FO(TC): first-order logic with transitive closure #
The logic that captures nondeterministic logarithmic space on ordered
structures (Immerman 1987): first-order logic extended
with a transitive-closure operator. If φ(x̄, ȳ) defines a binary relation on
k-tuples, then TC[x̄, ȳ. φ](ū, v̄) says that v̄ is reachable from ū in the
φ-graph.
The operator as data #
As everywhere in this library, the operator is not added to Mathlib's
FirstOrder.Language.BoundedFormula as a new constructor – that would mean
redoing relabelling, substitution and realization for an extended syntax, and
losing every existing lemma. It is kept at the Lean level instead: a
DescriptiveComplexity.TCSpec bundles the arity k, a first-order transition
formula over the ordered expansion with two k-tuples of free variables, and
the two endpoint formulas; reachability itself is Relation.ReflTransGen,
whose induction principles then do the work in proofs. This is the same move as
DescriptiveComplexity.HornProgram for SO-Horn and DescriptiveComplexity.KromProgram for
SO-Krom.
A single application of TC in front of a first-order matrix is not a
restriction on ordered structures: Immerman's normal form makes every
FO(posTC) formula equivalent to one, just as a single existential block
suffices for DescriptiveComplexity.SigmaSODefinable. The library takes that normal
form as the definition (DescriptiveComplexity.TCDefinable), exactly as it takes
Σ₁-definability as the definition of NP rather than proving Fagin's theorem
against a machine.
What this is for #
DescriptiveComplexity.NL is already defined, by the Krom fragment
(DescriptiveComplexity.LogSpace), and the two coincide
(DescriptiveComplexity.tcDefinable_iff_mem_NL), so FO(TC) is not set up as a
second complexity class; the modes are what would make that possible, should it
become useful. A walk whose state were only a tuple of elements could not be
pulled back through an interpretation, whose tags vary from node to node, and
could not carry the finite data a translation needs (the atom index and sign of
a literal, say); carrying it in coordinates would fail on a one-element
universe. FO(TC) is here as the logic in which two things are naturally stated:
- the translation to the Krom fragment, which goes through the complement –
a clausal fragment states closure and rejection, so it defines
non-reachability head-on, exactly as
DescriptiveComplexity.unreach_mem_NLdoes for the concrete case; - Immerman–Szelepcsényi, closure of FO(TC) under complement
(
DescriptiveComplexity.TCDefinable.complinDescriptiveComplexity.TransitiveClosureCompl), whose inductive-counting proof is a walk on configurations – a phase, a flag and eight registers, each a node or a count – and so lives inside a singleTC. That theorem turns the above translation into an equivalence and givesREACH ∈ NL.
The canonical example is DescriptiveComplexity.reach_tcDefinable – REACH is a TC,
at arity one and with a single mode, over the edge relation between the marked
sources and the marked targets.
Specifications #
A single-TC definition: the transition formula of a graph on k-tuples,
together with formulas for the admissible start and end tuples. All three are
first-order over the ordered expansion of the vocabulary, so that they may
mention the linear order, as the ordered setting of the capture theorem
allows.
- Mode : Type
The modes: a finite amount of state the walk carries besides its tuple of elements. Tuples of elements cannot hold finite data of their own – a one-element universe has only one tuple – so, exactly as tags replace the order-encoded sorts of a textbook interpretation in
DescriptiveComplexity.FOInterpretation, a mode carries what the tuple cannot. Modes are finite.
- k : ℕ
The arity: the walk runs on
k-tuples of elements. The transition formula, one per pair of modes, with two
k-tuples of free variables: the current tuple on the left, the next one on the right.The formula defining the admissible starting tuples, per mode.
The formula defining the accepting tuples, per mode.
Instances For
Dependency graph
A node of the walk: a mode together with a k-tuple of elements.
Instances For
Dependency graph
One step of the walk: the transition formula of the two modes, read with the current tuple on the left and the next one on the right.
Instances For
Dependency graph
Reachability in the walk: the reflexive-transitive closure of
DescriptiveComplexity.TCSpec.Step.
Equations
- spec.Reach = Relation.ReflTransGen spec.Step
Instances For
Dependency graph
A node is a starting node when its tuple satisfies the source formula of its mode.
Instances For
Dependency graph
A node is accepting when its tuple satisfies the target formula of its mode.
Instances For
Dependency graph
The structure is accepted: some accepting node is reachable from some starting node.
Equations
Instances For
Dependency graph
Isomorphism-invariance #
The image of a node under an isomorphism: same mode, transported tuple.
Instances For
Dependency graph
One step is preserved by an isomorphism of the ordered expansions.
Dependency graph
Reachability is preserved by an isomorphism of the ordered expansions.
Dependency graph
Acceptance is isomorphism-invariant (for isomorphisms of the ordered expansions, the order being visible to the formulas).
Dependency graph
FO(TC) definability #
A decision problem is FO(TC) definable if, on nonempty finite ordered
structures, it is defined by a single transitive closure: there is a
DescriptiveComplexity.TCSpec whose accepting tuples are reachable from its starting
tuples exactly on the yes-instances.
As for DescriptiveComplexity.SigmaSOHornDefinable, the equivalence is required for
every linear order on the universe, so this is order-invariant FO(TC)
definability: the problem itself does not see the order, while the transition
and endpoint formulas may.
Equations
- DescriptiveComplexity.TCDefinable P = ∃ (spec : DescriptiveComplexity.TCSpec L), ∀ (A : Type) [inst : L.Structure A] [inst_1 : LinearOrder A] [Finite A] [Nonempty A], P.Holds A ↔ spec.Accepts A
Instances For
Dependency graph
FO(TC) definability only depends on the finite instances of a problem.