Skip to content

Commit 465c566

Browse files
committed
Merge branch 'master' into codex/tfae-congr-append
2 parents c41e87d + e310d5e commit 465c566

3,007 files changed

Lines changed: 13399 additions & 13205 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: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ jobs:
5757
build-outcome: ${{ steps.build.outcome }}
5858
archive-outcome: ${{ steps.archive.outcome }}
5959
counterexamples-outcome: ${{ steps.counterexamples.outcome }}
60+
wanted-outcome: ${{ steps.wanted.outcome }}
6061
cache-staging-has-files: ${{ steps.cache_staging_check.outputs.has_files }}
6162
mk_all-outcome: ${{ steps.mk_all.outcome }}
6263
noisy-outcome: ${{ steps.noisy.outcome }}
@@ -230,12 +231,13 @@ jobs:
230231
# storing and transferring oleans over the network.
231232
# Hopefully a future re-implementation of `cache` will obviate the present need for this hack.
232233

233-
- name: fetch archive and counterexamples cache
234+
- name: fetch archive, counterexamples and wanted cache
234235
shell: bash
235236
run: |
236237
cd pr-branch
237238
../tools-branch/.lake/build/bin/cache get Archive.lean
238239
../tools-branch/.lake/build/bin/cache get Counterexamples.lean
240+
../tools-branch/.lake/build/bin/cache get Wanted.lean
239241
240242
- name: build archive
241243
id: archive
@@ -253,8 +255,16 @@ jobs:
253255
../tools-branch/scripts/lake-build-with-retry.sh Counterexamples
254256
# results of build at pr-branch/.lake/build_summary_Counterexamples.json
255257
258+
- name: build wanted
259+
id: wanted
260+
continue-on-error: true
261+
run: |
262+
cd pr-branch
263+
../tools-branch/scripts/lake-build-with-retry.sh Wanted
264+
# results of build at pr-branch/.lake/build_summary_Wanted.json
265+
256266
# Runs in the build job because it only needs the freshly-built Mathlib/
257-
# Archive/Counterexamples oleans, which are present here; keeping it in
267+
# Archive/Counterexamples/Wanted oleans, which are present here; keeping it in
258268
# `build` also spares `test_lint` from fetching Archive/Counterexamples.
259269
- name: check for noisy stdout lines
260270
id: noisy
@@ -263,7 +273,7 @@ jobs:
263273
buildMsgs="$(
264274
## we exploit `lake`s replay feature: since the cache is present, running
265275
## `lake build` will reproduce all the outputs without having to recompute
266-
lake build -q --iofail Mathlib Archive Counterexamples
276+
lake build -q --iofail Mathlib Archive Counterexamples Wanted
267277
)"
268278
if [ -n "${buildMsgs}" ]
269279
then
@@ -300,6 +310,13 @@ jobs:
300310
cd pr-branch
301311
lake env ../tools-branch/.lake/build/bin/cache --staging-dir="../cache-staging" stage Counterexamples.lean
302312
313+
- name: stage Wanted cache files
314+
if: ${{ steps.wanted.outcome == 'success' }}
315+
shell: landrun --rox /usr --ro /etc/timezone --rw /dev --rox /home/lean/.elan --rox /home/lean/actions-runner/_work --rox /home/lean/.cache/mathlib/ --rw /home/lean/.cache/mathlib/ --rw pr-branch/.lake/ --rw cache-staging/ --env PATH --env HOME --env GITHUB_OUTPUT --env CI -- bash -euxo pipefail {0}
316+
run: |
317+
cd pr-branch
318+
lake env ../tools-branch/.lake/build/bin/cache --staging-dir="../cache-staging" stage Wanted.lean
319+
303320
- name: check cache staging contents
304321
id: cache_staging_check
305322
if: ${{ always() && (steps.build.outcome == 'success' || steps.build.outcome == 'failure' || steps.build.outcome == 'cancelled') }}
@@ -463,19 +480,19 @@ jobs:
463480
# the archive/counterexamples builds all succeeded. The condition reads those
464481
# from the build job's outputs, and the problem-matcher wrap is gated to match.
465482
- name: begin gh-problem-match-wrap for test step
466-
if: ${{ needs.build.outputs.build-outcome == 'success' && needs.build.outputs.mk_all-outcome == 'success' && needs.build.outputs.archive-outcome == 'success' && needs.build.outputs.counterexamples-outcome == 'success' }}
483+
if: ${{ needs.build.outputs.build-outcome == 'success' && needs.build.outputs.mk_all-outcome == 'success' && needs.build.outputs.archive-outcome == 'success' && needs.build.outputs.counterexamples-outcome == 'success' && needs.build.outputs.wanted-outcome == 'success' }}
467484
uses: leanprover-community/gh-problem-matcher-wrap@65a654fcdf7b64ff7633bc7a558f7b46d59a27bf # 2026-06-25
468485
with:
469486
action: add # In order to be able to run a multiline script, we need to add/remove the problem matcher before and after.
470487
linters: lean
471488
- name: test mathlib
472-
if: ${{ needs.build.outputs.build-outcome == 'success' && needs.build.outputs.mk_all-outcome == 'success' && needs.build.outputs.archive-outcome == 'success' && needs.build.outputs.counterexamples-outcome == 'success' }}
489+
if: ${{ needs.build.outputs.build-outcome == 'success' && needs.build.outputs.mk_all-outcome == 'success' && needs.build.outputs.archive-outcome == 'success' && needs.build.outputs.counterexamples-outcome == 'success' && needs.build.outputs.wanted-outcome == 'success' }}
473490
id: test
474491
run: |
475492
cd pr-branch
476493
../tools-branch/scripts/lake-build-wrapper.py .lake/build_summary_MathlibTest.json lake --iofail test
477494
- name: end gh-problem-match-wrap for test step
478-
if: ${{ needs.build.outputs.build-outcome == 'success' && needs.build.outputs.mk_all-outcome == 'success' && needs.build.outputs.archive-outcome == 'success' && needs.build.outputs.counterexamples-outcome == 'success' }}
495+
if: ${{ needs.build.outputs.build-outcome == 'success' && needs.build.outputs.mk_all-outcome == 'success' && needs.build.outputs.archive-outcome == 'success' && needs.build.outputs.counterexamples-outcome == 'success' && needs.build.outputs.wanted-outcome == 'success' }}
479496
uses: leanprover-community/gh-problem-matcher-wrap@65a654fcdf7b64ff7633bc7a558f7b46d59a27bf # 2026-06-25
480497
with:
481498
action: remove

