Course: Engineering Artificial Intelligence

67
University College Cork (Ireland) Department of Civil and Environmental Engineering Course: Engineering Artificial Intelligence Dr. Radu Marinescu Lecture 7

description

Course: Engineering Artificial Intelligence. Dr. Radu Marinescu. Lecture 7. Today’s class. Logic Propositional logic First order logic. What is logic?. A formal language Syntax – what expressions are legal Semantics – what legal expressions mean - PowerPoint PPT Presentation

Transcript of Course: Engineering Artificial Intelligence

Page 1: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Course:Engineering Artificial Intelligence

Dr. Radu Marinescu

Lecture 7

Page 2: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Today’s class

o Logic• Propositional logic• First order logic

R. Marinescu October-2009 page 2

Page 3: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

What is logic?

o A formal language• Syntax – what expressions are legal• Semantics – what legal expressions mean• Proof system – a way of manipulating syntactic expressions to get

other syntactic expressions (which will tell us something new)

R. Marinescu October-2009 page 3

Page 4: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

What is logic?

o A formal language• Syntax – what expressions are legal• Semantics – what legal expressions mean• Proof system – a way of manipulating syntactic expressions to get

other syntactic expressions (which will tell us something new)o Why proofs? Two kinds of inferences an agent

might want to make• Multiple percepts => conclusions about the world• Current state & operators => properties of next state

R. Marinescu October-2009 page 4

Page 5: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Propositional logic syntax

o Syntax: what you’re allowed to write•for (int t = 0; t == 100; t++) {…}• “Colorless green ideas sleep furiously” (Noam Chomsky)

R. Marinescu October-2009 page 5

Page 6: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Propositional logic syntax

o Syntax: what you’re allowed to write•for (int t = 0; t == 100; t++) {…}• “Colorless green ideas sleep furiously” (Noam Chomsky)

o Sentences (WFF: well formed formulas)•true and false are sentences

R. Marinescu October-2009 page 6

Page 7: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Propositional logic syntax

o Syntax: what you’re allowed to write•for (int t = 0; t == 100; t++) {…}• “Colorless green ideas sleep furiously” (Noam Chomsky)

o Sentences (WFF: well formed formulas)•true and false are sentences• Propositional variables are sentences: P, Q, R, Z

R. Marinescu October-2009 page 7

Page 8: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Propositional logic syntax

o Syntax: what you’re allowed to write•for (int t = 0; t == 100; t++) {…}• “Colorless green ideas sleep furiously” (Noam Chomsky)

o Sentences (WFF: well formed formulas)•true and false are sentences• Propositional variables are sentences: P, Q, R, Z• If Φ and Ψ are sentences, then so are

(Φ), ¬ Φ, Φ /\ Ψ, Φ \/ Ψ, Φ → Ψ, Φ ↔ Ψ

R. Marinescu October-2009 page 8

Page 9: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Propositional logic syntax

o Syntax: what you’re allowed to write•for (int t = 0; t == 100; t++) {…}• “Colorless green ideas sleep furiously” (Noam Chomsky)

o Sentences (WFF: well formed formulas)•true and false are sentences• Propositional variables are sentences: P, Q, R, Z• If Φ and Ψ are sentences, then so are

(Φ), ¬ Φ, Φ ˄ Ψ, Φ ˅ Ψ, Φ → Ψ, Φ ↔ Ψ• Nothing else is a sentence

R. Marinescu October-2009 page 9

Page 10: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Precedence

o Precedence rules enable “shorthand” form of sentences, but formally only the fully parenthesized form is legal

o Syntactically ambiguous forms allowed in shorthand only when semantically equivalent: A ˄ B ˄ C is equivalent to (A ˄ B) ˄ C and A ˄ (B ˄ C)

R. Marinescu October-2009 page 10

¬

˄

˅

highest

lowest

A ˅ B ˄ C A ˅ (B ˄ C)

A ˄ B → C ˅ D (A ˄ B) → (C ˅ D)

A → B ˅ C ↔ D (A → (B ˅ C)) ↔ D

Page 11: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Semantics

o Meaning of a sentence is truth value {t, f}o Interpretation is an assignment of truth values to

propositional variables• holds(Φ, i) [Sentence Φ is t in interpretation i]• fails(Φ, i) [Sentence Φ is f in interpretation i]

R. Marinescu October-2009 page 11

Page 12: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Semantic rules

