Predicate Logic: Peano Arithmetic Alice Gao Lecture 20 CS 245 - - PowerPoint PPT Presentation

predicate logic peano arithmetic
SMART_READER_LITE
LIVE PREVIEW

Predicate Logic: Peano Arithmetic Alice Gao Lecture 20 CS 245 - - PowerPoint PPT Presentation

Predicate Logic: Peano Arithmetic Alice Gao Lecture 20 CS 245 Logic and Computation Fall 2019 1 / 22 Outline The Learning Goals Properties of Equality Using Logic to Model Number Theory Revisiting the Learning Goals CS 245 Logic and


slide-1
SLIDE 1

Predicate Logic: Peano Arithmetic

Alice Gao

Lecture 20

CS 245 Logic and Computation Fall 2019 1 / 22

slide-2
SLIDE 2

Outline

The Learning Goals Properties of Equality Using Logic to Model Number Theory Revisiting the Learning Goals

CS 245 Logic and Computation Fall 2019 2 / 22

slide-3
SLIDE 3

Learning goals

By the end of this lecture, you should be able to:

▶ Write a formal deduction proof using rules for equality. ▶ Write a formal deduction proof for properties of natural

numbers using formal deduction rules and Peano axioms.

CS 245 Logic and Computation Fall 2019 3 / 22

slide-4
SLIDE 4

Formal Deduction Rules for Equality

(≈ −) If Σ ⊢ 𝐵(𝑢1) and Σ ⊢ 𝑢1 ≈ 𝑢2 then Σ ⊢ 𝐵′(𝑢2), where 𝐵′(𝑢2) results from 𝐵(𝑢1) by replacing some (not necessarily all) occurrences

  • f 𝑢1 by 𝑢2.

(≈ +) ∅ ⊢ 𝑣 ≈ 𝑣.

CS 245 Logic and Computation Fall 2019 4 / 22

slide-5
SLIDE 5

Proving Properties of Equality

(Refmexivity) ∀𝑦 (𝑦 ≈ 𝑦) (Symmetry) ∀𝑦 ∀𝑧 ((𝑦 ≈ 𝑧) → (𝑧 ≈ 𝑦)) (Transitivity) ∀𝑦 ∀𝑧 ∀𝑨 ((𝑦 ≈ 𝑧) ∧ (𝑧 ≈ 𝑨) → (𝑦 ≈ 𝑨))

CS 245 Logic and Computation Fall 2019 5 / 22

slide-6
SLIDE 6

Proving Refmexivity

Refmexivity: ∅ ⊢ ∀𝑦(𝑦 ≈ 𝑦)

CS 245 Logic and Computation Fall 2019 6 / 22

slide-7
SLIDE 7

Proving Symmetry

Symmetry: ∅ ⊢ ∀𝑦 ∀𝑧 (𝑦 ≈ 𝑧) → (𝑧 ≈ 𝑦)

CS 245 Logic and Computation Fall 2019 7 / 22

slide-8
SLIDE 8

Proving Transitivity

Transitivity: ∅ ⊢ ∀𝑦 ∀𝑧 ∀𝑨 (𝑦 ≈ 𝑧) ∧ (𝑧 ≈ 𝑨) → (𝑦 ≈ 𝑨)

CS 245 Logic and Computation Fall 2019 8 / 22

slide-9
SLIDE 9

Outline

The Learning Goals Properties of Equality Using Logic to Model Number Theory Revisiting the Learning Goals

CS 245 Logic and Computation Fall 2019 9 / 22

slide-10
SLIDE 10

Using Logic to Model Mathematics

We want to use predicate logic to model mathematics.

▶ Number theory, with 0, +, and ⋅ ▶ Set theory, with ∈ and ∅ ▶ Group theory ▶ Graph theory ▶ Geometry

For each domain,

▶ Defjne axioms that describe the functions, predicates/relations

and individuals/constants.

▶ Prove theorems in that domain using predicate logic.

