Skip to content

Commit 6e4ffe9

Browse files
authored
Merge branch 'leanprover-community:master' into main
2 parents 65bfb5c + 3a3edd3 commit 6e4ffe9

882 files changed

Lines changed: 27109 additions & 9453 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/build.in.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -671,16 +671,6 @@ jobs:
671671
lint-bib-file: true
672672
ref: ${{ PR_BRANCH_REF }}
673673

674-
build_and_lint:
675-
name: CI Success
676-
if: FORK_CONDITION
677-
needs: [style_lint, post_steps]
678-
runs-on: ubuntu-latest
679-
steps:
680-
- name: succeed
681-
run: |
682-
echo "Success: Required build and lint checks completed!"
683-
684674
final:
685675
name: Post-CI jobJOB_NAME
686676
if: FORK_CONDITION

.github/workflows/bors.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -681,16 +681,6 @@ jobs:
681681
lint-bib-file: true
682682
ref: ${{ github.sha }}
683683

684-
build_and_lint:
685-
name: CI Success
686-
if: github.repository == 'leanprover-community/mathlib4' || github.repository == 'leanprover-community/mathlib4-nightly-testing'
687-
needs: [style_lint, post_steps]
688-
runs-on: ubuntu-latest
689-
steps:
690-
- name: succeed
691-
run: |
692-
echo "Success: Required build and lint checks completed!"
693-
694684
final:
695685
name: Post-CI job
696686
if: github.repository == 'leanprover-community/mathlib4' || github.repository == 'leanprover-community/mathlib4-nightly-testing'

.github/workflows/build.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -688,16 +688,6 @@ jobs:
688688
lint-bib-file: true
689689
ref: ${{ github.sha }}
690690

691-
build_and_lint:
692-
name: CI Success
693-
if: github.repository == 'leanprover-community/mathlib4' || github.repository == 'leanprover-community/mathlib4-nightly-testing'
694-
needs: [style_lint, post_steps]
695-
runs-on: ubuntu-latest
696-
steps:
697-
- name: succeed
698-
run: |
699-
echo "Success: Required build and lint checks completed!"
700-
701691
final:
702692
name: Post-CI job
703693
if: github.repository == 'leanprover-community/mathlib4' || github.repository == 'leanprover-community/mathlib4-nightly-testing'

.github/workflows/build_fork.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -685,16 +685,6 @@ jobs:
685685
lint-bib-file: true
686686
ref: ${{ github.event.pull_request.head.sha }}
687687

688-
build_and_lint:
689-
name: CI Success
690-
if: github.event.pull_request.head.repo.fork
691-
needs: [style_lint, post_steps]
692-
runs-on: ubuntu-latest
693-
steps:
694-
- name: succeed
695-
run: |
696-
echo "Success: Required build and lint checks completed!"
697-
698688
final:
699689
name: Post-CI job (fork)
700690
if: github.event.pull_request.head.repo.fork

.github/workflows/label_new_contributor.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ name: Label New Contributors
22

33
# Written with ChatGPT: https://chat.openai.com/share/3777ceb1-d722-4705-bacd-ba3f04b387be
44

5-
on: pull_request_target
5+
on:
6+
pull_request_target:
7+
types:
8+
- opened
69

