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

Lax52.MSOSyntax

Monadic second-order syntax

concepts/Lax52/MSOSyntax.lean · lax-52

definition

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

    Definition

    Monadic second-order formulas over an arbitrary first-order language. A formula in context (n,m)(n, m) has nn first-order variables and mm monadic second-order variables. First-order terms are the terms of the underlying first-order language. Disjunction and negation are primitive; conjunction and the other usual connectives are derived operations.

    Lean source view on GitHub

    1import Mathlib.ModelTheory.Semantics
    2
    3/-!
    4---
    5title: Monadic second-order syntax
    6type: definition
    7---
    8
    9Monadic second-order formulas over an arbitrary first-order language. A formula
    10in context `(n, m)` has `n` first-order variables and `m` monadic second-order
    11variables. First-order terms are the terms of the underlying first-order
    12language. Disjunction and negation are primitive; conjunction and the other
    13usual connectives are derived operations.
    14-/
    15
    16namespace Lax52.MSOSyntax
    17
    18open FirstOrder
    19
    20universe u v
    21
    22/-- Monadic second-order formulas over `L`, intrinsically scoped by the numbers
    23of available first-order and monadic variables. -/
    24inductive Formula (L : Language.{u, v}) : Nat → Nat → Type (max u v)
    25 | falsum {n m : Nat} : Formula L n m
    26 | equal {n m : Nat} : L.Term (Fin n) → L.Term (Fin n) → Formula L n m
    27 | rel {n m k : Nat} : L.Relations k → (Fin k → L.Term (Fin n)) → Formula L n m
    28 | mem {n m : Nat} : L.Term (Fin n) → Fin m → Formula L n m
    29 | or {n m : Nat} : Formula L n m → Formula L n m → Formula L n m
    30 | neg {n m : Nat} : Formula L n m → Formula L n m
    31 | exFO {n m : Nat} : Formula L (n + 1) m → Formula L n m
    32 | exSO {n m : Nat} : Formula L n (m + 1) → Formula L n m
    33
    34/-- An MSO sentence has no free variables of either sort. -/
    35abbrev Sentence (L : Language.{u, v}) := Formula L 0 0
    36
    37namespace Formula
    38
    39variable {L : Language.{u, v}} {n m : Nat}
    40
    41/-- Derived conjunction. -/
    42def and (phi psi : Formula L n m) : Formula L n m :=
    43 .neg (.or (.neg phi) (.neg psi))
    44
    45/-- Derived truth. -/
    46def verum : Formula L n m := .neg .falsum
    47
    48/-- Derived implication. -/
    49def imp (phi psi : Formula L n m) : Formula L n m :=
    50 .or (.neg phi) psi
    51
    52/-- Derived biconditional. -/
    53def iff (phi psi : Formula L n m) : Formula L n m :=
    54 and (imp phi psi) (imp psi phi)
    55
    56/-- Derived universal first-order quantification. -/
    57def allFO (phi : Formula L (n + 1) m) : Formula L n m :=
    58 .neg (.exFO (.neg phi))
    59
    60/-- Derived universal monadic second-order quantification. -/
    61def allSO (phi : Formula L n (m + 1)) : Formula L n m :=
    62 .neg (.exSO (.neg phi))
    63
    64end Formula
    65
    66end Lax52.MSOSyntax
    67

    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…