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

Lax765601.MealyDerivatives

Myhill–Nerode for Mealy machines

concepts/Lax765601/MealyDerivatives.lean · lax-765601

proven

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

    Evidence

    Each proof establishes this claim relative to its assumptions.

    In the paper

    Theorem

    A string-to-string function is computed by a Mealy machine if and only if (1) it has finitely many derivatives, (2) it is letter-to-letter, and (3) its nn-th output letter depends only on the first nn input letters (Lemma A.2.10 of Transducers). From a machine, the derivative f(w_)f(w\_) is determined by the state reached after reading ww, so there are finitely many. Conversely, the minimal machine of ff has the derivatives as its states, the derivative of the empty string as initial state, and the transitions

    f(w_)a/last letter of f(wa)f(wa_),f(w\_) \xrightarrow{a\,/\,\text{last letter of } f(wa)} f(wa\_),

    which are well defined because the output letter and the target depend only on the derivative f(w_)f(w\_) and not on ww.

    Lean source view on GitHub

    1import Mathlib.Data.Set.Finite.Basic
    2import Lax765601.MealyMachine
    3import Lax765601.ElementaryProperties
    4import Lax765601.Derivatives
    5
    6/-!
    7---
    8title: Myhill–Nerode for Mealy machines
    9type: theorem
    10---
    11A string-to-string function is computed by a Mealy machine if and only if (1) it
    12has finitely many derivatives, (2) it is letter-to-letter, and (3) its nn-th
    13output letter depends only on the first nn input letters (Lemma A.2.10 of
    14*Transducers*). From a machine, the derivative f(w_)f(w\_) is determined by the
    15state reached after reading ww, so there are finitely many. Conversely, the
    16*minimal machine* of ff has the derivatives as its states, the derivative of the
    17empty string as initial state, and the transitions
    18f(w_)a/last letter of f(wa)f(wa_),f(w\_) \xrightarrow{a\,/\,\text{last letter of } f(wa)} f(wa\_),
    19which are well defined because the output letter and the target depend only on
    20the derivative f(w_)f(w\_) and not on ww.
    21
    22# Formalization notes
    23
    24Condition (3) is `PrefixDetermined f`, "the first `n` output letters depend only
    25on the first `n` input letters", which for a letter-to-letter function says
    26exactly that the `n`-th output letter depends only on the first `n` input
    27letters. The set of derivatives is the range of `deriv f`, and its finiteness is
    28mathlib's `Set.Finite`. No finiteness of the alphabets is assumed: the states of
    29the minimal machine are the derivatives, whatever the alphabets.
    30-/
    31
    32namespace Lax765601.MealyDerivatives
    33
    34open Lax765601.MealyMachine Lax765601.ElementaryProperties Lax765601.Derivatives
    35
    36/-- A function is computed by a Mealy machine if and only if it has finitely many
    37derivatives, is letter-to-letter, and its first `n` output letters depend only on
    38its first `n` input letters. -/
    39axiom isMealy_iff {A B : Type} (f : List A → List B) :
    40 IsMealy f ↔ (Set.range (deriv f)).Finite ∧ LengthPreserving f ∧ PrefixDetermined f
    41
    42end Lax765601.MealyDerivatives
    43
    Show Proof

    Formalization notes

    Condition (3) is PrefixDeterminedfPrefixDetermined f, "the first nn output letters depend only on the first nn input letters", which for a letter-to-letter function says exactly that the nn-th output letter depends only on the first nn input letters. The set of derivatives is the range of derivfderiv f, and its finiteness is mathlib's Set.FiniteSet.Finite. No finiteness of the alphabets is assumed: the states of the minimal machine are the derivatives, whatever the alphabets.

    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…