Skip to content

Commit 46df2fa

Browse files
committed
Merge remote-tracking branch 'upstream/master' into reducible-convert
2 parents f7a72a3 + 3bc0f4b commit 46df2fa

32 files changed

Lines changed: 340 additions & 254 deletions

File tree

.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: 455d84939bba1fbe157ff2c1469a0c258372d05c
13+
default: 78f34ded6a5f5aa11ea5b7c3120fe5d8422db1da
1414
path:
1515
description: Checkout destination path.
1616
required: false

.github/workflows/shake.yaml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,14 @@ jobs:
3535
use-github-cache: false
3636
use-mathlib-cache: true
3737

38+
- name: lake build
39+
run: |
40+
lake build Mathlib Archive Counterexamples
41+
3842
- name: lake shake
3943
id: shake
4044
run: |
41-
lake shake --add-public --keep-implied --keep-prefix --fix --explain > explain.txt 2>&1
45+
lake shake --add-public --keep-implied --keep-prefix --fix --explain Mathlib Archive Counterexamples > explain.txt 2>&1
4246
if git diff --quiet; then
4347
echo "changed=false" >> "$GITHUB_OUTPUT"
4448
else
@@ -53,12 +57,17 @@ jobs:
5357
5458
- name: Upload explain.txt
5559
id: upload-artifact
56-
if: steps.shake.outputs.changed == 'true'
60+
if: failure() || steps.shake.outputs.changed == 'true'
5761
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
5862
with:
5963
name: shake-explain
6064
path: explain.txt
6165

66+
- name: Cleanup explain.txt
67+
if: steps.shake.outputs.changed == 'true'
68+
run: |
69+
rm -f explain.txt
70+
6271
- name: Build PR body
6372
id: pr_body
6473
if: steps.shake.outputs.changed == 'true' && toJson(inputs.dry_run) != 'true'
@@ -118,7 +127,7 @@ jobs:
118127
api-key: ${{ secrets.ZULIP_API_KEY }}
119128
email: 'github-mathlib4-bot@leanprover.zulipchat.com'
120129
organization-url: 'https://leanprover.zulipchat.com'
121-
to: 'nightly-testing'
130+
to: 'nightly-testing-mathlib'
122131
type: 'stream'
123132
topic: 'Mathlib `shake --fix`'
124133
content: |

Mathlib/Data/DFinsupp/Interval.lean

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,20 +182,19 @@ lemma card_uIcc : #(uIcc f g) = ∏ i ∈ f.support ∪ g.support, #(uIcc (f i)
182182

183183
end Lattice
184184

185-
section CanonicallyOrdered
185+
section IsBotZeroClass
186186

187187
variable [DecidableEq ι] [∀ i, DecidableEq (α i)]
188-
variable [∀ i, AddCommMonoid (α i)] [∀ i, PartialOrder (α i)] [∀ i, CanonicallyOrderedAdd (α i)]
188+
variable [∀ i, AddCommMonoid (α i)] [∀ i, PartialOrder (α i)] [∀ i, IsBotZeroClass (α i)]
189189
[∀ i, OrderBot (α i)] [∀ i, LocallyFiniteOrder (α i)]
190190
variable (f : Π₀ i, α i)
191191

192192
lemma card_Iic : #(Iic f) = ∏ i ∈ f.support, #(Iic (f i)) := by
193-
simp_rw [Iic_eq_Icc, card_Icc, DFinsupp.bot_eq_zero, support_zero, empty_union, zero_apply,
194-
bot_eq_zero]
193+
simp [Iic_eq_Icc, card_Icc, bot_eq_zero]
195194

196195
lemma card_Iio : #(Iio f) = (∏ i ∈ f.support, #(Iic (f i))) - 1 := by
197196
rw [card_Iio_eq_card_Iic_sub_one, card_Iic]
198197

199-
end CanonicallyOrdered
198+
end IsBotZeroClass
200199

201200
end DFinsupp

Mathlib/Data/DFinsupp/Lex.lean

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,17 +259,27 @@ section OrderedAddMonoid
259259
variable [LinearOrder ι]
260260

