Skip to content

Commit 800c1ac

Browse files
authored
Merge branch 'leanprover-community:master' into HasMulAntidiagonal
2 parents e9553c9 + 21d390b commit 800c1ac

File tree

10 files changed

+149
-13
lines changed

10 files changed

+149
-13
lines changed

.github/workflows/labels_from_comment.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ name: Label PR based on Comment
99
on:
1010
issue_comment:
1111
types: [created]
12+
pull_request_review:
13+
types: [submitted]
14+
pull_request_review_comment:
15+
types: [created]
1216

1317
# Limit permissions for GITHUB_TOKEN for the entire workflow
1418
permissions:

Mathlib/Geometry/Euclidean/Angle/Sphere.lean

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,26 @@ theorem angle_eq_pi_div_two_iff_mem_sphere_ofDiameter {p₁ p₂ p₃ : P} :
106106

107107
alias thales_theorem := angle_eq_pi_div_two_iff_mem_sphere_of_isDiameter
108108

109+
/-- Converse of Thales' theorem in 2D: if three distinct points on a circle
110+
form a right angle, then the chord is a diameter. -/
111+
theorem isDiameter_of_angle_eq_pi_div_two {p₁ p₂ p₃ : P} {s : Sphere P}
112+
[Fact (finrank ℝ V = 2)]
113+
(hp₁ : p₁ ∈ s) (hp₂ : p₂ ∈ s) (hp₃ : p₃ ∈ s)
114+
(hne₁₂ : p₁ ≠ p₂) (hne₂₃ : p₂ ≠ p₃)
115+
(hangle : ∠ p₁ p₂ p₃ = π / 2) :
116+
s.IsDiameter p₁ p₃ := by
117+
haveI : FiniteDimensional ℝ V := .of_finrank_eq_succ (Fact.out : finrank ℝ V = 2)
118+
have hne₁₃ : p₁ ≠ p₃ := fun h ↦ by
119+
rw [h, angle_self_of_ne hne₂₃.symm] at hangle; linarith [Real.pi_pos]
120+
have hd := Sphere.isDiameter_ofDiameter p₁ p₃
121+
have h_eq : s = Sphere.ofDiameter p₁ p₃ := by
122+
by_contra hne
123+
have := eq_of_mem_sphere_of_mem_sphere_of_finrank_eq_two
124+
(Fact.out : finrank ℝ V = 2) hne hne₁₃ hp₁ hp₃ hp₂
125+
hd.left_mem hd.right_mem (angle_eq_pi_div_two_iff_mem_sphere_ofDiameter.mp hangle)
126+
exact this.elim hne₁₂.symm hne₂₃
127+
exact h_eq ▸ hd
128+
109129
/-- For a tangent line to a sphere, the angle between the line and the radius at the tangent point
110130
equals `π / 2`. -/
111131
theorem IsTangentAt.angle_eq_pi_div_two {s : Sphere P} {p q : P} {as : AffineSubspace ℝ P}

Mathlib/LinearAlgebra/ExteriorAlgebra/Basic.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,8 @@ lemma ιMulti_range (n : ℕ) :
324324
exact ⟨fun i => ⟨ι R (v i), LinearMap.mem_range_self _ _⟩, rfl⟩
325325

326326
/-- The image of `ExteriorAlgebra.ιMulti R n` spans the `n`th exterior power, as a submodule
327-
of the exterior algebra. -/
327+
of the exterior algebra. See `exteriorPower.ιMulti_span_fixedDegree_of_span_eq_top` for a version
328+
where we restrict to elements of the form `x₁ ∧ ⋯ ∧ xₙ` where the `xᵢ` belong to a spanning set. -/
328329
lemma ιMulti_span_fixedDegree (n : ℕ) :
329330
Submodule.span R (Set.range (ιMulti R n)) = ⋀[R]^n M := by
330331
refine le_antisymm (Submodule.span_le.2 (ιMulti_range R n)) ?_

