Skip to content

Commit cd24027

Browse files
authored
Merge branch 'master' into chore/copy-spelling
2 parents c5ed95e + 177caf0 commit cd24027

96 files changed

Lines changed: 1505 additions & 462 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Mathlib.lean

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ public import Mathlib.Algebra.Category.Ring.FinitePresentation
232232
public import Mathlib.Algebra.Category.Ring.Instances
233233
public import Mathlib.Algebra.Category.Ring.Limits
234234
public import Mathlib.Algebra.Category.Ring.LinearAlgebra
235+
public import Mathlib.Algebra.Category.Ring.Small
235236
public import Mathlib.Algebra.Category.Ring.Topology
236237
public import Mathlib.Algebra.Category.Ring.Under.Basic
237238
public import Mathlib.Algebra.Category.Ring.Under.Limits
@@ -5654,6 +5655,7 @@ public import Mathlib.NumberTheory.ModularForms.Cusps
56545655
public import Mathlib.NumberTheory.ModularForms.DedekindEta
56555656
public import Mathlib.NumberTheory.ModularForms.Delta
56565657
public import Mathlib.NumberTheory.ModularForms.Derivative
5658+
public import Mathlib.NumberTheory.ModularForms.DimensionFormulas.LevelOne
56575659
public import Mathlib.NumberTheory.ModularForms.Discriminant
56585660
public import Mathlib.NumberTheory.ModularForms.EisensteinSeries.Basic
56595661
public import Mathlib.NumberTheory.ModularForms.EisensteinSeries.Defs
@@ -6407,6 +6409,7 @@ public import Mathlib.RingTheory.Flat.EquationalCriterion
64076409
public import Mathlib.RingTheory.Flat.FaithfullyFlat.Algebra
64086410
public import Mathlib.RingTheory.Flat.FaithfullyFlat.Basic
64096411
public import Mathlib.RingTheory.Flat.FaithfullyFlat.Descent
6412+
public import Mathlib.RingTheory.Flat.IsBaseChange
64106413
public import Mathlib.RingTheory.Flat.Localization
64116414
public import Mathlib.RingTheory.Flat.Rank
64126415
public import Mathlib.RingTheory.Flat.Stability
@@ -6843,6 +6846,7 @@ public import Mathlib.RingTheory.TensorProduct.IncludeLeftSubRight
68436846
public import Mathlib.RingTheory.TensorProduct.IsBaseChangeFree
68446847
public import Mathlib.RingTheory.TensorProduct.IsBaseChangeHom
68456848
public import Mathlib.RingTheory.TensorProduct.IsBaseChangePi
6849+
public import Mathlib.RingTheory.TensorProduct.IsBaseChangeRightExact
68466850
public import Mathlib.RingTheory.TensorProduct.Maps
68476851
public import Mathlib.RingTheory.TensorProduct.MonoidAlgebra
68486852
public import Mathlib.RingTheory.TensorProduct.MvPolynomial

Mathlib/Algebra/Algebra/Defs.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ instance (priority := 1100) id : Algebra R R where
386386
-- be made so without a significant performance hit.
387387
-- see library note [reducible non-instances].
388388
toSMul := instSMulOfMul
389-
__ := ({ RingHom.id R with toFun x := x }).toAlgebra
389+
__ := (RingHom.id R).toAlgebra
390390

391391
@[simp] lemma linearMap_self : Algebra.linearMap R R = .id := rfl
392392

