IUM lectures on Numbers

2.9. Consequences of these new results

The results above are the first theorems that we have seen in this chapter of the form "if some equation is true, then some other equation is also true"; results like commutativity and associativity of addition and multiplication were of the form "this equation is always true", and hence logically simpler. Let's prove some other results of the form "if some equation is true, then some other equation is also true", using Peano's last two axioms S(x)=S(y)\implies x=y and S(x)\neq 0.

Theorem 18

Say x, y and n are natural numbers.

  1. If x+n=y+n then x=y (the cancellation property for addition);

  2. If x+n=n, then x=0.

Proof

  1. Fix x and y, and let's do induction on n. More precisely, we let P_n denote the statement "if x+n=y+n then x=y" and we prove P_n for all n, by induction.

    The base case is easy: if x+0=y+0 then x=y because x+0=x and y+0=y by definition of addition. For the inductive step, we assume "if x+k=y+k then x=y" and we have to prove "if x+S(k)=y+S(k) then x=y". So let's assume x+S(k)=y+S(k); by definition of addition we deduce S(x+k)=S(y+k). By injectivity of S (Peano's second extra axiom, which we proved above) we deduce x+k=y+k. And finally by our inductive hypothesis we conclude x=y.

  2. Setting y=0 in the previous part gives x+n=0+n\implies x=0, and because we know 0+n=n we're done.

Lemma add_right_cancel "Addition is cancellative" Given: {x y n : ℕ} Assume: Conclusion: x + n = y + n → x = y Proof: x:ℕy:ℕ⊢ x + 0 = y + 0 ⇒ x = yx:ℕy:ℕ⊢ ∀ (k : ℕ), (x + k = y + k ⇒ x = y) ⇒ x + succ k = y + succ k ⇒ x = y x:ℕy:ℕ⊢ x + 0 = y + 0 ⇒ x = y x:ℕy:ℕh:x + 0 = y + 0⊢ x = y Calc x = x + 0 All goals completed! 🐙 All goals completed! 🐙 _ = y + 0 from h _ = y All goals completed! 🐙 All goals completed! 🐙 x:ℕy:ℕ⊢ ∀ (k : ℕ), (x + k = y + k ⇒ x = y) ⇒ x + succ k = y + succ k ⇒ x = y x:ℕy:ℕk:ℕ⊢ (x + k = y + k ⇒ x = y) ⇒ x + succ k = y + succ k ⇒ x = y x:ℕy:ℕk:ℕIH:x + k = y + k ⇒ x = y⊢ x + succ k = y + succ k ⇒ x = y x:ℕy:ℕk:ℕIH:x + k = y + k ⇒ x = yh1:x + succ k = y + succ k⊢ x = y Fact h2 : succ (x + k) = succ (y + k) by Calc succ (x + k) = x + succ k All goals completed! 🐙 All goals completed! 🐙 _ = y + succ k from h1 _ = succ (y + k) All goals completed! 🐙 All goals completed! 🐙 x:ℕy:ℕk:ℕIH:x + k = y + k ⇒ x = yh1:x + succ k = y + succ kh2:succ (x + k) = succ (y + k)h3:x + k = y + k⊢ x = y All goals completed! 🐙 QEDLemma add_left_eq_self "Only zero leaves a number unchanged when added" Given: {x n : ℕ} Assume: (h : x + n = n) Conclusion: x = 0 Proof: Fact h' : x + n = 0 + n by All goals completed! 🐙 All goals completed! 🐙 QED

Theorem 19

Suppose x and y are natural numbers and x+y=0. Then x=y=0.

Proof

Let's first prove that y=0. We showed in Theorem 17 that y was either 0 or a successor. If y=0 then we are done. Otherwise we must have y=S(n) for some natural number n. In this case 0=x+y=x+S(n)=S(x+n), but on the other hand, from Peano's first extra axiom, 0\ne S(x+n). This is a contradiction! So the y=S(n) case is ruled out.

We deduce that y=0, and hence x+0=0 which implies that x=0 by definition of addition.

Lemma add_left_eq_zero "If x + y = 0 then y = 0" Given: {x y : ℕ} Assume: (h : x + y = 0) Conclusion: y = 0 Proof: x:ℕy:ℕh:x + y = 0hy₀:y = 0 ∨ ∃ n, y = succ n⊢ y = 0 x:ℕy:ℕh:x + y = 0hy₀:y = 0 ∨ ∃ n, y = succ n⊢ y = 0 ⇒ y = 0x:ℕy:ℕh:x + y = 0hy₀:y = 0 ∨ ∃ n, y = succ n⊢ (∃ n, y = succ n) ⇒ y = 0 x:ℕy:ℕh:x + y = 0hy₀:y = 0 ∨ ∃ n, y = succ n⊢ y = 0 ⇒ y = 0 x:ℕy:ℕh:x + y = 0hy₀:y = 0 ∨ ∃ n, y = succ nhy:y = 0⊢ y = 0 All goals completed! 🐙 x:ℕy:ℕh:x + y = 0hy₀:y = 0 ∨ ∃ n, y = succ n⊢ (∃ n, y = succ n) ⇒ y = 0 x:ℕy:ℕh:x + y = 0hy₀:y = 0 ∨ ∃ n, y = succ nhy:∃ n, y = succ n⊢ y = 0 x:ℕy:ℕh:x + y = 0hy₀:y = 0 ∨ ∃ n, y = succ nhy:∃ n, y = succ nn:ℕhyn:y = succ n⊢ y = 0 Fact hxn : 0 = succ (x + n) by Calc 0 = x + y from h _ = x + succ n from hyn _ = succ (x + n) All goals completed! 🐙 All goals completed! 🐙 x:ℕy:ℕh:x + y = 0hy₀:y = 0 ∨ ∃ n, y = succ nhy:∃ n, y = succ nn:ℕhyn:y = succ nhxn:0 = succ (x + n)hxn':0 ≠ succ (x + n)⊢ y = 0 All goals completed! 🐙 QEDLemma add_right_eq_zero "If x + y = 0 then x = 0" Given: {x y : ℕ} Assume: (h : x + y = 0) Conclusion: x = 0 Proof: x:ℕy:ℕh:x + y = 0hy:y = 0⊢ x = 0 Calc x = x + 0 All goals completed! 🐙 All goals completed! 🐙 _ = x + y from hy _ = 0 from h QED