Slide 1 Propositional Definite Clause Logic: Syntax, Semantics and Bottom-up Proofs Jim Little UBC...
-
Upload
wesley-lewis -
Category
Documents
-
view
217 -
download
1
Transcript of Slide 1 Propositional Definite Clause Logic: Syntax, Semantics and Bottom-up Proofs Jim Little UBC...
Slide 1
Propositional Definite Clause Logic: Syntax,
Semantics and Bottom-up Proofs
Jim LittleUBC CS 322 – CSP October 20, 2014
Slide 2
Lecture Overview
• Recap: Logic intro• Propositional Definite Clause
Logic: Semantics• PDCL: Bottom-up Proof
Logic: A general framework for reasoning
General problem: Query answering• tell the computer how the world works• tell the computer some facts about the world• ask a yes/no question about whether other facts must be
true
Solving it with Logic1. Begin with a task domain.2. Distinguish those things you want to talk about (the
ontology)3. Choose symbols in the computer to denote elements of your
ontology4. Tell the system knowledge about the domain5. Ask the system whether new statements about the domain
are true or false
live_w4? lit_l2?
Slide 3
Example: Electrical Circuit
/ up
/down
Slide 4
/ up
/down
Syntax: are these sentences that a reasoning procedure can process?
Semantics: what do these statements say about the world I need to represent?
Slide 5
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
Slide 6
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
Slide 7
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.
Slide 8
To Obtain This We Need One More Definition
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.
• we also say that G logically follows from KB, or that KB entails G.• In other words, KB ⊧ G if there is no interpretation in which KB is true and G is false.
• when KB is TRUE, then G must be TRUE
• We want a reasoning procedure that can find all and only the logical consequences of a knowledge base
Slide 9
User’s View of Semantics
• Choose a task domain: intended interpretation.
• For each proposition you want to represent, associate a proposition symbol in the language.
• Tell the system clauses that are true in the intended interpretation: axiomatize the domain.
• Ask questions about the intended interpretation.
• If KB |= g , then g must be true in the intended interpretation.
Slide 10
Computer’s View of Semantics
• The computer doesn’t have access to the intended interpretation.
• All it knows is the knowledge base.
• The computer can determine if a formula is a logical consequence of KB.
• If KB |= g then g must be true in the intended interpretation.
• Otherwise, there is a model of KB in which g is false. This could be the intended interpretation.
The computer wouldn't know!
Slide 11
Computer’s View of Semantics
• Otherwise, there is a model of KB in which g is false. This could be the intended interpretation.
The computer wouldn't know
.
.
.
sr
q
qp
KBp q r s
I1 true true true true
I2 true true true false
Slide 12
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 and complete)• Bottom-up Proof Procedure for Finding Logical Consequence
Slide 13
Proof Procedures• A proof procedure is a mechanically derivable
demonstration that a formula logically follows from a knowledge base.
• Given a proof procedure P, KB ⊦ P g means g can be derived from knowledge base KB with the proof procedure.
• If I tell you I have a proof procedure for PDCL• What do I need to show you in order for you to trust my
procedure?
That is sound and complete
Slide 14
Soundness and Completeness
• Completeness of proof procedure P: need to prove that
If g is true in all models of KB (KB g)⊧ then g is derived by the procedure (KB ⊦P g)
Definition (completeness)
A proof procedure P is complete if KB g implies KB ⊧ ⊦P g.
complete: every atom that logically follows from KB is derived by P
• Soundness of proof procedure P: need to prove that
Definition (soundness)
A proof procedure P is sound if KB ⊦P g implies KB g.⊧
If g can be derived by the procedure (KB ⊦P g) then g is true in all models of KB (KB g)⊧
sound: every atom derived by P follows logically from KB (i.e. is true in every model)
Slide 15
Simple Proof Procedure
problem with this approach?
• If there are n propositions in the KB, must check all the interpretations!
Goal of proof theory • find sound and complete proof procedures that allow us to
prove that a logical formula follows from a KB avoiding to do the above
Simple proof procedure S• Enumerate all interpretations• For each interpretation I, check whether it is a model of KB
i.e., check whether all clauses in KB are true in I
• KB ⊦S g if g holds in all such models
Slide 16
2𝑛
Lecture Overview
• Recap Lecture 7• Logical Consequences and Proof
Procedures
• Bottom-Up Proof Procedure• Soundness
• Completeness
Slide 17
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.
Slide 18
Bottom-up proof procedureC :={};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
The C at the end of BU procedure is a fixed point:• Further applications of our rule of derivation will not
change C!Slide 19
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}
{c,e,f,j,a}
Done.Slide 20
Lecture Overview
• Recap of Lecture 6
• Planning as CSP
• Logic
• Intro
• Propositional Definite Clause Logic (PDCL)
• Sintax and Semantics
• Logical Consequences and Proof Procedures
• Bottom Up Proof Procedure
• Soundness and completenessSlide 21
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.
Slide 22
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.
Slide 23
Soundness of bottom-up proof procedure BU
By contradiction: Suppose there is a g such that KB ⊦ BU 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 => ContradictionSlide 24
Completeness of BU: general idea
• Generic completeness of proof procedure: If G is logically entailed by the KB (KB ⊧ G) then G can be proved by the BU procedure (KB
⊦BU G)
Sketch of our proof:1. Suppose KB ⊧ G. Then G is true in all models of KB.
2. Thus G is true in any particular model of KB
3. We will define a model (called minimal model) so that if G is true in that model, G is proved by the bottom up algorithm.
4. Thus KB ⊦ G.
Slide 25
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
All atoms = {a, b, c, d,e, f, g}C = {e,d, c, f,}Minimal Model =a=F, b=F, c=T, d = T, e=T, f=T, g=F
• Using this model, we’ll then show that, if KB ⊧ G, then G must be in C, that is
Completeness of BU: 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)
KB a ← e ∧
g.b ← f ∧ g. c ← e.
f ← c e. d.
Slide 26
Claim: MM is a model of KBProof 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
DefinitionThe minimal model MM is the interpretation in which- every element of BU’s fixed point C is true - every other atom is false.
Slide 27
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)
Slide 28
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 BUSlide 29
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
Slide 30
Slide 31
Lecture Overview
• Recap: Logic intro• Propositional Definite Clause
Logic: Semantics• PDCL: Bottom-up Proof
Slide 32
Next class
(still section 5.2)• Soundness and Completeness of Bottom-up
Proof Procedure• Using PDC Logic to model the electrical
domain• Reasoning in the electrical domain