import MyNat.Definition
import MyNat.Addition -- add_zero
import AdvancedAdditionWorld.Level1 -- succ_inj
namespace MyNat
open MyNat

Advanced Addition World

Level 5: add_right_cancel

The theorem add_right_cancel is the theorem that you can cancel on the right when you're doing addition -- if a + t = b + t then a = b. After intro h I'd recommend induction on t. Don't forget that rw [add_zero] at h can be used to do rewriting of hypotheses rather than the goal.

Theorem

On the set of natural numbers, addition has the right cancellation property. In other words, if there are natural numbers a, b and c such that a + t = b + t then we have a = b.

theorem 
add_right_cancel: ∀ (a t b : MyNat), a + t = b + t → a = b
add_right_cancel
(
a: MyNat
a
t: MyNat
t
b: MyNat
b
:
MyNat: Type
MyNat
) :
a: MyNat
a
+
t: MyNat
t
=
b: MyNat
b
+
t: MyNat
t
a: MyNat
a
=
b: MyNat
b
:=
a, t, b: MyNat

a + t = b + t a = b
a, t, b: MyNat
h: a + t = b + t

a = b
a, t, b: MyNat
h: a + t = b + t

a = b
a, b: MyNat
h: a + zero = b + zero

zero
a = b
a, b: MyNat
h: a + zero = b + zero

zero
a = b
a, b: MyNat
h: a + 0 = b + 0

zero
a = b
a, b: MyNat
h: a + 0 = b + 0

zero
a = b
a, b: MyNat
h: a + 0 = b + 0

zero
a = b
a, b: MyNat
h: a + 0 = b + 0

zero
a = b
a, b: MyNat
h: a = b + 0

zero
a = b
a, b: MyNat
h: a = b + 0

zero
a = b
a, b: MyNat
h: a = b + 0

zero
a = b
a, b: MyNat
h: a = b + 0

zero
a = b
a, b: MyNat
h: a = b

zero
a = b
a, b: MyNat
h: a = b

zero
a = b
a, b: MyNat
h: a = b

zero
a = b

Goals accomplished! 🐙
a, b, d: MyNat
ih: a + d = b + d a = b
h: a + succ d = b + succ d

succ
a = b
a, b, d: MyNat
ih: a + d = b + d a = b
h: a + succ d = b + succ d

succ
a + d = b + d
a, b, d: MyNat
ih: a + d = b + d a = b
h: a + succ d = b + succ d

succ
a + d = b + d
a, b, d: MyNat
ih: a + d = b + d a = b
h: succ (a + d) = b + succ d

succ
a + d = b + d
a, b, d: MyNat
ih: a + d = b + d a = b
h: succ (a + d) = b + succ d

succ
a + d = b + d
a, b, d: MyNat
ih: a + d = b + d a = b
h: succ (a + d) = b + succ d

succ
a + d = b + d
a, b, d: MyNat
ih: a + d = b + d a = b
h: succ (a + d) = b + succ d

succ
a + d = b + d
a, b, d: MyNat
ih: a + d = b + d a = b
h: succ (a + d) = succ (b + d)

succ
a + d = b + d
a, b, d: MyNat
ih: a + d = b + d a = b
h: succ (a + d) = succ (b + d)

succ
a + d = b + d
a, b, d: MyNat
ih: a + d = b + d a = b
h: succ (a + d) = succ (b + d)

succ
a + d = b + d

Goals accomplished! 🐙

Next up Level 6