def read_code_done

bendtorch-core@0.1.0.0 · src/tensor/read_contract.bend:127

import bendtorch-core@0.1.0.0/src/tensor/read_contract.bend as ReadContract
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
import bendtorch-core@0.1.0.0/src/storage/main.bend as Storage
import bendtorch-core@0.1.0.0/src/storage/LAWS.bend as StorageLaws
import bendtorch-core@0.1.0.0/src/tensor/core.bend as Core
import bendtorch-core@0.1.0.0/src/tensor/lifecycle.bend as Lifecycle
import bendtorch-core@0.1.0.0/src/tensor/observation.bend as Observation

127def read_code_done(+shape: Shape.Shape, +fill: F32, -valid: {Lifecycle.logical_length(StorageLaws.created(Shape.count(shape), fill)) == Shape.logical_numel(Shape.dimensions(shape)) : Nat}, +index: U32, -expected: Result<&2, &2, Storage.Error, F32>,
128  read: {StorageLaws.read(StorageLaws.created(Shape.count(shape), fill), index) == expected : Result<&2, &2, Storage.Error, F32>}) ->
129  {Observation.read_code(shape, index, Done{Core.TTensor{StorageLaws.created(Shape.count(shape), fill), valid}}) == Some{Observation.read_status(Core.storage_read_error(expected))} : Maybe<&2, U32>}:
130  Equal.cong(U32, Maybe<&2, U32>, code => Some{code},
131    Observation.read_code_pair(shape, Core.read_result(shape, StorageLaws.created(Shape.count(shape), fill), valid, index, Storage.get(StorageLaws.created(Shape.count(shape), fill), index), {==})),
132    Observation.read_status(Core.storage_read_error(expected)),
133    Equal.trans(U32, Observation.read_code_pair(shape, Core.read_result(shape, StorageLaws.created(Shape.count(shape), fill), valid, index, Storage.get(StorageLaws.created(Shape.count(shape), fill), index), {==})),
134      Observation.read_status(Core.storage_read_error(StorageLaws.read(StorageLaws.created(Shape.count(shape), fill), index))), Observation.read_status(Core.storage_read_error(expected)),
135      read_code_projection(shape, StorageLaws.created(Shape.count(shape), fill), valid, index, Storage.get(StorageLaws.created(Shape.count(shape), fill), index), {==}),
136      Equal.cong(Result<&2, &2, Storage.Error, F32>, U32, result => Observation.read_status(Core.storage_read_error(result)), StorageLaws.read(StorageLaws.created(Shape.count(shape), fill), index), expected, read)))

Uses (23)

Used by (1)