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.
@[reducible, inline]
Equations
Instances For
@[extern lean_uint8_to_uint16]
Equations
- a.toUInt16 = { toBitVec := { toFin := ⟨a.toNat, ⋯⟩ } }
Instances For
@[extern lean_uint32_of_nat]
Equations
- UInt32.ofNat n = { toBitVec := BitVec.ofNat 32 n }
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.ofNat' n h else UInt32.ofNat' (UInt32.size - 1) UInt32.ofNatTruncate.proof_1
Instances For
@[reducible, inline]
Equations
Instances For
@[extern lean_uint16_to_uint32]
Equations
- a.toUInt32 = { toBitVec := { toFin := ⟨a.toNat, ⋯⟩ } }
Instances For
Equations
- UInt32.instOfNat = { ofNat := UInt32.ofNat n }
theorem
UInt32.ofNat'_lt_of_lt
{n m : Nat}
(h1 : n < UInt32.size)
(h2 : m < UInt32.size)
:
n < m → UInt32.ofNat' n h1 < UInt32.ofNat m
theorem
UInt32.lt_ofNat'_of_lt
{n m : Nat}
(h1 : n < UInt32.size)
(h2 : m < UInt32.size)
:
m < n → UInt32.ofNat m < UInt32.ofNat' n h1
@[extern lean_uint64_of_nat]
Equations
- UInt64.ofNat n = { toBitVec := BitVec.ofNat 64 n }
Instances For
@[reducible, inline]
Equations
Instances For
@[extern lean_uint8_to_uint64]
Equations
- a.toUInt64 = { toBitVec := { toFin := ⟨a.toNat, ⋯⟩ } }
Instances For
@[extern lean_uint16_to_uint64]
Equations
- a.toUInt64 = { toBitVec := { toFin := ⟨a.toNat, ⋯⟩ } }
Instances For
@[extern lean_uint32_to_uint64]
Equations
- a.toUInt64 = { toBitVec := { toFin := ⟨a.toNat, ⋯⟩ } }
Instances For
Equations
- UInt64.instOfNat = { ofNat := UInt64.ofNat n }
@[extern lean_usize_of_nat]
Equations
- USize.ofNat n = { toBitVec := BitVec.ofNat System.Platform.numBits n }
Instances For
Equations
- USize.instOfNat = { ofNat := USize.ofNat n }
Equations
- instDecidableLtUSize a b = a.decLt b