strong ai vs. weak ai automated reasoningdzhu/cs280/chap14.pdfautomated reasoning george f luger...

16
Automated Reasoning George F Luger ARTIFICIAL INTELLIGENCE 6th edition Structures and Strategies for Complex Problem Solving 1 Strong AI vs. Weak AI Artificial intelligence can be classified into two categories: strong AI and weak AI Strong AI: Can pass the Turing Test Has an intelligence that matches or exceeds that of human beings Weak AI: Doesn’t pass the Turing Test Produces machines that act intelligently 2 Automated Reasoning Program Allows computers to reason completely, or nearly completely, automatically Uses weak problem-solving methods Prerequisite for weak method problem solving: Prerequisite for weak method problem solving: An unambiguous and exact notation for representing information Precise inference rules for drawing conclusions, and A carefully described strategies to apply these rules The design of search strategies is an art – cannot guarantee to find a useful solution 3 An Example – Logic Theorist The first AI program Deliberately engineered to mimic the problem solving skills of a human being A weak problem solver A weak problem solver Uses uniform representation medium – propositional calculus Uses sound inference rules – substitution, replacement, and detachment Uses strategies or heuristic methods to guide the solution process 4

Upload: others

Post on 01-Jun-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Strong AI vs. Weak AI Automated Reasoningdzhu/cs280/Chap14.pdfAutomated Reasoning George F Luger ARTIFICIAL INTELLIGENCE 6th edition Structures and Strategies for Complex Problem Solving

Automated Reasoning

George F Luger

ARTIFICIAL INTELLIGENCE 6th editionStructures and Strategies for Complex Problem Solving

1

Strong AI vs. Weak AI

• Artificial intelligence can be classified into two categories: strong AI and weak AI

• Strong AI:– Can pass the Turing Test

– Has an intelligence that matches or exceeds that of human beings

• Weak AI:– Doesn’t pass the Turing Test

– Produces machines that act intelligently

2

Automated Reasoning Program

• Allows computers to reason completely, or nearly completely, automatically

• Uses weak problem-solving methods

• Prerequisite for weak method problem solving:• Prerequisite for weak method problem solving:– An unambiguous and exact notation for representing

information

– Precise inference rules for drawing conclusions, and

– A carefully described strategies to apply these rules

• The design of search strategies is an art – cannot guarantee to find a useful solution

3

An Example – Logic Theorist

• The first AI program

• Deliberately engineered to mimic the problem solving skills of a human being

• A weak problem solver• A weak problem solver

• Uses uniform representation medium –propositional calculus

• Uses sound inference rules – substitution, replacement, and detachment

• Uses strategies or heuristic methods to guide the solution process

4

Page 2: Strong AI vs. Weak AI Automated Reasoningdzhu/cs280/Chap14.pdfAutomated Reasoning George F Luger ARTIFICIAL INTELLIGENCE 6th edition Structures and Strategies for Complex Problem Solving

Inference Rules of LT

• Substitution allows any expression to be substituted for every occurrence of a symbol

(B ∨ B) → B Substitute ¬A for B, we have

(¬A ∨ ¬A) → ¬A(¬A ∨ ¬A) → ¬A

• Replacement allows a connective to be replaced by its definition or an equivalent form– Since ¬A ∨ B ≡ A → B

– Therefore ¬A ∨ ¬A can be replaced by A → ¬A

• Detachment is modus ponens

5

The Strategy of LT

• First, directly apply substitution to the goal to match it against all known axioms and theorems

• Second, if it fails, apply all possible detachments and replacements to the goal and test all results for success. If it fails, add them to a subproblemlistsuccess. If it fails, add them to a subproblemlist

• Third, chaining method is used to find a new subproblem (if a → c is a problem and b → c is found, then a → b is a new subproblem)

• Fourth, if the above three methods fail, go to the subproblem list and select the next untried subproblem

6

The Strategy of LT

• The executive routine applies the four methods repeatedly until either the solution is found or the memory and time are exhausted

• The LP executes a goal-driven, breath-first search • The LP executes a goal-driven, breath-first search of the problem space

• Matching process enables the substitution, replacement and detachment of the expressions

7

Reasoning as Search

