FO(LFP) = SO-Horn: the translation into the fragment #
The hard half of Grädel's equivalence (Grädel 1992):
every FO(LFP) definable problem is SO-Horn definable
(DescriptiveComplexity.LFPDefinable.sigmaSOHornDefinable). With the easy half
DescriptiveComplexity.SigmaSOHornDefinable.lfpDefinable the two formalisms are
interchangeable (DescriptiveComplexity.lfpDefinable_iff_sigmaSOHornDefinable), so the
fragment inherits the closure property that only a full logic has by
construction: SO-Horn definability is closed under complement
(DescriptiveComplexity.SigmaSOHornDefinable.compl), and level 0 of the polynomial
hierarchy collapses, Π₀ᵖ = Σ₀ᵖ (DescriptiveComplexity.piP_zero_eq) – polynomial
time, as defined by the Horn fragment, is closed under complement.
The construction #
Where a Σ₁ certificate could guess a fixed point and its derivation order,
a Horn program must derive them. The program built here
(DescriptiveComplexity.LFPHorn.trProg) has one goal clause – “the output sentence is
not false” – and rules computing, as its least model, the entire evaluation of
the FO(LFP) definition (DescriptiveComplexity.LFPHorn.canonAssign):
- the fixed point itself, on a copy of the original block, by the original
rules (
DescriptiveComplexity.LFPHorn.liftedRules); - the complement of the fixed point, the part a positive formalism cannot
see directly: relations
N j i (t̄, x̄)– the atomi x̄is not yet derived at stage(j, t̄)– for stages indexed lexicographically byhc + 1static copies of the tuplest̄ ∈ A^hm(DescriptiveComplexity.LFPHorn.hscopies suffice on every nonempty structure, where tuples alone would fail on one-element universes:(hc+1)·n^hmalways exceeds theΣᵢ n^{arityᵢ}rounds after which the stages stabilize,DescriptiveComplexity.derivesIn_iff_derives_of_card_le). The base rules populateNat the bottom stage; the step rules carry an underived atom to the next stage when no rule instance derives it, that unbounded conjunction over the valuations being assembled by the non-firing accumulatorsNF j (c, a) (t̄, x̄, w̄)walking the lexicographic order of the valuationsw̄ ∈ A^k– the technique ofDescriptiveComplexity.Problems.HornSat.Definability, applied to a rule system rather than one clause body, with the order machinery ofDescriptiveComplexity.OrderWalk; - an evaluator for the output sentence: truth and falsity relations for
every subformula (
DescriptiveComplexity.subslists them; no recursion over the syntax is needed in the index type), with falsity of a fixed-point atom read fromNat the last stage, implication evaluated clausewise, and the universal quantifier assembled by one more accumulator along the order.
Correctness is the identity between the least model of this program and the
canonical assignment: soundness (DescriptiveComplexity.LFPHorn.trRules_sound, the
canonical assignment satisfies every rule) gives one inclusion and makes the
canonical assignment the witness when the output holds; completeness (the
DescriptiveComplexity.LFPHorn.derives_n/derives_nf/derives_eval inductions along
stages, valuations and subformulas) shows every canonical fact derivable, so
that any satisfying assignment of the program contains it – in particular the
falsity of the output, when false, always reaches the goal clause
(DescriptiveComplexity.LFPHorn.holds_iff_exists).
Stripping a relational summand out of terms #
A term over L₀.sum R with R relational is a term over L₀: the
summand contributes no function symbols.
Equations
- DescriptiveComplexity.stripTerm (FirstOrder.Language.var a) = FirstOrder.Language.var a
- DescriptiveComplexity.stripTerm (FirstOrder.Language.func (Sum.inl f) ts) = FirstOrder.Language.func f fun (i : Fin l) => DescriptiveComplexity.stripTerm (ts i)
- DescriptiveComplexity.stripTerm (FirstOrder.Language.func (Sum.inr f) _ts) = isEmptyElim f
Instances For
Dependency graph
Dependency graph
The subformula closure of a sentence, as a list #
The subformulas of a bounded formula over Empty, each with its binder
depth, as a list; the formula itself is included.
Equations
- DescriptiveComplexity.subs FirstOrder.Language.BoundedFormula.falsum = [⟨x✝, FirstOrder.Language.BoundedFormula.falsum⟩]
- DescriptiveComplexity.subs (FirstOrder.Language.BoundedFormula.equal t u) = [⟨x✝, FirstOrder.Language.BoundedFormula.equal t u⟩]
- DescriptiveComplexity.subs (FirstOrder.Language.BoundedFormula.rel r ts) = [⟨x✝, FirstOrder.Language.BoundedFormula.rel r ts⟩]
- DescriptiveComplexity.subs (a.imp b) = ⟨x✝, a.imp b⟩ :: (DescriptiveComplexity.subs a ++ DescriptiveComplexity.subs b)
- DescriptiveComplexity.subs a.all = ⟨x✝, a.all⟩ :: DescriptiveComplexity.subs a
Instances For
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
A bound on the binder depths of the subformula closure.
Equations
Instances For
Dependency graph
Dependency graph
Dependency graph
The headed clauses of the rule system #
The rules with a head, paired with their heads: goal clauses derive nothing, so only these participate in the stage machinery.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
Dependency graph
Dimensions of the construction #
The width of a stage tuple: the arity bound of the block.
Instances For
Dependency graph
The number of copies of the stage relations, minus one.
Equations
Instances For
Dependency graph
The number of copies of the stage relations: enough for (hc + 1) · n^hm
stages to exceed the number of atoms of the block on every nonempty
structure.
Equations
Instances For
Dependency graph
The number of variables reserved for evaluating the output sentence.
Equations
Instances For
Dependency graph
The universally quantified first-order variables shared by all clauses of the translated program: three stage-tuple blocks, two valuation blocks, the evaluation block, and one spare.
Equations
Instances For
Dependency graph
The binder depth of a subformula of the output is within the evaluation block. (A dedicated lemma, so that proof terms in the rules carry exactly this type.)
Dependency graph
The left subformula of an implication in the output.
Dependency graph
The right subformula of an implication in the output.
Dependency graph
The body of a universally quantified subformula of the output.
Dependency graph
The block of the translation #
Index of the subformula relations: a subformula of the output sentence, with its binder depth.
Equations
- DescriptiveComplexity.LFPHorn.SubIx d = { x : (n' : ℕ) × ((L.sum FirstOrder.Language.order).sum d.B.lang).BoundedFormula Empty n' // x ∈ DescriptiveComplexity.subs d.out }
Instances For
Dependency graph
Index of the non-firing relations: a headed clause of the rule system.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
Dependency graph
Dependency graph
The relation variables of the translated program: the original block
(computing the fixed point), the stage complements N, the non-firing
accumulators NF, the subformula truth/falsity relations, and the
∀-accumulators.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
The original relation variables.
Equations
Instances For
Dependency graph
N j i (t̄, x̄): at stage (j, t̄), the atom i x̄ is not yet derived.
Instances For
Dependency graph
NF j (c, a) (t̄, x̄, w̄): no valuation up to w̄ fires the clause c at
stage (j, t̄) to derive the atom a.idx x̄.
Instances For
Dependency graph
Truth (true) and falsity (false) of a subformula of the output.
Instances For
Dependency graph
The accumulator of a universally quantified subformula.
Instances For
Dependency graph
The arities: stage relations carry a stage tuple in front, non-firing relations also a valuation tuple behind, subformula relations their binder depth.
Equations
- DescriptiveComplexity.LFPHorn.trArity d (Sum.inl i) = d.B.arity i
- DescriptiveComplexity.LFPHorn.trArity d (Sum.inr (Sum.inl (fst, i))) = DescriptiveComplexity.LFPHorn.hm d + d.B.arity i
- DescriptiveComplexity.LFPHorn.trArity d (Sum.inr (Sum.inr (Sum.inl (fst, ca)))) = DescriptiveComplexity.LFPHorn.hm d + d.B.arity (↑ca).2.idx + d.k
- DescriptiveComplexity.LFPHorn.trArity d (Sum.inr (Sum.inr (Sum.inr (Sum.inl (x_1, snd))))) = (↑x_1).fst
- DescriptiveComplexity.LFPHorn.trArity d (Sum.inr (Sum.inr (Sum.inr (Sum.inr x_1)))) = (↑x_1).fst + 1
Instances For
Dependency graph
The block of the translated program.
Equations
- DescriptiveComplexity.LFPHorn.trBlock d = { ι := DescriptiveComplexity.LFPHorn.TrIx d, ιFinite := ⋯, arity := DescriptiveComplexity.LFPHorn.trArity d }
Instances For
Dependency graph
The shared first-order variables and their layout #
All clauses of the translated program share kk d universally quantified
variables: three stage-tuple blocks (current stage, next stage, and the atom
tuple), two valuation blocks for the rule being tested, a block for the
free variables of the output's subformulas, and one spare variable for the
∀-accumulators.
The current stage tuple t̄.
Equations
- DescriptiveComplexity.LFPHorn.vT1 d q = ⟨↑q, ⋯⟩
Instances For
Dependency graph
The next stage tuple t̄'.
Equations
Instances For
Dependency graph
The atom tuple x̄ (also the interpreted arguments ȳ of the output's
fixed-point atoms).
Equations
- DescriptiveComplexity.LFPHorn.vX d q = ⟨2 * DescriptiveComplexity.LFPHorn.hm d + ↑q, ⋯⟩
Instances For
Dependency graph
The first valuation block w̄.
Equations
- DescriptiveComplexity.LFPHorn.vW1 d q = ⟨3 * DescriptiveComplexity.LFPHorn.hm d + ↑q, ⋯⟩
Instances For
Dependency graph
The second valuation block w̄'.
Equations
- DescriptiveComplexity.LFPHorn.vW2 d q = ⟨3 * DescriptiveComplexity.LFPHorn.hm d + d.k + ↑q, ⋯⟩
Instances For
Dependency graph
The evaluation block ē, holding the free variables of a subformula.
Equations
- DescriptiveComplexity.LFPHorn.vE d q = ⟨3 * DescriptiveComplexity.LFPHorn.hm d + 2 * d.k + ↑q, ⋯⟩
Instances For
Dependency graph
The spare variable, the accumulator's predecessor.
Equations
Instances For
Dependency graph
The atom tuple of a relation variable i, inside the x̄ block.
Equations
Instances For
Dependency graph
The first n variables of the evaluation block.
Equations
Instances For
Dependency graph
The first copy.
Equations
Instances For
Dependency graph
The last copy.
Equations
Instances For
Dependency graph
Atom builders #
An atom of an original relation variable.
Equations
- DescriptiveComplexity.LFPHorn.rAt d i sel = { idx := DescriptiveComplexity.LFPHorn.rIx d i, args := sel }
Instances For
Dependency graph
An atom N j i (t̄, x̄).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
An atom NF j (c, a) (t̄, x̄, w̄).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
A truth or falsity atom of a subformula.
Equations
- DescriptiveComplexity.LFPHorn.tfAt d x b es = { idx := DescriptiveComplexity.LFPHorn.tfIx d x b, args := es }
Instances For
Dependency graph
An accumulator atom of a subformula.
Equations
- DescriptiveComplexity.LFPHorn.acAt d x es = { idx := DescriptiveComplexity.LFPHorn.acIx d x, args := es }
Instances For
Dependency graph
The rules of the translated program #
The relation variables, as a list.
Equations
Instances For
Dependency graph
Dependency graph
An original atom, over the lifted block and variables.
Equations
- DescriptiveComplexity.LFPHorn.liftAtom d a = DescriptiveComplexity.LFPHorn.rAt d a.idx fun (q : Fin (d.B.arity a.idx)) => DescriptiveComplexity.LFPHorn.vW1 d (a.args q)
Instances For
Dependency graph
An original rule, over the lifted block and variables.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
The original headed rules, lifted: they compute the fixed point on the
R-part of the block. (Goal clauses of the rule system are not lifted:
in FO(LFP) they derive nothing, and their content is carried by the output
sentence.)
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
The stage-successor pairs of copies: within one copy, or crossing to the next.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
Dependency graph
The guard stepping from stage (j, t̄) to stage (j', t̄'): the successor
tuple within a copy, the wrap-around between consecutive copies.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
Base rules: at the first stage, nothing is derived.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
Step rules: an atom underivable at a stage all of whose potential derivations fail to fire stays underivable at the next stage.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
The non-firing rules for one copy and one headed clause (c, a): walking
the valuations w̄' along their lexicographic order, NF (t̄, x̄, w̄') is
derived when the previous accumulator holds (at the base, nothing) and the
clause does not derive a.idx x̄ at valuation w̄' – because its guard fails,
because its head tuple differs from x̄, or because one of its body atoms is
not derived at the stage.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
All non-firing rules.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
A term of a subformula, as a term of the guard vocabulary over the evaluation variables.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
The rules evaluating one subformula of the output, by shape.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
All subformula-evaluation rules.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
The unique goal clause: the output sentence must not be false at the fixed point.
Equations
Instances For
Dependency graph
The rules of the translated program: everything but the goal clause.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
The translated program.
Equations
Instances For
Dependency graph
The canonical assignment #
Over a fixed ordered structure, each relation variable of the block has an intended value; the correctness proof shows that the least model of the translated program is exactly this assignment.
Composition distributes over Fin.addCases.
Dependency graph
The rank of a stage: its position in the lexicographic order of the pairs of a copy index and a stage tuple.
Equations
Instances For
Dependency graph
The complement of a stage: at stage (j, t̄), the atom i x̄ is not yet
derived. (A named definition, so that reduction stops here rather than
exposing the recursion of DescriptiveComplexity.derivesIn.)
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
The clause c with head atom a does not derive the atom a.idx x̄ at
stage rank r, at any valuation lexicographically up to w̄.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
The structure interpreting the expanded vocabulary at the least fixed point of the rules – the structure the output sentence is read in.
Equations
Instances For
Dependency graph
Truth of a subformula of the output at the least fixed point.
Equations
- DescriptiveComplexity.LFPHorn.evalT d A ψ v = ψ.Realize default v
Instances For
Dependency graph
The intended accumulator of a universally quantified subformula: the quantified subformula holds up to the last argument. Other subformulas have no accumulator; theirs is empty.
Equations
Instances For
Dependency graph
The canonical assignment: the fixed point on the original variables, the
complements of its stages on N, the non-firing predicates on NF, truth and
falsity of the output's subformulas, and the accumulators.
Equations
- One or more equations did not get rendered due to their size.
- DescriptiveComplexity.LFPHorn.canonAssign d A (Sum.inl i) = fun (x : Fin ((DescriptiveComplexity.LFPHorn.trBlock d).arity (Sum.inl i)) → A) => DescriptiveComplexity.Derives d.rules ⟨i, x⟩
- DescriptiveComplexity.LFPHorn.canonAssign d A (Sum.inr (Sum.inl (j, i))) = DescriptiveComplexity.LFPHorn.canonN d A j i
- DescriptiveComplexity.LFPHorn.canonAssign d A (Sum.inr (Sum.inr (Sum.inr (Sum.inr x)))) = DescriptiveComplexity.LFPHorn.canonAc d A x
Instances For
Dependency graph
Atom characterizations under the canonical assignment #
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
The accumulator of ∀, at an explicit snoc tuple.
Dependency graph
Counting: the last stage is beyond every derivation #
Dependency graph
Soundness: the canonical assignment satisfies the rules #
Each rule family preserves the canonical assignment; the goal clause is dealt with at assembly time, where it encodes the output sentence itself.
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Extending a non-firing certificate at the bottom valuation.
Dependency graph
Extending a non-firing certificate along the successor valuation.
Dependency graph
Dependency graph
Evaluating the output sentence #
The value of a term of the expanded vocabulary at the least fixed point.
Equations
Instances For
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
The evaluation tuple of a wider context, as a snoc.
Dependency graph
Composition distributes over Fin.snoc.
Dependency graph
Dependency graph
All rules are sound #
Dependency graph
Completeness: every canonical fact is derivable #
The other inclusion: each component of the canonical assignment is contained in the least model of the translated program. The fixed point part is leastness itself; the stage complements walk the stage order, the non-firing predicates walk the valuation order, and the subformula relations follow the structure of the output.
Assembling a valuation of the shared variables from its blocks.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
Extending a tuple to a wider block, junk-padded.
Equations
- DescriptiveComplexity.LFPHorn.padF f p = if h : ↑p < m then f ⟨↑p, h⟩ else Classical.arbitrary A
Instances For
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Rewriting the tuple of a derived atom.
Dependency graph
Membership of the rules in the program #
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
The fixed point itself #
The fixed point of the rules is derivable on the R-part: leastness,
against the lifted rules.
Dependency graph
The stage complements #
A stage that derives nothing new certifies non-firing at every valuation.
Dependency graph
The stage-successor guard is realizable along a cover.
Dependency graph
A cover of stages is a stage pair.
Dependency graph
At the bottom stage, everything is underived, by the base rules.
Dependency graph
Membership of a non-firing clause in the program.
Dependency graph
Firing one non-firing clause, given its guard and bodies.
Dependency graph
The non-firing certificates are derivable, walking the valuations.
Dependency graph
The stage complements are derivable, walking the stages.
Dependency graph
The subformula relations #
Dependency graph
Truth and falsity of every subformula of the output are derivable, by structural induction; universally quantified subformulas accumulate their instances along the order.
Dependency graph
Assembly: the translated program defines the same problem #
The truth of the output sentence, as the canonical value of its root.
Dependency graph
The translated program has a satisfying assignment exactly when the FO(LFP) definition holds. Left to right, the canonical assignment satisfies every rule, and the goal clause because the output is true; right to left, any satisfying assignment contains the least model, and if the output were false its falsity would be derivable, firing the goal clause.
Dependency graph
The equivalence of FO(LFP) and SO-Horn #
Every FO(LFP) definable problem is SO-Horn definable – the hard
direction of Grädel's equivalence, by the staged translation above. Together
with DescriptiveComplexity.SigmaSOHornDefinable.lfpDefinable this makes the two
formalisms interchangeable.
Dependency graph
FO(LFP) = SO-Horn (Grädel 1992): a problem is FO(LFP) definable iff it is SO-Horn definable, on ordered structures.
Dependency graph
SO-Horn definability is closed under complement: through the logic FO(LFP), where complementation is negating the output formula. This is the statement that was out of reach of the fragment alone.
Dependency graph
Level 0 of the hierarchy: Π₀ᵖ = Σ₀ᵖ #
Complementation is a bijection of the SO-Horn definable problems.
Dependency graph
Π₀ᵖ = Σ₀ᵖ: polynomial time is closed under complement – Grädel's
capture theorem at level 0 of the hierarchy, the identity that was open while
the fragment stood alone: it needs the least model of a Horn program computed
inside the fragment, which is what the translation through FO(LFP)
provides.