Types of bounded quantifier rank

Lax185574.FirstOrderTypes · concepts/Lax185574/FirstOrderTypes.lean · lax-185574

definition

Loading review…

Sign in with ORCID

Community review

Flags

Each flag is tied to a public ORCID identity and explains why this concept may be incorrect.

No flags have been submitted.

    Community review

    Flag this concept

    State precisely what appears incorrect. This explanation will be public under your ORCID name.

    No source line selected.

    Natural Language Statement

    Definition

    Let A be a structure and W a set of its elements. A formula with parameters from W is a formula in the signature of A expanded by a constant for every element of W. For a tuple v̄ ∈ V(A)^k and q ∈ ℕ, the type of quantifier rank q of v̄ over W, written tp_q(v̄/W), is the set of all formulas φ(x₁, …, x_k) with parameters from W and of quantifier rank at most q such that A ⊨ φ(v̄).

    For sets X, Y of elements, Types_{k,q}(X/Y) = { tp_q(v̄/Y) : v̄ ∈ X^k } is the set of types realized by k-tuples from X. The notation omits /Y when Y is empty, and then the types are those without parameters, tp_q(v̄) and Types_{k,q}(X). The number of realized types |Types_{k,q}(X/Y)| is the quantity that the paper bounds throughout.

    Concept map
    1 concept
    100%
    DefinitionThis conceptDescendants are omitted for concepts with more than 10 descendants.

    In the paper

    • page 13 of this submission's paper

    Lean source view on GitHub

    1import Mathlib.ModelTheory.Satisfiability
    2import Mathlib.Data.Set.Card
    3
    4/-!
    5---
    6title: Types of bounded quantifier rank
    7type: definition
    8---
    9Let A be a structure and W a set of its elements. A formula with
    10parameters from W is a formula in the signature of A expanded by a
    11constant for every element of W. For a tuple v̄ ∈ V(A)^k and q ∈ ℕ, the
    12*type of quantifier rank q of v̄ over W*, written tp_q(v̄/W), is the set
    13of all formulas φ(x₁, …, x_k) with parameters from W and of quantifier
    14rank at most q such that A ⊨ φ(v̄).
    15
    16For sets X, Y of elements,
    17Types_{k,q}(X/Y) = { tp_q(v̄/Y) : v̄ ∈ X^k }
    18is the set of types realized by k-tuples from X. The notation omits /Y
    19when Y is empty, and then the types are those without parameters,
    20tp_q(v̄) and Types_{k,q}(X). The number of realized types |Types_{k,q}(X/Y)| is the
    21quantity that the paper bounds throughout.
    22
    23# Formalization notes
    24
    25Types without parameters, `rankType` and `types`, are defined separately
    26from types over a parameter set, `rankTypeOver` and `typesOver`. Over
    27the empty set the two agree up to the evident bijection of formulas.
    28The separate version is needed because the formula type of the
    29parameterized version depends on the parameter set, so it would not
    30let one compare types in different structures, such as two induced
    31substructures.
    32
    33Formulas are those of mathlib's first-order logic, `L.Formula α`, where
    34`α` indexes the free variables. A parameter from `W` is a free variable
    35of the right summand of `Fin k ⊕ W`, and it is always assigned the
    36element that it names. This is the same as adjoining a constant for each
    37element of `W`, and it does not change the quantifier rank. The type is
    38literally the set of formulas, as in the paper, and the count is the
    39cardinality of the set of realized types. It is finite whenever `X` is
    40finite, since it is the image of `X^k`.
    41
    42The count `typeCountOver` takes the structure as an explicit argument,
    43because it is applied to structures that are not instances, such as the
    44expansion of a graph by colors.
    45
    46Mathlib's formulas are built from falsum, equality, relations,
    47implication and universal quantification. The quantifier rank is the
    48nesting depth of the universal quantifier. Every formula of the usual
    49syntax with ¬, ∧, ∨, ∃ and ∀ translates into this syntax without
    50changing its quantifier rank, so the types are the usual ones.
    51-/
    52
    53namespace Lax185574.FirstOrderTypes
    54
    55open FirstOrder FirstOrder.Language
    56
    57universe u v w z
    58
    59variable {L : Language.{u, v}}
    60
    61/-- The quantifier rank of a formula: the nesting depth of its
    62quantifiers. -/
    63def quantifierRank {α : Type w} : {n : ℕ} → L.BoundedFormula α n → ℕ
    64 | _, .falsum => 0
    65 | _, .equal _ _ => 0
    66 | _, .rel _ _ => 0
    67 | _, .imp φ ψ => max (quantifierRank φ) (quantifierRank ψ)
    68 | _, .all φ => quantifierRank φ + 1
    69
    70variable {V : Type z}
    71
    72section
    73
    74variable [L.Structure V]
    75
    76/-- The type `tp_q(v̄)` of quantifier rank `q` of the tuple `v`: the
    77formulas of quantifier rank at most `q`, without parameters, that hold
    78of `v`. -/
    79def rankType (q : ℕ) {k : ℕ} (v : Fin k → V) : Set (L.Formula (Fin k)) :=
    80 {φ | quantifierRank φ ≤ q ∧ φ.Realize v}
    81
    82/-- `Types_{k,q}(X)`: the types of quantifier rank `q` of the `k`-tuples
    83from `X`. -/
    84def types (k q : ℕ) (X : Set V) : Set (Set (L.Formula (Fin k))) :=
    85 rankType q '' {v : Fin k → V | ∀ i, v i ∈ X}
    86
    87/-- `|Types_{k,q}(X)|`: the number of types of quantifier rank `q`
    88realized by `k`-tuples from `X`. -/
    89noncomputable def typeCount (k q : ℕ) (X : Set V) : ℕ :=
    90 (types (L := L) k q X).ncard
    91
    92/-- The type `tp_q(v̄/W)` of quantifier rank `q` of the tuple `v` over
    93the parameter set `W`: the formulas of quantifier rank at most `q` with
    94parameters from `W` that hold of `v`. -/
    95def rankTypeOver (q : ℕ) (W : Set V) {k : ℕ} (v : Fin k → V) :
    96 Set (L.Formula (Fin k ⊕ W)) :=
    97 {φ | quantifierRank φ ≤ q ∧ φ.Realize (Sum.elim v Subtype.val)}
    98
    99/-- `Types_{k,q}(X/Y)`: the types of quantifier rank `q` over `Y` of the
    100`k`-tuples from `X`. -/
    101def typesOver (k q : ℕ) (X Y : Set V) : Set (Set (L.Formula (Fin k ⊕ Y))) :=
    102 rankTypeOver q Y '' {v : Fin k → V | ∀ i, v i ∈ X}
    103
    104end
    105
    106/-- `|Types_{k,q}(X/Y)|`: the number of types of quantifier rank `q` over
    107`Y` realized by `k`-tuples from `X`, in the structure `M`. -/
    108noncomputable def typeCountOver (M : L.Structure V) (k q : ℕ) (X Y : Set V) : ℕ :=
    109 (@typesOver L V M k q X Y).ncard
    110
    111end Lax185574.FirstOrderTypes
    112
    Formalization notes

    Types without parameters, rankTyperankType and typestypes, are defined separately from types over a parameter set, rankTypeOverrankTypeOver and typesOvertypesOver. Over the empty set the two agree up to the evident bijection of formulas. The separate version is needed because the formula type of the parameterized version depends on the parameter set, so it would not let one compare types in different structures, such as two induced substructures.

    Formulas are those of mathlib's first-order logic, L.FormulaαL.Formula α, where αα indexes the free variables. A parameter from WW is a free variable of the right summand of Fink⊕WFin k ⊕ W, and it is always assigned the element that it names. This is the same as adjoining a constant for each element of WW, and it does not change the quantifier rank. The type is literally the set of formulas, as in the paper, and the count is the cardinality of the set of realized types. It is finite whenever XX is finite, since it is the image of XkX^k.

    The count typeCountOvertypeCountOver takes the structure as an explicit argument, because it is applied to structures that are not instances, such as the expansion of a graph by colors.

    Mathlib's formulas are built from falsum, equality, relations, implication and universal quantification. The quantifier rank is the nesting depth of the universal quantifier. Every formula of the usual syntax with ¬, ∧, ∨, ∃ and ∀ translates into this syntax without changing its quantifier rank, so the types are the usual ones.

    Discussion

    Ask a question or add context. Endorsements and structured flags are kept in the review panel above.

    Loading discussion…