• Logic Theorist explored a search tree: the root was the initial hypothesis, each branch was a deduction based on the rules of logic. Somewhere "up" the tree was the goal: the proposition the program tree was the goal: the proposition the program intended to prove. The pathway along the branches that led to the goal was a proof – a series of statements, each deduced using the rules of logic, that led from the hypothesis to the proposition to be proved.

8

Page 3: Strong AI vs. Weak AI Automated Reasoningdzhu/cs280/Chap14.pdfAutomated Reasoning George F Luger ARTIFICIAL INTELLIGENCE 6th edition Structures and Strategies for Complex Problem Solving

9

An Example

Suppose we wish to prove:

(p → ¬p) → ¬p

1. (A ∨ A) → A Matching identifies the best axiom

10

out of five available ones2. (¬A ∨ ¬A) → ¬A Substitute ¬A for A in order to

apply3. (A → ¬A) → ¬A Replacement of → for ∨ and ¬,

followed by4. (p → ¬p) → ¬p substitution of p for A

QED

General Problem Solver

• Study revealed there were many ways the LT’s solution differed from those of human subjects

• Human behavior showed strong evidence of matching and difference reduction mechanismmatching and difference reduction mechanism

• GPS was based on the LT

• GPS was intended to work as a universal problem solver to solve any formalized symbolic problem

11

General Problem Solver

• The problem-solving strategies of human subject is called difference reduction

• The general process of using transformations to reduce problem differences is called means-ends analysisanalysis

• The algorithm applying means-ends analysis is called the General Problem Solver (GPS) – Differences between the initial statement and the goal

are found

– A difference table containing transformation rules is used to remove the differences

12

Page 4: Strong AI vs. Weak AI Automated Reasoningdzhu/cs280/Chap14.pdfAutomated Reasoning George F Luger ARTIFICIAL INTELLIGENCE 6th edition Structures and Strategies for Complex Problem Solving

Fig 14.1a Transformation rules for logic problems, from Newell and Simon (1961)

13

Fig 14.1b A proof of a theorem in propositional calculus, from Newell and Simon (1961), generated by human subject

14

GPS Model

• The GPS model of problem solving requires two components– General procedure for comparing two state – General procedure for comparing two state

descriptions and reducing their differences

– The table of connections, giving links between problem differences and transformations that reduce them

15

Fig 14.2 Flow chart and difference reduction table for the General Problem Solver, from Newell and Simon (1963b).

16

Page 5: Strong AI vs. Weak AI Automated Reasoningdzhu/cs280/Chap14.pdfAutomated Reasoning George F Luger ARTIFICIAL INTELLIGENCE 6th edition Structures and Strategies for Complex Problem Solving

Resolution Method

• A modern and more powerful method for automated reasoning

• Can prove theorems in both propositional and predicate calculuspredicate calculus

• The primary rule of inference in PROLOG

• Uses a single rule of resolution, instead of trying different rules of inference and hoping one succeeds

• Greatly reduces the search space17

Resolution Refutation

• It proves a theorem by negating the goal statement to be proved and adding it to the set of given axioms known to be true

• Proving the theorem directly may take a long time • Proving the theorem directly may take a long time or may not work at all

• It uses the resolution rule of inference to show that the negated goal leads to a contradiction

• It follows that the original goal must be consistent – this proves the theorem

18

Resolution Refutation Proof Steps

• Put the premises or axioms into clause form

• Add the negation of what is to be proved, in clause form, to the set of axioms

• Resolve these clause together, producing new clauses that logically follow from them

• Produce a contradiction by generating the empty clause

• The substitutions used to produce the empty clause are those that make the original goal true

19

Clause Form

• A clause is a disjunction of literals– e.g. A ∨ B ∨ C

¬ B ∨ C ∨ D

• A literal is an atomic expression or the negation of an atomic expression

• The database of axioms can be represented in a conjunctive normal form using only ∨, ∧, and ¬– e.g.

(A ∨ B ∨ C ) ∧ (¬ B ∨ C ∨ D )

20

Page 6: Strong AI vs. Weak AI Automated Reasoningdzhu/cs280/Chap14.pdfAutomated Reasoning George F Luger ARTIFICIAL INTELLIGENCE 6th edition Structures and Strategies for Complex Problem Solving

Clause Form

