Documentation

DescriptiveComplexity.Problems.Hamilton.Forward

A Hamilton circuit presented as a cyclic list #

The forward direction of the Vertex Cover → Hamilton Circuit reduction builds its circuit as an explicit sequence of vertices – selectors interleaved with the chains of the cover vertices – so it is convenient to introduce a tour from a list: a duplicate-free list containing every vertex, along which consecutive elements are adjacent and whose last element is adjacent to its first, is a tour (DescriptiveComplexity.tourOn_of_cycleList).

theorem DescriptiveComplexity.tourOn_of_cycleList {H : Type} {R : HHProp} [Finite H] (l : List H) (hne : l []) (nd : l.Nodup) (hcov : ∀ (x : H), x l) (hchain : List.IsChain R l) (hwrap : R (l.getLast hne) (l.head hne)) :

A cyclic list is a tour. A duplicate-free list containing every element, along which consecutive elements are R-related and whose last element is R-related to its first, presents a tour of R.

Dependency graph
theorem DescriptiveComplexity.tourOn_of_blocks {H : Type} {R : HHProp} [Finite H] (bs : List (List H)) (hbne : []bs) (hflat : bs.flatten []) (nd : bs.flatten.Nodup) (hcov : ∀ (x : H), x bs.flatten) (hchain : lbs, List.IsChain R l) (hconn : List.IsChain (fun (l₁ l₂ : List H) => xl₁.getLast?, yl₂.head?, R x y) bs) (hwrap : xbs.flatten.getLast?, ybs.flatten.head?, R x y) :

A cycle of blocks is a tour. A list of nonempty blocks whose flattening is duplicate-free and covers everything, where each block is a chain, consecutive blocks connect (last of one to head of the next), and the whole wraps (last of the flattening to its head), presents a tour. This packages the isChain_flatten step for the forward construction, whose blocks are a selector followed by a cover vertex's chain.

Dependency graph

The traversal of a single gadget (the snake) #

@[reducible, inline]

The gadget vertex of index i over the ordered edge (a, b) (owner a).

