- 89 Views
- Uploaded on
- Presentation posted in: General

Cooperating Intelligent Systems

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Cooperating Intelligent Systems

Inference in first-order logic

Chapter 9, AIMA

- Reduce the first order logic sentences to propositional (boolean) logic.
- Use the inference systems in propositional logic.
We need a system for transfering sentences with quantifiers to sentences without quantifiers

All the propositional rules (Modus Ponens, And Elimination, And introduction, etc.) plus:

Universal Instantiation (UI)

Where the variable x is replaced by the ground term a everywhere in the sentence w.

Example:

∀x P(x,f(x),B) ⇒ P(A,f(A),B)

Existential Instantiation (EI)

Where the variable x is replaced by a ground term a (that makes the sentence true) in the sentence w.

Example:

∃x Q(x,g(x),B) ⇒ Q(A,g(A),B)

A must be a new symbol.

Ground term = a term without variables

C is called a Skolem constant

Making up names is called skolemization

C is called a Skolem constant

Making up names is called skolemization

Apply Universal Instantiation (UI) and Existential Instantiation (EI) so that every FOL KB is made into a propositional KB.

⇒ We can use the tools from propositional logic to prove theorems.

Problem with function constants: Father(A), Father(Father(A)), Father(Father(Father(A))), etc. ad infinitum...infinite number of sentences...how can we prove this in finite time?

Theorem: We can find every entailed sentence [Gödel, Herbrand], but the search is not guaranteed to stop for nonentailed sentences.(”Solution”: negation-as-failure, stop after a certain time and assume the sentence is false)

Inefficient...generalized (lifted) inference rules better

Subst(q,a) = Apply the substitution q to the sentence a.

Example:

- = {x/John} (replace x with John)
a = (King(x) ∧ Greedy(x)) ⇒ Evil(x)

(King(John) ∧ Greedy(John)) ⇒ Evil(John)

General form: q = {v/g} where v is a variable and g is a ground term.

KB

p1 = King(John)

q1 = King(x)

∀x (King(x) ∧ Greedy(x) ⇒ Evil(x))

p2 = Greedy(John)

q2 = Greedy(x)

q = {x/John}

r = Evil(x)

For atomic sentences pi, qi, and r where there exists a substitution q such that Subst(q,pi) = Subst(q,qi) for all i

We have John who is King and is Greedy. If someone is King and Greedy then he/she/it is also Evil.

KB

p1 = King(John)

q1 = King(x)

∀x (King(x) ∧ Greedy(x) ⇒ Evil(x))

p2 = Greedy(John)

q2 = Greedy(x)

q = {x/John}

r = Evil(x)

For atomic sentences pi, qi, and r where there exists a substitution q such that Subst(q,pi) = Subst(q,qi) for all i

Subst(q,p1) = Subst(q,q1)

KB

p1 = King(John)

q1 = King(x)

∀x (King(x) ∧ Greedy(x) ⇒ Evil(x))

p2 = Greedy(John)

q2 = Greedy(x)

q = {x/John}

r = Evil(x)

For atomic sentences pi, qi, and r where there exists a substitution q such that Subst(q,pi) = Subst(q,qi) for all i

Subst(q,p2) = Subst(q,q2)

KB

p1 = King(John)

q1 = King(x)

∀x (King(x) ∧ Greedy(x) ⇒ Evil(x))

p2 = Greedy(John)

q2 = Greedy(x)

q = {x/John}

r = Evil(x)

King(John), Greedy(John)

Subst(q,r) = Evil(John)

⇒Evil(John)

KB

p1 = King(John)

q1 = King(x)

∀x (King(x) ∧ Greedy(x) ⇒ Evil(x))

p2 = Greedy(John)

q2 = Greedy(x)

q = {x/John}

r = Evil(x)

King(John), Greedy(John)

Subst(q,r) = Evil(John)

⇒Evil(John)

Lifted inference rules make only the necessary substitutions

KB:

