Natural Deduction. Formal Methods in Verification of Computer Systems Jeremy Johnson

Similar documents
Natural Deduction for Propositional Logic

03 Propositional Logic II

Overview. I Review of natural deduction. I Soundness and completeness. I Semantics of propositional formulas. I Soundness proof. I Completeness proof.

15414/614 Optional Lecture 1: Propositional Logic

CS 512, Spring 2016, Handout 02 Natural Deduction, and Examples of Natural Deduction, in Propositional Logic

02 Propositional Logic

Propositional Logic: Part II - Syntax & Proofs 0-0

Deductive Systems. Lecture - 3

2. The Logic of Compound Statements Summary. Aaron Tan August 2017

(p == train arrives late) (q == there are taxis) (r == If p and not q, then r. Not r. p. Therefore, q. Propositional Logic

Warm-Up Problem. Write a Resolution Proof for. Res 1/32

The Importance of Being Formal. Martin Henz. February 5, Propositional Logic

Artificial Intelligence. Propositional logic

Learning Goals of CS245 Logic and Computation

Lecture 2. Logic Compound Statements Conditional Statements Valid & Invalid Arguments Digital Logic Circuits. Reading (Epp s textbook)

Introduction to Theoretical Computer Science

Language of Propositional Logic

Propositional Logics and their Algebraic Equivalents

Logic for Computer Science - Week 5 Natural Deduction

Propositional Logic Language

COMP219: Artificial Intelligence. Lecture 19: Logic for KR

COMP219: Artificial Intelligence. Lecture 19: Logic for KR

Proof Tactics, Strategies and Derived Rules. CS 270 Math Foundations of CS Jeremy Johnson

Lecture 1: Propositional Logic (I)

Computation and Logic Definitions

Propositional Logic: Deductive Proof & Natural Deduction Part 1

Propositional Logic. CS 3234: Logic and Formal Systems. Martin Henz and Aquinas Hobor. August 26, Generated on Tuesday 31 August, 2010, 16:54

Logic: Propositional Logic (Part I)

Knowledge base (KB) = set of sentences in a formal language Declarative approach to building an agent (or other system):

Overview. Knowledge-Based Agents. Introduction. COMP219: Artificial Intelligence. Lecture 19: Logic for KR

Přednáška 12. Důkazové kalkuly Kalkul Hilbertova typu. 11/29/2006 Hilbertův kalkul 1

Section 1.2: Propositional Logic

CS250: Discrete Math for Computer Science. L6: CNF and Natural Deduction for PropCalc

Propositional natural deduction

Chapter 11: Automated Proof Systems (1)

Advanced Topics in LP and FP

Chapter 4: Classical Propositional Semantics

Chapter 1: The Logic of Compound Statements. January 7, 2008

Notes on Inference and Deduction

Fundamentals of Logic

Propositional Logic: Review

FORMAL PROOFS DONU ARAPURA

CSC Discrete Math I, Spring Propositional Logic

Propositional logic (revision) & semantic entailment. p. 1/34

Propositional Logic. Jason Filippou UMCP. ason Filippou UMCP) Propositional Logic / 38

Propositional logic. Programming and Modal Logic

SE 212: Logic and Computation. se212 Nancy Day

Logical Agents. Outline

AI Programming CS S-09 Knowledge Representation

Predicate Calculus. Formal Methods in Verification of Computer Systems Jeremy Johnson

Normal Forms of Propositional Logic

Chapter 11: Automated Proof Systems

CS 2740 Knowledge Representation. Lecture 4. Propositional logic. CS 2740 Knowledge Representation. Administration

Applied Logic. Lecture 1 - Propositional logic. Marcin Szczuka. Institute of Informatics, The University of Warsaw

Description Logics. Foundations of Propositional Logic. franconi. Enrico Franconi

Outline. Overview. Syntax Semantics. Introduction Hilbert Calculus Natural Deduction. 1 Introduction. 2 Language: Syntax and Semantics

CHAPTER 11. Introduction to Intuitionistic Logic

Propositional Logic. Testing, Quality Assurance, and Maintenance Winter Prof. Arie Gurfinkel

Intelligent Agents. Pınar Yolum Utrecht University

Formal (natural) deduction in propositional logic

Introduction to Intuitionistic Logic

Warm-Up Problem. Is the following true or false? 1/35

Propositional Logic Arguments (5A) Young W. Lim 10/11/16

Propositional Logic Basics Propositional Equivalences Normal forms Boolean functions and digital circuits. Propositional Logic.

Announcements. CS311H: Discrete Mathematics. Propositional Logic II. Inverse of an Implication. Converse of a Implication

PROPOSITIONAL CALCULUS

Propositional Logic Arguments (5A) Young W. Lim 11/8/16

EECS 1028 M: Discrete Mathematics for Engineers

Logic, Sets, and Proofs

Proof Methods for Propositional Logic

Compound Propositions

Part 1: Propositional Logic

Inference in Propositional Logic

The Logic of Compound Statements cont.

Intermediate Logic. Natural Deduction for TFL

Logic and Proofs. (A brief summary)

A Weak Post s Theorem and the Deduction Theorem Retold

