Skip to content

Commit 89a27c8

Browse files
committed
Merge remote-tracking branch 'upstream/master' into kim/move-OrderDual
# Conflicts: # Mathlib/Order/Filter/AtTopBot/Defs.lean
2 parents f3bc668 + ae6b7e9 commit 89a27c8

File tree

39 files changed

+773
-130
lines changed

39 files changed

+773
-130
lines changed

.github/workflows/add_label_from_diff.yaml

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,33 +21,42 @@ jobs:
2121
# Don't run on forks, where we wouldn't have permissions to add the label anyway.
2222
if: github.repository == 'leanprover-community/mathlib4'
2323
steps:
24-
- name: Checkout code
24+
- name: Checkout master branch to build autolabel from
2525
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2626
with:
27-
ref: ${{ github.event.pull_request.head.sha }}
28-
fetch-depth: 0
27+
ref: master
28+
path: tools
2929
- name: Configure Lean
3030
uses: leanprover/lean-action@c544e89643240c6b398f14a431bcdc6309e36b3e # v1.4.0
3131
with:
3232
auto-config: false
3333
use-github-cache: false
3434
use-mathlib-cache: false
35-
- name: lake exe autolabel
35+
lake-package-directory: tools # Building here
36+
- name: Build autolabel from master
37+
working-directory: tools
38+
run: |
39+
lake build autolabel
40+
- name: Checkout branch to label
41+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
42+
with:
43+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
44+
fetch-depth: 0
45+
path: pr-branch
46+
- name: Run autolabel
47+
working-directory: pr-branch
3648
run: |
37-
# the checkout dance, to avoid a detached head
38-
git checkout master
39-
git checkout -
40-
labels="$(lake exe autolabel)"
49+
labels="$("${GITHUB_WORKSPACE}/tools/.lake/build/bin/autolabel")"
4150
printf '%s\n' "${labels}"
4251
# extract
4352
label="$(printf '%s' "${labels}" | sed -n 's=^::notice::.*#\[\([^,]*\)\].*=\1=p')"
4453
printf 'label: "%s"\n' "${label}"
45-
if [ -n "${label}" ]
54+
if [ -n "${label}" ] && [ -n "${PR_NUMBER}" ]
4655
then
4756
printf 'Applying label %s\n' "${label}"
4857
# we use curl rather than octokit/request-action so that the job won't fail
4958
# (and send an annoying email) if the labels don't exist
50-
url="https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels"
59+
url="https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}/labels"
5160
printf 'url: %s\n' "${url}"
5261
jsonLabel="$(printf '{"labels":["%s"]}' "${label}")"
5362
printf 'jsonLabel: %s\n' "${jsonLabel}"
@@ -62,3 +71,6 @@ jobs:
6271
fi
6372
env:
6473
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74+
# the PR number could be undefined in workflows triggered by 'push',
75+
# in which case we only log the applicable label and exit
76+
PR_NUMBER: ${{ github.event.pull_request.number }}

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ on:
1010
# ignore staging and trying branches used by bors, these are handled by bors.yml
1111
- 'staging'
1212
- 'trying'
13+
# ignore branches meant for experiments
14+
- 'ci-dev/**'
1315
merge_group:
1416

1517
concurrency:

.github/workflows/build_template.yml

Lines changed: 39 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
1-
# Reusable workflow invoked by build.yml, bors.yml, and build_fork.yml.
1+
# Reusable workflow invoked by build.yml, bors.yml, build_fork.yml, and ci_dev.yml.
22

33
on:
44
workflow_call:
55
inputs:
66
concurrency_group:
77
type: string
88
required: true
9+
tools_branch_ref:
10+
type: string
11+
required: false
12+
default: ''
913
pr_branch_ref:
1014
type: string
1115
required: true
16+
run_post_ci:
17+
type: boolean
18+
required: false
19+
default: true
1220
runs_on:
1321
type: string
1422
required: true
@@ -71,16 +79,16 @@ jobs:
7179
- name: 'Setup jq'
7280
uses: dcarbone/install-jq-action@b7ef57d46ece78760b4019dbc4080a1ba2a40b45 # v3.2.0
7381