261261
instance Lex.orderBot [∀ i, AddCommMonoid (α i)] [∀ i, PartialOrder (α i)]
262-
[∀ i, CanonicallyOrderedAdd (α i)] :
262+
[∀ i, IsBotZeroClass (α i)] :
263263
OrderBot (Lex (Π₀ i, α i)) where
264264
bot := 0
265265
bot_le _ := DFinsupp.toLex_monotone bot_le
266266

267+
instance Lex.isBotZeroClass [∀ i, AddCommMonoid (α i)] [∀ i, PartialOrder (α i)]
268+
[∀ i, IsBotZeroClass (α i)] :
269+
IsBotZeroClass (Lex (Π₀ i, α i)) where
270+
isBot_zero := isBot_bot
271+
267272
instance Colex.orderBot [∀ i, AddCommMonoid (α i)] [∀ i, PartialOrder (α i)]
268-
[∀ i, CanonicallyOrderedAdd (α i)] :
273+
[∀ i, IsBotZeroClass (α i)] :
269274
OrderBot (Colex (Π₀ i, α i)) where
270275
bot := 0
271276
bot_le _ := DFinsupp.toColex_monotone bot_le
272277

278+
instance Colex.isBotZeroClass [∀ i, AddCommMonoid (α i)] [∀ i, PartialOrder (α i)]
279+
[∀ i, IsBotZeroClass (α i)] :
280+
IsBotZeroClass (Colex (Π₀ i, α i)) where
281+
isBot_zero := isBot_bot
282+
273283
instance Lex.isOrderedCancelAddMonoid [∀ i, AddCommMonoid (α i)] [∀ i, PartialOrder (α i)]
274284
[∀ i, IsOrderedCancelAddMonoid (α i)] :
275285
IsOrderedCancelAddMonoid (Lex (Π₀ i, α i)) where

Mathlib/Data/DFinsupp/Order.lean

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -189,17 +189,23 @@ end Module
189189

190190
section PartialOrder
191191

192-
variable (α) [∀ i, AddCommMonoid (α i)] [∀ i, PartialOrder (α i)] [∀ i, CanonicallyOrderedAdd (α i)]
192+
variable (α) [∀ i, AddCommMonoid (α i)] [∀ i, PartialOrder (α i)]
193193

194-
instance : OrderBot (Π₀ i, α i) where
194+
instance [∀ i, IsBotZeroClass (α i)] : OrderBot (Π₀ i, α i) where
195195
bot := 0
196-
bot_le := by simp only [le_def, coe_zero, Pi.zero_apply, imp_true_iff, zero_le]
196+
bot_le := by simp [le_def]
197+
198+
instance [∀ i, IsBotZeroClass (α i)] : IsBotZeroClass (Π₀ i, α i) where
199+
isBot_zero := isBot_bot
197200

198201
variable {α}
199202

200-
protected theorem bot_eq_zero : (⊥ : Π₀ i, α i) = 0 :=
203+
@[deprecated _root_.bot_eq_zero (since := "2026-05-07")]
204+
protected theorem bot_eq_zero [∀ i, IsBotZeroClass (α i)] : (⊥ : Π₀ i, α i) = 0 :=
201205
rfl
202206

207+
variable [∀ i, CanonicallyOrderedAdd (α i)]
208+
203209
@[simp]
204210
theorem add_eq_zero_iff (f g : Π₀ i, α i) : f + g = 0 ↔ f = 0 ∧ g = 0 := by
205211
simp [DFunLike.ext_iff, forall_and]
@@ -289,25 +295,21 @@ theorem subset_support_tsub : f.support \ g.support ⊆ (f - g).support := by
289295
end PartialOrder
290296

291297
section LinearOrder
292-
variable [∀ i, AddCommMonoid (α i)] [∀ i, LinearOrder (α i)] [∀ i, CanonicallyOrderedAdd (α i)]
298+
variable [∀ i, AddCommMonoid (α i)] [∀ i, LinearOrder (α i)] [∀ i, IsBotZeroClass (α i)]
293299
[DecidableEq ι] {f g : Π₀ i, α i}
294300

