Answered step by step
Verified Expert Solution
Question
1 Approved Answer
YOUR ANSWER HERE SAT problems are represented by noting down ( a ) the number of variables , ( b ) the number of clauses
YOUR ANSWER HERE
SAT problems are represented by noting down a the number of variables
b the number of clauses
and c for each clause, the list of literals variables or their negations
We will use a data structure in python that has the following fields:
n: the number of variables.
clauses : a list of clauses ccm
Each clause ci is itself a list ci: l l lk wherein li is a positive number between to n representing the variable
OR a negative number between n and representing the literal
Example
Let's revisit the problem from previous example. It is represented as
n
clauses
We have provided a datastructure called SATInstance. Your goal is to complete the function evaluate that inputs a partial truth assignment: a dictionary that maps variable numbers from n inclusive to truefalse If a variable is unmapped then it is not assigned to either value.
evaluate should return if the partial truth assignment already violates a clause.
evaluate should return if the partial truth assignment neither violates nor satisfies the formula.
evaluate should return if the partial truth assignment satisfies each and every clause in the formula.
Example
Revisiting the example above, let us take the partial assignment true
It leaves
unassigned.
Under this assignment:
The clause
is true since
is true.
The clause
is true since
is true.
The clause
is unresolved since
is false and we do not know what
or
are.
Therefore your function evaluate must return
since at least one clause is unresolved and remaining clauses are all true.
Example
Revisiting the example above, let us take the partial assignment truefalse
It leaves
unassigned. Under this assignment:
The clause
is true since
is true.
The clause
is true since
is true.
The clause
is true because
is false and the clause has
Since all clauses are true, the formula is already satisfied even though we do not know at
are. evaluate must return for this formula and partial truth assignment.
Example
Revisiting the example above, let us take the partial assignment truetruetrue
It leaves
unassigned. Under this assignment:
The clause
is true since
is true.
The clause
is true since
is true.
The clause
is false since
x x$ are true.
Since at least one clause is false, the formula is already violated even though we do not know what
is evaluate must return for this formula and partial truth assignment.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started