src/shape/plan_proofs.bend open laws/TODOs
raw source on the hub · import bendtorch-core@0.1.0.0/src/shape/plan_proofs.bend as Plan_proofs
7 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 ./construct_proofs.bend as Construct import ./LAWS.bend as Laws
Definitions
def plan_construct source · line 9 · raw
@+left:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+right:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @-left_padding:Nat -> @-right_padding:Nat -> @-minimal:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.PadMinimal<left_padding, right_padding> -> @-output:List<&2, U32> -> @-aligned:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Aligned(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.pad(left_padding, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(left)), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.pad(right_padding, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(right)), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.naturals(output)) -> @+result:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.ConstructResult<output> -> {0x1689e5deb278c16abd3bd45eac101ef3/src/shape/LAWS.planned_dimensions(left, right, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.broadcast_checked.construct(left, right, left_padding, right_padding, minimal, output, aligned, result)) == (0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.dimensions(left), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.dimensions(right)) : Pair(List<&2, U32>, List<&2, U32>)}
def plan_align source · line 16 · raw
@+left:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+right:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+left_padding:Nat -> @+right_padding:Nat -> @-minimal:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.PadMinimal<left_padding, right_padding> -> @+alignment:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Alignment<0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.pad_words(left_padding, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.dimensions(left)), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.pad_words(right_padding, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.dimensions(right))> -> {0x1689e5deb278c16abd3bd45eac101ef3/src/shape/LAWS.planned_dimensions(left, right, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.broadcast_checked.align(left, right, left_padding, right_padding, minimal, alignment)) == (0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.dimensions(left), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.dimensions(right)) : Pair(List<&2, U32>, List<&2, U32>)}
def broadcast_checked_plan source · line 23 · raw
@+left:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+right:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> {0x1689e5deb278c16abd3bd45eac101ef3/src/shape/LAWS.planned_dimensions(left, right, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.broadcast_checked(left, right)) == (0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.dimensions(left), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.dimensions(right)) : Pair(List<&2, U32>, List<&2, U32>)}
def some_injective source · line 28 · raw
@-A:Data -> @-x:A -> @-y:A -> @equal:{Some{x} == Some{y} : Maybe<&2, A>} -> {x == y : A}
def some_none source · line 31 · raw
@-A:Data -> @-x:A -> @equal:{Some{x} == None{} : Maybe<&2, A>} -> Empty
def is_eq_refl source · line 34 · raw
@+value:Nat -> {True{} == Nat.is_eq(value, value) : Bool}
def eq_true source · line 41 · raw
@+a:Nat -> @-b:Nat -> @equal:{a == b : Nat} -> {True{} == Nat.is_eq(a, b) : Bool}
def sub_balance source · line 45 · raw
@+a:Nat -> @+b:Nat -> {Nat.add(Nat.sub(b, a), a) == Nat.add(Nat.sub(a, b), b) : Nat}
def choice_output source · line 58 · raw
@-left:U32 -> @-right:U32 -> @choice:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.AxisChoice<left, right> -> Maybe<&2, Nat>
def aligned_output source · line 65 · raw
@-left:List<&2, U32> -> @-right:List<&2, U32> -> @alignment:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Alignment<left, right> -> Maybe<&2, List<&2, Nat>>
def some_nat source · line 72 · raw
@-a:Nat -> @-b:Nat -> @equal:{a == b : Nat} -> {Some{a} == Some{b} : Maybe<&2, Nat>}
def axis_right_complete source · line 75 · raw
@+left:U32 -> @+right:U32 -> @-output:Nat -> @+one:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.BoolCase<Nat.is_eq(1n, U32.to_nat(right))> -> @+axis:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Axis<U32.to_nat(left), U32.to_nat(right), output> -> @differ:{False{} == Nat.is_eq(U32.to_nat(left), U32.to_nat(right)) : Bool} -> @left_wide:{False{} == Nat.is_eq(1n, U32.to_nat(left)) : Bool} -> {Some{output} == choice_output(left, right, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.axis_choice.right_one(left, right, one)) : Maybe<&2, Nat>}
def axis_left_complete source · line 94 · raw
@+left:U32 -> @+right:U32 -> @-output:Nat -> @+one:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.BoolCase<Nat.is_eq(1n, U32.to_nat(left))> -> @+axis:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Axis<U32.to_nat(left), U32.to_nat(right), output> -> @differ:{False{} == Nat.is_eq(U32.to_nat(left), U32.to_nat(right)) : Bool} -> {Some{output} == choice_output(left, right, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.axis_choice.left_one(left, right, one)) : Maybe<&2, Nat>}
def axis_equal_complete source · line 107 · raw
@+left:U32 -> @+right:U32 -> @-output:Nat -> @+same:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.BoolCase<Nat.is_eq(U32.to_nat(left), U32.to_nat(right))> -> @+axis:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Axis<U32.to_nat(left), U32.to_nat(right), output> -> {Some{output} == choice_output(left, right, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.axis_choice.equal(left, right, same)) : Maybe<&2, Nat>}
def axis_complete source · line 120 · raw
@+left:U32 -> @+right:U32 -> @-output:Nat -> @+axis:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Axis<U32.to_nat(left), U32.to_nat(right), output> -> {Some{output} == choice_output(left, right, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.axis_choice(left, right)) : Maybe<&2, Nat>}
def align_step_complete source · line 123 · raw
@-lh:U32 -> @-lt:List<&2, U32> -> @-rh:U32 -> @-rt:List<&2, U32> -> @-oh:Nat -> @-ot:List<&2, Nat> -> @+rest:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Alignment<lt, rt> -> @+choice:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.AxisChoice<lh, rh> -> @rest_seen:{Some{ot} == aligned_output(lt, rt, rest) : Maybe<&2, List<&2, Nat>>} -> @choice_seen:{Some{oh} == choice_output(lh, rh, choice) : Maybe<&2, Nat>} -> {Some{oh <> ot} == aligned_output(lh <> lt, rh <> rt, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.align.step(lh, lt, rh, rt, rest, choice)) : Maybe<&2, List<&2, Nat>>}
def align_complete source · line 136 · raw
@+left:List<&2, U32> -> @+right:List<&2, U32> -> @+output:List<&2, Nat> -> @+aligned:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Aligned(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.naturals(left), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.naturals(right), output) -> {Some{output} == aligned_output(left, right, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.align(left, right)) : Maybe<&2, List<&2, Nat>>}
def complete_construct source · line 156 · raw
@+left:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+right:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @-left_padding:Nat -> @-right_padding:Nat -> @-minimal:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.PadMinimal<left_padding, right_padding> -> @-output:List<&2, U32> -> @-aligned:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Aligned(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.pad(left_padding, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(left)), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.pad(right_padding, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(right)), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.naturals(output)) -> @+result:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.ConstructResult<output> -> @built:{0x1689e5deb278c16abd3bd45eac101ef3/src/shape/LAWS.built(output, result) == Some{output} : Maybe<&2, List<&2, U32>>} -> {0x1689e5deb278c16abd3bd45eac101ef3/src/shape/LAWS.broadcast_built(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.broadcast_checked.construct(left, right, left_padding, right_padding, minimal, output, aligned, result)) == True{} : Bool}
def complete_align source · line 163 · raw
@+left:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+right:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+left_padding:Nat -> @+right_padding:Nat -> @-minimal:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.PadMinimal<left_padding, right_padding> -> @+alignment:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Alignment<0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.pad_words(left_padding, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.dimensions(left)), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.pad_words(right_padding, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.dimensions(right))> -> @-target:List<&2, Nat> -> @seen:{Some{target} == aligned_output(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.pad_words(left_padding, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.dimensions(left)), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.pad_words(right_padding, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.dimensions(right)), alignment) : Maybe<&2, List<&2, Nat>>} -> @+rank_bound:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.LE(List.length(&2, Nat, target), 4n) -> @+capacity_bound:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.LE(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.numel(target), 1048576n) -> {0x1689e5deb278c16abd3bd45eac101ef3/src/shape/LAWS.broadcast_built(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.broadcast_checked.align(left, right, left_padding, right_padding, minimal, alignment)) == True{} : Bool}
def padded_words source · line 173 · raw
@+left_padding:Nat -> @+right_padding:Nat -> @-left:List<&2, U32> -> @-right:List<&2, U32> -> @-output:List<&2, Nat> -> @aligned:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Aligned(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.pad(left_padding, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.naturals(left)), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.pad(right_padding, 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.naturals(right)), output) -> 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Aligned(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.naturals(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.pad_words(left_padding, left)), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.naturals(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.pad_words(right_padding, right)), output)
def broadcast_checked_complete source · line 178 · raw
@+left:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+right:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Shape -> @+output:List<&2, U32> -> @+alignment:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.Broadcast<0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(left), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.extents(right), 0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.naturals(output)> -> @+rank_bound:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.LE(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.rank_dimensions(output), 4n) -> @+capacity_bound:0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.LE(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.logical_numel(output), 1048576n) -> {0x1689e5deb278c16abd3bd45eac101ef3/src/shape/LAWS.broadcast_built(0x1689e5deb278c16abd3bd45eac101ef3/src/shape/core.broadcast_checked(left, right)) == True{} : Bool}