3/11/2002copyright brian williams1 propositional logic and satisfiability brian c. williams...
TRANSCRIPT
3/11/2002 copyright Brian Williams 1
Propositional Logic and Satisfiability
Brian C. Williams16.412/6.834 October 7th, 2002
3/11/2002 copyright Brian Williams 2
Reading Assignments: Propositional Logic
• AIMA Ch. 6 – Propositional Logic
3/11/2002 copyright Brian Williams 3
Outline
• Motivation• Propositional Logic
• Syntax• Semantics
• Propositional Satisfiability• Systematic methods• Characteristics of systematic search• Through local search
• Summary• Appendix: Reduction to Clausal Form
4copyright Brian Williams3/11/2002
How can Logic Help Us to Perform Diagnosis?
Helium tank
Fuel tankOxidizer tank
MainEngines
Flow1 = zeroPressure1 = nominal
Pressure2= nominal
Acceleration = zero
3/11/2002 copyright Brian Williams 5
Consistency-based Diagnosis
• Given:• Observations “no thrust”• Device schematic• Component models
• Specifies all correct and faulty modes• Constraints describe behavior of each mode.
• Find:• Component mode assignment that is consistent with
the Obs, Schematic & Models.
3/11/2002 copyright Brian Williams 6
• Candidate: Assignment to all component modes.
0
1
0
0
1
Or1
Or2
Or3
And1
And2
A
B
C
D
E
F
G
X
Y
Z
1And(i):• G(i):
Out(i) = In1(i) AND In2(i)
• U(i): 0
Diagnosis identifies consistent modes
Candidate = {G(And1) & G(And2) & G(Or1) & G(Or2) & G(Or3)}
3/11/2002 copyright Brian Williams 7
Diagnosis identifies consistent modes
AND(i):• G(i):
Out(i) = In1(i) AND In2(i)
• U(i):
• Candidate: Assignment to all component modes.• Diagnosis D: Candidate consistent with model Phi and
observables OBS.
3
2
2
3
3
Or1
Or3
And1
A
B
C
D
E
F
G
X
Y
Z
10
12
Diagnosis = {G(And1) & U(And2) & G(Or1) & G(Or2) & G(Or3)}
Or2
8copyright Brian Williams3/11/2002
How do we write down the constraints?
Helium tank
Fuel tankOxidizer tank
MainEngines
Flow1 = zeroPressure1 = nominal
Pressure2= nominal
Acceleration = zero
3/11/2002 copyright Brian Williams 9
What formal languages exist for describing constraints?
Logic:• Propositional logic truth of facts• First order logic facts,objects,relations• Temporal logic time, ….• Modal logics knowledge, belief
…• Probability ….
3/11/2002 copyright Brian Williams 10
Logic in General
• Logics• formal languages for representing information such
that conclusions can be drawn.
• Syntax • defines the sentences in the language.
• Semantics • define the “meaning” of sentences;
• i.e., truth of a sentence in a world.
3/11/2002 copyright Brian Williams 11
Outline
• Motivation
• Propositional Logic• Syntax• Semantics
• Propositional Satisfiability
• Summary
• Appendix: Reduction to Clausal Form
3/11/2002 copyright Brian Williams 12
Propositional Logic:Syntax• Proposition
• Statement that is true or false• (valve v1)• (= voltage high)
• Propositional sentence (S)• S ::= proposition |
• (NOT S) |
• (OR S1 ... Sn) |
• (AND S1 ... Sn)
• Defined Constructs• (implies S1 S2) => ((not S1) OR S2)
• (IFF S1 S2) => (AND (IMPLIES S1 S2)(IMPLIES S2 S1))
• . . .
3/11/2002 copyright Brian Williams 13
Engine Example: propositional logic sentence
(mode(E1) = ok implies
(thrust(E1) = on if and only if flow(V1) = on and flow(V2) = on)) and
(mode(E1) = ok or mode(E1) = unknown) and
not (mode(E1) = ok and mode(E1) = unknown)
E1
V1 V2
3/11/2002 copyright Brian Williams 14
Propositional Logic: SemanticsA model assigns true/false to every proposition symbol Pi
• A = True, B = False, C = False
The truth of sentence S is defined as a composition of boolean operators applied to the model (S, S1 and S2 are sentences):
• Not S is True iff S is False
• S1 and S2 is True iff S1 is True and S2 is True
• S1 or S2 is True iff S1 is True or S2 is True
• S1 implies S2 is True iff S1 is False or S2 is True
• S1 iff S2 is True iff S1 implies S2 is True
and S2 implies S1 is True
3/11/2002 copyright Brian Williams 15
Example: Determining the truth of a sentence
(mode(E1) = ok implies
[(thrust(E1) = on if and only if (flow(V1) = on and flow(V2) = on)) and
(mode(E1) = ok or mode(E1) = unknown) and
not (mode(E1) = ok and mode(E1) = unknown)])
Model:
mode(E1) = ok is True
thrust(E1) = on is False
flow(V1) = on is True
flow(V2) = on is False
mode(E1) = unknown is False
3/11/2002 copyright Brian Williams 16
Example: Determining the truth of a sentence
(True implies
[(thrust(E1) = on if and only if (flow(V1) = on and flow(V2) = on)) and
(True or mode(E1) = unknown) and
not (True and mode(E1) = unknown)])
Model:
mode(E1) = ok is True
thrust(E1) = on is False
flow(V1) = on is True
flow(V2) = on is False
mode(E1) = unknown is False
3/11/2002 copyright Brian Williams 17
Example: Determining the truth of a sentence
(True implies
[(False if and only if (True and False)) and
(True or False) and
not (True and False)])
Model:
mode(E1) = ok is True
thrust(E1) = on is False
flow(V1) = on is True
flow(V2) = on is False
mode(E1) = unknown is False
3/11/2002 copyright Brian Williams 18
Example: Determining the truth of a sentence
(True implies
[(False if and only if (True and False)) and
(True or False) and
not (True and False)])
Model:
mode(E1) = ok is True
thrust(E1) = on is False
flow(V1) = on is True
flow(V2) = on is False
mode(E1) = unknown is False
3/11/2002 copyright Brian Williams 19
Example: Determining the truth of a sentence
(True implies
[(False if and only if (True and False)) and
(True or False) and
not False])
Model:
mode(E1) = ok is True
thrust(E1) = on is False
flow(V1) = on is True
flow(V2) = on is False
mode(E1) = unknown is False
3/11/2002 copyright Brian Williams 20
Example: Determining the truth of a sentence
(True implies
[(False if and only if (True and False)) and
(True or False) and
True])
Model:
mode(E1) = ok is True
thrust(E1) = on is False
flow(V1) = on is True
flow(V2) = on is False
mode(E1) = unknown is False
3/11/2002 copyright Brian Williams 21
Example: Determining the truth of a sentence
(True implies
[(False if and only if False) and
True and
True])
Model:
mode(E1) = ok is True
thrust(E1) = on is False
flow(V1) = on is True
flow(V2) = on is False
mode(E1) = unknown is False
3/11/2002 copyright Brian Williams 22
Example: Determining the truth of a sentence
(True implies
[(False if and only if False) and
True and
True])
Model:
mode(E1) = ok is True
thrust(E1) = on is False
flow(V1) = on is True
flow(V2) = on is False
mode(E1) = unknown is False
3/11/2002 copyright Brian Williams 23
Example: Determining the truth of a sentence
(True implies
[(False implies False ) and (False implies False )) and
True and
True])
Model:
mode(E1) = ok is True
thrust(E1) = on is False
flow(V1) = on is True
flow(V2) = on is False
mode(E1) = unknown is False
3/11/2002 copyright Brian Williams 24
Example: Determining the truth of a sentence
(True implies
[(not False or False ) and (not False or False )) and
True and
True])
Model:
mode(E1) = ok is True
thrust(E1) = on is False
flow(V1) = on is True
flow(V2) = on is False
mode(E1) = unknown is False
3/11/2002 copyright Brian Williams 25
Example: Determining the truth of a sentence
(True implies
[(True or False ) and (True or False )) and
True and
True])
Model:
mode(E1) = ok is True
thrust(E1) = on is False
flow(V1) = on is True
flow(V2) = on is False
mode(E1) = unknown is False
3/11/2002 copyright Brian Williams 26
Example: Determining the truth of a sentence
(True implies
[(True and True) and
True and
True])
Model:
mode(E1) = ok is True
thrust(E1) = on is False
flow(V1) = on is True
flow(V2) = on is False
mode(E1) = unknown is False
3/11/2002 copyright Brian Williams 27
Example: Determining the truth of a sentence
(True implies
[True and
True and
True])
Model:
mode(E1) = ok is True
thrust(E1) = on is False
flow(V1) = on is True
flow(V2) = on is False
mode(E1) = unknown is False
3/11/2002 copyright Brian Williams 28
Example: Determining the truth of a sentence
(True implies
True)
Model:
mode(E1) = ok is True
thrust(E1) = on is False
flow(V1) = on is True
flow(V2) = on is False
mode(E1) = unknown is False
3/11/2002 copyright Brian Williams 29
Example: Determining the truth of a sentence
(not True or
True)
Model:
mode(E1) = ok is True
thrust(E1) = on is False
flow(V1) = on is True
flow(V2) = on is False
mode(E1) = unknown is False
3/11/2002 copyright Brian Williams 30
Example: Determining the truth of a sentence
(False or
True)
Model:
mode(E1) = ok is True
thrust(E1) = on is False
flow(V1) = on is True
flow(V2) = on is False
mode(E1) = unknown is False
3/11/2002 copyright Brian Williams 31
Example: Determining the truth of a sentence
True!
Model:
mode(E1) = ok is True
thrust(E1) = on is False
flow(V1) = on is True
flow(V2) = on is False
mode(E1) = unknown is False
3/11/2002 copyright Brian Williams 32
Outline
• Motivation• Propositional Logic
• Syntax• Semantics
• Propositional Satisfiability• Clausal Form• Systematic methods• Characteristics of systematic search• Through local search
• Summary• Appendix: Reduction to Clausal Form
3/11/2002 copyright Brian Williams 33
Propositional SatisfiabilityPropositional Satisfiability
Find a model M that satisfies sentence T (called a theory):
• Reduce sentence T to clausal form.• Perform search similar to Forward Checking
Propositional satisfiability testing: 1990: 100 variables / 200 clauses (constraints) 1998: 10,000 - 100,000 vars / 10^6 clauses Novel applications: e.g. diagnosis, planning, software / circuit testing, machine learning, and protein folding
3/11/2002 copyright Brian Williams 34
Propositional Clauses:A Simpler Form
• Literal: proposition or its negation• B, Not A
• Clause: disjunction of literals• (not A or B or E)
• Conjunctive Normal Form• Phi = (A or B or C) and
(not A or B or E) and (not B or C or D)
• Viewed as a set of clauses
3/11/2002 copyright Brian Williams 35
Engine Example: Clausal Model
(mode(E1) = ok implies
(thrust(E1) = on iff flow(V1) = on and flow(V2) = on)) and
(mode(E1) = ok or mode(E1) = unknown) and
not (mode(E1) = ok and mode(E1) = unknown)
not (mode(E1) = ok) or not (thrust(E1) = on) or flow(V1) = on;
not (mode(E1) = ok) or not (thrust(E1) = on) or flow(V2) = on;
not (mode(E1) = ok) or not (flow(V1) = on) or
not (flow(V2) = on) or thrust(E1) = on;
mode(E1) = ok or mode(E1) = unknown;
not (mode(E1) = ok) or not (mode(E1) = unknown);
3/11/2002 copyright Brian Williams 36
Outline
• Propositional Satisfiability• Clausal form• Systematic methods
• Backtrack Search• Deduction by Resolution• DPLL: Combining search and deduction • Characteristics of DPLL
• local search using GSAT
• Summary• Appendix: Reduction to Clausal Form
3/11/2002 copyright Brian Williams 37
Propositional Satisfiability by Enumeration
• Assign true or false to an unassigned proposition.
• Backtrack as soon as a clause is violated.
Example:• C1: Not A or B• C2: Not C or A• C3: Not B or C
A
F T
BF T
C
F T
C
F T
BF T
C C
F TF T
3/11/2002 copyright Brian Williams 38
Backtrack Search Procedure
BT(phi,A)
Input: A cnf theory phi, an assignment A to propositions in phi
Output: A decision of whether phi is satisfiable.
1. If a clause is violated return(false);
2. Else if all propositions are assigned return(true);
3. Else Q = some unassigned proposition in phi;
4. Return (BT(phi, A[Q = True]) or
5. BT(phi, A[Q = False])
3/11/2002 copyright Brian Williams 39
Outline
• Propositional Satisfiability• Clausal form• Systematic methods
• Backtrack Search• Deduction by Resolution• DPLL: Combining search and deduction • Characteristics of DPLL
• local search using GSAT
• Summary• Appendix: Reduction to Clausal Form
3/11/2002 copyright Brian Williams 40
Inference: Resolution on Clauses
or B, not B or or
Example: Checking Satisfiability of C1 – C4:• C1: A• C2: Not A or B• C3: Not B or C• C4: Not C or Not A• C5: Not A or C Resolving C2 and C3 using B• C6: C Resolving C1 and C5 using A• C7: Not A Resolving C6 and C4 using C• C8: False Resolving C7 and C1 using A
3/11/2002 copyright Brian Williams 41
Outline
• Propositional Satisfiability• Clausal form• Systematic methods
• Backtrack Search• Deduction by Resolution• DPLL: Combining search and deduction • Characteristics of DPLL
• local search using GSAT
• Summary• Appendix: Reduction to Clausal Form
3/11/2002 copyright Brian Williams 42
How Do We Combine Resolution and Back Track Search?Backtrack Search• Assign true or false to an
unassigned proposition.• Backtrack as soon as a clause
is violated.• Satisfiable if assignment is
complete.
Example:• C1: Not A or B• C2: Not C or A• C3: Not B or C
A
F T
BF T
C
F T
C
F T
BF T
C C
F TF T
Similar to Forward Checking: Perform limited form of inference apply inference rule after assigning each variable.
3/11/2002 copyright Brian Williams 43
Perform limited inference:Unit Clause Resolution
Idea: Conclude propositions, not disjunctive clauses
• Unit clause: a clause with a single literal.
• Not A
• Unit resolution: resolution with unit clauses:• not A (A or B or C)
(B or C)
• Unit propagation: unit resolve until only a unit clause is left:
• (not A) (not B) (A or B or C)
C
3/11/2002 copyright Brian Williams 44
Unit Propagation Examples
• C1: Not A or B• C2: Not C or A• C3: Not B or C• C4: A
C4A
TrueC1
B
TrueC3
C
True
Satisfied
Satisfied
Satisfied
Satisfied
3/11/2002 copyright Brian Williams 45
Unit Propagation Examples
• C1: Not A or B• C2: Not C or A• C3: Not B or C• C4: A
• C4’: Not B
C1 C3C4
C1 C2C4’
A
True
B
True
C
True
A
False
B
False
C
False
C4A
True
Satisfied
Satisfied
Satisfied
Satisfied
3/11/2002 copyright Brian Williams 46
C1 : ¬r q pC2: ¬ p ¬ t
r
true
q
false
p
t
procedure propagate(C) // C is a clause
if all literals in C are false except l, and l is unassigned
then assign true to l and
record C as a support for l and
for each clause C’ mentioning “not l”,
propagate(C’)
end propagate
Unit Propagation
3/11/2002 copyright Brian Williams 47
C1 : ¬r q pC2: ¬ p ¬ t
r
true
q
false
p
t
procedure propagate(C) // C is a clause
if all literals in C are false except l, and l is unassigned
then assign true to l and
record C as a support for l and
for each clause C’ mentioning “not l”,
propagate(C’)
end propagate
Unit Propagation
3/11/2002 copyright Brian Williams 48
C1 : ¬r q p
r q
p
C2: ¬ p ¬ t
true false
true
t
procedure propagate(C) // C is a clause
if all literals in C are false except l, and l is unassigned
then assign true to l and
record C as a support for l and
for each clause C’ mentioning “not l”,
propagate(C’)
end propagate
Unit Propagation
3/11/2002 copyright Brian Williams 49
C1 : ¬r q p
r q
p
C2: ¬ p ¬ t
true false
true
t
procedure propagate(C) // C is a clause
if all literals in C are false except l, and l is unassigned
then assign true to l and
record C as a support for l and
for each clause C’ mentioning “not l”,
propagate(C’)
end propagate
Unit Propagation
3/11/2002 copyright Brian Williams 50
r q
p
true false
true
procedure propagate(C) // C is a clause
if all literals in C are false except l, and l is unassigned
then assign true to l and
record C as a support for l and
for each clause C’ mentioning “not l”,
propagate(C’)
end propagate
C2: ¬ p ¬ t
t
C1 : ¬r q p
Unit Propagation
3/11/2002 copyright Brian Williams 51
r q
p
C2: ¬ p ¬ t
true false
true
tfalse
procedure propagate(C) // C is a clause
if all literals in C are false except l, and l is unassigned
then assign true to l and
record C as a support for l and
for each clause C’ mentioning “not l”,
propagate(C’)
end propagate
C1 : ¬r q p
Unit Propagation
3/11/2002 copyright Brian Williams 52
Propositional Satisfiability by DPLL
Initially:• Unit propagate.
Repeat:• Assign true or false to an
unassigned proposition.• Unit propagate.• Backtrack as soon as a
clause is violated.• Satisfiable if assignment
is complete.
Propagate:C = FB = FA = F
A
F TPropagate:B = TC = TA = T
Example:• C1: Not A or B• C2: Not C or A• C3: Not B or C
3/11/2002 copyright Brian Williams 53
DPLL Procedure[Davis, Putnam Logmann, Loveland, 1962]
DPLL(phi,A) Input: A cnf theory phi, an assignment A to propositions in
phiOutput: A decision of whether phi is satisfiable.1. propagate(phi);2. If a clause is violated return(false);3. Else if all propositions are assigned return(true);4. Else Q = some unassigned proposition in phi;6. Return (DPLL(phi, A[Q = True]) or 7. DPLL(phi, A[Q = False])
3/11/2002 copyright Brian Williams 54
Outline
• Motivation• Propositional Logic• Propositional Satisfiability
• Systematic methods• Characteristics of systematic search• Through local search
• Summary• Appendix: Reduction to Clausal Form
3/11/2002 copyright Brian Williams 55
Hardness of 3SAT
02 3 4 5
Ratio of Clauses-to-Variables
6 7 8
1000
3000
DP
Calls
2000
4000
50 var 40 var 20 var
3/11/2002 copyright Brian Williams 56
The 4.3 Point
0.02 3 4 5
Ratio of Clauses-to-Variables
6 7 8
0.2
0.6
Pro
bab
ilit
yD
P C
alls
0.4
50 var 40 var 20 var
50% sat
Mitchell, Selman, and Levesque 1991
0.8
1.0
0
1000
3000
2000
4000
3/11/2002 copyright Brian Williams 57
3/11/2002 copyright Brian Williams 58
Intuition
• At low ratios:• few clauses (constraints)• many assignments• easily found
• At high ratios:• many clauses• inconsistencies easily detected
3/11/2002 copyright Brian Williams 60
Phase transition 2-, 3-, 4-, 5-, and 6-SATPhase transition 2-, 3-, 4-, 5-, and 6-SAT
3/11/2002 copyright Brian Williams 61
Outline
• Motivation• Propositional Logic• Propositional Satisfiability
• Systematic methods• Characteristics of systematic search• Through local search
• Summary• Appendix: Reduction to Clausal Form
3/11/2002 copyright Brian Williams 62
GSAT Example
• C1: Not A or B• C2: Not C or Not A• C3: or B or Not C
C1, C2, C3 violated A
True
B
False
C
True
C3 violated
False
C2 violated
True
C1 violated
False
1. Pick random assignment
2. Check effect of flipping each assignment, counting violated clauses
3. Pick assignment with fewest violations.
3/11/2002 copyright Brian Williams 63
GSAT Example
• C1: Not A or B• C2: Not C or Not A• C3: or B or Not C
C1 violated A
True
B
False
C
False
Satisfied
False
Satisfied
True
C1,C2,C3 violated
True
1. Pick random assignment
2. Check effect of flipping each assignment, counting violated clauses
3. Pick assignment with fewest violations.
3/11/2002 copyright Brian Williams 64
GSAT Example
• C1: Not A or B• C2: Not C or Not A• C3: or B or Not C
Satisfied A
True
B
True
C
False
1. Pick random assignment
2. Check effect of flipping each assignment, counting violated clauses
3. Pick assignment with fewest violations.
3/11/2002 copyright Brian Williams 65
Outline
• Motivation• Propositional Logic• Propositional Satisfiability
• Systematic methods• Characteristics of systematic search• Through local search
• Summary• Appendix: Reduction to Clausal Form
3/11/2002 copyright Brian Williams 66
Satisfiability Testing ProceduresSatisfiability Testing Procedures
• Reduce to CNF (Clausal Form) then:• Systematic, complete procedures
• Depth-first backtrack search (Davis, Putnam, & Loveland 1961)
• unit propagation, shortest clause heuristic• State-of-the-art implementations:
• ntab (Crawford & Auton 1997)• itms (Nayak & Williams 1997)
• many others! See SATLIB 1998 / Hoos & Stutzle
• Stochastic, incomplete procedures• GSAT (Selman et. al 1993)
• Walksat (Selman & Kautz 1993)
• greedy local search + noise to escape local minima
3/11/2002 copyright Brian Williams 67
SummaryLogical agents apply inference to a knowledge base to derive new information
and make decisions.
Basic concepts in logic
• Syntax: formal structure of sentences.
• Semantics: truth of sentence wrt models.
• Entailment: necessary truth of a sentence given another.
• Inference: deriving sentences from others.
• Soundness: derivations produce only entailed sentences.
• Completeness: derivations can produce all entailed sentences.
• Enumeration, Resolution, DPLL and DPLL+TMS are sound and complete methods for propositional logic.
• Local repair methods (e.g., GSAT) are sound but incomplete.
3/11/2002 copyright Brian Williams 68
Appendix: Reduction to Clauses
Note: You are responsible for reading this material
3/11/2002 copyright Brian Williams 69
Engine Example: Mapping to a Clausal Model
(mode(E1) = ok implies
(thrust(E1) = on iff flow(V1) = on and flow(V2) = on)) and
(mode(E1) = ok or mode(E1) = unknown) and
not (mode(E1) = ok and mode(E1) = unknown)
not (mode(E1) = ok) or not (thrust(E1) = on) or flow(V1) = on;
not (mode(E1) = ok) or not (thrust(E1) = on) or flow(V2) = on;
not (mode(E1) = ok) or not (flow(V1) = on) or
not (flow(V2) = on) or thrust(E1) = on;
mode(E1) = ok or mode(E1) = unknown;
not (mode(E1) = ok) or not (mode(E1) = unknown);
3/11/2002 copyright Brian Williams 70
Reducing Propositional Formula to Clauses (CNF)
• Eliminate IFF and Implies
• E1 iff E2 => (E1 implies E2) and (E2 implies E1)
• E1 implies E2 => not E1 or E2
3/11/2002 copyright Brian Williams 71
Engine Example: Eliminate IFF
(mode(E1) = ok implies
(thrust(E1) = on iff (flow(V1) = on and flow(V2) = on))) and
(mode(E1) = ok or mode(E1) = unknown) and
not (mode(E1) = ok and mode(E1) = unknown)
3/11/2002 copyright Brian Williams 72
Engine Example: Eliminate IFF
(mode(E1) = ok implies
(thrust(E1) = on iff (flow(V1) = on and flow(V2) = on))) and
(mode(E1) = ok or mode(E1) = unknown) and
not (mode(E1) = ok and mode(E1) = unknown)
(mode(E1) = ok implies
((thrust(E1) = on implies (flow(V1) = on and flow(V2) = on)) and
((flow(V1) = on and flow(V2) = on) implies thrust(E1) = on))) and
(mode(E1) = ok or mode(E1) = unknown) and
not (mode(E1) = ok and mode(E1) = unknown)
3/11/2002 copyright Brian Williams 73
Engine Example: Eliminate Implies
(mode(E1) = ok implies
((thrust(E1) = on implies (flow(V1) = on and flow(V2) = on)) and
((flow(V1) = on and flow(V2) = on) implies thrust(E1) = on))) and
(mode(E1) = ok or mode(E1) = unknown) and
not (mode(E1) = ok and mode(E1) = unknown)
3/11/2002 copyright Brian Williams 74
Engine Example: Eliminate Implies
(mode(E1) = ok implies ((thrust(E1) = on implies (flow(V1) = on and flow(V2) = on)) and ((flow(V1) = on and flow(V2) = on) implies thrust(E1) = on))) and(mode(E1) = ok or mode(E1) = unknown) andnot (mode(E1) = ok and mode(E1) = unknown)
(not (mode(E1) = ok) or ((not (thrust(E1) = on) or (flow(V1) = on and flow(V2) = on)) and (not (flow(V1) = on and flow(V2) = on)) or thrust(E1) = on))) and(mode(E1) = ok or mode(E1) = unknown) andnot (mode(E1) = ok and mode(E1) = unknown)
3/11/2002 copyright Brian Williams 75
Reducing Propositional Formula to Clauses (CNF)
• Move negations in to propositions (De Morgan)
• Not (E1 and E2) => (not E1) or (not E2)
• Not (E1 or E2) => (not E1) and (not E2)
• Not (not E1) => E1
3/11/2002 copyright Brian Williams 76
Engine Example: Move Negations In
(not (mode(E1) = ok) or
((not (thrust(E1) = on) or (flow(V1) = on and flow(V2) = on)) and
(not (flow(V1) = on and flow(V2) = on)) or thrust(E1) = on))) and
(mode(E1) = ok or mode(E1) = unknown) and
not (mode(E1) = ok and mode(E1) = unknown)
3/11/2002 copyright Brian Williams 77
Engine Example: Move Negations In
(not (mode(E1) = ok) or ((not (thrust(E1) = on) or (flow(V1) = on and flow(V2) = on)) and (not (flow(V1) = on and flow(V2) = on)) or thrust(E1) = on))) and(mode(E1) = ok or mode(E1) = unknown) andnot (mode(E1) = ok and mode(E1) = unknown)
(not (mode(E1) = ok) or ((not (thrust(E1) = on) or (flow(V1) = on and flow(V2) = on)) and (not (flow(V1) = on) or not (flow(V2) = on)) or thrust(E1) = on) ) and(mode(E1) = ok or mode(E1) = unknown) and(not (mode(E1) = ok) or not (mode(E1) = unknown)))
3/11/2002 copyright Brian Williams 78
Reducing Propositional Formula to Clauses (CNF)
• Move conjunction out (Distribution)• E1 or (E2 and E3) =>(E1 or E2) and (E1 or E3)
3/11/2002 copyright Brian Williams 79
Engine Example: Move Conjunctions Out
(not (mode(E1) = ok) or
((not (thrust(E1) = on) or (flow(V1) = on and flow(V2) = on)) and
(not (flow(V1) = on) or not (flow(V2) = on) or thrust(E1) = on))) and
(mode(E1) = ok or mode(E1) = unknown) and
(not (mode(E1) = ok) or not (mode(E1) = unknown))
3/11/2002 copyright Brian Williams 80
Engine Example: Move Conjunctions Out
(not (mode(E1) = ok) or ((not (thrust(E1) = on) or (flow(V1) = on and flow(V2) = on)) and (not (flow(V1) = on) or not (flow(V2) = on) or thrust(E1) = on))) and(mode(E1) = ok or mode(E1) = unknown) and(not (mode(E1) = ok) or not (mode(E1) = unknown))
(not (mode(E1) = ok) or (((not (thrust(E1) = on) or flow(V1) = on) and (not (thrust(E1) = on) or flow(V2) = on)) and (not (flow(V1) = on) or not (flow(V2) = on) or thrust(E1) = on))) and(mode(E1) = ok or mode(E1) = unknown) and(not (mode(E1) = ok) or not (mode(E1) = unknown))
3/11/2002 copyright Brian Williams 81
Engine Example: Move Conjunctions Out
(not (mode(E1) = ok) or
(((not (thrust(E1) = on) or flow(V1) = on) and
(not (thrust(E1) = on) or flow(V2) = on)) and
(not (flow(V1) = on) or not (flow(V2) = on) or thrust(E1) = on))) and
(mode(E1) = ok or mode(E1) = unknown) and
(not (mode(E1) = ok) or not (mode(E1) = unknown))
3/11/2002 copyright Brian Williams 82
Engine Example: Move Conjunctions Out
(not (mode(E1) = ok) or (((not (thrust(E1) = on) or flow(V1) = on) and (not (thrust(E1) = on) or flow(V2) = on)) and (not (flow(V1) = on) or not (flow(V2) = on) or thrust(E1) = on))) and(mode(E1) = ok or mode(E1) = unknown) and(not (mode(E1) = ok) or not (mode(E1) = unknown))
(not (mode(E1) = ok) or not (thrust(E1) = on) or flow(V1) = on) and (not (mode(E1) = ok) or not (thrust(E1) = on) or flow(V2) = on)) and (not (mode(E1) = ok) or not (flow(V1) = on) or not (flow(V2) = on) or thrust(E1) = on) and(mode(E1) = ok or mode(E1) = unknown) and(not (mode(E1) = ok) or not (mode(E1) = unknown))