Skip to content

Commit 4c41035

Browse files
Merge branch 'master' into master
2 parents b88c734 + 15f6691 commit 4c41035

File tree

95 files changed

+2220
-529
lines changed

Some content is hidden

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

95 files changed

+2220
-529
lines changed

.github/build.in.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ jobs:
501501
id: lint
502502
run: |
503503
cd pr-branch
504-
env LEAN_ABORT_ON_PANIC=1 ../master-branch/scripts/lake-build-wrapper.py .lake/build_summary_lint.json lake exe runLinter --trace Mathlib
504+
env LEAN_ABORT_ON_PANIC=1 lake exe runLinter --trace Mathlib
505505
506506
- name: end gh-problem-match-wrap for shake and lint steps
507507
uses: leanprover-community/gh-problem-matcher-wrap@20007cb926a46aa324653a387363b52f07709845 # 2025-04-23

.github/workflows/bors.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ jobs:
511511
id: lint
512512
run: |
513513
cd pr-branch
514-
env LEAN_ABORT_ON_PANIC=1 ../master-branch/scripts/lake-build-wrapper.py .lake/build_summary_lint.json lake exe runLinter --trace Mathlib
514+
env LEAN_ABORT_ON_PANIC=1 lake exe runLinter --trace Mathlib
515515
516516
- name: end gh-problem-match-wrap for shake and lint steps
517517
uses: leanprover-community/gh-problem-matcher-wrap@20007cb926a46aa324653a387363b52f07709845 # 2025-04-23

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ jobs:
517517
id: lint
518518
run: |
519519
cd pr-branch
520-
env LEAN_ABORT_ON_PANIC=1 ../master-branch/scripts/lake-build-wrapper.py .lake/build_summary_lint.json lake exe runLinter --trace Mathlib
520+
env LEAN_ABORT_ON_PANIC=1 lake exe runLinter --trace Mathlib
521521
522522
- name: end gh-problem-match-wrap for shake and lint steps
523523
uses: leanprover-community/gh-problem-matcher-wrap@20007cb926a46aa324653a387363b52f07709845 # 2025-04-23

.github/workflows/build_fork.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ jobs:
515515
id: lint
516516
run: |
517517
cd pr-branch
518-
env LEAN_ABORT_ON_PANIC=1 ../master-branch/scripts/lake-build-wrapper.py .lake/build_summary_lint.json lake exe runLinter --trace Mathlib
518+
env LEAN_ABORT_ON_PANIC=1 lake exe runLinter --trace Mathlib
519519
520520
- name: end gh-problem-match-wrap for shake and lint steps
521521
uses: leanprover-community/gh-problem-matcher-wrap@20007cb926a46aa324653a387363b52f07709845 # 2025-04-23

