bump mathlib and fixes

pull/54/head
Jon Eugster 2 years ago
parent 421606aaed
commit 27e82378d0

@ -1 +1 @@
leanprover/lean4:nightly-2023-02-10 leanprover/lean4:nightly-2023-03-09

@ -114,14 +114,14 @@ DefinitionDoc StrictMono
" "
LemmaDoc not_odd as not_odd in "Nat" LemmaDoc even_iff_not_odd as even_iff_not_odd in "Nat"
"`¬ (odd n) ↔ even n`" "`Even n ↔ ¬ (Odd n)`"
LemmaDoc not_even as not_even in "Nat" LemmaDoc odd_iff_not_even as odd_iff_not_even in "Nat"
"`¬ (even n) ↔ odd n`" "`Odd n ↔ ¬ (Even n)`"
LemmaDoc even_square as even_square in "Nat" LemmaDoc even_square as even_square in "Nat"
"`∀ (n : ), even n → even (n ^ 2)`" "`∀ (n : ), Even n → Even (n ^ 2)`"

@ -42,6 +42,7 @@ Endeckungen zeigen. Schaut, darunter ist eine Aufgabe.
-- logisch equivalent sind. -- logisch equivalent sind.
-- Wenn das Goal eine Implikation ist, kann man `contrapose` anwenden. -- Wenn das Goal eine Implikation ist, kann man `contrapose` anwenden.
open Nat
Statement (n : ) (h : Odd (n ^ 2)): Odd n := by Statement (n : ) (h : Odd (n ^ 2)): Odd n := by
Hint "**Oddeus**: Wie soll das den gehen? Hint "**Oddeus**: Wie soll das den gehen?
@ -56,9 +57,9 @@ Statement (n : ) (h : Odd (n ^ 2)): Odd n := by
revert h revert h
Hint "*Oddeus*: Ob man jetzt wohl dieses `contrapose` benutzen kann?" Hint "*Oddeus*: Ob man jetzt wohl dieses `contrapose` benutzen kann?"
contrapose contrapose
Hint (hidden := true) "**Du**: Warte mal, jetzt kann man wohl `not_odd` verwenden…" Hint (hidden := true) "**Du**: Warte mal, jetzt kann man wohl `even_iff_not_odd` verwenden…"
rw [not_odd] rw [← even_iff_not_odd]
rw [not_odd] rw [← even_iff_not_odd]
Hint "**Robo**: Und den Rest hast du bei *Evenine* als Lemma gezeigt!" Hint "**Robo**: Und den Rest hast du bei *Evenine* als Lemma gezeigt!"
apply even_square apply even_square

@ -27,6 +27,8 @@ und \"per Kontraposition\", beweise die Gleiche Aufgabe indem
du mit `by_contra` einen Widerspruch suchst. du mit `by_contra` einen Widerspruch suchst.
" "
open Nat
Statement (n : ) (h : Odd (n ^ 2)) : Odd n := by Statement (n : ) (h : Odd (n ^ 2)) : Odd n := by
Hint "**Robo**: Fang diesmal mit `by_contra g` an!" Hint "**Robo**: Fang diesmal mit `by_contra g` an!"
by_contra g by_contra g
@ -34,7 +36,7 @@ Statement (n : ) (h : Odd (n ^ 2)) : Odd n := by
Hint "**Robo**: Also `suffices g : ¬ Odd (n ^ 2)`." Hint "**Robo**: Also `suffices g : ¬ Odd (n ^ 2)`."
suffices d : ¬ Odd (n ^ 2) suffices d : ¬ Odd (n ^ 2)
contradiction contradiction
rw [not_odd] at * rw [←even_iff_not_odd] at *
apply even_square apply even_square
assumption assumption