.github/workflows/lake_cache_shadow.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ on:
7272
# Default: the full `Mathlib` library — the representative master shadow.
7373
# For a cheaper experiment, pass a smaller set, e.g.
7474
# Mathlib.Topology.Basic Mathlib.Combinatorics.SimpleGraph.Basic Mathlib.RingTheory.Ideal.Basic
75-
# or add `Archive Counterexamples` to also shadow those libraries.
75+
# or add `Archive Counterexamples Wanted` to also shadow those libraries.
7676
default: Mathlib
7777
toolchain_override:
7878
description: >-
@@ -582,12 +582,12 @@ jobs:
582582
# (no rebuild). Deps building is expected and excluded from the grep.
583583
# Emit an explicit health line (consumed by the Zulip report) and fail
584584
# the run if it's not a full hit.
585-
BUILT_ROOT=$(grep -cE '^✔.*Built (Mathlib|Archive|Counterexamples)([. ]|$)' "$log" || true)
585+
BUILT_ROOT=$(grep -cE '^✔.*Built (Mathlib|Archive|Counterexamples|Wanted)([. ]|$)' "$log" || true)
586586
if [ "$BUILT_ROOT" -ne 0 ]; then
587587
health="❌ NOT full cache hits — ${BUILT_ROOT} root-package module(s) rebuilt"
588588
echo "health=${health}" >> "$GITHUB_OUTPUT"
589589
echo "::error::${health}"
590-
grep -E '^✔.*Built (Mathlib|Archive|Counterexamples)([. ]|$)' "$log" || true
590+
grep -E '^✔.*Built (Mathlib|Archive|Counterexamples|Wanted)([. ]|$)' "$log" || true
591591
exit 1
592592
fi
593593
health="✅ full cache hits — 0 root-package modules rebuilt (${FETCHED_ARTIFACTS} served from cache)"

.github/workflows/publish_tools.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ jobs:
7777
# We ship the whole build dir, not just the
7878
# binary, in case it needs other files there
7979
# to run.
80-
# - scripts/lake-build-with-retry.sh: builds Mathlib/Archive/Counterexamples
81-
# with retries.
80+
# - scripts/lake-build-with-retry.sh: builds Mathlib/Archive/Counterexamples/
81+
# Wanted with retries.
8282
# - scripts/lake-build-wrapper.py: wraps the `lake test` step.
8383
# - lean-toolchain: the toolchain this binary was built with;
8484
# the consumer installs it (via elan) so the

