The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V30. Combinatorics

Mathlib.Combinatorics.Graph.Basic

113 declarations and 1 deprecated aliases. Mathlib docs · Source

Multigraphs

A multigraph is a set of vertices and a set of edges, together with incidence data that associates each edge e with an unordered pair s(x,y) of vertices called the ends of e. The pair of e and s(x,y) is called a link. The vertices x and y may be equal, in which case e is a loop. There may be more than one edge with the same ends.

If a multigraph has no loops and has at most one edge for every given ends, it is called simple, and these objects are also formalized as SimpleGraph.

This module defines Graph α β for a vertex type α and an edge type β, and gives basic API for incidence, adjacency and extensionality. The design broadly follows [Chou1994].

Main definitions

For G : Graph α β, ...

  • V(G) denotes the vertex set of G as a term in Set α.
  • E(G) denotes the edge set of G as a term in Set β.
  • G.IsLink e x y means that the edge e : β has vertices x : α and y : α as its ends.
  • G.Inc e x means that the edge e : β has x as one of its ends.
  • G.Adj x y means that there is an edge e having x and y as its ends.
  • G.IsLoopAt e x means that e is a loop edge with both ends equal to x.
  • G.IsNonloopAt e x means that e is a non-loop edge with one end equal to x.
  • G.incidenceSet x is the set of edges incident to x.
  • G.loopSet x is the set of loops with both ends equal to x.
  • G.copy creates a definitional copy of a graph with propositionally equal data.
  • G.Compatible H means that G and H agree on the incidence relation for their shared edges.
  • Graph.noEdge V is the graph with vertex set V and no edges.
  • Graph.bouquet v E is the graph with vertex set {v} and edge set E, where every edge is a loop at v.
  • Graph.banana u v E is the graph with vertex set {u, v} and edge set E, where every edge connects u and v.

Implementation notes

Unlike the design of SimpleGraph, the vertex and edge sets of G are modelled as sets V(G) : Set α and E(G) : Set β, within ambient types, rather than being types themselves. This mimics the 'embedded set' design used in Matroid, which seems to be more convenient for formalizing real-world proofs in combinatorics.

A specific advantage is that this allows subgraphs of G : Graph α β to also exist on an equal footing with G as terms in Graph α β, and so there is no need for a Graph.subgraph type and all the associated definitions and canonical coercion maps. The same will go for minors and the various other partial orders on multigraphs.

The main tradeoff is that parts of the API will need to care about whether a term x : α or e : β is a 'real' vertex or edge of the graph, rather than something outside the vertex or edge set. This is an issue, but is likely amenable to automation.

Notation

Reflecting written mathematics, we use the compact notations V(G) and E(G) to refer to the vertexSet and edgeSet of G : Graph α β. If G.IsLink e x y then we refer to e as edge and x and y as left and right in names.

Edge-vertex-vertex incidence

Edge-vertex incidence

Adjacency

Extensionality

Sets of edges or loops incident to a vertex

Compatibility of Graphs

We define two graphs to be Compatible if for each edge belonging to their shared edge set, the incidence relation (i.e., which pairs of vertices it links) is the same in both graphs.

Graphs with no edges

Graphs with two vertices

Graphs with one vertex

theorem Graph.mk.inj E1 #

