The UTF-8 byte length of a list of characters. (This is intended for specification purposes.)
Equations
Instances For
A string position is valid if it is equal to the UTF-8 length of an initial substring of s
.
Equations
Instances For
Induction along the valid positions in a list of characters. (This definition is intended only for specification purposes.)
Equations
- String.utf8InductionOn [] i p nil eq ind = nil i
- String.utf8InductionOn (c :: cs) i p nil eq ind = if h : i = p then (_ : p = i) ▸ eq c cs else ind c cs i h (String.utf8InductionOn cs (i + c) p nil eq ind)
Instances For
Validity for a string iterator.
Equations
- String.Iterator.Valid it = String.Pos.Valid it.s (String.Iterator.pos it)
Instances For
it.ValidFor l r
means that it
is a string iterator whose underlying string is
l.reverse ++ r
, and where the cursor is pointing at the end of l.reverse
.
- mk: ∀ {l r : List Char},
String.Iterator.ValidFor l r { s := { data := List.reverseAux l r }, i := { byteIdx := String.utf8Len l } }
The canonical constructor for
ValidFor
.
Instances For
Validity for a substring.
- startValid : String.Pos.Valid s.str s.startPos
The start position of a valid substring is valid.
- stopValid : String.Pos.Valid s.str s.stopPos
The stop position of a valid substring is valid.
- le : s.startPos ≤ s.stopPos
The stop position of a substring is at least the start.
Instances For
A substring is represented by three lists l m r
, where m
is the middle section
(the actual substring) and l ++ m ++ r
is the underlying string.
- mk: ∀ {l m r : List Char},
Substring.ValidFor l m r
{ str := { data := l ++ m ++ r }, startPos := { byteIdx := String.utf8Len l },
stopPos := { byteIdx := String.utf8Len l + String.utf8Len m } }
The constructor for
ValidFor
.