Documentation

Cedar.Thm.Data.String

============================================================================================== # Digit strings (Digit⁺) and their correspondence with toNat?'

`IsDigits` is the grammar-level notion of a non-empty run of digit characters — the
`Digit⁺` production common to numeric grammars. These lemmas connect it to the stdlib
natural-number parser `toNat?'`: a digit string is exactly one `toNat?'` accepts (modulo the
`'_'` separator, which `toNat?'` rejects and `Char.isDigit` never admits). The `IsDigits.*`
projections at the end give dot-notation for the facts parser proofs consume.
============================================================================================== 

Digit⁺: a non-empty string all of whose characters are decimal digits.

Equations
Instances For

    Digit{n}: a run of exactly n decimal digits. The fixed-width refinement of IsDigits, used wherever a grammar pins a field's width (the datetime grammar's YYYY, MM, SSS, …).

    Equations
    Instances For

      Digit{1,n}: between one and n decimal digits. IsDigits supplies the lower bound and the length constraint the upper (the decimal grammar's Fraction ::= Digit{1,4}).

      Equations
      Instances For

        ['-']: an optional leading minus sign, either present or absent. Shared by the numeric grammars that admit a signed literal (decimal's Sign, duration's leading '-').

        Equations
        Instances For

          Natural-number value of a captured decimal digit string, defaulting to 0 when parsing fails. On a field satisfying IsDigits, the default is never taken.

          Equations
          Instances For

            Length of a captured string as an integer, for use in grammar value formulas.

            Equations
            Instances For

              Sign denoted by a captured optional-minus field.

              Equations
              Instances For

                Rendering a natural number and parsing it with Cedar's underscore-rejecting parser recovers the original number.

                Nat.repr is accepted by Cedar's natural-number parser.

                The canonical decimal rendering of a natural number is a nonempty digit string.

                Nat.repr is a nonempty digit string.

                ============================================================================================== # Splitting a string on a separator ==============================================================================================

                ============================================================================================== # toString/repr of naturals contains no '.' ==============================================================================================

                ============================================================================================== # Digit-accumulating folds and Nat.toDigits roundtrip ==============================================================================================