Merge branch 'main' of github.com:leanprover-community/lean4game

This commit is contained in:
Jon Eugster
2023-02-08 10:34:47 +01:00
94 changed files with 1085 additions and 711 deletions
+4 -1
View File
@@ -39,9 +39,12 @@ Conclusion
Path Proposition → Implication → Predicate → Contradiction → LeanStuff
--Path Predicate → Prime
-- Path Predicate → Prime
Path Predicate → Induction → LeanStuff → Function → SetFunction
Path LeanStuff → SetTheory → SetFunction
Path SetTheory → SetTheory2
MakeGame
@@ -63,6 +63,6 @@ have k : ¬ B
Conclusion ""
Tactics contradiction rcases haveₓ assumption apply
NewTactics contradiction rcases haveₓ assumption apply
Lemmas Even Odd not_even not_odd
NewLemmas Even Odd not_even not_odd
@@ -60,6 +60,6 @@ Hint (A : Prop) (B : Prop) (h : A → ¬ B) (g : A) (f : B) : False =>
Conclusion ""
Tactics contradiction apply assumption rcases sufficesₓ
NewTactics contradiction apply assumption rcases sufficesₓ
Lemmas Even Odd not_even not_odd
NewLemmas Even Odd not_even not_odd
@@ -52,4 +52,4 @@ HiddenHint (A : Prop) (B : Prop) (h : A → B) (b : ¬ B) (a : A) : False =>
Conclusion ""
Tactics by_contra sufficesₓ haveₓ contradiction apply assumption
NewTactics by_contra sufficesₓ haveₓ contradiction apply assumption
@@ -46,4 +46,4 @@ HiddenHint (A : Prop) (B : Prop) : A → B ↔ (¬ B → ¬ A) =>
Conclusion ""
Tactics contradiction constructor intro by_contra sufficesₓ haveₓ apply assumption
NewTactics contradiction constructor intro by_contra sufficesₓ haveₓ apply assumption
@@ -61,5 +61,5 @@ Hint (n : ℕ) : Even n → ¬Odd (n ^ 2) =>
Hint (n : ℕ) : Even n → Even (n ^ 2) =>
"Diese Aussage hast du bereits als Lemma bewiesen, schau mal in der Bibliothek."
Tactics contrapose rw apply
Lemmas Even Odd not_even not_odd even_square
NewTactics contrapose rw apply
NewLemmas Even Odd not_even not_odd even_square
@@ -71,6 +71,6 @@ HiddenHint (n: ℕ) (h : Odd (n ^ 2)) (g : Even n) : Even (n ^ 2) =>
"Probiers mit `apply ...`"
Tactics contradiction by_contra rw apply assumption -- TODO: suffices, have
NewTactics contradiction by_contra rw apply assumption -- TODO: suffices, have
Lemmas Odd Even not_odd not_even even_square
NewLemmas Odd Even not_odd not_even even_square
@@ -23,4 +23,4 @@ Statement
: True := by
trivial
Tactics rw
NewTactics rw
@@ -37,4 +37,4 @@ HiddenHint (A : Prop) (B : Prop) (hb : B) : A → (A ∧ B) =>
Hint (A : Prop) (B : Prop) (ha : A) (hb : B) : (A ∧ B) =>
"Jetzt kannst du die Taktiken aus dem letzten Kapitel verwenden."
Tactics intro constructor assumption
NewTactics intro constructor assumption
@@ -39,4 +39,4 @@ dass $B$ wahr ist."
HiddenHint (A : Prop) (B : Prop) (ha : A) (h : A → B): B =>
"Mit `revert ha` kann man die Annahme `ha` als Implikationsprämisse vorne ans Goal anhängen."
Tactics revert assumption
NewTactics revert assumption
@@ -32,7 +32,7 @@ HiddenHint (A : Prop) (B : Prop) (hA : A) (g : A → B) : A =>
"Nachdem du die Implikation `A → B` angewendet hast, musst du nur noch $A$ zeigen,
dafür hast du bereits einen Beweis in den Annahmen."
Tactics apply assumption
NewTactics apply assumption
-- Katex notes
-- `\\( \\)` or `$ $` for inline
@@ -32,4 +32,4 @@ HiddenHint (A : Prop) (B : Prop) (C : Prop) (hA : A) (f : A → B) (g : B → C)
"Du willst $C$ beweisen. Suche also nach einer Implikation $\\ldots \\Rightarrow C$ und wende
diese mit `apply` an."
Tactics intro apply assumption revert
NewTactics intro apply assumption revert
@@ -48,6 +48,6 @@ Hint (A : Prop) (B : Prop) (C : Prop) (D : Prop) (E : Prop) (F : Prop)
(i : D → E) (k : E → F) (m : C → F) : D =>
"Sackgasse. Probier doch einen anderen Weg."
Tactics apply assumption revert intro
NewTactics apply assumption revert intro
-- https://www.jmilne.org/not/Mamscd.pdf
@@ -38,6 +38,6 @@ aus mehreren Einzelteilen besteht: `⟨A → B, B → A⟩`. Man sagt also Lean,
ob das Goal aus solchen Einzelteilen \"konstruiert\" werden kann.
"
Tactics constructor assumption
NewTactics constructor assumption
-- TODO : `case mpr =>` ist mathematisch noch sinnvoll.
@@ -71,4 +71,4 @@ Hint (A : Prop) (B : Prop) (C : Prop) (D : Prop) (h₁ : C ↔ D) (h₂ : D ↔
"Das ist nicht der optimale Weg..."
Tactics rw assumption
NewTactics rw assumption
@@ -41,4 +41,4 @@ Hint (A : Prop) (B : Prop) (C : Prop) (h : A ↔ B) (g : B → C) (hA : A) : B =
Conclusion "Im nächsten Level findest du die zweite Option."
Tactics apply assumption
NewTactics apply assumption
@@ -36,7 +36,7 @@ Conclusion
"
"
Tactics intro apply rcases assumption
NewTactics intro apply rcases assumption
-- -- TODO: The new `cases` works differntly. There is also `cases'`
-- example (A B : Prop) : (A ↔ B) → (A → B) := by
@@ -50,6 +50,6 @@ Conclusion
"
"
Tactics apply left right assumption
NewTactics apply left right assumption
Lemmas not_or_of_imp
NewLemmas not_or_of_imp
@@ -34,6 +34,6 @@ Conclusion
`rw` hat automatisch `rfl` ausgeführt und dadurch den Beweis beendet.
"
Tactics rw
NewTactics rw
Lemmas not_not not_or_of_imp
NewLemmas not_not not_or_of_imp
@@ -76,6 +76,6 @@ HiddenHint (A : Prop) (B: Prop) (h : ¬ A ∨ B) (ha : A) : B =>
HiddenHint (A : Prop) (B: Prop) (ha : A) (ha' : ¬A) : B =>
"Findest du einen Widerspruch?"
Tactics rfl assumption trivial left right constructor rcases
NewTactics rfl assumption trivial left right constructor rcases
Lemmas not_not not_or_of_imp
NewLemmas not_not not_or_of_imp
@@ -43,4 +43,4 @@ Statement
(n : ℕ) : (∑ i : Fin n, (0 + 0)) = 0 := by
simp
Tactics simp
NewTactics simp
@@ -34,4 +34,4 @@ Statement
simp
ring
Tactics rw simp ring
NewTactics rw simp ring
@@ -42,4 +42,4 @@ Statement arithmetic_sum
simp_rw [Nat.succ_eq_one_add]
ring
Tactics ring
NewTactics ring
@@ -27,4 +27,4 @@ $\\sum_{i = 0}^n (2n + 1) = n ^ 2$."
rw [hn, Nat.succ_eq_add_one]
ring
Tactics ring
NewTactics ring
@@ -44,4 +44,4 @@ Statement
-- rw [mul_add, hn]
-- ring
Tactics ring
NewTactics ring
@@ -44,4 +44,4 @@ Statement
rw [hn]
Tactics ring
NewTactics ring
@@ -29,4 +29,4 @@ example (n : ℕ) (h : 5 ≤ n) : n^2 < 2 ^ n
sorry
| n + 5 => by sorry
Tactics rw simp ring
NewTactics rw simp ring
@@ -23,10 +23,4 @@ Statement
sorry
sorry
Tactics rw simp ring
-- example (n : ℕ) : (n - 1) * (n + 1) = (n ^ 2 - 1) := by
-- induction' n with n hn
-- ring
-- rw [Nat.succ_eq_one_add]
-- rw []
NewTactics rw simp ring
@@ -21,7 +21,7 @@ Statement
(n : ℕ) : True := by
trivial
Tactics simp
NewTactics simp
-- Σ_i Σ_j ... = Σ_j Σ_i ...
@@ -29,4 +29,4 @@ Statement
"TODO" : True := by
trivial
Tactics rw
NewTactics rw
@@ -67,4 +67,4 @@ Hint (A : Prop) (B : Prop) (C : Prop) (h : A ∧ B) : C ∧ A =>
Hint (A : Prop) (B : Prop) (C : Prop) (h : A → C) : C ∧ A =>
"Ein UND im Goal kann mit `constructor` aufgeteilt werden."
Tactics left right assumption constructor rcases
NewTactics left right assumption constructor rcases
@@ -20,4 +20,4 @@ Conclusion
"
"
Tactics ring
NewTactics ring
@@ -20,4 +20,4 @@ Conclusion
"
"
Tactics ring
NewTactics ring
@@ -58,4 +58,4 @@ Hint (n : ℕ) (hn : odd n) (h : ∀ (x : ℕ), (odd x) → even (x + 1)) : even
"`∀ (x : ℕ), (odd x) → even (x + 1)` ist eigentlich das gleiche wie
`(x : ℕ) → `"
Tactics ring intro unfold
NewTactics ring intro unfold
@@ -22,4 +22,4 @@ Statement : ∃ (f : ℕ → ℕ), ∀ (x : ℕ), f x = 0 := by
Conclusion ""
Tactics use simp
NewTactics use simp
@@ -39,6 +39,6 @@ Ring zu lösen, funktioniert aber auch auf `ℕ`, auch wenn dieses kein Ring ist
(erst `ℤ` ist ein Ring).
"
Tactics ring
NewTactics ring
#eval 4 / 6
@@ -67,4 +67,4 @@ Hint (a : ℕ) (b : ℕ) (c : ℕ) (d : ℕ) (h₁ : c = d) (h₂ : d = b) (h₃
Conclusion "Übrigens, mit `rw [h₁, ←h₂]` könnte man mehrere `rw` zusammenfassen."
Tactics assumption rw
NewTactics assumption rw
@@ -37,4 +37,4 @@ Hint (a : ℕ) (b : ℕ) (h : a = b) (g : a + a ^ 2 = b + 1) : a + a ^ 2 = a + 1
Conclusion "Übrigens, mit `rw [h] at *` kann man im weiteren `h` in **allen** Annahmen und
dem Goal umschreiben."
Tactics assumption rw
NewTactics assumption rw
@@ -30,4 +30,4 @@ Hint (y : ℕ) : (2 * y + 1) ^ 2 = 4 * y ^ 2 + 3 * y + 1 + y =>
Conclusion ""
Tactics ring rw
NewTactics ring rw
@@ -28,4 +28,4 @@ Conclusion
aufzurufen, deshalb brauchst du das nur noch selten.
"
Tactics rfl
NewTactics rfl
@@ -67,5 +67,5 @@ Hint (n : ℕ) (x : ℕ) (hx : n = x + x) : n ^ 2 = 2 * x ^ 2 + 2 * x ^ 2 =>
Hint (n : ℕ) (x : ℕ) (hx : n = x + x) : (x + x) ^ 2 = 2 * x ^ 2 + 2 * x ^ 2 =>
"Die Taktik `ring` löst solche Gleichungen."
Tactics unfold rcases use rw ring
Lemmas Even Odd
NewTactics unfold rcases use rw ring
NewLemmas Even Odd
@@ -50,4 +50,4 @@ Hint (n : ℕ) (hn : Odd n) (h : ∀ (x : ℕ), (Odd x) → Even (x + 1)) : Even
Conclusion "Für-alle-Statements, Implikationen und Lemmas/Theoreme verhalten sich alle
praktisch gleich. Mehr dazu später."
Tactics ring intro unfold
NewTactics ring intro unfold
@@ -62,6 +62,6 @@ Hint (n : ℕ) : n + n = 2 * n => "Recap: `ring` löst Gleichungen in `ℕ`."
Conclusion ""
Tactics push_neg intro use rw unfold ring
NewTactics push_neg intro use rw unfold ring
Lemmas Even Odd not_even not_odd not_exists not_forall
NewLemmas Even Odd not_even not_odd not_exists not_forall
@@ -50,6 +50,6 @@ Statement
Conclusion ""
Tactics push_neg intro use rw unfold ring
NewTactics push_neg intro use rw unfold ring
Lemmas Even Odd not_even not_odd not_exists not_forall
NewLemmas Even Odd not_even not_odd not_exists not_forall
@@ -36,6 +36,6 @@ example : True := by
Conclusion ""
Tactics
NewTactics
Lemmas
NewLemmas
@@ -48,4 +48,4 @@ HiddenHint (A : Prop) (B : Prop) (C : Prop): ¬((¬B ∨ ¬ C) ∨ (A → B))
Conclusion ""
Tactics tauto
NewTactics tauto
@@ -27,4 +27,5 @@ HiddenHint : 42 = 42 =>
Conclusion "Bravo! PS: `rfl` steht für \"reflexivity\"."
Tactics rfl
NewTactics rfl
DisabledTactics tauto
@@ -32,4 +32,5 @@ HiddenHint (n : ℕ) (h : 1 < n) : 1 < n =>
Conclusion ""
Tactics assumption
NewTactics assumption
DisabledTactics tauto
@@ -27,4 +27,5 @@ HiddenHint (A : Prop) (hA : A) : A =>
Conclusion ""
Tactics assumption
NewTactics assumption
DisabledTactics tauto
@@ -33,4 +33,5 @@ True := by
Conclusion ""
Tactics trivial
NewTactics trivial
DisabledTactics tauto
@@ -21,4 +21,5 @@ Statement
Conclusion ""
Tactics trivial
NewTactics trivial
DisabledTactics tauto
@@ -27,4 +27,5 @@ HiddenHint (A : Prop) (h : False) : A =>
"Wenn man einen Beweis von `False` hat, kann man mit `contradiction` das Goal beweisen,
unabhängig davon, was das Goal ist."
Tactics contradiction
NewTactics contradiction
DisabledTactics tauto
@@ -26,4 +26,5 @@ Conclusion
"
"
Tactics contradiction
NewTactics contradiction
DisabledTactics tauto
@@ -29,4 +29,5 @@ Conclusion
"
"
Tactics contradiction
NewTactics contradiction
DisabledTactics tauto
@@ -32,7 +32,8 @@ HiddenHint (A : Prop) (B : Prop) (hA : A) (hB : B) : A ∧ B =>
HiddenHint (A : Prop) (hA : A) : A =>
"Du hast einen Beweis dafür in den *Annahmen*."
Tactics constructor assumption
NewTactics constructor assumption
DisabledTactics tauto
-- Statement
-- "Zeige $(A \\land (A \\Rightarrow B)) \\iff (A \\land B)$."
@@ -33,7 +33,8 @@ HiddenHint (A : Prop) (B : Prop) (C : Prop) (h : A ∧ (B ∧ C)) : B =>
HiddenHint (A : Prop) (hA : A) : A =>
"Du hast einen Beweis dafür in den *Annahmen*."
Tactics constructor assumption
NewTactics constructor assumption
DisabledTactics tauto
-- Statement
-- "Zeige $(A \\land (A \\Rightarrow B)) \\iff (A \\land B)$."
@@ -30,4 +30,5 @@ HiddenHint (A : Prop) (B : Prop) (hA : A) : A ∨ (¬ B) =>
Hint (A : Prop) (B : Prop) (hA : A) : ¬ B =>
"Sackgasse. Probier's nochmals."
Tactics left right assumption
NewTactics left right assumption
DisabledTactics tauto
@@ -44,4 +44,5 @@ HiddenHint (A : Prop) (B : Prop) (h : A ∨ (A ∧ B)) : A =>
Hint (A : Prop) (B : Prop) (h : A ∧ B) : A =>
"Jetzt noch das UND in den Annahmen mit `rcases h with ⟨h₁, h₂⟩` zerlegen."
Tactics assumption rcases
NewTactics assumption rcases
DisabledTactics tauto
@@ -122,4 +122,5 @@ HiddenHint (A : Prop) (B : Prop) (C : Prop) (h : B ∧ C) : (A ∨ C) =>
HiddenHint (A : Prop) (B : Prop) : A ∨ B =>
"`left` oder `right`?"
Tactics left right assumption constructor rcases rfl contradiction trivial
NewTactics left right assumption constructor rcases rfl contradiction trivial
DisabledTactics tauto
@@ -21,4 +21,4 @@ Statement
: True := by
trivial
Tactics rw
NewTactics rw
@@ -39,4 +39,4 @@ Statement mem_univ
trivial
-- tauto
Tactics tauto trivial
NewTactics tauto trivial
@@ -39,7 +39,7 @@ Statement subset_empty_iff
intro h hA
apply mem_univ -- or `trivial`.
Tactics intro trivial apply
NewTactics intro trivial apply
-- blocked: tauto simp
end MySet
@@ -54,8 +54,8 @@ Statement subset_empty_iff
rcases a with ⟨h₁, h₂⟩
assumption
Tactics constructor intro rw assumption rcases simp tauto trivial
NewTactics constructor intro rw assumption rcases simp tauto trivial
Lemmas Subset.antisymm_iff empty_subset
NewLemmas Subset.antisymm_iff empty_subset
end MySet
@@ -45,8 +45,8 @@ Statement eq_empty_iff_forall_not_mem
rw [←subset_empty_iff]
rfl -- This is quite a miracle :)
Tactics constructor intro rw assumption rcases simp tauto trivial
NewTactics constructor intro rw assumption rcases simp tauto trivial
Lemmas Subset.antisymm_iff empty_subset
NewLemmas Subset.antisymm_iff empty_subset
end MySet
@@ -30,6 +30,6 @@ Statement nonempty_iff_ne_empty
push_neg
rfl
Tactics constructor intro rw assumption rcases simp tauto trivial
NewTactics constructor intro rw assumption rcases simp tauto trivial
Lemmas Subset.antisymm_iff empty_subset
NewLemmas Subset.antisymm_iff empty_subset
@@ -26,6 +26,6 @@ Statement
"" (A B : Set ℕ) : (A ∪ ∅) ∩ B = A ∩ (univ ∩ B) := by
simp
Tactics constructor intro rw assumption rcases simp tauto trivial
NewTactics constructor intro rw assumption rcases simp tauto trivial
Lemmas Subset.antisymm_iff empty_subset
NewLemmas Subset.antisymm_iff empty_subset
@@ -30,6 +30,6 @@ Statement
rw [←union_diff_distrib]
rw [univ_union]
Tactics constructor intro rw assumption rcases simp tauto trivial
NewTactics constructor intro rw assumption rcases simp tauto trivial
Lemmas Subset.antisymm_iff empty_subset
NewLemmas Subset.antisymm_iff empty_subset
@@ -30,6 +30,6 @@ Statement
rw [←not_mem_compl_iff]
exact h4
Tactics constructor intro rw assumption rcases simp tauto trivial
NewTactics constructor intro rw assumption rcases simp tauto trivial
Lemmas Subset.antisymm_iff empty_subset
NewLemmas Subset.antisymm_iff empty_subset
@@ -22,7 +22,7 @@ man die de-Morganschen Regeln einfach selber beweisen könnten.
Die meisten Aufgaben über Mengen sind eine Kombination von `rw` und `simp_rw` verschiedenster
Lemmas in `import Mathlib.Data.Set`.
NewLemmas in `import Mathlib.Data.Set`.
Die Taktik `simp_rw` funktioniert ähnlich wie `rw`, aber sie versucht jedes Lemma so oft
wie möglich anzuwenden. Wir kennen also 4 etwas verwandte Optionen um Lemmas und Theoreme zu
@@ -52,7 +52,7 @@ Statement
rw [diff_eq_compl_inter]
rw [inter_comm]
Tactics constructor intro rw assumption rcases simp tauto trivial
NewTactics constructor intro rw assumption rcases simp tauto trivial
-- TODOs
-- Lemmas compl_union compl_inter mem_compl_iff
@@ -33,6 +33,6 @@ Statement
rw [Set.mem_diff]
exact hx
Tactics constructor intro rw assumption rcases simp tauto trivial
NewTactics constructor intro rw assumption rcases simp tauto trivial
Lemmas Subset.antisymm_iff empty_subset
NewLemmas Subset.antisymm_iff empty_subset
@@ -32,6 +32,6 @@ Statement
({4, 9} : Set ℕ) = Set.insert 4 {9} := by
rfl
Tactics constructor intro rw assumption rcases simp tauto trivial
NewTactics constructor intro rw assumption rcases simp tauto trivial
Lemmas Subset.antisymm_iff empty_subset
NewLemmas Subset.antisymm_iff empty_subset
@@ -35,5 +35,5 @@ Statement
simp_rw [mem_insert_iff, mem_singleton_iff] at *
tauto
Tactics simp_rw intro tauto rw
NewTactics simp_rw intro tauto rw
--Lemmas Subset.antisymm_iff empty_subset
@@ -32,6 +32,6 @@ Statement
use 1
ring
Tactics constructor intro rw assumption rcases simp tauto trivial
NewTactics constructor intro rw assumption rcases simp tauto trivial
Lemmas Subset.antisymm_iff empty_subset
NewLemmas Subset.antisymm_iff empty_subset
@@ -37,6 +37,6 @@ Statement
assumption
Tactics constructor intro rw assumption rcases simp tauto trivial
NewTactics constructor intro rw assumption rcases simp tauto trivial
Lemmas Subset.antisymm_iff empty_subset
NewLemmas Subset.antisymm_iff empty_subset
@@ -36,6 +36,6 @@ Statement
ring
Tactics constructor intro rw assumption rcases simp tauto trivial
NewTactics constructor intro rw assumption rcases simp tauto trivial
Lemmas Subset.antisymm_iff empty_subset
NewLemmas Subset.antisymm_iff empty_subset
@@ -34,6 +34,6 @@ Statement
ring
Tactics constructor intro rw assumption rcases simp tauto trivial
NewTactics constructor intro rw assumption rcases simp tauto trivial
Lemmas Subset.antisymm_iff empty_subset
NewLemmas Subset.antisymm_iff empty_subset
@@ -28,6 +28,6 @@ Statement
{ x ∈ (S : Set ℤ) | 0 ≤ x} ⊆ S := by
library_search
Tactics constructor intro rw assumption rcases simp tauto trivial
NewTactics constructor intro rw assumption rcases simp tauto trivial
Lemmas Subset.antisymm_iff empty_subset
NewLemmas Subset.antisymm_iff empty_subset
@@ -23,6 +23,6 @@ Statement
use 1
ring
Tactics constructor intro rw assumption rcases simp tauto trivial
NewTactics constructor intro rw assumption rcases simp tauto trivial
Lemmas Subset.antisymm_iff empty_subset
NewLemmas Subset.antisymm_iff empty_subset
@@ -22,6 +22,6 @@ open Set
Statement
"" : True := sorry
Tactics constructor intro rw assumption rcases simp tauto trivial
NewTactics constructor intro rw assumption rcases simp tauto trivial
Lemmas Subset.antisymm_iff empty_subset
NewLemmas Subset.antisymm_iff empty_subset
@@ -23,6 +23,6 @@ Statement
use 1
ring
Tactics constructor intro rw assumption rcases simp tauto trivial
NewTactics constructor intro rw assumption rcases simp tauto trivial
Lemmas Subset.antisymm_iff empty_subset
NewLemmas Subset.antisymm_iff empty_subset
@@ -54,8 +54,7 @@ Statement
rw [←Set.union_diff_distrib]
rw [Set.univ_union]
Tactics rw
NewTactics rw
example : 4 ∈ (univ : Set ℕ) := by
trivial
@@ -35,4 +35,4 @@ lemma asdf (a b c d : ℕ) (h₁ : c = d) (h₂ : a = b) (h₃ : a = d) : b = c
Conclusion ""
Tactics assumption
NewTactics assumption
-2
View File
@@ -258,5 +258,3 @@ Prove:
TacticDoc intro
"Useful to introduce stuff"
TacticSet basics := rfl induction_on intro rewrite