74-
# Checkout the master branch into a subdirectory
75-
- name: Checkout master branch
82+
# Checkout a trusted branch to build the tooling from
83+
- name: Checkout tools branch
7684
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
7785
with:
7886
# Recall that on the `leanprover-community/mathlib4-nightly-testing` repository,
7987
# we don't maintain a `master` branch at all.
8088
# For PRs and pushes to this repository, we will use `nightly-testing-green` instead,
8189
# so that even when `nightly-testing` is broken, we can still build tools from a known good state.
82-
ref: ${{ github.repository == 'leanprover-community/mathlib4-nightly-testing' && 'nightly-testing-green' || 'master' }}
83-
path: master-branch
90+
ref: ${{ inputs.tools_branch_ref != '' && inputs.tools_branch_ref || (github.repository == 'leanprover-community/mathlib4-nightly-testing' && 'nightly-testing-green' || 'master') }}
91+
path: tools-branch
8492

8593
# Checkout the PR branch into a subdirectory
8694
- name: Checkout PR branch
@@ -160,18 +168,18 @@ jobs:
160168
# Set it as an environment variable for subsequent steps
161169
echo "LEAN_SRC_PATH=$LEAN_SRC_PATH" >> "$GITHUB_ENV"
162170
163-
- name: build master-branch tools
164-
shell: bash # We're only building the `master` branch version of the tools, so don't need to run inside landrun.
171+
- name: build tools-branch tools
172+
shell: bash # We're only building a trusted branch with the tools, so no need to run inside landrun.
165173
run: |
166-
cd master-branch
174+
cd tools-branch
167175
lake build cache check-yaml graph
168176
ls .lake/build/bin/cache
169177
ls .lake/build/bin/check-yaml
170178
ls .lake/packages/importGraph/.lake/build/bin/graph
171179
172180
- name: cleanup .cache/mathlib
173181
# This needs write access to .cache/mathlib, so can't be run inside landrun.
174-
# However it is only using the `master` version of `cache`, so is safe to run outside landrun.
182+
# However it is only using the `tools` version of `cache`, so is safe to run outside landrun.
175183
shell: bash
176184
run: |
177185
# Define the cache directory path
@@ -190,8 +198,8 @@ jobs:
190198
# Check if size exceeds 10GB
191199
if [ "$DIR_SIZE" -gt "10737418240" ]; then
192200
echo "Cache size exceeds threshold, running lake exe cache clean"
193-
# We use the master-branch version of `cache`.
194-
cd master-branch
201+
# We use the tools-branch version of `cache`.
202+
cd tools-branch
195203
lake exe cache clean
196204
fi
197205
@@ -281,15 +289,15 @@ jobs:
281289
282290
- name: get cache (1/3 - setup and initial fetch)
283291
id: get_cache_part1_setup
284-
shell: bash # only runs `cache get` from `master-branch`, so doesn't need to be inside landrun
292+
shell: bash # only runs `cache get` from `tools-branch`, so doesn't need to be inside landrun
285293
run: |
286294
cd pr-branch
287295
echo "Removing old Mathlib build directories prior to cache fetch..."
288296
rm -rf .lake/build/lib/lean/Mathlib
289297
290298
# Fail quickly if the cache is completely cold, by checking for Mathlib.Init
291299
echo "Attempting to fetch olean for Mathlib/Init.lean from cache..."
292-
../master-branch/.lake/build/bin/cache get Mathlib/Init.lean
300+
../tools-branch/.lake/build/bin/cache get Mathlib/Init.lean
293301
294302
- name: get cache (2/3 - test Mathlib.Init cache)
295303
id: get_cache_part2_test
@@ -303,16 +311,16 @@ jobs:
303311
304312
- name: get cache (3/3 - finalize cache operation)
305313
id: get
306-
shell: bash # only runs `cache get` from `master-branch`, so doesn't need to be inside landrun
314+
shell: bash # only runs `cache get` from `tools-branch`, so doesn't need to be inside landrun
307315
run: |
308316
cd pr-branch
309317
if [[ "${{ steps.get_cache_part2_test.outcome }}" == "success" ]]; then
310318
echo "Fetching all remaining cache..."
311319
312-
../master-branch/.lake/build/bin/cache get
320+
../tools-branch/.lake/build/bin/cache get
313321
314322
# Run again with --repo, to ensure we actually get the oleans.
315-
../master-branch/.lake/build/bin/cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} get
323+
../tools-branch/.lake/build/bin/cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} get
316324
else
317325
echo "WARNING: 'lake build --no-build -v Mathlib.Init' failed."
318326
echo "No cache for 'Mathlib.Init' available or it could not be prepared."
@@ -346,7 +354,7 @@ jobs:
346354
fi
347355
echo "::endgroup::"
348356
349-
../master-branch/scripts/lake-build-with-retry.sh Mathlib
357+
../tools-branch/scripts/lake-build-with-retry.sh Mathlib
350358
# results of build at pr-branch/.lake/build_summary_Mathlib.json
351359
- name: end gh-problem-match-wrap for build step
352360
uses: leanprover-community/gh-problem-matcher-wrap@20007cb926a46aa324653a387363b52f07709845 # 2025-04-23
@@ -372,15 +380,15 @@ jobs:
372380
# Trim trailing whitespace from secrets to prevent issues with accidentally added spaces
373381
export MATHLIB_CACHE_SAS="${MATHLIB_CACHE_SAS_RAW%"${MATHLIB_CACHE_SAS_RAW##*[![:space:]]}"}"
374382
375-
# Use the trusted cache tool from master-branch
383+
# Use the trusted cache tool from tools-branch
376384
# TODO: this is not doing anything currently, and needs to be integrated with put-unpacked
377-
# ../master-branch/.lake/build/bin/cache commit || true
385+
# ../tools-branch/.lake/build/bin/cache commit || true
378386
# run this in CI if it gets an incorrect lake hash for existing cache files somehow
379-
# ../master-branch/.lake/build/bin/cache put!
387+
# ../tools-branch/.lake/build/bin/cache put!
380388
# do not try to upload files just downloaded
381389
382390
echo "Uploading cache to Azure..."
383-
MATHLIB_CACHE_USE_CLOUDFLARE=0 ../master-branch/.lake/build/bin/cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} put-unpacked
391+
MATHLIB_CACHE_USE_CLOUDFLARE=0 ../tools-branch/.lake/build/bin/cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} put-unpacked
384392
env:
385393
MATHLIB_CACHE_SAS_RAW: ${{ secrets.MATHLIB_CACHE_SAS }}
386394