Propositional Logic: Models and Proofs

Propositional Logic Part 1

Propositional Logic Arguments (5A) Young W. Lim 11/30/16

Logical Agents. Chapter 7

Discrete Structures & Algorithms. Propositional Logic EECE 320 // UBC

Propositional Logic. Spring Propositional Logic Spring / 32

Marie Duží

Propositional Logic. Fall () Propositional Logic Fall / 30

Natural Deduction is a method for deriving the conclusion of valid arguments expressed in the symbolism of propositional logic.

1 Propositional logic

Automated Reasoning Lecture 2: Propositional Logic and Natural Deduction

Announcements. CS243: Discrete Structures. Propositional Logic II. Review. Operator Precedence. Operator Precedence, cont. Operator Precedence Example

Logic and Inferences

EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS

Computational Logic. Davide Martinenghi. Spring Free University of Bozen-Bolzano. Computational Logic Davide Martinenghi (1/30)

cis32-ai lecture # 18 mon-3-apr-2006

The semantics of propositional logic

Part Two: The Basic Components of the SOFL Specification Language

Artificial Intelligence Knowledge Representation I

Logic. Introduction to Artificial Intelligence CS/ECE 348 Lecture 11 September 27, 2001

CHAPTER 1 - LOGIC OF COMPOUND STATEMENTS

Knowledge based Agents

Propositional logic. Programming and Modal Logic

Transcription:

Natural Deduction Formal Methods in Verification of Computer Systems Jeremy Johnson

Outline 1. An example 1. Validity by truth table 2. Validity by proof 2. What s a proof 1. Proof checker 3. Rules of natural deduction 4. Provable equivalence 5. Soundness and Completeness

An Example If the train arrives late and there are no taxis at the station, then John is late for his meeting. John is not late for his meeting. The train did arrive late. Therefore, there were taxis at the station. If it is raining and Jane does not have here umbrella with her, then she will get wet. Jane is not wet. It is raining. Therefore, Jane has her umbrella with her.

An Example If the train arrives late and there are no taxis at the station, then John is late for his meeting. John is not late for his meeting. The train did arrive late. Therefore, there were taxis at the station. p = the train arrives late q = there are taxis at the station r = John is late for his meeting. p q r, r, p q [a sequent]

An Example p = it is raining q = Jane has her umbrella r = Jane gets wet. p q r, r, p q If it is raining and Jane does not have here umbrella with her, then she will get wet. Jane is not wet. It is raining. Therefore, Jane has her umbrella with her.

Validity by Truth Table p q r, r, p q p q r q r p q (p q) r F F F T T F T F F T T F F T F T F F T F T F T T F F F T T F F T T T F T F T T F T T T T F F T F T T T T F F F T

Proof By applying rules of inference to a set of formulas, called premises, we derive additional formulas and may infer a conclusion from the premises A sequent is φ 1,,φ n ψ Premises φ 1,,φ n Conclusion ψ The sequent is valid if a proof for it can be found

Proof A proof is a sequence of formulas that are either premises or follow from the application of a rule to previous formulas Each formula must be labeled by it s justification, i.e. the rule that was applied along with pointers to the formulas that the rule was applied to It is relatively straightforward to check to see if a proof is valid

Validity by Deduction p q r, r, p q 1 p q r premise 2 r premise 3 p premise 4 q assumption 5 p q i 3,4 6 r e 1,5 7 e 6,2 8 q i 4-7 9 q e 8

Rules of Natural Deduction Natural deduction uses a set of rules formally introduced by Gentzen in 1934 The rules follow a natural way of reasoning about Introduction rules Introduce logical operators from premises Elimination rules Eliminate logical operators from premise producing a conclusion without the operator

Conjunction Rules Introduction Rule φ ψ φ ψ i Elimination Rule φ ψ φ e1 φ ψ ψ e2

Implication Rules Introduction Rule φ ψ φ ψ i Assume φ and show ψ Elimination Rule (Modus Ponens) φ φ ψ ψ e

Disjunction Rules Introduction Rule φ φ ψ i1 ψ φ ψ i2 Elimination Rule (proof by case analysis) φ ψ φ χ χ ψ χ e

Negation Rules Introduce the symbol ( = bottom) to encode a contradiction Bottom elimination φ e. Elimination Rule can prove anything φ φ e

Negation Rules Introduction Rule φ φ i Double negation φ leads to a contradiction φ φ e

Proof by Contradiction Derived Rule φ φ PBC Assume φ and derive a a contradiction Derived rules can be used like the basic rules and serve as a short cut (macro) Sometimes used as a negation elimination rule instead of double negation

Law of the Excluded Middle p p [derived rule LEM] 1 (p p) assumption 2 p Assumption 3 (p p) i 1 3,4 4 e 3,1 5 p i 2-4 6 p p i 2 3,4 7 e 6,1 8 (p p) i 1-7 9 p p e 8

ProofLab The ProofLab tool from the Logic and Proofs course from the CMU online learning initiative allows you to experiment with natural deduction proofs

ProofLab

