Paper
First-Order Model Checking on Monadically Dependent Graph Classes
65 pages · 151 marked passages · pdflatex · download PDF · lax-185574
-
Monadic dependence through the independence property
A formula φ(x, y) in the signature of colored graphs has the independence property on a graph class 𝒞 if for every n there are a coloring G⁺ of a graph G ∈ 𝒞, vertices a₁, …, aₙ, and vertices b_J for J ⊆ [n] such that G⁺ ⊨ φ(aᵢ, b_J) holds exactly when i ∈ J. A class is monadically dependent if and only if no formula has the independence property on it.
By a result of Baldwin and Shelah, one may equivalently allow formulas φ(x̄, ȳ) with tuples of variables, and tuples āᵢ and b̄_J. On a monadically dependent class, no such formula has the independence property either.
- thm✓
Lax185574.IndependenceProperty(1st statement) - thm✓
Lax185574.IndependenceProperty(2nd statement)
1 import Lax185574.MonadicDependence 2 … module docstring, 33 lines 36 37 namespace Lax185574.IndependenceProperty 38 39 open Lax185574.Graphs Lax185574.FirstOrderLogic Lax185574.MonadicDependence 40 41 /-- The formula `φ(x̄, ȳ)` with `k` colors, whose free variables are a 42 tuple `x̄` of `p` variables followed by a tuple `ȳ` of `p'` variables, 43 has the *independence property* on `C`: for every `m` there are a graph 44 `G ∈ C`, a coloring of `G`, tuples `a i` for `i < m` and tuples `b J` 45 for `J ⊆ {0, …, m - 1}` such that `φ(a i, b J)` holds exactly when 46 `i ∈ J`. -/ 47 def HasIP (C : GraphClass) {k p p' : ℕ} (φ : Formula (Fin k) (p + p')) : Prop := 48 ∀ m : ℕ, ∃ G ∈ C, ∃ (col : Fin k → Set (Fin G.n)) (a : Fin m → Fin p → Fin G.n) 49 (b : Finset (Fin m) → Fin p' → Fin G.n), 50 ∀ (i : Fin m) (J : Finset (Fin m)), φ.Holds G col (Fin.append (a i) (b J)) ↔ i ∈ J 51 52 /-- A graph class is monadically dependent if and only if no formula 53 `φ(x, y)` of colored graphs, in two single variables, has the 54 independence property on it. -/ 55 axiom monadicallyDependent_iff_forall_not_hasIP (C : GraphClass) : 56 MonadicallyDependent C ↔ ∀ (k : ℕ) (φ : Formula (Fin k) (1 + 1)), ¬ HasIP C φ 57 58 /-- On a monadically dependent class, no formula `φ(x̄, ȳ)` of colored 59 graphs, in tuples of variables, has the independence property 60 (Baldwin–Shelah). -/ 61 axiom not_hasIP_of_monadicallyDependent (C : GraphClass) (hC : MonadicallyDependent C) 62 {k p p' : ℕ} (φ : Formula (Fin k) (p + p')) : ¬ HasIP C φ 63 64 end Lax185574.IndependenceProperty 65 - thm✓
-
no assumptions
If a formula has the independence property on , then for a graph on vertices take the elements and color the set of them and the set of the elements for the edges of . Two distinct elements of are adjacent in if and only if they have a common -neighbor in . So transduces all graphs. Conversely, a transduction of all graphs produces the incidence graph between and its subsets, so its edge formula has the independence property.
The argument is carried out for the graph classes of the archive and mathlib formulas, and transferred to the graph classes used here and the translation of formulas.
-
no assumptions
Suppose
φ(x̄; ȳ)has the independence property on . The left tuple is not empty, since otherwise all agree. By Shelah's reduction, carried out with Ramsey's theorem on finite shattered sequences, some formula with a single left variable has the independence property, and so has its dual . Then codes pairs: for tuples and the elements satisfy it exactly when . Among all formulas coding on , with any number of colors, take one of least total arity. If it has two left variables, then either extends by elements of a color to a tuple coding and no other element of a color , which is a coding formula with a single left variable, or a spurious witness gives a coding formula with parameters and fewer left variables. By symmetry the minimal formula is in single variables. With a color for the codes with , the formula has the independence property. So is not monadically dependent.The argument is carried out for the graph classes of the archive and mathlib formulas, and transferred to the graph classes used here and the translation of formulas.
-
The proof in the paper. Color a pair of index pairs by the truth values of
φ(āᵢ', c_{i,j})and , and take homogeneous sets , by the bipartite Ramsey lemma. Pair up consecutive elements of and : withūᵢ = āᵣ āᵣ'for the -th and -st elements of , likewise , and , the exclusive or holds ofūᵢ', d_{i,j}exactly when : earlier pairs see two equal truth values by homogeneity, the pair itself sees true then false, and later pairs see false twice. The same holds for the columns. Then the formula , with coloring the grid points for , encodes membership for an injection of the subsets of into the columns. By Baldwin–Shelah this bounds , hence the order of the pattern.The argument is carried out for the graph classes of the archive and their monadic dependence, and transferred to the graph classes used here.
-
no assumptions
Concatenate the two tuples to one tuple of length and apply the Erdős–Rado theorem for order types of tuples to the induced coloring. This gives a set of size on which the color depends only on the order type of the concatenation. Split into its smallest elements and its largest elements . Every entry from lies below every entry from , so for and the order type of the concatenation is determined by the order types of and . The function is the largest such that every admits such sets of size for every coloring. It is non-decreasing by definition and unbounded by the Ramsey step.
The Ramsey core is adapted from lax-345067 (finite Ramsey theorems for pairs and tuples).
-
Homogeneous rectangles for colorings of pairs of tuples
For a tuple ā = (a₁, …, a_ℓ) ∈ [n]^ℓ, the order type otp(ā) of ā is the atomic type of ā in the ordered set ([n], ≤). It stores, for each i, j ∈ [ℓ], whether aᵢ < aⱼ, aᵢ = aⱼ or aᵢ > aⱼ.
For every k, ℓ ∈ ℕ there is an unbounded, non-decreasing function U_{k,ℓ} : ℕ → ℕ with the following property. For every t ∈ ℕ and coloring
c : [t]^ℓ × [t]^ℓ → [k]
there are subsets I, J ⊆ [t] of size U_{k,ℓ}(t) such that c(ā, b̄) only depends on otp(ā) and otp(b̄), for all ā ∈ I^ℓ and b̄ ∈ J^ℓ.
This is a version of Ramsey's theorem, see Lemma 4.4 of the cited work on flip-breakability.
1 import Mathlib.Data.Fintype.Card 2 import Mathlib.Order.Monotone.Basic 3 … module docstring, 30 lines 34 35 namespace Lax185574.BipartiteHomogeneity 36 37 /-- The order type `otp(ā)` of a tuple of elements of `[t]`: the 38 comparison of every pair of its entries. -/ 39 def orderType {ℓ t : ℕ} (a : Fin ℓ → Fin t) : Fin ℓ → Fin ℓ → Ordering := 40 fun i j => compare (a i) (a j) 41 42 /-- **Homogeneous rectangles.** Every coloring of pairs of 43 `ℓ`-tuples from `[t]` with `k` colors is determined by the order types 44 on `I^ℓ × J^ℓ`, for some sets `I` and `J` of size `U_{k,ℓ}(t)`, where 45 `U_{k,ℓ}` is unbounded and non-decreasing. -/ 46 axiom exists_orderType_homogeneous (k ℓ : ℕ) : 47 ∃ U : ℕ → ℕ, Monotone U ∧ (∀ m : ℕ, ∃ t : ℕ, m ≤ U t) ∧ 48 ∀ (t : ℕ) (c : (Fin ℓ → Fin t) → (Fin ℓ → Fin t) → Fin k), 49 ∃ I J : Finset (Fin t), I.card = U t ∧ J.card = U t ∧ 50 ∀ a a' b b' : Fin ℓ → Fin t, 51 (∀ i, a i ∈ I) → (∀ i, a' i ∈ I) → (∀ i, b i ∈ J) → (∀ i, b' i ∈ J) → 52 orderType a = orderType a' → orderType b = orderType b' → 53 c a b = c a' b' 54 55 end Lax185574.BipartiteHomogeneity 56 -
The proof in the paper. Color a pair of index pairs by the truth values of
φ(āᵢ', c_{i,j})and , and take homogeneous sets , by the bipartite Ramsey lemma. Pair up consecutive elements of and : withūᵢ = āᵣ āᵣ'for the -th and -st elements of , likewise , and , the exclusive or holds ofūᵢ', d_{i,j}exactly when : earlier pairs see two equal truth values by homogeneity, the pair itself sees true then false, and later pairs see false twice. The same holds for the columns. Then the formula , with coloring the grid points for , encodes membership for an injection of the subsets of into the columns. By Baldwin–Shelah this bounds , hence the order of the pattern.The argument is carried out for the graph classes of the archive and their monadic dependence, and transferred to the graph classes used here.
-
Local formulas and basic local sentences
Fix a finite relational signature σ of arity α. Two σ-formulas φ(x̄) and ψ(x̄) are equivalent if for every σ-structure A and every tuple ā ∈ V(A)^{|x̄|}, A ⊨ φ(ā) if and only if A ⊨ ψ(ā).
The formula adj_σ(x₁, x₂) tests whether x₁ and x₂ are adjacent in the Gaifman graph. For every relation R ∈ σ of arity β ≤ α it tests whether there are elements x₃, …, x_β such that some permutation of x₁, …, x_β satisfies R. Its quantifier rank is at most α − 2. From it one derives the formula dist(x₁, x₂) ≤ r, which checks whether x₁ and x₂ have distance at most r in the Gaifman graph. It quantifies the candidate vertices of a path and checks the required adjacencies in parallel, so its quantifier rank is at most r + α.
A σ-formula φ(x̄) is r-local if every quantifier appearing in φ(x̄) is of the form ∀y ∈ Ball_s(x̄) or ∃y ∈ Ball_s(x̄) for some s ≤ r, where the ball checks are implemented using the dist formulas, which are exempt from this condition. A sentence ψ is basic r-local if there is some r' ≤ r such that ψ is of the form
∃x₁, …, x_m ( ⋀{1 ≤ i < j ≤ m} dist(xᵢ, xⱼ) > 2r' ∧ ⋀{1 ≤ i ≤ m} φ(xᵢ) )
for an r'-local formula φ.
1 import Lax185574.GaifmanGraph 2 import Mathlib.ModelTheory.Satisfiability 3 import Mathlib.Logic.Equiv.Fin.Basic 4 … module docstring, 74 lines 79 80 namespace Lax185574.LocalFormulas 81 82 open FirstOrder FirstOrder.Language 83 84 universe u v w a 85 86 variable {L : Language.{u, v}} 87 88 /-- Two formulas are *equivalent* if they hold of the same tuples in 89 every structure whose domain lies in the universe `w`. -/ 90 def Equivalent {α : Type a} (φ ψ : L.Formula α) : Prop := 91 ∀ (M : Type w) [L.Structure M] (x : α → M), φ.Realize x ↔ ψ.Realize x 92 93 /-- Two formulas are *equivalent on finite structures* if they hold of 94 the same tuples in every finite structure whose domain lies in the 95 universe `w`. -/ 96 def FinitelyEquivalent {α : Type a} (φ ψ : L.Formula α) : Prop := 97 ∀ (M : Type w) [Finite M] [L.Structure M] (x : α → M), φ.Realize x ↔ ψ.Realize x 98 99 /-- The formula `φ(x₁, …, x_j)` with each `xᵢ` replaced by the term 100 `t i`, as a subformula with `n` bound variables in scope. -/ 101 def instantiate {β : Type*} {j n : ℕ} (φ : L.Formula (Fin j)) 102 (t : Fin j → L.Term (β ⊕ Fin n)) : L.BoundedFormula β n := 103 (φ.subst t).relabel id 104 105 /-- The variable term in position `m` of a relation atom in `adj_σ`: 106 positions `0` and `1` are `x₁` and `x₂`, and position `m ≥ 2` is the 107 bound variable `x_{m+1}`. -/ 108 def adjSlot {l : ℕ} (m : Fin l) : L.Term (Fin 2 ⊕ Fin (l - 2)) := 109 if h : m.val < 2 then Term.var (Sum.inl ⟨m.val, h⟩) 110 else Term.var (Sum.inr ⟨m.val - 2, by omega⟩) 111 112 /-- The part of `adj_σ` for one relation symbol `R` of arity `l`: 113 `∃x₃ … ∃x_l ⋁_π R(x_{π(1)}, …, x_{π(l)})` if `l ≥ 2`, and falsum 114 otherwise. -/ 115 noncomputable def adjVia {l : ℕ} (R : L.Relations l) : L.Formula (Fin 2) := 116 if 2 ≤ l then 117 BoundedFormula.exs 118 (BoundedFormula.iSup fun π : Equiv.Perm (Fin l) => 119 BoundedFormula.rel R fun m => adjSlot (π m)) 120 else ⊥ 121 122 variable (L) in 123 /-- `adj_σ(x₁, x₂)`: the formula stating that `x₁` and `x₂` are adjacent 124 in the Gaifman graph. -/ 125 noncomputable def adjFormula [Finite (Σ l, L.Relations l)] : L.Formula (Fin 2) := 126 ∼((Term.var (Sum.inl 0)).bdEqual (Term.var (Sum.inl 1))) ⊓ 127 BoundedFormula.iSup fun R : Σ l, L.Relations l => adjVia R.2 128 129 /-- The vertex `v_i` of the walk quantified in `dist(x₁, x₂) ≤ r`: 130 `v₀ = x₁`, and `v_i` for `i ≥ 1` is the `i`-th bound variable. -/ 131 def walkVertex {r : ℕ} (i : Fin (r + 1)) : L.Term (Fin 2 ⊕ Fin r) := 132 Fin.cases (motive := fun _ => L.Term (Fin 2 ⊕ Fin r)) 133 (Term.var (Sum.inl 0)) (fun j => Term.var (Sum.inr j)) i 134 135 variable (L) in 136 /-- `dist(x₁, x₂) ≤ r`: there are `v₁, …, v_r` with `v_r = x₂` such that 137 each step of `x₁ = v₀, v₁, …, v_r` is an equality or an adjacency. -/ 138 noncomputable def distFormula [Finite (Σ l, L.Relations l)] (r : ℕ) : 139 L.Formula (Fin 2) := 140 BoundedFormula.exs 141 (((walkVertex (L := L) (Fin.last r)).bdEqual (Term.var (Sum.inl 1))) ⊓ 142 BoundedFormula.iInf fun i : Fin r => 143 ((walkVertex (L := L) i.castSucc).bdEqual (walkVertex i.succ)) ⊔ 144 instantiate (adjFormula L) ![walkVertex i.castSucc, walkVertex i.succ]) 145 146 variable (L) in 147 /-- The guard `y ∈ Ball_s(x̄)` of a local quantifier, where `x̄` are the 148 `k` free variables and `y` is the newly bound variable: the disjunction 149 over `i` of `dist(xᵢ, y) ≤ s`. -/ 150 noncomputable def ballGuard [Finite (Σ l, L.Relations l)] (k s n : ℕ) : 151 L.BoundedFormula (Fin k) (n + 1) := 152 BoundedFormula.iSup fun i : Fin k => 153 instantiate (distFormula L s) ![Term.var (Sum.inl i), Term.var (Sum.inr (Fin.last n))] 154 155 /-- `IsLocal r φ`: the formula `φ` with free variables `x̄ = x₁, …, x_k` 156 and `n` further bound variables in scope is `r`-local. It is built from 157 atoms by falsum, implication and quantifiers guarded by `Ball_s(x̄)` for 158 some `s ≤ r`. -/ 159 inductive IsLocal [Finite (Σ l, L.Relations l)] (r : ℕ) {k : ℕ} : 160 {n : ℕ} → L.BoundedFormula (Fin k) n → Prop 161 /-- Falsum is local. -/ 162 | falsum {n : ℕ} : IsLocal r (BoundedFormula.falsum : L.BoundedFormula (Fin k) n) 163 /-- Equality atoms are local. -/ 164 | equal {n : ℕ} (t₁ t₂ : L.Term (Fin k ⊕ Fin n)) : 165 IsLocal r (BoundedFormula.equal t₁ t₂) 166 /-- Relation atoms are local. -/ 167 | rel {n l : ℕ} (R : L.Relations l) (ts : Fin l → L.Term (Fin k ⊕ Fin n)) : 168 IsLocal r (BoundedFormula.rel R ts) 169 /-- Implications of local formulas are local. -/ 170 | imp {n : ℕ} {φ ψ : L.BoundedFormula (Fin k) n} : 171 IsLocal r φ → IsLocal r ψ → IsLocal r (φ.imp ψ) 172 /-- `∀y ∈ Ball_s(x̄) φ`, that is `∀y (y ∈ Ball_s(x̄) → φ)`, for `s ≤ r`. -/ 173 | all {n s : ℕ} {φ : L.BoundedFormula (Fin k) (n + 1)} : 174 s ≤ r → IsLocal r φ → IsLocal r (∀' (ballGuard L k s n ⟹ φ)) 175 /-- `∃y ∈ Ball_s(x̄) φ`, that is `∃y (y ∈ Ball_s(x̄) ∧ φ)`, for `s ≤ r`. -/ 176 | ex {n s : ℕ} {φ : L.BoundedFormula (Fin k) (n + 1)} : 177 s ≤ r → IsLocal r φ → IsLocal r (∃' (ballGuard L k s n ⊓ φ)) 178 179 variable (L) in 180 /-- The sentence `∃x₁, …, x_m (⋀_{i < j} dist(xᵢ, xⱼ) > 2r' ∧ ⋀_i φ(xᵢ))`. -/ 181 noncomputable def basicLocalSentence [Finite (Σ l, L.Relations l)] (r' m : ℕ) 182 (φ : L.Formula (Fin 1)) : L.Sentence := 183 BoundedFormula.exs 184 ((BoundedFormula.iInf fun p : {p : Fin m × Fin m // p.1 < p.2} => 185 ∼(instantiate (distFormula L (2 * r')) 186 ![Term.var (Sum.inr p.1.1), Term.var (Sum.inr p.1.2)])) ⊓ 187 BoundedFormula.iInf fun i : Fin m => instantiate φ ![Term.var (Sum.inr i)]) 188 189 /-- `IsBasicLocal r ψ`: the sentence `ψ` is basic `r`-local. -/ 190 def IsBasicLocal [Finite (Σ l, L.Relations l)] (r : ℕ) (ψ : L.Sentence) : Prop := 191 ∃ r' ≤ r, ∃ (m : ℕ) (φ : L.Formula (Fin 1)), 192 IsLocal r' φ ∧ ψ = basicLocalSentence L r' m φ 193 194 end Lax185574.LocalFormulas 195 -
Local formulas are evaluated in any superset of the ball
Let φ(x̄) be an r-local σ-formula, let A be a σ-structure, let ā ∈ V(A)^{|x̄|}, and let Ball^A_r(ā) ⊆ B ⊆ V(A). Then A ⊨ φ(ā) if and only if A[B] ⊨ φ(ā).
1 import Lax185574.LocalFormulas 2 … module docstring, 18 lines 21 22 namespace Lax185574.LocalSubstructure 23 24 open FirstOrder FirstOrder.Language 25 open Lax185574.GaifmanGraph Lax185574.LocalFormulas 26 27 universe u v z 28 29 /-- **Local formulas and substructures.** An `r`-local formula holds of 30 a tuple in a structure `A` if and only if it holds of the tuple in every 31 induced substructure `A[B]` with `B ⊇ Ball^A_r(ā)`. -/ 32 axiom realize_iff_realize_induced (L : Language.{u, v}) [L.IsRelational] 33 [Finite (Σ l, L.Relations l)] (r k : ℕ) (φ : L.Formula (Fin k)) (hφ : IsLocal r φ) 34 (V : Type z) [L.Structure V] (B : Set V) (a : Fin k → B) : 35 ball L r (Subtype.val ∘ a) ⊆ B → 36 (φ.Realize (Subtype.val ∘ a) ↔ @Formula.Realize L B (induced B) _ φ a) 37 38 end Lax185574.LocalSubstructure 39 -
no assumptions
An -local formula holds of a tuple in a structure if and only if it holds of the tuple in an induced substructure that contains the ball of radius around the tuple. The quantifiers of the formula are guarded by balls of radius at most around the tuple, and these balls are the same in the structure and in the substructure, since a walk of length at most from the tuple uses only relation tuples whose entries lie in the ball.
-
Gaifman's locality theorem with a rank bound
For all α, q, k ∈ ℕ there is a p = p(α, q, k), computable from α, q, k, with the following property. Let σ be a finite relational signature of arity at most α. Every σ-formula φ(x̄) of quantifier rank at most q and with |x̄| ≤ k free variables is equivalent to a σ-formula φ^loc(x̄), computable from φ, that is a Boolean combination of basic 7^q-local sentences and 7^q-local formulas, each of quantifier rank at most p.
This is Gaifman's locality theorem. Gaifman's paper does not state the bound p explicitly. An analysis of its proof shows that p depends only on α, q and k, and not on the signature σ, as the rank-preserving locality theorems of Dreier and Toruńczyk and of van Bergerem, Grohe and Schweikardt make explicit for their variants of local formulas. The dependence of p on α comes from expressing the distance predicates in plain first-order logic.
1 import Lax185574.FirstOrderTypes 2 import Lax185574.LocalFormulas 3 … module docstring, 39 lines 43 44 namespace Lax185574.GaifmanLocality 45 46 open FirstOrder FirstOrder.Language 47 open Lax185574.FirstOrderTypes Lax185574.LocalFormulas 48 49 universe u v w z 50 51 variable {L : Language.{u, v}} 52 53 /-- `IsBooleanCombination P φ`: the formula `φ` is a Boolean combination 54 of formulas satisfying `P`, built by falsum and implication. -/ 55 inductive IsBooleanCombination {α : Type w} (P : L.Formula α → Prop) : 56 L.Formula α → Prop 57 /-- A constituent is a Boolean combination. -/ 58 | atom {φ : L.Formula α} : P φ → IsBooleanCombination P φ 59 /-- Falsum is a Boolean combination. -/ 60 | falsum : IsBooleanCombination P ⊥ 61 /-- Implications of Boolean combinations are Boolean combinations. -/ 62 | imp {φ ψ : L.Formula α} : 63 IsBooleanCombination P φ → IsBooleanCombination P ψ → 64 IsBooleanCombination P (φ.imp ψ) 65 66 /-- The constituents of a Gaifman normal form with radius `h` and rank 67 bound `p`: `h`-local formulas and basic `h`-local sentences, each of 68 quantifier rank at most `p`. -/ 69 def IsLocalConstituent [Finite (Σ l, L.Relations l)] (h p : ℕ) {n : ℕ} 70 (χ : L.Formula (Fin n)) : Prop := 71 (IsLocal h χ ∧ quantifierRank χ ≤ p) ∨ 72 ∃ ψ : L.Sentence, IsBasicLocal h ψ ∧ quantifierRank ψ ≤ p ∧ 73 χ = ψ.relabel Empty.elim 74 75 /-- **Gaifman's locality theorem.** For all `α, q, k` there is a rank 76 bound `p` such that every formula of quantifier rank at most `q` with at 77 most `k` free variables, over a finite relational signature of arity at 78 most `α`, is equivalent to a Boolean combination of `7^q`-local formulas 79 and basic `7^q`-local sentences of quantifier rank at most `p`. -/ 80 axiom exists_local_equivalent (α q k : ℕ) : 81 ∃ p : ℕ, ∀ (L : Language.{u, v}) [L.IsRelational] [Finite (Σ l, L.Relations l)], 82 (∀ l, α < l → IsEmpty (L.Relations l)) → 83 ∀ (n : ℕ), n ≤ k → ∀ φ : L.Formula (Fin n), quantifierRank φ ≤ q → 84 ∃ ψ : L.Formula (Fin n), FinitelyEquivalent.{u, v, z, 0} φ ψ ∧ 85 IsBooleanCombination (IsLocalConstituent (7 ^ q) p) ψ 86 87 end Lax185574.GaifmanLocality 88 -
no assumptions
The formula is translated into the syntax of the normal form of lax-512892, over a vocabulary with one symbol for each relation symbol and a nullary symbol for falsum. Its normal form has radii at most and at most witnesses in each basic local sentence. Every local formula in it has quantifier depth at most , a bound that depends on the arity of the vocabulary but not on its symbols. Back in mathlib's syntax, each ball-restricted quantifier gets a dist-formula guard of quantifier rank at most , which gives the rank bound .
-
Let be given by . A formula of rank at most uses finitely many relation symbols. Over the sublanguage of these symbols it is equivalent, on finite structures, to a Boolean combination of basic -local sentences and -local formulas of rank at most . The sentences have the same truth value for both tuples. A local formula holds of a tuple in the structure if and only if it holds in the induced substructure, by , since the balls of the sublanguage are contained in those of . In the induced substructures, the two tuples satisfy the same formulas of rank at most .
-
Few types far from a parameter set
For every q, k, c ∈ ℕ there are numbers r = r(q) and T = T(q, k, c) with the following property. Let H be a graph expanded by at most c unary predicates and U ⊆ V(H). Consider the set
F ≔ { a ∈ V(H) : dist^H(a, U) > r }
of vertices that are far from U. Then |Types^H_{k,q}(F/U)| ≤ T(q, k, c).
1 import Lax185574.Colorings 2 import Lax185574.FirstOrderTypes 3 import Lax185574.GraphBalls 4 … module docstring, 26 lines 31 32 namespace Lax185574.SeparatingTypes 33 34 open FirstOrder FirstOrder.Language Lax710763.Transductions 35 open Lax185574.FirstOrderTypes Lax185574.GraphBalls Lax185574.Colorings 36 37 universe z 38 39 /-- **Few types far from a parameter set.** In a graph with `c` unary 40 predicates, the `k`-tuples of vertices at distance more than `r(q)` from 41 `U` realize at most `T(q, k, c)` types of quantifier rank `q` over 42 `U`. -/ 43 axiom typeCountOver_far_le (q : ℕ) : 44 ∃ r : ℕ, ∀ k c : ℕ, ∃ T : ℕ, 45 ∀ (V : Type z) [Finite V] (G : SimpleGraph V) (colors : Fin c → Set V) 46 (U : Set V), 47 @typeCountOver (withColors Language.graph c) V (expansion G colors) k q 48 (graphBall G r U)ᶜ U ≤ T 49 50 end Lax185574.SeparatingTypes 51 -
Let and . Expand the colored graph by a relation for every relation symbol with some positions filled by parameters from , and by a unary relation for every . Formulas with parameters become formulas of the expansion without parameters and with the same quantifier rank. For a tuple far from , the ball of radius around it in the expansion avoids and its neighbors, so the new relations are trivial on , and the type of rank of the tuple in the expansion of is determined by its type in the colored graph induced on . By , that type determines the type of rank in the expansion, hence the type over in the colored graph. The types of rank of -tuples in colored graphs are bounded by the number of their finite codes, which depends on , and only.
-
The bound follows from , since for a fixed tuple
ūfrom the type ofā ūover is determined by the type ofāover . A formula aboutā ūbecomes a formula aboutāof the same quantifier rank when the variables forūare replaced by the parametersū. -
no assumptions
The finite form of Matoušek's (p, q)-theorem, through ε-nets and the finite minimax theorem. Its statement has the roles of the sides swapped and needs no exception for the vertices of the sample, so it implies the form used here.
-
Bounded-VC duality
For a graph G and sets S, X ⊆ V(G), the set S dominates X if every vertex of X ∖ S has a neighbor in S, and S antidominates X if every vertex of X ∖ S has a nonneighbor in S.
For every d ∈ ℕ there is some k ∈ ℕ with the following property. Let G be a graph of VC-dimension at most d, and let X, Y ⊆ V(G) be two (possibly overlapping) sets with at least one of X, Y finite. Then there exists a set sample(X, Y) of size at most k such that at least one of the following holds:
- sample(X, Y) is contained in Y and dominates X,
- sample(X, Y) is contained in X and antidominates Y.
This is a corollary of the (p, q)-theorem for bounded VC-dimension.
1 import Lax185574.VCDimension 2 … module docstring, 28 lines 31 32 namespace Lax185574.VCDuality 33 34 open Lax185574.VCDimension 35 36 universe u 37 38 variable {V : Type u} 39 40 /-- `S` dominates `X` in `G`: every vertex of `X ∖ S` has a neighbor in 41 `S`. -/ 42 def Dominates (G : SimpleGraph V) (S X : Set V) : Prop := 43 ∀ x ∈ X \ S, ∃ y ∈ S, G.Adj x y 44 45 /-- `S` antidominates `X` in `G`: every vertex of `X ∖ S` has a 46 nonneighbor in `S`. -/ 47 def Antidominates (G : SimpleGraph V) (S X : Set V) : Prop := 48 ∀ x ∈ X \ S, ∃ y ∈ S, ¬ G.Adj x y 49 50 /-- **Bounded-VC duality.** In a finite graph of VC-dimension at most 51 `d`, for any two vertex sets `X` and `Y`, some set of at most `k(d)` 52 vertices of `Y` dominates `X`, or some set of at most `k(d)` vertices of 53 `X` antidominates `Y`. -/ 54 axiom vc_duality (d : ℕ) : 55 ∃ k : ℕ, ∀ (V : Type u) [Finite V] (G : SimpleGraph V), vcDim G ≤ d → 56 ∀ X Y : Set V, ∃ S : Finset V, S.card ≤ k ∧ 57 (((S : Set V) ⊆ Y ∧ Dominates G S X) ∨ 58 ((S : Set V) ⊆ X ∧ Antidominates G S Y)) 59 60 end Lax185574.VCDuality 61 -
The proof in the paper. Group by neighborhoods in the ball and by neighborhoods in . The parameter set consists of representatives of all groups and of a bounded-VC duality sample for every pair of groups of and for every group of against the inner ball. The -flip toggles exactly the pairs of atomic types joined by an edge of between and . Then and are non-adjacent in the flip, the inner ball is unchanged, and it has no edges to the outside of , so the ball of radius still avoids . The duality is used in a form without exception for the sample, obtained from the concept at the cost of doubling the sample.
-
Atomically matched tuples
For a graph G and tuples ā, b̄ ∈ V(G)^t, the tuples ā = a₁ … a_t and b̄ = b₁ … b_t are atomically matched if there is a relation ∼ ∈ {=, ≠, ≥} such that G ⊨ E(aᵢ, bⱼ) if and only if i ∼ j, for all i, j ∈ [t]. In particular, the bipartite graph semi-induced between the tuples ā and b̄ is a matching, a co-matching, or a half-graph.
1 import Mathlib.Combinatorics.SimpleGraph.Basic 2 import Mathlib.Order.Fin.Basic 3 … module docstring, 19 lines 23 24 namespace Lax185574.AtomicMatching 25 26 universe u 27 28 variable {V : Type u} 29 30 /-- The tuples `a` and `b` are atomically matched in `G`: adjacency of 31 `a i` and `b j` is described by `i = j`, by `i ≠ j`, or by `i ≥ j`. -/ 32 def AtomicallyMatched (G : SimpleGraph V) {t : ℕ} (a b : Fin t → V) : Prop := 33 (∀ i j, G.Adj (a i) (b j) ↔ i = j) ∨ 34 (∀ i j, G.Adj (a i) (b j) ↔ i ≠ j) ∨ 35 (∀ i j, G.Adj (a i) (b j) ↔ j ≤ i) 36 37 end Lax185574.AtomicMatching 38 -
Many atomic types force atomically matched tuples
There exists a computable function Q : ℕ → ℕ such that for every ℓ ∈ ℕ and for every bipartite graph G = (L, R, E) with |ATypes(L/R)| > Q(ℓ), there are two tuples ā ∈ L^ℓ and b̄ ∈ R^ℓ that are atomically matched in G.
This is Corollary 2.4 of Ding, Oporowski, Oxley and Vertigan (1996), see also Theorem 2 of Gravier, Maffray, Renault and Trotignon (2004).
1 import Lax185574.AtomicMatching 2 import Lax185574.AtomicTypes 3 import Lax185574.BipartiteGraphs 4 import Mathlib.Computability.Partrec 5 … module docstring, 24 lines 30 31 namespace Lax185574.MatchedTuples 32 33 open Lax185574.AtomicMatching Lax185574.AtomicTypes Lax185574.BipartiteGraphs 34 35 universe u v 36 37 /-- **Matchings, co-matchings and half-graphs.** A computable `Q` such 38 that a bipartite graph whose left side realizes more than `Q(ℓ)` atomic 39 types over the right side contains atomically matched `ℓ`-tuples, one 40 from each side. -/ 41 axiom exists_atomicallyMatched : 42 ∃ Q : ℕ → ℕ, Computable Q ∧ 43 ∀ (ℓ : ℕ) (L : Type u) (R : Type v) [Finite L] [Finite R] (E : L → R → Prop), 44 Q ℓ < atomicTypeCount (bipartiteGraph E) (Set.range Sum.inl) 45 (Set.range Sum.inr) → 46 ∃ (a : Fin ℓ → L) (b : Fin ℓ → R), 47 AtomicallyMatched (bipartiteGraph E) (Sum.inl ∘ a) (Sum.inr ∘ b) 48 49 end Lax185574.MatchedTuples 50 -
no assumptions
Ding, Oporowski, Oxley and Vertigan, Cor. 2.4, through an explicit Ramsey bound and a staircase argument on homogeneous matrices. The number of atomic types of the left side over the right side is the number of distinct neighborhoods. A half-graph with becomes one with by reversing both tuples.
-
(φ, ψ)-patterns
Fix first-order formulas φ(x̄, z) and ψ(ȳ, z). A (φ, ψ)-pattern of order s × t in a graph G consists of tuples ā₁, …, ā_s ∈ V(G)^{|x̄|}, b̄₁, …, b̄t ∈ V(G)^{|ȳ|}, and vertices (c{i,j} : i ∈ [s], j ∈ [t]) such that the following holds for all i, i' ∈ [s] and j, j' ∈ [t]:
- G ⊨ φ(āᵢ, c_{i,j}), and G ⊭ φ(ā_{i'}, c_{i,j}) if i' > i,
- G ⊨ ψ(b̄ⱼ, c_{i,j}), and G ⊭ ψ(b̄_{j'}, c_{i,j}) if j' > j.
The set { c_{i,j} : i ∈ [s], j ∈ [t] } is the set of grid-points of the pattern, and s is its height.
1 import Mathlib.ModelTheory.Graph 2 import Mathlib.ModelTheory.Semantics 3 … module docstring, 26 lines 30 31 namespace Lax185574.PhiPsiPatterns 32 33 open FirstOrder FirstOrder.Language 34 35 universe u 36 37 variable {V : Type u} 38 39 /-- `G ⊨ φ(ā, c)` for a formula `φ(x̄, z)` of the language of graphs. -/ 40 def Holds (G : SimpleGraph V) {p : ℕ} 41 (φ : Language.graph.Formula (Fin p ⊕ Fin 1)) (a : Fin p → V) (c : V) : 42 Prop := 43 @Formula.Realize Language.graph V G.structure _ φ (Sum.elim a ![c]) 44 45 /-- The tuples `a i`, `b j` and the vertices `c i j` form a 46 `(φ, ψ)`-pattern of order `s × t` in `G`. -/ 47 def IsPattern (G : SimpleGraph V) {p p' : ℕ} 48 (φ : Language.graph.Formula (Fin p ⊕ Fin 1)) 49 (ψ : Language.graph.Formula (Fin p' ⊕ Fin 1)) {s t : ℕ} 50 (a : Fin s → Fin p → V) (b : Fin t → Fin p' → V) (c : Fin s → Fin t → V) : 51 Prop := 52 ∀ i j, 53 (Holds G φ (a i) (c i j) ∧ ∀ i', i < i' → ¬ Holds G φ (a i') (c i j)) ∧ 54 (Holds G ψ (b j) (c i j) ∧ ∀ j', j < j' → ¬ Holds G ψ (b j') (c i j)) 55 56 /-- `G` contains a `(φ, ψ)`-pattern of order `s × t`. -/ 57 def HasPattern (G : SimpleGraph V) {p p' : ℕ} 58 (φ : Language.graph.Formula (Fin p ⊕ Fin 1)) 59 (ψ : Language.graph.Formula (Fin p' ⊕ Fin 1)) (s t : ℕ) : Prop := 60 ∃ (a : Fin s → Fin p → V) (b : Fin t → Fin p' → V) (c : Fin s → Fin t → V), 61 IsPattern G φ ψ a b c 62 63 end Lax185574.PhiPsiPatterns 64 -
Monadically dependent classes exclude large (φ, ψ)-patterns
For every monadically dependent graph class 𝒞 and formulas φ(x̄, z), ψ(ȳ, z), there is some t ∈ ℕ such that no graph G ∈ 𝒞 contains a (φ, ψ)-pattern of order t × t.
This is a corollary of Lemma C.1 of the cited work on ordered twin-width. The paper includes a self-contained proof.
1 import Lax185574.PhiPsiPatterns 2 import Lax185574.MonadicDependence 3 … module docstring, 24 lines 28 29 namespace Lax185574.ForbiddenPhiPsiPatterns 30 31 open FirstOrder FirstOrder.Language 32 open Lax185574.Graphs Lax185574.MonadicDependence Lax185574.PhiPsiPatterns 33 34 /-- **Forbidden `(φ, ψ)`-patterns.** No graph of a monadically 35 dependent class contains a `(φ, ψ)`-pattern of order `t × t`, for some 36 `t` depending on the class, `φ` and `ψ`. -/ 37 axiom forbidden_phiPsi_patterns (C : GraphClass) (hC : MonadicallyDependent C) 38 {p p' : ℕ} (φ : Language.graph.Formula (Fin p ⊕ Fin 1)) 39 (ψ : Language.graph.Formula (Fin p' ⊕ Fin 1)) : 40 ∃ t : ℕ, ∀ G ∈ C, ¬ HasPattern G.toSimpleGraph φ ψ t t 41 42 end Lax185574.ForbiddenPhiPsiPatterns 43 -
φ-patterns
For a first-order formula φ(x̄, z), a φ-pattern is a (φ, ψ)-pattern with ψ(y, z) = E(y, z) or ψ(y, z) = ¬E(y, z). These are called a (φ, E)-pattern and a (φ, ¬E)-pattern, respectively. Such a pattern consists of tuples ā₁, …, ā_s ∈ V(G)^{|x̄|}, vertices b₁, …, b_t ∈ V(G) and (c_{i,j} : i ∈ [s], j ∈ [t]). The tuple b̄ = (b₁, …, b_t) is the base of the pattern.
1 import Lax185574.PhiPsiPatterns 2 … module docstring, 20 lines 23 24 namespace Lax185574.PhiPatterns 25 26 open FirstOrder FirstOrder.Language 27 open Lax185574.PhiPsiPatterns 28 29 universe u 30 31 variable {V : Type u} 32 33 /-- The formula `E(y, z)`. -/ 34 def edgeFormula : Language.graph.Formula (Fin 1 ⊕ Fin 1) := 35 Relations.formula₂ Language.adj (Term.var (Sum.inl 0)) (Term.var (Sum.inr 0)) 36 37 /-- `G` contains a `φ`-pattern of order `s × t`: a `(φ, E)`-pattern or a 38 `(φ, ¬E)`-pattern. -/ 39 def HasPhiPattern (G : SimpleGraph V) {p : ℕ} 40 (φ : Language.graph.Formula (Fin p ⊕ Fin 1)) (s t : ℕ) : Prop := 41 HasPattern G φ edgeFormula s t ∨ HasPattern G φ edgeFormula.not s t 42 43 end Lax185574.PhiPatterns 44 -
Monadically dependent classes exclude large φ-patterns
For every monadically dependent graph class 𝒞 and formula φ(x̄, z), there is some t ∈ ℕ such that no graph G ∈ 𝒞 contains a φ-pattern of order t × t.
1 import Lax185574.PhiPatterns 2 import Lax185574.MonadicDependence 3 … module docstring, 19 lines 23 24 namespace Lax185574.ForbiddenPhiPatterns 25 26 open FirstOrder FirstOrder.Language 27 open Lax185574.Graphs Lax185574.MonadicDependence Lax185574.PhiPatterns 28 29 /-- **Forbidden `φ`-patterns.** No graph of a monadically dependent 30 class contains a `φ`-pattern of order `t × t`, for some `t` depending on 31 the class and `φ`. -/ 32 axiom forbidden_phi_patterns (C : GraphClass) (hC : MonadicallyDependent C) 33 {p : ℕ} (φ : Language.graph.Formula (Fin p ⊕ Fin 1)) : 34 ∃ t : ℕ, ∀ G ∈ C, ¬ HasPhiPattern G.toSimpleGraph φ t t 35 36 end Lax185574.ForbiddenPhiPatterns 37 -
A -pattern is a -pattern or a -pattern. Take the larger of the two bounds of the lemma on -patterns, and use that a pattern contains patterns of all smaller orders.
The argument is carried out for the graph classes of the archive and their monadic dependence, and transferred to the graph classes used here.
-
The proof in the paper. For each symmetric let express distance at most in , using the quantifier-free edge formula of the flip. Let exceed all the bounds on -patterns and put . For every , every and every base fix a -pattern of maximum height (less than ), and let consist of and all their grid points. If a ball in avoids but realizes more than atomic types over , the matching theorem gives atomically matched tuples in and of length . By pigeonhole of the pairs have the same pair of atomic types over , so on them agrees with or with its complement, and this yields such that the tuple from and the tuple
ūfrom satisfy and for . Then andūextend the chosen pattern with base by a row, asūlies in and the old grid points do not, contradicting maximality.The argument is carried out for the graph classes of the archive and their monadic dependence, and transferred to the graph classes used here.
-
Refining a partition increases the flip metric
If 𝒬 refines 𝒫, then every 𝒫-flip is also a 𝒬-flip, and hence
dist_𝒬(u, v) ≥ dist_𝒫(u, v).
1 import Lax185574.Flips 2 … module docstring, 17 lines 20 21 namespace Lax185574.FlipMetricMonotone 22 23 open Lax185574.Flips 24 25 universe u 26 27 /-- If `𝒬` refines `𝒫`, every `𝒫`-flip is a `𝒬`-flip. -/ 28 axiom isFlip_of_le {V : Type u} (G : SimpleGraph V) {P Q : Setoid V} 29 (hQP : Q ≤ P) (H : SimpleGraph V) (hH : IsFlip G P H) : IsFlip G Q H 30 31 /-- If `𝒬` refines `𝒫`, then `dist_𝒬(u, v) ≥ dist_𝒫(u, v)`: every ball 32 of the flip metric of `𝒬` lies in the ball of the same radius of the 33 flip metric of `𝒫`. -/ 34 axiom flipBall_subset_of_le {V : Type u} (G : SimpleGraph V) {P Q : Setoid V} 35 (hQP : Q ≤ P) (r : ℕ) (v : V) : flipBall G Q r v ⊆ flipBall G P r v 36 37 end Lax185574.FlipMetricMonotone 38 -
no assumptions
Each part of lies in a part of , so the choice between agreeing and disagreeing made for a pair of -parts also serves the pair of -parts inside it.
-
no assumptions
Every -flip is a -flip, so a bound on the distance in all -flips is in particular a bound in all -flips.
-
Converting the flip metric of a partition into a single flip
Let G be a graph and let 𝒫 be a partition of V(G). There is a refinement 𝒬 of 𝒫 with |𝒬| ≤ |𝒫| · 2^|𝒫| and a 𝒬-flip H of G such that, for every v ∈ V(G) and r ∈ ℕ,
Ball^H_r(v) ⊆ Ball^𝒫_{6r}(v).
This is Lemma 8 of the cited work on separability properties of monadically dependent graph classes.
1 import Lax185574.Flips 2 import Lax185574.GraphBalls 3 … module docstring, 22 lines 26 27 namespace Lax185574.PartitionMetricConversion 28 29 open Lax185574.Flips Lax185574.GraphBalls 30 31 universe u 32 33 /-- **Partition-metric conversion.** A refinement `𝒬` of `𝒫` with at 34 most `|𝒫| · 2^|𝒫|` parts carries a single flip whose radius-`r` balls lie 35 in the radius-`6r` balls of the flip metric of `𝒫`. -/ 36 axiom exists_refinement_flip {V : Type u} [Finite V] (G : SimpleGraph V) 37 (P : Setoid V) : 38 ∃ Q : Setoid V, Q ≤ P ∧ 39 Nat.card (Quotient Q) ≤ Nat.card (Quotient P) * 2 ^ Nat.card (Quotient P) ∧ 40 ∃ H : SimpleGraph V, IsFlip G Q H ∧ 41 ∀ (v : V) (r : ℕ), graphBall H r {v} ⊆ flipBall G P (6 * r) v 42 43 end Lax185574.PartitionMetricConversion 44 -
no assumptions
Bonnet et al., Lemma 8, for a partition given by a labeling : a refined labeling with at most labels and one toggle on it whose radius- balls lie in the radius- balls of the flip metric. Label the parts of by . The fibers of the refined labeling form the partition , and flips for a labeling with a symmetric toggle are exactly the flips for its fibers.
-
Apply the closure theorem at radius to obtain and the sets . For every of size at most , the partition-metric conversion applied to , which has at most parts, gives one flip whose radius- balls lie in the radius- balls of the flip metric of . For a tuple outside take . As refines , the flip metric of dominates that of , and the latter is at least the distance in the -flip from the closure theorem, which exceeds . So separates from at distance more than . There are at most sets .
The argument is carried out for the graph classes of the archive and their monadic dependence, and transferred to the graph classes used here.
-
Closure theorem
For every monadically dependent graph class 𝒞 and radius r ∈ ℕ there are some c, s ∈ ℕ with the following property.
For every G ∈ 𝒞 and finite set A ⊆ V(G) there is a set A* ⊆ V(G) of size O_{𝒞,r}(|A|^c) such that for every vertex v ∉ A there is a set S(v) ⊆ A* of size at most s and an S(v)-definable flip H with
dist^H(v, A) > r.
1 import Lax185574.Flips 2 import Lax185574.GraphBalls 3 import Lax185574.Partitions 4 import Lax185574.MonadicDependence 5 … module docstring, 30 lines 36 37 namespace Lax185574.ClosureTheorem 38 39 open Lax185574.Graphs Lax185574.MonadicDependence 40 open Lax185574.Flips Lax185574.GraphBalls Lax185574.Partitions 41 42 /-- **Closure theorem.** For a monadically dependent class and a radius 43 `r`, every finite parameter set `A` has a polynomial-size closure `A*` 44 such that each vertex outside `A` is separated from `A` at distance more 45 than `r` by a flip over at most `s` vertices of `A*`. -/ 46 axiom closure_theorem (C : GraphClass) (hC : MonadicallyDependent C) (r : ℕ) : 47 ∃ c s a : ℕ, ∀ G ∈ C, ∀ A : Finset (Fin G.n), ∃ Astar : Finset (Fin G.n), 48 Astar.card ≤ a * (A.card + 1) ^ c ∧ 49 ∀ v ∉ A, ∃ S ⊆ Astar, S.card ≤ s ∧ ∃ H : SimpleGraph (Fin G.n), 50 IsFlip G.toSimpleGraph (atomicTypes G.toSimpleGraph (S : Set (Fin G.n))) H ∧ 51 Disjoint (graphBall H r {v}) (A : Set (Fin G.n)) 52 53 end Lax185574.ClosureTheorem 54 -
Closure theorem for tuples
For every monadically dependent graph class 𝒞, radius r ∈ ℕ, and tuple size k ∈ ℕ, there are some c, s ∈ ℕ with the following property.
For every G ∈ 𝒞 and finite set A ⊆ V(G) there is a set ℋ of O_{𝒞,r,k}(|A|^c) many s-flips of G such that for every tuple v̄ ∈ (V(G) ∖ A)^k there is a flip H ∈ ℋ with
dist^H(v̄, A) > r.
1 import Lax185574.Flips 2 import Lax185574.GraphBalls 3 import Lax185574.MonadicDependence 4 … module docstring, 26 lines 31 32 namespace Lax185574.ClosureTheoremTuples 33 34 open Lax185574.Graphs Lax185574.MonadicDependence 35 open Lax185574.Flips Lax185574.GraphBalls 36 37 /-- **Closure theorem for tuples.** For a monadically dependent class, a 38 radius `r` and a tuple size `k`, every finite parameter set `A` has a 39 polynomial-size family of `s`-flips such that each `k`-tuple outside `A` 40 is at distance more than `r` from `A` in some member. -/ 41 axiom closure_theorem_tuples (C : GraphClass) (hC : MonadicallyDependent C) 42 (r k : ℕ) : 43 ∃ c s a : ℕ, ∀ G ∈ C, ∀ A : Finset (Fin G.n), 44 ∃ family : Finset (SimpleGraph (Fin G.n)), 45 family.card ≤ a * (A.card + 1) ^ c ∧ 46 (∀ H ∈ family, ∃ P : Setoid (Fin G.n), 47 Nat.card (Quotient P) ≤ s ∧ IsFlip G.toSimpleGraph P H) ∧ 48 ∀ v : Fin k → Fin G.n, (∀ i, v i ∉ A) → 49 ∃ H ∈ family, Disjoint (graphBall H r (Set.range v)) (A : Set (Fin G.n)) 50 51 end Lax185574.ClosureTheoremTuples 52 -
Definable flips
For s ∈ ℕ, an s-tuple p̄ = (p₁, …, p_s) of vertices of a graph G and a symmetric relation R ⊆ Π^s × Π^s, the graph G ⊕ (p̄, R) is the {p₁, …, p_s}-flip H of G obtained by partitioning V(G) into atomic types over p̄ and then flipping according to R. More precisely, for uv ∈ (V choose 2),
uv ∈ E(H) △ E(G) ⟺ (atp^G(u/p̄), atp^G(v/p̄)) ∈ R.
Such a flip is called s-definable. Equivalently, an s-definable flip is an S-flip for some S ⊆ V(G) of size at most s. An s-definable flip is also s'-definable for every s' ≥ s.
1 import Lax185574.AtomicTypes 2 import Lax185574.Flips 3 import Lax185574.Partitions 4 … module docstring, 38 lines 43 44 namespace Lax185574.DefinableFlips 45 46 open Lax185574.AtomicTypes Lax185574.Flips Lax185574.Partitions 47 48 universe u 49 50 variable {V : Type u} 51 52 /-- `G ⊕ (p̄, R)`: two distinct vertices are adjacent if and only if 53 their adjacency in `G` differs from membership of the pair of their 54 atomic types over `p̄` in the symmetric relation `R`. -/ 55 noncomputable def flipOver (G : SimpleGraph V) {s : ℕ} (p : Fin s → V) 56 (R : (Fin s → PairType) → (Fin s → PairType) → Prop) : SimpleGraph V := 57 SimpleGraph.fromRel fun u v => 58 Xor (G.Adj u v) (R (atomicTypeOver G p u) (atomicTypeOver G p v)) 59 60 /-- `H` is an `s`-definable flip of `G`: an `S`-flip of `G` for some set 61 `S` of at most `s` vertices. -/ 62 def IsDefinableFlip (G : SimpleGraph V) (s : ℕ) (H : SimpleGraph V) : Prop := 63 ∃ S : Finset V, S.card ≤ s ∧ IsFlip G (atomicTypes G (S : Set V)) H 64 65 end Lax185574.DefinableFlips 66 -
Atomic types of vertices and of pairs
The atomic type of a tuple v̄ over a set Y of elements of a structure A is atp^A(v̄/Y) ≔ tp^A_0(v̄/Y), and ATypes^A(X/Y) ≔ Types^A_{1,0}(X/Y) is the set of atomic types over Y of the elements of X.
For a graph, Π = {(x = y), (x ≠ y) ∧ E(x, y), (x ≠ y) ∧ ¬E(x, y)} is the set of the three possible atomic types of a pair of vertices. For an s-tuple p̄ = (p₁, …, p_s) of vertices and a vertex v, the atomic type atp(v/p̄) is identified with the s-tuple in Π^s whose i-th component is the atomic type of the pair (v, pᵢ).
1 import Lax185574.FirstOrderTypes 2 import Mathlib.ModelTheory.Graph 3 … module docstring, 27 lines 31 32 namespace Lax185574.AtomicTypes 33 34 open FirstOrder FirstOrder.Language 35 open Lax185574.FirstOrderTypes 36 37 universe u 38 39 variable {V : Type u} 40 41 /-- `|ATypes^G(X/Y)|`: the number of atomic types over `Y`, in the graph 42 `G`, of the vertices of `X`. -/ 43 noncomputable def atomicTypeCount (G : SimpleGraph V) (X Y : Set V) : ℕ := 44 @typeCountOver Language.graph V G.structure 1 0 X Y 45 46 /-- The three atomic types of a pair of vertices in a graph, the set Π. -/ 47 inductive PairType 48 /-- The type `x = y`. -/ 49 | eq 50 /-- The type `x ≠ y ∧ E(x, y)`. -/ 51 | adj 52 /-- The type `x ≠ y ∧ ¬E(x, y)`. -/ 53 | nonAdj 54 deriving DecidableEq 55 56 /-- There are three atomic types of pairs. -/ 57 instance : Fintype PairType := 58 ⟨{.eq, .adj, .nonAdj}, fun x => by cases x <;> decide⟩ 59 60 open Classical in 61 /-- The atomic type of the pair `(u, v)` in the graph `G`. -/ 62 noncomputable def pairType (G : SimpleGraph V) (u v : V) : PairType := 63 if u = v then .eq else if G.Adj u v then .adj else .nonAdj 64 65 /-- `atp(v/p̄)`, as an element of `Π^s`: its `i`-th component is the 66 atomic type of the pair `(v, pᵢ)`. -/ 67 noncomputable def atomicTypeOver (G : SimpleGraph V) {s : ℕ} (p : Fin s → V) 68 (v : V) : Fin s → PairType := 69 fun i => pairType G v (p i) 70 71 end Lax185574.AtomicTypes 72 -
The edges of a definable flip are quantifier-free definable
The edges of a definable flip can be defined in the original graph. More precisely, for every s ∈ ℕ and symmetric relation R ⊆ Π^s × Π^s there exists a quantifier-free formula E_{⊕R}(x, y, z̄) such that for every graph G, tuple p̄ ∈ V(G)^s, and vertices u, v ∈ V(G),
G ⊕ (p̄, R) ⊨ E(u, v) ⟺ G ⊨ E_{⊕R}(u, v, p̄).
1 import Lax185574.DefinableFlips 2 import Mathlib.ModelTheory.Complexity 3 … module docstring, 21 lines 25 26 namespace Lax185574.DefinableFlipFormula 27 28 open FirstOrder FirstOrder.Language 29 open Lax185574.AtomicTypes Lax185574.DefinableFlips 30 31 universe u 32 33 /-- **Definable flips are quantifier-free definable.** For a symmetric 34 relation `R` on atomic types over `s`-tuples, one quantifier-free 35 formula `E_{⊕R}(x, y, z̄)` defines the edges of `G ⊕ (p̄, R)` in `G`, for 36 every graph `G` and tuple `p̄`. -/ 37 axiom exists_isQF_flipOver_formula (s : ℕ) 38 (R : (Fin s → PairType) → (Fin s → PairType) → Prop) 39 (hR : ∀ P Q, R P Q → R Q P) : 40 ∃ φ : Language.graph.Formula (Fin 2 ⊕ Fin s), φ.IsQF ∧ 41 ∀ (V : Type u) (G : SimpleGraph V) (p : Fin s → V) (x y : V), 42 (flipOver G p R).Adj x y ↔ 43 @Formula.Realize Language.graph V G.structure _ φ (Sum.elim ![x, y] p) 44 45 end Lax185574.DefinableFlipFormula 46 -
no assumptions
Two distinct vertices are adjacent in exactly when either they are adjacent and the pair of their atomic types over is not in , or they are non-adjacent and the pair is in . Membership of the pair of atomic types in is a finite disjunction, over the pairs in , of conjunctions of the atomic formulas , and .
-
Definable flips preserve monadic dependence
Let 𝒞 be a monadically dependent graph class and s ∈ ℕ. The class consisting of all s-definable flips of graphs from 𝒞 is monadically dependent.
1 import Lax185574.DefinableFlips 2 import Lax185574.MonadicDependence 3 … module docstring, 20 lines 24 25 namespace Lax185574.FlipsMonadicallyDependent 26 27 open Lax185574.Graphs Lax185574.MonadicDependence Lax185574.DefinableFlips 28 29 /-- The class of all `s`-definable flips of graphs from `C`. -/ 30 def definableFlipClass (C : GraphClass) (s : ℕ) : GraphClass := 31 {H | ∃ G ∈ C, ∃ F : SimpleGraph (Fin G.n), 32 IsDefinableFlip G.toSimpleGraph s F ∧ H = Graph.ofSimpleGraph F} 33 34 /-- **Definable flips preserve monadic dependence.** The `s`-definable 35 flips of the graphs of a monadically dependent class form a monadically 36 dependent class. -/ 37 axiom monadicallyDependent_definableFlipClass (C : GraphClass) 38 (hC : MonadicallyDependent C) (s : ℕ) : 39 MonadicallyDependent (definableFlipClass C s) 40 41 end Lax185574.FlipsMonadicallyDependent 42 -
no assumptions
A flip for a partition into at most parts is obtained from the original graph by a fixed transduction: color the parts with unary predicates and flip the adjacency between the chosen pairs of colors. This bounded-flip image of a class is transduced by it, and monadic dependence is preserved under transductions. Every -definable flip is a flip for the partition into atomic types over at most vertices, which has at most parts.
The argument is carried out for the graph classes of the archive and their monadic dependence, and transferred to the graph classes used here.
-
no assumptions
Let and witness the two flips and put . The partition into atomic types over in refines the one over in , and also the one over in : two vertices outside with the same neighbors in lie in the same part over , so their adjacency to a vertex of is preserved or complemented alike when passing to . A flip of a flip is a flip for a common refinement.
-
Transitivity of definable flips
Let G₁ be an s₁-definable flip of G₀ and G₂ be an s₂-definable flip of G₁. Then G₂ is an (s₁ + s₂)-definable flip of G₀.
1 import Lax185574.DefinableFlips 2 … module docstring, 16 lines 19 20 namespace Lax185574.DefinableFlipTransitivity 21 22 open Lax185574.DefinableFlips 23 24 universe u 25 26 /-- **Transitivity of definable flips.** An `s₂`-definable flip of an 27 `s₁`-definable flip of `G₀` is an `(s₁ + s₂)`-definable flip of `G₀`. -/ 28 axiom isDefinableFlip_trans {V : Type u} {G₀ G₁ G₂ : SimpleGraph V} 29 {s₁ s₂ : ℕ} (h₁ : IsDefinableFlip G₀ s₁ G₁) (h₂ : IsDefinableFlip G₁ s₂ G₂) : 30 IsDefinableFlip G₀ (s₁ + s₂) G₂ 31 32 end Lax185574.DefinableFlipTransitivity 33 -
Few atomic types in balls avoiding a closure
For every monadically dependent graph class 𝒞 and r, s ∈ ℕ, there are some k, t ∈ ℕ with the following property. For every G ∈ 𝒞 and finite set A ⊆ V(G), there is A* ⊇ A of size O_{𝒞,r,s}(|A|^k) such that, for every s-definable flip H of G and every vertex v,
Ball^H_r[v] ∩ A* = ∅ ⟹ |ATypes^H(Ball^H_r[v]/A)| ≤ t.
Equivalently, Ball^H_r[v] intersects at most t parts of the partition of V(H) into atomic types over A in H.
1 import Lax185574.AtomicTypes 2 import Lax185574.DefinableFlips 3 import Lax185574.GraphBalls 4 import Lax185574.MonadicDependence 5 … module docstring, 23 lines 29 30 namespace Lax185574.BallTypes 31 32 open Lax185574.Graphs Lax185574.MonadicDependence 33 open Lax185574.AtomicTypes Lax185574.DefinableFlips Lax185574.GraphBalls 34 35 /-- **Few types in balls.** Every finite set `A` has a polynomial-size 36 superset `A*` such that, in every `s`-definable flip `H`, each ball of 37 radius `r` that avoids `A*` realizes at most `t` atomic types over `A` 38 in `H`. -/ 39 axiom ball_types (C : GraphClass) (hC : MonadicallyDependent C) (r s : ℕ) : 40 ∃ k t a : ℕ, ∀ G ∈ C, ∀ A : Finset (Fin G.n), ∃ Astar ⊇ A, 41 Astar.card ≤ a * (A.card + 1) ^ k ∧ 42 ∀ H : SimpleGraph (Fin G.n), IsDefinableFlip G.toSimpleGraph s H → ∀ v : Fin G.n, 43 Disjoint (graphBall H r {v}) (Astar : Set (Fin G.n)) → 44 atomicTypeCount H (graphBall H r {v}) (A : Set (Fin G.n)) ≤ t 45 46 end Lax185574.BallTypes 47 -
A definable flip separating a ball one step further
For all d, t ∈ ℕ, there is some z ∈ ℕ with the following property.
For every graph G of VC-dimension at most d, radius r ∈ ℕ, finite set A ⊆ V(G), and arbitrary set C ⊆ V(G) satisfying
Ball^G_r[C] ∩ A = ∅ and |ATypes^G(Ball^G_r[C]/A)| ≤ t,
there exists a z-definable flip H of G in which Ball^H_{r+1}[C] ∩ A = ∅.
1 import Lax185574.AtomicTypes 2 import Lax185574.DefinableFlips 3 import Lax185574.GraphBalls 4 import Lax185574.VCDimension 5 … module docstring, 22 lines 28 29 namespace Lax185574.BallFlip 30 31 open Lax185574.AtomicTypes Lax185574.DefinableFlips Lax185574.GraphBalls 32 open Lax185574.VCDimension 33 34 universe u 35 36 /-- **Ball flip.** If a ball of radius `r` around `C` avoids `A` and 37 realizes at most `t` atomic types over `A`, then a `z(d, t)`-definable 38 flip moves `A` out of the ball of radius `r + 1` around `C`. -/ 39 axiom exists_ball_flip (d t : ℕ) : 40 ∃ z : ℕ, ∀ (V : Type u) [Finite V] (G : SimpleGraph V), vcDim G ≤ d → 41 ∀ (r : ℕ) (A C : Set V), Disjoint (graphBall G r C) A → 42 atomicTypeCount G (graphBall G r C) A ≤ t → 43 ∃ H : SimpleGraph V, IsDefinableFlip G z H ∧ 44 Disjoint (graphBall H (r + 1) C) A 45 46 end Lax185574.BallFlip 47 -
Induction on , as in the paper. At radius 0 take and no flip. For the step, enlarge to by the ball-types lemma for the current parameter bound , and apply the induction hypothesis to , giving . The -definable flips of graphs of the class form a monadically dependent class, so they have VC-dimension at most some . For every set of at most vertices and every -flip (at most of them), group the vertices whose radius- ball in avoids by the set of atomic types over that the ball meets. By the ball-types lemma these profiles have at most members, and by the Sauer–Shelah lemma there are at most atomic types over , so there are polynomially many groups. The ball flip lemma gives a -definable flip of that -separates each group from , which is an -definable flip of by transitivity. The new closure is together with the parameters of all these flips. Vertices of are isolated by the flip over themselves.
The argument is carried out for the graph classes of the archive and their monadic dependence, and transferred to the graph classes used here.
-
Chains and their radius-r width
A chain in a graph G is a decreasing sequence V(G) = S₁ ⊇ ⋯ ⊇ S_ℓ = ∅ of vertex sets. Its radius-r width, for r ∈ ℕ, is
max_{2 ≤ i ≤ ℓ} max_{v ∈ V(G)} |ATypes^G(Ball_r^{S_i}(v)/S_{i−1})| = max_{2 ≤ i ≤ ℓ} max_{v ∈ V(G)} |Ball_r^{S_i}(v)/𝒫_{S_{i−1}}|,
where Ball_r^S(v) is the ball in the metric of S-flips and 𝒫_S is the partition into atomic types over S.
1 import Lax185574.Flips 2 import Mathlib.Order.Lattice.Nat 3 … module docstring, 39 lines 43 44 namespace Lax185574.Chains 45 46 open Lax185574.Partitions Lax185574.Flips 47 48 universe z 49 50 variable {V : Type z} 51 52 /-- `S` is a chain: `∅ = S₁ ⊆ ⋯ ⊆ S_m = V`. -/ 53 def IsChain [Fintype V] (S : List (Finset V)) : Prop := 54 ∃ h : S ≠ [], S.head h = ∅ ∧ S.getLast h = Finset.univ ∧ 55 ∀ (t : ℕ) (ht : t + 1 < S.length), S[t] ⊆ S[t + 1] 56 57 /-- The radius-`r` width of the chain `S` in `G`: the largest number of 58 parts of `𝒫_{S_{t+1}}` that meet a radius-`r` ball in the metric of 59 `S_t`-flips. -/ 60 noncomputable def chainWidth (G : SimpleGraph V) (r : ℕ) (S : List (Finset V)) : ℕ := 61 sSup {K | ∃ (t : ℕ) (ht : t + 1 < S.length) (v : V), 62 K = partCount (atomicTypes G (S[t + 1] : Set V)) 63 (flipBall G (atomicTypes G (S[t] : Set V)) r v)} 64 65 end Lax185574.Chains 66 -
The statement for graphs, graph classes and , from the version for simple graphs applied to the class of the simple graphs of the members. The algorithm is the program with its exponent, the chain of a graph is that of its simple graph, and the constant becomes , so that bounds the time .
-
Computing chains of small width
There is an algorithm which, given an n-vertex graph G, a radius r ∈ ℕ and a rational ε > 0, computes a chain of G of length O(r/ε) and radius-r width O_{𝒞,r,ε}(n^ε), and runs in time Ô_{𝒞,r}(n³), where 𝒞 is any monadically dependent graph class containing G. Here Ô_k(n^c) stands for a bound O_{k,δ}(n^{c+δ}) for every δ > 0.
The paper cites this as Theorem 4.4 of the companion paper Monadically dependent graph classes have almost bounded merge-width (see ).
1 import Lax185574.Chains 2 import Lax185574.Algorithms 3 import Lax185574.MonadicDependence 4 import Mathlib.Analysis.SpecialFunctions.Pow.Real 5 … module docstring, 40 lines 46 47 namespace Lax185574.ComputingChains 48 49 open Lax185574.Graphs Lax185574.MonadicDependence Lax185574.Algorithms Lax185574.Chains 50 51 /-- **Computing chains.** One algorithm computes, from `r ≥ 1`, a 52 rational `ε > 0` and a graph, a chain of length at most `K · r/ε + K`. On 53 members of a monadically dependent class, the chain has radius-`r` width 54 at most `c · (n+1)^ε`, and for every `δ > 0` the algorithm takes time 55 `O(n^(3+δ))`, with `c` depending also on `δ`. -/ 56 axiom exists_program_chain : 57 ∃ (A : Algorithm) (K : ℕ) (chain : ℕ → ℚ → (G : Graph) → List (Finset (Fin G.n))), 58 (∀ (r : ℕ) (ε : ℚ) (G : Graph), 1 ≤ r → 0 < ε → 59 IsChain (chain r ε G) ∧ ((chain r ε G).length : ℚ) ≤ K * r / ε + K) ∧ 60 ∀ C : GraphClass, MonadicallyDependent C → ∀ (r : ℕ) (ε : ℚ), 1 ≤ r → 0 < ε → 61 ∀ δ : ℝ, 0 < δ → ∃ c : ℕ, ∀ G ∈ C, 62 (chainWidth G.toSimpleGraph r (chain r ε G) : ℝ) ≤ c * ((G.n : ℝ) + 1) ^ (ε : ℝ) ∧ 63 A.Computes c (r, ε, G) (chain r ε G) ((G.n : ℝ) ^ (3 + δ)) 64 65 end Lax185574.ComputingChains 66 -
Locally definable construction sequences from chains
For every n-vertex graph G and its chain of length ℓ there is a construction sequence G₁, …, G_λ of G such that the following properties hold for all r ≥ 1. Let k_r denote the radius-(5r+1) width of the chain and w_r ≔ k_r · π_G(k_r).
- The resulting construction sequence has radius-r width at most w_r and length λ ≤ O(n w₁).
- For every t ∈ [λ−1] and v ∈ V(G), the induced partial graph G_t[Ball^{G_{t+1}}_r(v)] is definable in some expansion of G with 2ℓ+1 unary predicates, using formulas of quantifier rank 7 with w_r parameters.
- The construction sequence can be computed in time O(ℓ n³), given G and its chain.
1 import Lax185574.Chains 2 import Lax185574.VCDimension 3 import Lax185574.ConstructionWidth 4 import Lax185574.LocalDefinability 5 import Lax185574.ConstructionSequences 6 import Lax185574.Algorithms 7 … module docstring, 45 lines 53 54 namespace Lax185574.ChainConstructionSequences 55 56 open Lax185574.Graphs Lax185574.Algorithms 57 open Lax185574.Chains Lax185574.VCDimension 58 open Lax185574.ConstructionSequences Lax185574.ConstructionWidth 59 open Lax185574.LocalDefinability 60 61 universe z 62 63 /-- The number `w_r = k_r · π_G(k_r)`, where `k_r` is the 64 radius-`(5r+1)` width of the chain `S`. -/ 65 noncomputable def chainBound {V : Type z} (G : SimpleGraph V) (S : List (Finset V)) (r : ℕ) : ℕ := 66 chainWidth G (5 * r + 1) S * neighborhoodComplexity G (chainWidth G (5 * r + 1) S) 67 68 /-- **Construction sequences from chains.** One algorithm computes, from 69 a graph and a chain of length `ℓ`, a construction sequence of the graph, 70 given by its script, in time `O((ℓ+1) · (n+1)³)`. For every `r ≥ 1`, it 71 has radius-`r` width at most `w_r` and length at most 72 `K · (n+1) · (w₁+1)`, and it is radius-`r` definable with `2ℓ+1` 73 predicates, `w_r` parameters and rank `7`. -/ 74 axiom exists_constructionSequence_of_chain : 75 ∃ (A : Algorithm) (c K : ℕ) (script : (G : Graph) → List (Finset (Fin G.n)) → Script G.n), 76 ∀ (G : Graph) (S : List (Finset (Fin G.n))), IsChain S → 77 let σ := script G S 78 IsConstructionSequence G.toSimpleGraph σ.run ∧ σ.HasSmallNumbers ∧ 79 σ.run.length ≤ K * (G.n + 1) * (chainBound G.toSimpleGraph S 1 + 1) ∧ 80 (∀ r : ℕ, 1 ≤ r → 81 constructionWidth r σ.run ≤ chainBound G.toSimpleGraph S r ∧ 82 IsRadiusDefinable G.toSimpleGraph σ.run r (2 * S.length + 1) 83 (chainBound G.toSimpleGraph S r) 7) ∧ 84 A.Computes c (G, S) σ ((S.length + 1) * (G.n + 1) ^ 3) 85 86 end Lax185574.ChainConstructionSequences 87 -
The proof of the theorem on definable construction sequences. Compute a chain at radius and accuracy (the chain theorem), of length , and turn it into a construction sequence (the lemma turning chains into construction sequences). With the radius- width of the chain, a bound on the VC-dimension of the graphs of the class (the observation on bounded VC-dimension) and (the Sauer–Shelah lemma), , so . The length is , as the width of a chain grows with the radius. The number of predicates is . On the word RAM, a first phase converts the compressed sparse row form of the graph into the word of the graph that the two cited programs read.
The proof is carried out for the input format with the graph in compressed sparse row form and the notion . The algorithm converts the word of the graph into compressed sparse rows () and runs that program. The script of a graph is the one whose encoding the program outputs on the converted input.
-
Merge sequences and their radius-r width
A merge sequence of a graph G is a sequence (𝒫₁, R₁), …, (𝒫_m, R_m) such that:
- 𝒫₁ is the partition into singletons and 𝒫_m = {V(G)},
- 𝒫₁ ≼ ⋯ ≼ 𝒫_m,
- R₁ ⊆ ⋯ ⊆ R_m ⊆ (V(G) choose 2), and
- for every i ∈ [m] and X, Y ∈ 𝒫_i, the set XY ∖ R_i is contained either in E(G) or in E(Ḡ), that is, the pair X, Y is homogeneous once pairs in R_i are ignored.
Here XY is the set of pairs xy with x ∈ X, y ∈ Y and x ≠ y. Condition 4 says that 𝒫_i is homogeneous modulo R_i. The radius-r width of the merge sequence is
max_{2 ≤ i ≤ m} max_{v ∈ V(G)} |Ball^{R_i}r(v)/𝒫{i−1}|.
The offset in the indices of R_i and 𝒫_{i−1} is intentional.
1 import Lax185574.Partitions 2 import Lax185574.GraphBalls 3 import Mathlib.Order.Lattice.Nat 4 … module docstring, 40 lines 45 46 namespace Lax185574.MergeSequences 47 48 open Lax185574.Partitions Lax185574.GraphBalls 49 50 universe z 51 52 variable {V : Type z} 53 54 /-- `P` is homogeneous modulo `R`: for every pair of parts `𝒫(a)`, 55 `𝒫(b)`, the pairs of distinct vertices between them that are not in 56 `R` are all edges of `G`, or all non-edges of `G`. -/ 57 def HomogeneousModulo (G : SimpleGraph V) (P : Setoid V) (R : SimpleGraph V) : Prop := 58 ∀ a b : V, 59 (∀ x y : V, P x a → P y b → x ≠ y → ¬ R.Adj x y → G.Adj x y) ∨ 60 (∀ x y : V, P x a → P y b → x ≠ y → ¬ R.Adj x y → ¬ G.Adj x y) 61 62 /-- `ms` is a merge sequence of `G`: it starts with the partition into 63 singletons and ends with the partition with one part, the partitions 64 get coarser and the relations grow, and every partition is homogeneous 65 modulo its relation. -/ 66 def IsMergeSequence (G : SimpleGraph V) (ms : List (Setoid V × SimpleGraph V)) : Prop := 67 ∃ h : ms ≠ [], 68 (ms.head h).1 = ⊥ ∧ (ms.getLast h).1 = ⊤ ∧ 69 (∀ (t : ℕ) (ht : t + 1 < ms.length), ms[t].1 ≤ ms[t + 1].1 ∧ ms[t].2 ≤ ms[t + 1].2) ∧ 70 ∀ (t : ℕ) (ht : t < ms.length), HomogeneousModulo G ms[t].1 ms[t].2 71 72 /-- The radius-`r` width of the merge sequence `ms`: the largest number 73 of parts of `𝒫_t` that meet a ball of radius `r` in `R_{t+1}`. -/ 74 noncomputable def mergeWidth (r : ℕ) (ms : List (Setoid V × SimpleGraph V)) : ℕ := 75 sSup {K | ∃ (t : ℕ) (ht : t + 1 < ms.length) (v : V), 76 K = partCount ms[t].1 (graphBall ms[t + 1].2 r {v})} 77 78 end Lax185574.MergeSequences 79 -
Merge sequences with definable stages from chains
For every graph G and chain of length ℓ there is a merge sequence (𝒬₁, R₁), …, (𝒬_ℓ, R_ℓ) with the following properties.
- For all r ≥ 1, the radius-r width of the merge sequence is bounded by k · π_G(k), where k is the radius-(5r+1) width of the given chain.
- For each i ∈ [ℓ], the relations ≡{𝒬_i} and R_i are definable in some expansion G^i of G with two unary predicates, using two fixed first-order formulas φ≡(x, y) and φ_R(x, y) of quantifier rank at most 5.
- The merge sequence can be computed in time O(ℓ n³), given G and its chain.
Here ≡_𝒬 is the equivalence relation on V(G) whose classes are the parts of the partition 𝒬.
1 import Lax185574.MergeSequences 2 import Lax185574.Chains 3 import Lax185574.VCDimension 4 import Lax185574.Colorings 5 import Lax185574.FirstOrderTypes 6 import Lax185574.Algorithms 7 … module docstring, 40 lines 48 49 namespace Lax185574.BetterMergeSequences 50 51 open FirstOrder FirstOrder.Language Lax710763.Transductions 52 open Lax185574.Graphs Lax185574.Algorithms 53 open Lax185574.Partitions Lax185574.MergeSequences Lax185574.Chains 54 open Lax185574.VCDimension Lax185574.Colorings Lax185574.FirstOrderTypes 55 56 universe z 57 58 variable {V : Type z} 59 60 /-- The stages of the merge sequence `ms` are definable by the formulas 61 `φeq` and `φR`: for every stage there are two color sets such that, in 62 the expansion of `G` by them, `φeq` defines the equivalence relation of 63 the partition and `φR` defines the relation of the stage. -/ 64 def StagesDefinable (G : SimpleGraph V) (ms : List (Setoid V × SimpleGraph V)) 65 (φeq φR : (withColors Language.graph 2).Formula (Fin 2)) : Prop := 66 ∀ (t : ℕ) (ht : t < ms.length), ∃ colors : Fin 2 → Set V, ∀ x : Fin 2 → V, 67 (@Formula.Realize _ V (expansion G colors) _ φeq x ↔ ms[t].1 (x 0) (x 1)) ∧ 68 (@Formula.Realize _ V (expansion G colors) _ φR x ↔ ms[t].2.Adj (x 0) (x 1)) 69 70 /-- **Merge sequences from chains.** Two fixed formulas of quantifier 71 rank at most `5` and one algorithm that computes, from a graph and a 72 chain of length `ℓ`, a merge sequence of length `ℓ` with the following 73 properties. (1) For every `r ≥ 1`, its radius-`r` width is at most 74 `k · π_G(k)` for the radius-`(5r+1)` width `k` of the chain. (2) The two 75 formulas define its stages. (3) The algorithm takes time 76 `O((ℓ+1) · (n+1)³)`. -/ 77 axiom exists_mergeSequence_of_chain : 78 ∃ (φeq φR : (withColors Language.graph 2).Formula (Fin 2)), 79 quantifierRank φeq ≤ 5 ∧ quantifierRank φR ≤ 5 ∧ 80 ∃ (A : Algorithm) (c : ℕ) (M : (G : Graph) → List (Finset (Fin G.n)) → 81 List (Setoid (Fin G.n) × SimpleGraph (Fin G.n))), 82 ∀ (G : Graph) (S : List (Finset (Fin G.n))), IsChain S → 83 IsMergeSequence G.toSimpleGraph (M G S) ∧ (M G S).length = S.length ∧ 84 (∀ r : ℕ, 1 ≤ r → 85 mergeWidth r (M G S) ≤ chainWidth G.toSimpleGraph (5 * r + 1) S * 86 neighborhoodComplexity G.toSimpleGraph (chainWidth G.toSimpleGraph (5 * r + 1) S)) ∧ 87 StagesDefinable G.toSimpleGraph (M G S) φeq φR ∧ 88 A.Computes c (G, S) (M G S) ((S.length + 1) * (G.n + 1) ^ 3) 89 90 end Lax185574.BetterMergeSequences 91 -
A graph or its complement has diameter at most 3
For every graph G, at least one of G and Ḡ has diameter at most 3.
This is folklore.
1 import Lax185574.GaifmanGraph 2 … module docstring, 16 lines 19 20 namespace Lax185574.ComplementDiameter 21 22 open Lax185574.GaifmanGraph 23 24 universe z 25 26 /-- **A graph or its complement has diameter at most 3.** -/ 27 axiom diameter_le_three_or_compl {V : Type z} (G : SimpleGraph V) : 28 (∀ u v : V, WithinDist G 3 u v) ∨ (∀ u v : V, WithinDist Gᶜ 3 u v) 29 30 end Lax185574.ComplementDiameter 31 -
no assumptions
If some two vertices , are not joined by a walk of length at most in , then they are distinct, non-adjacent and have no common neighbor. In
Ḡthey are adjacent, and every other vertex is adjacent to or to . So any two vertices are joined inḠby a walk that goes to or , possibly crosses the edge , and leaves again, of length at most . -
Bipartite graphs and bipartite complements
A bipartite graph B = (X, Y, E) has parts X and Y and an edge set E of pairs xy with x ∈ X and y ∈ Y. Its bipartite complement, denoted B̄, is the bipartite graph with parts X, Y and edge set XY ∖ E.
For a graph G and disjoint vertex sets X, Y ⊆ V(G), G[X, Y] is the bipartite graph with parts X and Y whose edges connect pairs of vertices that are adjacent in G. Furthermore, G[X, X] denotes the bipartite graph whose parts are two copies of X, and whose edges connect two vertices in opposite parts if the corresponding vertices of G are either adjacent or equal. The edges of G[X, X] connecting the two copies of a vertex are its diagonal edges. Finally, Ḡ[X, X] is the bipartite complement of G[X, X], extended with the diagonal edges.
1 import Mathlib.Combinatorics.SimpleGraph.Basic 2 … module docstring, 37 lines 40 41 namespace Lax185574.BipartiteGraphs 42 43 universe u w z 44 45 /-- The bipartite graph on `α ⊕ β` with an edge between `inl a` and 46 `inr b` exactly when `E a b`. -/ 47 def bipartiteGraph {α : Type u} {β : Type w} (E : α → β → Prop) : SimpleGraph (α ⊕ β) := 48 SimpleGraph.fromRel fun s t => ∃ a b, s = .inl a ∧ t = .inr b ∧ E a b 49 50 variable {V : Type z} 51 52 /-- `G[X, Y]`, on two copies of `V`: the left copy of `u ∈ X` and the 53 right copy of `v ∈ Y` are adjacent if `u = v` or `u` and `v` are 54 adjacent in `G`. -/ 55 def pairGraph (G : SimpleGraph V) (X Y : Set V) : SimpleGraph (V ⊕ V) := 56 bipartiteGraph fun u v => u ∈ X ∧ v ∈ Y ∧ (u = v ∨ G.Adj u v) 57 58 /-- `Ḡ[X, Y]`, on two copies of `V`: the left copy of `u ∈ X` and the 59 right copy of `v ∈ Y` are adjacent if `u = v` or `u` and `v` are 60 non-adjacent in `G`. -/ 61 def coPairGraph (G : SimpleGraph V) (X Y : Set V) : SimpleGraph (V ⊕ V) := 62 bipartiteGraph fun u v => u ∈ X ∧ v ∈ Y ∧ (u = v ∨ ¬ G.Adj u v) 63 64 end Lax185574.BipartiteGraphs 65 -
A four-part flip of a bipartite graph with short edges in both polarities
Let B = (X, Y, E) be a bipartite graph with bipartite complement B̄, and pick arbitrary vertices x ∈ X and y ∈ Y. Partition X according to adjacency to y, that is, X = X₊ ⊎ X₋ with X₊ = N(y) and X₋ = X ∖ N(y), and similarly Y = Y₊ ⊎ Y₋ according to x. Then there is a bipartite graph B′ = (X, Y, E′), obtained from B by some {X₊, X₋, Y₊, Y₋}-flip, satisfying
for all uv ∈ E′, dist^B(u, v) ≤ 5 and dist^{B̄}(u, v) ≤ 5.
This is Lemma A.3 of Drabik, Dumas, Geniet, Nowakowski, Pilipczuk and Toruńczyk, Variants of merge-width and applications (2026).
1 import Lax185574.BipartiteGraphs 2 import Lax185574.GaifmanGraph 3 … module docstring, 38 lines 42 43 namespace Lax185574.BipartiteFlip 44 45 open Lax185574.BipartiteGraphs Lax185574.GaifmanGraph 46 47 universe u w 48 49 /-- **Four-part flip of a bipartite graph.** For representatives `x` 50 and `y`, some flip of `E` on the four parts given by adjacency to `y` 51 and to `x` keeps only edges `uv` with `dist^B(u, v) ≤ 5` and 52 `dist^{B̄}(u, v) ≤ 5`. -/ 53 axiom exists_flip_close {X : Type u} {Y : Type w} (E : X → Y → Prop) (x : X) (y : Y) : 54 ∃ E' : X → Y → Prop, 55 (∀ (u u' : X) (v v' : Y), (E u y ↔ E u' y) → (E x v ↔ E x v') → 56 ((E' u v ↔ E u v) ↔ (E' u' v' ↔ E u' v'))) ∧ 57 ∀ (u : X) (v : Y), E' u v → 58 WithinDist (bipartiteGraph E) 5 (.inl u) (.inr v) ∧ 59 WithinDist (bipartiteGraph fun a b => ¬ E a b) 5 (.inl u) (.inr v) 60 61 end Lax185574.BipartiteFlip 62 -
no assumptions
Flip a cell of the four-part partition exactly when it contains an edge of with no walk of length at most in . Then every edge of that is an edge of has a short walk in , by the choice of the flipped cells. Every edge of that is a non-edge of lies in a flipped cell, and comparing it with the edge that caused the flip gives a walk of length at most in between its ends, by a case analysis over the adjacencies to the representatives. Walks between the two sides of a bipartite graph have odd length, so the bound improves to .
The construction is adapted from an earlier formalization that proves the statement with bound for flips given by Boolean toggles, see PROVENANCE.md.
-
Splitting the parts of a partition by atomic types over a set
Fix a graph G and a partition 𝒫 of V(G). For a set T ⊆ V(G), 𝒫 ∧ T is the refinement of 𝒫 where each part P ∈ 𝒫 is split into atomic types over T ∖ P, that is, into sets of the form P ∩ Q, where Q is the set of all vertices of G with a given neighborhood in T ∖ P.
1 import Lax185574.Partitions 2 … module docstring, 20 lines 23 24 namespace Lax185574.TypeSplitting 25 26 universe z 27 28 variable {V : Type z} 29 30 /-- `𝒫 ∧ T`: each part `P` of `P` is split according to the 31 neighborhoods of its vertices in `T ∖ P`. -/ 32 def split (G : SimpleGraph V) (P : Setoid V) (T : Set V) : Setoid V := 33 Setoid.ker fun v => (Quotient.mk P v, {t | t ∈ T ∧ ¬ P t v} ∩ G.neighborSet v) 34 35 end Lax185574.TypeSplitting 36 -
Splitting by a transversal keeps few parts in flip-metric balls
Let G be a graph, 𝒫 ≼ 𝒬 partitions of V(G), and T a transversal of 𝒫. Suppose |Ball^𝒬_{r+1}(v)/𝒫| ≤ k for every v ∈ V(G). Then for every v ∈ V(G),
|Ball^𝒬_r(v)/(𝒫 ∧ T)| ≤ k · π_G(k).
This is Corollary 5.4 of Drabik, Dumas, Geniet, Nowakowski, Pilipczuk and Toruńczyk, Variants of merge-width and applications (2026).
1 import Lax185574.TypeSplitting 2 import Lax185574.Flips 3 import Lax185574.VCDimension 4 … module docstring, 22 lines 27 28 namespace Lax185574.SplitBalls 29 30 open Lax185574.Partitions Lax185574.Flips Lax185574.TypeSplitting Lax185574.VCDimension 31 32 universe z 33 34 /-- **Splitting along a transversal.** If every radius-`(r+1)` ball of 35 the `𝒬`-flip metric meets at most `k` parts of `𝒫 ≼ 𝒬`, then every 36 radius-`r` ball meets at most `k · π_G(k)` parts of `𝒫 ∧ T`. -/ 37 axiom partCount_split_le {V : Type z} [Finite V] (G : SimpleGraph V) (P Q : Setoid V) 38 (T : Set V) (r k : ℕ) (hPQ : P ≤ Q) (hT : IsTransversal P T) 39 (hk : ∀ v : V, partCount P (flipBall G Q (r + 1) v) ≤ k) (v : V) : 40 partCount (split G P T) (flipBall G Q r v) ≤ k * neighborhoodComplexity G k 41 42 end Lax185574.SplitBalls 43 -
no assumptions
Let be the radius- ball and the radius- ball of the -flip metric around , and . The transversal has one vertex in each part of , so . Take and . Some -flip has no short walk from to , so and are distinct and non-adjacent in . Hence the adjacency of in is the same for all vertices of in the part , which contains . So the part of in is determined by its part in and its trace on . There are at most parts of meeting , and at most traces on .
-
Bipartite graphs and bipartite complements
A bipartite graph B = (X, Y, E) has parts X and Y and an edge set E of pairs xy with x ∈ X and y ∈ Y. Its bipartite complement, denoted B̄, is the bipartite graph with parts X, Y and edge set XY ∖ E.
For a graph G and disjoint vertex sets X, Y ⊆ V(G), G[X, Y] is the bipartite graph with parts X and Y whose edges connect pairs of vertices that are adjacent in G. Furthermore, G[X, X] denotes the bipartite graph whose parts are two copies of X, and whose edges connect two vertices in opposite parts if the corresponding vertices of G are either adjacent or equal. The edges of G[X, X] connecting the two copies of a vertex are its diagonal edges. Finally, Ḡ[X, X] is the bipartite complement of G[X, X], extended with the diagonal edges.
1 import Mathlib.Combinatorics.SimpleGraph.Basic 2 … module docstring, 37 lines 40 41 namespace Lax185574.BipartiteGraphs 42 43 universe u w z 44 45 /-- The bipartite graph on `α ⊕ β` with an edge between `inl a` and 46 `inr b` exactly when `E a b`. -/ 47 def bipartiteGraph {α : Type u} {β : Type w} (E : α → β → Prop) : SimpleGraph (α ⊕ β) := 48 SimpleGraph.fromRel fun s t => ∃ a b, s = .inl a ∧ t = .inr b ∧ E a b 49 50 variable {V : Type z} 51 52 /-- `G[X, Y]`, on two copies of `V`: the left copy of `u ∈ X` and the 53 right copy of `v ∈ Y` are adjacent if `u = v` or `u` and `v` are 54 adjacent in `G`. -/ 55 def pairGraph (G : SimpleGraph V) (X Y : Set V) : SimpleGraph (V ⊕ V) := 56 bipartiteGraph fun u v => u ∈ X ∧ v ∈ Y ∧ (u = v ∨ G.Adj u v) 57 58 /-- `Ḡ[X, Y]`, on two copies of `V`: the left copy of `u ∈ X` and the 59 right copy of `v ∈ Y` are adjacent if `u = v` or `u` and `v` are 60 non-adjacent in `G`. -/ 61 def coPairGraph (G : SimpleGraph V) (X Y : Set V) : SimpleGraph (V ⊕ V) := 62 bipartiteGraph fun u v => u ∈ X ∧ v ∈ Y ∧ (u = v ∨ ¬ G.Adj u v) 63 64 end Lax185574.BipartiteGraphs 65 -
Pairs at distance at most 5 in both polarities
Let G be a graph and 𝒫 a partition of V = V(G). Define R = R(G, 𝒫) ⊆ (V choose 2) so that for all parts X, Y ∈ 𝒫 (possibly X = Y) and pairs uv with u ∈ X, v ∈ Y and u ≠ v, we have uv ∈ R if and only if
dist^{G[X,Y]}(u, v) ≤ 5 and dist^{Ḡ[X,Y]}(u, v) ≤ 5.
1 import Lax185574.BipartiteGraphs 2 import Lax185574.Partitions 3 import Lax185574.GaifmanGraph 4 … module docstring, 23 lines 28 29 namespace Lax185574.PairRelation 30 31 open Lax185574.BipartiteGraphs Lax185574.Partitions Lax185574.GaifmanGraph 32 33 universe z 34 35 variable {V : Type z} 36 37 /-- The relation `R(G, 𝒫)`: distinct `u` and `v` are related if they 38 are within distance `5` both in `G[𝒫(u), 𝒫(v)]` and in 39 `Ḡ[𝒫(u), 𝒫(v)]`. -/ 40 def pairRelation (G : SimpleGraph V) (P : Setoid V) : SimpleGraph V := 41 SimpleGraph.fromRel fun u v => 42 WithinDist (pairGraph G (part P u) (part P v)) 5 (.inl u) (.inr v) ∧ 43 WithinDist (coPairGraph G (part P u) (part P v)) 5 (.inl u) (.inr v) 44 45 end Lax185574.PairRelation 46 -
The pair relation of atomic types is definable
Suppose G is a graph and 𝒫 is the partition of V(G) into atomic types over some set S ⊆ V(G). Then the relation R ≔ R(G, 𝒫) is definable in G expanded with one unary predicate marking S, using a fixed first-order formula φ_R(x, y) of quantifier rank at most 5.
1 import Lax185574.PairRelation 2 import Lax185574.Colorings 3 import Lax185574.FirstOrderTypes 4 … module docstring, 18 lines 23 24 namespace Lax185574.PairRelationDefinable 25 26 open FirstOrder FirstOrder.Language Lax710763.Transductions 27 open Lax185574.Partitions Lax185574.PairRelation Lax185574.Colorings 28 open Lax185574.FirstOrderTypes 29 30 universe z 31 32 /-- **Definability of the pair relation.** One formula of quantifier 33 rank at most `5`, with one color marking `S`, defines `R(G, 𝒫_S)` in 34 every graph `G`. -/ 35 axiom exists_formula_pairRelation : 36 ∃ φ : (withColors Language.graph 1).Formula (Fin 2), quantifierRank φ ≤ 5 ∧ 37 ∀ {V : Type z} (G : SimpleGraph V) (S : Set V) (x : Fin 2 → V), 38 @Formula.Realize _ V (expansion G fun _ => S) _ φ x ↔ 39 (pairRelation G (atomicTypes G S)).Adj (x 0) (x 1) 40 41 end Lax185574.PairRelationDefinable 42 -
no assumptions
The formula of the paper. says that and have the same atomic type over , with one quantifier. says that and lie in opposite parts among the parts of and and are equal or adjacent, respectively non-adjacent. says that there are such that every consecutive pair of satisfies , and . Such a chain is a walk of length between opposite copies of and in , respectively
Ḡ[X, Y]. Conversely, every walk of length at most between opposite copies has odd length and can be padded to length exactly by going back and forth along an edge. The pair relation is symmetric, as exchanging the two copies maps to . The rank is .The paper's formula takes the disjunction over walks of length , and . The padding argument makes the walks of length suffice.
-
The pair relation grows under coarsening
Fix a graph G and partitions 𝒫 and 𝒫′ of V(G) such that 𝒫 refines 𝒫′. Then R(G, 𝒫) ⊆ R(G, 𝒫′).
1 import Lax185574.PairRelation 2 … module docstring, 17 lines 20 21 namespace Lax185574.PairRelationMonotone 22 23 open Lax185574.PairRelation 24 25 universe z 26 27 /-- **Monotonicity of the pair relation.** Coarsening the partition can 28 only add pairs. -/ 29 axiom pairRelation_mono {V : Type z} (G : SimpleGraph V) (P P' : Setoid V) 30 (h : P ≤ P') : pairRelation G P ≤ pairRelation G P' 31 32 end Lax185574.PairRelationMonotone 33 -
no assumptions
On two copies of , the graph is a subgraph of whenever and , and likewise for
Ḡ[X, Y]. The parts of lie in the parts of , so every short walk witnessing is a walk in the graphs for . -
Balls of the pair relation lie in flip-metric balls
Fix a graph G and a partition 𝒫 of V(G), and let R ≔ R(G, 𝒫). For every radius r ∈ ℕ and vertex v ∈ V(G),
Ball^R_r(v) ⊆ Ball^𝒫_{5r}(v).
1 import Lax185574.PairRelation 2 import Lax185574.Flips 3 import Lax185574.GraphBalls 4 … module docstring, 16 lines 21 22 namespace Lax185574.PairRelationBalls 23 24 open Lax185574.PairRelation Lax185574.Flips Lax185574.GraphBalls 25 26 universe z 27 28 /-- **Ball containment.** A radius-`r` ball of `R(G, 𝒫)` lies in the 29 radius-`5r` ball of the `𝒫`-flip metric. -/ 30 axiom graphBall_pairRelation_subset {V : Type z} (G : SimpleGraph V) (P : Setoid V) 31 (r : ℕ) (v : V) : 32 graphBall (pairRelation G P) r {v} ⊆ flipBall G P (5 * r) v 33 34 end Lax185574.PairRelationBalls 35 -
no assumptions
As in the paper, every pair has . In a -flip , the bipartite graph is or
Ḡ[X, Y], and the walk of length at most there projects to a walk in by contracting diagonal edges. A walk of length at most in then gives a walk of length at most in every -flip. -
Splitting by a transversal gives a partition homogeneous modulo the pair relation
Fix a graph G and a partition 𝒫 of V(G), let T be a transversal of 𝒫, and R ≔ R(G, 𝒫). Then 𝒬 ≔ 𝒫 ∧ T is homogeneous modulo R, that is, for all X, Y ∈ 𝒬 either
XY ∖ R ⊆ E(G) or XY ∖ R ⊆ E(Ḡ).
1 import Lax185574.PairRelation 2 import Lax185574.TypeSplitting 3 import Lax185574.MergeSequences 4 … module docstring, 16 lines 21 22 namespace Lax185574.HomogeneousSplitting 23 24 open Lax185574.Partitions Lax185574.PairRelation Lax185574.TypeSplitting 25 open Lax185574.MergeSequences 26 27 universe z 28 29 /-- **Homogeneity modulo the pair relation.** For a transversal `T` of 30 `𝒫`, the partition `𝒫 ∧ T` is homogeneous modulo `R(G, 𝒫)`. -/ 31 axiom homogeneousModulo_split {V : Type z} (G : SimpleGraph V) (P : Setoid V) (T : Set V) 32 (hT : IsTransversal P T) : 33 HomogeneousModulo G (split G P T) (pairRelation G P) 34 35 end Lax185574.HomogeneousSplitting 36 -
As in the paper, for each pair of parts of we find a flip of on these parts whose edges lie in . Then the pairs outside are non-edges of the flip, so they are all edges or all non-edges of . Two parts of inside one part of : by the diameter lemma, or
Ḡ[X]has diameter at most . In the first case every non-adjacent pair of is joined by a walk of length at most between opposite copies in and by an edge inḠ[X, X], so it lies in , and the second case is symmetric. Parts inside different parts , of : apply the bipartite flip lemma to with the representatives in . The parts of refine the four parts of that lemma, so the flip is constant on the pair. -
The statement for graphs and , from the version for simple graphs: the algorithm is the program with its exponent, the merge sequence of a graph is that of its simple graph, and the constant stays the same.
-
Splitting by minimal representatives preserves coarsening
Fix a graph G together with a total order < on its vertices. Let 𝒫₁ ≼ 𝒫₂ ≼ ⋯ ≼ 𝒫_m be a sequence of ever coarser partitions of V(G). Pick representatives T₁ ⊇ T₂ ⊇ ⋯ ⊇ T_m of 𝒫₁, …, 𝒫_m by setting
T_i ≔ { min_<(P) : P ∈ 𝒫_i },
and define 𝒬_i ≔ 𝒫_i ∧ T_i. Then 𝒬₁ ≼ 𝒬₂ ≼ ⋯ ≼ 𝒬_m is also a sequence of ever coarser partitions.
1 import Lax185574.TypeSplitting 2 … module docstring, 26 lines 29 30 namespace Lax185574.SplittingMonotone 31 32 open Lax185574.TypeSplitting 33 34 universe z 35 36 variable {V : Type z} 37 38 /-- The vertices that are minimal in their part of `P`. -/ 39 def minimalVertices [LinearOrder V] (P : Setoid V) : Set V := 40 {v | ∀ u : V, P u v → v ≤ u} 41 42 /-- **Coarsening is preserved.** Splitting ever coarser partitions 43 along their minimal vertices gives ever coarser partitions. -/ 44 axiom split_minimalVertices_mono [LinearOrder V] (G : SimpleGraph V) (Ps : List (Setoid V)) 45 (h : ∀ (t : ℕ) (ht : t + 1 < Ps.length), Ps[t] ≤ Ps[t + 1]) : 46 ∀ (t : ℕ) (ht : t + 1 < Ps.length), 47 split G Ps[t] (minimalVertices Ps[t]) ≤ split G Ps[t + 1] (minimalVertices Ps[t + 1]) 48 49 end Lax185574.SplittingMonotone 50 -
no assumptions
As in the paper. If then a vertex that is minimal in its part of is minimal in its part of , so . Two vertices in the same part of lie in the same part of , hence of . They have the same neighbors in , which contains , so they lie in the same part of .
-
From merge sequences to locally definable construction sequences
For every n-vertex graph G and merge sequence (𝒫₁, R₁), …, (𝒫_ℓ, R_ℓ) of G, there is a construction sequence G₁, …, G_λ of G such that the following properties hold for all r ≥ 1. Let w_r be the radius-r width of the merge sequence.
- The obtained construction sequence has radius-r width at most w_r, and has length λ ≤ O(n w₁).
- Suppose for every i ∈ [ℓ], the relations ≡{𝒫_i} and R_i are definable in some expansion of G with 2 unary predicates, using two fixed first-order formulas of quantifier rank 5. Then, for every t ∈ [λ−1] and v ∈ V(G), the induced partial graph G_t[Ball^{G{t+1}}_r(v)] is definable in some expansion of G with 2ℓ+1 unary predicates, using formulas of quantifier rank 7 with w_r parameters.
- The construction sequence can be computed in time O(ℓ n²), given an n-vertex graph G and merge sequence of length ℓ.
1 import Lax185574.BetterMergeSequences 2 import Lax185574.ConstructionWidth 3 import Lax185574.LocalDefinability 4 import Lax185574.ConstructionSequences 5 … module docstring, 58 lines 64 65 namespace Lax185574.MergeToConstruction 66 67 open FirstOrder FirstOrder.Language Lax710763.Transductions 68 open Lax185574.Graphs Lax185574.Algorithms 69 open Lax185574.Partitions Lax185574.MergeSequences Lax185574.BetterMergeSequences 70 open Lax185574.ConstructionSequences Lax185574.ConstructionWidth 71 open Lax185574.LocalDefinability Lax185574.FirstOrderTypes 72 73 /-- **Merge sequences to construction sequences.** One algorithm 74 converts a merge sequence of length `ℓ` of a graph into a construction 75 sequence of the same graph, given by its script, in time 76 `O((ℓ+1) · (n+1)²)`. For every `r ≥ 1`, the construction sequence has 77 radius-`r` width at most `max 1 w_r`, where `w_r` is the radius-`r` 78 width of the merge sequence, and length at most `K · (n+1) · (w₁+1)`. If 79 two formulas of quantifier rank at most `5` define the stages, it is 80 radius-`r` definable with `2ℓ+1` predicates, `max 1 w_r` parameters and 81 rank `7`. -/ 82 axiom exists_constructionSequence_of_mergeSequence : 83 ∃ (A : Algorithm) (c K : ℕ) (script : (G : Graph) → 84 List (Setoid (Fin G.n) × SimpleGraph (Fin G.n)) → Script G.n), 85 ∀ (G : Graph) (ms : List (Setoid (Fin G.n) × SimpleGraph (Fin G.n))), 86 IsMergeSequence G.toSimpleGraph ms → 87 let σ := script G ms 88 IsConstructionSequence G.toSimpleGraph σ.run ∧ σ.HasSmallNumbers ∧ 89 σ.run.length ≤ K * (G.n + 1) * (mergeWidth 1 ms + 1) ∧ 90 (∀ r : ℕ, 1 ≤ r → 91 constructionWidth r σ.run ≤ max 1 (mergeWidth r ms) ∧ 92 ((∃ φeq φR : (withColors Language.graph 2).Formula (Fin 2), 93 quantifierRank φeq ≤ 5 ∧ quantifierRank φR ≤ 5 ∧ 94 StagesDefinable G.toSimpleGraph ms φeq φR) → 95 IsRadiusDefinable G.toSimpleGraph σ.run r (2 * ms.length + 1) 96 (max 1 (mergeWidth r ms)) 7)) ∧ 97 A.Computes c (G, ms) σ ((ms.length + 1) * (G.n + 1) ^ 2) 98 99 end Lax185574.MergeToConstruction 100 -
no assumptions
The statement for graphs and , from the version for simple graphs: the algorithm is the program with its exponent, the script of a graph is that of its simple graph, and the constants stay the same.
-
The statement for graphs and , from the version for simple graphs: the algorithm is the program with its exponent, the script of a graph is that of its simple graph, and the constants stay the same.
-
First-order model checking on monadically dependent graph classes
There is an algorithm which solves the model checking problem for first-order logic on graphs, that is, it decides whether a given graph G satisfies a given first-order sentence φ, with the following guarantee. For every monadically dependent graph class 𝒞 and every real ε > 0, the algorithm runs in time O_{𝒞,φ,ε}(n^(3+ε)) on the n-vertex graphs G ∈ 𝒞.
1 import Lax185574.Algorithms 2 import Lax185574.MonadicDependence 3 import Mathlib.Analysis.SpecialFunctions.Pow.Real 4 … module docstring, 43 lines 48 49 namespace Lax185574.ModelChecking 50 51 open Lax185574.Graphs Lax185574.FirstOrderLogic Lax185574.MonadicDependence 52 open Lax185574.Algorithms 53 54 /-- **First-order model checking on monadically dependent graph 55 classes.** There is an algorithm `A` such that for every monadically 56 dependent class `C`, every sentence `φ` and every `ε > 0` there is a 57 constant `c` such that `A` decides `G ⊨ φ` from `(G, φ)` in time 58 `O(n ^ (3 + ε))` with the constant `c`, for every graph `G ∈ C` on `n` 59 vertices. -/ 60 axiom exists_program_modelChecking : 61 ∃ A : Algorithm, ∀ C : GraphClass, MonadicallyDependent C → 62 ∀ (φ : Sentence) (ε : ℝ), 0 < ε → ∃ c : ℕ, 63 ∀ G ∈ C, A.Decides c (G, φ) (G ⊨ φ) ((G.n : ℝ) ^ (3 + ε)) 64 65 end Lax185574.ModelChecking 66 -
Polynomial bound on the number of types over a parameter set
Let 𝒞 be a monadically dependent graph class and k, q, c ∈ ℕ. For every graph G ∈ 𝒞, every expansion G⁺ of G by c unary predicates and every subset U ⊆ V(G),
|Types^{G⁺}{k,q}(V(G)/U)| ≤ O{𝒞,q,k,c}(1) · poly_{𝒞,q,k}(|U|).
The degree of the polynomial does not depend on the number c of unary predicates. Only the constant factor does.
1 import Lax185574.Colorings 2 import Lax185574.FirstOrderTypes 3 import Lax185574.MonadicDependence 4 … module docstring, 24 lines 29 30 namespace Lax185574.TypeBound 31 32 open Lax185574.Graphs Lax185574.MonadicDependence 33 open Lax185574.FirstOrderTypes Lax185574.Colorings 34 35 /-- **Type bound.** In a monadically dependent class, the number of 36 types of quantifier rank `q` of `k`-tuples over a parameter set `U`, in 37 an expansion by `c` unary predicates, is at most `F · (|U| + 1)^a`. The 38 exponent `a` does not depend on `c`. -/ 39 axiom typeCountOver_le (C : GraphClass) (hC : MonadicallyDependent C) 40 (k q : ℕ) : 41 ∃ a : ℕ, ∀ c : ℕ, ∃ F : ℕ, ∀ G ∈ C, 42 ∀ (colors : Fin c → Set (Fin G.n)) (U : Finset (Fin G.n)), 43 typeCountOver (expansion G.toSimpleGraph colors) k q Set.univ (U : Set (Fin G.n)) ≤ 44 F * (U.card + 1) ^ a 45 46 end Lax185574.TypeBound 47 -
Radius-r depth-q width of a construction sequence
For r, q ∈ ℕ, the radius-r depth-q width of a construction sequence G₁, …, G_λ is
max_{t ∈ [λ−1]} max_{v ∈ V(G)} |Types^{G_t}{q,q}(Ball^{G{t+1}}_r(v))|.
It measures a construction sequence by the number of types of q-tuples realized near each vertex. Types are taken in G_t, and balls in G_{t+1}.
1 import Lax185574.ConstructionSequences 2 import Lax185574.FirstOrderTypes 3 import Mathlib.Order.ConditionallyCompleteLattice.Basic 4 import Mathlib.Data.Nat.Lattice 5 … module docstring, 23 lines 29 30 namespace Lax185574.Width 31 32 open Lax185574.PartialGraphs Lax185574.FirstOrderTypes 33 34 universe z 35 36 variable {V : Type z} 37 38 /-- The number of types of `q`-tuples of quantifier rank `q`, in the 39 partial graph `G`, realized by tuples from the set `X`. -/ 40 noncomputable def partialTypeCount (G : PartialGraph V) (k q : ℕ) (X : Set V) : ℕ := 41 @typeCount language V G.structure k q X 42 43 /-- The radius-`r` depth-`q` width of the sequence `s`: the largest 44 number of types of `q`-tuples of quantifier rank `q` in `s[t]` realized 45 by tuples from a ball of radius `r` in `s[t+1]`. -/ 46 noncomputable def width (r q : ℕ) (s : List (PartialGraph V)) : ℕ := 47 sSup {K | ∃ (t : ℕ) (ht : t + 1 < s.length) (v : V), 48 K = partialTypeCount s[t] q q (s[t + 1].ball r v)} 49 50 end Lax185574.Width 51 -
Construction sequences with few realized types
Let 𝒞 be a monadically dependent graph class, r, q ∈ ℕ, and let ε > 0 be a rational. There is a constant α ≥ 1 depending only on 𝒞 and q such that every graph G ∈ 𝒞 has a construction sequence of radius-r depth-q width O_{𝒞,r,q,ε}(n^{αε}) and length O_{𝒞,r,q,ε}(n^{1+αε}). Moreover, there is an algorithm (independent of 𝒞) which, given r, q ∈ ℕ, a rational ε > 0 and an n-vertex graph G ∈ 𝒞, computes such a construction sequence in time Ô_{𝒞,r,q,ε}(n³). Here Ô_k(n³) stands for a bound O_{k,η}(n^{3+η}) for every η > 0.
It is important that α does not depend on ε, as this makes the exponent αε of the width as small as one likes.
1 import Lax185574.Width 2 import Lax185574.ConstructionSequences 3 import Lax185574.MonadicDependence 4 import Lax185574.Algorithms 5 import Mathlib.Analysis.SpecialFunctions.Pow.Real 6 … module docstring, 37 lines 44 45 namespace Lax185574.FewTypes 46 47 open Lax185574.Graphs Lax185574.MonadicDependence Lax185574.Algorithms 48 open Lax185574.ConstructionSequences Lax185574.Width 49 50 /-- **Construction sequences with few realized types.** One algorithm 51 computes, from `r`, `q`, a rational `ε > 0` and a graph `G`, a 52 construction sequence of `G`, given by its script. On members of a 53 monadically dependent class it takes time `O(n^(3+η))` for every 54 `η > 0`, and the sequence has length at most `c · (n+1)^(1+aε)` and 55 radius-`r` depth-`q` width at most `c · (n+1)^(aε)`. Here `a ≥ 1` 56 depends only on the class and `q`, and `c` on the class, `r`, `q`, `ε` 57 and `η`. -/ 58 axiom exists_program_fewTypes : 59 ∃ (A : Algorithm) (script : ℕ → ℕ → ℚ → (G : Graph) → Script G.n), 60 (∀ (r q : ℕ) (ε : ℚ) (G : Graph), 0 < ε → 61 IsConstructionSequence G.toSimpleGraph (script r q ε G).run ∧ 62 (script r q ε G).HasSmallNumbers) ∧ 63 ∀ C : GraphClass, MonadicallyDependent C → ∀ q : ℕ, ∃ a : ℕ, 1 ≤ a ∧ 64 ∀ (r : ℕ) (ε : ℚ), 0 < ε → ∀ η : ℝ, 0 < η → ∃ c : ℕ, 65 ∀ G ∈ C, 66 A.Computes c (r, q, ε, G) (script r q ε G) ((G.n : ℝ) ^ (3 + η)) ∧ 67 ((script r q ε G).run.length : ℝ) ≤ c * ((G.n : ℝ) + 1) ^ (1 + (a : ℝ) * ε) ∧ 68 (width r q (script r q ε G).run : ℝ) ≤ c * ((G.n : ℝ) + 1) ^ ((a : ℝ) * ε) 69 70 end Lax185574.FewTypes 71 -
Model checking along a construction sequence
There is an algorithm which, given a sentence φ and an n-vertex graph G together with a construction sequence of G of length λ, determines whether G ⊨ φ in time
λ · n² · poly_φ(K),
where K is the radius-r depth-d width of the construction sequence, for some r and d that depend only on φ.
1 import Lax185574.Algorithms 2 import Lax185574.ConstructionSequences 3 import Lax185574.Width 4 … module docstring, 33 lines 38 39 namespace Lax185574.ConstructionModelChecking 40 41 open Lax185574.Graphs Lax185574.FirstOrderLogic Lax185574.Algorithms 42 open Lax185574.ConstructionSequences Lax185574.Width 43 44 /-- **Model checking along a construction sequence.** One algorithm 45 decides `G ⊨ φ`, given `G`, a construction sequence of `G` by its 46 script `σ`, and `φ`, in time `O(λ · (n+1)² · (K+1)^b)`, where `λ` is 47 the length of the sequence and `K` its radius-`r` depth-`d` width. The 48 numbers `r`, `d`, `b` and the constant `c` depend on `φ`. -/ 49 axiom exists_program_modelChecking_sequence : 50 ∃ A : Algorithm, ∀ φ : Sentence, ∃ r d c b : ℕ, 51 ∀ (G : Graph) (σ : Script G.n), IsConstructionSequence G.toSimpleGraph σ.run → 52 A.Decides c (G, σ, φ) (G ⊨ φ) 53 (σ.run.length * (G.n + 1) ^ 2 * (width r d σ.run + 1) ^ b) 54 55 end Lax185574.ConstructionModelChecking 56 -
The proof of the main theorem. The algorithm converts the word of the graph into its compressed sparse row form and runs the program of on it. The conversion takes time linear in the length of the input, which is .
-
Polynomial bound on the number of types over a parameter set
Let 𝒞 be a monadically dependent graph class and k, q, c ∈ ℕ. For every graph G ∈ 𝒞, every expansion G⁺ of G by c unary predicates and every subset U ⊆ V(G),
|Types^{G⁺}{k,q}(V(G)/U)| ≤ O{𝒞,q,k,c}(1) · poly_{𝒞,q,k}(|U|).
The degree of the polynomial does not depend on the number c of unary predicates. Only the constant factor does.
1 import Lax185574.Colorings 2 import Lax185574.FirstOrderTypes 3 import Lax185574.MonadicDependence 4 … module docstring, 24 lines 29 30 namespace Lax185574.TypeBound 31 32 open Lax185574.Graphs Lax185574.MonadicDependence 33 open Lax185574.FirstOrderTypes Lax185574.Colorings 34 35 /-- **Type bound.** In a monadically dependent class, the number of 36 types of quantifier rank `q` of `k`-tuples over a parameter set `U`, in 37 an expansion by `c` unary predicates, is at most `F · (|U| + 1)^a`. The 38 exponent `a` does not depend on `c`. -/ 39 axiom typeCountOver_le (C : GraphClass) (hC : MonadicallyDependent C) 40 (k q : ℕ) : 41 ∃ a : ℕ, ∀ c : ℕ, ∃ F : ℕ, ∀ G ∈ C, 42 ∀ (colors : Fin c → Set (Fin G.n)) (U : Finset (Fin G.n)), 43 typeCountOver (expansion G.toSimpleGraph colors) k q Set.univ (U : Set (Fin G.n)) ≤ 44 F * (U.card + 1) ^ a 45 46 end Lax185574.TypeBound 47 -
Locally definable construction sequences
Let A be a structure and H a partial graph with V(H) ⊆ V(A). Then H is definable in A by formulas of quantifier rank q₀ with parameters from a set S ⊆ V(A) if for every relation R of H of arity k there is a formula φ_R(x₁, …, x_k) of quantifier rank at most q₀ with parameters from S such that, for all v̄ ∈ V(A)^k,
A ⊨ φ_R(v̄) ⟺ v̄ ∈ V(H)^k and H ⊨ R(v̄).
Let G be a graph and r, c, s, q₀ ∈ ℕ. A construction sequence G₁, …, G_λ of G is radius-r definable with c unary predicates, s parameters and quantifier rank q₀ if, for all t ∈ [λ−1] and v ∈ V(G), the induced partial graph G_t[Ball^{G_{t+1}}_r(v)] is definable in some expansion of G by c unary predicates, by formulas of quantifier rank q₀ with parameters from a set of at most s vertices. The expansion and the parameters may depend on t and v.
1 import Lax185574.ConstructionSequences 2 import Lax185574.Colorings 3 import Lax185574.FirstOrderTypes 4 … module docstring, 32 lines 37 38 namespace Lax185574.LocalDefinability 39 40 open FirstOrder FirstOrder.Language 41 open Lax185574.PartialGraphs Lax185574.FirstOrderTypes Lax185574.Colorings 42 open Lax710763.Transductions 43 44 universe u v z 45 46 variable {V : Type z} 47 48 /-- The induced partial graph `H[B]` is definable in the structure on 49 `V` by formulas of quantifier rank at most `q₀` with parameters from 50 `S`. -/ 51 def DefinableIn {L : Language.{u, v}} [L.Structure V] (q₀ : ℕ) (S : Set V) 52 (H : PartialGraph V) (B : Set V) : Prop := 53 ∀ {k : ℕ} (R : PartialGraphs.language.Relations k), 54 ∃ φ : L.Formula (Fin k ⊕ S), quantifierRank φ ≤ q₀ ∧ 55 ∀ x : Fin k → V, 56 φ.Realize (Sum.elim x Subtype.val) ↔ 57 (∀ i, x i ∈ B) ∧ @Structure.RelMap _ V H.structure k R x 58 59 /-- The sequence `s` is radius-`r` definable in the graph `G` with `c` 60 unary predicates, `s'` parameters and quantifier rank `q₀`: for every 61 step `t` and vertex `v`, the induced partial graph 62 `s[t][Ball^{s[t+1]}_r(v)]` is definable in some expansion of `G` by `c` 63 unary predicates, by formulas of quantifier rank at most `q₀` with at 64 most `s'` parameters. -/ 65 def IsRadiusDefinable (G : SimpleGraph V) (s : List (PartialGraph V)) 66 (r c s' q₀ : ℕ) : Prop := 67 ∀ (t : ℕ) (ht : t + 1 < s.length) (v : V), 68 ∃ (colors : Fin c → Set V) (S : Finset V), S.card ≤ s' ∧ 69 @DefinableIn V (withColors Language.graph c) (expansion G colors) q₀ S 70 s[t] (s[t + 1].ball r v) 71 72 end Lax185574.LocalDefinability 73 -
Computing locally definable construction sequences
Let r ≥ 1 be an integer, ε > 0 a rational, and 𝒞 a monadically dependent graph class. There is a constant δ ≥ 1 depending only on 𝒞 such that every n-vertex graph G ∈ 𝒞 has a construction sequence of G which is radius-r definable with O(r/ε) unary predicates, O_{𝒞,r,ε}(n^{δε}) parameters and quantifier rank 7, and has length O_{𝒞,r,ε}(n^{1+δε}). Moreover, there is an algorithm (independent of 𝒞) which, given r, ε and G, computes such a sequence, and runs in time Ô_{𝒞,r,ε}(n³) whenever G ∈ 𝒞. Here Ô_k(n³) stands for a bound O_{k,η}(n^{3+η}) for every η > 0.
1 import Lax185574.LocalDefinability 2 import Lax185574.ConstructionSequences 3 import Lax185574.MonadicDependence 4 import Lax185574.Algorithms 5 import Mathlib.Analysis.SpecialFunctions.Pow.Real 6 … module docstring, 46 lines 53 54 namespace Lax185574.DefinableSequences 55 56 open Lax185574.Graphs Lax185574.MonadicDependence Lax185574.Algorithms 57 open Lax185574.ConstructionSequences Lax185574.LocalDefinability 58 59 /-- **Locally definable construction sequences.** One algorithm 60 computes, from `r ≥ 1`, a rational `ε > 0` and a graph `G`, a 61 construction sequence of `G`, given by its script. On members of a 62 monadically dependent class it takes time `O(n^(3+η))` for every 63 `η > 0`, and the sequence has length at most `c · (n+1)^(1+aε)` and is 64 radius-`r` definable with `⌈K·r/ε⌉ + K` unary predicates, 65 `⌊c · (n+1)^(aε)⌋` parameters and quantifier rank `7`. Here `a ≥ 1` 66 depends only on the class, and `c` on the class, `r`, `ε` and `η`. -/ 67 axiom exists_program_definableSequence : 68 ∃ (A : Algorithm) (K : ℕ) (script : ℕ → ℚ → (G : Graph) → Script G.n), 69 (∀ (r : ℕ) (ε : ℚ) (G : Graph), 1 ≤ r → 0 < ε → 70 IsConstructionSequence G.toSimpleGraph (script r ε G).run ∧ 71 (script r ε G).HasSmallNumbers) ∧ 72 ∀ C : GraphClass, MonadicallyDependent C → ∃ a : ℕ, 1 ≤ a ∧ 73 ∀ (r : ℕ) (ε : ℚ), 1 ≤ r → 0 < ε → ∀ η : ℝ, 0 < η → ∃ c : ℕ, 74 ∀ G ∈ C, 75 A.Computes c (r, ε, G) (script r ε G) ((G.n : ℝ) ^ (3 + η)) ∧ 76 ((script r ε G).run.length : ℝ) ≤ c * ((G.n : ℝ) + 1) ^ (1 + (a : ℝ) * ε) ∧ 77 IsRadiusDefinable G.toSimpleGraph (script r ε G).run r (⌈(K : ℚ) * r / ε⌉₊ + K) 78 ⌊(c : ℝ) * ((G.n : ℝ) + 1) ^ ((a : ℝ) * ε)⌋₊ 7 79 80 end Lax185574.DefinableSequences 81 -
Types are determined by types in a neighborhood
For all k, q, α ∈ ℕ there is a number q' = q'(k, q, α) such that with h ≔ 7^q the following holds. Let σ be a relational signature of arity at most α and A a σ-structure. Then, for all ā ∈ V(A)^k and B ⊇ Ball^A_h(ā), the type tp^A_q(ā) depends only on tp^{A[B]}_{q'}(ā).
This is a corollary of Gaifman's locality theorem. The point is that h depends on q alone, and q' does not depend on the signature beyond its arity. The latter matters when the signature has one unary symbol per part of a partition with up to n parts. The paper states that h = h(q) is computable, and its proof takes h = 7^q. The statement here names this value, because algorithms downstream compute the radius from q.
1 import Lax185574.FirstOrderTypes 2 import Lax185574.GaifmanGraph 3 … module docstring, 37 lines 41 42 namespace Lax185574.LocalToGlobal 43 44 open FirstOrder FirstOrder.Language 45 open Lax185574.FirstOrderTypes Lax185574.GaifmanGraph 46 47 universe u v z 48 49 /-- **Local-to-global types.** For a relational structure of arity at 50 most `α`, the type of quantifier rank `q` of a `k`-tuple is determined 51 by its type of quantifier rank `q'` in any induced substructure that 52 contains its ball of radius `7^q`. -/ 53 axiom rankType_eq_of_rankType_induced_eq (k q α : ℕ) : 54 ∃ q' : ℕ, ∀ (L : Language.{u, v}) [L.IsRelational], 55 (∀ l, α < l → IsEmpty (L.Relations l)) → 56 ∀ (V : Type z) [Finite V] [L.Structure V] (B B' : Set V) 57 (a : Fin k → B) (b : Fin k → B'), 58 ball L (7 ^ q) (Subtype.val ∘ a) ⊆ B → 59 ball L (7 ^ q) (Subtype.val ∘ b) ⊆ B' → 60 @rankType L B (induced B) q' k a = @rankType L B' (induced B') q' k b → 61 rankType (L := L) q (Subtype.val ∘ a) = rankType (L := L) q (Subtype.val ∘ b) 62 63 end Lax185574.LocalToGlobal 64 -
Local definability bounds the width
Let q ∈ ℕ and h ≔ 7^q. The following holds for every monadically dependent graph class 𝒞 and all r, c, s, q₀ ∈ ℕ. If a construction sequence of a graph G ∈ 𝒞 is radius-(r+h) definable with c unary predicates, s parameters and rank q₀, then its radius-r depth-q width is at most O_{𝒞,q,q₀,c}(1) · poly_{𝒞,q,q₀}(s).
1 import Lax185574.LocalDefinability 2 import Lax185574.Width 3 import Lax185574.MonadicDependence 4 … module docstring, 21 lines 26 27 namespace Lax185574.DefinableToTypes 28 29 open Lax185574.Graphs Lax185574.MonadicDependence 30 open Lax185574.ConstructionSequences Lax185574.LocalDefinability Lax185574.PartialGraphs 31 open Lax185574.Width 32 33 /-- **Local definability bounds the width.** A construction sequence of 34 a member of a monadically dependent class that is radius-`(r + 7^q)` 35 definable with `c` unary predicates, `s` parameters and rank `q₀` has 36 radius-`r` depth-`q` width at most `F · (s + 1)^a`. -/ 37 axiom width_le_of_isRadiusDefinable (q : ℕ) (C : GraphClass) (hC : MonadicallyDependent C) 38 (q₀ : ℕ) : 39 ∃ a : ℕ, ∀ c : ℕ, ∃ F : ℕ, ∀ r s : ℕ, ∀ G ∈ C, 40 ∀ seq : List (PartialGraph (Fin G.n)), IsConstructionSequence G.toSimpleGraph seq → 41 IsRadiusDefinable G.toSimpleGraph seq (r + 7 ^ q) c s q₀ → 42 width r q seq ≤ F * (s + 1) ^ a 43 44 end Lax185574.DefinableToTypes 45 -
Let be the rank of for -tuples, rank and arity 2, and let and be the exponent and factor of for -tuples and rank . Fix a step and a vertex , and let and be the balls of radius and around in the next partial graph. A step keeps resolved pairs, so the radius- ball in the current partial graph of a tuple from lies in . By , the type of such a tuple is determined by its type of rank in the induced partial graph on . This partial graph is definable in an expansion of the graph by predicates with at most parameters, so the type over the parameters of rank determines the latter. bounds the number of these types by .
The argument is carried out for the graph classes of the archive and their monadic dependence, and transferred to the graph classes used here.
-
The proof of the few-types theorem. Run the algorithm of the theorem on definable construction sequences with radius , where is the radius of the lemma passing from definability to few types. The output is radius- definable with predicates and parameters, so its radius- depth- width is at most , which is . So works for the width and the length, and since . The exponent of the time is passed on to the theorem on definable construction sequences. The program is a simulation of the program of the theorem on definable construction sequences on the rewritten input, one word bit shorter, and the word-length exponent grows by one to pay for the larger first entry.
The proof is carried out for the input format with the graph in compressed sparse row form and the notion . The algorithm converts the word of the graph into compressed sparse rows () and runs the program for that format. The script of a graph is the one whose encoding the program outputs on the converted input.
-
Partial graphs
A partial graph H consists of a finite vertex set V = V(H), two disjoint sets E(H), N(H) ⊆ (V choose 2) of edges and non-edges, and a partition of V whose parts are treated as colors. The pairs in R(H) = E(H) ∪ N(H) are resolved, and all other pairs are unresolved. H is viewed as a logical structure with binary relations E and N and a unary predicate for every color. Distances dist^H and balls Ball^H_r(v) are measured in the Gaifman graph (V, R(H)), the graph of resolved pairs.
For the model-checking algorithm, the parts are given names, to track them over time. Fix a countably infinite set of unary symbols, called colors. A partial graph G is regarded as a relational structure with the two symmetric binary relations E and N and a unary relation Y for every color Y. The vertices of color Y form its color class Y^G, and the nonempty color classes are the parts of G. The size of the representation of G is given by |G| = |V(G)| and ‖G‖ = |V(G)| + |R(G)|.
1 import Lax185574.GaifmanGraph 2 import Lax185574.Encodings 3 import Mathlib.Combinatorics.SimpleGraph.Basic 4 import Mathlib.Data.Set.Card 5 … module docstring, 54 lines 60 61 namespace Lax185574.PartialGraphs 62 63 open FirstOrder FirstOrder.Language 64 open Lax185574.GaifmanGraph 65 66 universe z 67 68 /-- A partial graph on the vertex type `V`: disjoint edges and 69 non-edges, and one color per vertex. -/ 70 structure PartialGraph (V : Type z) where 71 /-- The edges `E(G)`. -/ 72 edge : SimpleGraph V 73 /-- The non-edges `N(G)`. -/ 74 nonEdge : SimpleGraph V 75 /-- No pair is both an edge and a non-edge. -/ 76 disjoint : Disjoint edge nonEdge 77 /-- The color of each vertex. -/ 78 color : V → ℕ 79 80 variable {V : Type z} 81 82 namespace PartialGraph 83 84 /-- The resolved pairs `R(G) = E(G) ∪ N(G)`, the Gaifman graph of the 85 partial graph. -/ 86 def resolved (G : PartialGraph V) : SimpleGraph V := G.edge ⊔ G.nonEdge 87 88 /-- `Ball^G_r(v)`: the vertices within distance `r` of `v` along 89 resolved pairs. -/ 90 def ball (G : PartialGraph V) (r : ℕ) (v : V) : Set V := 91 {u | WithinDist G.resolved r v u} 92 93 /-- The color class `Y^G`. -/ 94 def colorClass (G : PartialGraph V) (Y : ℕ) : Set V := {v | G.color v = Y} 95 96 /-- The size `‖G‖ = |V(G)| + |R(G)|` of a partial graph on `Fin n`. -/ 97 noncomputable def size {n : ℕ} (G : PartialGraph (Fin n)) : ℕ := 98 n + Set.ncard G.resolved.edgeSet 99 100 end PartialGraph 101 102 /-- The relation symbols of partial graphs: edges, non-edges and one 103 unary symbol per color. -/ 104 inductive Rel : ℕ → Type 105 | edge : Rel 2 106 | nonEdge : Rel 2 107 | color (Y : ℕ) : Rel 1 108 109 /-- The language of partial graphs. -/ 110 def language : Language := 111 ⟨fun _ => Empty, Rel⟩ 112 deriving Language.IsRelational 113 114 /-- A partial graph as a relational structure. -/ 115 @[implicit_reducible] 116 def PartialGraph.structure (G : PartialGraph V) : language.Structure V where 117 funMap f := isEmptyElim f 118 RelMap 119 | .edge => fun x => G.edge.Adj (x 0) (x 1) 120 | .nonEdge => fun x => G.nonEdge.Adj (x 0) (x 1) 121 | .color Y => fun x => G.color (x 0) = Y 122 123 open Lax185574.Encoding in 124 /-- A partial graph on `Fin n` is encoded by the family of its colors, 125 then its edges and then its non-edges, each graph as in 126 `Lax185574.Encodings`. So the encoding is `n` and the `n` colors, then 127 `n` and for every vertex in order the set of its neighbors along edges, 128 then `n` and for every vertex the set of its neighbors along non-edges. 129 It is determined by the partial graph and has length O(‖G‖). Running 130 times are stated in terms of ‖G‖, which is only meaningful for an 131 encoding without padding. The edges and non-edges are relations, so the 132 encoding is not derived. -/ 133 noncomputable instance {n : ℕ} : Encode (PartialGraph (Fin n)) where 134 encode G := encode (G.color, G.edge, G.nonEdge) 135 136 end Lax185574.PartialGraphs 137 -
The distance matrix of a partial graph
The distance matrix of a partial graph G is the |G| × |G| matrix D_G with entries D_G(u, v) = dist^G(u, v) ∈ ℕ ∪ {∞}.
1 import Lax185574.PartialGraphs 2 import Mathlib.Combinatorics.SimpleGraph.Metric 3 … module docstring, 26 lines 30 31 namespace Lax185574.DistanceMatrix 32 33 open Lax185574.PartialGraphs 34 35 /-- The distance matrix `D_G`: `D_G(u, v) = dist^G(u, v)`, the distance 36 in the graph of resolved pairs, and `∞` if there is no path. -/ 37 noncomputable def distMatrix {n : ℕ} (G : PartialGraph (Fin n)) : Fin n → Fin n → ℕ∞ := 38 fun u v => G.resolved.edist u v 39 40 end Lax185574.DistanceMatrix 41 -
Construction sequences
For colors P, Q and a partial graph G, the partial graphs merge_{P,Q}(G) (for P ≠ Q), resolve⁺{P,Q}(G) and resolve⁻{P,Q}(G) are obtained from G by leaving everything unchanged, apart from the following:
- merge_{P,Q}(G): P^H = P^G ∪ Q^G and Q^H = ∅, for P ≠ Q;
- resolve⁺_{P,Q}(G): E(H) = E(G) ∪ (P^G Q^G ∖ N(G));
- resolve⁻_{P,Q}(G): N(H) = N(G) ∪ (P^G Q^G ∖ E(G)).
Here P^G Q^G is the set of pairs xy of distinct vertices with x ∈ P^G and y ∈ Q^G. After either resolve, every pair in P^G Q^G is resolved.
An initial partial graph has no resolved pairs, and every part is a singleton. A construction sequence of a graph G = (V, E) is a sequence G₁, …, G_λ of partial graphs with vertex set V such that G₁ is initial, every step is one merge or one resolve, and G_λ has a single part, E(G_λ) = E and N(G_λ) = (V choose 2) ∖ E.
1 import Lax185574.PartialGraphs 2 … module docstring, 52 lines 55 56 namespace Lax185574.ConstructionSequences 57 58 open Lax185574.PartialGraphs 59 60 universe z 61 62 variable {V : Type z} 63 64 /-- The pairs `P^G Q^G`: distinct vertices, one of color `P` and the 65 other of color `Q`. -/ 66 def between (G : PartialGraph V) (P Q : ℕ) : SimpleGraph V := 67 SimpleGraph.fromRel fun x y => G.color x = P ∧ G.color y = Q 68 69 /-- `merge_{P,Q}(G)`: the vertices of color `Q` get color `P`. -/ 70 def merge (G : PartialGraph V) (P Q : ℕ) : PartialGraph V := 71 { G with color := fun v => if G.color v = Q then P else G.color v } 72 73 /-- `resolve⁺_{P,Q}(G)`: the unresolved pairs in `P^G Q^G` become 74 edges. -/ 75 def resolvePos (G : PartialGraph V) (P Q : ℕ) : PartialGraph V where 76 edge := G.edge ⊔ (between G P Q \ G.nonEdge) 77 nonEdge := G.nonEdge 78 disjoint := disjoint_sup_left.2 ⟨G.disjoint, disjoint_sdiff_self_left⟩ 79 color := G.color 80 81 /-- `resolve⁻_{P,Q}(G)`: the unresolved pairs in `P^G Q^G` become 82 non-edges. -/ 83 def resolveNeg (G : PartialGraph V) (P Q : ℕ) : PartialGraph V where 84 edge := G.edge 85 nonEdge := G.nonEdge ⊔ (between G P Q \ G.edge) 86 disjoint := disjoint_sup_right.2 ⟨G.disjoint, disjoint_sdiff_self_right⟩ 87 color := G.color 88 89 /-- An initial partial graph: no resolved pairs, and every part is a 90 singleton. -/ 91 def IsInitial (G : PartialGraph V) : Prop := 92 G.edge = ⊥ ∧ G.nonEdge = ⊥ ∧ Function.Injective G.color 93 94 /-- `H` is obtained from `G` by one merge or one resolve. -/ 95 def IsStep (G H : PartialGraph V) : Prop := 96 ∃ P Q : ℕ, (P ≠ Q ∧ H = merge G P Q) ∨ H = resolvePos G P Q ∨ 97 H = resolveNeg G P Q 98 99 /-- `s` is a construction sequence of the graph `G`: it starts with an 100 initial partial graph, each entry is obtained from the previous one by 101 one merge or one resolve, and the last entry has a single part, the 102 edges of `G` as edges and the non-edges of `G` as non-edges. -/ 103 def IsConstructionSequence (G : SimpleGraph V) (s : List (PartialGraph V)) : 104 Prop := 105 ∃ h : s ≠ [], 106 IsInitial (s.head h) ∧ 107 (∀ (t : ℕ) (ht : t + 1 < s.length), IsStep s[t] s[t + 1]) ∧ 108 (∀ u v : V, (s.getLast h).color u = (s.getLast h).color v) ∧ 109 (s.getLast h).edge = G ∧ (s.getLast h).nonEdge = Gᶜ 110 111 open Lax185574.Encoding 112 113 /-- One step of a construction sequence. -/ 114 inductive Step 115 /-- `merge_{P,Q}`. -/ 116 | merge (P Q : ℕ) 117 /-- `resolve⁺_{P,Q}`. -/ 118 | resolvePos (P Q : ℕ) 119 /-- `resolve⁻_{P,Q}`. -/ 120 | resolveNeg (P Q : ℕ) 121 deriving Encode 122 123 /-- The partial graph obtained by applying a step. -/ 124 def apply (G : PartialGraph V) : Step → PartialGraph V 125 | .merge P Q => merge G P Q 126 | .resolvePos P Q => resolvePos G P Q 127 | .resolveNeg P Q => resolveNeg G P Q 128 129 /-- The partial graph with no resolved pairs and the given colors. -/ 130 def unresolved (color : V → ℕ) : PartialGraph V where 131 edge := ⊥ 132 nonEdge := ⊥ 133 disjoint := disjoint_bot_left 134 color := color 135 136 /-- A construction script on `Fin n`: the colors of the initial partial 137 graph, which has no resolved pairs, and the steps. -/ 138 structure Script (n : ℕ) where 139 /-- The colors of the initial partial graph. -/ 140 colors : Fin n → ℕ 141 /-- The steps, in order. -/ 142 steps : List Step 143 deriving Encode 144 145 /-- The sequence produced by a script: the initial partial graph 146 followed by the results of the steps. -/ 147 def Script.run {n : ℕ} (σ : Script n) : List (PartialGraph (Fin n)) := 148 σ.steps.scanl apply (unresolved σ.colors) 149 150 /-- Every number in the encoding of the script `σ` is at most the 151 length of the encoding plus `n`. This holds when the colors of the 152 initial partial graph and of the steps are vertices. It lets an 153 algorithm pass the script on to another one, whose word length depends 154 on the numbers of its input. -/ 155 def Script.HasSmallNumbers {n : ℕ} (σ : Script n) : Prop := 156 ∀ v ∈ encode σ, v ≤ (encode σ).length + n 157 158 /-- The list `y` encodes the sequence `s` of partial graphs on `n` 159 vertices: it is the encoding of a script that produces `s`. -/ 160 def EncodesSequence {n : ℕ} (y : List ℕ) (s : List (PartialGraph (Fin n))) : 161 Prop := 162 ∃ σ : Script n, y = encode σ ∧ s = σ.run 163 164 end Lax185574.ConstructionSequences 165 -
Distance logic over partial graphs and distance rank
The logic distFO extends first-order logic over partial graphs by distance atoms. Its atoms are
- the first-order atoms x = y, E(x, y), N(x, y) and Y(x), for colors Y;
- for each radius r ∈ ℕ, the binary distance atom dist(x, y) ≤ r;
- for each radius r ∈ ℕ and color Y, the unary distance atom dist(x, Y) < r, equivalent to ∃y (Y(y) ∧ dist(x, y) < r).
Distances are measured in the Gaifman graph of the partial graph, that is, along resolved pairs. A formula is built from atoms by negation, conjunction and the local quantifier ∃y (dist(xᵢ, y) ≤ s ∧ φ(x̄ y)).
The horizon functions are ρ⁻(k, q) = 9^((k+q+1)q) and ρ⁺(k, q) = 9^((k+q)(q+1)). A formula has distance rank (k, q) if it is a Boolean combination of
- first-order atoms,
- binary distance atoms of radius at most ρ⁻(k, q),
- unary distance atoms of radius at most ρ⁺(k, q), and
- formulas ∃y (dist(xᵢ, y) ≤ ρ⁺(k+1, q−1) ∧ φ(x̄ y)), where q ≥ 1, xᵢ is a free variable and φ has distance rank (k+1, q−1).
1 import Lax185574.PartialGraphs 2 import Lax185574.Encodings 3 import Lax3.DistFO 4 … module docstring, 51 lines 56 57 namespace Lax185574.DistanceLogic 58 59 open Lax185574.PartialGraphs Lax185574.GaifmanGraph Lax185574.Encoding 60 open Lax3.DistFO (rhoMinus rhoPlus) 61 62 /-- Formulas of distance logic over partial graphs with `ℓ` free 63 variables. -/ 64 inductive DistFO : ℕ → Type 65 /-- `xᵢ = xⱼ`. -/ 66 | eq {ℓ : ℕ} (i j : Fin ℓ) : DistFO ℓ 67 /-- `E(xᵢ, xⱼ)`. -/ 68 | edge {ℓ : ℕ} (i j : Fin ℓ) : DistFO ℓ 69 /-- `N(xᵢ, xⱼ)`. -/ 70 | nonEdge {ℓ : ℕ} (i j : Fin ℓ) : DistFO ℓ 71 /-- `Y(xᵢ)`. -/ 72 | color {ℓ : ℕ} (Y : ℕ) (i : Fin ℓ) : DistFO ℓ 73 /-- `dist(xᵢ, xⱼ) ≤ r`. -/ 74 | distLe {ℓ : ℕ} (r : ℕ) (i j : Fin ℓ) : DistFO ℓ 75 /-- `dist(xᵢ, Y) < r`. -/ 76 | distColorLt {ℓ : ℕ} (r Y : ℕ) (i : Fin ℓ) : DistFO ℓ 77 /-- Negation. -/ 78 | not {ℓ : ℕ} (φ : DistFO ℓ) : DistFO ℓ 79 /-- Conjunction. -/ 80 | and {ℓ : ℕ} (φ ψ : DistFO ℓ) : DistFO ℓ 81 /-- `∃y (dist(xᵢ, y) ≤ s ∧ φ(x̄ y))`, binding the new last variable. -/ 82 | exLocal {ℓ : ℕ} (i : Fin ℓ) (s : ℕ) (φ : DistFO (ℓ + 1)) : DistFO ℓ 83 deriving Encode 84 85 namespace DistFO 86 87 /-- The formula is an atom. -/ 88 def IsAtom {ℓ : ℕ} : DistFO ℓ → Prop 89 | .not _ | .and _ _ | .exLocal _ _ _ => False 90 | _ => True 91 92 /-- Some walk of length less than `r` joins `u` and `v`. -/ 93 def WithinDistLt {W : Type*} (G : SimpleGraph W) (r : ℕ) (u v : W) : Prop := 94 ∃ p : G.Walk u v, p.length < r 95 96 variable {V : Type*} 97 98 /-- Satisfaction in the partial graph `G` under the assignment `m` of 99 vertices to the free variables. -/ 100 def Sat (G : PartialGraph V) : {ℓ : ℕ} → (Fin ℓ → V) → DistFO ℓ → Prop 101 | _, m, .eq i j => m i = m j 102 | _, m, .edge i j => G.edge.Adj (m i) (m j) 103 | _, m, .nonEdge i j => G.nonEdge.Adj (m i) (m j) 104 | _, m, .color Y i => G.color (m i) = Y 105 | _, m, .distLe r i j => WithinDist G.resolved r (m i) (m j) 106 | _, m, .distColorLt r Y i => ∃ v, G.color v = Y ∧ WithinDistLt G.resolved r (m i) v 107 | _, m, .not φ => ¬ Sat G m φ 108 | _, m, .and φ ψ => Sat G m φ ∧ Sat G m ψ 109 | _, m, .exLocal i s φ => 110 ∃ v, WithinDist G.resolved s (m i) v ∧ Sat G (Fin.snoc m v) φ 111 112 /-- `DRank k q φ`: the formula `φ` has distance rank `(k, q)`. -/ 113 inductive DRank : ℕ → ℕ → {ℓ : ℕ} → DistFO ℓ → Prop 114 | eq {k q ℓ : ℕ} (i j : Fin ℓ) : DRank k q (.eq i j) 115 | edge {k q ℓ : ℕ} (i j : Fin ℓ) : DRank k q (.edge i j) 116 | nonEdge {k q ℓ : ℕ} (i j : Fin ℓ) : DRank k q (.nonEdge i j) 117 | color {k q ℓ : ℕ} (Y : ℕ) (i : Fin ℓ) : DRank k q (.color Y i) 118 | distLe {k q ℓ : ℕ} (r : ℕ) (i j : Fin ℓ) : 119 r ≤ rhoMinus k q → DRank k q (.distLe r i j) 120 | distColorLt {k q ℓ : ℕ} (r Y : ℕ) (i : Fin ℓ) : 121 r ≤ rhoPlus k q → DRank k q (.distColorLt r Y i) 122 | not {k q ℓ : ℕ} {φ : DistFO ℓ} : DRank k q φ → DRank k q (.not φ) 123 | and {k q ℓ : ℕ} {φ ψ : DistFO ℓ} : 124 DRank k q φ → DRank k q ψ → DRank k q (.and φ ψ) 125 | exLocal {k q ℓ : ℕ} (i : Fin ℓ) {φ : DistFO (ℓ + 1)} : 126 DRank (k + 1) q φ → DRank k (q + 1) (.exLocal i (rhoPlus (k + 1) q) φ) 127 128 end DistFO 129 130 end Lax185574.DistanceLogic 131 -
Type trees and their canonical representation
Let G be a partial graph, k, q ∈ ℕ and ā a tuple of ℓ vertices. The atomic (k, q)-type atp_{k,q}(ā) is the set of atomic distFO formulas of distance rank (k, q) with free variables among x₁, …, x_ℓ that ā satisfies in G. The (k, q)-type tree of ā is
tree_{k,q}(ā) = (atp_{k,q}(ā), 𝓔_{k,q}(ā)),
where 𝓔_{k,0}(ā) = ∅ and, for q ≥ 1,
𝓔_{k,q}(ā) = {(i, tree_{k+1,q−1}(ā b)) | i ∈ [ℓ], b ∈ V(G), dist(aᵢ, b) ≤ ρ⁺(k+1, q−1)}.
The members of 𝓔_{k,q}(ā) are the extensions, and i is the guard of the extension. The number ℓ is the arity and (k, q) is the rank of the tree.
Type trees are represented on the RAM in a canonical form, with all sets sorted and free of duplicates, so that two trees are equal exactly when their representations are. The size ‖τ‖ of a tree is the size of its representation, which includes k, q and ℓ.
For a type tree ν of arity one, [ν]^G is the set of vertices b with tree_{k,q}(b) = ν, where (k, q) is the rank of ν.
1 import Lax185574.DistanceLogic 2 import Mathlib.Data.Fin.VecNotation 3 … module docstring, 61 lines 65 66 namespace Lax185574.TypeTrees 67 68 open Lax185574.PartialGraphs Lax185574.GaifmanGraph Lax185574.Encoding 69 open Lax185574.DistanceLogic Lax185574.DistanceLogic.DistFO 70 open Lax3.DistFO (rhoMinus rhoPlus) 71 72 /-- `Node q ℓ`: the roots of the type trees of depth `q` and arity `ℓ`. 73 A root of depth `0` is its set of atoms. A root of depth `q + 1` is its 74 set of atoms together with its set of extensions, pairs of a guard and 75 a root of depth `q` and arity `ℓ + 1`. -/ 76 def Node : ℕ → ℕ → Type 77 | 0, ℓ => Finset (DistFO ℓ) 78 | q + 1, ℓ => Finset (DistFO ℓ) × Finset (Fin ℓ × Node q (ℓ + 1)) 79 80 /-- A root of depth `0` is encoded by its set of atoms. A root of depth 81 `q + 1` is encoded by its set of atoms followed by its set of 82 extensions. `Node` is defined by recursion on the depth and is not an 83 inductive type, so its encoding is given by the same recursion. -/ 84 @[instance_reducible] def Node.instEncode : (q ℓ : ℕ) → Encode (Node q ℓ) 85 | 0, ℓ => inferInstanceAs (Encode (Finset (DistFO ℓ))) 86 | q + 1, ℓ => 87 letI := Node.instEncode q (ℓ + 1) 88 inferInstanceAs (Encode (Finset (DistFO ℓ) × Finset (Fin ℓ × Node q (ℓ + 1)))) 89 90 instance {q ℓ : ℕ} : Encode (Node q ℓ) := Node.instEncode q ℓ 91 92 /-- A type tree: its rank `(k, q)`, its arity `ℓ` and its root. -/ 93 structure TypeTree where 94 /-- The first component of the rank. -/ 95 k : ℕ 96 /-- The depth, the second component of the rank. -/ 97 q : ℕ 98 /-- The arity. -/ 99 ℓ : ℕ 100 /-- The root. -/ 101 root : Node q ℓ 102 deriving Encode 103 104 variable {V : Type*} 105 106 /-- The finite set with the elements of `S`, and `∅` if `S` is 107 infinite. -/ 108 noncomputable def finsetOf {α : Type*} (S : Set α) : Finset α := 109 open Classical in if h : S.Finite then h.toFinset else ∅ 110 111 /-- `atp_{k,q}(a)`: the atoms of distance rank `(k, q)` satisfied by the 112 tuple `a`. -/ 113 def atp (G : PartialGraph V) (k q : ℕ) {ℓ : ℕ} (a : Fin ℓ → V) : Set (DistFO ℓ) := 114 {φ | IsAtom φ ∧ DRank k q φ ∧ Sat G a φ} 115 116 /-- The root of `tree_{k,q}(a)`: the atoms of `atp_{k,q}(a)` and, for 117 `q ≥ 1`, the extensions `(i, tree_{k+1,q−1}(a b))`. -/ 118 noncomputable def node (G : PartialGraph V) : (k q : ℕ) → {ℓ : ℕ} → (Fin ℓ → V) → Node q ℓ 119 | k, 0, _, a => finsetOf (atp G k 0 a) 120 | k, q + 1, ℓ, a => 121 (finsetOf (atp G k (q + 1) a), 122 finsetOf {e | ∃ (i : Fin ℓ) (b : V), 123 WithinDist G.resolved (rhoPlus (k + 1) q) (a i) b ∧ 124 e = (i, node G (k + 1) q (Fin.snoc a b))}) 125 126 /-- `tree_{k,q}(a)`. -/ 127 noncomputable def tree (G : PartialGraph V) (k q : ℕ) {ℓ : ℕ} (a : Fin ℓ → V) : TypeTree := 128 ⟨k, q, ℓ, node G k q a⟩ 129 130 /-- `[ν]^G`: the vertices whose type tree is `ν`. The rank is read off 131 `ν`, which records it. -/ 132 def realizations (G : PartialGraph V) (ν : TypeTree) : Set V := 133 {b | tree G ν.k ν.q ![b] = ν} 134 135 /-- The family `(tree_{k,q}(a) : a ∈ V(G))` of the type trees of all 136 vertices. -/ 137 noncomputable def family {n : ℕ} (G : PartialGraph (Fin n)) (k q : ℕ) : Fin n → TypeTree := 138 fun a => tree G k q ![a] 139 140 /-- The largest size of a tree of the family. -/ 141 noncomputable def maxTreeSize {n : ℕ} (G : PartialGraph (Fin n)) (k q : ℕ) : ℕ := 142 Finset.univ.sup fun a : Fin n => wordLength (family G k q a) 143 144 end Lax185574.TypeTrees 145 -
Canonical form
A type tree given by a representation whose sets need not be sorted or duplicate-free can be brought into canonical form in polynomial time.
1 import Lax185574.Algorithms 2 … module docstring, 25 lines 28 29 namespace Lax185574.CanonicalForm 30 31 open Lax185574.Encoding Lax185574.Algorithms 32 33 /-- **Canonical form.** One algorithm turns a list of elements, given by 34 their encodings, into the finite set of its entries, in polynomial time. 35 It sorts the encodings and removes duplicates. -/ 36 axiom exists_program_canonical : 37 ∃ (A : Algorithm) (c a : ℕ), ∀ (α : Type) [Encode α] [DecidableEq α] (l : List α), 38 A.Computes c (l.map encode) l.toFinset (((encode (l.map encode)).length + 1) ^ a) 39 40 end Lax185574.CanonicalForm 41 -
no assumptions
The program reads the list of words into arrays, the entries one after the other with the start and the length of every word. It then selects the distinct words in increasing order: in round it scans all words and keeps the smallest one above the word selected in round , comparing words lexicographically entry by entry. The indices of the selected words are recorded, and finally their number and their frames are written. With words of total length , this takes steps, so cubic time in the length of the input. Every value the program produces is at most the length of the input plus its largest entry, so word-length exponent suffices.
The proof is carried out for the notion , and transferred to through .
-
Evaluation of distance formulas on type trees
Let φ(x̄) be a distFO formula of distance rank (k, q), G a partial graph and ā ∈ V(G)^ℓ with ℓ = |x̄| ≤ k. Then whether G ⊨ φ(ā) holds is decidable in polynomial time, given tree^G_{k,q}(ā) and φ.
For a type tree τ = tree^G_{k,q}(ā) one writes τ ⊨ φ if G ⊨ φ(ā). The lemma shows that this depends on τ only.
1 import Lax185574.TypeTrees 2 import Lax185574.Algorithms 3 … module docstring, 26 lines 30 31 namespace Lax185574.Evaluation 32 33 open Lax185574.Encoding Lax185574.Algorithms 34 open Lax185574.PartialGraphs Lax185574.DistanceLogic Lax185574.DistanceLogic.DistFO 35 open Lax185574.TypeTrees 36 37 /-- **Evaluation.** One algorithm decides, given `tree_{k,q}(u)` and a 38 formula `φ` of distance rank `(k, q)`, whether `u` satisfies `φ`, in 39 time polynomial in the size of the input. -/ 40 axiom exists_program_eval : 41 ∃ A : Algorithm, ∀ k q : ℕ, ∃ c a : ℕ, 42 ∀ (n : ℕ) (G : PartialGraph (Fin n)) (ℓ : ℕ) (u : Fin ℓ → Fin n) (φ : DistFO ℓ), 43 ℓ ≤ k → DRank k q φ → 44 A.Decides c (tree G k q u, φ) (Sat G u φ) 45 (((encode (tree G k q u)).length + (encode φ).length + 1) ^ a) 46 47 end Lax185574.Evaluation 48 -
no assumptions
The program reads the tree, copies the word of its root into an array, reads the code of the formula into a second array, and lists the nodes of the tree in breadth-first order. It fills a table with a row for every position of the code and a column for every node, from the last position to the first. At a position where a subformula starts, the entry of a node is the value of the subformula at the node: an atom is looked up among the atom codes of the node, a negation or a conjunction is read off the rows of its subformulas, and holds if some extension of the node with guard has a child where holds, read off the row of . A second table records where every subformula ends, which locates the second conjunct of a conjunction. This is the recursion of the proof of the evaluation lemma over pairs of a subformula and a node. The answer is the entry of the first position at the root, which is the semantic core , whose correctness is . A cell takes time linear in the length of the input, so the time is a polynomial of degree three. Every value is at most a constant times the square of the input length, so word-length exponent suffices.
The proof is carried out for the notion , and transferred to through .
-
Type trees are distance types
Fix ℓ ≤ k and q, a partial graph G and ā, b̄ ∈ V(G)^ℓ. Then tree_{k,q}(ā) = tree_{k,q}(b̄) if and only if G ⊨ φ(ā) ⇔ φ(b̄) for every distFO formula φ(x̄) of distance rank (k, q) with |x̄| = ℓ.
1 import Lax185574.TypeTrees 2 … module docstring, 14 lines 17 18 namespace Lax185574.TreeEquivalence 19 20 open Lax185574.PartialGraphs Lax185574.DistanceLogic Lax185574.DistanceLogic.DistFO 21 open Lax185574.TypeTrees 22 23 /-- **Type trees are distance types.** Two tuples have the same type 24 tree of rank `(k, q)` exactly when they satisfy the same formulas of 25 distance rank `(k, q)`. -/ 26 axiom tree_eq_iff {V : Type*} [Finite V] (G : PartialGraph V) (k q : ℕ) {ℓ : ℕ} 27 (hℓ : ℓ ≤ k) (a b : Fin ℓ → V) : 28 tree G k q a = tree G k q b ↔ 29 ∀ φ : DistFO ℓ, DRank k q φ → (Sat G a φ ↔ Sat G b φ) 30 31 end Lax185574.TreeEquivalence 32 -
The rightwards implication follows from the evaluation lemma: the evaluation program receives equal inputs for the two tuples, so it gives equal answers. The vertex type is renamed to for this. The converse is , by induction on .
-
Locality of type trees
Every node at depth j of tree_{k,q}(a) is tree_{k+j,q−j}(v̄) for some tuple v̄ from Ball_{ρ⁺(k,q)}(a), and every color mentioned in the root label of that node intersects this ball.
1 import Lax185574.TypeTrees 2 … module docstring, 22 lines 25 26 namespace Lax185574.TreeLocality 27 28 open Lax185574.PartialGraphs Lax185574.GaifmanGraph 29 open Lax185574.DistanceLogic Lax185574.DistanceLogic.DistFO Lax185574.TypeTrees 30 open Lax3.DistFO (rhoMinus rhoPlus) 31 32 /-- The atom mentions the color `Y`. -/ 33 def MentionsColor (Y : ℕ) {ℓ : ℕ} : DistFO ℓ → Prop 34 | .color Y' _ => Y' = Y 35 | .distColorLt _ Y' _ => Y' = Y 36 | _ => False 37 38 /-- **Locality of type trees.** A tuple reached from `v 0` by guarded 39 extensions lies in the ball of radius `ρ⁺(k, q)` around `v 0`, and so 40 does a vertex of every color mentioned in its atomic type. -/ 41 axiom ball_of_guarded {V : Type*} (G : PartialGraph V) (k q j : ℕ) (hj : j ≤ q) 42 (v : Fin (j + 1) → V) 43 (hv : ∀ i : Fin (j + 1), 0 < i.val → ∃ i' : Fin (j + 1), i'.val < i.val ∧ 44 WithinDist G.resolved (rhoPlus (k + i.val) (q - i.val)) (v i') (v i)) : 45 (∀ i, v i ∈ G.ball (rhoPlus k q) (v 0)) ∧ 46 ∀ φ ∈ atp G (k + j) (q - j) v, ∀ Y : ℕ, MentionsColor Y φ → 47 ∃ u ∈ G.ball (rhoPlus k q) (v 0), G.color u = Y 48 49 end Lax185574.TreeLocality 50 -
no assumptions
By induction along the tuple and the triangle inequality, the entry is within of . A color mentioned in a true atom of rank has a vertex within the radius of the atom, at most , of an entry. The horizon inequality bounds both distances by .
-
Ordered coordinate restriction of type trees
There is an operation ↾ on type trees such that for all k, q ∈ ℕ, partial graphs G, tuples w̄ ∈ V(G)^ℓ with ℓ ≤ k and ordered lists J of distinct positions in [ℓ],
tree_{k,q}(w̄) ↾ J = tree_{k,q}(w̄ ↾ J).
Given τ and J one can compute τ ↾ J in time polynomial in ‖τ‖.
1 import Lax185574.TypeTrees 2 import Lax185574.Algorithms 3 … module docstring, 25 lines 29 30 namespace Lax185574.Restriction 31 32 open Lax185574.Encoding Lax185574.Algorithms 33 open Lax185574.PartialGraphs Lax185574.TypeTrees 34 35 /-- **Ordered coordinate restriction.** One algorithm computes 36 `tree_{k,q}(u ↾ J)` from `tree_{k,q}(u)` and `J`, in time polynomial in 37 the size of the tree. -/ 38 axiom exists_program_restrict : 39 ∃ A : Algorithm, ∀ k q : ℕ, ∃ c a : ℕ, 40 ∀ (n : ℕ) (G : PartialGraph (Fin n)) (ℓ : ℕ) (u : Fin ℓ → Fin n) (J : List (Fin ℓ)), 41 ℓ ≤ k → J.Nodup → 42 A.Computes c (tree G k q u, J) (tree G k q (fun i => u (J.get i))) 43 (((encode (tree G k q u)).length + 1) ^ a) 44 45 end Lax185574.Restriction 46 -
The program is one pass over the tree followed by restoring canonical form, as in the proof of the restriction lemma. The pass reads the tree and , the latter into a table of the places of the positions, lists the nodes of the tree in breadth-first order, and writes for every node, from the last to the first, its transformed atoms and its transformed extensions. An atom is transformed by renaming its positions along , and dropped if a position lies outside . An extension is transformed by renaming its guard in the same way, and dropped if the guard lies outside , and its child is referred to by the indices of the jobs of the child. Positions beyond the arity , the new positions of the nodes below the root, are moved down by . Nothing is sorted in the pass. The canonical form is then restored from the leaves up by the program of the canonical form observation, called once for every set of the result (). The result is the semantic core along the partial inverse of , whose correctness is . The sets of the result are no larger than those of the input, so the time is polynomial in the length of the input.
The proof is carried out for the notion , and transferred to through .
-
Rank shift of type trees
There is a polynomial-time algorithm which maps tree_{k,q}(ā) to tree_{k+1,q−1}(ā) for all k ∈ ℕ, q ≥ 1, partial graphs G and nonempty ā ∈ V(G)^{≤k}.
1 import Lax185574.TypeTrees 2 import Lax185574.Algorithms 3 … module docstring, 18 lines 22 23 namespace Lax185574.RankShift 24 25 open Lax185574.Encoding Lax185574.Algorithms 26 open Lax185574.PartialGraphs Lax185574.TypeTrees 27 28 /-- **Rank shift.** One algorithm computes `tree_{k+1,q}(u)` from 29 `tree_{k,q+1}(u)` in polynomial time. -/ 30 axiom exists_program_shift : 31 ∃ A : Algorithm, ∀ k q : ℕ, ∃ c a : ℕ, 32 ∀ (n : ℕ) (G : PartialGraph (Fin n)) (ℓ : ℕ) (u : Fin ℓ → Fin n), 1 ≤ ℓ → ℓ ≤ k → 33 A.Computes c (tree G k (q + 1) u) (tree G (k + 1) q u) 34 (((encode (tree G k (q + 1) u)).length + 1) ^ a) 35 36 end Lax185574.RankShift 37 -
The program runs the glue program and the restriction program of the restriction lemma in the loop driver . In its first round the glue program reads the tree, finds the first extension with guard , which exists since , and asks for the restriction of its child to the first positions. In its second round it outputs the answer. The child is
tree_{k+1,q−1}(ā b)for a vertex , so the answer istree_{k+1,q−1}(ā), as in the proof of the rank shift lemma. Every run inside the driver is right at an admissible word length: the runs of the glue program because their values are polynomial in the input, the run of the restriction program because its query is admissible at the word length of its region. The constant absorbs the constant of the restriction program at rank , and the degree is that of the restriction program plus two.The proof is carried out for the notion , and transferred to through .
-
Far composition of type trees
There is an operation ∗ on type trees such that for all k, q ∈ ℕ, partial graphs G and nonempty tuples ā₁, ā₂ with |ā₁ ā₂| ≤ k and dist(ā₁, ā₂) > ρ⁻(k, q),
tree_{k,q}(ā₁) ∗ tree_{k,q}(ā₂) = tree_{k,q}(ā₁ ā₂).
Given τ₁ and τ₂ one can compute τ₁ ∗ τ₂ in time poly_{k,q}(‖τ₁‖ + ‖τ₂‖).
1 import Lax185574.TypeTrees 2 import Lax185574.Algorithms 3 … module docstring, 23 lines 27 28 namespace Lax185574.FarComposition 29 30 open Lax185574.Encoding Lax185574.Algorithms 31 open Lax185574.PartialGraphs Lax185574.GaifmanGraph Lax185574.TypeTrees 32 open Lax3.DistFO (rhoMinus rhoPlus) 33 34 /-- **Far composition.** One algorithm computes the type tree of the 35 concatenation of two far tuples from their type trees, in time 36 polynomial in their sizes. -/ 37 axiom exists_program_compose : 38 ∃ A : Algorithm, ∀ k q : ℕ, ∃ c a : ℕ, 39 ∀ (n : ℕ) (G : PartialGraph (Fin n)) (ℓ₁ ℓ₂ : ℕ) (u₁ : Fin ℓ₁ → Fin n) 40 (u₂ : Fin ℓ₂ → Fin n), 1 ≤ ℓ₁ → 1 ≤ ℓ₂ → ℓ₁ + ℓ₂ ≤ k → 41 (∀ i j, ¬ WithinDist G.resolved (rhoMinus k q) (u₁ i) (u₂ j)) → 42 A.Computes c (tree G k q u₁, tree G k q u₂) (tree G k q (Fin.append u₁ u₂)) 43 (((encode (tree G k q u₁)).length + (encode (tree G k q u₂)).length + 1) ^ a) 44 45 end Lax185574.FarComposition 46 -
The program runs a glue program and the three programs of the restriction lemma, the rank shift lemma and the canonical form observation in the loop driver. The glue program runs the recursion of the far composition with an explicit stack of frames: each round reads the stack and the answer to its last question, does one step of the recursion and asks the next question, a rank shift, a restriction or a canonical form, or writes the type tree of the concatenation. Before it halts, every round checks that the question is admissible for the program that answers it, that the round counter is small against the word length of its region, and that its output fits, so every halting run inside the driver is right.
The proof is carried out for the notion , and transferred to through .
-
Scatter types
Let G be a partial graph. A set S of vertices is r-scattered if all vertices of S have pairwise distance larger than r. Fix a linear order on V(G). For X ⊆ V(G) and r ∈ ℕ, S_r(X) is the inclusion-wise maximal r-scattered subset of X built by the greedy process that repeatedly adds the least available vertex.
The (k, q)-scatter type stp^G_{k,q} is the function with domain
{(r, tree_{k+i,q−i}(b)) | i ∈ [q], b ∈ V(G), r ∈ [9^{k+i} · ρ⁻(k+i, q−i)]}
given by stp^G_{k,q}(r, ν) = min(|S_r([ν]^G)|, k + q). For q = 0 the domain is empty. A scatter type is represented canonically as the sorted list of its triples (r, ν, stp_{k,q}(r, ν)), using the canonical representation of ν. Its size ‖stp_{k,q}‖ is the size of this list.
1 import Lax185574.TypeTrees 2 import Mathlib.Data.List.FinRange 3 … module docstring, 35 lines 39 40 namespace Lax185574.ScatterTypes 41 42 open Lax185574.PartialGraphs Lax185574.GaifmanGraph 43 open Lax185574.TypeTrees 44 open Lax3.DistFO (rhoMinus rhoPlus) 45 46 variable {n : ℕ} 47 48 /-- `S_r(X)`: the greedy maximal `r`-scattered subset of `X`, scanning 49 the vertices in increasing order. -/ 50 noncomputable def greedyScattered (G : PartialGraph (Fin n)) (r : ℕ) (X : Set (Fin n)) : 51 List (Fin n) := 52 open Classical in 53 (List.finRange n).foldl 54 (fun S v => if v ∈ X ∧ ∀ u ∈ S, ¬ WithinDist G.resolved r u v then S ++ [v] else S) [] 55 56 /-- The domain `domain(stp_{k,q})` of the scatter type. -/ 57 def domain (G : PartialGraph (Fin n)) (k q : ℕ) : Set (ℕ × TypeTree) := 58 {p | ∃ (i : ℕ) (b : Fin n), 1 ≤ i ∧ i ≤ q ∧ 1 ≤ p.1 ∧ 59 p.1 ≤ 9 ^ (k + i) * rhoMinus (k + i) (q - i) ∧ 60 p.2 = tree G (k + i) (q - i) ![b]} 61 62 /-- The value `min(|S_r([ν]^G)|, k + q)` at the pair `p = (r, ν)`. -/ 63 noncomputable def value (G : PartialGraph (Fin n)) (k q : ℕ) (p : ℕ × TypeTree) : ℕ := 64 min (greedyScattered G p.1 (realizations G p.2)).length (k + q) 65 66 /-- The graph `{(x, f x) | x ∈ D}` of a function on a finite domain. -/ 67 noncomputable def graphOn {α β : Type*} (D : Set α) (f : α → β) : Finset (α × β) := 68 finsetOf {p | p.1 ∈ D ∧ p.2 = f p.1} 69 70 /-- `stp^G_{k,q}`, as its graph: the pairs `((r, ν), stp(r, ν))` with 71 `(r, ν) ∈ domain(stp_{k,q})`. -/ 72 noncomputable def stp (G : PartialGraph (Fin n)) (k q : ℕ) : Finset ((ℕ × TypeTree) × ℕ) := 73 graphOn (domain G k q) (value G k q) 74 75 end Lax185574.ScatterTypes 76 -
Type trees and their canonical representation
Let G be a partial graph, k, q ∈ ℕ and ā a tuple of ℓ vertices. The atomic (k, q)-type atp_{k,q}(ā) is the set of atomic distFO formulas of distance rank (k, q) with free variables among x₁, …, x_ℓ that ā satisfies in G. The (k, q)-type tree of ā is
tree_{k,q}(ā) = (atp_{k,q}(ā), 𝓔_{k,q}(ā)),
where 𝓔_{k,0}(ā) = ∅ and, for q ≥ 1,
𝓔_{k,q}(ā) = {(i, tree_{k+1,q−1}(ā b)) | i ∈ [ℓ], b ∈ V(G), dist(aᵢ, b) ≤ ρ⁺(k+1, q−1)}.
The members of 𝓔_{k,q}(ā) are the extensions, and i is the guard of the extension. The number ℓ is the arity and (k, q) is the rank of the tree.
Type trees are represented on the RAM in a canonical form, with all sets sorted and free of duplicates, so that two trees are equal exactly when their representations are. The size ‖τ‖ of a tree is the size of its representation, which includes k, q and ℓ.
For a type tree ν of arity one, [ν]^G is the set of vertices b with tree_{k,q}(b) = ν, where (k, q) is the rank of ν.
1 import Lax185574.DistanceLogic 2 import Mathlib.Data.Fin.VecNotation 3 … module docstring, 61 lines 65 66 namespace Lax185574.TypeTrees 67 68 open Lax185574.PartialGraphs Lax185574.GaifmanGraph Lax185574.Encoding 69 open Lax185574.DistanceLogic Lax185574.DistanceLogic.DistFO 70 open Lax3.DistFO (rhoMinus rhoPlus) 71 72 /-- `Node q ℓ`: the roots of the type trees of depth `q` and arity `ℓ`. 73 A root of depth `0` is its set of atoms. A root of depth `q + 1` is its 74 set of atoms together with its set of extensions, pairs of a guard and 75 a root of depth `q` and arity `ℓ + 1`. -/ 76 def Node : ℕ → ℕ → Type 77 | 0, ℓ => Finset (DistFO ℓ) 78 | q + 1, ℓ => Finset (DistFO ℓ) × Finset (Fin ℓ × Node q (ℓ + 1)) 79 80 /-- A root of depth `0` is encoded by its set of atoms. A root of depth 81 `q + 1` is encoded by its set of atoms followed by its set of 82 extensions. `Node` is defined by recursion on the depth and is not an 83 inductive type, so its encoding is given by the same recursion. -/ 84 @[instance_reducible] def Node.instEncode : (q ℓ : ℕ) → Encode (Node q ℓ) 85 | 0, ℓ => inferInstanceAs (Encode (Finset (DistFO ℓ))) 86 | q + 1, ℓ => 87 letI := Node.instEncode q (ℓ + 1) 88 inferInstanceAs (Encode (Finset (DistFO ℓ) × Finset (Fin ℓ × Node q (ℓ + 1)))) 89 90 instance {q ℓ : ℕ} : Encode (Node q ℓ) := Node.instEncode q ℓ 91 92 /-- A type tree: its rank `(k, q)`, its arity `ℓ` and its root. -/ 93 structure TypeTree where 94 /-- The first component of the rank. -/ 95 k : ℕ 96 /-- The depth, the second component of the rank. -/ 97 q : ℕ 98 /-- The arity. -/ 99 ℓ : ℕ 100 /-- The root. -/ 101 root : Node q ℓ 102 deriving Encode 103 104 variable {V : Type*} 105 106 /-- The finite set with the elements of `S`, and `∅` if `S` is 107 infinite. -/ 108 noncomputable def finsetOf {α : Type*} (S : Set α) : Finset α := 109 open Classical in if h : S.Finite then h.toFinset else ∅ 110 111 /-- `atp_{k,q}(a)`: the atoms of distance rank `(k, q)` satisfied by the 112 tuple `a`. -/ 113 def atp (G : PartialGraph V) (k q : ℕ) {ℓ : ℕ} (a : Fin ℓ → V) : Set (DistFO ℓ) := 114 {φ | IsAtom φ ∧ DRank k q φ ∧ Sat G a φ} 115 116 /-- The root of `tree_{k,q}(a)`: the atoms of `atp_{k,q}(a)` and, for 117 `q ≥ 1`, the extensions `(i, tree_{k+1,q−1}(a b))`. -/ 118 noncomputable def node (G : PartialGraph V) : (k q : ℕ) → {ℓ : ℕ} → (Fin ℓ → V) → Node q ℓ 119 | k, 0, _, a => finsetOf (atp G k 0 a) 120 | k, q + 1, ℓ, a => 121 (finsetOf (atp G k (q + 1) a), 122 finsetOf {e | ∃ (i : Fin ℓ) (b : V), 123 WithinDist G.resolved (rhoPlus (k + 1) q) (a i) b ∧ 124 e = (i, node G (k + 1) q (Fin.snoc a b))}) 125 126 /-- `tree_{k,q}(a)`. -/ 127 noncomputable def tree (G : PartialGraph V) (k q : ℕ) {ℓ : ℕ} (a : Fin ℓ → V) : TypeTree := 128 ⟨k, q, ℓ, node G k q a⟩ 129 130 /-- `[ν]^G`: the vertices whose type tree is `ν`. The rank is read off 131 `ν`, which records it. -/ 132 def realizations (G : PartialGraph V) (ν : TypeTree) : Set V := 133 {b | tree G ν.k ν.q ![b] = ν} 134 135 /-- The family `(tree_{k,q}(a) : a ∈ V(G))` of the type trees of all 136 vertices. -/ 137 noncomputable def family {n : ℕ} (G : PartialGraph (Fin n)) (k q : ℕ) : Fin n → TypeTree := 138 fun a => tree G k q ![a] 139 140 /-- The largest size of a tree of the family. -/ 141 noncomputable def maxTreeSize {n : ℕ} (G : PartialGraph (Fin n)) (k q : ℕ) : ℕ := 142 Finset.univ.sup fun a : Fin n => wordLength (family G k q a) 143 144 end Lax185574.TypeTrees 145 -
Restriction of scatter types
For every partial graph G and q ≥ 1, the function stp_{k+1,q−1} is the restriction of stp_{k,q} to domain(stp_{k+1,q−1}).
1 import Lax185574.ScatterTypes 2 … module docstring, 14 lines 17 18 namespace Lax185574.ScatterTypeRestriction 19 20 open Lax185574.PartialGraphs Lax185574.ScatterTypes 21 22 /-- **Restriction of scatter types.** -/ 23 axiom stp_restrict {n : ℕ} (G : PartialGraph (Fin n)) (k q : ℕ) : 24 domain G (k + 1) q ⊆ domain G k (q + 1) ∧ 25 ∀ p ∈ domain G (k + 1) q, value G (k + 1) q p = value G k (q + 1) p 26 27 end Lax185574.ScatterTypeRestriction 28 -
no assumptions
Level of the domain is level of , since the ranks and the radius bounds coincide. The values agree because the caps and coincide and both use the same greedy scattered set.
-
Computing the scatter type
There is an algorithm which, given a nonempty partial graph G, numbers k ≥ 1 and q ∈ ℕ, its distance matrix D_G, and the family (tree_{k,q}(a) : a ∈ V(G)), computes stp^G_{k,q} in time
|G|² · poly_{k,q}(max_{a ∈ V(G)} ‖tree_{k,q}(a)‖).
1 import Lax185574.ScatterTypes 2 import Lax185574.DistanceMatrix 3 import Lax185574.Algorithms 4 … module docstring, 24 lines 29 30 namespace Lax185574.ComputeScatterType 31 32 open Lax185574.Encoding Lax185574.Algorithms 33 open Lax185574.PartialGraphs Lax185574.ScatterTypes Lax185574.TypeTrees 34 open Lax185574.DistanceMatrix 35 36 /-- **Computing the scatter type.** One algorithm computes `stp^G_{k,q}` 37 from `G`, `k`, `q`, the distance matrix `D_G` and the type trees of all 38 vertices, in time quadratic in `n` and polynomial in the largest size of 39 a tree. -/ 40 axiom exists_program_stp : 41 ∃ A : Algorithm, ∀ k q : ℕ, ∃ c a : ℕ, 42 ∀ (n : ℕ) (G : PartialGraph (Fin n)), 1 ≤ k → 1 ≤ n → 43 A.Computes c (G, k, q, distMatrix G, family G k q) (stp G k q) 44 (n ^ 2 * (maxTreeSize G k q + 1) ^ a) 45 46 end Lax185574.ComputeScatterType 47 -
The program runs the glue program and the program of the rank shift lemma in the loop driver , as in the proof of the lemma on computing scatter types. The first round reads the graph, and , skips the distance matrix and reads the family of type trees. For it outputs the empty scatter type. Otherwise the rounds ask for the shifts of the entries of the list of the family trees followed by the answers, one by one, so that the answers are the trees for and all vertices , in this order. After a dummy call the final round reads the graph, and the answers and computes the scatter type (). Its greedy scans test whether a vertex is within distance of a chosen vertex by one entry of the row of of the chosen vertex, in place of a breadth-first search. The script has calls. Every run inside the driver is right at an admissible word length: the runs of the glue program because their values are below a constant in times the cube of , the runs of the rank shift because their queries are admissible at the word lengths of their regions. The time is that of the first round, , and of the final round, , plus middle rounds of time and calls of time .
The proof is carried out for the notion , and transferred to through .
-
The far tree
For a partial graph G, k ∈ ℕ, q ≥ 1 and a nonempty tuple ā of at most k vertices,
ftree_{k,q}(ā) = {tree_{k+1,q−1}(b) | b ∈ V(G), dist(ā, b) > ρ⁻(k+1, q−1)}.
It is the set of type trees of the vertices far from ā.
1 import Lax185574.TypeTrees 2 … module docstring, 18 lines 21 22 namespace Lax185574.FarTrees 23 24 open Lax185574.PartialGraphs Lax185574.GaifmanGraph 25 open Lax185574.TypeTrees 26 open Lax3.DistFO (rhoMinus rhoPlus) 27 28 variable {V : Type*} 29 30 /-- `ftree_{k,q}(a)`: the type trees of the vertices far from `a`. -/ 31 noncomputable def ftree (G : PartialGraph V) (k q : ℕ) {ℓ : ℕ} (a : Fin ℓ → V) : 32 Finset TypeTree := 33 finsetOf {ν | ∃ b : V, 34 (∀ i, ¬ WithinDist G.resolved (rhoMinus (k + 1) (q - 1)) (a i) b) ∧ 35 ν = tree G (k + 1) (q - 1) ![b]} 36 37 end Lax185574.FarTrees 38 -
no assumptions
The existence of an admissible pair is the grouping iteration: start with all indices surviving at scale , and while two surviving entries are within eight times the scale, drop one of them and multiply the scale by nine. At the end, entries of one group are within twice the scale , hence within , and entries of different groups are farther apart than .
For the detection property, if every vertex of is near the tuple, then the vertices of lie in distinct blocks, by the scattering of . Conversely, if some vertex of is far from the tuple and no vertex of is at a distance between and , then the blocks met by inject into minus the representative of .
-
Clustering of a tuple
Let r ∈ ℕ, ℓ ≥ 1, G a graph and ā = (a₁, …, a_ℓ) ∈ V(G)^ℓ. There exist a radius ρ with r ≤ ρ ≤ 9^{ℓ−1} r and a partition 𝓑 of {a₁, …, a_ℓ} with the following property. For every X ⊆ V(G), every inclusion-wise maximal 4ρ-scattered subset S ⊆ X, and every H ≥ 4ρ + r,
∃x ∈ X: dist(x, ā) > r ⟺ ∃x ∈ X: r < dist(x, ā) ≤ H, or |{B ∈ 𝓑 | ∃x ∈ X: dist(x, B) ≤ r}| < |S|.
Moreover, ρ and 𝓑 can be determined by tests of the form dist(aᵢ, aⱼ) ≤ s, where i, j ∈ [ℓ] and s ≤ 8 · 9^{ℓ−1} r.
1 import Lax185574.GaifmanGraph 2 import Mathlib.Data.Set.Card 3 … module docstring, 38 lines 42 43 namespace Lax185574.Clustering 44 45 open Lax185574.GaifmanGraph 46 47 variable {V : Type*} 48 49 /-- The radius `ρ` and the partition `β` of the positions are 50 admissible for `a` at radius `r`: entries in one block are within 51 distance `4ρ − 2r`, and entries in different blocks are not within 52 distance `4ρ + 2r`. -/ 53 def Admissible (G : SimpleGraph V) (r : ℕ) {ℓ : ℕ} (a : Fin ℓ → V) (ρ : ℕ) 54 (β : Fin ℓ → Fin ℓ) : Prop := 55 ∀ i j, (β i = β j → WithinDist G (4 * ρ - 2 * r) (a i) (a j)) ∧ 56 (β i ≠ β j → ¬ WithinDist G (4 * ρ + 2 * r) (a i) (a j)) 57 58 /-- **Clustering.** Some admissible radius lies between `r` and 59 `9^(ℓ−1) r`, and every admissible pair detects the vertices of a set `X` 60 far from `a`: by vertices at bounded distance, or by counting a maximal 61 scattered subset of `X`. -/ 62 axiom clustering [Finite V] (G : SimpleGraph V) (r ℓ : ℕ) (hℓ : 1 ≤ ℓ) (a : Fin ℓ → V) : 63 (∃ ρ β, r ≤ ρ ∧ ρ ≤ 9 ^ (ℓ - 1) * r ∧ Admissible G r a ρ β) ∧ 64 ∀ ρ β, r ≤ ρ → Admissible G r a ρ β → 65 ∀ (X S : Set V) (H : ℕ), S ⊆ X → 66 (∀ x ∈ S, ∀ y ∈ S, x ≠ y → ¬ WithinDist G (4 * ρ) x y) → 67 (∀ x ∈ X, ∃ y ∈ S, WithinDist G (4 * ρ) x y) → 68 4 * ρ + r ≤ H → 69 ((∃ x ∈ X, ∀ i, ¬ WithinDist G r (a i) x) ↔ 70 (∃ x ∈ X, (∀ i, ¬ WithinDist G r (a i) x) ∧ ∃ i, WithinDist G H (a i) x) ∨ 71 (β '' {i | ∃ x ∈ X, WithinDist G r (a i) x}).ncard < S.ncard) 72 73 end Lax185574.Clustering 74 -
Computing the far tree
Fix k ∈ ℕ and q ≥ 1, let G be a partial graph, and let ā ∈ V(G)^{≤k} be nonempty. Then ftree_{k,q}(ā) is computable from tree_{k,q}(ā) and stp_{k,q} in time
‖stp_{k,q}‖ · poly_{k,q}(‖tree_{k,q}(ā)‖).
1 import Lax185574.ScatterTypes 2 import Lax185574.FarTrees 3 import Lax185574.Algorithms 4 … module docstring, 20 lines 25 26 namespace Lax185574.ToFarTree 27 28 open Lax185574.Encoding Lax185574.Algorithms 29 open Lax185574.PartialGraphs Lax185574.TypeTrees Lax185574.ScatterTypes Lax185574.FarTrees 30 31 /-- **Computing the far tree.** One algorithm computes `ftree_{k,q}(u)` 32 from `tree_{k,q}(u)` and `stp_{k,q}`, in time linear in the size of the 33 scatter type and polynomial in the size of the tree. -/ 34 axiom exists_program_ftree : 35 ∃ A : Algorithm, ∀ k q : ℕ, ∃ c a : ℕ, 36 ∀ (n : ℕ) (G : PartialGraph (Fin n)) (ℓ : ℕ) (u : Fin ℓ → Fin n), 1 ≤ ℓ → ℓ ≤ k → 37 A.Computes c (tree G k (q + 1) u, stp G k (q + 1)) (ftree G k (q + 1) u) 38 (((encode (stp G k (q + 1))).length + 1) * 39 ((encode (tree G k (q + 1) u)).length + 1) ^ a) 40 41 end Lax185574.ToFarTree 42 -
The program runs the glue program and the restriction program of the restriction lemma in the loop driver . Round of the glue program reads the tree, the scatter type and the answers so far, and asks for the restriction of the child of extension to its last position, one call per extension. The last round reads the radius and the blocks off the root, the met and far bits off the roots of the children, scans the scatter type and writes the selected trees, as in the proof of the far tree lemma. Its output is the far tree by , which applies the clustering lemma. Every run inside the driver is right at an admissible word length: the runs of the glue program because their values are polynomial in the input with a factor depending on the rank, the runs of the restriction program because their queries are admissible at the word lengths of their regions.
The proof is carried out for the notion , and transferred to through .
-
Lifting type trees through a merge
Fix ℓ ≤ k and q ∈ ℕ. Let G be a partial graph and ā ∈ V(G)^ℓ. Given tree^G_{k,q}(ā) and two distinct colors P, Q, one can compute tree^H_{k,q}(ā), where H = merge_{P,Q}(G), in time poly_{k,q}(‖tree^G_{k,q}(ā)‖).
1 import Lax185574.TypeTrees 2 import Lax185574.ConstructionSequences 3 import Lax185574.Algorithms 4 … module docstring, 19 lines 24 25 namespace Lax185574.MergeLift 26 27 open Lax185574.Encoding Lax185574.Algorithms 28 open Lax185574.PartialGraphs Lax185574.TypeTrees Lax185574.ConstructionSequences 29 30 /-- **Merge lift.** One algorithm computes the type tree of a tuple 31 after a merge from its type tree before, in time polynomial in the size 32 of the tree. -/ 33 axiom exists_program_mergeLift : 34 ∃ A : Algorithm, ∀ k q : ℕ, ∃ c a : ℕ, 35 ∀ (n : ℕ) (G : PartialGraph (Fin n)) (ℓ : ℕ) (u : Fin ℓ → Fin n) (P Q : ℕ), 36 ℓ ≤ k → P ≠ Q → 37 A.Computes c (tree G k q u, P, Q) (tree (merge G P Q) k q u) 38 (((encode (tree G k q u)).length + 1) ^ a) 39 40 end Lax185574.MergeLift 41 -
The program is one pass over the tree followed by restoring canonical form, as in the proof of the merge lift lemma. The pass reads the tree and the colors and , lists the nodes of the tree in breadth-first order, and writes for every node, from the last to the first, its transformed atoms and its extensions. An atom is transformed by replacing the color by in every atom and . The guards are kept, and the child of an extension is referred to by the indices of the jobs of the child. Nothing is sorted in the pass. The canonical form is then restored from the leaves up by the program of the canonical form observation, called once for every set of the result (), which merges atoms that become equal. This is the semantic core , whose correctness is . No tree grows, so the time is polynomial in the length of the input.
The proof is carried out for the notion , and transferred to through .
-
Lifting type trees through a resolve
Let k ≥ 1 and q ∈ ℕ. Given a partial graph G, its distance matrix D_G, colors P, Q, a sign ±, and (tree^G_{k,q}(a) : a ∈ V(G)), one can compute H = resolve^±{P,Q}(G), its distance matrix D_H, and (tree^H{k,q}(a) : a ∈ V(G)) in time
|G|² · poly_{k,q}(M + T),
where
M = max_{a ∈ V(G)} ‖tree^G_{k,q}(a)‖, T = max_{a ∈ V(G)} |{tree^G_{k+i,q−i}(v̄) | 0 ≤ i ≤ q, ℓ ∈ [k+i], v̄ ∈ (Ball^H_{ρ⁺(k,q)}(a))^ℓ}|.
Each output tree has size poly_{k,q}(T).
1 import Lax185574.TypeTrees 2 import Lax185574.ConstructionSequences 3 import Lax185574.DistanceMatrix 4 import Lax185574.Algorithms 5 … module docstring, 34 lines 40 41 namespace Lax185574.ResolveLift 42 43 open Lax185574.Encoding Lax185574.Algorithms 44 open Lax185574.PartialGraphs Lax185574.TypeTrees Lax185574.ConstructionSequences 45 open Lax185574.DistanceMatrix 46 open Lax3.DistFO (rhoMinus rhoPlus) 47 48 variable {n : ℕ} 49 50 /-- `resolve^±_{P,Q}(G)`, positive for `true`. -/ 51 def resolveBy (G : PartialGraph (Fin n)) (s : Bool) (P Q : ℕ) : PartialGraph (Fin n) := 52 if s then resolvePos G P Q else resolveNeg G P Q 53 54 /-- The parameter `T`: the largest number of type trees in `G` of 55 tuples from a ball of radius `ρ⁺(k, q)` in `H`, over all ranks 56 `(k+i, q−i)` and arities `ℓ ∈ [k+i]`. -/ 57 noncomputable def treeCount (G H : PartialGraph (Fin n)) (k q : ℕ) : ℕ := 58 Finset.univ.sup fun a : Fin n => 59 Set.ncard {τ : TypeTree | ∃ (i ℓ : ℕ) (v : Fin ℓ → Fin n), i ≤ q ∧ 1 ≤ ℓ ∧ ℓ ≤ k + i ∧ 60 (∀ j, v j ∈ H.ball (rhoPlus k q) a) ∧ τ = tree G (k + i) (q - i) v} 61 62 /-- **Resolve lift.** One algorithm computes the partial graph `H` after 63 a resolve, its distance matrix and the type trees of all vertices in it, 64 from the partial graph `G` before, its distance matrix, `P`, `Q`, the 65 sign and its type trees, in time `O(n² · (M + T + 1)^a)`. Each new tree 66 has size `O((T + 1)^a)`. -/ 67 axiom exists_program_resolveLift : 68 ∃ A : Algorithm, ∀ k q : ℕ, ∃ c a : ℕ, 69 ∀ (n : ℕ) (G : PartialGraph (Fin n)) (P Q : ℕ) (s : Bool), 1 ≤ k → 70 let H := resolveBy G s P Q 71 let T := treeCount G H k q 72 A.Computes c (G, distMatrix G, P, Q, s, family G k q) (H, distMatrix H, family H k q) 73 (n ^ 2 * (maxTreeSize G k q + T + 1) ^ a) ∧ 74 ∀ b : Fin n, (encode (tree H k q ![b])).length ≤ c * (T + 1) ^ a 75 76 end Lax185574.ResolveLift 77 -
The program is the loop driver of the glue program of the resolve lift with the switch of its five callees: the rank shift (the rank shift lemma), the far tree (the far tree lemma), the far composition (the far composition lemma), the canonical form (the canonical form observation) and the scatter type (the lemma on computing scatter types). The glue program first computes the scatter type of the input, then walks down the levels of the items, asking for the shift, the far tree and the compositions of each item, and walks up again, asking for the canonical forms of the atoms and of the children of each item. Its last round builds the resolved graph and its distance matrix, by the formula for distances after a resolve, and writes the output. Every round runs within a constant times steps, with , except the first two and the last round, which read the input or write the output and run within a constant times steps. With at most a constant times rounds, the total time of the glue program is within the bound. The sizes of the output trees are those of the type trees of the resolved graph.
The proof is carried out for the notion , and transferred to through .
-
Type tree sizes
Let k ≥ 1 and q ∈ ℕ, and put r = ρ⁺(k, q) and d = r + k + q. The following holds for every partial graph G.
- |{tree^G_{k+i,q−i}(v̄) | v̄ ∈ X^ℓ}| ≤ |Types^G_{d,d}(X)| for all i ∈ {0, …, q}, ℓ ∈ [k+i] and X ⊆ V(G).
- ‖tree^G_{k,q}(a)‖ ≤ poly_{k,q}(|Types^G_{d,d}(Ball^G_r(a))|) for every a ∈ V(G).
1 import Lax185574.TypeTrees 2 import Lax185574.Width 3 … module docstring, 20 lines 24 25 namespace Lax185574.TypeTreeSizes 26 27 open Lax185574.PartialGraphs Lax185574.Encoding Lax185574.TypeTrees Lax185574.Width 28 open Lax3.DistFO (rhoMinus rhoPlus) 29 30 /-- **Type tree sizes, counting.** The number of type trees of tuples 31 from `X` is at most the number of `d`-types of `d`-tuples from `X`. -/ 32 axiom treeCount_le {n : ℕ} (G : PartialGraph (Fin n)) (k q : ℕ) (hk : 1 ≤ k) 33 (i ℓ : ℕ) (hi : i ≤ q) (hℓ : 1 ≤ ℓ) (hℓk : ℓ ≤ k + i) (X : Set (Fin n)) : 34 Set.ncard {τ : TypeTree | ∃ v : Fin ℓ → Fin n, (∀ j, v j ∈ X) ∧ τ = tree G (k + i) (q - i) v} ≤ 35 partialTypeCount G (rhoPlus k q + k + q) (rhoPlus k q + k + q) X 36 37 /-- **Type tree sizes, size.** The size of the type tree of a vertex is 38 polynomial in the number of `d`-types of `d`-tuples from its ball. -/ 39 axiom tree_length_le (k q : ℕ) (hk : 1 ≤ k) : 40 ∃ c a : ℕ, ∀ (n : ℕ) (G : PartialGraph (Fin n)) (v : Fin n), 41 wordLength (tree G k q ![v]) ≤ 42 c * (partialTypeCount G (rhoPlus k q + k + q) (rhoPlus k q + k + q) 43 (G.ball (rhoPlus k q) v) + 1) ^ a 44 45 end Lax185574.TypeTreeSizes 46 -
A tuple is padded to a -tuple by repeating its last entry. The type of quantifier rank of the padded tuple determines the type of of quantifier rank , which determines by , since . So the type trees are the image of a function on .
-
Put . By the locality lemma, every node of is the tree of a tuple from the ball, and every color in a true atom of its root meets the ball. There are at most such colors and at most trees per rank and arity by part (i). So every root has atoms, every node has at most children, and the depth is . This gives the bound , where depends on and only.
-
Two threads run in parallel at a word length a constant below the given one. The first thread removes the graph from the input and runs a loop that alternates a glue program with a callee. The glue program follows the construction sequence step by step. It keeps the current partial graph with its matrix of distances and the type trees of all vertices, and issues one call per step and finally one call of the evaluation on the tree of a vertex and the localized sentence. For a merge step the callee maps the merge lift over the trees of all vertices, for a resolve step it runs the resolve lift, which also returns the new matrix of distances. Each query is guarded for the word length of its callee, so every halting run of the pipeline is right, and the pipeline halts within steps when the input is long enough. The second thread evaluates the sentence by brute force, which is fast for short inputs and for graphs without vertices. The combinator outputs the answer of a thread that halts.
The proof is carried out for the input format with the graph in compressed sparse row form and the notion , with a time bound that holds for every bound on the width. The algorithm converts the word of the graph into compressed sparse rows () and runs the program for that format with the width itself as the bound. The conversion takes time linear in the length of the input, which is for a fixed sentence.
-
Partial graphs
A partial graph H consists of a finite vertex set V = V(H), two disjoint sets E(H), N(H) ⊆ (V choose 2) of edges and non-edges, and a partition of V whose parts are treated as colors. The pairs in R(H) = E(H) ∪ N(H) are resolved, and all other pairs are unresolved. H is viewed as a logical structure with binary relations E and N and a unary predicate for every color. Distances dist^H and balls Ball^H_r(v) are measured in the Gaifman graph (V, R(H)), the graph of resolved pairs.
For the model-checking algorithm, the parts are given names, to track them over time. Fix a countably infinite set of unary symbols, called colors. A partial graph G is regarded as a relational structure with the two symmetric binary relations E and N and a unary relation Y for every color Y. The vertices of color Y form its color class Y^G, and the nonempty color classes are the parts of G. The size of the representation of G is given by |G| = |V(G)| and ‖G‖ = |V(G)| + |R(G)|.
1 import Lax185574.GaifmanGraph 2 import Lax185574.Encodings 3 import Mathlib.Combinatorics.SimpleGraph.Basic 4 import Mathlib.Data.Set.Card 5 … module docstring, 54 lines 60 61 namespace Lax185574.PartialGraphs 62 63 open FirstOrder FirstOrder.Language 64 open Lax185574.GaifmanGraph 65 66 universe z 67 68 /-- A partial graph on the vertex type `V`: disjoint edges and 69 non-edges, and one color per vertex. -/ 70 structure PartialGraph (V : Type z) where 71 /-- The edges `E(G)`. -/ 72 edge : SimpleGraph V 73 /-- The non-edges `N(G)`. -/ 74 nonEdge : SimpleGraph V 75 /-- No pair is both an edge and a non-edge. -/ 76 disjoint : Disjoint edge nonEdge 77 /-- The color of each vertex. -/ 78 color : V → ℕ 79 80 variable {V : Type z} 81 82 namespace PartialGraph 83 84 /-- The resolved pairs `R(G) = E(G) ∪ N(G)`, the Gaifman graph of the 85 partial graph. -/ 86 def resolved (G : PartialGraph V) : SimpleGraph V := G.edge ⊔ G.nonEdge 87 88 /-- `Ball^G_r(v)`: the vertices within distance `r` of `v` along 89 resolved pairs. -/ 90 def ball (G : PartialGraph V) (r : ℕ) (v : V) : Set V := 91 {u | WithinDist G.resolved r v u} 92 93 /-- The color class `Y^G`. -/ 94 def colorClass (G : PartialGraph V) (Y : ℕ) : Set V := {v | G.color v = Y} 95 96 /-- The size `‖G‖ = |V(G)| + |R(G)|` of a partial graph on `Fin n`. -/ 97 noncomputable def size {n : ℕ} (G : PartialGraph (Fin n)) : ℕ := 98 n + Set.ncard G.resolved.edgeSet 99 100 end PartialGraph 101 102 /-- The relation symbols of partial graphs: edges, non-edges and one 103 unary symbol per color. -/ 104 inductive Rel : ℕ → Type 105 | edge : Rel 2 106 | nonEdge : Rel 2 107 | color (Y : ℕ) : Rel 1 108 109 /-- The language of partial graphs. -/ 110 def language : Language := 111 ⟨fun _ => Empty, Rel⟩ 112 deriving Language.IsRelational 113 114 /-- A partial graph as a relational structure. -/ 115 @[implicit_reducible] 116 def PartialGraph.structure (G : PartialGraph V) : language.Structure V where 117 funMap f := isEmptyElim f 118 RelMap 119 | .edge => fun x => G.edge.Adj (x 0) (x 1) 120 | .nonEdge => fun x => G.nonEdge.Adj (x 0) (x 1) 121 | .color Y => fun x => G.color (x 0) = Y 122 123 open Lax185574.Encoding in 124 /-- A partial graph on `Fin n` is encoded by the family of its colors, 125 then its edges and then its non-edges, each graph as in 126 `Lax185574.Encodings`. So the encoding is `n` and the `n` colors, then 127 `n` and for every vertex in order the set of its neighbors along edges, 128 then `n` and for every vertex the set of its neighbors along non-edges. 129 It is determined by the partial graph and has length O(‖G‖). Running 130 times are stated in terms of ‖G‖, which is only meaningful for an 131 encoding without padding. The edges and non-edges are relations, so the 132 encoding is not derived. -/ 133 noncomputable instance {n : ℕ} : Encode (PartialGraph (Fin n)) where 134 encode G := encode (G.color, G.edge, G.nonEdge) 135 136 end Lax185574.PartialGraphs 137 -
Construction sequences
For colors P, Q and a partial graph G, the partial graphs merge_{P,Q}(G) (for P ≠ Q), resolve⁺{P,Q}(G) and resolve⁻{P,Q}(G) are obtained from G by leaving everything unchanged, apart from the following:
- merge_{P,Q}(G): P^H = P^G ∪ Q^G and Q^H = ∅, for P ≠ Q;
- resolve⁺_{P,Q}(G): E(H) = E(G) ∪ (P^G Q^G ∖ N(G));
- resolve⁻_{P,Q}(G): N(H) = N(G) ∪ (P^G Q^G ∖ E(G)).
Here P^G Q^G is the set of pairs xy of distinct vertices with x ∈ P^G and y ∈ Q^G. After either resolve, every pair in P^G Q^G is resolved.
An initial partial graph has no resolved pairs, and every part is a singleton. A construction sequence of a graph G = (V, E) is a sequence G₁, …, G_λ of partial graphs with vertex set V such that G₁ is initial, every step is one merge or one resolve, and G_λ has a single part, E(G_λ) = E and N(G_λ) = (V choose 2) ∖ E.
1 import Lax185574.PartialGraphs 2 … module docstring, 52 lines 55 56 namespace Lax185574.ConstructionSequences 57 58 open Lax185574.PartialGraphs 59 60 universe z 61 62 variable {V : Type z} 63 64 /-- The pairs `P^G Q^G`: distinct vertices, one of color `P` and the 65 other of color `Q`. -/ 66 def between (G : PartialGraph V) (P Q : ℕ) : SimpleGraph V := 67 SimpleGraph.fromRel fun x y => G.color x = P ∧ G.color y = Q 68 69 /-- `merge_{P,Q}(G)`: the vertices of color `Q` get color `P`. -/ 70 def merge (G : PartialGraph V) (P Q : ℕ) : PartialGraph V := 71 { G with color := fun v => if G.color v = Q then P else G.color v } 72 73 /-- `resolve⁺_{P,Q}(G)`: the unresolved pairs in `P^G Q^G` become 74 edges. -/ 75 def resolvePos (G : PartialGraph V) (P Q : ℕ) : PartialGraph V where 76 edge := G.edge ⊔ (between G P Q \ G.nonEdge) 77 nonEdge := G.nonEdge 78 disjoint := disjoint_sup_left.2 ⟨G.disjoint, disjoint_sdiff_self_left⟩ 79 color := G.color 80 81 /-- `resolve⁻_{P,Q}(G)`: the unresolved pairs in `P^G Q^G` become 82 non-edges. -/ 83 def resolveNeg (G : PartialGraph V) (P Q : ℕ) : PartialGraph V where 84 edge := G.edge 85 nonEdge := G.nonEdge ⊔ (between G P Q \ G.edge) 86 disjoint := disjoint_sup_right.2 ⟨G.disjoint, disjoint_sdiff_self_right⟩ 87 color := G.color 88 89 /-- An initial partial graph: no resolved pairs, and every part is a 90 singleton. -/ 91 def IsInitial (G : PartialGraph V) : Prop := 92 G.edge = ⊥ ∧ G.nonEdge = ⊥ ∧ Function.Injective G.color 93 94 /-- `H` is obtained from `G` by one merge or one resolve. -/ 95 def IsStep (G H : PartialGraph V) : Prop := 96 ∃ P Q : ℕ, (P ≠ Q ∧ H = merge G P Q) ∨ H = resolvePos G P Q ∨ 97 H = resolveNeg G P Q 98 99 /-- `s` is a construction sequence of the graph `G`: it starts with an 100 initial partial graph, each entry is obtained from the previous one by 101 one merge or one resolve, and the last entry has a single part, the 102 edges of `G` as edges and the non-edges of `G` as non-edges. -/ 103 def IsConstructionSequence (G : SimpleGraph V) (s : List (PartialGraph V)) : 104 Prop := 105 ∃ h : s ≠ [], 106 IsInitial (s.head h) ∧ 107 (∀ (t : ℕ) (ht : t + 1 < s.length), IsStep s[t] s[t + 1]) ∧ 108 (∀ u v : V, (s.getLast h).color u = (s.getLast h).color v) ∧ 109 (s.getLast h).edge = G ∧ (s.getLast h).nonEdge = Gᶜ 110 111 open Lax185574.Encoding 112 113 /-- One step of a construction sequence. -/ 114 inductive Step 115 /-- `merge_{P,Q}`. -/ 116 | merge (P Q : ℕ) 117 /-- `resolve⁺_{P,Q}`. -/ 118 | resolvePos (P Q : ℕ) 119 /-- `resolve⁻_{P,Q}`. -/ 120 | resolveNeg (P Q : ℕ) 121 deriving Encode 122 123 /-- The partial graph obtained by applying a step. -/ 124 def apply (G : PartialGraph V) : Step → PartialGraph V 125 | .merge P Q => merge G P Q 126 | .resolvePos P Q => resolvePos G P Q 127 | .resolveNeg P Q => resolveNeg G P Q 128 129 /-- The partial graph with no resolved pairs and the given colors. -/ 130 def unresolved (color : V → ℕ) : PartialGraph V where 131 edge := ⊥ 132 nonEdge := ⊥ 133 disjoint := disjoint_bot_left 134 color := color 135 136 /-- A construction script on `Fin n`: the colors of the initial partial 137 graph, which has no resolved pairs, and the steps. -/ 138 structure Script (n : ℕ) where 139 /-- The colors of the initial partial graph. -/ 140 colors : Fin n → ℕ 141 /-- The steps, in order. -/ 142 steps : List Step 143 deriving Encode 144 145 /-- The sequence produced by a script: the initial partial graph 146 followed by the results of the steps. -/ 147 def Script.run {n : ℕ} (σ : Script n) : List (PartialGraph (Fin n)) := 148 σ.steps.scanl apply (unresolved σ.colors) 149 150 /-- Every number in the encoding of the script `σ` is at most the 151 length of the encoding plus `n`. This holds when the colors of the 152 initial partial graph and of the steps are vertices. It lets an 153 algorithm pass the script on to another one, whose word length depends 154 on the numbers of its input. -/ 155 def Script.HasSmallNumbers {n : ℕ} (σ : Script n) : Prop := 156 ∀ v ∈ encode σ, v ≤ (encode σ).length + n 157 158 /-- The list `y` encodes the sequence `s` of partial graphs on `n` 159 vertices: it is the encoding of a script that produces `s`. -/ 160 def EncodesSequence {n : ℕ} (y : List ℕ) (s : List (PartialGraph (Fin n))) : 161 Prop := 162 ∃ σ : Script n, y = encode σ ∧ s = σ.run 163 164 end Lax185574.ConstructionSequences 165 -
Radius-r width of a construction sequence
Partial graphs, construction sequences and their radius-r width are defined in the technical overview of the paper. A construction sequence of a graph G with vertex set V is a sequence G₁, …, G_λ of partial graphs with vertex set V. Its radius-r width is the maximum, over all t ∈ [λ] and v ∈ V, of the number of parts of G_t that intersect Ball^{G_t}_r(v). The ball is taken in the Gaifman graph (V, R(G_t)) of G_t, whose edges are the resolved pairs E(G_t) ∪ N(G_t). The radius-r merge-width of G is the minimum radius-r width over all construction sequences of G.
For a partial graph H with partition 𝒫 and a set W ⊆ V(H), the induced partial graph H[W] has vertex set W, edges E(H) ∩ (W choose 2), non-edges N(H) ∩ (W choose 2), and partition { P ∩ W : P ∈ 𝒫 } ∖ {∅}.
1 import Lax185574.PartialGraphs 2 import Mathlib.Order.Lattice.Nat 3 … module docstring, 39 lines 43 44 namespace Lax185574.ConstructionWidth 45 46 open Lax185574.PartialGraphs 47 48 universe z 49 50 variable {V : Type z} 51 52 /-- The radius-`r` width of the sequence `s`: the largest number of 53 parts of `s[t]` that meet a ball of radius `r` in the resolved pairs of 54 `s[t]`. -/ 55 noncomputable def constructionWidth (r : ℕ) (s : List (PartialGraph V)) : ℕ := 56 sSup {K | ∃ (t : ℕ) (ht : t < s.length) (v : V), 57 K = ((s[t]).color '' (s[t]).ball r v).ncard} 58 59 end Lax185574.ConstructionWidth 60 -
The statement for graphs, graph classes and , from the version for simple graphs applied to the class of the simple graphs of the members. The algorithm is the program with its exponent, the sequence of a graph is that of its simple graph, and the constant becomes , so that bounds the time .
-
Polynomial bound on the number of types over a parameter set
Let 𝒞 be a monadically dependent graph class and k, q, c ∈ ℕ. For every graph G ∈ 𝒞, every expansion G⁺ of G by c unary predicates and every subset U ⊆ V(G),
|Types^{G⁺}{k,q}(V(G)/U)| ≤ O{𝒞,q,k,c}(1) · poly_{𝒞,q,k}(|U|).
The degree of the polynomial does not depend on the number c of unary predicates. Only the constant factor does.
1 import Lax185574.Colorings 2 import Lax185574.FirstOrderTypes 3 import Lax185574.MonadicDependence 4 … module docstring, 24 lines 29 30 namespace Lax185574.TypeBound 31 32 open Lax185574.Graphs Lax185574.MonadicDependence 33 open Lax185574.FirstOrderTypes Lax185574.Colorings 34 35 /-- **Type bound.** In a monadically dependent class, the number of 36 types of quantifier rank `q` of `k`-tuples over a parameter set `U`, in 37 an expansion by `c` unary predicates, is at most `F · (|U| + 1)^a`. The 38 exponent `a` does not depend on `c`. -/ 39 axiom typeCountOver_le (C : GraphClass) (hC : MonadicallyDependent C) 40 (k q : ℕ) : 41 ∃ a : ℕ, ∀ c : ℕ, ∃ F : ℕ, ∀ G ∈ C, 42 ∀ (colors : Fin c → Set (Fin G.n)) (U : Finset (Fin G.n)), 43 typeCountOver (expansion G.toSimpleGraph colors) k q Set.univ (U : Set (Fin G.n)) ≤ 44 F * (U.card + 1) ^ a 45 46 end Lax185574.TypeBound 47 -
Type tree sizes
Let k ≥ 1 and q ∈ ℕ, and put r = ρ⁺(k, q) and d = r + k + q. The following holds for every partial graph G.
- |{tree^G_{k+i,q−i}(v̄) | v̄ ∈ X^ℓ}| ≤ |Types^G_{d,d}(X)| for all i ∈ {0, …, q}, ℓ ∈ [k+i] and X ⊆ V(G).
- ‖tree^G_{k,q}(a)‖ ≤ poly_{k,q}(|Types^G_{d,d}(Ball^G_r(a))|) for every a ∈ V(G).
1 import Lax185574.TypeTrees 2 import Lax185574.Width 3 … module docstring, 20 lines 24 25 namespace Lax185574.TypeTreeSizes 26 27 open Lax185574.PartialGraphs Lax185574.Encoding Lax185574.TypeTrees Lax185574.Width 28 open Lax3.DistFO (rhoMinus rhoPlus) 29 30 /-- **Type tree sizes, counting.** The number of type trees of tuples 31 from `X` is at most the number of `d`-types of `d`-tuples from `X`. -/ 32 axiom treeCount_le {n : ℕ} (G : PartialGraph (Fin n)) (k q : ℕ) (hk : 1 ≤ k) 33 (i ℓ : ℕ) (hi : i ≤ q) (hℓ : 1 ≤ ℓ) (hℓk : ℓ ≤ k + i) (X : Set (Fin n)) : 34 Set.ncard {τ : TypeTree | ∃ v : Fin ℓ → Fin n, (∀ j, v j ∈ X) ∧ τ = tree G (k + i) (q - i) v} ≤ 35 partialTypeCount G (rhoPlus k q + k + q) (rhoPlus k q + k + q) X 36 37 /-- **Type tree sizes, size.** The size of the type tree of a vertex is 38 polynomial in the number of `d`-types of `d`-tuples from its ball. -/ 39 axiom tree_length_le (k q : ℕ) (hk : 1 ≤ k) : 40 ∃ c a : ℕ, ∀ (n : ℕ) (G : PartialGraph (Fin n)) (v : Fin n), 41 wordLength (tree G k q ![v]) ≤ 42 c * (partialTypeCount G (rhoPlus k q + k + q) (rhoPlus k q + k + q) 43 (G.ball (rhoPlus k q) v) + 1) ^ a 44 45 end Lax185574.TypeTreeSizes 46 -
Lifting type trees through a resolve
Let k ≥ 1 and q ∈ ℕ. Given a partial graph G, its distance matrix D_G, colors P, Q, a sign ±, and (tree^G_{k,q}(a) : a ∈ V(G)), one can compute H = resolve^±{P,Q}(G), its distance matrix D_H, and (tree^H{k,q}(a) : a ∈ V(G)) in time
|G|² · poly_{k,q}(M + T),
where
M = max_{a ∈ V(G)} ‖tree^G_{k,q}(a)‖, T = max_{a ∈ V(G)} |{tree^G_{k+i,q−i}(v̄) | 0 ≤ i ≤ q, ℓ ∈ [k+i], v̄ ∈ (Ball^H_{ρ⁺(k,q)}(a))^ℓ}|.
Each output tree has size poly_{k,q}(T).
1 import Lax185574.TypeTrees 2 import Lax185574.ConstructionSequences 3 import Lax185574.DistanceMatrix 4 import Lax185574.Algorithms 5 … module docstring, 34 lines 40 41 namespace Lax185574.ResolveLift 42 43 open Lax185574.Encoding Lax185574.Algorithms 44 open Lax185574.PartialGraphs Lax185574.TypeTrees Lax185574.ConstructionSequences 45 open Lax185574.DistanceMatrix 46 open Lax3.DistFO (rhoMinus rhoPlus) 47 48 variable {n : ℕ} 49 50 /-- `resolve^±_{P,Q}(G)`, positive for `true`. -/ 51 def resolveBy (G : PartialGraph (Fin n)) (s : Bool) (P Q : ℕ) : PartialGraph (Fin n) := 52 if s then resolvePos G P Q else resolveNeg G P Q 53 54 /-- The parameter `T`: the largest number of type trees in `G` of 55 tuples from a ball of radius `ρ⁺(k, q)` in `H`, over all ranks 56 `(k+i, q−i)` and arities `ℓ ∈ [k+i]`. -/ 57 noncomputable def treeCount (G H : PartialGraph (Fin n)) (k q : ℕ) : ℕ := 58 Finset.univ.sup fun a : Fin n => 59 Set.ncard {τ : TypeTree | ∃ (i ℓ : ℕ) (v : Fin ℓ → Fin n), i ≤ q ∧ 1 ≤ ℓ ∧ ℓ ≤ k + i ∧ 60 (∀ j, v j ∈ H.ball (rhoPlus k q) a) ∧ τ = tree G (k + i) (q - i) v} 61 62 /-- **Resolve lift.** One algorithm computes the partial graph `H` after 63 a resolve, its distance matrix and the type trees of all vertices in it, 64 from the partial graph `G` before, its distance matrix, `P`, `Q`, the 65 sign and its type trees, in time `O(n² · (M + T + 1)^a)`. Each new tree 66 has size `O((T + 1)^a)`. -/ 67 axiom exists_program_resolveLift : 68 ∃ A : Algorithm, ∀ k q : ℕ, ∃ c a : ℕ, 69 ∀ (n : ℕ) (G : PartialGraph (Fin n)) (P Q : ℕ) (s : Bool), 1 ≤ k → 70 let H := resolveBy G s P Q 71 let T := treeCount G H k q 72 A.Computes c (G, distMatrix G, P, Q, s, family G k q) (H, distMatrix H, family H k q) 73 (n ^ 2 * (maxTreeSize G k q + T + 1) ^ a) ∧ 74 ∀ b : Fin n, (encode (tree H k q ![b])).length ≤ c * (T + 1) ^ a 75 76 end Lax185574.ResolveLift 77 -
Balls around vertex sets in a graph
For a graph G, a radius r ∈ ℕ and a set C ⊆ V(G), the ball
Ball^G_r[C] = { w ∈ V(G) : dist^G(c, w) ≤ r for some c ∈ C }
is the union of the balls Ball^G_r[c] of radius r around the vertices c ∈ C. For a vertex v it is written Ball^G_r[v], and for a tuple v̄ it is the ball around the set of entries of v̄.
The distance between two sets is the minimum distance between their elements. So dist^G(X, A) > r holds if and only if Ball^G_r[X] is disjoint from A.
1 import Lax185574.GaifmanGraph 2 … module docstring, 30 lines 33 34 namespace Lax185574.GraphBalls 35 36 open Lax185574.GaifmanGraph 37 38 universe u 39 40 variable {V : Type u} 41 42 /-- `Ball^G_r[C]`: the vertices within distance `r` of some vertex of 43 `C`. -/ 44 def graphBall (G : SimpleGraph V) (r : ℕ) (C : Set V) : Set V := 45 {w | ∃ c ∈ C, WithinDist G r c w} 46 47 end Lax185574.GraphBalls 48 -
Partitions, transversals and the partition into atomic types
For two partitions 𝒫, 𝒬 of the same set, 𝒫 ≼ 𝒬 says that 𝒫 refines 𝒬, that is, each part of 𝒫 is contained in some part of 𝒬. For a partition 𝒫 of V and X ⊆ V, X/𝒫 is the set of parts of 𝒫 that meet X. The part of 𝒫 containing an element v is 𝒫(v). Further, ≡_𝒫 is the equivalence relation on V whose classes are the parts of 𝒫. A transversal of 𝒫 is a set that contains exactly one vertex of every part.
For a graph G and S ⊆ V(G), two vertices u, v have the same atomic type over S if and only if either u = v, or u, v ∉ S and N(u) ∩ S = N(v) ∩ S. The partition into atomic types 𝒫_S partitions S into singletons and the vertices of V(G) ∖ S according to their neighborhoods in S.
1 import Lax185574.Encodings 2 import Mathlib.Data.Setoid.Basic 3 import Mathlib.Data.Set.Card 4 import Mathlib.Data.Fintype.Basic 5 … module docstring, 38 lines 44 45 namespace Lax185574.Partitions 46 47 open Lax185574.Encoding 48 49 universe z 50 51 variable {V : Type z} 52 53 /-- `|X/𝒫|`: the number of parts of `P` that meet `X`. -/ 54 noncomputable def partCount (P : Setoid V) (X : Set V) : ℕ := 55 (Quotient.mk P '' X).ncard 56 57 /-- The part `𝒫(v)` of `P` that contains `v`. -/ 58 def part (P : Setoid V) (v : V) : Set V := {u | P u v} 59 60 /-- `T` is a transversal of `P`: every part of `P` contains exactly one 61 vertex of `T`. -/ 62 def IsTransversal (P : Setoid V) (T : Set V) : Prop := 63 ∀ v : V, ∃! t : V, t ∈ T ∧ P t v 64 65 /-- The partition `𝒫_S` into atomic types over `S`: vertices of `S` are 66 singletons, and vertices outside `S` are grouped by their neighborhood 67 in `S`. -/ 68 def atomicTypes (G : SimpleGraph V) (S : Set V) : Setoid V := 69 Setoid.ker fun v => (S ∩ {v}, S ∩ G.neighborSet v) 70 71 /-- The parts of a partition of `Fin n`, as a finite set of finite 72 sets. -/ 73 noncomputable def parts {n : ℕ} (P : Setoid (Fin n)) : Finset (Finset (Fin n)) := 74 open Classical in Finset.univ.image fun v => Finset.univ.filter fun u => P u v 75 76 /-- A partition of `Fin n` is encoded by the finite set of its parts. 77 A setoid is a relation, so the encoding is not derived. -/ 78 noncomputable instance {n : ℕ} : Encode (Setoid (Fin n)) where 79 encode P := encode (parts P) 80 81 end Lax185574.Partitions 82 -
Monadically dependent graph classes
A graph class C transduces the class of all graphs if there are a number k and a first-order formula ψ(x₀, x₁) with k colors such that every graph H can be found inside a k-colored graph from C, with ψ defining the edges of H. That is, there are a graph G ∈ C, a coloring of G with k colors, and an injective map f from the vertices of H to the vertices of G such that for all distinct vertices u and v of H
u and v are adjacent in H ⟺ ψ(f(u), f(v)) holds in the colored G.
The class C is monadically dependent if it does not transduce the class of all graphs.
1 import Lax185574.FirstOrderLogic 2 import Mathlib.Data.Fin.VecNotation 3 … module docstring, 43 lines 47 48 namespace Lax185574.MonadicDependence 49 50 open Lax185574.Graphs Lax185574.FirstOrderLogic 51 52 /-- The class `C` transduces the class of all graphs: some formula 53 `ψ(x₀, x₁)` with `k` colors defines every graph `H` on the image of an 54 injective map `f` into some `k`-colored graph `G ∈ C`. -/ 55 def TransducesAllGraphs (C : GraphClass) : Prop := 56 ∃ (k : ℕ) (ψ : Formula (Fin k) 2), 57 ∀ H : Graph, ∃ G ∈ C, ∃ (col : Fin k → Set (Fin G.n)) (f : Fin H.n ↪ Fin G.n), 58 ∀ u v : Fin H.n, u ≠ v → (H.Adj u v ↔ ψ.Holds G col ![f u, f v]) 59 60 /-- A graph class is monadically dependent if it does not transduce the 61 class of all graphs. -/ 62 def MonadicallyDependent (C : GraphClass) : Prop := 63 ¬ TransducesAllGraphs C 64 65 end Lax185574.MonadicDependence 66 -
Neighborhood complexity and VC-dimension
The neighborhood complexity of a graph G is the function π_G : ℕ → ℕ defined by
π_G(k) ≔ max_{S ⊆ V(G), |S| ≤ k} |{ N^G(v) ∩ S : v ∈ V(G) }|,
which counts the maximum number of distinct neighborhoods of vertices of G restricted to a set of size at most k.
The VC-dimension of a graph G is the maximal size of a set A ⊆ V(G) such that { N(v) ∩ A : v ∈ V(G) } = 2^A.
1 import Lax199508.NeighborhoodComplexity 2 import Mathlib.Data.ENat.Lattice 3 … module docstring, 31 lines 35 36 namespace Lax185574.VCDimension 37 38 open Lax199508.NeighborhoodComplexity 39 40 universe u 41 42 variable {V : Type u} 43 44 /-- The neighborhood complexity `π_G(k)`: the largest number of 45 neighborhood traces `N(v) ∩ S` on a set `S` of at most `k` vertices. -/ 46 noncomputable def neighborhoodComplexity (G : SimpleGraph V) (k : ℕ) : ℕ := 47 sSup {m | ∃ S : Finset V, S.card ≤ k ∧ m = traceCount G (S : Set V)} 48 49 /-- The neighborhoods of `G` shatter `A`: every subset of `A` is the 50 trace `N(v) ∩ A` of some vertex `v`. -/ 51 def Shatters (G : SimpleGraph V) (A : Finset V) : Prop := 52 ∀ B ⊆ A, ∃ v : V, ∀ a ∈ A, (G.Adj v a ↔ a ∈ B) 53 54 /-- The VC-dimension of `G`: the supremum of the sizes of the finite 55 vertex sets shattered by the neighborhoods. -/ 56 noncomputable def vcDim (G : SimpleGraph V) : ℕ∞ := 57 ⨆ (A : Finset V) (_ : Shatters G A), (A.card : ℕ∞) 58 59 end Lax185574.VCDimension 60 -
Polynomial neighborhood complexity from bounded VC-dimension
If G has VC-dimension d then
π_G(k) ≤ (k + 1)^d for all k ∈ ℕ.
This follows from the Sauer–Shelah lemma.
1 import Lax185574.VCDimension 2 … module docstring, 18 lines 21 22 namespace Lax185574.NeighborhoodComplexityBound 23 24 open Lax185574.VCDimension 25 26 universe u 27 28 /-- **Neighborhood complexity bound.** A graph of VC-dimension at most `d` has 29 neighborhood complexity `π_G(k) ≤ (k + 1)^d`. -/ 30 axiom neighborhoodComplexity_le {V : Type u} (G : SimpleGraph V) (d : ℕ) 31 (hG : vcDim G ≤ d) (k : ℕ) : neighborhoodComplexity G k ≤ (k + 1) ^ d 32 33 end Lax185574.NeighborhoodComplexityBound 34 -
no assumptions
The Sauer–Shelah lemma. The traces on a set of at most vertices form a family of subsets of whose shattered sets are shattered by the neighborhoods of , so they have size at most . By the Sauer–Shelah lemma of mathlib (via Pajor's bound on the shatterer) the family has at most members.
-
A monadically dependent class has bounded VC-dimension, since otherwise the edge formula has the independence property on it.
The argument is carried out for the graph classes of the archive and their monadic dependence, and transferred to the graph classes used here.
-
Bounded VC-dimension of monadically dependent classes
For every monadically dependent graph class 𝒞 there is some d ∈ ℕ such that every graph G ∈ 𝒞 has VC-dimension at most d.
The paper notes that this is easy to see from the definition of monadic dependence, and refers to the companion paper for a proof.
1 import Lax185574.VCDimension 2 import Lax185574.MonadicDependence 3 … module docstring, 25 lines 29 30 namespace Lax185574.BoundedVCClasses 31 32 open Lax185574.Graphs Lax185574.MonadicDependence Lax185574.VCDimension 33 34 /-- **Bounded VC-dimension.** Some `d` bounds the VC-dimension of every 35 graph of a monadically dependent class. -/ 36 axiom exists_vcDim_le (C : GraphClass) (hC : MonadicallyDependent C) : 37 ∃ d : ℕ, ∀ G ∈ C, vcDim G.toSimpleGraph ≤ d 38 39 end Lax185574.BoundedVCClasses 40 -
Types of bounded quantifier rank
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.
1 import Mathlib.ModelTheory.Satisfiability 2 import Mathlib.Data.Set.Card 3 … module docstring, 48 lines 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 -
Atomic types of vertices and of pairs
The atomic type of a tuple v̄ over a set Y of elements of a structure A is atp^A(v̄/Y) ≔ tp^A_0(v̄/Y), and ATypes^A(X/Y) ≔ Types^A_{1,0}(X/Y) is the set of atomic types over Y of the elements of X.
For a graph, Π = {(x = y), (x ≠ y) ∧ E(x, y), (x ≠ y) ∧ ¬E(x, y)} is the set of the three possible atomic types of a pair of vertices. For an s-tuple p̄ = (p₁, …, p_s) of vertices and a vertex v, the atomic type atp(v/p̄) is identified with the s-tuple in Π^s whose i-th component is the atomic type of the pair (v, pᵢ).
1 import Lax185574.FirstOrderTypes 2 import Mathlib.ModelTheory.Graph 3 … module docstring, 27 lines 31 32 namespace Lax185574.AtomicTypes 33 34 open FirstOrder FirstOrder.Language 35 open Lax185574.FirstOrderTypes 36 37 universe u 38 39 variable {V : Type u} 40 41 /-- `|ATypes^G(X/Y)|`: the number of atomic types over `Y`, in the graph 42 `G`, of the vertices of `X`. -/ 43 noncomputable def atomicTypeCount (G : SimpleGraph V) (X Y : Set V) : ℕ := 44 @typeCountOver Language.graph V G.structure 1 0 X Y 45 46 /-- The three atomic types of a pair of vertices in a graph, the set Π. -/ 47 inductive PairType 48 /-- The type `x = y`. -/ 49 | eq 50 /-- The type `x ≠ y ∧ E(x, y)`. -/ 51 | adj 52 /-- The type `x ≠ y ∧ ¬E(x, y)`. -/ 53 | nonAdj 54 deriving DecidableEq 55 56 /-- There are three atomic types of pairs. -/ 57 instance : Fintype PairType := 58 ⟨{.eq, .adj, .nonAdj}, fun x => by cases x <;> decide⟩ 59 60 open Classical in 61 /-- The atomic type of the pair `(u, v)` in the graph `G`. -/ 62 noncomputable def pairType (G : SimpleGraph V) (u v : V) : PairType := 63 if u = v then .eq else if G.Adj u v then .adj else .nonAdj 64 65 /-- `atp(v/p̄)`, as an element of `Π^s`: its `i`-th component is the 66 atomic type of the pair `(v, pᵢ)`. -/ 67 noncomputable def atomicTypeOver (G : SimpleGraph V) {s : ℕ} (p : Fin s → V) 68 (v : V) : Fin s → PairType := 69 fun i => pairType G v (p i) 70 71 end Lax185574.AtomicTypes 72 -
Gaifman graph, distances, balls and induced substructures
The Gaifman graph of a relational structure A with domain V has vertex set V. Two distinct elements are adjacent if they occur together in some tuple of some relation of A. For a structure with unary and binary relations, these are the pairs uv such that (u, v) or (v, u) lies in a binary relation. The distance dist^A(u, v) is the distance in the Gaifman graph, and Ball^A_r(ā) is the set of elements at distance at most r from some entry of the tuple ā.
For a set B of elements of a relational structure A, the induced substructure A[B] has domain B, and each relation of A is restricted to B. The paper uses A[B] without defining it.
1 import Mathlib.ModelTheory.Basic 2 import Mathlib.Combinatorics.SimpleGraph.Walk.Basic 3 … module docstring, 25 lines 29 30 namespace Lax185574.GaifmanGraph 31 32 open FirstOrder FirstOrder.Language 33 34 universe u v z 35 36 variable {L : Language.{u, v}} {V : Type z} [L.Structure V] 37 38 variable (L) in 39 /-- The Gaifman graph: distinct elements are adjacent if they occur 40 together in a tuple of some relation. -/ 41 def gaifmanGraph : SimpleGraph V := 42 SimpleGraph.fromRel fun a b => 43 ∃ (l : ℕ) (R : L.Relations l) (x : Fin l → V), 44 Structure.RelMap R x ∧ a ∈ Set.range x ∧ b ∈ Set.range x 45 46 /-- The vertices `u` and `v` of the graph `G` are within distance `d`: 47 some walk from `u` to `v` has length at most `d`. -/ 48 def WithinDist {W : Type*} (G : SimpleGraph W) (d : ℕ) (u v : W) : Prop := 49 ∃ p : G.Walk u v, p.length ≤ d 50 51 variable (L) in 52 /-- `Ball^A_r(ā)`: the elements within distance `r` of some entry of the 53 tuple `a` in the Gaifman graph. -/ 54 def ball (r : ℕ) {k : ℕ} (a : Fin k → V) : Set V := 55 {b | ∃ i, WithinDist (gaifmanGraph L (V := V)) r (a i) b} 56 57 /-- The induced substructure `A[B]` of a relational structure: the 58 relations of `A`, restricted to `B`. -/ 59 @[implicit_reducible] 60 def induced [L.IsRelational] (B : Set V) : L.Structure B where 61 funMap f := isEmptyElim f 62 RelMap R x := Structure.RelMap R (fun i => (x i : V)) 63 64 end Lax185574.GaifmanGraph 65 -
Flips and flip metrics
For a graph G and a partition 𝒫 of V ≔ V(G), a 𝒫-flip of G is a graph H with V(H) = V such that for every pair X, Y ∈ 𝒫 (possibly X = Y), either H[X, Y] = G[X, Y] or H[X, Y] = Ḡ[X, Y]. If |𝒫| ≤ s, then H is an s-flip of G. The associated flip metric and its balls are
dist_𝒫(u, v) ≔ max { dist^H(u, v) : H is a 𝒫-flip of G }, Ball^𝒫_r(v) ≔ { u : dist_𝒫(u, v) ≤ r } = ⋂ { Ball^H_r(v) : H is a 𝒫-flip of G }.
As a shorthand, for a graph G and a set S ⊆ V(G), a 𝒫S-flip of G is called an S-flip, and dist_S^G ≔ dist{𝒫_S} and Ball^S_r ≔ Ball^{𝒫_S}_r. Here 𝒫_S is the partition into atomic types over S, see and .
1 import Lax185574.Partitions 2 import Lax185574.GaifmanGraph 3 … module docstring, 36 lines 40 41 namespace Lax185574.Flips 42 43 open Lax185574.Partitions Lax185574.GaifmanGraph 44 45 universe z 46 47 variable {V : Type z} 48 49 /-- `H` is a `𝒫`-flip of `G`: for every pair of parts `𝒫(a)`, `𝒫(b)`, 50 adjacency in `H` between distinct vertices of these parts either agrees 51 with adjacency in `G` throughout, or with non-adjacency in `G` 52 throughout. -/ 53 def IsFlip (G : SimpleGraph V) (P : Setoid V) (H : SimpleGraph V) : Prop := 54 ∀ a b : V, 55 (∀ x y : V, P x a → P y b → x ≠ y → (H.Adj x y ↔ G.Adj x y)) ∨ 56 (∀ x y : V, P x a → P y b → x ≠ y → (H.Adj x y ↔ ¬ G.Adj x y)) 57 58 /-- `dist_𝒫(u, v) ≤ r`: in every `𝒫`-flip of `G`, some walk from `u` 59 to `v` has length at most `r`. -/ 60 def FlipWithinDist (G : SimpleGraph V) (P : Setoid V) (r : ℕ) (u v : V) : Prop := 61 ∀ H : SimpleGraph V, IsFlip G P H → WithinDist H r u v 62 63 /-- `Ball^𝒫_r(v)`: the vertices within distance `r` of `v` in every 64 `𝒫`-flip of `G`. -/ 65 def flipBall (G : SimpleGraph V) (P : Setoid V) (r : ℕ) (v : V) : Set V := 66 {u | FlipWithinDist G P r v u} 67 68 end Lax185574.Flips 69 -
Radius-r width of a construction sequence
Partial graphs, construction sequences and their radius-r width are defined in the technical overview of the paper. A construction sequence of a graph G with vertex set V is a sequence G₁, …, G_λ of partial graphs with vertex set V. Its radius-r width is the maximum, over all t ∈ [λ] and v ∈ V, of the number of parts of G_t that intersect Ball^{G_t}_r(v). The ball is taken in the Gaifman graph (V, R(G_t)) of G_t, whose edges are the resolved pairs E(G_t) ∪ N(G_t). The radius-r merge-width of G is the minimum radius-r width over all construction sequences of G.
For a partial graph H with partition 𝒫 and a set W ⊆ V(H), the induced partial graph H[W] has vertex set W, edges E(H) ∩ (W choose 2), non-edges N(H) ∩ (W choose 2), and partition { P ∩ W : P ∈ 𝒫 } ∖ {∅}.
1 import Lax185574.PartialGraphs 2 import Mathlib.Order.Lattice.Nat 3 … module docstring, 39 lines 43 44 namespace Lax185574.ConstructionWidth 45 46 open Lax185574.PartialGraphs 47 48 universe z 49 50 variable {V : Type z} 51 52 /-- The radius-`r` width of the sequence `s`: the largest number of 53 parts of `s[t]` that meet a ball of radius `r` in the resolved pairs of 54 `s[t]`. -/ 55 noncomputable def constructionWidth (r : ℕ) (s : List (PartialGraph V)) : ℕ := 56 sSup {K | ∃ (t : ℕ) (ht : t < s.length) (v : V), 57 K = ((s[t]).color '' (s[t]).ball r v).ncard} 58 59 end Lax185574.ConstructionWidth 60 -
Few types far from a parameter set, with a fixed tuple of parameters
For every q, k, c ∈ ℕ there are numbers r = r(q) and T = T(q, k, c) with the following property. Let H be a graph expanded by at most c unary predicates and U ⊆ V(H). Fix a tuple ū of vertices of U of finite length. Let F ≔ { a ∈ V(H) : dist^H(a, U) > r }. Then
|{ tp^H_q(ā ū/U) : ā ∈ F^k }| ≤ T(q, k, c).
1 import Lax185574.Colorings 2 import Lax185574.FirstOrderTypes 3 import Lax185574.GraphBalls 4 … module docstring, 21 lines 26 27 namespace Lax185574.SeparatingTypesTuples 28 29 open FirstOrder FirstOrder.Language Lax710763.Transductions 30 open Lax185574.FirstOrderTypes Lax185574.Colorings Lax185574.GraphBalls 31 32 universe z 33 34 /-- **Few types far from a parameter set, with fixed parameters.** For a 35 fixed tuple `ū` from `U`, the tuples `ā ū` with `ā` a `k`-tuple far from 36 `U` realize at most `T(q, k, c)` types of quantifier rank `q` over `U`, 37 independently of the length of `ū`. -/ 38 axiom ncard_rankTypeOver_append_le (q : ℕ) : 39 ∃ r : ℕ, ∀ k c : ℕ, ∃ T : ℕ, 40 ∀ (V : Type z) [Finite V] (G : SimpleGraph V) (colors : Fin c → Set V) 41 (U : Set V) (m : ℕ) (u : Fin m → V), (∀ i, u i ∈ U) → 42 ((fun a : Fin k → V => 43 @rankTypeOver (withColors Language.graph c) V (expansion G colors) q U 44 (k + m) (Fin.append a u)) '' 45 {a | ∀ i, a i ∉ graphBall G r U}).ncard ≤ T 46 47 end Lax185574.SeparatingTypesTuples 48 -
The proof in the paper, with the padding step replaced by a split of each tuple into its entries outside and its entries inside . Let be the separation radius. For each , the closure theorem for tuples gives polynomially many -flips of such that every -tuple outside is at distance more than from in one of them. A flip is undone by a toggle on at most parts, so the edges of are quantifier-free definable in expanded by the colors and by predicates for the parts, and the type of a tuple in this expansion determines its type in . A -tuple is a rearrangement of
ā ūwithāoutside andūinside , and its type is determined by the type ofā ūand the positions. For fixed positions,ū, and , the tuplesāfar from in realize at most types in . Summing over at most position sets, tuplesūand the flips gives the bound, whose exponent does not depend on .The argument is carried out for the graph classes of the archive and their monadic dependence, and transferred to the graph classes used here.