+ All Categories
Home > Documents > Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)

Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)

Date post: 31-Mar-2015
Category:
Upload: jayla-easter
View: 221 times
Download: 0 times
Share this document with a friend
Popular Tags:
31
Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)
Transcript
Page 1: Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)

Computer Science CPSC 322

Lecture 25

Top Down Proof Procedure

(Ch 5.2.2)

Page 2: Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)

Announcements

• Two sets of practice exercises on logic are now available (#8 and #9)

• Do them!• Pay special attention to “Directed Questions”. • They can really help you do well on the conceptual

questions part of the final• Can show you how to be precise when you define

concepts

• After today’s class, you will know enough to do Q2 –a,b,c in Assignment 3• Perhaps d and e as well, depending on how far we get

Page 3: Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)

Lecture Overview

• Recap Lecture 24

• Bottom-Up Proof Procedure

• Soundness

• Completeness

• Intro to Top-Down Proof Procedure (time permitting)

Page 4: Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)

Where Are We?Environment

Problem Type

Query

Planning

Deterministic Stochastic

Constraint Satisfaction Search

Arc Consistency

Search

Search

Logics

STRIPS

Vars + Constraints

Value Iteration

Variable

Elimination

Belief Nets

Decision Nets

Markov Processes

Static

Sequential

Representation

ReasoningTechnique

Variable

EliminationBack to static

problems, but with richer

representation

Page 5: Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)

Logic: a framework for representation & reasoning

To Define a Logic We Need • Syntax: specifies the symbols used, and how they

can be combined to form legal sentences • Knowledge base is a set of sentences in the language

• Semantics: specifies the meaning of symbols and sentences

• Reasoning theory or proof procedure: a specification of how an answer can be produced.• Sound: only generates correct answers with respect to

the semantics

• Complete: Guaranteed to find an answer if it exists

Page 6: Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)

Propositional Definite Clauses: Syntax

Definition (atom)

An atom is a symbol starting with a lower case letter

Definition (body)

A body is an atom or is of the form b1 ∧ b2 where b1 and b2 are bodies.

Definition (definite clause)

A definite clause is

- an atom or

- a rule of the form h ← b where h is an

atom (“head”) and b is a body. (Read this as “h if b”.)

Definition (KB)

A knowledge base (KB) is a set of definite clauses

Examples: p1; live_l1

Examples: p1 ∧ p2; ok_w1 ∧ live_w0

Examples: p1 ← p2; live_w0 ← live_w1 ∧ up_s2

Page 7: Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)

Propositional Definite Clauses: Semantics

Definition (model)A model of a knowledge base KB is an interpretation in

which KB is true.

Similar to CSPs: a model of a set of clauses is an interpretation that makes all of the clauses true

Definition (interpretation)

An interpretation I assigns a truth value to each atom.

Definition (truth values of statements)• A body b1 ∧ b2 is true in I if and only if b1 is true in

I and b2 is true in I.• A rule h ← b is false in I if and only if b is true in I

and h is false in I.• A knowledge base KB is true in I if and only if

every clause in KB is true in I.

Page 8: Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)

OK but….• …. Who cares? Where are we going with this?

• Remember what we want to do with Logic

1) Tell the system knowledge about a task domain.• This is your KB• which expresses true statements about the world

2) Ask the system whether new statements about the domain are true or false.• Need a proof procedure that allows the system give

responses that are– Sound: only generates correct answers with respect to the semantics– Complete: Guaranteed to find an answer if it exists

Page 9: Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)

For instance

1) Tell the system knowledge about a task domain.

2) Ask the system whether new statements about the domain are true or false

• live_w4? lit_l2?

Page 10: Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)

PDCL Semantics: Logical Consequence

Definition (model)A model of a knowledge base KB is an interpretation in

which every clause in KB is true.

• In other words, KB g if there is no interpretation in which KB is true ⊧and g is false

• We want a reasoning procedure that can find all and only the logical consequences of a knowledge base

