Documentation

CslibFrontier.Logics.SecondOrder.Basic

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 #

Main results #

inductive Cslib.Logic.SO.BoundedFormula (allowTC : Bool) (α : Type w) :
FirstOrder.Language → ℕ → Type (max (u + 1) (v + 1) w)

A second-order formula with free element variables α, n bound element variables, and vocabulary L. Relation binders extend the vocabulary for their body.

def Cslib.Logic.SO.BoundedFormula.Realize {allowTC : Bool} {α : Type w} {M : Type w'} {L : FirstOrder.Language} {n : ℕ} :
BoundedFormula allowTC α L n → [L.Structure M] → (α → M) → (Fin n → M) → Prop

Evaluate a formula in a structure, with assignments for the free and bound elements.

def Cslib.Logic.SO.BoundedFormula.neg {allowTC : Bool} {α : Type w} {L : FirstOrder.Language} {n : ℕ} (φ : BoundedFormula allowTC α L n) :
BoundedFormula allowTC α L n

Negation of a second-order formula.

def Cslib.Logic.SO.BoundedFormula.ex {allowTC : Bool} {α : Type w} {L : FirstOrder.Language} {n : ℕ} (φ : BoundedFormula allowTC α L (n + 1)) :
BoundedFormula allowTC α L n

Existential first-order quantification.

def Cslib.Logic.SO.BoundedFormula.exRel {allowTC : Bool} {α : Type w} {L : FirstOrder.Language} {n : ℕ} {ι : Type} [Finite ι] (arity : ι → ℕ) (φ : BoundedFormula allowTC α (L.sum (ESO.varLanguage arity)) n) :
BoundedFormula allowTC α L n

Existential quantification over a block of relations.

@[simp]
theorem Cslib.Logic.SO.BoundedFormula.realize_neg {allowTC : Bool} {α : Type w} {L : FirstOrder.Language} {n : ℕ} {M : Type w'} [L.Structure M] {free : α → M} {bound : Fin n → M} (φ : BoundedFormula allowTC α L n) :
φ.neg.Realize free bound ↔ ¬φ.Realize free bound
@[simp]
theorem Cslib.Logic.SO.BoundedFormula.realize_ex {allowTC : Bool} {α : Type w} {L : FirstOrder.Language} {n : ℕ} {M : Type w'} [L.Structure M] {free : α → M} {bound : Fin n → M} (φ : BoundedFormula allowTC α L (n + 1)) :
φ.ex.Realize free bound ↔ ∃ (a : M), φ.Realize free (Fin.snoc bound a)
@[simp]
theorem Cslib.Logic.SO.BoundedFormula.realize_exRel {allowTC : Bool} {α : Type w} {L : FirstOrder.Language} {n : ℕ} {M : Type w'} [L.Structure M] {free : α → M} {bound : Fin n → M} {ι : Type} [Finite ι] (arity : ι → ℕ) (φ : BoundedFormula allowTC α (L.sum (ESO.varLanguage arity)) n) :
(exRel arity φ).Realize free bound ↔ ∃ (R : (i : ι) → Set (Fin (arity i) → M)), φ.Realize free bound
@[reducible, inline]
abbrev Cslib.Logic.SO.Formula (α : Type u_1) :
FirstOrder.Language → ℕ → Type (max (u_2 + 1) (u_3 + 1) u_1)

A formula of plain second-order logic.

@[reducible, inline]
abbrev Cslib.Logic.SO.TCFormula (α : Type u_1) :
FirstOrder.Language → ℕ → Type (max (u_2 + 1) (u_3 + 1) u_1)

A formula of second-order logic with transitive closure.

@[reducible, inline]
abbrev Cslib.Logic.SO.Sentence (L : FirstOrder.Language) :
Type (max (u + 1) (v + 1))

A second-order sentence has no free or bound element variables at its outer level.

@[reducible, inline]
abbrev Cslib.Logic.SO.TCSentence (L : FirstOrder.Language) :
Type (max (u + 1) (v + 1))

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.

@[simp]

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.