src/shape/projection_proofs.bend checks
raw source on the hub · import bendtorch-core@0.1.0.0/src/shape/projection_proofs.bend as Projection_proofs
6 imports
import Base import ./core.bend as Shape import ./nat_proofs.bend as Nats import ./broadcast_proofs.bend as Broadcast import ./unique_proofs.bend as Unique import ./coordinate_proofs.bend as Coordinates
Definitions
def strides_of source · line 8 · raw
@+dims:List<&2, Nat> -> List<&2, Nat>
def zeros source · line 15 · raw
@count:Nat -> @values:List<&2, Nat> -> List<&2, Nat>
def dot source · line 22 · raw
@steps:List<&2, Nat> -> @values:List<&2, Nat> -> Nat
def lt_zero_false source · line 29 · raw
@+value:Nat -> {Nat.is_lt(value, 0n) == False{} : Bool}
def walk_left_rows source · line 36 · raw
@+left:List<&2, Nat> -> @+right:List<&2, Nat> -> @+output:List<&2, Nat> -> @+index:Nat -> @same:{List.length(&2, Nat, right) == List.length(&2, Nat, output) : Nat} -> {0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.walk_left(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.index_rows(left, right, output), index) == dot(strides_of(left), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.digits(output, index)) : Nat}
def walk_right_rows source · line 50 · raw
@+left:List<&2, Nat> -> @+right:List<&2, Nat> -> @+output:List<&2, Nat> -> @+index:Nat -> @same:{List.length(&2, Nat, left) == List.length(&2, Nat, output) : Nat} -> {0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.walk_right(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.index_rows(left, right, output), index) == dot(strides_of(right), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.digits(output, index)) : Nat}
def pad_strides source · line 66 · raw
@+count:Nat -> @+dims:List<&2, Nat> -> {strides_of(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.pad(count, dims)) == zeros(count, strides_of(dims)) : List<&2, Nat>}
def dot_zeros source · line 73 · raw
@+count:Nat -> @+values:List<&2, Nat> -> @+steps:List<&2, Nat> -> {dot(zeros(count, steps), values) == dot(steps, List.drop(&2, Nat, values, count)) : Nat}
def digits_length source · line 87 · raw
@+dims:List<&2, Nat> -> @+index:Nat -> {List.length(&2, Nat, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.digits(dims, index)) == List.length(&2, Nat, dims) : Nat}
def axis_term source · line 94 · raw
@+size:Nat -> @+stride:Nat -> @+value:Nat -> {Nat.mul(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.broadcast_index(size, stride), value) == Nat.mul(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.broadcast_index(size, value), stride) : Nat}
def dot_broadcast source · line 105 · raw
@+dims:List<&2, Nat> -> @+values:List<&2, Nat> -> {dot(strides_of(dims), values) == 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.offset(dims, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.broadcast_indices(dims, values)) : Nat}
def padding_of source · line 115 · raw
@-width:Nat -> @+padding:Nat -> @+rank:Nat -> @sum:{Nat.add(padding, rank) == width : Nat} -> {padding == Nat.sub(width, rank) : Nat}
def left_padded source · line 118 · raw
@+left:List<&2, Nat> -> @+right:List<&2, Nat> -> @+output:List<&2, Nat> -> @+alignment:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Broadcast<left, right, output> -> {List.length(&2, Nat, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.pad(Nat.sub(List.length(&2, Nat, output), List.length(&2, Nat, left)), left)) == List.length(&2, Nat, output) : Nat}
def right_padded source · line 125 · raw
@+left:List<&2, Nat> -> @+right:List<&2, Nat> -> @+output:List<&2, Nat> -> @+alignment:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Broadcast<left, right, output> -> {List.length(&2, Nat, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.pad(Nat.sub(List.length(&2, Nat, output), List.length(&2, Nat, right)), right)) == List.length(&2, Nat, output) : Nat}
def walk_left_value source · line 132 · raw
@+left:List<&2, Nat> -> @+right:List<&2, Nat> -> @+output:List<&2, Nat> -> @+alignment:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Broadcast<left, right, output> -> @+index:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Fin(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.numel(output)) -> {0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.walk_left(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.index_table(left, right, output), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Fin.value(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.numel(output), index)) == 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.row_major(left, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.project_left(left, right, output, alignment, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.unflatten(output, index))) : Nat}
def walk_right_value source · line 150 · raw
@+left:List<&2, Nat> -> @+right:List<&2, Nat> -> @+output:List<&2, Nat> -> @+alignment:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Broadcast<left, right, output> -> @+index:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Fin(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.numel(output)) -> {0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.walk_right(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.index_table(left, right, output), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Fin.value(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.numel(output), index)) == 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.row_major(right, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.project_right(left, right, output, alignment, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.unflatten(output, index))) : Nat}