Definition (logical consequence)

If KB is a set of clauses and g is a conjunction of atoms,

g is a logical consequence of KB, written KB g⊧ ,

if g is true in every model of KB

Page 11: Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)

.

.

q

rqpKB

Interpretationsr q p

T T T

T T F

T F T

T F F

F T T

F T F

F F T

F F F

Models

Which atoms are logically entailed?

Example of Logic Entailment

• We want a reasoning procedure that can find all and only the logical consequences of a knowledge base

Page 12: Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)

Recap: proofs, soundness, completeness• A proof is a mechanically derivable demonstration that a formula

logically follows from a knowledge base.

Definition (derivability with a proof procedure)Given a proof procedure P, KB ⊦P g means g can be derived from knowledge base KB with proof procedure P.

Definition (soundness)

A proof procedure P is sound if KB ⊦P g implies KB g⊧ .

sound: every atom g that P derives follows logically from KB

Definition (completeness)

A proof procedure P is complete if KB g implies KB ⊧ ⊦P g.

complete: every atom g that logically follows from KB is derived by P

Page 13: Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)

Lecture Overview

• Recap Lecture 24

• Bottom-Up Proof Procedure

• Soundness

• Completeness

• Intro to Top-Down Proof Procedure (time permitting)

Page 14: Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)

Bottom-up proof procedure

• One rule of derivation, a generalized form of modus ponens:

• If “h ← b1 … bm" is a clause in the knowledge base, and each bi has been derived, then h can be derived.

• This rule also covers the case when m = 0.

Page 15: Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)

Bottom-up proof procedure

C :={};repeat

select clause “h ← b1 ∧ … ∧ bm” in KB such that bi ∈ C for all i, and h ∉ C;

C := C ∪ { h }until no more clauses can be selected.

KB ⊦ G if G ⊆ C at the end of this procedure

Page 16: Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)

C := {};

repeat

select clause h ← b1 … bm in KB such that bi C for all i, and h C;

C := C {h}

until no more clauses can be selected.

Bottom-up proof procedure: example

a ← b c

a ← e f

b ← f k

c ← e

d ← k

e.

f ← j e

f ← c

j ← c

{}

Page 17: Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)

C := {};

repeat

select clause h ← b1 … bm in KB such that bi C for all i, and h C;

C := C {h}

until no more clauses can be selected.

Bottom-up proof procedure: example

a ← b c

a ← e f

b ← f k

c ← e

d ← k

e.

f ← j e

f ← c

j ← c

{}

{e}

{c,e}

{c,e,f}

{c,e,f,j}

{a,c,e,f,j}

Done.

Page 18: Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)

Lecture Overview

• Recap Lecture 24

• Bottom-Up Proof Procedure

• Soundness

• Completeness

• Top-Down Proof Procedure (time permitting)

Page 19: Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)

Soundness of bottom-up proof procedure BU

What do we need to prove to show that BU is sound ?

sound: every atom g that P derives follows logically from KB

Definition (soundness)

A proof procedure P is sound if KB ⊦P g implies KB g⊧ .

C := {};Repeat

select clause h ← b1 … bm in KB such that bi C for all i, and h C; C := C {h}until no more clauses can be selected.

Page 20: Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)

Soundness of bottom-up proof procedure BU

What do we need to prove to show that BU is sound ?

If g C at the end of BU procedure, then g is true in all models of KB (KB g)⊧

sound: every atom g that P derives follows logically from KB

Definition (soundness)

A proof procedure P is sound if KB ⊦P g implies KB g⊧ .

C := {};repeat

select clause h ← b1 … bm in KB such that bi C for all i, and h C; C := C {h}until no more clauses can be selected.

Page 21: Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)

Soundness of bottom-up proof procedure BU

By contradiction: Suppose there is a g such that

KB g but not KB g.⊦ ⊧

If g C at the end of BU procedure, then g is true in all models of KB (KB g)⊧

What do we need to prove to show that BU is sound ?

