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_7.lean

47 lines
1.2 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_6
Game "NNG"
World "Multiplication"
Level 7
Title "add_mul"
open MyNat
Introduction
"
We proved `mul_add` already, but because we don't have commutativity yet
we also need to prove `add_mul`. We have a bunch of tools now, so this won't
be too hard. You know what -- you can do this one by induction on any of
the variables. Try them all! Which works best? If you can't face
doing all the commutativity and associativity, remember the high-powered
`simp` tactic mentioned at the bottom of Addition World level 6,
which will solve any puzzle which needs only commutativity
and associativity. If your goal looks like `a + (b + c) = c + b + a` or something,
don't mess around doing it explicitly with `add_comm` and `add_assoc`,
just try `simp`.
"
Statement MyNat.add_mul
"Addition is distributive over multiplication.
In other words, for all natural numbers $a$, $b$ and $t$, we have
$(a + b) \times t = at + bt$."
(a b t : ) : (a + b) * t = a * t + b * t := by
induction b with d hd
· rw [zero_mul]
rw [add_zero]
rw [add_zero]
rfl
· rw [add_succ]
rw [succ_mul]
rw [hd]
rw [succ_mul]
rw [add_assoc]
rfl
LemmaTab "Mul"
Conclusion
"
"