Skip to content

Commit a5e675b

Browse files
authored
Merge branch 'leanprover-community:master' into main
2 parents 6e4ffe9 + 7950cd5 commit a5e675b

38 files changed

Lines changed: 557 additions & 54 deletions

File tree

Counterexamples/DiscreteTopologyNonDiscreteUniformity.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ lemma ball_eq_singleton {n : ℕ} : Metric.ball n ((2 : ℝ) ^ (-n - 1 : ℤ)) =
142142

143143

144144
theorem TopIsDiscrete : DiscreteTopology ℕ := by
145-
apply singletons_open_iff_discrete.mp
145+
apply discreteTopology_iff_isOpen_singleton.mpr
146146
intro
147147
simpa only [← ball_eq_singleton] using isOpen_ball
148148

Counterexamples/SorgenfreyLine.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,8 @@ theorem isClosed_of_subset_antidiagonal {s : Set (ℝₗ × ℝₗ)} {c : ℝₗ
231231

232232
open Subtype in
233233
instance (c : ℝₗ) : DiscreteTopology {x : ℝₗ × ℝₗ | x.1 + x.2 = c} :=
234-
forall_open_iff_discrete.1 fun U ↦ isClosed_compl_iff.1 <| isClosed_induced_iff.2
235-
⟨val '' Uᶜ, isClosed_of_subset_antidiagonal <| coe_image_subset _ Uᶜ,
234+
discreteTopology_iff_forall_isClosed.2 fun C ↦ isClosed_induced_iff.2
235+
⟨val '' C, isClosed_of_subset_antidiagonal <| coe_image_subset _ C,
236236
preimage_image_eq _ val_injective⟩
237237

238238
/-- The Sorgenfrey plane `ℝₗ × ℝₗ` is not a normal space. -/

Mathlib.lean

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1706,6 +1706,7 @@ import Mathlib.Analysis.InnerProductSpace.Convex
17061706
import Mathlib.Analysis.InnerProductSpace.Defs
17071707
import Mathlib.Analysis.InnerProductSpace.Dual
17081708
import Mathlib.Analysis.InnerProductSpace.EuclideanDist
1709+
import Mathlib.Analysis.InnerProductSpace.GramMatrix
17091710
import Mathlib.Analysis.InnerProductSpace.GramSchmidtOrtho
17101711
import Mathlib.Analysis.InnerProductSpace.Harmonic.Basic
17111712
import Mathlib.Analysis.InnerProductSpace.Harmonic.Constructions
@@ -2884,6 +2885,7 @@ import Mathlib.CategoryTheory.Triangulated.TriangleShift
28842885
import Mathlib.CategoryTheory.Triangulated.Triangulated
28852886
import Mathlib.CategoryTheory.Triangulated.Yoneda
28862887
import Mathlib.CategoryTheory.Types.Basic
2888+
import Mathlib.CategoryTheory.Types.Monomorphisms
28872889
import Mathlib.CategoryTheory.Types.Set
28882890
import Mathlib.CategoryTheory.UnivLE
28892891
import Mathlib.CategoryTheory.Whiskering
@@ -5585,6 +5587,7 @@ import Mathlib.RingTheory.Grassmannian
55855587
import Mathlib.RingTheory.HahnSeries.Addition
55865588
import Mathlib.RingTheory.HahnSeries.Basic
55875589
import Mathlib.RingTheory.HahnSeries.HEval
5590+
import Mathlib.RingTheory.HahnSeries.HahnEmbedding
55885591
import Mathlib.RingTheory.HahnSeries.Lex
55895592
import Mathlib.RingTheory.HahnSeries.Multiplication
55905593
import Mathlib.RingTheory.HahnSeries.PowerSeries

Mathlib/Algebra/Algebra/Equiv.lean

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -817,3 +817,25 @@ def ULift.algEquiv {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Alge
817817
ULift.{w} A ≃ₐ[R] A where
818818
__ := ULift.ringEquiv
819819
commutes' _ := rfl
820+
821+
/-- If an `R`-algebra `A` is isomorphic to `R` as `R`-module, then the canonical map `R → A` is an
822+
equivalence of `R`-algebras.
823+
824+
Note that if `e : R ≃ₗ[R] A` is the linear equivalence, then this is not the same as the equivalence
825+
of algebras provided here unless `e 1 = 1`. -/
826+
@[simps] def LinearEquiv.algEquivOfRing
827+
{R A : Type*} [CommSemiring R] [CommSemiring A] [Algebra R A]
828+
(e : R ≃ₗ[R] A) : R ≃ₐ[R] A where
829+
__ := Algebra.ofId R A
830+
invFun x := e.symm (e 1 * x)
831+
left_inv x := calc
832+
e.symm (e 1 * (algebraMap R A) x)
833+
= e.symm (x • e 1) := by rw [Algebra.smul_def, mul_comm]
834+
_ = x := by rw [map_smul, e.symm_apply_apply, smul_eq_mul, mul_one]
835+
right_inv x := calc
836+
(algebraMap R A) (e.symm (e 1 * x))
837+
= (algebraMap R A) (e.symm (e 1 * x)) * e (e.symm 11) := by
838+
rw [smul_eq_mul, mul_one, e.apply_symm_apply, mul_one]
839+
_ = x := by rw [map_smul, Algebra.smul_def, mul_left_comm, ← Algebra.smul_def _ (e 1),
840+
← map_smul, smul_eq_mul, mul_one, e.apply_symm_apply, ← mul_assoc, ← Algebra.smul_def,
841+
← map_smul, smul_eq_mul, mul_one, e.apply_symm_apply, one_mul]

Mathlib/Algebra/Order/Module/HahnEmbedding.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ under `ArchimedeanClass.closedBall K c`. The embeddings from these submodules ar
2828
`HahnEmbedding.Seed K M R`.
2929
3030
By setting `K = ℚ` and `R = ℝ`, the condition can be trivially satisfied, leading
31-
to a proof of the classic Hahn embedding theorem. (TODO: implement this)
31+
to a proof of the classic Hahn embedding theorem. (See `hahnEmbedding_isOrderedAddMonoid`)
3232
3333
## Main theorem
3434

Mathlib/Analysis/Analytic/IsolatedZeros.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,8 @@ theorem AnalyticAt.map_nhdsNE {x : 𝕜} {f : 𝕜 → E} (hfx : AnalyticAt 𝕜
342342
Preimages of codiscrete sets: if `f` is analytic on a neighbourhood of `U` and not locally constant,
343343
then the preimage of any subset codiscrete within `f '' U` is codiscrete within `U`.
344344
345-
See `AnalyticOnNhd.preimage_zero_codiscreteWithin` for the special case that `s` is the complement
346-
of zero. Applications might want to use the theorem `Filter.codiscreteWithin.mono`.
345+
See `AnalyticOnNhd.preimage_zero_mem_codiscreteWithin` for the special case that `s` is the
346+
complement of zero. Applications might want to use the theorem `Filter.codiscreteWithin.mono`.
347347
-/
348348
theorem AnalyticOnNhd.preimage_mem_codiscreteWithin {U : Set 𝕜} {s : Set E} {f : 𝕜 → E}
349349
(hfU : AnalyticOnNhd 𝕜 f U) (h₂f : ∀ x ∈ U, ¬EventuallyConst f (𝓝 x))

Mathlib/Analysis/Calculus/TangentCone.lean

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -591,22 +591,25 @@ end Normed
591591
section RealNormed
592592
variable [NormedAddCommGroup G] [NormedSpace ℝ G]
593593

594-
/-- In a real vector space, a convex set with nonempty interior is a set of unique
595-
differentiability at every point of its closure. -/
596-
theorem uniqueDiffWithinAt_convex {s : Set G} (conv : Convex ℝ s) (hs : (interior s).Nonempty)
597-
{x : G} (hx : x ∈ closure s) : UniqueDiffWithinAt ℝ s x := by
594+
theorem Convex.span_tangentConeAt {s : Set G} (conv : Convex ℝ s) (hs : (interior s).Nonempty)
595+
{x : G} (hx : x ∈ closure s) : Submodule.span ℝ (tangentConeAt ℝ s x) = ⊤ := by
598596
rcases hs with ⟨y, hy⟩
599597
suffices y - x ∈ interior (tangentConeAt ℝ s x) by
600-
refine ⟨Dense.of_closure ?_, hx⟩
601-
simp [(Submodule.span ℝ (tangentConeAt ℝ s x)).eq_top_of_nonempty_interior'
602-
⟨y - x, interior_mono Submodule.subset_span this⟩]
598+
apply (Submodule.span ℝ (tangentConeAt ℝ s x)).eq_top_of_nonempty_interior'
599+
exact ⟨y - x, interior_mono Submodule.subset_span this⟩
603600
rw [mem_interior_iff_mem_nhds]
604601
replace hy : interior s ∈ 𝓝 y := IsOpen.mem_nhds isOpen_interior hy
605602
apply mem_of_superset ((isOpenMap_sub_right x).image_mem_nhds hy)
606603
rintro _ ⟨z, zs, rfl⟩
607604
refine mem_tangentConeAt_of_openSegment_subset (Subset.trans ?_ interior_subset)
608605
exact conv.openSegment_closure_interior_subset_interior hx zs
609606

607+
/-- In a real vector space, a convex set with nonempty interior is a set of unique
608+
differentiability at every point of its closure. -/
609+
theorem uniqueDiffWithinAt_convex {s : Set G} (conv : Convex ℝ s) (hs : (interior s).Nonempty)
610+
{x : G} (hx : x ∈ closure s) : UniqueDiffWithinAt ℝ s x := by
611+
simp [uniqueDiffWithinAt_iff, conv.span_tangentConeAt hs hx, hx]
612+
610613
/-- In a real vector space, a convex set with nonempty interior is a set of unique
611614
differentiability. -/
612615
theorem uniqueDiffOn_convex {s : Set G} (conv : Convex ℝ s) (hs : (interior s).Nonempty) :
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
/-
2+
Copyright (c) 2025 Peter Pfaffelhuber. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Peter Pfaffelhuber
5+
-/
6+
7+
import Mathlib.LinearAlgebra.Matrix.PosDef
8+
9+
/-! # Gram Matrices
10+
11+
This file defines Gram matrices and proves their positive semidefiniteness.
12+
Results require `RCLike 𝕜`.
13+
14+
## Main definition
15+
16+
* `Matrix.gram` : the `Matrix n n 𝕜` with `⟪v i, v j⟫` at `i j : n`, where `v : n → E` for an
17+
`Inner 𝕜 E`.
18+
19+
## Main results
20+
21+
* `Matrix.posSemidef_gram`: Gram matrices are positive semidefinite.
22+
* `Matrix.posDef_gram_iff_linearIndependent`: Linear independence of `v` is
23+
equivalent to positive definiteness of `gram 𝕜 v`.
24+
-/
25+
26+
open RCLike Real Matrix
27+
28+
open scoped InnerProductSpace ComplexOrder ComplexConjugate
29+
30+
variable {E n α 𝕜 : Type*}
31+
namespace Matrix
32+
33+
/-- The entries of a Gram matrix are inner products of vectors in an inner product space. -/
34+
def gram (𝕜 : Type*) [Inner 𝕜 E] (v : n → E) : Matrix n n 𝕜 := of fun i j ↦ ⟪v i, v j⟫_𝕜
35+
36+
@[simp]
37+
lemma gram_apply [Inner 𝕜 E] (v : n → E) (i j : n) :
38+
(gram 𝕜 v) i j = ⟪v i, v j⟫_𝕜 := rfl
39+
40+
variable [RCLike 𝕜]
41+
42+
section SemiInnerProductSpace
43+
variable [SeminormedAddCommGroup E] [InnerProductSpace 𝕜 E]
44+
45+
@[simp]
46+
lemma gram_zero : gram 𝕜 (0 : n → E) = 0 := Matrix.ext fun _ _ ↦ inner_zero_left _
47+
48+
@[simp]
49+
lemma gram_single [DecidableEq n] (i : n) (x : E) :
50+
gram 𝕜 (Pi.single i x) = Matrix.single i i ⟪x, x⟫_𝕜 := by
51+
ext j k
52+
obtain hij | rfl := ne_or_eq i j
53+
· simp [hij]
54+
obtain hik | rfl := ne_or_eq i k
55+
· simp [hik]
56+
simp
57+
58+
lemma submatrix_gram (v : n → E) {m : Set n} (f : m → n) :
59+
(gram 𝕜 v).submatrix f f = gram 𝕜 (v ∘ f) := rfl
60+
61+
variable (𝕜) in
62+
/-- A Gram matrix is Hermitian. -/
63+
lemma isHermitian_gram (v : n → E) : (gram 𝕜 v).IsHermitian :=
64+
Matrix.ext fun _ _ ↦ inner_conj_symm _ _
65+
66+
variable [Fintype n]
67+
68+
theorem star_dotProduct_gram_mulVec (v : n → E) (x y : n → 𝕜) :
69+
star x ⬝ᵥ (gram 𝕜 v) *ᵥ y = ⟪∑ i, x i • v i, ∑ i, y i • v i⟫_𝕜 := by
70+
trans ∑ i, ∑ j, conj (x i) * y j * ⟪v i, v j⟫_𝕜
71+
· simp_rw [dotProduct, mul_assoc, ← Finset.mul_sum, mulVec, dotProduct, mul_comm, ← star_def,
72+
gram_apply, Pi.star_apply]
73+
· simp_rw [sum_inner, inner_sum, inner_smul_left, inner_smul_right, mul_assoc]
74+
75+
variable (𝕜) in
76+
/-- A Gram matrix is positive semidefinite. -/
77+
theorem posSemidef_gram (v : n → E) :
78+
PosSemidef (gram 𝕜 v) := by
79+
refine ⟨isHermitian_gram _ _, fun x ↦ ?_⟩
80+
rw [star_dotProduct_gram_mulVec, le_iff_re_im]
81+
simp [inner_self_nonneg]
82+
83+
/-- In a normed space, positive definiteness of `gram 𝕜 v` implies linear independence of `v`. -/
84+
theorem linearIndependent_of_posDef_gram {v : n → E} (h_gram : PosDef (gram 𝕜 v)) :
85+
LinearIndependent 𝕜 v := by
86+
rw [Fintype.linearIndependent_iff]
87+
intro y hy
88+
obtain ⟨h1, h2⟩ := h_gram
89+
specialize h2 y
90+
simp_all [star_dotProduct_gram_mulVec]
91+
92+
end SemiInnerProductSpace
93+
94+
section NormedInnerProductSpace
95+
variable [NormedAddCommGroup E] [InnerProductSpace 𝕜 E] [Fintype n]
96+
97+
/-- In a normed space, linear independence of `v` implies positive definiteness of `gram 𝕜 v`. -/
98+
theorem posDef_gram_of_linearIndependent
99+
{v : n → E} (h_li : LinearIndependent 𝕜 v) : PosDef (gram 𝕜 v) := by
100+
rw [Fintype.linearIndependent_iff] at h_li
101+
obtain ⟨h0, h1⟩ := posSemidef_gram 𝕜 v
102+
refine ⟨h0, fun x hx ↦ (h1 x).lt_of_ne' ?_⟩
103+
rw [star_dotProduct_gram_mulVec, inner_self_eq_zero.ne]
104+
exact mt (h_li x) (mt funext hx)
105+
106+
/-- In a normed space, linear independence of `v` is equivalent to positive definiteness of
107+
`gram 𝕜 v`. -/
108+
theorem posDef_gram_iff_linearIndependent {v : n → E} :
109+
PosDef (gram 𝕜 v) ↔ LinearIndependent 𝕜 v :=
110+
⟨linearIndependent_of_posDef_gram, posDef_gram_of_linearIndependent⟩
111+
112+
end NormedInnerProductSpace
113+
114+
end Matrix

Mathlib/Analysis/SpecialFunctions/Log/PosLog.lean

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ theorem log_of_nat_eq_posLog {n : ℕ} : log⁺ n = log n := by
7676
· simp [hn, posLog]
7777
· simp [posLog_eq_log, Nat.one_le_iff_ne_zero.2 hn]
7878

79+
/-- The function `log⁺` equals `log (max 1 _)` for non-negative real numbers. -/
80+
theorem posLog_eq_log_max_one {x : ℝ} (hx : 0 ≤ x) : log⁺ x = log (max 1 x) := by
81+
grind [le_abs, posLog_eq_log, log_one, max_eq_left, log_nonpos, posLog_def]
82+
7983
/-- The function `log⁺` is monotone on the positive axis. -/
8084
theorem monotoneOn_posLog : MonotoneOn log⁺ (Set.Ici 0) := by
8185
intro x hx y hy hxy

Mathlib/CategoryTheory/Limits/Shapes/Pullback/CommSq.lean

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,10 @@ theorem of_bot' {X₁₁ X₁₂ X₂₁ X₂₂ X₃₁ X₃₂ : C} {h₁₁ :
791791
IsPullback h₁₁ (t.lift (h₁₁ ≫ v₁₂) v₃₁ (by rw [Category.assoc, s.w])) v₁₂ h₂₁ :=
792792
of_bot ((t.lift_snd _ _ _) ▸ s) (by simp only [lift_fst]) t
793793

794+
instance [HasPullbacksAlong f] (h : P ⟶ Y) : HasPullback h (pullback.fst g f) :=
795+
IsPullback.hasPullback (IsPullback.of_bot' (IsPullback.of_hasPullback (h ≫ g) f)
796+
(IsPullback.of_hasPullback g f))
797+
794798
section
795799

796800
variable [HasZeroObject C] [HasZeroMorphisms C]

0 commit comments

Comments
 (0)