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

Lax765601.MealyEquivalenceBound

Decidable equivalence of Mealy machines

concepts/Lax765601/MealyEquivalenceBound.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

    The equivalence problem for Mealy machines — do two given machines compute the same function? — is decidable (Theorem A.1.2 of Transducers). The book reduces it to the equivalence of regular languages: a letter-to-letter function is determined by the languages "the last output letter is bb", one for each output letter bb, and each of them is recognised by the automaton underlying the machine. In the form stated here, two Mealy machines with n1n_1 and n2n_2 states are equivalent if and only if they agree on all input strings of length at most n1n2n_1 n_2 — a finite check, since the alphabet is finite.

    Lean source view on GitHub

    1import Mathlib.SetTheory.Cardinal.Finite
    2import Lax765601.MealyMachine
    3
    4/-!
    5---
    6title: Decidable equivalence of Mealy machines
    7type: theorem
    8---
    9The equivalence problem for Mealy machines — do two given machines compute the
    10same function? — is decidable (Theorem A.1.2 of *Transducers*). The book reduces
    11it to the equivalence of regular languages: a letter-to-letter function is
    12determined by the languages "the last output letter is bb", one for each output
    13letter bb, and each of them is recognised by the automaton underlying the
    14machine. In the form stated here, two Mealy machines with n1n_1 and n2n_2 states
    15are equivalent if and only if they agree on all input strings of length at most
    16n1n2n_1 n_2 — a finite check, since the alphabet is finite.
    17
    18# Formalization notes
    19
    20Decidability is expressed by its mathematical content, the finite check, rather
    21than by a decision procedure on encodings of machines: the product of the numbers
    22of states bounds the length of a shortest input on which two inequivalent
    23machines differ, because a pair of runs that repeats a pair of states can be
    24shortened by cutting out the loop. `Nat.card Q` is the number of states of a
    25finite state space. The statement holds over any input alphabet, finite or not;
    26finiteness of the alphabet is what makes the check a finite one.
    27-/
    28
    29namespace Lax765601.MealyEquivalenceBound
    30
    31open Lax765601.MealyMachine
    32
    33/-- Two Mealy machines are equivalent if and only if they agree on every input
    34string of length at most the product of their numbers of states. -/
    35axiom eval_eq_iff_short {A B Q₁ Q₂ : Type} [Finite Q₁] [Finite Q₂]
    36 (M : Mealy A B Q₁) (N : Mealy A B Q₂) :
    37 M.eval = N.eval
    38 ∀ w : List A, w.length ≤ Nat.card Q₁ * Nat.card Q₂ → M.eval w = N.eval w
    39
    40end Lax765601.MealyEquivalenceBound
    41
    Show Proof

    Formalization notes

    Decidability is expressed by its mathematical content, the finite check, rather than by a decision procedure on encodings of machines: the product of the numbers of states bounds the length of a shortest input on which two inequivalent machines differ, because a pair of runs that repeats a pair of states can be shortened by cutting out the loop. Nat.cardQNat.card Q is the number of states of a finite state space. The statement holds over any input alphabet, finite or not; finiteness of the alphabet is what makes the check a finite one.

    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…