∀ {α : Type u_3} {β : Type u_4} {vertexSet : Set α} {IsLink : β → α → α → Prop} {edgeSet : Set β}
  {isLink_symm : ∀ ⦃e : β⦄, e ∈ edgeSet → Std.Symm (IsLink e)}
  {eq_or_eq_of_isLink_of_isLink : ∀ ⦃e : β⦄ ⦃x y v w : α⦄, IsLink e x y → IsLink e v w → x = v ∨ x = w}
  {edge_mem_iff_exists_isLink :
    autoParam (∀ (e : β), e ∈ edgeSet ↔ ∃ x y, IsLink e x y) Graph.edge_mem_iff_exists_isLink._autoParam}
  {left_mem_of_isLink :
    autoParam (∀ ⦃e : β⦄ ⦃x y : α⦄, IsLink e x y → x ∈ vertexSet) Graph.left_mem_of_isLink._autoParam}
  {vertexSet_1 : Set α} {IsLink_1 : β → α → α → Prop} {edgeSet_1 : Set β}
  {isLink_symm_1 : ∀ ⦃e : β⦄, e ∈ edgeSet_1 → Std.Symm (IsLink_1 e)}
  {eq_or_eq_of_isLink_of_isLink_1 : ∀ ⦃e : β⦄ ⦃x y v w : α⦄, IsLink_1 e x y → IsLink_1 e v w → x = v ∨ x = w}
  {edge_mem_iff_exists_isLink_1 :
    autoParam (∀ (e : β), e ∈ edgeSet_1 ↔ ∃ x y, IsLink_1 e x y) Graph.edge_mem_iff_exists_isLink._autoParam}
  {left_mem_of_isLink_1 :
    autoParam (∀ ⦃e : β⦄ ⦃x y : α⦄, IsLink_1 e x y → x ∈ vertexSet_1) Graph.left_mem_of_isLink._autoParam},
  { vertexSet := vertexSet, IsLink := IsLink, edgeSet := edgeSet, isLink_symm := isLink_symm,
        eq_or_eq_of_isLink_of_isLink := eq_or_eq_of_isLink_of_isLink,
        edge_mem_iff_exists_isLink := edge_mem_iff_exists_isLink, left_mem_of_isLink := left_mem_of_isLink } =
      { vertexSet := vertexSet_1, IsLink := IsLink_1, edgeSet := edgeSet_1, isLink_symm := isLink_symm_1,
        eq_or_eq_of_isLink_of_isLink := eq_or_eq_of_isLink_of_isLink_1,
        edge_mem_iff_exists_isLink := edge_mem_iff_exists_isLink_1, left_mem_of_isLink := left_mem_of_isLink_1 } →
    vertexSet = vertexSet_1 ∧ IsLink = IsLink_1 ∧ edgeSet = edgeSet_1

theorem Graph.mk.congr_simp E1 #

∀ {α : Type u_3} {β : Type u_4} (vertexSet vertexSet_1 : Set α) (e_vertexSet : vertexSet = vertexSet_1)
  (IsLink IsLink_1 : β → α → α → Prop) (e_IsLink : IsLink = IsLink_1) (edgeSet edgeSet_1 : Set β)
  (e_edgeSet : edgeSet = edgeSet_1) (isLink_symm : ∀ ⦃e : β⦄, e ∈ edgeSet → Std.Symm (IsLink e))
  (eq_or_eq_of_isLink_of_isLink : ∀ ⦃e : β⦄ ⦃x y v w : α⦄, IsLink e x y → IsLink e v w → x = v ∨ x = w)
  (edge_mem_iff_exists_isLink : ∀ (e : β), e ∈ edgeSet ↔ ∃ x y, IsLink e x y)
  (left_mem_of_isLink : ∀ ⦃e : β⦄ ⦃x y : α⦄, IsLink e x y → x ∈ vertexSet),
  { vertexSet := vertexSet, IsLink := IsLink, edgeSet := edgeSet, isLink_symm := isLink_symm,
      eq_or_eq_of_isLink_of_isLink := eq_or_eq_of_isLink_of_isLink,
      edge_mem_iff_exists_isLink := edge_mem_iff_exists_isLink, left_mem_of_isLink := left_mem_of_isLink } =
    { vertexSet := vertexSet_1, IsLink := IsLink_1, edgeSet := edgeSet_1, isLink_symm := ⋯,
      eq_or_eq_of_isLink_of_isLink := ⋯, edge_mem_iff_exists_isLink := ⋯, left_mem_of_isLink := ⋯ }

def Graph.ctorIdx E1 #

{α : Type u_3} → {β : Type u_4} → Graph α β → ℕ

theorem Graph.mk.injEq E0 #

