Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
leanprover-community-mathlib4-bot committed Jan 30, 2025
2 parents ddc6ce8 + 956d514 commit 4368e7a
Show file tree
Hide file tree
Showing 510 changed files with 9,310 additions and 6,301 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/latest_import.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ jobs:
- name: add minImports linter option
run: |
# set `linter.minImports option` to true in `lakefile`
sed -i -- '/^ -- '\`'latest_import.yml'\`' uses this comment/{s=^= ⟨`linter.minImports, true⟩,\n=}' lakefile.lean
# we disable checking for backticks inside single quotes with the next line
# shellcheck disable=SC2016
# set `linter.minImports option` to true and `Elab.async` to false in `lakefile`
sed -i -- '/^ -- '\`'latest_import.yml'\`' uses this comment/{s=^= ⟨`linter.minImports, true⟩,\n ⟨`Elab.async, false⟩,\n=}' lakefile.lean
# import the `minImports` linter in `Mathlib.Init`
sed -i -z 's=^=import Mathlib.Tactic.Linter.MinImports\n=' Mathlib/Init.lean
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/maintainer_bors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,15 @@ jobs:
( steps.user_permission.outputs.require-result == 'true' ||
steps.merge_or_delegate.outputs.bot == 'true' ) }}
id: remove_labels
name: Remove "awaiting-author"
name: Remove "awaiting-author" and "maintainer-merge"
# we use curl rather than octokit/request-action so that the job won't fail
# (and send an annoying email) if the labels don't exist
run: |
curl --request DELETE \
--url "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}${{ github.event.pull_request.number }}/labels/awaiting-author" \
--header 'authorization: Bearer ${{ secrets.TRIAGE_TOKEN }}'
for label in awaiting-author maintainer-merge; do
curl --request DELETE \
--url "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}${{ github.event.pull_request.number }}/labels/${label}" \
--header 'authorization: Bearer ${{ secrets.TRIAGE_TOKEN }}'
done
- name: Set up Python
if: ${{ ! steps.merge_or_delegate.outputs.mOrD == '' &&
Expand Down
36 changes: 26 additions & 10 deletions Mathlib.lean
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Std
import Batteries
import Mathlib.Algebra.AddConstMap.Basic
import Mathlib.Algebra.AddConstMap.Equiv
Expand Down Expand Up @@ -355,6 +356,7 @@ import Mathlib.Algebra.Group.Submonoid.Defs
import Mathlib.Algebra.Group.Submonoid.DistribMulAction
import Mathlib.Algebra.Group.Submonoid.Finsupp
import Mathlib.Algebra.Group.Submonoid.Membership
import Mathlib.Algebra.Group.Submonoid.MulAction
import Mathlib.Algebra.Group.Submonoid.MulOpposite
import Mathlib.Algebra.Group.Submonoid.Operations
import Mathlib.Algebra.Group.Submonoid.Pointwise
Expand Down Expand Up @@ -449,6 +451,7 @@ import Mathlib.Algebra.Homology.Embedding.StupidTrunc
import Mathlib.Algebra.Homology.Embedding.TruncGE
import Mathlib.Algebra.Homology.Embedding.TruncGEHomology
import Mathlib.Algebra.Homology.Embedding.TruncLE
import Mathlib.Algebra.Homology.Embedding.TruncLEHomology
import Mathlib.Algebra.Homology.ExactSequence
import Mathlib.Algebra.Homology.Factorizations.Basic
import Mathlib.Algebra.Homology.Functor
Expand Down Expand Up @@ -1166,6 +1169,7 @@ import Mathlib.Analysis.BoxIntegral.Partition.Tagged
import Mathlib.Analysis.BoxIntegral.UnitPartition
import Mathlib.Analysis.CStarAlgebra.ApproximateUnit
import Mathlib.Analysis.CStarAlgebra.Basic
import Mathlib.Analysis.CStarAlgebra.CStarMatrix
import Mathlib.Analysis.CStarAlgebra.Classes
import Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Basic
import Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Instances
Expand Down Expand Up @@ -1732,6 +1736,7 @@ import Mathlib.CategoryTheory.Category.ULift
import Mathlib.CategoryTheory.ChosenFiniteProducts
import Mathlib.CategoryTheory.ChosenFiniteProducts.Cat
import Mathlib.CategoryTheory.ChosenFiniteProducts.FunctorCategory
import Mathlib.CategoryTheory.ChosenFiniteProducts.InfSemilattice
import Mathlib.CategoryTheory.Closed.Cartesian
import Mathlib.CategoryTheory.Closed.Enrichment
import Mathlib.CategoryTheory.Closed.Functor
Expand Down Expand Up @@ -1845,7 +1850,7 @@ import Mathlib.CategoryTheory.Galois.Prorepresentability
import Mathlib.CategoryTheory.Galois.Topology
import Mathlib.CategoryTheory.Generator.Abelian
import Mathlib.CategoryTheory.Generator.Basic
import Mathlib.CategoryTheory.Generator.Coproduct
import Mathlib.CategoryTheory.Generator.Indization
import Mathlib.CategoryTheory.Generator.Preadditive
import Mathlib.CategoryTheory.Generator.Presheaf
import Mathlib.CategoryTheory.Generator.Sheaf
Expand Down Expand Up @@ -1930,6 +1935,7 @@ import Mathlib.CategoryTheory.Limits.Indization.Equalizers
import Mathlib.CategoryTheory.Limits.Indization.FilteredColimits
import Mathlib.CategoryTheory.Limits.Indization.IndObject
import Mathlib.CategoryTheory.Limits.Indization.LocallySmall
import Mathlib.CategoryTheory.Limits.Indization.ParallelPair
import Mathlib.CategoryTheory.Limits.Indization.Products
import Mathlib.CategoryTheory.Limits.IsConnected
import Mathlib.CategoryTheory.Limits.IsLimit
Expand All @@ -1939,6 +1945,7 @@ import Mathlib.CategoryTheory.Limits.MorphismProperty
import Mathlib.CategoryTheory.Limits.Opposites
import Mathlib.CategoryTheory.Limits.Over
import Mathlib.CategoryTheory.Limits.Pi
import Mathlib.CategoryTheory.Limits.Preorder
import Mathlib.CategoryTheory.Limits.Preserves.Basic
import Mathlib.CategoryTheory.Limits.Preserves.Filtered
import Mathlib.CategoryTheory.Limits.Preserves.Finite
Expand Down Expand Up @@ -2143,6 +2150,7 @@ import Mathlib.CategoryTheory.Preadditive.Projective
import Mathlib.CategoryTheory.Preadditive.ProjectiveResolution
import Mathlib.CategoryTheory.Preadditive.Schur
import Mathlib.CategoryTheory.Preadditive.SingleObj
import Mathlib.CategoryTheory.Preadditive.Transfer
import Mathlib.CategoryTheory.Preadditive.Yoneda.Basic
import Mathlib.CategoryTheory.Preadditive.Yoneda.Injective
import Mathlib.CategoryTheory.Preadditive.Yoneda.Limits
Expand Down Expand Up @@ -2263,6 +2271,7 @@ import Mathlib.CategoryTheory.Subobject.Types
import Mathlib.CategoryTheory.Subobject.WellPowered
import Mathlib.CategoryTheory.Subpresheaf.Basic
import Mathlib.CategoryTheory.Subpresheaf.Image
import Mathlib.CategoryTheory.Subpresheaf.OfSection
import Mathlib.CategoryTheory.Subpresheaf.Sieves
import Mathlib.CategoryTheory.Subterminal
import Mathlib.CategoryTheory.Sums.Associator
Expand Down Expand Up @@ -2500,6 +2509,7 @@ import Mathlib.Data.Complex.FiniteDimensional
import Mathlib.Data.Complex.Module
import Mathlib.Data.Complex.Order
import Mathlib.Data.Complex.Orientation
import Mathlib.Data.Complex.Trigonometric
import Mathlib.Data.Countable.Basic
import Mathlib.Data.Countable.Defs
import Mathlib.Data.Countable.Small
Expand Down Expand Up @@ -3082,19 +3092,13 @@ import Mathlib.Deprecated.Cardinal.Finite
import Mathlib.Deprecated.Cardinal.PartENat
import Mathlib.Deprecated.Combinator
import Mathlib.Deprecated.Equiv
import Mathlib.Deprecated.Group
import Mathlib.Deprecated.HashMap
import Mathlib.Deprecated.LazyList
import Mathlib.Deprecated.Logic
import Mathlib.Deprecated.MinMax
import Mathlib.Deprecated.NatLemmas
import Mathlib.Deprecated.Order
import Mathlib.Deprecated.RelClasses
import Mathlib.Deprecated.Ring
import Mathlib.Deprecated.Subfield
import Mathlib.Deprecated.Subgroup
import Mathlib.Deprecated.Submonoid
import Mathlib.Deprecated.Subring
import Mathlib.Dynamics.BirkhoffSum.Average
import Mathlib.Dynamics.BirkhoffSum.Basic
import Mathlib.Dynamics.BirkhoffSum.NormedSpace
Expand Down Expand Up @@ -3231,8 +3235,8 @@ import Mathlib.Geometry.Manifold.IntegralCurve.Basic
import Mathlib.Geometry.Manifold.IntegralCurve.ExistUnique
import Mathlib.Geometry.Manifold.IntegralCurve.Transform
import Mathlib.Geometry.Manifold.IntegralCurve.UniformTime
import Mathlib.Geometry.Manifold.InteriorBoundary
import Mathlib.Geometry.Manifold.IsManifold
import Mathlib.Geometry.Manifold.IsManifold.Basic
import Mathlib.Geometry.Manifold.IsManifold.InteriorBoundary
import Mathlib.Geometry.Manifold.LocalDiffeomorph
import Mathlib.Geometry.Manifold.LocalInvariantProperties
import Mathlib.Geometry.Manifold.MFDeriv.Atlas
Expand Down Expand Up @@ -3742,6 +3746,7 @@ import Mathlib.MeasureTheory.Covering.OneDim
import Mathlib.MeasureTheory.Covering.Vitali
import Mathlib.MeasureTheory.Covering.VitaliFamily
import Mathlib.MeasureTheory.Decomposition.Exhaustion
import Mathlib.MeasureTheory.Decomposition.IntegralRNDeriv
import Mathlib.MeasureTheory.Decomposition.Jordan
import Mathlib.MeasureTheory.Decomposition.Lebesgue
import Mathlib.MeasureTheory.Decomposition.RadonNikodym
Expand All @@ -3768,7 +3773,9 @@ import Mathlib.MeasureTheory.Function.EssSup
import Mathlib.MeasureTheory.Function.Floor
import Mathlib.MeasureTheory.Function.Intersectivity
import Mathlib.MeasureTheory.Function.Jacobian
import Mathlib.MeasureTheory.Function.L1Space
import Mathlib.MeasureTheory.Function.L1Space.AEEqFun
import Mathlib.MeasureTheory.Function.L1Space.HasFiniteIntegral
import Mathlib.MeasureTheory.Function.L1Space.Integrable
import Mathlib.MeasureTheory.Function.L2Space
import Mathlib.MeasureTheory.Function.LocallyIntegrable
import Mathlib.MeasureTheory.Function.LpOrder
Expand Down Expand Up @@ -4019,6 +4026,7 @@ import Mathlib.NumberTheory.LSeries.Nonvanishing
import Mathlib.NumberTheory.LSeries.Positivity
import Mathlib.NumberTheory.LSeries.PrimesInAP
import Mathlib.NumberTheory.LSeries.RiemannZeta
import Mathlib.NumberTheory.LSeries.SumCoeff
import Mathlib.NumberTheory.LSeries.ZMod
import Mathlib.NumberTheory.LegendreSymbol.AddCharacter
import Mathlib.NumberTheory.LegendreSymbol.Basic
Expand Down Expand Up @@ -4155,6 +4163,7 @@ import Mathlib.Order.Compare
import Mathlib.Order.CompleteBooleanAlgebra
import Mathlib.Order.CompleteLattice
import Mathlib.Order.CompleteLattice.Finset
import Mathlib.Order.CompleteLattice.SetLike
import Mathlib.Order.CompleteLatticeIntervals
import Mathlib.Order.CompletePartialOrder
import Mathlib.Order.CompleteSublattice
Expand Down Expand Up @@ -4355,7 +4364,10 @@ import Mathlib.Probability.Independence.ZeroOne
import Mathlib.Probability.Integration
import Mathlib.Probability.Kernel.Basic
import Mathlib.Probability.Kernel.Composition.Basic
import Mathlib.Probability.Kernel.Composition.CompNotation
import Mathlib.Probability.Kernel.Composition.IntegralCompProd
import Mathlib.Probability.Kernel.Composition.Lemmas
import Mathlib.Probability.Kernel.Composition.MeasureComp
import Mathlib.Probability.Kernel.Composition.MeasureCompProd
import Mathlib.Probability.Kernel.Composition.ParallelComp
import Mathlib.Probability.Kernel.CondDistrib
Expand Down Expand Up @@ -4384,7 +4396,9 @@ import Mathlib.Probability.Martingale.OptionalSampling
import Mathlib.Probability.Martingale.OptionalStopping
import Mathlib.Probability.Martingale.Upcrossing
import Mathlib.Probability.Moments.Basic
import Mathlib.Probability.Moments.ComplexMGF
import Mathlib.Probability.Moments.IntegrableExpMul
import Mathlib.Probability.Moments.MGFAnalytic
import Mathlib.Probability.Notation
import Mathlib.Probability.ProbabilityMassFunction.Basic
import Mathlib.Probability.ProbabilityMassFunction.Binomial
Expand Down Expand Up @@ -4632,6 +4646,7 @@ import Mathlib.RingTheory.Localization.LocalizationLocalization
import Mathlib.RingTheory.Localization.Module
import Mathlib.RingTheory.Localization.NormTrace
import Mathlib.RingTheory.Localization.NumDen
import Mathlib.RingTheory.Localization.Pi
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.MatrixAlgebra
import Mathlib.RingTheory.Multiplicity
Expand Down Expand Up @@ -4860,6 +4875,7 @@ import Mathlib.SetTheory.Cardinal.SchroederBernstein
import Mathlib.SetTheory.Cardinal.Subfield
import Mathlib.SetTheory.Cardinal.ToNat
import Mathlib.SetTheory.Cardinal.UnivLE
import Mathlib.SetTheory.Descriptive.Tree
import Mathlib.SetTheory.Game.Basic
import Mathlib.SetTheory.Game.Birthday
import Mathlib.SetTheory.Game.Domineering
Expand Down
11 changes: 9 additions & 2 deletions Mathlib/Algebra/AddTorsor.lean
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ multiplicative group actions).
-/

open scoped Pointwise

/-- An `AddTorsor G P` gives a structure to the nonempty type `P`,
acted on by an `AddGroup G` with a transitive and free action given
by the `+ᵥ` operation and a corresponding subtraction given by the
Expand Down Expand Up @@ -162,8 +164,6 @@ theorem vadd_eq_vadd_iff_neg_add_eq_vsub {v₁ v₂ : G} {p₁ p₂ : P} :

namespace Set

open Pointwise

theorem singleton_vsub_self (p : P) : ({p} : Set P) -ᵥ {p} = {(0 : G)} := by
rw [Set.singleton_vsub_singleton, vsub_self]

Expand Down Expand Up @@ -231,6 +231,13 @@ theorem vadd_eq_vadd_iff_sub_eq_vsub {v₁ v₂ : G} {p₁ p₂ : P} :
theorem vsub_sub_vsub_comm (p₁ p₂ p₃ p₄ : P) : p₁ -ᵥ p₂ - (p₃ -ᵥ p₄) = p₁ -ᵥ p₃ - (p₂ -ᵥ p₄) := by
rw [← vsub_vadd_eq_vsub_sub, vsub_vadd_comm, vsub_vadd_eq_vsub_sub]

namespace Set

@[simp] lemma vadd_set_vsub_vadd_set (v : G) (s t : Set P) : (v +ᵥ s) -ᵥ (v +ᵥ t) = s -ᵥ t := by
ext; simp [mem_vsub, mem_vadd_set]

end Set

end comm

namespace Prod
Expand Down
19 changes: 19 additions & 0 deletions Mathlib/Algebra/Algebra/Pi.lean
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ theorem algebraMap_apply {_ : CommSemiring R} [_s : ∀ i, Semiring (f i)] [∀
(a : R) (i : I) : algebraMap R (∀ i, f i) a i = algebraMap R (f i) a :=
rfl

variable {I} in
instance (g : I → Type*) [∀ i, CommSemiring (f i)] [∀ i, Semiring (g i)]
[∀ i, Algebra (f i) (g i)] : Algebra (∀ i, f i) (∀ i, g i) where
algebraMap := Pi.ringHom fun _ ↦ (algebraMap _ _).comp (Pi.evalRingHom f _)
commutes' _ _ := funext fun _ ↦ Algebra.commutes _ _
smul_def' _ _ := funext fun _ ↦ Algebra.smul_def _ _

example [∀ i, CommSemiring (f i)] : Pi.instAlgebraForall f f = Algebra.id _ := rfl

-- One could also build a `∀ i, R i`-algebra structure on `∀ i, A i`,
-- when each `A i` is an `R i`-algebra, although I'm not sure that it's useful.
variable {I} (R)
Expand All @@ -70,6 +79,16 @@ def evalAlgHom {_ : CommSemiring R} [∀ i, Semiring (f i)] [∀ i, Algebra R (f
toFun := fun f => f i
commutes' := fun _ => rfl }

@[simp]
theorem algHom_evalAlgHom [CommSemiring R] [s : ∀ i, Semiring (f i)] [∀ i, Algebra R (f i)] :
algHom R f (evalAlgHom R f) = AlgHom.id R (Π i, f i) := rfl

/-- `Pi.algHom` commutes with composition. -/
theorem algHom_comp [CommSemiring R] [∀ i, Semiring (f i)] [∀ i, Algebra R (f i)]
{A B : Type*} [Semiring A] [Algebra R A] [Semiring B] [Algebra R B]
(g : ∀ i, B →ₐ[R] f i) (h : A →ₐ[R] B) :
(algHom R f g).comp h = algHom R f (fun i ↦ (g i).comp h) := rfl

variable (A B : Type*) [CommSemiring R] [Semiring B] [Algebra R B]

/-- `Function.const` as an `AlgHom`. The name matches `Pi.constRingHom`, `Pi.constMonoidHom`,
Expand Down
16 changes: 3 additions & 13 deletions Mathlib/Algebra/BigOperators/Fin.lean
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ theorem prod_univ_zero [CommMonoid β] (f : Fin 0 → β) : ∏ i, f i = 1 :=
/-- A product of a function `f : Fin (n + 1) → β` over all `Fin (n + 1)`
is the product of `f x`, for some `x : Fin (n + 1)` times the remaining product -/
@[to_additive "A sum of a function `f : Fin (n + 1) → β` over all `Fin (n + 1)` is the sum of
`f x`, for some `x : Fin (n + 1)` plus the remaining product"]
`f x`, for some `x : Fin (n + 1)` plus the remaining sum"]
theorem prod_univ_succAbove [CommMonoid β] {n : ℕ} (f : Fin (n + 1) → β) (x : Fin (n + 1)) :
∏ i, f i = f x * ∏ i : Fin n, f (x.succAbove i) := by
rw [univ_succAbove, prod_cons, Finset.prod_map _ x.succAboveEmb]
Expand All @@ -64,7 +64,7 @@ theorem prod_univ_succAbove [CommMonoid β] {n : ℕ} (f : Fin (n + 1) → β) (
/-- A product of a function `f : Fin (n + 1) → β` over all `Fin (n + 1)`
is the product of `f 0` plus the remaining product -/
@[to_additive "A sum of a function `f : Fin (n + 1) → β` over all `Fin (n + 1)` is the sum of
`f 0` plus the remaining product"]
`f 0` plus the remaining sum"]
theorem prod_univ_succ [CommMonoid β] {n : ℕ} (f : Fin (n + 1) → β) :
∏ i, f i = f 0 * ∏ i : Fin n, f i.succ :=
prod_univ_succAbove f 0
Expand Down Expand Up @@ -215,17 +215,7 @@ theorem partialProd_left_inv {G : Type*} [Group G] (f : Fin (n + 1) → G) :
@[to_additive]
theorem partialProd_right_inv {G : Type*} [Group G] (f : Fin n → G) (i : Fin n) :
(partialProd f (Fin.castSucc i))⁻¹ * partialProd f i.succ = f i := by
obtain ⟨i, hn⟩ := i
induction i with
| zero => simp [-Fin.succ_mk, partialProd_succ]
| succ i hi =>
specialize hi (lt_trans (Nat.lt_succ_self i) hn)
simp only [Fin.coe_eq_castSucc, Fin.succ_mk, Fin.castSucc_mk] at hi ⊢
rw [← Fin.succ_mk _ _ (lt_trans (Nat.lt_succ_self _) hn), ← Fin.succ_mk _ _ hn]
simp only [partialProd_succ, mul_inv_rev, Fin.castSucc_mk]
-- Porting note: was
-- assoc_rw [hi, inv_mul_cancel_left]
rw [← mul_assoc, mul_left_eq_self, mul_assoc, hi, inv_mul_cancel]
rw [partialProd_succ, inv_mul_cancel_left]

/-- Let `(g₀, g₁, ..., gₙ)` be a tuple of elements in `Gⁿ⁺¹`.
Then if `k < j`, this says `(g₀g₁...gₖ₋₁)⁻¹ * g₀g₁...gₖ = gₖ`.
Expand Down
19 changes: 19 additions & 0 deletions Mathlib/Algebra/BigOperators/Pi.lean
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,22 @@ def Pi.monoidHomMulEquiv {ι : Type*} [Fintype ι] [DecidableEq ι] (M : ι →
MonoidHom.mul_apply, mul_apply]

end MulEquiv

variable [Finite ι] [DecidableEq ι] {M : Type*}

-- manually additivized to fix variable names
-- See https://github.com/leanprover-community/mathlib4/issues/11462
lemma Pi.single_induction [AddCommMonoid M] (p : (ι → M) → Prop) (f : ι → M)
(zero : p 0) (add : ∀ f g, p f → p g → p (f + g))
(single : ∀ i m, p (Pi.single i m)) : p f := by
cases nonempty_fintype ι
rw [← Finset.univ_sum_single f]
exact Finset.sum_induction _ _ add zero (by simp [single])

@[to_additive (attr := elab_as_elim) existing]
lemma Pi.mulSingle_induction [CommMonoid M] (p : (ι → M) → Prop) (f : ι → M)
(one : p 1) (mul : ∀ f g, p f → p g → p (f * g))
(mulSingle : ∀ i m, p (Pi.mulSingle i m)) : p f := by
cases nonempty_fintype ι
rw [← Finset.univ_prod_mulSingle f]
exact Finset.prod_induction _ _ mul one (by simp [mulSingle])
Loading

0 comments on commit 4368e7a

Please sign in to comment.