Skip to content

Commit dd1862d

Browse files
Merge branch 'master' into monoidHomClass-lemmas
2 parents 2c18caf + 3d8100b commit dd1862d

File tree

230 files changed

+5146
-1802
lines changed

Some content is hidden

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

230 files changed

+5146
-1802
lines changed

.github/workflows/build_template.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,12 @@ jobs:
743743
- name: clean up the import graph file
744744
run: rm import_graph.dot
745745

746+
- name: check all scripts build successfully
747+
run: |
748+
lake env lean scripts/create_deprecated_modules.lean
749+
lake env lean scripts/autolabel.lean
750+
lake exe check_title_labels --labels "t-algebra" "feat: dummy PR for testing"
751+
746752
- name: build everything
747753
# make sure everything is available for test/import_all.lean
748754
# and that miscellaneous executables still work

Cache/Requests.lean

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ namespace Cache.Requests
1313

1414
open System (FilePath)
1515

16+
/-- The full name of the main Mathlib GitHub repository. -/
17+
def MATHLIBREPO := "leanprover-community/mathlib4"
18+
1619
/--
1720
Structure to hold repository information with priority ordering
1821
-/
@@ -37,7 +40,7 @@ def isRemoteURL (url : String) : Bool :=
3740
/--
3841
Helper function to get repository from a remote name
3942
-/
40-
def getRepoFromRemote (mathlibDepPath : FilePath) (remoteName : String) (errorContext : String) : IO String := do
43+
def getRepoFromRemote (mathlibDepPath : FilePath) (remoteName : String) (errorContext : String) : IO (Option String) := do
4144
-- If the remote is already a valid URL, attempt to extract the repo from it. This happens with `gh pr checkout`
4245
if isRemoteURL remoteName then
4346
repoFromURL remoteName
@@ -46,23 +49,25 @@ def getRepoFromRemote (mathlibDepPath : FilePath) (remoteName : String) (errorCo
4649
-- standard name like `origin` or `upstream` or it errors out.
4750
let out ← IO.Process.output
4851
{cmd := "git", args := #["remote", "get-url", remoteName], cwd := mathlibDepPath}
49-
-- If `git remote get-url` fails then bail out with an error to help debug
52+
-- If `git remote get-url` fails then return none.
5053
let output := out.stdout.trimAscii
5154
unless out.exitCode == 0 do
52-
throw <| IO.userError s!"\
53-
Failed to run Git to determine Mathlib's repository from {remoteName} remote (exit code: {out.exitCode}).\n\
55+
IO.println s!"\
56+
Warning: failed to run Git to determine Mathlib's repository from {remoteName} remote\n\
5457
{errorContext}\n\
55-
Stdout:\n{output}\nStderr:\n{out.stderr.trimAscii}\n"
58+
Continuing to fetch the cache from {MATHLIBREPO}."
59+
return none
5660
-- Finally attempt to extract the repository from the remote URL returned by `git remote get-url`
5761
repoFromURL output.copy
58-
where repoFromURL (url : String) : IO String := do
62+
where repoFromURL (url : String) : IO (Option String) := do
5963
if let some repo := extractRepoFromUrl url then
60-
return repo
64+
return some repo
6165
else
62-
throw <| IO.userError s!"\
63-
Failed to extract repository from remote URL: {url}.\n\
66+
IO.println s!"\
67+
Warning: Failed to extract repository from remote URL: {url}.\n\
6468
{errorContext}\n\
65-
Please ensure the remote URL is valid and points to a GitHub repository."
69+
Continuing to fetch the cache from {MATHLIBREPO}."
70+
return none
6671

6772
/--
6873
Finds the remote name that points to `leanprover-community/mathlib4` repository.
@@ -146,7 +151,7 @@ Attempts to determine the GitHub repository of a version of Mathlib from its Git
146151
If the current commit coincides with a PR ref, it will determine the source fork
147152
of that PR rather than just using the origin remote.
148153
-/
149-
def getRemoteRepo (mathlibDepPath : FilePath) : IO RepoInfo := do
154+
def getRemoteRepo (mathlibDepPath : FilePath) : IO (Option RepoInfo) := do
150155

151156
-- Since currently we need to push a PR to `leanprover-community/mathlib` build a user cache,
152157
-- we check if we are a special branch or a branch with PR. This leaves out non-PRed fork
@@ -176,7 +181,7 @@ def getRemoteRepo (mathlibDepPath : FilePath) : IO RepoInfo := do
176181
let repo := "leanprover-community/mathlib4-nightly-testing"
177182
let cacheService := if useCloudflareCache then "Cloudflare" else "Azure"
178183
IO.println s!"Using cache ({cacheService}) from nightly-testing remote: {repo}"
179-
return {repo := repo, useFirst := true}
184+
return some {repo := repo, useFirst := true}
180185

181186
-- Only search for PR refs if we're not on a regular branch like master, bump/*, or nightly-testing*
182187
-- let isSpecialBranch := branchName == "master" || branchName.startsWith "bump/" ||
@@ -234,11 +239,16 @@ def getRemoteRepo (mathlibDepPath : FilePath) : IO RepoInfo := do
234239
-- If no tracking remote is configured, fall back to origin
235240
"origin"
236241

237-
let repo ← getRepoFromRemote mathlibDepPath remoteName
242+
let repo? ← getRepoFromRemote mathlibDepPath remoteName
238243
s!"Ensure Git is installed and the '{remoteName}' remote points to its GitHub repository."
239244
let cacheService := if useCloudflareCache then "Cloudflare" else "Azure"
240-
IO.println s!"Using cache ({cacheService}) from {remoteName}: {repo}"
241-
return {repo := repo, useFirst := false}
245+
match repo? with
246+
| some repo =>
247+
IO.println s!"Using cache ({cacheService}) from {remoteName}: {repo?}"
248+
return some {repo := repo, useFirst := false}
249+
| none =>
250+
IO.println s!"Using cache ({cacheService}) from {MATHLIBREPO}."
251+
return none
242252

243253
/-- Public URL for mathlib cache -/
244254
initialize URL : String ← do
@@ -275,9 +285,6 @@ def getUploadAuth : IO UploadAuth := do
275285
throw <| IO.userError
276286
"environment variable MATHLIB_CACHE_AZURE_BEARER_TOKEN or MATHLIB_CACHE_SAS must be set to upload caches"
277287

278-
/-- The full name of the main Mathlib GitHub repository. -/
279-
def MATHLIBREPO := "leanprover-community/mathlib4"
280-
281288
/--
282289
Given a file name like `"1234.tar.gz"`, makes the URL to that file on the server.
283290
@@ -663,16 +670,19 @@ def getFiles
663670
isMathlibRoot mathlibDepPath
664671
if failed > 0 then IO.Process.exit 1
665672
else
666-
let repoInfo ← getRemoteRepo (← read).mathlibDepPath
673+
let repoInfo? ← getRemoteRepo (← read).mathlibDepPath
667674

668675
-- Build list of repositories to download from in order
669676
let repos : List String :=
670-
if repoInfo.repo == MATHLIBREPO then
671-
[repoInfo.repo]
672-
else if repoInfo.useFirst then
673-
[repoInfo.repo, MATHLIBREPO]
677+
if let some repoInfo := repoInfo? then
678+
if repoInfo.repo == MATHLIBREPO then
679+
[MATHLIBREPO]
680+
else if repoInfo.useFirst then
681+
[repoInfo.repo, MATHLIBREPO]
682+
else
683+
[MATHLIBREPO, repoInfo.repo]
674684
else
675-
[MATHLIBREPO, repoInfo.repo]
685+
[MATHLIBREPO]
676686

677687
let mut failed : Nat := 0
678688
for h : i in [0:repos.length] do

Mathlib.lean

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,7 @@ public import Mathlib.Algebra.Homology.SpectralObject.Basic
678678
public import Mathlib.Algebra.Homology.SpectralObject.Cycles
679679
public import Mathlib.Algebra.Homology.SpectralObject.Differentials
680680
public import Mathlib.Algebra.Homology.SpectralObject.EpiMono
681+
public import Mathlib.Algebra.Homology.SpectralObject.FirstPage
681682
public import Mathlib.Algebra.Homology.SpectralObject.HasSpectralSequence
682683
public import Mathlib.Algebra.Homology.SpectralObject.Homology
683684
public import Mathlib.Algebra.Homology.SpectralObject.Page
@@ -898,6 +899,7 @@ public import Mathlib.Algebra.Order.Antidiag.Pi
898899
public import Mathlib.Algebra.Order.Antidiag.Prod
899900
public import Mathlib.Algebra.Order.Archimedean.Basic
900901
public import Mathlib.Algebra.Order.Archimedean.Class
902+
public import Mathlib.Algebra.Order.Archimedean.Defs
901903
public import Mathlib.Algebra.Order.Archimedean.Hom
902904
public import Mathlib.Algebra.Order.Archimedean.IndicatorCard
903905
public import Mathlib.Algebra.Order.Archimedean.Submonoid
@@ -1492,6 +1494,7 @@ public import Mathlib.AlgebraicTopology.SimplexCategory.GeneratorsRelations.EpiM
14921494
public import Mathlib.AlgebraicTopology.SimplexCategory.GeneratorsRelations.NormalForms
14931495
public import Mathlib.AlgebraicTopology.SimplexCategory.MorphismProperty
14941496
public import Mathlib.AlgebraicTopology.SimplexCategory.Rev
1497+
public import Mathlib.AlgebraicTopology.SimplexCategory.SemiSimplexCategory
14951498
public import Mathlib.AlgebraicTopology.SimplexCategory.ToMkOne
14961499
public import Mathlib.AlgebraicTopology.SimplexCategory.Truncated
14971500
public import Mathlib.AlgebraicTopology.SimplicialCategory.Basic
@@ -1535,8 +1538,10 @@ public import Mathlib.AlgebraicTopology.SimplicialSet.NerveAdjunction
15351538
public import Mathlib.AlgebraicTopology.SimplicialSet.NerveNondegenerate
15361539
public import Mathlib.AlgebraicTopology.SimplicialSet.NonDegenerateSimplices
15371540
public import Mathlib.AlgebraicTopology.SimplicialSet.NonDegenerateSimplicesSubcomplex
1541+
public import Mathlib.AlgebraicTopology.SimplicialSet.Nonempty
15381542
public import Mathlib.AlgebraicTopology.SimplicialSet.Op
15391543
public import Mathlib.AlgebraicTopology.SimplicialSet.Path
1544+
public import Mathlib.AlgebraicTopology.SimplicialSet.PiZero
15401545
public import Mathlib.AlgebraicTopology.SimplicialSet.Presentable
15411546
public import Mathlib.AlgebraicTopology.SimplicialSet.ProdStdSimplex
15421547
public import Mathlib.AlgebraicTopology.SimplicialSet.ProdStdSimplexOne
@@ -2787,6 +2792,7 @@ public import Mathlib.CategoryTheory.Limits.Preserves.Basic
27872792
public import Mathlib.CategoryTheory.Limits.Preserves.Bifunctor
27882793
public import Mathlib.CategoryTheory.Limits.Preserves.BifunctorCokernel
27892794
public import Mathlib.CategoryTheory.Limits.Preserves.Creates.Finite
2795+
public import Mathlib.CategoryTheory.Limits.Preserves.Creates.Opposites
27902796
public import Mathlib.CategoryTheory.Limits.Preserves.Creates.Pullbacks
27912797
public import Mathlib.CategoryTheory.Limits.Preserves.Filtered
27922798
public import Mathlib.CategoryTheory.Limits.Preserves.Finite
@@ -3468,6 +3474,7 @@ public import Mathlib.Combinatorics.Quiver.Path.Weight
34683474
public import Mathlib.Combinatorics.Quiver.Prefunctor
34693475
public import Mathlib.Combinatorics.Quiver.Push
34703476
public import Mathlib.Combinatorics.Quiver.ReflQuiver
3477+
public import Mathlib.Combinatorics.Quiver.Schreier
34713478
public import Mathlib.Combinatorics.Quiver.SingleObj
34723479
public import Mathlib.Combinatorics.Quiver.Subquiver
34733480
public import Mathlib.Combinatorics.Quiver.Symmetric
@@ -4616,6 +4623,7 @@ public import Mathlib.GroupTheory.GroupExtension.Basic
46164623
public import Mathlib.GroupTheory.GroupExtension.Defs
46174624
public import Mathlib.GroupTheory.HNNExtension
46184625
public import Mathlib.GroupTheory.Index
4626+
public import Mathlib.GroupTheory.IndexNSmul
46194627
public import Mathlib.GroupTheory.IndexNormal
46204628
public import Mathlib.GroupTheory.IsPerfect
46214629
public import Mathlib.GroupTheory.IsSubnormal
@@ -6225,6 +6233,7 @@ public import Mathlib.RingTheory.AlgebraicIndependent.RankAndCardinality
62256233
public import Mathlib.RingTheory.AlgebraicIndependent.TranscendenceBasis
62266234
public import Mathlib.RingTheory.AlgebraicIndependent.Transcendental
62276235
public import Mathlib.RingTheory.Artinian.Algebra
6236+
public import Mathlib.RingTheory.Artinian.Defs
62286237
public import Mathlib.RingTheory.Artinian.Instances
62296238
public import Mathlib.RingTheory.Artinian.Module
62306239
public import Mathlib.RingTheory.Artinian.Ring
@@ -6239,6 +6248,7 @@ public import Mathlib.RingTheory.Binomial
62396248
public import Mathlib.RingTheory.ChainOfDivisors
62406249
public import Mathlib.RingTheory.ClassGroup
62416250
public import Mathlib.RingTheory.Coalgebra.Basic
6251+
public import Mathlib.RingTheory.Coalgebra.CoassocSimps
62426252
public import Mathlib.RingTheory.Coalgebra.Convolution
62436253
public import Mathlib.RingTheory.Coalgebra.Equiv
62446254
public import Mathlib.RingTheory.Coalgebra.GroupLike
@@ -6345,6 +6355,7 @@ public import Mathlib.RingTheory.Flat.Rank
63456355
public import Mathlib.RingTheory.Flat.Stability
63466356
public import Mathlib.RingTheory.Flat.Tensor
63476357
public import Mathlib.RingTheory.Flat.TorsionFree
6358+
public import Mathlib.RingTheory.FormalGroup.Basic
63486359
public import Mathlib.RingTheory.FractionalIdeal.Basic
63496360
public import Mathlib.RingTheory.FractionalIdeal.Extended
63506361
public import Mathlib.RingTheory.FractionalIdeal.Inverse
@@ -6550,8 +6561,10 @@ public import Mathlib.RingTheory.MvPolynomial.Symmetric.NewtonIdentities
65506561
public import Mathlib.RingTheory.MvPolynomial.Tower
65516562
public import Mathlib.RingTheory.MvPolynomial.WeightedHomogeneous
65526563
public import Mathlib.RingTheory.MvPowerSeries.Basic
6564+
public import Mathlib.RingTheory.MvPowerSeries.Equiv
65536565
public import Mathlib.RingTheory.MvPowerSeries.Evaluation
65546566
public import Mathlib.RingTheory.MvPowerSeries.Expand
6567+
public import Mathlib.RingTheory.MvPowerSeries.GaussNorm
65556568
public import Mathlib.RingTheory.MvPowerSeries.Inverse
65566569
public import Mathlib.RingTheory.MvPowerSeries.LexOrder
65576570
public import Mathlib.RingTheory.MvPowerSeries.LinearTopology
@@ -7166,6 +7179,7 @@ public import Mathlib.Tactic.Ring.Basic
71667179
public import Mathlib.Tactic.Ring.Common
71677180
public import Mathlib.Tactic.Ring.Compare
71687181
public import Mathlib.Tactic.Ring.NamePolyVars
7182+
public import Mathlib.Tactic.Ring.NamePowerVars
71697183
public import Mathlib.Tactic.Ring.PNat
71707184
public import Mathlib.Tactic.Ring.RingNF
71717185
public import Mathlib.Tactic.Sat.FromLRAT

Mathlib/Algebra/Algebra/Equiv.lean

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ def toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Alg
6969
[Algebra R B] [EquivLike F A B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=
7070
{ (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }
7171

72-
instance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]
73-
[EquivLike F A B] [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=
74-
⟨toAlgEquiv⟩
7572
end AlgEquivClass
7673

7774
namespace AlgEquiv
@@ -137,7 +134,7 @@ theorem toEquiv_eq_coe : e.toEquiv = e :=
137134

138135
@[simp]
139136
protected theorem coe_coe {F : Type*} [EquivLike F A₁ A₂] [AlgEquivClass F R A₁ A₂] (f : F) :
140-
⇑(f : A₁ ≃ₐ[R] A₂) = f :=
137+
⇑(AlgEquivClass.toAlgEquiv f) = f :=
141138
rfl
142139

143140
theorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=
@@ -255,13 +252,13 @@ theorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=
255252
@[simp]
256253
theorem coe_apply_coe_coe_symm_apply {F : Type*} [EquivLike F A₁ A₂] [AlgEquivClass F R A₁ A₂]
257254
(f : F) (x : A₂) :
258-
f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=
255+
f ((AlgEquivClass.toAlgEquiv f).symm x) = x :=
259256
EquivLike.right_inv f x
260257

261258
@[simp]
262259
theorem coe_coe_symm_apply_coe_apply {F : Type*} [EquivLike F A₁ A₂] [AlgEquivClass F R A₁ A₂]
263260
(f : F) (x : A₁) :
264-
(f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=
261+
(AlgEquivClass.toAlgEquiv f).symm (f x) = x :=
265262
EquivLike.left_inv f x
266263

267264
/-- `simp` normal form of `invFun_eq_symm` -/

Mathlib/Algebra/Algebra/Spectrum/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ theorem AlgEquiv.spectrum_eq {F R A B : Type*} [CommSemiring R] [Ring A] [Ring B
424424
spectrum R (f a) = spectrum R a :=
425425
Set.Subset.antisymm (AlgHom.spectrum_apply_subset _ _) <| by
426426
simpa only [AlgEquiv.coe_algHom, AlgEquiv.coe_coe_symm_apply_coe_apply] using
427-
AlgHom.spectrum_apply_subset (f : A ≃ₐ[R] B).symm (f a)
427+
AlgHom.spectrum_apply_subset (AlgEquivClass.toAlgEquiv f : A ≃ₐ[R] B).symm (f a)
428428

429429
section ConjugateUnits
430430

Mathlib/Algebra/BigOperators/Intervals.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,12 @@ theorem prod_Icc_succ_top {a b : ℕ} (hab : a ≤ b + 1) (f : ℕ → M) :
7878
@[to_additive]
7979
theorem prod_range_mul_prod_Ico (f : ℕ → M) {m n : ℕ} (h : m ≤ n) :
8080
((∏ k ∈ range m, f k) * ∏ k ∈ Ico m n, f k) = ∏ k ∈ range n, f k :=
81-
Nat.Ico_zero_eq_range ▸ Nat.Ico_zero_eq_range ▸ prod_Ico_consecutive f m.zero_le h
81+
Nat.Ico_zero_eq_range m ▸ Nat.Ico_zero_eq_range n ▸ prod_Ico_consecutive f m.zero_le h
8282

8383
@[to_additive]
8484
theorem prod_range_eq_mul_Ico (f : ℕ → M) {n : ℕ} (hn : 0 < n) :
8585
∏ x ∈ Finset.range n, f x = f 0 * ∏ x ∈ Ico 1 n, f x :=
86-
Finset.range_eq_Ico ▸ Finset.prod_eq_prod_Ico_succ_bot hn f
86+
Finset.range_eq_Ico n ▸ Finset.prod_eq_prod_Ico_succ_bot hn f
8787

8888
@[to_additive]
8989
theorem prod_Ico_eq_mul_inv {δ : Type*} [CommGroup δ] (f : ℕ → δ) {m n : ℕ} (h : m ≤ n) :

Mathlib/Algebra/BigOperators/Module.lean

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ theorem sum_range_by_parts :
5959
f (n - 1) • G n - ∑ i ∈ range (n - 1), (f (i + 1) - f i) • G (i + 1) := by
6060
by_cases hn : n = 0
6161
· simp [hn]
62-
· rw [range_eq_Ico, sum_Ico_by_parts f g (Nat.pos_of_ne_zero hn), sum_range_zero, smul_zero,
63-
sub_zero, range_eq_Ico]
62+
· simp only [range_eq_Ico]
63+
rw [sum_Ico_by_parts f g (Nat.pos_of_ne_zero hn), sum_range_zero, smul_zero, sub_zero]
64+
simp only [← range_eq_Ico]
6465

6566
end Finset

Mathlib/Algebra/Category/Grp/FiniteGrp.lean

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,11 @@ instance : CoeSort FiniteGrp.{u} (Type u) where
4646

4747
@[to_additive]
4848
instance : Category FiniteGrp :=
49-
inferInstanceAs (Category (InducedCategory _ FiniteGrp.toGrp))
49+
inferInstanceAs <| Category (InducedCategory _ FiniteGrp.toGrp)
5050

5151
@[to_additive]
52-
instance : ConcreteCategory FiniteGrp (· →* ·) := InducedCategory.concreteCategory FiniteGrp.toGrp
52+
instance : ConcreteCategory FiniteGrp (· →* ·) :=
53+
inferInstanceAs <| ConcreteCategory (InducedCategory _ toGrp) _
5354

5455
@[to_additive]
5556
instance (G : FiniteGrp) : Group G := inferInstanceAs <| Group G.toGrp

0 commit comments

Comments
 (0)