295301
@[simp]
296302
theorem support_inf : (f ⊓ g).support = f.support ∩ g.support := by
297303
ext
298-
simp only [inf_apply, mem_support_iff, Ne, Finset.mem_inter]
299-
simp only [← nonpos_iff_eq_zero, min_le_iff, not_or]
304+
simp
300305

301306
@[simp]
302307
theorem support_sup : (f ⊔ g).support = f.support ∪ g.support := by
303308
ext
304-
simp only [Finset.mem_union, mem_support_iff, sup_apply, Ne, ← nonpos_iff_eq_zero, sup_le_iff,
305-
Classical.not_and_iff_not_or_not]
309+
simp [imp_iff_not_or]
306310

307311
nonrec theorem disjoint_iff : Disjoint f g ↔ Disjoint f.support g.support := by
308-
rw [disjoint_iff, disjoint_iff, DFinsupp.bot_eq_zero, ← DFinsupp.support_eq_empty,
309-
DFinsupp.support_inf]
310-
rfl
312+
simp [disjoint_iff, bot_eq_zero, ← DFinsupp.support_eq_empty]
311313

312314
end LinearOrder
313315

Mathlib/Data/DFinsupp/WellFounded.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,13 @@ theorem Lex.wellFounded' (hbot : ∀ ⦃i a⦄, ¬s i a 0) (hs : ∀ i, WellFoun
168168
end Zero
169169

170170
instance Lex.wellFoundedLT [LT ι] [@Std.Trichotomous ι (· < ·)] [hι : WellFoundedGT ι]
171-
[∀ i, AddMonoid (α i)] [∀ i, PartialOrder (α i)] [∀ i, CanonicallyOrderedAdd (α i)]
171+
[∀ i, AddMonoid (α i)] [∀ i, PartialOrder (α i)] [∀ i, IsBotZeroClass (α i)]
172172
[hα : ∀ i, WellFoundedLT (α i)] :
173173
WellFoundedLT (Lex (Π₀ i, α i)) :=
174174
⟨Lex.wellFounded' (fun _ _ => not_lt_zero) (fun i => (hα i).wf) hι.wf⟩
175175

