Question: you need to use python 3 code and resolution method for below information Satisfiability for 2 - CNF will be your task for HW #

you need to use python3 code and resolution method for below information
Satisfiability for 2-CNF will be your task for
HW # 1.
The easy version is to check satisfiability
(using resolution method).
The full task is to check satisfiability and, if
the answer is yes, to return one of the
satisfying assignments. It is important to keep in mind that the
input is given in human-readable form, as
a string representing the formula. Conjunction, disjunction, negation, and
implication, are, resp., /\,\/, ~,->.
Literals: x or ~x, where x is an arbitrary
letter.
Clauses: (1\/2
) or (1->2
), where
1 and 2 are literals.
The CNF is a conjunction (/\) of clauses. First, one needs to translate the input into
a machine-digestable form (this is called
parsing of the input).
Grammar for CNFs:
CNF ::= Clause | CNF /\ Clause
Clause ::=(Lit \/ Lit)|(Lit -> Lit)
Lit ::= Var | ~Var use python3
The program (in Python) should implement
two functions:
1. is_satisfiable, which takes a CNF and
answers True or False, depending on
whether it is satisfiable.
2. sat_assignment, which takes a CNF and
returns a satisfying assignment as an
associative array:
{'x': True, 'y': False, 'z': True }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!