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

Lax314295.MSORelabellings

MSO relabellings

concepts/Lax314295/MSORelabellings.lean · lax-314295

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

    In the paper

    Definition

    An mso relabelling (Definition C.4.3 of Transducers) consists of an input alphabet AA, an output alphabet BB, a finite set Φ\Phi of mso formulas over AA each with exactly one free first-order variable, an output map ΦB\Phi \to B^*, and a string in BB^* for the empty input, such that for every input string and every position in it exactly one formula of Φ\Phi is true at that position. The relabelling maps a nonempty input to the concatenation, over its positions, of the outputs of the unique formulas true there, and the empty input to the designated string. MSO relabellings define exactly the rational functions (Theorem C.4.4), and first-order relabellings — all of whose formulas are first-order — exactly the functions of aperiodic bimachines (Theorem C.4.16).

    Lean source view on GitHub

    1import Lax314295.MSOLogic
    2
    3/-!
    4---
    5title: MSO relabellings
    6type: definition
    7---
    8An *mso relabelling* (Definition C.4.3 of *Transducers*) consists of an input
    9alphabet AA, an output alphabet BB, a finite set Φ\Phi of mso formulas over
    10AA each with exactly one free first-order variable, an output map
    11ΦB\Phi \to B^*, and a string in BB^* for the empty input, such that for every
    12input string and every position in it exactly one formula of Φ\Phi is true at
    13that position. The relabelling maps a nonempty input to the concatenation, over
    14its positions, of the outputs of the unique formulas true there, and the empty
    15input to the designated string. MSO relabellings define exactly the rational
    16functions (Theorem C.4.4), and *first-order relabellings* — all of whose
    17formulas are first-order — exactly the functions of aperiodic bimachines
    18(Theorem C.4.16).
    19
    20# Formalization notes
    21
    22The set of formulas is indexed by a finite type `Idx`; the free variable of every
    23formula is the variable `0`, and a formula is evaluated at a position `p` under
    24the valuation sending every variable to `p`. `Relabels R w v` is the graph of
    25the relabelling, uniqueness of the true formula being a field of the structure.
    26-/
    27
    28namespace Lax314295.MSORelabellings
    29
    30open Lax314295.MSOLogic
    31
    32/-- An mso relabelling: a finite family of formulas with one free first-order
    33variable (the variable `0`), exactly one of which holds at each position of each
    34input, an output string for each formula, and an output for the empty input. -/
    35structure MSORelabelling (A B : Type) where
    36 /-- The index set of the formulas. -/
    37 Idx : Type
    38 /-- Finiteness of the index set. -/
    39 finIdx : Finite Idx
    40 /-- The formulas, each with the one free first-order variable `x₀`. -/
    41 form : Idx → MSO A
    42 /-- The output string of each formula. -/
    43 out : Idx → List B
    44 /-- The output string for the empty input. -/
    45 emptyOut : List B
    46 /-- At every position of every input string exactly one formula holds. -/
    47 unique : ∀ (w : List A) (p : ℕ), p < w.length →
    48 ∃! i : Idx, MSO.Sat w (fun _ => p) (fun _ => ∅) (form i)
    49
    50namespace MSORelabelling
    51
    52variable {A B : Type}
    53
    54/-- The relabelling maps `w` to `v`: for a nonempty input, `v` is the concatenation
    55of the outputs of the formulas true at the positions of `w`; the empty input
    56gives the designated string. -/
    57def Relabels (R : MSORelabelling A B) (w : List A) (v : List B) : Prop :=
    58 (w = [] ∧ v = R.emptyOut) ∨
    59 (w ≠ [] ∧ ∃ g : ℕ → R.Idx,
    60 (∀ p < w.length, MSO.Sat w (fun _ => p) (fun _ => ∅) (R.form (g p))) ∧
    61 v = ((List.range w.length).map (fun p => R.out (g p))).flatten)
    62
    63/-- All formulas of the relabelling are first-order. -/
    64def AllFO (R : MSORelabelling A B) : Prop := ∀ i, (R.form i).IsFO
    65
    66end MSORelabelling
    67
    68/-- A function defined by an mso relabelling. -/
    69def IsMSORelabelling {A B : Type} (f : List A → List B) : Prop :=
    70 ∃ R : MSORelabelling A B, ∀ w, R.Relabels w (f w)
    71
    72/-- A function defined by a first-order relabelling. -/
    73def IsFORelabelling {A B : Type} (f : List A → List B) : Prop :=
    74 ∃ R : MSORelabelling A B, R.AllFO ∧ ∀ w, R.Relabels w (f w)
    75
    76end Lax314295.MSORelabellings
    77

    Formalization notes

    The set of formulas is indexed by a finite type IdxIdx; the free variable of every formula is the variable 00, and a formula is evaluated at a position pp under the valuation sending every variable to pp. RelabelsRwvRelabels R w v is the graph of the relabelling, uniqueness of the true formula being a field of the structure.

    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…