Computing decompositions from a given 2-sequence

Lax528502.DecompositionAlgorithms · concepts/Lax528502/DecompositionAlgorithms.lean · lax-528502

definition

Loading review…

Sign in with ORCID

Community review

Flags

Each flag is tied to a public ORCID identity and explains why this concept may be incorrect.

No flags have been submitted.

    Community review

    Flag this concept

    State precisely what appears incorrect. This explanation will be public under your ORCID name.

    No source line selected.

    Natural Language Statement

    Definition

    A graph with a given 22-sequence comes with a numbering of its vertices. A branch-decomposition algorithm returns its tree in that numbering. A tree-decomposition algorithm also chooses a numbering of the bags and writes the tree and its bags. A time bound of BB instructions applies at every word width large enough to address BB.

    Concept map
    11 concepts; 4 descendants hidden
    100%
    Proven claimDefinitionThis conceptRelated conceptA → B: B builds on A

    Lean source view on GitHub

    1import Lax528502.ContractionInput
    2import Lax528502.GraphProblems
    3import Lax528502.MimWidth
    4import Lax528502.TreeIndependence
    5import Lax759944.RamPolytime
    6import Lax808846.Ram
    7
    8/-!
    9---
    10title: Computing decompositions from a given 2-sequence
    11type: definition
    12---
    13A graph with a given 22-sequence comes with a numbering of its vertices.
    14A branch-decomposition algorithm returns its tree in that numbering. A
    15tree-decomposition algorithm also chooses a numbering of the bags and writes
    16the tree and its bags. A time bound of BB instructions applies at every word
    17width large enough to address BB.
    18-/
    19
    20namespace Lax528502.DecompositionAlgorithms
    21
    22open Lax183560 Lax228581.TwinWidth Lax228581.Treewidth
    23open Lax759944.RamPolytime Lax808846.Ram
    24
    25/-- A finite graph, its vertex numbering, and a witnessing contraction sequence. -/
    26structure GraphWithTwoSequence where
    27 Vertex : Type
    28 [finiteVertices : Fintype Vertex]
    29 [decidableVertices : DecidableEq Vertex]
    30 n : ℕ
    31 order : Fin n ≃ Vertex
    32 graph : SimpleGraph Vertex
    33 sequence : PartitionSequence graph 2
    34
    35attribute [instance] GraphWithTwoSequence.finiteVertices GraphWithTwoSequence.decidableVertices
    36
    37/-- Present a graph and its supplied sequence in the given vertex order. -/
    38def GraphWithTwoSequence.of {V : Type} [Fintype V] [DecidableEq V] {n : ℕ}
    39 (order : Fin n ≃ V) (G : SimpleGraph V) (S : PartitionSequence G 2) : GraphWithTwoSequence :=
    40 { Vertex := V, n := n, order := order, graph := G, sequence := S }
    41
    42/-- A numbered graph and its sequence on the RAM input. -/
    43noncomputable def GraphWithTwoSequence.input (I : GraphWithTwoSequence) : List ℕ :=
    44 ContractionInput.encode I.order I.graph I.sequence
    45
    46/-- A word-RAM algorithm with a verified polynomial running time. -/
    47structure PolynomialTimeAlgorithm where
    48 run : List ℕ → List ℕ
    49 polynomialTime : RamPolytime run
    50
    51/-- Return the indicated branch tree, using the vertex numbers of the input. -/
    52def PolynomialTimeAlgorithm.OutputsBranchDecomposition (algorithm : PolynomialTimeAlgorithm)
    53 (I : GraphWithTwoSequence) (T : Option (BranchDecompositions.BinaryTree I.Vertex)) : Prop :=
    54 algorithm.run I.input = MimWidth.encode I.order T
    55
    56/-- Return the same tree and bags at every word width that can address the
    57instruction budget. The output includes the complete tree and bag incidence matrices. -/
    58def OutputsTreeDecompositionWithin (program : Program) (I : GraphWithTwoSequence) (t : ℕ)
    59 (D : TreeDecomposition I.graph) (budget : ℕ) : Prop :=
    60 ∃ (m : ℕ) (nodes : Fin m ≃ D.Node), ∀ w : ℕ, budget < 2 ^ w →
    61 ∃ steps ≤ budget, RunsTo w program (ContractionInput.tape (t :: I.input))
    62 (TreeIndependence.encode I.order D nodes) steps
    63
    64/-- Decide the proposition with a single Boolean answer on the given input. -/
    65def PolynomialTimeAlgorithm.Decides (algorithm : PolynomialTimeAlgorithm)
    66 (input : List ℕ) (proposition : Prop) : Prop :=
    67 ∃ answer : Bool, algorithm.run input = [answer.toNat] ∧ (answer = true ↔ proposition)
    68
    69/-- Return an optimal vertex set for the requested problem or report infeasibility. -/
    70def PolynomialTimeAlgorithm.FindsOptimum (algorithm : PolynomialTimeAlgorithm)
    71 {n : ℕ} (problem : GraphProblems.Problem n) (G : SimpleGraph (Fin n))
    72 (graphInput : List ℕ) : Prop :=
    73 problem.Answer G (algorithm.run (GraphProblems.input graphInput problem))
    74
    75/-- A graph already numbered by the vertices of its contraction sequence. -/
    76noncomputable def numberedSequenceInput {n : ℕ} {G : SimpleGraph (Fin n)}
    77 (sequence : PartitionSequence G 2) : List ℕ :=
    78 ContractionInput.encode (Equiv.refl _) G sequence
    79
    80/-- A guarantee on every input whose graph and computed branch decomposition
    81have the stated width. Auxiliary problem data may follow the graph. -/
    82def GivenBranchDecomposition (width : ℕ) (branch : PolynomialTimeAlgorithm)
    83 (guarantee : ∀ {n : ℕ}, SimpleGraph (Fin n) → List ℕ → Prop) : Prop :=
    84 ∀ (x : List ℕ) (n : ℕ) (G : SimpleGraph (Fin n)) (T : Option (BranchDecompositions.BinaryTree (Fin n))),
    85 (ContractionInput.graph (Equiv.refl _) G).IsPrefix x →
    86 branch.run x = MimWidth.encode (Equiv.refl _) T →
    87 MimWidth.IsBranchDecompositionOfWidthAtMost G T width → guarantee G x
    88
    89end Lax528502.DecompositionAlgorithms
    90

    Discussion

    Ask a question or add context. Endorsements and structured flags are kept in the review panel above.

    Loading discussion…