Documentation

CslibFrontier.Logics.SecondOrder.WordMSO.FirstOrder

First-order logic over words in Mathlib's model theory #

The word vocabulary over an alphabet α as a Mathlib first-order language wordLanguage α: no function symbols, a binary relation symbol <, and a unary relation symbol P_a for each letter a Libkin, Sections 1.3 and 7.4. wordStructure w interprets it on the positions Fin w.length of a word w, with the natural order and P_a = {i | w[i] = a}.

The sentences of wordLanguage α define exactly the first-order definable languages of Cslib.Logic.WordMSO. WordFO.toFormula translates a Mathlib formula into the first-order fragment Formula.IsFO, and Formula.toWordFO translates a formula of that fragment back. Equality, which is primitive in Mathlib's formulas, becomes the derived Formula.eq. So results about FODefinable, such as the regularity of first-order definable languages, apply to Mathlib's first-order sentences over words, and conversely.

Main definitions #

Main results #

References #

inductive Cslib.Logic.WordMSO.WordRel (α : Type u) :
ℕ → Type u

Relation symbols of the word vocabulary over α: the binary order < and, for each letter a, the unary letter predicate P_a.

  • lt {α : Type u} : WordRel α 2

    The order < of positions.

  • letter {α : Type u} (a : α) : WordRel α 1

    The letter predicate P_a.

The first-order language of words over α: no function symbols, the order <, and P_a for every letter a.

For finitely many letters, the word vocabulary has finitely many relation symbols.

The relation symbol < of the word vocabulary.

The relation symbol P_a of the word vocabulary.

@[instance_reducible]

The word structure of w: the positions Fin w.length, their natural order, and P_a = {i | w[i] = a}. It is not an instance, since the universe Fin w.length does not determine w.

Translation of a Mathlib formula over the word vocabulary, with no free variables and m bound variables in scope, into a first-order word formula with m free position variables (and any number of unused set variables). Relation symbols become atoms, and equality becomes the derived Formula.eq.

The translation lands in the first-order fragment.

theorem Cslib.Logic.WordMSO.WordFO.realize_toFormula {α : Type u} (w : List α) {n : ℕ} (V : Fin n → Set (Fin w.length)) {m : ℕ} (φ : (wordLanguage α).BoundedFormula Empty m) (xs : Fin m → Fin w.length) :
Formula.Realize (fun (i : Fin w.length) => w[i]) (toFormula φ) xs V ↔ have this := wordStructure w; φ.Realize Empty.elim xs

The translation preserves satisfaction: the word formula holds at an assignment of positions iff the Mathlib formula holds in the word structure.

The language of a Mathlib first-order sentence over the word vocabulary: the words whose word structure satisfies it.

A sentence and its translation define the same language.

The language of a Mathlib first-order sentence over the word vocabulary is first-order definable.

Translation of a word formula with m free position variables into a Mathlib formula over the word vocabulary with m bound variables in scope. Set atoms and set quantifiers, which do not occur in first-order formulas without free set variables, become ⊥.

theorem Cslib.Logic.WordMSO.Formula.realize_toWordFO {α : Type u} (w : List α) {m : ℕ} (φ : Formula α m 0) :
φ.IsFO → ∀ (xs : Fin m → Fin w.length) (V : Fin 0 → Set (Fin w.length)), (have this := wordStructure w; φ.toWordFO.Realize Empty.elim xs) ↔ Realize (fun (i : Fin w.length) => w[i]) φ xs V

The translation preserves satisfaction on first-order formulas without free set variables.

A first-order sentence and its translation define the same language.

First-order definability in Mathlib's model theory. A language is first-order definable iff it is the language of a Mathlib first-order sentence over the word vocabulary.