Add -> +, Mul -> * etc in lemma tabs
This commit is contained in:
@@ -30,7 +30,7 @@ will ask us to show that if `0 + d = d` then `0 + succ d = succ d`. Because
|
||||
See if you can do your first induction proof in Lean.
|
||||
"
|
||||
|
||||
LemmaDoc MyNat.zero_add as "zero_add" in "Add" "
|
||||
LemmaDoc MyNat.zero_add as "zero_add" in "+" "
|
||||
`zero_add x` is the proof of `0 + x = x`.
|
||||
|
||||
`zero_add` is a `simp` lemma, because replacing `0 + x` by `x`
|
||||
@@ -86,7 +86,7 @@ goal before you can access the second one.
|
||||
"
|
||||
NewTactic induction
|
||||
|
||||
LemmaTab "Add"
|
||||
LemmaTab "+"
|
||||
|
||||
Conclusion
|
||||
"
|
||||
|
||||
@@ -16,7 +16,7 @@ we have the problem that we are adding `b` to things, so we need
|
||||
to use induction to split into the cases where `b = 0` and `b` is a successor.
|
||||
"
|
||||
|
||||
LemmaDoc MyNat.succ_add as "succ_add" in "Add"
|
||||
LemmaDoc MyNat.succ_add as "succ_add" in "+"
|
||||
"`succ_add a b` is a proof that `succ a + b = succ (a + b)`."
|
||||
|
||||
/--
|
||||
@@ -40,7 +40,7 @@ Statement succ_add (a b : ℕ) : succ a + b = succ (a + b) := by
|
||||
rw [add_succ, add_succ, hd]
|
||||
rfl
|
||||
|
||||
LemmaTab "Add"
|
||||
LemmaTab "+"
|
||||
|
||||
Conclusion "
|
||||
Well done! You now have enough tools to tackle the main boss of this level.
|
||||
|
||||
@@ -15,7 +15,7 @@ Look in your inventory to see the proofs you have available.
|
||||
These should be enough.
|
||||
"
|
||||
|
||||
LemmaDoc MyNat.add_comm as "add_comm" in "Add"
|
||||
LemmaDoc MyNat.add_comm as "add_comm" in "+"
|
||||
"`add_comm x y` is a proof of `x + y = y + x`."
|
||||
|
||||
/-- On the set of natural numbers, addition is commutative.
|
||||
@@ -32,4 +32,4 @@ Statement add_comm (a b : ℕ) : a + b = b + a := by
|
||||
-- Adding this instance to make `ac_rfl` work.
|
||||
instance : Lean.IsCommutative (α := ℕ) (· + ·) := ⟨add_comm⟩
|
||||
|
||||
LemmaTab "Add"
|
||||
LemmaTab "+"
|
||||
|
||||
@@ -19,7 +19,7 @@ Introduction
|
||||
That's true, but we didn't prove it yet. Let's prove it now by induction.
|
||||
"
|
||||
|
||||
LemmaDoc MyNat.add_assoc as "add_assoc" in "Add" "`add_assoc a b c` is a proof
|
||||
LemmaDoc MyNat.add_assoc as "add_assoc" in "+" "`add_assoc a b c` is a proof
|
||||
that `(a + b) + c = a + (b + c)`. Note that in Lean `(a + b) + c` prints
|
||||
as `a + b + c`, because the notation for addition is defined to be left
|
||||
associative. "
|
||||
@@ -42,7 +42,7 @@ Statement add_assoc (a b c : ℕ) : a + b + c = a + (b + c) := by
|
||||
-- Adding this instance to make `ac_rfl` work.
|
||||
instance : Lean.IsAssociative (α := ℕ) (· + ·) := ⟨add_assoc⟩
|
||||
|
||||
LemmaTab "Add"
|
||||
LemmaTab "+"
|
||||
|
||||
Conclusion
|
||||
"
|
||||
|
||||
@@ -23,7 +23,7 @@ will only do rewrites of the form `b + ? = ? + b`, and `rw [add_comm b c]`
|
||||
will only do rewrites of the form `b + c = c + b`.
|
||||
"
|
||||
|
||||
LemmaDoc MyNat.add_right_comm as "add_right_comm" in "Add"
|
||||
LemmaDoc MyNat.add_right_comm as "add_right_comm" in "+"
|
||||
"`add_right_comm a b c` is a proof that `(a + b) + c = (a + c) + b`.
|
||||
|
||||
In Lean, `a + b + c` means `(a + b) + c`, so this result gets displayed
|
||||
@@ -36,7 +36,7 @@ Statement add_right_comm (a b c : ℕ) : a + b + c = a + c + b := by
|
||||
rw [add_comm b, add_assoc]
|
||||
rfl
|
||||
|
||||
LemmaTab "Add"
|
||||
LemmaTab "+"
|
||||
|
||||
Conclusion "
|
||||
You've now seen all the tactics you need to beat the final boss of the game.
|
||||
|
||||
@@ -6,9 +6,9 @@ Title "add_right_cancel"
|
||||
|
||||
namespace MyNat
|
||||
|
||||
LemmaTab "Add"
|
||||
LemmaTab "+"
|
||||
|
||||
LemmaDoc MyNat.add_right_cancel as "add_right_cancel" in "Add" "
|
||||
LemmaDoc MyNat.add_right_cancel as "add_right_cancel" in "+" "
|
||||
|
||||
`add_right_cancel a b n` is the theorem that $a+n=b+n \\implies a=b.$
|
||||
"
|
||||
|
||||
@@ -6,9 +6,9 @@ Title "add_left_cancel"
|
||||
|
||||
namespace MyNat
|
||||
|
||||
LemmaTab "Add"
|
||||
LemmaTab "+"
|
||||
|
||||
LemmaDoc MyNat.add_left_cancel as "add_left_cancel" in "Add" "
|
||||
LemmaDoc MyNat.add_left_cancel as "add_left_cancel" in "+" "
|
||||
|
||||
`add_left_cancel a b n` is the theorem that $n+a=n+b \\implies a=b.$
|
||||
"
|
||||
|
||||
@@ -6,9 +6,9 @@ Title "add_left_eq_self"
|
||||
|
||||
namespace MyNat
|
||||
|
||||
LemmaTab "Add"
|
||||
LemmaTab "+"
|
||||
|
||||
LemmaDoc MyNat.add_left_eq_self as "add_left_eq_self" in "Add" "
|
||||
LemmaDoc MyNat.add_left_eq_self as "add_left_eq_self" in "+" "
|
||||
|
||||
`add_left_eq_self x y` is the theorem that $x + y = y\\implies x=0.$
|
||||
"
|
||||
|
||||
@@ -4,11 +4,11 @@ World "AdvAddition"
|
||||
Level 5
|
||||
Title "add_right_eq_self"
|
||||
|
||||
LemmaTab "Add"
|
||||
LemmaTab "+"
|
||||
|
||||
namespace MyNat
|
||||
|
||||
LemmaDoc MyNat.add_right_eq_self as "add_right_eq_self" in "Add" "
|
||||
LemmaDoc MyNat.add_right_eq_self as "add_right_eq_self" in "+" "
|
||||
|
||||
`add_right_eq_self x y` is the theorem that $x + y = x\\implies y=0.$
|
||||
"
|
||||
|
||||
@@ -82,7 +82,7 @@ hypothesis `hq : Q`.
|
||||
"
|
||||
NewTactic tauto cases
|
||||
|
||||
LemmaDoc MyNat.eq_zero_of_add_right_eq_zero as "eq_zero_of_add_right_eq_zero" in "Add" "
|
||||
LemmaDoc MyNat.eq_zero_of_add_right_eq_zero as "eq_zero_of_add_right_eq_zero" in "+" "
|
||||
A proof that $a+b=0 \\implies a=0$.
|
||||
"
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ World "AdvAddition"
|
||||
Level 7
|
||||
Title "eq_zero_of_add_left_eq_zero"
|
||||
|
||||
LemmaTab "Add"
|
||||
LemmaTab "+"
|
||||
|
||||
namespace MyNat
|
||||
|
||||
@@ -13,7 +13,7 @@ Introduction
|
||||
of using it.
|
||||
"
|
||||
|
||||
LemmaDoc MyNat.eq_zero_of_add_left_eq_zero as "eq_zero_of_add_left_eq_zero" in "Add" "
|
||||
LemmaDoc MyNat.eq_zero_of_add_left_eq_zero as "eq_zero_of_add_left_eq_zero" in "+" "
|
||||
A proof that $a+b=0 \\implies b=0$.
|
||||
"
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import Game.Levels.Algorithm.L04pred
|
||||
import Game.Levels.Algorithm.L05is_zero
|
||||
import Game.Levels.Algorithm.L06succ_ne_succ
|
||||
import Game.Levels.Algorithm.L07decide
|
||||
import Game.Levels.Algorithm.L08decide2
|
||||
|
||||
World "Algorithm"
|
||||
Title "Algorithm World"
|
||||
|
||||
@@ -35,7 +35,7 @@ Statement (a b c d : ℕ) : a + b + (c + d) = a + c + d + b := by
|
||||
rw [add_comm b d]
|
||||
rfl
|
||||
|
||||
LemmaTab "Add"
|
||||
LemmaTab "+"
|
||||
|
||||
Conclusion
|
||||
"
|
||||
|
||||
@@ -26,7 +26,7 @@ introduce Peano's last axiom `zero_ne_succ n`, a proof that `0 ≠ succ n`.
|
||||
To learn about this result, click on it in the list of lemmas on the right.
|
||||
"
|
||||
|
||||
LemmaDoc MyNat.zero_ne_one as "zero_ne_one" in "numerals" "
|
||||
LemmaDoc MyNat.zero_ne_one as "zero_ne_one" in "012" "
|
||||
`zero_ne_one` is a proof of `0 ≠ 1`.
|
||||
"
|
||||
|
||||
|
||||
@@ -33,18 +33,18 @@ are proved by induction from these two basic theorems.
|
||||
|
||||
NewDefinition Mul
|
||||
|
||||
LemmaDoc MyNat.mul_zero as "mul_zero" in "Mul"
|
||||
LemmaDoc MyNat.mul_zero as "mul_zero" in "*"
|
||||
"
|
||||
`mul_zero m` is the proof that `m * 0 = 0`."
|
||||
|
||||
LemmaDoc MyNat.mul_succ as "mul_succ" in "Mul"
|
||||
LemmaDoc MyNat.mul_succ as "mul_succ" in "*"
|
||||
"
|
||||
`mul_succ a b` is the proof that `a * succ b = a * b + a`.
|
||||
"
|
||||
|
||||
NewLemma MyNat.mul_zero MyNat.mul_succ
|
||||
|
||||
LemmaDoc MyNat.mul_one as "mul_one" in "Mul" "
|
||||
LemmaDoc MyNat.mul_one as "mul_one" in "*" "
|
||||
`mul_one m` is the proof that `m * 1 = m`.
|
||||
"
|
||||
|
||||
@@ -56,4 +56,4 @@ Statement mul_one (m : ℕ) : m * 1 = m := by
|
||||
rw [zero_add]
|
||||
rfl
|
||||
|
||||
LemmaTab "Mul"
|
||||
LemmaTab "*"
|
||||
|
||||
@@ -15,7 +15,7 @@ and `zero_mul` (which we don't), so let's
|
||||
start with this.
|
||||
"
|
||||
|
||||
LemmaDoc MyNat.zero_mul as "zero_mul" in "Mul" "
|
||||
LemmaDoc MyNat.zero_mul as "zero_mul" in "*" "
|
||||
`zero_mul x` is the proof that `0 * x = 0`.
|
||||
|
||||
Note: `zero_mul` is a `simp` lemma.
|
||||
|
||||
@@ -19,7 +19,7 @@ home screen by clicking the house icon and then taking a look.
|
||||
You won't lose any progress.
|
||||
"
|
||||
|
||||
LemmaDoc MyNat.succ_mul as "succ_mul" in "Mul" "
|
||||
LemmaDoc MyNat.succ_mul as "succ_mul" in "*" "
|
||||
`succ_mul a b` is the proof that `succ a * b = a * b + b`.
|
||||
|
||||
It could be deduced from `mul_succ` and `mul_comm`, however this argument
|
||||
@@ -43,4 +43,4 @@ Statement succ_mul
|
||||
rw [add_right_comm]
|
||||
rfl
|
||||
|
||||
LemmaTab "Mul"
|
||||
LemmaTab "*"
|
||||
|
||||
@@ -17,7 +17,7 @@ But we'll keep hold of these proofs anyway, because it's convenient
|
||||
to have exactly the right tool for a job.
|
||||
"
|
||||
|
||||
LemmaDoc MyNat.mul_comm as "mul_comm" in "Mul" "
|
||||
LemmaDoc MyNat.mul_comm as "mul_comm" in "*" "
|
||||
`mul_comm` is the proof that multiplication is commutative. More precisely,
|
||||
`mul_comm a b` is the proof that `a * b = b * a`.
|
||||
"
|
||||
@@ -34,4 +34,4 @@ Statement mul_comm
|
||||
rw [mul_succ]
|
||||
rfl
|
||||
|
||||
LemmaTab "Mul"
|
||||
LemmaTab "*"
|
||||
|
||||
@@ -13,7 +13,7 @@ Either by induction, or by using `succ_mul`, or
|
||||
by using commutativity. Which do you think is quickest?
|
||||
"
|
||||
|
||||
LemmaDoc MyNat.one_mul as "one_mul" in "Mul" "
|
||||
LemmaDoc MyNat.one_mul as "one_mul" in "*" "
|
||||
`one_mul m` is the proof `1 * m = m`.
|
||||
"
|
||||
|
||||
@@ -23,4 +23,4 @@ Statement one_mul
|
||||
rw [mul_comm, mul_one]
|
||||
rfl
|
||||
|
||||
LemmaTab "Mul"
|
||||
LemmaTab "*"
|
||||
|
||||
@@ -12,7 +12,7 @@ This level is more important than you think; it plays
|
||||
a useful role when battling a big boss later on.
|
||||
"
|
||||
|
||||
LemmaDoc MyNat.two_mul as "two_mul" in "Mul" "
|
||||
LemmaDoc MyNat.two_mul as "two_mul" in "*" "
|
||||
`two_mul m` is the proof that `2 * m = m + m`.
|
||||
"
|
||||
|
||||
@@ -22,4 +22,4 @@ Statement two_mul
|
||||
rw [two_eq_succ_one, succ_mul, one_mul]
|
||||
rfl
|
||||
|
||||
LemmaTab "Mul"
|
||||
LemmaTab "*"
|
||||
|
||||
@@ -17,7 +17,7 @@ Note that the left hand side contains a multiplication
|
||||
and then an addition.
|
||||
"
|
||||
|
||||
LemmaDoc MyNat.mul_add as "mul_add" in "Mul" "Multiplication distributes
|
||||
LemmaDoc MyNat.mul_add as "mul_add" in "*" "Multiplication distributes
|
||||
over addition on the left.
|
||||
|
||||
`mul_add a b c` is the proof that `a * (b + c) = a * b + a * c`."
|
||||
@@ -38,4 +38,4 @@ Statement mul_add
|
||||
rw [add_succ, mul_succ, hd, mul_succ, add_assoc]
|
||||
rfl
|
||||
|
||||
LemmaTab "Mul"
|
||||
LemmaTab "*"
|
||||
|
||||
@@ -12,7 +12,7 @@ Introduction
|
||||
which avoids it. Can you spot it?
|
||||
"
|
||||
|
||||
LemmaDoc MyNat.add_mul as "add_mul" in "Mul" "
|
||||
LemmaDoc MyNat.add_mul as "add_mul" in "*" "
|
||||
`add_mul a b c` is a proof that $(a+b)c=ac+bc$.
|
||||
"
|
||||
/-- Addition is distributive over multiplication.
|
||||
@@ -23,4 +23,4 @@ Statement add_mul
|
||||
rw [mul_comm, mul_add, mul_comm, mul_comm c]
|
||||
rfl
|
||||
|
||||
LemmaTab "Mul"
|
||||
LemmaTab "*"
|
||||
|
||||
@@ -13,7 +13,7 @@ We now have enough to prove that multiplication is associative,
|
||||
the boss level of multiplication world. Good luck!
|
||||
"
|
||||
|
||||
LemmaDoc MyNat.mul_assoc as "mul_assoc" in "Mul" "
|
||||
LemmaDoc MyNat.mul_assoc as "mul_assoc" in "*" "
|
||||
`mul_assoc a b c` is a proof that `(a * b) * c = a * (b * c)`.
|
||||
|
||||
Note that when Lean says `a * b * c` it means `(a * b) * c`.
|
||||
@@ -37,7 +37,7 @@ Statement mul_assoc
|
||||
rw [mul_add]
|
||||
rfl
|
||||
|
||||
LemmaTab "Mul"
|
||||
LemmaTab "*"
|
||||
|
||||
Conclusion "
|
||||
A passing mathematician notes that you've proved
|
||||
|
||||
@@ -41,7 +41,7 @@ Statement MyNat.mul_left_comm
|
||||
rw [mul_assoc]
|
||||
rfl
|
||||
|
||||
LemmaTab "Mul"
|
||||
LemmaTab "*"
|
||||
|
||||
-- TODO: make simp work:
|
||||
-- attribute [simp] mul_assoc mul_comm mul_left_comm
|
||||
|
||||
@@ -29,14 +29,14 @@ Note in particular that `0 ^ 0 = 1`.
|
||||
|
||||
NewDefinition Pow
|
||||
|
||||
LemmaDoc MyNat.pow_zero as "pow_zero" in "Pow" "
|
||||
LemmaDoc MyNat.pow_zero as "pow_zero" in "^" "
|
||||
`pow_zero a : a ^ 0 = 1` is one of the two axioms
|
||||
defining exponentiation in this game.
|
||||
"
|
||||
|
||||
NewLemma MyNat.pow_zero
|
||||
|
||||
LemmaDoc MyNat.zero_pow_zero as "zero_pow_zero" in "Pow" "
|
||||
LemmaDoc MyNat.zero_pow_zero as "zero_pow_zero" in "^" "
|
||||
Mathematicians sometimes argue that `0 ^ 0 = 0` is also
|
||||
a good convention. But it is not a good convention in this
|
||||
game; all the later levels come out beautifully with the
|
||||
@@ -49,4 +49,4 @@ Statement zero_pow_zero
|
||||
rw [pow_zero]
|
||||
rfl
|
||||
|
||||
LemmaTab "Pow"
|
||||
LemmaTab "^"
|
||||
|
||||
@@ -9,14 +9,14 @@ namespace MyNat
|
||||
Introduction "We've just seen that `0 ^ 0 = 1`, but if `n`
|
||||
is a successor, then `0 ^ n = 0`. We prove that here."
|
||||
|
||||
LemmaDoc MyNat.pow_succ as "pow_succ" in "Pow" "
|
||||
LemmaDoc MyNat.pow_succ as "pow_succ" in "^" "
|
||||
`pow_succ a b : a ^ (succ b) = a ^ b * a` is one of the
|
||||
two axioms defining exponentiation in this game.
|
||||
"
|
||||
|
||||
NewLemma MyNat.pow_succ
|
||||
|
||||
LemmaDoc MyNat.zero_pow_succ as "zero_pow_succ" in "Pow" "
|
||||
LemmaDoc MyNat.zero_pow_succ as "zero_pow_succ" in "^" "
|
||||
Although $0^0=1$ in this game, $0^n=0$ if $n>0$, i.e., if
|
||||
$n$ is a successor.
|
||||
"
|
||||
@@ -28,4 +28,4 @@ Statement zero_pow_succ
|
||||
rw [mul_zero]
|
||||
rfl
|
||||
|
||||
LemmaTab "Pow"
|
||||
LemmaTab "^"
|
||||
|
||||
@@ -6,7 +6,7 @@ Title "pow_one"
|
||||
|
||||
namespace MyNat
|
||||
|
||||
LemmaDoc MyNat.pow_one as "pow_one" in "Pow" "
|
||||
LemmaDoc MyNat.pow_one as "pow_one" in "^" "
|
||||
`pow_one a` says that `a ^ 1 = a`.
|
||||
|
||||
Note that this is not quite true by definition: `a ^ 1` is
|
||||
@@ -22,4 +22,4 @@ Statement pow_one
|
||||
rw [one_mul]
|
||||
rfl
|
||||
|
||||
LemmaTab "Pow"
|
||||
LemmaTab "^"
|
||||
|
||||
@@ -6,7 +6,7 @@ Title "one_pow"
|
||||
|
||||
namespace MyNat
|
||||
|
||||
LemmaDoc MyNat.one_pow as "one_pow" in "Pow" "
|
||||
LemmaDoc MyNat.one_pow as "one_pow" in "^" "
|
||||
`one_pow n` is a proof that $1^n=1$.
|
||||
"
|
||||
/-- For all naturals $m$, $1 ^ m = 1$. -/
|
||||
@@ -20,4 +20,4 @@ Statement one_pow
|
||||
rw [mul_one]
|
||||
rfl
|
||||
|
||||
LemmaTab "Pow"
|
||||
LemmaTab "^"
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace MyNat
|
||||
|
||||
Introduction "Note: this lemma will be useful for the final boss!"
|
||||
|
||||
LemmaDoc MyNat.pow_two as "pow_two" in "Pow" "
|
||||
LemmaDoc MyNat.pow_two as "pow_two" in "^" "
|
||||
`pow_two a` says that `a ^ 2 = a * a`.
|
||||
"
|
||||
|
||||
@@ -20,4 +20,4 @@ Statement pow_two
|
||||
rw [pow_one]
|
||||
rfl
|
||||
|
||||
LemmaTab "Pow"
|
||||
LemmaTab "^"
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace MyNat
|
||||
Introduction "Let's now begin our approch to the final boss,
|
||||
by proving some more subtle facts about powers."
|
||||
|
||||
LemmaDoc MyNat.pow_add as "pow_add" in "Pow" "
|
||||
LemmaDoc MyNat.pow_add as "pow_add" in "^" "
|
||||
|
||||
`pow_add a m n` is a proof that $a^{m+n}=a^ma^n.$
|
||||
"
|
||||
@@ -23,4 +23,4 @@ Statement pow_add
|
||||
· rw [add_succ, pow_succ, pow_succ, ht, mul_assoc]
|
||||
rfl
|
||||
|
||||
LemmaTab "Pow"
|
||||
LemmaTab "^"
|
||||
|
||||
@@ -16,7 +16,7 @@ because `rw [mul_comm]` swaps the wrong multiplication,
|
||||
then read the documentation of `rw` for tips on how to fix this.
|
||||
"
|
||||
|
||||
LemmaDoc MyNat.mul_pow as "mul_pow" in "Pow" "
|
||||
LemmaDoc MyNat.mul_pow as "mul_pow" in "^" "
|
||||
`mul_pow a b n` is a proof that $(ab)^n=a^nb^n.$
|
||||
"
|
||||
|
||||
@@ -32,4 +32,4 @@ Statement mul_pow
|
||||
rw [mul_comm a (_ * b), mul_assoc, mul_comm b a]
|
||||
rfl
|
||||
|
||||
LemmaTab "Pow"
|
||||
LemmaTab "^"
|
||||
|
||||
@@ -13,7 +13,7 @@ sub-boss appears as the music reaches a frenzy. What
|
||||
else could there be to prove about powers after this?
|
||||
"
|
||||
|
||||
LemmaDoc MyNat.pow_pow as "pow_pow" in "Pow" "
|
||||
LemmaDoc MyNat.pow_pow as "pow_pow" in "^" "
|
||||
`pow_pow a m n` is a proof that $(a^m)^n=a^{mn}.$
|
||||
"
|
||||
|
||||
@@ -26,7 +26,7 @@ Statement pow_pow
|
||||
· rw [pow_succ, Ht, mul_succ, pow_add]
|
||||
rfl
|
||||
|
||||
LemmaTab "Pow"
|
||||
LemmaTab "^"
|
||||
|
||||
-- **TODO** if these are `simp` then they should be `simp`ed at source.
|
||||
attribute [simp] MyNat.pow_zero
|
||||
|
||||
@@ -13,7 +13,7 @@ Introduction
|
||||
|
||||
-- **TODO** get the `ring` hack working again.
|
||||
|
||||
LemmaDoc MyNat.add_sq as "add_sq" in "Pow" "
|
||||
LemmaDoc MyNat.add_sq as "add_sq" in "^" "
|
||||
`add_sq a b` is the statment that $(a+b)^2=a^2+b^2+2ab.$
|
||||
"
|
||||
|
||||
@@ -29,7 +29,7 @@ Statement add_sq
|
||||
rw [← add_assoc, ← add_assoc]
|
||||
rfl
|
||||
|
||||
LemmaTab "Pow"
|
||||
LemmaTab "^"
|
||||
|
||||
Conclusion
|
||||
"
|
||||
|
||||
@@ -46,7 +46,7 @@ Statement
|
||||
|
||||
NewHiddenTactic xyzzy
|
||||
|
||||
LemmaTab "Pow"
|
||||
LemmaTab "^"
|
||||
|
||||
Conclusion
|
||||
"
|
||||
|
||||
@@ -6,7 +6,7 @@ World "Tutorial"
|
||||
Level 1
|
||||
Title "The rfl tactic"
|
||||
|
||||
LemmaTab "numerals"
|
||||
LemmaTab "012"
|
||||
|
||||
namespace MyNat
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ World "Tutorial"
|
||||
Level 2
|
||||
Title "the rw tactic"
|
||||
|
||||
LemmaTab "numerals"
|
||||
LemmaTab "012"
|
||||
|
||||
namespace MyNat
|
||||
|
||||
|
||||
@@ -23,16 +23,16 @@ It is distinct from the Lean natural numbers `Nat`, which should hopefully
|
||||
never leak into the natural number game.*"
|
||||
|
||||
|
||||
LemmaDoc MyNat.one_eq_succ_zero as "one_eq_succ_zero" in "numerals"
|
||||
LemmaDoc MyNat.one_eq_succ_zero as "one_eq_succ_zero" in "012"
|
||||
"`one_eq_succ_zero` is a proof of `1 = succ 0`."
|
||||
|
||||
LemmaDoc MyNat.two_eq_succ_one as "two_eq_succ_one" in "numerals"
|
||||
LemmaDoc MyNat.two_eq_succ_one as "two_eq_succ_one" in "012"
|
||||
"`two_eq_succ_one` is a proof of `2 = succ 1`."
|
||||
|
||||
LemmaDoc MyNat.three_eq_succ_two as "three_eq_succ_two" in "numerals"
|
||||
LemmaDoc MyNat.three_eq_succ_two as "three_eq_succ_two" in "012"
|
||||
"`three_eq_succ_two` is a proof of `3 = succ 2`."
|
||||
|
||||
LemmaDoc MyNat.four_eq_succ_three as "four_eq_succ_three" in "numerals"
|
||||
LemmaDoc MyNat.four_eq_succ_three as "four_eq_succ_three" in "012"
|
||||
"`four_eq_succ_three` is a proof of `4 = succ 3`."
|
||||
|
||||
NewDefinition MyNat
|
||||
@@ -73,7 +73,7 @@ Statement
|
||||
Hint (hidden := true) "Now finish the job with `rfl`."
|
||||
rfl
|
||||
|
||||
LemmaTab "numerals"
|
||||
LemmaTab "012"
|
||||
|
||||
Conclusion
|
||||
"
|
||||
|
||||
@@ -5,7 +5,7 @@ World "Tutorial"
|
||||
Level 4
|
||||
Title "rewriting backwards"
|
||||
|
||||
LemmaTab "numerals"
|
||||
LemmaTab "012"
|
||||
|
||||
namespace MyNat
|
||||
|
||||
|
||||
@@ -20,9 +20,9 @@ by induction using these two basic theorems."
|
||||
|
||||
NewDefinition Add
|
||||
|
||||
LemmaTab "Add"
|
||||
LemmaTab "+"
|
||||
|
||||
LemmaDoc MyNat.add_zero as "add_zero" in "Add"
|
||||
LemmaDoc MyNat.add_zero as "add_zero" in "+"
|
||||
"`add_zero a` is a proof that `a + 0 = a`.
|
||||
|
||||
## Summary
|
||||
|
||||
@@ -29,7 +29,7 @@ Statement (a b c : ℕ) : a + (b + 0) + (c + 0) = a + b + c := by
|
||||
rw [add_zero]
|
||||
rfl
|
||||
|
||||
LemmaTab "Add"
|
||||
LemmaTab "+"
|
||||
|
||||
Conclusion "
|
||||
Let's now learn about Peano's second axiom for addition, `add_succ`.
|
||||
|
||||
@@ -6,16 +6,16 @@ World "Tutorial"
|
||||
Level 7
|
||||
Title "add_succ"
|
||||
|
||||
LemmaTab "numerals"
|
||||
LemmaTab "012"
|
||||
|
||||
namespace MyNat
|
||||
|
||||
LemmaDoc MyNat.add_succ as "add_succ" in "Add"
|
||||
LemmaDoc MyNat.add_succ as "add_succ" in "+"
|
||||
"`add_succ a b` is the proof of `a + succ b = succ (a + b)`."
|
||||
|
||||
NewLemma MyNat.add_succ
|
||||
|
||||
LemmaDoc MyNat.succ_eq_add_one as "succ_eq_add_one" in "Add"
|
||||
LemmaDoc MyNat.succ_eq_add_one as "succ_eq_add_one" in "+"
|
||||
"`succ_eq_add_one n` is the proof that `succ n = n + 1`."
|
||||
|
||||
Introduction
|
||||
|
||||
@@ -6,7 +6,7 @@ World "Tutorial"
|
||||
Level 8
|
||||
Title "2+2=4"
|
||||
|
||||
LemmaTab "numerals"
|
||||
LemmaTab "012"
|
||||
|
||||
namespace MyNat
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ Statement (a b c d e f g h : ℕ) :
|
||||
ac_rfl
|
||||
|
||||
NewTactic ac_rfl
|
||||
LemmaTab "Add"
|
||||
LemmaTab "+"
|
||||
|
||||
Conclusion
|
||||
"
|
||||
|
||||
@@ -33,7 +33,7 @@ Oh did I mention there was a new tactic? Find it highlighted in your inventory.
|
||||
Statement : (29 : ℕ) + 35 = 64 := by
|
||||
decide
|
||||
|
||||
LemmaTab "Add"
|
||||
LemmaTab "+"
|
||||
|
||||
Conclusion
|
||||
"
|
||||
|
||||
Reference in New Issue
Block a user