Documentation

CslibFrontier.Foundations.Combinatorics.Multidigraph.Basic

Multidigraphs given by source and target maps #

A multidigraph on vertices V with arcs E (parallel arcs and self-loops allowed) is represented by its endpoint maps src tgt : E → V. Forgetting arc multiplicities yields the underlying Digraph V (Cslib.Multidigraph.toDigraph); conversely, any simple directed graph G : Digraph V embeds as the multidigraph on its arc subtype Cslib.Multidigraph.Arc G via Cslib.Multidigraph.arcSrc and Cslib.Multidigraph.arcTgt, recovering G under toDigraph (Cslib.Multidigraph.toDigraph_arcSrc_arcTgt).

This module also defines spanning in-arborescences Cslib.Multidigraph.IsInArborescence and proves their parent-iteration characterization (Cslib.Multidigraph.isInArborescence_iff_exists_iterate), from which both simple-digraph parent arborescences (Digraph.Arborescence) and multidigraph matrix-tree theorems (Multidigraph.Arborescence) derive.

Main definitions #

Main results #

def Cslib.Multidigraph.toDigraph {V : Type u_1} {E : Type u_2} (src tgt : E → V) :

The simple directed graph Digraph V underlying src tgt : E → V, keeping self-loops and merging parallel arcs.

@[simp]
theorem Cslib.Multidigraph.toDigraph_adj {V : Type u_1} {E : Type u_2} {src tgt : E → V} {u v : V} :
(toDigraph src tgt).Adj u v ↔ ∃ (e : E), src e = u ∧ tgt e = v
@[reducible, inline]
abbrev Cslib.Multidigraph.Arc {V : Type u_1} (G : Digraph V) :
Type u_1

The arc subtype {e : V × V // G.Adj e.1 e.2} viewing G : Digraph V as a multidigraph without parallel arcs.

def Cslib.Multidigraph.arcSrc {V : Type u_1} (G : Digraph V) (e : Arc G) :
V

Source map of the canonical multidigraph of G : Digraph V.

def Cslib.Multidigraph.arcTgt {V : Type u_1} (G : Digraph V) (e : Arc G) :
V

Target map of the canonical multidigraph of G : Digraph V.

@[simp]
theorem Cslib.Multidigraph.arcSrc_mk {V : Type u_1} {G : Digraph V} (e : V × V) (he : G.Adj e.1 e.2) :
arcSrc G ⟨e, he⟩ = e.1
@[simp]
theorem Cslib.Multidigraph.arcTgt_mk {V : Type u_1} {G : Digraph V} (e : V × V) (he : G.Adj e.1 e.2) :
arcTgt G ⟨e, he⟩ = e.2
theorem Cslib.Multidigraph.arc_ext_iff {V : Type u_1} {G : Digraph V} {e₁ e₂ : Arc G} :
e₁ = e₂ ↔ arcSrc G e₁ = arcSrc G e₂ ∧ arcTgt G e₁ = arcTgt G e₂
@[simp]

Forgetting multiplicities of (arcSrc G, arcTgt G) recovers G.

Spanning in-arborescences and parent iteration #

structure Cslib.Multidigraph.IsInArborescence {V : Type u_1} {E : Type u_2} (src tgt : E → V) (r : V) (f : { v : V // v ≠ r } → E) :

f is a spanning in-arborescence rooted at r of the multidigraph src tgt : E → V: it chooses an arc f v out of every vertex v ≠ r, and following the chosen arcs leads from every vertex to r.

  • src_eq (v : { v : V // v ≠ r }) : src (f v) = ↑v

    The arc chosen at v leaves v.

  • reachable (v : V) : Relation.ReflTransGen (fun (v w : V) => ∃ (h : v ≠ r), tgt (f ⟨v, h⟩) = w) v r

    Following the chosen arcs leads from every vertex to the root.

theorem Cslib.Multidigraph.reflTransGen_of_iterate_eq {V : Type u_1} {r : V} {p : V → V} {n : ℕ} {v : V} :
p^[n] v = r → Relation.ReflTransGen (fun (u w : V) => u ≠ r ∧ p u = w) v r

If iterating p reaches r from v, then v reaches r along non-root steps u ≠ r ∧ p u = w.

theorem Cslib.Multidigraph.exists_iterate_eq_of_reflTransGen {V : Type u_1} {r : V} {p : V → V} {v : V} (h : Relation.ReflTransGen (fun (u w : V) => u ≠ r ∧ p u = w) v r) :
∃ (n : ℕ), p^[n] v = r

If v reaches r along steps u ≠ r ∧ p u = w, then iterating p reaches r from v.

theorem Cslib.Multidigraph.isInArborescence_iff_exists_iterate {V : Type u_1} {E : Type u_2} {src tgt : E → V} {r : V} {f : { v : V // v ≠ r } → E} {p : V → V} (hp : ∀ (v : { v : V // v ≠ r }), p ↑v = tgt (f v)) :
IsInArborescence src tgt r f ↔ (∀ (v : { v : V // v ≠ r }), src (f v) = ↑v) ∧ ∀ (v : V), ∃ (n : ℕ), p^[n] v = r

Given any total parent extension p : V → V agreeing with v ↦ tgt (f v) off r, f is a spanning in-arborescence rooted at r iff each chosen arc leaves its vertex and iterating p reaches r from every vertex.