Skip to content

Commit 9c598f7

Browse files
committed
Merge remote-tracking branch 'upstream/master' into weakbilin-rename
# Conflicts: # Mathlib/Analysis/LocallyConvex/WeakSpace.lean
2 parents 559b307 + 6cad1b0 commit 9c598f7

File tree

1,008 files changed

+11430
-5728
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,008 files changed

+11430
-5728
lines changed

.github/workflows/PR_summary.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ jobs:
228228
then
229229
# Format each changed workflow path as a Markdown bullet: "- `path`"
230230
workflowFilesChangedMarkdown="$(sed "s|^|- \`|; s|\$|\`|" <<< "${workflowFilesChanged}")"
231-
workflowDocsReminder="$(printf "### Workflow documentation reminder\nThis PR modifies files under \`.github/workflows/\`.\nPlease update \`docs/workflows.md\` if the workflow inventory, triggers, or behavior changed.\n\nModified workflow files:\n%s\n" "${workflowFilesChangedMarkdown}")"
231+
workflowDocsReminder="$(printf "### ⚠️ Workflow documentation reminder\nThis PR modifies files under \`.github/workflows/\`.\nPlease update \`docs/workflows.md\` if the workflow inventory, triggers, or behavior changed.\n\nModified workflow files:\n%s\n" "${workflowFilesChangedMarkdown}")"
232232
else
233233
workflowDocsReminder=""
234234
fi
@@ -239,7 +239,7 @@ jobs:
239239
then
240240
# Format each added scripts path as a Markdown bullet: "- `path`"
241241
scriptsFilesAddedMarkdown="$(sed "s|^|- \`|; s|\$|\`|" <<< "${scriptsFilesAdded}")"
242-
scriptsLocationReminder="$(printf "### Scripts folder reminder\nThis PR adds files under \`scripts/\`.\nPlease consider whether each added script belongs in this repository or in \`leanprover-community/mathlib-ci\`.\n\nAdded scripts files:\n%s\n" "${scriptsFilesAddedMarkdown}")"
242+
scriptsLocationReminder="$(printf "### ⚠️ Scripts folder reminder\nThis PR adds files under \`scripts/\`.\nPlease consider whether each added script belongs in this repository or in [\`leanprover-community/mathlib-ci\`](https://github.com/leanprover-community/mathlib-ci).\n\nA script belongs in **\`mathlib-ci\`** if it is a CI automation script that interacts with GitHub (e.g. managing labels, posting comments, triggering bots), runs from a trusted external checkout in CI, or requires access to secrets.\n\nA script belongs in **this repository** (\`scripts/\`) if it is a developer or maintainer tool to be run locally, a code maintenance or analysis utility, a style linting tool, or a data file used by the library's own linters.\n\nSee the [\`mathlib-ci\` README](https://github.com/leanprover-community/mathlib-ci) for more details.\n\nAdded scripts files:\n%s\n" "${scriptsFilesAddedMarkdown}")"
243243
else
244244
scriptsLocationReminder=""
245245
fi

.github/workflows/rm_set_option.yml

Lines changed: 65 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,20 @@ on:
1010
required: false
1111
default: false
1212
type: boolean
13+
global_timeout:
14+
description: 'Global timeout in seconds (default: 18000 = 5 hours)'
15+
required: false
16+
default: '18000'
17+
type: string
1318

1419
jobs:
1520
build:
1621
name: Remove unnecessary set_option lines
17-
runs-on: ubuntu-latest
22+
runs-on: pr
1823
if: github.repository == 'leanprover-community/mathlib4'
24+
permissions:
25+
contents: read
26+
id-token: write
1927
steps:
2028
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2129

@@ -26,21 +34,70 @@ jobs:
2634
use-github-cache: false
2735
use-mathlib-cache: true
2836

37+
- name: Restore progress cache
38+
if: toJson(inputs.dry_run) != 'true'
39+
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
40+
with:
41+
path: scripts/.rm_set_option_progress.jsonl
42+
# Use run_id in restore-keys so we always pick up the most recent cache
43+
# for this toolchain, regardless of which run saved it.
44+
key: rm-set-option-progress-${{ hashFiles('lean-toolchain') }}-${{ github.run_id }}
45+
restore-keys: |
46+
rm-set-option-progress-${{ hashFiles('lean-toolchain') }}-
47+
2948
- name: Remove unnecessary set_option lines
3049
id: rm_set_option
3150
shell: bash
51+
env:
52+
DRY_RUN: ${{ inputs.dry_run }}
53+
GLOBAL_TIMEOUT: ${{ inputs.global_timeout }}
3254
run: |
33-
DRY_RUN_FLAG=""
34-
if [ "${{ inputs.dry_run }}" = "true" ]; then
35-
DRY_RUN_FLAG="--dry-run"
55+
ARGS=()
56+
if [ "$DRY_RUN" = "true" ]; then
57+
ARGS+=("--dry-run")
3658
fi
37-
python3 scripts/rm_set_option.py $DRY_RUN_FLAG
59+
TIMEOUT="${GLOBAL_TIMEOUT:-18000}"
60+
python3 scripts/rm_set_option.py "${ARGS[@]}" --global-timeout "$TIMEOUT"
3861
if git diff --quiet; then
3962
echo "changed=false" >> "$GITHUB_OUTPUT"
4063
else
4164
echo "changed=true" >> "$GITHUB_OUTPUT"
4265
fi
4366
67+
- name: Save progress cache
68+
# Always save (even on failure/timeout) so the next run can resume.
69+
# Skip on dry-run (no files are modified) and if the progress file was
70+
# cleaned up (meaning the run completed fully).
71+
if: always() && toJson(inputs.dry_run) != 'true' && hashFiles('scripts/.rm_set_option_progress.jsonl') != ''
72+
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
73+
with:
74+
path: scripts/.rm_set_option_progress.jsonl
75+
key: rm-set-option-progress-${{ hashFiles('lean-toolchain') }}-${{ github.run_id }}
76+
77+
- name: Build PR body
78+
id: pr_body
79+
if: steps.rm_set_option.outputs.changed == 'true' && toJson(inputs.dry_run) != 'true'
80+
shell: bash
81+
env:
82+
LINES_REMOVED: ${{ steps.rm_set_option.outputs.lines_removed }}
83+
FILES_MODIFIED: ${{ steps.rm_set_option.outputs.files_modified }}
84+
FILES_TIMED_OUT: ${{ steps.rm_set_option.outputs.files_timed_out }}
85+
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
86+
run: |
87+
{
88+
echo "body<<EOF"
89+
echo "I removed ${LINES_REMOVED} unnecessary \`set_option\` line(s) across ${FILES_MODIFIED} file(s)."
90+
if [ "${FILES_TIMED_OUT}" != "0" ]; then
91+
echo ""
92+
echo "⚠️ This is a partial run — ${FILES_TIMED_OUT} file(s) still to be processed. The next scheduled run will continue automatically."
93+
fi
94+
echo ""
95+
echo "---"
96+
echo ""
97+
echo "[workflow run for this PR](${RUN_URL})"
98+
echo "EOF"
99+
} >> "$GITHUB_OUTPUT"
100+
44101
- name: Generate app token
45102
id: app-token
46103
if: steps.rm_set_option.outputs.changed == 'true'
@@ -55,20 +112,15 @@ jobs:
55112
- name: Create Pull Request
56113
id: pr
57114
if: steps.rm_set_option.outputs.changed == 'true' && toJson(inputs.dry_run) != 'true'
58-
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
115+
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
59116
with:
60117
author: "mathlib-nolints[bot] <258989889+mathlib-nolints[bot]@users.noreply.github.com>"
61118
token: "${{ steps.app-token.outputs.token }}"
62119
commit-message: "chore: remove unnecessary set_option lines"
63120
branch: "rm-set-option"
64121
base: master
65122
title: "chore: remove unnecessary set_option lines"
66-
body: |
67-
I am happy to remove some unnecessary `set_option` lines for you!
68-
69-
---
70-
71-
[workflow run for this PR](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
123+
body: ${{ steps.pr_body.outputs.body }}
72124
# labels: "auto-merge-after-CI"
73125

74126
- name: Send Zulip message (success)
@@ -82,7 +134,7 @@ jobs:
82134
type: 'stream'
83135
topic: 'Mathlib `remove unnecessary set_option lines`'
84136
content: |
85-
Please review #${{ steps.pr.outputs.pull-request-number }}, which removes unnecessary set_option lines.
137+
Please review #${{ steps.pr.outputs.pull-request-number }}, which removes ${{ steps.rm_set_option.outputs.lines_removed }} unnecessary `set_option` line(s) across ${{ steps.rm_set_option.outputs.files_modified }} file(s).
86138
87139
- name: Send Zulip message (failure)
88140
if: ${{ toJson(inputs.dry_run) != 'true' && failure() }}

Archive/Examples/PropEncodable.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ private def finv : (WType fun i => Fin (arity α i)) → PropForm α
7474
| ⟨cor, fn⟩ => or (finv (fn 0)) (finv (fn 1))
7575

7676
instance [Encodable α] : Encodable (PropForm α) :=
77-
haveI : Encodable (Constructors α) := by unfold Constructors; infer_instance
77+
haveI : Encodable (Constructors α) := inferInstanceAs <| Encodable (α ⊕ Unit ⊕ Unit ⊕ Unit)
7878
Encodable.ofLeftInverse f finv (by intro p; induction p <;> simp [f, finv, *])
7979

8080
end PropForm

Archive/Hairer.lean

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ lemma inj_L : Injective (L ι) :=
112112
rw [isOpen_ball.interior_eq]
113113
apply subset_closure
114114

115-
set_option backward.isDefEq.respectTransparency false in
116115
lemma hairer (N : ℕ) (ι : Type*) [Fintype ι] :
117116
∃ (ρ : EuclideanSpace ℝ ι → ℝ), tsupport ρ ⊆ closedBall 0 1 ∧ ContDiff ℝ ∞ ρ ∧
118117
∀ (p : MvPolynomial ι ℝ), p.totalDegree ≤ N →

Archive/Imo/Imo1982Q1.lean

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ lemma f₃ : f 3 = 1 := by
7070

7171
lemma superadditive {m n : ℕ+} : f m + f n ≤ f (m + n) := by have h := hf.rel m n; grind
7272

73-
set_option backward.isDefEq.respectTransparency false in
7473
lemma superhomogeneous {m n : ℕ+} : ↑n * f m ≤ f (n * m) := by
7574
induction n with
7675
| one => simp
@@ -84,7 +83,6 @@ lemma superhomogeneous {m n : ℕ+} : ↑n * f m ≤ f (n * m) := by
8483
lemma superlinear {a b c d : ℕ+} : a * f b + c * f d ≤ f (a * b + c * d) :=
8584
(add_le_add hf.superhomogeneous hf.superhomogeneous).trans hf.superadditive
8685

87-
set_option backward.isDefEq.respectTransparency false in
8886
lemma le_mul_three_apply (n : ℕ+) : n ≤ f (3 * n) := by
8987
rw [← mul_one (n : ℕ), ← hf.f₃, mul_comm 3]
9088
exact hf.superhomogeneous

Archive/Imo/Imo1986Q5.lean

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ theorem map_eq_zero : f x = 0 ↔ 2 ≤ x := by
5050

5151
theorem map_ne_zero_iff : f x ≠ 0 ↔ x < 2 := by simp [hf.map_eq_zero]
5252

53-
set_option backward.isDefEq.respectTransparency false in
5453
theorem map_of_lt_two (hx : x < 2) : f x = 2 / (2 - x) := by
5554
have hx' : 0 < 2 - x := tsub_pos_of_lt hx
5655
have hfx : f x ≠ 0 := hf.map_ne_zero_iff.2 hx
@@ -68,7 +67,6 @@ theorem map_eq (x : ℝ≥0) : f x = 2 / (2 - x) :=
6867

6968
end IsGood
7069

71-
set_option backward.isDefEq.respectTransparency false in
7270
theorem isGood_iff {f : ℝ≥0 → ℝ≥0} : IsGood f ↔ f = fun x ↦ 2 / (2 - x) := by
7371
refine ⟨fun hf ↦ funext hf.map_eq, ?_⟩
7472
rintro rfl

Archive/Imo/Imo1987Q1.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ fixed points. -/
5555
def fiber (k : ℕ) : Set (Perm α) :=
5656
{σ : Perm α | card (fixedPoints σ) = k}
5757

58-
instance {k : ℕ} : Fintype (fiber α k) := by unfold fiber; infer_instance
58+
instance {k : ℕ} : Fintype (fiber α k) := inferInstanceAs <| Fintype (setOf _)
5959

6060
@[simp]
6161
theorem mem_fiber {σ : Perm α} {k : ℕ} : σ ∈ fiber α k ↔ card (fixedPoints σ) = k :=

Archive/Imo/Imo2019Q4.lean

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ open Nat Finset
3030

3131
namespace Imo2019Q4
3232

33-
set_option backward.isDefEq.respectTransparency false in
3433
theorem upper_bound {k n : ℕ} (hk : k > 0)
3534
(h : (k ! : ℤ) = ∏ i ∈ range n, ((2 : ℤ) ^ n - (2 : ℤ) ^ i)) : n < 6 := by
3635
have h2 : ∑ i ∈ range n, i < k := by

Archive/MiuLanguage/Basic.lean

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ instance : Repr MiuAtom :=
108108
-/
109109
abbrev Miustr := List MiuAtom
110110

111-
instance : Membership MiuAtom Miustr := by unfold Miustr; infer_instance
112-
113111
/-- For display purposes, an `Miustr` can be represented as a `String`.
114112
-/
115113
def Miustr.mrepr : Miustr → String

Archive/MiuLanguage/DecisionNec.lean

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,8 @@ string to be derivable, namely that the string must start with an M and contain
103103
-/
104104
def Goodm (xs : Miustr) : Prop :=
105105
List.headI xs = M ∧ M ∉ List.tail xs
106+
deriving Decidable
106107

107-
set_option backward.isDefEq.respectTransparency false in
108-
instance : DecidablePred Goodm := by unfold Goodm; infer_instance
109-
110-
set_option backward.isDefEq.respectTransparency false in
111108
/-- Demonstration that `"MI"` starts with `M` and has no `M` in its tail.
112109
-/
113110
theorem goodmi : Goodm [M, I] := by
@@ -121,7 +118,6 @@ We'll show, for each `i` from 1 to 4, that if `en` follows by Rule `i` from `st`
121118
-/
122119

123120

124-
set_option backward.isDefEq.respectTransparency false in
125121
theorem goodm_of_rule1 (xs : Miustr) (h₁ : Derivable (xs ++ [I])) (h₂ : Goodm (xs ++ [I])) :
126122
Goodm (xs ++ [I, U]) := by
127123
obtain ⟨mhead, nmtail⟩ := h₂
@@ -141,7 +137,6 @@ theorem goodm_of_rule2 (xs : Miustr) (_ : Derivable (M :: xs)) (h₂ : Goodm (M
141137
rw [cons_append] at mtail
142138
exact or_self_iff.mp (mem_append.mp mtail)
143139

144-
set_option backward.isDefEq.respectTransparency false in
145140
theorem goodm_of_rule3 (as bs : Miustr) (h₁ : Derivable (as ++ [I, I, I] ++ bs))
146141
(h₂ : Goodm (as ++ [I, I, I] ++ bs)) : Goodm (as ++ (U :: bs)) := by
147142
obtain ⟨mhead, nmtail⟩ := h₂
@@ -160,7 +155,6 @@ The proof of the next lemma is identical, on the tactic level, to the previous p
160155
-/
161156

162157

163-
set_option backward.isDefEq.respectTransparency false in
164158
theorem goodm_of_rule4 (as bs : Miustr) (h₁ : Derivable (as ++ [U, U] ++ bs))
165159
(h₂ : Goodm (as ++ [U, U] ++ bs)) : Goodm (as ++ bs) := by
166160
obtain ⟨mhead, nmtail⟩ := h₂
@@ -197,8 +191,7 @@ that `en` has no `M` in its tail. We automatically derive that this is a decidab
197191
-/
198192
def Decstr (en : Miustr) :=
199193
Goodm en ∧ (count I en % 3 = 1 ∨ count I en % 3 = 2)
200-
201-
instance : DecidablePred Decstr := by unfold Decstr; infer_instance
194+
deriving Decidable
202195

203196
/-- Suppose `en : Miustr`. If `en` is `Derivable`, then the condition `Decstr en` holds.
204197
-/

0 commit comments

Comments
 (0)