Skip to content

Commit c9fe4c8

Browse files
committed
Merge remote-tracking branch 'upstream/master' into bump/v4.23.0
2 parents 1aa814d + bed8037 commit c9fe4c8

File tree

141 files changed

+2805
-887
lines changed

Some content is hidden

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

141 files changed

+2805
-887
lines changed

Archive/Wiedijk100Theorems/InverseTriangleSum.lean

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@ discrete_sum
2626
open Finset
2727

2828
/-- **Sum of the Reciprocals of the Triangular Numbers** -/
29-
theorem Theorems100.inverse_triangle_sum :
30-
∀ n, ∑ k ∈ range n, (2 : ℚ) / (k * (k + 1)) = if n = 0 then 0 else 2 - (2 : ℚ) / n := by
31-
refine sum_range_induction _ _ rfl ?_
29+
theorem Theorems100.inverse_triangle_sum (n : ℕ) :
30+
∑ k ∈ range n, (2 : ℚ) / (k * (k + 1)) = if n = 0 then 0 else 2 - (2 : ℚ) / n := by
31+
apply sum_range_induction _ _ rfl
3232
rintro (_ | _)
3333
· norm_num
34-
field_simp
35-
ring
34+
· field_simp
35+
ring_nf
36+
simp

Counterexamples/CliffordAlgebraNotInjective.lean

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import Mathlib.Algebra.CharP.Quotient
88
import Mathlib.LinearAlgebra.CliffordAlgebra.Contraction
99
import Mathlib.RingTheory.MvPolynomial.Basic
1010
import Mathlib.RingTheory.MvPolynomial.Ideal
11+
import Mathlib.Tactic.Ring.NamePolyVars
1112

1213
/-! # `algebraMap R (CliffordAlgebra Q)` is not always injective.
1314
@@ -34,36 +35,39 @@ noncomputable section
3435
open LinearMap (BilinForm)
3536
open LinearMap (BilinMap)
3637

38+
name_poly_vars X, Y, Z over ZMod 2
39+
3740
namespace Q60596
3841

3942
open MvPolynomial
4043

4144
/-- The monomial ideal generated by terms of the form $x_ix_i$. -/
4245
def kIdeal : Ideal (MvPolynomial (Fin 3) (ZMod 2)) :=
43-
Ideal.span (Set.range fun i => (X i * X i : MvPolynomial (Fin 3) (ZMod 2)))
46+
Ideal.span (Set.range fun i =>
47+
(MvPolynomial.X i * MvPolynomial.X i : MvPolynomial (Fin 3) (ZMod 2)))
4448

