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 #
Cslib.Logic.WordMSO.wordLanguage,Cslib.Logic.WordMSO.wordStructure: the word vocabulary and the word structure of a word;wordLanguage.ltSymbandwordLanguage.letterSymbare its relation symbols.Cslib.Logic.WordMSO.WordFO.toFormula: Mathlib formulas over the word vocabulary to word formulas.Cslib.Logic.WordMSO.Formula.toWordFO: first-order word formulas to Mathlib formulas.Cslib.Logic.WordMSO.WordFO.language: the language of a Mathlib sentence over the word vocabulary.
Main results #
Cslib.Logic.WordMSO.WordFO.realize_toFormula,Cslib.Logic.WordMSO.Formula.realize_toWordFO: both translations preserve satisfaction.Cslib.Logic.WordMSO.WordFO.foDefinable_language: the language of a Mathlib sentence is first-order definable.Cslib.Logic.WordMSO.foDefinable_iff_exists_sentence: a language is first-order definable iff it is the language of a Mathlib sentence over the word vocabulary.
References #
Relation symbols of the word vocabulary over α: the binary order < and, for each letter
a, the unary 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.
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.
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 ⊥.
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.