∀ {α : Type u_3} {β : Type u_4} (vertexSet : Set α) (IsLink : β → α → α → Prop) (edgeSet : Set β)
  (isLink_symm : ∀ ⦃e : β⦄, e ∈ edgeSet → Std.Symm (IsLink e))
  (eq_or_eq_of_isLink_of_isLink : ∀ ⦃e : β⦄ ⦃x y v w : α⦄, IsLink e x y → IsLink e v w → x = v ∨ x = w)
  (edge_mem_iff_exists_isLink :
    autoParam (∀ (e : β), e ∈ edgeSet ↔ ∃ x y, IsLink e x y) Graph.edge_mem_iff_exists_isLink._autoParam)
  (left_mem_of_isLink :
    autoParam (∀ ⦃e : β⦄ ⦃x y : α⦄, IsLink e x y → x ∈ vertexSet) Graph.left_mem_of_isLink._autoParam)
  (vertexSet_1 : Set α) (IsLink_1 : β → α → α → Prop) (edgeSet_1 : Set β)
  (isLink_symm_1 : ∀ ⦃e : β⦄, e ∈ edgeSet_1 → Std.Symm (IsLink_1 e))
  (eq_or_eq_of_isLink_of_isLink_1 : ∀ ⦃e : β⦄ ⦃x y v w : α⦄, IsLink_1 e x y → IsLink_1 e v w → x = v ∨ x = w)
  (edge_mem_iff_exists_isLink_1 :
    autoParam (∀ (e : β), e ∈ edgeSet_1 ↔ ∃ x y, IsLink_1 e x y) Graph.edge_mem_iff_exists_isLink._autoParam)
  (left_mem_of_isLink_1 :
    autoParam (∀ ⦃e : β⦄ ⦃x y : α⦄, IsLink_1 e x y → x ∈ vertexSet_1) Graph.left_mem_of_isLink._autoParam),
  ({ vertexSet := vertexSet, IsLink := IsLink, edgeSet := edgeSet, isLink_symm := isLink_symm,
        eq_or_eq_of_isLink_of_isLink := eq_or_eq_of_isLink_of_isLink,
        edge_mem_iff_exists_isLink := edge_mem_iff_exists_isLink, left_mem_of_isLink := left_mem_of_isLink } =
      { vertexSet := vertexSet_1, IsLink := IsLink_1, edgeSet := edgeSet_1, isLink_symm := isLink_symm_1,
        eq_or_eq_of_isLink_of_isLink := eq_or_eq_of_isLink_of_isLink_1,
        edge_mem_iff_exists_isLink := edge_mem_iff_exists_isLink_1, left_mem_of_isLink := left_mem_of_isLink_1 }) =
    (vertexSet = vertexSet_1 ∧ IsLink = IsLink_1 ∧ edgeSet = edgeSet_1)

structure Graph E3 #

Type u_3 → Type u_4 → Type (max u_3 u_4)

A multigraph with vertices of type α and edges of type β, as described by vertex and edge sets vertexSet : Set α and edgeSet : Set β, and a predicate IsLink describing whether an edge e : β has vertices x y : α as its ends.

The edgeSet structure field can be inferred from IsLink via edge_mem_iff_exists_isLink (and this structure provides default values for edgeSet and edge_mem_iff_exists_isLink that use IsLink). While the field is not strictly necessary, when defining a graph we often immediately know what the edge set should be, and furthermore having edgeSet separate can be convenient for definitional equality reasons.

ctor Graph.mk E0 #

{α : Type u_3} →
  {β : Type u_4} →
    (vertexSet : Set α) →
      (IsLink : β → α → α → Prop) →
        (edgeSet : Set β) →
          (∀ ⦃e : β⦄, e ∈ edgeSet → Std.Symm (IsLink e)) →
            (∀ ⦃e : β⦄ ⦃x y v w : α⦄, IsLink e x y → IsLink e v w → x = v ∨ x = w) →
              autoParam (∀ (e : β), e ∈ edgeSet ↔ ∃ x y, IsLink e x y) Graph.edge_mem_iff_exists_isLink._autoParam →
                autoParam (∀ ⦃e : β⦄ ⦃x y : α⦄, IsLink e x y → x ∈ vertexSet) Graph.left_mem_of_isLink._autoParam →
                  Graph α β

abbrev Graph.vertexSet E1 #

{α : Type u_3} → {β : Type u_4} → Graph α β → Set α

The vertex set.

abbrev Graph.edgeSet E1 #

{α : Type u_3} → {β : Type u_4} → Graph α β → Set β

The edge set.

def Graph.«termV(_)» E1 #

Lean.ParserDescr

V(G) denotes the vertexSet of a graph G.

def Graph.«termE(_)» E1 #

Lean.ParserDescr

E(G) denotes the edgeSet of a graph G.

