PROOF.bend checks
raw source on the hub · import bend-ndarray@0.1.0.0/PROOF.bend as PROOF
Proofs of LAWS.bend.
5 imports
import Base import ./shape.bend as S import ./LAWS.bend as Laws import bend-mathlib@0.8.1.0/nat.bend as MN import bend-mathlib@0.8.1.0/list.bend as ML
Definitions
def Tag source · line 10 · raw
@b:Bool -> Type
def to_empty source · line 17 · raw
@e:{False{} == True{} : Bool} -> Empty
def MTag source · line 21 · raw
@m:Maybe<&2, List<&2, Nat>> -> Type
def none_some source · line 28 · raw
@+r:List<&2, Nat> -> @h:{None{} == Some{r} : Maybe<&2, List<&2, Nat>>} -> Empty
def NTag source · line 32 · raw
@m:Maybe<&2, Nat> -> Type
def none_some_n source · line 39 · raw
@+r:Nat -> @h:{None{} == Some{r} : Maybe<&2, Nat>} -> Empty
def or_true source · line 43 · raw
@p:Bool -> {True{} == Bool.or(p, True{}) : Bool}
def and_left source · line 50 · raw
@p:Bool -> @+q:Bool -> @h:{Bool.and(p, q) == True{} : Bool} -> {p == True{} : Bool}
def and_right source · line 57 · raw
@p:Bool -> @+q:Bool -> @h:{Bool.and(p, q) == True{} : Bool} -> {q == True{} : Bool}
def unsome_l source · line 64 · raw
@m:Maybe<&2, List<&2, Nat>> -> List<&2, Nat>
def some_inj_l source · line 71 · raw
@+a:List<&2, Nat> -> @+b:List<&2, Nat> -> @h:{Some{a} == Some{b} : Maybe<&2, List<&2, Nat>>} -> {a == b : List<&2, Nat>}
def unsome_n source · line 74 · raw
@m:Maybe<&2, Nat> -> Nat
def some_inj_n source · line 81 · raw
@+a:Nat -> @+b:Nat -> @h:{Some{a} == Some{b} : Maybe<&2, Nat>} -> {a == b : Nat}
def fits_refl source · line 85 · raw
@s:List<&2, Nat> -> {0x3812e108d3d3723b9d582970dd383a5c/shape.fits_rev(s, s) == True{} : Bool}a dimension fits itself
def two_eq source · line 95 · raw
@+x:Nat -> @+y:Nat -> @+d:Nat -> @xd:{x == d : Nat} -> @yd:{y == d : Nat} -> {Nat.is_eq(d, d) == Nat.is_eq(x, y) : Bool}x and y both equal d: is_eq(x, y) is is_eq(d, d)
def fits1 source · line 103 · raw
@+x:Nat -> @+d:Nat -> Bool
x fits d: x is 1 or d
def bpick_fits source · line 106 · raw
@x1:Bool -> @y1:Bool -> @e:Bool -> @+x:Nat -> @+y:Nat -> @+d:Nat -> @ex:{Nat.is_eq(x, 1n) == x1 : Bool} -> @ey:{Nat.is_eq(y, 1n) == y1 : Bool} -> @ee:{Nat.is_eq(x, y) == e : Bool} -> @h:{0x3812e108d3d3723b9d582970dd383a5c/shape.bpick(x1, y1, e, x, y) == Some{d} : Maybe<&2, Nat>} -> {Bool.and(fits1(x, d), fits1(y, d)) == True{} : Bool}
def RTag source · line 131 · raw
@r:Result<&2, &2, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, List<&2, Nat>> -> Type
def fail_done source · line 138 · raw
@+e:0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr -> @+s:List<&2, Nat> -> @h:{Fail{e} == Done{s} : Result<&2, &2, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, List<&2, Nat>>} -> Empty
def undone source · line 142 · raw
@r:Result<&2, &2, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, List<&2, Nat>> -> List<&2, Nat>
def done_inj source · line 149 · raw
@+a:List<&2, Nat> -> @+b:List<&2, Nat> -> @h:{Done{a} == Done{b} : Result<&2, &2, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, List<&2, Nat>>} -> {a == b : List<&2, Nat>}
def mcons_sound source · line 153 · raw
@m1:Maybe<&2, Nat> -> @m2:Maybe<&2, List<&2, Nat>> -> @+x:Nat -> @+y:Nat -> @+xs:List<&2, Nat> -> @+ys:List<&2, Nat> -> @+rs:List<&2, Nat> -> @e1:{0x3812e108d3d3723b9d582970dd383a5c/shape.bdim(x, y) == m1 : Maybe<&2, Nat>} -> @e2:{0x3812e108d3d3723b9d582970dd383a5c/shape.bcast_rev(xs, ys) == m2 : Maybe<&2, List<&2, Nat>>} -> @h:{0x3812e108d3d3723b9d582970dd383a5c/shape.mcons(m1, m2) == Some{rs} : Maybe<&2, List<&2, Nat>>} -> @ih:(@r:List<&2, Nat> -> @_:{0x3812e108d3d3723b9d582970dd383a5c/shape.bcast_rev(xs, ys) == Some{r} : Maybe<&2, List<&2, Nat>>} -> {Bool.and(0x3812e108d3d3723b9d582970dd383a5c/shape.fits_rev(xs, r), 0x3812e108d3d3723b9d582970dd383a5c/shape.fits_rev(ys, r)) == True{} : Bool}) -> {Bool.and(0x3812e108d3d3723b9d582970dd383a5c/shape.fits_rev(x <> xs, rs), 0x3812e108d3d3723b9d582970dd383a5c/shape.fits_rev(y <> ys, rs)) == True{} : Bool}---- broadcast_sound ----
def sound_rev source · line 170 · raw
@ra:List<&2, Nat> -> @rb:List<&2, Nat> -> @+rs:List<&2, Nat> -> @h:{0x3812e108d3d3723b9d582970dd383a5c/shape.bcast_rev(ra, rb) == Some{rs} : Maybe<&2, List<&2, Nat>>} -> {Bool.and(0x3812e108d3d3723b9d582970dd383a5c/shape.fits_rev(ra, rs), 0x3812e108d3d3723b9d582970dd383a5c/shape.fits_rev(rb, rs)) == True{} : Bool}
def sound_pub source · line 186 · raw
@m:Maybe<&2, List<&2, Nat>> -> @+a:List<&2, Nat> -> @+b:List<&2, Nat> -> @+s:List<&2, Nat> -> @e:{0x3812e108d3d3723b9d582970dd383a5c/shape.bcast_rev(List.reverse(&2, Nat, a), List.reverse(&2, Nat, b)) == m : Maybe<&2, List<&2, Nat>>} -> @h:{0x3812e108d3d3723b9d582970dd383a5c/shape.bcast_done(m, a, b) == Done{s} : Result<&2, &2, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, List<&2, Nat>>} -> {Bool.and(0x3812e108d3d3723b9d582970dd383a5c/shape.fits(a, s), 0x3812e108d3d3723b9d582970dd383a5c/shape.fits(b, s)) == True{} : Bool}
def some_l source · line 201 · raw
@m:Maybe<&2, List<&2, Nat>> -> Bool
---- broadcast_complete ----
def some_n source · line 208 · raw
@m:Maybe<&2, Nat> -> Bool
def bpick_some source · line 216 · raw
@x1:Bool -> @y1:Bool -> @e:Bool -> @+x:Nat -> @+y:Nat -> @+d:Nat -> @ex:{Nat.is_eq(x, 1n) == x1 : Bool} -> @ey:{Nat.is_eq(y, 1n) == y1 : Bool} -> @ee:{Nat.is_eq(x, y) == e : Bool} -> @fx:{fits1(x, d) == True{} : Bool} -> @fy:{fits1(y, d) == True{} : Bool} -> {some_n(0x3812e108d3d3723b9d582970dd383a5c/shape.bpick(x1, y1, e, x, y)) == True{} : Bool}x fits d and y fits d: the pair broadcasts
def mcons_some source · line 232 · raw
@m1:Maybe<&2, Nat> -> @m2:Maybe<&2, List<&2, Nat>> -> @h1:{some_n(m1) == True{} : Bool} -> @h2:{some_l(m2) == True{} : Bool} -> {some_l(0x3812e108d3d3723b9d582970dd383a5c/shape.mcons(m1, m2)) == True{} : Bool}
def complete_rev source · line 242 · raw
@ra:List<&2, Nat> -> @rb:List<&2, Nat> -> @rs:List<&2, Nat> -> @+ha:{0x3812e108d3d3723b9d582970dd383a5c/shape.fits_rev(ra, rs) == True{} : Bool} -> @+hb:{0x3812e108d3d3723b9d582970dd383a5c/shape.fits_rev(rb, rs) == True{} : Bool} -> {some_l(0x3812e108d3d3723b9d582970dd383a5c/shape.bcast_rev(ra, rb)) == True{} : Bool}
def done_of_some source · line 259 · raw
@m:Maybe<&2, List<&2, Nat>> -> @+a:List<&2, Nat> -> @+b:List<&2, Nat> -> @h:{some_l(m) == True{} : Bool} -> {0x3812e108d3d3723b9d582970dd383a5c/LAWS.is_done(0x3812e108d3d3723b9d582970dd383a5c/shape.bcast_done(m, a, b)) == True{} : Bool}
def bpick_least source · line 273 · raw
@x1:Bool -> @y1:Bool -> @e:Bool -> @+x:Nat -> @+y:Nat -> @+d:Nat -> @+c:Nat -> @h:{0x3812e108d3d3723b9d582970dd383a5c/shape.bpick(x1, y1, e, x, y) == Some{d} : Maybe<&2, Nat>} -> @fx:{fits1(x, c) == True{} : Bool} -> @fy:{fits1(y, c) == True{} : Bool} -> {fits1(d, c) == True{} : Bool}---- broadcast_least ---- the pair's result fits whatever both sides fit
def least_m source · line 289 · raw
@m1:Maybe<&2, Nat> -> @m2:Maybe<&2, List<&2, Nat>> -> @rs:List<&2, Nat> -> @+x:Nat -> @+y:Nat -> @+xs:List<&2, Nat> -> @+ys:List<&2, Nat> -> @+rt:List<&2, Nat> -> @e1:{0x3812e108d3d3723b9d582970dd383a5c/shape.bdim(x, y) == m1 : Maybe<&2, Nat>} -> @e2:{0x3812e108d3d3723b9d582970dd383a5c/shape.bcast_rev(xs, ys) == m2 : Maybe<&2, List<&2, Nat>>} -> @h:{0x3812e108d3d3723b9d582970dd383a5c/shape.mcons(m1, m2) == Some{rt} : Maybe<&2, List<&2, Nat>>} -> @+ha:{0x3812e108d3d3723b9d582970dd383a5c/shape.fits_rev(x <> xs, rs) == True{} : Bool} -> @+hb:{0x3812e108d3d3723b9d582970dd383a5c/shape.fits_rev(y <> ys, rs) == True{} : Bool} -> @ih:(@r:List<&2, Nat> -> @q:List<&2, Nat> -> @_:{0x3812e108d3d3723b9d582970dd383a5c/shape.bcast_rev(xs, ys) == Some{r} : Maybe<&2, List<&2, Nat>>} -> @_:{0x3812e108d3d3723b9d582970dd383a5c/shape.fits_rev(xs, q) == True{} : Bool} -> @_:{0x3812e108d3d3723b9d582970dd383a5c/shape.fits_rev(ys, q) == True{} : Bool} -> {0x3812e108d3d3723b9d582970dd383a5c/shape.fits_rev(r, q) == True{} : Bool}) -> {0x3812e108d3d3723b9d582970dd383a5c/shape.fits_rev(rt, rs) == True{} : Bool}
def least_rev source · line 308 · raw
@ra:List<&2, Nat> -> @rb:List<&2, Nat> -> @+rt:List<&2, Nat> -> @+rs:List<&2, Nat> -> @h:{0x3812e108d3d3723b9d582970dd383a5c/shape.bcast_rev(ra, rb) == Some{rt} : Maybe<&2, List<&2, Nat>>} -> @+ha:{0x3812e108d3d3723b9d582970dd383a5c/shape.fits_rev(ra, rs) == True{} : Bool} -> @+hb:{0x3812e108d3d3723b9d582970dd383a5c/shape.fits_rev(rb, rs) == True{} : Bool} -> {0x3812e108d3d3723b9d582970dd383a5c/shape.fits_rev(rt, rs) == True{} : Bool}
def least_pub source · line 323 · raw
@m:Maybe<&2, List<&2, Nat>> -> @+a:List<&2, Nat> -> @+b:List<&2, Nat> -> @+s:List<&2, Nat> -> @+t:List<&2, Nat> -> @e:{0x3812e108d3d3723b9d582970dd383a5c/shape.bcast_rev(List.reverse(&2, Nat, a), List.reverse(&2, Nat, b)) == m : Maybe<&2, List<&2, Nat>>} -> @h:{0x3812e108d3d3723b9d582970dd383a5c/shape.bcast_done(m, a, b) == Done{t} : Result<&2, &2, 0x3812e108d3d3723b9d582970dd383a5c/shape.NdErr, List<&2, Nat>>} -> @+ha:{0x3812e108d3d3723b9d582970dd383a5c/shape.fits(a, s) == True{} : Bool} -> @+hb:{0x3812e108d3d3723b9d582970dd383a5c/shape.fits(b, s) == True{} : Bool} -> {0x3812e108d3d3723b9d582970dd383a5c/shape.fits(t, s) == True{} : Bool}