Skip to content

Commit fbb59a1

Browse files
committed
Merge branch 'GdeltaLCH' of https://github.com/CoolRmal/mathlib4 into GdeltaLCH
2 parents af71f3e + 2b31092 commit fbb59a1

2,867 files changed

Lines changed: 46516 additions & 20301 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/daily.yml

Lines changed: 149 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -25,33 +25,14 @@ jobs:
2525
runs-on: ubuntu-latest
2626
if: github.repository == 'leanprover-community/mathlib4'
2727
strategy:
28+
fail-fast: false
2829
matrix:
2930
branch_type: [master, nightly]
3031
steps:
3132
# Checkout repository, so that we can fetch tags to decide which branch we want.
3233
- name: Checkout branch or tag
3334
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
3435

35-
# this step needs to be run here while we have `mathlib4` checked out,
36-
# or else `gh run view` will try to look for runs in `mathlib4-nightly-testing`
37-
- name: Get URLs
38-
id: urls
39-
env:
40-
GH_TOKEN: ${{ github.token }}
41-
run: |
42-
# adapted from https://cmbuckley.co.uk/blog/2024/04/09/deep-links-to-github-actions-job-logs/
43-
lean4checker_url=$(gh run view ${{ github.run_id }} --json jobs --jq '
44-
.jobs[] | select(.name == "check-lean4checker (${{ matrix.branch_type }})")
45-
| (.url + (.steps[] | select(.name == "Check environments using lean4checker")
46-
| "#step:\(.number):1"))')
47-
echo "lean4checker_url=$lean4checker_url" | tee -a "$GITHUB_OUTPUT"
48-
49-
mathlib_test_executable_url=$(gh run view ${{ github.run_id }} --json jobs --jq '
50-
.jobs[] | select(.name == "check-lean4checker (${{ matrix.branch_type }})")
51-
| (.url + (.steps[] | select(.name == "Run mathlib_test_executable")
52-
| "#step:\(.number):1"))')
53-
echo "mathlib_test_executable_url=$mathlib_test_executable_url" | tee -a "$GITHUB_OUTPUT"
54-
5536
- name: Fetch latest tags (if nightly)
5637
if: matrix.branch_type == 'nightly'
5738
run: |
@@ -84,7 +65,7 @@ jobs:
8465
use-mathlib-cache: true
8566
reinstall-transient-toolchain: true
8667

87-
- name: Check environments using lean4checker # make sure this name is consistent with "Get URLs"
68+
- name: Check environments using lean4checker # make sure this name is consistent with "Get job status and URLs" in the notify job
8869
id: lean4checker
8970
continue-on-error: true
9071
run: |
@@ -115,14 +96,51 @@ jobs:
11596
# so we explicitly check Batteries as well here.
11697
lake env lean4checker/.lake/build/bin/lean4checker Batteries Mathlib
11798
118-
- name: Run mathlib_test_executable # make sure this name is consistent with "Get URLs"
119-
id: mathlib-test
120-
continue-on-error: true
99+
notify-lean4checker:
100+
runs-on: ubuntu-latest
101+
needs: check-lean4checker
102+
if: github.repository == 'leanprover-community/mathlib4' && always()
103+
strategy:
104+
fail-fast: false
105+
matrix:
106+
branch_type: [master, nightly]
107+
steps:
108+
- name: Checkout repository
109+
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
110+
111+
- name: Get job status and URLs
112+
id: get-status
113+
env:
114+
GH_TOKEN: ${{ github.token }}
121115
run: |
122-
lake exe mathlib_test_executable
116+
JOB_NAME="check-lean4checker (${{ matrix.branch_type }})"
117+
118+
# Get URL to the specific step
119+
LEAN4CHECKER_URL=$(gh run view ${{ github.run_id }} --json jobs --jq \
120+
".jobs[] | select(.name == \"$JOB_NAME\") \
121+
| (.url + (.steps[] | select(.name == \"Check environments using lean4checker\") \
122+
| \"#step:\(.number):1\"))")
123+
124+
echo "lean4checker_url=${LEAN4CHECKER_URL}" | tee -a "$GITHUB_OUTPUT"
125+
126+
- name: Fetch latest tags (if nightly)
127+
if: matrix.branch_type == 'nightly'
128+
run: |
129+
git remote add nightly-testing https://github.com/leanprover-community/mathlib4-nightly-testing.git
130+
git fetch nightly-testing --tags
131+
LATEST_TAG=$(git tag | grep -E "${{ env.TAG_PATTERN }}" | sort -r | head -n 1)
132+
echo "LATEST_TAG=${LATEST_TAG}" | tee -a "$GITHUB_ENV"
133+
134+
- name: Set branch ref
135+
run: |
136+
if [ "${{ matrix.branch_type }}" == "master" ]; then
137+
echo "BRANCH_REF=${{ env.DEFAULT_BRANCH }}" >> "$GITHUB_ENV"
138+
else
139+
echo "BRANCH_REF=${{ env.LATEST_TAG }}" >> "$GITHUB_ENV"
140+
fi
123141
124142
- name: Post success message for lean4checker on Zulip
125-
if: steps.lean4checker.outcome == 'success'
143+
if: needs.check-lean4checker.result == 'success'
126144
uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2
127145
with:
128146
api-key: ${{ secrets.ZULIP_API_KEY }}
@@ -132,37 +150,129 @@ jobs:
132150
type: 'stream'
133151
topic: 'lean4checker'
134152
content: |
135-
✅ lean4checker [succeeded](${{ steps.urls.outputs.lean4checker_url }}) on ${{ github.sha }} (branch: ${{ env.BRANCH_REF }})
153+
✅ lean4checker [succeeded](${{ steps.get-status.outputs.lean4checker_url }}) on ${{ github.sha }} (branch: ${{ env.BRANCH_REF }})
136154
137-
- name: Post success message for mathlib_test_executable on Zulip
138-
if: steps.mathlib-test.outcome == 'success'
155+
- name: Post failure / cancelled message for lean4checker on Zulip
156+
if: needs.check-lean4checker.result != 'success'
139157
uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2
140158
with:
141159
api-key: ${{ secrets.ZULIP_API_KEY }}
142160
email: 'github-mathlib4-bot@leanprover.zulipchat.com'
143161
organization-url: 'https://leanprover.zulipchat.com'
144162
to: 'nightly-testing'
145163
type: 'stream'
146-
topic: 'mathlib test executable'
164+
topic: 'lean4checker failure'
147165
content: |
148-
✅ mathlib_test_executable [succeeded](${{ steps.urls.outputs.mathlib_test_executable_url }}) on ${{ github.sha }} (branch: ${{ env.BRANCH_REF }})
166+
❌ lean4checker [${{ needs.check-lean4checker.result }}](${{ steps.get-status.outputs.lean4checker_url }}) on ${{ github.sha }} (branch: ${{ env.BRANCH_REF }})
167+
168+
check-mathlib_test_executable:
169+
runs-on: ubuntu-latest
170+
if: github.repository == 'leanprover-community/mathlib4'
171+
strategy:
172+
fail-fast: false
173+
matrix:
174+
branch_type: [master, nightly]
175+
steps:
176+
# Checkout repository, so that we can fetch tags to decide which branch we want.
177+
- name: Checkout branch or tag
178+
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
179+
180+
- name: Fetch latest tags (if nightly)
181+
if: matrix.branch_type == 'nightly'
182+
run: |
183+
# When in nightly mode, fetch tags from the nightly-testing repository
184+
git remote add nightly-testing https://github.com/leanprover-community/mathlib4-nightly-testing.git
185+
git fetch nightly-testing --tags
186+
LATEST_TAG=$(git tag | grep -E "${{ env.TAG_PATTERN }}" | sort -r | head -n 1)
187+
echo "LATEST_TAG=${LATEST_TAG}" >> "$GITHUB_ENV"
188+
189+
- name: Set branch ref
190+
run: |
191+
if [ "${{ matrix.branch_type }}" == "master" ]; then
192+
echo "BRANCH_REF=${{ env.DEFAULT_BRANCH }}" >> "$GITHUB_ENV"
193+
else
194+
echo "BRANCH_REF=${{ env.LATEST_TAG }}" >> "$GITHUB_ENV"
195+
fi
196+
197+
# Checkout the branch or tag we want to test.
198+
- name: Checkout branch or tag
199+
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
200+
with:
201+
repository: ${{ matrix.branch_type == 'nightly' && 'leanprover-community/mathlib4-nightly-testing' || github.repository }}
202+
ref: ${{ env.BRANCH_REF }}
203+
204+
- name: Configure Lean
205+
uses: leanprover/lean-action@434f25c2f80ded67bba02502ad3a86f25db50709 # v1.3.0
206+
with:
207+
auto-config: false
208+
use-github-cache: false
209+
use-mathlib-cache: true
210+
reinstall-transient-toolchain: true
211+
212+
- name: Run mathlib_test_executable # make sure this name is consistent with "Get job status and URLs" in the notify job
213+
id: mathlib-test
214+
continue-on-error: true
215+
run: |
216+
lake exe mathlib_test_executable
217+
218+
notify-mathlib_test_executable:
219+
runs-on: ubuntu-latest
220+
needs: check-mathlib_test_executable
221+
if: github.repository == 'leanprover-community/mathlib4' && always()
222+
strategy:
223+
fail-fast: false
224+
matrix:
225+
branch_type: [master, nightly]
226+
steps:
227+
- name: Checkout repository
228+
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
229+
230+
- name: Get job status and URLs
231+
id: get-status
232+
env:
233+
GH_TOKEN: ${{ github.token }}
234+
run: |
235+
JOB_NAME="check-mathlib_test_executable (${{ matrix.branch_type }})"
236+
237+
# Get URL to the specific step
238+
MATHLIB_TEST_EXECUTABLE_URL=$(gh run view ${{ github.run_id }} --json jobs --jq \
239+
".jobs[] | select(.name == \"$JOB_NAME\") \
240+
| (.url + (.steps[] | select(.name == \"Run mathlib_test_executable\") \
241+
| \"#step:\(.number):1\"))")
242+
243+
echo "mathlib_test_executable_url=${MATHLIB_TEST_EXECUTABLE_URL}" | tee -a "$GITHUB_OUTPUT"
244+
245+
- name: Fetch latest tags (if nightly)
246+
if: matrix.branch_type == 'nightly'
247+
run: |
248+
git remote add nightly-testing https://github.com/leanprover-community/mathlib4-nightly-testing.git
249+
git fetch nightly-testing --tags
250+
LATEST_TAG=$(git tag | grep -E "${{ env.TAG_PATTERN }}" | sort -r | head -n 1)
251+
echo "LATEST_TAG=${LATEST_TAG}" | tee -a "$GITHUB_ENV"
252+
253+
- name: Set branch ref
254+
run: |
255+
if [ "${{ matrix.branch_type }}" == "master" ]; then
256+
echo "BRANCH_REF=${{ env.DEFAULT_BRANCH }}" >> "$GITHUB_ENV"
257+
else
258+
echo "BRANCH_REF=${{ env.LATEST_TAG }}" >> "$GITHUB_ENV"
259+
fi
149260
150-
- name: Post failure message for lean4checker on Zulip
151-
if: steps.lean4checker.outcome == 'failure'
261+
- name: Post success message for mathlib_test_executable on Zulip
262+
if: needs.check-mathlib_test_executable.result == 'success'
152263
uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2
153264
with:
154265
api-key: ${{ secrets.ZULIP_API_KEY }}
155266
email: 'github-mathlib4-bot@leanprover.zulipchat.com'
156267
organization-url: 'https://leanprover.zulipchat.com'
157268
to: 'nightly-testing'
158269
type: 'stream'
159-
topic: 'lean4checker failure'
270+
topic: 'mathlib test executable'
160271
content: |
161-
❌ lean4checker [failed](${{ steps.urls.outputs.lean4checker_url }}) on ${{ github.sha }} (branch: ${{ env.BRANCH_REF }})
162-
continue-on-error: true
272+
✅ mathlib_test_executable [succeeded](${{ steps.get-status.outputs.mathlib_test_executable_url }}) on ${{ github.sha }} (branch: ${{ env.BRANCH_REF }})
163273
164-
- name: Post failure message for mathlib_test_executable on Zulip
165-
if: steps.mathlib-test.outcome == 'failure'
274+
- name: Post failure / cancelled message for mathlib_test_executable on Zulip
275+
if: needs.check-mathlib_test_executable.result != 'success'
166276
uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2
167277
with:
168278
api-key: ${{ secrets.ZULIP_API_KEY }}
@@ -172,5 +282,4 @@ jobs:
172282
type: 'stream'
173283
topic: 'mathlib test executable failure'
174284
content: |
175-
❌ mathlib_test_executable [failed](${{ steps.urls.outputs.mathlib_test_executable_url }}) on ${{ github.sha }} (branch: ${{ env.BRANCH_REF }})
176-
continue-on-error: true
285+
❌ mathlib_test_executable [${{ needs.check-mathlib_test_executable.result }}](${{ steps.get-status.outputs.mathlib_test_executable_url }}) on ${{ github.sha }} (branch: ${{ env.BRANCH_REF }})

.github/workflows/discover-lean-pr-testing.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ jobs:
1818
with:
1919
ref: nightly-testing
2020
fetch-depth: 0 # Fetch all branches
21+
token: ${{ secrets.NIGHTLY_TESTING }}
2122

2223
- name: Set up Git
2324
run: |
24-
git config --global user.name "github-actions"
25-
git config --global user.email "github-actions@github.com"
25+
git config --global user.name "leanprover-community-mathlib4-bot"
26+
git config --global user.email "leanprover-community-mathlib4-bot@users.noreply.github.com"
2627
2728
- name: Configure Lean
2829
uses: leanprover/lean-action@434f25c2f80ded67bba02502ad3a86f25db50709 # v1.3.0

.github/workflows/maintainer_merge.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,12 @@ jobs:
2929
EVENT_NAME: ${{ github.event_name }}
3030
name: Ping maintainers on Zulip
3131
runs-on: ubuntu-latest
32-
if: github.repository == 'leanprover-community/mathlib4'
32+
if: >- # crude check to skip running this on most reviews / comments
33+
github.repository == 'leanprover-community/mathlib4' &&
34+
(
35+
contains(format('{0}{1}', github.event.comment.body, github.event.review.body), 'maintainer merge') ||
36+
contains(format('{0}{1}', github.event.comment.body, github.event.review.body), 'maintainer delegate')
37+
)
3338
steps:
3439
- name: Find maintainer merge/delegate
3540
id: merge_or_delegate

Archive.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ import Archive.Imo.Imo2024Q2
5757
import Archive.Imo.Imo2024Q3
5858
import Archive.Imo.Imo2024Q5
5959
import Archive.Imo.Imo2024Q6
60+
import Archive.Imo.Imo2025Q3
6061
import Archive.Kuratowski
6162
import Archive.MiuLanguage.Basic
6263
import Archive.MiuLanguage.DecisionNec
@@ -74,7 +75,6 @@ import Archive.Wiedijk100Theorems.FriendshipGraphs
7475
import Archive.Wiedijk100Theorems.HeronsFormula
7576
import Archive.Wiedijk100Theorems.InverseTriangleSum
7677
import Archive.Wiedijk100Theorems.Konigsberg
77-
import Archive.Wiedijk100Theorems.Partition
7878
import Archive.Wiedijk100Theorems.PerfectNumbers
7979
import Archive.Wiedijk100Theorems.SolutionOfCubicQuartic
8080
import Archive.Wiedijk100Theorems.SumOfPrimeReciprocalsDiverges

Archive/Examples/MersennePrimes.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Mathlib.NumberTheory.LucasLehmer
1010
1111
We run some Lucas-Lehmer tests to prove the first Mersenne primes are prime.
1212
13-
See the discussion at the end of [Mathlib/NumberTheory/LucasLehmer.lean]
13+
See the discussion at the end of `Mathlib/NumberTheory/LucasLehmer.lean`
1414
for ideas about extending this to larger Mersenne primes.
1515
-/
1616

Archive/Imo/Imo1960Q1.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ theorem ge_100 {n : ℕ} (h1 : ProblemPredicate n) : 100 ≤ n := by
4545
rw [← h1.left]
4646
refine Nat.base_pow_length_digits_le 10 n ?_ (not_zero h1)
4747
simp
48-
omega
48+
lia
4949

5050
theorem lt_1000 {n : ℕ} (h1 : ProblemPredicate n) : n < 1000 := by
5151
have h2 : n < 10 ^ 3 := by
5252
rw [← h1.left]
5353
refine Nat.lt_base_pow_length_digits ?_
5454
simp
55-
omega
55+
lia
5656

5757
/-
5858
We do an exhaustive search to show that all results are covered by `SolutionPredicate`.
@@ -70,7 +70,7 @@ theorem searchUpTo_step {c n} (H : SearchUpTo c n) {c' n'} (ec : c + 1 = c') (en
7070
refine ⟨by ring, fun m l p => ?_⟩
7171
obtain ⟨h₁, ⟨m, rfl⟩, h₂⟩ := id p
7272
by_cases h : 11 * m < c * 11; · exact H _ h p
73-
obtain rfl : m = c := by omega
73+
obtain rfl : m = c := by lia
7474
rw [Nat.mul_div_cancel_left _ (by simp : 11 > 0), mul_comm] at h₂
7575
refine (H' h₂).imp ?_ ?_ <;> · rintro rfl; norm_num
7676

Archive/Imo/Imo1962Q1.lean

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,31 +53,31 @@ Now we can eliminate possibilities for `(digits 10 c).length` until we get to th
5353
lemma case_0_digits {c n : ℕ} (hc : (digits 10 c).length = 0) : ¬ProblemPredicate' c n := by
5454
intro hpp
5555
have hpow : 6 * 10 ^ 0 = 6 * 10 ^ (digits 10 c).length := by rw [hc]
56-
omega
56+
lia
5757

5858
lemma case_1_digits {c n : ℕ} (hc : (digits 10 c).length = 1) : ¬ProblemPredicate' c n := by
5959
intro hpp
6060
have hpow : 6 * 10 ^ 1 = 6 * 10 ^ (digits 10 c).length := by rw [hc]
61-
omega
61+
lia
6262

6363
lemma case_2_digits {c n : ℕ} (hc : (digits 10 c).length = 2) : ¬ProblemPredicate' c n := by
6464
intro hpp
6565
have hpow : 6 * 10 ^ 2 = 6 * 10 ^ (digits 10 c).length := by rw [hc]
66-
omega
66+
lia
6767

6868
lemma case_3_digits {c n : ℕ} (hc : (digits 10 c).length = 3) : ¬ProblemPredicate' c n := by
6969
intro hpp
7070
have hpow : 6 * 10 ^ 3 = 6 * 10 ^ (digits 10 c).length := by rw [hc]
71-
omega
71+
lia
7272

7373
lemma case_4_digits {c n : ℕ} (hc : (digits 10 c).length = 4) : ¬ProblemPredicate' c n := by
7474
intro hpp
7575
have hpow : 6 * 10 ^ 4 = 6 * 10 ^ (digits 10 c).length := by rw [hc]
76-
omega
76+
lia
7777

7878
/-- Putting this inline causes a deep recursion error, so we separate it out. -/
7979
private lemma helper_5_digits {c : ℤ} (hc : 6 * 10 ^ 5 + c = 4 * (10 * c + 6)) : c = 15384 := by
80-
omega
80+
lia
8181

8282
lemma case_5_digits {c n : ℕ} (hc : (digits 10 c).length = 5) (hpp : ProblemPredicate' c n) :
8383
c = 15384 := by

0 commit comments

Comments
 (0)