@@ -396,23 +404,23 @@ jobs:
396404
shell: bash
397405
run: |
398406
cd pr-branch
399-
../master-branch/.lake/build/bin/cache get Archive.lean
400-
../master-branch/.lake/build/bin/cache get Counterexamples.lean
407+
../tools-branch/.lake/build/bin/cache get Archive.lean
408+
../tools-branch/.lake/build/bin/cache get Counterexamples.lean
401409
402410
- name: build archive
403411
id: archive
404412
continue-on-error: true
405413
run: |
406414
cd pr-branch
407-
../master-branch/scripts/lake-build-with-retry.sh Archive
415+
../tools-branch/scripts/lake-build-with-retry.sh Archive
408416
# results of build at pr-branch/.lake/build_summary_Archive.json
409417
410418
- name: build counterexamples
411419
id: counterexamples
412420
continue-on-error: true
413421
run: |
414422
cd pr-branch
415-
../master-branch/scripts/lake-build-with-retry.sh Counterexamples
423+
../tools-branch/scripts/lake-build-with-retry.sh Counterexamples
416424
# results of build at pr-branch/.lake/build_summary_Counterexamples.json
417425
418426
- name: Check if building Archive or Counterexamples failed
@@ -436,8 +444,8 @@ jobs:
436444
export MATHLIB_CACHE_SAS="${MATHLIB_CACHE_SAS_RAW%"${MATHLIB_CACHE_SAS_RAW##*[![:space:]]}"}"
437445
438446
echo "Uploading Archive and Counterexamples cache to Azure..."
439-
MATHLIB_CACHE_USE_CLOUDFLARE=0 ../master-branch/.lake/build/bin/cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} put-unpacked Archive.lean
440-
MATHLIB_CACHE_USE_CLOUDFLARE=0 ../master-branch/.lake/build/bin/cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} put-unpacked Counterexamples.lean
447+
MATHLIB_CACHE_USE_CLOUDFLARE=0 ../tools-branch/.lake/build/bin/cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} put-unpacked Archive.lean
448+
MATHLIB_CACHE_USE_CLOUDFLARE=0 ../tools-branch/.lake/build/bin/cache --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} put-unpacked Counterexamples.lean
441449
env:
442450
MATHLIB_CACHE_SAS_RAW: ${{ secrets.MATHLIB_CACHE_SAS }}
443451

