Types of bounded quantifier rank
Lax185574.FirstOrderTypes · concepts/Lax185574/FirstOrderTypes.lean · lax-185574
No public endorsements yet.
Loading review…
Sign in with ORCIDNatural 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
In the paper
- page 13 of this submission's paper
Lean source view on GitHub
| 1 | import Mathlib.ModelTheory.Satisfiability |
| 2 | import Mathlib.Data.Set.Card |
| 3 | |
| 4 | /-! |
| 5 | --- |
| 6 | title: Types of bounded quantifier rank |
| 7 | type: definition |
| 8 | --- |
| 9 | Let A be a structure and W a set of its elements. A formula with |
| 10 | parameters from W is a formula in the signature of A expanded by a |
| 11 | constant 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 |
| 13 | of all formulas φ(x₁, …, x_k) with parameters from W and of quantifier |
| 14 | rank at most q such that A ⊨ φ(v̄). |
| 15 | |
| 16 | For sets X, Y of elements, |
| 17 | Types_{k,q}(X/Y) = { tp_q(v̄/Y) : v̄ ∈ X^k } |
| 18 | is the set of types realized by k-tuples from X. The notation omits /Y |
| 19 | when Y is empty, and then the types are those without parameters, |
| 20 | tp_q(v̄) and Types_{k,q}(X). The number of realized types |Types_{k,q}(X/Y)| is the |
| 21 | quantity that the paper bounds throughout. |
| 22 | |
| 23 | # Formalization notes |
| 24 | |
| 25 | Types without parameters, `rankType` and `types`, are defined separately |
| 26 | from types over a parameter set, `rankTypeOver` and `typesOver`. Over |
| 27 | the empty set the two agree up to the evident bijection of formulas. |
| 28 | The separate version is needed because the formula type of the |
| 29 | parameterized version depends on the parameter set, so it would not |
| 30 | let one compare types in different structures, such as two induced |
| 31 | substructures. |
| 32 | |
| 33 | Formulas are those of mathlib's first-order logic, `L.Formula α`, where |
| 34 | `α` indexes the free variables. A parameter from `W` is a free variable |
| 35 | of the right summand of `Fin k ⊕ W`, and it is always assigned the |
| 36 | element that it names. This is the same as adjoining a constant for each |
| 37 | element of `W`, and it does not change the quantifier rank. The type is |
| 38 | literally the set of formulas, as in the paper, and the count is the |
| 39 | cardinality of the set of realized types. It is finite whenever `X` is |
| 40 | finite, since it is the image of `X^k`. |
| 41 | |
| 42 | The count `typeCountOver` takes the structure as an explicit argument, |
| 43 | because it is applied to structures that are not instances, such as the |
| 44 | expansion of a graph by colors. |
| 45 | |
| 46 | Mathlib's formulas are built from falsum, equality, relations, |
| 47 | implication and universal quantification. The quantifier rank is the |
| 48 | nesting depth of the universal quantifier. Every formula of the usual |
| 49 | syntax with ¬, ∧, ∨, ∃ and ∀ translates into this syntax without |
| 50 | changing its quantifier rank, so the types are the usual ones. |
| 51 | -/ |
| 52 | |
| 53 | namespace Lax185574.FirstOrderTypes |
| 54 | |
| 55 | open FirstOrder FirstOrder.Language |
| 56 | |
| 57 | universe u v w z |
| 58 | |
| 59 | variable {L : Language.{u, v}} |
| 60 | |
| 61 | /-- The quantifier rank of a formula: the nesting depth of its |
| 62 | quantifiers. -/ |
| 63 | def 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 | |
| 70 | variable {V : Type z} |
| 71 | |
| 72 | section |
| 73 | |
| 74 | variable [L.Structure V] |
| 75 | |
| 76 | /-- The type `tp_q(v̄)` of quantifier rank `q` of the tuple `v`: the |
| 77 | formulas of quantifier rank at most `q`, without parameters, that hold |
| 78 | of `v`. -/ |
| 79 | def 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 |
| 83 | from `X`. -/ |
| 84 | def 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` |
| 88 | realized by `k`-tuples from `X`. -/ |
| 89 | noncomputable 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 |
| 93 | the parameter set `W`: the formulas of quantifier rank at most `q` with |
| 94 | parameters from `W` that hold of `v`. -/ |
| 95 | def 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`. -/ |
| 101 | def 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 | |
| 104 | end |
| 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`. -/ |
| 108 | noncomputable def typeCountOver (M : L.Structure V) (k q : ℕ) (X Y : Set V) : ℕ := |
| 109 | (@typesOver L V M k q X Y).ncard |
| 110 | |
| 111 | end Lax185574.FirstOrderTypes |
| 112 |
Formalization notes
Types without parameters, and , are defined separately from types over a parameter set, and . 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, , where indexes the free variables. A parameter from is a free variable of the right summand of , and it is always assigned the element that it names. This is the same as adjoining a constant for each element of , 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 is finite, since it is the image of .
The count 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.
Builds on
none
Used by
Discussion
Ask a question or add context. Endorsements and structured flags are kept in the review panel above.
0 comments