Basics on First-Order Semantics #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4. This file defines the interpretations of first-order terms, formulas, sentences, and theories in a style inspired by the Flypitch project.
Main Definitions #
first_order.language.term.realize
is defined so thatt.realize v
is the termt
evaluated at variablesv
.first_order.language.bounded_formula.realize
is defined so thatφ.realize v xs
is the bounded formulaφ
evaluated at tuples of variablesv
andxs
.first_order.language.formula.realize
is defined so thatφ.realize v
is the formulaφ
evaluated at variablesv
.first_order.language.sentence.realize
is defined so thatφ.realize M
is the sentenceφ
evaluated in the structureM
. Also denotedM ⊨ φ
.first_order.language.Theory.model
is defined so thatT.model M
is true if and only if every sentence ofT
is realized inM
. Also denotedT ⊨ φ
.
Main Results #
first_order.language.bounded_formula.realize_to_prenex
shows that the prenex normal form of a formula has the same realization as the original formula.- Several results in this file show that syntactic constructions such as
relabel
,cast_le
,lift_at
,subst
, and the actions of language maps commute with realization of terms, formulas, sentences, and theories.
Implementation Notes #
- Formulas use a modified version of de Bruijn variables. Specifically, a
L.bounded_formula α n
is a formula with some variables indexed by a typeα
, which cannot be quantified over, and some indexed byfin n
, which can. For anyφ : L.bounded_formula α (n + 1)
, we define the formula∀' φ : L.bounded_formula α n
by universally quantifying over the variable indexed byn : fin (n + 1)
.
References #
For the Flypitch project:
A term t
with variables indexed by α
can be evaluated by giving a value to each variable.
Equations
- first_order.language.term.realize v (first_order.language.term.func f ts) = first_order.language.Structure.fun_map f (λ (i : fin a_2), first_order.language.term.realize v (ts i))
- first_order.language.term.realize v (first_order.language.term.var k) = v k
A bounded formula can be evaluated as true or false by giving values to each free variable.
Equations
- f.all.realize v xs = ∀ (x : M), f.realize v (fin.snoc xs x)
- (f₁.imp f₂).realize v xs = (f₁.realize v xs → f₂.realize v xs)
- (first_order.language.bounded_formula.rel R ts).realize v xs = first_order.language.Structure.rel_map R (λ (i : fin a_5), first_order.language.term.realize (sum.elim v xs) (ts i))
- (first_order.language.bounded_formula.equal t₁ t₂).realize v xs = (first_order.language.term.realize (sum.elim v xs) t₁ = first_order.language.term.realize (sum.elim v xs) t₂)
- first_order.language.bounded_formula.falsum.realize v xs = false
A formula can be evaluated as true or false by giving values to each free variable.
Equations
A sentence can be evaluated as true or false in a structure.
Equations
The complete theory of a structure M
is the set of all sentences M
satisfies.
Equations
- L.complete_theory M = {φ : L.sentence | M ⊨ φ}
Instances for first_order.language.complete_theory
Two structures are elementarily equivalent when they satisfy the same sentences.
Equations
- L.elementarily_equivalent M N = (L.complete_theory M = L.complete_theory N)
A model of a theory is a structure in which every sentence is realized as true.
Instances of this typeclass
- first_order.language.model_empty
- first_order.language.model_complete_theory
- first_order.language.model_infinite_theory
- first_order.language.model_nonempty
- first_order.language.elementary_substructure.Theory_model
- first_order.language.Theory.Model.is_model
- first_order.language.Theory.Model.subtheory_Model_models
- first_order.language.model_preorder
- first_order.language.model_partial_order
- first_order.language.model_linear_order
- first_order.language.model_DLO
- first_order.language.simple_graph_model