Download presentation
Presentation is loading. Please wait.
1
S P Vimal, Department of CSIS, BITS, Pilani
2
Agenda A quick review of syntax & semantics
2 A quick review of syntax & semantics Entailment in Propositional Logic Discussion EA C461 Artificial Intelligence
3
Review: Propositional logic: Syntax
3 Propositional logic is the simplest logic Atomic sentence : A Propositional symbol (written in upper case, just for notational convenience) W1,3 – Wumpus is in room (1,3) True / False Syntax semantics entailment discussion EA C461 Artificial Intelligence
4
Review: Propositional logic: Syntax
4 If S is a sentence, S is a sentence (negation) If S1 and S2 are sentences, (S1 S2)is a sentence (conjunction) If S1 and S2 are sentences, ( S1 S2) is a sentence (disjunction) If S1 and S2 are sentences, (S1 S2) is a sentence (implication) If S1 and S2 are sentences, (S1 S2) is a sentence (biconditional) Precedence , , , , EA C461 Artificial Intelligence
5
Semantics Defines the rules for defining the truth of a sentence w.r.t a particular model. Let the sentence in the KB make use of the proposition symbols P12,P22,P31. One possible model is m1 = {P12=true,P22=false,P31=true} With these symbols, 8 possible models, can be enumerated automatically. Rules for evaluating truth with respect to a model m: S is true iff S is false S1 S2 is true iff S1 is true and S2 is true S1 S2 is true iff S1is true or S2 is true S1 S2 is true iff S1 is false or S2 is true i.e., is false iff S1 is true and S2 is false S1 S2 is true iff S1S2 is true and S2S1 is true
6
Review: Truth tables for connectives
6 EA C461 Artificial Intelligence
7
Wumpus world sentences
7 Assume a wumpus world without wumpus (??) Let Pi,j be true if there is a pit in [i, j]. Let Bi,j be true if there is a breeze in [i, j]. R1: P1,1 "Pits cause breezes in adjacent squares" R2: B1,1 (P1,2 P2,1) R3: B2,1 (P1,1 P2,2 P3,1) R4: B1,1 R5: B2,1 EA C461 Artificial Intelligence
8
Truth tables for inference
8 EA C461 Artificial Intelligence
9
Inference by enumeration
9 Depth-first enumeration of all models is sound and complete For n symbols, time complexity is O(2n), space complexity is O(n) EA C461 Artificial Intelligence
10
Equivalence Two sentences α and β are equivalent, if they are true in the same set of models, which is written as α <=> β In other words, α ≡ β if and only if α ╞ β and β ╞ α
11
Validity A sentence is valid, if it is true in all models
Example : P V ר P Tautologies Deduction theorem: For any sentence α and β, α ╞ β if and only if (α ╞ β ) valid Now, What is inference? Rephrase in terms of Deduction Theorem? All you do is to check the validity of KB╞ α Conversely??? Conversely, every valid implication represents an inference.
12
Satisfiablity A sentence is satisfiable if it is true in some model.
If a sentence α is true in model m, then m satisfies α, or we say m is the model of α. How do you verify if a sentence is satisfiable? Enumerate the possible models, until one is found to satisfy. Many problems in Computer Science can be reduced to a satisfiablity problems Ex. CSP is all about verifying if the constraints are satisfiable by some assignments
13
Connection between Validity and Satisfiablity
α is valid iff רα is not satisfiable How do we use this observation for ‘entailment’? Let us phrase it this way α╞ β if and only if the sentence (α Λ רβ ) is not satisfiable. Reduction to an absurd thing / Proof by refutation / Proof by contradiction
14
Proof methods Proof methods divide into (roughly) two kinds:
14 Proof methods divide into (roughly) two kinds: Application of inference rules Legitimate (sound) generation of new sentences from old Proof = a sequence of inference rule applications Can use inference rules as operators in a standard search algorithm Typically require transformation of sentences into a normal form Model checking truth table enumeration (always exponential in n) improved backtracking, e.g., Davis--Putnam-Logemann-Loveland (DPLL) heuristic search in model space (sound but incomplete) e.g., min-conflicts-like hill-climbing algorithms EA C461 Artificial Intelligence
15
A property Monotonicity
15 Monotonicity Set of entailed sentences can only increase as information is added to the knowledge base. If KB╞ β then KB Λ α╞ β Inference rules can be applied whenever suitable premises are found in the Knowledge base. EA C461 Artificial Intelligence 15
16
li … li-1 li+1 … lk m1 … mj-1 mj+1 ... mn
Resolution 16 Conjunctive Normal Form (CNF) conjunction of disjunctions of literals clauses E.g., (A B) (B C D) Resolution inference rule (for CNF): li … lk, m1 … mn li … li-1 li+1 … lk m1 … mj-1 mj+1 ... mn where li and mj are complementary literals. E.g., P1,3 P2,2, P2,2 P1,3 Resolution is sound and complete for propositional logic EA C461 Artificial Intelligence
17
Resolution algorithm 17 Proof by contradiction, i.e., show KBα unsatisfiable EA C461 Artificial Intelligence
18
Resolution example KB = (B1,1 (P1,2 P2,1)) B1,1 α = P1,2
18 KB = (B1,1 (P1,2 P2,1)) B1,1 α = P1,2 EA C461 Artificial Intelligence
19
Completeness of Resolution
19 Resolution Closure (RC) RC(S) – set of clauses derivable by repeated application of resolution rule to clauses in S or their derivatives RC(S) must be finite Completeness is entailed by “Ground Resolution Theorem” “If a set of clauses is unsatisfiable, then the resolution closure of those clauses contains the empty clause ” EA C461 Artificial Intelligence
20
Contd… 20 Any complete search algorithm, applying only resolution can derive any conclusion entailed by any knowledge base in propositional logic This is true only in restricted sense Resolution can always be used to either confirm or refute a sentence Resolution cannot be used to enumerate entailed sentences Refutation completeness EA C461 Artificial Intelligence
21
Forward and backward chaining
21 Horn Form (restricted) KB = conjunction of Horn clauses Horn clause = proposition symbol; or (conjunction of symbols) symbol E.g., C (B A) (C D B) Modus Ponens (for Horn Form): complete for Horn KBs α1, … ,αn, α1 … αn β β Can be used with forward chaining or backward chaining. These algorithms are very natural and run in linear time EA C461 Artificial Intelligence
22
Forward chaining 22 Idea: fire any rule whose premises are satisfied in the KB, add its conclusion to the KB, until query is found EA C461 Artificial Intelligence
23
Forward chaining algorithm
23 Forward chaining is sound and complete for Horn KB EA C461 Artificial Intelligence
24
Forward chaining example
24 EA C461 Artificial Intelligence
25
Forward chaining example
25 EA C461 Artificial Intelligence
26
Forward chaining example
26 EA C461 Artificial Intelligence
27
Forward chaining example
27 EA C461 Artificial Intelligence
28
Forward chaining example
28 EA C461 Artificial Intelligence
29
Forward chaining example
29 EA C461 Artificial Intelligence
30
Forward chaining example
30 EA C461 Artificial Intelligence
31
Forward chaining example
31 EA C461 Artificial Intelligence
32
Proof of completeness 32 FC derives every atomic sentence that is entailed by KB FC reaches a fixed point where no new atomic sentences are derived Consider the final state as a model m, assigning true/false to symbols Every clause in the original KB is true in m a1 … ak b Hence m is a model of KB If KB╞ q, q is true in every model of KB, including m EA C461 Artificial Intelligence
33
Backward chaining EA C461 Artificial Intelligence 33
Idea: work backwards from the query q: to prove q by BC, check if q is known already, or prove by BC all premises of some rule concluding q Avoid loops: check if new subgoal is already on the goal stack Avoid repeated work: check if new subgoal has already been proved true, or has already failed EA C461 Artificial Intelligence
34
Backward chaining example
34 EA C461 Artificial Intelligence
35
Backward chaining example
35 EA C461 Artificial Intelligence
36
Backward chaining example
36 EA C461 Artificial Intelligence
37
Backward chaining example
37 EA C461 Artificial Intelligence
38
Backward chaining example
38 EA C461 Artificial Intelligence
39
Backward chaining example
39 EA C461 Artificial Intelligence
40
Backward chaining example
40 EA C461 Artificial Intelligence
41
Backward chaining example
41 EA C461 Artificial Intelligence
42
Backward chaining example
42 EA C461 Artificial Intelligence
43
Backward chaining example
43 EA C461 Artificial Intelligence
44
Forward vs. backward chaining
44 FC is data-driven, automatic, unconscious processing, e.g., object recognition, routine decisions May do lots of work that is irrelevant to the goal BC is goal-driven, appropriate for problem-solving, e.g., Where are my keys? How do I get into a PhD program? Complexity of BC can be much less than linear in size of KB EA C461 Artificial Intelligence
45
Refining model checking
Algorithms checks satisfiability The connection between finding a solution to a CSP and finding satisfying model for a logical sentence implies the existence of backtracking algorithm DPLL (Davis, Putnam, Logemann & Loveland)
46
The DPLL algorithm 46 Determine if an input propositional logic sentence (in CNF) is satisfiable. Improvements over truth table enumeration: Early termination A clause is true if any literal is true. A sentence is false if any clause is false. Pure symbol heuristic Pure symbol: always appears with the same "sign" in all clauses. e.g., In the three clauses (A B), (B C), (C A), A and B are pure, C is impure. Make a pure symbol literal true. Unit clause heuristic Unit clause: only one literal in the clause The only literal in a unit clause must be true. EA C461 Artificial Intelligence
47
The DPLL algorithm 47 EA C461 Artificial Intelligence
48
The WalkSAT algorithm Incomplete, local search algorithm
48 Incomplete, local search algorithm Evaluation function: The min-conflict heuristic of minimizing the number of unsatisfied clauses Balance between greediness and randomness EA C461 Artificial Intelligence
49
The WalkSAT algorithm 49 EA C461 Artificial Intelligence
50
Hard satisfiability problems
50 Consider randomly generated 3-CNF sentences. e.g., (D B C) (B A C) (C B E) (E D B) (B E C) m = number of clauses n = number of symbols This CNF has 16 models out of 32 possible assignments. Quite easy to solve. So where are hard problems? Fix n and keep increasing m, EA C461 Artificial Intelligence
51
Hard satisfiability problems
51 EA C461 Artificial Intelligence
52
Hard satisfiability problems
52 n=500 Median runtime for 100 satisfiable random 3-CNF sentences EA C461 Artificial Intelligence
53
Inference-based agents in the Wumpus world
53 A wumpus-world agent using propositional logic: P1,1 W1,1 Bx,y (Px,y+1 Px,y-1 Px+1,y Px-1,y) Sx,y (Wx,y+1 Wx,y-1 Wx+1,y Wx-1,y) W1,1 W1,2 … W4,4 W1,1 W1,2 W1,1 W1,3 … 64 distinct proposition symbols, 155 sentences EA C461 Artificial Intelligence
54
54 EA C461 Artificial Intelligence
55
L111 Facing Right1 Forward1 L 212
Keeping Track of Location and Orientation 55 Should our KB include statements like L11 Facing Right Forward L 21 What is the problem here? L111 Facing Right1 Forward1 L 212 Facing Right TurnLeft 1 FacingUp2 Result : tens of thousands of such sentences EA C461 Artificial Intelligence
56
Summary 56 Logical agents apply inference to a knowledge base to derive new information and make decisions Basic concepts of logic: syntax: formal structure of sentences semantics: truth of sentences wrt models entailment: necessary truth of one sentence given another inference: deriving sentences from other sentences soundness: derivations produce only entailed sentences completeness: derivations can produce all entailed sentences Wumpus world requires the ability to represent partial and negated information, reason by cases, etc. Resolution is complete for propositional logic Forward, backward chaining are linear-time, complete for Horn clauses Propositional logic lacks expressive power EA C461 Artificial Intelligence
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.