logic in artificial intelligence (this lecture is an informal introduction only)

32
Logic in Artificial Intelligence Logic in Artificial Intelligence (this lecture is an informal introduction only) (this lecture is an informal introduction only)

Upload: stone-caldwell

Post on 02-Jan-2016

22 views

Category:

Documents


0 download

DESCRIPTION

Logic in Artificial Intelligence (this lecture is an informal introduction only). Human Logic. Humans are, among other things, information processors. We acquire information about the world and use this information to further our ends. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Logic in Artificial Intelligence (this lecture is an informal introduction only)

Logic in Artificial IntelligenceLogic in Artificial Intelligence

(this lecture is an informal introduction only)(this lecture is an informal introduction only)

Page 2: Logic in Artificial Intelligence (this lecture is an informal introduction only)

• Humans are, among other things, information processors.

• We acquire information about the world and use this information to further our ends.

• One of the strengths of human information processing is our ability to represent and manipulate logical information.

Human Logic

Page 3: Logic in Artificial Intelligence (this lecture is an informal introduction only)

• We are given some facts about the arrangement of five blocks in a stack, and we are asked to determine their exact arrangement.

• The sentences shown on the left constitute the premises of the problem.

A simple puzzle

• The red block is on the green block.

• The green block is somewhere above the blue block.

• The green block is not on the blue block.

• The yellow block is on the green block or the blue block.

• There is some block on the black block.

Conclusions:• The red block is on the green

block.• The green block is on the

yellow block.• The yellow block is on the blue

block.• The blue block is on the black

block.• The black block is directly on

the table.

Page 4: Logic in Artificial Intelligence (this lecture is an informal introduction only)

• Unfortunately, it is not always apparent which conclusions may be safely drawn from a given set of premises.

• What's more, even when we are given the conclusions, as in this example, their correctness may not be immediately obvious.

• In order to persuade others of a conclusion that we have drawn, it is useful to write down a proof, i.e. a series of intermediate conclusions, such that each is immediately obvious.

• As an example, consider the following informal proof:• We are told that the yellow block is on the green block or the blue block. • We are also told that the red block is on the green block. • Given the assumption that there can be only one block on another and that a

block cannot be two colors at once, we can conclude that the yellow block is not on the green block.

• But then, by elimination, the yellow block must be on the blue block.

Proof

Page 5: Logic in Artificial Intelligence (this lecture is an informal introduction only)

• The concept of proof, in order to be meaningful, requires that we be able to recognize certain reasoning steps as immediately obvious.

• In other words, we need to be familiar with the reasoning “atoms” out of which complex proof “molecules” are built.

• One of Aristotle's great contributions to philosophy was his recognition that what makes a step of a proof immediately obvious is its form rather than its content.

• It does not matter whether you are talking about blocks or stocks or automobiles. What matters is the structure of the facts with which you are working.

Aristotle (384-322 B.C.E.)

Page 6: Logic in Artificial Intelligence (this lecture is an informal introduction only)

All Accords are Hondas.All Hondas are Japanese.Therefore, all Accords are Japanese.

All borogoves are slithy toves.All slithy toves are mimsy.Therefore, all borogoves are mimsy.

• What's more, in order to reach these conclusion, we do not need to know anything about Hondas and Accords or borogoves and slithy toves or what it means to be mimsy.

• What is interesting about these examples is that they share the same reasoning structure, with respect to the pattern shown below.

All x are y.All y are z.Therefore, all x are z.

Examples

Page 7: Logic in Artificial Intelligence (this lecture is an informal introduction only)

• Which patterns are correct?

• How many patterns are enough?

Questions

Page 8: Logic in Artificial Intelligence (this lecture is an informal introduction only)

PatternAll x are y.Some y are z.Therefore, some x are z.

Good InstanceAll Toyotas are Japanese cars.Some Japanese cars are made in America.Therefore, some Toyotas are made in America.

Not-So-Good InstanceAll Toyotas are cars.Some cars are Porsches.Therefore, some Toyotas are Porsches.

Unsound Patterns

