definition
No public endorsements yet.
Loading review…
Sign in with ORCIDConcept map
In the paper
- page 151 of the paper of lax-157538, Transducers
Definition
The marked squaring function (Example 33 of Transducers) copies an input string of length exactly times, underlining the first letters of the -th copy:
The output has length over the alphabet , one copy of the input alphabet underlined and one plain. It is the one prime function of quadratic growth that, added to the regular functions, generates the polyregular functions (Definition D.0.1).
Lean source view on GitHub
| 1 | import Mathlib.Data.List.Basic |
| 2 | |
| 3 | /-! |
| 4 | --- |
| 5 | title: Marked squaring |
| 6 | type: definition |
| 7 | --- |
| 8 | The *marked squaring* function (Example 33 of *Transducers*) copies an input |
| 9 | string of length exactly times, underlining the first letters of the |
| 10 | -th copy: |
| 11 | |
| 12 | The output has length over the alphabet , one copy of the input |
| 13 | alphabet underlined and one plain. It is the one prime function of quadratic |
| 14 | growth that, added to the regular functions, generates the polyregular |
| 15 | functions (Definition D.0.1). |
| 16 | |
| 17 | # Formalization notes |
| 18 | |
| 19 | Underlined letters are `Sum.inl`, plain ones `Sum.inr`; the `i`-th copy is |
| 20 | `(w.take (i+1)).map Sum.inl ++ (w.drop (i+1)).map Sum.inr`. Marked squaring is a |
| 21 | family of functions, one for each alphabet. |
| 22 | -/ |
| 23 | |
| 24 | namespace Lax194892.MarkedSquaring |
| 25 | |
| 26 | /-- Marked squaring: `n` copies of an input of length `n`, the first `i` letters |
| 27 | of the `i`-th copy underlined. -/ |
| 28 | def markedSquare (A : Type) (w : List A) : List (A ⊕ A) := |
| 29 | ((List.range w.length).map |
| 30 | (fun i => (w.take (i + 1)).map Sum.inl ++ (w.drop (i + 1)).map Sum.inr)).flatten |
| 31 | |
| 32 | end Lax194892.MarkedSquaring |
| 33 |
Formalization notes
Underlined letters are , plain ones ; the -th copy is . Marked squaring is a family of functions, one for each alphabet.
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