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

Lax194892.PebbleConfigurationEncoding

String representations of pebble configurations, and balanced runs

concepts/Lax194892/PebbleConfigurationEncoding.lean · lax-194892

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

    Section D.2 of Transducers represents a configuration of a kk-pebble transducer on an input ww — a state and a stack of at most kk gaps of ww — as a string with one letter per gap of ww, the letter of a gap recording the state, the input letter that follows the gap and the set of pebbles sitting in the gap; the results on reachability speak about a pair of configurations at a time, encoded together. A run between two configurations of height \ell is balanced if the pebble at height \ell is never popped during it, although it may be moved.

    Lean source view on GitHub

    1import Lax194892.PebbleTransducers
    2
    3/-!
    4---
    5title: String representations of pebble configurations, and balanced runs
    6type: definition
    7---
    8Section D.2 of *Transducers* represents a configuration of a kk-pebble
    9transducer on an input ww — a state and a stack of at most kk gaps of ww — as
    10a string with one letter per gap of ww, the letter of a gap recording the
    11state, the input letter that follows the gap and the set of pebbles sitting in
    12the gap; the results on reachability speak about a *pair* of configurations at
    13a time, encoded together. A run between two configurations of height \ell is
    14*balanced* if the pebble at height \ell is never popped during it, although
    15it may be moved.
    16
    17# Formalization notes
    18
    19`pairEnc q₁ q₂ sts stt w` has `w.length + 1` letters, the last one being the
    20only one with no following input letter; `ann k st p` is the set of pebbles of
    21the stack `st` sitting in the gap `p`. `RestrReaches M w ℓ` is reachability
    22along runs all of whose configurations have height at least `ℓ`; with `ℓ = 0` it
    23is ordinary reachability, and for endpoints of height `ℓ` it is the book's
    24balanced run.
    25-/
    26
    27namespace Lax194892.PebbleConfigurationEncoding
    28
    29open Lax194892.PebbleTransducers
    30
    31/-- Reachability along runs whose configurations all have height at least `ℓ`:
    32the topmost `ℓ` pebbles are never popped. -/
    33inductive RestrReaches {A B Q : Type} {k : ℕ} (M : Pebble A B Q k) (w : List A) (ℓ : ℕ) :
    34 PebbleCfg Q → PebbleCfg Q → Prop
    35 /-- The empty run. -/
    36 | refl (q : Q) (st : List ℕ) (h : ℓ ≤ st.length) :
    37 RestrReaches M w ℓ (PebbleCfg.conf q st) (PebbleCfg.conf q st)
    38 /-- One step from a configuration of height at least `ℓ`. -/
    39 | step {q : Q} {st : List ℕ} {c' c'' : PebbleCfg Q} {o : List B} (h : ℓ ≤ st.length)
    40 (hs : M.stepCfg w (PebbleCfg.conf q st) = some (o, c'))
    41 (hr : RestrReaches M w ℓ c' c'') :
    42 RestrReaches M w ℓ (PebbleCfg.conf q st) c''
    43
    44/-- A balanced run between two configurations of height `ℓ`: the pebble at
    45height `ℓ` is never popped. -/
    46def BalancedRun {A B Q : Type} {k : ℕ} (M : Pebble A B Q k) (w : List A) (ℓ : ℕ)
    47 (c c' : PebbleCfg Q) : Prop :=
    48 RestrReaches M w ℓ c c'
    49
    50/-- The pebbles of the stack `st` sitting in the gap `p`. -/
    51def ann (k : ℕ) (st : List ℕ) (p : ℕ) : Fin k → Bool := fun i => decide (st[(i : ℕ)]? = some p)
    52
    53/-- A letter of the representation of a pair of configurations: the two states, the
    54input letter following the gap, and the pebbles of each configuration in the gap. -/
    55abbrev PairLetter (A Q : Type) (k : ℕ) := Q × Q × Option A × (Fin k → Bool) × (Fin k → Bool)
    56
    57/-- The string representation of the pair of configurations `(q₁, sts)` and
    58`(q₂, stt)` of the input `w`: one letter per gap. -/
    59def pairEnc {A Q : Type} {k : ℕ} (q₁ q₂ : Q) (sts stt : List ℕ) (w : List A) :
    60 List (PairLetter A Q k) :=
    61 (List.range (w.length + 1)).map fun p => (q₁, q₂, w[p]?, ann k sts p, ann k stt p)
    62
    63end Lax194892.PebbleConfigurationEncoding
    64

    Formalization notes

    pairEncq1q2stssttwpairEnc q₁ q₂ sts stt w has w.length+1w.length + 1 letters, the last one being the only one with no following input letter; annkstpann k st p is the set of pebbles of the stack stst sitting in the gap pp. RestrReachesMwRestrReaches M w ℓ is reachability along runs all of whose configurations have height at least ; with =0ℓ = 0 it is ordinary reachability, and for endpoints of height it is the book's balanced run.

    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…