130 likes | 253 Views
This chapter delves into the fundamentals of propositional logic, covering models, semantics, and inference engines. It discusses how to represent knowledge bases (KB) and determine the truth values of propositions with examples. Key concepts include soundness, completeness, and efficiency of inference engines, addressing the complexity of inference algorithms. Techniques for creating reflex agents that learn using propositional logic are explored, highlighting methods for determining actions based on current percept lists and knowledge bases.
E N D
Logical inference Chapter 7
Reminders… • Propositional logic: A ‘model’ is a set of propositional statements and truth values. • Easy to implement as a …. • … hashtable • Semantics: rules for determining the truth of a sentence.
For example • Model = {‘P’:true, ‘Q’:false, ‘R’:true} • Is ‘P & Q’ true? • Is ‘P | Q’ true? • Is ‘P & ~Q & (Q | R)’ true? • Is ‘P & ~Q & (~Q | T)’ true?
Consider the reflex agent… • How can we create a reflex agent that learns, using propositional logic? • Perceptlist: • [‘mate’,’flee’,0] • [‘smallenemy’,’fight’,1] • Conclusions: • Mate -> ~ Flee • SmallEnemy -> Fight • Flee? Fight? Eat? Mate? • Given (current) KB, does KB entail action?
The well-tempered inference engine • What do we want in an inference engine? • Soundness, every conclusion derived is correct. • Completeness, every correct conclusion is derivable. • Efficient (of at most polynomial complexity). • Sorry, but “every known inference algorithm for propositional logic has a worse-case complexity that is exponential in the size of the input,” where “input” is the number of propositions.
So let’s give up? • No, accept some limitations • Soundness? • Completeness? • Efficiency?
Some inferential terms • Logical equivalence (these are meta-statements) • ~~ == • ~( | ) == (~ & ~) • ~(&) == (~ | ~) • Validity • Sentence is True in every model • Satisfiability • a sentence is true in model m, then satisfies m.
Some inference theorems • Deduction theorem • For any sentences and , entails iff the sentence ( -> ) is valid. • Proof by refutation/reductio ad absurum • entails iff ( -> ~) is unsatisfiable. • P -> Q? Assert ~Q, see if results in contradiction.
Again, unfortunately… • This is NP-complete (probably too hard). • But let’s play lots of tricks • Monotonic assumption: number of entailed sentences can only increase as information is added to the KB. • Place our attention on what we care about. • But it’s still NP-complete.
Completeness through resolution • Does proof by contradiction • I.e., KB entails by proving (KB & ~ ) is unsatisfiable. • Put in “conjuctive normal form” • Only “conjunction of disjunctions of [possibly negated] literals” • See algorithm in book.
Consider the reflex agent again… • How can we create a reflex agent that learns, using propositional logic? • Perceptlist: • [‘mate’,’flee’,0] • [‘smallenemy’,’fight’,1] • Conclusions: • Mate -> ~ Flee • SmallEnemy -> Fight • Flee? Fight? Eat? Mate? • Given (current) KB, does KB entail action?