Equations
Instances For
    Dependency graph
    theorem DescriptiveComplexity.gv_adj {A : Type} [FirstOrder.Language.markedGraph.Structure A] [LinearOrder A] {a b a' b' : A} (i j : HTag) (hi : i HTag.sel i HTag.hub) (hj : j HTag.sel j HTag.hub) (h : HEdge a b) (h' : HEdge a' b') :
    DGEdge (gPt i hi h) (gPt j hj h') IAdjRaw (i, ![a, b]) (j, ![a', b'])

    Adjacency between two gadget vertices reduces to the intended adjacency of their (tag, tuple) pairs.

    Dependency graph
    Dependency graph
    Dependency graph
    Dependency graph
    Dependency graph
    Dependency graph
    Dependency graph

    The traversal of gadget {a, b} when b is also in the cover: only the a-side is walked, a straight horizontal path 0-1-2-3-4-5.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      Dependency graph

      The traversal of gadget {a, b} when b is not in the cover: the a-through path visiting all twelve vertices, dipping into the b-side.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        Dependency graph
        Dependency graph
        Dependency graph
        Dependency graph
        Dependency graph
        Dependency graph
        Dependency graph
        Dependency graph
        Dependency graph

        Distinctness of gadget vertices #

        Dependency graph
        Dependency graph

        Which vertices a snake contains (for covering) #

        Every a-side gadget vertex is in the both-sides snake.

        Dependency graph

        Every a-side gadget vertex is in the through snake.

        Dependency graph

        Every b-side gadget vertex – a gadget vertex owned by the far endpoint – is in the through snake. This is why an uncovered endpoint's vertices are visited by the covered endpoint's chain.

        Dependency graph

        The sorted neighbour list of a vertex #

        The neighbours of a in the input, listed in increasing order.

        Equations
        Instances For
          Dependency graph
          Dependency graph

          The neighbour list is strictly increasing.

          Dependency graph
          Dependency graph
          theorem DescriptiveComplexity.chain_edge {A : Type} [FirstOrder.Language.markedGraph.Structure A] [LinearOrder A] {a b c : A} (hb : HEdge a b) (hc : HEdge a c) (hbc : b < c) (hbtw : ∀ (d : A), HEdge a dd b c d) :
          DGEdge (gv5 hb) (gv0 hc)

          The gadget chain edge: the exit ⟨g5,(a,b)⟩ of one gadget is adjacent to the entrance ⟨g0,(a,c)⟩ of the next, given the neighbour-successor conditions (DescriptiveComplexity.IAdjRaw, the .g5,.g0 case). This is what glues consecutive snakes into a vertex's chain.

          Dependency graph
          theorem DescriptiveComplexity.nbrList_isChain {A : Type} [FirstOrder.Language.markedGraph.Structure A] [LinearOrder A] [Fintype A] (a : A) :
          List.IsChain (fun (b c : A) => ∀ (hb : HEdge a b) (hc : HEdge a c), DGEdge (gv5 hb) (gv0 hc)) (nbrList a)

          The neighbour list is a connection-chain: consecutive neighbours b, c of a satisfy the gadget chain edge, so the per-neighbour snakes concatenate into a's chain.

          Dependency graph

          A cover vertex's chain #

          The snake of gadget {a, b} in a chain of a: the a-side-only path if b is in the cover C, the through-path otherwise (empty if a, b is not an edge, which never happens on the neighbour list).

          Equations
          Instances For
            Dependency graph
            Dependency graph
            Dependency graph
            Dependency graph
            Dependency graph
            Dependency graph

            The chain of the cover vertex a: its gadgets' snakes, concatenated in neighbour order.

            Equations
            Instances For
              Dependency graph

              A chain is a DGEdge-chain: the snakes are chains and consecutive ones connect via DescriptiveComplexity.chain_edge.

              Dependency graph

              Minima and maxima of the neighbour list #

              The head of the neighbour list is the least neighbour.

              Dependency graph

              The last of the neighbour list is the greatest neighbour.

              Dependency graph

              Selector edges #

              theorem DescriptiveComplexity.sel_entrance_edge {A : Type} [FirstOrder.Language.markedGraph.Structure A] [LinearOrder A] {m a b : A} (hm : MGMarked m) (h : HEdge a b) (hmin : ∀ (d : A), HEdge a db d) :
              DGEdge (selPt hm) (gv0 h)

              A selector is adjacent to a chain entrance ⟨g0,(a,b)⟩ when b is the least neighbour of a.

              Dependency graph
              theorem DescriptiveComplexity.exit_sel_edge {A : Type} [FirstOrder.Language.markedGraph.Structure A] [LinearOrder A] {m a b : A} (hm : MGMarked m) (h : HEdge a b) (hmax : ∀ (d : A), HEdge a dd b) :
              DGEdge (gv5 h) (selPt hm)

              A selector is adjacent to a chain exit ⟨g5,(a,b)⟩ when b is the greatest neighbour of a.

              Dependency graph

              Selectors are mutually adjacent (a self-looped clique).

              Dependency graph

              Which vertices a chain contains (for covering) #

              theorem DescriptiveComplexity.mem_snakeOf_owner {A : Type} [FirstOrder.Language.markedGraph.Structure A] [LinearOrder A] {C : AProp} {a b : A} (h : HEdge a b) (i : HTag) (hi : i HTag.sel i HTag.hub) :
              gPt i hi h snakeOf C a b

              Every a-side gadget vertex is in a's snake for b, whichever snake it is.

              Dependency graph
              theorem DescriptiveComplexity.gadget_mem_chain {A : Type} [FirstOrder.Language.markedGraph.Structure A] [LinearOrder A] [Fintype A] {C : AProp} {a b : A} (h : HEdge a b) (i : HTag) (hi : i HTag.sel i HTag.hub) :
              gPt i hi h chain C a

              A gadget vertex is in its owner's chain: ⟨i,(a,b)⟩ is visited by a's chain (for any cover C).

              Dependency graph
              theorem DescriptiveComplexity.gadget_mem_chain_far {A : Type} [FirstOrder.Language.markedGraph.Structure A] [LinearOrder A] [Fintype A] {C : AProp} {a b : A} (hab : HEdge a b) (i : HTag) (hi : i HTag.sel i HTag.hub) (hnc : ¬C a) :
              gPt i hi hab chain C b

              A gadget vertex is in the far endpoint's chain when its owner is uncovered: if a ∉ C, the vertex ⟨i,(a,b)⟩ is visited by b's through-traversal.

              Dependency graph

              The endpoints of a chain #

              theorem DescriptiveComplexity.chain_head? {A : Type} [FirstOrder.Language.markedGraph.Structure A] [LinearOrder A] [Fintype A] (C : AProp) (a : A) (hne : nbrList a []) :
              ∃ (b : A) (h : HEdge a b), (∀ (d : A), HEdge a db d) (chain C a).head? = some (gv0 h)

              A chain's first vertex is the entrance ⟨g0,(a,b)⟩ of the least-neighbour gadget – which a selector is adjacent to.

              Dependency graph
              theorem DescriptiveComplexity.chain_getLast? {A : Type} [FirstOrder.Language.markedGraph.Structure A] [LinearOrder A] [Fintype A] (C : AProp) (a : A) (hne : nbrList a []) :
              ∃ (b : A) (h : HEdge a b), (∀ (d : A), HEdge a dd b) (chain C a).getLast? = some (gv5 h)

              A chain's last vertex is the exit ⟨g5,(a,b)⟩ of the greatest-neighbour gadget – which a selector is adjacent to.

              Dependency graph

              Chains of distinct cover vertices are disjoint #

              theorem DescriptiveComplexity.snakeBoth_tuple {A : Type} [FirstOrder.Language.markedGraph.Structure A] [LinearOrder A] {a b : A} (h : HEdge a b) {p : hamInterp.MapRel A} (hp : p snakeBoth h) :
              (↑p).2 0 = a (↑p).2 1 = b
              Dependency graph
              theorem DescriptiveComplexity.snakeThrough_tuple {A : Type} [FirstOrder.Language.markedGraph.Structure A] [LinearOrder A] {a b : A} (h : HEdge a b) {p : hamInterp.MapRel A} (hp : p snakeThrough h) :
              (↑p).2 0 = a (↑p).2 1 = b (↑p).2 0 = b (↑p).2 1 = a
              Dependency graph
              theorem DescriptiveComplexity.chain_tuple {A : Type} [FirstOrder.Language.markedGraph.Structure A] [LinearOrder A] [Fintype A] {C : AProp} {w : A} {p : hamInterp.MapRel A} (hp : p chain C w) :
              (↑p).2 0 = w (↑p).2 1 = w ¬C ((↑p).2 0)

              The owner invariant of a chain: a vertex of w's chain is either owned by w (w-side) or owned by an uncovered neighbour of w (the far side of a through-traversal).

              Dependency graph
              theorem DescriptiveComplexity.chain_disjoint {A : Type} [FirstOrder.Language.markedGraph.Structure A] [LinearOrder A] [Fintype A] {C : AProp} {w w' : A} (hw : C w) (hw' : C w') (hne : w w') :
              (chain C w).Disjoint (chain C w')

              Chains of distinct cover vertices are disjoint. Their only possible overlap is a far-side vertex, which requires an uncovered owner – but both cover vertices are covered.

              Dependency graph
              theorem DescriptiveComplexity.snakeOf_tuple {A : Type} [FirstOrder.Language.markedGraph.Structure A] [LinearOrder A] {C : AProp} {w b : A} (hwb : HEdge w b) {p : hamInterp.MapRel A} (hp : p snakeOf C w b) :
              (↑p).2 0 = w (↑p).2 1 = b (↑p).2 0 = b (↑p).2 1 = w
              Dependency graph
              theorem DescriptiveComplexity.snakeOf_disjoint {A : Type} [FirstOrder.Language.markedGraph.Structure A] [LinearOrder A] {C : AProp} {w b b' : A} (hwb : HEdge w b) (hwb' : HEdge w b') (hbb : b b') :
              (snakeOf C w b).Disjoint (snakeOf C w b')

              Snakes of distinct neighbours of w are disjoint.

              Dependency graph

              A single chain is duplicate-free: its snakes are internally nodup and pairwise disjoint (distinct neighbours ⇒ distinct gadgets).

              Dependency graph
              theorem DescriptiveComplexity.chain_tag {A : Type} [FirstOrder.Language.markedGraph.Structure A] [LinearOrder A] [Fintype A] {C : AProp} {w : A} {p : hamInterp.MapRel A} (hp : p chain C w) :
              (↑p).1 HTag.sel

              Chain vertices are gadget vertices, never selectors.

              Dependency graph

              A selector is never a chain vertex.

              Dependency graph

              The blocks of the cycle #

              A chain over a nonempty neighbour list is nonempty.

              Dependency graph

              A block of the cycle: a selector, optionally followed by a cover vertex's chain. The cp is that chain when the selector is paired with a cover vertex, and [] for a leftover selector.

              Equations
              Instances For
                Dependency graph
                Dependency graph
                Dependency graph

                Every paired block is a DGEdge-chain: the selector connects to the chain's entrance and the chain is a chain.

                Dependency graph
                Dependency graph
                theorem DescriptiveComplexity.block_getLast_paired_adj {A : Type} [FirstOrder.Language.markedGraph.Structure A] [LinearOrder A] [Fintype A] {C : AProp} {m m' w : A} (hm : MGMarked m) (hm' : MGMarked m') (hne : nbrList w []) {x : hamInterp.MapRel A} (hx : x (block hm (chain C w)).getLast?) :
                DGEdge x (selPt hm')

                The last vertex of a paired block (a chain exit) is adjacent to any selector.

                Dependency graph

                The last vertex of an extra block (its selector) is adjacent to any selector.

                Dependency graph

                The marked and cover lists #

                The marked vertices of the input: the selectors.

                Equations
                Instances For
                  Dependency graph

                  The non-isolated cover vertices: those whose chain is nonempty.

                  Equations
                  Instances For
                    Dependency graph
                    Dependency graph
                    Dependency graph
                    Dependency graph
                    Dependency graph

                    There are at most as many cover vertices as selectors, from the vertex-cover threshold.

                    Dependency graph

                    The cycle and its correctness #

                    The blocks of the cycle: the first |coverList| selectors each followed by their paired cover vertex's chain, then the leftover selectors alone.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      Dependency graph
                      theorem DescriptiveComplexity.block_of_mem_blockList {A : Type} [FirstOrder.Language.markedGraph.Structure A] [LinearOrder A] [Fintype A] {C : AProp} {bl : List (hamInterp.MapRel A)} (hbl : bl blockList C) :
                      (∃ (m : A) (w : A) (hm : MGMarked m), C w nbrList w [] bl = block hm (chain C w)) ∃ (m : A) (hm : MGMarked m), bl = block hm []

                      Every block of the list is a selector followed by a chain, or a lone selector – both nonempty and starting with a selector.

                      Dependency graph
                      Dependency graph
                      Dependency graph
                      theorem DescriptiveComplexity.blockList_isChain_conn {A : Type} [FirstOrder.Language.markedGraph.Structure A] [LinearOrder A] [Fintype A] {C : AProp} :
                      List.IsChain (fun (l₁ l₂ : List (hamInterp.MapRel A)) => xl₁.getLast?, yl₂.head?, DGEdge x y) (blockList C)

                      Consecutive blocks connect – in fact every pair does, since every block starts with a selector and every block's last vertex is adjacent to every selector.

                      Dependency graph
                      theorem DescriptiveComplexity.block_disjoint {A : Type} [FirstOrder.Language.markedGraph.Structure A] [LinearOrder A] {m1 m2 : A} (hm1 : MGMarked m1) (hm2 : MGMarked m2) {cp1 cp2 : List (hamInterp.MapRel A)} (hmm : m1 m2) (hcp : cp1.Disjoint cp2) (h1 : selPt hm1cp2) (h2 : selPt hm2cp1) :
                      (block hm1 cp1).Disjoint (block hm2 cp2)

                      Two blocks with distinct selectors and appropriately disjoint chain parts are disjoint.

                      Dependency graph
                      theorem DescriptiveComplexity.mem_zip_left {α β : Type} {l₁ : List α} {l₂ : List β} (hlen : l₁.length l₂.length) {x : α} (hx : x l₁) :
                      ∃ (y : β), (x, y) l₁.zip l₂

                      Every element of the first list is paired by zip when it is no longer than the second.

                      Dependency graph
                      theorem DescriptiveComplexity.mem_zip_right {α β : Type} {l₁ : List α} {l₂ : List β} (hlen : l₂.length l₁.length) {y : β} (hy : y l₂) :
                      ∃ (x : α), (x, y) l₁.zip l₂

                      Every element of the second list is paired by zip when it is no longer than the first.

                      Dependency graph
                      theorem DescriptiveComplexity.zip_pairwise_both {α β : Type} {l₁ : List α} {l₂ : List β} (h₁ : l₁.Nodup) (h₂ : l₂.Nodup) :
                      List.Pairwise (fun (p q : α × β) => p.1 q.1 p.2 q.2) (l₁.zip l₂)

                      Zipping two duplicate-free lists gives a list whose pairs differ in both components.

                      Dependency graph

                      Every cover vertex's chain is in the cycle: a cover vertex is paired with a selector, so its chain sits in a paired block.

                      Dependency graph

                      Every selector is in the cycle: it heads either a paired block (if among the first |coverList| selectors) or a leftover block.

                      Dependency graph
                      theorem DescriptiveComplexity.blockList_covers {A : Type} [FirstOrder.Language.markedGraph.Structure A] [LinearOrder A] [Fintype A] {C : AProp} (hcard : {x : A | C x}.ncard {x : A | MGMarked x}.ncard) (hcover : ∀ (a b : A), HEdge a bC a C b) (hmarks : ∃ (m : A), MGMarked m) (v : hamInterp.MapRel A) :

                      Covering: every vertex of the interpreted graph is in the cycle. A selector heads a block; a gadget vertex sits in a covered endpoint's chain (its owner's if covered, the neighbour's otherwise); the hub cannot occur, since there is a selector.

                      Dependency graph

                      The cycle is nonempty when there is a selector.

                      Dependency graph

                      Each block is duplicate-free.

                      Dependency graph

                      The blocks are pairwise disjoint: distinct selectors, and distinct cover vertices give disjoint chains.

                      Dependency graph
                      Dependency graph

                      The wrap edge: the last vertex of the cycle is adjacent to the first (a selector), since every block's last vertex is adjacent to every selector.

                      Dependency graph
                      theorem DescriptiveComplexity.blockCycle_tourOn {A : Type} [FirstOrder.Language.markedGraph.Structure A] [LinearOrder A] {C : AProp} [Finite A] (hcard : {x : A | C x}.ncard {x : A | MGMarked x}.ncard) (hcover : ∀ (a b : A), HEdge a bC a C b) (hmarks : ∃ (m : A), MGMarked m) :

                      The non-degenerate forward direction: given a cover with at most as many vertices as the marked set, at least one marked vertex, and covering every edge, the gadget graph has a Hamilton circuit – the cycle of selectors and chains.

                      Dependency graph

                      The degenerate forward direction: with no marked vertices and no edges, the interpreted graph is the single self-looped hub, a one-element Hamilton circuit.

                      Dependency graph