~/bend-docscommunity

machine_limits.bend checks

raw source on the hub · import stelliferous@0.0.2.0/machine_limits.bend as Machine_limits

Machine limits carry binary safety evidence. Nat proofs quantify over Limits rather than specializing their types to a large unary bound.

1 import
import Base

Types

type Facts source · line 33 · raw

@-d:U32 -> @-c:U32 -> @-k:U32 -> @-h:U32 -> Data

type Limits source · line 52 · raw

Data

Definitions

def word_max source · line 5 · raw

U32

def native_nat_max source · line 11 · raw

Word(48n)

Official v2.0.26 native Nat payloads have 48 bits. Checked metadata products keep each partial value <= U32.max; doubling it and adding a U32 operand is at most 3*U32.max. Binary evidence avoids expanding these bounds in unary.

def extend_metadata_word source · line 14 · raw

@width:Nat -> @word:Word(width) -> Word(Nat.add(width, 16n))

def extended_metadata_operand source · line 19 · raw

@value:U32 -> Word(48n)

def metadata_operand_max source · line 23 · raw

Word(48n)

def metadata_product_step_max source · line 26 · raw

Word(48n)

def metadata_product_step_fits source · line 30 · raw

{Cmp.is_le(Word.cmp(48n, metadata_product_step_max, native_nat_max)) == True{} : Bool}

def dimension source · line 55 · raw

@limits:Limits -> U32

def capacity source · line 58 · raw

@limits:Limits -> U32

def coordinate source · line 61 · raw

@limits:Limits -> U32

def half_word source · line 64 · raw

@limits:Limits -> U32