NNG progress
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import NNG.Metadata
|
||||
--import NNG.MyNat.Power
|
||||
import NNG.Levels.Multiplication
|
||||
import NNG.MyNat.Power
|
||||
|
||||
Game "NNG"
|
||||
World "Power"
|
||||
@@ -8,18 +8,12 @@ Title "zero_pow_zero"
|
||||
|
||||
open MyNat
|
||||
|
||||
Introduction
|
||||
"
|
||||
|
||||
"
|
||||
|
||||
Statement
|
||||
Statement MyNat.zero_pow_zero
|
||||
"$0 ^ 0 = 1$"
|
||||
: (0 : ℕ) ^ 0 = (1 : ℕ) := by -- (0 : ℕ) ^ (0 : ℕ) = 1 := by
|
||||
trivial
|
||||
|
||||
Conclusion
|
||||
"
|
||||
|
||||
"
|
||||
: (0 : ℕ) ^ 0 = 1 := by
|
||||
rw [pow_zero]
|
||||
rfl
|
||||
|
||||
NewLemma MyNat.pow_zero MyNat.pow_succ
|
||||
NewDefinition Pow
|
||||
LemmaTab "Pow"
|
||||
|
||||
@@ -1,24 +1,17 @@
|
||||
import NNG.Metadata
|
||||
import NNG.MyNat.Addition
|
||||
import NNG.Levels.Power.Level_1
|
||||
|
||||
Game "NNG"
|
||||
World "Power"
|
||||
Level 2
|
||||
Title ""
|
||||
Title "zero_pow_succ"
|
||||
|
||||
open MyNat
|
||||
|
||||
Introduction
|
||||
"
|
||||
Statement MyNat.zero_pow_succ
|
||||
"For all naturals $m$, $0 ^{\\operatorname{succ} (m)} = 0$."
|
||||
(m : ℕ) : (0 : ℕ) ^ (succ m) = 0 := by
|
||||
rw [pow_succ]
|
||||
rw [mul_zero]
|
||||
rfl
|
||||
|
||||
"
|
||||
|
||||
Statement
|
||||
""
|
||||
: true := by
|
||||
trivial
|
||||
|
||||
Conclusion
|
||||
"
|
||||
|
||||
"
|
||||
LemmaTab "Pow"
|
||||
|
||||
@@ -1,24 +1,19 @@
|
||||
import NNG.Metadata
|
||||
import NNG.MyNat.Addition
|
||||
import NNG.Levels.Power.Level_2
|
||||
|
||||
Game "NNG"
|
||||
World "Power"
|
||||
Level 3
|
||||
Title ""
|
||||
Title "pow_one"
|
||||
|
||||
open MyNat
|
||||
|
||||
Introduction
|
||||
"
|
||||
Statement MyNat.pow_one
|
||||
"For all naturals $a$, $a ^ 1 = a$."
|
||||
(a : ℕ) : a ^ 1 = a := by
|
||||
rw [one_eq_succ_zero]
|
||||
rw [pow_succ]
|
||||
rw [pow_zero]
|
||||
rw [one_mul]
|
||||
rfl
|
||||
|
||||
"
|
||||
|
||||
Statement
|
||||
""
|
||||
: true := by
|
||||
trivial
|
||||
|
||||
Conclusion
|
||||
"
|
||||
|
||||
"
|
||||
LemmaTab "Pow"
|
||||
|
||||
@@ -1,25 +1,22 @@
|
||||
import NNG.Metadata
|
||||
import NNG.MyNat.Addition
|
||||
import NNG.Levels.Power.Level_3
|
||||
|
||||
|
||||
Game "NNG"
|
||||
World "Power"
|
||||
Level 4
|
||||
Title ""
|
||||
Title "one_pow"
|
||||
|
||||
open MyNat
|
||||
|
||||
Introduction
|
||||
"
|
||||
Statement MyNat.one_pow
|
||||
"For all naturals $m$, $1 ^ m = 1$."
|
||||
(m : ℕ) : (1 : ℕ) ^ m = 1 := by
|
||||
induction m with t ht
|
||||
· rw [pow_zero]
|
||||
rfl
|
||||
· rw [pow_succ]
|
||||
rw [ht]
|
||||
rw [mul_one]
|
||||
rfl
|
||||
|
||||
"
|
||||
|
||||
Statement
|
||||
""
|
||||
: true := by
|
||||
trivial
|
||||
|
||||
Conclusion
|
||||
"
|
||||
|
||||
"
|
||||
|
||||
LemmaTab "Pow"
|
||||
|
||||
@@ -1,24 +1,20 @@
|
||||
import NNG.Metadata
|
||||
import NNG.MyNat.Addition
|
||||
import NNG.Levels.Power.Level_4
|
||||
|
||||
|
||||
Game "NNG"
|
||||
World "Power"
|
||||
Level 5
|
||||
Title ""
|
||||
Title "pow_add"
|
||||
|
||||
open MyNat
|
||||
|
||||
Introduction
|
||||
"
|
||||
Statement MyNat.pow_add
|
||||
"For all naturals $a$, $m$, $n$, we have $a^{m + n} = a ^ m a ^ n$."
|
||||
(a m n : ℕ) : a ^ (m + n) = a ^ m * a ^ n := by
|
||||
induction n with t ht
|
||||
· rw [add_zero, pow_zero, mul_one]
|
||||
rfl
|
||||
· rw [add_succ, pow_succ, pow_succ, ht, mul_assoc]
|
||||
rfl
|
||||
|
||||
"
|
||||
|
||||
Statement
|
||||
""
|
||||
: true := by
|
||||
trivial
|
||||
|
||||
Conclusion
|
||||
"
|
||||
|
||||
"
|
||||
LemmaTab "Pow"
|
||||
|
||||
@@ -1,24 +1,30 @@
|
||||
import NNG.Metadata
|
||||
import NNG.MyNat.Addition
|
||||
import NNG.Levels.Power.Level_5
|
||||
|
||||
Game "NNG"
|
||||
World "Power"
|
||||
Level 6
|
||||
Title ""
|
||||
Title "mul_pow"
|
||||
|
||||
open MyNat
|
||||
|
||||
Introduction
|
||||
"
|
||||
|
||||
You might find the tip at the end of level 9 of Multiplication World
|
||||
useful in this one. You can go to the main menu and pop back into
|
||||
Multiplication World and take a look -- you won't lose any of your
|
||||
proofs.
|
||||
"
|
||||
|
||||
Statement
|
||||
""
|
||||
: true := by
|
||||
trivial
|
||||
Statement MyNat.mul_pow
|
||||
"For all naturals $a$, $b$, $n$, we have $(ab) ^ n = a ^ nb ^ n$."
|
||||
(a b n : ℕ) : (a * b) ^ n = a ^ n * b ^ n := by
|
||||
induction n with t Ht
|
||||
· rw [pow_zero, pow_zero, pow_zero, mul_one]
|
||||
rfl
|
||||
· rw [pow_succ, pow_succ, pow_succ, Ht]
|
||||
-- simp
|
||||
repeat rw [mul_assoc]
|
||||
rw [mul_comm a (_ * b), mul_assoc, mul_comm b a]
|
||||
rfl
|
||||
|
||||
Conclusion
|
||||
"
|
||||
|
||||
"
|
||||
LemmaTab "Pow"
|
||||
|
||||
@@ -1,24 +1,35 @@
|
||||
import NNG.Metadata
|
||||
import NNG.MyNat.Addition
|
||||
import NNG.Levels.Power.Level_6
|
||||
|
||||
Game "NNG"
|
||||
World "Power"
|
||||
Level 7
|
||||
Title ""
|
||||
Title "pow_pow"
|
||||
|
||||
open MyNat
|
||||
|
||||
Introduction
|
||||
"
|
||||
|
||||
Boss level! What will the collectible be?
|
||||
"
|
||||
|
||||
Statement
|
||||
""
|
||||
: true := by
|
||||
trivial
|
||||
Statement MyNat.pow_pow
|
||||
"For all naturals $a$, $m$, $n$, we have $(a ^ m) ^ n = a ^ {mn}$."
|
||||
(a m n : ℕ) : (a ^ m) ^ n = a ^ (m * n) := by
|
||||
induction n with t Ht
|
||||
· rw [mul_zero, pow_zero, pow_zero]
|
||||
rfl
|
||||
· rw [pow_succ, Ht, mul_succ, pow_add]
|
||||
rfl
|
||||
|
||||
LemmaTab "Pow"
|
||||
|
||||
Conclusion
|
||||
"
|
||||
Apparently Lean can't find a collectible, even though you feel like you
|
||||
just finished power world so you must have proved *something*. What should the
|
||||
collectible for this level be called?
|
||||
|
||||
But what is this? It's one of those twists where there's another
|
||||
boss after the boss you thought was the final boss! Go to the next
|
||||
level!
|
||||
"
|
||||
|
||||
@@ -1,22 +1,49 @@
|
||||
import NNG.Metadata
|
||||
import NNG.MyNat.Addition
|
||||
import NNG.Levels.Power.Level_7
|
||||
-- import Mathlib.Tactic.Ring
|
||||
|
||||
Game "NNG"
|
||||
World "Power"
|
||||
Level 8
|
||||
Title ""
|
||||
Title "add_squared"
|
||||
|
||||
open MyNat
|
||||
|
||||
Introduction
|
||||
"
|
||||
[final boss music]
|
||||
|
||||
You see something written on the stone dungeon wall:
|
||||
```
|
||||
by
|
||||
rw [two_eq_succ_one]
|
||||
rw [one_eq_succ_zero]
|
||||
repeat rw [pow_succ]
|
||||
…
|
||||
```
|
||||
|
||||
and you can't make out the last two lines because there's a kind
|
||||
of thing in the way that will magically disappear
|
||||
but only when you've beaten the boss.
|
||||
"
|
||||
|
||||
Statement
|
||||
""
|
||||
: true := by
|
||||
trivial
|
||||
Statement MyNat.add_squared
|
||||
"For all naturals $a$ and $b$, we have
|
||||
$$(a+b)^2=a^2+b^2+2ab.$$"
|
||||
(a b : ℕ) : (a + b) ^ 2 = a ^ 2 + b ^ 2 + 2 * a * b := by
|
||||
rw [two_eq_succ_one]
|
||||
rw [one_eq_succ_zero]
|
||||
repeat rw [pow_succ]
|
||||
repeat rw [pow_zero]
|
||||
--ring
|
||||
repeat rw [one_mul]
|
||||
rw [add_mul, mul_add, mul_add, mul_comm b a]
|
||||
rw [succ_mul, succ_mul, zero_mul, zero_add, add_mul]
|
||||
repeat rw [add_assoc]
|
||||
rw [add_comm _ (b * b), ← add_assoc _ (b*b), add_comm _ (b*b), add_assoc]
|
||||
rfl
|
||||
|
||||
NewLemma MyNat.two_eq_succ_one
|
||||
LemmaTab "Pow"
|
||||
|
||||
Conclusion
|
||||
"
|
||||
|
||||
Reference in New Issue
Block a user