710
# Limit permissions for GITHUB_TOKEN for the entire workflow
811
permissions:
@@ -36,6 +39,10 @@ jobs:
3639
const issues = await github.paginate(opts)
3740
const pullRequestCount = issues.length;
3841
42+
// We could filter out bot users here, with:
43+
// const isBot = (github.rest.users.getByUsername(creator).type === "Bot");
44+
// But we choose to label PRs by new bot contributors as well.
45+
3946
// Determine if the creator has 5 or fewer pull requests
4047
if (pullRequestCount <= 5) {
4148
// Add the "new-contributor" label to the current pull request

.github/workflows/nolints.yml

Lines changed: 14 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
if: github.repository == 'leanprover-community/mathlib4'
1313
steps:
14-
- name: cleanup
15-
run: |
16-
find . -name . -o -prune -exec rm -rf -- {} +
17-
18-
# The Hoskinson runners may not have jq installed, so do that now.
19-
- name: 'Setup jq'
20-
uses: dcarbone/install-jq-action@f0e10f46ff84f4d32178b4b76e1ef180b16f82c3 # v3.1.1
21-
2214
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
23-
with:
24-
## fetch the whole repository, as we want to push to it later
25-
fetch-depth: 0
26-
27-
- name: prune ProofWidgets .lake
28-
run: |
29-
# The ProofWidgets release contains not just the `.js` (which we need in order to build)
30-
# but also `.oleans`, which may have been built with the wrong toolchain.
31-
# This removes them.
32-
# See discussion at https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/nightly-testing/near/411225235
33-
rm -rf .lake/packages/proofwidgets/.lake/build/lib
34-
rm -rf .lake/packages/proofwidgets/.lake/build/ir
3515

3616
- name: Configure Lean
3717
uses: leanprover/lean-action@f807b338d95de7813c5c50d018f1c23c9b93b4ec # 2025-04-24
@@ -40,31 +20,22 @@ jobs:
4020
use-github-cache: false
4121
use-mathlib-cache: true
4222

43-
- name: build mathlib
44-
id: build
45-
uses: leanprover-community/gh-problem-matcher-wrap@20007cb926a46aa324653a387363b52f07709845 # 2025-04-23
46-
with:
47-
linters: lean
48-
run: |
49-
bash -o pipefail -c "env LEAN_ABORT_ON_PANIC=1 lake build --wfail -KCI"
50-
5123
- name: update nolints.json
5224
shell: bash
5325
run: |
5426
env LEAN_ABORT_ON_PANIC=1 lake exe runLinter --update Mathlib
5527
56-
- name: configure git setup
57-
run: |
58-
git remote add origin-bot "https://leanprover-community-bot:${{ secrets.UPDATE_NOLINTS_TOKEN }}@github.com/leanprover-community/mathlib4.git"
59-
git config user.email "leanprover.community@gmail.com"
60-
git config user.name "leanprover-community-bot"
61-
62-
# By default, github actions overrides the credentials used to access any
63-
# github url so that it uses the github-actions[bot] user. We want to access
64-
# github using a different username.
65-
git config --unset http.https://github.com/.extraheader
66-
67-
- name: file a new PR to update nolints.json
68-
run: ./scripts/update_nolints_CI.sh
69-
env:
70-
DEPLOY_GITHUB_TOKEN: ${{ secrets.UPDATE_NOLINTS_TOKEN }}
28+
- name: Create Pull Request
29+
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
30+
with:
31+
token: "${{ secrets.UPDATE_NOLINTS_TOKEN }}"
32+
author: "leanprover-community-bot <leanprover.community@gmail.com>"
33+
commit-message: "chore(scripts): update nolints.json"
34+
branch: "nolints"
35+
base: master
36+
title: "chore(scripts): update nolints.json"
37+
body: |
38+
I am happy to remove some nolints for you!
39+
40+
[workflow run for this PR](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
41+
labels: "auto-merge-after-CI"

.github/workflows/update_dependencies.yml

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ jobs:
99
update-dependencies:
1010
runs-on: ubuntu-latest
1111
if: github.repository == 'leanprover-community/mathlib4'
12+
env:
13+
BRANCH_NAME: "update-dependencies-bot-use-only"
1214
steps:
1315
- name: Checkout repository
1416
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -23,13 +25,28 @@ jobs:
2325
use-github-cache: false
2426
use-mathlib-cache: false
2527

28+
- name: Get branch SHA if it exists
29+
id: get-branch-sha
30+
run: |
31+
# Check if the branch exists remotely
32+
if git fetch origin "$BRANCH_NAME"; then
33+
SHA=$(git rev-parse "origin/$BRANCH_NAME")
34+
echo "Branch '$BRANCH_NAME' exists with SHA: $SHA"
35+
echo "sha=$SHA" >> "${GITHUB_OUTPUT}"
36+
else
37+
echo "Branch '$BRANCH_NAME' does not exist"
38+
echo "sha=" >>" ${GITHUB_OUTPUT}"
39+
fi
40+
2641
- name: Get PR and labels
42+
if: ${{ steps.get-branch-sha.outputs.sha != '' }}
2743
id: PR # all the steps below are skipped if 'ready-to-merge' is in the list of labels found here
2844
uses: 8BitJonny/gh-get-current-pr@4056877062a1f3b624d5d4c2bedefa9cf51435c9 # 4.0.0
2945
# TODO: this may not work properly if the same commit is pushed to multiple branches:
3046
# https://github.com/8BitJonny/gh-get-current-pr/issues/8
3147
with:
3248
github-token: ${{ secrets.GITHUB_TOKEN }}
49+
sha: ${{ steps.get-branch-sha.outputs.sha }}
3350
# Only return if PR is still open
3451
filterOutClosed: true
3552

@@ -40,12 +57,6 @@ jobs:
4057
prNumber: ${{ steps.PR.outputs.number }}
4158
prUrl: ${{ steps.PR.outputs.pr_url }}
4259

43-
- name: Configure Git User
44-
if: ${{ !contains(steps.PR.outputs.pr_labels, 'ready-to-merge') }}
45-
run: |
46-
git config user.name "leanprover-community-mathlib4-bot"
47-
git config user.email "leanprover-community-mathlib4-bot@users.noreply.github.com"
48-
4960
- name: Update dependencies
5061
if: ${{ !contains(steps.PR.outputs.pr_labels, 'ready-to-merge') }}
5162
run: lake update -v
@@ -61,22 +72,44 @@ jobs:
6172
echo "toolchain_modified=false" >> "$GITHUB_OUTPUT"
6273
fi
6374
64-
- name: Generate PR title
75+
- name: Check if lake-manifest.json was modified
6576
if: ${{ !contains(steps.PR.outputs.pr_labels, 'ready-to-merge') && steps.check_toolchain.outputs.toolchain_modified != 'true' }}
77+
id: check_manifest
78+
run: |
79+
if [ -n "${{ steps.get-branch-sha.outputs.sha }}" ]; then
80+
# Branch exists, compare the file
81+
if git diff --quiet "origin/$BRANCH_NAME" -- lake-manifest.json; then
82+
echo "has_diff=false" >> "${GITHUB_OUTPUT}"
83+
echo "No differences in lake-manifest.json"
84+
else
85+
echo "has_diff=true" >> "${GITHUB_OUTPUT}"
86+
echo "Differences found in lake-manifest.json"
87+
fi
88+
else
89+
# Branch doesn't exist, consider it as different
90+
echo "has_diff=true" >> "${GITHUB_OUTPUT}"
91+
echo "Branch does not exist, treating as different"
92+
fi
93+
94+
- name: Generate PR title
95+
if: ${{ !contains(steps.PR.outputs.pr_labels, 'ready-to-merge') && steps.check_manifest.outputs.has_diff == 'true' }}
6696
run: |
6797
echo "timestamp=$(date -u +"%Y-%m-%d-%H-%M")" >> "$GITHUB_ENV"
6898
echo "pr_title=chore: update Mathlib dependencies $(date -u +"%Y-%m-%d")" >> "$GITHUB_ENV"
6999
70100
- name: Create Pull Request
71-
if: ${{ !contains(steps.PR.outputs.pr_labels, 'ready-to-merge') && steps.check_toolchain.outputs.toolchain_modified != 'true' }}
101+
if: ${{ !contains(steps.PR.outputs.pr_labels, 'ready-to-merge') && steps.check_manifest.outputs.has_diff == 'true' }}
72102
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
73103
with:
74104
token: "${{ secrets.UPDATE_DEPENDENCIES_TOKEN }}"
75105
author: "leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com>"
76106
commit-message: "chore: update Mathlib dependencies ${{ env.timestamp }}"
77107
# this branch is referenced in update_dependencies_zulip.yml
78-
branch: "update-dependencies-bot-use-only"
108+
branch: ${{ env.BRANCH_NAME }}
79109
base: master
80110
title: "${{ env.pr_title }}"
81-
body: "This PR updates the Mathlib dependencies."
111+
body: |
112+
This PR updates the Mathlib dependencies.
113+
114+
[workflow run for this PR](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
82115
labels: "auto-merge-after-CI"

Archive/Arithcc.lean

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,13 @@ protected theorem StateEq.refl (t : Register) (ζ : State) : ζ ≃[t] ζ := by
209209

210210
@[symm]
211211
protected theorem StateEq.symm {t : Register} (ζ₁ ζ₂ : State) : ζ₁ ≃[t] ζ₂ → ζ₂ ≃[t] ζ₁ := by
212-
simp [StateEq]; intros
212+
simp only [StateEq, and_imp]; intros
213213
constructor <;> (symm; assumption)
214214

215215
@[trans]
216216
protected theorem StateEq.trans {t : Register} (ζ₁ ζ₂ ζ₃ : State) :
217217
ζ₁ ≃[t] ζ₂ → ζ₂ ≃[t] ζ₃ → ζ₁ ≃[t] ζ₃ := by
218-
simp [StateEq]; intros
218+
simp only [StateEq, and_imp]; intros
219219
constructor
220220
· simp_all only
221221
· trans ζ₂ <;> assumption
@@ -227,7 +227,7 @@ instance (t : Register) : Trans (StateEq (t + 1)) (StateEq (t + 1)) (StateEq (t
227227
@[trans]
228228
protected theorem StateEqStateEqRs.trans (t : Register) (ζ₁ ζ₂ ζ₃ : State) :
229229
ζ₁ ≃[t] ζ₂ → ζ₂ ≃[t]/ac ζ₃ → ζ₁ ≃[t]/ac ζ₃ := by
230-
simp [StateEq]; intros
230+
simp only [StateEq, and_imp]; intros
231231
trans ζ₂ <;> assumption
232232

233233
instance (t : Register) : Trans (StateEq (t + 1)) (StateEqRs (t + 1)) (StateEqRs (t + 1)) :=
@@ -236,7 +236,7 @@ instance (t : Register) : Trans (StateEq (t + 1)) (StateEqRs (t + 1)) (StateEqRs
236236
/-- Writing the same value to register `t` gives `≃[t + 1]` from `≃[t]`. -/
237237
theorem stateEq_implies_write_eq {t : Register} {ζ₁ ζ₂ : State} (h : ζ₁ ≃[t] ζ₂) (v : Word) :
238238
write t v ζ₁ ≃[t + 1] write t v ζ₂ := by
239-
simp [StateEq, StateEqRs] at *
239+
simp only [StateEq, StateEqRs, write] at *
240240
constructor; · exact h.1
241241
intro r hr
242242
have hr : r ≤ t := Register.le_of_lt_succ hr
@@ -249,15 +249,15 @@ theorem stateEq_implies_write_eq {t : Register} {ζ₁ ζ₂ : State} (h : ζ₁
249249
/-- Writing the same value to any register preserves `≃[t]/ac`. -/
250250
theorem stateEqRs_implies_write_eq_rs {t : Register} {ζ₁ ζ₂ : State} (h : ζ₁ ≃[t]/ac ζ₂)
251251
(r : Register) (v : Word) : write r v ζ₁ ≃[t]/ac write r v ζ₂ := by
252-
simp [StateEqRs] at *
252+
simp only [StateEqRs, write] at *
253253
intro r' hr'
254254
specialize h r' hr'
255255
congr
256256

257257
/-- `≃[t + 1]` with writing to register `t` implies `≃[t]`. -/
258258
theorem write_eq_implies_stateEq {t : Register} {v : Word} {ζ₁ ζ₂ : State}
259259
(h : ζ₁ ≃[t + 1] write t v ζ₂) : ζ₁ ≃[t] ζ₂ := by
260-
simp [StateEq, StateEqRs] at *
260+
simp only [StateEq, write, StateEqRs] at *
261261
constructor; · exact h.1
262262
intro r hr
263263
obtain ⟨_, h⟩ := h
@@ -313,10 +313,10 @@ theorem compiler_correctness
313313
have hζ₃ : ζ₃ ≃[t + 1] { write t ν₁ η with ac := ν₂ } := calc
314314
ζ₃ = outcome (compile map e_s₂ (t + 1)) ζ₂ := by simp_all
315315
_ ≃[t + 1] { ζ₂ with ac := ν₂ } := by apply e_ih_s₂ <;> assumption
316-
_ ≃[t + 1] { write t ν₁ η with ac := ν₂ } := by simp [StateEq]; apply hζ₂
316+
_ ≃[t + 1] { write t ν₁ η with ac := ν₂ } := by simpa [StateEq]
317317
have hζ₃_ν₂ : ζ₃.ac = ν₂ := by simp_all [StateEq]
318318
have hζ₃_ν₁ : read t ζ₃ = ν₁ := by
319-
simp [StateEq, StateEqRs] at hζ₃ ⊢
319+
simp only [StateEq, StateEqRs, write, read] at hζ₃ ⊢
320320
obtain ⟨_, hζ₃⟩ := hζ₃
321321
specialize hζ₃ t (Register.lt_succ_self _)
322322
simp_all

Archive/Imo/Imo2008Q2.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ theorem imo2008_q2a (x y z : ℝ) (h : x * y * z = 1) (hx : x ≠ 1) (hy : y ≠
4646
x ^ 2 / (x - 1) ^ 2 + y ^ 2 / (y - 1) ^ 2 + z ^ 2 / (z - 1) ^ 21 := by
4747
obtain ⟨a, b, c, ha, hb, hc, rfl, rfl, rfl⟩ := subst_abc h
4848
obtain ⟨m, n, rfl, rfl⟩ : ∃ m n, b = c - m ∧ a = c - m - n := by use c - b, b - a; simp
49-
have hm_ne_zero : m ≠ 0 := by contrapose! hy; simp [field]; assumption
50-
have hn_ne_zero : n ≠ 0 := by contrapose! hx; simp [field]; assumption
49+
have hm_ne_zero : m ≠ 0 := by contrapose! hy; simpa [field]
50+
have hn_ne_zero : n ≠ 0 := by contrapose! hx; simpa [field]
5151
have hmn_ne_zero : m + n ≠ 0 := by contrapose! hz; field_simp; linarith
5252
have hc_sub_sub : c - (c - m - n) = m + n := by abel
5353
rw [ge_iff_le, ← sub_nonneg]

Archive/Imo/Imo2019Q2.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ as `(2 : ℤ) • ∡ _ _ _ = (2 : ℤ) • ∡ _ _ _`.
3434
-/
3535

3636

37-
library_note "IMO geometry formalization conventions"/--
37+
library_note2 «IMO geometry formalization conventions» /--
3838
We apply the following conventions for formalizing IMO geometry problems. A problem is assumed
3939
to take place in the plane unless that is clearly not intended, so it is not required to prove
4040
that the points are coplanar (whether or not that in fact follows from the other conditions).

0 commit comments

Comments
 (0)