Page 9: Logic in Artificial Intelligence (this lecture is an informal introduction only)

I have seen 1000 black ravens.I have never seen a raven that is not black.Therefore, every raven is black.

Induction - Unsound

Page 10: Logic in Artificial Intelligence (this lecture is an informal introduction only)

If there is no fuel, the car will not start.If there is no spark, the car will not start.There is spark.The car will not start.Therefore, there is no fuel.What if the car is in a vacuum chamber?

Abduction, or abductive reasoning, is the process of inference to the best explanation.

Abduction - Unsound

Page 11: Logic in Artificial Intelligence (this lecture is an informal introduction only)

Soundness

• What distinguishes a correct pattern from one that is incorrect is that it must always lead to correct conclusions, i.e. conclusions that are true whenever the premises are true.

• As we will see, this is the defining criterion for what we call deduction.

Page 12: Logic in Artificial Intelligence (this lecture is an informal introduction only)

Logical Entailment/Deduction:Does not say that conclusion is true in generalConclusion true whenever premises are true

Leibnitz: The intellect is freed of all conception of theobjects involved, and yet the computation yields the correctresult.

Russell: Math may be defined as the subject in which wenever know what we are talking about nor whether what weare saying is true.

Deduction - Sound

Page 13: Logic in Artificial Intelligence (this lecture is an informal introduction only)

• Algebra1. Formal language for encoding information2. Legal transformations

• Logic1. Formal language for encoding information2. Legal transformations

Formal Logic

Page 14: Logic in Artificial Intelligence (this lecture is an informal introduction only)

Xavier is three times as old as Yolanda. Xavier's age andYolanda's age add up to twelve. How old are Xavier andYolanda?

x 3y 0x y 12

4y 12

y 3x 9

Algebra Problem

Page 15: Logic in Artificial Intelligence (this lecture is an informal introduction only)

If Amy loves Pat, then Amy loves Quincy. If it is Monday and raining, then Amy loves Pat or Quincy.

If it is Monday and raining, does Amy love Quincy?

Logic Problem

Page 16: Logic in Artificial Intelligence (this lecture is an informal introduction only)

Simple sentences:

Amy loves Pat.loves(amy, pat)

Amy loves Quincy.loves(amy, quincy)

It is Monday.ismonday

It’s raining.raining

FormalizationPremises:If Amy loves Pat, Amy loves Quincy.

loves(amy,pat) loves(amy,quincy) If it Monday and raining, Amy loves Pat or

Quincy.ismonday raining

loves(amy,pat) loves(amy,quincy)

Question:If it is Monday and raining, does Amy love

Quincy?

Page 17: Logic in Artificial Intelligence (this lecture is an informal introduction only)

p1 ... pk q1 ... ql

r1 ... rm s1 ... sn

p1 ... pk r1 ... rm q1 ... ql s1 ... sn

Rule of Inference (Resolution)

• If pi on the left hand side of one sentence is the same as qj in the

right hand side of the other sentence, it is okay to drop the two symbols.

Page 18: Logic in Artificial Intelligence (this lecture is an informal introduction only)

Two Tricks

• A sentence p

asserts that p is true (i.e. a fact)

• A sentence p

asserts that p is false

Page 19: Logic in Artificial Intelligence (this lecture is an informal introduction only)

Modus Ponens - special case of Resolution

p q

p

q

monday alex is teaching AI

monday

alex teaching AI

Using the tricks:

p q

p

p p q q,

i.e. q

Page 20: Logic in Artificial Intelligence (this lecture is an informal introduction only)

p1 ... pk q1 ... ql

r1 ... rm s1 ... sn

p1 ... pk r1 ... rm q1 ... ql s1 ... sn

• If pi on the left hand side of one sentence is the same as qj in the

right hand side of the other sentence, drop the two symbols.

Solving Amy's love life…

loves(amy,pat) loves(amy,quincy) ismonday raining loves(amy,pat) loves(amy,quincy)loves(amy,pat) ismonday raining

loves(amy,quincy) loves(amy,pat) loves(amy,quincy)

ismonday raining loves(amy,quincy) loves(amy,quincy)