@ -29,6 +29,7 @@ and eine Wand aus Dornenranken. Beim Eingang steht eine Wache, die auch zuruft:
-- (welche man auch mit `rw` explizit benutzen könnte.) -- (welche man auch mit `rw` explizit benutzen könnte.)
open Nat
Statement : ¬ ∃ (n : ), ∀ (k : ) , Odd (n + k) := by Statement : ¬ ∃ (n : ), ∀ (k : ) , Odd (n + k) := by
Hint "**Du**: Also ich kann mal das `¬` durch die Quantifier hindurchschieben. Hint "**Du**: Also ich kann mal das `¬` durch die Quantifier hindurchschieben.
@ -46,29 +47,31 @@ Statement : ¬ ∃ (n : ), ∀ (k : ) , Odd (n + k) := by
unfold Odd unfold Odd
push_neg push_neg
Hint "**Robo**: Der Weg ist etwas schwieriger. Ich würde nochmals zurück und schauen, Hint "**Robo**: Der Weg ist etwas schwieriger. Ich würde nochmals zurück und schauen,
dass du irgendwann `¬Odd` kriegst, was du dann mit `rw [not_odd]` zu `Even` umwandeln dass du irgendwann `¬Odd` kriegst, was du dann mit `rw [←even_iff_not_odd]`
zu `Even` umwandeln.
kannst." kannst."
push_neg push_neg
intro n intro n
Hint "**Robo**: Welche Zahl du jetzt mit `use` brauchst, danach wirst du vermutlich das Hint "**Robo**: Welche Zahl du jetzt mit `use` brauchst, danach wirst du vermutlich das
Lemma `not_odd` brauchen. Lemma `←even_iff_not_odd` brauchen.
**Du**: Könnte ich jetzt schon `rw [not_odd]` machen? **Du**: Könnte ich jetzt schon `rw [←even_iff_not_odd]` machen?
**Robo**: Ne, `rw` kann nicht innerhalb von Quantifiern umschreiben. **Robo**: Ne, `rw` kann nicht innerhalb von Quantifiern umschreiben.
**Du**: Aber wie würde ich das machen? **Du**: Aber wie würde ich das machen?
**Robo**: Zeig ich dir später, die Wache wird schon ganz ungeduldig!" **Robo**: Zeig ich dir später, die Wache wird schon ganz ungeduldig!
Im Moment würde ich zuerst mit `use` eine richtige Zahl angeben, und danach umschreiben."
Branch Branch
use n + 2 use n + 2
Hint "**Robo**: Gute Wahl! Jetzt kannst du `not_odd` verwenden." Hint "**Robo**: Gute Wahl! Jetzt kannst du `←even_iff_not_odd` verwenden."
Branch Branch
use n + 4 use n + 4
Hint "**Robo**: Gute Wahl! Jetzt kannst du `not_odd` verwenden." Hint "**Robo**: Gute Wahl! Jetzt kannst du `←even_iff_not_odd` verwenden."
use n use n
Hint "**Robo**: Gute Wahl! Jetzt kannst du `not_odd` verwenden." Hint "**Robo**: Gute Wahl! Jetzt kannst du `←even_iff_not_odd` verwenden."
rw [not_odd] rw [←even_iff_not_odd]
unfold Even unfold Even
use n use n
--ring --ring
@ -103,4 +106,4 @@ ist deine!
" "
NewTactic push_neg NewTactic push_neg
NewLemma not_even not_odd not_exists not_forall NewLemma even_iff_not_odd odd_iff_not_even not_exists not_forall

