CS325 Artificial Intelligence Ch. 7, 8, 9 Logic, Knowledge, and - - PowerPoint PPT Presentation

cs325 artificial intelligence ch 7 8 9 logic knowledge
SMART_READER_LITE
LIVE PREVIEW

CS325 Artificial Intelligence Ch. 7, 8, 9 Logic, Knowledge, and - - PowerPoint PPT Presentation

CS325 Artificial Intelligence Ch. 7, 8, 9 Logic, Knowledge, and Inference Cengiz Gnay, Ph.D. Spring 2013 Gnay Ch. 7, 8, 9 Logic, Knowledge, and Inference Is Logic Overrated? We did so far: Intelligent agents Problem Solving


slide-1
SLIDE 1

CS325 Artificial Intelligence

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference

Cengiz Günay, Ph.D. Spring 2013

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-2
SLIDE 2

Is Logic Overrated?

We did so far: Intelligent agents Problem Solving Probability Machine Learning

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-3
SLIDE 3

Is Logic Overrated?

We did so far: Intelligent agents Problem Solving Probability Machine Learning Did we forget “thinking rationally?”

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-4
SLIDE 4

Is Logic Overrated?

We did so far: Intelligent agents Problem Solving Probability Machine Learning Did we forget “thinking rationally?” An agent needs logic for:

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-5
SLIDE 5

Is Logic Overrated?

We did so far: Intelligent agents Problem Solving Probability Machine Learning Did we forget “thinking rationally?” An agent needs logic for: To represent a model of the world And to reason about it

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-6
SLIDE 6

Entry/Exit Surveys

Exit survey: Unsupervised Learning What changed in your understanding? Any new suggestions on where would you use it? Entry survey: Logic (0.25 points of final grade) What language would you use to represent logic? How would you make an agent reason?

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-7
SLIDE 7

Tools of Logic

It’s been a while since Aristotle, do we still need formal logic?

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-8
SLIDE 8

Tools of Logic

It’s been a while since Aristotle, do we still need formal logic? Our society is based on logic: we take it for granted.

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-9
SLIDE 9

Tools of Logic

It’s been a while since Aristotle, do we still need formal logic? Our society is based on logic: we take it for granted. In this class, we’ll learn the tools of logic for representation and inference: Propositional logic First-order logic

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-10
SLIDE 10

The Simplest: Propositional Logic

Remember?

.001

P(B)

.002

P(E)

Alarm Earthquake MaryCalls JohnCalls Burglary

B

T T F F

E

T F T F .95 .29 .001 .94

P(A|B,E) A

T F .90 .05

P(J|A) A

T F .70 .01

P(M|A)

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-11
SLIDE 11

The Simplest: Propositional Logic

Remember?

.001

P(B)

.002

P(E)

Alarm Earthquake MaryCalls JohnCalls Burglary

B

T T F F

E

T F T F .95 .29 .001 .94

P(A|B,E) A

T F .90 .05

P(J|A) A

T F .70 .01

P(M|A)

(E ∨ B) ⇒ A, Correct?

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-12
SLIDE 12

The Simplest: Propositional Logic

Remember?

.001

P(B)

.002

P(E)

Alarm Earthquake MaryCalls JohnCalls Burglary

B

T T F F

E

T F T F .95 .29 .001 .94

P(A|B,E) A

T F .90 .05

P(J|A) A

T F .70 .01

P(M|A)

(E ∨ B) ⇒ A, Correct? A ⇒ (J ∧ M)?

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-13
SLIDE 13

The Simplest: Propositional Logic

(E ∨ B) ⇒ A, Correct? A ⇒ (J ∧ M)? Propositional Logic Operators Cheat Sheet ∧ And ∨ Or ¬ Negation () Grouping ⇒ Implies ⇔ Equivalence

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-14
SLIDE 14

The Simplest: Propositional Logic

(E ∨ B) ⇒ A, Correct? A ⇒ (J ∧ M)? Propositional Logic Operators Cheat Sheet ∧ And ∨ Or ¬ Negation () Grouping ⇒ Implies ⇔ Equivalence Model of the world represented as: {B : True, E : False, . . .}

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-15
SLIDE 15

Can You Handle the Truth Tables?

P Q ¬ P P ∧ Q P ∨ Q P ⇒ Q P ⇔ Q false false true false false true true false true true false true true false true false false false true false false true true false true true true true

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-16
SLIDE 16

Can You Handle the Truth Tables?

P Q ¬ P P ∧ Q P ∨ Q P ⇒ Q P ⇔ Q false false true false false true true false true true false true true false true false false false true false false true true false true true true true

Mostly consistent with English meanings, except?

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-17
SLIDE 17

