cs236501 introduction to ai tutorial 8 resolution tutorial 8 resolution

20
CS 236501 Introduction to AI Tutorial 8 Resolution

Upload: melvyn-merritt

Post on 05-Jan-2016

246 views

Category:

Documents


14 download

TRANSCRIPT

Page 1: CS236501 Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution

CS 236501Introduction to AI

CS 236501Introduction to AI

Tutorial 8Resolution

Tutorial 8Resolution

Page 2: CS236501 Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution

Problem DefinitionProblem Definition

Input1. 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

Apr 20, 2023

Intro. to AI – Tutorial 8 2

Page 3: CS236501 Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution

DefinitionsDefinitions

• Terms:

– Constants (e.g. “c1”, “c2”)

– Variables (e.g. “x1”, “x2”)

– Functions (e.g. “f(x1, x2)”)

• 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)

Apr 20, 2023

Intro. to AI – Tutorial 8 3

Page 4: CS236501 Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution

DefinitionsDefinitions

• Formulae - Recursively defined:– Every Atom is a formula

– If w1, w2 are formulae, then so are:

• Clause – Disjunction (or) of literals.

– e.g. L1 V L2 V ¬L3 (can be written as: {L1, L2 ,¬L3})

Apr 20, 2023

Intro. to AI – Tutorial 8 4

1 1 2 1 2 1 2 1 1, , , , ,w w w w w w w w w

Page 5: CS236501 Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution

The Resolution PrincipleThe Resolution Principle

• Given:– A clause Φ containing the literal: φ – A clause Ψ containing the literal: ¬φ

• We can conclude:– (Φ – {φ}) U (Ψ – {¬φ})

• Or in the generalized version…

Apr 20, 2023

Intro. to AI – Tutorial 8 5

Page 6: CS236501 Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution

The Resolution PrincipleThe 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

Apr 20, 2023

Intro. to AI – Tutorial 8 6

Page 7: CS236501 Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution

The Resolution ProcedureThe 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.

Apr 20, 2023

Intro. to AI – Tutorial 8 7

Page 8: CS236501 Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution

The Resolution ProcedureThe 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 2.

Apr 20, 2023

Intro. to AI – Tutorial 8 8

Page 9: CS236501 Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution

Conversion to Clause FormConversion to Clause Form

1. Eliminate all :– Replace AB 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.

Apr 20, 2023

Intro. to AI – Tutorial 8 9

A B A B

1 2 1 2, , , ,x y P x y P x y x P x f x P x f x

Page 10: CS236501 Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution

Conversion to Clause FormConversion 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.

Apr 20, 2023

Intro. to AI – Tutorial 8 10

Page 11: CS236501 Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution

Conversion to Clauses - ExampleConversion to Clauses - Example

• Initial expression:

• Remove implications:

Apr 20, 2023

Intro. to AI – Tutorial 8 11

, ,

,

, , , ,

y on x y bigger y x

x brick x y on y x brick y

y z on x y on x z equal y z

, ,

,

, , , ,

y on x y bigger y x

x brick x y on y x brick y

y z on x y on x z equal y z

Page 12: CS236501 Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution

Conversion to Clauses - ExampleConversion to Clauses - Example

• Previous step:

• Move negations inwards:

Apr 20, 2023

Intro. to AI – Tutorial 8 12

, ,

,

, , , ,

y on x y bigger y x

x brick x y on y x brick y

y z on x y on x z equal y z

, ,

,

, , , ,

y on x y bigger y x

x brick x y on y x brick y

y z on x y on x z equal y z

Page 13: CS236501 Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution

Conversion to Clauses - ExampleConversion to Clauses - Example

• Previous step:

• Remove existential quantifiers:

Apr 20, 2023

Intro. to AI – Tutorial 8 13

,support support ,

,

, , , ,

on x x bigger x x

x brick x y on y x brick y

y z on x y on x z equal y z

, ,

,

, , , ,

y on x y bigger y x

x brick x y on y x brick y

y z on x y on x z equal y z

Page 14: CS236501 Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution

Conversion to Clauses - ExampleConversion to Clauses - Example

• Previous step:

• Rename variables:

Apr 20, 2023

Intro. to AI – Tutorial 8 14

,support support ,

,

, , , ,

on x x bigger x x

x brick x y on y x brick y

w z on x w on x z equal w z

,support support ,

,

, , , ,

on x x bigger x x

x brick x y on y x brick y

y z on x y on x z equal y z

Page 15: CS236501 Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution

Conversion to Clauses - ExampleConversion to Clauses - Example

• Previous step:

• Remove universals quantifiers:

Apr 20, 2023

Intro. to AI – Tutorial 8 15

,support support ,

,

, , ,

on x x bigger x x

brick x on y x brick y

on x w on x z equal w z

,support support ,

,

, , , ,

on x x bigger x x

x brick x y on y x brick y

w z on x w on x z equal w z

Page 16: CS236501 Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution

Conversion to Clauses - ExampleConversion to Clauses - Example

• Previous step:

• Convert to CNF:

Apr 20, 2023

Intro. to AI – Tutorial 8 16

,support

support ,

,

, , ,

brick x on x x

brick x bigger x x

brick x on y x brick y

brick x on x w on x z equal w z

,support support ,

,

, , ,

on x x bigger x x

brick x on y x brick y

on x w on x z equal w z

Page 17: CS236501 Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution

Conversion to Clauses - ExampleConversion to Clauses - Example

• Previous step:

• Convert to clauses:

Apr 20, 2023

Intro. to AI – Tutorial 8 17

, ,support ,

, support , ,

, , , ,

, , , , , ,

brick x on x x

brick x bigger x x

brick x on y x brick y

brick x on x w on x z equal w z

,support

support ,

,

, , ,

brick x on x x

brick x bigger x x

brick x on y x brick y

brick x on x w on x z equal w z

Page 18: CS236501 Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution

Conversion to Clauses - ExampleConversion to Clauses - Example

• Previous step:

• Rename variables:

Apr 20, 2023

Intro. to AI – Tutorial 8 18

1 1 1

2 2 2

3 3

4 4 4

, ,support ,

, support , ,

, , , ,

, , , , , ,

brick x on x x

brick x bigger x x

brick x on y x brick y

brick x on x w on x z equal w z

, ,support ,

, support , ,

, , , ,

, , , , , ,

brick x on x x

brick x bigger x x

brick x on y x brick y

brick x on x w on x z equal w z

Page 19: CS236501 Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution

Simple ExampleSimple Example

• The problem:– “Heads I win, tails you lose.” – Use resolution to show I always win.

• Facts representation:

Apr 20, 2023

Intro. to AI – Tutorial 8 19

1.

2.

3.

4.

:

H Win Me

T Loose You

H T

Loose You Win Me

Goal Win Me

Page 20: CS236501 Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution

Simple ExampleSimple Example

• Proof:

Apr 20, 2023

Intro. to AI – Tutorial 8 20

1. ,

2. ,

3. ,

4. ,

5.

H Win Me

T Loose You

H T

Loose You Win Me

Win Me

6. , 2,4T Win Me

7. , 1,3T Win Me

8. 6,7Win Me9. {} 5,8