Relational second-order logic and transitive closure #
An element quantifier binds one first-order variable. A relation quantifier binds
a finite block of relation variables of specified arities, reusing the relation-variable
language and expansion of ESO. The grammar allows both kinds of quantifier to nest in
either order. Relation quantifiers have full semantics over all relations of their arity
on the carrier Immerman, Chapter 7.
First-order subformulas reuse Mathlib's bounded formulas. An existential second-order
sentence embeds by applying one existential relation block to its first-order matrix.
Definable is the SO predicate on classes of finite structures.
The transitive-closure extension lets an edge formula bind two tuples of elements and relations. An application holds when its endpoints are joined by a nonempty finite path in that edge relation Ferrarotti, Van den Bussche and Virtema, §2, Definitions 3–4. The syntax index enables this constructor only for SO(TC).
Their setting uses finite nonempty carriers, relational vocabularies, and variable tuples
as the TC endpoints. To instantiate that setting, take a relational input language, restrict
the carriers to finite nonempty types, use Term.var at the individual endpoints, and
interpret the relation endpoints as input symbols or relation variables in scope.
Here TCDefinable also ranges over empty finite carriers, the vocabulary can include fixed
function symbols, and an individual endpoint can be any first-order term. This development
defines satisfaction and finite-structure definability. Complexity capture is a separate result.
Main definitions #
BoundedFormula,BoundedFormula.Realize: typed formulas and satisfaction.FormulaandTCFormula: the SO and SO(TC) formula types.Sentence,Sentence.ofESO,Definable: closed formulas and finite-structure definability.
Main results #
Sentence.realize_ofESO: the existing ESO semantics agree with the full SO semantics.Definable.of_eso,Definable.compl: SO contains ESO and is closed under complement.
A second-order formula with free element variables α, n bound element variables,
and vocabulary L. Relation binders extend the vocabulary for their body.
- ofFirstOrder {allowTC : Bool} {α : Type w} {L : FirstOrder.Language} {n : ℕ} (φ : L.BoundedFormula α n) : BoundedFormula allowTC α L n
Embed a first-order formula.
- imp {allowTC : Bool} {α : Type w} {L : FirstOrder.Language} {n : ℕ} (φ ψ : BoundedFormula allowTC α L n) : BoundedFormula allowTC α L n
Logical implication.
- all {allowTC : Bool} {α : Type w} {L : FirstOrder.Language} {n : ℕ} (φ : BoundedFormula allowTC α L (n + 1)) : BoundedFormula allowTC α L n
Quantify universally over one element, appended to the bound-variable list.
- allRel {allowTC : Bool} {α : Type w} {L : FirstOrder.Language} {n : ℕ} {ι : Type} : Finite ι →
(arity : ι → ℕ) → (φ : BoundedFormula allowTC α (L.sum (ESO.varLanguage arity)) n) → BoundedFormula allowTC α L n
Quantify universally over a finite block of relations.
- tc {allowTC : Bool} {α : Type w} {L : FirstOrder.Language} {n k : ℕ} {ι : Type} : allowTC = true →
Finite ι →
(arity : ι → ℕ) →
(sourceRelations targetRelations : (i : ι) → L.Relations (arity i)) →
(sourceTerms targetTerms : Fin k → L.Term (α ⊕ Fin n)) →
(edge : BoundedFormula allowTC α (L.sum (ESO.varLanguage (Sum.elim arity arity))) (n + k + k)) →
BoundedFormula allowTC α L n
Apply transitive closure to an edge formula over two tuples of elements and relations.
Evaluate a formula in a structure, with assignments for the free and bound elements.
Negation of a second-order formula.
Existential first-order quantification.
Existential quantification over a block of relations.
A formula of plain second-order logic.
A formula of second-order logic with transitive closure.
A second-order sentence has no free or bound element variables at its outer level.
An SO(TC) sentence has no free or bound element variables at its outer level.
Satisfaction of a second-order sentence.
Embed an existential second-order sentence into second-order logic.
The ESO embedding preserves satisfaction.
A class is second-order definable if a sentence defines its finite members.
A class is SO(TC)-definable if a transitive-closure sentence defines its finite members.
Every existential second-order definable class is second-order definable.
Second-order definability is closed under complement.