ReductionPROOF.preserved_read: def of bendtorch-core@0.1.0.0 Import: import bendtorch-core@0.1.0.0/src/tensor/reduction_PROOF.bend as ReductionPROOF Lines 174-194 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=174&end_line=194 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 def preserved_read(+fuel: Nat, -shape: Shape.Shape, -original: Core.Tensor, +cursor: Nat, +accumulator: F32, tensor: Core.Tensor, result: Result<&2, &2, Core.Error, F32>, -rec: @tensor: Core.Tensor -> @+value: F32 -> Laws.Preserved, -kept: @+other: U32 -> {Core.checked_observe(shape, tensor, other) == Core.checked_observe(shape, original, other) : Maybe<&2, F32>}) -> Laws.Preserved value => Reduction.natural_sum_loop(fuel, shape, tensor, 1n+cursor, value), accumulator, (tensor, result))>: match result: case Fail{error}: Laws.Preserved{other => {==}} case Done{+value}: Laws.Preserved{other => claim : @certificate: Laws.Preserved -> {Laws.retained_observe(shape, Reduction.natural_sum_loop(fuel, shape, tensor, 1n+cursor, F32.add(accumulator, value)), other) == Laws.successful_observe(shape, tensor, Reduction.natural_sum_loop(fuel, shape, tensor, 1n+cursor, F32.add(accumulator, value)), other) : Maybe<&2, F32>} = \{Laws.Preserved: kept => kept(other)} Equal.trans(Maybe<&2, F32>, Laws.retained_observe(shape, Reduction.natural_sum_loop(fuel, shape, tensor, 1n+cursor, F32.add(accumulator, value)), other), Laws.successful_observe(shape, tensor, Reduction.natural_sum_loop(fuel, shape, tensor, 1n+cursor, F32.add(accumulator, value)), other), Laws.successful_observe(shape, original, Reduction.natural_sum_loop(fuel, shape, tensor, 1n+cursor, F32.add(accumulator, value)), other), claim(rec(tensor, F32.add(accumulator, value))), success_keeps(shape, original, tensor, Reduction.natural_sum_loop(fuel, shape, tensor, 1n+cursor, F32.add(accumulator, value)), other, kept(other)))} Uses (18): 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=F32.add 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=Result https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Sigma https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 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/tensor/core.bend&name=Error 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 https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/reduction.bend&name=natural_sum_loop https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/reduction.bend&name=read_step https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/reduction_LAWS.bend&name=Preserved https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/reduction_LAWS.bend&name=retained_observe https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/reduction_LAWS.bend&name=successful_observe https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/reduction_PROOF.bend&name=success_keeps