Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
YnirPaz committed Oct 13, 2024
2 parents 18b14b1 + 3d44cf1 commit 5c9cb52
Show file tree
Hide file tree
Showing 1,786 changed files with 39,348 additions and 15,216 deletions.
9 changes: 5 additions & 4 deletions .github/build.in.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ jobs:
run: |
rm -rf .lake/build/lib/Mathlib/
# Fail quickly if the cache is completely cold, by checking for Mathlib.Init
lake exe cache get Mathlib.Init
lake build --no-build Mathlib.Init && lake exe cache get || echo "No cache for 'Mathlib.Init' available"
lake exe cache get #Mathlib.Init
#lake build --no-build Mathlib.Init && lake exe cache get || echo "No cache for 'Mathlib.Init' available"
- name: update {Mathlib, Tactic, Counterexamples, Archive}.lean
id: mk_all
Expand Down Expand Up @@ -278,7 +278,7 @@ jobs:
# Output is posted to the zulip topic
# https://leanprover.zulipchat.com/#narrow/stream/345428-mathlib-reviewers/topic/lean4checker

- name: Post comments for lean-pr-testing branch
- name: Post comments for lean-pr-testing-NNNN and batteries-pr-testing-NNNN branches
if: always()
env:
TOKEN: ${{ secrets.LEAN_PR_TESTING }}
Expand All @@ -291,7 +291,8 @@ jobs:
LINT_OUTCOME: ${{ steps.lint.outcome }}
TEST_OUTCOME: ${{ steps.test.outcome }}
run: |
scripts/lean-pr-testing-comments.sh
scripts/lean-pr-testing-comments.sh lean
scripts/lean-pr-testing-comments.sh batteries
final:
name: Post-CI jobJOB_NAME
Expand Down
19 changes: 17 additions & 2 deletions .github/workflows/PR_summary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,27 @@ jobs:
PR="${{ github.event.pull_request.number }}"
title="### PR summary"
graphAndHighPercentReports=$(python ./scripts/import-graph-report.py base.json head.json changed_files.txt)
## Import count comment
importCount=$(
python ./scripts/import-graph-report.py base.json head.json changed_files.txt
printf '%s\n' "${graphAndHighPercentReports}" | sed '/^Import changes exceeding/Q'
./scripts/import_trans_difference.sh
)
## High percentage imports
high_percentages=$(
printf '%s\n' "${graphAndHighPercentReports}" | sed -n '/^Import changes exceeding/,$p'
)
# if there are files with large increase in transitive imports, then we add the `large-import` label
if [ -n "${high_percentages}" ]
then
high_percentages=$'\n\n'"${high_percentages}"
gh pr edit "${PR}" --add-label large-import
else # otherwise, we remove the label
gh pr edit "${PR}" --remove-label large-import
fi
if [ "$(printf '%s' "${importCount}" | wc -l)" -gt 12 ]
then
importCount="$(printf '<details><summary>\n\n%s\n\n</summary>\n\n%s\n\n</details>\n' "#### Import changes for modified files" "${importCount}")"
Expand All @@ -80,6 +95,6 @@ jobs:
currentHash="$(git rev-parse HEAD)"
hashURL="https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }}/commits/${currentHash}"
message="$(printf '%s [%s](%s)\n\n%s\n\n---\n\n%s\n' "${title}" "$(git rev-parse --short HEAD)" "${hashURL}" "${importCount}" "${declDiff}")"
message="$(printf '%s [%s](%s)%s\n\n%s\n\n---\n\n%s\n' "${title}" "$(git rev-parse --short HEAD)" "${hashURL}" "${high_percentages}" "${importCount}" "${declDiff}")"
./scripts/update_PR_comment.sh "${message}" "${title}" "${PR}"
42 changes: 42 additions & 0 deletions .github/workflows/add_label_from_diff.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Autolabel PRs

on:
pull_request:
types: [opened]
push:
paths:
- scripts/autolabel.lean
- .github/workflows/add_label_from_diff.yaml

