Deciders: walks with two exits, closed under the first-order connectives #
Immerman's normal form for FO(TC) – a TC of a formula containing TCs is a
single TC – is proved here not as a normal form on formulas but as an
algebra of walks. A DescriptiveComplexity.Decider is a walk (modes and a
tuple of coordinates, as DescriptiveComplexity.TCSpec) with two exits,
yes and no, and a parameter type β its formulas may mention. It
decides a proposition at a valuation of its parameters when, from its start
mode and any tuple of coordinates, the yes exit is reachable exactly if
the proposition holds and the no exit exactly if it fails
(DescriptiveComplexity.Decider.Decides).
Starting from any tuple, rather than from a canonical one, is what makes the constructions below compose without resets: a decider run after another one simply starts where the previous one exited.
The algebra #
DescriptiveComplexity.Decider.atomdecides a first-order formula over the base, by exiting at once;DescriptiveComplexity.Decider.negswaps the two exits – negation is free, the decider being asked for both answers;DescriptiveComplexity.Decider.seqruns a second decider after the first exitedyes– conjunction;DescriptiveComplexity.Decider.allruns a decider once per element of the universe, in the order of the structure, restarting it after eachyesand exitingyesafter the last element – universal quantification, with the quantified element frozen into a coordinate of the walk;DescriptiveComplexity.Decider.relabelParrenames the parameters.
Disjunction, implication and the existential quantifier are De Morgan
combinations (DescriptiveComplexity.Decider.exTup is an existential over a
whole tuple). What is not here is the atom case for a walk's own
reachability relation, which is where nondeterminism (or a step budget) comes
in: DescriptiveComplexity.TransitiveClosureDecideReach and
DescriptiveComplexity.TransitiveClosureDecideReachDet.
Determinism travels #
Every construction preserves functionality – at most one move, step or
exit, out of every node (DescriptiveComplexity.Decider.Functional). This is
what makes the same algebra serve the deterministic logic: a functional
decider, turned into a specification (DescriptiveComplexity.Decider.toSpec),
is unchanged by determinization.
Copying coordinates #
The formula “the variables sel' hold the same values as the variables
sel”, coordinate by coordinate.
Equations
- DescriptiveComplexity.copyF sel sel' = FirstOrder.Language.Formula.iInf fun (i : ι) => (FirstOrder.Language.var (sel i)).equal (FirstOrder.Language.var (sel' i))
Instances For
Dependency graph
Dependency graph
Paths: an invariant and a lifting #
An invariant preserved by every step holds along a path.
Dependency graph
Deciders #
A decider: a walk on tuples of Coord coordinates carrying a finite
mode, with formulas that may mention parameters of type β, and two
exits – yes (true) and no (false) – each a formula on the current
tuple and the parameters. Its formulas are over the ordered expansion of the
vocabulary, the iteration of DescriptiveComplexity.Decider.all needing the
order.
- Mode : Type
The modes.
Modes are finite.
- Coord : Type
The coordinates of a tuple.
Tuples are finite.
- start : self.Mode
The starting mode.
- step : self.Mode → self.Mode → (L.sum FirstOrder.Language.order).Formula ((self.Coord ⊕ self.Coord) ⊕ β)
The step formula, one per pair of modes: the current tuple, the next one, then the parameters.
The exit formulas: at a mode, the condition on the current tuple and the parameters under which the walk exits with the given answer.
Instances For
Dependency graph
A node of the walk: a mode together with a tuple.
Instances For
Dependency graph
One step of the walk, at a valuation of the parameters.
Instances For
Dependency graph
Reachability in the walk, at a valuation of the parameters.
Equations
- D.ReachAt v = Relation.ReflTransGen (D.StepAt v)
Instances For
Dependency graph
The walk exits at a node with an answer.
Instances For
Dependency graph
The answer o is reachable from the start mode at the tuple t.
Instances For
Dependency graph
The decider decides P at a valuation of its parameters: from the
start mode and any tuple, yes is reachable exactly when P holds, and no
exactly when it fails.
Instances For
Dependency graph
A move out of a node: a step to another node, or an exit.
Instances For
Dependency graph
A decider is functional when no node has two moves: the walk is deterministic, exits included.
Equations
Instances For
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Functionality, from its three components.
Dependency graph
Renaming the parameters #
The decider with its parameters renamed along f: a parameter of the new
decider is read where f sends it.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Atoms #
The decider of a first-order formula over the base: no step, and it exits at once with the truth value of the formula.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Negation #
The decider with its two exits swapped.
Equations
Instances For
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Sequential composition #
The variables of the first component's step, in the composite's.
Instances For
Dependency graph
The variables of the second component's step, in the composite's.
Instances For
Dependency graph
The variables of the first component's exit, in the composite's exit.
Instances For
Dependency graph
The variables of the second component's exit, in the composite's exit.
Instances For
Dependency graph
The variables of the first component's exit, in the composite's step (read on the current tuple).
Equations
Instances For
Dependency graph
The current tuple's coordinate c, as a step variable.
Equations
Instances For
Dependency graph
The next tuple's coordinate c, as a step variable.
Equations
Instances For
Dependency graph
Sequential composition: the first decider runs, and where it exits
yes the second one starts, from the tuple it left; the answer is the
second's. The coordinates of the idle component are copied along.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
A path of the first component lifts to the composite, the second component's coordinates fixed.
Dependency graph
A path of the second component lifts to the composite, the first component's coordinates fixed.
Dependency graph
What the composite may have reached from its start at t: a node of the
first component reached by it, the second's coordinates untouched, or a node of
the second component reached after the first exited yes.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Universal quantification: an iteration along the order #
The variables of the component's step in the iteration's: the quantified parameter is read off the current tuple's extra coordinate.
Equations
- DescriptiveComplexity.Decider.allVar (Sum.inl (Sum.inl c)) = Sum.inl (Sum.inl (Sum.inl c))
- DescriptiveComplexity.Decider.allVar (Sum.inl (Sum.inr c)) = Sum.inl (Sum.inr (Sum.inl c))
- DescriptiveComplexity.Decider.allVar (Sum.inr (Sum.inl b)) = Sum.inr b
- DescriptiveComplexity.Decider.allVar (Sum.inr (Sum.inr PUnit.unit)) = Sum.inl (Sum.inl (Sum.inr ()))
Instances For
Dependency graph
The variables of the component's exit in the iteration's step (read on the current tuple).
Equations
Instances For
Dependency graph
The variables of the component's exit in the iteration's exit.
Equations
Instances For
Dependency graph
The extra coordinate holding the quantified element, in a step.
Instances For
Dependency graph
The extra coordinate holding the quantified element, in a step.
Instances For
Dependency graph
Universal quantification: the component is run once per element of
the universe, in the order of the structure, the element being held in one
extra coordinate. The first step sets it to the minimum; where the component
exits yes below the maximum, it is restarted at the successor; a yes at the
maximum, or a no anywhere, is the answer.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
The valuation of the component's parameters: the iteration's, and the current element.
Equations
- DescriptiveComplexity.Decider.vy v y = Sum.elim v fun (x : Unit) => y
Instances For
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
A path of the component lifts to the iteration, the element fixed.
Dependency graph
Upwards from any element: if the component says yes at every element
from y on, the iteration exits yes from the component's start at y.
Dependency graph
Upwards to a failure: if the component says yes below y but not
everywhere, the iteration exits no from the component's start at y.
Dependency graph
What the iteration may have reached: its start, or a node of the component
at some element, every smaller element having been answered yes.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
Dependency graph
Dependency graph
The iteration decides the universal quantification.
Dependency graph
Dependency graph
Quantifying over a tuple, and the derived connectives #
The parameters of a decider over a tuple of K + 1 variables, read as the
parameters over K variables together with one more.
Equations
Instances For
Dependency graph
Universal quantification over a tuple: one iteration per coordinate.
Equations
Instances For
Dependency graph
Existential quantification over a tuple, by De Morgan.
Equations
Instances For
Dependency graph
Implication, by De Morgan: not (the first and not the second).
Instances For
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
A decider with no parameters is a specification #
The coordinates of a decider, enumerated.
Equations
- D.coordEquiv = (Fintype.equivFin D.Coord).trans (finCongr ⋯)
Instances For
Dependency graph
The variables of the decider's step, as the specification's.
Equations
- D.specVar = Sum.elim (Sum.map ⇑D.coordEquiv ⇑D.coordEquiv) Empty.elim
Instances For
Dependency graph
The variables of the decider's exit, as the specification's step.
Equations
- D.specExitVar = Sum.elim (fun (c : D.Coord) => Sum.inl (D.coordEquiv c)) Empty.elim
Instances For
Dependency graph
A decider as a specification: the two exits become two terminal
modes, the yes one accepting; the start mode is the source, at any tuple.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
The valuation of the (absent) parameters.
Equations
Instances For
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
What the specification reaches from its source: a node of the decider it reaches, or an exit it reaches.
Dependency graph
A path of the decider is a path of the specification.
Dependency graph
The specification accepts exactly when the decider says yes from some
tuple.
Dependency graph
A functional decider gives a functional specification.
Dependency graph
A functional decider's specification is unchanged by determinization:
its deterministic reading accepts exactly when the decider says yes.