- All cats like fish
- Cats eat everything they like
- Ziggy is a cat

Example from Tuomas Sandholm @ CMU

KB:

- All cats like fish
- Cats eat everything they like
- Ziggy is a cat

Example from Tuomas Sandholm @ CMU

Ziggy the cat eats the fish!

Eats(Ziggy,Fish)

Cat(x) ∧ Likes(x,y) ⇒ Eats(x,y)q = {x/Ziggy, y/Fish}

Likes(Ziggy,Fish)

Cat(x) ⇒ Likes(x,Fish)q = {x/Ziggy}

Cat(Ziggy)

KB in Horn Form

KB in Horn Form

Facts

Forward chaining: Arms dealer

Forward chaining generates all inferences (also irrelevant ones)

We have proved thatWest is a criminal

Criminal(West)

American(x) ∧ Weapon(y) ∧ Hostile(z)∧ Sells(x,y,z) ⇒ Criminal(x)q = {x/West, y/M, z/NoNo}

Weapon(M)

Sells(West,M,NoNo)

Hostile(NoNo)

Missile(x) ∧ Owns(NoNo,x) ⇒Sells(West,x,NoNo)q = {x/M}

Missile(x) ⇒ Weapon(x)q = {x/M}

Enemy(x,America) ⇒ Hostile(x)q = {x/NoNo}

American(West)

Missile(M)

Owns(NoNo,M)

Enemy(NoNo,America)

KB in Horn Form

- SavingsAccount(Inadequate) ⇒ Investments(Bank)
- SavingsAccount(Adequate) ∧ Income(Adequate) ⇒ Investments(Stocks)
- SavingsAccount(Adequate) ∧ Income(Inadequate) ⇒ Investments(Mixed)
- ∀x (AmountSaved(x) ∧∃y (Dependents(y) ∧ Greater(x,MinSavings(y))) ⇒ SavingsAccount(Adequate))
- ∀x (AmountSaved(x) ∧∃y (Dependents(y) ∧¬Greater(x,MinSavings(y))) ⇒ SavingsAccount(Inadequate))
- ∀x (Earnings(x,Steady) ∧∃y (Dependents(y) ∧ Greater(x,MinIncome(y))) ⇒ Income(Adequate))
- ∀x (Earnings(x,Steady) ∧∃y (Dependents(y) ∧¬Greater(x,MinIncome(y))) ⇒ Income(Inadequate))
- ∀x (Earnings(x,UnSteady) ⇒ Income(Inadequate))
- AmountSaved($22000)
- Earnings($25000,Steady)
- Dependents(3)

MinSavings(x) ≡ $5000•xMinIncome(x) ≡ $15000 + ($4000•x)

Example from G.F. Luger, ”Artificial Intelligence” 2002

FC financial advisor

Investments(Mixed)

SavingsAccount(Adequate)

Income(Inadequate)

¬Greater($25000,MinIncome)

Greater($22000,MinSavings)

MinIncome = $27000MinSavings = $15000

AmountSaved($22000)

Dependents(3)

Earnings($25000,Steady)

Literal = (possibly negated) atomic sentence, e.g., ¬Rich(Me)

Clause = disjunction of literals, e.g. ¬Rich(Me) ∨ Unhappy(Me)

The KB is a conjunction of clauses

Any FOL KB can be converted to CNF as follows:

- Replace (P ⇒ Q) by (¬P ∨ Q) (implication elimination)
- Move ¬ inwards, e.g., ¬∀x P(x) becomes ∃x ¬P(x)
- Standardize variables apart, e.g., (∀x P(x) ∨∃x Q(x)) becomes (∀x P(x) ∨∃y Q(y))
- Move quantifiers left, e.g., (∀x P(x) ∨∃y Q(y)) becomes ∀x ∃y (P(x) ∨ Q(y))
- Eliminate ∃ by Skolemization
- Drop universal quantifiers
- Distribute ∧ over ∨, e.g., (P ∧ Q) ∨ R becomes (P ∨ R) ∧ (Q ∨ R)