Provable Equivalence φ and ψ are provably equivalent, φ ψ, iff the sequents φ ψ and ψ φ are both valid Alternatively φ ψ iff the sequent φ ψ ψ φ is valid A valid sequent with no premises is a tautology

De Morgan s Law (P Q) P Q 1 (P Q) premise 2 P assumption 3 P Q i1 2 4 e 1,3 5 P i 2-4 6 Q assumption 7 P Q i2 6 8 e 1,7 9 Q i 6-8 10 P Q i 5,9

De Morgan s Law (P Q) P Q 1 P Q premise 2 P e1 1 3 Q e2 1 4 P Q assumption 5 P assumption 6 e 2,5 7 Q i2 6 8 e 3,7 9 e 4,5-6, 7-8 10 (P Q) i 4-9

Semantic Entailment If for all valuations (assignments of variables to truth values) for which all φ 1,,φ n evaluate to true, ψ also evaluates to true then the semantic entailment relation φ 1,,φ n ψ holds

Soundness and Completeness φ 1,,φ n ψ holds iff φ 1,,φ n ψ is valid In particular, ψ, a tautology, ψ is valid. I.E. ψ is a tautology iff ψ is provable Soundness you can not prove things that are not true in the truth table sense Completeness you can prove anything that is true in the truth table sense

Proof Outline For soundness show, using a truth table, that each rule of inference implies the conclusion is true when the assumptions are true and use induction on the length of the proof to chain together inferences For completeness 1. Reduce to proving tautologies 2. Provide a proof for a sequent for each entry in the truth table for the conclusion using induction on the formula in the conclusion 3. Construct proof from the proofs for each row

Illustrate Inductive Proof Prove if p q r p (q r) valid then p q r p (q r) 1 p q r premise 2 p assumption 3 q assumption 4 p q i 2,3 5 r e 1,5 6 q r i 3-5 7 p (q r) i 2-6

Smaller Proof Remove last line 1 p q r premise 2 p assumption 3 q assumption 4 p q i 2,3 5 r e 1,5 6 q r i 3-5

Inductive Hypothesis Remove last line and change assumption to premise to obtain proof of p q r, p q r 1 p q r premise 2 p premise 3 q assumption 4 p q i 2,3 5 r e 1,5 6 q r i 3-5 By induction p q r, p q r

Inductive Step p q r, p q r and correctness of i Implies p q r p (q r) φ ψ φ ψ i ϕ ψ ϕ ψ F F T F T T T F F T T T

Proof of Soundness Use induction on the length of the proof Base case. When the proof has length 1, premise and conclusion are the same. Clearly the conclusion is T when the premise is T Look at the rule in the last line of the proof Obtain proofs for the premises and use induction hypothesis to show entailment for premises Use correctness of rule and truth of premises to deduce truth of conclusion

Correctness of Rules of Inference φ ψ φ χ χ ψ χ e ϕ ψ χ ϕ χ ψ χ ϕ ψ F F F T T F F F T T T F F T F T F T F T T T T T T F F F T T T F T T T T T T F F F T T T T T T T

Correctness of Rules of Inference φ φ i φ φ e ϕ ϕ ϕ F F T T T F F ϕ ϕ ϕ F T F T F T

Induction for Implication Elimination Given a proof of length k for the sequent φ 1,,φ n ψ and assume the rule at step k is e and the premise Then we obtain proofs for (replace open assumptions by premises) φ 1,,φ n η 1 η 2 φ 1,,φ n, η 1 ψ φ 1,,φ n, η 2 ψ

Inductive Step Since the proofs are shorter by induction φ 1,,φ n η 1 η 2 φ 1,,φ n, η 1 ψ φ 1,,φ n, η 2 ψ By correctness of the e rule, we conclude φ 1,,φ n ψ A similar proof must be carried out for each of the rules of inference

Proof of Completeness 1. Reduce to tautologies φ 1,,φ n ψ is equivalent to ϕ = φ 1 (φ 2 (φ n ψ) ) This follows from (A B) C A (B C) 2. Prove p, 1, p n ϕ for each row in the truth table for ϕ 3. Combine the proofs in (2) using case analysis and the LEM to obtain a proof for the tautology ϕ

Key Lemma for Proof of Completeness Proposition. Let ϕ be a boolean formula with propositional atoms p 1,,p n. Let l be any row in the truth table for ϕ. Let p i be p i if the entry for p i is T and p i if the entry if F. Then p, 1, p n ϕ is provable if ϕ in row l is T p, 1, p n ϕ is provable if ϕ in row l is T

Proof of Lemma Use structural induction on the formula ϕ Base case. ϕ is a propositional atom. In this case the proofs of p p and p p are trivial. For boolean operators assume proofs for the operands and then construct a proof from them for each of the operators,, and. This is shown for. The other cases are similar.

Inductive Step for Implication To prove p, 1, p n ϕ 1 ϕ 2 For each entry in the truth table for ϕ 1 ϕ 2 Assume proofs for p, 1, p n ϕ 1 [ ϕ 1 ] and p, 1, p n ϕ 2 [ ϕ 2 ] Prove ϕ 1 ϕ 2 ϕ 1 ϕ 2 [ϕ 1 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