File: Mathlib/Combinatorics/Quiver/Arborescence.lean

full_name: Quiver.Arborescence
code: /-- A quiver is an arborescence when there is a unique path from the default vertex
    to every other vertex. -/
class Arborescence (V : Type u) [Quiver.{v} V] : Type max u v where
  /-- The root of the arborescence. -/
  root : V
  /-- There is a unique path from the root to any other vertex. -/
  uniquePath : ∀ b : V, Unique (Path root b)
goal: Type (max u v)

full_name: Quiver.Arborescence.root
code: /-- A quiver is an arborescence when there is a unique path from the default vertex
    to every other vertex. -/
class Arborescence (V : Type u) [Quiver.{v} V] : Type max u v where
  /-- The root of the arborescence. -/
  root : V
  /-- There is a unique path from the root to any other vertex. -/
  uniquePath : ∀ b : V, Unique (Path root b)
goal: V

full_name: Quiver.Arborescence.uniquePath
code: /-- A quiver is an arborescence when there is a unique path from the default vertex
    to every other vertex. -/
class Arborescence (V : Type u) [Quiver.{v} V] : Type max u v where
  /-- The root of the arborescence. -/
  root : V
  /-- There is a unique path from the root to any other vertex. -/
  uniquePath : ∀ b : V, Unique (Path root b)
goal: Unique (Quiver.Path Quiver.Arborescence.root b)

full_name: Quiver.root
code: /-- The root of an arborescence. -/
def root (V : Type u) [Quiver V] [Arborescence V] : V 
goal: V

full_name: Quiver.instUniquePathRoot
code: instance {V : Type u} [Quiver V] [Arborescence V] (b : V) : Unique (Path (root V) b) 
goal: Unique (Quiver.Path (Quiver.root V) b)

full_name: Quiver.arborescenceMk
code: /-- To show that `[Quiver V]` is an arborescence with root `r : V`, it suffices to
  - provide a height function `V → ℕ` such that every arrow goes from a
    lower vertex to a higher vertex,
  - show that every vertex has at most one arrow to it, and
  - show that every vertex other than `r` has an arrow to it. -/
noncomputable def arborescenceMk {V : Type u} [Quiver V] (r : V) (height : V → ℕ)
    (height_lt : ∀ ⦃a b⦄, (a ⟶ b) → height a < height b)
    (unique_arrow : ∀ ⦃a b c : V⦄ (e : a ⟶ c) (f : b ⟶ c), a = b ∧ HEq e f)
    (root_or_arrow : ∀ b, b = r ∨ ∃ a, Nonempty (a ⟶ b)) :
    Arborescence V 
goal: Quiver.Arborescence V

full_name: Quiver.RootedConnected.nonempty_path
code: /-- `RootedConnected r` means that there is a path from `r` to any other vertex. -/
class RootedConnected {V : Type u} [Quiver V] (r : V) : Prop where
  nonempty_path : ∀ b : V, Nonempty (Path r b)
goal: Nonempty (Quiver.Path r b)

full_name: Quiver.RootedConnected
code: /-- `RootedConnected r` means that there is a path from `r` to any other vertex. -/
class RootedConnected {V : Type u} [Quiver V] (r : V) : Prop where
  nonempty_path : ∀ b : V, Nonempty (Path r b)
goal: Prop

full_name: Quiver.shortestPath
code: /-- A path from `r` of minimal length. -/
noncomputable def shortestPath (b : V) : Path r b 
goal: Quiver.Path r b

full_name: Quiver.shortest_path_spec
code: /-- The length of a path is at least the length of the shortest path -/
theorem shortest_path_spec {a : V} (p : Path r a) : (shortestPath r a).length ≤ p.length 
goal: (Quiver.shortestPath r a).length ≤ p.length

full_name: Quiver.geodesicSubtree
code: /-- A subquiver which by construction is an arborescence. -/
def geodesicSubtree : WideSubquiver V 
goal: WideSubquiver V

full_name: Quiver.geodesicArborescence
code: noncomputable instance geodesicArborescence : Arborescence (geodesicSubtree r) 
goal: Quiver.Arborescence (WideSubquiver.toType V (Quiver.geodesicSubtree r))