* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download notes
Structure (mathematical logic) wikipedia , lookup
Quantum logic wikipedia , lookup
Axiom of reducibility wikipedia , lookup
Mathematical proof wikipedia , lookup
Intuitionistic logic wikipedia , lookup
Model theory wikipedia , lookup
First-order logic wikipedia , lookup
Law of thought wikipedia , lookup
Bernard Bolzano wikipedia , lookup
History of the Church–Turing thesis wikipedia , lookup
History of the function concept wikipedia , lookup
Analytic–synthetic distinction wikipedia , lookup
Natural deduction wikipedia , lookup
Boolean satisfiability problem wikipedia , lookup
Laws of Form wikipedia , lookup
Propositional calculus wikipedia , lookup
Truth-bearer wikipedia , lookup
1 Propositional Logic atomic propositions compound propositions built using “extensional” connectives (and, or, not, . . . ) Example 1.0.1. Because is not an “extensional” connective. Indeed A := 4 is an even number B := 4 can be divided by 2 C := 4 is not prime A, B and C are (indended to be) ”true” while A because B is (indended to be) ”true” A because C is (indended to be) ”false” 1.1 Syntax and: ∧ or: ∨ if . . . then . . . : → not: ¬ A, B, . . . : atomic propositions P, Q, . . . : formulas Definition 1.1.1 (Alphabet). Consists of the symbols: • for atomic propositions • connectives • “(”, “)” Definition 1.1.2 (Well Formed Formulas WFF). Is the minimal set X s.t. • A, B, . . . ∈ X 3 • If P ∈ X then (¬P ) ∈ X • If P, Q ∈ X then (P ? Q) ∈ X, where ? ∈ {∧, ∨, . . . } Priority to avoid parenthesis: ¬ > ∧ > ∨ > → Example 1.1.1. A ∧ B → ¬C is interpreted as (A ∧ B) → (¬C). One cannot remove the parenthesis in (A → B)∧C since the interpretation of A → B ∧C is A → (B ∧ C). 1.2 Semantics 1 “true” 0 “false” Definition 1.2.1 (Interpretation). v : WFF → {0, 1} ¬P : ¬P is true iff P is false: v(¬P ) = 1 iff v(P ) = 0 P 0 1 P ∧Q: P 0 0 1 1 P ∨Q: ¬P 1 0 v(P ∧ Q) = 1 iff v(P ) = v(Q) = 1 v(P ∧ Q) = min{v(P ), v(Q)} Q 0 1 0 1 P ∧Q 0 0 0 1 v(P ∨ Q) = 1 iff v(P ) = 1 or v(Q) = 1 v(P ∨ Q) = max{v(P ), v(Q)} P 0 0 1 1 P →Q: Q 0 1 0 1 P ∨Q 0 1 1 1 P 0 v(P → Q) = 0 iff v(P ) = 1 and v(Q) = 0 0 1 1 4 Q 0 1 0 1 P →Q 1 1 0 1 Definition 1.2.2 (Model). Let P ∈ WFF and v interpretation. If v(P ) = 1 we say that P is satisfied by v, or that v is a model for P (denoted by v |= P ). Definition 1.2.3. P is satisfiable if it has at least a model. P is unsatisfiable otherwise. Definition 1.2.4. P is a tautology if every interpretation v is a model for P (denoted by |= P ). Theorem 1.2.1. P is a tautology iff ¬P is unsatisfiable. Definition 1.2.5. Let Γ be a set of WFF and Q be a formula. Q is a (semantical) consequence of Γ iff for each interpretation v ((∀P i ∈ Γ, v(Pi ) = 1) =⇒ v(Q) = 1) (denoted by Γ |= Q). Theorem 1.2.2. Γ |= Q iff Γ ∪ {¬Q} is unsatisfiable. Proof. (⇒) Since Γ |= Q it holds that v(Q) = 1 for all models v of Γ. Therefore v(¬Q) = 0 for all models v of Γ and Γ ∪ {¬Q} has no model. (⇐) Let v 0 be an interpretation. If v 0 is a model for Γ, being Γ ∪ {¬Q} unsatisfiable, then necessarily v 0 (¬Q) = 0 iff v 0 (Q) = 1. Example 1.2.1. (A → B) ∨ (B → A) is a tautology. P 0 0 1 1 Q 0 1 0 1 (A → B) ∨ (B → A) 1 1 1 1 Definition 1.2.6. Let P and Q two WFF, P ≡ Q if for all interpretations v, v(P ) = v(Q). Each n-ary connective defines a function f : {0, 1} n → {0, 1} 2 Example 1.2.2. n = 2: 22 = 16 functions from {0, 1}2 to {0, 1} A connective is derivable if it is possible to define it from other connectives. Proposition 1.2.1. A → B ≡ ¬A ∨ B A ∨ B ≡ ¬A → B A ∨ B ≡ ¬(¬A ∧ ¬B) A ∧ B ≡ ¬(¬A ∨ ¬B) ¬A ≡ A → ⊥ ⊥ ≡ A ∧ ¬A 5 Let P be a propositions containing the (distinct) atomic formulas A 1 , . . . , An and v1 , . . . v2n its interpretations. We denote with v P the boolean function associated with P , i.e. vP : {0, 1}n → {0, 1} is defined as follows: for each (a 1 , . . . , an ), ai ∈ {0, 1}, there exists i ∈ {1, . . . 2n } such that vP (a1 , . . . , an ) = vi Definition 1.2.7. A set of connectives is functionally complete if every connective can be derived from it. Theorem 1.2.3. For each n-ary truth functions, there is a proposition P only using the connectives ∧, ∨ and ¬, such that f = v P . Proof. (See p. 47 of Gallier’s book). By induction on the arity n of f . 1 2 A 0 1 0 For n = 1 there are 4 possible truth functions: 1 0 1 A ∨ ¬A A ∧ ¬A Assume the claim is true for n. n + 1: Let f be a truth function with n + 1 arguments. f1 (x1 , . . . , xn ) = f (x1 , . . . , xn , 1) f2 (x1 , . . . , xn ) = f (x1 , . . . , xn , 0) ) 3 0 1 A 4 1 0 ¬A by i.h. f1 = vQ and f2 = vQ0 i.e. Q and Q0 represents f1 and f2 , resp. Let P be (An+1 ∧ Q) ∨ (¬An+1 ∧ Q0 ) where An+1 is an atomic proposition not occurring in Q, Q0 . It is easy to see that f = vP . Corollary 1.2.1. {∧, ∨, ¬} is functionally complete. 1.3 Normal Forms P1 ∨ · · · ∨ Pn . . . disjunction of formulas P1 ∧ · · · ∧ Pn . . . conjunction of formulas Definition 1.3.1. A literal is an atomic proposition or its negation. Definition 1.3.2. A well-formed formula P is in conjunctive normal form (CNF) iff P = P1 ∧ · · · ∧ Pn with n ≥ 1, where Pi , i ∈ {1, . . . , n}, is a disjunction of literals. Theorem 1.3.1. For each WFF P , there exists a CNF P C and a DNF P D s.t. P ≡ P C and P ≡ P D . 6 Proof. Uses equivalences such as ) ¬(P ∨ Q) ≡ ¬P ∧ ¬Q De Morgan laws ¬(P ∧ Q) ≡ ¬P ∨ ¬Q ¬¬P ≡ P P ∨ (Q ∧ R) ≡ (P ∨ Q) ∧ (P ∨ R) P ∧ (Q ∨ R) ≡ (P ∧ Q) ∨ (P ∧ R) ) Distributivity Truth table method A 0 0 1 1 B 0 1 0 1 P 1 0 1 0 → P1D = (¬A ∧ ¬B) → P1C = ¬(¬A ∧ B) → P2D = (A ∧ ¬B) → P2C = ¬(A ∧ B) P D = P1D ∨ P2D = (¬A ∧ ¬B) ∨ (A ∧ ¬B) P C = P1C ∧ P2C = ¬(¬A ∧ B) ∧ ¬(A ∧ B) = (A ∨ ¬B) ∧ (¬A ∨ ¬B) 7