theorem Graph.IsLink.edge_mem E1 #

∀ {α : Type u_1} {β : Type u_2} {x y : α} {e : β} {G : Graph α β}, G.IsLink e x y → e ∈ G.edgeSet

theorem Graph.IsLink.symm E1 #

∀ {α : Type u_1} {β : Type u_2} {x y : α} {e : β} {G : Graph α β}, G.IsLink e x y → G.IsLink e y x

theorem Graph.IsLink.left_mem E1 #

∀ {α : Type u_1} {β : Type u_2} {x y : α} {e : β} {G : Graph α β}, G.IsLink e x y → x ∈ G.vertexSet

theorem Graph.IsLink.right_mem E1 #

∀ {α : Type u_1} {β : Type u_2} {x y : α} {e : β} {G : Graph α β}, G.IsLink e x y → y ∈ G.vertexSet

theorem Graph.IsLink.left_eq_or_eq E0 #

∀ {α : Type u_1} {β : Type u_2} {x y z w : α} {e : β} {G : Graph α β}, G.IsLink e x y → G.IsLink e z w → x = z ∨ x = w

theorem Graph.IsLink.right_eq_or_eq E0 #

∀ {α : Type u_1} {β : Type u_2} {x y z w : α} {e : β} {G : Graph α β}, G.IsLink e x y → G.IsLink e z w → y = z ∨ y = w

theorem Graph.IsLink.left_eq_of_right_ne E1 #

∀ {α : Type u_1} {β : Type u_2} {x y z w : α} {e : β} {G : Graph α β}, G.IsLink e x y → G.IsLink e z w → x ≠ z → x = w

theorem Graph.IsLink.right_unique E1 #

∀ {α : Type u_1} {β : Type u_2} {x y z : α} {e : β} {G : Graph α β}, G.IsLink e x y → G.IsLink e x z → y = z

theorem Graph.IsLink.left_unique E1 #

∀ {α : Type u_1} {β : Type u_2} {x y z : α} {e : β} {G : Graph α β}, G.IsLink e x z → G.IsLink e y z → x = y

def Graph.Inc E1 #

{α : Type u_1} → {β : Type u_2} → Graph α β → β → α → Prop

The unary incidence predicate of G. G.Inc e x means that the vertex x is one or both of the ends of the edge e. In the Inc namespace, we use edge and vertex to refer to e and x.

theorem Graph.Inc.edge_mem E1 #

∀ {α : Type u_1} {β : Type u_2} {x : α} {e : β} {G : Graph α β}, G.Inc e x → e ∈ G.edgeSet

theorem Graph.not_inc_of_notMem_edgeSet E0 #

∀ {α : Type u_1} {β : Type u_2} {x : α} {e : β} {G : Graph α β}, e ∉ G.edgeSet → ¬G.Inc e x

theorem Graph.Inc.vertex_mem E1 #

∀ {α : Type u_1} {β : Type u_2} {x : α} {e : β} {G : Graph α β}, G.Inc e x → x ∈ G.vertexSet

theorem Graph.IsLink.inc_left E1 #

∀ {α : Type u_1} {β : Type u_2} {x y : α} {e : β} {G : Graph α β}, G.IsLink e x y → G.Inc e x

theorem Graph.IsLink.inc_right E1 #

∀ {α : Type u_1} {β : Type u_2} {x y : α} {e : β} {G : Graph α β}, G.IsLink e x y → G.Inc e y

def Graph.Inc.other E1 #

{α : Type u_1} → {β : Type u_2} → {x : α} → {e : β} → {G : Graph α β} → G.Inc e x → α

Given a proof that the edge e is incident with the vertex x in G, noncomputably find the other end of e. (If e is a loop, this is equal to x itself).

theorem Graph.Inc.inc_other E0 #

∀ {α : Type u_1} {β : Type u_2} {x : α} {e : β} {G : Graph α β} (h : G.Inc e x), G.Inc e h.other

def Graph.IsLoopAt E1 #

{α : Type u_1} → {β : Type u_2} → Graph α β → β → α → Prop

G.IsLoopAt e x means that both ends of the edge e are equal to the vertex x.

theorem Graph.IsLoopAt.inc E1 #

