updates
This commit is contained in:
@@ -14,8 +14,8 @@ Zum Beispiel
|
||||
\"und angenommen, dass $n$ strikt grösser als $1$ ist\".
|
||||
|
||||
In Lean schreibt man beides mit dem gleichen Syntax: `(n : ℕ) (h : 1 < n)` definiert
|
||||
zuerst eine natürliche Zahl $n$ und eine Annahme dass $1 < n$ (die Annahme kriegt
|
||||
den Namen `h`).
|
||||
zuerst eine natürliche Zahl $n$ und eine Annahme dass $1 < n$ gilt
|
||||
(welche den Namen `h` kriegt).
|
||||
|
||||
Wenn das Goal genau einer Annahme entspricht, kann man diese mit `assumption` beweisen.
|
||||
"
|
||||
|
||||
@@ -18,14 +18,14 @@ kann die Taktik `rw [h]` im Goal $X$ durch $Y$ ersetzen.
|
||||
"
|
||||
|
||||
Statement umschreiben
|
||||
"Angenommen man hat die Gleichheiten
|
||||
$$ \\begin{aligned}
|
||||
a &= b \\\\\\\\
|
||||
a &= d \\\\\\\\
|
||||
c &= d
|
||||
\\end{aligned} $$
|
||||
Zeige dass $b = c$."
|
||||
(a b c d : ℕ) (h₁ : c = d) (h₂ : a = b) (h₃ : a = d) : b = c := by
|
||||
"Angenommen man hat die Gleichheiten
|
||||
|
||||
$$
|
||||
\\begin{aligned} a &= b \\\\ a &= d \\\\ c &= d \\end{aligned}
|
||||
$$
|
||||
|
||||
Zeige dass $b = c$."
|
||||
(a b c d : ℕ) (h₁ : c = d) (h₂ : a = b) (h₃ : a = d) : b = c := by
|
||||
rw [h₁]
|
||||
rw [←h₂]
|
||||
assumption
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
import TestGame.Metadata
|
||||
import Mathlib
|
||||
|
||||
Game "TestGame"
|
||||
World "Logic"
|
||||
Level 6
|
||||
|
||||
Title "Rewrite"
|
||||
|
||||
Introduction
|
||||
"
|
||||
Mit `rw` kann man nicht nur das Goal sondern auch andere Annahmen umschreiben:
|
||||
|
||||
Wenn `(h : X = Y)` ist, dann ersetzt `rw [h] at g` in der Annahme
|
||||
`g` das `X` durch `Y`.
|
||||
"
|
||||
|
||||
Statement umschreiben
|
||||
"Angenommen man hat die Gleichheiten
|
||||
|
||||
$$
|
||||
\\begin{aligned} a &= b \\\\ a + a ^ 2 &= b + 1 \\end{aligned}
|
||||
$$
|
||||
|
||||
Zeige dass $b + b ^ 2 = b + 1$."
|
||||
(a b : ℕ) (h : a = b) (g : a + a ^ 2 = b + 1) : b + b ^ 2 = b + 1 := by
|
||||
rw [h] at g
|
||||
assumption
|
||||
|
||||
Message (a : ℕ) (b : ℕ) (h : a = b) (g : a + a ^ 2 = b + 1) : b + b ^ 2 = b + 1 =>
|
||||
"`rw [ ... ] at g` schreibt die Annahme `g` um."
|
||||
|
||||
Message (a : ℕ) (b : ℕ) (h : a = b) (g : a + a ^ 2 = b + 1) : a + a ^ 2 = a + 1 =>
|
||||
"Sackgasse. probiers doch mit `rw [h] at g` stattdessen."
|
||||
|
||||
Conclusion "Übrigens, mit `rw [h] at *` kann man im weiteren `h` in **allen** Annahmen und
|
||||
dem Goal umschreiben."
|
||||
|
||||
Tactics assumption rw
|
||||
@@ -3,32 +3,32 @@ import Mathlib
|
||||
|
||||
Game "TestGame"
|
||||
World "Logic"
|
||||
Level 6
|
||||
Level 7
|
||||
|
||||
Title "Implikation"
|
||||
|
||||
Introduction
|
||||
"Als nächstes widmen wir uns der Implikation $A \\Rightarrow B$.
|
||||
|
||||
Mit zwei logischen Aussagen `(A : Prop)`, `(B : Prop)` schreibt man eine Implikation
|
||||
Mit zwei logischen Aussagen `(A : Prop) (B : Prop)` schreibt man eine Implikation
|
||||
als `A → B` (`\\to`).
|
||||
|
||||
Wenn man als Goal $B$ hat und eine Impikation `(g : A → B)` kann man mit `apply g` diese
|
||||
anwenden, worauf das Goal $A$ ist. Auf Papier würde man an der Stelle
|
||||
folgendes zu schreiben: \"Es genügt $A$ zu zeigen, denn $A$ impliziert $B$\".
|
||||
Wenn man als Goal $B$ beweisen möchte und eine Impikation `(g : A → B)`
|
||||
hat, kann man mit `apply g` diese
|
||||
anwenden, worauf das zu beweisende Goal $A$ wird. Auf Papier würde man an der Stelle
|
||||
folgendes zu schreiben: \"Es genügt $A$ zu zeigen, denn $A \\Rightarrow B$\".
|
||||
|
||||
*Bemerke:* Das ist der selbe Pfeil, der später auch für Funktionen wie `ℕ → ℕ` gebraucht
|
||||
wird, deshalb heisst er `\\to`."
|
||||
|
||||
|
||||
Statement
|
||||
"Seien $A$, $B$ logische Aussagen, wobei $A$ wahr ist und $A$ impliziert $B$.
|
||||
"Seien $A, B$ logische Aussagen, wobei $A$ wahr ist und $A \\Rightarrow B$.
|
||||
Zeige, dass $B$ wahr ist."
|
||||
(A B : Prop) (hA : A) (g : A → B) : B := by
|
||||
apply g
|
||||
assumption
|
||||
|
||||
Hint (A : Prop) (B : Prop) (hA : A) (g : A → B) : A =>
|
||||
Hint (A : Prop) (B : Prop) (hA : A) (g : A → B) : B =>
|
||||
"Mit `apply g` kannst du die Implikation `g` anwenden."
|
||||
|
||||
Hint (A : Prop) (B : Prop) (hA : A) (g : A → B) : A =>
|
||||
@@ -37,8 +37,8 @@ dafür hast du bereits einen Beweis in den Annahmen."
|
||||
|
||||
Tactics apply assumption
|
||||
|
||||
-- Mathjax notes
|
||||
-- `\\\\( \\\\)` or `$ $` for inline
|
||||
-- Katex notes
|
||||
-- `\\( \\)` or `$ $` for inline
|
||||
-- and `$$ $$` block.
|
||||
-- align block:
|
||||
-- $$\\begin{aligned} 2x - 4 &= 6 \\\\\\\\ 2x &= 10 \\\\\\\\ x &= 5 \\end{aligned}$$
|
||||
-- $$\\begin{aligned} 2x - 4 &= 6 \\\\ 2x &= 10 \\\\ x &= 5 \\end{aligned}$$
|
||||
|
||||
@@ -2,7 +2,7 @@ import TestGame.Metadata
|
||||
|
||||
Game "TestGame"
|
||||
World "Logic"
|
||||
Level 7
|
||||
Level 8
|
||||
|
||||
Title "Implikation"
|
||||
|
||||
@@ -28,12 +28,17 @@ Statement
|
||||
apply f
|
||||
assumption
|
||||
|
||||
Message (A : Prop) (B : Prop) (C : Prop) (D : Prop) (E : Prop) (F : Prop)
|
||||
Hint (A : Prop) (B : Prop) (C : Prop) (D : Prop) (E : Prop) (F : Prop)
|
||||
(hA : A) (f : A → B) (g : C → B) (h : B → E)
|
||||
(i : D → E) (k : E → F) (m : C → F) : F =>
|
||||
"Versuch mit `apply` den richtigen Weg zu finden."
|
||||
|
||||
Message (A : Prop) (B : Prop) (C : Prop) (D : Prop) (E : Prop) (F : Prop)
|
||||
(hA : A) (f : A → B) (g : C → B) (h : B → E)
|
||||
(i : D → E) (k : E → F) (m : C → F) : C =>
|
||||
"Sackgasse. Probier doch einen anderen Weg."
|
||||
|
||||
Message (A : Prop) (B : Prop) (C : Prop) (D : Prop) (E : Prop) (F : Prop)
|
||||
Message (A : Prop) (B : Prop) (C : Prop) (D : Prop) (E : Prop) (F : Prop)
|
||||
(hA : A) (f : A → B) (g : C → B) (h : B → E)
|
||||
(i : D → E) (k : E → F) (m : C → F) : D =>
|
||||
"Sackgasse. Probier doch einen anderen Weg."
|
||||
|
||||
@@ -4,7 +4,7 @@ set_option tactic.hygienic false
|
||||
|
||||
Game "TestGame"
|
||||
World "Logic"
|
||||
Level 8
|
||||
Level 9
|
||||
|
||||
Title "Implikation"
|
||||
|
||||
@@ -15,7 +15,7 @@ Wenn das Goal eine Implikation $A \\Rightarrow B$ ist, kann man mit
|
||||
"
|
||||
|
||||
Statement
|
||||
""
|
||||
"Angenommen man weiss $A \\Rightarrow B \\Rightarrow C$, zeige dass $A \\Rightarrow C$."
|
||||
(A B C : Prop) (f : A → B) (g : B → C) : A → C := by
|
||||
intro hA
|
||||
apply g
|
||||
@@ -23,7 +23,7 @@ Statement
|
||||
assumption
|
||||
|
||||
Message (A : Prop) (B : Prop) (C : Prop) (f : A → B) (g : B → C) : A → C =>
|
||||
"mit `intro hA` kann man eine Implikation angehen."
|
||||
"Mit `intro hA` kann man eine Implikation angehen."
|
||||
|
||||
Message (A : Prop) (B : Prop) (C : Prop) (hA : A) (f : A → B) (g : B → C) : C =>
|
||||
"Jetzt ist es ein altbekanntes Spiel von `apply`-Anwendungen."
|
||||
|
||||
@@ -5,7 +5,7 @@ import Init.Data.ToString
|
||||
|
||||
Game "TestGame"
|
||||
World "Logic"
|
||||
Level 9
|
||||
Level 10
|
||||
|
||||
Title "Genau dann wenn"
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import TestGame.Metadata
|
||||
|
||||
Game "TestGame"
|
||||
World "Logic"
|
||||
Level 10
|
||||
Level 11
|
||||
|
||||
Title "Genau dann wenn"
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ set_option tactic.hygienic false
|
||||
|
||||
Game "TestGame"
|
||||
World "Logic"
|
||||
Level 11
|
||||
Level 12
|
||||
|
||||
Title "Genau dann wenn"
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import Mathlib.Tactic.Cases
|
||||
|
||||
Game "TestGame"
|
||||
World "Logic"
|
||||
Level 12
|
||||
Level 13
|
||||
|
||||
Title "Genau dann wenn"
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ set_option tactic.hygienic false
|
||||
|
||||
Game "TestGame"
|
||||
World "Logic"
|
||||
Level 13
|
||||
Level 14
|
||||
|
||||
Title "Und"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import Mathlib.Tactic.LeftRight
|
||||
|
||||
Game "TestGame"
|
||||
World "Logic"
|
||||
Level 14
|
||||
Level 15
|
||||
|
||||
Title "Oder"
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import Mathlib.Tactic.LeftRight
|
||||
|
||||
Game "TestGame"
|
||||
World "Logic"
|
||||
Level 15
|
||||
Level 16
|
||||
|
||||
Title "Oder - Bonus"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ set_option tactic.hygienic false
|
||||
|
||||
Game "TestGame"
|
||||
World "Logic"
|
||||
Level 16
|
||||
Level 17
|
||||
|
||||
Title "Oder"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user