ReductionPROOF.fold_value: def of bendtorch-core@0.1.0.0 Import: import bendtorch-core@0.1.0.0/src/tensor/reduction_PROOF.bend as ReductionPROOF Lines 357-373 of bendtorch-core@0.1.0.0/src/tensor/reduction_PROOF.bend: https://jend.leeeet.dev/read.txt?path=bendtorch-core@0.1.0.0/src/tensor/reduction_PROOF.bend&start_line=357&end_line=373 import Base import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape import bendtorch-core@0.1.0.0/src/tensor/core.bend as Core import bendtorch-core@0.1.0.0/src/tensor/reduction.bend as Reduction import bendtorch-core@0.1.0.0/src/tensor/reduction_LAWS.bend as Laws import bendtorch-core@0.1.0.0/src/storage/main.bend as Storage import bendtorch-core@0.1.0.0/src/storage/model.bend as Model def fold_value(-shape: Shape.Shape, +depth: Nat, +length: Nat, -original: Array, -balanced: Model.Balanced(F32, depth, original), -valid: {Storage.bounds(depth, length) == True{} : Bool}, -exact: {length == Shape.logical_numel(Shape.dimensions(shape)) : Nat}, +fuel: Nat, +accumulator: F32, +values: List<&2, F32>, logical: Laws.LogicalValues(fuel, shape, Core.TTensor{Storage.Owned{depth, length, original, balanced, valid}, exact}, 0n, values)) -> Fact<{Pair.fst(F32, Array, Reduction.array_sum(fuel, 0n, accumulator, original)) == Reduction.sequential_sum(values, accumulator) : F32}>: match fuel values: case 0n Nil{}: Fact{{==}} case 1n+rest values: Fact{{\{Fact: p => p} : Fact<({Pair.fst(F32, Array, Reduction.array_sum(1n+rest, 0n, accumulator, original)) == Reduction.sequential_sum(values, accumulator) : F32})> -> {Pair.fst(F32, Array, Reduction.array_sum(1n+rest, 0n, accumulator, original)) == Reduction.sequential_sum(values, accumulator) : F32}}( run_value(shape, depth, length, original, balanced, valid, exact, rest, 0n, accumulator, original, Array.get(F32, original, U32.from_nat(0n)), {==}, {==}, values, logical))} case 0n value <> others: Empty.absurd(Fact<{Pair.fst(F32, Array, Reduction.array_sum(0n, 0n, accumulator, original)) == Reduction.sequential_sum(value <> others, accumulator) : F32}>, logical) Uses (21): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Array https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Array.get https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Empty.absurd 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=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Pair.fst https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.from_nat 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/shape/core.bend&name=dimensions https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/shape/core.bend&name=logical_numel https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/storage/main.bend&name=Storage https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/storage/main.bend&name=bounds https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/storage/model.bend&name=Balanced 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/reduction.bend&name=array_sum https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/reduction.bend&name=sequential_sum https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/reduction_LAWS.bend&name=LogicalValues https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/reduction_PROOF.bend&name=Fact https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/reduction_PROOF.bend&name=run_value