Can You Handle the Truth Tables?

P Q ¬ P P ∧ Q P ∨ Q P ⇒ Q P ⇔ Q false false true false false true true false true true false true true false true false false false true false false true true false true true true true

Mostly consistent with English meanings, except? OR operation (∨) is inclusive

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-18
SLIDE 18

Can You Handle the Truth Tables?

P Q ¬ P P ∧ Q P ∨ Q P ⇒ Q P ⇔ Q false false true false false true true false true true false true true false true false false false true false false true true false true true true true

Mostly consistent with English meanings, except? OR operation (∨) is inclusive Except ⇒ and ⇔, so consult the truth table.

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-19
SLIDE 19

Can You Handle the Truth Tables?

P Q ¬ P P ∧ Q P ∨ Q P ⇒ Q P ⇔ Q false false true false false true true false true true false true true false true false false false true false false true true false true true true true

Mostly consistent with English meanings, except? OR operation (∨) is inclusive Except ⇒ and ⇔, so consult the truth table. Question: E: 5 is even, S: the earth goes around the sun E ⇒ S: True or False?

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-20
SLIDE 20

Can You Handle the Truth Tables?

P Q ¬ P P ∧ Q P ∨ Q P ⇒ Q P ⇔ Q false false true false false true true false true true false true true false true false false false true false false true true false true true true true

Mostly consistent with English meanings, except? OR operation (∨) is inclusive Except ⇒ and ⇔, so consult the truth table. Question: E: 5 is even, S: the earth goes around the sun E ⇒ S: True or False? ¬E ⇒ ¬S: True or False?

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-21
SLIDE 21

Let’s Put Truth Tables to Use

P Q P ∧ (P ⇒ Q) ¬(¬P ∨ ¬Q) P ∧ (P ⇒ Q) ⇔ ¬(¬P ∨ ¬Q) False False False True True False True True

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-22
SLIDE 22

Let’s Put Truth Tables to Use

P Q P ∧ (P ⇒ Q) ¬(¬P ∨ ¬Q) P ∧ (P ⇒ Q) ⇔ ¬(¬P ∨ ¬Q) False False Yes False True Yes True False Yes True True Yes Yes Yes

Trick: ¬(¬P ∨ ¬Q) ⇒ P ∧ Q

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-23
SLIDE 23

World Representation

What we know to be True: (E ∨ B) ⇒ A A ⇒ (J ∧ M) B

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-24
SLIDE 24

World Representation

What we know to be True: (E ∨ B) ⇒ A A ⇒ (J ∧ M) B Can we infer? T F ? E B A J M

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-25
SLIDE 25

World Representation

What we know to be True: (E ∨ B) ⇒ A A ⇒ (J ∧ M) B Can we infer? T F ? X E X B X A X J X M

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-26
SLIDE 26

Validity and Satisfiability

Valid: Always true. Satisfiable: Possible to be true. Unsatisfiable: Impossible to be true.

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-27
SLIDE 27

Validity and Satisfiability

Valid: Always true. Satisfiable: Possible to be true. Unsatisfiable: Impossible to be true. V S U P P ∨ ¬P P ∧ ¬P P ∨ Q ∨ (P ⇔ Q) (Q ⇒ P) ∨ (P ⇒ Q) (Food ⇒ Party) ∨ (Drinks ⇒ Party) ⇒ (Food ∧ Drinks ⇒ Party)

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-28
SLIDE 28

Validity and Satisfiability

Valid: Always true. Satisfiable: Possible to be true. Unsatisfiable: Impossible to be true. V S U X P X P ∨ ¬P X P ∧ ¬P X P ∨ Q ∨ (P ⇔ Q) X (Q ⇒ P) ∨ (P ⇒ Q) X (Food ⇒ Party) ∨ (Drinks ⇒ Party) ⇒ (Food ∧ Drinks ⇒ Party)

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-29
SLIDE 29

Propositional Logic: Limitations?

P Q ¬ P P ∧ Q P ∨ Q P ⇒ Q P ⇔ Q false false true false false true true false true true false true true false true false false false true false false true true false true true true true

1 Only true and false propositions, no objects. Therefore no

relations between objects

2 No uncertainty (except totally unknown entities) 3 No general statements like ALL or ANY

Cumbersome for large domains.

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-30
SLIDE 30

Propositional Logic: Limitations?

P Q ¬ P P ∧ Q P ∨ Q P ⇒ Q P ⇔ Q false false true false false true true false true true false true true false true false false false true false false true true false true true true true

1 Only true and false propositions, no objects. Therefore no

relations between objects

2 No uncertainty (except totally unknown entities) 3 No general statements like ALL or ANY

