import MyNat.Addition -- imports addition.
import AdditionWorld.Level1 -- zero_add
import AdditionWorld.Level3 -- succ_add
namespace MyNat
open MyNat
Addition World
Level 4: add_comm
In this level, you'll prove that addition is commutative.
Lemma
On the set of natural numbers, addition is commutative.
In other words, for all natural numbers a
and b
, we have a + b = b + a.
lemmaadd_comm (add_comm: ∀ (a b : MyNat), a + b = b + aaa: MyNatb :b: MyNatMyNat) :MyNat: Typea +a: MyNatb =b: MyNatb +b: MyNata :=a: MyNata, b: MyNata + b = b + aa, b: MyNata + b = b + aa: MyNat
zeroa + zero = zero + aa: MyNat
zeroa + zero = zero + aa: MyNat
zeroa + 0 = 0 + aa: MyNat
zeroa + 0 = 0 + aa: MyNat
zeroa + 0 = 0 + aa: MyNat
zeroa = 0 + aa: MyNat
zeroa = 0 + aa: MyNat
zeroa = 0 + aa: MyNat
zeroa = aGoals accomplished! 🐙a, b: MyNat
ih: a + b = b + a
succa + succ b = succ b + aa, b: MyNat
ih: a + b = b + a
succa + succ b = succ b + aa, b: MyNat
ih: a + b = b + a
succsucc (a + b) = succ b + aa, b: MyNat
ih: a + b = b + a
succsucc (a + b) = succ b + aa, b: MyNat
ih: a + b = b + a
succsucc (a + b) = succ b + aa, b: MyNat
ih: a + b = b + a
succsucc (b + a) = succ b + aa, b: MyNat
ih: a + b = b + a
succsucc (b + a) = succ b + aa, b: MyNat
ih: a + b = b + a
succsucc (b + a) = succ b + aa, b: MyNat
ih: a + b = b + a
succsucc (b + a) = succ (b + a)Goals accomplished! 🐙
If you are keeping up so far then nice! You're nearly ready to make a choice: Multiplication World or Function World. But there are just a couple more useful lemmas in Addition World which you should prove first.
Press on to level 5.