ProjectionProofs.dot_broadcast: def of bendtorch-core@0.1.0.0 Import: import bendtorch-core@0.1.0.0/src/shape/projection_proofs.bend as ProjectionProofs Lines 105-113 of bendtorch-core@0.1.0.0/src/shape/projection_proofs.bend: https://jend.leeeet.dev/read.txt?path=bendtorch-core@0.1.0.0/src/shape/projection_proofs.bend&start_line=105&end_line=113 import Base import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape def dot_broadcast(+dims: List<&2, Nat>, +values: List<&2, Nat>) -> {dot(strides_of(dims), values) == Shape.offset(dims, Shape.broadcast_indices(dims, values)) : Nat}: match dims values: case +head <> +tail +value <> +rest: %Equal.sym(Nat, dot(strides_of(tail), rest), Shape.offset(tail, Shape.broadcast_indices(tail, rest)), dot_broadcast(tail, rest)) : {Nat.add(Nat.mul(Shape.broadcast_index(head, Shape.numel(tail)), value), _) == Nat.add(Nat.mul(Shape.broadcast_index(head, value), Shape.numel(tail)), Shape.offset(tail, Shape.broadcast_indices(tail, rest))) : Nat} Equal.cong(Nat, Nat, term => Nat.add(term, Shape.offset(tail, Shape.broadcast_indices(tail, rest))), Nat.mul(Shape.broadcast_index(head, Shape.numel(tail)), value), Nat.mul(Shape.broadcast_index(head, value), Shape.numel(tail)), axis_term(head, Shape.numel(tail), value)) case Nil{} values: {==} case head <> tail Nil{}: {==} Uses (13): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Equal.cong https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Equal.sym https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.add https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.mul https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/shape/core.bend&name=broadcast_index https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/shape/core.bend&name=broadcast_indices https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/shape/core.bend&name=numel https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/shape/core.bend&name=offset https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/shape/projection_proofs.bend&name=axis_term https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/shape/projection_proofs.bend&name=dot https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/shape/projection_proofs.bend&name=strides_of