Documentation

Mathlib.Data.UInt

Adds Mathlib specific instances to the UIntX data types. #

The CommRing instances (and the NatCast and IntCast instances from which they is built) are scoped in the UIntX.CommRing namespace, rather than available globally. As a result, the ring tactic will not work on UIntX types without open scoped UIntX.Ring.

This is because the presence of these casting operations contradicts assumptions made by the expression tree elaborator, namely that coercions do not form a cycle.

The UInt version also interferes more with software-verification use-cases, which is reason to be more cautious here.

Equations
  • One or more equations did not get rendered due to their size.
theorem UInt64.zsmul_def (z : ) (a : UInt64) :
z a = { val := z a.val }
theorem UInt64.natCast_def (n : ) :
n = { val := n }
Equations
  • One or more equations did not get rendered due to their size.
theorem UInt32.pow_def (a : UInt32) (n : ) :
a ^ n = { val := a.val ^ n }
Equations
theorem USize.nsmul_def (n : ) (a : USize) :
n a = { val := n a.val }

To use this instance, use open scoped UInt32.CommRing.

See the module docstring for an explanation

Equations
Instances For
    theorem UInt16.pow_def (a : UInt16) (n : ) :
    a ^ n = { val := a.val ^ n }
    Equations
    theorem UInt8.pow_def (a : UInt8) (n : ) :
    a ^ n = { val := a.val ^ n }
    Equations
    Equations
    theorem UInt16.zsmul_def (z : ) (a : UInt16) :
    z a = { val := z a.val }

    To use this instance, use open scoped UInt32.CommRing.

    See the module docstring for an explanation

    Equations
    Instances For
      Equations
      theorem USize.pow_def (a : USize) (n : ) :
      a ^ n = { val := a.val ^ n }
      Equations

      To use this instance, use open scoped UInt32.CommRing.

      See the module docstring for an explanation

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For

        To use this instance, use open scoped UInt64.CommRing.

        See the module docstring for an explanation

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          Equations
          theorem USize.intCast_def (z : ) :
          z = { val := z }
          Equations
          • One or more equations did not get rendered due to their size.
          Equations
          Equations

          To use this instance, use open scoped UInt16.CommRing.

          See the module docstring for an explanation

          Equations
          Instances For

            To use this instance, use open scoped UInt64.CommRing.

            See the module docstring for an explanation

            Equations
            Instances For
              theorem UInt16.intCast_def (z : ) :
              z = { val := z }
              theorem UInt64.intCast_def (z : ) :
              z = { val := z }
              theorem UInt64.neg_def (a : UInt64) :
              -a = { val := -a.val }
              theorem UInt32.neg_def (a : UInt32) :
              -a = { val := -a.val }
              Equations
              • One or more equations did not get rendered due to their size.
              theorem UInt16.nsmul_def (n : ) (a : UInt16) :
              n a = { val := n a.val }

              To use this instance, use open scoped UInt8.CommRing.

              See the module docstring for an explanation

              Equations
              Instances For
                Equations
                Equations
                theorem UInt8.intCast_def (z : ) :
                z = { val := z }
                theorem USize.neg_def (a : USize) :
                -a = { val := -a.val }

                To use this instance, use open scoped USize.CommRing.

                See the module docstring for an explanation

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  theorem USize.natCast_def (n : ) :
                  n = { val := n }
                  theorem UInt16.natCast_def (n : ) :
                  n = { val := n }

                  To use this instance, use open scoped UInt8.CommRing.

                  See the module docstring for an explanation

                  Equations
                  Instances For
                    Equations
                    • One or more equations did not get rendered due to their size.
                    theorem UInt8.natCast_def (n : ) :
                    n = { val := n }
                    theorem USize.zsmul_def (z : ) (a : USize) :
                    z a = { val := z a.val }
                    theorem UInt64.pow_def (a : UInt64) (n : ) :
                    a ^ n = { val := a.val ^ n }
                    theorem UInt16.neg_def (a : UInt16) :
                    -a = { val := -a.val }
                    Equations
                    Equations
                    theorem UInt8.neg_def (a : UInt8) :
                    -a = { val := -a.val }

                    To use this instance, use open scoped UInt8.CommRing.

                    See the module docstring for an explanation

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      Equations

                      To use this instance, use open scoped UInt16.CommRing.

                      See the module docstring for an explanation

                      Equations
                      Instances For
                        Equations
                        Equations
                        Equations
                        theorem UInt32.intCast_def (z : ) :
                        z = { val := z }

                        To use this instance, use open scoped UInt64.CommRing.

                        See the module docstring for an explanation

                        Equations
                        Instances For

                          To use this instance, use open scoped UInt16.CommRing.

                          See the module docstring for an explanation

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            theorem UInt32.zsmul_def (z : ) (a : UInt32) :
                            z a = { val := z a.val }
                            theorem UInt32.nsmul_def (n : ) (a : UInt32) :
                            n a = { val := n a.val }

                            To use this instance, use open scoped USize.CommRing.

                            See the module docstring for an explanation

                            Equations
                            Instances For
                              Equations
                              theorem UInt64.nsmul_def (n : ) (a : UInt64) :
                              n a = { val := n a.val }
                              Equations
                              theorem UInt8.zsmul_def (z : ) (a : UInt8) :
                              z a = { val := z a.val }

                              To use this instance, use open scoped USize.CommRing.

                              See the module docstring for an explanation

                              Equations
                              Instances For
                                Equations
                                theorem UInt8.nsmul_def (n : ) (a : UInt8) :
                                n a = { val := n a.val }
                                theorem UInt32.natCast_def (n : ) :
                                n = { val := n }

                                Is this an uppercase ASCII letter?

                                Equations
                                Instances For

                                  Is this a lowercase ASCII letter?

                                  Equations
                                  Instances For

                                    Is this an alphabetic ASCII character?

                                    Equations
                                    • c.isASCIIAlpha = (c.isASCIIUpper || c.isASCIILower)
                                    Instances For

                                      Is this an ASCII digit character?

                                      Equations
                                      Instances For

                                        Is this an alphanumeric ASCII character?

                                        Equations
                                        • c.isASCIIAlphanum = (c.isASCIIAlpha || c.isASCIIDigit)
                                        Instances For
                                          @[deprecated UInt8.isASCIIUpper]

                                          Alias of UInt8.isASCIIUpper.


                                          Is this an uppercase ASCII letter?

                                          Equations
                                          Instances For
                                            @[deprecated UInt8.isASCIILower]

                                            Alias of UInt8.isASCIILower.


                                            Is this a lowercase ASCII letter?

                                            Equations
                                            Instances For
                                              @[deprecated UInt8.isASCIIAlpha]

                                              Alias of UInt8.isASCIIAlpha.


                                              Is this an alphabetic ASCII character?

                                              Equations
                                              Instances For
                                                @[deprecated UInt8.isASCIIDigit]

                                                Alias of UInt8.isASCIIDigit.


                                                Is this an ASCII digit character?

                                                Equations
                                                Instances For
                                                  @[deprecated UInt8.isASCIIAlphanum]

                                                  Alias of UInt8.isASCIIAlphanum.


                                                  Is this an alphanumeric ASCII character?

                                                  Equations
                                                  Instances For

                                                    The numbers from 0 to 256 are all valid UTF-8 characters, so we can embed one in the other.

                                                    Equations
                                                    • n.toChar = { val := n.toUInt32, valid := }
                                                    Instances For