Cooperating intelligent systems
This presentation is the property of its rightful owner.
Sponsored Links
1 / 55

Cooperating Intelligent Systems PowerPoint PPT Presentation


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

Cooperating Intelligent Systems. Inference in first-order logic Chapter 9, AIMA. Reduce to propositional logic. Reduce the first order logic sentences to propositional (boolean) logic. Use the inference systems in propositional logic.

Download Presentation

Cooperating Intelligent Systems

An Image/Link below is provided (as is) to download presentation

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

Presentation Transcript


Cooperating intelligent systems

Cooperating Intelligent Systems

Inference in first-order logic

Chapter 9, AIMA


Reduce to propositional logic

Reduce to propositional logic

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


Fol inference rules

FOL inference rules

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


Example kings

Example: Kings...

C is called a Skolem constant

Making up names is called skolemization


Example kings1

Example: Kings...

C is called a Skolem constant

Making up names is called skolemization


Propositionalization

Propositionalization

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


Notation substitution

Notation: Substitution

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.


Generalized lifted modus ponens

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)

Generalized (lifted) Modus Ponens

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.


Generalized lifted modus ponens1

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)

Generalized (lifted) Modus Ponens

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)


Generalized lifted modus ponens2

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)

Generalized (lifted) Modus Ponens

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)


Generalized lifted modus ponens3

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)

Generalized (lifted) Modus Ponens

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


Generalized lifted modus ponens4

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)

Generalized (lifted) Modus Ponens

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

Lifted inference rules make only the necessary substitutions


Forward chaining example

Forward chaining example

KB:

  • All cats like fish

  • Cats eat everything they like

  • Ziggy is a cat

Example from Tuomas Sandholm @ CMU


Forward chaining example1

Forward chaining example

KB:

  • All cats like fish

  • Cats eat everything they like

  • Ziggy is a cat

Example from Tuomas Sandholm @ CMU


Cooperating intelligent systems

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)


Example arms dealer

Example: Arms dealer

KB in Horn Form


Example arms dealer1

Example: Arms dealer

KB in Horn Form

Facts


Cooperating intelligent systems

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)


Example financial advisor

Example: Financial advisor

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


Cooperating intelligent systems

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)


Fol cnf conjunctive normal form

FOL CNF (Conjunctive Normal Form)

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


Cnf example

CNF example

”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)]


Notation unification

Notation: Unification

Unify(p,q) = q

means that

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


Fol resolution inference rule

FOL resolution inference rule

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


Resolution proves kb a by proving kb a is unsatisfiable

Resolution proves KB ⊨a by proving (KB ∧¬a) is unsatisfiable

Start fromthe top

¬

Arms dealer example


Resolution proves kb a by proving kb a is unsatisfiable1

Resolution proves KB ⊨a by proving (KB ∧¬a) is unsatisfiable

∀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


Resolution proves kb a by proving kb a is unsatisfiable2

Resolution proves KB ⊨a by proving (KB ∧¬a) is unsatisfiable

∀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


Resolution proves kb a by proving kb a is unsatisfiable3

Resolution proves KB ⊨a by proving (KB ∧¬a) is unsatisfiable

Where Unify(li,¬mj) = q.

¬

Arms dealer example


Resolution proves kb a by proving kb a is unsatisfiable4

Resolution proves KB ⊨a by proving (KB ∧¬a) is unsatisfiable

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


Resolution proves kb a by proving kb a is unsatisfiable5

Resolution proves KB ⊨a by proving (KB ∧¬a) is unsatisfiable

¬

Arms dealer example


Resolution proves kb a by proving kb a is unsatisfiable6

Resolution proves KB ⊨a by proving (KB ∧¬a) is unsatisfiable

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


Resolution proves kb a by proving kb a is unsatisfiable7

Resolution proves KB ⊨a by proving (KB ∧¬a) is unsatisfiable

¬

Arms dealer example


Resolution proves kb a by proving kb a is unsatisfiable8

Resolution proves KB ⊨a by proving (KB ∧¬a) is unsatisfiable

¬

Arms dealer example


Resolution proves kb a by proving kb a is unsatisfiable9

Resolution proves KB ⊨a by proving (KB ∧¬a) is unsatisfiable

?

¬

Arms dealer example


Resolution proves kb a by proving kb a is unsatisfiable10

Resolution proves KB ⊨a by proving (KB ∧¬a) is unsatisfiable

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


Resolution proves kb a by proving kb a is unsatisfiable11

Resolution proves KB ⊨a by proving (KB ∧¬a) is unsatisfiable

?

¬

Arms dealer example


Resolution proves kb a by proving kb a is unsatisfiable12

Resolution proves KB ⊨a by proving (KB ∧¬a) is unsatisfiable

¬

Arms dealer example


Resolution proves kb a by proving kb a is unsatisfiable13

Resolution proves KB ⊨a by proving (KB ∧¬a) is unsatisfiable

¬

Arms dealer example


Resolution proves kb a by proving kb a is unsatisfiable14

Resolution proves KB ⊨a by proving (KB ∧¬a) is unsatisfiable

¬

Arms dealer example


Resolution proves kb a by proving kb a is unsatisfiable15

Resolution proves KB ⊨a by proving (KB ∧¬a) is unsatisfiable

¬

Arms dealer example


Resolution proves kb a by proving kb a is unsatisfiable16

Resolution proves KB ⊨a by proving (KB ∧¬a) is unsatisfiable

¬

Arms dealer example


Resolution example ii

Resolution example II

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


Cooperating intelligent systems

KB

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

Query

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


Kb the negation of the query

KB + the negation of the Query


Kb q to clause form i

(KB ∧¬Q) to Clause form...(I)


Kb q to clause form ii

(KB ∧¬Q) to Clause form...(II)


Kb q to clause form iii

(KB ∧¬Q) to Clause form...(III)


Kb q to clause form iv

(KB ∧¬Q) to Clause form...(IV)


Kb q in clause form

(KB ∧¬Q) in Clause form

We drop the universal quantifiers...

But introduce different notation to keepbetter track...


Cooperating intelligent systems

1

2

3

4

5

6

7

8

9

10

11


Cooperating intelligent systems

1

2

3

4

5

6

7

8

9

10

11

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

The resolvent becomes our clause # 12


Cooperating intelligent systems

1

2

3

4

5

6

7

8

9

10

11

12

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

The resolvent becomes our clause # 13


Cooperating intelligent systems

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


Cooperating intelligent systems

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}


  • Login