∀ {α : Type u_1} {β : Type u_2} {x : α} {e : β} {G : Graph α β}, G.IsLoopAt e x → G.Inc e x

theorem Graph.IsLoopAt.edge_mem E1 #

∀ {α : Type u_1} {β : Type u_2} {x : α} {e : β} {G : Graph α β}, G.IsLoopAt e x → e ∈ G.edgeSet

theorem Graph.IsLoopAt.vertex_mem E1 #

∀ {α : Type u_1} {β : Type u_2} {x : α} {e : β} {G : Graph α β}, G.IsLoopAt e x → x ∈ G.vertexSet

def Graph.IsNonloopAt E1 #

{α : Type u_1} → {β : Type u_2} → Graph α β → β → α → Prop

G.IsNonloopAt e x means that the vertex x is one but not both of the ends of the edge =e, or equivalently that e is incident with x but not a loop at x - see Graph.isNonloopAt_iff_inc_not_isLoopAt.

theorem Graph.IsNonloopAt.inc E1 #

∀ {α : Type u_1} {β : Type u_2} {x : α} {e : β} {G : Graph α β}, G.IsNonloopAt e x → G.Inc e x

theorem Graph.IsNonloopAt.edge_mem E1 #

∀ {α : Type u_1} {β : Type u_2} {x : α} {e : β} {G : Graph α β}, G.IsNonloopAt e x → e ∈ G.edgeSet

theorem Graph.IsNonloopAt.vertex_mem E1 #

∀ {α : Type u_1} {β : Type u_2} {x : α} {e : β} {G : Graph α β}, G.IsNonloopAt e x → x ∈ G.vertexSet

theorem Graph.IsLoopAt.not_isNonloopAt E1 #

∀ {α : Type u_1} {β : Type u_2} {x : α} {e : β} {G : Graph α β}, G.IsLoopAt e x → ∀ (y : α), ¬G.IsNonloopAt e y

theorem Graph.IsNonloopAt.not_isLoopAt E1 #

∀ {α : Type u_1} {β : Type u_2} {x : α} {e : β} {G : Graph α β}, G.IsNonloopAt e x → ∀ (y : α), ¬G.IsLoopAt e y

theorem Graph.isNonloopAt_iff_inc_not_isLoopAt E1 #

∀ {α : Type u_1} {β : Type u_2} {x : α} {e : β} {G : Graph α β}, G.IsNonloopAt e x ↔ G.Inc e x ∧ ¬G.IsLoopAt e x

theorem Graph.isLoopAt_iff_inc_not_isNonloopAt E1 #

∀ {α : Type u_1} {β : Type u_2} {x : α} {e : β} {G : Graph α β}, G.IsLoopAt e x ↔ G.Inc e x ∧ ¬G.IsNonloopAt e x

theorem Graph.Inc.isLoopAt_or_isNonloopAt E1 #

∀ {α : Type u_1} {β : Type u_2} {x : α} {e : β} {G : Graph α β}, G.Inc e x → G.IsLoopAt e x ∨ G.IsNonloopAt e x

def Graph.Adj E1 #

{α : Type u_1} → {β : Type u_2} → Graph α β → α → α → Prop

G.Adj x y means that G has an edge whose ends are the vertices x and y.

theorem Graph.Adj.symm E1 #

∀ {α : Type u_1} {β : Type u_2} {x y : α} {G : Graph α β}, G.Adj x y → G.Adj y x

instance Graph.instSymmAdj E0 #

∀ {α : Type u_1} {β : Type u_2} {G : Graph α β}, Std.Symm G.Adj

theorem Graph.adj_comm E1 #

∀ {α : Type u_1} {β : Type u_2} {G : Graph α β} (x y : α), G.Adj x y ↔ G.Adj y x

theorem Graph.Adj.left_mem E1 #

∀ {α : Type u_1} {β : Type u_2} {x y : α} {G : Graph α β}, G.Adj x y → x ∈ G.vertexSet

theorem Graph.Adj.right_mem E1 #

∀ {α : Type u_1} {β : Type u_2} {x y : α} {G : Graph α β}, G.Adj x y → y ∈ G.vertexSet

theorem Graph.IsLink.adj E1 #

∀ {α : Type u_1} {β : Type u_2} {x y : α} {e : β} {G : Graph α β}, G.IsLink e x y → G.Adj x y