o holds(true, i) for all io fails(false, i) for all Io holds(¬Φ, i) if and only if fails(Φ, i)

o holds(Φ ˄ Ψ, i) iff holds(Φ, i) and holds(Ψ, i)

o holds(Φ ˅ Ψ, i) iff holds(Φ, i) or holds(Ψ, i)

R. Marinescu October-2009 page 12

(negation)

(conjunction)

(disjunction)

Page 13: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Semantic rules

o holds(true, i) for all io fails(false, i) for all Io holds(¬Φ, i) if and only if fails(Φ, i)

o holds(Φ ˄ Ψ, i) iff holds(Φ, i) and holds(Ψ, i)

o holds(Φ ˅ Ψ, i) iff holds(Φ, i) or holds(Ψ, i)

o holds(P, i) iff i(P) = to fails(P, i) iff i(P) = f

R. Marinescu October-2009 page 13

(negation)

(conjunction)

(disjunction)

Page 14: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Some important shorthand

o Φ → Ψ ≡ ¬Φ ˅ Ψ (conditional, implication)

o Φ ↔ Ψ ≡ (Φ → Ψ) ˄ (Ψ → Φ) (biconditional, equivalence)

R. Marinescu October-2009 page 14

antecedent → consequent

Page 15: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Some important shorthand

o Φ → Ψ ≡ ¬Φ ˅ Ψ (conditional, implication)

o Φ ↔ Ψ ≡ (Φ → Ψ) ˄ (Ψ → Φ) (biconditional, equivalence)

R. Marinescu October-2009 page 15

antecedent → consequent

P Q ¬P P˄Q P˅Q P→Q Q→P P↔Q

f f t f f t t t

f t t f t t f f

t f f f t f t f

t t f t t t t t

Truth tables

Page 16: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Some important shorthand

o Φ → Ψ ≡ ¬Φ ˅ Ψ (conditional, implication)

o Φ ↔ Ψ ≡ (Φ → Ψ) ˄ (Ψ → Φ) (biconditional, equivalence)

R. Marinescu October-2009 page 16

antecedent → consequent

P Q ¬P P˄Q P˅Q P→Q Q→P P↔Q

f f t f f t t t

f t t f t t f f

t f f f t f t f

t t f t t t t t

Truth tables

Note that implication is not “causality”, if P is f then P→Q is t

Page 17: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Terminology

o A sentence is valid iff its truth table value is t in all interpretations

• Valid sentences: true, ¬false, P ˅ ¬P

o A sentence is satisfiable iff its truth value is t in at least one interpretation

• Valid sentences: P, true, ¬P

o A sentence is unsatisfiable iff its truth value is f in all interpretations

• Unsatisfiable sentences: P ˄¬P, false, ¬true

R. Marinescu October-2009 page 17

Page 18: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Terminology

o A sentence is valid iff its truth table value is t in all interpretations

• Valid sentences: true, ¬false, P ˅ ¬P

o A sentence is satisfiable iff its truth value is t in at least one interpretation

• Valid sentences: P, true, ¬P

o A sentence is unsatisfiable iff its truth value is f in all interpretations

• Unsatisfiable sentences: P ˄¬P, false, ¬true

R. Marinescu October-2009 page 18

All are finitely decidable!

Page 19: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Examples

R. Marinescu October-2009 page 19

Sentence Valid?Interpretation that makesentence’s truth value = f

smoke → firesmoke ˅ ¬fire

valid

Page 20: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Examples

R. Marinescu October-2009 page 20

Sentence Valid?Interpretation that makesentence’s truth value = f

smoke → smoke¬ smoke ˅ smoke

valid

smoke → fire¬ smoke ˅ fire

satisfiable,not valid

smoke = t, fire = f

Page 21: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Examples

R. Marinescu October-2009 page 21

Sentence Valid?Interpretation that makesentence’s truth value = f

smoke → smoke¬smoke ˅ smoke

valid

smoke → fire¬smoke ˅ fire

satisfiable,not valid

smoke = t, fire = f

(s → f) → (¬s → ¬f) satisfiable,not valid

s = f, f = ts → f = t, ¬s → ¬f = f

Page 22: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Examples

R. Marinescu October-2009 page 22

Sentence Valid?Interpretation that makesentence’s truth value = f

smoke → smoke¬smoke ˅ smoke

valid

smoke → fire¬smoke ˅ fire

satisfiable,not valid

smoke = t, fire = f

