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

Lax132576.SubsequentialTransducers

Subsequential transducers

concepts/Lax132576/SubsequentialTransducers.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 subsequential transducer (Section B.4.3 of Transducers) is a sequential transducer equipped with a partial end-of-input function, which is applied to the state reached after the whole input has been read: its value, if defined, is appended to the output, and if it is undefined the transducer has no output. Subsequential transducers therefore compute partial functions; they can, for instance, append a letter to their input, which a sequential transducer cannot, and a function that is undefined on some inputs can be computed. Theorem B.4.8 characterises the subsequential functions.

    Lean source view on GitHub

    1import Lax765601.StateTransformations
    2import Lax132576.SequentialTransducers
    3
    4/-!
    5---
    6title: Subsequential transducers
    7type: definition
    8---
    9A *subsequential transducer* (Section B.4.3 of *Transducers*) is a sequential
    10transducer equipped with a partial *end-of-input* function, which is applied to
    11the state reached after the whole input has been read: its value, if defined,
    12is appended to the output, and if it is undefined the transducer has no output.
    13Subsequential transducers therefore compute *partial* functions; they can, for
    14instance, append a letter to their input, which a sequential transducer cannot,
    15and a function that is undefined on some inputs can be computed. Theorem B.4.8
    16characterises the subsequential functions.
    17
    18# Formalization notes
    19
    20A partial function is a function into `Option (List B)`. The end-of-input
    21function is `Q → Option (List B)`; the semantics is the output of the
    22sequential part followed by the end-of-input value at the state reached, when
    23that value is defined. `IsSubsequential f` asks for a finite state space.
    24-/
    25
    26namespace Lax132576.SubsequentialTransducers
    27
    28open Lax765601.StateTransformations Lax132576.SequentialTransducers
    29
    30/-- A subsequential transducer: a sequential transducer with a partial end-of-input
    31function applied to the last state of the run. -/
    32structure Subsequential (A B Q : Type) extends Sequential A B Q where
    33 /-- The partial end-of-input function. -/
    34 endOfInput : Q → Option (List B)
    35
    36namespace Subsequential
    37
    38variable {A B Q : Type}
    39
    40/-- The semantics of a subsequential transducer: the output of the sequential
    41part followed by the end-of-input value, when defined. -/
    42def eval (T : Subsequential A B Q) (w : List A) : Option (List B) :=
    43 (T.endOfInput (strTrans T.toSequential.transFun w T.toSequential.init)).map
    44 (fun u => T.toSequential.eval w ++ u)
    45
    46end Subsequential
    47
    48/-- A partial function computed by a subsequential transducer with a finite state
    49space. -/
    50def IsSubsequential {A B : Type} (f : List A → Option (List B)) : Prop :=
    51 ∃ (Q : Type) (_ : Finite Q) (T : Subsequential A B Q), T.eval = f
    52
    53end Lax132576.SubsequentialTransducers
    54

    Formalization notes

    A partial function is a function into Option(ListB)Option (List B). The end-of-input function is QOption(ListB)Q → Option (List B); the semantics is the output of the sequential part followed by the end-of-input value at the state reached, when that value is defined. IsSubsequentialfIsSubsequential 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…