def fill_write_pair
bendtorch-core@0.1.0.0 · src/tensor/construction_PROOF.bend:436
import bendtorch-core@0.1.0.0/src/tensor/construction_PROOF.bend as ConstructionPROOF
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
436def fill_write_pair(-shape: Shape.Shape, +value: F32, +rest: List<&2, F32>, +cursor: Nat, +index: U32,
437 -original: Core.Tensor<shape>, pair: Core.Tensor<shape> & Result<&2, &2, Core.Error, Unit>,
438 -same: {pair == Core.write_flat(shape, original, index, value) : Core.Tensor<shape> & Result<&2, &2, Core.Error, Unit>},
439 -converted: {U32.to_nat(index) == cursor : Nat}, -model: Core.CheckedUpdateModel<shape, original, index, value>,
440 -rec: @tensor: Core.Tensor<shape> -> FillOutcome<shape, tensor, rest, 1n+cursor, Core.fill_values(rest, shape, tensor, 1n+cursor)>) ->
441 FillOutcome<shape, original, value <> rest, cursor,
442 Core.fill_values_step(shape, tensor => Core.fill_values(rest, shape, tensor, 1n+cursor), pair)>:
443 (tensor, result) = pair
444 match result:
445 case Fail{error}:
446 FillOutcome{Unit{}}
447 case Done{unit}:
448 FillOutcome{
449 {\{FillOutcome: meaning => meaning} : FillOutcome<shape, original, value <> rest, cursor, Core.fill_values(rest, shape, tensor, 1n+cursor)> ->
450 FillMeaning(shape, original, value <> rest, cursor, Core.fill_values(rest, shape, tensor, 1n+cursor))}(fill_advance(shape, value, rest, cursor,
451 original, tensor, Core.fill_values(rest, shape, tensor, 1n+cursor),
452 written_model(shape, original, tensor, cursor, index, value, unit, converted,
453 %Equal.sym(Core.Tensor<shape> & Result<&2, &2, Core.Error, Unit>, (tensor, Done{unit}), Core.write_flat(shape, original, index, value), same) :
454 Core.CheckedUpdateMeaning(shape, original, index, value, _)
455 {\{Core.CheckedUpdateModel: meaning => meaning} : Core.CheckedUpdateModel<shape, original, index, value> ->
456 Core.CheckedUpdateMeaning(shape, original, index, value, Core.write_flat(shape, original, index, value))}(model)),
457 {\{FillOutcome: meaning => meaning} : FillOutcome<shape, tensor, rest, 1n+cursor, Core.fill_values(rest, shape, tensor, 1n+cursor)> ->
458 FillMeaning(shape, tensor, rest, 1n+cursor, Core.fill_values(rest, shape, tensor, 1n+cursor))}(rec(tensor))))}