• Resolution is an operation on two clauses (one containing a literal and the other containing its negation) to produce a new and simpler clause where two literals are “resolved away”where two literals are “resolved away”– e.g.

(A ∨ B ∨ C ) ∧ (¬ B ∨ C ∨ D ) ≡ A ∨ C ∨ D

(p ∨ q ) ∧ (¬ q ∨ r) ≡ p ∨ r

(f ∨ g ) ∧ (f ∨ ¬ g) ≡ f ∨ f ≡ f

• Unification may be required before resolution

21

Resolution Rules of Reference

22

An Example

Axioms:Fido is a dog.All dogs are animals.All animals will die.

Prove:Fido will die.

23

Fido will die.

Using predicate calculus:

1. All dogs are animals: ∀(X) (dog(X) → animal(X))2. Fido is a dog: dog(fido)3. Modus ponens and {fido/X} gives: animal(fido)4. All animals will die: ∀(Y) (animal(Y) → die(Y))5. Modus ponens and {fido/Y} gives: die(fido)

An Example

Predicate Form: Clause Form:

1. ∀(X) (dog(X) → animal(X)) ¬ dog(X) ∨ animal(X)2. dog(fido) dog(fido)3. ∀(Y) (animal(Y) → die(Y)) ¬ animal(Y) ∨ die(Y)

24

Negate the conclusion that Fido will die:

4. ¬ die(fido) ¬ die(fido)

The entire database can be represented as a conjunctionof disjuncts:

(¬ dog(X) ∨ animal(X)) ∧ (¬ animal(Y) ∨ die(Y)) ∧ (dog(fido)) ∧ (¬ die(fido))

Page 7: Strong AI vs. Weak AI Automated Reasoningdzhu/cs280/Chap14.pdfAutomated Reasoning George F Luger ARTIFICIAL INTELLIGENCE 6th edition Structures and Strategies for Complex Problem Solving

Resolution proof for the “dead dog” problem

25

Substitution of Variables

• The sequence of substitutions used gives values of variables to make the goal true

• e.g. • e.g. – Find out if “something will die” is true

– Negated goal: ¬ (∃ Z die(Z))

– The substitution {fido/Z} shows that fido is an instance of animal that will die

26

Conversion to the Clause Form

Prove:Some programmers hate failuresNo programmer hates any success∴ No failure is a success

Let:

27

Let:p(X) = X is a programmer s(X) = X is a successf(X) = X is a failure h(X, Y) = X hates Y

Then premises and negated conclusion are:1) (∃X) [p(X) ∧ (∀Y) (f(Y) → h(X, Y))]2) (∀X) [p(X) → (∀Y) (s(Y) → ¬ h(X, Y))]3) ¬ (∀Y) (f(Y) → ¬ s(Y))

Conversion to the Clause Form

Nine steps to convert statements to the clause form:

1. Eliminate conditionals (→) using a → b ≡ ¬ a ∨ b1) ⇒ (∃X) [p(X) ∧ (∀Y) (¬ f(Y) ∨ h(X, Y))]

2) ⇒ (∀X) [¬ p(X) ∨ (∀Y) (¬s(Y) ∨ ¬ h(X, Y))]

28

2) ⇒ (∀X) [¬ p(X) ∨ (∀Y) (¬s(Y) ∨ ¬ h(X, Y))]

3) ⇒ ¬ (∀Y) (¬ f(Y) ∨ ¬ s(Y))

2. When possible, eliminate negations or reduce their scope using ¬ (¬ a) ≡ a

¬ (a ∨ b) ≡ ¬ a ∧ ¬ b ¬ (∃X) a(X) ≡ (∀X) ¬ a(X)

¬ (a ∧ b) ≡ ¬ a ∨ ¬ b ¬ (∀X) a(X) ≡ (∃X) ¬ a(X)

3) ⇒ (∃Y) (f(Y) ∧ s(Y))

Page 8: Strong AI vs. Weak AI Automated Reasoningdzhu/cs280/Chap14.pdfAutomated Reasoning George F Luger ARTIFICIAL INTELLIGENCE 6th edition Structures and Strategies for Complex Problem Solving

Conversion to the Clause Form

3. Standardize variables (each quantifier has unique variable name).e.g. (∃X) ¬ p(X) ∨ (∀X) p(X) ⇒ (∃X) ¬ p(X) ∨ (∀Y) p(Y)

