Skip to content

Commit 355686d

Browse files
authored
Merge branch 'master' into derived-set
2 parents 9c703c9 + d4d96de commit 355686d

139 files changed

Lines changed: 2607 additions & 898 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.

.github/workflows/build_template.yml

Lines changed: 8 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -247,76 +247,6 @@ jobs:
247247
echo "✅ All inputRevs in lake-manifest.json are valid"
248248
fi
249249
250-
- name: validate ProofWidgets source repository
251-
# Only enforce this on the main mathlib4 repository, not on nightly-testing
252-
if: github.repository == 'leanprover-community/mathlib4'
253-
shell: bash
254-
run: |
255-
cd pr-branch
256-
257-
expected_url='https://github.com/leanprover-community/ProofWidgets4'
258-
proofwidgets_count=$(jq '[.packages[] | select(.name == "proofwidgets")] | length' lake-manifest.json)
259-
if [ "$proofwidgets_count" -ne 1 ]; then
260-
echo "❌ Error: expected exactly one proofwidgets entry in lake-manifest.json, found $proofwidgets_count"
261-
exit 1
262-
fi
263-
264-
proofwidgets_url=$(jq -r '.packages[] | select(.name == "proofwidgets") | .url' lake-manifest.json)
265-
normalized_url="${proofwidgets_url%.git}"
266-
if [ "$normalized_url" != "$expected_url" ]; then
267-
echo "❌ Error: invalid ProofWidgets source URL in lake-manifest.json"
268-
echo " expected: $expected_url"
269-
echo " found: $proofwidgets_url"
270-
exit 1
271-
fi
272-
273-
echo "✅ ProofWidgets source URL is allowed: $proofwidgets_url"
274-
275-
- name: verify ProofWidgets lean-toolchain matches on versioned releases
276-
# Only enforce this on the main mathlib4 repository, not on nightly-testing
277-
if: github.repository == 'leanprover-community/mathlib4'
278-
shell: bash
279-
run: |
280-
cd pr-branch
281-
282-
# Read the lean-toolchain file
283-
TOOLCHAIN=$(cat lean-toolchain | tr -d '[:space:]')
284-
echo "Lean toolchain: $TOOLCHAIN"
285-
286-
# Check if toolchain matches the versioned release pattern: leanprover/lean4:vX.Y.Z (with optional suffix like -rc1)
287-
if [[ "$TOOLCHAIN" =~ ^leanprover/lean4:v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.-]+)?$ ]]; then
288-
echo "✓ Detected versioned Lean release: $TOOLCHAIN"
289-
echo "Verifying ProofWidgets lean-toolchain matches..."
290-
291-
# Check if ProofWidgets lean-toolchain exists
292-
if [ ! -f .lake/packages/proofwidgets/lean-toolchain ]; then
293-
echo "❌ Error: .lake/packages/proofwidgets/lean-toolchain does not exist"
294-
echo "This file should be created by 'lake env' during dependency download."
295-
exit 1
296-
fi
297-
298-
# Read ProofWidgets lean-toolchain
299-
PROOFWIDGETS_TOOLCHAIN=$(cat .lake/packages/proofwidgets/lean-toolchain | tr -d '[:space:]')
300-
echo "ProofWidgets toolchain: $PROOFWIDGETS_TOOLCHAIN"
301-
302-
# Compare the two
303-
if [ "$TOOLCHAIN" != "$PROOFWIDGETS_TOOLCHAIN" ]; then
304-
echo "❌ Error: Lean toolchain mismatch!"
305-
echo " Main lean-toolchain: $TOOLCHAIN"
306-
echo " ProofWidgets lean-toolchain: $PROOFWIDGETS_TOOLCHAIN"
307-
echo ""
308-
echo "When using a versioned Lean release (leanprover/lean4:vX.Y.Z),"
309-
echo "the ProofWidgets dependency must use the same toolchain."
310-
echo "Please update the ProofWidgets dependency to use $TOOLCHAIN"
311-
exit 1
312-
else
313-
echo "✅ ProofWidgets lean-toolchain matches: $TOOLCHAIN"
314-
fi
315-
else
316-
echo "ℹ Lean toolchain is not a versioned release (pattern: leanprover/lean4:vX.Y.Z)"
317-
echo "Skipping ProofWidgets toolchain verification."
318-
fi
319-
320250
- name: get cache (1/3 - setup and initial fetch)
321251
id: get_cache_part1_setup
322252
shell: bash # only runs `cache get` from `tools-branch`, so doesn't need to be inside landrun
@@ -327,7 +257,7 @@ jobs:
327257
328258
# Fail quickly if the cache is completely cold, by checking for Mathlib.Init
329259
echo "Attempting to fetch olean for Mathlib/Init.lean from cache..."
330-
../tools-branch/.lake/build/bin/cache --skip-proofwidgets get Mathlib/Init.lean
260+
../tools-branch/.lake/build/bin/cache get Mathlib/Init.lean
331261
332262
- name: get cache (2/3 - test Mathlib.Init cache)
333263
id: get_cache_part2_test
@@ -381,9 +311,9 @@ jobs:
381311
echo "Warming up cache using previous commit: $PREV_SHA (source: $PREV_SHA_SOURCE)"
382312
if git cat-file -e "$PREV_SHA^{commit}" 2>/dev/null || git fetch --no-tags --depth=1 origin "$PREV_SHA"; then
383313
git checkout "$PREV_SHA"
384-
../tools-branch/.lake/build/bin/cache --skip-proofwidgets get
314+
../tools-branch/.lake/build/bin/cache get
385315
# Run again with --repo, to ensure we actually get the oleans.
386-
../tools-branch/.lake/build/bin/cache --repo="$CACHE_REPO" --skip-proofwidgets get
316+
../tools-branch/.lake/build/bin/cache --repo="$CACHE_REPO" get
387317
388318
echo "Switching back to branch head"
389319
git checkout "$ORIG_SHA"
@@ -396,18 +326,10 @@ jobs:
396326
397327
echo "Fetching all remaining cache..."
398328
399-
../tools-branch/.lake/build/bin/cache --skip-proofwidgets get
329+
../tools-branch/.lake/build/bin/cache get
400330
401331
# Run again with --repo, to ensure we actually get the oleans.
402-
../tools-branch/.lake/build/bin/cache --repo="$CACHE_REPO" --skip-proofwidgets get
403-
404-
- name: fetch ProofWidgets release
405-
# We need network access for ProofWidgets frontend assets.
406-
# Run inside landrun so PR-controlled code remains sandboxed.
407-
shell: landrun --unrestricted-network --rox /etc --rox /usr --rw /dev --rox /home/lean/.elan --rox /home/lean/actions-runner/_work --rw pr-branch/.lake/ --env PATH --env HOME --env GITHUB_OUTPUT --env CI -- bash -euxo pipefail {0}
408-
run: |
409-
cd pr-branch
410-
lake build proofwidgets:release
332+
../tools-branch/.lake/build/bin/cache --repo="$CACHE_REPO" get
411333
412334
- name: update {Mathlib, Tactic, Counterexamples, Archive}.lean
413335
id: mk_all
@@ -462,8 +384,8 @@ jobs:
462384
shell: bash
463385
run: |
464386
cd pr-branch
465-
../tools-branch/.lake/build/bin/cache --skip-proofwidgets get Archive.lean
466-
../tools-branch/.lake/build/bin/cache --skip-proofwidgets get Counterexamples.lean
387+
../tools-branch/.lake/build/bin/cache get Archive.lean
388+
../tools-branch/.lake/build/bin/cache get Counterexamples.lean
467389
468390
- name: build archive
469391
id: archive
@@ -955,6 +877,7 @@ jobs:
955877
steps.get-label-actor.outputs.username == 'mathlib-update-dependencies' ||
956878
steps.get-label-actor.outputs.username == 'mathlib-splicebot' ||
957879
contains(steps.actorTeams.outputs.teams, 'mathlib-maintainers') ||
880+
contains(steps.actorTeams.outputs.teams, 'lean-release-managers') ||
958881
contains(steps.actorTeams.outputs.teams, 'bot-users')
959882
)
960883
name: If `auto-merge-after-CI` is present, add a `bors merge` comment.

