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"
"`¬ (odd n) ↔ even n`"
LemmaDoc even_iff_not_odd as even_iff_not_odd in "Nat"
"`Even n ↔ ¬ (Odd n)`"
LemmaDoc not_even as not_even in "Nat"
"`¬ (even n) ↔ odd n`"
LemmaDoc odd_iff_not_even as odd_iff_not_even in "Nat"
"`Odd n ↔ ¬ (Even n)`"
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.
-- Wenn das Goal eine Implikation ist, kann man `contrapose` anwenden.
open Nat
Statement (n : ) (h : Odd (n ^ 2)): Odd n := by
Hint "**Oddeus**: Wie soll das den gehen?
@ -56,9 +57,9 @@ Statement (n : ) (h : Odd (n ^ 2)): Odd n := by
revert h
Hint "*Oddeus*: Ob man jetzt wohl dieses `contrapose` benutzen kann?"
contrapose
Hint (hidden := true) "**Du**: Warte mal, jetzt kann man wohl `not_odd` verwenden…"
rw [not_odd]
rw [not_odd]
Hint (hidden := true) "**Du**: Warte mal, jetzt kann man wohl `even_iff_not_odd` verwenden…"
rw [← even_iff_not_odd]
rw [← even_iff_not_odd]
Hint "**Robo**: Und den Rest hast du bei *Evenine* als Lemma gezeigt!"
apply even_square