4. Move all ∀ to front without changing their order

⇒ ∀ ∃ ∧ ¬ ∨

29

1) ⇒ (∀Y) (∃X) [p(X) ∧ (¬ f(Y) ∨ h(X, Y))]

2) ⇒ (∀X) (∀Y) [¬ p(X) ∨ ¬ s(Y) ∨ ¬ h(X, Y)]

5. Eliminate existential quantifiers using Skolemfunctions

1) ⇒ (∀Y) [p(a) ∧ (¬ f(Y) ∨ h(a, Y))]2) ⇒ (∀X) (∀Y) [¬ p(X) ∨ ¬ s(Y) ∨ ¬ h(X, Y)]3) ⇒ f(b) ∧ s(b)

Conversion to the Clause Form

6. Drop all universal quantification1) ⇒ p(a) ∧ (¬ f(Y) ∨ h(a, Y))]2) ⇒ ¬ p(X) ∨ ¬ s(Y) ∨ ¬ h(X, Y)3) ⇒ f(b) ∧ s(b)

30

7. Convert the expression to conjunctive normal form using: p ∨ (q ∧ r) = (p ∨ q) ∧ (p ∨ r) � Our example is already in conjunctive normal

form

Conversion to the Clause Form

8. Eliminate ∧ signs by writing the expression as a set of clauses.

1) ⇒ { p(a), ¬ f(Y) ∨ h(a, Y) }

2) ⇒ { ¬ p(X) ∨ ¬ s(Y) ∨ ¬ h(X, Y) }⇒

31

3) ⇒ { f(b), s(b) }

Or: 1a) p(a)

1b) ¬ f(Y) ∨ h(a, Y)

2a) ¬ p(X) ∨ ¬ s(Y) ∨ ¬ h(X, Y)

3a) f(b)

3b) s(b)

Conversion to the Clause Form

9. Rename variables in clauses so that each clause has unique variable name. Needless sharing of variable names may cause loss of generality in the solution.

32

1a) p(a)

1b) ¬ f(Y) ∨ h(a, Y)

2a) ¬ p(X) ∨ ¬s(Z) ∨ ¬ h(X, Z)

3a) f(b)

3b) s(b)

Page 9: Strong AI vs. Weak AI Automated Reasoningdzhu/cs280/Chap14.pdfAutomated Reasoning George F Luger ARTIFICIAL INTELLIGENCE 6th edition Structures and Strategies for Complex Problem Solving

Unification

• The process of finding substitutions for variables to make arguments match is called unification.

• Without unification it is impossible to

33

• Without unification it is impossible to resolve clauses such as:

¬ f(Y) ∨ h(a, Y)

f(b)

• For (1a) – (3b): {a/X, b/Y, b/Z}

Proof by Resolution Refutation

34

∴ p(a) ∧ ( ¬ f(b) ∨ h(a, b) ) ∧( ¬ p(a) ∨ ¬ s(b) ∨ ¬ h(a, b) ) ∧ f(b) ∧ s(b) = nil

• Since the root is nil, the conclusion is valid.

The Binary Resolution Proof Procedure

Prove aa from the following axioms:

Propositions Clause Form

b ∧ c → a a∨ ¬ b ∨ ¬ cb b

35

b bd ∧ e → c c∨ ¬ d ∨ ¬ e e ∨ f e ∨ fd ∧ ¬ f d

¬ f¬ a

We first convert the propositions to the clause form using:p → q ≡ ¬ p ∨ q and ¬ (p ∧ q) ≡ ¬ p ∨ ¬ q

Then the negated goal, ¬ a, is added to the clause set.

One resolution proof for an example from the propositional calculus.

36

Page 10: Strong AI vs. Weak AI Automated Reasoningdzhu/cs280/Chap14.pdfAutomated Reasoning George F Luger ARTIFICIAL INTELLIGENCE 6th edition Structures and Strategies for Complex Problem Solving

Happy Student Problem Example

• Anyone passing his history exams and winning the lottery is happy. But anyone who studies or is lucky can pass all his who studies or is lucky can pass all his exams. John did not study but he is lucky. Anyone who is lucky wins the lottery. Is Is John happy?John happy?

