First-order logic with a transitive closure

Lax485149.TransitiveClosure · concepts/Lax485149/TransitiveClosure.lean · lax-485149

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 transitive-closure specification over a vocabulary LL consists of a finite set of modes, an arity kk, and first-order formulas over L∪{≤}L \cup \{\le\}: a transition formula φm,n(xˉ,yˉ)\varphi_{m,n}(\bar x, \bar y) for each pair of modes and, for each mode mm, a source formula σm(xˉ)\sigma_m(\bar x) and a target formula τm(xˉ)\tau_m(\bar x), with xˉ\bar x and yˉ\bar y tuples of kk variables. On a linearly ordered LL-structure AA it defines a directed graph whose nodes are the pairs (m,aˉ)(m, \bar a) of a mode and a kk-tuple of elements, with an edge from (m,aˉ)(m, \bar a) to (n,bˉ)(n, \bar b) when A⊨φm,n(aˉ,bˉ)A \models \varphi_{m,n}(\bar a, \bar b). The specification accepts AA when some node satisfying its target formula is reachable, by a possibly empty path, from some node satisfying its source formula.

    A decision problem PP over LL is FO(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. This is the normal form of first-order logic with a transitive closure operator on ordered structures, a single positive application of the operator; the modes play the role of a bounded amount of extra state, which tuples of elements cannot carry on small universes.

    Concept map
    3 concepts; 23 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
    6
    7/-!
    8---
    9title: First-order logic with a transitive closure
    10type: definition
    11---
    12A transitive-closure specification over a vocabulary LL consists of a finite
    13set of modes, an arity kk, and first-order formulas over L∪{≤}L \cup \{\le\}:
    14a transition formula φm,n(xˉ,yˉ)\varphi_{m,n}(\bar x, \bar y) for each pair of modes
    15and, for each mode mm, a source formula σm(xˉ)\sigma_m(\bar x) and a target
    16formula τm(xˉ)\tau_m(\bar x), with xˉ\bar x and yˉ\bar y tuples of kk
    17variables. On a linearly ordered LL-structure AA it defines a directed
    18graph whose nodes are the pairs (m,aˉ)(m, \bar a) of a mode and a kk-tuple of
    19elements, with an edge from (m,aˉ)(m, \bar a) to (n,bˉ)(n, \bar b) when
    20A⊨φm,n(aˉ,bˉ)A \models \varphi_{m,n}(\bar a, \bar b). The specification accepts AA
    21when some node satisfying its target formula is reachable, by a possibly
    22empty path, from some node satisfying its source formula.
    23
    24A decision problem PP over LL is FO(TC) definable when some specification
    25accepts, for every nonempty finite LL-structure AA and every linear order
    26on AA, exactly when AA is a yes-instance of PP. This is the normal form
    27of first-order logic with a transitive closure operator on ordered
    28structures, a single positive application of the operator; the modes play
    29the role of a bounded amount of extra state, which tuples of elements cannot
    30carry on small universes.
    31-/
    32
    33namespace Lax485149.TransitiveClosure
    34
    35open Lax904597.Problems
    36
    37open FirstOrder
    38
    39open Language
    40
    41/-- A single-`TC` definition: the transition formula of a graph on `k`-tuples,
    42together with formulas for the admissible start and end tuples. All three are
    43first-order over the ordered expansion of the vocabulary, so that they may
    44mention the linear order, as the ordered setting of the capture theorem
    45allows. -/
    46structure TCSpec (L : Language.{0, 0}) where
    47 /-- The *modes*: a finite amount of state the walk carries besides its tuple
    48 of elements. Tuples of elements cannot hold finite data of their own – a
    49 one-element universe has only one tuple – so, exactly as tags replace the
    50 order-encoded sorts of a textbook interpretation in `FOInterpretation`, a
    51 mode carries what the tuple cannot. -/
    52 Mode : Type
    53 /-- Modes are finite. -/
    54 [modeFinite : Finite Mode]
    55 /-- The arity: the walk runs on `k`-tuples of elements. -/
    56 k : ℕ
    57 /-- The transition formula, one per pair of modes, with two `k`-tuples of
    58 free variables: the current tuple on the left, the next one on the right. -/
    59 step : Mode → Mode → (L.sum Language.order).Formula (Fin k ⊕ Fin k)
    60 /-- The formula defining the admissible starting tuples, per mode. -/
    61 src : Mode → (L.sum Language.order).Formula (Fin k)
    62 /-- The formula defining the accepting tuples, per mode. -/
    63 tgt : Mode → (L.sum Language.order).Formula (Fin k)
    64
    65attribute [instance] TCSpec.modeFinite
    66
    67namespace TCSpec
    68
    69section Semantics
    70
    71variable {L : Language.{0, 0}} (spec : TCSpec L) {A : Type} [L.Structure A] [LinearOrder A]
    72
    73variable (A) in
    74/-- A node of the walk: a mode together with a `k`-tuple of elements. -/
    75abbrev Node : Type := spec.Mode × (Fin spec.k → A)
    76
    77/-- One step of the walk: the transition formula of the two modes, read with
    78the current tuple on the left and the next one on the right. -/
    79def Step (a b : spec.Node A) : Prop :=
    80 (spec.step a.1 b.1).Realize (Sum.elim a.2 b.2)
    81
    82/-- Reachability in the walk: the reflexive-transitive closure of
    83`TCSpec.Step`. -/
    84abbrev Reach : spec.Node A → spec.Node A → Prop :=
    85 Relation.ReflTransGen spec.Step
    86
    87/-- A node is a starting node when its tuple satisfies the source formula of
    88its mode. -/
    89def IsSrc (a : spec.Node A) : Prop := (spec.src a.1).Realize a.2
    90
    91/-- A node is accepting when its tuple satisfies the target formula of its
    92mode. -/
    93def IsTgt (a : spec.Node A) : Prop := (spec.tgt a.1).Realize a.2
    94
    95variable (A) in
    96/-- The structure is accepted: some accepting node is reachable from some
    97starting node. -/
    98def Accepts : Prop :=
    99 ∃ u v : spec.Node A, spec.IsSrc u ∧ spec.IsTgt v ∧ spec.Reach u v
    100
    101end Semantics
    102
    103end TCSpec
    104
    105/-- A decision problem is *FO(TC) definable* if, on nonempty finite *ordered*
    106structures, it is defined by a single transitive closure: there is a `TCSpec`
    107whose accepting tuples are reachable from its starting tuples exactly on the
    108yes-instances.
    109
    110The equivalence is required for *every* linear order on the universe, so this
    111is order-invariant FO(TC) definability: the problem itself does not see the
    112order, while the transition and endpoint formulas may. -/
    113def TCDefinable {L : Language.{0, 0}} [L.IsRelational] (P : DecisionProblem L) : Prop :=
    114 ∃ spec : TCSpec L,
    115 ∀ (A : Type) [L.Structure A] [LinearOrder A] [Finite A] [Nonempty A],
    116 P A ↔ spec.Accepts A
    117
    118end Lax485149.TransitiveClosure
    119

    Discussion

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

    Loading discussion…