theorem Graph.mk_eq_self E0 #

∀ {α : Type u_1} {β : Type u_2} (G : Graph α β) {E : Set β} (hE : ∀ (e : β), e ∈ E ↔ ∃ x y, G.IsLink e x y),
  { vertexSet := G.vertexSet, IsLink := G.IsLink, edgeSet := E, isLink_symm := ⋯, eq_or_eq_of_isLink_of_isLink := ⋯,
      edge_mem_iff_exists_isLink := hE, left_mem_of_isLink := ⋯ } =
    G

edgeSet can be determined using IsLink, so the graph constructed from G.vertexSet and G.IsLink using any value for edgeSet is equal to G itself.

theorem Graph.ext E1 #

∀ {α : Type u_1} {β : Type u_2} {G₁ G₂ : Graph α β},
  G₁.vertexSet = G₂.vertexSet → (∀ (e : β) (x y : α), G₁.IsLink e x y ↔ G₂.IsLink e x y) → G₁ = G₂

Two graphs with the same vertex set and binary incidences are equal. (We use this as the default extensionality lemma rather than adding @[ext] to the definition of Graph, so it doesn't require equality of the edge sets.)

theorem Graph.ext_iff E0 #

∀ {α : Type u_1} {β : Type u_2} {G₁ G₂ : Graph α β},
  G₁ = G₂ ↔ G₁.vertexSet = G₂.vertexSet ∧ ∀ (e : β) (x y : α), G₁.IsLink e x y ↔ G₂.IsLink e x y

theorem Graph.ext_inc E1 #

∀ {α : Type u_1} {β : Type u_2} {G₁ G₂ : Graph α β},
  G₁.vertexSet = G₂.vertexSet → (∀ (e : β) (x : α), G₁.Inc e x ↔ G₂.Inc e x) → G₁ = G₂

Two graphs with the same vertex set and unary incidences are equal.

def Graph.copy E1 #

{α : Type u_1} →
  {β : Type u_2} →
    (G : Graph α β) →
      {vertexSet : Set α} →
        {edgeSet : Set β} →
          {IsLink : β → α → α → Prop} →
            G.vertexSet = vertexSet →
              G.edgeSet = edgeSet → (∀ (e : β) (x y : α), G.IsLink e x y ↔ IsLink e x y) → Graph α β

Graph.copy produces a graph equal to G but with provided definitional choices for vertexSet, edgeSet, and IsLink. This is mainly useful for improving definitional equalities while keeping the same underlying graph.

theorem Graph.edgeSet_copy E1 #

∀ {α : Type u_1} {β : Type u_2} (G : Graph α β) {vertexSet : Set α} {edgeSet : Set β} {IsLink : β → α → α → Prop}
  (hvertexSet : G.vertexSet = vertexSet) (hedgeSet : G.edgeSet = edgeSet)
  (hIsLink : ∀ (e : β) (x y : α), G.IsLink e x y ↔ IsLink e x y), (G.copy hvertexSet hedgeSet hIsLink).edgeSet = edgeSet

theorem Graph.vertexSet_copy E1 #

∀ {α : Type u_1} {β : Type u_2} (G : Graph α β) {vertexSet : Set α} {edgeSet : Set β} {IsLink : β → α → α → Prop}
  (hvertexSet : G.vertexSet = vertexSet) (hedgeSet : G.edgeSet = edgeSet)
  (hIsLink : ∀ (e : β) (x y : α), G.IsLink e x y ↔ IsLink e x y),
  (G.copy hvertexSet hedgeSet hIsLink).vertexSet = vertexSet

theorem Graph.copy_eq E0 #

∀ {α : Type u_1} {β : Type u_2} (G : Graph α β) {V : Set α} {E : Set β} {IsLink : β → α → α → Prop}
  (hV : G.vertexSet = V) (hE : G.edgeSet = E) (h_isLink : ∀ (e : β) (x y : α), G.IsLink e x y ↔ IsLink e x y),
  G.copy hV hE h_isLink = G

def Graph.incidenceSet E1 #

{α : Type u_1} → {β : Type u_2} → {G : Graph α β} → α → Set β

G.incidenceSet x is the set of edges incident to x in G.

theorem Graph.mem_incidenceSet E0 #

∀ {α : Type u_1} {β : Type u_2} {G : Graph α β} (x : α) (e : β), e ∈ Graph.incidenceSet x ↔ G.Inc e x

theorem Graph.incidenceSet_subset_edgeSet E1 #

∀ {α : Type u_1} {β : Type u_2} {G : Graph α β} (x : α), Graph.incidenceSet x ⊆ G.edgeSet

def Graph.loopSet E1 #

{α : Type u_1} → {β : Type u_2} → {G : Graph α β} → α → Set β

G.loopSet x is the set of loops at x in G.

theorem Graph.mem_loopSet E0 #

∀ {α : Type u_1} {β : Type u_2} {G : Graph α β} (x : α) (e : β), e ∈ Graph.loopSet x ↔ G.IsLoopAt e x

theorem Graph.loopSet_subset_incidenceSet E1 #

∀ {α : Type u_1} {β : Type u_2} {G : Graph α β} (x : α), Graph.loopSet x ⊆ Graph.incidenceSet x

The loopSet is included in the incidenceSet.

def Graph.Compatible E1 #

{α : Type u_1} → {β : Type u_2} → Graph α β → Graph α β → Prop

Two graphs are compatible if their shared edges have the same ends in both graphs.

theorem Graph.Compatible.refl E1 #

∀ {α : Type u_1} {β : Type u_2} (G : Graph α β), G.Compatible G

theorem Graph.Compatible.rfl E0 #

∀ {α : Type u_1} {β : Type u_2} {G : Graph α β}, G.Compatible G

instance Graph.instReflCompatible E0 #

∀ {α : Type u_1} {β : Type u_2}, Std.Refl Graph.Compatible

theorem Graph.Compatible.symm E1 #

∀ {α : Type u_1} {β : Type u_2} {G H : Graph α β}, G.Compatible H → H.Compatible G

instance Graph.instSymmCompatible E0 #

∀ {α : Type u_1} {β : Type u_2}, Std.Symm Graph.Compatible

theorem Graph.IsLink.of_compatible E1 #

∀ {α : Type u_1} {β : Type u_2} {x y : α} {e : β} {G H : Graph α β},
  G.Compatible H → e ∈ H.edgeSet → G.IsLink e x y → H.IsLink e x y

theorem Graph.Compatible.of_disjoint_edgeSet E1 #

∀ {α : Type u_1} {β : Type u_2} {G H : Graph α β}, Disjoint G.edgeSet H.edgeSet → G.Compatible H

theorem Graph.Inc.of_compatible E1 #

∀ {α : Type u_1} {β : Type u_2} {x : α} {e : β} {G H : Graph α β},
  G.Compatible H → e ∈ H.edgeSet → G.Inc e x → H.Inc e x

theorem Graph.IsLoopAt.of_compatible E1 #

∀ {α : Type u_1} {β : Type u_2} {x : α} {e : β} {G H : Graph α β},
  G.Compatible H → e ∈ H.edgeSet → G.IsLoopAt e x → H.IsLoopAt e x

theorem Graph.IsNonloopAt.of_compatible E1 #

∀ {α : Type u_1} {β : Type u_2} {x : α} {e : β} {G H : Graph α β},
  G.Compatible H → e ∈ H.edgeSet → G.IsNonloopAt e x → H.IsNonloopAt e x

def Graph.noEdge E1 #

{α : Type u_1} → Set α → (β : Type u_3) → Graph α β

The graph with vertex set vertexSet and no edges

theorem Graph.edgeSet_noEdge E0 #

∀ {α : Type u_1} (vertexSet : Set α) (β : Type u_3), (Graph.noEdge vertexSet β).edgeSet = ∅

theorem Graph.vertexSet_noEdge E0 #

∀ {α : Type u_1} (vertexSet : Set α) (β : Type u_3), (Graph.noEdge vertexSet β).vertexSet = vertexSet

theorem Graph.edgeSet_eq_empty E1 #

∀ {α : Type u_1} {β : Type u_2} {G : Graph α β}, G.edgeSet = ∅ ↔ G = Graph.noEdge G.vertexSet β

def Graph.banana E1 #

{α : Type u_1} → {β : Type u_2} → α → α → Set β → Graph α β

A graph with exactly two vertices and no loops.

theorem Graph.vertexSet_banana E0 #

∀ {α : Type u_1} {β : Type u_2} (u v : α) (edgeSet : Set β), (Graph.banana u v edgeSet).vertexSet = {u, v}

theorem Graph.edgeSet_banana E0 #

∀ {α : Type u_1} {β : Type u_2} (u v : α) (edgeSet : Set β), (Graph.banana u v edgeSet).edgeSet = edgeSet

theorem Graph.banana_inc E0 #

∀ {α : Type u_1} {β : Type u_2} {x u v : α} {e : β} {edgeSet : Set β},
  (Graph.banana u v edgeSet).Inc e x ↔ e ∈ edgeSet ∧ (x = u ∨ x = v)

theorem Graph.banana_comm E1 #

∀ {α : Type u_1} {β : Type u_2} (u v : α) (edgeSet : Set β), Graph.banana u v edgeSet = Graph.banana v u edgeSet

theorem Graph.banana_isNonloopAt E0 #

∀ {α : Type u_1} {β : Type u_2} {x u v : α} {e : β} {edgeSet : Set β},
  (Graph.banana u v edgeSet).IsNonloopAt e x ↔ e ∈ edgeSet ∧ (x = u ∨ x = v) ∧ u ≠ v

theorem Graph.banana_isLoopAt E0 #

∀ {α : Type u_1} {β : Type u_2} {x u v : α} {e : β} {edgeSet : Set β},
  (Graph.banana u v edgeSet).IsLoopAt e x ↔ e ∈ edgeSet ∧ x = u ∧ u = v

theorem Graph.banana_adj E0 #

∀ {α : Type u_1} {β : Type u_2} {x y u v : α} {edgeSet : Set β},
  (Graph.banana u v edgeSet).Adj x y ↔ edgeSet.Nonempty ∧ s(x, y) = s(u, v)

theorem Graph.banana_empty E0 #

∀ {α : Type u_1} {β : Type u_2} {u v : α}, Graph.banana u v ∅ = Graph.noEdge {u, v} β

abbrev Graph.bouquet E1 #

{α : Type u_1} → {β : Type u_2} → α → Set β → Graph α β

A graph with one vertex and loops at that vertex. This is an abbreviation for the special case of banana where the two vertices are the same. Most lemmas about bouquet should instead be proved using banana instead.

theorem Graph.vertexSet_bouquet E1 #

∀ {α : Type u_1} {β : Type u_2} (v : α) (edgeSet : Set β), (Graph.bouquet v edgeSet).vertexSet = {v}

theorem Graph.bouquet_inc E1 #

∀ {α : Type u_1} {β : Type u_2} {x : α} {e : β} (v : α) (edgeSet : Set β),
  (Graph.bouquet v edgeSet).Inc e x ↔ e ∈ edgeSet ∧ x = v

theorem Graph.bouquet_adj E1 #

∀ {α : Type u_1} {β : Type u_2} {x y : α} (v : α) (edgeSet : Set β),
  (Graph.bouquet v edgeSet).Adj x y ↔ edgeSet.Nonempty ∧ x = v ∧ y = v

theorem Graph.bouquet_isLoopAt E1 #

∀ {α : Type u_1} {β : Type u_2} {x : α} {e : β} (v : α) (edgeSet : Set β),
  (Graph.bouquet v edgeSet).IsLoopAt e x ↔ e ∈ edgeSet ∧ x = v

theorem Graph.not_isNonloopAt_bouquet E1 #

∀ {α : Type u_1} {β : Type u_2} {x v : α} {e : β} {edgeSet : Set β}, ¬(Graph.bouquet v edgeSet).IsNonloopAt e x

theorem Graph.exists_eq_bouquet E1 #

∀ {α : Type u_1} {β : Type u_2} {G : Graph α β},
  G.vertexSet.Nonempty → G.vertexSet.Subsingleton → ∃ x F, G = Graph.bouquet x F

Every graph on just one vertex is a bouquet on that vertex.

theorem Graph.bouquet_empty E1 #

∀ {α : Type u_1} {β : Type u_2} (v : α), Graph.bouquet v ∅ = Graph.noEdge {v} β

Deprecated aliases

NameNew nameSince