Skip to content

Commit 7087ffc

Browse files
author
leanprover-community-mathlib4-bot
committed
Update lean-toolchain for leanprover/lean4#14259
2 parents 53f6e45 + de3a9cf commit 7087ffc

2,431 files changed

Lines changed: 17252 additions & 4745 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.

.git-blame-ignore-revs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# 2024-05-20 replace `refine'` with one underscore by `refine` (#13059)
2+
7493b5f81b4c031b87877c5c124bea1ddc4e567d
3+
# 2024-05-24 replace many `refine'` with `refine` (#13166)
4+
fc48848e4374f13c796a7399bfccd2e228f776df
5+
# 2025-11-19 move Mathlib to the module system (#31786)
6+
6a54a80825b060ab20dc31751ebdce78b3a3b518

.github/actions/get-mathlib-ci/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ inputs:
1010
# Default pinned commit used by workflows unless they explicitly override.
1111
# Update this ref as needed to pick up changes to mathlib-ci scripts
1212
# This is also updated automatically by .github/workflows/update_dependencies.yml
13-
default: 5aee9d4ce5a39050c72b4aa46015a824b0c189ac
13+
default: 0cd6cbc879d9241f3b4f6cb7e8291e34128c5654
1414
path:
1515
description: Checkout destination path.
1616
required: false

.github/workflows/PR_summary.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,16 @@ jobs:
233233
echo "Compute technical debt changes"
234234
techDebtVar="$("${CI_SCRIPTS_DIR}/reporting/technical-debt-metrics.sh" pr_summary)"
235235
236+
# If the PR decreased technical debt, add the `tech debt` label.
237+
# The metrics script emits a summary line "Decrease in <level> tech debt:" for each
238+
# level (strong/weak) that went down (and "Increase ..."/"No changes ..." otherwise),
239+
# so matching either of those two lines means the PR reduced some tech debt.
240+
if grep -qE "Decrease in (strong|weak) tech debt" <<< "${techDebtVar}"
241+
then
242+
printf $'Adding "tech debt" label to PR %s\n' "${PR}"
243+
gh pr edit "${PR}" --add-label "tech debt"
244+
fi
245+
236246
echo "Compute documentation reminder"
237247
workflowFilesChanged="$(grep '^\.github/workflows/' changed_files.txt || true)"
238248
if [ -n "${workflowFilesChanged}" ]

