Documentation

Mathlib.Data.ByteArray

Main result #

Introduce main properties of Up (well-ordered relation for "upwards" induction on ) and of ByteArray

This entire file has been deprecated on 2024-08-19 in favour of ByteSubarray in Batteries.

@[deprecated]
def Nat.Up (ub : Nat) (a : Nat) (i : Nat) :

A well-ordered relation for "upwards" induction on the natural numbers up to some bound ub.

Equations
  • ub.Up a i = (i < a i < ub)
theorem Nat.Up.next {ub : Nat} {i : Nat} (h : i < ub) :
ub.Up (i + 1) i
theorem Nat.Up.WF (ub : Nat) :
@[deprecated]

A well-ordered relation for "upwards" induction on the natural numbers up to some bound ub.

Equations
  • ub.upRel = { rel := ub.Up, wf := }
@[deprecated]
structure ByteSliceT :

A terminal byte slice, a suffix of a byte array.

@[inline]

The number of elements in the byte slice.

Equations
  • self.size = self.arr.size - self.off
@[inline]
def ByteSliceT.getOp (self : ByteSliceT) (idx : Nat) :

Index into a byte slice. The getOp function allows the use of the buf[i] notation.

Equations
  • self.getOp idx = self.arr.get! (self.off + idx)

Convert a byte array into a terminal slice.

Equations
  • arr.toSliceT = { arr := arr, off := 0 }
@[deprecated Batteries.ByteSubarray]
structure ByteSlice :

A byte slice, given by a backing byte array, and an offset and length.

Convert a byte slice into an array, by copying the data if necessary.

Equations
  • { arr := arr, off := off, len := len }.toArray = arr.extract off len
@[inline]
def ByteSlice.getOp (self : ByteSlice) (idx : Nat) :

Index into a byte slice. The getOp function allows the use of the buf[i] notation.

Equations
  • self.getOp idx = self.arr.get! (self.off + idx)
@[irreducible, deprecated]
def ByteSlice.forIn.loop {m : Type u → Type v} {β : Type u} [Monad m] (f : UInt8βm (ForInStep β)) (arr : ByteArray) (off : Nat) (_end : Nat) (i : Nat) (b : β) :
m β

The inner loop of the forIn implementation for byte slices.

Equations
  • One or more equations did not get rendered due to their size.
@[deprecated]
Equations
  • One or more equations did not get rendered due to their size.

Convert a terminal byte slice into a regular byte slice.

Equations
  • { arr := arr, off := off }.toSlice = { arr := arr, off := off, len := arr.size - off }

Convert a byte array into a byte slice.

Equations
  • arr.toSlice = { arr := arr, off := 0, len := arr.size }

Convert a byte slice into a string. This does not handle non-ASCII characters correctly: every byte will become a unicode character with codepoint < 256.

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