4549
theorem mem_kIdeal_iff (x : MvPolynomial (Fin 3) (ZMod 2)) :
4650
x ∈ kIdeal ↔ ∀ m : Fin 3 →₀ ℕ, m ∈ x.support → ∃ i, 2 ≤ m i := by
4751
have :
4852
kIdeal = Ideal.span ((monomial · (1 : ZMod 2)) '' Set.range (Finsupp.single · 2)) := by
49-
simp_rw [kIdeal, X, monomial_mul, one_mul, ← Finsupp.single_add, ← Set.range_comp,
53+
simp_rw [kIdeal, MvPolynomial.X, monomial_mul, one_mul, ← Finsupp.single_add, ← Set.range_comp,
5054
Function.comp_def]
5155
rw [this, mem_ideal_span_monomial_image]
5256
simp
5357

54-
theorem X0_X1_X2_notMem_kIdeal : (X 0 * X 1 * X 2 : MvPolynomial (Fin 3) (ZMod 2)) ∉ kIdeal := by
58+
theorem X_Y_Z_notMem_kIdeal : (X * Y * Z : MvPolynomial (Fin 3) (ZMod 2)) ∉ kIdeal := by
5559
intro h
5660
simp_rw [mem_kIdeal_iff, support_mul_X, support_X, Finset.map_singleton, addRightEmbedding_apply,
5761
Finset.mem_singleton, forall_eq, ← Fin.sum_univ_three fun i => Finsupp.single i 1,
5862
← Finsupp.equivFunOnFinite_symm_eq_sum] at h
5963
contradiction
6064

61-
@[deprecated (since := "2025-05-23")] alias X0_X1_X2_not_mem_kIdeal := X0_X1_X2_notMem_kIdeal
65+
@[deprecated (since := "2025-05-23")] alias X_Y_Z_not_mem_kIdeal := X_Y_Z_notMem_kIdeal
6266

63-
theorem mul_self_mem_kIdeal_of_X0_X1_X2_mul_mem {x : MvPolynomial (Fin 3) (ZMod 2)}
64-
(h : X 0 * X 1 * X 2 * x ∈ kIdeal) : x * x ∈ kIdeal := by
67+
theorem mul_self_mem_kIdeal_of_X_Y_Z_mul_mem {x : MvPolynomial (Fin 3) (ZMod 2)}
68+
(h : X * Y * Z * x ∈ kIdeal) : x * x ∈ kIdeal := by
6569
rw [mem_kIdeal_iff] at h
66-
have : x ∈ Ideal.span ((X : Fin 3 → MvPolynomial _ (ZMod 2)) '' Set.univ) := by
70+
have : x ∈ Ideal.span ((MvPolynomial.X : Fin 3 → MvPolynomial _ (ZMod 2)) '' Set.univ) := by
6771
rw [mem_ideal_span_X_image]
6872
intro m hm
6973
simp_rw [mul_assoc, support_X_mul, Finset.map_map, Finset.mem_map,
@@ -127,11 +131,11 @@ theorem sq_zero_of_αβγ_mul {x : K} : α * β * γ * x = 0 → x * x = 0 := by
127131
induction x using Quotient.inductionOn'
128132
change Ideal.Quotient.mk _ _ = 0 → Ideal.Quotient.mk _ _ = 0
129133
rw [Ideal.Quotient.eq_zero_iff_mem, Ideal.Quotient.eq_zero_iff_mem]
130-
exact mul_self_mem_kIdeal_of_X0_X1_X2_mul_mem
134+
exact mul_self_mem_kIdeal_of_X_Y_Z_mul_mem
131135

132136
/-- Though `αβγ` is not itself zero -/
133137
theorem αβγ_ne_zero : α * β * γ ≠ 0 := fun h =>
134-
X0_X1_X2_notMem_kIdeal <| Ideal.Quotient.eq_zero_iff_mem.1 h
138+
X_Y_Z_notMem_kIdeal <| Ideal.Quotient.eq_zero_iff_mem.1 h
135139

136140
/-- The 1-form on $K^3$, the kernel of which we will take a quotient by.
137141

Mathlib.lean

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ import Mathlib.Algebra.Category.CoalgCat.Basic
9292
import Mathlib.Algebra.Category.CoalgCat.ComonEquivalence
9393
import Mathlib.Algebra.Category.CoalgCat.Monoidal
9494
import Mathlib.Algebra.Category.CommAlgCat.Basic
95+
import Mathlib.Algebra.Category.CommAlgCat.FiniteType
9596
import Mathlib.Algebra.Category.ContinuousCohomology.Basic
9697
import Mathlib.Algebra.Category.FGModuleCat.Basic
9798
import Mathlib.Algebra.Category.FGModuleCat.EssentiallySmall
@@ -953,6 +954,7 @@ import Mathlib.Algebra.Polynomial.CoeffMem
953954
import Mathlib.Algebra.Polynomial.Degree.CardPowDegree
954955
import Mathlib.Algebra.Polynomial.Degree.Definitions
955956
import Mathlib.Algebra.Polynomial.Degree.Domain
957+
import Mathlib.Algebra.Polynomial.Degree.IsMonicOfDegree
956958
import Mathlib.Algebra.Polynomial.Degree.Lemmas
957959
import Mathlib.Algebra.Polynomial.Degree.Monomial
958960
import Mathlib.Algebra.Polynomial.Degree.Operations
@@ -1904,6 +1906,7 @@ import Mathlib.CategoryTheory.Abelian.Pseudoelements
19041906
import Mathlib.CategoryTheory.Abelian.Refinements
19051907
import Mathlib.CategoryTheory.Abelian.RightDerived
19061908
import Mathlib.CategoryTheory.Abelian.SerreClass.Basic
1909+
import Mathlib.CategoryTheory.Abelian.SerreClass.MorphismProperty
19071910
import Mathlib.CategoryTheory.Abelian.Subobject
19081911
import Mathlib.CategoryTheory.Abelian.Transfer
19091912
import Mathlib.CategoryTheory.Abelian.Yoneda
@@ -5081,6 +5084,7 @@ import Mathlib.RepresentationTheory.Homological.GroupCohomology.Functoriality
50815084
import Mathlib.RepresentationTheory.Homological.GroupCohomology.Hilbert90
50825085
import Mathlib.RepresentationTheory.Homological.GroupCohomology.LongExactSequence
50835086
import Mathlib.RepresentationTheory.Homological.GroupCohomology.LowDegree
5087+
import Mathlib.RepresentationTheory.Homological.GroupCohomology.Shapiro
50845088
import Mathlib.RepresentationTheory.Homological.GroupHomology.Basic
50855089
import Mathlib.RepresentationTheory.Homological.GroupHomology.Functoriality
50865090
import Mathlib.RepresentationTheory.Homological.GroupHomology.LowDegree
@@ -5495,6 +5499,7 @@ import Mathlib.RingTheory.Regular.Category
54955499
import Mathlib.RingTheory.Regular.Depth
54965500
import Mathlib.RingTheory.Regular.IsSMulRegular
54975501
import Mathlib.RingTheory.Regular.RegularSequence
5502+
import Mathlib.RingTheory.RingHom.Etale
54985503
import Mathlib.RingTheory.RingHom.Finite
54995504
import Mathlib.RingTheory.RingHom.FinitePresentation
55005505
import Mathlib.RingTheory.RingHom.FiniteType
@@ -5929,6 +5934,7 @@ import Mathlib.Tactic.Rify
59295934
import Mathlib.Tactic.Ring
59305935
import Mathlib.Tactic.Ring.Basic
59315936
import Mathlib.Tactic.Ring.Compare
5937+
import Mathlib.Tactic.Ring.NamePolyVars
59325938
import Mathlib.Tactic.Ring.PNat
59335939
import Mathlib.Tactic.Ring.RingNF
59345940
import Mathlib.Tactic.Sat.FromLRAT

Mathlib/Algebra/Algebra/Bilinear.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def mul : A →ₗ[R] A →ₗ[R] A :=
8989

9090
/-- The multiplication map on a non-unital algebra, as an `R`-linear map from `A ⊗[R] A` to `A`. -/
9191
-- TODO: upgrade to A-linear map if A is a semiring.
92-
noncomputable def mul' : A ⊗[R] A →ₗ[R] A :=
92+
def mul' : A ⊗[R] A →ₗ[R] A :=
9393
TensorProduct.lift (mul R A)
9494

9595
variable {A}

Mathlib/Algebra/Algebra/Equiv.lean

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,3 +758,10 @@ def toAlgAut : G →* A ≃ₐ[R] A where
758758
end
759759

760760
end MulSemiringAction
761+
762+
/-- The algebra equivalence between `ULift A` and `A`. -/
763+
@[simps! -isSimp apply]
764+
def ULift.algEquiv {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A] :
765+
ULift.{w} A ≃ₐ[R] A where
766+
__ := ULift.ringEquiv
767+
commutes' _ := rfl

Mathlib/Algebra/Azumaya/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ lemma AlgHom.mulLeftRight_bij [h : IsAzumaya R A] :
3939

4040
/-- The "canonical" isomorphism between `R ⊗ Rᵒᵖ` and `End R R` which is equal
4141
to `AlgHom.mulLeftRight R R`. -/
42-
noncomputable abbrev tensorEquivEnd : R ⊗[R] Rᵐᵒᵖ ≃ₐ[R] Module.End R R :=
42+
abbrev tensorEquivEnd : R ⊗[R] Rᵐᵒᵖ ≃ₐ[R] Module.End R R :=
4343
Algebra.TensorProduct.lid R Rᵐᵒᵖ|>.trans <| .moduleEndSelf R
4444

4545
lemma coe_tensorEquivEnd : tensorEquivEnd R = AlgHom.mulLeftRight R R := by

Mathlib/Algebra/Azumaya/Defs.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ variable (R A : Type*) [CommSemiring R] [Semiring A] [Algebra R A]
3232
open TensorProduct MulOpposite
3333

3434
/-- `A` as a `A ⊗[R] Aᵐᵒᵖ`-module (or equivalently, an `A`-`A` bimodule). -/
35-
noncomputable abbrev instModuleTensorProductMop :
35+
abbrev instModuleTensorProductMop :
3636
Module (A ⊗[R] Aᵐᵒᵖ) A := TensorProduct.Algebra.module
3737

3838
/-- The canonical map from `A ⊗[R] Aᵐᵒᵖ` to `Module.End R A` where
3939
`a ⊗ b` maps to `f : x ↦ a * x * b`. -/
40-
noncomputable def AlgHom.mulLeftRight : (A ⊗[R] Aᵐᵒᵖ) →ₐ[R] Module.End R A :=
40+
def AlgHom.mulLeftRight : (A ⊗[R] Aᵐᵒᵖ) →ₐ[R] Module.End R A :=
4141
letI : Module (A ⊗[R] Aᵐᵒᵖ) A := TensorProduct.Algebra.module
4242
letI : IsScalarTower R (A ⊗[R] Aᵐᵒᵖ) A := {
4343
smul_assoc := fun r ab a ↦ by

Mathlib/Algebra/BigOperators/Finprod.lean

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,4 +1145,24 @@ theorem finprod_emb_domain (f : α ↪ β) [DecidablePred (· ∈ Set.range f)]
11451145
(∏ᶠ b : β, if h : b ∈ Set.range f then g (Classical.choose h) else 1) = ∏ᶠ a : α, g a :=
11461146
finprod_emb_domain' f.injective g
11471147

1148+
@[simp, norm_cast]
1149+
lemma Nat.cast_finprod [Finite ι] {R : Type*} [CommSemiring R] (f : ι → ℕ) :
1150+
↑(∏ᶠ x, f x : ℕ) = ∏ᶠ x, (f x : R) :=
1151+
(Nat.castRingHom R).map_finprod f.mulSupport.toFinite
1152+
1153+
@[simp, norm_cast]
1154+
lemma Nat.cast_finprod_mem {s : Set ι} (hs : s.Finite) {R : Type*} [CommSemiring R] (f : ι → ℕ) :
1155+
↑(∏ᶠ x ∈ s, f x : ℕ) = ∏ᶠ x ∈ s, (f x : R) :=
1156+
(Nat.castRingHom R).map_finprod_mem _ hs
1157+
1158+
@[simp, norm_cast]
1159+
lemma Nat.cast_finsum [Finite ι] {M : Type*} [AddCommMonoidWithOne M]
1160+
(f : ι → ℕ) : ↑(∑ᶠ x, f x : ℕ) = ∑ᶠ x, (f x : M) :=
1161+
(Nat.castAddMonoidHom M).map_finsum f.support.toFinite
1162+
1163+
@[simp, norm_cast]
1164+
lemma Nat.cast_finsum_mem {s : Set ι} (hs : s.Finite) {M : Type*}
1165+
[AddCommMonoidWithOne M] (f : ι → ℕ) : ↑(∑ᶠ x ∈ s, f x : ℕ) = ∑ᶠ x ∈ s, (f x : M) :=
1166+
(Nat.castAddMonoidHom M).map_finsum_mem _ hs
1167+
11481168
end type

Mathlib/Algebra/BigOperators/Group/Finset/Basic.lean

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -604,19 +604,22 @@ theorem prod_multiset_count_of_subset [DecidableEq M] (m : Multiset M) (s : Fins
604604
apply prod_list_count_of_subset l s
605605

606606
/-- For any product along `{0, ..., n - 1}` of a commutative-monoid-valued function, we can verify
607-
that it's equal to a different function just by checking ratios of adjacent terms.
607+
that it's equal to a different function just by checking ratios of adjacent terms up to `n`.
608608
609609
This is a multiplicative discrete analogue of the fundamental theorem of calculus. -/
610610
@[to_additive "For any sum along `{0, ..., n - 1}` of a commutative-monoid-valued function, we can
611-
verify that it's equal to a different function just by checking differences of adjacent terms.
611+
verify that it's equal to a different function just by checking differences of adjacent terms up to
612+
`n`.
612613
613614
This is a discrete analogue of the fundamental theorem of calculus."]
614615
theorem prod_range_induction (f s : ℕ → M) (base : s 0 = 1)
615-
(step : ∀ n, s (n + 1) = s n * f n) (n : ℕ) :
616+
(n : ℕ) (step : ∀ k < n, s (k + 1) = s k * f k) :
616617
∏ k ∈ Finset.range n, f k = s n := by
617618
induction n with
618619
| zero => rw [Finset.prod_range_zero, base]
619-
| succ k hk => simp only [hk, Finset.prod_range_succ, step, mul_comm]
620+
| succ k hk =>
621+
rw [Finset.prod_range_succ, step _ (Nat.lt_succ_self _), hk]
622+
exact fun _ hl ↦ step _ (Nat.lt_succ_of_lt hl)
620623

621624
@[to_additive (attr := simp)]
622625
theorem prod_const (b : M) : ∏ _x ∈ s, b = b ^ #s :=
@@ -921,7 +924,7 @@ lemma sum_range_tsub {f : ℕ → M} (h : Monotone f) (n : ℕ) :
921924
apply sum_range_induction
922925
case base => apply tsub_eq_of_eq_add; rw [zero_add]
923926
case step =>
924-
intro n
927+
intro n _
925928
have h₁ : f n ≤ f (n + 1) := h (Nat.le_succ _)
926929
have h₂ : f 0 ≤ f n := h (Nat.zero_le _)
927930
rw [tsub_add_eq_add_tsub h₂, add_tsub_cancel_of_le h₁]

Mathlib/Algebra/Category/CommAlgCat/Basic.lean

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ Authors: Yaël Dillies, Christian Merten, Michał Mrugała, Andrew Yang
55
-/
66
import Mathlib.Algebra.Category.AlgCat.Basic
77
import Mathlib.Algebra.Category.Ring.Under.Basic
8+
import Mathlib.CategoryTheory.Limits.Over
9+
import Mathlib.CategoryTheory.WithTerminal.Cone
810

911
/-!
1012
# The category of commutative algebras over a commutative ring
@@ -17,7 +19,7 @@ namespace CategoryTheory
1719

1820
open Limits
1921

20-
universe v u
22+
universe w v u
2123

2224
variable {R : Type u} [CommRing R]
2325

@@ -165,6 +167,25 @@ instance reflectsIsomorphisms_forget : (forget (CommAlgCat.{u} R)).ReflectsIsomo
165167
let e : X ≃ₐ[R] Y := { f.hom, i.toEquiv with }
166168
exact (isoMk e).isIso_hom
167169

170+
variable (R)
171+
172+
/-- Universe lift functor for commutative algebras. -/
173+
def uliftFunctor : CommAlgCat.{v} R ⥤ CommAlgCat.{max v w} R where
174+
obj A := .of R <| ULift A
175+
map {A B} f := CommAlgCat.ofHom <|
176+
ULift.algEquiv.symm.toAlgHom.comp <| f.hom.comp ULift.algEquiv.toAlgHom
177+
178+
/-- The universe lift functor for commutative algebras is fully faithful. -/
179+
def fullyFaithfulUliftFunctor : (uliftFunctor R).FullyFaithful where
180+
preimage {A B} f :=
181+
CommAlgCat.ofHom <| ULift.algEquiv.toAlgHom.comp <| f.hom.comp ULift.algEquiv.symm.toAlgHom
182+
183+
instance : (uliftFunctor R).Full :=
184+
(fullyFaithfulUliftFunctor R).full
185+
186+
instance : (uliftFunctor R).Faithful :=
187+
(fullyFaithfulUliftFunctor R).faithful
188+
168189
end CommAlgCat
169190

170191
/-- The category of commutative algebras over a commutative ring `R` is the same as commutative
@@ -179,4 +200,12 @@ def commAlgCatEquivUnder (R : CommRingCat) : CommAlgCat R ≌ Under R where
179200
CommAlgCat.isoMk { toRingEquiv := .refl A, commutes' _ := rfl }
180201
counitIso := .refl _
181202

203+
-- TODO: Generalize to `UnivLE.{u, v}` once `commAlgCatEquivUnder` is generalized.
204+
instance : HasColimits (CommAlgCat.{u} R) :=
205+
Adjunction.has_colimits_of_equivalence (commAlgCatEquivUnder (.of R)).functor
206+
207+
-- TODO: Generalize to `UnivLE.{u, v}` once `commAlgCatEquivUnder` is generalized.
208+
instance : HasLimits (CommAlgCat.{u} R) :=
209+
Adjunction.has_limits_of_equivalence (commAlgCatEquivUnder (.of R)).functor
210+
182211
end CategoryTheory

0 commit comments

Comments
 (0)