440 likes | 1.63k Views
Logic: Chapter 7. Deductive reasoningLogical inferences in a formal languagePreserve truth with each inferenceReasoning assumed to be same as logical proofLogical formalismsTermed ?Knowledge representation"Use logical languagesE.g., propositional logic or predicate calculusApplication to AI
E N D
1. General Methods of Acquiring Knowledge Deductive
New knowledge follows from prior knowledge by reasoning
E.g., Math proofs or logical inference
Inductive
New knowledge based on observations of the world
E.g., we may learn that apples fall from trees as a child by watching apples fall from trees
Deduction-induction combination
E.g., use a theory (e.g., deductive knowledge base) and examples from world (inductive oriented) to generate new information, predictions
2. Logic: Chapter 7 Deductive reasoning
Logical inferences in a formal language
Preserve truth with each inference
Reasoning assumed to be same as logical proof
Logical formalisms
Termed “Knowledge representation”
Use logical languages
E.g., propositional logic or predicate calculus
Application to AI
A new language
E.g., to specify start state, goals, knowledge, inference rules
Inference rules
A logical way to work from start state to goals using knowledge
3. Overall Approach
4. Propositional Logic Syntax
What are the sentences or well-formed formulas (wffs)?
Semantics
Correspondence to truth values (true/false)
Proof theory
Deductive inference mechanisms
5. Syntax: What are the wffs? A constant is a wff
true, false
Propositional symbols are wffs
Symbols: variables standing for true or false & names of other wffs
E.g., P, Q, A, B
A wff with parentheses is a wff
E.g., (true), (P)
If P is a wff, and Q is a wff, then
P ? Q is a wff
P ? Q is a wff
P ? Q is a wff
P ? Q is a wff
? P is a wff
6. Semantics:What Do the wffs Mean? Defined by truth tables, see Figure 7.8, p. 207
world
Logic symbols refer to aspects of real world situation
Symbol, J may mean “Jane”
Symbol, K may mean “Jane’s child is 8 yrs old”
We provide this interpretation of the symbols
model
A mapping from symbols to truth values
A label for a row in a truth table
7. When is a KB true? KB = Knowledge Base
A KB is a collection of wffs
E.g., KB = { (A?C), (B??C) }
A KB is true when the conjunction of all KB wffs in a row in the corresponding truth table are true
M(KB) = the set of all rows in the truth table that are true for KB
8. Example Let KB = { (A?C), (B??C) }
What is M(KB)?
Method
Form a truth table with columns A, B, C
Write down wffs of KB in additional columns
Determine when conjunction of wffs in KB are true
Determine M(KB)
9. Entailment KB |= ?
|= is symbol for entailment; ? is another wff
KB entails ? iff ? is true in all models where KB is true
Entailment means
Add ? to the KB and preserve truth
? is new knowledge
Entailment is the first requirement for an inference procedure or mechanism
We want to infer new statements that are true
10. Inference Procedures An inference procedure lets us mechanically preserve truth
E.g., if A and B are in the KB, then we can insert the new wff: “A ? B” into the KB
A ? B is true in all models where KB is true, so
KB |= A ? B
Additional requirements for a specific inference procedure
Generation: create new sentences ?
Verification: check if some ? is entailed
KB |-i ?
? can be derived from KB with a specific inference procedure
11. Inference Problem & Approaches Inference problem
Given a KB
E.g., KB = {P, P ? Q},
How do we determine if a new wff, ?, logically follows from the KB?
i.e., how do we determine if: KB |= ?
Approaches
Enumeration method
Inference rules & proof construction
12. Enumeration Method Given
KB and a wff ?
Question: Is KB |= ?
Method
Compute M(KB)
Compute M(?)
KB |= ? iff M(KB) ? M(?)
13. Why?KB |= ? iff M(KB) ? M(?) Consider again KB = { (A?C), (B??C) }
Recall that M(KB) = {4, 5, 7, 8}
Let ? be (A ? B ? C)
M(?) = {2, 3, 4, 5, 6, 7, 8}
Would we expect KB |= ? ?
Let ? be (A ? B)
M(?) = {7, 8}
Would we expect KB |= ? ?
14. Example Let KB = { (A?C), (B??C) }
Let ? = A?B
Is it true that KB |= ? ?
15. Inference Rules & Proof Construction: A Simple Inference Procedure Say KB = {A1, A2, A3, … }
How to derive new true wffs?
Assume our logical language has “and”
Usual notation: ^
Then, define the following inference procedure
Given two wff’s, X and Y from KB
Create a new wff by: X ^ Y
Call this procedure |-and
KB |-and A1 ^ A2
KB |-and A2 ^ A2
16. Inference Procedure #2: Modus Ponens Justification
To see that modus ponens preserves truth, recall:
? ? ? = ?? ? ?
We know that:
? ? KB (I.e., ? is true)
Therefore ?? ? KB (because, otherwise, M(KB) = {})
Therefore because ?? ? ? ? KB (i.e., ? ? ? ? KB),
? must be true
Therefore KB |= ?
17. Example: Modus Ponens Given: KB = { P ? Q => R, P ? Q }
Prove: R using KB |-mp
18. Solution KB = { P ? Q => R, P ? Q }
Let ? = P ? Q, and Let ? = R
KB has wffs of form: ? ? ?, ?
By modus ponens, KB |= R
19. Example Using our enumeration procedure, and our definition of entailment:
KB |= ? iff M(KB) ? M(?)
Prove that:
{ ? ? ?, ?} |= ?
20. Inference Procedure #3: Unit Resolution Justification
To see that unit resolution preserves truth:
Note that ?? is true (i.e., ?? ? KB),
Therefore, ? is false
Therefore because ? ? ? ? KB,
? must be true
Therefore KB |= ?
21. Example Given: KB = { (P? R) ? Q, ?Q }
Prove: P? R
Using unit resolution
22. Solution KB = { (P? R) ? Q, ?Q }
Let ? = (P? R), Let ? = Q
KB has wffs of form: ? ? ?, ? ?
By unit resolution, KB |= (P? R)
23. Inference Procedure #4: Resolution Justification
To see that resolution preserves truth:
Note that for any symbol P, either P is true or ?P is true
So, either ? or ?? is true
Case 1: ? is true
?? is false, therefore ? is true (since ? ? ?? ? KB)
Case 2: ?? is true
? is false, therefore ? is true (since ? ? ? ? KB)
Therefore since either Case 1 or Case 2 must apply
? ? ? must be true
Therefore, KB |= ? ? ?
24. Resolution Example Given: KB = { (P? R) ? Q, ?Q ? (R ?S) }
Prove: (P? R) ? (R ?S)
25. Solution KB = { (P? R) ? Q, ?Q ? (R ?S) }
Let ? = (P? R)
Let ? = (R ?S)
Let ? = Q
KB has wffs of form: ? ? ?, ? ? ? ?
By resolution, KB |= (P? R) ? (R ?S)
26. Example Application Reasoning about statements in natural language
Given
Statements in natural language
And a goal (theorem) to prove
Convert statements in natural language to (propositional) logic
Convert theorem into logic
Apply inference “operators” until theorem (goal) is reached
27. Example (Exercise 7.9, p. 238) If the unicorn is mythical, then it is immortal, but if it is not mythical, then it is a mortal mammal. If the unicorn is either immortal or a mammal, then it is horned. The unicorn is magical if it is horned.
Prove that the unicorn is magical.
1) Translate English sentences into logic
2) Use inference to prove