@ -27,6 +27,8 @@ und \"per Kontraposition\", beweise die Gleiche Aufgabe indem
du mit `by_contra` einen Widerspruch suchst.
"
open Nat
Statement (n : ) (h : Odd (n ^ 2)) : Odd n := by
Hint "**Robo**: Fang diesmal mit `by_contra g` an!"
by_contra g
@ -34,7 +36,7 @@ Statement (n : ) (h : Odd (n ^ 2)) : Odd n := by
Hint "**Robo**: Also `suffices g : ¬ Odd (n ^ 2)`."
suffices d : ¬ Odd (n ^ 2)
contradiction
rw [not_odd] at *
rw [←even_iff_not_odd] at *
apply even_square
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.)
open Nat
Statement : ¬ ∃ (n : ), ∀ (k : ) , Odd (n + k) := by
Hint "**Du**: Also ich kann mal das `¬` durch die Quantifier hindurchschieben.
@ -46,29 +47,31 @@ Statement : ¬ ∃ (n : ), ∀ (k : ) , Odd (n + k) := by
unfold Odd
push_neg
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."
push_neg
intro n
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.
**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
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
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
Hint "**Robo**: Gute Wahl! Jetzt kannst du `not_odd` verwenden."
rw [not_odd]
Hint "**Robo**: Gute Wahl! Jetzt kannst du `←even_iff_not_odd` verwenden."
rw [←even_iff_not_odd]
unfold Even
use n
--ring
@ -103,4 +106,4 @@ ist deine!
"
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
lemma not_odd {n : } : ¬ Odd n ↔ Even n := by
sorry
-- lemma not_odd {n : } : ¬ Odd n ↔ Even n := by
-- sorry
lemma not_even {n : } : ¬ Even n ↔ Odd 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⟩
@ -13,72 +13,58 @@ lemma even_square (n : ) : Even n → Even (n ^ 2) := by
rw [hx]
ring
section powerset
open Set
namespace Finset
theorem powerset_singleton {U : Type _} [DecidableEq U] (x : U) :
Finset.powerset {x} = {∅, {x}} := by
ext y
rw [mem_powerset, subset_singleton_iff, mem_insert, mem_singleton]
end Finset
/- The powerset of a singleton contains only `∅` and the singleton. -/
theorem powerset_singleton {U : Type _} (x : U) :
𝒫 ({x} : Set U) = {∅, {x}} := by
ext y
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)
: s ⊆ insert a t ↔ s ⊆ t := by
constructor
· intro g y hy
specialize g hy
rw [mem_insert_iff] at g
rcases g with g | g
· rw [g] at hy
contradiction
· assumption
· intro g y hy
specialize g hy
exact mem_insert_of_mem _ g
theorem subset_insert_iff_of_not_mem' {U : Type _ } {s t : Set U} {a : U} (h : a ∉ s)
(g : s ⊆ t) : s ⊆ insert a t := by
intro y hy
specialize g hy
exact mem_insert_of_mem _ g
lemma mem_powerset_insert_iff {U : Type _} (A S : Set U) (x : U) :
S ∈ 𝒫 (insert x A) ↔ S ∈ 𝒫 A ∃ B ∈ 𝒫 A , insert x B = S := by
simp_rw [mem_powerset_iff]
constructor
· intro h
by_cases hs : x ∈ S
· right
use S \ {x}
rw [insert_diff_singleton, insert_eq_of_mem hs, diff_singleton_subset_iff]
exact ⟨h, rfl⟩
· left
exact (subset_insert_iff_of_not_mem hs).mp h
· intro h
rcases h with h | ⟨B, h₁, h₂⟩
· exact le_trans h (subset_insert x A)
· rw [←h₂]
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
-- section powerset
-- open Set
-- namespace Finset
-- theorem powerset_singleton {U : Type _} [DecidableEq U] (x : U) :
-- Finset.powerset {x} = {∅, {x}} := by
-- ext y
-- rw [mem_powerset, subset_singleton_iff, mem_insert, mem_singleton]
-- end Finset
-- /- The powerset of a singleton contains only `∅` and the singleton. -/
-- theorem powerset_singleton {U : Type _} (x : U) :
-- 𝒫 ({x} : Set U) = {∅, {x}} := by
-- ext y
-- 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)
-- (g : s ⊆ t) : s ⊆ insert a t := by
-- intro y hy
-- specialize g hy
-- exact mem_insert_of_mem _ g
-- lemma mem_powerset_insert_iff {U : Type _} (A S : Set U) (x : U) :
-- S ∈ 𝒫 (insert x A) ↔ S ∈ 𝒫 A ∃ B ∈ 𝒫 A , insert x B = S := by
-- simp_rw [mem_powerset_iff]
-- constructor
-- · intro h
-- by_cases hs : x ∈ S
-- · right
-- use S \ {x}
-- rw [insert_diff_singleton, insert_eq_of_mem hs, diff_singleton_subset_iff]
-- exact ⟨h, rfl⟩
-- · left
-- exact (subset_insert_iff_of_not_mem hs).mp h
-- · intro h
-- rcases h with h | ⟨B, h₁, h₂⟩
-- · exact le_trans h (subset_insert x A)
-- · rw [←h₂]
-- 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":
{"url": "https://github.com/leanprover-community/mathlib4.git",
"subDir?": null,
"rev": "c8bff08cf815e8881e95967259910524100adfb0",
"rev": "fc4a489c2af75f687338fe85c8901335360f8541",
"name": "mathlib",
"inputRev?": "master"}},
{"git":
{"url": "https://github.com/gebner/quote4",
"subDir?": null,
"rev": "7ac99aa3fac487bec1d5860e751b99c7418298cf",
"rev": "cc915afc9526e904a7b61f660d330170f9d60dd7",
"name": "Qq",
"inputRev?": "master"}},
{"git":
{"url": "https://github.com/JLimperg/aesop",
"subDir?": null,
"rev": "ba61f7fec6174d8c7d2796457da5a8d0b0da44c6",
"rev": "071464ac36e339afb7a87640aa1f8121f707a59a",
"name": "aesop",
"inputRev?": "master"}},
{"path": {"name": "GameServer", "dir": "./../leanserver"}},
{"git":
{"url": "https://github.com/leanprover/std4",
"subDir?": null,
"rev": "de7e2a79905a3f87cad1ad5bf57045206f9738c7",
"rev": "44a92d84c31a88b9af9329a441890ad449d8cd5f",
"name": "std",
"inputRev?": "main"}}]}

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

Loading…
Cancel
Save