rename testgame to adam

This commit is contained in:
Alexander Bentkamp
2023-03-23 17:10:13 +01:00
parent a262cff63b
commit 5c73d3bddb
166 changed files with 0 additions and 0 deletions
@@ -0,0 +1,70 @@
import TestGame.Metadata
import Std.Tactic.RCases
import Mathlib.Tactic.LeftRight
set_option tactic.hygienic false
Game "TestGame"
World "Implication"
Level 9
Title "Oder"
Introduction
"
Übung macht den Meister... Benutze alle vier Methoden mit UND und ODER
umzugehen um folgende Aussage zu beweisen.
| | Und | Oder |
|---------|:-------------------------|:--------------------------|
| Annahme | `rcases h with ⟨h₁, h₂⟩` | `rcases h with h₁ \\| h₂` |
| Goal | `constructor` | `left`/`right` |
"
Statement and_or_imp
"Angenommen $(A \\land B) \\lor (A \\Rightarrow C)$ und $A$ sind wahr, zeige dass
$B \\lor (C \\land A)$ wahr ist."
(A B C : Prop) (h : (A ∧ B) ∨ (A → C)) (hA : A) : (B ∨ (C ∧ A)) := by
rcases h with h₁ | h₂
left
rcases h₁ with ⟨x, y⟩
assumption
right
constructor
apply h₂
assumption
assumption
HiddenHint (A : Prop) (B : Prop) (C : Prop) (h : A ∧ B ∨ (A → C)) (hA : A) : B ∨ (C ∧ A) =>
"Ein ODER in den Annahmen teilt man mit `rcases h with h₁ | h₂`."
-- If starting with `left`.
Hint (A : Prop) (B : Prop) (C : Prop) (h : A ∧ B ∨ (A → C)) : B =>
"Da kommst du nicht mehr weiter..."
-- If starting with `right`.
Hint (A : Prop) (B : Prop) (C : Prop) (h : A ∧ B ∨ (A → C)) : (C ∧ A) =>
"Da kommst du nicht mehr weiter..."
HiddenHint (A : Prop) (B : Prop) (C : Prop) (h : A ∧ B) (hA : A) : B ∨ (C ∧ A) =>
"`left` oder `right`?"
HiddenHint (A : Prop) (B : Prop) (C : Prop) (h : B) (hA : A) : B ∨ (C ∧ A) =>
"`left` oder `right`?"
Hint (A : Prop) (B : Prop) (C : Prop) (h : A ∧ B) (hA : A) : B ∨ (C ∧ A) =>
"Ein UND in den Annahmen kann man mit `rcases h with ⟨h₁, h₂⟩` aufteilen."
Hint (A : Prop) (B : Prop) (C : Prop) (h : A ∧ B) (hA : A) : B =>
"Ein UND in den Annahmen kann man mit `rcases h with ⟨h₁, h₂⟩` aufteilen."
Hint (A : Prop) (B : Prop) (C : Prop) (h : A ∧ B) : C =>
"Sackgasse."
Hint (A : Prop) (B : Prop) (C : Prop) (h : A ∧ B) : C ∧ A =>
"Hmmm..."
Hint (A : Prop) (B : Prop) (C : Prop) (h : A → C) : C ∧ A =>
"Ein UND im Goal kann mit `constructor` aufgeteilt werden."
NewTactic left right assumption constructor rcases
@@ -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
"
"
NewTactic 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
"
"
NewTactic ring
@@ -0,0 +1,61 @@
import TestGame.Metadata
import Std.Tactic.RCases
import Mathlib.Tactic.Contrapose
import Mathlib.Tactic.Use
import Mathlib.Tactic.Ring
-- TODO: `even`/`odd` sind in Algebra.Parity. Not ported yet
def even (a : ℕ) : Prop := ∃ r, a = 2 * r
def odd (a : ℕ) : Prop := ∃ k, a = 2 * k + 1
lemma not_odd {n : ℕ} : ¬ odd n ↔ even n := by sorry
lemma not_even {n : ℕ} : ¬ even n ↔ odd n := by sorry
lemma even_square (n : ℕ) : even n → even (n ^ 2) := by
intro ⟨x, hx⟩
unfold even at *
use 2 * x ^ 2
rw [hx]
ring
def prime (n : ℕ) : Prop := (2 ≤ n) ∧ ∀ a b, n = a * b → a = 1 ∨ b = 1
Game "TestGame"
World "Nat"
Level 4
Title "Für alle"
Introduction
"
Eine Primzahl könnte man folgendermassen implementieren:
```
def prime (p : ℕ) : Prop := (2 ≤ p) ∧ (∀ a b, p = a * b → a = 1 ∨ b = 1)
```
Also, eine Zahl `p` ungleich `0` oder `1`, für die gilt wenn `a * b = p` dann ist
entweder `a` oder `b` eins.
(Tatsächlich ist eine Primzahl dann etwas genereller definiert, aber dazu mehr später.)
"
Statement
"Wenn `n * m` eine Primzahl ist, dann ist einer der beiden Faktoren eins."
(p n m : ℕ) (h : prime p) (h₂ : p = m * n) : n = 1 ∨ m = 1 := by
unfold prime at h
rcases h with ⟨l, r⟩
apply r
rw [h₂]
ring
Hint (n : ℕ) (hn : odd n) (h : ∀ (x : ℕ), (odd x) → even (x + 1)) : even (n + 1) =>
"`∀ (x : ℕ), (odd x) → even (x + 1)` ist eigentlich das gleiche wie
`(x : ℕ) → `"
NewTactic ring intro unfold
@@ -0,0 +1 @@
-- tauto is not implemented yet... duper?
@@ -0,0 +1 @@
-- not implemented yet
@@ -0,0 +1,18 @@
import TestGame.Metadata
import Mathlib
-- -- INCORPORATED
-- example (A B : Prop) : (A → B) ↔ (¬ B → ¬A) := by
-- constructor
-- intro h nb
-- by_contra
-- have : B
-- apply h
-- assumption
-- contradiction
-- intro h a
-- by_contra
-- have : ¬ A
-- apply h
-- assumption
-- contradiction
@@ -0,0 +1,25 @@
import TestGame.Metadata
import Mathlib.Tactic.Ring
Game "TestGame"
World "Function"
Level 1
Title "Funktionen"
Introduction
"
Funktionen werden in Lean als `(f : ℕ → ℕ)` geschrieben (`\\to`), also mit dem gleichen
Pfeil wie Implikationen. Entsprechend kann man Implikationen und Funktionen genau
gleich behandeln.
"
Statement : ∃ (f : ℕ → ℕ), ∀ (x : ℕ), f x = 0 := by
let g := fun (x : ℕ) ↦ 0
use g
simp
Conclusion ""
NewTactic use simp