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

Lax132576.SequentialTransducers

Sequential transducers

concepts/Lax132576/SequentialTransducers.lean · lax-132576

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

    A sequential transducer (Section B.4.2 of Transducers) is defined like a Mealy machine, except that its transition function has type

    Q×AQ×B,Q \times A \to Q \times B^*,

    so that a transition may produce an output string of any length, including the empty one, instead of exactly one letter. The functions computed by sequential transducers, the sequential functions, lie strictly between the Mealy machines and the rational functions; Theorem B.4.6 characterises them without reference to a machine.

    Lean source view on GitHub

    1import Mathlib.Data.Finite.Defs
    2
    3/-!
    4---
    5title: Sequential transducers
    6type: definition
    7---
    8A *sequential transducer* (Section B.4.2 of *Transducers*) is defined like a
    9Mealy machine, except that its transition function has type
    10Q×AQ×B,Q \times A \to Q \times B^*,
    11so that a transition may produce an output string of any length, including the
    12empty one, instead of exactly one letter. The functions computed by sequential
    13transducers, the *sequential functions*, lie strictly between the Mealy
    14machines and the rational functions; Theorem B.4.6 characterises them without
    15reference to a machine.
    16
    17# Formalization notes
    18
    19`run` concatenates the output strings of the transitions taken from a given
    20state, and `eval` is the run from the initial state; `IsSequential f` asks for a
    21finite state space.
    22-/
    23
    24namespace Lax132576.SequentialTransducers
    25
    26/-- A sequential transducer: a Mealy machine whose transitions produce output
    27strings of variable length. -/
    28structure Sequential (A B Q : Type) where
    29 /-- The initial state. -/
    30 init : Q
    31 /-- The transition function: a target state and an output string. -/
    32 step : Q → A → Q × List B
    33
    34namespace Sequential
    35
    36variable {A B Q : Type}
    37
    38/-- The output produced from a given state on an input string. -/
    39def run (T : Sequential A B Q) : Q → List A → List B
    40 | _, [] => []
    41 | q, a :: w => (T.step q a).2 ++ T.run (T.step q a).1 w
    42
    43/-- The semantics of a sequential transducer. -/
    44def eval (T : Sequential A B Q) (w : List A) : List B := T.run T.init w
    45
    46/-- The transition function of the underlying automaton. -/
    47def transFun (T : Sequential A B Q) : Q → A → Q := fun q a => (T.step q a).1
    48
    49end Sequential
    50
    51/-- A function computed by a sequential transducer with a finite state space. -/
    52def IsSequential {A B : Type} (f : List A → List B) : Prop :=
    53 ∃ (Q : Type) (_ : Finite Q) (T : Sequential A B Q), T.eval = f
    54
    55end Lax132576.SequentialTransducers
    56

    Formalization notes

    runrun concatenates the output strings of the transitions taken from a given state, and evaleval is the run from the initial state; IsSequentialfIsSequential f asks for a finite state space.

    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…