.github/workflows/maintainer_merge_wf_run.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ jobs:
150150
legacy_suffix=" (legacy)"
151151
fi
152152
metadata=$'['"${trigger_name}"$']('"${trigger_run_url}"$'), [wf_run]('"${wf_run_url}"$')'"${legacy_suffix}"
153-
message="${message}"$'\n\n---\n'"${metadata}"
153+
echo "${metadata}"
154+
# message="${message}"$'\n\n---\n'"${metadata}"
154155
printf 'title<<EOF\n%s\nEOF' "${message}" | tee "$GITHUB_OUTPUT"
155156
env:
156157
AUTHOR: ${{ steps.inputs.outputs.author }}
@@ -188,7 +189,8 @@ jobs:
188189
legacy_suffix=" (legacy)"
189190
fi
190191
metadata=$'['"${trigger_name}"$']('"${trigger_run_url}"$'), [wf_run]('"${wf_run_url}"$')'"${legacy_suffix}"
191-
body="${body}"$'\n\n---\n'"${metadata}"
192+
echo "${metadata}"
193+
# body="${body}"$'\n\n---\n'"${metadata}"
192194
printf 'body<<EOF\n%s\nEOF\n' "${body}" | tee -a "$GITHUB_OUTPUT"
193195
194196
- name: Add comment to PR

