def expected_same_indices
bendtorch-core@0.1.0.0 · src/tensor/core_PROOF.bend:725
import bendtorch-core@0.1.0.0/src/tensor/core_PROOF.bend as CorePROOF
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/elementwise.bend as Elementwise
725def expected_same_indices(+operation: Elementwise.Operation, +plan: Shape.BroadcastPlan, +index: U32,
726 -original_left: Core.Dynamic, -original_right: Core.Dynamic, -left: Core.Dynamic, -right: Core.Dynamic,
727 -left_same: Elementwise.SameSource(original_left, left), -right_same: Elementwise.SameSource(original_right, right),
728 result: Result<&2, &1, Core.Error, U32 & U32>,
729 -exact: {result == Elementwise.input_indices(plan, index) : Result<&2, &1, Core.Error, U32 & U32>}) ->
730 ExpectedSame<operation, plan, index, original_left, original_right, left, right>:
731 match result:
732 case Fail{error}:
733 ExpectedSame{
734 %exact : {Elementwise.expected_indices(operation, left, right, _) == Elementwise.expected_indices(operation, original_left, original_right, _) : Maybe<&2, F32>}
735 {==}}
736 case Done{indices}:
737 (+left_index, +right_index) = indices
738 ExpectedSame{
739 %exact : {Elementwise.expected_indices(operation, left, right, _) == Elementwise.expected_indices(operation, original_left, original_right, _) : Maybe<&2, F32>}
740 Equal.trans(Maybe<&2, F32>, Elementwise.expected_left(operation, right, right_index, Core.checked_observe_dynamic(left, left_index)),
741 Elementwise.expected_left(operation, right, right_index, Core.checked_observe_dynamic(original_left, left_index)),
742 Elementwise.expected_left(operation, original_right, right_index, Core.checked_observe_dynamic(original_left, left_index)),
743 Equal.cong(Maybe<&2, F32>, Maybe<&2, F32>, value => Elementwise.expected_left(operation, right, right_index, value),
744 Core.checked_observe_dynamic(left, left_index), Core.checked_observe_dynamic(original_left, left_index), left_same(left_index)),
745 expected_left_same(operation, right, original_right, right_index, Core.checked_observe_dynamic(original_left, left_index), right_same(right_index)))}