Mathlib/Algebra/Category/CommAlgCat/FiniteType.lean

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ lemma Algebra.FiniteType.exists_fgAlgCatSkeleton (A : Type v) [CommRing A] [Alge
4747
obtain ⟨n, f, hf⟩ := Algebra.FiniteType.iff_quotient_mvPolynomial''.mp h
4848
exact ⟨⟨n, RingHom.ker f⟩, ⟨(Ideal.quotientKerAlgEquivOfSurjective hf).symm⟩⟩
4949

50+
lemma RingHom.FiniteType.exists_smallRepr {S : Type v} [CommRing S] {f : R →+* S}
51+
(hf : f.FiniteType) :
52+
∃ (T : FGAlgCatSkeleton R) (e : T.eval.obj ≃+* S), f = e.toRingHom.comp (algebraMap _ _) := by
53+
algebraize [f]
54+
obtain ⟨T, ⟨e⟩⟩ := Algebra.FiniteType.exists_fgAlgCatSkeleton R S
55+
exact ⟨T, e.symm.toRingEquiv, e.symm.toAlgHom.comp_algebraMap.symm⟩
56+
5057
/-- Universe lift functor for finitely generated algebras. -/
5158
def FGAlgCat.uliftFunctor : FGAlgCat.{v} R ⥤ FGAlgCat.{max v w} R where
5259
obj A := ⟨.of R <| ULift A.1, .equiv inferInstance ULift.algEquiv.symm⟩

Mathlib/Algebra/Category/Grp/FilteredColimits.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ noncomputable def colimitCocone : Cocone F where
130130
ι.app J := GrpCat.ofHom ((MonCat.FilteredColimits.colimitCocone
131131
(F ⋙ forget₂ GrpCat MonCat)).ι.app J).hom
132132
ι.naturality _ _ f := (forget₂ _ MonCat).map_injective
133-
((MonCat.FilteredColimits.colimitCocone _).ι.naturality f)
133+
((MonCat.FilteredColimits.colimitCocone (F ⋙ forget₂ GrpCat MonCat)).ι.naturality f)
134134

135135
/-- The proposed colimit cocone is a colimit in `GrpCat`. -/
136136
@[to_additive /-- The proposed colimit cocone is a colimit in `AddGroup`. -/]
@@ -191,7 +191,7 @@ noncomputable def colimitCocone : Cocone F where
191191
ι.app J := CommGrpCat.ofHom
192192
((GrpCat.FilteredColimits.colimitCocone (F ⋙ forget₂ CommGrpCat GrpCat)).ι.app J).hom
193193
ι.naturality _ _ f := (forget₂ _ GrpCat).map_injective
194-
((GrpCat.FilteredColimits.colimitCocone _).ι.naturality f)
194+
((GrpCat.FilteredColimits.colimitCocone (F ⋙ forget₂ CommGrpCat GrpCat)).ι.naturality f)
195195

196196
/-- The proposed colimit cocone is a colimit in `CommGrpCat`. -/
197197
@[to_additive /-- The proposed colimit cocone is a colimit in `AddCommGroup`. -/]

Mathlib/Algebra/Category/ModuleCat/Topology/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ def freeMap {X Y : TopCat.{v}} (f : X ⟶ Y) : freeObj R X ⟶ freeObj R Y :=
421421
ext x
422422
simp [coe_freeObj]⟩
423423

424-
lemma freeMap_map {X Y : TopCat} (f : X ⟶ Y) (v : X →₀ R) :
424+
lemma freeMap_map {X Y : TopCat.{v}} (f : X ⟶ Y) (v : X →₀ R) :
425425
(freeMap R f : (X →₀ R) → (Y →₀ R)) v = Finsupp.mapDomain f.hom v := rfl
426426

427427
/-- The free topological module over a topological space as a functor.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/-
2+
Copyright (c) 2026 Andrew Yang. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Andrew Yang
5+
-/
6+
module
7+
8+
public import Mathlib.Algebra.Category.CommAlgCat.FiniteType
9+
public import Mathlib.CategoryTheory.ObjectProperty.Small
10+
11+
12+
/-! # Smallness results on the category of `CommRing` -/
13+
14+
@[expose] public section
15+
16+
universe u
17+
18+
open CategoryTheory
19+
20+
namespace CommRingCat
21+
22+
variable {P Q : ObjectProperty CommRingCat.{u}}
23+
24+
lemma essentiallySmall_of_finiteType [ObjectProperty.EssentiallySmall.{u} Q]
25+
(hPQ : ∀ S, P S → ∃ R, Q R ∧ ∃ (f : R ⟶ S), f.hom.FiniteType) :
26+
ObjectProperty.EssentiallySmall.{u} P := by
27+
obtain ⟨Q', _, hQ'Q, hQQ'⟩ := ObjectProperty.EssentiallySmall.exists_small_le Q
28+
let f (S : Σ R : Subtype Q', FGAlgCatSkeleton R) : CommRingCat := .of S.2.eval.obj
29+
refine ⟨.ofObj f, inferInstance, fun S hS ↦ ?_⟩
30+
obtain ⟨R, hR, φ, hφ⟩ := hPQ S hS
31+
wlog hR' : Q' R generalizing R
32+
· obtain ⟨R', hR', ⟨e⟩⟩ := hQQ' _ hR
33+
exact this R' (hQ'Q _ hR') (e.inv ≫ φ)
34+
(hφ.comp e.symm.commRingCatIsoToRingEquiv.finite.finiteType) hR'
35+
obtain ⟨T, e, he⟩ := hφ.exists_smallRepr
36+
exact ⟨_, ⟨⟨_, hR'⟩, T⟩, ⟨RingEquiv.toCommRingCatIso e.symm⟩⟩
37+
38+
lemma essentiallySmall_of_localizationAway [ObjectProperty.EssentiallySmall.{u} Q]
39+
(hPQ : ∀ S, P S → ∃ s : Set S, Ideal.span s = ⊤ ∧ ∀ f ∈ s, Q (.of (Localization.Away f))) :
40+
ObjectProperty.EssentiallySmall.{u} P := by
41+
obtain ⟨Q', _, hQ'Q, hQQ'⟩ := ObjectProperty.EssentiallySmall.exists_small_le Q
42+
let f (S : Σ (n : ℕ) (R : Fin n → Subtype Q'), Subring (Π i, (R i).1)) : CommRingCat := .of S.2.2
43+
refine ⟨.ofObj f, inferInstance, fun S hS ↦ ?_⟩
44+
obtain ⟨s, hs, H⟩ := hPQ S hS
45+
wlog hs' : s.Finite generalizing s
46+
· obtain ⟨s', hs's, hs'⟩ := (Ideal.span_eq_top_iff_finite _).mp hs
47+
exact this s' hs' (fun f hf ↦ H f (hs's hf)) s'.finite_toSet
48+
choose S' hS' e using fun (f : s) ↦ hQQ' _ (H _ f.2)
49+
let φ : S →+* Π i, S' (hs'.equivFin.symm i) :=
50+
((RingEquiv.piCongrRight fun i ↦ (e i).some.commRingCatIsoToRingEquiv).trans
51+
(RingEquiv.piCongrLeft (S' ·) hs'.equivFin.symm).symm).toRingHom.comp (algebraMap _ _)
52+
have hφ : Function.Injective φ := by
53+
dsimp only [RingHom.coe_comp, φ]
54+
refine (RingEquiv.injective _).comp (Localization.algebraMap_injective_of_span_eq_top _ hs)
55+
refine ⟨_, ⟨Nat.card s, (fun f ↦ ⟨S' f, hS' f⟩) ∘ hs'.equivFin.symm, φ.range⟩, ⟨?_⟩⟩
56+
exact (RingEquiv.ofBijective φ.rangeRestrict
57+
⟨φ.injective_codRestrict.mpr hφ, φ.rangeRestrict_surjective⟩).toCommRingCatIso
58+
59+
end CommRingCat

Mathlib/Algebra/Group/Hom/Defs.lean

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -717,19 +717,22 @@ alias isDedekindFiniteMonoid_of_injective := IsDedekindFiniteMonoid.of_injective
717717
end MonoidHom
718718

719719
/-- The identity map from a type with 1 to itself. -/
720-
@[to_additive (attr := simps) /-- The identity map from a type with zero to itself. -/]
720+
@[to_additive (attr := simps, implicit_reducible)
721+
/-- The identity map from a type with zero to itself. -/]
721722
def OneHom.id (M : Type*) [One M] : OneHom M M where
722723
toFun x := x
723724
map_one' := rfl
724725

725726
/-- The identity map from a type with multiplication to itself. -/
726-
@[to_additive (attr := simps) /-- The identity map from a type with addition to itself. -/]
727+
@[to_additive (attr := simps, implicit_reducible)
728+
/-- The identity map from a type with addition to itself. -/]
727729
def MulHom.id (M : Type*) [Mul M] : M →ₙ* M where
728730
toFun x := x
729731
map_mul' _ _ := rfl
730732

731733
/-- The identity map from a monoid to itself. -/
732-
@[to_additive (attr := simps) /-- The identity map from an additive monoid to itself. -/]
734+
@[to_additive (attr := simps, implicit_reducible)
735+
/-- The identity map from an additive monoid to itself. -/]
733736
def MonoidHom.id (M : Type*) [MulOne M] : M →* M where
734737
toFun x := x
735738
map_one' := rfl
@@ -745,22 +748,23 @@ lemma MulHom.coe_id {M : Type*} [Mul M] : (MulHom.id M : M → M) = _root_.id :=
745748
lemma MonoidHom.coe_id {M : Type*} [MulOne M] : (MonoidHom.id M : M → M) = _root_.id := rfl
746749

747750
/-- Composition of `OneHom`s as a `OneHom`. -/
748-
@[to_additive /-- Composition of `ZeroHom`s as a `ZeroHom`. -/]
751+
@[to_additive (attr := implicit_reducible) /-- Composition of `ZeroHom`s as a `ZeroHom`. -/]
749752
def OneHom.comp [One M] [One N] [One P] (hnp : OneHom N P) (hmn : OneHom M N) : OneHom M P where
750-
toFun := hnp hmn
753+
toFun x := hnp (hmn x)
751754
map_one' := by simp
752755

753756
/-- Composition of `MulHom`s as a `MulHom`. -/
754-
@[to_additive /-- Composition of `AddHom`s as an `AddHom`. -/]
757+
@[to_additive (attr := implicit_reducible) /-- Composition of `AddHom`s as an `AddHom`. -/]
755758
def MulHom.comp [Mul M] [Mul N] [Mul P] (hnp : N →ₙ* P) (hmn : M →ₙ* N) : M →ₙ* P where
756-
toFun := hnp hmn
759+
toFun x := hnp (hmn x)
757760
map_mul' x y := by simp
758761

759762
/-- Composition of monoid morphisms as a monoid morphism. -/
760-
@[to_additive /-- Composition of additive monoid morphisms as an additive monoid morphism. -/]
763+
@[to_additive (attr := implicit_reducible)
764+
/-- Composition of additive monoid morphisms as an additive monoid morphism. -/]
761765
def MonoidHom.comp [MulOne M] [MulOne N] [MulOne P] (hnp : N →* P) (hmn : M →* N) :
762766
M →* P where
763-
toFun := hnp hmn
767+
toFun x := hnp (hmn x)
764768
map_one' := by simp
765769
map_mul' := by simp
766770

Mathlib/Algebra/Homology/Additive.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,7 @@ theorem map_chain_complex_of (F : W₁ ⥤ W₂) [F.PreservesZeroMorphisms] (X :
214214
rw [← F.map_comp, sq n, Functor.map_zero] := by
215215
refine HomologicalComplex.ext rfl ?_
216216
rintro i j (rfl : j + 1 = i)
217-
simp only [CategoryTheory.Functor.mapHomologicalComplex_obj_d, of_d, eqToHom_refl, comp_id,
218-
id_comp]
217+
simp
219218

220219
end ChainComplex
221220

Mathlib/Algebra/Homology/HomologicalComplex.lean

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -631,32 +631,34 @@ section Of
631631

632632
variable {V} {α : Type*} [AddRightCancelSemigroup α] [One α] [DecidableEq α]
633633

634+
/-- Auxiliary definition for differentials for `ChainComplex.of`. -/
635+
def of.d (X : α → V) (d : ∀ n, X (n + 1) ⟶ X n) (i : α) (j : α) : X i ⟶ X j :=
636+
if h : i = j + 1 then eqToHom (by rw [h]) ≫ d j else 0
637+
634638
/-- Construct an `α`-indexed chain complex from a dependently-typed differential.
635639
-/
636-
def of (X : α → V) (d : ∀ n, X (n + 1) ⟶ X n) (sq : ∀ n, d (n + 1) ≫ d n = 0) : ChainComplex V α :=
640+
abbrev of (X : α → V) (d : ∀ n, X (n + 1) ⟶ X n) (sq : ∀ n, d (n + 1) ≫ d n = 0) :
641+
ChainComplex V α :=
637642
{ X := X
638-
d := fun i j => if h : i = j + 1 then eqToHom (by rw [h]) ≫ d j else 0
639-
shape := fun i j w => by
640-
rw [dif_neg (Ne.symm w)]
643+
d := of.d X d
644+
shape := fun i j w => by simp [of.d, (Ne.symm w)]
641645
d_comp_d' := fun i j k hij hjk => by
642-
dsimp at hij hjk
646+
dsimp [of.d] at hij hjk
643647
substs hij hjk
644648
simp only [eqToHom_refl, id_comp, dite_eq_ite, ite_true, sq] }
645649

646650
variable (X : α → V) (d : ∀ n, X (n + 1) ⟶ X n) (sq : ∀ n, d (n + 1) ≫ d n = 0)
647651

648-
@[simp]
649652
theorem of_X : (of X d sq).X = X :=
650653
rfl
651654

652655
@[simp]
653-
theorem of_d (j : α) : (of X d sq).d (j + 1) j = d j := by
654-
dsimp [of]
656+
theorem of_d (j : α) : of.d X d (j + 1) j = d j := by
657+
dsimp [of.d]
655658
rw [if_pos rfl, Category.id_comp]
656659

657-
theorem of_d_ne {i j : α} (h : i ≠ j + 1) : (of X d sq).d i j = 0 := by
658-
rw [of]
659-
simp [dif_neg h]
660+
theorem of_d_ne {i j : α} (h : i ≠ j + 1) : of.d X d i j = 0 := by
661+
simp [of.d, dif_neg h]
660662

661663
end Of
662664

@@ -674,7 +676,7 @@ def ofHom (f : ∀ i : α, X i ⟶ Y i) (comm : ∀ i : α, f (i + 1) ≫ d_Y i
674676
of X d_X sq_X ⟶ of Y d_Y sq_Y :=
675677
{ f
676678
comm' := fun n m => by
677-
simp only [ComplexShape.down_Rel]
679+
simp only [of.d, ComplexShape.down_Rel]
678680
rintro rfl
679681
simpa using comm m }
680682

@@ -739,7 +741,7 @@ lemma mkAux_eq_shortComplex_mk_d_comp_d (n : ℕ) :
739741
mkAux X₀ X₁ X₂ d₀ d₁ s succ n =
740742
ShortComplex.mk _ _ ((mk X₀ X₁ X₂ d₀ d₁ s succ).d_comp_d (n + 2) (n + 1) n) := by
741743
rw [show n + 2 = n + 1 + 1 from rfl]
742-
simp only [mk, of_X, of_d, mkAux]
744+
simp [mk, mkAux]
743745

744746
/-- The isomorphism from `(mk X₀ X₁ X₂ d₀ d₁ s succ).X (n + 3)` that is given by
745747
the inductive construction. -/
@@ -760,7 +762,7 @@ lemma mk_d (n : ℕ) :
760762
set_option backward.isDefEq.respectTransparency false in
761763
rw [eqToHom_refl, comp_id] at eq
762764
refine Eq.trans ?_ eq
763-
dsimp only [mk, of]
765+
dsimp only [mk, of, of.d]
764766
rw [dif_pos (by rfl), eqToHom_refl, id_comp]
765767
rfl
766768

@@ -797,7 +799,7 @@ def mk'XIso (n : ℕ) :
797799
(mk' X₀ X₁ d₀ succ').X (n + 2) ≅ (succ' ((mk' X₀ X₁ d₀ succ').d (n + 1) n)).1 := by
798800
obtain _ | n := n
799801
· apply eqToIso
800-
dsimp [mk', mk, of, mkAux]
802+
dsimp [mk', mk, of, mkAux, of.d]
801803
rw [id_comp]
802804
· exact mkXIso _ _ _ _ _ (succ' d₀).2.2 (fun S => succ' S.f) n
803805

@@ -886,36 +888,36 @@ section Of
886888

887889
variable {V} {α : Type*} [AddRightCancelSemigroup α] [One α] [DecidableEq α]
888890

891+
/-- Auxiliary definition for differentials for `CochainComplex.of`. -/
892+
def of.d (X : α → V) (d : ∀ n, X n ⟶ X (n + 1)) (i : α) (j : α) : X i ⟶ X j :=
893+
if h : i + 1 = j then d _ ≫ eqToHom (by rw [h]) else 0
894+
889895
/-- Construct an `α`-indexed cochain complex from a dependently-typed differential.
890896
-/
891-
def of (X : α → V) (d : ∀ n, X n ⟶ X (n + 1)) (sq : ∀ n, d n ≫ d (n + 1) = 0) :
897+
abbrev of (X : α → V) (d : ∀ n, X n ⟶ X (n + 1)) (sq : ∀ n, d n ≫ d (n + 1) = 0) :
892898
CochainComplex V α :=
893899
{ X := X
894-
d := fun i j => if h : i + 1 = j then d _ ≫ eqToHom (by rw [h]) else 0
895-
shape := fun i j w => by
896-
rw [dif_neg]
897-
exact w
900+
d := of.d X d
901+
shape := fun i j w => dif_neg (c := i + 1 = j) w
898902
d_comp_d' := fun i j k => by
899-
dsimp
903+
dsimp [of.d]
900904
split_ifs with h h' h'
901905
· substs h h'
902906
simp [sq]
903907
all_goals simp }
904908

905909
variable (X : α → V) (d : ∀ n, X n ⟶ X (n + 1)) (sq : ∀ n, d n ≫ d (n + 1) = 0)
906910

907-
@[simp]
908911
theorem of_X : (of X d sq).X = X :=
909912
rfl
910913

911914
@[simp]
912-
theorem of_d (j : α) : (of X d sq).d j (j + 1) = d j := by
913-
dsimp [of]
915+
theorem of_d (j : α) : of.d X d j (j + 1) = d j := by
916+
dsimp [of.d]
914917
rw [if_pos rfl, Category.comp_id]
915918

916-
theorem of_d_ne {i j : α} (h : i + 1 ≠ j) : (of X d sq).d i j = 0 := by
917-
rw [of]
918-
simp [dif_neg h]
919+
theorem of_d_ne {i j : α} (h : i + 1 ≠ j) : of.d X d i j = 0 := by
920+
simp [of.d, dif_neg h]
919921

920922
end Of
921923

@@ -934,7 +936,7 @@ def ofHom (f : ∀ i : α, X i ⟶ Y i) (comm : ∀ i : α, f i ≫ d_Y i = d_X
934936
of X d_X sq_X ⟶ of Y d_Y sq_Y :=
935937
{ f
936938
comm' := fun n m => by
937-
simp only [ComplexShape.up_Rel]
939+
simp only [of.d, ComplexShape.up_Rel]
938940
rintro rfl
939941
simpa using comm n }
940942

0 commit comments

Comments
 (0)