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

Lax132576.Bimachines

Bimachines

concepts/Lax132576/Bimachines.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 bimachine (Definition B.2.2 of Transducers) is a deterministic model for the rational functions. It consists of input and output alphabets AA and BB, two deterministic automata over AA without accepting states — the prefix automaton and the suffix automaton — and an output function

    (states of the prefix automaton)×(states of the suffix automaton)B.(\text{states of the prefix automaton}) \times (\text{states of the suffix automaton}) \to B^*.

    On an input a1ana_1 \cdots a_n it considers, for every i{0,,n}i \in \{0, \ldots, n\}, the factorisation into the prefix a1aia_1 \cdots a_i and the suffix ai+1ana_{i+1} \cdots a_n, runs the prefix automaton on the prefix and the suffix automaton on the reverse of the suffix, applies the output function to the resulting pair of states, and concatenates the n+1n + 1 pieces in increasing order of ii. Bimachines compute exactly the rational functions (Theorem B.2.3). A bimachine is aperiodic if both its automata are aperiodic, i.e. satisfy the stabilisation condition on state transformations; aperiodic bimachines compute exactly the first-order relabellings (Theorem C.4.16).

    Lean source view on GitHub

    1import Lax765601.StateTransformations
    2
    3/-!
    4---
    5title: Bimachines
    6type: definition
    7---
    8A *bimachine* (Definition B.2.2 of *Transducers*) is a deterministic model for
    9the rational functions. It consists of input and output alphabets AA and BB,
    10two deterministic automata over AA without accepting states — the *prefix*
    11automaton and the *suffix* automaton — and an output function
    12(states of the prefix automaton)×(states of the suffix automaton)B.(\text{states of the prefix automaton}) \times (\text{states of the suffix automaton}) \to B^*.
    13On an input a1ana_1 \cdots a_n it considers, for every i{0,,n}i \in \{0, \ldots, n\},
    14the factorisation into the prefix a1aia_1 \cdots a_i and the suffix
    15ai+1ana_{i+1} \cdots a_n, runs the prefix automaton on the prefix and the suffix
    16automaton on the *reverse* of the suffix, applies the output function to the
    17resulting pair of states, and concatenates the n+1n + 1 pieces in increasing
    18order of ii. Bimachines compute exactly the rational functions (Theorem
    19B.2.3). A bimachine is *aperiodic* if both its automata are aperiodic, i.e.
    20satisfy the stabilisation condition on state transformations; aperiodic
    21bimachines compute exactly the first-order relabellings (Theorem C.4.16).
    22
    23# Formalization notes
    24
    25Each automaton is an initial state and a transition function; the state
    26transformation of a string is `strTrans` of `Lax765601.StateTransformations`,
    27and reading the suffix in reverse is `strTrans M.suffixStep (w.drop i).reverse`.
    28`IsBimachine f` asks for finite state spaces of both automata.
    29-/
    30
    31namespace Lax132576.Bimachines
    32
    33open Lax765601.StateTransformations
    34
    35/-- A bimachine: a deterministic prefix automaton, a deterministic suffix automaton
    36(run on the reverse of the suffix) and an output function on pairs of states. -/
    37structure Bimachine (A B P S : Type) where
    38 /-- Initial state of the prefix automaton. -/
    39 prefixInit : P
    40 /-- Transition function of the prefix automaton. -/
    41 prefixStep : P → A → P
    42 /-- Initial state of the suffix automaton. -/
    43 suffixInit : S
    44 /-- Transition function of the suffix automaton. -/
    45 suffixStep : S → A → S
    46 /-- The output function. -/
    47 out : P → S → List B
    48
    49namespace Bimachine
    50
    51variable {A B P S : Type}
    52
    53/-- The semantics of a bimachine: for every gap `i` of the input, the prefix
    54automaton is run on the first `i` letters and the suffix automaton on the reverse
    55of the rest, and the pieces of output are concatenated. -/
    56def eval (M : Bimachine A B P S) (w : List A) : List B :=
    57 ((List.range (w.length + 1)).map (fun i =>
    58 M.out (strTrans M.prefixStep (w.take i) M.prefixInit)
    59 (strTrans M.suffixStep (w.drop i).reverse M.suffixInit))).flatten
    60
    61end Bimachine
    62
    63/-- A function computed by a bimachine with finite state spaces. -/
    64def IsBimachine {A B : Type} (f : List A → List B) : Prop :=
    65 ∃ (P S : Type) (_ : Finite P) (_ : Finite S) (M : Bimachine A B P S), M.eval = f
    66
    67/-- A function computed by an aperiodic bimachine: both automata satisfy the
    68stabilisation condition on their state transformations. -/
    69def IsAperiodicBimachine {A B : Type} (f : List A → List B) : Prop :=
    70 ∃ (P S : Type) (_ : Finite P) (_ : Finite S) (M : Bimachine A B P S),
    71 M.eval = f ∧ TransAperiodic M.prefixStepTransAperiodic M.suffixStep
    72
    73end Lax132576.Bimachines
    74

    Formalization notes

    Each automaton is an initial state and a transition function; the state transformation of a string is strTransstrTrans of Lax765601.StateTransformationsLax765601.StateTransformations, and reading the suffix in reverse is strTransM.suffixStep(w.dropi).reversestrTrans M.suffixStep (w.drop i).reverse. IsBimachinefIsBimachine f asks for finite state spaces of both automata.

    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…