While this submission is a draft, it cannot be used by other submissions.

Second-order logic with a transitive closure

Lax134656.SecondOrderTransitiveClosure · concepts/Lax134656/SecondOrderTransitiveClosure.lean · lax-134656

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 second-order transitive-closure specification over a vocabulary LL consists of a block of relation variables and three first-order sentences over L∪{≤}L \cup \{\le\}: a transition sentence over two copies of the block, and a source and a target sentence over one copy. On a linearly ordered LL-structure it defines a directed graph whose nodes, the states, are the assignments of relations to the block, with an edge from one state to another when the transition sentence holds with the first copy of the block read as the current state and the second as the next. The specification accepts the structure when some state satisfying the target sentence is reachable, by a possibly empty path, from some state satisfying the source sentence.

    A decision problem PP over LL is SO(TC) definable when some specification accepts, for every nonempty finite LL-structure AA and every linear order on AA, exactly when AA is a yes-instance of PP. A state holds polynomially many bits and a path may be exponentially long: this is the logic SO(TC), which captures polynomial space on ordered structures, in the normal form of a single application of the operator.

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

    Lean source view on GitHub

    1import Mathlib.ModelTheory.Order
    2import Mathlib.ModelTheory.Semantics
    3import Mathlib.Logic.Relation
    4import Lax904597.Problems
    5import Lax904597.Interpretations
    6import Lax904597.SecondOrder
    7import Lax535992.InflationaryFixedPoint
    8
    9/-!
    10---
    11title: Second-order logic with a transitive closure
    12type: definition
    13---
    14A second-order transitive-closure specification over a vocabulary LL
    15consists of a block of relation variables and three first-order sentences
    16over L∪{≤}L \cup \{\le\}: a transition sentence over two copies of the
    17block, and a source and a target sentence over one copy. On a linearly
    18ordered LL-structure it defines a directed graph whose nodes, the states,
    19are the assignments of relations to the block, with an edge from one state
    20to another when the transition sentence holds with the first copy of the
    21block read as the current state and the second as the next. The
    22specification accepts the structure when some state satisfying the target
    23sentence is reachable, by a possibly empty path, from some state satisfying
    24the source sentence.
    25
    26A decision problem PP over LL is SO(TC) definable when some specification
    27accepts, for every nonempty finite LL-structure AA and every linear order
    28on AA, exactly when AA is a yes-instance of PP. A state holds
    29polynomially many bits and a path may be exponentially long: this is the
    30logic SO(TC), which captures polynomial space on ordered structures, in the
    31normal form of a single application of the operator.
    32-/
    33
    34namespace Lax134656.SecondOrderTransitiveClosure
    35
    36open Lax904597.Problems Lax904597.SecondOrder Lax535992.InflationaryFixedPoint
    37
    38open FirstOrder
    39
    40open Language Structure
    41
    42/-- The structure over `L` expanded by *two* copies of a block's vocabulary –
    43the current state and the next one – interpreted by two assignments. -/
    44@[reducible]
    45def SOBlock.structure₂ {L : Language.{0, 0}} (B : SOBlock) {A : Type} [inst : L.Structure A]
    46 (ρ σ : B.Assignment A) : ((L.sum B.lang).sum B.lang).Structure A :=
    47 @sumStructure (L.sum B.lang) B.lang A (SOBlock.structure₁ B ρ) (B.structure σ)
    48
    49/-- A single-`TC` definition over a second-order block: the states of the walk
    50are the assignments of the block `B`, and the transition, source and target
    51conditions are first-order sentences over the base vocabulary expanded by the
    52order and by copies of the block. The transition sentence sees two copies –
    53the current state and the next one.
    54
    55The order is visible to all three sentences; the problem itself does not see
    56it. -/
    57structure SOTCSpec (L : Language.{0, 0}) : Type 1 where
    58 /-- The block whose assignments are the states of the walk. -/
    59 B : SOBlock
    60 /-- The transition sentence, over two copies of the block: the current state
    61 reads the first copy, the next state the second. -/
    62 step : (((L.sum Language.order).sum B.lang).sum B.lang).Sentence
    63 /-- The sentence defining the admissible starting states. -/
    64 src : ((L.sum Language.order).sum B.lang).Sentence
    65 /-- The sentence defining the accepting states. -/
    66 tgt : ((L.sum Language.order).sum B.lang).Sentence
    67
    68namespace SOTCSpec
    69
    70section Semantics
    71
    72variable {L : Language.{0, 0}} (spec : SOTCSpec L) {A : Type} [L.Structure A] [LinearOrder A]
    73
    74variable (A) in
    75/-- A state of the walk: an assignment of the block. -/
    76abbrev State : Type := spec.B.Assignment A
    77
    78/-- One step of the walk: the transition sentence, read with the current state
    79in the first copy of the block and the next state in the second. -/
    80def Step (ρ σ : spec.State A) : Prop :=
    81 @Sentence.Realize _ A (SOBlock.structure₂ (L := L.sum Language.order) spec.B ρ σ) spec.step
    82
    83/-- Reachability in the walk: the reflexive-transitive closure of
    84`SOTCSpec.Step`. -/
    85abbrev Reach : spec.State A → spec.State A → Prop :=
    86 Relation.ReflTransGen spec.Step
    87
    88/-- A state is a starting state when it satisfies the source sentence. -/
    89def IsSrc (ρ : spec.State A) : Prop :=
    90 @Sentence.Realize _ A (SOBlock.structure₁ (L := L.sum Language.order) spec.B ρ) spec.src
    91
    92/-- A state is accepting when it satisfies the target sentence. -/
    93def IsTgt (ρ : spec.State A) : Prop :=
    94 @Sentence.Realize _ A (SOBlock.structure₁ (L := L.sum Language.order) spec.B ρ) spec.tgt
    95
    96variable (A) in
    97/-- The structure is accepted: some accepting state is reachable from some
    98starting state. -/
    99def Accepts : Prop :=
    100 ∃ ρ σ : spec.State A, spec.IsSrc ρ ∧ spec.IsTgt σ ∧ spec.Reach ρ σ
    101
    102end Semantics
    103
    104end SOTCSpec
    105
    106/-- A decision problem is *SO(TC) definable* if, on nonempty finite *ordered*
    107structures, it is defined by a single transitive closure over the assignments
    108of a second-order quantifier block: there is an `SOTCSpec` whose accepting
    109states are reachable from its starting states exactly on the yes-instances.
    110The equivalence is required for *every* linear order on the universe: the
    111problem itself does not see the order, while the three sentences may. -/
    112def SOTCDefinable {L : Language.{0, 0}} [L.IsRelational] (P : DecisionProblem L) : Prop :=
    113 ∃ spec : SOTCSpec L,
    114 ∀ (A : Type) [L.Structure A] [LinearOrder A] [Finite A] [Nonempty A],
    115 P A ↔ spec.Accepts A
    116
    117end Lax134656.SecondOrderTransitiveClosure
    118

    Discussion

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

    Loading discussion…