ismonday raining loves(amy,quincy)

Page 21: Logic in Artificial Intelligence (this lecture is an informal introduction only)

• Prolog is by far the most widely used logic programming language.

• However, Prolog programs are sets of implications whose premise is a conjunction of positive literals and whose conclusion is a single positive literal. • An implication with no premises simply asserts a given proposition –

sometimes called a fact.

• Hence, the Amy’s love life can’t be solved with Prolog. We need a more powerful Theorem Prover.

Prolog as a Theorem Prover

Page 22: Logic in Artificial Intelligence (this lecture is an informal introduction only)

Art is the parent of Bob and Bud.Bob is the parent of Cal and Coe.A grandparent is a parent of a parent.

p(art,bob)p(art,bud)p(bob,cal)p(bob,coe)p(x, y) p(y, z) g(x, z)

Kinship

Page 23: Logic in Artificial Intelligence (this lecture is an informal introduction only)

Let’s assume g(art, coe) is not true, i.e. g(art, coe) .

1. p(art, bob)2. p(art, bud)3. p(bob,cal)4. p(bob,coe)5. p(x, y)p(y, z) g(x,z)6. g(art, coe) By assumption (see above)7. p(art, y) p(y,coe) 5,6 (bind vars by unification)8. p(bob,coe) 1,7 (bind vars by unification)9. 4,8

Nothing means contradiction!

Is Art the Grandparent of Coe?

Page 24: Logic in Artificial Intelligence (this lecture is an informal introduction only)

1. p(art, bob)2. p(art, bud)3. p(bob,cal)4. p(bob,coe)5. p(x, y)p(y, z) g(x,z)6. g(art, z) goal(z)7. p(art, y) p(y, z) goal(z) 5,68. p(bob, z) goal(z) 1,79. p(bud, z) goal(z) 2,710. goal(cal) 3,811. goal(coe) 4,8

Who Are the Grandchildren of Art?

Page 25: Logic in Artificial Intelligence (this lecture is an informal introduction only)

Databases

Page 26: Logic in Artificial Intelligence (this lecture is an informal introduction only)

1. p(art, bob)2. p(art, bud)3. p(bob,cal)4. p(bob,coe)5. p(x, y)p(y, z) g(x,z)6. g(art, z) goal(z)

Who Are the Grandchildren of Art? In SQL

p(x, y) p(y, z)g(x, z)

CREATE VIEW g(x,y) ASSELECT p1.x, p2.yFROM p AS p1, p AS p2WHERE p1.y = p2.x;

g(art, z)goal(z)

SELECT g.yFROM gWHERE g.x = 'art';

Page 27: Logic in Artificial Intelligence (this lecture is an informal introduction only)

; Someone who lives in Dreadsbury Mansion killed Aunt Agatha. Agatha, the; butler, and Charles live in Dreadsbury Mansion and are the only people who; live therein. A killer always hates his victim, and is never richer than; his victim. Charles hates no one that Agatha hates. Agatha hates everyone; except the butler. The butler hates everyone not richer than Aunt Agatha.; The butler hates everyone Agatha hates. No one hates everybody. Aunt Agatha; is not the butler. Prove that Aunt Agatha killer herself.

=> Killed(Agatha,Agatha) | Killed(butler,Agatha) | Killed(Charles,Agatha)=> Is(x,Agatha) | Is(x,butler) | Is(x,Charles)Killed(x,y) => Hates(x,y)Killed(x,y) => ~Richer(x,y) Hates(Agatha,x) => ~Hates(Charles,x)=>Hates(Agatha,Agatha)=>Hates(Agatha,Charles)=>~Hates(Agatha,butler)~Richer(x,Agatha) => Hates(butler,x)Hates(Agatha,x) => Hates(butler,x)=>~Hates(x,Agatha) | ~Hates(x,butler) | ~Hates(x,Charles)=>~Is(Agatha,butler)=>~Killed(Agatha,Agatha)

Agatha

Page 28: Logic in Artificial Intelligence (this lecture is an informal introduction only)