@@ -460,7 +468,7 @@ jobs:
460468
id: test
461469
run: |
462470
cd pr-branch
463-
../master-branch/scripts/lake-build-wrapper.py .lake/build_summary_MathlibTest.json lake --iofail test
471+
../tools-branch/scripts/lake-build-wrapper.py .lake/build_summary_MathlibTest.json lake --iofail test
464472
- name: end gh-problem-match-wrap for test step
465473
uses: leanprover-community/gh-problem-matcher-wrap@20007cb926a46aa324653a387363b52f07709845 # 2025-04-23
466474
with:
@@ -584,8 +592,8 @@ jobs:
584592
TEST_OUTCOME: ${{ steps.test.outcome }}
585593
NIGHTLY_TESTING_REPO: leanprover-community/mathlib4-nightly-testing
586594
run: |
587-
master-branch/scripts/lean-pr-testing-comments.sh lean
588-
master-branch/scripts/lean-pr-testing-comments.sh batteries
595+
tools-branch/scripts/lean-pr-testing-comments.sh lean
596+
tools-branch/scripts/lean-pr-testing-comments.sh batteries
589597
590598
post_steps:
591599
name: Post-Build Step
@@ -678,6 +686,7 @@ jobs:
678686

679687
final:
680688
name: Post-CI job
689+
if: ${{ inputs.run_post_ci }}
681690
needs: [style_lint, build, post_steps]
682691
runs-on: ubuntu-latest
683692
steps:

.github/workflows/ci_dev.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: ci dev
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tools_branch_ref:
7+
description: ref for tools checkout (defaults to 'this commit')
8+
required: false
9+
type: string
10+
default: ''
11+
pr_branch_ref:
12+
description: ref for building-branch checkout (defaults to 'this commit')
13+
required: false
14+
type: string
15+
default: ''
16+
run_post_ci:
17+
description: Run the post-CI job?
18+
required: false
19+
type: boolean
20+
default: false # We shouldn't need this job in typical experiments
21+
22+
# Limit permissions for GITHUB_TOKEN for the entire workflow
23+
permissions:
24+
contents: read
25+
# By default let's remove this permission (which is present in the other build pipelines)
26+
# from the CI experimentation runs to avoid unwitting side effects
27+
# pull-requests: write
28+
29+
jobs:
30+
build:
31+
name: ci (dev branch)
32+
# For sanity and intentionality, let's only trigger this from branches ci-dev/*
33+
if: ${{ github.repository == 'leanprover-community/mathlib4' && github.ref_type == 'branch' && startsWith(github.ref_name, 'ci-dev/') }}
34+
uses: ./.github/workflows/build_template.yml
35+
with:
36+
concurrency_group: ${{ github.workflow }}-${{ github.ref }}
37+
# Use the tools from 'this branch', as our changes in the tools might be relevant for experiments
38+
tools_branch_ref: ${{ inputs.tools_branch_ref != '' && inputs.tools_branch_ref || github.sha }}
39+
pr_branch_ref: ${{ inputs.pr_branch_ref != '' && inputs.pr_branch_ref || github.sha }}
40+
run_post_ci: ${{ inputs.run_post_ci }}
41+
runs_on: pr
42+
secrets: inherit

