Documentation

Mathlib.Combinatorics.Digraph.Basic

Digraphs #

This module defines directed graphs on a vertex type V, which is the same notion as a relation V โ†’ V โ†’ Prop. While this might be too simple of a notion to deserve the grandeur of a new definition, the intention here is to develop relations using the language of graph theory.

Note that in this treatment, a digraph may have self loops.

The type Digraph V is structurally equivalent to Quiver.{0} V, but a difference between these is that Quiver is a class โ€” its purpose is to attach a quiver structure to a particular type V. In contrast, for Digraph V we are interested in working with the entire lattice of digraphs on V.

Main definitions #

structure Digraph (V : Type u_1) :
Type u_1

A digraph is a relation Adj on a vertex type V. The relation describes which pairs of vertices are adjacent.

In this treatment, a digraph may have self-loops.

  • Adj : V โ†’ V โ†’ Prop

    The adjacency relation of a digraph.

Instances For
    theorem Digraph.ext_iff {V : Type u_1} {x y : Digraph V} :
    x = y โ†” x.Adj = y.Adj
    theorem Digraph.ext {V : Type u_1} {x y : Digraph V} (Adj : x.Adj = y.Adj) :
    x = y
    def Digraph.mk' {V : Type u_1} :
    (V โ†’ V โ†’ Bool) โ†ช Digraph V

    Constructor for digraphs using a Boolean function. This is useful for creating a digraph with a decidable Adj relation, and it's used in the construction of the Fintype (Digraph V) instance.

    Instances For
      @[simp]
      theorem Digraph.mk'_apply_Adj {V : Type u_1} (x : V โ†’ V โ†’ Bool) (v w : V) :
      (mk' x).Adj v w = (x v w = true)
      @[implicit_reducible]
      instance instDecidableRelAdjCoeEmbeddingForallForallBoolDigraphMk' {V : Type u_1} (adj : V โ†’ V โ†’ Bool) :
      DecidableRel (Digraph.mk' adj).Adj
      @[implicit_reducible]
      instance instFintypeDigraphOfDecidableEq {V : Type u_1} [DecidableEq V] [Fintype V] :

      The complete digraph on a type V (denoted by โŠค) is the digraph whose vertices are all adjacent. Note that every vertex is adjacent to itself in โŠค.

      Instances For

        The empty digraph on a type V (denoted by โŠฅ) is the digraph such that no pairs of vertices are adjacent. Note that โŠฅ is called the empty digraph because it has no edges.

        Instances For
          def Digraph.completeBipartiteGraph (V : Type u_1) (W : Type u_2) :
          Digraph (V โŠ• W)

          Two vertices are adjacent in the complete bipartite digraph on two vertex types if and only if they are not from the same side. Any bipartite digraph may be regarded as a subgraph of one of these.

          Instances For
            @[simp]
            theorem Digraph.completeBipartiteGraph_Adj (V : Type u_1) (W : Type u_2) (v w : V โŠ• W) :
            (completeBipartiteGraph V W).Adj v w = (v.isLeft = true โˆง w.isRight = true โˆจ v.isRight = true โˆง w.isLeft = true)
            theorem Digraph.adj_injective {V : Type u_2} :
            Function.Injective Adj
            @[simp]
            theorem Digraph.adj_inj {V : Type u_2} {G H : Digraph V} :
            G.Adj = H.Adj โ†” G = H
            def Digraph.IsSubgraph {V : Type u_2} (x y : Digraph V) :

            The relation that one Digraph is a spanning subgraph of another. Note that Digraph.IsSubgraph G H should be spelled G โ‰ค H.

            Instances For
              @[implicit_reducible]
              instance Digraph.instLE {V : Type u_2} :
              LE (Digraph V)

              For digraphs G, H, G โ‰ค H iff โˆ€ a b, G.Adj a b โ†’ H.Adj a b.

              @[simp]
              theorem Digraph.isSubgraph_eq_le {V : Type u_2} :
              Digraph.IsSubgraph = fun (x1 x2 : Digraph V) => x1 โ‰ค x2
              @[implicit_reducible]
              instance Digraph.instMax {V : Type u_2} :
              Max (Digraph V)

              The supremum of two digraphs x โŠ” y has edges where either x or y have edges.

              @[simp]
              theorem Digraph.sup_adj {V : Type u_2} (x y : Digraph V) (v w : V) :
              (x โŠ” y).Adj v w โ†” x.Adj v w โˆจ y.Adj v w
              @[implicit_reducible]
              instance Digraph.instMin {V : Type u_2} :
              Min (Digraph V)

              The infimum of two digraphs x โŠ“ y has edges where both x and y have edges.

              @[simp]
              theorem Digraph.inf_adj {V : Type u_2} (x y : Digraph V) (v w : V) :
              (x โŠ“ y).Adj v w โ†” x.Adj v w โˆง y.Adj v w
              @[implicit_reducible]
              instance Digraph.instCompl {V : Type u_2} :

              We define Gแถœ to be the Digraph V such that no two adjacent vertices in G are adjacent in the complement, and every nonadjacent pair of vertices is adjacent.

              @[simp]
              theorem Digraph.compl_adj {V : Type u_2} (G : Digraph V) (v w : V) :
              Gแถœ.Adj v w โ†” ยฌG.Adj v w
              @[implicit_reducible]
              instance Digraph.sdiff {V : Type u_2} :
              SDiff (Digraph V)

              The difference of two digraphs x \ y has the edges of x with the edges of y removed.

              @[simp]
              theorem Digraph.sdiff_adj {V : Type u_2} (x y : Digraph V) (v w : V) :
              (x \ y).Adj v w โ†” x.Adj v w โˆง ยฌy.Adj v w
              @[implicit_reducible]
              instance Digraph.supSet {V : Type u_2} :
              @[implicit_reducible]
              instance Digraph.infSet {V : Type u_2} :
              @[simp]
              theorem Digraph.sSup_adj {V : Type u_2} {a b : V} {s : Set (Digraph V)} :
              (sSup s).Adj a b โ†” โˆƒ G โˆˆ s, G.Adj a b
              @[simp]
              theorem Digraph.sInf_adj {V : Type u_2} {a b : V} {s : Set (Digraph V)} :
              (sInf s).Adj a b โ†” โˆ€ G โˆˆ s, G.Adj a b
              @[simp]
              theorem Digraph.iSup_adj {ฮน : Sort u_1} {V : Type u_2} {a b : V} {f : ฮน โ†’ Digraph V} :
              (โจ† (i : ฮน), f i).Adj a b โ†” โˆƒ (i : ฮน), (f i).Adj a b
              @[simp]
              theorem Digraph.iInf_adj {ฮน : Sort u_1} {V : Type u_2} {a b : V} {f : ฮน โ†’ Digraph V} :
              (โจ… (i : ฮน), f i).Adj a b โ†” โˆ€ (i : ฮน), (f i).Adj a b
              @[implicit_reducible]
              @[implicit_reducible]
              @[simp]
              theorem Digraph.top_adj {V : Type u_2} (v w : V) :
              @[simp]
              theorem Digraph.bot_adj {V : Type u_2} (v w : V) :
              โŠฅ.Adj v w โ†” False
              @[implicit_reducible]
              instance Digraph.instInhabited (V : Type u_3) :
              Inhabited (Digraph V)
              @[implicit_reducible]
              @[implicit_reducible]
              instance Digraph.Bot.adjDecidable (V : Type u_2) :
              DecidableRel โŠฅ.Adj
              @[implicit_reducible]
              instance Digraph.Sup.adjDecidable (V : Type u_2) (G H : Digraph V) [DecidableRel G.Adj] [DecidableRel H.Adj] :
              DecidableRel (G โŠ” H).Adj
              @[implicit_reducible]
              instance Digraph.Inf.adjDecidable (V : Type u_2) (G H : Digraph V) [DecidableRel G.Adj] [DecidableRel H.Adj] :
              DecidableRel (G โŠ“ H).Adj
              @[implicit_reducible]
              instance Digraph.SDiff.adjDecidable (V : Type u_2) (G H : Digraph V) [DecidableRel G.Adj] [DecidableRel H.Adj] :
              DecidableRel (G \ H).Adj
              @[implicit_reducible]
              instance Digraph.Top.adjDecidable (V : Type u_2) :
              DecidableRel โŠค.Adj
              @[implicit_reducible]
              instance Digraph.Compl.adjDecidable (V : Type u_2) (G : Digraph V) [DecidableRel G.Adj] :
              DecidableRel Gแถœ.Adj