CS Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution
Problem Definition Input 1.Database containing formally represented facts: First-order logic sentences converted into clause form. 2.Inference rule: Resolution principle (MP & MT) Goal: An inference procedure Requirements: 1.Soundness – every sentence produced by the procedure will be “true”. 2.Completeness – every “true” sentence can be produced by the procedure 16-Nov-15Intro. to AI – Tutorial 82
Definitions Terms: –Constants (e.g. “c 1 ”, “c 2 ”) –Variables (e.g. “x 1 ”, “x 2 ”) –Functions (e.g. “f(x 1, x 2 )”) Predicate – Indicator function on terminals. –e.g. EVEN(t) : Numbers {TRUE, FALSE} Atom – the application of a predicate on a literal. –e.g. EVEN(t) Literal – A predicate or its negation –e.g. EVEN(t), ¬EVEN(t) 16-Nov-15Intro. to AI – Tutorial 83
Definitions Formulae - Recursively defined: –Every Atom is a formula –If w 1, w 2 are formulae, then so are: Clause – Disjunction (or) of literals. –e.g. L 1 V L 2 V ¬L 3 (can be written as: {L 1, L 2,¬L 3 }) 16-Nov-15Intro. to AI – Tutorial 84
The Resolution Principle Given: –A clause Φ containing the literal: φ –A clause Ψ containing the literal: ¬φ We can conclude: –(Φ – {φ}) U (Ψ – {¬φ}) Or in the generalized version… 16-Nov-15Intro. to AI – Tutorial 85
The Resolution Principle Given: –A clause Φ containing the literal: φ –A clause Ψ containing the literal: ¬ψ –A most general unifier g of φ and ¬ψ We can conclude: –((Φ – {φ}) U (Ψ – {¬ψ})) | g 16-Nov-15Intro. to AI – Tutorial 86
The Resolution Procedure Let DB be a set of true sentences without contradictions, and C be a sentence we want to prove. The Idea - proof by negation: Assume ¬C and try to find a contradiction. Intuition If all DB sentences are true, and assuming ¬C creates a contradiction then C must be inferred from DB. 16-Nov-15Intro. to AI – Tutorial 87
The Resolution Procedure 1.Convert: DB U {¬C} to clause form. 2.If there is a contradiction in DB, C was proved. Terminate. 3.Select two clauses and add their resolvents to the current DB. If there are no resolvable clauses – the procedure fails, terminate. Else, go to step Nov-15Intro. to AI – Tutorial 88
Conversion to Clause Form 1.Eliminate all : –Replace A B with ¬A V B 2.Distribute negations: –Replace ¬¬A with A – with –… 3.Eliminate existential quantifiers by replacing with Skölem constants or functions: –e.g. 16-Nov-15Intro. to AI – Tutorial 89
Conversion to Clause Form 4.Rename variables to avoid duplicates between different quantifiers. 5.Drop all universal quantifiers 6.Put expression into conjunctive normal form (CNF). 7.Convert to clauses (sets of literals). 8.Rename variables to avoid duplicates between different clauses. 16-Nov-15Intro. to AI – Tutorial 810
Conversion to Clauses - Example Initial expression: Remove implications: 16-Nov-15Intro. to AI – Tutorial 811
Conversion to Clauses - Example Previous step: Move negations inwards: 16-Nov-15Intro. to AI – Tutorial 812
Conversion to Clauses - Example Previous step: Remove existential quantifiers: 16-Nov-15Intro. to AI – Tutorial 813
Conversion to Clauses - Example Previous step: Rename variables: 16-Nov-15Intro. to AI – Tutorial 814
Conversion to Clauses - Example Previous step: Remove universals quantifiers: 16-Nov-15Intro. to AI – Tutorial 815
Conversion to Clauses - Example Previous step: Convert to CNF: 16-Nov-15Intro. to AI – Tutorial 816
Conversion to Clauses - Example Previous step: Convert to clauses: 16-Nov-15Intro. to AI – Tutorial 817
Conversion to Clauses - Example Previous step: Rename variables: 16-Nov-15Intro. to AI – Tutorial 818
Simple Example The problem: –“Heads I win, tails you lose.” –Use resolution to show I always win. Facts representation: 16-Nov-15Intro. to AI – Tutorial 819
Simple Example Proof: 16-Nov-15Intro. to AI – Tutorial 820