Cumbersome for large domains. Next: First Order Logic (FOL), fixes 1 & 3

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-31
SLIDE 31

First Order Logic

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-32
SLIDE 32

First Order Logic

Can also compare in terms of representation type:

1 Atomic: facts Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-33
SLIDE 33

First Order Logic

Can also compare in terms of representation type:

1 Atomic: facts 2 Factored: facts divided into parts (used both in prop. logic

and probability)

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-34
SLIDE 34

First Order Logic

Can also compare in terms of representation type:

1 Atomic: facts 2 Factored: facts divided into parts (used both in prop. logic

and probability)

3 Structured: facts, objects and relations (only in FOL) Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-35
SLIDE 35

First Order Logic

Can also compare in terms of representation type:

1 Atomic: facts 2 Factored: facts divided into parts (used both in prop. logic

and probability)

3 Structured: facts, objects and relations (only in FOL) Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-36
SLIDE 36

FOL World Model

What was the model in propositional logic?

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-37
SLIDE 37

FOL World Model

What was the model in propositional logic? {P : True, Q : False, . . .}

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-38
SLIDE 38

FOL World Model

What was the model in propositional logic? {P : True, Q : False, . . .} Let’s represent these objects in First Order Logic: Constants: {A, B, C, D, 1, 2, 3} Relations: above: {[A, B], [C, D], . . . ), vowel: {[A]} rainy: {} Functions: numberof: {A → 1, B → 3, . . . )

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-39
SLIDE 39

FOL Syntax

Sentences vowel(A) above(A,B) 2 = 2 Terms constants: A, B, 2 variables: x, y func: numberof(A)

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-40
SLIDE 40

FOL Syntax

Sentences vowel(A) above(A,B) 2 = 2 Terms constants: A, B, 2 variables: x, y func: numberof(A) Operators: ∨ ∧ ¬ ⇒⇔ ()

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-41
SLIDE 41

FOL Syntax

Sentences vowel(A) above(A,B) 2 = 2 Terms constants: A, B, 2 variables: x, y func: numberof(A) Operators: ∨ ∧ ¬ ⇒⇔ () Quantifiers: ∀x ∃y ∀x vowel(A) ⇒ numberof(x) = 1 ∃x numberof(x) = 2 Note: Default is ∀.

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-42
SLIDE 42

FOL in Action

Remember the 2-location vacuum world?

1 2 3 4 5 6 7 8

Constants: A, B, V , D1, D2 Relations: Loc, Vacuum, Dirt, At(o, l)

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-43
SLIDE 43

FOL in Action

Remember the 2-location vacuum world?

1 2 3 4 5 6 7 8

Constants: A, B, V , D1, D2 Relations: Loc, Vacuum, Dirt, At(o, l) Say:

1 Vacuum is at location A: Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-44
SLIDE 44

FOL in Action

Remember the 2-location vacuum world?

1 2 3 4 5 6 7 8

Constants: A, B, V , D1, D2 Relations: Loc, Vacuum, Dirt, At(o, l) Say:

1 Vacuum is at location A: At(V , A) Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-45
SLIDE 45

FOL in Action

Remember the 2-location vacuum world?

1 2 3 4 5 6 7 8

Constants: A, B, V , D1, D2 Relations: Loc, Vacuum, Dirt, At(o, l) Say:

1 Vacuum is at location A: At(V , A) 2 World is clean: Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-46
SLIDE 46

FOL in Action

Remember the 2-location vacuum world?

1 2 3 4 5 6 7 8

Constants: A, B, V , D1, D2 Relations: Loc, Vacuum, Dirt, At(o, l) Say:

1 Vacuum is at location A: At(V , A) 2 World is clean:

∀d ∀l Dirt(d) ∧ Loc(l) ⇒ ¬At(d, l)

3 Vaccum is at dirty location Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-47
SLIDE 47

FOL in Action

Remember the 2-location vacuum world?

1 2 3 4 5 6 7 8

Constants: A, B, V , D1, D2 Relations: Loc, Vacuum, Dirt, At(o, l) Say:

1 Vacuum is at location A: At(V , A) 2 World is clean:

∀d ∀l Dirt(d) ∧ Loc(l) ⇒ ¬At(d, l)

3 Vaccum is at dirty location

∃d ∃l Dirt(d) ∧ Loc(l) ∧ At(d, l) ∧ At(V , l)

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-48
SLIDE 48

FOL Example

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-49
SLIDE 49

FOL Example

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference
slide-50
SLIDE 50

Exit Survey

Exit survey: Logic Where would you use propositional vs. FOL? What is the importance of logic representation over what we saw earlier?

Günay

  • Ch. 7, 8, 9 – Logic, Knowledge, and Inference