review of last time
play

Review of Last Time |= means logically follows |- i means can be - PDF document

Review of Last Time |= means logically follows |- i means can be derived from CS 331: Artificial Intelligence If your inference algorithm derives only Propositional Logic 2 things that follow logically from the KB, the


  1. Review of Last Time • |= means “logically follows” • |- i means “can be derived from” CS 331: Artificial Intelligence • If your inference algorithm derives only Propositional Logic 2 things that follow logically from the KB, the inference is sound • If everything that follows logically from the KB can be derived using your inference algorithm, the inference is complete 1 2 Entailment Applied to the Wumpus Inference: Model Checking World • Suppose we want to know if KB |=  P 1,2 ? Let us consider the models that • In the 3 models in which KB is true,  P 1,2 is also true support the conclusion α 1 = “There is no pit in [1,2].” We draw a line marked with α 1 B 1,1 B 2,1 P 1,1 P 1,2 P 2,1 P 2,2 P 3,1 R 1 R 2 R 3 R 4 R 5 KB around these models false false false false false false false true true true true false false false false false false false false true true true false true false false In every model in which KB is true, α 1 is also true. : : : : : : : : : : : : : Therefore KB |= α 1 false true false false false false false true true false true true false false true false false false false true true true true true true true false true false false false true false true true true true true true false true false false false true true true true true true true true false true false false true false false true false false true true false : : : : : : : : : : : : : true true true true true true true false true true false true false 3 4 Complexity The really depressing news • If the KB and  contain n symbols in total, • Every known inference algorithm for propositional logic has a worst-case what is the time complexity of the truth complexity that is exponential in the size of table enumeration algorithm? the input You can’t handle the truth! • Space complexity is O(n) because the actual algorithm uses DFS • But some algorithms are more efficient in practice 5 6 1

  2. Logical equivalence Standard Logic Equivalences • Intuitively: two sentences  and  are logically equivalent (i.e.    ) if they are true in the same set of models • Formally:    if and only if  |=  and  |=  • Can prove this with truth tables In the above,  ,  , and  are arbitrary sentences of propositional logic 7 8 Validity Satisfiability • A sentence is satisfiable if it is true in some • A sentence is valid if it is true in all models model. • E.g. P   Pis valid • A sentence is unsatisfiable if it is true in no models • Valid sentences = Tautologies • Determining the satisfiability of sentences in • Tautologies are vacuous propositional logic was the first problem proved to be NP-complete • Satisfiability is connected to validity: Deduction theorem  is valid iff ¬  is unsatisfiable For any sentences  and  ,  |=  iff the • Satisfiability is connected to entailment: sentence (    ) is valid  |=  iff the sentence (   ¬  ) is unsatisfiable (proof by contradiction) 9 10 CW: Exercise Proof methods How do we prove that  can be entailed from the KB? 1. Model checking e.g. check that  is true in all models in which KB is true 2. Inference rules 11 12 2

  3. Inference Rules Other Inference Rules 1. Modus Ponens     ,  2. And-Elimination     These are both sound inference rules. You don’t need to All of the logical equivalences can be turned into enumerate models now    inference rules e.g.        ( ) ( ) 13 Example Proofs • A sequence of applications of inference rules is Given the following KB, can we prove ¬R? called a proof KB: • Instead of enumerating models, we can search for P  ¬(Q  R) proofs P • Proofs ignore irrelevant propositions • 2 methods: Proof: – Go forward from initial KB, applying inference rules to ¬(Q  R) by Modus Ponens get to the goal sentence ¬Q  ¬R by De Morgan’s Law – Go backward from goal sentence to get to the KB ¬R by And-Elimination 15 16 In-class Exercise Monotonicity If it is October, there will not be a • Proofs only work because of monotonicity football game at OSU If it is October and it is Saturday, I • Monotonicity: the set of entailed sentences will be in Corvallis can only increase as information is added to If it doesn’t rain or if there is a football game, I will ride my bike to the knowledge base OSU • For any sentences  and  , Today is Saturday and it is October If I am in Corvallis, it will not rain if KB |=  then KB   |=  Can you prove that I will ride my bike to OSU? 17 18 3

  4. Resolution Resolution • Here’s how resolution works ( ¬ l 2 and l 2 are called • An inference rule that is sound and complementary literals):    complete l l , l l 1 2 2 3  l l • Forms the basis for a family of complete 1 3 • Note that you need to remove multiple copies of inference procedures literals (called factoring) i.e. • Here, complete means refutation    , l l l l 1 2 2 1 completeness: resolution can refute or l 1 confirm the truth of any sentence with • If l i and m j are complementary literals, the full respect to the KB resolution rule looks like:       l l , m m 1 k 1 n                l l l l m m m m     19 1 i 1 i 1 k 1 j 1 j 1 n Conjunctive Normal Form Recipe for Converting to CNF • Resolution only applies to sentences of the form l 1 Eliminate  , replacing    with (    )  1.  l 2  …  l k (    ) • This is called a disjunction of literals Eliminate  , replacing    with ¬    2. • It turns out that every sentence of propositional 3. Move ¬ inwards using: logic is logically equivalent to a conjunction of ¬(¬  )   (double-negation elimination) disjunction of literals ¬(    )  ¬   ¬  (De Morgan’s Law) • Called Conjunctive Normal Form or CNF ¬(    )  ¬   ¬  (De Morgan’s Law) e.g. (l 1  l 2  l 3  l 4 )  (l 5  l 6  l 7  l 8 )  … Apply distributive law (   (    ))  ((    )  4. • k-CNF sentences have exactly k literals per clause (    )) e.g. A 3-CNF sentence would be (l 1  l 2  l 3 )  (l 4  l 5  l 6 )  (l 7  l 8  l 9 ) 21 22 In-class Exercise Exercise KB Can we show that : Person  Mortal KB |= (Socrates  Mortal)? Socrates  Person 23 24 4

  5. A resolution algorithm In-class Exercise KB To prove KB |=  , we show that (KB  ¬  ) is unsatisfiable Can we show that : (Remember that  |=  iff the sentence (   ¬  ) is unsatisfiable) Person  Mortal KB |= (Socrates  Mortal)? Socrates  Person The algorithm: Convert (KB  ¬  ) to CNF 1. 2. Apply resolution rule to resulting clauses. Each pair with complementary literals is resolved to produce a new clause which is added to the KB 3. Keep going until – There are no new clauses that can be added ( meaning KB |   ) – Two clauses resolve to yield the empty clause ( meaning KB |=  ) The empty clause is equivalent to false because a disjunction is true only if one of its disjuncts is true 25 26 CW: Exercise Resolution Pseudocode 27 28 Things you should know • Understand the syntax and semantics of propositional logic • Know how to do a proof in propositional logic using inference rules • Know how to convert arbitrary sentences to CNF • Know how resolution works 29 5

Recommend


More recommend