Slide from S. Russel

”Everyone who loves all animals is loved by someone”

∀x [∀y Animal(y) ⇒ Loves(x,y)] ⇒ ∃y Loves(y,x)

Implication elimination∀x ¬[∀y ¬Animal(y) ∨ Loves(x,y)] ∨ ∃y Loves(y,x)

Move ¬ inwards (¬∀y P becomes ∃y ¬P)∀x [∃y ¬(¬Animal(y) ∨ Loves(x,y))] ∨ ∃y Loves(y,x)∀x [∃y (Animal(y) ∧¬Loves(x,y))] ∨ ∃y Loves(y,x)∀x [∃y Animal(y) ∧¬Loves(x,y)] ∨ ∃y Loves(y,x)

Standardize variables individually∀x [∃y Animal(y) ∧¬Loves(x,y)] ∨ ∃z Loves(z,x)

Skolemize (Replace ∃ with constants)∀x [Animal(F(x)) ∧¬Loves(x,F(x))] ∨ Loves(G(x),x)Why not ∀x [Animal(A) ∧¬Loves(x,A)] ∨ Loves(B,x) ??

Drop ∀[Animal(F(x)) ∧¬Loves(x,F(x))] ∨ Loves(G(x),x)

Distribute ∨ over ∧[Animal(F(x)) ∨ Loves(G(x),x)] ∧ [¬Loves(x,F(x)) ∨ Loves(G(x),x)]

Unify(p,q) = q

means that

Subst(q,p) = Subst(q,q)

First-order literals are complementary if one unifies with the negation of the other

Where Unify(li,¬mj) = q.

Note that li and mj are removed

Start fromthe top

¬

Arms dealer example

∀x (American(x)∧Weapon(y)∧Hostile(z)∧Sells(x,y,z)⇒Criminal(x))

Translate to CNF:

∀x (¬(American(x)∧Weapon(y)∧Hostile(z)∧Sells(x,y,z))∨Criminal(x))

∀x ((¬American(x)∨¬Weapon(y)∨¬Hostile(z)∨¬Sells(x,y,z))∨Criminal(x))

∀x (¬American(x)∨¬Weapon(y)∨¬Hostile(z)∨¬Sells(x,y,z)∨Criminal(x))

¬American(x)∨¬Weapon(y)∨¬Hostile(z)∨¬Sells(x,y,z)∨Criminal(x)

- Any FOL KB can be converted to CNF as follows:
- Replace (P ⇒ Q) by (¬P ∨ Q) (implication elimination)
- Move ¬ inwards, e.g., ¬∀x P(x) becomes ∃x ¬P(x)
- Standardize variables apart, e.g., (∀x P(x) ∨ ∃x Q(x)) becomes (∀x P(x) ∨ ∃y Q(y))
- Move quantifiers left, e.g., (∀x P(x) ∨ ∃y Q(y)) becomes ∀x ∃y (P(x) ∨ Q(y))
- Eliminate ∃ by Skolemization
- Drop universal quantifiers
- Distribute ∧ over ∨, e.g., (P ∧ Q) ∨ R becomes (P ∨ R) ∧ (Q ∨ R)

¬

Arms dealer example

∀x (American(x)∧Weapon(y)∧Hostile(z)∧Sells(x,y,z)⇒Criminal(x))

Translate to CNF:

∀x (¬(American(x)∧Weapon(y)∧Hostile(z)∧Sells(x,y,z))∨Criminal(x))

∀x ((¬American(x)∨¬Weapon(y)∨¬Hostile(z)∨¬Sells(x,y,z))∨Criminal(x))

∀x (¬American(x)∨¬Weapon(y)∨¬Hostile(z)∨¬Sells(x,y,z)∨Criminal(x))

¬American(x)∨¬Weapon(y)∨¬Hostile(z)∨¬Sells(x,y,z)∨Criminal(x)

