Propositional Logic: Part II - Syntax & Proofs
Total Page:16
File Type:pdf, Size:1020Kb
Propositional Logic: Part II - Syntax & Proofs 0-0 Outline ² Syntax of Propositional Formulas ² Motivating Proofs ² Syntactic Entailment ` and Proofs ² Proof Rules for Natural Deduction ² Axioms, theories and theorems ² Consistency & completeness 1 Language of Propositional Calculus Def: A propositional formula is constructed inductively from the symbols for ² propositional variables: p; q; r; : : : or p1; p2; : : : ² connectives: :; ^; _; !; $ ² parentheses: (; ) ² constants: >; ? by the following rules: 1. A propositional variable or constant symbol (>; ?) is a formula. 2. If Á and à are formulas, then so are: (:Á); (Á ^ Ã); (Á _ Ã); (Á ! Ã); (Á $ Ã) Note: Removing >; ? from the above provides the def. of sentential formulas in Rubin. Semantically > = T; 2 ? = F though often T; F are used directly in formulas when engineers abuse notation. 3 WFF Smackdown Propositional formulas are also called propositional sentences or well formed formulas (WFF). When we use precedence of logical connectives and associativity of ^; _; $ to drop (smackdown!) parentheses it is understood that this is shorthand for the fully parenthesized expressions. Note: To further reduce use of (; ) some def's of formula use order of precedence: ! ^ ! :; ^; _; instead of :; ; $ _ $ As we will see, PVS uses the 1st order of precedence. 4 BNF and Parse Trees The Backus Naur form (BNF) for the de¯nition of a propositional formula is: Á ::= pj?j>j(:Á)j(Á ^ Á)j(Á _ Á)j(Á ! Á) Here p denotes any propositional variable and each occurrence of Á to the right of ::= represents any formula constructed thus far. We can apply this inductive de¯nition in reverse to construct a formula's parse tree. A parse tree represents a WFF Á if i) the root is an atomic formula and nothing else (i.e. Á is p), or ii) the root is : and there is only one well formed subtree, or iii) the root is ^; _; ! or $ and there are two well formed subtrees. Note: All leaf nodes will be atomic (e.g. p; ? or >) 5 Subformulas and Subtrees Def: If Á is a propositional formula, the subformulas of Á are give as follows: ² Á is a subformula of Á, ² if Á is :à then à is a subformula of Á, ² if Á is (Á1 ^ Á2); (Á1 _ Á2); (Á1 ! Á2), or (Á1 $ Á2), then both Á1 and Á2 are subformulas of Á ² if à is a subformula of Á, then all subformulas of à are subformulas of Á. The subformulas of Á correspond to all of the subtrees of Á's parse tree. Example: Consider p $ (q ^ :p ! q _ r). The fully parenthesized formula is: (p $ ((q ^ (:p)) ! (q _ r))) 6 Motivating Proofs Limitations of Truth Tables # of rows in truth table = 2n where n = # of propositional variables in formula Formula with 10 propositional variables has truth table with 210 = 1024 rows - too big to do by hand! Safety critical shutdown system with 3 redundant controllers each with > 20 boolean inputs & majority vote logic on shutdown could have speci¯cation of a propositional formula using > 3 ¢ 20 = 60 boolean variables. Truth table would have 260 > 1:15 £ 1018 rows! 260 Would require 8£109 = 144; 115; 188 > 144 million GB/column!! 7 Motivating Proofs (cont) Formal proof systems provide a way of examining the structure or syntax of formulas to determine the validity of an argument without resorting to truth tables. E.g. Know p; p ! q j= q (modus ponens - a.k.a !e). Therefore c _ :d; c _ :d ! (a ^ b $ c) j= a ^ b $ c Formal proof systems can decompose a problem into sub-problems (sub-proofs) that are of a manageable size. E.g. If Á1 : : : ; Án j= Ã1 and Á1; : : : Án j= Ã2 then Á1; : : : ; Án j= Ã1 ^ Ã2. 8 Proof Rules and Proofs These are examples of valid rules of inference or proof rules. E.g. Knowing that formulas Á and Á ! à are true allows us to infer or deduce that à is true. An example of an invalid rule of inference would be knowing that à is true and Á ! à is true, we conclude Á. Why? Def: A proof of à from premises Á1; : : : ; Án is a ¯nite sequence of propositions ending with Ã, such that each member of the sequence is either a premise (Ái), or is derived from previous members of the sequence by a valid rule of inference. In this case we say that Á1; : : : ; Án syntactically entails à and write Á1; : : : ; Án ` à and say that Á1; : : : ; Án ` à is a valid sequent. 9 Proof Rules of Natural Deduction While there exists more than one proof system for propositional (and predicate) logic Natural Deduction is one of the most useful systems. It formalizes rules of mathematical proof you are already familiar with, e.g., To prove condition Á implies situation Ã, assume Á is true and show that à follows. While there are variations in natural deduction proof systems (e.g., see Rubin vs. Huth+Ryan), they all have the same basic elements: - Rules to eliminate operators, and - Rules to introduce operators. 10 Proof Rules: ! e We know that Á; Á ! à j= Ã, so we can use this as a proof rule. If Á1; : : : Án ` Á and Á1; : : : Án ` Á ! Ã, then Á1; : : : Án ` Ã. This rule is known as modus ponens or \implies (arrow) elimination" which we will abbreviate by ! e and summarize as follows: Á Á ! à ! e à 11 Proof Rules: ! i Another useful rule follow from the following useful fact: Á j= à i® j= Á ! à Thus Á1 : : : Án; Á ` à i® Á1 : : : Án ` Á ! Ã. This rule is a form of the Deduction Theorem, a.k.a. conditional premise or \implies (arrow) introduction", denoted by ! i, and summarized as follows: Á . à ||| ! i Á ! à 12 A First Formal Proof Example: Show that p ! q; q ! r ` p ! r Proof: row Premises Deduce Rule 1 p ! q; q ! r ` p ! q Premise 2 p ! q; q ! r; p ` p Assumption 3 p ! q; q ! r; p ` q ! e1; 2 4 p ! q; q ! r; p ` q ! r Premise 5 p ! q; q ! r; p ` r ! e3; 4 6 p ! q; q ! r ` p ! r ! i2 ¡ 5 Note: We could show that: p ! q; q ! r; r ! s ` p ! s 13 in just 8 rows, not 24 = 16 rows of truth table. Try it. 14 Proof Rules: ^i Its getting pretty tedious writing Á1; : : : ; Án and I'm basically lazy so henceforth I'll write ¡ (\Big gamma"), to represent this sequence of premises. Assume (1) ¡ j= Á and (2) ¡ j= Ã. Then we must have ¡ j= Á ^ Ã. (why?) So if (1) ¡ ` Á and (2) ¡ ` à then ¡ ` Á ^ Ã. This result is known as part of the Rules of Adjunction, a.k.a. \conjunction (and) introduction", denoted by ^i, and summarized as follows: Á à ^ i Á ^ à 15 Proof Rules: ^e1; ^e2 Consider the following pair of valid arguments: (1) Á ^ à j= Á and (2) Á ^ à j= à To paraphrase these arguments: (1) says \When Á ^ à is true, then Á is true." (2) says \When Á ^ à is true, then à is true." So if ¡ ` Á ^ à then (1)¡ ` Á and (2)¡ ` Ã. This and the previous result are known as the Rules of Adjunction. We will call this part \conjunction (and) elimination", denoted by ^e1 and ^e2 respectively, and summarized as follows: Á ^ à Á ^ à ^ e1 ^ e2 Á à 16 Proof Rules: $ e1; $ e2 The rules we will use for dealing with $ are all based upon the following semantics equivalent: Á $ à ´ (Á ! Ã) ^ (à ! Á) (1) The rules for \if and only if elimination" follow from the valid argument: Á $ à j= (Á ! Ã) ^ (à ! Á) which in turn provides the valid arguments: (1)Á $ à j= Á ! Ã, and (2)Á $ à j= à ! Á. We denote $ elimination by $ e1 and $ e2 respectively, and summarized as follows: Á $ à Á $ à $ e1 $ e2 Á ! à à ! Á 17 Proof Rules: $ i Let us now consider the other valid argument that follows from (1), namely (Á ! Ã) ^ (à ! Á) j= Á $ à which by the defs. of ^ and j= is the same as: (Á ! Ã); (à ! Á) j= Á $ à This rule is also known as \double arrow introduction" which we will denote by $ i and summarize as follows: Á ! à à ! Á $ i Á $ à So if ¡ ` Á ! à and ¡ ` à ! Á then ¡ ` Á $ Ã. Example: Show ` (p ! (q ! r)) $ (p ^ q ! r) 18 Proof Rules: ::e and ::i It is easy to check that ::Á ´ Á. Hence: (1)::Á j= Á and (2)Á j= ::Á So we know: (1) if ¡ ` ::Á then ¡ ` Á, and (2) if ¡ ` Á the ¡ ` ::Á. This results are known as \double negation elimination" and \double negation introduction", denoted by ::e and ::i respectively, and summarized as follows: ::Á Á ::e ::i Á ::Á 19 Proof Rules: MT Recall the proof rule ! e. Á Á ! à ! e à If ¡ ` Á and ¡ ` Á ! Ã, then ¡ ` Ã. Suppose it is still the case that ¡ ` Á ! Ã, but instead of ¡ ` Á we know that ¡ ` :Ã. If Á were true, then by ! e we would have Ã, but since we have Á ! à and :Ã, we must have :Á. This reasoning is borne out by the valid argument: Á ! Ã; :à j= :Á The resulting proof rule is known as modus tollens or MT and 20 summarized as: Á ! à :à MT :Á Example: Show p ! q; q ! r ` :r ! :p 21 Proof Rules: _i Consider the following pair of valid arguments: (1) Á j= Á _ à and (2) à j= Á _ à To paraphrase these arguments: (1) says \When Á is true, then Á or à is true." (2) says \When à is true, then Á or à is true." So if (1)¡ ` Á or (2)¡ ` à then, either way, ¡ ` Á _ Ã.