Documentation

CslibFrontier.Computability.Complexity.Problems.Hamiltonian.Diamond.Defs

Diamond graph definitions, membership, and size bounds #

This file defines the diamond graph (Cslib.Complexity.Diamond.graph) and closed diamond graph (Cslib.Complexity.Diamond.cycleGraph) used in the reduction of satisfiability to directed Hamiltonian paths and cycles Sipser, Theorem 7.46, along with vertex and arc membership characterizations and size formulas.

Main definitions #

Main results #

References #

Diamond graphs #

A detour through the node of clause clause, across slot of row, left to right when leftToRight is true and right to left otherwise.

  • clause : ℕ

    The clause index visited by the detour.

  • row : ℕ

    The row index containing the slot.

  • slot : ℕ

    The slot index within the row.

  • leftToRight : Bool

    Whether the detour traverses the slot from left to right.

Instances For
    theorem Cslib.Complexity.Diamond.Detour.ext {x y : Detour} (clause : x.clause = y.clause) (row : x.row = y.row) (slot : x.slot = y.slot) (leftToRight : x.leftToRight = y.leftToRight) :
    x = y
    Instances For

      The top of diamond i, which is also the bottom of diamond i - 1.

      Instances For

        Node a of the row of diamond i.

        Instances For

          The node of clause j.

          Instances For

            The number of nodes in row i: a pair of nodes for each slot, separators between and around the pairs, and the two ends.

            Instances For

              The arcs of diamond i: from its top to both ends of its row, from both ends to its bottom, and both ways between consecutive row nodes.

              Instances For

                The arcs of the detour d.

                Instances For
                  def Cslib.Complexity.Diamond.arcs (N : ℕ) (slots : ℕ → ℕ) (D : List Detour) :

                  The arcs of the diamond graph: the diamonds and the detours.

                  Instances For
                    def Cslib.Complexity.Diamond.vertices (N : ℕ) (slots : ℕ → ℕ) (M : ℕ) :

                    The vertices of the diamond graph: the tops, the rows and the clause nodes.

                    Instances For
                      def Cslib.Complexity.Diamond.graph (N : ℕ) (slots : ℕ → ℕ) (M : ℕ) (D : List Detour) :

                      The diamond graph with N diamonds whose rows have slots i slots, M clause nodes and the detours D.

                      Instances For
                        def Cslib.Complexity.Diamond.cycleGraph (N : ℕ) (slots : ℕ → ℕ) (M : ℕ) (D : List Detour) :

                        The diamond graph closed by an arc from the bottom of the last diamond to the top of the first.

                        Instances For
                          structure Cslib.Complexity.Diamond.WellFormed (N : ℕ) (slots : ℕ → ℕ) (M : ℕ) (D : List Detour) :

                          The detours go through declared nodes, and the detours across each slot all belong to one clause.

                          Instances For

                            Some directions of the rows give every clause j < M a detour in the direction of its row.

                            Instances For

                              Vertices and arcs #

                              @[simp]
                              theorem Cslib.Complexity.Diamond.rowNode_inj {i i' a a' : ℕ} :
                              rowNode i a = rowNode i' a' ↔ i = i' ∧ a = a'
                              theorem Cslib.Complexity.Diamond.rowLength_sub_one (slots : ℕ → ℕ) (i : ℕ) :
                              rowLength slots i - 1 = 3 * slots i + 2
                              theorem Cslib.Complexity.Diamond.mem_vertices {N : ℕ} {slots : ℕ → ℕ} {M v : ℕ} :
                              v ∈ vertices N slots M ↔ (∃ i ≤ N, v = topNode i) ∨ (∃ i < N, ∃ a < rowLength slots i, v = rowNode i a) ∨ ∃ j < M, v = clauseNode j
                              theorem Cslib.Complexity.Diamond.mem_arcs {N : ℕ} {slots : ℕ → ℕ} {D : List Detour} {u v : ℕ} :
                              (u, v) ∈ arcs N slots D ↔ (∃ i < N, u = topNode i ∧ (v = rowNode i 0 ∨ v = rowNode i (rowLength slots i - 1)) ∨ (u = rowNode i 0 ∨ u = rowNode i (rowLength slots i - 1)) ∧ v = topNode (i + 1) ∨ ∃ a < rowLength slots i - 1, u = rowNode i a ∧ v = rowNode i (a + 1) ∨ u = rowNode i (a + 1) ∧ v = rowNode i a) ∨ ∃ d ∈ D, d.leftToRight = true ∧ (u = rowNode d.row (3 * d.slot + 2) ∧ v = clauseNode d.clause ∨ u = clauseNode d.clause ∧ v = rowNode d.row (3 * d.slot + 3)) ∨ d.leftToRight = false ∧ (u = rowNode d.row (3 * d.slot + 3) ∧ v = clauseNode d.clause ∨ u = clauseNode d.clause ∧ v = rowNode d.row (3 * d.slot + 2))
                              theorem Cslib.Complexity.Diamond.length_vertices (N : ℕ) (slots : ℕ → ℕ) (M : ℕ) :
                              (vertices N slots M).length = 4 * N + 3 * (List.map slots (List.range N)).sum + M + 1

                              The number of vertices of a diamond graph, counted as listed.

                              theorem Cslib.Complexity.Diamond.length_arcs (N : ℕ) (slots : ℕ → ℕ) (D : List Detour) :
                              (arcs N slots D).length = 8 * N + 6 * (List.map slots (List.range N)).sum + 2 * D.length

                              The number of arcs of a diamond graph, counted as listed.

                              theorem Cslib.Complexity.Diamond.notMem_arcs_topNode_zero {N : ℕ} {slots : ℕ → ℕ} {D : List Detour} (u : ℕ) :
                              (u, topNode 0) ∉ arcs N slots D

                              No arc enters the top of the first diamond.