jobs:
add_topic_label:
name: Add topic label
runs-on: ubuntu-latest
# Don't run on forks, where we wouldn't have permissions to add the label anyway.
if: github.repository == 'leanprover-community/mathlib4'
permissions:
issues: write
checks: write
pull-requests: write
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: install elan
run: |
set -o pipefail
curl -sSfL https://github.com/leanprover/elan/releases/download/v3.1.1/elan-x86_64-unknown-linux-gnu.tar.gz | tar xz
./elan-init -y --default-toolchain none
echo "$HOME/.elan/bin" >> "${GITHUB_PATH}"
- name: lake exe autolabel
run: |
# the checkout dance, to avoid a detached head
git checkout master
git checkout -
lake exe autolabel "$NUMBER"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
NUMBER: ${{ github.event.number }}
9 changes: 5 additions & 4 deletions .github/workflows/bors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ jobs:
run: |
rm -rf .lake/build/lib/Mathlib/
# Fail quickly if the cache is completely cold, by checking for Mathlib.Init
lake exe cache get Mathlib.Init
lake build --no-build Mathlib.Init && lake exe cache get || echo "No cache for 'Mathlib.Init' available"
lake exe cache get #Mathlib.Init
#lake build --no-build Mathlib.Init && lake exe cache get || echo "No cache for 'Mathlib.Init' available"
- name: update {Mathlib, Tactic, Counterexamples, Archive}.lean
id: mk_all
Expand Down Expand Up @@ -288,7 +288,7 @@ jobs:
# Output is posted to the zulip topic
# https://leanprover.zulipchat.com/#narrow/stream/345428-mathlib-reviewers/topic/lean4checker

- name: Post comments for lean-pr-testing branch
- name: Post comments for lean-pr-testing-NNNN and batteries-pr-testing-NNNN branches
if: always()
env:
TOKEN: ${{ secrets.LEAN_PR_TESTING }}
Expand All @@ -301,7 +301,8 @@ jobs:
LINT_OUTCOME: ${{ steps.lint.outcome }}
TEST_OUTCOME: ${{ steps.test.outcome }}
run: |
scripts/lean-pr-testing-comments.sh
scripts/lean-pr-testing-comments.sh lean
scripts/lean-pr-testing-comments.sh batteries
final:
name: Post-CI job
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ jobs:
run: |
rm -rf .lake/build/lib/Mathlib/
# Fail quickly if the cache is completely cold, by checking for Mathlib.Init
lake exe cache get Mathlib.Init
lake build --no-build Mathlib.Init && lake exe cache get || echo "No cache for 'Mathlib.Init' available"
lake exe cache get #Mathlib.Init
#lake build --no-build Mathlib.Init && lake exe cache get || echo "No cache for 'Mathlib.Init' available"
- name: update {Mathlib, Tactic, Counterexamples, Archive}.lean
id: mk_all
Expand Down Expand Up @@ -295,7 +295,7 @@ jobs:
# Output is posted to the zulip topic
# https://leanprover.zulipchat.com/#narrow/stream/345428-mathlib-reviewers/topic/lean4checker

- name: Post comments for lean-pr-testing branch
- name: Post comments for lean-pr-testing-NNNN and batteries-pr-testing-NNNN branches
if: always()
env:
TOKEN: ${{ secrets.LEAN_PR_TESTING }}
Expand All @@ -308,7 +308,8 @@ jobs:
LINT_OUTCOME: ${{ steps.lint.outcome }}
TEST_OUTCOME: ${{ steps.test.outcome }}
run: |
scripts/lean-pr-testing-comments.sh
scripts/lean-pr-testing-comments.sh lean
scripts/lean-pr-testing-comments.sh batteries
final:
name: Post-CI job
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/build_fork.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ jobs:
run: |
rm -rf .lake/build/lib/Mathlib/
# Fail quickly if the cache is completely cold, by checking for Mathlib.Init
lake exe cache get Mathlib.Init
lake build --no-build Mathlib.Init && lake exe cache get || echo "No cache for 'Mathlib.Init' available"
lake exe cache get #Mathlib.Init
#lake build --no-build Mathlib.Init && lake exe cache get || echo "No cache for 'Mathlib.Init' available"
- name: update {Mathlib, Tactic, Counterexamples, Archive}.lean
id: mk_all
Expand Down Expand Up @@ -292,7 +292,7 @@ jobs:
# Output is posted to the zulip topic
# https://leanprover.zulipchat.com/#narrow/stream/345428-mathlib-reviewers/topic/lean4checker