- Any FOL KB can be converted to CNF as follows:
- Replace (P ⇒ Q) by (¬P ∨ Q) (implication elimination)
- Move ¬ inwards, e.g., ¬∀x P(x) becomes ∃x ¬P(x)
- Standardize variables apart, e.g., (∀x P(x) ∨ ∃x Q(x)) becomes (∀x P(x) ∨ ∃y Q(y))
- Move quantifiers left, e.g., (∀x P(x) ∨ ∃y Q(y)) becomes ∀x ∃y (P(x) ∨ Q(y))
- Eliminate ∃ by Skolemization
- Drop universal quantifiers
- Distribute ∧ over ∨, e.g., (P ∧ Q) ∨ R becomes (P ∨ R) ∧ (Q ∨ R)

¬

Arms dealer example

Where Unify(li,¬mj) = q.

¬

Arms dealer example

Where Unify(li,¬mj) = q.

l1 = ¬American(x)

l2 = ¬Weapon(y)

l3 = ¬Sells(x,y,z)

l4 = ¬Hostile(z)

l5 = Criminal(x)

m1 = Criminal(West)

Unify(l5,¬m1) = q= {x/West}

Subst(q,l1∨ l2∨ l3∨ l4) =...

¬

Arms dealer example

¬

Arms dealer example

l1 = ¬American(x)

l2 = ¬Weapon(y)

l3 = ¬Sells(x,y,z)

l4 = ¬Hostile(z)

l5 = Criminal(x)

m2 = American(West)

Unify(l1,¬m2) = q= {x/West}

Subst(q,l2∨ l3∨ l4) =...

¬

Arms dealer example

¬

Arms dealer example

¬

Arms dealer example

?

¬

Arms dealer example

l2 = ¬Weapon(y)

l3 = ¬Sells(x,y,z)

l4 = ¬Hostile(z)

m3 = Weapon(x)

m4 = Missile(x)

Unify(l2,¬m3) = q= {y/x}

Subst(q,l2∨ l3∨ l4 ∨ m4) =...

¬

Arms dealer example

?

¬

Arms dealer example

¬

Arms dealer example

¬

Arms dealer example

¬

Arms dealer example

¬

Arms dealer example

¬

Arms dealer example

∅

- Problem Statement: Tony, Shikuo and Ellen belong to the Hoofers Club. Every member of the Hoofers Club is either a skier or a mountain climber or both. No mountain climber likes rain, and all skiers like snow. Ellen dislikes whatever Tony likes and likes whatever Tony dislikes. Tony likes rain and snow.
- Query: Is there a member of the Hoofers Club who is a mountain climber but not a skier?

Example from Charles Dyer (referenced by Tuomas Sandhom @ CMU)

The rules only apply to members of the Hoofers club (our domain).

Problem Statement: Tony, Shikuo and Ellen belong to the Hoofers Club. Every member of the Hoofers Club is either a skier or a mountain climber or both. No mountain climber likes rain, and all skiers like snow. Ellen dislikes whatever Tony likes and likes whatever Tony dislikes. Tony likes rain and snow.

Query: Is there a member of the Hoofers Club who is a mountain climber but not a skier?

We drop the universal quantifiers...

But introduce different notation to keepbetter track...

1

2

3

4

5

6

7

8

9

10

11

1

2

3

4

5

6

7

8

9

10

11

Unify(p4,¬p11) = q= {x/s}

The resolvent becomes our clause # 12

1

2

3

4

5

6

7

8

9

10

11

12

Unify(p6, ¬p12) = q= {x/z}

The resolvent becomes our clause # 13

1

2

3

4

5

6

7

8

9

10

11

12

13

Unify(p10, ¬p8) = q= {v/Snow}

The resolvent becomes our clause # 14

1

2

3

4

5

6

7

8

9

10

11

12

13

14

We have proved that there is amember of the Hoofers club whois a mountain climber but not a skier.

Unify(p13, ¬p14) = q= {x/Ellen}