You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lean4game/server/nng/NNG/Levels/Multiplication/Level_8.lean

46 lines
1.1 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import NNG.Levels.Multiplication.Level_7
Game "NNG"
World "Multiplication"
Level 8
Title "mul_comm"
open MyNat
Introduction
"
Finally, the boss level of multiplication world. But (assuming you
didn't cheat) 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.
"
Statement MyNat.mul_comm
"Multiplication is commutative."
(a b : ) : a * b = b * a := by
induction b with d hd
· rw [zero_mul]
rw [mul_zero]
rfl
· rw [succ_mul]
rw [← hd]
rw [mul_succ]
rfl
LemmaTab "Mul"
Conclusion
"
You've now proved that the natural numbers are a commutative semiring!
That's the last collectible in Multiplication World.
* `CommSemiring `
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`.
"
-- TODO: collectible
-- instance mynat.comm_semiring : comm_semiring mynat := by structure_helper