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✝ = { decide := false, reflects_decide := ⋯ }
- (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✝ = { decide := if h : φ₁.Realize x✝¹ x✝ then decide ((fun (a : φ₁.Realize x✝¹ x✝) => φ₂.Realize x✝¹ x✝) h) else true, reflects_decide := ⋯ }
- φ.all.decidableRealize x✝¹ x✝ = { decide := decide (∀ a ∈ Finset.univ, (fun (_x : M) => φ.Realize x✝¹ (Fin.snoc x✝ _x)) a), reflects_decide := ⋯ }
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.