<<

Introduction to Proof Theory Lecture 1 - Propositional logic, semantics and proofs

Anupam Das & Thomas Powell

University of Copenhagen & Technische Universität Darmstadt

European Summer School on Logic, Language, and Information

Sofia University 13 August 2018

These slides are available at http://www.anupamdas.com/esslli18.

1 / 51 Outline

1 Introduction, motivation and this course

2 Language of propositional logic

3 semantics

4 Some puzzles

5 Deductive reasoning

6 A Hilbert-Frege style deductive system

7 The deduction theorem

8 Questions and exercises

9 References

2 / 51 Formally, a proof system defines what a proof may be. This allows not only the study of proofs themselves, but also of what it means to be provable. But why do we study proofs? • Foundational results, which tell us something fundamental about reasoning itself. These lead to... • Applications, which use insights and techniques from proof theory to accomplish something concrete in another discipline altogether.

This lecture course: A comprehensive introduction to the field, focussing on classical results but hinting at powerful applications.

Wherefore proof theory?

Proof theory is the study of mathematical proofs as formal objects.

3 / 51 But why do we study proofs? • Foundational results, which tell us something fundamental about reasoning itself. These lead to... • Applications, which use insights and techniques from proof theory to accomplish something concrete in another discipline altogether.

This lecture course: A comprehensive introduction to the field, focussing on classical results but hinting at powerful applications.

Wherefore proof theory?

Proof theory is the study of mathematical proofs as formal objects. Formally, a proof system defines what a proof may be. This allows not only the study of proofs themselves, but also of what it means to be provable.

3 / 51 • Foundational results, which tell us something fundamental about reasoning itself. These lead to... • Applications, which use insights and techniques from proof theory to accomplish something concrete in another discipline altogether.

This lecture course: A comprehensive introduction to the field, focussing on classical results but hinting at powerful applications.

Wherefore proof theory?

Proof theory is the study of mathematical proofs as formal objects. Formally, a proof system defines what a proof may be. This allows not only the study of proofs themselves, but also of what it means to be provable. But why do we study proofs?

3 / 51 This lecture course: A comprehensive introduction to the field, focussing on classical results but hinting at powerful applications.

Wherefore proof theory?

Proof theory is the study of mathematical proofs as formal objects. Formally, a proof system defines what a proof may be. This allows not only the study of proofs themselves, but also of what it means to be provable. But why do we study proofs? • Foundational results, which tell us something fundamental about reasoning itself. These lead to... • Applications, which use insights and techniques from proof theory to accomplish something concrete in another discipline altogether.

3 / 51 Wherefore proof theory?

Proof theory is the study of mathematical proofs as formal objects. Formally, a proof system defines what a proof may be. This allows not only the study of proofs themselves, but also of what it means to be provable. But why do we study proofs? • Foundational results, which tell us something fundamental about reasoning itself. These lead to... • Applications, which use insights and techniques from proof theory to accomplish something concrete in another discipline altogether.

This lecture course: A comprehensive introduction to the field, focussing on classical results but hinting at powerful applications.

3 / 51 Foundational results from the early days

Gödel’s incompleteness theorem (1931), informally We cannot prove every true sentence in a given proof system.

This result fundamentally reoriented the direction of logic research in the 20th century.

Gentzen’s Hauptsatz (1934), informally Every purely logical theorem can be proved analytically, i.e. without making ‘guesses’.

The translation of proofs to analytic form, cut-elimination, has become one of the most powerful tools in all of logic.

Since then we have come very far...

4 / 51 Applications of proof theory today

It is impossible to list the many roles that proof theory plays in the areas relevant to the ESSLLI community, but we list some of the highlights: Computer science • Proof normalisation as the execution of functional programs. • Proof search as logic programming. Linguistics • Language grammars and substructural logics. • Proof-theoretic semantics. Mathematics • Relative strength of mathematical theories. • Extracting bounds and computational content from proofs. Philosophy • Theories of meaning in logic. • Formal accounts of modalities from epistemology.

5 / 51 Who are we?

Anupam • Marie Skłodowska-Curie research fellow at the University of Copenhagen. • Computational proof theorist with background in mathematics and philosophy. • Specialises in structural proof theory and interactions with computational complexity.

Thomas • Postdoctoral researcher at the Technical University of Darmstadt. • Computational proof theorist with background in mathematics and computer science. • Specialises in proof interpretations, the extraction of computational content from proofs, and higher-type computability theory.

6 / 51 Overview of the course

We assume you have seen some logic, but there are no formal prerequisites.

• Lecture 1: Propositional logic, semantics and proofs. Syntax of propositional logic, truth table semantics, Hilbert-Frege style proof systems, the deduction theorem. (Anupam and Tom) • Lecture 2: Soundness and completeness. Structural induction, soundness, Lindenbaum’s construction, completeness, the compactness theorem. (Anupam) • Lecture 3: First-order logic and formal theories. Syntax of predicate logic, structures, and Hilbert-Frege style proof systems. First order theories and their models. Peano arithmetic. (Tom) • Lecture 4: Cut-elimination and its consequences. The problem of proof search, the sequent calculus, the cut-elimination theorem, Herbrand’s theorem, Craig interpolation. (Anupam) • Lecture 5: Nonclassical logics and some perspectives. Constructivism and , linear logic, modal logic, Lambek calculus, current trends. (Anupam and Tom)

7 / 51 References for this course

Proof theory is an incredibly big field (both deep and broad). The following are popular broad-spectrum references:

1 [Buss, 1998] Handbook of Proof Theory (a mathematical approach)

2 [Troelstra and Schwichtenberg, 1996] Basic Proof Theory. (a computational approach)

3 [Schoenfeld, 1967] Mathematical Logic. (a broader overview of logic)

4 Stanford Encyclopedia of Philosophy. (an excellent high-level general reference) http://plato.stanford.edu/

NB: While 1, 2 and 3 are a little dated in terms of topics, the material still remains standard initiation to proof theory.

8 / 51 Sprechen Sie deutsch?

We also highly recommend taking a look at original texts: • [Frege, 1879] Begrifsschrit. (the first serious attempt to formalise mathematics in logic, unfortunately erroneously) • [Whitehead and Russell, 1927] Principia Mathematica. (the second serious attempt, notably error-free) • [Gödel, 1931] Über Formal Unentscheidbare Sätze der Principia Mathematica Und Verwandter Systeme I. (the incompleteness theorems) • [Szabo, 1972] The collected papers of Gerhard Gentzen. English translations. (the foundation of structural proof theory)

(For those of you who are interested, we will also provide pointers to accessible research articles showcasing what is going on in proof theory today.)

9 / 51 Outline

1 Introduction, motivation and this course

2 Language of propositional logic

3 Truth table semantics

4 Some puzzles

5 Deductive reasoning

6 A Hilbert-Frege style deductive system

7 The deduction theorem

8 Questions and exercises

9 References

10 / 51 Definition (Formulae) The set Form of formulae, written A, B, C etc., are generated as follows: • Any propositional variable p is a formula. • ⊥ is a formula. (falsum) • > is a formula. (veritum) • For a formula A, the expression ¬A is a formula. (negation) • For formulae A, B, the expression (A ∨ B) is a formula. (disjunction) • For formulae A, B, the expression (A ∧ B) is a formula. (conjunction) • For formulae A, B, the expression (A → B) is a formula. (implication)