- name: Post comments for lean-pr-testing branch
- name: Post comments for lean-pr-testing-NNNN and batteries-pr-testing-NNNN branches
if: always()
env:
TOKEN: ${{ secrets.LEAN_PR_TESTING }}
Expand All @@ -305,7 +305,8 @@ jobs:
LINT_OUTCOME: ${{ steps.lint.outcome }}
TEST_OUTCOME: ${{ steps.test.outcome }}
run: |
scripts/lean-pr-testing-comments.sh
scripts/lean-pr-testing-comments.sh lean
scripts/lean-pr-testing-comments.sh batteries
final:
name: Post-CI job (fork)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lean4checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
run: |
git clone https://github.com/leanprover/lean4checker
cd lean4checker
git checkout v4.12.0-rc1
git checkout v4.13.0-rc3
# Now that the git hash is embedded in each olean,
# we need to compile lean4checker on the same toolchain
cp ../lean-toolchain .
Expand Down
32 changes: 11 additions & 21 deletions .github/workflows/nightly_detect_failure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
topic: 'Mathlib status updates'
content: |
❌ The latest CI for Mathlib's branch#nightly-testing has [failed](https://github.com/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}) ([${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})).
You can `git fetch; git checkout nightly-testing` and push a fix.
handle_success:
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'nightly-testing' }}
Expand Down Expand Up @@ -210,26 +211,15 @@ jobs:
bump_branch_suffix = bump_branch.replace('bump/', '')
payload = f"🛠️: it looks like it's time to create a new bump/nightly-{current_version} branch from nightly-testing (specifically {sha}), and then PR that to {bump_branch}. "
payload += "To do so semi-automatically, run the following script from mathlib root:\n\n"
payload += f"```bash\n./scripts/create-adaptation-pr.sh {bump_branch_suffix} {current_version}\n```\n"
# Only post if the message is different
# We compare the first 160 characters, since that includes the date and bump version
if not messages or messages[0]['content'][:160] != payload[:160]:
# Log messages, because the bot seems to repeat itself...
if messages:
print("###### Last message:")
print(messages[0]['content'])
print("###### Current message:")
print(payload)
else:
print('The strings match!')
# Post the reminder message
request = {
'type': 'stream',
'to': 'nightly-testing',
'topic': 'Mathlib bump branch reminders',
'content': payload
}
result = client.send_message(request)
print(result)
payload += f"```bash\n./scripts/create-adaptation-pr.sh --bumpversion={bump_branch_suffix} --nightlydate={current_version} --nightlysha={sha}\n```\n"
# Post the reminder message
request = {
'type': 'stream',
'to': 'nightly-testing',
'topic': 'Mathlib bump branch reminders',
'content': payload
}
result = client.send_message(request)
print(result)
else:
print('No action needed.')
2 changes: 1 addition & 1 deletion .github/workflows/update_dependencies_zulip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
});
}
} else {
output += "No PR found for this run!";
output += "No PR found for this run! If you are feeling impatient and have write access, please go to the following page and click the "Run workflow" button!\nhttps://github.com/leanprover-community/mathlib4/actions/workflows/update_dependencies.yml";
}
return output;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
{
"Deprecation for mathlib": {
"scope": "lean4",
"prefix": "deprecated",
"body": [
"@[deprecated $1 (since := \"${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE}\")]"
]
},
"Deprecated alias for mathlib": {
"scope": "lean4",
"prefix": "deprecated alias",
Expand Down
2 changes: 1 addition & 1 deletion Archive/Examples/IfNormalization/Result.lean
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ We don't want a `simp` lemma for `(ite i t e).eval` in general, only once we kno
`e` to the literal booleans given by `l` -/
def normalize (l : AList (fun _ : ℕ => Bool)) :
(e : IfExpr) → { e' : IfExpr //
(∀ f, e'.eval f = e.eval (fun w => (l.lookup w).elim (f w) (fun b => b)))
(∀ f, e'.eval f = e.eval (fun w => (l.lookup w).elim (f w) id))
∧ e'.normalized
∧ ∀ (v : ℕ), v ∈ vars e' → l.lookup v = none }
| lit b => ⟨lit b, ◾⟩
Expand Down
12 changes: 6 additions & 6 deletions Archive/Examples/IfNormalization/WithoutAesop.lean
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ theorem eval_ite_ite' {a b c d e : IfExpr} {f : ℕ → Bool} :
`e` to the literal booleans given by `l` -/
def normalize' (l : AList (fun _ : ℕ => Bool)) :
(e : IfExpr) → { e' : IfExpr //
(∀ f, e'.eval f = e.eval (fun w => (l.lookup w).elim (f w) (fun b => b)))
(∀ f, e'.eval f = e.eval (fun w => (l.lookup w).elim (f w) id))
∧ e'.normalized
∧ ∀ (v : ℕ), v ∈ vars e' → l.lookup v = none }
| lit b => ⟨lit b, by simp⟩
Expand Down Expand Up @@ -92,8 +92,8 @@ def normalize' (l : AList (fun _ : ℕ => Bool)) :
· simp_all
· have := ht₃ v
have := he₃ v
simp_all? says simp_all only [normalized, Bool.and_eq_true, Bool.not_eq_true',
AList.lookup_insert_eq_none, ne_eq, AList.lookup_insert]
simp_all? says simp_all only [normalized, Bool.and_eq_true, Bool.not_eq_eq_eq_not,
Bool.not_true, AList.lookup_insert_eq_none, ne_eq, AList.lookup_insert]
obtain ⟨⟨⟨tn, tc⟩, tr⟩, td⟩ := ht₂
split <;> rename_i h'
· subst h'
Expand All @@ -103,9 +103,9 @@ def normalize' (l : AList (fun _ : ℕ => Bool)) :
have := he₃ w
by_cases h : w = v
· subst h; simp_all
· simp_all? says simp_all only [normalized, Bool.and_eq_true, Bool.not_eq_true',
AList.lookup_insert_eq_none, ne_eq, not_false_eq_true, AList.lookup_insert_ne,
implies_true]
· simp_all? says simp_all only [normalized, Bool.and_eq_true, Bool.not_eq_eq_eq_not,
Bool.not_true, AList.lookup_insert_eq_none, ne_eq, not_false_eq_true,
AList.lookup_insert_ne, implies_true]
obtain ⟨⟨⟨en, ec⟩, er⟩, ed⟩ := he₂
split at b <;> rename_i h'
· subst h'; simp_all
Expand Down
2 changes: 1 addition & 1 deletion Archive/Hairer.lean
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ lemma inj_L : Injective (L ι) :=
fun g hg _h2g g_supp ↦ by
simpa [mul_comm (g _), L] using congr($hp ⟨g, g_supp.trans ball_subset_closedBall, hg⟩)
simp_rw [MvPolynomial.funext_iff, map_zero]
refine fun x ↦ AnalyticOn.eval_linearMap (EuclideanSpace.equiv ι ℝ).toLinearMap p
refine fun x ↦ AnalyticOnNhd.eval_linearMap (EuclideanSpace.equiv ι ℝ).toLinearMap p
|>.eqOn_zero_of_preconnected_of_eventuallyEq_zero
(preconnectedSpace_iff_univ.mp inferInstance) (z₀ := 0) trivial
(Filter.mem_of_superset (Metric.ball_mem_nhds 0 zero_lt_one) ?_) trivial
Expand Down
2 changes: 1 addition & 1 deletion Archive/Imo/Imo1962Q1.lean
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ lemma case_more_digits {c n : ℕ} (hc : (digits 10 c).length ≥ 6) (hpp : Prob
calc
n ≥ 10 * c := le.intro hpp.left.symm
_ ≥ 10 ^ (digits 10 c).length := base_pow_length_digits_le 10 c (by decide) hnz
_ ≥ 10 ^ 6 := pow_le_pow_right (by decide) hc
_ ≥ 10 ^ 6 := pow_right_mono₀ (by decide) hc
_ ≥ 153846 := by norm_num

/-!
Expand Down
4 changes: 2 additions & 2 deletions Archive/Imo/Imo1972Q5.lean
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ theorem imo1972_q5 (f g : ℝ → ℝ) (hf1 : ∀ x, ∀ y, f (x + y) + f (x - y
calc
0 < ‖f x‖ := norm_pos_iff.mpr hx
_ ≤ k := hk₁ x
rw [div_lt_iff]
rw [div_lt_iff]
· apply lt_mul_of_one_lt_right h₁ hneg
· exact zero_lt_one.trans hneg
-- Demonstrate that `k ≤ k'` using `hk₂`.
Expand Down Expand Up @@ -87,7 +87,7 @@ theorem imo1972_q5' (f g : ℝ → ℝ) (hf1 : ∀ x, ∀ y, f (x + y) + f (x -
have h : ∀ x, ‖f x‖ ≤ k := le_ciSup hf2
have hgy : 0 < ‖g y‖ := by linarith
have k_pos : 0 < k := lt_of_lt_of_le (norm_pos_iff.mpr hx) (h x)
have : k / ‖g y‖ < k := (div_lt_iff hgy).mpr (lt_mul_of_one_lt_right k_pos H)
have : k / ‖g y‖ < k := (div_lt_iff hgy).mpr (lt_mul_of_one_lt_right k_pos H)
have : k ≤ k / ‖g y‖ := by
suffices ∀ x, ‖f x‖ ≤ k / ‖g y‖ from ciSup_le this
intro x
Expand Down
2 changes: 1 addition & 1 deletion Archive/Imo/Imo1986Q5.lean
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ theorem map_of_lt_two (hx : x < 2) : f x = 2 / (2 - x) := by
have hx' : 0 < 2 - x := tsub_pos_of_lt hx
have hfx : f x ≠ 0 := hf.map_ne_zero_iff.2 hx
apply le_antisymm
· rw [le_div_iff₀ hx', ← NNReal.le_div_iff' hfx, tsub_le_iff_right, ← hf.map_eq_zero,
· rw [le_div_iff₀ hx', ← le_div_iff' hfx.bot_lt, tsub_le_iff_right, ← hf.map_eq_zero,
hf.map_add, div_mul_cancel₀ _ hfx, hf.map_two, zero_mul]
· rw [div_le_iff₀' hx', ← hf.map_eq_zero]
refine (mul_eq_zero.1 ?_).resolve_right hfx
Expand Down
2 changes: 1 addition & 1 deletion Archive/Imo/Imo2006Q5.lean
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ theorem Polynomial.iterate_comp_sub_X_ne {P : Polynomial ℤ} (hP : 1 < P.natDeg
(hk : 0 < k) : P.comp^[k] X - X ≠ 0 := by
rw [sub_ne_zero]
apply_fun natDegree
simpa using (one_lt_pow hP hk.ne').ne'
simpa using (one_lt_pow hP hk.ne').ne'

/-- We solve the problem for the specific case k = 2 first. -/
theorem imo2006_q5' {P : Polynomial ℤ} (hP : 1 < P.natDegree) :
Expand Down
Loading

0 comments on commit 5c9cb52

Please sign in to comment.