itcs 3153 artificial intelligence lecture 11 logical agents chapter 7 lecture 11 logical agents...
Post on 20-Dec-2015
222 Views
Preview:
TRANSCRIPT
ITCS 3153Artificial Intelligence
Lecture 11Lecture 11
Logical AgentsLogical Agents
Chapter 7Chapter 7
Lecture 11Lecture 11
Logical AgentsLogical Agents
Chapter 7Chapter 7
Reasoning w/ propositional logic
Remember what we’ve developed so farRemember what we’ve developed so far
• Logical sentencesLogical sentences
• And, or, not, implies (entailment), iff (equivalence)And, or, not, implies (entailment), iff (equivalence)
• Syntax vs. semanticsSyntax vs. semantics
• Truth tablesTruth tables
• Satisfiability, proof by contradictionSatisfiability, proof by contradiction
Remember what we’ve developed so farRemember what we’ve developed so far
• Logical sentencesLogical sentences
• And, or, not, implies (entailment), iff (equivalence)And, or, not, implies (entailment), iff (equivalence)
• Syntax vs. semanticsSyntax vs. semantics
• Truth tablesTruth tables
• Satisfiability, proof by contradictionSatisfiability, proof by contradiction
Logical Equivalences
Know these equivalencesKnow these equivalencesKnow these equivalencesKnow these equivalences
Reasoning w/ propositional logic
Inference RulesInference Rules
• Modus Ponens: Modus Ponens:
– Whenever sentences of form Whenever sentences of form => => and and are given are giventhe sentence the sentence can be inferred can be inferred
RR11: Green => Martian: Green => Martian
RR22: Green: Green
Inferred: MartianInferred: Martian
Inference RulesInference Rules
• Modus Ponens: Modus Ponens:
– Whenever sentences of form Whenever sentences of form => => and and are given are giventhe sentence the sentence can be inferred can be inferred
RR11: Green => Martian: Green => Martian
RR22: Green: Green
Inferred: MartianInferred: Martian
Reasoning w/ propositional logic
Inference RulesInference Rules• And-EliminationAnd-Elimination
– Any of conjuncts can be inferredAny of conjuncts can be inferred
RR11: Martian ^ Green: Martian ^ Green
Inferred: MartianInferred: Martian
Inferrred: GreenInferrred: Green
Use truth tables if you want to confirm inference Use truth tables if you want to confirm inference rulesrules
Inference RulesInference Rules• And-EliminationAnd-Elimination
– Any of conjuncts can be inferredAny of conjuncts can be inferred
RR11: Martian ^ Green: Martian ^ Green
Inferred: MartianInferred: Martian
Inferrred: GreenInferrred: Green
Use truth tables if you want to confirm inference Use truth tables if you want to confirm inference rulesrules
Example of a proof
~P ~B
BP?
P?
P?
P?
Example of a proof
~P ~B
B~P
P?
P?
~P
Constructing a proof
Proving Proving is like is like searchingsearching
• Find sequence of logical inference rules that lead to desired Find sequence of logical inference rules that lead to desired resultresult
• Note the explosion of propositionsNote the explosion of propositions
– Good proof methods ignore the countless irrelevant Good proof methods ignore the countless irrelevant propositionspropositions
Proving Proving is like is like searchingsearching
• Find sequence of logical inference rules that lead to desired Find sequence of logical inference rules that lead to desired resultresult
• Note the explosion of propositionsNote the explosion of propositions
– Good proof methods ignore the countless irrelevant Good proof methods ignore the countless irrelevant propositionspropositions
Monotonicity of knowledge base
Knowledge base can only get largerKnowledge base can only get larger
• Adding new sentences to knowledge base can only make it get largerAdding new sentences to knowledge base can only make it get larger
– If (KB entails If (KB entails ))
((KB ^ ((KB ^ ) entails ) entails ))
• This is important when constructing proofsThis is important when constructing proofs
– A logical conclusion drawn at one point cannot be invalidated by a A logical conclusion drawn at one point cannot be invalidated by a subsequent entailmentsubsequent entailment
Knowledge base can only get largerKnowledge base can only get larger
• Adding new sentences to knowledge base can only make it get largerAdding new sentences to knowledge base can only make it get larger
– If (KB entails If (KB entails ))
((KB ^ ((KB ^ ) entails ) entails ))
• This is important when constructing proofsThis is important when constructing proofs
– A logical conclusion drawn at one point cannot be invalidated by a A logical conclusion drawn at one point cannot be invalidated by a subsequent entailmentsubsequent entailment
How many inferences?
Previous example relied on application of inference Previous example relied on application of inference rules to generate new sentencesrules to generate new sentences
• When have you drawn enough inferences to prove something?When have you drawn enough inferences to prove something?
– Too many make search process take longerToo many make search process take longer
– Too few halt logical progression and make proof process Too few halt logical progression and make proof process incompleteincomplete
Previous example relied on application of inference Previous example relied on application of inference rules to generate new sentencesrules to generate new sentences
• When have you drawn enough inferences to prove something?When have you drawn enough inferences to prove something?
– Too many make search process take longerToo many make search process take longer
– Too few halt logical progression and make proof process Too few halt logical progression and make proof process incompleteincomplete
Resolution
Unit Resolution Inference RuleUnit Resolution Inference Rule
• If If mm and and llii are are
complementarycomplementaryliteralsliterals
Unit Resolution Inference RuleUnit Resolution Inference Rule
• If If mm and and llii are are
complementarycomplementaryliteralsliterals
Resolution Inference Rule
Also works with clausesAlso works with clauses
But make sure each literal appears only onceBut make sure each literal appears only once
Also works with clausesAlso works with clauses
But make sure each literal appears only onceBut make sure each literal appears only once
Resolution and completeness
Any Any completecomplete search algorithm, applying only the search algorithm, applying only the resolution rule, can derive any conclusion resolution rule, can derive any conclusion entailed by any knowledge base in propositional entailed by any knowledge base in propositional logiclogic
• More specifically, More specifically, refutation completenessrefutation completeness
– Able to confirm or refute any sentenceAble to confirm or refute any sentence
– Unable to enumerate all true sentencesUnable to enumerate all true sentences
Any Any completecomplete search algorithm, applying only the search algorithm, applying only the resolution rule, can derive any conclusion resolution rule, can derive any conclusion entailed by any knowledge base in propositional entailed by any knowledge base in propositional logiclogic
• More specifically, More specifically, refutation completenessrefutation completeness
– Able to confirm or refute any sentenceAble to confirm or refute any sentence
– Unable to enumerate all true sentencesUnable to enumerate all true sentences
What about “and” clauses?
Resolution only applies to “or” clausesResolution only applies to “or” clauses
• Every sentence of propositional logic can be transformed to a Every sentence of propositional logic can be transformed to a logically equivalent conjunction of disjunctions of literalslogically equivalent conjunction of disjunctions of literals
Conjunctive Normal Form (CNF)Conjunctive Normal Form (CNF)
• A sentence expressed as conjunction of disjunction of literalsA sentence expressed as conjunction of disjunction of literals
– k-CNF: exactly k literals per clausek-CNF: exactly k literals per clause
Resolution only applies to “or” clausesResolution only applies to “or” clauses
• Every sentence of propositional logic can be transformed to a Every sentence of propositional logic can be transformed to a logically equivalent conjunction of disjunctions of literalslogically equivalent conjunction of disjunctions of literals
Conjunctive Normal Form (CNF)Conjunctive Normal Form (CNF)
• A sentence expressed as conjunction of disjunction of literalsA sentence expressed as conjunction of disjunction of literals
– k-CNF: exactly k literals per clausek-CNF: exactly k literals per clause
CNF
An algorithm for resolution
We wish to prove KB entails We wish to prove KB entails • Must show (KB ^ ~Must show (KB ^ ~) is unsatisfiable) is unsatisfiable
– No possible way for KB to entail (not No possible way for KB to entail (not ))
– Proof by contradictionProof by contradiction
We wish to prove KB entails We wish to prove KB entails • Must show (KB ^ ~Must show (KB ^ ~) is unsatisfiable) is unsatisfiable
– No possible way for KB to entail (not No possible way for KB to entail (not ))
– Proof by contradictionProof by contradiction
An algorithm for resolution
AlgorithmAlgorithm
• KB ^ ~KB ^ ~is put in CNFis put in CNF
• Each pair with complementary literals is resolved to produce Each pair with complementary literals is resolved to produce new clause which is added to KB (if novel)new clause which is added to KB (if novel)
– Cease if no new clauses to add (~Cease if no new clauses to add (~ is not entailed) is not entailed)
– Cease if resolution rule derives empty clause (~Cease if resolution rule derives empty clause (~ is is entailed)entailed)
AlgorithmAlgorithm
• KB ^ ~KB ^ ~is put in CNFis put in CNF
• Each pair with complementary literals is resolved to produce Each pair with complementary literals is resolved to produce new clause which is added to KB (if novel)new clause which is added to KB (if novel)
– Cease if no new clauses to add (~Cease if no new clauses to add (~ is not entailed) is not entailed)
– Cease if resolution rule derives empty clause (~Cease if resolution rule derives empty clause (~ is is entailed)entailed)
Example of resolution
Proof that there is not a pit in PProof that there is not a pit in P1,21,2: ~P: ~P1,21,2
• KB ^ PKB ^ P1,21,2 leads to empty clause leads to empty clause
• Therefore ~PTherefore ~P1,21,2 is true is true
Proof that there is not a pit in PProof that there is not a pit in P1,21,2: ~P: ~P1,21,2
• KB ^ PKB ^ P1,21,2 leads to empty clause leads to empty clause
• Therefore ~PTherefore ~P1,21,2 is true is true
Formal Algorithm
Horn Clauses
Horn ClauseHorn Clause
• Disjunction of literals with at most one is positiveDisjunction of literals with at most one is positive
– (~a V ~b V ~c V d)(~a V ~b V ~c V d)
– (~a V b V c V ~d) (~a V b V c V ~d) Not a Horn ClauseNot a Horn Clause
Horn ClauseHorn Clause
• Disjunction of literals with at most one is positiveDisjunction of literals with at most one is positive
– (~a V ~b V ~c V d)(~a V ~b V ~c V d)
– (~a V b V c V ~d) (~a V b V c V ~d) Not a Horn ClauseNot a Horn Clause
Horn Clauses
Can be written as a special implicationCan be written as a special implication
• (~a V ~b V c) (~a V ~b V c) (a ^ b) => c (a ^ b) => c
– (~a V ~b V c) == (~(a ^ b) V c) … de Morgan(~a V ~b V c) == (~(a ^ b) V c) … de Morgan
– (~(a ^ b) V c) == ((a ^ b) => c … implication elimination(~(a ^ b) V c) == ((a ^ b) => c … implication elimination
Can be written as a special implicationCan be written as a special implication
• (~a V ~b V c) (~a V ~b V c) (a ^ b) => c (a ^ b) => c
– (~a V ~b V c) == (~(a ^ b) V c) … de Morgan(~a V ~b V c) == (~(a ^ b) V c) … de Morgan
– (~(a ^ b) V c) == ((a ^ b) => c … implication elimination(~(a ^ b) V c) == ((a ^ b) => c … implication elimination
Horn Clauses
Permit straightforward inference determinationPermit straightforward inference determination
• Forward chainingForward chaining
• Backward chainingBackward chaining
Permit straightforward inference determinationPermit straightforward inference determination
• Forward chainingForward chaining
• Backward chainingBackward chaining
Horn Clauses
Permit determination of entailment in linear time Permit determination of entailment in linear time (in order of knowledge base size)(in order of knowledge base size)Permit determination of entailment in linear time Permit determination of entailment in linear time (in order of knowledge base size)(in order of knowledge base size)
Forward Chaining
Forward Chaining
PropertiesProperties
• SoundSound
• CompleteComplete
– All entailed atomic sentence will be derivedAll entailed atomic sentence will be derived
Data DrivenData Driven
• Start with what we knowStart with what we know
• Derive new info until we discover what we wantDerive new info until we discover what we want
PropertiesProperties
• SoundSound
• CompleteComplete
– All entailed atomic sentence will be derivedAll entailed atomic sentence will be derived
Data DrivenData Driven
• Start with what we knowStart with what we know
• Derive new info until we discover what we wantDerive new info until we discover what we want
Backward Chaining
Start with what you want to know, a query (q)Start with what you want to know, a query (q)
Look for implications that conclude qLook for implications that conclude q
Goal-Directed ReasoningGoal-Directed Reasoning
Start with what you want to know, a query (q)Start with what you want to know, a query (q)
Look for implications that conclude qLook for implications that conclude q
Goal-Directed ReasoningGoal-Directed Reasoning
top related