.github/workflows/remove_deprecated_decls.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ jobs:
129129
printf $'::group::Running lake env\n'
130130
lake env | tr ':' '\n'
131131
echo "::endgroup::"
132-
for repo in Mathlib Archive Counterexamples; do
132+
for repo in Mathlib Archive Counterexamples Wanted; do
133133
echo "::group::Retrieving the cache for ${repo}"
134134
lake exe cache get "$repo" || true
135135
echo "::endgroup::"
@@ -141,12 +141,12 @@ jobs:
141141
NEW_DATE: "${{ steps.process_dates.outputs.to_date }}"
142142
DRY_RUN: "${{ toJson(inputs.dry_run) }}"
143143
run: |
144-
# We create a temporary file importing `Mathlib`, `Archive` and `Counterexamples`
145-
# and running `#clear_deprecations` with the expected date-range.
144+
# We create a temporary file importing `Mathlib`, `Archive`, `Counterexamples` and
145+
# `Wanted`, and running `#clear_deprecations` with the expected date-range.
146146
tmplean="$(mktemp -p Mathlib --suffix=.lean RMDXXX)"
147147
echo "::group::Creating ${tmplean} file"
148148
{
149-
for repo in Mathlib Archive Counterexamples; do
149+
for repo in Mathlib Archive Counterexamples Wanted; do
150150
printf $'import %s\n' "$repo"
151151
done
152152
REALLY=$([ "$DRY_RUN" = "true" ] && echo "" || echo "really")

Archive.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ import Archive.MiuLanguage.Basic
6767
import Archive.MiuLanguage.DecisionNec
6868
import Archive.MiuLanguage.DecisionSuf
6969
import Archive.OxfordInvariants.Summer2021.Week3P1
70+
import Archive.RiemannStieltjes
7071
import Archive.Sensitivity
7172
import Archive.Wiedijk100Theorems.AbelRuffini
7273
import Archive.Wiedijk100Theorems.AreaOfACircle

Archive/Arithcc.lean

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -262,14 +262,10 @@ theorem write_eq_implies_stateEq {t : Register} {v : Word} {ζ₁ ζ₂ : State}
262262
intro r hr
263263
obtain ⟨_, h⟩ := h
264264
specialize h r (lt_trans hr (Register.lt_succ_self _))
265-
rwa [if_neg (ne_of_lt hr)] at h
265+
rwa [ite_eq_right (ne_of_lt hr)] at h
266266

267-
set_option linter.flexible false in
268-
set_option linter.style.whitespace false in -- manual alignment is not recognised
269267
/-- The main **compiler correctness theorem**.
270-
271-
Unlike Theorem 1 in the paper, both `map` and the assumption on `t` are explicit.
272-
-/
268+
Unlike Theorem 1 in the paper, both `map` and the assumption on `t` are explicit. -/
273269
theorem compiler_correctness
274270
(map : Identifier → Register) (e : Expr) (ξ : Identifier → Word) (η : State) (t : Register)
275271
(hmap : ∀ x, read (loc x map) η = ξ x) (ht : ∀ x, loc x map < t) :
@@ -324,11 +320,11 @@ theorem compiler_correctness
324320
simp_all
325321
have hζ₄ : ζ₄ ≃[t + 1] { write t ν₁ η with ac := ν } := calc
326322
ζ₄ = step (Instruction.add t) ζ₃ := by simp_all
327-
_ = { ζ₃ with ac := read t ζ₃ + ζ₃.ac } := by simp [step]
328-
_ = { ζ₃ with ac := ν } := by simp_all
329-
_ ≃[t + 1] { { write t ν₁ η with ac := ν₂ } with ac := ν } := by
330-
simp [StateEq] at hζ₃ ⊢; cases hζ₃; assumption
331-
_ ≃[t + 1] { write t ν₁ η with ac := ν } := by simp_all; rfl
323+
_ = { ζ₃ with ac := read t ζ₃ + ζ₃.ac } := by simp [step]
324+
_ = { ζ₃ with ac := ν } := by simp_all
325+
_ ≃[t + 1] { { write t ν₁ η with ac := ν₂ } with ac := ν } := by
326+
simp only [StateEq, true_and]; exact hζ₃.2
327+
_ ≃[t + 1] { write t ν₁ η with ac := ν } := by simp_all; rfl
332328
apply write_eq_implies_stateEq <;> assumption
333329

334330
end Correctness

Archive/Examples/Eisenstein.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ namespace Polynomial
2525

2626
open Ideal.Quotient Ideal RingHom
2727

28-
set_option linter.flexible false in
2928
example : Irreducible (X ^ 4 - 10 * X ^ 2 + 1 : ℤ[X]) := by
3029
-- We will apply the generalized Eisenstein criterion with `q = X ^ 2 + 1` and `K = ZMod 3`.
3130
set f : ℤ[X] := X ^ 4 - 10 * X ^ 2 + 1 with hf_eq
@@ -42,7 +41,7 @@ example : Irreducible (X ^ 4 - 10 * X ^ 2 + 1 : ℤ[X]) := by
4241
have hdeg_q₃ : q₃.natDegree = 2 := by unfold q₃; compute_degree!
4342
suffices Irreducible q₃ by simpa [q] using this
4443
apply irreducible_of_degree_le_three_of_not_isRoot
45-
(by simp_all) (by simp_all [q₃]; decide)
44+
(by simp_all) (by simp_rw [q₃, IsRoot.def, eval_add, eval_pow, eval_X, eval_one]; decide)
4645
· unfold q; monicity!
4746
· exact Monic.isPrimitive hf_lC
4847
· simp_all

Archive/Examples/IfNormalization/WithoutAesop.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def normalize' (l : AList (fun _ : ℕ => Bool)) :
6060
refine ⟨fun f => ?_, ?_, fun w b => ?_⟩
6161
· simp only [eval, apply_ite, ite_eq_iff']
6262
cases hfv : f v
63-
· simp +contextual only [cond_false, h, he₁]
63+
· simp +contextual only [Bool.cond_false, h, he₁]
6464
refine ⟨fun _ => ?_, fun _ => ?_⟩
6565
· congr
6666
ext w
@@ -74,7 +74,7 @@ def normalize' (l : AList (fun _ : ℕ => Bool)) :
7474
· subst h
7575
simp_all
7676
· simp_all
77-
· simp only [cond_true, h, ht₁]
77+
· simp only [Bool.cond_true, h, ht₁]
7878
refine ⟨fun _ => ?_, fun _ => ?_⟩
7979
· congr
8080
ext w

Archive/Imo/Imo1987Q1.lean

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ open Finset (range sum_const)
3131

3232
namespace Imo1987Q1
3333

34-
set_option backward.isDefEq.respectTransparency false in
3534
/-- The set of pairs `(x : α, σ : Perm α)` such that `σ x = x` is equivalent to the set of pairs
3635
`(x : α, σ : Perm {x}ᶜ)`. -/
3736
def fixedPointsEquiv : { σx : α × Perm α // σx.2 σx.1 = σx.1 } ≃ Σ x : α, Perm ({x}ᶜ : Set α) :=
@@ -42,7 +41,6 @@ def fixedPointsEquiv : { σx : α × Perm α // σx.2 σx.1 = σx.1 } ≃ Σ x :
4241
sigmaCongrRight fun x => Equiv.subtypeEquivRight (by simp)
4342
_ ≃ Σ x : α, Perm ({x}ᶜ : Set α) := sigmaCongrRight fun x => by apply Equiv.Set.compl
4443

45-
set_option backward.isDefEq.respectTransparency false in
4644
theorem card_fixed_points :
4745
card { σx : α × Perm α // σx.2 σx.1 = σx.1 } = card α * (card α - 1)! := by
4846
simp only [card_congr (fixedPointsEquiv α), card_sigma, card_perm]

Archive/Imo/Imo2008Q4.lean

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ end Imo2008Q4
3434

3535
open Imo2008Q4
3636

37-
set_option linter.flexible false in
3837
theorem imo2008_q4 (f : ℝ → ℝ) (H₁ : ∀ x > 0, 0 < f x) :
3938
(∀ w x y z : ℝ, 0 < w → 0 < x → 0 < y → 0 < z → w * x = y * z →
4039
(f w ^ 2 + f x ^ 2) / (f (y ^ 2) + f (z ^ 2)) = (w ^ 2 + x ^ 2) / (y ^ 2 + z ^ 2)) ↔

0 commit comments

Comments
 (0)