Test if byte is an ASCII letter. $$\text{isAlpha}(w) \iff \text{isUpper}(w) \lor \text{isLower}(w)$$
Equations
Instances For
Test if byte is an ASCII letter or digit. $$\text{isAlphaNum}(w) \iff \text{isAlpha}(w) \lor \text{isDigit}(w)$$
Equations
Instances For
Test if byte is an ASCII control character. $$\text{isControl}(w) \iff w < 32 \lor w = 127$$
Instances For
Test if byte is an ASCII hexadecimal digit. $$\text{isHexDigit}(w) \iff \text{isDigit}(w) \lor w \in [65,70] \lor w \in [97,102]$$
Equations
Instances For
Test if byte is in the ASCII range. $$\text{isAscii}(w) \iff w \le 127$$
Equations
- Data.Word8.isAscii w = decide (w ≤ 127)
Instances For
Convert an uppercase ASCII letter to lowercase; other bytes unchanged. $$\text{toLower}(w) = \begin{cases} w + 32 & \text{if } w \in [65,90] \\ w & \text{otherwise} \end{cases}$$
Equations
- Data.Word8.toLower w = if Data.Word8.isUpper w = true then w + 32 else w
Instances For
Convert a lowercase ASCII letter to uppercase; other bytes unchanged. $$\text{toUpper}(w) = \begin{cases} w - 32 & \text{if } w \in [97,122] \\ w & \text{otherwise} \end{cases}$$
Equations
- Data.Word8.toUpper w = if Data.Word8.isLower w = true then w - 32 else w
Instances For
toLower maps uppercase letters to lowercase letters.
$$\forall w.\; \text{isUpper}(w) \to \text{isLower}(\text{toLower}(w))$$
Proved by exhaustive evaluation over all 256 UInt8 values via native_decide.
toUpper maps lowercase letters to uppercase letters.
$$\forall w.\; \text{isLower}(w) \to \text{isUpper}(\text{toUpper}(w))$$
Proved by exhaustive evaluation over all 256 UInt8 values via native_decide.