Download presentation
Presentation is loading. Please wait.
Published byGabriel Hicks Modified over 8 years ago
1
Knowledge Repn. & Reasoning Lecture #9: Propositional Logic UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2005
2
Today Representation in Propositional Logic Semantics & Deduction Reasoning procedures for propositional logic –Proving entailment using Resolution –Checking Satisfiability (SAT) using DPLL
3
Representing Knowledge Propositional symbols represent facts under consideration: –there_is_rain, there_are_clouds, door1_open, robot_in_pos_56_210 Not propositions: –is_there_rain? –location_of_robot –Dan_Roth
4
Representing Knowledge Knowledge bases are sets of formulae –There_is_rain there_are_clouds –Robot_in_pos_3_1 Position_3_1_empty –Has_drink coffee tea
5
Knowledge Engineering Select a language: set of features Examine cases Decide on dependencies between features Write dependencies formally Test
6
Propositional Logic Semantics: –Truth assignments that satisfy KB/formula -a-b a -a b a b Interpretations: I 1 [a]=FALSE I 1 [b]=FALSE assign truth values to propositional symbols I1I1 I2I2 I3I3 I4I4
7
Propositional Logic Semantics: –Truth assignments that satisfy KB/formula b a b -a -b a -a ╨ Models of f: Interpretations that satisfy f I1I1 I2I2 M 1 = I 3 M 2 = I 4 M1M1
8
Propositional Logic Semantics: –Truth assignments that satisfy KB/formula ╨ M1M1 Logical Entailment ╨╨╨╨
9
Propositional Logic Semantics: –Truth assignments that satisfy KB/formula Logical Entailment ╨ ┴ Deduction (inference)
10
More Notations Interpretations ~ Models Axioms – formulae that are “assumed” Signature – the symbols used by a KB Theory ~ KB (a set of axioms), or Theory ~ the complete set of sentences entailed by the axioms Sentence = formula (in prop. logic)
11
More Notations The value that symbol p takes in model M: –[[ M ]] p –p M –M[p] -- we will primarily use this Clauses: {lit1, lit2, lit3,…} or lit1 lit2 lit3...
12
SAT via Generate and Test If we have a truth table of KB, then we can check that KB satisfiable by looking at it. Problem: n propositional symbols 2 n rows in truth table –Checking interpretation I takes time O(|KB|) –Generating table is expensive: O(2 n |KB|) time Observation: SAT requires us to look only for one model
13
Clausal Form Every formula can be reformulated into an equivalent CNF formula (conjunction of clauses). Examples (using De Morgan Laws): )(bb )(ab )(ba )(aa
14
Clausal Form Every formula can be reformulated into an equivalent CNF formula (conjunction of clauses). Examples:
15
Clausal Form Every formula can be reformulated into an equivalent CNF formula (conjunction of clauses). Examples:
16
Propagating a Truth-Value KB in CNF, and we observe p=TRUE Then, removing clauses with p positive from KB gives an equivalent theory. Example: KB Observe
17
Propagating a Truth-Value KB in CNF, and we observe p=TRUE Then, removing negative instances of p from KB gives an equivalent theory. Example: KB Observe
18
DPLL Search Procedure for CNF 1.If no clauses in KB, return T 2.If a clause in KB is empty (FALSE), return F 3.If KB has a unit clause C with prop. p, then return DPLL(KB,p←polarity(p,C)) 4.Choose an uninstantiated variable p 5.If DPLL(KB, p←TRUE) returns T, return T 6.If DPLL(KB, p←FALSE) returns T, return T 7.Return F
19
DPLL in Action On board
20
DPLL in Action On board Note: we could know without thorough checking that this KB is satisfiable
21
DPLL in Action On board
22
Related: SAT Solving Order of selection of variables (lecture #27) Stochastic local search (readings on website) Binary Decision Diagrams (readings on website) Strategies other than unit propagation (-||-) 2-SAT is solvable in linear time 3-XOR-SAT is solvable in O(n 3 ) time Smart backtracking (zchaff; readings on website) Clauses/Vars in Random SAT (read on website) SAT via probabilistic models (read on website)
23
Take a Breath Until now: SAT solving –Search in the space of models From now: Resolution theorem proving –Search in the space of proofs Later: Formal Verification
24
Resolution Theorem Proving Given: –KB – a set of propositional sentences –Query Q – a logical sentence Calling procedure: 1.Add Q to KB 2.Convert KB into clausal form 3.Run theorem prover. If we prove contradiction, return T. Otherwise, return F.
25
Resolution Theorem Proving 1.Add Q to KB 2.Convert KB into clausal form 3.Run theorem prover. If we prove contradiction, return T. Otherwise, return F. Deduction theorem: KB Q iff KB Q FALSE ╨╨
26
Resolution Theorem Proving 1.Add Q to KB 2.Convert KB into clausal form 3.Run theorem prover. If we prove contradiction, return T. Otherwise, return F. Deduction theorem: KB Q iff KB Q FALSE ╨╨
27
Propositional Resolution Resolution inference rule: C1: p1 C1’ C2: p1 C2’ -------------------- C3: C1’ C2’ C1 p1 C1’ C2 p1 C2’
28
Propositional Resolution Resolution algorithm (saturation): 1.While there are unresolved C1,C2: (1)Select C1, C2 in KB (2)If C1, C2 are resolvable, resolve them into a new clause C3 (3)Add C3 to KB (4)If C3={ } (empty clause), we got a contradiction. 2.STOP C1: p1 C1’ C2: p1 C2’ -------------------- C3: C1’ C2’
29
Resolution in Action On board Negated Query KB C1: p1 C1’ C2: p1 C2’ -------------------- C3: C1’ C2’
30
Resolution in Action On board C1: p1 C1’ C2: p1 C2’ -------------------- C3: C1’ C2’ Negated Query KB
31
Properties of Resolution Running time for n variables, m clauses: –Resolving two clauses: O(n) –Finding two resolvable clauses: O(1) –Overall algorithm: O(3 n n)
32
Properties of Resolution Theorem: Resolution is sound –Resolving clauses in KB generates valid consequences of KB Theorem: Resolution is refutation complete –Resolution of KB with Q yields the empty clause iff KB Q ╨
33
Properties of Resolution Resolution does not always generate Q KB = { {a,b}, { a,b}, {b,c} } Q = b c = {b, c} Theorem: Resolution always generates a clause that subsumes Q iff KB Q Example: Resolving KB generates b ╨
34
Simple Enhancements Remove subsumed clauses –{ p } subsumes { p, q } –{ p, q } subsumes { p, q, r } –{ p } does not subsume { p, q } Contract same literals –{ p, p, q } becomes { p, q } Unit resolution: resolve unit clauses first
35
Related to Prop. Resolution Clause selection for resolution (lecture 26) Consequence finding (if have time) Prime implicates/implicants (if have time)
36
Take a Breath SAT solving –Search in the space of models Until now: Resolution theorem proving –Search in the space of proofs Soundness & Completeness If we have time: Formal Verification
37
Soundness Prove soundness of resolution
38
Completeness Prove completeness of resolution
39
Resolution vs SAT SAT solvers can find models Resolution sometimes better at finding contradictions With resolution it is easier to explain and provide a proof
40
Summary So Far Finding models using DPLL Resolution theorem proving allows us to find contradictions and explanation. –The deduction theorem tells us how to ask queries from either SAT solvers or Resolution
41
Summary So Far Finding models using DPLL Resolution theorem proving allows us to find contradictions and explanation. –The deduction theorem tells us how to ask queries from either SAT solvers or Resolution
42
Application: Hardware Verification AND not AND f1f1 f2f2 f3f3 f4f4 f5f5 OR x1x1 x2x2 x3x3 f 5 (x 1,x 2,x 3 ) = a function of the input signal Question: Can we set this boolean cirtuit to TRUE?
43
Application: Hardware Verification AND not AND f1f1 f2f2 f3f3 f4f4 f5f5 OR x1x1 x2x2 x3x3 f 5 (x 1,x 2,x 3 ) = f 3 f 4 = f 1 (f 2 x 3 ) = (x 1 x 2 ) ( x 2 x 3 ) Question: Can we set this boolean cirtuit to TRUE? SAT(f 5 ) ? M[x 1 ]=FALSE M[x 2 ]=FALSE M[x 3 ]=FALSE
44
Hardware Verification Questions in logical circuit verification –Equivalence of circuits –Arrival of the circuit to a state (required a temporal model, which gets propositionalized) –Achieving an output from the circuit
45
Summary SAT checking using DPLL (instantiate, propagate, backtrack) Entailment/SAT checking using Resolution (create more and more clauses until KB is saturated) Formal verification uses mainly SAT checking such as DPLL, but also sometimes resolution
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.