(s → f) → (¬s → ¬f) satisfiable,not valid

s = f, f = ts → f = t, ¬s → ¬f = f

(s → f) → (¬f → ¬s) valid

Page 23: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Satisfiability

o Related to constraint satisfactiono Given a sentence S, try to find an interpretation i

such that holds(S, i)o Analogous to finding an assignment of values to

variables such that the constraints hold

R. Marinescu October-2009 page 23

Page 24: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Satisfiability

o Related to constraint satisfactiono Given a sentence S, try to find an interpretation i

such that holds(S, i)o Analogous to finding an assignment of values to

variables such that the constraints hold

o Brute force method: enumerate all interpretations and check

o Better methods• Heuristic search• Constraint propagation• Stochastic search

R. Marinescu October-2009 page 24

Page 25: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Satisfiability problems

o Scheduling nurses to work in a hospital• Propositional variables represent, for example, that Pat is working

on Tuesday at 2• Constraints on the schedule are represented using logical

expressions over the variables

o Finding bugs in software• Propositional variables represent states of the program• Use logic to describe how the program works and to assert there

is a bug• If the sentence is satisfiable, you’ve found a bug

R. Marinescu October-2009 page 25

Page 26: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

A good lecture?

o Imagine we knew that:• If today is sunny, then Thomas will be happy (S → H)• If Thomas is happy, the lecture will be good (H → G)• Today is sunny (S)

Should we conclude that the lecture will be good?

R. Marinescu October-2009 page 26

Page 27: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Checking interpretations

R. Marinescu October-2009 page 27

S H G

t t t

t t f

t f t

t f f

f t t

f t f

f f t

f f f

Page 28: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Checking interpretations

R. Marinescu October-2009 page 28

S H G S→H H→G S

t t t t t t

t t f t f t

t f t f t t

t f f f t t

f t t t t f

f t f t f f

f f t t t f

f f f t t f

Page 29: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Checking interpretations

R. Marinescu October-2009 page 29

S H G S→H H→G S G

t t t t t t t

t t f t f t f

t f t f t t t

t f f f t t f

f t t t t f t

f t f t f f f

f f t t t f t

f f f t t f f

Good lecture!

Page 30: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Entailment

o A knowledge base (KB) entails a sentence S iff every interpretation that makes KB true also makes S true

R. Marinescu October-2009 page 30

KB Sholds

interpretations interpretationssubset

holds holds

Page 31: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Computing entailment

o Enumerate all interpretationso Select those in which all elements of KB are trueo Check to see if S is true in all those

interpretations

R. Marinescu October-2009 page 31

KB Sholds

interpretations interpretationssubset

holds holds

Page 32: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Computing entailment

o Enumerate all interpretationso Select those in which all elements of KB are trueo Check to see if S is true in all those

interpretations

R. Marinescu October-2009 page 32

KB Sholds

interpretations interpretationssubset

holds holds

Way too many interpretations in general !!

Page 33: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Entailment and Proof

o A proof is a way to test whether a KB entails a sentence, without enumerating all possible interpretations

R. Marinescu October-2009 page 33

KB Sholds

interpretations interpretationssubset

holds holds

proof

Page 34: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Proof

o Proof is a sequence of sentenceso First ones are premises (in KB)o Then, you can write down on the next line the result

of applying an inference rule to previous lineso When S is on a line, you have proved S from KB

o If inference rules are sound, then any S you can prove from KB is entailed by KB

o If inference rules are complete, then any S that is entailed by KB can be proved from KB

R. Marinescu October-2009 page 34

Page 35: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Natural deduction

o Some inference rules

R. Marinescu October-2009 page 35

α → β

α

β

Modusponens

α → β

¬β

¬α

Modustolens

α

β

α ˄ β

AND-introduction

α ˄ β

α

AND-elimination

Page 36: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Natural deduction example

R. Marinescu October-2009 page 36

Step Formula Derivation

1 P ˄ Q given

2 P → R given

3 (Q ˄ R) → S given

Prove S

Page 37: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Natural deduction example

R. Marinescu October-2009 page 37

Step Formula Derivation

1 P ˄ Q given

2 P → R given

3 (Q ˄ R) → S given

4 P 1 And-Elim

Prove S

Page 38: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Natural deduction example

R. Marinescu October-2009 page 38

Step Formula Derivation

1 P ˄ Q given

2 P → R given

3 (Q ˄ R) → S given

4 P 1 And-Elim

