Skip to content

Commit 8b55d47

Browse files
Refactoring
1 parent b2eb227 commit 8b55d47

1 file changed

Lines changed: 10 additions & 13 deletions

File tree

Mathlib/Combinatorics/SimpleGraph/Bipartite.lean

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -454,17 +454,14 @@ section BipartiteDoubleCover
454454
/-- `bipartiteDoubleCover G` has two vertices `inl v` and `inr v` for each vertex `v` in `G`
455455
such that `inl v` (`inr v`) is adjacent to `inr w` (`inl w`) iff `v` is adjacent to `w` in `G`. -/
456456
@[simp] def bipartiteDoubleCover (G : SimpleGraph V) : SimpleGraph (V ⊕ V) where
457-
Adj v w := match v, w with
458-
| .inl v', .inr w' | .inr v', .inl w' => G.Adj v' w'
459-
| _, _ => False
460-
symm v w := match v, w with
461-
| .inl _, .inr _ | .inr _, .inl _ => G.adj_symm
462-
| .inl _, .inl _ | .inr _, .inr _ => id
463-
464-
instance [h : DecidableRel G.Adj] : DecidableRel G.bipartiteDoubleCover.Adj :=
465-
fun v w ↦ match v, w with
466-
| .inl _, .inr _ | .inr _, .inl _ => h _ _
467-
| .inl _, .inl _ | .inr _, .inr _ => inferInstanceAs (Decidable False)
457+
Adj
458+
| .inl v', .inr w' | .inr v', .inl w' => G.Adj v' w'
459+
| _, _ => False
460+
symm _ _ := by grind [adj_symm]
461+
462+
instance [h : DecidableRel G.Adj] : DecidableRel G.bipartiteDoubleCover.Adj
463+
| .inl _, .inr _ | .inr _, .inl _ => h _ _
464+
| .inl _, .inl _ | .inr _, .inr _ => inferInstanceAs (Decidable False)
468465

469466
/-- The bipartite double cover of `G` is contained in the corresponding complete bipartite graph,
470467
that is, the bipartite double cover of `G` is bipartite. -/
@@ -477,8 +474,8 @@ theorem bipartiteDoubleCover_le : G.bipartiteDoubleCover ≤ completeBipartiteGr
477474
theorem bipartiteDoubleCover_card_edgeFinset [Fintype V] [DecidableRel G.Adj] :
478475
#G.bipartiteDoubleCover.edgeFinset = 2 * #G.edgeFinset := by
479476
rw [two_mul_card_edgeFinset, eq_comm]
480-
apply card_bij (fun (v, w) _ ↦ s(.inl v, .inr w)) (fun _ h ↦ by simpa using h)
481-
(fun (_, _) _ (_, _) _ ↦ by simp) (fun e he ↦ ?_)
477+
apply card_bij (fun (v, w) _ ↦ s(.inl v, .inr w))
478+
(fun _ h ↦ by simpa using h) (by grind) (fun e he ↦ ?_)
482479
induction e with | _ v w
483480
rw [Set.mem_toFinset, mem_edgeSet] at he
484481
match v, w with

0 commit comments

Comments
 (0)