def preserved_decision

bendtorch-core@0.1.0.0 · src/tensor/reduction_PROOF.bend:228

import bendtorch-core@0.1.0.0/src/tensor/reduction_PROOF.bend as ReductionPROOF
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

228def preserved_decision(+fuel: Nat, -shape: Shape.Shape, tensor: Core.Tensor<shape>, +cursor: Nat, +accumulator: F32,
229  -rec: @tensor: Core.Tensor<shape> -> @+value: F32 -> Laws.Preserved<shape, tensor, Reduction.natural_sum_loop(fuel, shape, tensor, 1n+cursor, value)>,
230  decision: Shape.BoolCase<Nat.is_eq(U32.to_nat(U32.from_nat(cursor)), cursor)>) ->
231  Laws.Preserved<shape, tensor, Reduction.sum_decided(shape,
232    tensor => value => Reduction.natural_sum_loop(fuel, shape, tensor, 1n+cursor, value), tensor, cursor, U32.from_nat(cursor), accumulator, decision)>:
233  match decision:
234    case Shape.BFalse{equal}:
235      Laws.Preserved{other => {==}}
236    case Shape.BTrue{equal}:
237      preserved_certificate(fuel, shape, tensor, cursor, accumulator, rec,
238        Core.read_certificate(shape, tensor, U32.from_nat(cursor)), Core.source_read_keeps(shape, tensor, U32.from_nat(cursor)))

Uses (14)

Used by (1)