Skip to content

Commit 0d96620

Browse files
committed
chore(Order): remove redundant instance fields (#30752)
This PR continues the cleanup from #30734, mosly removing `bot := ⊥`. I also want to remove occurrences of `sup := (· ⊔ ·)`, but the problem is that the `sup` and `min` fields are different, making things more awkward than they should be. (See also #24614) I found these redundant instance fields using VSCode's built-in search.
1 parent 2b55585 commit 0d96620

File tree

36 files changed

+137
-224
lines changed

36 files changed

+137
-224
lines changed

Archive/Wiedijk100Theorems/BuffonsNeedle.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ lemma volume_needleSpace : ℙ (needleSpace d) = ENNReal.ofReal (d * π) := by
130130

131131
lemma measurable_needleCrossesIndicator : Measurable (needleCrossesIndicator l) := by
132132
unfold needleCrossesIndicator
133-
refine Measurable.indicator measurable_const (IsClosed.measurableSet (IsClosed.inter ?l ?r))
133+
refine Measurable.indicator measurable_const (IsClosed.measurableSet (IsClosed.and ?l ?r))
134134
all_goals simp only [tsub_le_iff_right, zero_add, ← neg_le_iff_add_nonneg']
135135
case' l => refine isClosed_le continuous_fst ?_
136136
case' r => refine isClosed_le (Continuous.neg continuous_fst) ?_

Mathlib/Algebra/Module/Submodule/Lattice.lean

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ instance uniqueBot : Unique (⊥ : Submodule R M) :=
7676
⟨inferInstance, fun x ↦ Subtype.ext <| (mem_bot R).1 x.mem⟩
7777

7878
instance : OrderBot (Submodule R M) where
79-
bot := ⊥
8079
bot_le p x := by simp +contextual [zero_mem]
8180

8281
protected theorem eq_bot_iff (p : Submodule R M) : p = ⊥ ↔ ∀ x ∈ p, x = (0 : M) :=
@@ -145,7 +144,6 @@ theorem mem_top {x : M} : x ∈ (⊤ : Submodule R M) :=
145144
trivial
146145

147146
instance : OrderTop (Submodule R M) where
148-
top := ⊤
149147
le_top _ _ _ := trivial
150148

151149
theorem eq_top_iff' {p : Submodule R M} : p = ⊤ ↔ ∀ x, x ∈ p :=

Mathlib/Algebra/Order/Kleene.lean

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,6 @@ protected abbrev idemSemiring [IdemSemiring α] [Zero β] [One β] [Add β] [Mul
324324
{ hf.semiring f zero one add mul nsmul npow natCast, hf.semilatticeSup _ sup,
325325
‹Bot β› with
326326
add_eq_sup := fun a b ↦ hf <| by rw [sup, add, add_eq_sup]
327-
bot := ⊥
328327
bot_le := fun a ↦ bot.trans_le <| @bot_le _ _ _ <| f a }
329328

330329
-- See note [reducible non-instances]

Mathlib/Analysis/BoxIntegral/Partition/Basic.lean

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ instance : LE (Prepartition I) :=
112112
fun π π' => ∀ ⦃I⦄, I ∈ π → ∃ I' ∈ π', I ≤ I'⟩
113113

114114
instance partialOrder : PartialOrder (Prepartition I) where
115-
le := (· ≤ ·)
116115
le_refl _ I hI := ⟨I, hI, le_rfl⟩
117116
le_trans _ _ _ h₁₂ h₂₃ _ hI₁ :=
118117
let ⟨_, hI₂, hI₁₂⟩ := h₁₂ hI₁

Mathlib/Analysis/NormedSpace/ENormedSpace.lean

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -156,23 +156,19 @@ theorem top_map {x : V} (hx : x ≠ 0) : (⊤ : ENormedSpace 𝕜 V) x = ⊤ :=
156156
if_neg hx
157157

158158
noncomputable instance : OrderTop (ENormedSpace 𝕜 V) where
159-
top := ⊤
160159
le_top e x := by obtain h | h := eq_or_ne x 0 <;> simp [top_map, h]
161160

162-
noncomputable instance : SemilatticeSup (ENormedSpace 𝕜 V) :=
163-
{ ENormedSpace.partialOrder with
164-
le := (· ≤ ·)
165-
lt := (· < ·)
166-
sup := fun e₁ e₂ =>
167-
{ toFun := fun x => max (e₁ x) (e₂ x)
168-
eq_zero' := fun _ h => e₁.eq_zero_iff.1 (ENNReal.max_eq_zero_iff.1 h).1
169-
map_add_le' := fun _ _ =>
170-
max_le (le_trans (e₁.map_add_le _ _) <| add_le_add (le_max_left _ _) (le_max_left _ _))
171-
(le_trans (e₂.map_add_le _ _) <| add_le_add (le_max_right _ _) (le_max_right _ _))
172-
map_smul_le' := fun c x => le_of_eq <| by simp only [map_smul, mul_max] }
173-
le_sup_left := fun _ _ _ => le_max_left _ _
174-
le_sup_right := fun _ _ _ => le_max_right _ _
175-
sup_le := fun _ _ _ h₁ h₂ x => max_le (h₁ x) (h₂ x) }
161+
noncomputable instance : SemilatticeSup (ENormedSpace 𝕜 V) where
162+
sup := fun e₁ e₂ =>
163+
{ toFun := fun x => max (e₁ x) (e₂ x)
164+
eq_zero' := fun _ h => e₁.eq_zero_iff.1 (ENNReal.max_eq_zero_iff.1 h).1
165+
map_add_le' := fun _ _ =>
166+
max_le (le_trans (e₁.map_add_le _ _) <| add_le_add (le_max_left _ _) (le_max_left _ _))
167+
(le_trans (e₂.map_add_le _ _) <| add_le_add (le_max_right _ _) (le_max_right _ _))
168+
map_smul_le' := fun c x => le_of_eq <| by simp only [map_smul, mul_max] }
169+
le_sup_left := fun _ _ _ => le_max_left _ _
170+
le_sup_right := fun _ _ _ => le_max_right _ _
171+
sup_le := fun _ _ _ h₁ h₂ x => max_le (h₁ x) (h₂ x)
176172

177173
@[deprecated "Use ENormedAddCommMonoid or talk to the Carleson project" (since := "2025-05-07"),
178174
simp, norm_cast]

Mathlib/Combinatorics/Digraph/Basic.lean

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -167,29 +167,20 @@ instance distribLattice : DistribLattice (Digraph V) :=
167167
{ adj_injective.distribLattice Digraph.Adj (fun _ _ ↦ rfl) fun _ _ ↦ rfl with
168168
le := fun G H ↦ ∀ ⦃a b⦄, G.Adj a b → H.Adj a b }
169169

170-
instance completeAtomicBooleanAlgebra : CompleteAtomicBooleanAlgebra (Digraph V) :=
171-
{ Digraph.distribLattice with
172-
le := (· ≤ ·)
173-
sup := (· ⊔ ·)
174-
inf := (· ⊓ ·)
175-
compl := HasCompl.compl
176-
sdiff := (· \ ·)
177-
top := Digraph.completeDigraph V
178-
bot := Digraph.emptyDigraph V
179-
le_top := fun _ _ _ _ ↦ trivial
180-
bot_le := fun _ _ _ h ↦ h.elim
181-
sdiff_eq := fun _ _ ↦ rfl
182-
inf_compl_le_bot := fun _ _ _ h ↦ absurd h.1 h.2
183-
top_le_sup_compl := fun G v w _ ↦ by tauto
184-
sSup := sSup
185-
le_sSup := fun _ G hG _ _ hab ↦ ⟨G, hG, hab⟩
186-
sSup_le := fun s G hG a b ↦ by
187-
rintro ⟨H, hH, hab⟩
188-
exact hG _ hH hab
189-
sInf := sInf
190-
sInf_le := fun _ _ hG _ _ hab ↦ hab hG
191-
le_sInf := fun _ _ hG _ _ hab ↦ fun _ hH ↦ hG _ hH hab
192-
iInf_iSup_eq := fun f ↦ by ext; simp [Classical.skolem] }
170+
instance completeAtomicBooleanAlgebra : CompleteAtomicBooleanAlgebra (Digraph V) where
171+
top := Digraph.completeDigraph V
172+
bot := Digraph.emptyDigraph V
173+
le_top _ _ _ _ := trivial
174+
bot_le _ _ _ h := h.elim
175+
inf_compl_le_bot _ _ _ h := absurd h.1 h.2
176+
top_le_sup_compl G v w _ := by tauto
177+
le_sSup _ G hG _ _ hab := ⟨G, hG, hab⟩
178+
sSup_le s G hG a b := by
179+
rintro ⟨H, hH, hab⟩
180+
exact hG _ hH hab
181+
sInf_le _ _ hG _ _ hab := hab hG
182+
le_sInf _ _ hG _ _ hab _ hH := hG _ hH hab
183+
iInf_iSup_eq f := by ext; simp [Classical.skolem]
193184

194185
@[simp] theorem top_adj (v w : V) : (⊤ : Digraph V).Adj v w := trivial
195186

Mathlib/Combinatorics/SimpleGraph/Basic.lean

Lines changed: 22 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -296,37 +296,28 @@ instance distribLattice : DistribLattice (SimpleGraph V) :=
296296
adj_injective.distribLattice _ (fun _ _ => rfl) fun _ _ => rfl with
297297
le := fun G H => ∀ ⦃a b⦄, G.Adj a b → H.Adj a b }
298298

299-
instance completeAtomicBooleanAlgebra : CompleteAtomicBooleanAlgebra (SimpleGraph V) :=
300-
{ SimpleGraph.distribLattice with
301-
le := (· ≤ ·)
302-
sup := (· ⊔ ·)
303-
inf := (· ⊓ ·)
304-
compl := HasCompl.compl
305-
sdiff := (· \ ·)
306-
top.Adj := Ne
307-
bot.Adj _ _ := False
308-
le_top := fun x _ _ h => x.ne_of_adj h
309-
bot_le := fun _ _ _ h => h.elim
310-
sdiff_eq := fun x y => by
311-
ext v w
312-
refine ⟨fun h => ⟨h.1, ⟨?_, h.2⟩⟩, fun h => ⟨h.1, h.2.2⟩⟩
313-
rintro rfl
314-
exact x.irrefl h.1
315-
inf_compl_le_bot := fun _ _ _ h => False.elim <| h.2.2 h.1
316-
top_le_sup_compl := fun G v w hvw => by
317-
by_cases h : G.Adj v w
318-
· exact Or.inl h
319-
· exact Or.inr ⟨hvw, h⟩
320-
sSup := sSup
321-
le_sSup := fun _ G hG _ _ hab => ⟨G, hG, hab⟩
322-
sSup_le := fun s G hG a b => by
323-
rintro ⟨H, hH, hab⟩
324-
exact hG _ hH hab
325-
sInf := sInf
326-
sInf_le := fun _ _ hG _ _ hab => hab.1 hG
327-
le_sInf := fun _ _ hG _ _ hab => ⟨fun _ hH => hG _ hH hab, hab.ne⟩
328-
iInf_iSup_eq := fun f => by ext; simp [Classical.skolem] }
329-
299+
instance completeAtomicBooleanAlgebra : CompleteAtomicBooleanAlgebra (SimpleGraph V) where
300+
top.Adj := Ne
301+
bot.Adj _ _ := False
302+
le_top x _ _ h := x.ne_of_adj h
303+
bot_le _ _ _ h := h.elim
304+
sdiff_eq x y := by
305+
ext v w
306+
refine ⟨fun h => ⟨h.1, ⟨?_, h.2⟩⟩, fun h => ⟨h.1, h.2.2⟩⟩
307+
rintro rfl
308+
exact x.irrefl h.1
309+
inf_compl_le_bot _ _ _ h := False.elim <| h.2.2 h.1
310+
top_le_sup_compl G v w hvw := by
311+
by_cases h : G.Adj v w
312+
· exact Or.inl h
313+
· exact Or.inr ⟨hvw, h⟩
314+
le_sSup _ G hG _ _ hab := ⟨G, hG, hab⟩
315+
sSup_le s G hG a b := by
316+
rintro ⟨H, hH, hab⟩
317+
exact hG _ hH hab
318+
sInf_le _ _ hG _ _ hab := hab.1 hG
319+
le_sInf _ _ hG _ _ hab := ⟨fun _ hH => hG _ hH hab, hab.ne⟩
320+
iInf_iSup_eq f := by ext; simp [Classical.skolem]
330321
/-- The complete graph on a type `V` is the simple graph with all pairs of distinct vertices. -/
331322
abbrev completeGraph (V : Type u) : SimpleGraph V := ⊤
332323

Mathlib/Combinatorics/SimpleGraph/Subgraph.lean

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -438,35 +438,25 @@ instance distribLattice : DistribLattice G.Subgraph :=
438438
le := fun x y => x.verts ⊆ y.verts ∧ ∀ ⦃v w : V⦄, x.Adj v w → y.Adj v w }
439439

440440
instance : BoundedOrder (Subgraph G) where
441-
top := ⊤
442-
bot := ⊥
443441
le_top x := ⟨Set.subset_univ _, fun _ _ => x.adj_sub⟩
444442
bot_le _ := ⟨Set.empty_subset _, fun _ _ => False.elim⟩
445443

446444
/-- Note that subgraphs do not form a Boolean algebra, because of `verts`. -/
447-
def completelyDistribLatticeMinimalAxioms : CompletelyDistribLattice.MinimalAxioms G.Subgraph :=
448-
{ Subgraph.distribLattice with
449-
le := (· ≤ ·)
450-
sup := (· ⊔ ·)
451-
inf := (· ⊓ ·)
452-
top := ⊤
453-
bot := ⊥
454-
le_top := fun G' => ⟨Set.subset_univ _, fun _ _ => G'.adj_sub⟩
455-
bot_le := fun _ => ⟨Set.empty_subset _, fun _ _ => False.elim⟩
456-
sSup := sSup
457-
-- Porting note: needed `apply` here to modify elaboration; previously the term itself was fine.
458-
le_sSup := fun s G' hG' => ⟨by apply Set.subset_iUnion₂ G' hG', fun _ _ hab => ⟨G', hG', hab⟩⟩
459-
sSup_le := fun s G' hG' =>
460-
⟨Set.iUnion₂_subset fun _ hH => (hG' _ hH).1, by
461-
rintro a b ⟨H, hH, hab⟩
462-
exact (hG' _ hH).2 hab⟩
463-
sInf := sInf
464-
sInf_le := fun _ G' hG' => ⟨Set.iInter₂_subset G' hG', fun _ _ hab => hab.1 hG'⟩
465-
le_sInf := fun _ G' hG' =>
466-
⟨Set.subset_iInter₂ fun _ hH => (hG' _ hH).1, fun _ _ hab =>
467-
fun _ hH => (hG' _ hH).2 hab, G'.adj_sub hab⟩⟩
468-
iInf_iSup_eq := fun f => Subgraph.ext (by simpa using iInf_iSup_eq)
469-
(by ext; simp [Classical.skolem]) }
445+
def completelyDistribLatticeMinimalAxioms : CompletelyDistribLattice.MinimalAxioms G.Subgraph where
446+
le_top G' := ⟨Set.subset_univ _, fun _ _ => G'.adj_sub⟩
447+
bot_le _ := ⟨Set.empty_subset _, fun _ _ => False.elim⟩
448+
-- Porting note: needed `apply` here to modify elaboration; previously the term itself was fine.
449+
le_sSup s G' hG' := ⟨by apply Set.subset_iUnion₂ G' hG', fun _ _ hab => ⟨G', hG', hab⟩⟩
450+
sSup_le s G' hG' :=
451+
⟨Set.iUnion₂_subset fun _ hH => (hG' _ hH).1, by
452+
rintro a b ⟨H, hH, hab⟩
453+
exact (hG' _ hH).2 hab⟩
454+
sInf_le _ G' hG' := ⟨Set.iInter₂_subset G' hG', fun _ _ hab => hab.1 hG'⟩
455+
le_sInf _ G' hG' :=
456+
⟨Set.subset_iInter₂ fun _ hH => (hG' _ hH).1, fun _ _ hab =>
457+
fun _ hH => (hG' _ hH).2 hab, G'.adj_sub hab⟩⟩
458+
iInf_iSup_eq f := Subgraph.ext (by simpa using iInf_iSup_eq)
459+
(by ext; simp [Classical.skolem])
470460

471461
instance : CompletelyDistribLattice G.Subgraph :=
472462
.ofMinimalAxioms completelyDistribLatticeMinimalAxioms

Mathlib/Computability/Reduce.lean

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,6 @@ private theorem le_trans {d₁ d₂ d₃ : ManyOneDegree} : d₁ ≤ d₂ → d
372372
apply ManyOneReducible.trans
373373

374374
instance instPartialOrder : PartialOrder ManyOneDegree where
375-
le := (· ≤ ·)
376375
le_refl := le_refl
377376
le_trans _ _ _ := le_trans
378377
le_antisymm _ _ := le_antisymm

Mathlib/Data/Finsupp/Lex.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ instance Lex.partialOrder [PartialOrder N] : PartialOrder (Lex (α →₀ N)) wh
8080

8181
/-- The linear order on `Finsupp`s obtained by the lexicographic ordering. -/
8282
instance Lex.linearOrder [LinearOrder N] : LinearOrder (Lex (α →₀ N)) where
83-
lt := (· < ·)
84-
le := (· ≤ ·)
83+
__ := Lex.partialOrder
8584
__ := LinearOrder.lift' (toLex ∘ toDFinsupp ∘ ofLex) finsuppEquivDFinsupp.injective
8685

8786
theorem Lex.single_strictAnti : StrictAnti fun (a : α) ↦ toLex (single a 1) := by

0 commit comments

Comments
 (0)