src/tensor/allocation_PROOF.bend checks
raw source on the hub · import bendtorch-core@0.1.0.0/src/tensor/allocation_PROOF.bend as Allocation_PROOF
14 imports
import Base import ../shape/core.bend as Shape import ../shape/nat_proofs.bend as Nats import ../storage/main.bend as Storage import ../storage/model.bend as Model import ../storage/api.bend as Api import ../storage/PROOF.bend as StorageProof import ../storage/arith.bend as Arith import ./core.bend as Core import ./lifecycle.bend as Lifecycle import ./allocation_spec.bend as Allocation import ./allocation_LAWS.bend as Laws import ./word_conversion.bend as Conversion import ./word_conversion_PROOF.bend as ConversionProof
Definitions
def allocate_length source · line 16 · raw
@+depth:Nat -> @+length:Nat -> @+fill:F32 -> @valid:Bool -> @-decision:{valid == 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/main.bounds(depth, length) : Bool} -> @accepted:{valid == True{} : Bool} -> {0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/allocation_spec.storage_length(0x1689e5deb278c16abd3bd45eac101ef3/src/storage/main.allocate(depth, length, fill, valid, decision)) == Some{length} : Maybe<&2, Nat>}
def allocate_at_length source · line 25 · raw
@+length:Nat -> @+fill:F32 -> @metadata:Pair(Nat, Nat) -> @valid:{0x1689e5deb278c16abd3bd45eac101ef3/src/storage/main.bounds(Pair.fst(Nat, Nat, metadata), length) == True{} : Bool} -> {0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/allocation_spec.storage_length(0x1689e5deb278c16abd3bd45eac101ef3/src/storage/main.allocate_at(length, fill, metadata)) == Some{length} : Maybe<&2, Nat>}
def new_checked_length source · line 31 · raw
@+length:Nat -> @+fill:F32 -> @allowed:Bool -> @accepted:{allowed == True{} : Bool} -> @limit:{Nat.is_le(length, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/model.capacity(20n)) == True{} : Bool} -> {0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/allocation_spec.storage_length(0x1689e5deb278c16abd3bd45eac101ef3/src/storage/main.new_checked(length, fill, allowed)) == Some{length} : Maybe<&2, Nat>}
def storage_new source · line 44 · raw
@+word:U32 -> @+fill:F32 -> @+within:{U32.is_le(word, 1048576) == True{} : Bool} -> {0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/allocation_spec.storage_length(0x1689e5deb278c16abd3bd45eac101ef3/src/storage/main.new(word, fill)) == Some{U32.to_nat(word)} : Maybe<&2, Nat>}
def storage_zero source · line 48 · raw
@+fill:F32 -> {0x1689e5deb278c16abd3bd45eac101ef3/src/storage/main.new(0, fill) == Done{0x1689e5deb278c16abd3bd45eac101ef3/src/storage/main.Empty{}} : Result<&2, &1, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/main.Error, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/main.Storage>}
def natural_equal_true source · line 51 · raw
@+a:Nat -> @+b:Nat -> @equal:{a == b : Nat} -> {True{} == Nat.is_eq(a, b) : Bool}
def attach_decided_length source · line 56 · raw
@+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+length:Nat -> @decision:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.BoolCase<Nat.is_eq(length, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.elements(shape))> -> @storage:0x1689e5deb278c16abd3bd45eac101ef3/src/storage/main.Storage -> @exact:{0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/lifecycle.logical_length(storage) == length : Nat} -> @accepted:{True{} == Nat.is_eq(length, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.elements(shape)) : Bool} -> {0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/allocation_spec.tensor_length(shape, 0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/core.attach_decided(shape, storage, length, exact, decision)) == Some{0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.logical_numel(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.dimensions(shape))} : Maybe<&2, Nat>}
def attach_length source · line 67 · raw
@+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @storage:0x1689e5deb278c16abd3bd45eac101ef3/src/storage/main.Storage -> @exact:{0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/lifecycle.logical_length(storage) == 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.elements(shape) : Nat} -> {0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/allocation_spec.tensor_length(shape, 0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/core.attach(shape, storage)) == Some{0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.logical_numel(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.dimensions(shape))} : Maybe<&2, Nat>}
def new_result_length source · line 75 · raw
@+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @result:Result<&2, &1, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/main.Error, 0x1689e5deb278c16abd3bd45eac101ef3/src/storage/main.Storage> -> @exact:{0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/allocation_spec.storage_length(result) == Some{0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.elements(shape)} : Maybe<&2, Nat>} -> {0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/allocation_spec.tensor_length(shape, 0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/core.new_result(shape, result)) == Some{0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.logical_numel(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.dimensions(shape))} : Maybe<&2, Nat>}
def tensor_done source · line 86 · raw
@+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @result:Result<&2, &1, 0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/core.Error, 0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/core.Tensor<shape>> -> @exact:{0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/allocation_spec.tensor_length(shape, result) == Some{0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.logical_numel(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.dimensions(shape))} : Maybe<&2, Nat>} -> 0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/allocation_spec.TensorDone<shape, result>
def core_new source · line 95 · raw
@+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+fill:F32 -> {0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/allocation_spec.tensor_length(shape, 0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/core.new(shape, fill)) == Some{0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.logical_numel(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.dimensions(shape))} : Maybe<&2, Nat>}
def core_new_done source · line 102 · raw
@+shape:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+fill:F32 -> 0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/allocation_spec.TensorDone<shape, 0x1689e5deb278c16abd3bd45eac101ef3/src/tensor/core.new(shape, fill)>