Archive/Imo/Imo2024Q3.lean

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -941,8 +941,6 @@ lemma exists_a_apply_add_eq : ∃ b c, 0 < c ∧ ∀ n, b < n →
941941
rcases hc.even_p (by lia) (hs n) with ⟨_, ht⟩
942942
simp [ht, ← two_mul]
943943

944-
variable {a N}
945-
946944
end Condition
947945

948946
theorem result {a : ℕ → ℕ} {N : ℕ} (h : Condition a N) :

Cache/IO.lean

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,12 @@ def rootHashGeneration : UInt64 := 4
122122
folders are located. However, `lake` has multiple options to customise these paths, like
123123
setting `srcDir` in a `lean_lib`. See `mkBuildPaths` below which currently assumes
124124
that no such options are set in any mathlib dependency)
125-
* the build directory for proofwidgets
126125
-/
127126
structure CacheM.Context where
128127
/-- source directory for mathlib files -/
129128
mathlibDepPath : FilePath
130129
/-- the Lean source search path -/
131130
srcSearchPath : SearchPath
132-
/-- build directory for proofwidgets -/
133-
proofWidgetsBuildDir : FilePath
134131

135132
@[inherit_doc CacheM.Context]
136133
abbrev CacheM := ReaderT CacheM.Context IO
@@ -158,8 +155,7 @@ private def CacheM.getContext : IO CacheM.Context := do
158155
let mathlibSource ← CacheM.mathlibDepPath sp
159156
return {
160157
mathlibDepPath := mathlibSource,
161-
srcSearchPath := sp,
162-
proofWidgetsBuildDir := LAKEPACKAGESDIR / "proofwidgets" / ".lake" / "build"}
158+
srcSearchPath := sp}
163159

164160
/-- Run a `CacheM` in `IO` by loading the context from `LEAN_SRC_PATH`. -/
165161
def CacheM.run (f : CacheM α) : IO α := do ReaderT.run f (← getContext)

Cache/Main.lean

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ Commands:
3939
Options:
4040
--repo=OWNER/REPO Override the repository to fetch/push cache from
4141
--staging-dir=<output-directory> Required for 'stage', 'stage!', 'unstage' and 'put-staged': staging directory.
42-
--skip-proofwidgets Skip fetching/building ProofWidgets release assets during 'get'
4342
4443
* Linked files refer to local cache files with corresponding Lean sources
4544
* Commands ending with '!' should be used manually, when hot-fixes are needed
@@ -101,7 +100,6 @@ def main (args : List String) : IO Unit := do
101100
-- parse relevant options, ignore the rest
102101
let repo? ← parseNamedOpt "repo" options
103102
let stagingDir? ← parseNamedOpt "staging-dir" options
104-
let skipProofWidgets := parseFlagOpt "skip-proofwidgets" options
105103

106104
let mut roots : Std.HashMap Lean.Name FilePath ← parseArgs args
107105
if roots.isEmpty then do
@@ -118,7 +116,7 @@ def main (args : List String) : IO Unit := do
118116
if leanTarArgs.contains (args.headD "") then validateLeanTar
119117
let get (args : List String) (force := false) (decompress := true) := do
120118
let hashMap ← if args.isEmpty then pure hashMap else hashMemo.filterByRootModules roots.keys
121-
getFiles repo? hashMap force force goodCurl decompress skipProofWidgets
119+
getFiles repo? hashMap force force goodCurl decompress
122120
let pack (overwrite verbose unpackedOnly := false) := do
123121
packCache hashMap overwrite verbose unpackedOnly (← getGitCommitHash)
124122
let put (overwrite unpackedOnly := false) := do

Cache/Requests.lean

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -641,61 +641,15 @@ def checkForManifestMismatch : IO.CacheM Unit := do
641641
precedence, then run `lake update`."
642642
IO.Process.exit 1
643643

