First-order logic with scoped operators #
An operator has finitely many formula bodies, each with its own first-order and relation binders, and a tuple of term arguments. This separates binding from the meaning of an operator: least fixed points, tuple transitive closure, and language quantifiers share the same syntax. Ordinary terms, formulas, and structures are Mathlib's first-order objects.
Formula is raw syntax. An interpretation gives it a total meaning; an operator's formation
conditions (such as positive recursion) are a separate layer. In particular, this interface does
not assume that every operator is monotone or that every structure is finite or ordered.
Main definitions #
RelVar,RelEnv: scoped, arity-indexed relation variables and their valuations.Binder,Shape: the binding and application interface of an operator.Formula,Formula.Realize: common syntax and interpretation.Formula.relabel,Formula.realize_relabel: capture-avoiding renaming of free variables.
References #
- N. Immerman, Descriptive Complexity
- Z. Ésik and K. G. Larsen, Regular Languages Definable by Lindström Quantifiers, Section 2, for multiple scoped bodies in regular-language quantifiers.
The meaning of a body as a function of its locally bound relations and variables.
Instances For
First-order syntax extended by an arbitrary family of scoped logical operators.
- ofFO {L : FirstOrder.Language} {O : Type s} {shape : O → Shape} {Γ : List ℕ} {α : Type w} : L.Formula α → Formula L shape Γ α
- rel {L : FirstOrder.Language} {O : Type s} {shape : O → Shape} {Γ : List ℕ} {α : Type w} {k : ℕ} : RelVar Γ k → (Fin k → L.Term α) → Formula L shape Γ α
- neg {L : FirstOrder.Language} {O : Type s} {shape : O → Shape} {Γ : List ℕ} {α : Type w} : Formula L shape Γ α → Formula L shape Γ α
- conj {L : FirstOrder.Language} {O : Type s} {shape : O → Shape} {Γ : List ℕ} {α : Type w} : Formula L shape Γ α → Formula L shape Γ α → Formula L shape Γ α
- ex {L : FirstOrder.Language} {O : Type s} {shape : O → Shape} {Γ : List ℕ} {α : Type w} : Formula L shape Γ (Option α) → Formula L shape Γ α
- op {L : FirstOrder.Language} {O : Type s} {shape : O → Shape} {Γ : List ℕ} {α : Type w} (o : O) (body : (i : Fin (shape o).slots) → Formula L shape (((shape o).binder i).relations ++ Γ) (α ⊕ Fin ((shape o).binder i).vars)) (args : Fin (shape o).arity → L.Term α) : Formula L shape Γ α
Instances For
Interpret a formula, capturing the ambient free-variable assignment in every operator body.
Instances For
Capture-avoiding relabeling of free first-order variables.
Instances For
Embedded first-order formulas keep their original semantics.
Relation variables are applied to the interpreted term arguments.
Semantic negation.
Semantic conjunction.
Existential binding changes only the new variable.
Relabeling is interpreted by precomposing the free-variable assignment.
Disjunction as a derived connective.
Instances For
Derived disjunction has the usual classical semantics.
Derived universal quantification has the usual classical semantics.