Steiner Tree

Lax799700.Steiner · concepts/Lax799700/Steiner.lean · lax-799700

proven

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

    Theorem

    STEINER TREE: given a graph, a set of terminals and a threshold kk, is there a connected set of vertices containing every terminal and using at most kk non-terminals (SteinerTree, the node-weighted form with unit weights), or a set of at most kk arcs of the graph connecting a set of vertices that contains every terminal (EdgeSteinerTree, the edge-weighted form, arcs counted as ordered pairs)? The vocabulary is that of graphs with two unary marks, the terminals and the marked set carrying kk in unary representation. Connectivity (ConnectedOn) is not first-order; the membership proofs certify it by a root of the chosen set and a strict partial order in which every other chosen vertex has a chosen neighbor strictly below it. Both forms are NP-hard by ordered first-order reductions from Vertex Cover.

    Concept map
    7 concepts
    100%
    Proven claimDefinitionThis conceptRelated conceptA → B: B builds on A
    Evidence

    This concept declares 6 statements. Each proof establishes one of them relative to its assumptions.

    1 edgeSteinerTree_iff proven

    3 hasSmallEdgeSteinerTree_iso proven

    4 hasSmallSteinerTree_iso proven

    5 steinerTree_iff proven

    Lean source view on GitHub

    1import Mathlib.Data.Fintype.EquivFin
    2import Mathlib.Data.Set.Card
    3import Mathlib.SetTheory.Cardinal.Finite
    4import Mathlib.Logic.Equiv.Prod
    5import Mathlib.ModelTheory.Semantics
    6import Mathlib.ModelTheory.Complexity
    7import Mathlib.Tactic.FinCases
    8import Mathlib.ModelTheory.Syntax
    9import Lax904597.Classes
    10import Lax799700.Problems
    11
    12/-!
    13---
    14title: Steiner Tree
    15type: theorem
    16---
    17STEINER TREE: given a graph, a set of terminals and a threshold kk, is
    18there a connected set of vertices containing every terminal and using at
    19most kk non-terminals (SteinerTree, the node-weighted form with unit
    20weights), or a set of at most kk arcs of the graph connecting a set of
    21vertices that contains every terminal (EdgeSteinerTree, the edge-weighted
    22form, arcs counted as ordered pairs)? The vocabulary is that of graphs
    23with two unary marks, the terminals and the marked set carrying kk in
    24unary representation. Connectivity (ConnectedOn) is not first-order; the
    25membership proofs certify it by a root of the chosen set and a strict
    26partial order in which every other chosen vertex has a chosen neighbor
    27strictly below it. Both forms are NP-hard by ordered first-order
    28reductions from Vertex Cover.
    29
    30-/
    31
    32namespace Lax799700.Steiner
    33
    34open FirstOrder
    35
    36open FirstOrder.Language
    37
    38/-- The relation symbols of the language. -/
    39inductive steinerGraphRel : ℕ → Type where
    40/-- `adj a b`: there is an edge between `a` and `b`. -/
    41 | adj : steinerGraphRel 2
    42/-- `terminal a`: the vertex `a` must be spanned. -/
    43 | terminal : steinerGraphRel 1
    44/-- `marked a`: the vertex `a` belongs to the marked set carrying the
    45 threshold. -/
    46 | marked : steinerGraphRel 1
    47 deriving DecidableEq
    48
    49/-- The relational language of graphs with terminals: adjacency, a set of
    50terminals to be spanned, and a marked set whose cardinality is the budget of
    51non-terminals. -/
    52def steinerGraph : FirstOrder.Language :=
    53 ⟨fun _ => Empty, steinerGraphRel⟩
    54
    55instance instIsRelationalSteinerGraph : FirstOrder.Language.IsRelational steinerGraph := fun _ =>
    56 (inferInstance : IsEmpty Empty)
    57
    58/-- `adj a b`: there is an edge between `a` and `b`. -/
    59abbrev stAdj : steinerGraph.Relations 2 :=
    60 .adj
    61
    62/-- `terminal a`: the vertex `a` must be spanned. -/
    63abbrev stTerminal : steinerGraph.Relations 1 :=
    64 .terminal
    65
    66/-- `marked a`: the vertex `a` belongs to the marked set carrying the
    67 threshold. -/
    68abbrev stMarked : steinerGraph.Relations 1 :=
    69 .marked
    70
    71open FirstOrder
    72
    73open Language Structure
    74
    75section Connectivity
    76
    77variable {A : Type}
    78
    79/-- The edges available inside a chosen set: adjacency in either direction,
    80restricted to the set. -/
    81def Link (Adjp : A → A → Prop) (S : A → Prop) (a b : A) : Prop :=
    82 S a ∧ S b ∧ (Adjp a b ∨ Adjp b a)
    83
    84/-- A set of vertices is connected if any two of its members are joined by a
    85path inside it. -/
    86def ConnectedOn (Adjp : A → A → Prop) (S : A → Prop) : Prop :=
    87 ∀ x y, S x → S y → Relation.ReflTransGen (Link Adjp S) x y
    88
    89end Connectivity
    90
    91section Generic
    92
    93variable {A : Type}
    94
    95/-- Some connected set contains every terminal and uses at most as many
    96non-terminals as the number encoded by the marked set. -/
    97def SteinerOn (Adjp : A → A → Prop) (Term Kp : A → Prop) : Prop :=
    98 ∃ S : A → Prop, (∀ x, Term x → S x) ∧ ConnectedOn Adjp S ∧
    99 {x | S x ∧ ¬Term x}.ncard ≤ {x | Kp x}.ncard
    100
    101variable {B : Type}
    102
    103/-- Some set of edges of the graph, connecting a set that contains every
    104terminal, is at most as large as the number encoded by the marked set: the
    105*edge-weighted* Steiner tree with unit weights, Karp's original reading.
    106
    107The chosen edges are given as a set of ordered pairs, one per edge, and
    108connectivity reads them symmetrically
    109(`DescriptiveComplexity.ConnectedOn`); a witness listing both orientations of an edge
    110merely pays for it twice, so the yes-instances are unaffected. The threshold
    111compares a count of *pairs* with a count of *elements*, which is meaningful
    112because a threshold is just a number – and necessary here, since an edge set
    113can be quadratically larger than the universe. -/
    114def SteinerEdgeOn (Adjp : A → A → Prop) (Term Kp : A → Prop) : Prop :=
    115 ∃ T : A → A → Prop, ∃ S : A → Prop,
    116 (∀ a b, T a b → Adjp a b) ∧ (∀ x, Term x → S x) ∧ ConnectedOn T S ∧
    117 {p : A × A | T p.1 p.2}.ncard ≤ {x | Kp x}.ncard
    118
    119end Generic
    120
    121section Problem
    122
    123section Shorthands
    124
    125variable {A : Type} [steinerGraph.Structure A]
    126
    127/-- `adj a b`: there is an edge between `a` and `b`. -/
    128def STAdj {A : Type} [steinerGraph.Structure A] (a0 : A) (a1 : A) : Prop :=
    129 FirstOrder.Language.Structure.RelMap stAdj ![a0, a1]
    130
    131/-- `terminal a`: the vertex `a` must be spanned. -/
    132def STTerminal {A : Type} [steinerGraph.Structure A] (a0 : A) : Prop :=
    133 FirstOrder.Language.Structure.RelMap stTerminal ![a0]
    134
    135/-- `marked a`: the vertex `a` belongs to the marked set carrying the
    136threshold. -/
    137def STMarked {A : Type} [steinerGraph.Structure A] (a0 : A) : Prop :=
    138 FirstOrder.Language.Structure.RelMap stMarked ![a0]
    139
    140end Shorthands
    141
    142variable (A : Type) [steinerGraph.Structure A]
    143
    144/-- A graph with terminals admits a connected set spanning the terminals and
    145using at most as many non-terminals as its marked set has elements.
    146(Finiteness of the universe is part of the property: cardinality thresholds
    147are only meaningful on finite structures.) -/
    148def HasSmallSteinerTree : Prop :=
    149 Finite A ∧ SteinerOn (STAdj (A := A)) STTerminal STMarked
    150
    151end Problem
    152
    153/-- A graph with terminals admits a set of edges connecting its terminals, of
    154size at most the number encoded by the marked set. -/
    155def HasSmallEdgeSteinerTree (A : Type) [steinerGraph.Structure A] : Prop :=
    156 Finite A ∧ SteinerEdgeOn (STAdj (A := A)) STTerminal STMarked
    157
    158open Lax904597.Problems Lax904597.Classes Lax799700.Problems
    159
    160/-- The property `HasSmallEdgeSteinerTree` is isomorphism-invariant. -/
    161axiom hasSmallEdgeSteinerTree_iso : ∀ {A B : Type} [Lax799700.Steiner.steinerGraph.Structure A] [Lax799700.Steiner.steinerGraph.Structure B],
    162 (A ≃[Lax799700.Steiner.steinerGraph] B) → (HasSmallEdgeSteinerTree A ↔ HasSmallEdgeSteinerTree B)
    163
    164/-- The problem EdgeSteinerTree: does the structure satisfy `HasSmallEdgeSteinerTree`? -/
    165def EdgeSteinerTree : DecisionProblem Lax799700.Steiner.steinerGraph :=
    166 DecisionProblem.ofPred HasSmallEdgeSteinerTree
    167
    168/-- The yes-instances of EdgeSteinerTree are exactly the structures satisfying
    169`HasSmallEdgeSteinerTree`. -/
    170axiom edgeSteinerTree_iff : ∀ (A : Type) [Lax799700.Steiner.steinerGraph.Structure A], EdgeSteinerTree A ↔ HasSmallEdgeSteinerTree A
    171
    172/-- EdgeSteinerTree is NP-complete. -/
    173axiom edgeSteinerTree_NP_complete : NP.Complete EdgeSteinerTree
    174
    175/-- The property `HasSmallSteinerTree` is isomorphism-invariant. -/
    176axiom hasSmallSteinerTree_iso : ∀ {A B : Type} [Lax799700.Steiner.steinerGraph.Structure A] [Lax799700.Steiner.steinerGraph.Structure B],
    177 (A ≃[Lax799700.Steiner.steinerGraph] B) → (HasSmallSteinerTree A ↔ HasSmallSteinerTree B)
    178
    179/-- The problem SteinerTree: does the structure satisfy `HasSmallSteinerTree`? -/
    180def SteinerTree : DecisionProblem Lax799700.Steiner.steinerGraph :=
    181 DecisionProblem.ofPred HasSmallSteinerTree
    182
    183/-- The yes-instances of SteinerTree are exactly the structures satisfying
    184`HasSmallSteinerTree`. -/
    185axiom steinerTree_iff : ∀ (A : Type) [Lax799700.Steiner.steinerGraph.Structure A], SteinerTree A ↔ HasSmallSteinerTree A
    186
    187/-- SteinerTree is NP-complete. -/
    188axiom steinerTree_NP_complete : NP.Complete SteinerTree
    189
    190end Lax799700.Steiner
    191
    Show ProofShow ProofShow ProofShow ProofShow ProofShow Proof

    Discussion

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

    Loading discussion…