5 R 4,2 Modus Ponens

Prove S

Page 39: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Natural deduction example

R. Marinescu October-2009 page 39

Step Formula Derivation

1 P ˄ Q given

2 P → R given

3 (Q ˄ R) → S given

4 P 1 And-Elim

5 R 4,2 Modus Ponens

6 Q 1 And-Elim

Prove S

Page 40: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Natural deduction example

R. Marinescu October-2009 page 40

Step Formula Derivation

1 P ˄ Q given

2 P → R given

3 (Q ˄ R) → S given

4 P 1 And-Elim

5 R 4,2 Modus Ponens

6 Q 1 And-Elim

7 Q ˄ R 5,6 And-Intro

Prove S

Page 41: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Natural deduction example

R. Marinescu October-2009 page 41

Step Formula Derivation

1 P ˄ Q given

2 P → R given

3 (Q ˄ R) → S given

4 P 1 And-Elim

5 R 4,2 Modus Ponens

6 Q 1 And-Elim

7 Q ˄ R 5,6 And-Intro

8 S 7,3 Modus Ponens

Prove S

Page 42: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Proof systems

o There are many natural deduction systems; they are typically “proof checkers”, sound but not complete

o Natural deduction uses lots of inference rules which introduces a large branching factor in the search for a proof

o In general, you need to do “proof by cases” which introduces even more branching

R. Marinescu October-2009 page 42

1 P ˅ R

2 Q ˅ R

3 P → R

Prove R

Page 43: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Propositional resolution

o Resolution rule:

o Single inference rule is a sound and complete proof system

o Requires all sentences to be converted to conjunctive normal form (CNF)

R. Marinescu October-2009 page 43

α ˅ β

¬β ˅ γ

α ˅ γ

Page 44: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Conjunctive normal form (CNF)

o Conjunctive normal form (CNF) formulas:

R. Marinescu October-2009 page 44

CBADBCBA

Page 45: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Conjunctive normal form (CNF)

o Conjunctive normal form (CNF) formulas:

• (A ˅ B ˅ ¬C) is a clause, which is a disjunction of literals

• A, B, and ¬C are literals, each of which is a variable or the negation of a variable

• Each clause is a requirement that must be satisfied and can be satisfied in multiple ways

• Every sentence in propositional logic can be written in CNF

R. Marinescu October-2009 page 45

CBADBCBA

Page 46: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Converting to CNF

1. Eliminate arrows using definitions

2. Drive in negations using De Morgan’s Laws

3. Distribute OR over AND

4. Every sentence can be converted to CNF, but it may grow exponentially in size

R. Marinescu October-2009 page 46

CABACBA

Page 47: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

CNF conversion example

R. Marinescu October-2009 page 47

DCBA

Page 48: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

CNF conversion example

1. Eliminate arrows

R. Marinescu October-2009 page 48

DCBA

DCBA

Page 49: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

CNF conversion example

1. Eliminate arrows

2. Drive in negations

R. Marinescu October-2009 page 49

DCBA

DCBA

DCBA

Page 50: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

CNF conversion example

1. Eliminate arrows

2. Drive in negations

3. Distribute

R. Marinescu October-2009 page 50

DCBA

DCBA

DCBA

DCBDCA

Page 51: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Propositional resolution

o Resolution rule:

R. Marinescu October-2009 page 51

α ˅ β

¬β ˅ γ

α ˅ γ

Page 52: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Propositional resolution

o Resolution rule:

o Resolution refutation:• Convert all sentences to CNF• Negate the desired conclusion (converted to CNF)• Apply resolution until either

Derive false (a contradiction) Can’t apply any more

R. Marinescu October-2009 page 52

α ˅ β

¬β ˅ γ

α ˅ γ

Page 53: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Propositional resolution

o Resolution refutation:• Convert all sentences to CNF• Negate the desired conclusion (converted to CNF)• Apply resolution until either

Derive false (a contradiction) Can’t apply any more

o Resolution refutation is sound and complete• If we derive a contradiction, then the conclusion follows from

axioms• If we can’t apply any more, then the conclusion cannot be proved

from the axioms

R. Marinescu October-2009 page 53

Page 54: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Propositional resolution example

R. Marinescu October-2009 page 54

1 P ˅ Q

2 P → R

3 Q → R

Prove R Step Formula Derivation

Page 55: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Propositional resolution example

R. Marinescu October-2009 page 55

