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

Lax132576.LeftDistance

Left distance and bounded variation

concepts/Lax132576/LeftDistance.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

    The left distance w1,w2\|w_1, w_2\| of two strings (Definition B.4.7 of Transducers) is the smallest kk such that the strings decompose as

    w1=vv1,w2=vv2with v1,v2k,w_1 = v\,v_1, \qquad w_2 = v\,v_2 \qquad \text{with } |v_1|, |v_2| \le k,

    i.e. the larger of the two lengths that remain after the longest common prefix has been removed. It measures how far apart two outputs of a transducer can be allowed to be after reading the same input. A partial function ff has bounded variation if for all w1,w2w_1, w_2 the left distances f(ww1),f(ww2)\|f(w w_1), f(w w_2)\| are bounded, ww ranging over the strings for which both values are defined (Theorem B.4.8); for a total function, the relation

    w1w2supwf(ww1),f(ww2)<w_1 \sim w_2 \quad\Longleftrightarrow\quad \sup_w \|f(w w_1), f(w w_2)\| < \infty

    is an equivalence relation on input strings, and its index is what characterises the rational functions (Theorem B.4.13).

    Lean source view on GitHub

    1import Mathlib.Order.ConditionallyCompleteLattice.Basic
    2import Mathlib.Data.Nat.Lattice
    3
    4/-!
    5---
    6title: Left distance and bounded variation
    7type: definition
    8---
    9The *left distance* w1,w2\|w_1, w_2\| of two strings (Definition B.4.7 of
    10*Transducers*) is the smallest kk such that the strings decompose as
    11w1=vv1,w2=vv2with v1,v2k,w_1 = v\,v_1, \qquad w_2 = v\,v_2 \qquad \text{with } |v_1|, |v_2| \le k,
    12i.e. the larger of the two lengths that remain after the longest common prefix
    13has been removed. It measures how far apart two outputs of a transducer can be
    14allowed to be after reading the same input. A partial function ff has
    15*bounded variation* if for all w1,w2w_1, w_2 the left distances
    16f(ww1),f(ww2)\|f(w w_1), f(w w_2)\| are bounded, ww ranging over the strings for which
    17both values are defined (Theorem B.4.8); for a total function, the relation
    18w1w2supwf(ww1),f(ww2)<w_1 \sim w_2 \quad\Longleftrightarrow\quad \sup_w \|f(w w_1), f(w w_2)\| < \infty
    19is an equivalence relation on input strings, and its index is what
    20characterises the rational functions (Theorem B.4.13).
    21
    22# Formalization notes
    23
    24`leftDist` is the infimum of the set of admissible `k`, which is nonempty
    25(`max |w₁| |w₂|` always works), so the infimum is attained and the convention
    26`sInf ∅ = 0` is never exercised. `BoundedVarRel f` is the relation `∼`, and
    27`BoundedVariation` the property of a partial function.
    28-/
    29
    30namespace Lax132576.LeftDistance
    31
    32/-- The left distance `‖w₁, w₂‖`: the least `k` such that `w₁ = v v₁` and
    33`w₂ = v v₂` with `|v₁|, |v₂| ≤ k`. -/
    34noncomputable def leftDist {B : Type} (w₁ w₂ : List B) : ℕ :=
    35 sInf {k : ℕ | ∃ v v₁ v₂ : List B,
    36 w₁ = v ++ v₁ ∧ w₂ = v ++ v₂ ∧ v₁.length ≤ k ∧ v₂.length ≤ k}
    37
    38/-- The relation `w₁ ∼ w₂` of Theorem B.4.13: the left distances
    39`‖f (w w₁), f (w w₂)‖` are bounded uniformly in `w`. -/
    40def BoundedVarRel {A B : Type} (f : List A → List B) (w₁ w₂ : List A) : Prop :=
    41 ∃ K : ℕ, ∀ w : List A, leftDist (f (w ++ w₁)) (f (w ++ w₂)) ≤ K
    42
    43/-- A partial function has bounded variation if for all `w₁, w₂` the left distances
    44`‖f (w w₁), f (w w₂)‖` are bounded, over the `w` for which both are defined. -/
    45def BoundedVariation {A B : Type} (f : List A → Option (List B)) : Prop :=
    46 ∀ w₁ w₂ : List A, ∃ K : ℕ, ∀ (w : List A) (v₁ v₂ : List B),
    47 f (w ++ w₁) = some v₁ → f (w ++ w₂) = some v₂ → leftDist v₁ v₂ ≤ K
    48
    49end Lax132576.LeftDistance
    50

    Formalization notes

    leftDistleftDist is the infimum of the set of admissible kk, which is nonempty (maxw1w2max |w₁| |w₂| always works), so the infimum is attained and the convention sInf=0sInf ∅ = 0 is never exercised. BoundedVarRelfBoundedVarRel f is the relation , and BoundedVariationBoundedVariation the property of a partial function.

    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…