Killed(Agatha(),Agatha()) | Killed(butler(),Agatha()) | Killed(Charles(),Agatha())Is(x,Agatha()) | Is(x,butler()) | Is(x,Charles()) ~Killed(x,y) | Hates(x,y)~Killed(x,y) | ~Richer(x,y) ~Hates(Agatha(),x) | ~Hates(Charles(),x) Hates(Agatha(),Agatha())Hates(Agatha(),Charles())~Hates(Agatha(),butler()) Richer(x,Agatha()) | Hates(butler(),x) ~Hates(Agatha(),x) | Hates(butler(),x) ~Hates(x,Agatha()) | ~Hates(x,butler()) | ~Hates(x,Charles()) ~Is(Agatha(),butler()) negated_conclusion~Killed(Agatha(),Agatha())

Agatha into clausal form

Page 29: Logic in Artificial Intelligence (this lecture is an informal introduction only)

Axioms: 1#>KilledAgathaAgatha KilledbutlerAgatha KilledCharlesAgatha 2: IsxAgatha Isxbutler IsxCharles 3 >~Killedxy Hatesxy 4 >~Killedxy ~Richerxy 5 >~HatesAgathax ~HatesCharlesx 6 >HatesAgathaAgatha 7 >HatesAgathaCharles 8: ~HatesAgathabutler 9 >RicherxAgatha Hatesbutlerx10 >~HatesAgathax Hatesbutlerx11 >~HatesxAgatha ~Hatesxbutler ~HatesxCharles12: ~IsAgathabutler

Negated conclusion:13S>~KilledAgathaAgatha

Phase 0 clauses used in proof:14#>(13a*1a) KilledbutlerAgatha KilledCharlesAgatha15 >(9a*4b) Hatesbutlerx ~KilledxAgatha17 >(5b*3b) ~HatesAgathax ~KilledCharlesx18#>(17b*14b) ~HatesAgathaAgatha KilledbutlerAgatha19S>(18a*6a) KilledbutlerAgatha20S>(19a*15b) Hatesbutlerbutler21#>(20a*11b) ~HatesbutlerAgatha ~HatesbutlerCharles22S>(19a*3a) HatesbutlerAgatha23S>(22a*21a) ~HatesbutlerCharles24S>(23a*10b) ~HatesAgathaCharles

Phases 1 and 2 clauses used in proof:25S>(24a,7a) []

Theo – Theorem Prover

Page 30: Logic in Artificial Intelligence (this lecture is an informal introduction only)

• Theorem Provers have come up with novel mathematical results. • The most famous of these concerns Robbins Algebra.

• In 1933, E. V. Huntington presented the following basis for Boolean algebra: • x + y = y + x. [commutativity] • (x + y) + z = x + (y + z). [associativity] • n(n(x) + y) + n(n(x) + n(y)) = x. [Huntington

equation]

• Shortly thereafter, Herbert Robbins conjectured that the Huntington equation can be replaced with a simpler one: • n(n(x + y) + n(x + n(y))) = x. [Robbins equation]

History

Page 31: Logic in Artificial Intelligence (this lecture is an informal introduction only)

• The problem was first posed in the 1930s by Dr. Herbert Robbins, a New Jersey Professor of Mathematics at Rutgers University.

• Robbins said that he worked on the problem for some time, and then passed it on one of the century's most famous logicians, Dr. Albert Tarski of Stanford University. Tarski, who is now dead, worked on the problem, included it in a book, and handed it out to graduate students and visitors.

• Burris (University of Waterloo), for example said that Tarski suggested the problem to him in the early 1970s, while he was visiting Stanford for a couple of months. Tarski, he said, "liked to throw out challenging problems to people passing through."

Page 32: Logic in Artificial Intelligence (this lecture is an informal introduction only)

• While mathematicians were batting around Robbins's problem, computer scientists were striving to see if they could get computers to reason.

• Among them was Wos, who started working on automated reasoning in the 1960s. It was a time when computers were primitive, clunky and slow, and researchers were divided on how to proceed.

• On October 10, 1996, after eight days of computation, EQP (a version of OTTER) found a proof.