The areas / V24. Category theory
Mathlib.Combinatorics.Quiver.ConnectedComponent
28 declarations. Mathlib docs · Source
Weakly and strongly connected components
For a quiver V, define the type WeaklyConnectedComponent V as the quotient of V by
the relation which identifies a with b if there is a path from a to b in Symmetrify V.
(These zigzags can be seen as a proof-relevant analogue of EqvGen.)
We define:
Quiver.IsStronglyConnected V: every pair of vertices is connected by a (possibly empty) path.Quiver.IsSStronglyConnected V: every pair of vertices is connected by a path of positive length.Quiver.StronglyConnectedComponent V: the quotient by the equivalence relation “paths in both directions”.
These concepts relate strong and weak connectivity and let us reason about strongly connected components in directed graphs.
Strongly connected components (directed connectivity)
We define strong connectivity (IsStronglyConnected), its positive-length refinement
(IsSStronglyConnected), and strongly connected components.
def Quiver.zigzagSetoid E1 #
(V : Type u_1) → [Quiver V] → Setoid V
Two vertices are related in the zigzag setoid if there is a zigzag of arrows from one to the other.
def Quiver.WeaklyConnectedComponent E1 #
(V : Type u_1) → [Quiver V] → Type u_1
The type of weakly connected components of a directed graph. Two vertices are in the same weakly connected component if there is a zigzag of arrows from one to the other.
def Quiver.WeaklyConnectedComponent.mk E1 #
{V : Type u_1} → [inst : Quiver V] → V → Quiver.WeaklyConnectedComponent V
The weakly connected component corresponding to a vertex.
instance Quiver.WeaklyConnectedComponent.instCoeTC E0 #
{V : Type u_1} → [inst : Quiver V] → CoeTC V (Quiver.WeaklyConnectedComponent V)
instance Quiver.WeaklyConnectedComponent.instInhabited E0 #
{V : Type u_1} → [inst : Quiver V] → [Inhabited V] → Inhabited (Quiver.WeaklyConnectedComponent V)
theorem Quiver.WeaklyConnectedComponent.eq E1 #
∀ {V : Type u_1} [inst : Quiver V] (a b : V),
Quiver.WeaklyConnectedComponent.mk a = Quiver.WeaklyConnectedComponent.mk b ↔ Nonempty (Quiver.Path a b)
def Quiver.wideSubquiverSymmetrify E1 #
{V : Type u_1} → [inst : Quiver V] → WideSubquiver (Quiver.Symmetrify V) → WideSubquiver V
A wide subquiver H of Symmetrify V determines a wide subquiver of V, containing an
arrow e if either e or its reversal is in H.
def Quiver.IsStronglyConnected E1 #
(V : Type u_2) → [Quiver V] → Prop
Strong connectivity: every ordered pair of vertices is joined by a (possibly empty) directed path.
def Quiver.IsSStronglyConnected E1 #
(V : Type u_2) → [Quiver V] → Prop
Positive strong connectivity: every ordered pair of vertices is joined by a directed path of positive length.
theorem Quiver.isStronglyConnected_iff E0 #
∀ (V : Type u_2) [inst : Quiver V], Quiver.IsStronglyConnected V ↔ ∀ (i j : V), Nonempty (Quiver.Path i j)
theorem Quiver.isSStronglyConnected_iff E0 #
∀ (V : Type u_2) [inst : Quiver V], Quiver.IsSStronglyConnected V ↔ ∀ (i j : V), ∃ p, 0 < p.length
theorem Quiver.IsStronglyConnected.nonempty_path E1 #
∀ (V : Type u_2) [inst : Quiver V], Quiver.IsStronglyConnected V → ∀ (i j : V), Nonempty (Quiver.Path i j)
theorem Quiver.IsSStronglyConnected.exists_pos_path E1 #
∀ (V : Type u_2) [inst : Quiver V], Quiver.IsSStronglyConnected V → ∀ (i j : V), ∃ p, 0 < p.length
theorem Quiver.IsSStronglyConnected.exists_pos_cycle E1 #
∀ (V : Type u_2) [inst : Quiver V], Quiver.IsSStronglyConnected V → ∀ (i : V), ∃ p, 0 < p.length
theorem Quiver.IsSStronglyConnected.isStronglyConnected E1 #
∀ (V : Type u_2) [inst : Quiver V], Quiver.IsSStronglyConnected V → Quiver.IsStronglyConnected V
def Quiver.stronglyConnectedSetoid E1 #
(V : Type u_2) → [Quiver V] → Setoid V
Equivalence relation identifying vertices connected by directed paths in both directions.
def Quiver.StronglyConnectedComponent E1 #
(V : Type u_2) → [Quiver V] → Type u_2
The type of strongly connected components (bidirectional reachability classes).
def Quiver.StronglyConnectedComponent.mk E1 #
{V : Type u_2} → [inst : Quiver V] → V → Quiver.StronglyConnectedComponent V
The canonical map from a vertex to its strongly connected component.
instance Quiver.StronglyConnectedComponent.instCoe E0 #
{V : Type u_2} → [inst : Quiver V] → Coe V (Quiver.StronglyConnectedComponent V)
instance Quiver.StronglyConnectedComponent.instInhabited E0 #
{V : Type u_2} → [inst : Quiver V] → [Inhabited V] → Inhabited (Quiver.StronglyConnectedComponent V)
theorem Quiver.StronglyConnectedComponent.eq E1 #
∀ {V : Type u_2} [inst : Quiver V] (a b : V),
Quiver.StronglyConnectedComponent.mk a = Quiver.StronglyConnectedComponent.mk b ↔
Nonempty (Quiver.Path a b) ∧ Nonempty (Quiver.Path b a)
theorem Quiver.StronglyConnectedComponent.mk_eq_mk E0 #
∀ {V : Type u_2} [inst : Quiver V] {a b : V},
Quiver.StronglyConnectedComponent.mk a = Quiver.StronglyConnectedComponent.mk b ↔
Nonempty (Quiver.Path a b) ∧ Nonempty (Quiver.Path b a)
theorem Quiver.StronglyConnectedComponent.IsSStronglyConnected.pos_cycle E1 #
∀ {V : Type u_2} [inst : Quiver V], Quiver.IsSStronglyConnected V → ∀ (v : V), ∃ p, 0 < p.length
theorem Quiver.stronglyConnectedComponent_eq_of_path E1 #
∀ {V : Type u_2} [inst : Quiver V] {a b : V},
Nonempty (Quiver.Path a b) →
Nonempty (Quiver.Path b a) → Quiver.StronglyConnectedComponent.mk a = Quiver.StronglyConnectedComponent.mk b
theorem Quiver.exists_path_of_stronglyConnectedComponent_eq E0 #
∀ {V : Type u_2} [inst : Quiver V] {a b : V},
Quiver.StronglyConnectedComponent.mk a = Quiver.StronglyConnectedComponent.mk b →
Nonempty (Quiver.Path a b) ∧ Nonempty (Quiver.Path b a)
theorem Quiver.stronglyConnectedComponent_singleton_iff E0 #
∀ {V : Type u_2} [inst : Quiver V] (v : V),
(∀ (w : V), Quiver.StronglyConnectedComponent.mk w = Quiver.StronglyConnectedComponent.mk v → w = v) ↔
∀ (w : V), w ≠ v → ¬(Nonempty (Quiver.Path v w) ∧ Nonempty (Quiver.Path w v))
theorem Quiver.IsStronglyConnected.isStronglyConnected_symmetrify E1 #
∀ {V : Type u_2} [inst : Quiver V], Quiver.IsStronglyConnected V → Quiver.IsStronglyConnected (Quiver.Symmetrify V)
theorem Quiver.IsStronglyConnected.isSStronglyConnected_of_hom E1 #
∀ {V : Type u_2} [inst : Quiver V],
Quiver.IsStronglyConnected V → ∀ {i₀ j₀ : V} (e₀ : i₀ ⟶ j₀), Quiver.IsSStronglyConnected V