update to lean nightly 22-12-05

pull/43/head
Jon Eugster 2 years ago
parent c6d8b35806
commit 04c0466fa4

@ -0,0 +1,15 @@
#!/usr/bin/env sh
# Operate in the directory where this file is located
cd $(dirname $0)
cd server
cd testgame
lake update
cp lake-packages/mathlib/lean-toolchain lean-toolchain
cp lake-packages/mathlib/lean-toolchain ../leanserver/lean-toolchain
cd ../leanserver
lake update

@ -55,7 +55,7 @@
"build_server": "server/build.sh",
"build_client": "NODE_ENV=production webpack",
"production": "NODE_ENV=production node server/index.mjs",
"update_lean": "cd server && (cd testgame && lake update) && cp testgame/lean-toolchain leanserver/lean-toolchain"
"update_lean": "./UPDATE_LEAN.sh"
},
"eslintConfig": {
"extends": [

@ -0,0 +1 @@
{"version": 4, "packagesDir": "./lake-packages", "packages": []}

@ -1 +1 @@
leanprover/lean4:nightly-2022-12-03
leanprover/lean4:nightly-2022-12-05

@ -19,6 +19,10 @@ import TestGame.Levels.Naturals.L01_Ring
import TestGame.Levels.Naturals.L02_Ring
import TestGame.Levels.Naturals.L03_Exists
import TestGame.Levels.Naturals.L04_Forall
import TestGame.Levels.Naturals.L31_Sum
import TestGame.Levels.Naturals.L32_Induction
import TestGame.Levels.Naturals.L33_Prime
import TestGame.Levels.Naturals.L34_ExistsUnique
import TestGame.Levels.Negation.L01_False
import TestGame.Levels.Negation.L02_Contra
import TestGame.Levels.Negation.L03_Contra

@ -1,12 +1,12 @@
import TestGame.Metadata
Game "TestGame"
World "TestWorld"
World "Old"
Level 1
Title "The reflexivity spell"
Introduction
Introduction
"
Let's learn a first spell: the `rfl` spell. `rfl` stands for \"reflexivity\", which is a fancy
way of saying that it will prove any goal of the form `A = A`. It doesn't matter how
@ -16,7 +16,7 @@ right hand side (a computer scientist would say \"definitionally equal\"). I rea
For example, `x * y + z = x * y + z` can be proved by `rfl`, but `x + y = y + x` cannot.
This is a very low level spell, but you need to start somewhere.
After closing this message, type rfl in the invocation zone and hit Enter or click
After closing this message, type rfl in the invocation zone and hit Enter or click
the \"Cast spell\" button.
"
@ -25,4 +25,4 @@ rfl
Conclusion "Congratulations for completing your first level! You can now click on the *Go to next level* button."
Tactics rfl
Tactics rfl

@ -1,7 +1,7 @@
import TestGame.Metadata
Game "TestGame"
World "TestWorld"
World "Old"
Level 2
Title "The rewriting spell"
@ -14,7 +14,7 @@ goal mentions the left hand side `A` somewhere, then
the `rewrite` tactic will replace the `A` in your goal with a `B`.
The documentation for `rewrite` just appeared in your spell book.
Play around with the menus and see what is there currently.
Play around with the menus and see what is there currently.
More information will appear as you progress.
Take a look in the top right box at what we have.
@ -26,13 +26,13 @@ this substitution using the `rewrite` spell. This spell takes a list of equaliti
or equivalences so you can cast `rewrite [h]`.
"
Statement (x y : ) (h : y = x + 7) : 2 * y = 2 * (x + 7) := by
Statement (x y : ) (h : y = x + 7) : 2 * y = 2 * (x + 7) := by
rewrite [h]
rfl
Message (x : ) (y : ) (h : y = x + 7) : 2*(x + 7) = 2*(x + 7) =>
Message (x : ) (y : ) (h : y = x + 7) : 2*(x + 7) = 2*(x + 7) =>
"Great! Now the goal should be easy to reach using the `rfl` spell."
Conclusion "Congratulations for completing your second level!"
Tactics rfl rewrite
Tactics rfl rewrite

@ -1,7 +1,7 @@
import TestGame.Metadata
Game "TestGame"
World "TestWorld"
World "Old"
Level 3
Title "Peano's axioms"
@ -40,9 +40,9 @@ This game is all about seeing how far these axioms of Peano can take us.
Let's practice our use of the `rewrite` tactic in the following example.
Our hypothesis `h` is a proof that `succ(a) = b` and we want to prove that
`succ(succ(a))=succ(b)`. In words, we're going to prove that if
`b` is the number after `a` then `succ(b)` is the number after `succ(a)`.
`b` is the number after `a` then `succ(b)` is the number after `succ(a)`.
Note that the system drops brackets when they're not
necessary, so `succ b` just means `succ(b)`.
necessary, so `succ b` just means `succ(b)`.
Now here's a tricky question. Knowing that our goal is `succ (succ a) = succ b`,
and our assumption is `h : succ a = b`, then what will the goal change
@ -56,23 +56,23 @@ the *right* hand side. Try and figure out how the goal will change, and
then try it.
"
Statement (a b : ) (h : succ a = b) : succ (succ a) = succ b := by
Statement (a b : ) (h : succ a = b) : succ (succ a) = succ b := by
rewrite [h]
rfl
Message (a : ) (b : ) (h : succ a = b) : succ b = succ b =>
Message (a : ) (b : ) (h : succ a = b) : succ b = succ b =>
"
Look: Lean changed `succ a` into `b`, so the goal became `succ b = succ b`.
That goal is of the form `X = X`, so you know what to do.
"
Conclusion "Congratulations for completing the third level!
Conclusion "Congratulations for completing the third level!
You may be wondering whether we could have just substituted in the definition of `b`
and proved the goal that way. To do that, we would want to replace the right hand
side of `h` with the left hand side. You do this in Lean by writing `rewrite [<- h]`. You get the
left-arrow by typing `\\l` and then a space; note that this is a small letter L,
not a number 1. You can just edit your proof and try it.
not a number 1. You can just edit your proof and try it.
You may also be wondering why we keep writing `succ(b)` instead of `b+1`. This
is because we haven't defined addition yet! On the next level, the final level
@ -80,4 +80,4 @@ of the tutorial, we will introduce addition, and then
we'll be ready to enter Addition World.
"
Tactics rfl rewrite
Tactics rfl rewrite

@ -1,7 +1,7 @@
import TestGame.Metadata
Game "TestGame"
World "TestWorld"
World "Old"
Level 4
Title "Addition"
@ -61,4 +61,4 @@ of the game. Serious things start in the next level."
Tactics rfl rewrite
Lemmas add_succ add_zero
Lemmas add_succ add_zero

@ -2,7 +2,7 @@ import TestGame.Metadata
import TestGame.Tactics
Game "TestGame"
World "TestWorld"
World "Old"
Level 5
Title "The induction_on spell"
@ -26,7 +26,7 @@ a reminder of the things you're now equipped with which we'll need in this world
* `add_zero (a : ) : a + 0 = a`. Use with `rewrite [add_zero]`.
* `add_succ (a b : ) : a + succ(b) = succ(a + b)`. Use with `rewrite [add_succ]`.
* The principle of mathematical induction. Use with `induction_on` (see below)
## Spells:
@ -34,17 +34,17 @@ a reminder of the things you're now equipped with which we'll need in this world
* `rewrite [h]` : if h is a proof of `A = B`, changes all A's in the goal to B's.
* `induction_on n with d hd` : we're going to learn this right now.
# Important thing:
# Important thing:
This is a *really* good time to check you understand about the spell book and the inventory on
the left. Eveything you need is collected in those lists. They
the left. Eveything you need is collected in those lists. They
will prove invaluable as the number of theorems we prove gets bigger. On the other hand,
we only need to learn one more spell to really start going places, so let's learn about
that spell right now.
OK so let's see induction in action. We're going to prove
`zero_add (n : ) : 0 + n = n`.
`zero_add (n : ) : 0 + n = n`.
That is: for all natural numbers $n$, $0+n=n$. Wait $-$ what is going on here?
Didn't we already prove that adding zero to $n$ gave us $n$?
@ -89,13 +89,13 @@ focussing on the top goal, ignore the other one for now, it's not changing
and we're not working on it.
"
Message (n : ) (ind_hyp: 0 + n = n) : 0 + succ n = succ n =>
Message (n : ) (ind_hyp: 0 + n = n) : 0 + succ n = succ n =>
"
Great! You solved the base case. We are now be back down
to one goal -- the inductive step.
to one goal -- the inductive step.
We have a fixed natural number `n`, and the inductive hypothesis `ind_hyp : 0 + n = n`
saying that we have a proof of `0 + n = n`.
saying that we have a proof of `0 + n = n`.
Our goal is to prove `0 + succ n = succ n`. In words, we're showing that
if the lemma is true for `n`, then it's also true for the number after `n`.
That's the inductive step. Once we've proved this inductive step, we will have proved
@ -112,7 +112,7 @@ goal with the right hand side. We do this with the `rewrite` spell. You can writ
figure them out itself).
"
Message (n : ) (ind_hyp: 0 + n = n) : succ (0 + n) = succ n =>
Message (n : ) (ind_hyp: 0 + n = n) : succ (0 + n) = succ n =>
"Well-done! We're almost there. It's time to use our induction hypothesis.
Cast
@ -125,4 +125,4 @@ Conclusion "Congratulations for completing your first inductive proof!"
Tactics rfl rewrite induction_on
Lemmas add_succ add_zero
Lemmas add_succ add_zero

@ -1,7 +1,7 @@
import TestGame.Metadata
Game "TestGame"
World "TestWorld"
World "Logic"
Level 1
Title "Aller Anfang ist... ein Einzeiler?"

@ -1,7 +1,7 @@
import TestGame.Metadata
Game "TestGame"
World "TestWorld"
World "Logic"
Level 2
Title "Definitionally equal"

@ -1,7 +1,7 @@
import TestGame.Metadata
Game "TestGame"
World "TestWorld"
World "Logic"
Level 3
Title "Annahmen"

@ -2,7 +2,7 @@ import TestGame.Metadata
import Mathlib.Data.Nat.Basic -- TODO
Game "TestGame"
World "TestWorld"
World "Logic"
Level 4
Title "Logische Aussagen: `Prop`"

@ -2,7 +2,7 @@ import TestGame.Metadata
import Mathlib
Game "TestGame"
World "TestWorld"
World "Logic"
Level 5
Title "Rewrite"

@ -2,7 +2,7 @@ import TestGame.Metadata
import Mathlib
Game "TestGame"
World "TestWorld"
World "Logic"
Level 6
Title "Implikation"

@ -1,7 +1,7 @@
import TestGame.Metadata
Game "TestGame"
World "TestWorld"
World "Logic"
Level 7
Title "Implikation"

@ -3,7 +3,7 @@ import TestGame.Metadata
set_option tactic.hygienic false
Game "TestGame"
World "TestWorld"
World "Logic"
Level 8
Title "Implikation"

@ -4,7 +4,7 @@ import Init.Data.ToString
#check List UInt8
Game "TestGame"
World "TestWorld"
World "Logic"
Level 9
Title "Genau dann wenn"

@ -1,7 +1,7 @@
import TestGame.Metadata
Game "TestGame"
World "TestWorld"
World "Logic"
Level 10
Title "Genau dann wenn"

@ -5,7 +5,7 @@ import Mathlib.Tactic.Cases
set_option tactic.hygienic false
Game "TestGame"
World "TestWorld"
World "Logic"
Level 11
Title "Genau dann wenn"

@ -1,7 +1,7 @@
import TestGame.Metadata
Game "TestGame"
World "TestWorld"
World "Logic"
Level 12
Title "Genau dann wenn"

@ -4,7 +4,7 @@ import Std.Tactic.RCases
set_option tactic.hygienic false
Game "TestGame"
World "TestWorld"
World "Logic"
Level 13
Title "Und"

@ -5,7 +5,7 @@ import Mathlib.Tactic.LeftRight
--set_option tactic.hygienic false
Game "TestGame"
World "TestWorld"
World "Logic"
Level 14
Title "Oder"

@ -8,7 +8,7 @@ import Mathlib.Tactic.LeftRight
Game "TestGame"
World "TestWorld"
World "Logic"
Level 15
Title "Oder - Bonus"

@ -5,7 +5,7 @@ import Mathlib.Tactic.LeftRight
set_option tactic.hygienic false
Game "TestGame"
World "TestWorld"
World "Logic"
Level 16
Title "Oder"

@ -1,14 +1,6 @@
import TestGame.Metadata
import Mathlib.Tactic.Ring
-- TODOs:
-- Natural numbers
-- even / odd
-- prime
-- `ring`
-- sum
-- induction
--set_option tactic.hygienic false
Game "TestGame"

@ -0,0 +1,23 @@
import TestGame.Metadata
import Mathlib.Tactic.Ring
Game "TestGame"
World "Nat2"
Level 1
Title "Summe"
Introduction
"
TODO: Summe
"
Statement : True := by
trivial
Conclusion
"
"
Tactics ring

@ -0,0 +1,23 @@
import TestGame.Metadata
import Mathlib.Tactic.Ring
Game "TestGame"
World "Nat2"
Level 2
Title "Induktion"
Introduction
"
TODO: Induktion (& induktion vs rcases)
"
Statement : True := by
trivial
Conclusion
"
"
Tactics ring

@ -0,0 +1,23 @@
import TestGame.Metadata
import Mathlib.Tactic.Ring
Game "TestGame"
World "Nat2"
Level 3
Title "Primzahlen"
Introduction
"
TODO: Primzahl
"
Statement : True := by
trivial
Conclusion
"
"
Tactics ring

@ -0,0 +1,23 @@
import TestGame.Metadata
import Mathlib.Tactic.Ring
Game "TestGame"
World "Nat2"
Level 5
Title "Exists unique"
Introduction
"
TODO: Es existiert genau eine gerade Primzahl.
"
Statement : True := by
trivial
Conclusion
"
"
Tactics ring

@ -1,5 +1,4 @@
import GameServer.Commands
--import TestGame.MyNat
import TestGame.TacticDocs
import TestGame.LemmaDocs
import Mathlib.Init.Data.Nat.Basic -- Imports the notation .
@ -21,15 +20,6 @@ with a level 1 spell book. Good luck."
Conclusion
"There is nothing else so far. Thanks for rescuing natural numbers!"
World "w1"
World "w2"
World "w3"
World "v1"
World "v2"
World "v3"
World "v4"
Path TestWorld → w1 → w2 → w3
Path w1 → v1 → v2 → v3 → w3
Path v3 → v4
Path Logic → Nat → Contradiction
Path Nat → Nat2

@ -28,7 +28,7 @@
{"git":
{"url": "https://github.com/leanprover-community/mathlib4.git",
"subDir?": null,
"rev": "a461e549ebaac0c9b6a83969bcaa982bff6adafc",
"rev": "573c745b2edb348902bf14e5b4166e50c68db8f6",
"name": "mathlib",
"inputRev?": "master"}},
{"git":

@ -1 +1 @@
leanprover/lean4:nightly-2022-12-03
leanprover/lean4:nightly-2022-12-05

Loading…
Cancel
Save