.github/workflows/daily.yml

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,3 +283,164 @@ jobs:
283283
topic: 'mathlib test executable failure'
284284
content: |
285285
❌ mathlib_test_executable [${{ needs.check-mathlib_test_executable.result }}](${{ steps.get-status.outputs.mathlib_test_executable_url }}) on ${{ github.sha }} (branch: ${{ env.BRANCH_REF }})
286+
287+
check-nanoda:
288+
runs-on: ubuntu-latest
289+
if: github.repository == 'leanprover-community/mathlib4'
290+
strategy:
291+
fail-fast: false
292+
matrix:
293+
branch_type: [master, nightly]
294+
steps:
295+
# Checkout repository, so that we can fetch tags to decide which branch we want.
296+
- name: Checkout branch or tag
297+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
298+
299+
- name: Fetch latest tags (if nightly)
300+
if: matrix.branch_type == 'nightly'
301+
run: |
302+
# When in nightly mode, fetch tags from the nightly-testing repository
303+
git remote add nightly-testing https://github.com/leanprover-community/mathlib4-nightly-testing.git
304+
git fetch nightly-testing --tags
305+
LATEST_TAG=$(git tag | grep -E "${{ env.TAG_PATTERN }}" | sort -r | head -n 1)
306+
echo "LATEST_TAG=${LATEST_TAG}" >> "$GITHUB_ENV"
307+
308+
- name: Set branch ref
309+
run: |
310+
if [ "${{ matrix.branch_type }}" == "master" ]; then
311+
echo "BRANCH_REF=${{ env.DEFAULT_BRANCH }}" >> "$GITHUB_ENV"
312+
else
313+
echo "BRANCH_REF=${{ env.LATEST_TAG }}" >> "$GITHUB_ENV"
314+
fi
315+
316+
# Checkout the branch or tag we want to test.
317+
- name: Checkout branch or tag
318+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
319+
with:
320+
repository: ${{ matrix.branch_type == 'nightly' && 'leanprover-community/mathlib4-nightly-testing' || github.repository }}
321+
ref: ${{ env.BRANCH_REF }}
322+
323+
- name: Configure Lean
324+
uses: leanprover/lean-action@434f25c2f80ded67bba02502ad3a86f25db50709 # v1.3.0
325+
with:
326+
auto-config: false
327+
use-github-cache: false
328+
use-mathlib-cache: true
329+
reinstall-transient-toolchain: true
330+
331+
- name: Install Rust
332+
uses: dtolnay/rust-toolchain@stable
333+
334+
- name: Check Mathlib using nanoda # make sure this name is consistent with "Get job status and URLs" in the notify job
335+
id: nanoda
336+
continue-on-error: true
337+
run: |
338+
# Clone and build lean4export
339+
# TODO: Once https://github.com/leanprover/lean4export/pull/11 is merged,
340+
# switch to leanprover/lean4export and remove the `git checkout` line below.
341+
git clone https://github.com/kim-em/lean4export
342+
cd lean4export
343+
git checkout fix-nondep-normalization
344+
# Match toolchain to mathlib
345+
cp ../lean-toolchain .
346+
lake build
347+
cd ..
348+
349+
# Clone and build nanoda_lib
350+
git clone https://github.com/ammkrn/nanoda_lib
351+
cd nanoda_lib
352+
git checkout debug
353+
cargo build --release
354+
cd ..
355+
356+
# Export Mathlib
357+
lake env lean4export/.lake/build/bin/lean4export Mathlib > mathlib_export.txt
358+
359+
# Create config
360+
cat > nanoda_config.json << 'EOF'
361+
{
362+
"export_file_path": "mathlib_export.txt",
363+
"permitted_axioms": [
364+
"propext",
365+
"Classical.choice",
366+
"Quot.sound",
367+
"Lean.trustCompiler"
368+
],
369+
"unpermitted_axiom_hard_error": false,
370+
"nat_extension": true,
371+
"string_extension": true,
372+
"print_success_message": true
373+
}
374+
EOF
375+
376+
# Run nanoda
377+
nanoda_lib/target/release/nanoda_bin nanoda_config.json
378+
379+
notify-nanoda:
380+
runs-on: ubuntu-latest
381+
needs: check-nanoda
382+
if: github.repository == 'leanprover-community/mathlib4' && always()
383+
strategy:
384+
fail-fast: false
385+
matrix:
386+
branch_type: [master, nightly]
387+
steps:
388+
- name: Checkout repository
389+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
390+
391+
- name: Get job status and URLs
392+
id: get-status
393+
env:
394+
GH_TOKEN: ${{ github.token }}
395+
run: |
396+
JOB_NAME="check-nanoda (${{ matrix.branch_type }})"
397+
398+
# Get URL to the specific step
399+
NANODA_URL=$(gh run view ${{ github.run_id }} --json jobs --jq \
400+
".jobs[] | select(.name == \"$JOB_NAME\") \
401+
| (.url + (.steps[] | select(.name == \"Check Mathlib using nanoda\") \
402+
| \"#step:\(.number):1\"))")
403+
404+
echo "nanoda_url=${NANODA_URL}" | tee -a "$GITHUB_OUTPUT"
405+
406+
- name: Fetch latest tags (if nightly)
407+
if: matrix.branch_type == 'nightly'
408+
run: |
409+
git remote add nightly-testing https://github.com/leanprover-community/mathlib4-nightly-testing.git
410+
git fetch nightly-testing --tags
411+
LATEST_TAG=$(git tag | grep -E "${{ env.TAG_PATTERN }}" | sort -r | head -n 1)
412+
echo "LATEST_TAG=${LATEST_TAG}" | tee -a "$GITHUB_ENV"
413+
414+
- name: Set branch ref
415+
run: |
416+
if [ "${{ matrix.branch_type }}" == "master" ]; then
417+
echo "BRANCH_REF=${{ env.DEFAULT_BRANCH }}" >> "$GITHUB_ENV"
418+
else
419+
echo "BRANCH_REF=${{ env.LATEST_TAG }}" >> "$GITHUB_ENV"
420+
fi
421+
422+
- name: Post success message for nanoda on Zulip
423+
if: needs.check-nanoda.result == 'success'
424+
uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2
425+
with:
426+
api-key: ${{ secrets.ZULIP_API_KEY }}
427+
email: 'github-mathlib4-bot@leanprover.zulipchat.com'
428+
organization-url: 'https://leanprover.zulipchat.com'
429+
to: 'nightly-testing'
430+
type: 'stream'
431+
topic: 'nanoda'
432+
content: |
433+
✅ nanoda [succeeded](${{ steps.get-status.outputs.nanoda_url }}) on ${{ github.sha }} (branch: ${{ env.BRANCH_REF }})
434+
435+
- name: Post failure / cancelled message for nanoda on Zulip
436+
if: needs.check-nanoda.result != 'success'
437+
uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2
438+
with:
439+
api-key: ${{ secrets.ZULIP_API_KEY }}
440+
email: 'github-mathlib4-bot@leanprover.zulipchat.com'
441+
organization-url: 'https://leanprover.zulipchat.com'
442+
to: 'nightly-testing'
443+
type: 'stream'
444+
topic: 'nanoda failure'
445+
content: |
446+
❌ nanoda [${{ needs.check-nanoda.result }}](${{ steps.get-status.outputs.nanoda_url }}) on ${{ github.sha }} (branch: ${{ env.BRANCH_REF }})

Cache/Init.lean

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/-
2+
Copyright (c) 2023 Arthur Paulino. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Arthur Paulino
5+
-/
6+
7+
namespace Cache.Requests
8+
9+
open System (FilePath)
10+
11+
-- FRO cache may be flaky: https://leanprover.zulipchat.com/#narrow/channel/113488-general/topic/The.20cache.20doesn't.20work/near/411058849
12+
-- This is defined in a separate file because it is used in the definition of `URL` and `UPLOAD_URL`
13+
-- and Lean does not allow one `initialize` to use another `initialize` defined in the same file
14+
initialize useFROCache : Bool ← do
15+
let froCache ← IO.getEnv "USE_FRO_CACHE"
16+
return froCache == some "1" || froCache == some "true"

Cache/Requests.lean

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,12 @@ Authors: Arthur Paulino
66

77
import Batteries.Data.String.Matcher
88
import Cache.Hashing
9+
import Cache.Init
910

1011
namespace Cache.Requests
1112

1213
open System (FilePath)
1314

14-
-- FRO cache may be flaky: https://leanprover.zulipchat.com/#narrow/channel/113488-general/topic/The.20cache.20doesn't.20work/near/411058849
15-
initialize useFROCache : Bool ← do
16-
let froCache ← IO.getEnv "USE_FRO_CACHE"
17-
return froCache == some "1" || froCache == some "true"
18-
1915
/--
2016
Structure to hold repository information with priority ordering
2117
-/
@@ -244,11 +240,14 @@ def getRemoteRepo (mathlibDepPath : FilePath) : IO RepoInfo := do
244240
return {repo := repo, useFirst := false}
245241

246242
/-- Public URL for mathlib cache -/
247-
def URL : String :=
248-
if useFROCache then
249-
"https://mathlib4.lean-cache.cloud"
250-
else
251-
"https://lakecache.blob.core.windows.net/mathlib4"
243+
initialize URL : String ← do
244+
let url? ← IO.getEnv "MATHLIB_CACHE_GET_URL"
245+
let defaultUrl :=
246+
if useFROCache then
247+
"https://mathlib4.lean-cache.cloud"
248+
else
249+
"https://lakecache.blob.core.windows.net/mathlib4"
250+
return url?.getD defaultUrl
252251

253252
/-- Retrieves the azure token from the environment -/
254253
def getToken : IO String := do
@@ -467,7 +466,7 @@ where
467466
printLakeOutput out := do
468467
unless out.stdout.isEmpty do
469468
IO.eprintln "lake stdout:"
470-
IO.eprint out.stderr
469+
IO.eprint out.stdout
471470
unless out.stderr.isEmpty do
472471
IO.eprintln "lake stderr:"
473472
IO.eprint out.stderr
@@ -508,11 +507,14 @@ end Get
508507
section Put
509508

510509
/-- FRO cache S3 URL -/
511-
def UPLOAD_URL : String :=
512-
if useFROCache then
513-
"https://a09a7664adc082e00f294ac190827820.r2.cloudflarestorage.com/mathlib4"
514-
else
515-
URL
510+
initialize UPLOAD_URL : String ← do
511+
let url? ← IO.getEnv "MATHLIB_CACHE_PUT_URL"
512+
let defaultUrl :=
513+
if useFROCache then
514+
"https://a09a7664adc082e00f294ac190827820.r2.cloudflarestorage.com/mathlib4"
515+
else
516+
"https://lakecache.blob.core.windows.net/mathlib4"
517+
return url?.getD defaultUrl
516518

517519
/-- Formats the config file for `curl`, containing the list of files to be uploaded -/
518520
def mkPutConfigContent (repo : String) (fileNames : Array String) (token : String) : IO String := do

Mathlib.lean

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,7 @@ public import Mathlib.Algebra.Homology.DerivedCategory.Ext.EnoughProjectives
546546
public import Mathlib.Algebra.Homology.DerivedCategory.Ext.ExactSequences
547547
public import Mathlib.Algebra.Homology.DerivedCategory.Ext.ExtClass
548548
public import Mathlib.Algebra.Homology.DerivedCategory.Ext.Linear
549+
public import Mathlib.Algebra.Homology.DerivedCategory.Ext.Map
549550
public import Mathlib.Algebra.Homology.DerivedCategory.Ext.TStructure
550551
public import Mathlib.Algebra.Homology.DerivedCategory.Fractions
551552
public import Mathlib.Algebra.Homology.DerivedCategory.FullyFaithful
@@ -852,6 +853,7 @@ public import Mathlib.Algebra.Order.BigOperators.Group.Finset
852853
public import Mathlib.Algebra.Order.BigOperators.Group.List
853854
public import Mathlib.Algebra.Order.BigOperators.Group.LocallyFinite
854855
public import Mathlib.Algebra.Order.BigOperators.Group.Multiset
856+
public import Mathlib.Algebra.Order.BigOperators.GroupWithZero.Finset
855857
public import Mathlib.Algebra.Order.BigOperators.GroupWithZero.List
856858
public import Mathlib.Algebra.Order.BigOperators.GroupWithZero.Multiset
857859
public import Mathlib.Algebra.Order.BigOperators.Ring.Finset
@@ -1665,6 +1667,7 @@ public import Mathlib.Analysis.Complex.CauchyIntegral
16651667
public import Mathlib.Analysis.Complex.Circle
16661668
public import Mathlib.Analysis.Complex.Conformal
16671669
public import Mathlib.Analysis.Complex.Convex
1670+
public import Mathlib.Analysis.Complex.CoveringMap
16681671
public import Mathlib.Analysis.Complex.Exponential
16691672
public import Mathlib.Analysis.Complex.ExponentialBounds
16701673
public import Mathlib.Analysis.Complex.Hadamard
@@ -2767,6 +2770,7 @@ public import Mathlib.CategoryTheory.Localization.Trifunctor
27672770
public import Mathlib.CategoryTheory.LocallyCartesianClosed.ChosenPullbacksAlong
27682771
public import Mathlib.CategoryTheory.LocallyCartesianClosed.ExponentiableMorphism
27692772
public import Mathlib.CategoryTheory.LocallyCartesianClosed.Over
2773+
public import Mathlib.CategoryTheory.LocallyCartesianClosed.Sections
27702774
public import Mathlib.CategoryTheory.LocallyDirected
27712775
public import Mathlib.CategoryTheory.MarkovCategory.Basic
27722776
public import Mathlib.CategoryTheory.Monad.Adjunction
@@ -4990,6 +4994,7 @@ public import Mathlib.MeasureTheory.Integral.IntervalIntegral.DerivIntegrable
49904994
public import Mathlib.MeasureTheory.Integral.IntervalIntegral.FundThmCalculus
49914995
public import Mathlib.MeasureTheory.Integral.IntervalIntegral.IntegrationByParts
49924996
public import Mathlib.MeasureTheory.Integral.IntervalIntegral.LebesgueDifferentiationThm
4997+
public import Mathlib.MeasureTheory.Integral.IntervalIntegral.MeanValue
49934998
public import Mathlib.MeasureTheory.Integral.IntervalIntegral.Periodic
49944999
public import Mathlib.MeasureTheory.Integral.IntervalIntegral.Slope
49955000
public import Mathlib.MeasureTheory.Integral.IntervalIntegral.TrapezoidalRule
@@ -5005,6 +5010,7 @@ public import Mathlib.MeasureTheory.Integral.Lebesgue.Sub
50055010
public import Mathlib.MeasureTheory.Integral.LebesgueNormedSpace
50065011
public import Mathlib.MeasureTheory.Integral.Marginal
50075012
public import Mathlib.MeasureTheory.Integral.MeanInequalities
5013+
public import Mathlib.MeasureTheory.Integral.MeanValue
50085014
public import Mathlib.MeasureTheory.Integral.PeakFunction
50095015
public import Mathlib.MeasureTheory.Integral.Pi
50105016
public import Mathlib.MeasureTheory.Integral.Prod
@@ -5217,6 +5223,8 @@ public import Mathlib.NumberTheory.Harmonic.EulerMascheroni
52175223
public import Mathlib.NumberTheory.Harmonic.GammaDeriv
52185224
public import Mathlib.NumberTheory.Harmonic.Int
52195225
public import Mathlib.NumberTheory.Harmonic.ZetaAsymp
5226+
public import Mathlib.NumberTheory.Height.Basic
5227+
public import Mathlib.NumberTheory.Height.Instances
52205228
public import Mathlib.NumberTheory.JacobiSum.Basic
52215229
public import Mathlib.NumberTheory.KummerDedekind
52225230
public import Mathlib.NumberTheory.LSeries.AbstractFuncEq
@@ -7235,6 +7243,7 @@ public import Mathlib.Topology.MetricSpace.Pseudo.Real
72357243
public import Mathlib.Topology.MetricSpace.Sequences
72367244
public import Mathlib.Topology.MetricSpace.ShrinkingLemma
72377245
public import Mathlib.Topology.MetricSpace.Similarity
7246+
public import Mathlib.Topology.MetricSpace.Snowflaking
72387247
public import Mathlib.Topology.MetricSpace.ThickenedIndicator
72397248
public import Mathlib.Topology.MetricSpace.Thickening
72407249
public import Mathlib.Topology.MetricSpace.TransferInstance

0 commit comments

Comments
 (0)