Skip to content

Commit 1a46bca

Browse files
feat(Combinatorics/SimpleGraph/Connectivity/Connected): add useful lemmas on the way to connected_or_connected_compl
Co-authored-by: Yaël Dillies <yael.dillies@gmail.com>
1 parent ffc0b2f commit 1a46bca

1 file changed

Lines changed: 17 additions & 16 deletions

File tree

Mathlib/Combinatorics/SimpleGraph/Connectivity/Connected.lean

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -296,22 +296,23 @@ theorem Iso.connected_iff {G : SimpleGraph V} {H : SimpleGraph V'} (e : G ≃g H
296296
G.Connected ↔ H.Connected :=
297297
⟨Connected.map e.toHom e.toEquiv.surjective, Connected.map e.symm.toHom e.symm.toEquiv.surjective⟩
298298

299-
theorem connected_or_connected_compl [Nonempty V] : G.Connected ∨ Gᶜ.Connected := by
300-
have ⟨v₀⟩ := ‹Nonempty V›
301-
by_cases hreach₀ : ∀ v, G.Reachable v₀ v
302-
· exact .inl <| G.connected_iff_exists_forall_reachable.mpr ⟨v₀, hreach₀⟩
303-
refine .inr <| Gᶜ.connected_iff_exists_forall_reachable.mpr ⟨v₀, fun v ↦ ?_⟩
304-
have ⟨v₁, hreach₁⟩ := not_forall.mp hreach₀
305-
have hcadj₁ : Gᶜ.Adj v₀ v₁ :=
306-
fun heq ↦ heq ▸ hreach₁ <| Reachable.refl _, mt Adj.reachable hreach₁⟩
307-
by_cases hreach : G.Reachable v₀ v
308-
· by_cases heq : v = v₁
309-
· exact heq ▸ hcadj₁.reachable
310-
have : Gᶜ.Adj v v₁ := ⟨heq, fun hadj ↦ hreach₁ <| hreach.trans hadj.reachable⟩
311-
exact hcadj₁.reachable.trans this.reachable.symm
312-
by_cases heq : v₀ = v
313-
· exact heq ▸ .refl _
314-
exact Adj.reachable ⟨heq, mt Adj.reachable hreach⟩
299+
lemma reachable_or_compl_adj (u v : V) : G.Reachable u v ∨ Gᶜ.Adj u v :=
300+
or_iff_not_imp_left.mpr fun huv ↦ ⟨fun heq ↦ huv <| heq ▸ Reachable.rfl, mt Adj.reachable huv⟩
301+
302+
theorem reachable_or_reachable_compl (u v w : V) : G.Reachable u v ∨ Gᶜ.Reachable u w :=
303+
or_iff_not_imp_left.mpr fun huv ↦ (em <| G.Reachable u w).elim
304+
(fun huw ↦ G.reachable_or_compl_adj .. |>.resolve_left huv |>.reachable.trans <|
305+
(G.reachable_or_compl_adj .. |>.resolve_left fun hvw ↦ huv <| huw.trans hvw.symm).reachable)
306+
(fun huw ↦ G.reachable_or_compl_adj .. |>.resolve_left huw |>.reachable)
307+
308+
theorem connected_or_preconnected_compl : G.Connected ∨ Gᶜ.Preconnected := by
309+
rw [or_iff_not_imp_left, G.connected_iff_exists_forall_reachable]
310+
push_neg
311+
exact fun h ↦ fun u v ↦ h u |>.elim fun w huw ↦
312+
reachable_or_reachable_compl .. |>.resolve_left huw
313+
314+
theorem connected_or_connected_compl [Nonempty V] : G.Connected ∨ Gᶜ.Connected :=
315+
G.connected_or_preconnected_compl.elim .inl (.inr ⟨·⟩)
315316

316317
/-- The quotient of `V` by the `SimpleGraph.Reachable` relation gives the connected
317318
components of a graph. -/

0 commit comments

Comments
 (0)