Skip to content

Commit daa4f13

Browse files
eric-wieserdagurtomas
authored andcommitted
chore: register Sym2 with induction (#14288)
Split from #12605 Also cleans up some proofs that used `revert` instead of `induction`.
1 parent 1daae7c commit daa4f13

File tree

6 files changed

+18
-20
lines changed

6 files changed

+18
-20
lines changed

Mathlib/Combinatorics/SimpleGraph/DegreeSum.lean

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ variable (G)
8787

8888
theorem dart_edge_fiber_card [DecidableEq V] (e : Sym2 V) (h : e ∈ G.edgeSet) :
8989
(univ.filter fun d : G.Dart => d.edge = e).card = 2 := by
90-
refine Sym2.ind (fun v w h => ?_) e h
90+
induction' e with v w
9191
let d : G.Dart := ⟨(v, w), h⟩
9292
convert congr_arg card d.edge_fiber
9393
rw [card_insert_of_not_mem, card_singleton]

Mathlib/Combinatorics/SimpleGraph/Finite.lean

+1-1
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ theorem mem_incidenceFinset [DecidableEq V] (e : Sym2 V) :
279279
theorem incidenceFinset_eq_filter [DecidableEq V] [Fintype G.edgeSet] :
280280
G.incidenceFinset v = G.edgeFinset.filter (Membership.mem v) := by
281281
ext e
282-
refine Sym2.ind (fun x y => ?_) e
282+
induction e
283283
simp [mk'_mem_incidenceSet_iff]
284284
#align simple_graph.incidence_finset_eq_filter SimpleGraph.incidenceFinset_eq_filter
285285

Mathlib/Combinatorics/SimpleGraph/Matching.lean

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ theorem IsMatching.toEdge_eq_of_adj {M : Subgraph G} (h : M.IsMatching) {v w : V
7070
theorem IsMatching.toEdge.surjective {M : Subgraph G} (h : M.IsMatching) :
7171
Function.Surjective h.toEdge := by
7272
rintro ⟨e, he⟩
73-
refine Sym2.ind (fun x y he => ?_) e he
73+
induction' e with x y
7474
exact ⟨⟨x, M.edge_vert he⟩, h.toEdge_eq_of_adj _ he⟩
7575
#align simple_graph.subgraph.is_matching.to_edge.surjective SimpleGraph.Subgraph.IsMatching.toEdge.surjective
7676

Mathlib/Combinatorics/SimpleGraph/Subgraph.lean

+3-5
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,7 @@ theorem mem_edgeSet {G' : Subgraph G} {v w : V} : s(v, w) ∈ G'.edgeSet ↔ G'.
245245

246246
theorem mem_verts_if_mem_edge {G' : Subgraph G} {e : Sym2 V} {v : V} (he : e ∈ G'.edgeSet)
247247
(hv : v ∈ e) : v ∈ G'.verts := by
248-
revert hv
249-
refine Sym2.ind (fun v w he ↦ ?_) e he
250-
intro hv
248+
induction e
251249
rcases Sym2.mem_iff.mp hv with (rfl | rfl)
252250
· exact G'.edge_vert he
253251
· exact G'.edge_vert (G'.symm he)
@@ -549,15 +547,15 @@ theorem edgeSet_sup {H₁ H₂ : Subgraph G} : (H₁ ⊔ H₂).edgeSet = H₁.ed
549547
@[simp]
550548
theorem edgeSet_sSup (s : Set G.Subgraph) : (sSup s).edgeSet = ⋃ G' ∈ s, edgeSet G' := by
551549
ext e
552-
induction e using Sym2.ind
550+
induction e
553551
simp
554552
#align simple_graph.subgraph.edge_set_Sup SimpleGraph.Subgraph.edgeSet_sSup
555553

556554
@[simp]
557555
theorem edgeSet_sInf (s : Set G.Subgraph) :
558556
(sInf s).edgeSet = (⋂ G' ∈ s, edgeSet G') ∩ G.edgeSet := by
559557
ext e
560-
induction e using Sym2.ind
558+
induction e
561559
simp
562560
#align simple_graph.subgraph.edge_set_Inf SimpleGraph.Subgraph.edgeSet_sInf
563561

Mathlib/Data/Sym/Sym2.lean

+11-11
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ protected theorem exact {p p' : α × α} (h : Sym2.mk p = Sym2.mk p') : Sym2.Re
124124
protected theorem eq {p p' : α × α} : Sym2.mk p = Sym2.mk p' ↔ Sym2.Rel α p p' :=
125125
Quotient.eq' (s₁ := Sym2.Rel.setoid α)
126126

127-
@[elab_as_elim]
127+
@[elab_as_elim, cases_eliminator, induction_eliminator]
128128
protected theorem ind {f : Sym2 α → Prop} (h : ∀ x y, f s(x, y)) : ∀ i, f i :=
129129
Quot.ind <| Prod.rec <| h
130130
#align sym2.ind Sym2.ind
@@ -273,7 +273,7 @@ theorem map_comp {g : β → γ} {f : α → β} : Sym2.map (g ∘ f) = Sym2.map
273273
#align sym2.map_comp Sym2.map_comp
274274

275275
theorem map_map {g : β → γ} {f : α → β} (x : Sym2 α) : map g (map f x) = map (g ∘ f) x := by
276-
revert x; apply Sym2.ind; aesop
276+
induction x; aesop
277277
#align sym2.map_map Sym2.map_map
278278

279279
@[simp]
@@ -317,8 +317,8 @@ instance : SetLike (Sym2 α) α where
317317
coe z := { x | z.Mem x }
318318
coe_injective' z z' h := by
319319
simp only [Set.ext_iff, Set.mem_setOf_eq] at h
320-
induction' z using Sym2.ind with x y
321-
induction' z' using Sym2.ind with x' y'
320+
induction' z with x y
321+
induction' z' with x' y'
322322
have hx := h x; have hy := h y; have hx' := h x'; have hy' := h y'
323323
simp only [mem_iff', eq_self_iff_true, or_true_iff, iff_true_iff,
324324
true_or_iff, true_iff_iff] at hx hy hx' hy'
@@ -385,7 +385,7 @@ theorem other_mem {a : α} {z : Sym2 α} (h : a ∈ z) : Mem.other h ∈ z := by
385385

386386
theorem mem_and_mem_iff {x y : α} {z : Sym2 α} (hne : x ≠ y) : x ∈ z ∧ y ∈ z ↔ z = s(x, y) := by
387387
constructor
388-
· induction' z using Sym2.ind with x' y'
388+
· induction' z with x' y'
389389
rw [mem_iff, mem_iff]
390390
aesop
391391
· rintro rfl
@@ -405,7 +405,7 @@ end Membership
405405

406406
@[simp]
407407
theorem mem_map {f : α → β} {b : β} {z : Sym2 α} : b ∈ Sym2.map f z ↔ ∃ a, a ∈ z ∧ f a = b := by
408-
induction' z using Sym2.ind with x y
408+
induction' z with x y
409409
simp only [map_pair_eq, mem_iff, exists_eq_or_imp, exists_eq_left]
410410
aesop
411411
#align sym2.mem_map Sym2.mem_map
@@ -465,7 +465,7 @@ theorem diag_isDiag (a : α) : IsDiag (diag a) :=
465465
#align sym2.diag_is_diag Sym2.diag_isDiag
466466

467467
theorem IsDiag.mem_range_diag {z : Sym2 α} : IsDiag z → z ∈ Set.range (@diag α) := by
468-
induction' z using Sym2.ind with x y
468+
induction' z with x y
469469
rintro (rfl : x = y)
470470
exact ⟨_, rfl⟩
471471
#align sym2.is_diag.mem_range_diag Sym2.IsDiag.mem_range_diag
@@ -692,7 +692,7 @@ def Mem.other' [DecidableEq α] {a : α} {z : Sym2 α} (h : a ∈ z) : α :=
692692

693693
@[simp]
694694
theorem other_spec' [DecidableEq α] {a : α} {z : Sym2 α} (h : a ∈ z) : s(a, Mem.other' h) = z := by
695-
induction z using Sym2.ind
695+
induction z
696696
have h' := mem_iff.mp h
697697
aesop (add norm unfold [Sym2.rec, Quot.rec]) (rule_sets := [Sym2])
698698
#align sym2.other_spec' Sym2.other_spec'
@@ -709,7 +709,7 @@ theorem other_mem' [DecidableEq α] {a : α} {z : Sym2 α} (h : a ∈ z) : Mem.o
709709

710710
theorem other_invol' [DecidableEq α] {a : α} {z : Sym2 α} (ha : a ∈ z) (hb : Mem.other' ha ∈ z) :
711711
Mem.other' hb = a := by
712-
induction z using Sym2.ind
712+
induction z
713713
aesop (rule_sets := [Sym2]) (add norm unfold [Sym2.rec, Quot.rec])
714714
#align sym2.other_invol' Sym2.other_invol'
715715

@@ -724,7 +724,7 @@ theorem other_invol {a : α} {z : Sym2 α} (ha : a ∈ z) (hb : Mem.other ha ∈
724724
theorem filter_image_mk_isDiag [DecidableEq α] (s : Finset α) :
725725
((s ×ˢ s).image Sym2.mk).filter IsDiag = s.diag.image Sym2.mk := by
726726
ext z
727-
induction' z using Sym2.inductionOn
727+
induction' z
728728
simp only [mem_image, mem_diag, exists_prop, mem_filter, Prod.exists, mem_product]
729729
constructor
730730
· rintro ⟨⟨a, b, ⟨ha, hb⟩, h⟩, hab⟩
@@ -739,7 +739,7 @@ theorem filter_image_mk_not_isDiag [DecidableEq α] (s : Finset α) :
739739
(((s ×ˢ s).image Sym2.mk).filter fun a : Sym2 α => ¬a.IsDiag) =
740740
s.offDiag.image Sym2.mk := by
741741
ext z
742-
induction z using Sym2.inductionOn
742+
induction z
743743
simp only [mem_image, mem_offDiag, mem_filter, Prod.exists, mem_product]
744744
constructor
745745
· rintro ⟨⟨a, b, ⟨ha, hb⟩, h⟩, hab⟩

Mathlib/Order/GameAdd.lean

+1-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ theorem Acc.sym2_gameAdd {a b} (ha : Acc rα a) (hb : Acc rα b) :
200200
induction' ha with a _ iha generalizing b
201201
induction' hb with b hb ihb
202202
refine Acc.intro _ fun s => ?_
203-
induction' s using Sym2.inductionOn with c d
203+
induction' s with c d
204204
rw [Sym2.GameAdd]
205205
dsimp
206206
rintro ((rc | rd) | (rd | rc))

0 commit comments

Comments
 (0)