• Let h be the first atom added to C that is not true in every model of KB. • In particular, suppose I is a model of KB in which h isn’t true

• There must be a clause in KB of form

h b1 ... bn

where each bi is true in I.

• Because h is false in I, this clause is false in I.

• Therefore I is not a model of KB => Contradiction

Page 22: Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)

Lecture Overview

• Recap Lecture 24

• Bottom-Up Proof Procedure

• Soundness

• Completeness

• Top-Down Proof Procedure (time permitting)

Page 23: Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)

We define a specific model of our KB, in which• every atom in C at the end of BU is true • every other atom is false

This is called minimal model

Using this model, we’ll then show that, if KB ⊧ G, then G must be in C, that is

Proof: general idea

If g is true in all models of KB (KB ⊧ g) then g C at the end of BU procedure (KB ⊦BU g)

Page 24: Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)

Minimal Model

The C at the end of BU procedure is a fixed point:• Further applications of our rule of derivation will not

change C!

Definition (minimal model)The minimal model MM is the interpretation in which – - every element of BU’s fixed point C is true - every other atom is false.

C := {};repeat

select clause h ← b1 … bm in KB such that bi C for all i, and h C; C := C {h}until no more clauses can be selected.

Page 25: Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)

Minimal model MM is a model of KB

Proof by contradiction.

Assume that MM is not a model of KB. • Then there must exist some clause in KB which is false in

MMLike every clause in KB, it is of the form h ← b1 … bm

(with m 0).

• h ← b1 … bm can only be false in MM if each bi is true in MM and h is false in MM.Since each bi is true in MM, each bi must be in C as well.

BU would add h to C, so h would be true in MMContradiction! Thus, MM is a model of KB

Definition (minimal model)The minimal model MM is the interpretation in which- every element of BU’s fixed point C is true - every other atom is false.

Page 26: Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)

Completeness of bottom-up procedure

What do we need to prove to show that BU is complete?

complete: everything that logically follows from KB is derived

Definition (completeness)

A proof procedure P is complete if KB g implies KB ⊧ ⊦P g.

If g is true in all models of KB (KB ⊧ g) then g C at the end of BU procedure (KB ⊦BU g)

Page 27: Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)

Completeness of bottom-up procedure

Direct proof based on minimal model:• Suppose KB ⊧ g. Then g is true in all models of KB.• Thus g is true in the minimal model.• Thus g C at the end of BU procedure.

• Thus KB ⊦BU g. Done. KB g implies KB ⊧ ⊦BU g

If g is true in all models of KB (KB ⊧ g) then g C at the end of BU procedure (KB ⊦BU g)

Page 28: Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)

Summary for bottom-up proof procedure BU

• BU is sound: it derives only atoms that logically follow from KB

• BU is complete:it derives all atoms that logically follow from KB

• Together: it derives exactly the atoms that logically follow from KB

• And, it is efficient!• Linear in the number of clauses in KB

Each clause is used maximally once by BU

Page 29: Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)

Learning Goals Up To Here

• PDCL syntax & semantics- Verify whether a logical statement belongs to the language of

propositional definite clauses

- Verify whether an interpretation is a model of a PDCL KB.

- Verify when a conjunction of atoms is a logical consequence of a knowledge base

• Bottom-up proof procedure• Define/read/write/trace/debug the Bottom Up (BU) proof

procedure• Prove that the BU proof procedure is sound and complete

Page 30: Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)

Bottom-up vs. Top-down

KB

g is proved if g C

When does BU look at the query? g

Bottom-up

At the beginning

In every loop iteration Never

At the end

C

Page 31: Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)

Bottom-up vs. Top-down

• Key Idea of top-down: search backward from a query g to determine if it can be derived from KB.

KB C

g is proved if g C

When does BU look at the query g?• Never• It derives the same C

regardless of the query

Bottom-up Top-down

TD performs a backward search starting at g

KB answer

Query G


Recommended