import MyNat.Addition
import MyNat.Multiplication
import MultiplicationWorld.Level5
import MultiplicationWorld.Level8
namespace MyNat
open MyNat
Multiplication World
Level 9: mul_left_comm
You are equipped with
mul_assoc (a b c : MyNat) : (a * b) * c = a * (b * c)
mul_comm (a b : MyNat) : a * b = b * a
Re-read the docs for rw
so you know all the tricks.
You can see them in the Tactics section on the left.
Lemma
For all natural numbers a
b
and c
, we have a(bc) = b(ac)
lemmamul_left_comm (mul_left_comm: ∀ (a b c : MyNat), a * (b * c) = b * (a * c)aa: MyNatbb: MyNatc :c: MyNatMyNat) :MyNat: Typea * (a: MyNatb *b: MyNatc) =c: MyNatb * (b: MyNata *a: MyNatc) :=c: MyNata, b, c: MyNata * (b * c) = b * (a * c)a, b, c: MyNata * (b * c) = b * (a * c)a, b, c: MyNata * b * c = b * (a * c)a, b, c: MyNata * b * c = b * (a * c)a, b, c: MyNata * b * c = b * (a * c)a, b, c: MyNatb * a * c = b * (a * c)a, b, c: MyNatb * a * c = b * (a * c)a, b, c: MyNatb * a * c = b * (a * c)a, b, c: MyNatb * (a * c) = b * (a * c)Goals accomplished! 🐙
And now you can teach the simp
tactic these new tricks:
attribute [simp] mul_assoc: ∀ (a b c : MyNat), a * b * c = a * (b * c)
mul_assoc mul_comm: ∀ (a b : MyNat), a * b = b * a
mul_comm mul_left_comm: ∀ (a b c : MyNat), a * (b * c) = b * (a * c)
mul_left_comm
and all of a sudden Lean can automatically do levels which are very boring for a human, for example:
example (example: ∀ (a b c d e : MyNat), a * b * c * d * e = c * (b * e * a) * daa: MyNatbb: MyNatcc: MyNatdd: MyNate :e: MyNatMyNat) : (((MyNat: Typea*a: MyNatb)*b: MyNatc)*c: MyNatd)*d: MyNate=(e: MyNatc*((c: MyNatb*b: MyNate)*e: MyNata))*a: MyNatd :=d: MyNata, b, c, d, e: MyNata * b * c * d * e = c * (b * e * a) * dGoals accomplished! 🐙
If you feel like attempting Advanced Multiplication world you'll have to do Function World and the Proposition Worlds first. These worlds assume a certain amount of mathematical maturity (perhaps 1st year undergraduate level).
Your other possibility is Power World.