def length_done
bendtorch-core@0.1.0.0 · src/tensor/metadata_contract.bend:45
import bendtorch-core@0.1.0.0/src/tensor/metadata_contract.bend as MetadataContract
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
import bendtorch-core@0.1.0.0/src/tensor/read_contract.bend as Reads
45def length_done(+shape: Shape.Shape, +fill: F32, -valid: {Lifecycle.logical_length(StorageLaws.created(Shape.count(shape), fill)) == Shape.logical_numel(Shape.dimensions(shape)) : Nat}) ->
46 {Observation.length_value(shape, Done{Core.TTensor{StorageLaws.created(Shape.count(shape), fill), valid}}) == Some{Shape.logical_numel(Shape.dimensions(shape))} : Maybe<&2, Nat>}:
47 Equal.cong(Nat, Maybe<&2, Nat>, number => Some{number}, Observation.length_number(shape, Core.length(shape, Core.TTensor{StorageLaws.created(Shape.count(shape), fill), valid})), Shape.logical_numel(Shape.dimensions(shape)),
48 Equal.trans(Nat, Observation.length_number(shape, Core.length(shape, Core.TTensor{StorageLaws.created(Shape.count(shape), fill), valid})), Lifecycle.length_value(Storage.length(StorageLaws.created(Shape.count(shape), fill))), Shape.logical_numel(Shape.dimensions(shape)),
49 number_projection(shape, StorageLaws.created(Shape.count(shape), fill), valid, Storage.length(StorageLaws.created(Shape.count(shape), fill)), {==}),
50 Equal.trans(Nat, Lifecycle.length_value(Storage.length(StorageLaws.created(Shape.count(shape), fill))), Lifecycle.length_owner(Storage.length(StorageLaws.created(Shape.count(shape), fill))), Shape.logical_numel(Shape.dimensions(shape)),
51 Equal.sym(Nat, Lifecycle.length_owner(Storage.length(StorageLaws.created(Shape.count(shape), fill))), Lifecycle.length_value(Storage.length(StorageLaws.created(Shape.count(shape), fill))), Lifecycle.length_exact(StorageLaws.created(Shape.count(shape), fill))),
52 Equal.trans(Nat, Lifecycle.length_owner(Storage.length(StorageLaws.created(Shape.count(shape), fill))), Lifecycle.logical_length(StorageLaws.created(Shape.count(shape), fill)), Shape.logical_numel(Shape.dimensions(shape)),
53 Lifecycle.length_preserved(StorageLaws.created(Shape.count(shape), fill)), Reads.created_exact(shape, fill)))))