import MyNat.Addition
import MyNat.Multiplication
import MultiplicationWorld.Level1
import MultiplicationWorld.Level6
namespace MyNat
open MyNat
Multiplication World
Level 8: mul_comm
Finally, the boss level of multiplication world. But you are well-prepared for it -- you have
zero_mul
and mul_zero
, as well as succ_mul
and mul_succ
. After this level you can of course
throw away one of each pair if you like, but I would recommend you hold on to them, sometimes it's
convenient to have exactly the right tools to do a job.
Lemma
Multiplication is commutative.
lemmamul_comm (mul_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 = 0a: MyNat
zeroa * 0 = 0a: MyNat
zeroa * 0 = 0a: MyNat
zero0 = 0Goals 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
succa * succ b = b * a + aa, b: MyNat
ih: a * b = b * a
succa * succ b = b * a + aa, b: MyNat
ih: a * b = b * a
succa * succ b = b * a + aa, b: MyNat
ih: a * b = b * a
succa * succ b = a * b + aa, b: MyNat
ih: a * b = b * a
succa * succ b = a * b + aa, b: MyNat
ih: a * b = b * a
succa * succ b = a * b + aa, b: MyNat
ih: a * b = b * a
succa * b + a = a * b + aGoals accomplished! 🐙
You've now proved that the natural numbers are a commutative semiring! That's the last collectible in Multiplication World.
-- instance MyNat.comm_semiring : comm_semiring MyNat := by structure_helper
-- BUGBUG
But don't leave multiplication just yet -- prove mul_left_comm
, the last
level of the world, and then we can beef up the power of simp
.
On to Level 9