Regular functions
Lax916827.RegularFunctions · concepts/Lax916827/RegularFunctions.lean · lax-916827
No public endorsements yet.
Loading review…
Sign in with ORCIDNatural Language Statement
Definition
The map reverse function is the map lifting of string reversal, applied blockwise between separators, and the map duplicate function is the map lifting of string duplication :
Neither is rational. A string-to-string function is regular (Definition C.0.1 of Transducers) if it can be obtained as a finite composition of functions each of which is a rational function, a map reverse function or a map duplicate function. The regular functions are the third step of the transducer ladder; Part C shows that they are the functions of two-way transducers, of streaming string transducers, of string-to-string mso transductions and of regular terms.
Concept map
In the paper
- page 84 of the paper of lax-157538, Transducers
Lean source view on GitHub
| 1 | import Lax765601.MapLifting |
| 2 | import Lax765601.CompositionClosure |
| 3 | import Lax132576.RationalFunctions |
| 4 | |
| 5 | /-! |
| 6 | --- |
| 7 | title: Regular functions |
| 8 | type: definition |
| 9 | --- |
| 10 | The *map reverse* function is the map lifting of string reversal, applied |
| 11 | blockwise between separators, and the *map duplicate* function is the map |
| 12 | lifting of string duplication : |
| 13 | |
| 14 | Neither is rational. A string-to-string function is *regular* (Definition |
| 15 | C.0.1 of *Transducers*) if it can be obtained as a finite composition of |
| 16 | functions each of which is a rational function, a map reverse function or a map |
| 17 | duplicate function. The regular functions are the third step of the transducer |
| 18 | ladder; Part C shows that they are the functions of two-way transducers, |
| 19 | of streaming string transducers, of string-to-string mso transductions and of |
| 20 | regular terms. |
| 21 | |
| 22 | # Formalization notes |
| 23 | |
| 24 | Map reverse and map duplicate are families of functions, one for every |
| 25 | alphabet `A`, of type `(A + 1)* → (A + 1)*` with `Option A` for `A + 1`. In the |
| 26 | family `RegularFam` they appear up to renaming: `f : A* → B*` is a map reverse if |
| 27 | the alphabets are in bijection with some `Option A₀` and `f` is `mapReverse A₀` |
| 28 | transported along the bijections. `IsRegularFun` is the composition closure of |
| 29 | `Lax765601.CompositionClosure`. |
| 30 | -/ |
| 31 | |
| 32 | namespace Lax916827.RegularFunctions |
| 33 | |
| 34 | open Lax765601.MapLifting Lax765601.CompositionClosure Lax132576.RationalFunctions |
| 35 | |
| 36 | /-- The map reverse function `w₁ # ⋯ # wₙ ↦ reverse w₁ # ⋯ # reverse wₙ`. -/ |
| 37 | def mapReverse (A : Type) : List (Option A) → List (Option A) := mapLift List.reverse |
| 38 | |
| 39 | /-- The map duplicate function `w₁ # ⋯ # wₙ ↦ w₁w₁ # ⋯ # wₙwₙ`. -/ |
| 40 | def mapDuplicate (A : Type) : List (Option A) → List (Option A) := mapLift (fun w => w ++ w) |
| 41 | |
| 42 | /-- The family of prime regular functions: rational functions, and the map reverse |
| 43 | and map duplicate functions, up to a renaming of the alphabets. -/ |
| 44 | def RegularFam : Family := fun A B f => |
| 45 | IsRationalFun f ∨ |
| 46 | (∃ (A₀ : Type) (e : A ≃ Option A₀) (e' : B ≃ Option A₀), |
| 47 | ∀ w, f w = (mapReverse A₀ (w.map e)).map e'.symm) ∨ |
| 48 | (∃ (A₀ : Type) (e : A ≃ Option A₀) (e' : B ≃ Option A₀), |
| 49 | ∀ w, f w = (mapDuplicate A₀ (w.map e)).map e'.symm) |
| 50 | |
| 51 | /-- A string-to-string function is regular if it is a finite composition of |
| 52 | rational functions, map reverse and map duplicate. -/ |
| 53 | def IsRegularFun {A B : Type} (f : List A → List B) : Prop := CompClosure RegularFam A B f |
| 54 | |
| 55 | end Lax916827.RegularFunctions |
| 56 |
Formalization notes
Map reverse and map duplicate are families of functions, one for every alphabet , of type with for . In the family they appear up to renaming: is a map reverse if the alphabets are in bijection with some and is transported along the bijections. is the composition closure of .
Used by
Lax194892.PolyregularFunctionsLax314295.MSOTransductionIffRegularLax314295.MSOTransductionOfRegularLax314295.RegularOfMSOTransductionLax709149.RegularUnderRepresentationLax916827.RegularCompositionLax916827.RegularConcatenationLax916827.RegularConditionalLax916827.RegularContinuityLax916827.RegularMapLiftingLax916827.RegularOfSSTLax916827.RegularOfTwoWayLax916827.RegularSumLax916827.SnakeLemmaLax916827.SSTIffRegularLax916827.SSTOfRegularLax916827.TwoWayIffRegularLax916827.TwoWayOfRegular
From Mathlib
none
Discussion
Ask a question or add context. Endorsements and structured flags are kept in the review panel above.
0 comments