176176
instance Colex.wellFoundedLT [LT ι] [@Std.Trichotomous ι (· < ·)] [WellFoundedLT ι]
177-
[∀ i, AddMonoid (α i)] [∀ i, PartialOrder (α i)] [∀ i, CanonicallyOrderedAdd (α i)]
177+
[∀ i, AddMonoid (α i)] [∀ i, PartialOrder (α i)] [∀ i, IsBotZeroClass (α i)]
178178
[∀ i, WellFoundedLT (α i)] :
179179
WellFoundedLT (Colex (Π₀ i, α i)) :=
180180
Lex.wellFoundedLT (ι := ιᵒᵈ)
@@ -237,7 +237,7 @@ protected theorem DFinsupp.wellFoundedLT [∀ i, Zero (α i)] [∀ i, Preorder (
237237
exact ⟨i, fun j hj ↦ Quot.sound (he j hj), hl⟩⟩
238238

239239
instance DFinsupp.wellFoundedLT'
240-
[∀ i, AddMonoid (α i)] [∀ i, PartialOrder (α i)] [∀ i, CanonicallyOrderedAdd (α i)]
240+
[∀ i, AddMonoid (α i)] [∀ i, PartialOrder (α i)] [∀ i, IsBotZeroClass (α i)]
241241
[∀ i, WellFoundedLT (α i)] : WellFoundedLT (Π₀ i, α i) :=
242242
DFinsupp.wellFoundedLT fun _ _ => not_lt_zero
243243

Mathlib/Data/Finsupp/Interval.lean

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,19 +119,18 @@ theorem card_uIcc :
119119

120120
end Lattice
121121

122-
section CanonicallyOrdered
122+
section IsBotZeroClass
123123

124-
variable [AddCommMonoid α] [PartialOrder α] [CanonicallyOrderedAdd α]
124+
variable [AddCommMonoid α] [PartialOrder α] [IsBotZeroClass α]
125125
[OrderBot α] [LocallyFiniteOrder α]
126126
variable [DecidableEq ι] [DecidableEq α] (f : ι →₀ α)
127127

128128
theorem card_Iic : #(Iic f) = ∏ i ∈ f.support, #(Iic (f i)) := by
129-
classical simp_rw [Iic_eq_Icc, card_Icc, Finsupp.bot_eq_zero, support_zero, empty_union,
130-
zero_apply, bot_eq_zero]
129+
classical simp [Iic_eq_Icc, card_Icc, bot_eq_zero]
131130

132131
theorem card_Iio : #(Iio f) = ∏ i ∈ f.support, #(Iic (f i)) - 1 := by
133132
rw [card_Iio_eq_card_Iic_sub_one, card_Iic]
134133

135-
end CanonicallyOrdered
134+
end IsBotZeroClass
136135

137136
end Finsupp

Mathlib/Data/Finsupp/Lex.lean

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,16 +226,24 @@ section OrderedAddMonoid
226226

227227
variable [LinearOrder α]
228228

229-
instance Lex.orderBot [AddCommMonoid N] [PartialOrder N] [CanonicallyOrderedAdd N] :
229+
instance Lex.orderBot [AddCommMonoid N] [PartialOrder N] [IsBotZeroClass N] :
230230
OrderBot (Lex (α →₀ N)) where
231231
bot := 0
232232
bot_le _ := Finsupp.toLex_monotone bot_le
233233

234-
instance Colex.orderBot [AddCommMonoid N] [PartialOrder N] [CanonicallyOrderedAdd N] :
234+
instance Lex.isBotZeroClass [AddCommMonoid N] [PartialOrder N] [IsBotZeroClass N] :
235+
IsBotZeroClass (Lex (α →₀ N)) where
236+
isBot_zero := isBot_bot
237+
238+
instance Colex.orderBot [AddCommMonoid N] [PartialOrder N] [IsBotZeroClass N] :
235239
OrderBot (Colex (α →₀ N)) where
236240
bot := 0
237241
bot_le _ := Finsupp.toColex_monotone bot_le
238242

243+
instance Colex.isBotZeroClass [AddCommMonoid N] [PartialOrder N] [IsBotZeroClass N] :
244+
IsBotZeroClass (Colex (α →₀ N)) where
245+
isBot_zero := isBot_bot
246+
239247
instance Lex.isOrderedCancelAddMonoid
240248
[AddCommMonoid N] [PartialOrder N] [IsOrderedCancelAddMonoid N] :
241249
IsOrderedCancelAddMonoid (Lex (α →₀ N)) where

Mathlib/Data/Finsupp/Order.lean

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -209,15 +209,21 @@ end SMulWithZero
209209

210210
section PartialOrder
211211

212-
variable [AddCommMonoid α] [PartialOrder α] [CanonicallyOrderedAdd α] {f g : ι →₀ α}
212+
variable [AddCommMonoid α] [PartialOrder α] {f g : ι →₀ α}
213213

214-
instance orderBot : OrderBot (ι →₀ α) where
214+
instance orderBot [IsBotZeroClass α] : OrderBot (ι →₀ α) where
215215
bot := 0
216-
bot_le := by simp only [le_def, coe_zero, Pi.zero_apply, imp_true_iff, zero_le]
216+
bot_le := by simp [le_def]
217217

218-
protected theorem bot_eq_zero : (⊥ : ι →₀ α) = 0 :=
218+
instance [IsBotZeroClass α] : IsBotZeroClass (ι →₀ α) where
219+
isBot_zero := isBot_bot
220+
221+
@[deprecated _root_.bot_eq_zero (since := "2026-05-07")]
222+
protected theorem bot_eq_zero [IsBotZeroClass α] : (⊥ : ι →₀ α) = 0 :=
219223
rfl
220224

225+
variable [CanonicallyOrderedAdd α]
226+
221227
@[simp]
222228
theorem add_eq_zero_iff (f g : ι →₀ α) : f + g = 0 ↔ f = 0 ∧ g = 0 := by
223229
simp [DFunLike.ext_iff, forall_and]
@@ -298,32 +304,26 @@ end PartialOrder
298304

299305
section LinearOrder
300306

301-
variable [AddCommMonoid α] [LinearOrder α] [CanonicallyOrderedAdd α]
307+
variable [AddCommMonoid α] [LinearOrder α] [IsBotZeroClass α]
302308

303309
@[simp]
304310
theorem support_inf [DecidableEq ι] (f g : ι →₀ α) : (f ⊓ g).support = f.support ∩ g.support := by
305311
ext
306-
simp only [inf_apply, mem_support_iff, Ne,
307-
Finset.mem_inter]
308-
simp only [← nonpos_iff_eq_zero, min_le_iff, not_or]
312+
simp
309313

310314
@[simp]
311315
theorem support_sup [DecidableEq ι] (f g : ι →₀ α) : (f ⊔ g).support = f.support ∪ g.support := by
312316
ext
313-
simp only [mem_support_iff, Ne, sup_apply, ← nonpos_iff_eq_zero, sup_le_iff, mem_union,
314-
not_and_or]
317+
simp [imp_iff_not_or]
315318

316319
nonrec theorem disjoint_iff {f g : ι →₀ α} : Disjoint f g ↔ Disjoint f.support g.support := by
317320
classical
318-
rw [disjoint_iff, disjoint_iff, Finsupp.bot_eq_zero, ← Finsupp.support_eq_empty,
319-
Finsupp.support_inf]
320-
rfl
321+
simp [disjoint_iff, bot_eq_zero, ← Finsupp.support_eq_empty]
321322

322323
end LinearOrder
323324

324325
/-! ### Some lemmas about `ℕ` -/
325326

326-
327327
section Nat
328328

329329
theorem sub_single_one_add {a : ι} {u u' : ι →₀ ℕ} (h : u a ≠ 0) :

Mathlib/Data/Finsupp/WellFounded.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ theorem Lex.wellFounded' (hbot : ∀ ⦃n⦄, ¬s n 0) (hs : WellFounded s)
5353
InvImage.wf _ (DFinsupp.Lex.wellFounded' (fun _ => hbot) (fun _ => hs) hr)
5454

5555
instance Lex.wellFoundedLT {α N} [LT α] [@Std.Trichotomous α (· < ·)] [hα : WellFoundedGT α]
56-
[AddMonoid N] [PartialOrder N] [CanonicallyOrderedAdd N]
56+
[AddMonoid N] [PartialOrder N] [IsBotZeroClass N]
5757
[hN : WellFoundedLT N] : WellFoundedLT (Lex (α →₀ N)) :=
5858
⟨Lex.wellFounded' (fun _ => not_lt_zero) hN.wf hα.wf⟩
5959

6060
instance Colex.wellFoundedLT {α N} [LT α] [@Std.Trichotomous α (· < ·)] [WellFoundedLT α]
61-
[AddMonoid N] [PartialOrder N] [CanonicallyOrderedAdd N]
61+
[AddMonoid N] [PartialOrder N] [IsBotZeroClass N]
6262
[WellFoundedLT N] : WellFoundedLT (Colex (α →₀ N)) :=
6363
Lex.wellFoundedLT (α := αᵒᵈ)
6464

@@ -81,7 +81,7 @@ protected theorem wellFoundedLT [Preorder N] [WellFoundedLT N] (hbot : ∀ n : N
8181
⟨InvImage.wf toDFinsupp (DFinsupp.wellFoundedLT fun _ a => hbot a).wf⟩
8282

8383
instance wellFoundedLT' {N}
84-
[AddMonoid N] [PartialOrder N] [CanonicallyOrderedAdd N] [WellFoundedLT N] :
84+
[AddMonoid N] [PartialOrder N] [IsBotZeroClass N] [WellFoundedLT N] :
8585
WellFoundedLT (α →₀ N) :=
8686
Finsupp.wellFoundedLT fun _ => not_lt_zero
8787

0 commit comments

Comments
 (0)