ConstructionPROOF.fill_elements_advance: def of bendtorch-core@0.1.0.0 Import: import bendtorch-core@0.1.0.0/src/tensor/construction_PROOF.bend as ConstructionPROOF Lines 242-257 of bendtorch-core@0.1.0.0/src/tensor/construction_PROOF.bend: https://jend.leeeet.dev/read.txt?path=bendtorch-core@0.1.0.0/src/tensor/construction_PROOF.bend&start_line=242&end_line=257 import Base import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape import bendtorch-core@0.1.0.0/src/storage/arith.bend as Arith import bendtorch-core@0.1.0.0/src/tensor/core.bend as Core import bendtorch-core@0.1.0.0/src/tensor/construction_LAWS.bend as Laws def fill_elements_advance(-shape: Shape.Shape, +value: F32, +rest: List<&2, F32>, +cursor: Nat, -written: Core.Tensor, -tensor: Core.Tensor, point: @+index: U32 -> @at: {U32.to_nat(index) == cursor : Nat} -> Core.ObservationChecked(Core.Packed{shape, written}, index) & {Core.checked_observe(shape, written, index) == Some{value} : Maybe<&2, F32>}, mapping: FillElements(shape, rest, 1n+cursor, tensor), frame: FillFrame(shape, written, 1n+cursor, tensor), +index: U32, +offset: Nat, at: {U32.to_nat(index) == Nat.add(cursor, offset) : Nat}, inside: Shape.LT(offset, List.length(&2, F32, value <> rest))) -> Core.ObservationChecked(Core.Packed{shape, tensor}, index) & {Core.checked_observe(shape, tensor, index) == Laws.list_element(value <> rest, offset) : Maybe<&2, F32>}: match offset: case 0n: fill_head(shape, written, tensor, cursor, value, point, frame, index, Equal.trans(Nat, U32.to_nat(index), Nat.add(cursor, 0n), cursor, at, add_zero_right(cursor))) case 1n+p: mapping(index)(p)(Equal.trans(Nat, U32.to_nat(index), Nat.add(cursor, 1n+p), Nat.add(1n+cursor, p), at, Arith.add_succ(cursor, p)))(inside) Uses (22): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Equal.trans https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List.length https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Maybe https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.add https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Pair https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.to_nat https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/shape/core.bend&name=LT https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/shape/core.bend&name=Shape https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/storage/arith.bend&name=add_succ https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/construction_LAWS.bend&name=list_element https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/construction_PROOF.bend&name=FillElements https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/construction_PROOF.bend&name=FillFrame https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/construction_PROOF.bend&name=add_zero_right https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/construction_PROOF.bend&name=fill_head https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/core.bend&name=Dynamic https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/core.bend&name=ObservationChecked https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/core.bend&name=Tensor https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/core.bend&name=checked_observe