Intro. to Logic CS402 Fall 2007 1 Propositional Calculus - Semantics (2/3) Propositional Calculus -...
Transcript of Intro. to Logic CS402 Fall 2007 1 Propositional Calculus - Semantics (2/3) Propositional Calculus -...
![Page 1: Intro. to Logic CS402 Fall 2007 1 Propositional Calculus - Semantics (2/3) Propositional Calculus - Semantics (2/3) Moonzoo Kim CS Division of EECS Dept.](https://reader030.fdocuments.net/reader030/viewer/2022032605/56649e765503460f94b775c9/html5/thumbnails/1.jpg)
Intro. to Logic CS402 Fall 2007
1
Propositional Calculus Propositional Calculus - - SemanticsSemantics (2/3)(2/3)
Moonzoo KimCS Division of EECS Dept.
KAIST
[email protected]://pswlab.kaist.ac.kr/courses/cs402-07
![Page 2: Intro. to Logic CS402 Fall 2007 1 Propositional Calculus - Semantics (2/3) Propositional Calculus - Semantics (2/3) Moonzoo Kim CS Division of EECS Dept.](https://reader030.fdocuments.net/reader030/viewer/2022032605/56649e765503460f94b775c9/html5/thumbnails/2.jpg)
Intro. to Logic CS402 Fall 2007
2
OverviewOverview
2.1 Boolean operators2.1 Boolean operators 2.2 Propositional formulas2.2 Propositional formulas 2.3 Interpretations2.3 Interpretations 2.4 Logical equivalence and substitution2.4 Logical equivalence and substitution 2.5 Satisfiability, validity, and consequence2.5 Satisfiability, validity, and consequence 2.6 Semantic tableaux2.6 Semantic tableaux 2.7 Soundness and completeness2.7 Soundness and completeness
![Page 3: Intro. to Logic CS402 Fall 2007 1 Propositional Calculus - Semantics (2/3) Propositional Calculus - Semantics (2/3) Moonzoo Kim CS Division of EECS Dept.](https://reader030.fdocuments.net/reader030/viewer/2022032605/56649e765503460f94b775c9/html5/thumbnails/3.jpg)
Logical equivalenceLogical equivalence
Defn 2.13. Let Defn 2.13. Let AA11,,AA222F2F. If . If ºº((AA11) = ) = ºº((AA22) for ) for allall interpretation, interpretation,
then then AA11 is is logically equivalentlogically equivalent to to AA22, denoted , denoted AA11 ≡≡ AA22
Example 2.14. Is Example 2.14. Is p Ç q equivalent to q Ç p?
p q º(p Ç q) º(q Ç p)
T T T T
T F T T
F T T T
F F F F
![Page 4: Intro. to Logic CS402 Fall 2007 1 Propositional Calculus - Semantics (2/3) Propositional Calculus - Semantics (2/3) Moonzoo Kim CS Division of EECS Dept.](https://reader030.fdocuments.net/reader030/viewer/2022032605/56649e765503460f94b775c9/html5/thumbnails/4.jpg)
Logical equivalenceLogical equivalence
We can extend the result of example 2.14 from We can extend the result of example 2.14 from atomic propositions to general formulasatomic propositions to general formulas
Theorem 2.15 Let Theorem 2.15 Let AA11 and and AA22 be any formulas. Then be any formulas. Then AA11 ÇÇ AA22 ≡≡ AA22 ÇÇ AA11.. ProofProof
LetLet º º be an arbitrary interpretation forbe an arbitrary interpretation for AA11 ÇÇ AA22. . Then, Then, º º is an interpretation for is an interpretation for AA22 ÇÇ AA11, too., too.
Similarly, Similarly, º º is an interpretation for is an interpretation for AA11 and and AA22
Therefore, Therefore, ºº((AA11ÇÇAA22)=T iff )=T iff ºº((AA11) =T or ) =T or ºº((AA22) =T iff ) =T iff ºº((AA22ÇÇAA11)=T)=T
![Page 5: Intro. to Logic CS402 Fall 2007 1 Propositional Calculus - Semantics (2/3) Propositional Calculus - Semantics (2/3) Moonzoo Kim CS Division of EECS Dept.](https://reader030.fdocuments.net/reader030/viewer/2022032605/56649e765503460f94b775c9/html5/thumbnails/5.jpg)
Logical equivalenceLogical equivalence
Definition 2.22Definition 2.22
A binary operator o is A binary operator o is defined fromdefined from a set of operators a set of operators
{o{o11, … o, … onn} if and only if there is a logical equivalence } if and only if there is a logical equivalence
AA11 o o AA22 ≡≡ AA, where , where AA is a formula constructed from occurrences of is a formula constructed from occurrences of AA11
and and AA22 using the operator {o using the operator {o11, …, o, …, onn}.}.
Similarly, the unary operator Similarly, the unary operator :: is defined from a set of operators {o is defined from a set of operators {o11, … , …
oonn} iff } iff :: AA11 ≡≡ AA, where , where AA is constructed from occurrences of is constructed from occurrences of AA11 and the and the
operators in the set.operators in the set. ExamplesExamples
$$ is defined from { is defined from {!!,, Æ Æ } because } because AA $$ B B ≡ ≡ ((AA !! BB) ) ÆÆ ( (BB !! AA)) !! is defined from { is defined from {::,, ÇÇ } because } because A A !! BB ≡≡ ::AA ÇÇ BB ÆÆ is defined from { is defined from {::,, ÇÇ } } because because AA ÆÆ BB ≡≡ ::((::AA Ç:Ç:BB ) )
Intro. to Logic CS402 Fall 2007
5
![Page 6: Intro. to Logic CS402 Fall 2007 1 Propositional Calculus - Semantics (2/3) Propositional Calculus - Semantics (2/3) Moonzoo Kim CS Division of EECS Dept.](https://reader030.fdocuments.net/reader030/viewer/2022032605/56649e765503460f94b775c9/html5/thumbnails/6.jpg)
Object language v.s. metalanguage
Note that ‘Note that ‘≡’ is ≡’ is notnot a binary operator used in a binary operator used in propositional logic (propositional logic (object languageobject language)). .
‘‘≡’ ≡’ ((metalanguagemetalanguage) is used to explain a relationship ) is used to explain a relationship between two formulas. between two formulas.
Theorem 2.16Theorem 2.16 AA11 ≡≡ AA22 if and only if if and only if AA11 $$ AA22 is true in every interpretation is true in every interpretation
![Page 7: Intro. to Logic CS402 Fall 2007 1 Propositional Calculus - Semantics (2/3) Propositional Calculus - Semantics (2/3) Moonzoo Kim CS Division of EECS Dept.](https://reader030.fdocuments.net/reader030/viewer/2022032605/56649e765503460f94b775c9/html5/thumbnails/7.jpg)
Logical substitutionLogical substitution
Logical equivalence justifies Logical equivalence justifies substitutionsubstitution of one formula of one formula for anotherfor another
Defn 2.17 Defn 2.17 AA is is subformulasubformula ofof BB if the formation tree for if the formation tree for AA occurs as a subtree of the formation tree for occurs as a subtree of the formation tree for BB. . AA is is proper subformation of proper subformation of BB if if AA is a subformation of is a subformation of BB, but , but AA is not identical to is not identical to BB..
Example 2.18 The formula (Example 2.18 The formula (pp !! qq) ) $$ ( (::pp !! ::qq) contains the ) contains the following proper subformulas:following proper subformulas:
p p !! q, q, :: p p !! :: q, q, :: p, p, :: q, p q, p andand q q
![Page 8: Intro. to Logic CS402 Fall 2007 1 Propositional Calculus - Semantics (2/3) Propositional Calculus - Semantics (2/3) Moonzoo Kim CS Division of EECS Dept.](https://reader030.fdocuments.net/reader030/viewer/2022032605/56649e765503460f94b775c9/html5/thumbnails/8.jpg)
Logical substitutionLogical substitution
Def. 2.19 If A is a subformula of B and A’ is any formula, then B’, the substitution of A’ for A in B, denoted B{A Ã A’}, is the
formula obtained by replacing all occurrences of the subtree for A in B by the tree for A’.
Theorem 2.21 Let A be a subformula of B and let A’ be a formula such that A ≡ A’. Then B ≡ B{A ≡ A’. Then B ≡ B{A ÃÃ A’} A’}
One of the most important applications of substitution is simplication Ex. p Æ (::p Ç q) ≡ ≡ (p (p ÆÆ ::p)p) ÇÇ (p (p ÆÆ q) ≡ q) ≡ falsefalse ÇÇ (p (p ÆÆ q) ≡ p q) ≡ p ÆÆ
![Page 9: Intro. to Logic CS402 Fall 2007 1 Propositional Calculus - Semantics (2/3) Propositional Calculus - Semantics (2/3) Moonzoo Kim CS Division of EECS Dept.](https://reader030.fdocuments.net/reader030/viewer/2022032605/56649e765503460f94b775c9/html5/thumbnails/9.jpg)
Satisfiability v.s. validitySatisfiability v.s. validity
Definition 2.24Definition 2.24 A propositional formula A propositional formula AA is is satisfiablesatisfiable iff iff ºº((AA)=)=TT for for somesome interpretation interpretation ºº..
A satisfying interpretation is called a A satisfying interpretation is called a modelmodel for for AA.. AA is is validvalid, denoted , denoted ²² AA, iff , iff ºº ( (AA) = ) = TT for for allall interpretation interpretation ºº. .
A valid propositional formula is also called a A valid propositional formula is also called a tautologytautology.. Theorem 2.25Theorem 2.25
AA is valid iff is valid iff ::AA is unsatisfiable. is unsatisfiable. AA is satisfiable iff is satisfiable iff ::AA is falsifiable. is falsifiable.
Intro. to Logic CS402 Fall 2007
9
![Page 10: Intro. to Logic CS402 Fall 2007 1 Propositional Calculus - Semantics (2/3) Propositional Calculus - Semantics (2/3) Moonzoo Kim CS Division of EECS Dept.](https://reader030.fdocuments.net/reader030/viewer/2022032605/56649e765503460f94b775c9/html5/thumbnails/10.jpg)
Satisfiability v.s. validitySatisfiability v.s. validity
Definition 2.26Definition 2.26
Let Let VV be a set of formulas. An algorithm is a be a set of formulas. An algorithm is a decision decision procedureprocedure for for VV if given an arbitrary formula A if given an arbitrary formula A 22 FF, it , it terminates and return the answer ‘yes’ if A terminates and return the answer ‘yes’ if A 22 VV and the and the answer ‘no’ if A answer ‘no’ if A VV
By theorem 2.25, a decision procedure for satisfiability By theorem 2.25, a decision procedure for satisfiability can be used as a decision procedure for validity.can be used as a decision procedure for validity. Suppose Suppose V V is a set of all satisfiable formulasis a set of all satisfiable formulas To decide if A is valid, apply the decision procedure for To decide if A is valid, apply the decision procedure for
satisfiability to satisfiability to ::AA This decision procedure is called a This decision procedure is called a refutation procedurerefutation procedure
Intro. to Logic CS402 Fall 2007
10
![Page 11: Intro. to Logic CS402 Fall 2007 1 Propositional Calculus - Semantics (2/3) Propositional Calculus - Semantics (2/3) Moonzoo Kim CS Division of EECS Dept.](https://reader030.fdocuments.net/reader030/viewer/2022032605/56649e765503460f94b775c9/html5/thumbnails/11.jpg)
Satisfiability v.s. validitySatisfiability v.s. validity
Example 2.27 Is Example 2.27 Is (p (p !! q) q) !! ( ( :: q q !! :: p) p) validvalid??
Intro. to Logic CS402 Fall 2007
11
p q p ! q : q ! : p (p ! q) ! (: q ! : p)
T T T T T
T F F F T
F T T T T
F F T T T
Example 2.28 p \/ q is satisfiable but not valid Example 2.28 p \/ q is satisfiable but not valid
![Page 12: Intro. to Logic CS402 Fall 2007 1 Propositional Calculus - Semantics (2/3) Propositional Calculus - Semantics (2/3) Moonzoo Kim CS Division of EECS Dept.](https://reader030.fdocuments.net/reader030/viewer/2022032605/56649e765503460f94b775c9/html5/thumbnails/12.jpg)
Logical consequenceLogical consequence
Definition 2.30 (extension of satisfiability from a Definition 2.30 (extension of satisfiability from a single formula to a set of formulas)single formula to a set of formulas) A set of formulas A set of formulas UU = { = {AA11 , … , … AAnn} is } is (simultaneously) (simultaneously)
satisfiable satisfiable iff there exists iff there exists anan interpretation interpretation ºº such that such that º º ((AA11) = … = ) = … = ºº ( (AAnn) = ) = TT..
The satisfying interpretation is called a The satisfying interpretation is called a modelmodel of of UU. . UU is is unsatisfiableunsatisfiable iff for every interpretation iff for every interpretation ºº, there , there
exists an exists an ii such that such that ºº ( (AAii) = ) = FF..
![Page 13: Intro. to Logic CS402 Fall 2007 1 Propositional Calculus - Semantics (2/3) Propositional Calculus - Semantics (2/3) Moonzoo Kim CS Division of EECS Dept.](https://reader030.fdocuments.net/reader030/viewer/2022032605/56649e765503460f94b775c9/html5/thumbnails/13.jpg)
Logical consequenceLogical consequence
Let U be a set of formulas and A a formula. If A is true in Let U be a set of formulas and A a formula. If A is true in every model of U, then A is a every model of U, then A is a logical consequencelogical consequence of U. of U. Notation: U Notation: U ²² AA If U is empty, logical consequence is the same as validityIf U is empty, logical consequence is the same as validity
Theoem 2.38 U U ² ² A iff A iff ² ² AA11Æ Æ …… Æ Æ AAnn !! A where U={A A where U={A11 … A … Ann}} Note Theorem 2.16Theorem 2.16
AA11 ≡≡ AA22 if and only if if and only if AA11 $$ AA22 is true in every interpretation is true in every interpretation
![Page 14: Intro. to Logic CS402 Fall 2007 1 Propositional Calculus - Semantics (2/3) Propositional Calculus - Semantics (2/3) Moonzoo Kim CS Division of EECS Dept.](https://reader030.fdocuments.net/reader030/viewer/2022032605/56649e765503460f94b775c9/html5/thumbnails/14.jpg)
Theories Theories Logical consequenceLogical consequence is the central concept in the foundations of is the central concept in the foundations of
mathematicsmathematics Valid formulas such as p Valid formulas such as p ÇÇ q q $$ q q ÇÇ p are trivial and not interesting p are trivial and not interesting Ex. Euclid assumed five formulas about geometry and deduced an extensive Ex. Euclid assumed five formulas about geometry and deduced an extensive
set of logical consequencesset of logical consequences.. Definition 2.41Definition 2.41
A set of formulas A set of formulas TT is a is a theorytheory if and only if it is if and only if it is closedclosed under logical under logical consequenceconsequence. .
TT is closed under logical consequence if and only if for all formula is closed under logical consequence if and only if for all formula AA, if , if TT ²² AA then then AA 22 TT. .
The elements of The elements of TT are called are called theoremstheorems Let Let UU be a set of formulas. be a set of formulas. TT ( (UU) = {) = {AA | | UU ²² AA} is called the theory of } is called the theory of UU. The . The
formulas of formulas of UU are called are called axiomsaxioms and the theory and the theory TT ( (UU) is ) is axiomatizableaxiomatizable.. Is Is TT ( (UU) theory?) theory?
![Page 15: Intro. to Logic CS402 Fall 2007 1 Propositional Calculus - Semantics (2/3) Propositional Calculus - Semantics (2/3) Moonzoo Kim CS Division of EECS Dept.](https://reader030.fdocuments.net/reader030/viewer/2022032605/56649e765503460f94b775c9/html5/thumbnails/15.jpg)
Examples of theory U = { pÇqÇr, q!r, r!p} Interpretation v1, v3 and v4 are models of U Which of the followings are true?
U ² p U ² q!r U ² r Ç :q U ² p Æ :q
Theory of U, i.e,T (U) U µ T (U)
because for all formula A 2 U, A ² A p 2 T (U)
because U ² p q!r 2 T (U)
because U ² q!r p Æ (q!r) 2 T (U)
because U ² p Æ (q!r) since U ² p and U ² q!r )
…
p q r pÇqÇr q!r r!p
v1 T T T T T T
v2 T T F T F T
v3 T F T T T T
v4 T F F T T T
v5 F T T T T F
v6 F T F T F T
v7 F F T T T F
v8 F F F F T T
![Page 16: Intro. to Logic CS402 Fall 2007 1 Propositional Calculus - Semantics (2/3) Propositional Calculus - Semantics (2/3) Moonzoo Kim CS Division of EECS Dept.](https://reader030.fdocuments.net/reader030/viewer/2022032605/56649e765503460f94b775c9/html5/thumbnails/16.jpg)
Ex. Theory of Euclidean geometry A set of 5 axioms U = {A1,A2,A3,A4,A5} such that
A1:Any two points can be joined by a unique straight line. A2:Any straight line segment can be extended indefinitely in a straight line. A3:Given any straight line segment, a circle can be drawn having the
segment as radius and one endpoint as center. A4:All right angles are congruent. A5:For every line l and for every point P that does not lie on l there exists a
unique line m through P that is parallel to l.
Euclidean theory TEuclid= T (U) = { A | U ² A} I.e.,Teuclid is axiomatizable by the above 5 axioms Ex. one logical consequence of the axioms
given a line segment AB, an equilateral triangleexists that includes the segment as one of its sides.
![Page 17: Intro. to Logic CS402 Fall 2007 1 Propositional Calculus - Semantics (2/3) Propositional Calculus - Semantics (2/3) Moonzoo Kim CS Division of EECS Dept.](https://reader030.fdocuments.net/reader030/viewer/2022032605/56649e765503460f94b775c9/html5/thumbnails/17.jpg)
Ex2. Model checking (formal verification)
A file system M can be specified by the following 7 formulas (i.e., a file system model M = { A1,A2,A3,A4,A5,A6,A7})
A1:A file system object has one or no parent. sig FSObject { parent: lone Dir }
A2:A directory has a set of file system objects sig Dir extends FSObject { contents: set FSObject }
A3:A directory is the parent of its contents fact defineContents { all d: Dir, o: d.contents | o.parent = d }
A4: A file in the file system is a file system object sig File extends FSObject {}
A5: All file system objects are either files or directories fact fileDirPartition { File + Dir = FSObject }
A6: There exists only one root one sig Root extends Dir { }{ no parent }
A7: File system is connected fact fileSystemConnected { FSObject in Root.*contents }
We can prove that this file system does not have a cyclic path A: No cyclic path exists
assert acyclic { no d: Dir | d in d.^contents } M ² A (i.e., this file system M does not have cyclic path)
root
D1 D2
F1 F2 D11
F111