CS 245 Logic and Computation Fall 2019 10 / 22

slide-11
SLIDE 11

Number Theory

We would like to formalize the properties of natural numbers.

▶ The domain is the set of natural numbers, 0, 1, 2, 3, … . ▶ Functions: addition + and multiplication ⋅. ▶ Relations: ordering <.

The axioms should be a small set of true statements from which we can derive theorems about natural numbers.

CS 245 Logic and Computation Fall 2019 11 / 22

slide-12
SLIDE 12

Symbols for Number Theory

▶ Individual/constant: 0 ▶ Functions:

addition + multiplication ⋅ successor 𝑡(𝑦)

CS 245 Logic and Computation Fall 2019 12 / 22

slide-13
SLIDE 13

Peano Axioms (1/2)

Axioms for successor PA1 Zero is not a successor of any natural number. PA2 If two numbers are the same, they must have the same predecessor. Axioms for addition PA3 Adding zero to any number yields the same number. PA4 Adding the successor of a number yields the successor of adding the number.

CS 245 Logic and Computation Fall 2019 13 / 22

slide-14
SLIDE 14

Peano Axioms (2/2)

Axioms for multiplication PA5 Multiplying a number by zero yields zero. PA6 Multiplying one number and the successor of another number equals the product of the two numbers plus the fjrst number.

CS 245 Logic and Computation Fall 2019 14 / 22

slide-15
SLIDE 15

Axiom for Induction

For 𝑜 ∈ ℕ, let 𝑄(𝑜) denote that 𝑜 has the property 𝑄.

▶ (Base Case)

Prove that 𝑄(0) is true.

▶ (Inductive Step)

Assume that 𝑄(𝑙) is true for some 𝑙 ∈ ℕ. Prove that 𝑄(𝑙 + 1) is true. By the principle of mathematical induction, 𝑄(𝑜) is true for every 𝑜 ∈ ℕ. Expressing this in predicate logic: (𝑄(0) ∧ ∀𝑦 (𝑄(𝑦) → 𝑄(𝑡(𝑦)))) → ∀𝑦 𝑄(𝑦)

CS 245 Logic and Computation Fall 2019 15 / 22

slide-16
SLIDE 16

Axiom for Induction

