Deciding first-order satisfaction on a finite structure #
The first step of the bridge to Mathlib's computability layer: on a finite
structure whose relations are decidable and whose equality is decidable,
FirstOrder.Language.BoundedFormula.Realize is decidable, by recursion on the
formula – quantifiers going through Fintype.decidableForallFintype.
Mathlib has no such instance (Realize is a Prop-valued recursion, and
Mathlib's model theory never needs to run it), so it is supplied here. It is
the first formal justification of the claim, elsewhere by inspection, that
first-order interpretations are effective: everything a reduction of this
library computes is an evaluation of a fixed formula in a finite structure.
The instance is deliberately independent of the rest of the bridge: it
mentions no encoding of structures, and it is useful on its own wherever a
first-order condition has to be checked by decide.
Satisfaction is decidable on a finite structure whose relations and
whose equality are decidable: a recursion on the formula, the quantifier case
being a decidable quantification over a Fintype.
The realization of a term needs no hypothesis: it is an ordinary function
into the universe, and only the equality test it feeds needs
DecidableEq M.
Equations
- FirstOrder.Language.BoundedFormula.falsum.decidableRealize x✝¹ x✝ = isFalse ⋯
- (FirstOrder.Language.BoundedFormula.equal t₁ t₂).decidableRealize x✝¹ x✝ = FirstOrder.Language.BoundedFormula.decidableRealize._aux_2 x✝² t₁ t₂ x✝¹ x✝
- (FirstOrder.Language.BoundedFormula.rel R ts).decidableRealize x✝¹ x✝ = FirstOrder.Language.BoundedFormula.decidableRealize._aux_4 x✝² l R ts x✝¹ x✝
- (φ₁.imp φ₂).decidableRealize x✝¹ x✝ = FirstOrder.Language.BoundedFormula.decidableRealize._aux_6 x✝² φ₁ φ₂ x✝¹ x✝ (φ₁.decidableRealize x✝¹ x✝) (φ₂.decidableRealize x✝¹ x✝)
- φ.all.decidableRealize x✝¹ x✝ = FirstOrder.Language.BoundedFormula.decidableRealize._aux_8 x✝² φ x✝¹ x✝ fun (x : M) => φ.decidableRealize x✝¹ (Fin.snoc x✝ x)
Dependency graph
Satisfaction of a formula (no bound variables left) is decidable on a finite structure with decidable relations.
Equations
Dependency graph
Satisfaction of a sentence is decidable on a finite structure with decidable relations.