GradientPROOF.contribution_inv: def of bendtorch-core@0.1.0.0 Import: import bendtorch-core@0.1.0.0/src/autograd/gradient_PROOF.bend as GradientPROOF Lines 394-419 of bendtorch-core@0.1.0.0/src/autograd/gradient_PROOF.bend: https://jend.leeeet.dev/read.txt?path=bendtorch-core@0.1.0.0/src/autograd/gradient_PROOF.bend&start_line=394&end_line=419 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_totality.bend as Totality import bendtorch-core@0.1.0.0/src/autograd/gradient.bend as Gradient def contribution_inv(+shape: Shape.Shape, -original: Core.Tensor, -contribution: Core.Dynamic, +cursor: Nat, +index: U32, total: Core.Tensor, -current: Core.Dynamic, pair: Core.Dynamic & Result<&2, &2, Core.Error, F32>, -exact: {U32.to_nat(index) == cursor : Nat}, -source: {Core.dynamic_read_value(pair) == Core.checked_observe_dynamic(current, index) : Maybe<&2, F32>}, -same: Totality.SameSource(contribution, current), -inv: Inv(shape, original, contribution, cursor, total)) -> Holds: (owner, result) = pair match result: case Fail{error}: Holds{Unit{}} case Done{+value}: total_inv(shape, original, contribution, cursor, total, index, value, owner, Core.read_flat(shape, total, index), exact, {\{Core.SourceRead: meaning => meaning} : Core.SourceRead -> {Core.read_value(shape, Core.read_flat(shape, total, index)) == Core.checked_observe(shape, total, index) : Maybe<&2, F32>}}( Core.source_read_model(shape, total, index)), {\{Core.SourceReadKeeps: kept => kept} : Core.SourceReadKeeps -> @+position: U32 -> {Core.retained_read_observe(shape, Core.read_flat(shape, total, index), position) == Core.checked_observe(shape, total, position) : Maybe<&2, F32>}}( Core.source_read_keeps(shape, total, index)), inv, Equal.trans(Maybe<&2, F32>, Core.checked_observe_dynamic(contribution, index), Core.checked_observe_dynamic(current, index), Some{value}, Equal.sym(Maybe<&2, F32>, Core.checked_observe_dynamic(current, index), Core.checked_observe_dynamic(contribution, index), {\{Holds: proof => proof} : Holds<{Core.checked_observe_dynamic(current, index) == Core.checked_observe_dynamic(contribution, index) : Maybe<&2, F32>}> -> {Core.checked_observe_dynamic(current, index) == Core.checked_observe_dynamic(contribution, index) : Maybe<&2, F32>}}( same_checked(contribution, current, same, index))), Equal.sym(Maybe<&2, F32>, Some{value}, Core.checked_observe_dynamic(current, index), source))) Uses (32): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Equal.sym 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=Maybe https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Pair 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=Base/base.bend&name=U32.to_nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Unit https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/autograd/gradient.bend&name=step_contribution https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/autograd/gradient_PROOF.bend&name=Holds https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/autograd/gradient_PROOF.bend&name=Inv https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/autograd/gradient_PROOF.bend&name=StepInv https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/autograd/gradient_PROOF.bend&name=same_checked https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/autograd/gradient_PROOF.bend&name=total_inv 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=Dynamic 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=SourceRead https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/core.bend&name=SourceReadKeeps 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/core.bend&name=checked_observe_dynamic https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/core.bend&name=dynamic_read_value https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/core.bend&name=read_flat https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/core.bend&name=read_value https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/core.bend&name=retained_read_observe https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/core.bend&name=source_read_keeps https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/core.bend&name=source_read_model https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/elementwise_totality.bend&name=SameSource