644-
/-- Fetches the ProofWidgets cloud release and prunes non-JS files. -/
645-
def getProofWidgets (buildDir : FilePath) : IO Unit := do
646-
if (← buildDir.pathExists) then
647-
-- Check if the ProofWidgets build is out-of-date via `lake`.
648-
-- This is done through Lake as cache has no simple heuristic
649-
-- to determine whether the ProofWidgets JS is out-of-date.
650-
let out ← IO.Process.output
651-
{cmd := "lake", args := #["-v", "build", "--no-build", "proofwidgets:release"]}
652-
if out.exitCode == 0 then -- up-to-date
653-
return
654-
else if out.exitCode == 3 then -- needs fetch (`--no-build` triggered)
655-
pure ()
656-
else
657-
printLakeOutput out
658-
throw <| IO.userError s!"Failed to validate ProofWidgets cloud release: \
659-
lake failed with error code {out.exitCode}"
660-
-- Download and unpack the ProofWidgets cloud release (for its `.js` files)
661-
IO.print "Fetching ProofWidgets cloud release..."
662-
let out ← IO.Process.output
663-
{cmd := "lake", args := #["-v", "build", "proofwidgets:release"]}
664-
if out.exitCode == 0 then
665-
IO.println " done!"
666-
else
667-
IO.print "\n"
668-
printLakeOutput out
669-
throw <| IO.userError s!"Failed to fetch ProofWidgets cloud release: \
670-
lake failed with error code {out.exitCode}"
671-
-- Prune non-JS ProofWidgets files (e.g., `olean`, `.c`)
672-
try
673-
IO.FS.removeDirAll (buildDir / "lib")
674-
IO.FS.removeDirAll (buildDir / "ir")
675-
catch e =>
676-
throw <| IO.userError s!"Failed to prune ProofWidgets cloud release: {e}"
677-
where
678-
printLakeOutput out := do
679-
unless out.stdout.isEmpty do
680-
IO.eprintln "lake stdout:"
681-
IO.eprint out.stdout
682-
unless out.stderr.isEmpty do
683-
IO.eprintln "lake stderr:"
684-
IO.eprint out.stderr
685-
686644
/-- Downloads missing files, and unpacks files. -/
687645
def getFiles
688646
(repo? : Option String) (hashMap : IO.ModuleHashMap)
689-
(forceDownload forceUnpack parallel decompress skipProofWidgets : Bool)
647+
(forceDownload forceUnpack parallel decompress : Bool)
690648
: IO.CacheM Unit := do
691649
let isMathlibRoot ← IO.isMathlibRoot
692650
unless isMathlibRoot do
693651
checkForToolchainMismatch
694652
checkForManifestMismatch
695-
if skipProofWidgets then
696-
IO.println "Skipping ProofWidgets release fetch"
697-
else
698-
getProofWidgets (← read).proofWidgetsBuildDir
699653

700654
let mathlibDepPath := (← read).mathlibDepPath
701655

Counterexamples/Phillips.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ We need the continuum hypothesis to construct it.
460460

461461
theorem sierpinski_pathological_family (Hcont : #ℝ = ℵ₁) :
462462
∃ f : ℝ → Set ℝ, (∀ x, (univ \ f x).Countable) ∧ ∀ y, {x : ℝ | y ∈ f x}.Countable := by
463-
rcases Cardinal.ord_eqwith ⟨r, hr, H⟩
463+
rcases Cardinal.exists_ord_eqwith ⟨r, hr, H⟩
464464
refine ⟨fun x => {y | r x y}, fun x => ?_, fun y => ?_⟩
465465
· have : univ \ {y | r x y} = {y | r y x} ∪ {x} := by
466466
ext y
@@ -474,9 +474,9 @@ theorem sierpinski_pathological_family (Hcont : #ℝ = ℵ₁) :
474474
· simp only [h, iff_true, or_true]; exact asymm h
475475
rw [this]
476476
apply Countable.union _ (countable_singleton _)
477-
rw [Cardinal.countable_iff_lt_aleph_one, ← Hcont]
477+
rw [Cardinal.le_aleph0_iff_set_countable, ← Cardinal.lt_aleph_one_iff, ← Hcont]
478478
exact Cardinal.card_typein_lt x H
479-
· rw [Cardinal.countable_iff_lt_aleph_one, ← Hcont]
479+
· rw [Cardinal.le_aleph0_iff_set_countable, ← Cardinal.lt_aleph_one_iff, ← Hcont]
480480
exact Cardinal.card_typein_lt y H
481481

482482
/-- A family of sets in `ℝ` which only miss countably many points, but such that any point is

Mathlib.lean

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,7 @@ public import Mathlib.Algebra.Lie.Engel
709709
public import Mathlib.Algebra.Lie.EngelSubalgebra
710710
public import Mathlib.Algebra.Lie.Extension
711711
public import Mathlib.Algebra.Lie.Free
712+
public import Mathlib.Algebra.Lie.Graded
712713
public import Mathlib.Algebra.Lie.Ideal
713714
public import Mathlib.Algebra.Lie.IdealOperations
714715
public import Mathlib.Algebra.Lie.InvariantForm
@@ -822,6 +823,7 @@ public import Mathlib.Algebra.Module.Torsion.Basic
822823
public import Mathlib.Algebra.Module.Torsion.Field
823824
public import Mathlib.Algebra.Module.Torsion.Free
824825
public import Mathlib.Algebra.Module.Torsion.Pi
826+
public import Mathlib.Algebra.Module.Torsion.PrimaryComponent
825827
public import Mathlib.Algebra.Module.Torsion.Prod
826828
public import Mathlib.Algebra.Module.TransferInstance
827829
public import Mathlib.Algebra.Module.ULift
@@ -1613,6 +1615,7 @@ public import Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Order
16131615
public import Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Pi
16141616
public import Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Projection
16151617
public import Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Range
1618+
public import Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.RealImaginaryPart
16161619
public import Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Restrict
16171620
public import Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unique
16181621
public import Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.Unital
@@ -1851,6 +1854,7 @@ public import Mathlib.Analysis.Convex.Exposed
18511854
public import Mathlib.Analysis.Convex.Extrema
18521855
public import Mathlib.Analysis.Convex.Extreme
18531856
public import Mathlib.Analysis.Convex.Function
1857+
public import Mathlib.Analysis.Convex.FunctionTopology
18541858
public import Mathlib.Analysis.Convex.Gauge
18551859
public import Mathlib.Analysis.Convex.GaugeRescale
18561860
public import Mathlib.Analysis.Convex.Hull
@@ -1902,6 +1906,7 @@ public import Mathlib.Analysis.Distribution.SchwartzSpace
19021906
public import Mathlib.Analysis.Distribution.SchwartzSpace.Basic
19031907
public import Mathlib.Analysis.Distribution.SchwartzSpace.Deriv
19041908
public import Mathlib.Analysis.Distribution.SchwartzSpace.Fourier
1909+
public import Mathlib.Analysis.Distribution.Support
19051910
public import Mathlib.Analysis.Distribution.TemperateGrowth
19061911
public import Mathlib.Analysis.Distribution.TemperedDistribution
19071912
public import Mathlib.Analysis.Distribution.TestFunction
@@ -2150,6 +2155,7 @@ public import Mathlib.Analysis.Normed.Order.Lattice
21502155
public import Mathlib.Analysis.Normed.Order.UpperLower
21512156
public import Mathlib.Analysis.Normed.Ring.Basic
21522157
public import Mathlib.Analysis.Normed.Ring.Finite
2158+
public import Mathlib.Analysis.Normed.Ring.InfiniteProd
21532159
public import Mathlib.Analysis.Normed.Ring.InfiniteSum
21542160
public import Mathlib.Analysis.Normed.Ring.Int
21552161
public import Mathlib.Analysis.Normed.Ring.Lemmas
@@ -5571,6 +5577,7 @@ public import Mathlib.NumberTheory.ModularForms.Cusps
55715577
public import Mathlib.NumberTheory.ModularForms.DedekindEta
55725578
public import Mathlib.NumberTheory.ModularForms.Delta
55735579
public import Mathlib.NumberTheory.ModularForms.Derivative
5580+
public import Mathlib.NumberTheory.ModularForms.Discriminant
55745581
public import Mathlib.NumberTheory.ModularForms.EisensteinSeries.Basic
55755582
public import Mathlib.NumberTheory.ModularForms.EisensteinSeries.Defs
55765583
public import Mathlib.NumberTheory.ModularForms.EisensteinSeries.E2.Defs
@@ -6655,6 +6662,7 @@ public import Mathlib.RingTheory.Regular.Depth
66556662
public import Mathlib.RingTheory.Regular.Flat
66566663
public import Mathlib.RingTheory.Regular.IsSMulRegular
66576664
public import Mathlib.RingTheory.Regular.RegularSequence
6665+
public import Mathlib.RingTheory.RegularLocalRing.Defs
66586666
public import Mathlib.RingTheory.RingHom.Bijective
66596667
public import Mathlib.RingTheory.RingHom.EssFiniteType
66606668
public import Mathlib.RingTheory.RingHom.Etale

0 commit comments

Comments
 (0)