@[implicit_reducible]
Equations
- xโยน.instDecidableEq_batteries xโ = decidable_of_decidable_of_iff โฏ
theorem
ByteArray.getElem_eq_data_getElem
{i : Nat}
(a : ByteArray)
(h : i < a.size)
:
a[i] = a.data[i]
uget/uset #
@[simp]
theorem
ByteArray.uset_eq_set
(a : ByteArray)
{i : USize}
(h : i.toNat < a.size)
(v : UInt8)
:
a.uset i v h = a.set i.toNat v h
empty #
push #
theorem
ByteArray.get_push_lt
(a : ByteArray)
(x : UInt8)
(i : Nat)
(h : i < a.size)
:
(a.push x)[i] = a[i]
set #
@[simp]
theorem
ByteArray.size_set
(a : ByteArray)
(i : Fin a.size)
(v : UInt8)
:
(a.set (โi) v โฏ).size = a.size
@[simp]
theorem
ByteArray.get_set_eq
(a : ByteArray)
(i : Fin a.size)
(v : UInt8)
:
(a.set (โi) v โฏ)[โi] = v
theorem
ByteArray.get_set_ne
{j : Nat}
(a : ByteArray)
(i : Fin a.size)
(v : UInt8)
(hj : j < a.size)
(h : โi โ j)
:
(a.set (โi) v โฏ)[j] = a[j]
theorem
ByteArray.set_set
(a : ByteArray)
(i : Fin a.size)
(v v' : UInt8)
:
(a.set (โi) v โฏ).set (โi) v' โฏ = a.set (โi) v' โฏ
copySlice #
@[simp]
theorem
ByteArray.data_copySlice
(a : ByteArray)
(i : Nat)
(b : ByteArray)
(j len : Nat)
(exact : Bool)
:
(a.copySlice i b j len exact).data = b.data.extract 0 j ++ a.data.extract i (i + len) ++ b.data.extract (j + min len (a.data.size - i))
append #
theorem
ByteArray.get_append_left
{i : Nat}
{a b : ByteArray}
(hlt : i < a.size)
(h : i < (a ++ b).size := โฏ)
:
(a ++ b)[i] = a[i]
theorem
ByteArray.get_append_right
{i : Nat}
{a b : ByteArray}
(hle : a.size โค i)
(h : i < (a ++ b).size)
(h' : i - a.size < b.size := โฏ)
:
(a ++ b)[i] = b[i - a.size]
extract #
theorem
ByteArray.get_extract_aux
{i : Nat}
{a : ByteArray}
{start stop : Nat}
(h : i < (a.extract start stop).size)
:
start + i < a.size
@[simp]
theorem
ByteArray.get_extract
{i : Nat}
{a : ByteArray}
{start stop : Nat}
(h : i < (a.extract start stop).size)
:
(a.extract start stop)[i] = a[start + i]
ofFn #
@[inline]
ofFn fwithf : Fin n โ UInt8returns the byte array whoseith element isf i. -
Equations
- ByteArray.ofFn f = Fin.foldl n (fun (acc : ByteArray) (i : Fin n) => acc.push (f i)) (ByteArray.emptyWithCapacity n)
Instances For
@[simp]
@[simp]
@[simp]
theorem
ByteArray.get_ofFn
{n : Nat}
(f : Fin n โ UInt8)
(i : Fin (ofFn f).size)
:
(ofFn f).get โi โฏ = f (Fin.cast โฏ i)
@[simp]
theorem
ByteArray.getElem_ofFn
{n : Nat}
(f : Fin n โ UInt8)
(i : Nat)
(h : i < (ofFn f).size)
:
(ofFn f)[i] = f โจi, โฏโฉ
map/mapM #
@[inline]
unsafe def
ByteArray.mapMUnsafe
{m : Type โ Type u_1}
[Monad m]
(a : ByteArray)
(f : UInt8 โ m UInt8)
:
m ByteArray
Unsafe optimized implementation of mapM.
This function is unsafe because it relies on the implementation limit that the size of an array is
always less than USize.size.
Equations
- a.mapMUnsafe f = ByteArray.mapMUnsafe.loop f a 0 a.usize
Instances For
@[specialize #[]]
unsafe def
ByteArray.mapMUnsafe.loop
{m : Type โ Type u_1}
[Monad m]
(f : UInt8 โ m UInt8)
(a : ByteArray)
(k s : USize)
:
m ByteArray
Inner loop for mapMUnsafe.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[implemented_by ByteArray.mapMUnsafe]
def
ByteArray.mapM
{m : Type โ Type u_1}
[Monad m]
(a : ByteArray)
(f : UInt8 โ m UInt8)
:
m ByteArray
mapM f a applies the monadic function f to each element of the array.
Equations
- One or more equations did not get rendered due to their size.