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

Lax916827.SnakeLemma

The snake lemma: the output of a snake graph is a regular function

concepts/Lax916827/SnakeLemma.lean · lax-916827

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

    Let CC be the alphabet representing snake graphs with states QQ and output alphabet BB. For every kk, the function mapping a string wCw \in C^* to the output of the snake graph it represents, if it represents a snake graph of width at most kk, and to ε\varepsilon otherwise, is regular (Lemma C.2.12 of Transducers, the book's snake lemma). The proof is an induction on the width: a snake of width kk visits the record-breaking columns, the ones it reaches for the first time further right than ever before; between two consecutive record-breakers the snake consists of a looping part and a progress part, both of width below kk, whose outputs are given by the induction hypothesis on factors cut out by rational functions, and the closure properties of Lemma C.2.10 glue them together.

    Lean source view on GitHub

    1import Lax916827.RegularFunctions
    2import Lax916827.SnakeGraphs
    3
    4/-!
    5---
    6title: The snake lemma: the output of a snake graph is a regular function
    7type: theorem
    8---
    9Let CC be the alphabet representing snake graphs with states QQ and output
    10alphabet BB. For every kk, the function mapping a string wCw \in C^* to the
    11output of the snake graph it represents, if it represents a snake graph of width
    12at most kk, and to ε\varepsilon otherwise, is regular (Lemma C.2.12 of
    13*Transducers*, the book's *snake lemma*). The proof is an induction on the
    14width: a snake of width kk visits the *record-breaking* columns, the ones it
    15reaches for the first time further right than ever before; between two
    16consecutive record-breakers the snake consists of a *looping part* and a
    17*progress part*, both of width below kk, whose outputs are given by the
    18induction hypothesis on factors cut out by rational functions, and the closure
    19properties of Lemma C.2.10 glue them together.
    20
    21# Formalization notes
    22
    23The function is `snakeOut k` of `SnakeGraphs`. The lemma is stated for every
    24`k`, not only for `k ∈ {1, …, |Q|}`, which is more general and costs nothing:
    25a column has at most `|Q|` vertices. The state set and the output alphabet are
    26assumed finite, so that the alphabet `C` is finite. The formal proof carries out
    27the induction for the width-`k` output function of an arbitrary two-way
    28transducer and reads the snake letters through the transducer that walks along a
    29snake graph.
    30-/
    31
    32namespace Lax916827.SnakeLemma
    33
    34open Lax916827.RegularFunctions Lax916827.SnakeGraphs
    35
    36/-- The output of a snake graph of width at most `k`, read off its string
    37representation, is a regular function. -/
    38axiom isRegularFun_snakeOut {Q B : Type} [Finite Q] [Finite B] (k : ℕ) :
    39 IsRegularFun (snakeOut (Q := Q) (B := B) k)
    40
    41end Lax916827.SnakeLemma
    42
    Show Proof

    Formalization notes

    The function is snakeOutksnakeOut k of SnakeGraphsSnakeGraphs. The lemma is stated for every kk, not only for k1,,Qk ∈ {1, …, |Q|}, which is more general and costs nothing: a column has at most Q|Q| vertices. The state set and the output alphabet are assumed finite, so that the alphabet CC is finite. The formal proof carries out the induction for the width-kk output function of an arbitrary two-way transducer and reads the snake letters through the transducer that walks along a snake graph.

    Used by

    none

    From Mathlib

    none

    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…