Documentation

DescriptiveComplexity.Counting.Quantitative

Quantitative first-order logic, and the class FP #

The quantitative logic of Arenas, Muñoz, Riveros 2020, in its first-order fragment QFO: above a layer of Boolean formulas, a layer of terms denoting natural numbers,

α ::= φ | s | α + α | α · α | Σx. α | Πx. α,

a formula counting 1 when it holds and 0 when it does not, and the two quantifiers being the sum and the product over the elements of the structure (DescriptiveComplexity.QTerm, DescriptiveComplexity.QTerm.eval). The logic, its semantics and the idea of separating a Boolean level from a quantitative one are theirs; QSO, the full logic of the paper, has second-order sums and products as well, which are not formalized here.

FP, the class of the functions computable in polynomial time – here those with natural-number values, which is what a DescriptiveComplexity.CountingProblem is – is defined by this logic over a Boolean layer of least fixed points: a problem is in FP when it is the value of a QFO term over the vocabulary expanded by the relations of a least fixed point, on every ordered finite structure (DescriptiveComplexity.FPDefinable). That QFO(LFP) captures FP over ordered structures is Theorem 4.4 of the paper; it is cited, not proved, as the capture theorems behind the other logically defined classes of the library are where no machine characterization is given.

A term over the plain ordered vocabulary, with no fixed point, defines a problem of FP (DescriptiveComplexity.fpDefinable_of_qfo): this is the case of most concrete functions, the fixed point being what makes the class all of FP.

Positivity is first-order #

Whether a term is positive is a formula (DescriptiveComplexity.QTerm.pos): a sum is positive when some summand is, a product when every factor is. So the support of a problem of FP is in PTIME (DescriptiveComplexity.support_mem_PTIME_of_fpDefinable), as the support of a problem of #P is in NP; and a parsimoniously #P-hard problem cannot be in FP unless NP ⊆ PTIME (DescriptiveComplexity.NP_subset_PTIME_of_parsimoniousHard_of_fpDefinable).

Terms #

The terms of quantitative first-order logic over a Boolean layer of first-order formulas, with free variables in α (Arenas, Muñoz, Riveros 2020, grammar (3.1), restricted to first-order quantifiers). A quantifier binds a block of n variables at once, the variables Sum.inr i of α ⊕ Fin n; the quantifiers Σx and Πx of the paper are the case n = 1.

Instances For
    Dependency graph
    noncomputable def DescriptiveComplexity.QTerm.eval {L : FirstOrder.Language} {A : Type} [L.Structure A] {α : Type} :
    QTerm L α → (α → A) → ℕ

    The value of a term in a structure, under a valuation (Table 1 of the paper).

    Equations
    Instances For
      Dependency graph

      The value of a closed term.

      Equations
      Instances For
        Dependency graph
        Dependency graph
        Dependency graph

        Positivity #

        noncomputable def DescriptiveComplexity.QTerm.pos {L : FirstOrder.Language} {α : Type} :
        QTerm L α → L.Formula α

        “The term is positive”, as a formula: a formula is positive when it holds, a sum when some summand is, a product when every factor is.

        Equations
        Instances For
          Dependency graph

          FP #

          A definition in QFO(LFP): a least fixed point, as for DescriptiveComplexity.LFPDef, and a quantitative term over the vocabulary expanded by its relations, read at the fixed point.

          Instances For
            Dependency graph

            The value of a definition on an ordered structure: the output, read at the least fixed point of the rules.

            Equations
            Instances For
              Dependency graph

              A counting problem is in FP when, on nonempty finite structures, it is the value of a definition in QFO(LFP), whatever the linear order (Arenas, Muñoz, Riveros 2020, Theorem 4.4).

              Equations
              Instances For
                Dependency graph
                theorem DescriptiveComplexity.fpDefinable_congr {L : FirstOrder.Language} [L.IsRelational] {C C' : CountingProblem L} (h : ∀ (A : Type) [inst : L.Structure A] [Finite A], C.Count A = C'.Count A) (hC : FPDefinable C) :
                Dependency graph

                A term with no fixed point defines a problem of FP: a counting problem that is the value of a QFO term over the ordered vocabulary is in FP. Registered in the Lax archive as Lax366625.FPByDigits.fpDefinable_of_qfo.

                Dependency graph

                The support of a problem of FP is in PTIME: positivity of the output term is a first-order formula over the fixed point.

                Dependency graph

                A problem of FP is not parsimoniously #P-hard, unless NP ⊆ PTIME.

                Dependency graph