.github/workflows/pre-commit.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
# ignore staging and trying branches used by bors, these are handled by bors.yml
1212
- 'staging'
1313
- 'trying'
14+
- 'ci-dev/**' # ignore branches meant for experiments
1415
- 'master'
1516
pull_request:
1617

Mathlib.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2012,6 +2012,7 @@ public import Mathlib.Analysis.Normed.Module.Basic
20122012
public import Mathlib.Analysis.Normed.Module.Complemented
20132013
public import Mathlib.Analysis.Normed.Module.Completion
20142014
public import Mathlib.Analysis.Normed.Module.Connected
2015+
public import Mathlib.Analysis.Normed.Module.ContinuousInverse
20152016
public import Mathlib.Analysis.Normed.Module.Convex
20162017
public import Mathlib.Analysis.Normed.Module.Dual
20172018
public import Mathlib.Analysis.Normed.Module.ENormedSpace

Mathlib/Algebra/Group/Finsupp.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ lemma support_single_add_single [DecidableEq ι] {f₁ f₂ : ι} {g₁ g₂ : M
153153
(H : f₁ ≠ f₂) (hg₁ : g₁ ≠ 0) (hg₂ : g₂ ≠ 0) :
154154
(single f₁ g₁ + single f₂ g₂).support = {f₁, f₂} := by
155155
rw [support_add_eq, support_single_ne_zero _ hg₁, support_single_ne_zero _ hg₂]
156-
· simp [pair_comm f₂ f₁]
156+
· simp
157157
· simp [support_single_ne_zero, *]
158158

159159
lemma support_single_add_single_subset [DecidableEq ι] {f₁ f₂ : ι} {g₁ g₂ : M} :

Mathlib/Algebra/Polynomial/Lifts.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ and that a monic polynomial that lifts can be lifted to a monic polynomial (of t
3434
## Implementation details
3535
3636
In general `R` and `S` are semirings, so `lifts` is a semiring. In the case of rings, see
37-
`lifts_iff_lifts_ring`.
37+
`lifts_iff_liftsRing`.
3838
3939
Since we do not assume `R` to be commutative, we cannot say in general that the set of polynomials
4040
that lift is a subalgebra. (By `lift_iff` this is true if `R` is commutative.)

Mathlib/Analysis/Analytic/CPolynomialDef.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ theorem HasFiniteFPowerSeriesOnBall.bound_zero_of_eq_zero (hf : ∀ y ∈ Metric
246246
· convert hasSum_zero
247247
rw [hp, ContinuousMultilinearMap.zero_apply]
248248
· rwa [Metric.mem_eball, edist_eq_enorm_sub, add_comm, add_sub_cancel_right,
249-
edist_zero_eq_enorm, ← Metric.mem_eball]
249+
edist_zero_right, ← Metric.mem_eball]
250250

251251
/-- If `f` has a formal power series at `x` bounded by `0`, then `f` is equal to `0` in a
252252
neighborhood of `x`. -/

Mathlib/Analysis/Analytic/Composition.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ theorem HasFPowerSeriesWithinAt.comp {g : F → G} {f : E → F} {q : FormalMult
795795
_ ≤ ‖compAlongComposition q p c‖ * (r : ℝ) ^ n := by
796796
rw [Finset.prod_const, Finset.card_fin]
797797
gcongr
798-
rw [Metric.mem_eball, edist_zero_eq_enorm] at hy
798+
rw [Metric.mem_eball, edist_zero_right] at hy
799799
have := le_trans (le_of_lt hy) (min_le_right _ _)
800800
rwa [enorm_le_coe, ← NNReal.coe_le_coe, coe_nnnorm] at this
801801
tendsto_nhds_of_cauchySeq_of_subseq cau compPartialSumTarget_tendsto_atTop C

0 commit comments

Comments
 (0)