No public endorsements yet.
Loading review…
Sign in with ORCIDConcept map
In the paper
- page 87 of the paper of lax-157538, Transducers
Definition
The equivalence problem for regular functions (Theorem C.1.4 of Transducers) is decided on two-way transducers, which by Theorem C.2.9 compute exactly the regular functions. A two-way transducer with states and letters in is described by a finite code: a lookup table for its transition function, listing for finitely many triples (letter to the left, state, letter to the right) the transition taken there. The initial state is , and a triple absent from the table halts with empty output. A code is total if the transducer it describes halts on every input.
Lean source view on GitHub
| 1 | import Mathlib.Computability.Primrec.List |
| 2 | import Lax916827.TwoWayTransducers |
| 3 | |
| 4 | /-! |
| 5 | --- |
| 6 | title: Codes of two-way transducers |
| 7 | type: definition |
| 8 | --- |
| 9 | The equivalence problem for regular functions (Theorem C.1.4 of *Transducers*) |
| 10 | is decided on two-way transducers, which by Theorem C.2.9 compute exactly the |
| 11 | regular functions. A two-way transducer with states and letters in |
| 12 | is described by a finite *code*: a lookup table for its transition |
| 13 | function, listing for finitely many triples (letter to the left, state, letter |
| 14 | to the right) the transition taken there. The initial state is , and a |
| 15 | triple absent from the table halts with empty output. A code is *total* if the |
| 16 | transducer it describes halts on every input. |
| 17 | |
| 18 | # Formalization notes |
| 19 | |
| 20 | `TwoWayCode` is a list of table entries; it is `Primcodable` as a list of pairs, |
| 21 | so that decidability can be stated with `DecidableUnderPromise` of |
| 22 | `Lax132576.TransducerCodes`. `twoWayCodeRel c` is the relation computed by the |
| 23 | coded transducer (a partial function, by determinism), and `TwoWayCodeTotal` the |
| 24 | promise that it is total. |
| 25 | -/ |
| 26 | |
| 27 | namespace Lax916827.TwoWayCodes |
| 28 | |
| 29 | open Lax916827.TwoWayTransducers |
| 30 | |
| 31 | /-- A code of a two-way transducer over `ℕ`: a lookup table from triples (letter to |
| 32 | the left, state, letter to the right) to transitions. -/ |
| 33 | abbrev TwoWayCode := List ((Option ℕ × ℕ × Option ℕ) × (List ℕ ⊕ (ℕ × List ℕ × Bool))) |
| 34 | |
| 35 | /-- The two-way transducer described by a code: initial state `0`, and the table |
| 36 | entry of a triple, or halting with empty output when the triple is absent. -/ |
| 37 | def twoWayCodeAut (c : TwoWayCode) : TwoWay ℕ ℕ ℕ where |
| 38 | init := 0 |
| 39 | step := fun l q r => |
| 40 | match c.lookup (l, q, r) with |
| 41 | | some x => x |
| 42 | | none => Sum.inl [] |
| 43 | |
| 44 | /-- The relation computed by the coded transducer. -/ |
| 45 | def twoWayCodeRel (c : TwoWayCode) : List ℕ → List ℕ → Prop := (twoWayCodeAut c).Computes |
| 46 | |
| 47 | /-- The coded transducer computes a total function: it halts on every input. -/ |
| 48 | def TwoWayCodeTotal (c : TwoWayCode) : Prop := ∀ w, ∃ v, twoWayCodeRel c w v |
| 49 | |
| 50 | end Lax916827.TwoWayCodes |
| 51 |
Formalization notes
is a list of table entries; it is as a list of pairs, so that decidability can be stated with of . is the relation computed by the coded transducer (a partial function, by determinism), and the promise that it is total.
Builds on
From Mathlib
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