Introduction to Artificial Intelligence
By:
Dr. Mohammad Shoab
Week 7
Knowledge-based agents
Inference engine
Knowledge base
Domain-independent algorithms
Domain-specific content
Introduction to Artificial Intelligence
Department of Computer Science
What is logic?
Introduction to Artificial Intelligence
Department of Computer Science
Propositional logic: Syntax
Introduction to Artificial Intelligence
Department of Computer Science
Propositional logic: Semantics
¬P is true iff P is false
P ∧ Q is true iff P is true and Q is true
P ∨ Q is true iff P is true or Q is true
P ⇒ Q is true iff P is false or Q is true
P ⇔ Q is true iff P ⇒ Q is true and Q ⇒ P is true�
Introduction to Artificial Intelligence
Department of Computer Science
Truth tables
Introduction to Artificial Intelligence
Department of Computer Science
Logical equivalence
Introduction to Artificial Intelligence
Department of Computer Science
Validity, satisfiability
A sentence is valid if it is true in all models,
e.g., True, A ∨¬A, A ⇒ A, (A ∧ (A ⇒ B)) ⇒ B�
A sentence is satisfiable if it is true in some model
e.g., A∨B, C
A sentence is unsatisfiable if it is true in no models
e.g., A∧¬A
Introduction to Artificial Intelligence
Department of Computer Science
Entailment
KB ╞ α
Introduction to Artificial Intelligence
Department of Computer Science
Inference
Introduction to Artificial Intelligence
Department of Computer Science
Inference
Introduction to Artificial Intelligence
Department of Computer Science
Inference rules
�
premises
conclusion
Introduction to Artificial Intelligence
Department of Computer Science
Inference rules
Introduction to Artificial Intelligence
Department of Computer Science
Inference rules
Introduction to Artificial Intelligence
Department of Computer Science
Resolution
α: “The weather is dry”
β: “The weather is rainy”
γ: “I carry an umbrella”
or
Introduction to Artificial Intelligence
Department of Computer Science
Resolution is complete
Introduction to Artificial Intelligence
Department of Computer Science
Complexity of inference
Introduction to Artificial Intelligence
Department of Computer Science
Definite clauses
�
premise or body
conclusion �or head
Introduction to Artificial Intelligence
Department of Computer Science
Forward chaining
Introduction to Artificial Intelligence
Department of Computer Science
Forward chaining example
Introduction to Artificial Intelligence
Department of Computer Science
Forward chaining example
Introduction to Artificial Intelligence
Department of Computer Science
Forward chaining example
Introduction to Artificial Intelligence
Department of Computer Science
Forward chaining example
Introduction to Artificial Intelligence
Department of Computer Science
Forward chaining example
Introduction to Artificial Intelligence
Department of Computer Science
Forward chaining example
Introduction to Artificial Intelligence
Department of Computer Science
Forward chaining example
Introduction to Artificial Intelligence
Department of Computer Science
Forward chaining example
Introduction to Artificial Intelligence
Department of Computer Science
Backward chaining
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�
Introduction to Artificial Intelligence
Department of Computer Science
Backward chaining example
Introduction to Artificial Intelligence
Department of Computer Science
Backward chaining example
Introduction to Artificial Intelligence
Department of Computer Science
Backward chaining example
Introduction to Artificial Intelligence
Department of Computer Science
Backward chaining example
Introduction to Artificial Intelligence
Department of Computer Science
Backward chaining example
Introduction to Artificial Intelligence
Department of Computer Science
Backward chaining example
Introduction to Artificial Intelligence
Department of Computer Science
Backward chaining example
Introduction to Artificial Intelligence
Department of Computer Science
Backward chaining example
Introduction to Artificial Intelligence
Department of Computer Science
Backward chaining example
Introduction to Artificial Intelligence
Department of Computer Science
Backward chaining example
Introduction to Artificial Intelligence
Department of Computer Science
Forward vs. backward chaining
Introduction to Artificial Intelligence
Department of Computer Science
The End
40
Introduction to Artificial Intelligence
Department of Computer Science
Exercise
Q1. Explain knowledge based agents.
Q2. What is Logic?
Q3. Explain each syntax of propositional logic.
Q4. Explain truth table of propositional logic.
Q5. What is entailment?
Q6. What is inference?
Q7. Explain complexity of inference.
Q8. What is definite clause?
Q9. Write about Forward Chaining and Backward Chaining.
41
Introduction to Artificial Intelligence
Department of Computer Science
Q10. Which is Domain-independent algorithm
Q11. Which is the rule for constructing valid sentences
42
Introduction to Artificial Intelligence
Department of Computer Science
Q12. Two sentences are logically equivalent iff they are true in
Q13. A sound inference procedure can derive only
43
Introduction to Artificial Intelligence
Department of Computer Science