CS157 Greatest Hits The Top 100 Slides of the Courselogic.stanford.edu/classes/cs157/2011/lectures/lecture20.pdf · CS157 Greatest Hits The Top 100 Slides of the Course Computational
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
A propositional interpretation is an associationbetween the propositional constants in a propositionallanguage and the truth values T or F.
p i⎯ → ⎯ T pi = Tq i⎯ → ⎯ F qi = Fr i⎯ → ⎯ T ri = T
12/7/10 4
Sentential Interpretation
A sentential interpretation is an association betweenthe sentences in a propositional language and the truthvalues T or F.
pi = T (p ∨ q)i = Tqi = F (¬q ∨ r)i = Tri = T ((p ∨ q) ∧ (¬q ∨ r))i = T
A propositional interpretation defines a sententialinterpretation by application of operator semantics.
3
12/7/10 5
Operator Semantics
φ ¬φ
T FF T
φ ψ φ ∧ψ
T T TT F FF T FF F F
φ ψ φ ∨ψ
T T TT F TF T TF F F
φ ψ φ ⇔ψ
T T TT F FF T FF F T
φ ψ φ ⇒ψ
T T TT F FF T TF F T
φ ψ φ ⇐ψ
T T TT F TF T FF F T
12/7/10 6
Evaluation
Interpretation i:
Compound Sentence(p ∨ q) ∧ (¬q ∨ r)
pi = Tqi = Fri = T
4
12/7/10 7
Truth Tables
€
p q rT T TT T FT F TT F FF T TF T FF F TF F F
A truth table is a table of all possible interpretationsfor the propositional constants in a language.
One column per constant.
One row per interpretation.
For a language with n constants,there are 2n interpretations.
12/7/10 8
Properties of Sentences
A sentence is valid if and only ifevery interpretation satisfies it.
A sentence is contingent if and only ifsome interpretation satisfies it andsome interpretation falsifies it.
A sentence is unsatisfiable if andonly if no interpretation satisfies it.
Valid
Contingent
Unsatisfiable
5
12/7/10 9
Properties of Sentences
A sentences is satisfiable if and onlyif it is either valid or contingent.
A sentences is falsifiable if and onlyif it is contingent or unsatisfiable.
Valid
Contingent
Unsatisfiable
}
}
12/7/10 10
Evaluation Versus Satisfaction
Evaluation:
Satisfaction:
pi = Tqi = F
(p∨ q)i = T(¬q)i = T
(p∨ q)i = T(¬q)i = T
pi = Tqi = F
6
12/7/10 11
Logical Entailment
A set of premises Δ logically entails a conclusion ϕ(written as Δ |= ϕ) if and only if every interpretationthat satisfies the premises also satisfies theconclusion.
{p} |= (p ∨ q)
{p} |# (p ∧ q)
{p, q} |= (p ∧ q)
12/7/10 12
Proof (Official Version)A proof of a conclusion from a set of premises is asequence of sentences terminating in the conclusionin which each item is either:
1. a premise2. An instance of an axiom schema3. the result of applying a rule of inference to earlieritems in sequence.
7
12/7/10 13
Provability
A conclusion is said to be provable from a set ofpremises (written Δ |- ϕ) if and only if there is a finiteproof of the conclusion from the premises using onlyModus Ponens and the Standard Axiom Schemata.
12/7/10 14
Soundness and Completeness
Soundness: Our proof system is sound, i.e. if theconclusion is provable from the premises, then thepremises propositionally entail the conclusion.
(Δ |- ϕ) ⇒ (Δ |= ϕ)
Completeness: Our proof system is complete, i.e. if thepremises propositionally entail the conclusion, then theconclusion is provable from the premises.
(Δ |= ϕ) ⇒ (Δ |- ϕ)
8
12/7/10 15
Metatheorems
Deduction Theorem: Δ |- (ϕ ⇒ ψ) if and only ifΔ∪{ϕ} |- ψ.
Equivalence Theorem: Δ |- (ϕ ⇔ ψ) and Δ |- χ, then itis the case that Δ ���|- χϕ←ψ.
12/7/10 16
Clausal Form
A literal is either an atomic sentence or a negation ofan atomic sentence.
p, ¬p
A clausal sentence is either a literal or a disjunctionof literals.
A sentence is provable from a set of sentences bypropositional resolution if and only if there is aderivation of the empty clause from the clausal formof Δ∪{¬ϕ}.
Theorem: Propositional Resolution is sound andcomplete, i.e. Δ |= ϕ if and only if Δ |- ϕ.
11
12/7/10 21
Davis Putnam Procedure
function dp (Δ) {for ϕ in vocabulary(Δ) do {var Δ’←{}; for Φ1 in Δ for Φ2 in Δ such that ϕ ∈ Φ1 ¬ϕ ∈ Φ2 do {var Φ’← Φ1− {ϕ} ∪ Φ2 − {¬ϕ}; if not tautology(Φ’) then Δ’←Δ’∪{Φ’}}; Δ←Δ − {Φ∈Δ | ϕ ∈ Φ or ¬ϕ ∈ Φ} ∪ Δ’}; return {if {} ∈ Δ then unsatisfiable else satisfiable}}
function tautology(Φ) {ϕ∈ Φ and ¬ϕ ∈ Φ}
12/7/10 22
Davis-Putnam Example
{p, q, r} {q, r}{p, q, ¬r} {q, ¬r}{p, ¬q, r} {¬q, r}{p, ¬q, ¬r} {¬q, ¬r}{¬p, q, r}{¬p, q, ¬r} {r}{¬p, ¬q, r} {¬r}{¬p, ¬q, ¬r}
{}
Cost = 16 + 4 + 1 = 21 resolutions
12
12/7/10 23
Davis Putnam Logemann Loveland
function dpll (Δ) {var ϕ; if Δ = {} then return yes; if {}∈ Δ then return no; ϕ ← choose vocabulary(Δ)); if dpll(simplify(Δ, ϕ)) return yes else return dpll(simplify(Δ,¬ϕ))}
12/7/10 24
Simplification
function simplify (Δ, ϕ) {var Δ’; for Φ ∈ Δ do {if ϕ∈Φ then skip else if negation(ϕ)∈Φ then Δ’← Δ’ ∪ {Φ − {negation(ϕ)}} else Δ’← Δ’ ∪ {Φ}}}
A value assignment siv based on interpretation iand variable assignment v is a mapping from theterms of the language into the universe ofdiscourse that agrees with i on constants, thatagrees with v on variables, and that, for functionalterms, yields the result of applying theinterpretation of the functional constant to thevalues assigned to the argument terms.
siv(σ)=i(σ)siv(υ)=v(υ)
siv(π(τ1,…,τn)=i(π)(siv(τ1),…, siv(τn))
18
12/7/10 35
Truth Assignments
A truth assignment tiv based on interpretation iand variable assignment v is a mapping from thesentences of the language into {true, false}.
tiv: sentence → {true, false}
The details of the definition are given on thefollowing slides.
12/7/10 36
Relational Sentences
A truth assignment satisfies a relational sentenceif and only if the tuple of objects denoted by thearguments is a member of the relation denoted bythe relation constant.
A version w[ν←x] of a variable assignment w isthe variable assignment that agrees with w on allvariables except ν, which is assigned the value x.
w[ν←x](µ) = w(µ)w[ν←x](ν) = x
20
12/7/10 39
Quantified Sentences
A universally quantified sentence is true ininterpretation I and variable assignment v if andonly if the scope is true for I and every version of v.
tiw(∀ν.ϕ )=true iff tiw[ν←x](ϕ)=true for all x∈|i|.
An existentially quantified sentence is true ininterpretation I and variable assignment v if andonly if the scope is true for I and some version of v.
tiw(∃v.ϕ )=true iff tiw[ν←x](ϕ)=true for some x∈|i|.
12/7/10 40
HHHHerbrand
The Herbrand universe for a set of sentences inRelational Logic (with at least one object constant) isthe set of all ground terms that can be formed fromjust the constants used in those sentences. If there areno object constants, then we add an arbitrary objectconstant, say a.
The Herbrand base for a set of sentences is the set ofall ground atomic sentences that can be formed usingjust the constants in the Herbrand universe.
21
12/7/10 41
Herbrand Theorem
Herbrand Theorem: A set of quantifier-free sentencesin Relational Logic is satisfiable if and only if it has aHerbrand model.
A variable is free in a sentence if and only if it occursoutside of the scope any quantifier of that variable.
x is free in p(x).x is free in ∃y.p(x,y).x is free in (p(x) ∧ ∀x.q(x)).x is not free∀x.p(x).
The statement that a variable is free in a sentence is notthe same as the statement that a term is free for avariable in a sentence!
24
12/7/10 47
Substitutability
A term τ is substitutable for ν in ϕ if and only if itthere are no occurrences of ν in the scope of aquantifier of a variable in τ.
Some texts say “x is free for y in ϕ” instead of “x issubstitutable for y in ϕ”.
mother(jane) is free for y in hates(jane,y).mother(x) is free for y in hates(jane,y).mother(x) is free for y in ∃z.hates(z,y).mother(x) is not free for y in ∃x.hates(x,y).mother(x) is free for y in (∀x.∀y.l(x,y) ∧ ∃z.h(z,y)).
12/7/10 48
Formal Proofs
A formal proof of ϕ from Δ is a sequence ofsentences terminating in ϕ in which each item iseither:1. a premise (a member of Δ)2. an instance of an axiom schema3. the result of applying a rule of inference toearlier items in the sequence.
25
12/7/10 49
Provability
A sentence ϕ is provable from a set of sentences Δ ifand only if there is a finite formal proof of ϕ from Δusing only Modus Ponens, Universal Generalization,and the standard axiom schemata.
Soundness Theorem: If ϕ is provable from Δ, then Δlogically entails ϕ.
Completeness Theorem (Godel): If Δ logically entailsϕ, then ϕ is provable from Δ.
12/7/10 50
Decidability Results
Logical Entailment for Relational Logic issemidecidable.
Logical Entailment for Relational Logic is notdecidable.
Arithmetic is not finitely axiomatizable in RelationalLogic.
{ϕ1,..., ϕ,...,ϕm}{ψ1,...,¬ψ,...,ψn}{ϕ1τ ,...,ϕmτ ,ψ1,...,ψn}σwhere σ = mgu(ϕτ ,ψ)where τ is a variable renaming on ϕ
12/7/10 60
Relational Resolution III (Final Version)
€
Φ
Ψ
((Φ'−{φ})τ ∪ (Ψ'−{¬ψ}))σwhere φ ∈ Φ' , a factor of Φ where ¬ψ ∈ Ψ' , a factor of Ψ where σ = mgu(ϕτ ,ψ)where τ is a variable renaming on ϕ
31
12/7/10 61
Provability
A resolution derivation of a clause ϕ from a set Δ ofclauses is a sequence of clauses terminating in ϕ inwhich each item is(1) a member of Δ or(2) the result of applying the resolution to earlier items.
A sentence ϕ is provable from a set of sentences Δ byresolution if and only if there is a derivation of theempty clause from the clausal form of Δ∪{¬ϕ}.
A resolution proof is a derivation of the empty clausefrom the clausal form of the premises and the negationof the desired conclusion.
12/7/10 62
Soundness and Completeness
Metatheorem: Provability using the RelationalResolution Principle is sound and complete forRelational Logic (without equality).
32
12/7/10 63
Answer Extraction Method
Alternate Method for Logical Entailment: Todetermine whether a set Δ of sentences logicallyentails a closed sentence ϕ , rewrite Δ∪{ϕ ⇒ goal} inclausal form and try to derive goal.
Method for Answer Extraction: To get values for freevariables ν1,…,νn in ϕ for which Δ logically entails ϕ,rewrite Δ∪{ϕ ⇒ goal(ν1,…,νn)} in clausal form andtry to derive goal(ν1,…,νn).
Intuition: The sentence (q(z) ⇒ goal(z)) says that,whenever, z satisfies q, it satisfies the “goal”.
The contrapositives of a chain are logicallyequivalent to the original chain.
35
12/7/10 69
Model Elimination
Model Elimination is a variant of Ordered Resolutionthat incorporates the Linearity Restriction in thedefinition of the rules of inference.
Using Model Elimination alone, it is possible to builda theorem prover that is sound and complete for all ofRelational Logic.
Moreover, it works with the Set of Support strategyand the Input Restriction!!!
12/7/10 70
Normal and Reduced Literals
Normal Literals:p¬q
Reduced Literals:[p]
[¬q]
Chains:〈p,¬q,[p],r〉
36
12/7/10 71
Model Elimination Rules
Reduction
Cancellation
Dropping
〈ϕ,ϕ1, ...,ϕm 〉
〈ψ ,ψ 1,...,ψ n 〉
〈ϕ1,...,ϕm ,[ψ ],ψ1,...,ψ n 〉σ
where σ = mgu(¬ϕ,ψ )
〈[ϕ ],ϕ1,...,ϕm 〉
〈ϕ1,...,ϕm 〉
〈ϕ,ϕ1, ...,ϕm ,[ψ ],ψ 1,...,ψ n 〉
〈ϕ1,...,ϕm ,[ψ ],ψ1,...,ψ n 〉σ
where σ = mgu(¬ϕ,ψ )
12/7/10 72
Epilog
Epilog is a theorem prover for Relational Logic. It issound and complete. It is at least as efficient asModel Elimination, and it is arguably more efficient.It is somewhat more intuitive than ordinaryResolution.
Features: Rule Form instead of Clausal Form Backward Chaining variant of the ME rule Iterative Deepening rather than Breadth-First Search
37
12/7/10 73
Rule Form
���Premises are expressed as rules.
Conclusions are expressed as questions.
〈p〉 p⇐〈¬p〉 ¬p⇐〈r,¬p,¬q〉 r⇐ p∧ q
〈p〉 ¬p?〈¬p〉 p?〈¬p,¬q,r〉 p∧ q ∧¬r?
12/7/10 74
Backward Chaining
Backward Chaining is the same as reduction exceptthat it works on rule form rather than clausal form.
ϕ ⇐ϕ1 ∧ ...∧ϕm
ψ ∧ψ1 ∧ ...∧ψ n ?ϕ1 ∧ ...∧ϕm ∧ [ψ ]∧ψ1 ∧ ...∧ψ n ?σwhere σ = mgu(ϕ,ψ )
Reduced literals need be retained only for non-Hornpremises.
Cancellation and Dropping are analogous.
38
12/7/10 75
12/7/10 76
Equality
An equation σ = τ is true in an interpretation i if andonly if the terms in the equation refer to the sameobject in the universe of discourse.
Satisfied Sentences a = a a = f(b) a= f(f(a)) a ≠ b b = f(a) a=f(f(c)) a = c b = f(c) b=f(f(b)) b = b c = f(b) c=f(f(a)) b ≠ c c=f(f(c))
12/7/10 78
Unique Names Assumption
In many applications, one makes the assumptionthat every object has a unique name. This iscalled the unique names assumption (UNA).The upshot is that a difference in name implies adifference in referent.
σ= τ ⇔ σi = τi
The unique names assumption is not true in general!!!
Question: How does one express the unique namesassumption in Relational Logic?
40
12/7/10 79
Reasoning with Equality
Axioms (reflexivity, symmtery, transitivity, subst) Paramodulation and Demodulation
12/7/10 80
Equality AxiomsReflexivity
∀x.x=x
Symmetry:
∀x.∀y.(x=y ⇒ y=x)
Transitivity:
∀x.∀y.∀z.(x=y ∧ y=z ⇒ x=z)
41
12/7/10 81
Equality Axioms in Rule FormReflexivity
x=x
Symmetry:
x=y ⇐ y=x
Transitivity:
x=z ⇐ x=y ∧ y=z
12/7/10 82
Equality Proof
€
1. b = a Premise2. b = c Premise3. x = x Equality4. x = y⇐ y = x Equality5. x = z⇐ x = y∧ y = z Equality6. a = c? Goal7. a = y∧ y = c? 5,68. y = a∧ y = c? 4,79. b = c? 1,810. ? 2,9
42
12/7/10 83
Equality Problem
€
1. f (a) = b Premise2. f (b) = a Premise3. x = x Equality4. x = y⇐ y = x Equality5. x = z⇐ x = y∧ y = z Equality6. f ( f (a)) = a? Goal7. a = f ( f (a))? 4,68. f ( f (a)) = y∧ y = a? 5,69. f ( f (a)) = w∧w = y∧ y = a? 5,810. f ( f (a)) = v∧v = w∧w = y∧ y = a? 5,9
1. f (a) = b Premise2. f (b) = a Premise3. x = x Equality4. x = y⇐ y = x Equality5. x = z⇐ x = y∧ y = z Equality6. f (a) = x∧ f (x) = a? f ( f (a)) = a?7. f (b) = a? 1,68. ? 2,7
12/7/10 86
Substitution Axiom
Flattening Rule:
f(f(a))=a ⇔ ∃x.(f(a)=x ∧ f(x)=a)
Substitution Axiom:
f(x)=z ⇐ x=y ∧ f(y)=z
44
12/7/10 87
Proof With Substitution
€
1. f (a) = b Premise2. f (b) = a Premise3. x = x Equality4. x = y⇐ y = x Equality5. x = z⇐ x = y∧ y = z Equality6. f (x) = z⇐ x = y∧ f (y) = z? Substitution7. f ( f (a)) = a? Goal8. f (a) = y∧ f (y) = a? 6,79. f (b) = a? 1,810. ? 2,9
12/7/10 88
Notes
Substitution axioms for relation constants too.
p(x) ⇐ x=y ∧ p(y)
Substitution axioms for multiple arguments
p(x,y)=z ⇐ x=u ∧ y=v ∧ p(u,v)
Need one substitution for each function and relationconstant.
45
12/7/10 89
Demodulation
{ϕ1, ...,ϕn}{τ1 = τ 2}{ϕ1, ...,ϕn}[τ1σ ←τ 2σ ]where τ occurs in ϕi where τ1σ = τ
12/7/10 90
Examples
€
p(a, f (b,g(a,h(b)),c),d)b = ep(a, f (e,g(a,h(e)),c),d)
€
p(a, f (b,g(a,h(b)),c),d)g(x,y) = j(x)p(a, f (b, j(a),c),d)
(2) Demodulation binds variables in equation only.
(3) Demodulation deletes parent.
12/7/10 98
Power
Theorem: Resolution and Paramodulation (togetherwith the reflexivity axiom) are refutation complete forall of Relational Logic*.
*including equality
50
12/7/10 99
Details
Thursday, Dec 9, 7:00pm in NVidia Auditorium.
One hour and 15 minutes of three hours.
Closed book.
Easy.
12/7/10 100
Hints
1. Study the Problems on the Problem Sets.2. Study the Problems on the Problem Sets.3. Study the Problems on the Problem Sets.4. Study the Problems on the Problem Sets.5. Study the Problems on the Problem Sets.6. Study the Problems on the Problem Sets.7. Study the Problems on the Problem Sets.8. Study the Problems on the Problem Sets.9. Study the Problems on the Problem Sets.10. View and understand the guest lectures.