This module exists to provide the very basic UInt8 etc. definitions required for
Init.Data.Char.Basic and Init.Data.Array.Basic. These are very important as they are used in
meta code that is then (transitively) used in Init.Data.UInt.Basic and Init.Data.BitVec.Basic.
This file thus breaks the import cycle that would be created by this dependency.
Converts the given natural number to UInt8, but returns 2^8 - 1 for natural numbers >= 2^8.
Equations
- UInt8.ofNatTruncate n = if h : n < UInt8.size then UInt8.ofNatLT n h else UInt8.ofNatLT (UInt8.size - 1) UInt8.ofNatTruncate.proof_1
Instances For
Equations
Instances For
Equations
- UInt8.instOfNat = { ofNat := UInt8.ofNat n }
Equations
- UInt16.ofNat n = { toBitVec := BitVec.ofNat 16 n }
Instances For
Converts the given natural number to UInt16, but returns 2^16 - 1 for natural numbers >= 2^16.
Equations
- UInt16.ofNatTruncate n = if h : n < UInt16.size then UInt16.ofNatLT n h else UInt16.ofNatLT (UInt16.size - 1) UInt16.ofNatTruncate.proof_1
Instances For
Equations
Instances For
Equations
- UInt16.instOfNat = { ofNat := UInt16.ofNat n }
Equations
- UInt32.ofNat n = { toBitVec := BitVec.ofNat 32 n }
Instances For
Pack a Nat less than 2^32 into a UInt32.
This function is overridden with a native implementation.
Equations
- UInt32.ofNat' n h = UInt32.ofNatLT n h
Instances For
Converts the given natural number to UInt32, but returns 2^32 - 1 for natural numbers >= 2^32.
Equations
- UInt32.ofNatTruncate n = if h : n < UInt32.size then UInt32.ofNatLT n h else UInt32.ofNatLT (UInt32.size - 1) UInt32.ofNatTruncate.proof_1
Instances For
Equations
Instances For
Equations
- UInt32.instOfNat = { ofNat := UInt32.ofNat n }
Equations
- UInt64.ofNat n = { toBitVec := BitVec.ofNat 64 n }
Instances For
Converts the given natural number to UInt64, but returns 2^64 - 1 for natural numbers >= 2^64.
Equations
- UInt64.ofNatTruncate n = if h : n < UInt64.size then UInt64.ofNatLT n h else UInt64.ofNatLT (UInt64.size - 1) UInt64.ofNatTruncate.proof_1
Instances For
Equations
Instances For
Equations
- UInt64.instOfNat = { ofNat := UInt64.ofNat n }
Equations
- USize.ofNat n = { toBitVec := BitVec.ofNat System.Platform.numBits n }
Instances For
Converts the given natural number to USize, but returns USize.size - 1 (i.e., 2^64 - 1 or
2^32 - 1 depending on the platform) for natural numbers >= USize.size.
Equations
- USize.ofNatTruncate n = if h : n < USize.size then USize.ofNatLT n h else USize.ofNatLT (USize.size - 1) USize.ofNatTruncate.proof_1
Instances For
Equations
Instances For
Equations
- USize.instOfNat = { ofNat := USize.ofNat n }
Equations
- instDecidableLtUSize a b = a.decLt b
Equations
- instDecidableLeUSize a b = a.decLe b