Documentation

Complexitylib.DescriptiveComplexity.SecondOrder.Syntax

Second-order logic: syntax #

Second-order logic over a vocabulary V extends first-order logic with relation variables — quantifiable variables standing for relations on the universe — and second-order quantifiers. A formula is indexed by a de Bruijn context rctx : List giving the arities of the relation variables in scope (innermost first) and by the number n of first-order variables in scope, so soExist k pushes a fresh arity-k relation variable onto rctx.

This is step 1 of the Fagin decomposition (roadmap L6): the ∃SO fragment of this syntax is the one Fagin's theorem characterizes as NP.

Main definitions #

Second-order formulas over vocabulary V, with a de Bruijn context rctx of relation-variable arities and n first-order variables. Extends first-order logic with relation-variable application (soRelApp) and second-order quantifiers (soExist/soAll), which push a fresh arity onto rctx.

Instances For
    @[reducible, inline]

    A second-order sentence: no free relation or element variables.

    Equations
    Instances For

      A formula is in existential second-order (∃SO) form: a block of second-order existential quantifiers over an FO matrix. This is the exact fragment Fagin's theorem characterizes as NP.

      Equations
      Instances For

        The first-order embedding of any formula is an FO matrix.

        The first-order fragment sits inside ∃SO: an embedded FO formula is a (quantifier-free-in-second-order) ∃SO formula.