@ -1,10 +1,10 @@
import Mathlib import Mathlib
lemma not_odd {n : } : ¬ Odd n ↔ Even n := by -- lemma not_odd {n : } : ¬ Odd n ↔ Even n := by
sorry -- sorry
lemma not_even {n : } : ¬ Even n ↔ Odd n := by -- lemma not_even {n : } : ¬ Even n ↔ Odd n := by
sorry -- sorry
lemma even_square (n : ) : Even n → Even (n ^ 2) := by lemma even_square (n : ) : Even n → Even (n ^ 2) := by
intro ⟨x, hx⟩ intro ⟨x, hx⟩
@ -13,72 +13,58 @@ lemma even_square (n : ) : Even n → Even (n ^ 2) := by
rw [hx] rw [hx]
ring ring
section powerset -- section powerset
open Set -- open Set
namespace Finset -- namespace Finset
theorem powerset_singleton {U : Type _} [DecidableEq U] (x : U) : -- theorem powerset_singleton {U : Type _} [DecidableEq U] (x : U) :
Finset.powerset {x} = {∅, {x}} := by -- Finset.powerset {x} = {∅, {x}} := by
ext y -- ext y
rw [mem_powerset, subset_singleton_iff, mem_insert, mem_singleton] -- rw [mem_powerset, subset_singleton_iff, mem_insert, mem_singleton]
end Finset -- end Finset
/- The powerset of a singleton contains only `∅` and the singleton. -/ -- /- The powerset of a singleton contains only `∅` and the singleton. -/
theorem powerset_singleton {U : Type _} (x : U) : -- theorem powerset_singleton {U : Type _} (x : U) :
𝒫 ({x} : Set U) = {∅, {x}} := by -- 𝒫 ({x} : Set U) = {∅, {x}} := by
ext y -- ext y
rw [mem_powerset_iff, subset_singleton_iff_eq, mem_insert_iff, mem_singleton_iff] -- rw [mem_powerset_iff, subset_singleton_iff_eq, mem_insert_iff, mem_singleton_iff]
theorem subset_insert_iff_of_not_mem {U : Type _ } {s t : Set U} {a : U} (h : a ∉ s) -- theorem subset_insert_iff_of_not_mem' {U : Type _ } {s t : Set U} {a : U} (h : a ∉ s)
: s ⊆ insert a t ↔ s ⊆ t := by -- (g : s ⊆ t) : s ⊆ insert a t := by
constructor -- intro y hy
· intro g y hy -- specialize g hy
specialize g hy -- exact mem_insert_of_mem _ g
rw [mem_insert_iff] at g
rcases g with g | g -- lemma mem_powerset_insert_iff {U : Type _} (A S : Set U) (x : U) :
· rw [g] at hy -- S ∈ 𝒫 (insert x A) ↔ S ∈ 𝒫 A ∃ B ∈ 𝒫 A , insert x B = S := by
contradiction -- simp_rw [mem_powerset_iff]
· assumption -- constructor
· intro g y hy -- · intro h
specialize g hy -- by_cases hs : x ∈ S
exact mem_insert_of_mem _ g -- · right
-- use S \ {x}
theorem subset_insert_iff_of_not_mem' {U : Type _ } {s t : Set U} {a : U} (h : a ∉ s) -- rw [insert_diff_singleton, insert_eq_of_mem hs, diff_singleton_subset_iff]
(g : s ⊆ t) : s ⊆ insert a t := by -- exact ⟨h, rfl⟩
intro y hy -- · left
specialize g hy -- exact (subset_insert_iff_of_not_mem hs).mp h
exact mem_insert_of_mem _ g -- · intro h
-- rcases h with h | ⟨B, h₁, h₂⟩
lemma mem_powerset_insert_iff {U : Type _} (A S : Set U) (x : U) : -- · exact le_trans h (subset_insert x A)
S ∈ 𝒫 (insert x A) ↔ S ∈ 𝒫 A ∃ B ∈ 𝒫 A , insert x B = S := by -- · rw [←h₂]
simp_rw [mem_powerset_iff] -- exact insert_subset_insert h₁
constructor
· intro h -- lemma mem_powerset_insert_iff' {U : Type _} (A S : Set U) (x : U) :
by_cases hs : x ∈ S -- S ∈ 𝒫 (insert x A) ↔ S \ {x} ∈ 𝒫 A := by
· right -- rw [mem_powerset_iff, mem_powerset_iff, diff_singleton_subset_iff]
use S \ {x}
rw [insert_diff_singleton, insert_eq_of_mem hs, diff_singleton_subset_iff] -- lemma powerset_insert {U : Type _} (A : Set U) (x : U) :
exact ⟨h, rfl⟩ -- 𝒫 (insert x A) = A.powerset A.powerset.image (insert x) := by
· left -- ext y
exact (subset_insert_iff_of_not_mem hs).mp h -- rw [mem_powerset_insert_iff, mem_union, mem_image]
· intro h
rcases h with h | ⟨B, h₁, h₂⟩
· exact le_trans h (subset_insert x A)
· rw [←h₂] -- end powerset
exact insert_subset_insert h₁
lemma mem_powerset_insert_iff' {U : Type _} (A S : Set U) (x : U) :
S ∈ 𝒫 (insert x A) ↔ S \ {x} ∈ 𝒫 A := by
rw [mem_powerset_iff, mem_powerset_iff, diff_singleton_subset_iff]
lemma powerset_insert {U : Type _} (A : Set U) (x : U) :
𝒫 (insert x A) = A.powerset A.powerset.image (insert x) := by
ext y
rw [mem_powerset_insert_iff, mem_union, mem_image]
end powerset

@ -4,25 +4,25 @@
[{"git": [{"git":
{"url": "https://github.com/leanprover-community/mathlib4.git", {"url": "https://github.com/leanprover-community/mathlib4.git",
"subDir?": null, "subDir?": null,
"rev": "c8bff08cf815e8881e95967259910524100adfb0", "rev": "fc4a489c2af75f687338fe85c8901335360f8541",
"name": "mathlib", "name": "mathlib",
"inputRev?": "master"}}, "inputRev?": "master"}},
{"git": {"git":
{"url": "https://github.com/gebner/quote4", {"url": "https://github.com/gebner/quote4",
"subDir?": null, "subDir?": null,
"rev": "7ac99aa3fac487bec1d5860e751b99c7418298cf", "rev": "cc915afc9526e904a7b61f660d330170f9d60dd7",
"name": "Qq", "name": "Qq",
"inputRev?": "master"}}, "inputRev?": "master"}},
{"git": {"git":
{"url": "https://github.com/JLimperg/aesop", {"url": "https://github.com/JLimperg/aesop",
"subDir?": null, "subDir?": null,
"rev": "ba61f7fec6174d8c7d2796457da5a8d0b0da44c6", "rev": "071464ac36e339afb7a87640aa1f8121f707a59a",
"name": "aesop", "name": "aesop",
"inputRev?": "master"}}, "inputRev?": "master"}},
{"path": {"name": "GameServer", "dir": "./../leanserver"}}, {"path": {"name": "GameServer", "dir": "./../leanserver"}},
{"git": {"git":
{"url": "https://github.com/leanprover/std4", {"url": "https://github.com/leanprover/std4",
"subDir?": null, "subDir?": null,
"rev": "de7e2a79905a3f87cad1ad5bf57045206f9738c7", "rev": "44a92d84c31a88b9af9329a441890ad449d8cd5f",
"name": "std", "name": "std",
"inputRev?": "main"}}]} "inputRev?": "main"}}]}

@ -1 +1 @@
leanprover/lean4:nightly-2023-02-10 leanprover/lean4:nightly-2023-03-09

Loading…
Cancel
Save