Documentation

CslibFrontier.Computability.Circuit.Boolean.FirstOrder

First-order model checking in constant depth #

A structure for a relational first-order language L on the universe Fin n is determined by the truth values of its atomic facts R(a₁, …, aₗ) (Cslib.Logic.FO.Atom, Cslib.Logic.FO.Model), and every structure with n elements is isomorphic to one of these through an enumeration (Cslib.Logic.FO.realize_iff_atomsOf). Expanding each universal quantifier into a conjunction over the n elements turns a first-order formula into a formula of negations and unbounded fan-in conjunctions and disjunctions over the atomic facts (ModelChecking.toUnbounded), which computes whether the structure satisfies it (ModelChecking.eval_toUnbounded). Its depth is bounded independently of n (ModelChecking.depth_toUnbounded_le) and its size is polynomial in n (ModelChecking.size_toUnbounded_le). This is the easy, nonuniform half of the characterization of AC⁰ by first-order logic Immerman, Chapter 5, Barrington, Immerman and Straubing, for relational vocabularies and without numerical predicates such as order or BIT; it reads as membership in AC⁰ once the atomic facts are the input bits, which needs a relation symbol of positive arity for the number of facts to grow with n.

Sentences are those of Mathlib's model theory (FirstOrder.Language.Sentence), and the statements are about structures rather than an encoding of structures as bit strings. The canonical ordered extension, including genuine 0, 1, and max constants and hardwired ≤ and BIT, is in CslibFrontier.Computability.Circuit.Boolean.FirstOrder.Ordered.

Main definitions #

Atomic facts Cslib.Logic.FO.Atom, models Cslib.Logic.FO.Model, and Cslib.Logic.FO.atomsOf are provided by CslibFrontier.Logics.FirstOrder.Atom.

Main results #

References #

The constant b as a formula over the unbounded fan-in basis.

@[simp]

constUnbounded b evaluates to b on every input.

The compiled connectives #

Both the order-free compiler below and the ordered one (CslibFrontier.Computability.Circuit.Boolean.FirstOrder.Ordered) compile atomic facts to inputs or constants, an implication φ → ψ to ¬φ ∨ ψ, and a universal quantifier to a conjunction over the n elements. The lemmas here give the semantics of these gadgets and the inductive steps of the depth, size and leaf bounds, so that each compiler only handles its atomic formulas.

@[simp]

A constant has depth one.

@[simp]

A constant is a single operation node.

@[simp]

A constant has no input leaves.

The compiled quantifier, a conjunction of n formulas, is true exactly when each is.

The compiled implication is two levels deeper than its arguments.

theorem Cslib.Circuits.Boolean.ModelChecking.depth_all_le {n N : ℕ} {A : Fin n → Formula Unbounded.signature N} {a : ℕ} (hA : ∀ (i : Fin n), (A i).depth ≤ a) :

The compiled quantifier is one level deeper than its arguments.

theorem Cslib.Circuits.Boolean.ModelChecking.size_imp_le {n N : ℕ} {A B : Formula Unbounded.signature N} {a b : ℕ} (hA : A.size ≤ a * (n + 2) ^ a) (hB : B.size ≤ b * (n + 2) ^ b) :

The inductive step of the polynomial size bound for the compiled implication.

theorem Cslib.Circuits.Boolean.ModelChecking.size_all_le {n N : ℕ} {A : Fin n → Formula Unbounded.signature N} {a : ℕ} (ha : 0 < a) (hA : ∀ (i : Fin n), (A i).size ≤ a * (n + 2) ^ a) :
(Formula.gate (Unbounded.Op.and n) A).size ≤ (a + 1) * (n + 2) ^ (a + 1)

The inductive step of the polynomial size bound for the compiled quantifier.

The inductive step of the polynomial leaf bound for the compiled implication.

theorem Cslib.Circuits.Boolean.ModelChecking.leafSize_all_le {n N : ℕ} {A : Fin n → Formula Unbounded.signature N} {a : ℕ} (hA : ∀ (i : Fin n), (A i).leafSize ≤ (n + 2) ^ a) :

The inductive step of the polynomial leaf bound for the compiled quantifier.

A first-order formula, with values xs for its bound variables, as a formula over the unbounded fan-in basis reading the atomic facts through e: atomic formulas are inputs or constants, an implication is a disjunction with one negated argument, and a universal quantifier is a conjunction over the n elements. A term of the relational language L is a variable (Cslib.Logic.FO.termVar), here a bound one, with value given by xs.

The formula decides the first-order formula on the structure given by its atomic facts.

A measure of the depth of a first-order formula: atomic formulas count one, an implication two more than its arguments, and a quantifier one more than its body.

The number of nodes of a first-order formula.

Every first-order formula has positive node count.

The depth does not depend on the universe.

The size is polynomial in the universe.

The number of leaves is polynomial in the universe.

Arbitrary finite structures #

The translation of a sentence decides it on every structure, through its atomic facts.

First-order sentences are decided in constant depth: for a relational language, every sentence is decided on the structures with n elements, given by their atomic facts, by a formula of negations and unbounded fan-in conjunctions and disjunctions whose depth does not depend on n and whose size is polynomial in n.

The same formula decides the sentence on every structure with n elements, through any enumeration of it.