• To solve the problem, we first change the sentences to the predicate form

37 38

Fig 14.5 One refutation for the “happy student” problem.

39

Exciting Life Problem Example

• All people who are not poor and are smart are happy. Those people who read are smart. John can read and is not poor. Happy smart. John can read and is not poor. Happy people have exciting lives. Can anyone be Can anyone be found with an exciting life?found with an exciting life?

• To apply resolution refutation method we change the sentences first to the predicate form and then to the clause form

40

Page 11: Strong AI vs. Weak AI Automated Reasoningdzhu/cs280/Chap14.pdfAutomated Reasoning George F Luger ARTIFICIAL INTELLIGENCE 6th edition Structures and Strategies for Complex Problem Solving

41

Fig 14.6 Resolution proof for the “exciting life” problem.

42

Strategies and Simplification Techniques for Resolution

• There is a different resolution refutation proof tree for the exciting life problem (Fig. 17)

• For N clauses, there are up to N2 ways of • For N clauses, there are up to Nways of combining them at just the first level. In a large problem the exponential growth of the combinatorics will quickly get out of control

• Therefore search heuristics or strategies are used to control and simplify the proof process

43

Fig 14.7 another resolution refutation for the example of Fig 14.6.

44

Page 12: Strong AI vs. Weak AI Automated Reasoningdzhu/cs280/Chap14.pdfAutomated Reasoning George F Luger ARTIFICIAL INTELLIGENCE 6th edition Structures and Strategies for Complex Problem Solving

The Breadth-First Strategy

• Each clause is compared for resolution with every clause in the clause space on the first round

• The clauses at level n are generated by resolving all clauses at level n-1 against the original clauses all clauses at level n-1 against the original clauses and all clauses previously produced

• It guarantees to find the shortest solution

• It guarantees to find a refutation if one exists

• A good strategy for a small problem

45

Fig 14.8 Complete state space for the “exciting life” problem generated by breadth-first search (to two levels).

46

The Unit Preference Strategy

• A clause of one literal is called a unit clause

• The unit preference strategy uses units for resolving whenever they are availableresolving whenever they are available

• Resolving with a unit clause guarantees the resolvent is smaller than the largest parent clause, which makes it closer to producing the clause of no literals

47

Fig 14.9 Using the unit preference strategy on the exciting life problem.

48

Page 13: Strong AI vs. Weak AI Automated Reasoningdzhu/cs280/Chap14.pdfAutomated Reasoning George F Luger ARTIFICIAL INTELLIGENCE 6th edition Structures and Strategies for Complex Problem Solving

Answer Extraction from Resolution Refutation

• Retaining information on the unification substitution made in the resolution refutation gives information for the correct refutation gives information for the correct answer

• To record the answer, retain the original conclusion to be approved and, into that conclusion, introduce each unification made in the resolution process

49

Unification substitutions of Fig 14.6 applied to the original query

50

Fido Dog Problem Example

Fido the dog goes wherever John, his master, goes.John is at the library. Where is Fido?

First represent the sentences in predicate calculus expressionsand then reduce them to clause form.

51

and then reduce them to clause form.

Predicates: at(john, X) → at(fido, X)at(john, library)

Clauses: ¬ at(john, X) ∨ at(fido, X)at(john, library)

Negated goal:¬ at(fido, Z)

Fig 14.11 Answer extraction process on the “finding fido” problem.

52

Page 14: Strong AI vs. Weak AI Automated Reasoningdzhu/cs280/Chap14.pdfAutomated Reasoning George F Luger ARTIFICIAL INTELLIGENCE 6th edition Structures and Strategies for Complex Problem Solving

Grandparent Problem Example

Everyone has a parent. The parent of a parent is a grandparent.Given the person John, prove that John has a grandparent.

The following are the sentences and negated goal in predicatecalculus expressions and the clause form:

53

calculus expressions and the clause form:

(∀X)(∃Y) p(X, Y)(∀X)(∀Y)(∀Z) p(X, Y) ∧ p(Y, Z) → gp(X, Z)¬ gp(john, W)

p(X, pa(X))¬ p(W, Y) ∨ ¬ p(Y, Z) ∨ gp(W, Z)¬ gp(john, V)

Fig 14.12 Skolemization as part of the answer extraction process.

