Skip to content

Commit c6636bb

Browse files
committed
chore(SimpleGraph/Finite): drop some DecidableEq assumptions (#10441)
- don't assume `DecidableEq` in `card_edgeFinset_le_card_choose_two`; - make `edgeFinset_deleteEdges` work with any `Fintype G.edgeSet` and `Fintype (G.deleteEdges s).edgeSet` instances; - don't assume `DecidbaleEq` in theorems about `DeleteFar`.
1 parent 4597f54 commit c6636bb

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

Mathlib/Combinatorics/SimpleGraph/Finite.lean

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -114,28 +114,28 @@ theorem edgeSet_univ_card : (univ : Finset G.edgeSet).card = G.edgeFinset.card :
114114
Fintype.card_of_subtype G.edgeFinset fun _ => mem_edgeFinset
115115
#align simple_graph.edge_set_univ_card SimpleGraph.edgeSet_univ_card
116116

117-
variable [Fintype V] [DecidableEq V]
117+
variable [Fintype V]
118118

119119
@[simp]
120-
theorem edgeFinset_top : (⊤ : SimpleGraph V).edgeFinset = univ.filter fun e => ¬e.IsDiag := by
120+
theorem edgeFinset_top [DecidableEq V] :
121+
(⊤ : SimpleGraph V).edgeFinset = univ.filter fun e => ¬e.IsDiag := by
121122
rw [← coe_inj]; simp
122123

123124
/-- The complete graph on `n` vertices has `n.choose 2` edges. -/
124-
theorem card_edgeFinset_top_eq_card_choose_two :
125+
theorem card_edgeFinset_top_eq_card_choose_two [DecidableEq V] :
125126
(⊤ : SimpleGraph V).edgeFinset.card = (Fintype.card V).choose 2 := by
126127
simp_rw [Set.toFinset_card, edgeSet_top, Set.coe_setOf, ← Sym2.card_subtype_not_diag]
127128

128129
/-- Any graph on `n` vertices has at most `n.choose 2` edges. -/
129130
theorem card_edgeFinset_le_card_choose_two : G.edgeFinset.card ≤ (Fintype.card V).choose 2 := by
131+
classical
130132
rw [← card_edgeFinset_top_eq_card_choose_two]
131133
exact card_le_card (edgeFinset_mono le_top)
132134

133135
end EdgeFinset
134136

135-
-- porting note: added `Fintype (Sym2 V)` argument rather than have it be inferred.
136-
-- As a consequence, deleted the `Fintype V` argument.
137-
theorem edgeFinset_deleteEdges [Fintype (Sym2 V)] [DecidableEq V] [DecidableRel G.Adj]
138-
(s : Finset (Sym2 V)) [DecidableRel (G.deleteEdges s).Adj] :
137+
theorem edgeFinset_deleteEdges [DecidableEq V] [Fintype G.edgeSet] (s : Finset (Sym2 V))
138+
[Fintype (G.deleteEdges s).edgeSet] :
139139
(G.deleteEdges s).edgeFinset = G.edgeFinset \ s := by
140140
ext e
141141
simp [edgeSet_deleteEdges]
@@ -144,8 +144,8 @@ theorem edgeFinset_deleteEdges [Fintype (Sym2 V)] [DecidableEq V] [DecidableRel
144144
section DeleteFar
145145

146146
-- porting note: added `Fintype (Sym2 V)` argument.
147-
variable {𝕜 : Type*} [OrderedRing 𝕜] [Fintype V] [Fintype (Sym2 V)] [DecidableEq V]
148-
[DecidableRel G.Adj] {p : SimpleGraph V → Prop} {r r₁ r₂ : 𝕜}
147+
variable {𝕜 : Type*} [OrderedRing 𝕜] [Fintype V] [Fintype (Sym2 V)]
148+
[Fintype G.edgeSet] {p : SimpleGraph V → Prop} {r r₁ r₂ : 𝕜}
149149

150150
/-- A graph is `r`-*delete-far* from a property `p` if we must delete at least `r` edges from it to
151151
get a graph with the property `p`. -/
@@ -158,6 +158,7 @@ variable {G}
158158
theorem deleteFar_iff :
159159
G.DeleteFar p r ↔ ∀ ⦃H : SimpleGraph _⦄ [DecidableRel H.Adj],
160160
H ≤ G → p H → r ≤ G.edgeFinset.card - H.edgeFinset.card := by
161+
classical
161162
refine ⟨fun h H _ hHG hH ↦ ?_, fun h s hs hG ↦ ?_⟩
162163
· have := h (sdiff_subset G.edgeFinset H.edgeFinset)
163164
simp only [deleteEdges_sdiff_eq_of_le _ hHG, edgeFinset_mono hHG, card_sdiff,

0 commit comments

Comments
 (0)