.github/workflows/build_template.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,9 @@ jobs:
801801
run: |
802802
lake env lean scripts/create_deprecated_modules.lean
803803
lake env lean scripts/autolabel.lean
804+
# Executing this also runs the export and writes a (gitignored) `crossrefs.json`,
805+
# which doubles as a smoke test of the `export_crossrefs.yml` workflow.
806+
lake env lean scripts/export_crossrefs.lean
804807
lake exe check_title_labels --labels "t-algebra" "feat: dummy PR for testing"
805808
806809
- name: build everything
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
name: Export cross-reference data
2+
3+
# Generates a JSON dictionary of every declaration tagged with `@[wikidata]`,
4+
# `@[stacks]`, or `@[kerodon]` (name, file, line, and the referenced ids) and
5+
# pushes it to a versioned repository (`CROSSREFS_REPO`), where it is publicly
6+
# available at `https://raw.githubusercontent.com/<CROSSREFS_REPO>/master/crossrefs.json`.
7+
#
8+
# The data is read from the fully-imported `Mathlib` environment by
9+
# `scripts/export_crossrefs.lean`, like the `#stacks_tags` command.
10+
11+
on:
12+
workflow_run:
13+
workflows: ["continuous integration"]
14+
branches: [master]
15+
types: [completed]
16+
workflow_dispatch:
17+
inputs:
18+
dry_run:
19+
description: "Dry run: mint the app token and verify push permission, but don't push to the crossrefs repo"
20+
type: boolean
21+
default: true
22+
23+
concurrency:
24+
group: export-crossrefs
25+
cancel-in-progress: true
26+
27+
permissions:
28+
contents: read
29+
# Required for the token-minting action to request a GitHub OIDC token,
30+
# which it exchanges (via Azure Key Vault) for a GitHub App installation token.
31+
id-token: write
32+
33+
env:
34+
CROSSREFS_REPO: leanprover-community/crossref-exports
35+
BUILT_SHA: ${{ github.event.workflow_run.head_sha || github.sha }}
36+
37+
jobs:
38+
export:
39+
name: Export cross-reference JSON
40+
runs-on: ubuntu-latest
41+
environment:
42+
name: crossref-exports
43+
deployment: false
44+
if: >-
45+
github.repository == 'leanprover-community/mathlib4' &&
46+
(github.event_name == 'workflow_dispatch'
47+
|| github.event.workflow_run.conclusion == 'success')
48+
steps:
49+
- name: Checkout the built commit
50+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
51+
with:
52+
persist-credentials: false
53+
# The exact commit CI validated; for manual runs, the dispatched ref.
54+
ref: ${{ env.BUILT_SHA }}
55+
56+
- name: Configure Lean and fetch the Mathlib cache
57+
uses: leanprover/lean-action@38fbc41a8c28c4cbaec22d7f7de508ec2e7c0dd9 # v1.5.0
58+
with:
59+
auto-config: false
60+
use-github-cache: false
61+
use-mathlib-cache: true
62+
reinstall-transient-toolchain: true
63+
64+
- name: Generate crossrefs.json
65+
env:
66+
CROSSREFS_OUT: crossrefs.json
67+
CROSSREFS_COMMIT: ${{ env.BUILT_SHA }}
68+
run: lake env lean scripts/export_crossrefs.lean
69+
70+
- name: Sanity-check the output
71+
run: |
72+
jq -e '.entries | length > 0' crossrefs.json > /dev/null
73+
echo "Exported $(jq '.entries | length' crossrefs.json) entries."
74+
75+
# Split `owner/repo` so the token can be scoped to the crossrefs repo. The
76+
# app is installed on the crossrefs repo's owner, not on this repository,
77+
# so the token-minting action must resolve the installation from there.
78+
- name: Resolve crossrefs repository owner and name
79+
id: repo
80+
run: |
81+
echo "owner=${CROSSREFS_REPO%%/*}" >> "$GITHUB_OUTPUT"
82+
echo "name=${CROSSREFS_REPO#*/}" >> "$GITHUB_OUTPUT"
83+
84+
# Mint a short-lived GitHub App installation token scoped to the crossrefs
85+
# repo, instead of relying on a long-lived personal access token.
86+
- name: Generate app token
87+
id: app-token
88+
uses: leanprover-community/mathlib-ci/.github/actions/azure-create-github-app-token@3bb576208589a435eeaeac9b144a1b7c3e948760
89+
with:
90+
app-id: ${{ secrets.MATHLIB_CROSSREFS_APP_ID }}
91+
key-vault-name: ${{ vars.MATHLIB_AZ_KEY_VAULT_NAME }}
92+
key-name: crossref-exports-app-pk
93+
azure-client-id: ${{ vars.GH_APP_AZURE_CLIENT_ID_CROSSREFS }}
94+
azure-tenant-id: ${{ secrets.LPC_AZ_TENANT_ID }}
95+
owner: ${{ steps.repo.outputs.owner }}
96+
repositories: ${{ steps.repo.outputs.name }}
97+
98+
- name: Push to the crossrefs repository
99+
env:
100+
CROSSREFS_PUSH_TOKEN: ${{ steps.app-token.outputs.token }}
101+
# On manual runs this defaults to true (see the workflow_dispatch
102+
# inputs); on the automatic workflow_run trigger `inputs` is empty, so
103+
# this is false and the push happens for real.
104+
DRY_RUN: ${{ inputs.dry_run || false }}
105+
run: |
106+
git clone --depth 1 \
107+
"https://x-access-token:${CROSSREFS_PUSH_TOKEN}@github.com/${CROSSREFS_REPO}.git" \
108+
crossrefs-repo
109+
cd crossrefs-repo
110+
git config user.name "leanprover-community-bot"
111+
git config user.email "leanprover-community-bot@users.noreply.github.com"
112+
# Commit only when the entries themselves change. The `generated`
113+
# timestamp and source `commit` change on every run, so comparing the
114+
# whole file would produce a commit even when nothing of substance did.
115+
# Consequence: the published `generated`/`commit` fields record when the
116+
# entries last changed, not the latest commit the export ran against, so
117+
# consumers should not read `generated` as a "data freshness" signal.
118+
# Read each file fully into a string and compare; using `diff -q` on two
119+
# `jq` process substitutions makes `diff` close the pipes at the first
120+
# difference, which leaves the `jq` writers with a SIGPIPE ("broken pipe")
121+
# and noisy spurious errors in the log.
122+
if [ -f crossrefs.json ] && \
123+
[ "$(jq -Sc '.entries' crossrefs.json)" = "$(jq -Sc '.entries' ../crossrefs.json)" ]; then
124+
echo "No change in entries."
125+
changed=false
126+
else
127+
cp ../crossrefs.json crossrefs.json
128+
git add crossrefs.json
129+
git commit -m "Update crossrefs (mathlib4@${BUILT_SHA})"
130+
changed=true
131+
fi
132+
133+
if [ "${DRY_RUN}" = "true" ]; then
134+
# Verify the minted token can actually push, without mutating the
135+
# remote: `git push --dry-run` performs the authenticated
136+
# git-receive-pack handshake (which GitHub gates on write access) but
137+
# never sends the update. If nothing changed, add a throwaway local
138+
# commit so there is a ref update to negotiate.
139+
if [ "${changed}" != "true" ]; then
140+
git commit --allow-empty -m "Dry-run push permission check (never sent)"
141+
fi
142+
echo "Dry run: verifying push permission against ${CROSSREFS_REPO} without pushing."
143+
git push --dry-run
144+
elif [ "${changed}" = "true" ]; then
145+
git push
146+
else
147+
echo "No change in entries; nothing to commit."
148+
fi
149+
150+
- name: Post failure message on Zulip
151+
if: failure()
152+
uses: zulip/github-actions-zulip/send-message@bd8ec52de371d139ae8313661b7d8318c19266aa # v2.0.1
153+
with:
154+
api-key: ${{ secrets.ZULIP_API_KEY }}
155+
email: 'github-mathlib4-bot@leanprover.zulipchat.com'
156+
organization-url: 'https://leanprover.zulipchat.com'
157+
to: 'nightly-testing-mathlib'
158+
type: 'stream'
159+
topic: 'crossrefs export failure'
160+
content: |
161+
❌ Cross-reference export [failed](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) on ${{ env.BUILT_SHA }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@
1010
scripts/.rm_set_option_progress.jsonl
1111
# Artifacts from using the devcontainer setup
1212
.devcontainer/devcontainer-lock.json
13+
14+
# Output of scripts/export_crossrefs.lean
15+
/crossrefs.json

Archive/Hairer.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ def L : MvPolynomial ι ℝ →ₗ[ℝ]
9393
(fun p f₁ f₂ ↦ by simp_rw [smul_eq_mul, ← integral_add (int p _) (int p _), ← mul_add]; rfl)
9494
fun r p f ↦ by simp_rw [← integral_smul, smul_comm r]; rfl
9595

96+
set_option backward.isDefEq.respectTransparency.types false in
9697
lemma inj_L : Injective (L ι) :=
9798
(injective_iff_map_eq_zero _).mpr fun p hp ↦ by
9899
have H : ∀ᵐ x : EuclideanSpace ℝ ι, x ∈ ball 0 1 → eval x p = 0 :=

Archive/Imo/Imo1987Q1.lean

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

3232
namespace Imo1987Q1
3333

34+
set_option backward.isDefEq.respectTransparency false in
3435
/-- The set of pairs `(x : α, σ : Perm α)` such that `σ x = x` is equivalent to the set of pairs
3536
`(x : α, σ : Perm {x}ᶜ)`. -/
3637
def fixedPointsEquiv : { σx : α × Perm α // σx.2 σx.1 = σx.1 } ≃ Σ x : α, Perm ({x}ᶜ : Set α) :=
@@ -41,6 +42,7 @@ def fixedPointsEquiv : { σx : α × Perm α // σx.2 σx.1 = σx.1 } ≃ Σ x :
4142
(sigmaCongrRight fun x => Equiv.setCongr <| by simp only [SetCoe.forall]; simp)
4243
_ ≃ Σ x : α, Perm ({x}ᶜ : Set α) := sigmaCongrRight fun x => by apply Equiv.Set.compl
4344

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

Archive/Imo/Imo1998Q2.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import Mathlib.Tactic.Ring
1313

1414
/-!
1515
# IMO 1998 Q2
16+
1617
In a competition, there are `a` contestants and `b` judges, where `b ≥ 3` is an odd integer. Each
1718
judge rates each contestant as either "pass" or "fail". Suppose `k` is a number such that, for any
1819
two judges, their ratings coincide for at most `k` contestants. Prove that `k / a ≥ (b - 1) / (2b)`.

Archive/Imo/Imo2001Q6.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import Mathlib.Tactic.LinearCombination
99

1010
/-!
1111
# IMO 2001 Q6
12+
1213
Let $a$, $b$, $c$, $d$ be integers with $a > b > c > d > 0$. Suppose that
1314
1415
$$ a*c + b*d = (a + b - c + d) * (-a + b + c + d). $$

0 commit comments

Comments
 (0)