Documentation

CslibFrontier.Logics.FirstOrder.FiniteVariable.Counting

Finite-variable counting logic #

The k-variable counting logic C^k extends FO^k by the counting quantifiers ∃^{≥ m} xᵢ φ, "at least m values of the variable xᵢ satisfy φ" ([CFI92], Section 3.2). Over a fixed number of variables, counting quantifiers add expressive power: the sentence ∃^{≥ 3} x₀ ⊤ uses one variable, but no one-variable first-order sentence separates a three-element set from a two-element one.

Cslib.Logic.FO.FiniteVariable.CountingFormula L k instantiates GenFormula at CountingQuant, inheriting its derived connectives, quantifier rank, free variables and congruence from Basic.lean. Truth uses Set.encard, so it is meaningful in infinite structures too: CountingFormula.atLeast m i φ holds when the set of values of xᵢ satisfying φ has at least m elements. The existential and universal quantifiers are derived from atLeast 1, and Formula.toCounting embeds FO^k into C^k preserving truth, quantifier rank and free variables.

Main definitions #

Main results #

References #

Counting quantifiers ∃^{≥ m} #

Quantifier tags ∃^{≥ m} of counting logics C^k and C^k_{∞ω}.

  • atLeast :: (
    • minCount : ℕ

      Minimum witness count m.

  • )
Instances For
    @[simp]
    theorem Cslib.Logic.FO.FiniteVariable.CountingQuant.eval_atLeast {M : Type w} (m : ℕ) (p : M → Prop) :
    Quantifier.eval { minCount := m } p ↔ ↑m ≤ {c : M | p c}.encard
    theorem Cslib.Logic.FO.FiniteVariable.CountingQuant.eval_iff_of_equiv {M : Type w} {N : Type w'} (q : CountingQuant) {pM : M → Prop} {pN : N → Prop} (f : M ≃ N) (hf : ∀ (c : M), pM c ↔ pN (f c)) :

    A bijection matching the witnesses of pM and pN preserves every counting quantifier.

    C^k: finite-variable counting logic #

    @[reducible, inline]

    Formulas of the k-variable counting logic C^k over the relation symbols of L. The variables are Fin k, and CountingFormula.atLeast m i φ quantifies the variable i, which may already be bound or free in an enclosing formula.

    The counting quantifier ∃^{≥ m} xᵢ φ: at least m values of xᵢ satisfy φ.

    Exactly m values of the variable xᵢ satisfy φ.

    On a finite structure, atLeast m i φ holds when at least m values of xᵢ satisfy φ, counted by Set.ncard.

    On a finite structure, exactly m i φ holds when exactly m values of xᵢ satisfy φ, counted by Set.ncard.

    FO^k is a fragment of C^k #

    The embedding of FO^k into C^k: the existential quantifier ex i φ becomes CountingFormula.atLeast 1 i φ.

    @[simp]

    The embedding preserves truth.