Mathlib/LinearAlgebra/ExteriorPower/Basic.lean

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ noncomputable def ιMulti_family {I : Type*} [LinearOrder I] (v : I → M)
6666
(s : {s : Finset I // Finset.card s = n}) : ⋀[R]^n M :=
6767
ιMulti R n fun i ↦ v <| Finset.orderIsoOfFin s.val s.property i
6868

69+
lemma ιMulti_family_eq_coe_comp {I : Type*} [LinearOrder I] (v : I → M) :
70+
ExteriorAlgebra.ιMulti_family R n v = (↑) ∘ ιMulti_family R n v :=
71+
rfl
72+
6973
@[simp] lemma ιMulti_family_apply_coe {I : Type*} [LinearOrder I] (v : I → M)
7074
(s : {s : Finset I // Finset.card s = n}) :
7175
ιMulti_family R n v s = ExteriorAlgebra.ιMulti_family R n v s := rfl
@@ -77,6 +81,29 @@ lemma ιMulti_span_fixedDegree :
7781
Submodule.span R (Set.range (ExteriorAlgebra.ιMulti R n)) = ⋀[R]^n M :=
7882
ExteriorAlgebra.ιMulti_span_fixedDegree R n
7983

84+
open Set Submodule in
85+
/-- If a set `s` spans the module `M`, then the set of all elements of the form `x₁ ∧ ⋯ ∧ xₙ`
86+
where `xᵢ ∈ s` spans `⋀ⁿ M`. -/
87+
lemma ιMulti_span_fixedDegree_of_span_eq_top {s : Set M} (hs : span R s = ⊤) :
88+
span R (ExteriorAlgebra.ιMulti R n '' {a | range a ⊆ s}) = ⋀[R]^n M := by
89+
apply le_antisymm
90+
· rw [span_le]
91+
rintro - ⟨y, ⟨y_mem, rfl⟩⟩
92+
apply ExteriorAlgebra.ιMulti_range R n
93+
simp
94+
· rw [ExteriorAlgebra.exteriorPower, LinearMap.range_eq_map, ← hs, map_span, span_pow, span_le]
95+
rintro x hx
96+
obtain ⟨f, rfl⟩ := Set.mem_pow.mp hx
97+
refine mem_span_of_mem ⟨ExteriorAlgebra.ιInv ∘ Subtype.val ∘ f, ?_, ?_⟩
98+
· rw [Set.mem_setOf_eq, Set.range_comp, Set.image_subset_iff]
99+
apply Subset.trans ?_ (s.image_subset_preimage_of_inverse ExteriorAlgebra.ι_leftInverse)
100+
grind
101+
· rw [ExteriorAlgebra.ιMulti_apply]
102+
apply congrArg (List.prod ∘ List.ofFn)
103+
ext i
104+
obtain ⟨m, -, hm⟩ := (Set.mem_image _ _ _).mp (f i).2
105+
rw [Function.comp_apply, Function.comp_apply, ← hm, ExteriorAlgebra.ι_leftInverse]
106+
80107
/-- The image of `exteriorPower.ιMulti` spans `⋀[R]^n M`. -/
81108
lemma ιMulti_span :
82109
Submodule.span R (Set.range (ιMulti R n)) = (⊤ : Submodule R (⋀[R]^n M)) := by
@@ -86,6 +113,13 @@ lemma ιMulti_span :
86113
Submodule.range_subtype]
87114
exact ExteriorAlgebra.ιMulti_span_fixedDegree R n
88115

116+
open Set Submodule in
117+
/-- A version of `ιMulti_span_fixedDegree_of_span` that works in the exterior power. -/
118+
lemma ιMulti_span_of_span {s : Set M} (hs : span R s = ⊤) :
119+
span R (ιMulti R n '' {a | range a ⊆ s}) = ⊤ := by
120+
apply LinearMap.map_injective (ker_subtype (⋀[R]^n M))
121+
simpa [LinearMap.map_span, Set.image_image] using ιMulti_span_fixedDegree_of_span_eq_top R n M hs
122+
89123
namespace presentation
90124

91125
/-- The index type for the relations in the standard presentation of `⋀[R]^n M`,
@@ -288,6 +322,87 @@ lemma map_surjective {f : M →ₗ[R] N} (hf : Surjective f) :
288322
rw [Set.range_eq_univ]
289323
exact Surjective.comp_left hf
290324

325+
section ιMulti_family
326+
327+
variable (R)
328+
329+
open Submodule Set in
330+
/-- Given an ordered family of vectors `i ↦ v i` ranging over `i ∈ I`, and indexes
331+
`α₁, α₂, …, αₙ ∈ I` (not necessarily in order) the wedge product `v (α 1) ∧ ⋯ ∧ v (α n)` belongs to
332+
the span of `n`-fold _ordered_ wedge products of elements of the `v i`. -/
333+
private lemma ιMulti_family_span_fixedDegree_aux
334+
{I : Type*} [LinearOrder I] (v : I → M) (α : Fin n → I) :
335+
ExteriorAlgebra.ιMulti R n (v ∘ α) ∈ span R (range (ExteriorAlgebra.ιMulti_family R n v)) := by
336+
by_cases α_inj : Injective α; swap
337+
· suffices ExteriorAlgebra.ιMulti R n (v ∘ α) = 0 by simp [this]
338+
exact AlternatingMap.map_eq_zero_of_not_injective _ _ <| fun h ↦ α_inj (Injective.of_comp h)
339+
suffices ∃ σ : Equiv.Perm (Fin n), (ExteriorAlgebra.ιMulti R n ((v ∘ α) ∘ σ)) ∈
340+
Submodule.span R (Set.range (ExteriorAlgebra.ιMulti_family R n v)) by
341+
obtain ⟨σ, hσ⟩ := this
342+
rw [AlternatingMap.map_perm] at hσ
343+
refine (Submodule.smul_mem_iff_of_isUnit _ (r := (σ.sign : R)) ?_).mp hσ
344+
rw [isUnit_iff_exists_inv]
345+
use (σ.sign : R)
346+
norm_cast
347+
simp only [Int.units_mul_self, Units.val_one, Int.cast_one]
348+
have α_card : (Finset.image α Finset.univ).card = n :=
349+
(Finset.card_image_of_injective Finset.univ α_inj).trans (Finset.card_fin n)
350+
use (Finset.orderIsoOfFin (Finset.image α Finset.univ) α_card).toEquiv.trans
351+
((Equiv.setCongr Fintype.coe_image_univ).trans (Equiv.ofInjective α α_inj).symm)
352+
apply Submodule.mem_span_of_mem
353+
use ⟨(Finset.image α Finset.univ), α_card⟩
354+
rw [ExteriorAlgebra.ιMulti_family, Function.comp_assoc]
355+
congr
356+
ext i
357+
simp [Equiv.apply_ofInjective_symm]
358+
rfl
359+
360+
open Finset in
361+
/-- If a family of vectors spans `M`, then the family of its `n`-fold exterior products spans
362+
`⋀[R]^n M`. Here we work in the exterior algebra. -/
363+
lemma ιMulti_family_span_fixedDegree_of_span {I : Type*} [LinearOrder I] {v : I → M}
364+
(hv : Submodule.span R (Set.range v) = ⊤) :
365+
Submodule.span R (Set.range (ExteriorAlgebra.ιMulti_family R n v)) = ⋀[R]^n M := by
366+
apply le_antisymm
367+
· rw [Submodule.span_le, Set.range_subset_iff]
368+
intro
369+
rw [SetLike.mem_coe, ιMulti_family_eq_coe_comp, comp_apply]
370+
exact Submodule.coe_mem _
371+
· rw [← ιMulti_span_fixedDegree_of_span_eq_top R n M hv, Submodule.span_le]
372+
rintro - ⟨f, ⟨f_range, rfl⟩⟩
373+
rw [Set.mem_setOf] at f_range
374+
obtain ⟨α, rfl⟩ := Set.range_subset_range_iff_exists_comp.mp f_range
375+
exact ιMulti_family_span_fixedDegree_aux R v α
376+
377+
/-- If a family of vectors spans `M`, then the family of its `n`-fold exterior products spans
378+
`⋀[R]^n M`. This is a variant of `ιMulti_family_span_fixedDegree_of_span` where we
379+
work in the exterior power and not the exterior algebra. -/
380+
lemma ιMulti_family_span_of_span {I : Type*} [LinearOrder I]
381+
{v : I → M} (hv : Submodule.span R (Set.range v) = ⊤) :
382+
Submodule.span R (Set.range (ιMulti_family R n v)) = ⊤ := by
383+
apply LinearMap.map_injective (Submodule.ker_subtype (⋀[R]^n M))
384+
rw [LinearMap.map_span, ← Set.image_univ, Set.image_image]
385+
simpa using ιMulti_family_span_fixedDegree_of_span R hv
386+
387+
open Set Submodule in
388+
/-- If `v` is a family of vectors of `M` indexed by a linearly ordered type, then the span of the
389+
range of `exteriorPower.ιMulti_family R n v`, i.e., of the family of `n`-fold exterior products
390+
of elements of `v`, is the image of the map of exterior powers induced by the inclusion of
391+
the span of `v` into `M`. -/
392+
lemma ιMulti_family_span {I : Type*} [LinearOrder I] (v : I → M) :
393+
(map n (span R (range v)).subtype).range = span R (range (ιMulti_family R n v)) := by
394+
have ⟨f, hf⟩ : ∃ f : I → Submodule.span R (Set.range v), Submodule.subtype _ ∘ f = v :=
395+
fun i ↦ ⟨v i, Submodule.subset_span (Set.mem_range_self i)⟩, rfl⟩
396+
have htop : Submodule.span R (Set.range f) = ⊤ := by
397+
apply SetLike.coe_injective
398+
apply Set.image_injective.mpr (Submodule.span R (Set.range v)).injective_subtype
399+
rw [← Submodule.map_coe, ← Submodule.span_image, ← Set.range_comp, hf,
400+
← Submodule.map_coe, ← LinearMap.range_eq_map, Submodule.range_subtype]
401+
rw [LinearMap.range_eq_map (M := ⋀[R]^n _), ← ιMulti_family_span_of_span _ htop,
402+
Submodule.map_span, ← Set.range_comp, map_comp_ιMulti_family, hf]
403+
404+
end ιMulti_family
405+
291406
/-! Linear equivalences in degrees 0 and 1. -/
292407

293408
variable (R M) in

docs/100.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
title : Gödel’s Incompleteness Theorem
3333
authors: Shogo Saito
3434
links :
35-
First incompleteness theorem: https://github.com/FormalizedFormalLogic/Incompleteness/blob/master/Incompleteness/Arith/First.lean
36-
Second incompleteness theorem: https://github.com/FormalizedFormalLogic/Incompleteness/blob/master/Incompleteness/Arith/Second.lean
37-
website: https://formalizedformallogic.github.io/Book/
35+
First incompleteness theorem: https://github.com/FormalizedFormalLogic/Foundation/blob/7c74089c2442ee211abfa1e2dd5a75091800f57b/Foundation/FirstOrder/Incompleteness/First.lean#L24-L53
36+
Second incompleteness theorem: https://github.com/FormalizedFormalLogic/Foundation/blob/7c74089c2442ee211abfa1e2dd5a75091800f57b/Foundation/FirstOrder/Incompleteness/Second.lean#L15-L18
37+
website: https://formalizedformallogic.github.io/Catalogue/
3838
7:
3939
title : Law of Quadratic Reciprocity
4040
decls :

docs/1000.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,7 @@ Q195133:
188188
Q200787:
189189
title: Gödel's incompleteness theorem
190190
authors: Shogo Saito
191-
# TODO: how to display this data nicely? want two URLs, right?
192-
# results:
193-
# - First: https://github.com/FormalizedFormalLogic/Incompleteness/blob/master/Incompleteness/Arith/First.lean
194-
# - Second: https://github.com/FormalizedFormalLogic/Incompleteness/blob/master/Incompleteness/Arith/Second.lean
195-
url: https://formalizedformallogic.github.io/Book/
191+
url: https://formalizedformallogic.github.io/Catalogue/
196192

197193
Q203565:
198194
title: Solutions of a general cubic equation

lake-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"type": "git",
6666
"subDir": null,
6767
"scope": "leanprover-community",
68-
"rev": "9957d56fa7dcf3fbc4066e3268eaaa739420ae5c",
68+
"rev": "ab9f3956f91980e61bea324c0cf1e9e7d9c8518b",
6969
"name": "batteries",
7070
"manifestFile": "lake-manifest.json",
7171
"inputRev": "main",

scripts/bench/lint/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## The `lint` benchmark
1+
# The `lint` benchmark
22

33
This benchmark runs `lake exe runLinter Mathlib`.
44
It measures the following metrics:

scripts/bench/open-mathlib/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## The `open-mathlib` benchmark
1+
# The `open-mathlib` benchmark
22

33
This benchmark approximates `import Mathlib` in the editor by running `lake lean Mathlib.lean`.
44
It measures the following metrics:

scripts/bench/size/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## The `size` benchmark
1+
# The `size` benchmark
22

33
This benchmark measures a few deterministic values.
44

0 commit comments

Comments
 (0)