Examples of formulae: ¬(p ∨ >) , (p → ¬q) , ¬⊥ Examples of non-formulae: (∨p → ( , p ∨ q → p0 ∧ q0 , ⊥p>

Propositional logic syntax

Let us fix a countable set Prop of propositional variables, written p, q, r etc.

11 / 51 Examples of formulae: ¬(p ∨ >) , (p → ¬q) , ¬⊥ Examples of non-formulae: (∨p → ( , p ∨ q → p0 ∧ q0 , ⊥p>

Propositional logic syntax

Let us fix a countable set Prop of propositional variables, written p, q, r etc. Definition (Formulae) The set Form of formulae, written A, B, C etc., are generated as follows: • Any propositional variable p is a formula. • ⊥ is a formula. (falsum) • > is a formula. (veritum) • For a formula A, the expression ¬A is a formula. (negation) • For formulae A, B, the expression (A ∨ B) is a formula. (disjunction) • For formulae A, B, the expression (A ∧ B) is a formula. (conjunction) • For formulae A, B, the expression (A → B) is a formula. (implication)

11 / 51 Propositional logic syntax

Let us fix a countable set Prop of propositional variables, written p, q, r etc. Definition (Formulae) The set Form of formulae, written A, B, C etc., are generated as follows: • Any propositional variable p is a formula. • ⊥ is a formula. (falsum) • > is a formula. (veritum) • For a formula A, the expression ¬A is a formula. (negation) • For formulae A, B, the expression (A ∨ B) is a formula. (disjunction) • For formulae A, B, the expression (A ∧ B) is a formula. (conjunction) • For formulae A, B, the expression (A → B) is a formula. (implication)

Examples of formulae: ¬(p ∨ >) , (p → ¬q) , ¬⊥ Examples of non-formulae: (∨p → ( , p ∨ q → p0 ∧ q0 , ⊥p>

11 / 51 You might find the following variations in the literature:

• 0 or f for ⊥ and 1 or t for >. • ∼ A, A¯ or A⊥ for ¬A. • A&B for A ∧ B. • A ⊃ B or A ⇒ B for A → B.

Our choice is mostly for convenience and legibility, and is widely used. The precise conventions oten depend on the domain. NB: Proof theorists love to argue about notation! (Of the ones above, implication seems to be the most contentious. For me, A ⊃ B is the only good notation!)

A remark on notation...

Other authors use diferent notations for the connectives.

12 / 51 Our choice is mostly for convenience and legibility, and is widely used. The precise conventions oten depend on the domain. NB: Proof theorists love to argue about notation! (Of the ones above, implication seems to be the most contentious. For me, A ⊃ B is the only good notation!)

A remark on notation...

Other authors use diferent notations for the connectives. You might find the following variations in the literature:

• 0 or f for ⊥ and 1 or t for >. • ∼ A, A¯ or A⊥ for ¬A. • A&B for A ∧ B. • A ⊃ B or A ⇒ B for A → B.

12 / 51 NB: Proof theorists love to argue about notation! (Of the ones above, implication seems to be the most contentious. For me, A ⊃ B is the only good notation!)

A remark on notation...

Other authors use diferent notations for the connectives. You might find the following variations in the literature:

• 0 or f for ⊥ and 1 or t for >. • ∼ A, A¯ or A⊥ for ¬A. • A&B for A ∧ B. • A ⊃ B or A ⇒ B for A → B.

Our choice is mostly for convenience and legibility, and is widely used. The precise conventions oten depend on the domain.

12 / 51 A remark on notation...

Other authors use diferent notations for the connectives. You might find the following variations in the literature:

• 0 or f for ⊥ and 1 or t for >. • ∼ A, A¯ or A⊥ for ¬A. • A&B for A ∧ B. • A ⊃ B or A ⇒ B for A → B.

Our choice is mostly for convenience and legibility, and is widely used. The precise conventions oten depend on the domain. NB: Proof theorists love to argue about notation! (Of the ones above, implication seems to be the most contentious. For me, A ⊃ B is the only good notation!)

12 / 51 Definition (Substitutions) A substitution is a map σ : Prop → Form. We can extend this to a map σ : Form → Form as follows: σ(⊥) := ⊥ σ(A ∨ B) := (σ(A) ∨ σ(B)) σ(>) := > σ(A ∧ B) := (σ(A) ∧ σ(B)) σ(¬A) := ¬σ(A) σ(A → B) := (σ(A) → σ(B))

Example Let σ : Prop → Form be the substitution: p 7→ p → q q 7→ ¬q ∧ >

(Any other variables in Prop are mapped to themselves). Then:

σ(¬q ∨ (p → ⊥)) = ¬(¬q ∧ >) ∨ ((p → q) → ⊥)

Substitutions

13 / 51 Example Let σ : Prop → Form be the substitution: p 7→ p → q q 7→ ¬q ∧ >

(Any other variables in Prop are mapped to themselves). Then:

σ(¬q ∨ (p → ⊥)) = ¬(¬q ∧ >) ∨ ((p → q) → ⊥)

Substitutions

Definition (Substitutions) A substitution is a map σ : Prop → Form. We can extend this to a map σ : Form → Form as follows: σ(⊥) := ⊥ σ(A ∨ B) := (σ(A) ∨ σ(B)) σ(>) := > σ(A ∧ B) := (σ(A) ∧ σ(B)) σ(¬A) := ¬σ(A) σ(A → B) := (σ(A) → σ(B))

13 / 51 Substitutions

Definition (Substitutions) A substitution is a map σ : Prop → Form. We can extend this to a map σ : Form → Form as follows: σ(⊥) := ⊥ σ(A ∨ B) := (σ(A) ∨ σ(B)) σ(>) := > σ(A ∧ B) := (σ(A) ∧ σ(B)) σ(¬A) := ¬σ(A) σ(A → B) := (σ(A) → σ(B))

Example Let σ : Prop → Form be the substitution: p 7→ p → q q 7→ ¬q ∧ >

(Any other variables in Prop are mapped to themselves). Then:

σ(¬q ∨ (p → ⊥)) = ¬(¬q ∧ >) ∨ ((p → q) → ⊥)

13 / 51 Proof idea. By induction on the length of the expression. (Exercise: prove this formally).

Some writing conventions • We may write A ↔ B as an abbreviation for ((A → B) ∧ (B → A)). • We may omit outer brackets of a formula. E.g., A → B instead of (A → B). • We may omit internal brackets in long conjunctions or disjunctions. E.g., A ∨ B ∨ C instead of (A ∨ B) ∨ C or A ∨ (B ∨ C). • Some authors write, e.g., A → B → C for A → (B → C). I.e., long implications associate to the right.

Reading and writing formulae

The following sounds trivial, but it is better that we state it: Proposition (Unique readability) Any expression over the alphabet Prop ∪ {(, ), ⊥, >, ¬, ∨, ∧, →}, is at most one formula.

14 / 51 Some writing conventions • We may write A ↔ B as an abbreviation for ((A → B) ∧ (B → A)). • We may omit outer brackets of a formula. E.g., A → B instead of (A → B). • We may omit internal brackets in long conjunctions or disjunctions. E.g., A ∨ B ∨ C instead of (A ∨ B) ∨ C or A ∨ (B ∨ C). • Some authors write, e.g., A → B → C for A → (B → C). I.e., long implications associate to the right.

Reading and writing formulae

The following sounds trivial, but it is better that we state it: Proposition (Unique readability) Any expression over the alphabet Prop ∪ {(, ), ⊥, >, ¬, ∨, ∧, →}, is at most one formula.

Proof idea. By induction on the length of the expression. (Exercise: prove this formally).

14 / 51 • Some authors write, e.g., A → B → C for A → (B → C). I.e., long implications associate to the right.

Reading and writing formulae

The following sounds trivial, but it is better that we state it: Proposition (Unique readability) Any expression over the alphabet Prop ∪ {(, ), ⊥, >, ¬, ∨, ∧, →}, is at most one formula.

Proof idea. By induction on the length of the expression. (Exercise: prove this formally).

Some writing conventions • We may write A ↔ B as an abbreviation for ((A → B) ∧ (B → A)). • We may omit outer brackets of a formula. E.g., A → B instead of (A → B). • We may omit internal brackets in long conjunctions or disjunctions. E.g., A ∨ B ∨ C instead of (A ∨ B) ∨ C or A ∨ (B ∨ C).

14 / 51 Reading and writing formulae

The following sounds trivial, but it is better that we state it: Proposition (Unique readability) Any expression over the alphabet Prop ∪ {(, ), ⊥, >, ¬, ∨, ∧, →}, is at most one formula.

Proof idea. By induction on the length of the expression. (Exercise: prove this formally).

Some writing conventions • We may write A ↔ B as an abbreviation for ((A → B) ∧ (B → A)). • We may omit outer brackets of a formula. E.g., A → B instead of (A → B). • We may omit internal brackets in long conjunctions or disjunctions. E.g., A ∨ B ∨ C instead of (A ∨ B) ∨ C or A ∨ (B ∨ C). • Some authors write, e.g., A → B → C for A → (B → C). I.e., long implications associate to the right.

14 / 51 Outline

1 Introduction, motivation and this course

2 Language of propositional logic

3 Truth table semantics

4 Some puzzles

5 Deductive reasoning

6 A Hilbert-Frege style deductive system

7 The deduction theorem

8 Questions and exercises

9 References

15 / 51 We think of propositional variables ranging over {0, 1}, and construe the connectives as functions on {0, 1} (Boolean functions) of the appropriate arity: Definition (Semantics of connectives) • ⊥ and > are the constant functions outputting 0 and 1 resp. • ¬ : {0, 1} → {0, 1} and ∨, ∧, →: {0, 1} × {0, 1} → {0, 1} as specified by the truth tables below: p q p ∨ q p q p ∧ q p q p → q p ¬p 0 0 0 0 0 0 0 0 1 0 1 0 1 1 0 1 0 0 1 1 1 0 1 0 1 1 0 0 1 0 0 1 1 1 1 1 1 1 1 1

(We refrain from giving a precise definition of truth tables here: it is simply a list of the outputs of a function under an enumeration of its inputs.)

Truth tables

A Boolean is an element of {0, 1}.(NB: notations may difer!)

16 / 51 Definition (Semantics of connectives) • ⊥ and > are the constant functions outputting 0 and 1 resp. • ¬ : {0, 1} → {0, 1} and ∨, ∧, →: {0, 1} × {0, 1} → {0, 1} as specified by the truth tables below: p q p ∨ q p q p ∧ q p q p → q p ¬p 0 0 0 0 0 0 0 0 1 0 1 0 1 1 0 1 0 0 1 1 1 0 1 0 1 1 0 0 1 0 0 1 1 1 1 1 1 1 1 1

(We refrain from giving a precise definition of truth tables here: it is simply a list of the outputs of a function under an enumeration of its inputs.)

Truth tables

A Boolean is an element of {0, 1}.(NB: notations may difer!) We think of propositional variables ranging over {0, 1}, and construe the connectives as functions on {0, 1} (Boolean functions) of the appropriate arity:

16 / 51 (We refrain from giving a precise definition of truth tables here: it is simply a list of the outputs of a function under an enumeration of its inputs.)

Truth tables

A Boolean is an element of {0, 1}.(NB: notations may difer!) We think of propositional variables ranging over {0, 1}, and construe the connectives as functions on {0, 1} (Boolean functions) of the appropriate arity: Definition (Semantics of connectives) • ⊥ and > are the constant functions outputting 0 and 1 resp. • ¬ : {0, 1} → {0, 1} and ∨, ∧, →: {0, 1} × {0, 1} → {0, 1} as specified by the truth tables below: p q p ∨ q p q p ∧ q p q p → q p ¬p 0 0 0 0 0 0 0 0 1 0 1 0 1 1 0 1 0 0 1 1 1 0 1 0 1 1 0 0 1 0 0 1 1 1 1 1 1 1 1 1

16 / 51 Truth tables

A Boolean is an element of {0, 1}.(NB: notations may difer!) We think of propositional variables ranging over {0, 1}, and construe the connectives as functions on {0, 1} (Boolean functions) of the appropriate arity: Definition (Semantics of connectives) • ⊥ and > are the constant functions outputting 0 and 1 resp. • ¬ : {0, 1} → {0, 1} and ∨, ∧, →: {0, 1} × {0, 1} → {0, 1} as specified by the truth tables below: p q p ∨ q p q p ∧ q p q p → q p ¬p 0 0 0 0 0 0 0 0 1 0 1 0 1 1 0 1 0 0 1 1 1 0 1 0 1 1 0 0 1 0 0 1 1 1 1 1 1 1 1 1

(We refrain from giving a precise definition of truth tables here: it is simply a list of the outputs of a function under an enumeration of its inputs.)

16 / 51 There is a fundamental connection between ∨ and ∧:

Definition (Dual connectives) Two connectives • and ◦ are called dual if the truth table for ◦ is obtained by switching every 0 for a 1 and vice-versa in the truth table for •.

Exercise: verify for yourself that ∨ and ∧ are dual. (Somewhat more trivially, ⊥ and > are also dual.) Duality is a commonly recurring theme in proof theory.

NB: The definition above makes sense for , but more general proof-theoretic definitions exist for ‘non-Boolean’ semantics.

A remark on duality

17 / 51 Definition (Dual connectives) Two connectives • and ◦ are called dual if the truth table for ◦ is obtained by switching every 0 for a 1 and vice-versa in the truth table for •.

Exercise: verify for yourself that ∨ and ∧ are dual. (Somewhat more trivially, ⊥ and > are also dual.) Duality is a commonly recurring theme in proof theory.

NB: The definition above makes sense for classical logic, but more general proof-theoretic definitions exist for ‘non-Boolean’ semantics.

A remark on duality

There is a fundamental connection between ∨ and ∧:

17 / 51 Exercise: verify for yourself that ∨ and ∧ are dual. (Somewhat more trivially, ⊥ and > are also dual.) Duality is a commonly recurring theme in proof theory.

NB: The definition above makes sense for classical logic, but more general proof-theoretic definitions exist for ‘non-Boolean’ semantics.

A remark on duality

There is a fundamental connection between ∨ and ∧:

Definition (Dual connectives) Two connectives • and ◦ are called dual if the truth table for ◦ is obtained by switching every 0 for a 1 and vice-versa in the truth table for •.

17 / 51 Duality is a commonly recurring theme in proof theory.

NB: The definition above makes sense for classical logic, but more general proof-theoretic definitions exist for ‘non-Boolean’ semantics.

A remark on duality

There is a fundamental connection between ∨ and ∧:

Definition (Dual connectives) Two connectives • and ◦ are called dual if the truth table for ◦ is obtained by switching every 0 for a 1 and vice-versa in the truth table for •.

Exercise: verify for yourself that ∨ and ∧ are dual. (Somewhat more trivially, ⊥ and > are also dual.)

17 / 51 NB: The definition above makes sense for classical logic, but more general proof-theoretic definitions exist for ‘non-Boolean’ semantics.

A remark on duality

There is a fundamental connection between ∨ and ∧:

Definition (Dual connectives) Two connectives • and ◦ are called dual if the truth table for ◦ is obtained by switching every 0 for a 1 and vice-versa in the truth table for •.

Exercise: verify for yourself that ∨ and ∧ are dual. (Somewhat more trivially, ⊥ and > are also dual.) Duality is a commonly recurring theme in proof theory.

17 / 51 A remark on duality

There is a fundamental connection between ∨ and ∧:

Definition (Dual connectives) Two connectives • and ◦ are called dual if the truth table for ◦ is obtained by switching every 0 for a 1 and vice-versa in the truth table for •.

Exercise: verify for yourself that ∨ and ∧ are dual. (Somewhat more trivially, ⊥ and > are also dual.) Duality is a commonly recurring theme in proof theory.

NB: The definition above makes sense for classical logic, but more general proof-theoretic definitions exist for ‘non-Boolean’ semantics.

17 / 51 Definition (Assignments) An assignment (or valuation) is a function α : Prop → {0, 1}. We naturally extend an assignment α to all formulae as follows:

α(⊥) := 0 α(A ∨ B) := α(A) ∨ α(B) α(>) := 1 α(A ∧ B) := α(A) ∧ α(B) α(¬A) := ¬α(A) α(A → B) := α(A) → α(B)

Definition (Validity and Satisfiability)

• An assignment α satisfies a formula A, written α  A, if α(A) = 1. • A is satisfiable if there exists an assignment α s.t. α  A. • A is valid or a tautology, written  A, if, for every assignment α, we have α  A.

NB: Validity and satisfiability are dual: A is valid ⇐⇒ ¬A is not satisfiable.

Semantics of formulae

18 / 51 We naturally extend an assignment α to all formulae as follows:

α(⊥) := 0 α(A ∨ B) := α(A) ∨ α(B) α(>) := 1 α(A ∧ B) := α(A) ∧ α(B) α(¬A) := ¬α(A) α(A → B) := α(A) → α(B)

Definition (Validity and Satisfiability)

• An assignment α satisfies a formula A, written α  A, if α(A) = 1. • A is satisfiable if there exists an assignment α s.t. α  A. • A is valid or a tautology, written  A, if, for every assignment α, we have α  A.

NB: Validity and satisfiability are dual: A is valid ⇐⇒ ¬A is not satisfiable.

Semantics of formulae

Definition (Assignments) An assignment (or valuation) is a function α : Prop → {0, 1}.

18 / 51 Definition (Validity and Satisfiability)

• An assignment α satisfies a formula A, written α  A, if α(A) = 1. • A is satisfiable if there exists an assignment α s.t. α  A. • A is valid or a tautology, written  A, if, for every assignment α, we have α  A.

NB: Validity and satisfiability are dual: A is valid ⇐⇒ ¬A is not satisfiable.

Semantics of formulae

Definition (Assignments) An assignment (or valuation) is a function α : Prop → {0, 1}. We naturally extend an assignment α to all formulae as follows:

α(⊥) := 0 α(A ∨ B) := α(A) ∨ α(B) α(>) := 1 α(A ∧ B) := α(A) ∧ α(B) α(¬A) := ¬α(A) α(A → B) := α(A) → α(B)

18 / 51 • A is satisfiable if there exists an assignment α s.t. α  A. • A is valid or a tautology, written  A, if, for every assignment α, we have α  A.

NB: Validity and satisfiability are dual: A is valid ⇐⇒ ¬A is not satisfiable.

Semantics of formulae

Definition (Assignments) An assignment (or valuation) is a function α : Prop → {0, 1}. We naturally extend an assignment α to all formulae as follows:

α(⊥) := 0 α(A ∨ B) := α(A) ∨ α(B) α(>) := 1 α(A ∧ B) := α(A) ∧ α(B) α(¬A) := ¬α(A) α(A → B) := α(A) → α(B)

Definition (Validity and Satisfiability)

• An assignment α satisfies a formula A, written α  A, if α(A) = 1.

18 / 51 • A is valid or a tautology, written  A, if, for every assignment α, we have α  A.

NB: Validity and satisfiability are dual: A is valid ⇐⇒ ¬A is not satisfiable.

Semantics of formulae

Definition (Assignments) An assignment (or valuation) is a function α : Prop → {0, 1}. We naturally extend an assignment α to all formulae as follows:

α(⊥) := 0 α(A ∨ B) := α(A) ∨ α(B) α(>) := 1 α(A ∧ B) := α(A) ∧ α(B) α(¬A) := ¬α(A) α(A → B) := α(A) → α(B)

Definition (Validity and Satisfiability)

• An assignment α satisfies a formula A, written α  A, if α(A) = 1. • A is satisfiable if there exists an assignment α s.t. α  A.

18 / 51 NB: Validity and satisfiability are dual: A is valid ⇐⇒ ¬A is not satisfiable.

Semantics of formulae

Definition (Assignments) An assignment (or valuation) is a function α : Prop → {0, 1}. We naturally extend an assignment α to all formulae as follows:

α(⊥) := 0 α(A ∨ B) := α(A) ∨ α(B) α(>) := 1 α(A ∧ B) := α(A) ∧ α(B) α(¬A) := ¬α(A) α(A → B) := α(A) → α(B)

Definition (Validity and Satisfiability)

• An assignment α satisfies a formula A, written α  A, if α(A) = 1. • A is satisfiable if there exists an assignment α s.t. α  A. • A is valid or a tautology, written  A, if, for every assignment α, we have α  A.

18 / 51 Semantics of formulae

Definition (Assignments) An assignment (or valuation) is a function α : Prop → {0, 1}. We naturally extend an assignment α to all formulae as follows:

α(⊥) := 0 α(A ∨ B) := α(A) ∨ α(B) α(>) := 1 α(A ∧ B) := α(A) ∧ α(B) α(¬A) := ¬α(A) α(A → B) := α(A) → α(B)

Definition (Validity and Satisfiability)

• An assignment α satisfies a formula A, written α  A, if α(A) = 1. • A is satisfiable if there exists an assignment α s.t. α  A. • A is valid or a tautology, written  A, if, for every assignment α, we have α  A.

NB: Validity and satisfiability are dual: A is valid ⇐⇒ ¬A is not satisfiable.

18 / 51 For instance, observe the following truth tables:

p q r p ∨ q (p ∨ q) ∨ r q ∨ r p ∨ (q ∨ r) 0 0 0 0 0 0 0 0 0 1 0 1 1 1 0 1 0 1 1 1 1 0 1 1 1 1 1 1 1 0 0 1 1 0 1 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1

We say that (p ∨ q) ∨ r and p ∨ (q ∨ r) are equivalent, since they have the same truth table. By a similar argument we have: • (p ∧ q) ∧ r is equivalent to p ∧ (q ∧ r). • p ∨ q and p ∧ q are equivalent to q ∨ p and q ∧ p resp. • p ∨ ⊥, p ∧ > and p are all equivalent.

Associativity and commutativity of ∨ and ∧

We can now justify the bracketing conventions we introduced earlier.

19 / 51 We say that (p ∨ q) ∨ r and p ∨ (q ∨ r) are equivalent, since they have the same truth table. By a similar argument we have: • (p ∧ q) ∧ r is equivalent to p ∧ (q ∧ r). • p ∨ q and p ∧ q are equivalent to q ∨ p and q ∧ p resp. • p ∨ ⊥, p ∧ > and p are all equivalent.

Associativity and commutativity of ∨ and ∧

We can now justify the bracketing conventions we introduced earlier. For instance, observe the following truth tables:

p q r p ∨ q (p ∨ q) ∨ r q ∨ r p ∨ (q ∨ r) 0 0 0 0 0 0 0 0 0 1 0 1 1 1 0 1 0 1 1 1 1 0 1 1 1 1 1 1 1 0 0 1 1 0 1 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1

19 / 51 By a similar argument we have: • (p ∧ q) ∧ r is equivalent to p ∧ (q ∧ r). • p ∨ q and p ∧ q are equivalent to q ∨ p and q ∧ p resp. • p ∨ ⊥, p ∧ > and p are all equivalent.

Associativity and commutativity of ∨ and ∧

We can now justify the bracketing conventions we introduced earlier. For instance, observe the following truth tables:

p q r p ∨ q (p ∨ q) ∨ r q ∨ r p ∨ (q ∨ r) 0 0 0 0 0 0 0 0 0 1 0 1 1 1 0 1 0 1 1 1 1 0 1 1 1 1 1 1 1 0 0 1 1 0 1 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1

We say that (p ∨ q) ∨ r and p ∨ (q ∨ r) are equivalent, since they have the same truth table.

19 / 51 Associativity and commutativity of ∨ and ∧

We can now justify the bracketing conventions we introduced earlier. For instance, observe the following truth tables:

p q r p ∨ q (p ∨ q) ∨ r q ∨ r p ∨ (q ∨ r) 0 0 0 0 0 0 0 0 0 1 0 1 1 1 0 1 0 1 1 1 1 0 1 1 1 1 1 1 1 0 0 1 1 0 1 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1

We say that (p ∨ q) ∨ r and p ∨ (q ∨ r) are equivalent, since they have the same truth table. By a similar argument we have: • (p ∧ q) ∧ r is equivalent to p ∧ (q ∧ r). • p ∨ q and p ∧ q are equivalent to q ∨ p and q ∧ p resp. • p ∨ ⊥, p ∧ > and p are all equivalent.

19 / 51 Notably, our choice of connectives is adequate (or functionally complete): Proposition (Adequacy) For a finite set P ⊆ Prop and f : {0, 1}P → {0, 1}, there is a formula F s.t., for any assignment α, we have f (α) = α(F).

Proof sketch. The idea is to encode the truth table definition of f . ( P ¬p if α(p) = 0 • For each α ∈ {0, 1} and p ∈ P, write pα := p if α(p) = 1 ( ) W V P • We define F := pα : α ∈ {0, 1} , f (α) = 1 . p∈P V ⇒ If f (α) = 1 then α(F) ≥ α(pα) = 1. p∈P 0 P V ⇐ If α(F) = 1 then, for some α ∈ {0, 1} s.t. f (β) = 1 we have β(pα) = 1, i.e. p∈P β(pα) = 1 for all p ∈ P. This implies β = α on P, so f (α) = f (β) = 1.

Adequacy

20 / 51 Proof sketch. The idea is to encode the truth table definition of f . ( P ¬p if α(p) = 0 • For each α ∈ {0, 1} and p ∈ P, write pα := p if α(p) = 1 ( ) W V P • We define F := pα : α ∈ {0, 1} , f (α) = 1 . p∈P V ⇒ If f (α) = 1 then α(F) ≥ α(pα) = 1. p∈P 0 P V ⇐ If α(F) = 1 then, for some α ∈ {0, 1} s.t. f (β) = 1 we have β(pα) = 1, i.e. p∈P β(pα) = 1 for all p ∈ P. This implies β = α on P, so f (α) = f (β) = 1.

Adequacy

Notably, our choice of connectives is adequate (or functionally complete): Proposition (Adequacy) For a finite set P ⊆ Prop and f : {0, 1}P → {0, 1}, there is a formula F s.t., for any assignment α, we have f (α) = α(F).

20 / 51 V ⇒ If f (α) = 1 then α(F) ≥ α(pα) = 1. p∈P 0 P V ⇐ If α(F) = 1 then, for some α ∈ {0, 1} s.t. f (β) = 1 we have β(pα) = 1, i.e. p∈P β(pα) = 1 for all p ∈ P. This implies β = α on P, so f (α) = f (β) = 1.

Adequacy

Notably, our choice of connectives is adequate (or functionally complete): Proposition (Adequacy) For a finite set P ⊆ Prop and f : {0, 1}P → {0, 1}, there is a formula F s.t., for any assignment α, we have f (α) = α(F).

Proof sketch. The idea is to encode the truth table definition of f . ( P ¬p if α(p) = 0 • For each α ∈ {0, 1} and p ∈ P, write pα := p if α(p) = 1 ( ) W V P • We define F := pα : α ∈ {0, 1} , f (α) = 1 . p∈P

20 / 51 Adequacy

Notably, our choice of connectives is adequate (or functionally complete): Proposition (Adequacy) For a finite set P ⊆ Prop and f : {0, 1}P → {0, 1}, there is a formula F s.t., for any assignment α, we have f (α) = α(F).

Proof sketch. The idea is to encode the truth table definition of f . ( P ¬p if α(p) = 0 • For each α ∈ {0, 1} and p ∈ P, write pα := p if α(p) = 1 ( ) W V P • We define F := pα : α ∈ {0, 1} , f (α) = 1 . p∈P V ⇒ If f (α) = 1 then α(F) ≥ α(pα) = 1. p∈P 0 P V ⇐ If α(F) = 1 then, for some α ∈ {0, 1} s.t. f (β) = 1 we have β(pα) = 1, i.e. p∈P β(pα) = 1 for all p ∈ P. This implies β = α on P, so f (α) = f (β) = 1.

20 / 51 Example (Parity) n The Boolean function Parn : {0, 1} → {0, 1} is defined by: ( 0 if α(p) = 1 for an even number of p ∈ n Parn(α) = 1 if α(p) = 1 for an odd number of p ∈ n ( ) W V P It is computed by the formula: pα : α(p) is odd p∈n p∈n

Example (Majority) n The Boolean function Majn : {0, 1} → {0, 1} is defined by: ( 0 if α(p) = 0 for most p ∈ n Majn(α) = 1 if α(p) = 1 for most p ∈ n ( ) W V : |α| > b n c It is computed by the formula: p 2 α(p)=1

Exercise: can you construct smaller formulae for these functions?

Examples from computer science

Let us identify n ∈ N with the set {p0,..., pn−1}.

21 / 51 Example (Majority) n The Boolean function Majn : {0, 1} → {0, 1} is defined by: ( 0 if α(p) = 0 for most p ∈ n Majn(α) = 1 if α(p) = 1 for most p ∈ n ( ) W V : |α| > b n c It is computed by the formula: p 2 α(p)=1

Exercise: can you construct smaller formulae for these functions?

Examples from computer science

Let us identify n ∈ N with the set {p0,..., pn−1}. Example (Parity) n The Boolean function Parn : {0, 1} → {0, 1} is defined by: ( 0 if α(p) = 1 for an even number of p ∈ n Parn(α) = 1 if α(p) = 1 for an odd number of p ∈ n ( ) W V P It is computed by the formula: pα : α(p) is odd p∈n p∈n

21 / 51 Exercise: can you construct smaller formulae for these functions?

Examples from computer science

Let us identify n ∈ N with the set {p0,..., pn−1}. Example (Parity) n The Boolean function Parn : {0, 1} → {0, 1} is defined by: ( 0 if α(p) = 1 for an even number of p ∈ n Parn(α) = 1 if α(p) = 1 for an odd number of p ∈ n ( ) W V P It is computed by the formula: pα : α(p) is odd p∈n p∈n

Example (Majority) n The Boolean function Majn : {0, 1} → {0, 1} is defined by: ( 0 if α(p) = 0 for most p ∈ n Majn(α) = 1 if α(p) = 1 for most p ∈ n ( ) W V : |α| > b n c It is computed by the formula: p 2 α(p)=1

21 / 51 Examples from computer science

Let us identify n ∈ N with the set {p0,..., pn−1}. Example (Parity) n The Boolean function Parn : {0, 1} → {0, 1} is defined by: ( 0 if α(p) = 1 for an even number of p ∈ n Parn(α) = 1 if α(p) = 1 for an odd number of p ∈ n ( ) W V P It is computed by the formula: pα : α(p) is odd p∈n p∈n

Example (Majority) n The Boolean function Majn : {0, 1} → {0, 1} is defined by: ( 0 if α(p) = 0 for most p ∈ n Majn(α) = 1 if α(p) = 1 for most p ∈ n ( ) W V : |α| > b n c It is computed by the formula: p 2 α(p)=1

Exercise: can you construct smaller formulae for these functions? 21 / 51 Notice that we did not use ⊥, >, → for the adequacy result. This means {¬, ∨, ∧} is already adequate! In particular, we can write ¬A ∨ B for A → B:

p q ¬p ¬p ∨ q 0 0 1 1 0 1 1 1 1 0 0 0 1 1 0 1

I.e., ¬p ∨ q and p → q are equivalent. Similarly: • ¬p and p → ⊥ are equivalent. • p ∨ q and ¬p → q are equivalent. • ⊥ and ¬(p → p) are equivalent. • p ∧ q and ¬(p → ¬q) are equivalent. • > and ⊥ → ⊥ are equivalent. In particular we have: Proposition The bases {⊥, →} and {¬, →} are adequate.

Inter-reducibility of connectives

22 / 51 This means {¬, ∨, ∧} is already adequate! In particular, we can write ¬A ∨ B for A → B:

p q ¬p ¬p ∨ q 0 0 1 1 0 1 1 1 1 0 0 0 1 1 0 1

I.e., ¬p ∨ q and p → q are equivalent. Similarly: • ¬p and p → ⊥ are equivalent. • p ∨ q and ¬p → q are equivalent. • ⊥ and ¬(p → p) are equivalent. • p ∧ q and ¬(p → ¬q) are equivalent. • > and ⊥ → ⊥ are equivalent. In particular we have: Proposition The bases {⊥, →} and {¬, →} are adequate.

Inter-reducibility of connectives

Notice that we did not use ⊥, >, → for the adequacy result.

22 / 51 Similarly: • ¬p and p → ⊥ are equivalent. • p ∨ q and ¬p → q are equivalent. • ⊥ and ¬(p → p) are equivalent. • p ∧ q and ¬(p → ¬q) are equivalent. • > and ⊥ → ⊥ are equivalent. In particular we have: Proposition The bases {⊥, →} and {¬, →} are adequate.

Inter-reducibility of connectives

Notice that we did not use ⊥, >, → for the adequacy result. This means {¬, ∨, ∧} is already adequate! In particular, we can write ¬A ∨ B for A → B:

p q ¬p ¬p ∨ q 0 0 1 1 0 1 1 1 1 0 0 0 1 1 0 1

I.e., ¬p ∨ q and p → q are equivalent.

22 / 51 In particular we have: Proposition The bases {⊥, →} and {¬, →} are adequate.

Inter-reducibility of connectives

Notice that we did not use ⊥, >, → for the adequacy result. This means {¬, ∨, ∧} is already adequate! In particular, we can write ¬A ∨ B for A → B:

p q ¬p ¬p ∨ q 0 0 1 1 0 1 1 1 1 0 0 0 1 1 0 1

I.e., ¬p ∨ q and p → q are equivalent. Similarly: • ¬p and p → ⊥ are equivalent. • p ∨ q and ¬p → q are equivalent. • ⊥ and ¬(p → p) are equivalent. • p ∧ q and ¬(p → ¬q) are equivalent. • > and ⊥ → ⊥ are equivalent.

22 / 51 Inter-reducibility of connectives

Notice that we did not use ⊥, >, → for the adequacy result. This means {¬, ∨, ∧} is already adequate! In particular, we can write ¬A ∨ B for A → B:

p q ¬p ¬p ∨ q 0 0 1 1 0 1 1 1 1 0 0 0 1 1 0 1

I.e., ¬p ∨ q and p → q are equivalent. Similarly: • ¬p and p → ⊥ are equivalent. • p ∨ q and ¬p → q are equivalent. • ⊥ and ¬(p → p) are equivalent. • p ∧ q and ¬(p → ¬q) are equivalent. • > and ⊥ → ⊥ are equivalent. In particular we have: Proposition The bases {⊥, →} and {¬, →} are adequate.

22 / 51 It is completely determined by its truth table, but arguably does not always model well our use of implication/conditionals in natural language. The following are all validated by interpreting “if...then...” as →:

• If the moon is made of cheese then I can run the 100m in under 9s. • If Riemann’s hypothesis is true then 2 + 2 = 4. • (If Goldbach’s conjecture is true then Riemann’s hypothesis is true) or (if Riemann’s hypothesis is true then Goldbach’s conjecture is true).

A word about implication

The connective → we have introduced is oten called material implication in philosophy and linguistics.

23 / 51 The following are all validated by interpreting “if...then...” as →:

• If the moon is made of cheese then I can run the 100m in under 9s. • If Riemann’s hypothesis is true then 2 + 2 = 4. • (If Goldbach’s conjecture is true then Riemann’s hypothesis is true) or (if Riemann’s hypothesis is true then Goldbach’s conjecture is true).

A word about implication

The connective → we have introduced is oten called material implication in philosophy and linguistics. It is completely determined by its truth table, but arguably does not always model well our use of implication/conditionals in natural language.

23 / 51 A word about implication

The connective → we have introduced is oten called material implication in philosophy and linguistics. It is completely determined by its truth table, but arguably does not always model well our use of implication/conditionals in natural language. The following are all validated by interpreting “if...then...” as →:

• If the moon is made of cheese then I can run the 100m in under 9s. • If Riemann’s hypothesis is true then 2 + 2 = 4. • (If Goldbach’s conjecture is true then Riemann’s hypothesis is true) or (if Riemann’s hypothesis is true then Goldbach’s conjecture is true).

23 / 51 Outline

1 Introduction, motivation and this course

2 Language of propositional logic

3 Truth table semantics

4 Some puzzles

5 Deductive reasoning

6 A Hilbert-Frege style deductive system

7 The deduction theorem

8 Questions and exercises

9 References

24 / 51 Puzzle You are on an island populated by precisely two types of people: • Knights always tell the truth. • Knaves always lie. You encounter two persons, Alice and Bob. Alice says:

“At least one of us is a knave.”

Who is who?

This particular puzzle is not so dificult, but there are several nice generalisations of it in the following reference: • [Smullyan, 1980] What is the Name of This Book? The Riddle of Dracula and Other Logical Puzzles.

Knights and knaves

Most of you have already seen liar vs. truth-teller puzzles...

25 / 51 You encounter two persons, Alice and Bob. Alice says:

“At least one of us is a knave.”

Who is who?

This particular puzzle is not so dificult, but there are several nice generalisations of it in the following reference: • [Smullyan, 1980] What is the Name of This Book? The Riddle of Dracula and Other Logical Puzzles.

Knights and knaves

Most of you have already seen liar vs. truth-teller puzzles... Puzzle You are on an island populated by precisely two types of people: • Knights always tell the truth. • Knaves always lie.

25 / 51 This particular puzzle is not so dificult, but there are several nice generalisations of it in the following reference: • [Smullyan, 1980] What is the Name of This Book? The Riddle of Dracula and Other Logical Puzzles.

Knights and knaves

Most of you have already seen liar vs. truth-teller puzzles... Puzzle You are on an island populated by precisely two types of people: • Knights always tell the truth. • Knaves always lie. You encounter two persons, Alice and Bob. Alice says:

“At least one of us is a knave.”

Who is who?

25 / 51 Knights and knaves

Most of you have already seen liar vs. truth-teller puzzles... Puzzle You are on an island populated by precisely two types of people: • Knights always tell the truth. • Knaves always lie. You encounter two persons, Alice and Bob. Alice says:

“At least one of us is a knave.”

Who is who?

This particular puzzle is not so dificult, but there are several nice generalisations of it in the following reference: • [Smullyan, 1980] What is the Name of This Book? The Riddle of Dracula and Other Logical Puzzles.

25 / 51 Write TA, TB for the propositions that Alice and Bob are knights (truth-tellers), respectively.

Alice has said ¬TA ∨ ¬TB, which is true just if she is a knight, i.e. TA is true. Now:

TA TB ¬TA ∨ ¬TB (¬TA ∨ ¬TB) ↔ TA 0 0 1 0 0 1 1 0 1 0 1 1 1 1 0 0

So we have that Alice is a knight and Bob is a knave. What is great about this approach is that it is fully automatisable. It is an elementary example of the utility of proof search.

A truth table approach

26 / 51 Alice has said ¬TA ∨ ¬TB, which is true just if she is a knight, i.e. TA is true. Now:

TA TB ¬TA ∨ ¬TB (¬TA ∨ ¬TB) ↔ TA 0 0 1 0 0 1 1 0 1 0 1 1 1 1 0 0

So we have that Alice is a knight and Bob is a knave. What is great about this approach is that it is fully automatisable. It is an elementary example of the utility of proof search.

A truth table approach

Write TA, TB for the propositions that Alice and Bob are knights (truth-tellers), respectively.

26 / 51 Now:

TA TB ¬TA ∨ ¬TB (¬TA ∨ ¬TB) ↔ TA 0 0 1 0 0 1 1 0 1 0 1 1 1 1 0 0

So we have that Alice is a knight and Bob is a knave. What is great about this approach is that it is fully automatisable. It is an elementary example of the utility of proof search.

A truth table approach

Write TA, TB for the propositions that Alice and Bob are knights (truth-tellers), respectively.

Alice has said ¬TA ∨ ¬TB, which is true just if she is a knight, i.e. TA is true.

26 / 51 So we have that Alice is a knight and Bob is a knave. What is great about this approach is that it is fully automatisable. It is an elementary example of the utility of proof search.

A truth table approach

Write TA, TB for the propositions that Alice and Bob are knights (truth-tellers), respectively.

Alice has said ¬TA ∨ ¬TB, which is true just if she is a knight, i.e. TA is true. Now:

TA TB ¬TA ∨ ¬TB (¬TA ∨ ¬TB) ↔ TA 0 0 1 0 0 1 1 0 1 0 1 1 1 1 0 0

26 / 51 What is great about this approach is that it is fully automatisable. It is an elementary example of the utility of proof search.

A truth table approach

Write TA, TB for the propositions that Alice and Bob are knights (truth-tellers), respectively.

Alice has said ¬TA ∨ ¬TB, which is true just if she is a knight, i.e. TA is true. Now:

TA TB ¬TA ∨ ¬TB (¬TA ∨ ¬TB) ↔ TA 0 0 1 0 0 1 1 0 1 0 1 1 1 1 0 0

So we have that Alice is a knight and Bob is a knave.

26 / 51 A truth table approach

Write TA, TB for the propositions that Alice and Bob are knights (truth-tellers), respectively.

Alice has said ¬TA ∨ ¬TB, which is true just if she is a knight, i.e. TA is true. Now:

TA TB ¬TA ∨ ¬TB (¬TA ∨ ¬TB) ↔ TA 0 0 1 0 0 1 1 0 1 0 1 1 1 1 0 0

So we have that Alice is a knight and Bob is a knave. What is great about this approach is that it is fully automatisable. It is an elementary example of the utility of proof search.

26 / 51 • Write RA, RB for the proposition that Alice and Bob are wearing red hats, resp.

• Their guesses GA and GB must depend only on RB and RA resp.

• By considering the two possible values for, say, GA, we arrive at two possible solutions:

RA RB GA(RB) GB(RA) RA RB GA(RB) GB(RA) 0 0 R B 0 0 B R 0 1 B B 0 1 R R 1 0 R R 1 0 B B 1 1 B R 1 1 R B

A functional example

Puzzle Alice and Bob are wearing red or blue hats. They can each see each other but not themselves. They must at the same time guess the colour of their own hat and at least one of them must get it right. How do they do it?

27 / 51 • Their guesses GA and GB must depend only on RB and RA resp.

• By considering the two possible values for, say, GA, we arrive at two possible solutions:

RA RB GA(RB) GB(RA) RA RB GA(RB) GB(RA) 0 0 R B 0 0 B R 0 1 B B 0 1 R R 1 0 R R 1 0 B B 1 1 B R 1 1 R B

A functional example

Puzzle Alice and Bob are wearing red or blue hats. They can each see each other but not themselves. They must at the same time guess the colour of their own hat and at least one of them must get it right. How do they do it?

• Write RA, RB for the proposition that Alice and Bob are wearing red hats, resp.

27 / 51 • By considering the two possible values for, say, GA, we arrive at two possible solutions:

RA RB GA(RB) GB(RA) RA RB GA(RB) GB(RA) 0 0 R B 0 0 B R 0 1 B B 0 1 R R 1 0 R R 1 0 B B 1 1 B R 1 1 R B

A functional example

Puzzle Alice and Bob are wearing red or blue hats. They can each see each other but not themselves. They must at the same time guess the colour of their own hat and at least one of them must get it right. How do they do it?

• Write RA, RB for the proposition that Alice and Bob are wearing red hats, resp.

• Their guesses GA and GB must depend only on RB and RA resp.

27 / 51 RA RB GA(RB) GB(RA) RA RB GA(RB) GB(RA) 0 0 R B 0 0 B R 0 1 B B 0 1 R R 1 0 R R 1 0 B B 1 1 B R 1 1 R B

A functional example

Puzzle Alice and Bob are wearing red or blue hats. They can each see each other but not themselves. They must at the same time guess the colour of their own hat and at least one of them must get it right. How do they do it?

• Write RA, RB for the proposition that Alice and Bob are wearing red hats, resp.

• Their guesses GA and GB must depend only on RB and RA resp.

• By considering the two possible values for, say, GA, we arrive at two possible solutions:

27 / 51 RA RB GA(RB) GB(RA) 0 0 B R 0 1 R R 1 0 B B 1 1 R B

A functional example

Puzzle Alice and Bob are wearing red or blue hats. They can each see each other but not themselves. They must at the same time guess the colour of their own hat and at least one of them must get it right. How do they do it?

• Write RA, RB for the proposition that Alice and Bob are wearing red hats, resp.

• Their guesses GA and GB must depend only on RB and RA resp.

• By considering the two possible values for, say, GA, we arrive at two possible solutions:

RA RB GA(RB) GB(RA) 0 0 R B 0 1 B B 1 0 R R 1 1 B R

27 / 51 A functional example

Puzzle Alice and Bob are wearing red or blue hats. They can each see each other but not themselves. They must at the same time guess the colour of their own hat and at least one of them must get it right. How do they do it?

• Write RA, RB for the proposition that Alice and Bob are wearing red hats, resp.

• Their guesses GA and GB must depend only on RB and RA resp.

• By considering the two possible values for, say, GA, we arrive at two possible solutions:

RA RB GA(RB) GB(RA) RA RB GA(RB) GB(RA) 0 0 R B 0 0 B R 0 1 B B 0 1 R R 1 0 R R 1 0 B B 1 1 B R 1 1 R B

27 / 51 Outline

1 Introduction, motivation and this course

2 Language of propositional logic

3 Truth table semantics

4 Some puzzles

5 Deductive reasoning

6 A Hilbert-Frege style deductive system

7 The deduction theorem

8 Questions and exercises

9 References

28 / 51 Deductive reasoning starts with some premises, and uses a set of rules to reach a conclusion. The above deduction is an instance of the following pattern:

1. p (first premise) 2. p → q (second premise) 3. q (conclusion, inferred from 1 and 2)

This is called , and is an example of an inference rule (more on this later!)

What is deductive reasoning?

We carry out deductive reasoning every day. E.g.

• The sun is out. • If the sun is out then it is daytime. • Therefore it is daytime.

29 / 51 What is deductive reasoning?

We carry out deductive reasoning every day. E.g.

• The sun is out. • If the sun is out then it is daytime. • Therefore it is daytime.

Deductive reasoning starts with some premises, and uses a set of rules to reach a conclusion. The above deduction is an instance of the following pattern:

1. p (first premise) 2. p → q (second premise) 3. q (conclusion, inferred from 1 and 2)

This is called modus ponens, and is an example of an inference rule (more on this later!)

29 / 51 Key Idea 1: Any deductive process should be semantically valid. Key Idea 2: Any semantically valid entailment should be formally obtaintable through a deductive process. We will leave this in the air for now...

How does this relate to truth tables?

We can show that our deduction is valid by looking at the corresponding truth table:

The sun is out It is daytime If the sun is out then it is daytime 0 0 1 0 1 1 1 0 0 1 1 1

30 / 51 How does this relate to truth tables?

We can show that our deduction is valid by looking at the corresponding truth table:

The sun is out It is daytime If the sun is out then it is daytime 0 0 1 0 1 1 1 0 0 1 1 1

Key Idea 1: Any deductive process should be semantically valid. Key Idea 2: Any semantically valid entailment should be formally obtaintable through a deductive process. We will leave this in the air for now...

30 / 51 Deductive systems play an important role in mathematics, computer science, philosophy and linguistics. In the remainder of this lecture, we will introduce a Hilbert-Frege style deductive system for propositional logic.

What is a deductive system?

A deductive system is some abstract representation of reasoning. More precisely, a deductive system should include:

1 A language, together with a set of well-formed sentences (in our case formulae) in this language;

2 A collection axioms i.e. formulae which are taken to be basic assumptions;

3 A collection of inference rules.

31 / 51 What is a deductive system?

A deductive system is some abstract representation of reasoning. More precisely, a deductive system should include:

1 A language, together with a set of well-formed sentences (in our case formulae) in this language;

2 A collection axioms i.e. formulae which are taken to be basic assumptions;

3 A collection of inference rules.

Deductive systems play an important role in mathematics, computer science, philosophy and linguistics. In the remainder of this lecture, we will introduce a Hilbert-Frege style deductive system for propositional logic.

31 / 51 Generally speaking:

• in a concise and minimal system, it is easier to prove things about the system but harder to prove things within the system. • in a rich and expressive system, it is easier to prove things within the system but harder to prove things about the system.

This is a universal tradeof that we see in many other contexts: • It’s very hard to write programs in a low-level language, but easier to formally reason about them. The opposite is true for a high-level language. • It’s dificult to describe something in basic english, but easier to check someone’s grammar. The opposite is true for normal english.

How should a deductive system be designed?

There many diferent ways of setting up a , which depend entirely on our goals. One of the main dichotomies we are confronted with is:

Rich and expressive vs. Concise and minimal

32 / 51 This is a universal tradeof that we see in many other contexts: • It’s very hard to write programs in a low-level language, but easier to formally reason about them. The opposite is true for a high-level language. • It’s dificult to describe something in basic english, but easier to check someone’s grammar. The opposite is true for normal english.

How should a deductive system be designed?

There many diferent ways of setting up a formal system, which depend entirely on our goals. One of the main dichotomies we are confronted with is:

Rich and expressive vs. Concise and minimal

Generally speaking:

• in a concise and minimal system, it is easier to prove things about the system but harder to prove things within the system. • in a rich and expressive system, it is easier to prove things within the system but harder to prove things about the system.

32 / 51 How should a deductive system be designed?

There many diferent ways of setting up a formal system, which depend entirely on our goals. One of the main dichotomies we are confronted with is:

Rich and expressive vs. Concise and minimal

Generally speaking:

• in a concise and minimal system, it is easier to prove things about the system but harder to prove things within the system. • in a rich and expressive system, it is easier to prove things within the system but harder to prove things about the system.

This is a universal tradeof that we see in many other contexts: • It’s very hard to write programs in a low-level language, but easier to formally reason about them. The opposite is true for a high-level language. • It’s dificult to describe something in basic english, but easier to check someone’s grammar. The opposite is true for normal english.

32 / 51 Outline

1 Introduction, motivation and this course

2 Language of propositional logic

3 Truth table semantics

4 Some puzzles

5 Deductive reasoning

6 A Hilbert-Frege style deductive system

7 The deduction theorem

8 Questions and exercises

9 References

33 / 51 Both of them were concerned with proving things about deductive systems, and so they worked in a minimalist setting, in which everything is reduced to the two connectives → and ⊥, and contains just one : modus ponens. In Lecture 2, Anupam also wants to prove things about deductive systems, so to make life easier for him, we will adopt the Hilbert-Frege style. In Lecture 3, I will focus more on proving things within deductive systems, and will use a more expressive language.

A minimalist system

Hilbert-Frege systems are named ater David Hilbert (1862 – 1943) and Gottlob Frege (1848 – 1925).

34 / 51 In Lecture 2, Anupam also wants to prove things about deductive systems, so to make life easier for him, we will adopt the Hilbert-Frege style. In Lecture 3, I will focus more on proving things within deductive systems, and will use a more expressive language.

A minimalist system

Hilbert-Frege systems are named ater David Hilbert (1862 – 1943) and Gottlob Frege (1848 – 1925).

Both of them were concerned with proving things about deductive systems, and so they worked in a minimalist setting, in which everything is reduced to the two connectives → and ⊥, and contains just one rule of inference: modus ponens.

34 / 51 A minimalist system

Hilbert-Frege systems are named ater David Hilbert (1862 – 1943) and Gottlob Frege (1848 – 1925).

Both of them were concerned with proving things about deductive systems, and so they worked in a minimalist setting, in which everything is reduced to the two connectives → and ⊥, and contains just one rule of inference: modus ponens. In Lecture 2, Anupam also wants to prove things about deductive systems, so to make life easier for him, we will adopt the Hilbert-Frege style. In Lecture 3, I will focus more on proving things within deductive systems, and will use a more expressive language.

34 / 51 Definition (Axioms and rules of F) Ths system F has three axioms: (wk) p → (q → p) (dist)( p → (q → r)) → ((p → q) → (p → r)). (neg) ¬¬p → p.

where we write ¬p as shorthand for p → ⊥, together with one inference rule modus ponens: p p → q mp q

An instance of an axiom A is a formula σ(A) for some substitution σ. Analogously for inference rules. We can show using e.g. truth tables that our axioms are all tautologies, and that modus ponens is valid: if A and A → B are tautologies, then so is B.

Axioms and rules

We will call our deductive system F. It is based on the language of propositional logic with basis {→, ⊥}.

35 / 51 together with one inference rule modus ponens: p p → q mp q

An instance of an axiom A is a formula σ(A) for some substitution σ. Analogously for inference rules. We can show using e.g. truth tables that our axioms are all tautologies, and that modus ponens is valid: if A and A → B are tautologies, then so is B.

Axioms and rules

We will call our deductive system F. It is based on the language of propositional logic with basis {→, ⊥}.

Definition (Axioms and rules of F) Ths system F has three axioms: (wk) p → (q → p) (dist)( p → (q → r)) → ((p → q) → (p → r)). (neg) ¬¬p → p.

where we write ¬p as shorthand for p → ⊥,

35 / 51 An instance of an axiom A is a formula σ(A) for some substitution σ. Analogously for inference rules. We can show using e.g. truth tables that our axioms are all tautologies, and that modus ponens is valid: if A and A → B are tautologies, then so is B.

Axioms and rules

We will call our deductive system F. It is based on the language of propositional logic with basis {→, ⊥}.

Definition (Axioms and rules of F) Ths system F has three axioms: (wk) p → (q → p) (dist)( p → (q → r)) → ((p → q) → (p → r)). (neg) ¬¬p → p.

where we write ¬p as shorthand for p → ⊥, together with one inference rule modus ponens: p p → q mp q

35 / 51 Axioms and rules

We will call our deductive system F. It is based on the language of propositional logic with basis {→, ⊥}.

Definition (Axioms and rules of F) Ths system F has three axioms: (wk) p → (q → p) (dist)( p → (q → r)) → ((p → q) → (p → r)). (neg) ¬¬p → p.

where we write ¬p as shorthand for p → ⊥, together with one inference rule modus ponens: p p → q mp q

An instance of an axiom A is a formula σ(A) for some substitution σ. Analogously for inference rules. We can show using e.g. truth tables that our axioms are all tautologies, and that modus ponens is valid: if A and A → B are tautologies, then so is B.

35 / 51 Definition (Derivation)

A derivation of A from Γ is a list of formulae (A1,..., An) with An = A (called the conclusion) such that each member of the sequence is either: • an axiom; • a hypothesis i.e. an element of Γ; • obtained from two previous formulae by an instance of modus ponens.

We write Γ ` A if there exists a derivation of A from Γ.

Definition (Proof) A proof is a derivation from an empty set of premises.We write ` A if there is a proof of A (“A is a theorem”).

Proofs and derivations

Let A be a formula and Γ be a set of formulae (called hypotheses).

36 / 51 • an axiom; • a hypothesis i.e. an element of Γ; • obtained from two previous formulae by an instance of modus ponens.

We write Γ ` A if there exists a derivation of A from Γ.

Definition (Proof) A proof is a derivation from an empty set of premises.We write ` A if there is a proof of A (“A is a theorem”).

Proofs and derivations

Let A be a formula and Γ be a set of formulae (called hypotheses).

Definition (Derivation)

A derivation of A from Γ is a list of formulae (A1,..., An) with An = A (called the conclusion) such that each member of the sequence is either:

36 / 51 • a hypothesis i.e. an element of Γ; • obtained from two previous formulae by an instance of modus ponens.

We write Γ ` A if there exists a derivation of A from Γ.

Definition (Proof) A proof is a derivation from an empty set of premises.We write ` A if there is a proof of A (“A is a theorem”).

Proofs and derivations

Let A be a formula and Γ be a set of formulae (called hypotheses).

Definition (Derivation)

A derivation of A from Γ is a list of formulae (A1,..., An) with An = A (called the conclusion) such that each member of the sequence is either: • an axiom;

36 / 51 • obtained from two previous formulae by an instance of modus ponens.

We write Γ ` A if there exists a derivation of A from Γ.

Definition (Proof) A proof is a derivation from an empty set of premises.We write ` A if there is a proof of A (“A is a theorem”).

Proofs and derivations

Let A be a formula and Γ be a set of formulae (called hypotheses).

Definition (Derivation)

A derivation of A from Γ is a list of formulae (A1,..., An) with An = A (called the conclusion) such that each member of the sequence is either: • an axiom; • a hypothesis i.e. an element of Γ;

36 / 51 We write Γ ` A if there exists a derivation of A from Γ.

Definition (Proof) A proof is a derivation from an empty set of premises.We write ` A if there is a proof of A (“A is a theorem”).

Proofs and derivations

Let A be a formula and Γ be a set of formulae (called hypotheses).

Definition (Derivation)

A derivation of A from Γ is a list of formulae (A1,..., An) with An = A (called the conclusion) such that each member of the sequence is either: • an axiom; • a hypothesis i.e. an element of Γ; • obtained from two previous formulae by an instance of modus ponens.

36 / 51 Definition (Proof) A proof is a derivation from an empty set of premises.We write ` A if there is a proof of A (“A is a theorem”).

Proofs and derivations

Let A be a formula and Γ be a set of formulae (called hypotheses).

Definition (Derivation)

A derivation of A from Γ is a list of formulae (A1,..., An) with An = A (called the conclusion) such that each member of the sequence is either: • an axiom; • a hypothesis i.e. an element of Γ; • obtained from two previous formulae by an instance of modus ponens.

We write Γ ` A if there exists a derivation of A from Γ.

36 / 51 We write ` A if there is a proof of A (“A is a theorem”).

Proofs and derivations

Let A be a formula and Γ be a set of formulae (called hypotheses).

Definition (Derivation)

A derivation of A from Γ is a list of formulae (A1,..., An) with An = A (called the conclusion) such that each member of the sequence is either: • an axiom; • a hypothesis i.e. an element of Γ; • obtained from two previous formulae by an instance of modus ponens.

We write Γ ` A if there exists a derivation of A from Γ.

Definition (Proof) A proof is a derivation from an empty set of premises.

36 / 51 Proofs and derivations

Let A be a formula and Γ be a set of formulae (called hypotheses).

Definition (Derivation)

A derivation of A from Γ is a list of formulae (A1,..., An) with An = A (called the conclusion) such that each member of the sequence is either: • an axiom; • a hypothesis i.e. an element of Γ; • obtained from two previous formulae by an instance of modus ponens.

We write Γ ` A if there exists a derivation of A from Γ.

Definition (Proof) A proof is a derivation from an empty set of premises.We write ` A if there is a proof of A (“A is a theorem”).

36 / 51 The following is proof of A → A:

1. A → (B → A) → A wk 2. (A → (B → A) → A) → (A → (B → A)) → A → A dist 3. (A → B → A) → A → A mp(1, 2) 4. A → B → A wk 5. A → A mp(4, 3)

Note that when we use an axiom, we technically use an instance of the axiom. The axiom wk is p → (q → p) where p, q are propositional variables, whereas

A → (B → A) → A

is an instance of that axiom.

Example: ` A → A

It is obvious that A → A is a tautology for any formula A, and we can indeed formally derive it within F.

37 / 51 1. A → (B → A) → A wk 2. (A → (B → A) → A) → (A → (B → A)) → A → A dist 3. (A → B → A) → A → A mp(1, 2) 4. A → B → A wk 5. A → A mp(4, 3)

Note that when we use an axiom, we technically use an instance of the axiom. The axiom wk is p → (q → p) where p, q are propositional variables, whereas

A → (B → A) → A

is an instance of that axiom.

Example: ` A → A

It is obvious that A → A is a tautology for any formula A, and we can indeed formally derive it within F. The following is proof of A → A:

37 / 51 2. (A → (B → A) → A) → (A → (B → A)) → A → A dist 3. (A → B → A) → A → A mp(1, 2) 4. A → B → A wk 5. A → A mp(4, 3)

Note that when we use an axiom, we technically use an instance of the axiom. The axiom wk is p → (q → p) where p, q are propositional variables, whereas

A → (B → A) → A

is an instance of that axiom.

Example: ` A → A

It is obvious that A → A is a tautology for any formula A, and we can indeed formally derive it within F. The following is proof of A → A:

1. A → (B → A) → A wk

37 / 51 3. (A → B → A) → A → A mp(1, 2) 4. A → B → A wk 5. A → A mp(4, 3)

Note that when we use an axiom, we technically use an instance of the axiom. The axiom wk is p → (q → p) where p, q are propositional variables, whereas

A → (B → A) → A

is an instance of that axiom.

Example: ` A → A

It is obvious that A → A is a tautology for any formula A, and we can indeed formally derive it within F. The following is proof of A → A:

1. A → (B → A) → A wk 2. (A → (B → A) → A) → (A → (B → A)) → A → A dist

37 / 51 4. A → B → A wk 5. A → A mp(4, 3)

Note that when we use an axiom, we technically use an instance of the axiom. The axiom wk is p → (q → p) where p, q are propositional variables, whereas

A → (B → A) → A

is an instance of that axiom.

Example: ` A → A

It is obvious that A → A is a tautology for any formula A, and we can indeed formally derive it within F. The following is proof of A → A:

1. A → (B → A) → A wk 2. (A → (B → A) → A) → (A → (B → A)) → A → A dist 3. (A → B → A) → A → A mp(1, 2)

37 / 51 5. A → A mp(4, 3)

Note that when we use an axiom, we technically use an instance of the axiom. The axiom wk is p → (q → p) where p, q are propositional variables, whereas

A → (B → A) → A

is an instance of that axiom.

Example: ` A → A

It is obvious that A → A is a tautology for any formula A, and we can indeed formally derive it within F. The following is proof of A → A:

1. A → (B → A) → A wk 2. (A → (B → A) → A) → (A → (B → A)) → A → A dist 3. (A → B → A) → A → A mp(1, 2) 4. A → B → A wk

37 / 51 Note that when we use an axiom, we technically use an instance of the axiom. The axiom wk is p → (q → p) where p, q are propositional variables, whereas

A → (B → A) → A

is an instance of that axiom.

Example: ` A → A

It is obvious that A → A is a tautology for any formula A, and we can indeed formally derive it within F. The following is proof of A → A:

1. A → (B → A) → A wk 2. (A → (B → A) → A) → (A → (B → A)) → A → A dist 3. (A → B → A) → A → A mp(1, 2) 4. A → B → A wk 5. A → A mp(4, 3)

37 / 51 Example: ` A → A

It is obvious that A → A is a tautology for any formula A, and we can indeed formally derive it within F. The following is proof of A → A:

1. A → (B → A) → A wk 2. (A → (B → A) → A) → (A → (B → A)) → A → A dist 3. (A → B → A) → A → A mp(1, 2) 4. A → B → A wk 5. A → A mp(4, 3)

Note that when we use an axiom, we technically use an instance of the axiom. The axiom wk is p → (q → p) where p, q are propositional variables, whereas

A → (B → A) → A

is an instance of that axiom.

37 / 51 1. B → C hyp 2. (B → C) → A → (B → C) wk 3. A → (B → C) mp(1, 2) 4. (A → (B → C)) → (A → B) → (A → C) dist 5. (A → B) → (A → C) mp(3, 4) 6. A → B hyp 7. A → C mp(6, 5)

Example: {A → B, B → C} ` A → C

The following is a derivation of A → C from the hypotheses {A → B, B → C}

38 / 51 2. (B → C) → A → (B → C) wk 3. A → (B → C) mp(1, 2) 4. (A → (B → C)) → (A → B) → (A → C) dist 5. (A → B) → (A → C) mp(3, 4) 6. A → B hyp 7. A → C mp(6, 5)

Example: {A → B, B → C} ` A → C

The following is a derivation of A → C from the hypotheses {A → B, B → C}

1. B → C hyp

38 / 51 3. A → (B → C) mp(1, 2) 4. (A → (B → C)) → (A → B) → (A → C) dist 5. (A → B) → (A → C) mp(3, 4) 6. A → B hyp 7. A → C mp(6, 5)

Example: {A → B, B → C} ` A → C

The following is a derivation of A → C from the hypotheses {A → B, B → C}

1. B → C hyp 2. (B → C) → A → (B → C) wk

38 / 51 4. (A → (B → C)) → (A → B) → (A → C) dist 5. (A → B) → (A → C) mp(3, 4) 6. A → B hyp 7. A → C mp(6, 5)

Example: {A → B, B → C} ` A → C

The following is a derivation of A → C from the hypotheses {A → B, B → C}

1. B → C hyp 2. (B → C) → A → (B → C) wk 3. A → (B → C) mp(1, 2)

38 / 51 5. (A → B) → (A → C) mp(3, 4) 6. A → B hyp 7. A → C mp(6, 5)

Example: {A → B, B → C} ` A → C

The following is a derivation of A → C from the hypotheses {A → B, B → C}

1. B → C hyp 2. (B → C) → A → (B → C) wk 3. A → (B → C) mp(1, 2) 4. (A → (B → C)) → (A → B) → (A → C) dist

38 / 51 6. A → B hyp 7. A → C mp(6, 5)

Example: {A → B, B → C} ` A → C

The following is a derivation of A → C from the hypotheses {A → B, B → C}

1. B → C hyp 2. (B → C) → A → (B → C) wk 3. A → (B → C) mp(1, 2) 4. (A → (B → C)) → (A → B) → (A → C) dist 5. (A → B) → (A → C) mp(3, 4)

38 / 51 7. A → C mp(6, 5)

Example: {A → B, B → C} ` A → C

The following is a derivation of A → C from the hypotheses {A → B, B → C}

1. B → C hyp 2. (B → C) → A → (B → C) wk 3. A → (B → C) mp(1, 2) 4. (A → (B → C)) → (A → B) → (A → C) dist 5. (A → B) → (A → C) mp(3, 4) 6. A → B hyp

38 / 51 Example: {A → B, B → C} ` A → C

The following is a derivation of A → C from the hypotheses {A → B, B → C}

1. B → C hyp 2. (B → C) → A → (B → C) wk 3. A → (B → C) mp(1, 2) 4. (A → (B → C)) → (A → B) → (A → C) dist 5. (A → B) → (A → C) mp(3, 4) 6. A → B hyp 7. A → C mp(6, 5)

38 / 51 • The leaves of the tree (in our case A1, A2 and A4) represent axioms or hypotheses

• whenever a node C has children A and B (e.g. A5 has children A4 and A3), then C is derived from A and B via an inference rule

Oten it is much easier to visualise a derivation when it is written in tree form, as the relationship between the formulae in the derivation is clearly represented.

Derivations as trees

Derivation trees are a compact way of representing derivations. They look like:

A1 A2

A4 A3

A5

39 / 51 • whenever a node C has children A and B (e.g. A5 has children A4 and A3), then C is derived from A and B via an inference rule

Oten it is much easier to visualise a derivation when it is written in tree form, as the relationship between the formulae in the derivation is clearly represented.

Derivations as trees

Derivation trees are a compact way of representing derivations. They look like:

A1 A2

A4 A3

A5

• The leaves of the tree (in our case A1, A2 and A4) represent axioms or hypotheses

39 / 51 Oten it is much easier to visualise a derivation when it is written in tree form, as the relationship between the formulae in the derivation is clearly represented.

Derivations as trees

Derivation trees are a compact way of representing derivations. They look like:

A1 A2

A4 A3

A5

• The leaves of the tree (in our case A1, A2 and A4) represent axioms or hypotheses

• whenever a node C has children A and B (e.g. A5 has children A4 and A3), then C is derived from A and B via an inference rule

39 / 51 Derivations as trees

Derivation trees are a compact way of representing derivations. They look like:

A1 A2

A4 A3

A5

• The leaves of the tree (in our case A1, A2 and A4) represent axioms or hypotheses

• whenever a node C has children A and B (e.g. A5 has children A4 and A3), then C is derived from A and B via an inference rule

Oten it is much easier to visualise a derivation when it is written in tree form, as the relationship between the formulae in the derivation is clearly represented.

39 / 51 The following is a derivation of A → C from {A → B, B → C} (hypotheses are indicated in blue):

B → C (B → C) → A → (B → C) A → (B → C)(A → (B → C)) → (A → B) → A → C A → B (A → B) → A → C A → C

Hint. Before drawing a proof tree, turn your paper sideways!

Our examples in tree form

The following is a proof of A → A:

A → (B → A) → A (A → (B → A) → A) → (A → B → A) → A → A A → B → A (A → B → A) → A → A A → A

40 / 51 Hint. Before drawing a proof tree, turn your paper sideways!

Our examples in tree form

The following is a proof of A → A:

A → (B → A) → A (A → (B → A) → A) → (A → B → A) → A → A A → B → A (A → B → A) → A → A A → A

The following is a derivation of A → C from {A → B, B → C} (hypotheses are indicated in blue):

B → C (B → C) → A → (B → C) A → (B → C)(A → (B → C)) → (A → B) → A → C A → B (A → B) → A → C A → C

40 / 51 Our examples in tree form

The following is a proof of A → A:

A → (B → A) → A (A → (B → A) → A) → (A → B → A) → A → A A → B → A (A → B → A) → A → A A → A

The following is a derivation of A → C from {A → B, B → C} (hypotheses are indicated in blue):

B → C (B → C) → A → (B → C) A → (B → C)(A → (B → C)) → (A → B) → A → C A → B (A → B) → A → C A → C

Hint. Before drawing a proof tree, turn your paper sideways!

40 / 51 Proof. We fix our set of hypotheses and carry out induction over the length of the derivation. Suppose that (A1,..., An) is a derivation of An. If An is an axiom or hypothesis then the single node tree

An

represents a derivation of An from Γ.

Otherwise, An is obtained via modus ponens from some Ai, Aj with i, j < n. But since (A1,..., Ai) and (A1,..., Aj) are also derivations (of shorter length), by the induction hypothesis there are trees Ti and Tj which represent, resprectively, derivations of Ai and Aj from Γ, and so the tree

Ti Tj

An

represents a derivation of An from Γ.

Tree normal form

Proposition

Every derivation (A1,..., An) can be converted to one in tree form.

41 / 51 Suppose that (A1,..., An) is a derivation of An. If An is an axiom or hypothesis then the single node tree

An

represents a derivation of An from Γ.

Otherwise, An is obtained via modus ponens from some Ai, Aj with i, j < n. But since (A1,..., Ai) and (A1,..., Aj) are also derivations (of shorter length), by the induction hypothesis there are trees Ti and Tj which represent, resprectively, derivations of Ai and Aj from Γ, and so the tree

Ti Tj

An

represents a derivation of An from Γ.

Tree normal form

Proposition

Every derivation (A1,..., An) can be converted to one in tree form.

Proof. We fix our set of hypotheses and carry out induction over the length of the derivation.

41 / 51 If An is an axiom or hypothesis then the single node tree

An

represents a derivation of An from Γ.

Otherwise, An is obtained via modus ponens from some Ai, Aj with i, j < n. But since (A1,..., Ai) and (A1,..., Aj) are also derivations (of shorter length), by the induction hypothesis there are trees Ti and Tj which represent, resprectively, derivations of Ai and Aj from Γ, and so the tree

Ti Tj

An

represents a derivation of An from Γ.

Tree normal form

Proposition

Every derivation (A1,..., An) can be converted to one in tree form.

Proof. We fix our set of hypotheses and carry out induction over the length of the derivation. Suppose that (A1,..., An) is a derivation of An.

41 / 51 Otherwise, An is obtained via modus ponens from some Ai, Aj with i, j < n. But since (A1,..., Ai) and (A1,..., Aj) are also derivations (of shorter length), by the induction hypothesis there are trees Ti and Tj which represent, resprectively, derivations of Ai and Aj from Γ, and so the tree

Ti Tj

An

represents a derivation of An from Γ.

Tree normal form

Proposition

Every derivation (A1,..., An) can be converted to one in tree form.

Proof. We fix our set of hypotheses and carry out induction over the length of the derivation. Suppose that (A1,..., An) is a derivation of An. If An is an axiom or hypothesis then the single node tree

An

represents a derivation of An from Γ.

41 / 51 But since (A1,..., Ai) and (A1,..., Aj) are also derivations (of shorter length), by the induction hypothesis there are trees Ti and Tj which represent, resprectively, derivations of Ai and Aj from Γ, and so the tree

Ti Tj

An

represents a derivation of An from Γ.

Tree normal form

Proposition

Every derivation (A1,..., An) can be converted to one in tree form.

Proof. We fix our set of hypotheses and carry out induction over the length of the derivation. Suppose that (A1,..., An) is a derivation of An. If An is an axiom or hypothesis then the single node tree

An

represents a derivation of An from Γ.

Otherwise, An is obtained via modus ponens from some Ai, Aj with i, j < n.

41 / 51 and so the tree

Ti Tj

An

represents a derivation of An from Γ.

Tree normal form

Proposition

Every derivation (A1,..., An) can be converted to one in tree form.

Proof. We fix our set of hypotheses and carry out induction over the length of the derivation. Suppose that (A1,..., An) is a derivation of An. If An is an axiom or hypothesis then the single node tree

An

represents a derivation of An from Γ.

Otherwise, An is obtained via modus ponens from some Ai, Aj with i, j < n. But since (A1,..., Ai) and (A1,..., Aj) are also derivations (of shorter length), by the induction hypothesis there are trees Ti and Tj which represent, resprectively, derivations of Ai and Aj from Γ,

41 / 51 Tree normal form

Proposition

Every derivation (A1,..., An) can be converted to one in tree form.

Proof. We fix our set of hypotheses and carry out induction over the length of the derivation. Suppose that (A1,..., An) is a derivation of An. If An is an axiom or hypothesis then the single node tree

An

represents a derivation of An from Γ.

Otherwise, An is obtained via modus ponens from some Ai, Aj with i, j < n. But since (A1,..., Ai) and (A1,..., Aj) are also derivations (of shorter length), by the induction hypothesis there are trees Ti and Tj which represent, resprectively, derivations of Ai and Aj from Γ, and so the tree

Ti Tj

An

represents a derivation of An from Γ.

41 / 51 Outline

1 Introduction, motivation and this course

2 Language of propositional logic

3 Truth table semantics

4 Some puzzles

5 Deductive reasoning

6 A Hilbert-Frege style deductive system

7 The deduction theorem

8 Questions and exercises

9 References

42 / 51 The deduction theorem confirms that these two notions are equivalent.

Theorem (Deduction theorem) Γ ` A → B if and only if Γ ∪ {A} ` B.

Warning: The deduction theorem (and in fact most of the theorems we will present) do not necessarily hold in an arbitrary deductive systems.

Proof (easy direction ⇒).

Suppose that (A1,..., An, A → B) is a derivation of A → B from Γ.

Then (A1,..., An, A → B, A, B) is a derivation of B from Γ ∪ {A}.

The relationship between ` and →

We conclude with our first important theorem about formal derivations. You may have noticed that ` and → seem to have a similar meaning, although they correspond to two quite diferent things, namely:

A ` B : I can derive B if I am allowed to take A as a hypothesis ` A → B : I can prove the implication A → B without any hypotheses

43 / 51 Theorem (Deduction theorem) Γ ` A → B if and only if Γ ∪ {A} ` B.

Warning: The deduction theorem (and in fact most of the theorems we will present) do not necessarily hold in an arbitrary deductive systems.

Proof (easy direction ⇒).

Suppose that (A1,..., An, A → B) is a derivation of A → B from Γ.

Then (A1,..., An, A → B, A, B) is a derivation of B from Γ ∪ {A}.

The relationship between ` and →

We conclude with our first important theorem about formal derivations. You may have noticed that ` and → seem to have a similar meaning, although they correspond to two quite diferent things, namely:

A ` B : I can derive B if I am allowed to take A as a hypothesis ` A → B : I can prove the implication A → B without any hypotheses

The deduction theorem confirms that these two notions are equivalent.

43 / 51 Warning: The deduction theorem (and in fact most of the theorems we will present) do not necessarily hold in an arbitrary deductive systems.

Proof (easy direction ⇒).

Suppose that (A1,..., An, A → B) is a derivation of A → B from Γ.

Then (A1,..., An, A → B, A, B) is a derivation of B from Γ ∪ {A}.

The relationship between ` and →

We conclude with our first important theorem about formal derivations. You may have noticed that ` and → seem to have a similar meaning, although they correspond to two quite diferent things, namely:

A ` B : I can derive B if I am allowed to take A as a hypothesis ` A → B : I can prove the implication A → B without any hypotheses

The deduction theorem confirms that these two notions are equivalent.

Theorem (Deduction theorem) Γ ` A → B if and only if Γ ∪ {A} ` B.

43 / 51 Proof (easy direction ⇒).

Suppose that (A1,..., An, A → B) is a derivation of A → B from Γ.

Then (A1,..., An, A → B, A, B) is a derivation of B from Γ ∪ {A}.

The relationship between ` and →

We conclude with our first important theorem about formal derivations. You may have noticed that ` and → seem to have a similar meaning, although they correspond to two quite diferent things, namely:

A ` B : I can derive B if I am allowed to take A as a hypothesis ` A → B : I can prove the implication A → B without any hypotheses

The deduction theorem confirms that these two notions are equivalent.

Theorem (Deduction theorem) Γ ` A → B if and only if Γ ∪ {A} ` B.

Warning: The deduction theorem (and in fact most of the theorems we will present) do not necessarily hold in an arbitrary deductive systems.

43 / 51 Then (A1,..., An, A → B, A, B) is a derivation of B from Γ ∪ {A}.

The relationship between ` and →

We conclude with our first important theorem about formal derivations. You may have noticed that ` and → seem to have a similar meaning, although they correspond to two quite diferent things, namely:

A ` B : I can derive B if I am allowed to take A as a hypothesis ` A → B : I can prove the implication A → B without any hypotheses

The deduction theorem confirms that these two notions are equivalent.

Theorem (Deduction theorem) Γ ` A → B if and only if Γ ∪ {A} ` B.

Warning: The deduction theorem (and in fact most of the theorems we will present) do not necessarily hold in an arbitrary deductive systems.

Proof (easy direction ⇒).

Suppose that (A1,..., An, A → B) is a derivation of A → B from Γ.

43 / 51 The relationship between ` and →

We conclude with our first important theorem about formal derivations. You may have noticed that ` and → seem to have a similar meaning, although they correspond to two quite diferent things, namely:

A ` B : I can derive B if I am allowed to take A as a hypothesis ` A → B : I can prove the implication A → B without any hypotheses

The deduction theorem confirms that these two notions are equivalent.

Theorem (Deduction theorem) Γ ` A → B if and only if Γ ∪ {A} ` B.

Warning: The deduction theorem (and in fact most of the theorems we will present) do not necessarily hold in an arbitrary deductive systems.

Proof (easy direction ⇒).

Suppose that (A1,..., An, A → B) is a derivation of A → B from Γ.

Then (A1,..., An, A → B, A, B) is a derivation of B from Γ ∪ {A}.

43 / 51 If Ai is an axiom or element of Γ, then a derivation Γ ` A → Ai is given via

Ai Ai → (A → Ai)

A → Ai

If Ai is A, then we have Γ ` A → A (we showed this earlier).

Otherwise, Ai follows from Aj and Aj → Ai where these occur previously in the derivation. By the induction hypothesis we have Γ ` A → Aj and Γ ` A → (Aj → Ai), and therefore

. . . . A → (Aj → Ai)(A → (Aj → Ai)) → (A → Aj) → (A → Ai)

A → Aj (A → Aj) → A → Ai

A → Ai

represents a derivation Γ ` A → Ai.

Thus by induction we have Γ ` A → Ai for all i, and in particular Γ ` A → B.

Proof (hard direction ⇐)

Suppose that (A1,..., An = B) is a derivation of B from Γ ∪ {A}. We show by structural induction on the derivation that Γ ` A → Ai for all i = 1,..., n.

44 / 51 If Ai is A, then we have Γ ` A → A (we showed this earlier).

Otherwise, Ai follows from Aj and Aj → Ai where these occur previously in the derivation. By the induction hypothesis we have Γ ` A → Aj and Γ ` A → (Aj → Ai), and therefore

. . . . A → (Aj → Ai)(A → (Aj → Ai)) → (A → Aj) → (A → Ai)

A → Aj (A → Aj) → A → Ai

A → Ai

represents a derivation Γ ` A → Ai.

Thus by induction we have Γ ` A → Ai for all i, and in particular Γ ` A → B.

Proof (hard direction ⇐)

Suppose that (A1,..., An = B) is a derivation of B from Γ ∪ {A}. We show by structural induction on the derivation that Γ ` A → Ai for all i = 1,..., n.

If Ai is an axiom or element of Γ, then a derivation Γ ` A → Ai is given via

Ai Ai → (A → Ai)

A → Ai

44 / 51 Otherwise, Ai follows from Aj and Aj → Ai where these occur previously in the derivation. By the induction hypothesis we have Γ ` A → Aj and Γ ` A → (Aj → Ai), and therefore

. . . . A → (Aj → Ai)(A → (Aj → Ai)) → (A → Aj) → (A → Ai)

A → Aj (A → Aj) → A → Ai

A → Ai

represents a derivation Γ ` A → Ai.

Thus by induction we have Γ ` A → Ai for all i, and in particular Γ ` A → B.

Proof (hard direction ⇐)

Suppose that (A1,..., An = B) is a derivation of B from Γ ∪ {A}. We show by structural induction on the derivation that Γ ` A → Ai for all i = 1,..., n.

If Ai is an axiom or element of Γ, then a derivation Γ ` A → Ai is given via

Ai Ai → (A → Ai)

A → Ai

If Ai is A, then we have Γ ` A → A (we showed this earlier).

44 / 51 and therefore

. . . . A → (Aj → Ai)(A → (Aj → Ai)) → (A → Aj) → (A → Ai)

A → Aj (A → Aj) → A → Ai

A → Ai

represents a derivation Γ ` A → Ai.

Thus by induction we have Γ ` A → Ai for all i, and in particular Γ ` A → B.

Proof (hard direction ⇐)

Suppose that (A1,..., An = B) is a derivation of B from Γ ∪ {A}. We show by structural induction on the derivation that Γ ` A → Ai for all i = 1,..., n.

If Ai is an axiom or element of Γ, then a derivation Γ ` A → Ai is given via

Ai Ai → (A → Ai)

A → Ai

If Ai is A, then we have Γ ` A → A (we showed this earlier).

Otherwise, Ai follows from Aj and Aj → Ai where these occur previously in the derivation. By the induction hypothesis we have Γ ` A → Aj and Γ ` A → (Aj → Ai),

44 / 51 Thus by induction we have Γ ` A → Ai for all i, and in particular Γ ` A → B.

Proof (hard direction ⇐)

Suppose that (A1,..., An = B) is a derivation of B from Γ ∪ {A}. We show by structural induction on the derivation that Γ ` A → Ai for all i = 1,..., n.

If Ai is an axiom or element of Γ, then a derivation Γ ` A → Ai is given via

Ai Ai → (A → Ai)

A → Ai

If Ai is A, then we have Γ ` A → A (we showed this earlier).

Otherwise, Ai follows from Aj and Aj → Ai where these occur previously in the derivation. By the induction hypothesis we have Γ ` A → Aj and Γ ` A → (Aj → Ai), and therefore

. . . . A → (Aj → Ai)(A → (Aj → Ai)) → (A → Aj) → (A → Ai)

A → Aj (A → Aj) → A → Ai

A → Ai

represents a derivation Γ ` A → Ai.

44 / 51 Proof (hard direction ⇐)

Suppose that (A1,..., An = B) is a derivation of B from Γ ∪ {A}. We show by structural induction on the derivation that Γ ` A → Ai for all i = 1,..., n.

If Ai is an axiom or element of Γ, then a derivation Γ ` A → Ai is given via

Ai Ai → (A → Ai)

A → Ai

If Ai is A, then we have Γ ` A → A (we showed this earlier).

Otherwise, Ai follows from Aj and Aj → Ai where these occur previously in the derivation. By the induction hypothesis we have Γ ` A → Aj and Γ ` A → (Aj → Ai), and therefore

. . . . A → (Aj → Ai)(A → (Aj → Ai)) → (A → Aj) → (A → Ai)

A → Aj (A → Aj) → A → Ai

A → Ai

represents a derivation Γ ` A → Ai.

Thus by induction we have Γ ` A → Ai for all i, and in particular Γ ` A → B.

44 / 51 Definition (Semantic entailment) We say Γ semantically entails A and write Γ  A if for any assignment α such that α(Ai) = 1 for all Ai ∈ Γ then also α(A) = 1.

• If Γ ` A, is it always the case that Γ  A? In other words, is everything that we can prove also true?

• Conversely, if Γ  A, can we always find a derivation Γ ` A. In other words, is everything true entailment also provable?

These are extremely important questions which will form the topic of tomorrow’s lecture!

Looking ahead to Lecture 2...

Today we discussed propositional logic from both a semantic (i.e. truth tables) and a syntactic (i.e. formal derivations) point of view. Underlying this is a distinction between semantic truth and provability.

45 / 51 • If Γ ` A, is it always the case that Γ  A? In other words, is everything that we can prove also true?

• Conversely, if Γ  A, can we always find a derivation Γ ` A. In other words, is everything true entailment also provable?

These are extremely important questions which will form the topic of tomorrow’s lecture!

Looking ahead to Lecture 2...

Today we discussed propositional logic from both a semantic (i.e. truth tables) and a syntactic (i.e. formal derivations) point of view. Underlying this is a distinction between semantic truth and provability.

Definition (Semantic entailment) We say Γ semantically entails A and write Γ  A if for any assignment α such that α(Ai) = 1 for all Ai ∈ Γ then also α(A) = 1.

45 / 51 • Conversely, if Γ  A, can we always find a derivation Γ ` A. In other words, is everything true entailment also provable?

These are extremely important questions which will form the topic of tomorrow’s lecture!

Looking ahead to Lecture 2...

Today we discussed propositional logic from both a semantic (i.e. truth tables) and a syntactic (i.e. formal derivations) point of view. Underlying this is a distinction between semantic truth and provability.

Definition (Semantic entailment) We say Γ semantically entails A and write Γ  A if for any assignment α such that α(Ai) = 1 for all Ai ∈ Γ then also α(A) = 1.

• If Γ ` A, is it always the case that Γ  A? In other words, is everything that we can prove also true?

45 / 51 These are extremely important questions which will form the topic of tomorrow’s lecture!

Looking ahead to Lecture 2...

Today we discussed propositional logic from both a semantic (i.e. truth tables) and a syntactic (i.e. formal derivations) point of view. Underlying this is a distinction between semantic truth and provability.

Definition (Semantic entailment) We say Γ semantically entails A and write Γ  A if for any assignment α such that α(Ai) = 1 for all Ai ∈ Γ then also α(A) = 1.

• If Γ ` A, is it always the case that Γ  A? In other words, is everything that we can prove also true?

• Conversely, if Γ  A, can we always find a derivation Γ ` A. In other words, is everything true entailment also provable?

45 / 51 Looking ahead to Lecture 2...

Today we discussed propositional logic from both a semantic (i.e. truth tables) and a syntactic (i.e. formal derivations) point of view. Underlying this is a distinction between semantic truth and provability.

Definition (Semantic entailment) We say Γ semantically entails A and write Γ  A if for any assignment α such that α(Ai) = 1 for all Ai ∈ Γ then also α(A) = 1.

• If Γ ` A, is it always the case that Γ  A? In other words, is everything that we can prove also true?

• Conversely, if Γ  A, can we always find a derivation Γ ` A. In other words, is everything true entailment also provable?

These are extremely important questions which will form the topic of tomorrow’s lecture!

45 / 51 Outline

1 Introduction, motivation and this course

2 Language of propositional logic

3 Truth table semantics

4 Some puzzles

5 Deductive reasoning

6 A Hilbert-Frege style deductive system

7 The deduction theorem

8 Questions and exercises

9 References

46 / 51 Syntax and Semantics

1 Sketch an algorithm to check if a given expression over the alphabet Prop ∪ {(, ), ⊥, >, ¬, ∨, ∧, →} is a valid formula.

2 Using truth tables, prove the De Morgan laws.

¬¬A ↔ A ¬(A ∨ B) ↔ ¬A ∧ ¬B ¬(A ∧ B) ↔ ¬A ∨ ¬B

Conclude that the bases {¬, ∨} and {¬, ∧} are adequate.

3 (Open-ended). Is there any single connective that is adequate all by itself?

4 A Boolean function is monotone if, in its truth table, flipping 0s to 1s in the inputs only flips 0s to 1s in the outputs. Show that ⊥, >, ∨, ∧ are monotone, and any formula composed of just these two is monotone.

5 Show that {⊥, >, ∨, ∧} is adequate for monotone Boolean functions.

Hint: recall the example of the majority functions, Majn.

47 / 51 Proofs

1 Show {A, B, A → (B → C)} ` C and hence ` A → (B → C) → B → A → C.

2 We can extend F to include conjunction ∧ by adding the following axioms:

(pair) p → q → (p ∧ q) (pl)( p ∧ q) → p (pr)( p ∧ q) → q Show that this extended system proves: (A → (B → C)) ↔ ((A ∧ B) → C)

3 We haven’t yet used the axiom (neg)! Show that F proves:

¬A → (A → B) (¬B → ¬A) → (A → B) ((A → B) → A) → A

4 (Hard). Write F(→) for the fragment of F without the neg axiom. • Notice that F(→) still satisfies the Deduction theorem! • Show F(→) is not equivalent to F over →-only formulae. (Non-conservativity) • On the other hand, show that F(→) + ((p → q) → p) → p is equivalent to F over →-only formulae.

48 / 51 Outline

1 Introduction, motivation and this course

2 Language of propositional logic

3 Truth table semantics

4 Some puzzles

5 Deductive reasoning

6 A Hilbert-Frege style deductive system

7 The deduction theorem

8 Questions and exercises

9 References

49 / 51 ReferencesI

Buss, S. R., editor (1998). Handbook of Proof Theory, volume 137 of Studies in Logic and the Foundations of Mathematics. Elsevier. Frege, G. (1879). Begrifsschrit: Eine Der Arithmetische Nachgebildete Formelsprache des Reinen Denkens. L. Nebert. Gödel, K. (1931). über formal unentscheidbare sätze der principia mathematica und verwandter systeme i. Monatshete für Mathematik, 38(1):173–198.

Schoenfeld, J. S. (1967). Mathematical Logic. Addison-Wesley, Reading.

Smullyan, R. M. (1980). What is the name of this book? the riddle of dracula and other logical puzzles. Philosophical Review, 89(3):467–470.

50 / 51 ReferencesII

Szabo, M. E. (1972). The collected papers of gerhard gentzen. Philosophy of Science, 39(1):91–91.

Troelstra, A. S. and Schwichtenberg, H. (1996). Basic Proof Theory. Cambridge University Press, New York, NY, USA.

Whitehead, A. N. and Russell, B. (1925–1927). Principia Mathematica. Cambridge University Press.

51 / 51