1 P ˅ Q

2 P → R

3 Q → R

Prove R Step Formula Derivation

1 P ˅ Q given

2 ¬P ˅ R given

Page 56: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Propositional resolution example

R. Marinescu October-2009 page 56

Prove R Step Formula Derivation

1 P ˅ Q given

2 ¬P ˅ R given

1 P ˅ Q

2 P → R

3 Q → R

Page 57: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Propositional resolution example

R. Marinescu October-2009 page 57

Prove R Step Formula Derivation

1 P ˅ Q given

2 ¬P ˅ R given

3 ¬Q ˅ R given

1 P ˅ Q

2 P → R

3 Q → R

Page 58: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Propositional resolution example

R. Marinescu October-2009 page 58

Prove R Step Formula Derivation

1 P ˅ Q given

2 ¬P ˅ R given

3 ¬Q ˅ R given

4 ¬R negated conclusion

1 P ˅ Q

2 P → R

3 Q → R

Page 59: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Propositional resolution example

R. Marinescu October-2009 page 59

Prove R Step Formula Derivation

1 P ˅ Q given

2 ¬P ˅ R given

3 ¬Q ˅ R given

4 ¬R negated conclusion

5 Q ˅ R 1,2

1 P ˅ Q

2 P → R

3 Q → R

Page 60: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Propositional resolution example

R. Marinescu October-2009 page 60

Prove R Step Formula Derivation

1 P ˅ Q given

2 ¬P ˅ R given

3 ¬Q ˅ R given

4 ¬R negated conclusion

5 Q ˅ R 1,2

6 ¬P 2,4

1 P ˅ Q

2 P → R

3 Q → R

Page 61: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Propositional resolution example

R. Marinescu October-2009 page 61

Prove R Step Formula Derivation

1 P ˅ Q given

2 ¬P ˅ R given

3 ¬Q ˅ R given

4 ¬R negated conclusion

5 Q ˅ R 1,2

6 ¬P 2,4

7 ¬Q 3,4

1 P ˅ Q

2 P → R

3 Q → R

Page 62: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Propositional resolution example

R. Marinescu October-2009 page 62

Prove R Step Formula Derivation

1 P ˅ Q given

2 ¬P ˅ R given

3 ¬Q ˅ R given

4 ¬R negated conclusion

5 Q ˅ R 1,2

6 ¬P 2,4

7 ¬Q 3,4

8 R 5,7

1 P ˅ Q

2 P → R

3 Q → R

Page 63: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Propositional resolution example

R. Marinescu October-2009 page 63

Prove R Step Formula Derivation

1 P ˅ Q given

2 ¬P ˅ R given

3 ¬Q ˅ R given

4 ¬R negated conclusion

5 Q ˅ R 1,2

6 ¬P 2,4

7 ¬Q 3,4

8 R 5,7

9 [] 4,8

1 P ˅ Q

2 P → R

3 Q → R

Page 64: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Propositional resolution example

R. Marinescu October-2009 page 64

Prove R Step Formula Derivation

1 P ˅ Q given

2 ¬P ˅ R given

3 ¬Q ˅ R given

4 ¬R negated conclusion

5 Q ˅ R 1,2

6 ¬P 2,4

7 ¬Q 3,4

8 R 5,7

9 [] 4,8

1 P ˅ Q

2 P → R

3 Q → R

false ˅ R

¬R ˅ false

false ˅ false

Page 65: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Example problem

R. Marinescu October-2009 page 65

Prove R

1 (P → Q) → Q

2 (P → R) → R

3 (R →S) → ¬(S → Q)

Do it yourselves!

Page 66: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Proof strategies

o Unit preference: prefer a resolution step involving a unit clause (clause with one literal)

• Produces a shorter clause – which is good since we are trying to produce a zero-length clause, that is a contradiction

R. Marinescu October-2009 page 66

Page 67: Course: Engineering Artificial Intelligence

University College Cork (Ireland) Department of Civil and Environmental Engineering

Proof strategies

o Unit preference: prefer a resolution step involving a unit clause (clause with one literal)

• Produces a shorter clause – which is good since we are trying to produce a zero-length clause, that is a contradiction

o Set of support: choose a resolution involving the negated goal or any clause derived from the negated goal

• We’re trying to produce a contradiction that follows from the negated goal, so these are “relevant” clauses

• If a contradiction exists, one can find one using the set-of-support strategy

R. Marinescu October-2009 page 67