(Materials drawn from Chapter 1 in: “Michael Huth and Mark Ryan. Logic in Computer Science: Modelling and Reasoning about Systems, 2nd Ed., Cambridge University Press, 2006.”) Nguyen An Khuong, Huynh Tuong Nguyen Faculty of Computer Science and Engineering University of Technology, VNUHCM Contents 1 Propositional Calculus: Declarative Sentences 2 Propositional Calculus: Natural Deduction Sequents Rules for natural deduction Basic and Derived Rules Excursion: Intuitionistic Logic 3 Propositional Logic as a Formal Language 4 Semantics of Propositional Logic Meaning of Logical Connectives Preview: Soundness and Completeness 5 Conjunctive Normal Form
Propositional Logic I Nguyen An Khuong, Huynh Tuong Nguyen Chapter 1a Propositional Logic I Discrete Mathematics II Contents Introduction Declarative Sentences Natural Deduction Sequents Rules for natural deduction (Materials drawn from Chapter in: Basic and Derived Rules Intuitionistic Logic “Michael Huth and Mark Ryan Logic in Computer Science: Modelling and Reasoning about Systems, 2nd Ed., Cambridge University Press, 2006.”) Formal Language Semantics Meaning of Logical Connectives Preview: Soundness and Completeness Normal Form Nguyen An Khuong, Huynh Tuong Nguyen Faculty of Computer Science and Engineering University of Technology, VNU-HCM Homeworks and Next Week Plan? 1a.1 Contents Propositional Logic I Nguyen An Khuong, Huynh Tuong Nguyen Propositional Calculus: Declarative Sentences Propositional Calculus: Natural Deduction Sequents Rules for natural deduction Basic and Derived Rules Excursion: Intuitionistic Logic Contents Introduction Declarative Sentences Natural Deduction Sequents Rules for natural deduction Propositional Logic as a Formal Language Basic and Derived Rules Intuitionistic Logic Formal Language Semantics of Propositional Logic Meaning of Logical Connectives Preview: Soundness and Completeness Semantics Meaning of Logical Connectives Preview: Soundness and Completeness Normal Form Conjunctive Normal Form Homeworks and Next Week Plan? 1a.2 Propositional Logic I Nguyen An Khuong, Huynh Tuong Nguyen Propositional Calculus: Declarative Sentences Propositional Calculus: Natural Deduction Contents Introduction Propositional Logic as a Formal Language Declarative Sentences Natural Deduction Semantics of Propositional Logic Sequents Rules for natural deduction Basic and Derived Rules Intuitionistic Logic Conjunctive Normal Form Formal Language Semantics Meaning of Logical Connectives Preview: Soundness and Completeness Normal Form Homeworks and Next Week Plan? 1a.3 Propositional Calculus Propositional Logic I Nguyen An Khuong, Huynh Tuong Nguyen Study of atomic propositions Propositions are built from sentences whose internal structure is not of concern Contents Building propositions Boolean operators are used to construct propositions out of simpler propositions Introduction Declarative Sentences Natural Deduction Sequents Rules for natural deduction Basic and Derived Rules Example for Propositional Calculus Intuitionistic Logic Formal Language • Atomic proposition: One plus one equals two • Atomic proposition: The earth revolves around the sun • Combined proposition: One plus one equals two and the earth revolves around the sun Semantics Meaning of Logical Connectives Preview: Soundness and Completeness Normal Form Homeworks and Next Week Plan? 1a.4 Goals and Main Result of Propositional Calculus Propositional Logic I Nguyen An Khuong, Huynh Tuong Nguyen Meaning of formula Associate meaning to a set of formulas by assigning a value true or false to every formula in the set Contents Introduction Declarative Sentences Proofs Symbol sequence that formally establishes whether a formula is always true Natural Deduction Sequents Rules for natural deduction Basic and Derived Rules Intuitionistic Logic Formal Language Soundness and completeness The set of provable formulas is the same as the set of formulas which are always true Semantics Meaning of Logical Connectives Preview: Soundness and Completeness Normal Form Homeworks and Next Week Plan? 1a.5 Uses of Propositional Calculus Propositional Logic I Nguyen An Khuong, Huynh Tuong Nguyen Hardware design The production of logic circuits uses propositional calculus at all phases; specification, design, testing Contents Introduction Declarative Sentences Verification Verification of hardware and software makes extensive use of propositional calculus Natural Deduction Sequents Rules for natural deduction Basic and Derived Rules Intuitionistic Logic Formal Language Problem solving Decision problems (scheduling, timetabling, etc) can be expressed as satisfiability problems in propositional calculus Semantics Meaning of Logical Connectives Preview: Soundness and Completeness Normal Form Homeworks and Next Week Plan? 1a.6 Predicate Calculus: Central ideas Propositional Logic I Nguyen An Khuong, Huynh Tuong Nguyen Richer language Instead of dealing with atomic propositions, predicate calculus provides the formulation of statements involving sets, functions and relations on these sets Contents Introduction Declarative Sentences Quantifiers Natural Deduction Sequents Predicate calculus provides statements that all or some elements of a set have specified properties Rules for natural deduction Basic and Derived Rules Intuitionistic Logic Formal Language Compositionality Similar to propositional calculus, formulas can be built from composites using logical connectives Semantics Meaning of Logical Connectives Preview: Soundness and Completeness Normal Form Homeworks and Next Week Plan? 1a.7 The uses of Predicate Calculus Propositional Logic I Nguyen An Khuong, Huynh Tuong Nguyen Progamming Language Semantics The meaning of programs such as ifx >= 0theny := sqrt(x)elsey := abs(x) can be captured with formulas of predicate calculus: √ ∀x∀y(x = x ∧ (x ≥ → y = x) ∧ (¬(x ≥ 0) → y = |x|)) Contents Introduction Declarative Sentences Natural Deduction Sequents Rules for natural deduction Other Uses of Predicate Calculus • Specification: Formally specify the purpose of a program in order to serve as input for software design, • Verification: Prove the correctness of a program with respect to its specification Basic and Derived Rules Intuitionistic Logic Formal Language Semantics Meaning of Logical Connectives Preview: Soundness and Completeness Normal Form Homeworks and Next Week Plan? 1a.8 An Example for Specification Propositional Logic I Nguyen An Khuong, Huynh Tuong Nguyen Let P be a program of the form while a b if a > b then a := a - b else a:= b - a; The specification of the program is given by the formula Contents Introduction Declarative Sentences Natural Deduction Sequents Rules for natural deduction Basic and Derived Rules {a ≥ ∧ b ≥ 0} P {a = gcd(a, b)} Intuitionistic Logic Formal Language Semantics Meaning of Logical Connectives Preview: Soundness and Completeness Normal Form Homeworks and Next Week Plan? 1a.9 Logic in Theorem Proving, Logic Programming, and Other Systems of Logic Propositional Logic I Nguyen An Khuong, Huynh Tuong Nguyen Theorem proving Formal logic has been used to design programs that can automatically prove mathematical theorems Logic programming Research in theorem proving has led to an efficient way of proving formulas in predicate calculus, called resolution, which forms the basis for logic programming Contents Introduction Declarative Sentences Natural Deduction Sequents Rules for natural deduction Basic and Derived Rules Some Other Systems of Logic Intuitionistic Logic Formal Language • Three-valued logic: A third truth value (denoting “don’t know” or “undetermined”) is often useful • Intuitionistic logic: A mathematical object is accepted only if a finite construction can be given for it • Temporal logic: Integrates time-dependent constructs such Semantics Meaning of Logical Connectives Preview: Soundness and Completeness Normal Form Homeworks and Next Week Plan? as (“always” and “eventually”) explicitly into a logic framework; useful for reasoning about real-time systems 1a.10 Meaning of propositional formula Propositional Logic I Nguyen An Khuong, Huynh Tuong Nguyen Meaning as mathematical object We define the meaning of formulas as a function that maps formulas and valuations to truth values Contents Approach We define this mapping based on the structure of the formula, using the meaning of their logical connectives Introduction Declarative Sentences Natural Deduction Sequents Rules for natural deduction Truth Values The set of truth values contains two elements T and F, where T represents “true” and F represents “false” Valuations Basic and Derived Rules Intuitionistic Logic Formal Language Semantics Meaning of Logical Connectives Preview: Soundness and Completeness Normal Form A valuation or model of a formula φ is an assignment of each propositional atom in φ to a truth value Homeworks and Next Week Plan? 1a.63 Propositional Logic I Meaning of logical connectives Nguyen An Khuong, Huynh Tuong Nguyen The meaning of a connective is defined as a truth table that gives the truth value of a formula, whose root symbol is the connective, based on the truth values of its components Contents Introduction Declarative Sentences Natural Deduction φ T T F F ψ T F T F φ∧ψ T F F F Sequents Rules for natural deduction Basic and Derived Rules Intuitionistic Logic Formal Language Semantics Meaning of Logical Connectives Preview: Soundness and Completeness Normal Form Homeworks and Next Week Plan? 1a.64 Propositional Logic I Truth tables of formulas Nguyen An Khuong, Huynh Tuong Nguyen Truth tables use placeholders of formulas such as φ: φ T T F F ψ T F T F φ∧ψ T F F F Contents Introduction Declarative Sentences Natural Deduction Sequents Rules for natural deduction Build the truth table for given formula: p T T q T T r T F (p ∧ q) T T ((p ∧ q) ∧ r) T F Basic and Derived Rules Intuitionistic Logic Formal Language Semantics Meaning of Logical Connectives Preview: Soundness and Completeness Normal Form Homeworks and Next Week Plan? 1a.65 Propositional Logic I Truth tables of other connectives Nguyen An Khuong, Huynh Tuong Nguyen φ T T F F ψ T F T F φ∨ψ T T T F φ T T F F ψ T F T F φ→ψ T F T T Contents Introduction Declarative Sentences Natural Deduction Sequents Rules for natural deduction Basic and Derived Rules Intuitionistic Logic φ T F ¬φ F T Formal Language T ⊥ F Semantics Meaning of Logical Connectives Preview: Soundness and Completeness Normal Form Homeworks and Next Week Plan? 1a.66 Constructing the truth table of a formula Propositional Logic I Nguyen An Khuong, Huynh Tuong Nguyen p T T F F q T F T F (¬p) F F T T ¬q F T F T p → ¬q F T T T q ∨ ¬p T F T T (p → ¬q) → (q ∨ ¬p) T F T T Contents Introduction Declarative Sentences Natural Deduction Sequents Rules for natural deduction Basic and Derived Rules Intuitionistic Logic Formal Language Semantics Meaning of Logical Connectives Preview: Soundness and Completeness Normal Form Homeworks and Next Week Plan? 1a.67 Validity and Satisfiability Propositional Logic I Nguyen An Khuong, Huynh Tuong Nguyen Validity Contents Introduction A formula is valid if it computes T for all its valuations Declarative Sentences Natural Deduction Satisfiability Sequents A formula is satisfiable if it computes T for at least one of its valuations Basic and Derived Rules Rules for natural deduction Intuitionistic Logic Formal Language Semantics Meaning of Logical Connectives Preview: Soundness and Completeness Normal Form Homeworks and Next Week Plan? 1a.68 Semantic Entailment, Soundness and Completeness of Propositional Logic Propositional Logic I Nguyen An Khuong, Huynh Tuong Nguyen Semantic Entailment If, for all valuations in which all φ1 , φ2 , , φn evaluate to T, the formula ψ evaluates to T as well, we say that φ1 , φ2 , , φn semantically entail ψ, written: Contents Introduction φ1 , φ2 , , φn |= ψ Declarative Sentences Natural Deduction Sequents Rules for natural deduction Basic and Derived Rules Soundness Let φ1 , φ2 , , φn and ψ be propositional formulas If φ1 , φ2 , , φn ψ, then φ1 , φ2 , , φn |= ψ Completeness Let φ1 , φ2 , , φn and ψ be propositional formulas If φ1 , φ2 , , φn |= ψ, then φ1 , φ2 , , φn ψ Intuitionistic Logic Formal Language Semantics Meaning of Logical Connectives Preview: Soundness and Completeness Normal Form Homeworks and Next Week Plan? 1a.69 Propositional Logic I Nguyen An Khuong, Huynh Tuong Nguyen Propositional Calculus: Declarative Sentences Propositional Calculus: Natural Deduction Contents Introduction Propositional Logic as a Formal Language Declarative Sentences Natural Deduction Semantics of Propositional Logic Sequents Rules for natural deduction Basic and Derived Rules Intuitionistic Logic Conjunctive Normal Form Formal Language Semantics Meaning of Logical Connectives Preview: Soundness and Completeness Normal Form Homeworks and Next Week Plan? 1a.70 Propositional Logic I Conjunctive Normal Form Nguyen An Khuong, Huynh Tuong Nguyen Definition A literal L is either an atom p or the negation of an atom ¬p A formula C is in conjunctive normal form (CNF) if it is a conjunction of clauses, where each clause is a disjunction of literals: Contents Introduction L ::= p|¬p, D ::= L|L ∨ D, C ::= D|D ∧ C Declarative Sentences Natural Deduction Sequents Rules for natural deduction Basic and Derived Rules Intuitionistic Logic Formal Language Examples • (¬p ∨ q ∨ r) ∧ (¬q ∨ r) ∧ (¬r) is in CNF • (¬p ∨ q ∨ r) ∧ ((p ∧ ¬q) ∨ r) ∧ (¬r) is not in CNF • (¬p ∨ q ∨ r) ∧ ¬(¬q ∨ r) ∧ (¬r) is not in CNF Semantics Meaning of Logical Connectives Preview: Soundness and Completeness Normal Form Homeworks and Next Week Plan? 1a.71 Propositional Logic I Usefulness of CNF Nguyen An Khuong, Huynh Tuong Nguyen Lemma A disjunction of literals L1 ∨ L2 ∨ · · · ∨ Lm is valid iff there are ≤ i, j ≤ m such that Li is ¬Lj How to disprove Contents Introduction |= (¬q ∨ p ∨ r) ∧ (¬p ∨ r) ∧ q? Declarative Sentences Natural Deduction Disprove any of: Sequents Rules for natural deduction |= (¬q ∨ p ∨ r) |= (¬p ∨ r) |= q Basic and Derived Rules Intuitionistic Logic Formal Language How to prove Semantics Meaning of Logical Connectives |= (¬q ∨ p ∨ q) ∧ (p ∨ r¬p) ∧ (r ∨ ¬r)? Normal Form Prove all of: |= (¬q ∨ p ∨ q) Preview: Soundness and Completeness Homeworks and Next Week Plan? |= (p ∨ r¬p) |= (r ∨ ¬r) 1a.72 Usefulness of CNF (cont.) and Transformation to CNF Propositional Logic I Nguyen An Khuong, Huynh Tuong Nguyen Proposition Let φ be a formula of propositional logic Then φ is satisfiable iff ¬φ is not valid Contents Introduction Declarative Sentences Satisfiability test We can test satisfiability of φ by transforming ¬φ into CNF, and show that some clause is not valid Natural Deduction Sequents Rules for natural deduction Basic and Derived Rules Intuitionistic Logic Formal Language Theorem-Transformation to CNF Every formula in the propositional calculus can be transformed into an equivalent formula in CNF Semantics Meaning of Logical Connectives Preview: Soundness and Completeness Normal Form Homeworks and Next Week Plan? 1a.73 Algorithm for CNF Transformation Propositional Logic I Nguyen An Khuong, Huynh Tuong Nguyen Eliminate implication using: A → B ≡ ¬A ∨ B Push all negations inward using De Morgan’s laws: ¬(A ∧ B) ≡ (¬A ∨ ¬B), Contents Introduction ¬(A ∨ B) ≡ (¬A ∧ ¬B) Declarative Sentences Natural Deduction Sequents Rules for natural deduction Eliminate double negations using the equivalence ¬¬A ≡ A The formula now consists of disjunctions and conjunctions of literals Use the distributive laws to eliminate conjunctions within disjunctions: A ∨ (B ∧ C) ≡ (A ∨ B) ∧ (A ∨ C), Basic and Derived Rules Intuitionistic Logic Formal Language Semantics Meaning of Logical Connectives Preview: Soundness and Completeness Normal Form Homeworks and Next Week Plan? (A ∧ B) ∨ C ≡ (A ∨ C) ∧ (B ∨ C) 1a.74 Propositional Logic I Example Nguyen An Khuong, Huynh Tuong Nguyen Contents (¬p → ¬q) → (p → q) ≡ ¬(¬¬p ∨ ¬q) ∨ (¬p ∨ q) Introduction Declarative Sentences ≡ (¬¬¬p ∧ q) ∨ (¬p ∨ q) ≡ (¬p ∧ q) ∨ (¬p ∨ q) Sequents ≡ (¬p ∨ ¬p ∨ q) ∧ (q ∨ ¬p ∨ q) Basic and Derived Rules ≡ Natural Deduction Rules for natural deduction Intuitionistic Logic Formal Language Semantics Meaning of Logical Connectives Preview: Soundness and Completeness Normal Form Homeworks and Next Week Plan? 1a.75 Homeworks I Write down the explanations (in Vietnamese, or in English if possible) of the following terms, find examples for each term, what are the differences between them: 1) 2) 3) 4) 5) fallacy, contradiction, paradox, counterexample; premise, assumption; tautology, valid, contradiction, satisfiable; soundness, completeness; sequent, consequence, implication, entailment II What are the differences between the following notations: ’−→’, ’=⇒’, ’ ’, ’|=’ ? And what are the differences between the following notations: ’←→’, ’⇐⇒’, ’ ’, ’≡’, ’=’ ? Find examples to illustrate these differences III It is recommended that you should as much as you can ALL marked exercises in [2] (notice that sample solutions for these exercises are available in [3]) For this lecture, the following are recommended exercises [2]: 1.1: 1.2: 1.4: 1.5: 2d), 2g); 1d), 1g), 1m), 1q), 1u), 1w), 3a), 3b), 3c), 3f), 3g), 3l), 3o); 12d); 3b), 3c), 7c) Propositional Logic I Nguyen An Khuong, Huynh Tuong Nguyen Contents Introduction Declarative Sentences Natural Deduction Sequents Rules for natural deduction Basic and Derived Rules Intuitionistic Logic Formal Language Semantics Meaning of Logical Connectives Preview: Soundness and Completeness Normal Form Homeworks and Next Week Plan? 1a.76 Next Week? Propositional Logic I Nguyen An Khuong, Huynh Tuong Nguyen Contents • Exercises Session; • [2, Section 1.6]: SAT Solvers; Introduction Declarative Sentences Natural Deduction Sequents • Application of SAT Solving Rules for natural deduction Basic and Derived Rules Intuitionistic Logic Formal Language Semantics Meaning of Logical Connectives Preview: Soundness and Completeness Normal Form Homeworks and Next Week Plan? 1a.77 [...].. .Propositional Logic I Nguyen An Khuong, Huynh Tuong Nguyen 1 Propositional Calculus: Declarative Sentences 2 Propositional Calculus: Natural Deduction Contents Introduction 3 Propositional Logic as a Formal Language Declarative Sentences Natural Deduction 4 Semantics of Propositional Logic Sequents Rules for natural deduction Basic and Derived Rules Intuitionistic Logic 5 Conjunctive Normal... 1a. 31 Propositional Logic I Rule for Disjunction Nguyen An Khuong, Huynh Tuong Nguyen Introduction of Disjunction φ ψ [ i1 ] [ i2 ] φ∨ψ φ∨ψ Contents Introduction Declarative Sentences Natural Deduction Elimination of Disjunction Sequents Rules for natural deduction Basic and Derived Rules ✄ ✄ Intuitionistic Logic Formal Language φ∨ψ φ ψ χ χ ✂ ✁ ✂ Semantics Meaning of Logical Connectives Preview:... Homeworks and Next Week Plan? 1a. 30 Propositional Logic I Rule for Introduction of Implication Nguyen An Khuong, Huynh Tuong Nguyen Introduction of Implication ✄ Contents Introduction φ Declarative Sentences Natural Deduction Sequents ψ ✂ Rules for natural deduction Basic and Derived Rules ✁ Intuitionistic Logic [→ i] Formal Language Semantics φ→ψ Meaning of Logical Connectives Preview: Soundness and Completeness... Contents Introduction Declarative Sentences Natural Deduction Sequents 3 Propositional Logic as a Formal Language Rules for natural deduction Basic and Derived Rules Intuitionistic Logic 4 Semantics of Propositional Logic Formal Language Semantics Meaning of Logical Connectives 5 Conjunctive Normal Form Preview: Soundness and Completeness Normal Form Homeworks and Next Week Plan? 1a. 18 Introduction Propositional. .. Focus on Structure Propositional Logic I Nguyen An Khuong, Huynh Tuong Nguyen From Concrete Propositions to Letters - Example 1.2 If it is raining and Jane does not have her umbrella with her then she will get wet Jane is not wet Contents Introduction Declarative Sentences Natural Deduction Sequents It is raining Rules for natural deduction Basic and Derived Rules Intuitionistic Logic Therefore, Jane... Declarative Sentences Natural Deduction Sequents 4 ¬q → ¬p i 2–3 Rules for natural deduction Basic and Derived Rules Intuitionistic Logic We can start a box with an assumption, and use previously proven propositions (including premises) from the outside in the box We cannot use assumptions from inside the box in rules outside the box Formal Language Semantics Meaning of Logical Connectives Preview: Soundness... Meaning of Logical Connectives Preview: Soundness and Completeness Normal Form Homeworks and Next Week Plan? 1a. 34 Propositional Logic I Rule for Negation Nguyen An Khuong, Huynh Tuong Nguyen Elimination of Negation ¬φ φ [¬e] ⊥ Contents Introduction Declarative Sentences Natural Deduction Introduction of Negation Sequents Rules for natural deduction ✄ Basic and Derived Rules Intuitionistic Logic Formal... Language φ Semantics Meaning of Logical Connectives Preview: Soundness and Completeness ⊥ ✂ ✁ Normal Form [ i] Homeworks and Next Week Plan? ¬φ 1a. 35 Propositional Logic I Elimination of ⊥ Nguyen An Khuong, Huynh Tuong Nguyen Elimination of ⊥ Contents Introduction Declarative Sentences ⊥ Natural Deduction [⊥e] φ Sequents Rules for natural deduction Basic and Derived Rules Intuitionistic Logic Formal Language... • but first back to the proof rules Rules for natural deduction Basic and Derived Rules Intuitionistic Logic Formal Language Semantics Meaning of Logical Connectives Preview: Soundness and Completeness Normal Form Homeworks and Next Week Plan? 1a. 24 Rules of Double Negation and Eliminating Implication Propositional Logic I Nguyen An Khuong, Huynh Tuong Nguyen Double Negation ¬¬φ φ [¬¬e] [¬ i] ¬¬φ... are no taxis at the station then John is late for his meeting Contents John is not late for his meeting Introduction Declarative Sentences The train did arrive late Natural Deduction Sequents Therefore, there were taxis at the station Rules for natural deduction Basic and Derived Rules Intuitionistic Logic Sequent Formal Language Semantics p ∧ ¬q → r, ¬r, p q Meaning of Logical Connectives Preview: Soundness