Draft — mutable and not usable as a dependency; its citation marks the draft state.

Lax678846.ExistentialSecondOrder

Existential second-order logic

concepts/Lax678846/ExistentialSecondOrder.lean · lax-678846

proven

Loading review…

Sign in with ORCID

Community review

Flags

Each flag is tied to a public ORCID identity and explains why this concept may be incorrect.

No flags have been submitted.

    Community review

    Flag this concept

    State precisely what appears incorrect. This explanation will be public under your ORCID name.

    No source line selected.

    Concept map

    Proven claimDefinitionThis conceptRelated conceptA → B: B builds on A

    Evidence

    Each proof establishes this claim relative to its assumptions.

    Definition and theorem

    An existential second-order sentence has the form R1Rsφ\exists R_1\cdots\exists R_s\,\varphi, where each relation has a fixed arity and the matrix φ\varphi is first-order. Witness relations range over all relations of their arities on the existing universe.

    The first-order basis consists of truth, equality, input-relation and witness-relation atoms, negation, conjunction, and existential element quantification. There is no built-in order or fixed-point operator. Element quantification binds variable zero. The witness vocabulary records the finite second-order quantifier prefix.

    Lean source view on GitHub

    1import Lax678846.FiniteStructures
    2
    3/-!
    4---
    5title: Existential second-order logic
    6type: definition and theorem
    7---
    8An existential second-order sentence has the form
    9R1Rsφ\exists R_1\cdots\exists R_s\,\varphi, where each relation has a fixed
    10arity and the matrix φ\varphi is first-order. Witness relations range over
    11all relations of their arities on the existing universe.
    12
    13The first-order basis consists of truth, equality, input-relation and
    14witness-relation atoms, negation, conjunction, and existential element
    15quantification. There is no built-in order or fixed-point operator.
    16Element quantification binds variable zero. The witness vocabulary records
    17the finite second-order quantifier prefix.
    18-/
    19
    20namespace Lax678846.ExistentialSecondOrder
    21
    22open Lax678846.FiniteStructures
    23
    24inductive FirstOrder (σ τ : Vocabulary) : Nat → Type
    25 | truth {m} : FirstOrder σ τ m
    26 | equal {m} (x y : Fin m) : FirstOrder σ τ m
    27 | relation {m} (r : Symbol σ) (args : Fin (σ.get r) → Fin m) : FirstOrder σ τ m
    28 | variable {m} (r : Symbol τ) (args : Fin (τ.get r) → Fin m) : FirstOrder σ τ m
    29 | neg {m} (φ : FirstOrder σ τ m) : FirstOrder σ τ m
    30 | conj {m} (φ ψ : FirstOrder σ τ m) : FirstOrder σ τ m
    31 | exists' {m} (φ : FirstOrder σ τ (m + 1)) : FirstOrder σ τ m
    32
    33def FirstOrder.eval {σ τ : Vocabulary} {m : Nat} (φ : FirstOrder σ τ m)
    34 (A : Structure σ) (R : Interpretation τ A.size) (v : Fin m → Fin A.size) : Prop :=
    35 match φ with
    36 | .truth => True
    37 | .equal x y => v x = v y
    38 | .relation r args => A.relation r (v ∘ args) = true
    39 | .variable r args => R r (v ∘ args) = true
    40 | .neg ψ => ¬ ψ.eval A R v
    41 | .conj ψ χ => ψ.eval A R v ∧ χ.eval A R v
    42 | .exists' ψ => ∃ a : Fin A.size, ψ.eval A R (Fin.cons a v)
    43
    44structure Sentence (σ : Vocabulary) where
    45 witnesses : Vocabulary
    46 matrix : FirstOrder σ witnesses 0
    47
    48def Satisfies {σ : Vocabulary} (A : Structure σ) (φ : Sentence σ) : Prop :=
    49 ∃ R : Interpretation φ.witnesses A.size, φ.matrix.eval A R Fin.elim0
    50
    51def Definable {σ : Vocabulary} (Q : Property σ) : Prop :=
    52 ∃ φ : Sentence σ, ∀ A : Structure σ, Q A ↔ Satisfies A φ
    53
    54axiom satisfiesInvariant {σ : Vocabulary} (φ : Sentence σ) :
    55 IsomorphismInvariant (fun A => Satisfies A φ)
    56
    57end Lax678846.ExistentialSecondOrder
    58
    Show Proof

    From Mathlib

    none

    Community review

    Discussion

    Ask a question or add context. Endorsements and structured flags are kept in the review panel above; your ORCID profile must share a public name.

    0 comments

    Loading discussion…