54

Prolog and Automated Reasoning

• One problem with resolution proof procedure is when predicate calculus descriptors are transformed to clause form, important heuristic problem-solving information is left out. For example:information is left out. For example:

a ∨ ¬ b ∨ c → ¬ d (provides heuristic information)

¬ a ∧ b ∧ ¬ c ∨ ¬ d (no heuristic information)

• Prolog uses Horn clauses whose procedural interpretation provides an explicit strategy that preserves the heuristic information

55

Horn Clause

• A Horn clause contains at most one positive literal

a ∨ ¬ b1 ∨ ¬ b2 ∨ … ∨ ¬ bn

• To emphasize the positive literal (a), the Horn • To emphasize the positive literal (a), the Horn clause is generally written as an implication:

a ← b1 ∧ b2 ∧ … ∧ bn

• Horn clause allows only restricted representation of the clauses, but provides very efficient search strategy for refutation

56

Page 15: Strong AI vs. Weak AI Automated Reasoningdzhu/cs280/Chap14.pdfAutomated Reasoning George F Luger ARTIFICIAL INTELLIGENCE 6th edition Structures and Strategies for Complex Problem Solving

Three Forms of the Horn Clause1. The original clause has no positive literals

← b1 ∧ b2 ∧ … ∧ bn

called a headlessclause or goals

2. It has no negative literalsa1 ←a1 ←a2 ←……

a3 ←called the facts

3. It has one positive and one or more negative literalsa ← b1 ∧ b2 ∧ … ∧ bn

called a rule 57

Reducing Clauses into Horn Form

• It takes three steps– Select and move the positive literal to the very left

• a ∨ ¬ b1 ∨ ¬ b2 ∨ … ∨ ¬ bn

– Change the clause to Horn form by the rule:– Change the clause to Horn form by the rule:• a ∨ ¬ b1 ∨ ¬ b2 ∨ … ∨ ¬ bn ≡ a ← ¬ (¬ b1 ∨ ¬ b2 ∨

… ∨ ¬ bn)

– Use de Morgan’s law to change it to• a ← b1 ∧ b2 ∧ … ∧ bn

• It may not always be possible to transform a clause to the Horn form (e.g. p ∨ q)

58

Search Strategy for Refutation

• Prolog implements left-to-right, depth-first search of clause for refutation

• Given a goal:← a1 ∧ a2 ∧ … ∧ an

and a program P, the Prolog interpreter searches for the first clause in P whose head unifies with a1

a1 ← b1 ∧ b2 ∧ … ∧ bm

• After reducing a1, the goal clause becomes:← b1 ∧ b2 ∧ … ∧ bm ∧ a2 ∧ … ∧ an

59

Search Strategy for Refutation

• The Prolog interpreter continues to reduce the leftmost goal, b1, using the first clause in P that unifies with b1

b ← c ∧ c ∧ … ∧ cb1 ← c1 ∧ c2 ∧ … ∧ cp

• The goal then becomes:← c1 ∧ c2 ∧ … ∧ cp ∧ b2 ∧ … ∧ bn ∧ a2 ∧ … ∧ an

• The search continues from left to right and from top to down until the goal reduces to the null clause

60

Page 16: Strong AI vs. Weak AI Automated Reasoningdzhu/cs280/Chap14.pdfAutomated Reasoning George F Luger ARTIFICIAL INTELLIGENCE 6th edition Structures and Strategies for Complex Problem Solving

Depth-First Search Strategy

goal

a1 a2 ana3 …

61

a1 a2 ana3 …

b1 b2 bmb3…

c1 c2 cpc3 …

Homework Assignment

1. Put the following predicate calculus expression in clause form:

∀ (X) (p(X) → { ∀ (Y) [p(Y) → p(f(X, Y))] ∧ ¬ ∀ (Y) [q(X, Y) → p(Y)]})

2. Prove the following using resolution refutation method.

62

2. Prove the following using resolution refutation method. Draw an inversed binary tree to show the resolution process.

Fact: ¬ d(f) ∨ [b(f) ∧ c(f)]

Rules: ¬ d(X) → ¬ a(X)

b(Y) → e(Y)

g(W) → c(W)

Prove: ¬ a(Z) ∨ e(Z)