Lax52.MSOSemantics
Semantics of monadic second-order logic
concepts/Lax52/MSOSemantics.lean · lax-52
No public endorsements yet.
Loading review…
Sign in with ORCIDConcept map
Definition
The satisfaction relation for monadic second-order formulas over an arbitrary first-order structure. First-order terms and relation symbols are interpreted by mathlib's first-order semantics, while a monadic valuation assigns a set of elements to every monadic variable.
Lean source view on GitHub
| 1 | import Lax52.MSOSyntax |
| 2 | |
| 3 | /-! |
| 4 | --- |
| 5 | title: Semantics of monadic second-order logic |
| 6 | type: definition |
| 7 | --- |
| 8 | |
| 9 | The satisfaction relation for monadic second-order formulas over an arbitrary |
| 10 | first-order structure. First-order terms and relation symbols are interpreted |
| 11 | by mathlib's first-order semantics, while a monadic valuation assigns a set of |
| 12 | elements to every monadic variable. |
| 13 | -/ |
| 14 | |
| 15 | namespace Lax52.MSOSemantics |
| 16 | |
| 17 | open FirstOrder |
| 18 | open FirstOrder.Language |
| 19 | open FirstOrder.Language.Structure |
| 20 | open Lax52.MSOSyntax |
| 21 | |
| 22 | universe u v w |
| 23 | |
| 24 | variable {L : Language.{u, v}} {M : Type w} [L.Structure M] |
| 25 | |
| 26 | /-- Extend a valuation by putting a newly bound variable at index zero. -/ |
| 27 | def consVal {n : Nat} (x : M) (v : Fin n → M) : Fin (n + 1) → M := |
| 28 | Fin.cases x v |
| 29 | |
| 30 | /-- Satisfaction of an MSO formula under first-order and monadic valuations. -/ |
| 31 | def Realize : {n m : Nat} → Formula L n m → (Fin n → M) → |
| 32 | (Fin m → Set M) → Prop |
| 33 | | _, _, .falsum, _, _ => False |
| 34 | | _, _, .equal t₁ t₂, v, _ => t₁.realize v = t₂.realize v |
| 35 | | _, _, .rel r ts, v, _ => RelMap r (fun i => (ts i).realize v) |
| 36 | | _, _, .mem t X, v, V => t.realize v ∈ V X |
| 37 | | _, _, .or phi psi, v, V => Realize phi v V ∨ Realize psi v V |
| 38 | | _, _, .neg phi, v, V => ¬Realize phi v V |
| 39 | | _, _, .exFO phi, v, V => ∃ x : M, Realize phi (consVal x v) V |
| 40 | | _, _, .exSO phi, v, V => ∃ X : Set M, Realize phi v (consVal X V) |
| 41 | |
| 42 | end Lax52.MSOSemantics |
| 43 |
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