Axiom for induction PA7 For each predicate formula 𝐵(𝑦) with free variable 𝑦 [𝐵(0) ∧ ∀𝑦(𝐵(𝑦) → 𝐵(𝑡(𝑦))] → ∀𝑦𝐵(𝑦)

CS 245 Logic and Computation Fall 2019 16 / 22

slide-17
SLIDE 17

Example 1: Every number is not equal to its successor

Every natural number is not equal to its successor. Prove that ∀𝑦 (¬(𝑡(𝑦) ≈ 𝑦)).

▶ Base Case: Prove that ¬(𝑡(0) ≈ 0)

Which Peano Axiom can we use to prove this?

▶ Induction Step:

Consider some 𝑙 ∈ ℕ. Assume that ¬(𝑡(𝑙) ≈ 𝑙). Prove that ¬(𝑡(𝑡(𝑙)) ≈ 𝑡(𝑙)). Which Peano Axiom can we use to prove this?

CS 245 Logic and Computation Fall 2019 17 / 22

slide-18
SLIDE 18

Example 1: Every number is not equal to its successor

Every natural number is not equal to its successor. Prove that ∀𝑦 (¬(𝑡(𝑦) ≈ 𝑦)). 1.∅ ⊢ ∀𝑦 ¬(𝑡(𝑦) ≈ 0) (𝑄𝐵1) 2.∅ ⊢ ¬(𝑡(0) ≈ 0) (∀−, 1) 3.¬(𝑡(𝑣) ≈ 𝑣), 𝑡(𝑡(𝑣)) ≈ 𝑡(𝑣) ⊢ 𝑡(𝑡(𝑣)) ≈ 𝑡(𝑣) (∈) 4.∅ ⊢ ∀𝑦 ∀𝑧 (𝑡(𝑦) ≈ 𝑡(𝑧) → 𝑦 ≈ 𝑧) (𝑄𝐵2) 5.∅ ⊢ 𝑡(𝑡(𝑣)) ≈ 𝑡(𝑣) → 𝑡(𝑣) ≈ 𝑣 (∀−, 4) 6.¬(𝑡(𝑣) ≈ 𝑣), 𝑡(𝑡(𝑣)) ≈ 𝑡(𝑣) ⊢ 𝑡(𝑡(𝑣)) ≈ 𝑡(𝑣) → 𝑡(𝑣) ≈ 𝑣 (+, 5) 7.¬(𝑡(𝑣) ≈ 𝑣), 𝑡(𝑡(𝑣)) ≈ 𝑡(𝑣) ⊢ 𝑡(𝑣) ≈ 𝑣 (→ −, 6, 3) 8.¬(𝑡(𝑣) ≈ 𝑣), 𝑡(𝑡(𝑣)) ≈ 𝑡(𝑣) ⊢ ¬(𝑡(𝑣) ≈ 𝑣) (∈) 9.¬(𝑡(𝑣) ≈ 𝑣) ⊢ ¬(𝑡(𝑡(𝑣)) ≈ 𝑡(𝑣)) (¬+, 7, 8) 10.∅ ⊢ ¬(𝑡(𝑣) ≈ 𝑣) → ¬(𝑡(𝑡(𝑣)) ≈ 𝑡(𝑣)) (→ +, 9) 11.∅ ⊢ ∀𝑦(¬(𝑡(𝑣) ≈ 𝑣) → ¬(𝑡(𝑡(𝑣)) ≈ 𝑡(𝑣))) (10, ∀+, no 𝑣 elsewhere)

CS 245 Logic and Computation Fall 2019 18 / 22

slide-19
SLIDE 19

Example 1: Every number is not equal to its successor

Every natural number is not equal to its successor. Prove that ∀𝑦(¬(𝑡(𝑦) ≈ 𝑦)). (continued) 12.∅ ⊢ ¬(𝑡(𝑣) ≈ 𝑣) ∧ ∀𝑦(¬(𝑡(𝑣) ≈ 𝑣) → ¬(𝑡(𝑡(𝑣)) ≈ 𝑡(𝑣))) (∧+, 2, 11) 13.∅ ⊢ ¬(𝑡(𝑣) ≈ 𝑣) ∧ ∀𝑦(¬(𝑡(𝑣) ≈ 𝑣) → ¬(𝑡(𝑡(𝑣)) ≈ 𝑡(𝑣))) → ∀𝑦 ¬(𝑡(𝑦) ≈ 𝑦) (𝑄𝐵7, with 𝐵(𝑦) ∶‶ ¬(𝑡(𝑦) ≈ 𝑦)″) 14.∅ ⊢ ∀𝑦 ¬(𝑡(𝑦) ≈ 𝑦) (→ −, 12, 13)

CS 245 Logic and Computation Fall 2019 19 / 22

slide-20
SLIDE 20

Example 2: Every non-zero natural number has a predecessor

Every non-zero natural number has a predecessor. Prove that ∀𝑦(𝑦 ≈ 0 ∨ ∃𝑧 (𝑡(𝑧) ≈ 𝑦)) Base case: 1.∅ ⊢ 0 ≈ 0 (≈ +) 2.∅ ⊢ 0 ≈ 0 ∨ ∃𝑧(𝑡(𝑧) ≈ 0) (∨+, 1) Induction step: 3.𝑙 ≈ 0 ⊢ 𝑙 ≈ 0 (∈) 4.∅ ⊢ 𝑡(𝑙) ≈ 𝑡(𝑙) (prove separately using (≈ +)) 5.𝑙 ≈ 0 ⊢ 𝑡(𝑙) ≈ 𝑡(𝑙) (+, 4) 6.𝑙 ≈ 0 ⊢ 𝑡(0) ≈ 𝑡(𝑙) (≈ −) with 𝐵(𝑦) ∶‶ 𝑡(𝑦) ≈ 𝑡(𝑙)″ 7.𝑙 ≈ 0 ⊢ ∃𝑧(𝑡(𝑧) ≈ 𝑡(𝑙)) ((∃+), 6) 8.𝑙 ≈ 0 ⊢ (𝑡(𝑙) ≈ 0) ∨ ∃𝑧(𝑡(𝑧) ≈ 𝑡(𝑙)) (∨+, 8)

CS 245 Logic and Computation Fall 2019 20 / 22

slide-21
SLIDE 21

Example 2:

Inductive step, second case of (∨−) 9.𝑡(𝑣) ≈ 𝑙 ⊢ 𝑡(𝑣) ≈ 𝑙 (∈) 10.𝑡(𝑣) ≈ 𝑙 ⊢ 𝑙 ≈ 𝑡(𝑣) (9, symmetry of ≈) 11.𝑡(𝑣) ≈ 𝑙 ⊢ 𝑡(𝑙) ≈ 𝑡(𝑙) (4, +) 12.𝑡(𝑣) ≈ 𝑙 ⊢ 𝑡(𝑡(𝑣)) ≈ 𝑡(𝑙) (11, 10, (≈ −), 𝐵(𝑦) ∶ 𝑡(𝑦) ≈ 𝑡(𝑙)) 13.𝑡(𝑣) ≈ 𝑙 ⊢ ∃𝑧(𝑡(𝑧) ≈ 𝑡(𝑙)) (12, ∃+) 14.𝑡(𝑣) ≈ 𝑙 ⊢ 𝑡(𝑙) ≈ 0 ∨ ∃𝑧(𝑡(𝑧) ≈ 𝑡(𝑙)) (13, ∨+) 15.∃𝑧(𝑡(𝑧) ≈ 𝑙) ⊢ 𝑡(𝑙) ≈ 0 ∨ ∃𝑧(𝑡(𝑧) ≈ 𝑡(𝑙)) (14, ∃−), no 𝑣 elsewhere) 16.𝑙 ≈ 0 ∨ ∃𝑧(𝑡(𝑧) ≈ 𝑙) ⊢ 𝑡(𝑙) ≈ 0 ∨ ∃𝑧(𝑡(𝑧) ≈ 𝑡(𝑙)) (8, 15, ∨−) 17.∅ ⊢ 𝑙 ≈ 0 ∨ ∃𝑧(𝑡(𝑧) ≈ 𝑙) → 𝑡(𝑙) ≈ 0 ∨ ∃𝑧(𝑡(𝑧) ≈ 𝑡(𝑙))(16, → +) 18.∅ ⊢ ∀𝑦(𝑄(𝑦) → 𝑄(𝑡(𝑦))) (17, ∀+, no 𝑙 elsewhere) 19.∅ ⊢ 𝑄(0) ∧ ∀𝑦(𝑄(𝑦) → 𝑄(𝑡(𝑦))) (18, 2, ∧+) 20.∅ ⊢ 𝑄(0) ∧ ∀𝑦(𝑄(𝑦) → 𝑄(𝑡(𝑦))) → ∀𝑦𝑄(𝑦) (𝑄𝐵7) 21.∅ ⊢ ∀𝑦(𝑦 ≈ 0 ∨ ∃𝑧(𝑡(𝑧) ≈ 𝑦)) (20, 19, → −)

CS 245 Logic and Computation Fall 2019 21 / 22

slide-22
SLIDE 22

Revisiting the learning goals

By the end of this lecture, you should be able to:

▶ Write a formal deduction proof using rules for equality. ▶ Write a formal deduction proof for properties of natural

numbers using formal deduction rules and Peano axioms.

CS 245 Logic and Computation Fall 2019 22 / 22