~/bend-docscommunity

PROOF.bend checks

raw source on the hub · import bend-quant-risk@0.1.1.0/PROOF.bend as PROOF

Proofs of every law in LAWS.bend (41 laws total). Checked with bend PROOF.bend --verdict (zero @unsafe, zero IO).

6 imports
import Base
import bend-quant-linalg@0.1.1.0/linalg.bend as L
import bend-quant-portfolio@0.1.1.0/portfolio.bend as P
import ./cov.bend as C
import ./risk.bend as R
import ./LAWS.bend as Laws

Definitions

def is_false_t source · line 12 · raw

@b:Bool -> Type

def false_ne_true source · line 19 · raw

@h:{False{} == True{} : Bool} -> Empty

def bool_and_false_r source · line 23 · raw

@a:Bool -> {Bool.and(a, False{}) == False{} : Bool}

def bool_and_false_l source · line 30 · raw

@+a:Bool -> @b:Bool -> @h:{a == False{} : Bool} -> {Bool.and(a, b) == False{} : Bool}

def bool_and_false_mid source · line 34 · raw

@a:Bool -> @+b:Bool -> @c:Bool -> @h:{b == False{} : Bool} -> {Bool.and(a, Bool.and(b, c)) == False{} : Bool}

def bool_and_l source · line 42 · raw

@a:Bool -> @b:Bool -> @h:{Bool.and(a, b) == True{} : Bool} -> {a == True{} : Bool}

def bool_and_r source · line 49 · raw

@a:Bool -> @b:Bool -> @h:{Bool.and(a, b) == True{} : Bool} -> {b == True{} : Bool}

def nat_eq_refl source · line 56 · raw

@n:Nat -> {Nat.is_eq(n, n) == True{} : Bool}

def nat_eq_sound source · line 63 · raw

@a:Nat -> @b:Nat -> @h:{Nat.is_eq(a, b) == True{} : Bool} -> {a == b : Nat}

def add_succ_r source · line 75 · raw

@a:Nat -> @+b:Nat -> {Nat.add(a, 1n+b) == 1n+Nat.add(a, b) : Nat}

def add_zero_r source · line 83 · raw

@a:Nat -> {Nat.add(a, 0n) == a : Nat}

def nat_pred source · line 91 · raw

@n:Nat -> Nat

def zero_ne_succ source · line 98 · raw

@n:Nat -> @h:{0n == 1n+n : Nat} -> Empty

def succ_ne_zero source · line 101 · raw

@n:Nat -> @h:{1n+n == 0n : Nat} -> Empty

def prepend_col_len source · line 106 · raw

@col:List<&2, F32> -> @rows:List<&2, List<&2, F32>> -> @h:{List.length(&2, F32, col) == List.length(&2, List<&2, F32>, rows) : Nat} -> {List.length(&2, List<&2, F32>, 0xcb0ff1755a0a8548a14bd336933147b3/cov.prepend_col(col, rows)) == List.length(&2, List<&2, F32>, rows) : Nat}

def mirror_upper_len source · line 119 · raw

@up:List<&2, List<&2, F32>> -> @n:Nat -> @+h:{0xcb0ff1755a0a8548a14bd336933147b3/LAWS.upper_ok(up, n) == True{} : Bool} -> {List.length(&2, List<&2, F32>, 0xcb0ff1755a0a8548a14bd336933147b3/cov.mirror_upper(up)) == n : Nat}

def prepend_col_get_zero source · line 140 · raw

@col:List<&2, F32> -> @rows:List<&2, List<&2, F32>> -> @i:Nat -> @h:{List.length(&2, F32, col) == List.length(&2, List<&2, F32>, rows) : Nat} -> {0x868deae626c42bd4c69da030be0090fc/linalg.mat_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.prepend_col(col, rows), i, 0n) == List.get(&2, F32, col, i) : Maybe<&2, F32>}

def prepend_col_get_succ source · line 156 · raw

@col:List<&2, F32> -> @rows:List<&2, List<&2, F32>> -> @i:Nat -> @+j:Nat -> @h:{List.length(&2, F32, col) == List.length(&2, List<&2, F32>, rows) : Nat} -> {0x868deae626c42bd4c69da030be0090fc/linalg.mat_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.prepend_col(col, rows), i, 1n+j) == 0x868deae626c42bd4c69da030be0090fc/linalg.mat_get(rows, i, j) : Maybe<&2, F32>}

def mirror_upper_eq source · line 172 · raw

@d:F32 -> @+off:List<&2, F32> -> @+sub:List<&2, List<&2, F32>> -> @+p:Nat -> @+h:{0xcb0ff1755a0a8548a14bd336933147b3/LAWS.upper_ok((d <> off) <> sub, 1n+p) == True{} : Bool} -> {List.length(&2, F32, off) == List.length(&2, List<&2, F32>, 0xcb0ff1755a0a8548a14bd336933147b3/cov.mirror_upper(sub)) : Nat}

def sym_tri_lex source · line 207 · raw

@rem_out:Nat -> @rem_in:Nat -> @p_cell:Pair(Array<F32>, F32) -> @+row:List<&2, F32> -> @+upper:List<&2, List<&2, F32>> -> @+s:Nat -> @+i:U32 -> @+j:U32 -> @+n:U32 -> @+ii:Nat -> @+jj:Nat -> @hlen:{Nat.add(rem_in, 1n+List.length(&2, F32, row)) == 1n+s : Nat} -> @hup:{0xcb0ff1755a0a8548a14bd336933147b3/LAWS.upper_ok(upper, s) == True{} : Bool} -> {0x868deae626c42bd4c69da030be0090fc/linalg.mat_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.mirror_upper(0xcb0ff1755a0a8548a14bd336933147b3/cov.sym_tri.go(rem_out, 0xcb0ff1755a0a8548a14bd336933147b3/cov.sym_tri.push(0xcb0ff1755a0a8548a14bd336933147b3/cov.sym_row.go(rem_in, 0xcb0ff1755a0a8548a14bd336933147b3/cov.sym_row.push(p_cell, row), i, j, n), upper), 2n+s, U32.sub(i, 1), n)), ii, jj) == 0x868deae626c42bd4c69da030be0090fc/linalg.mat_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.mirror_upper(0xcb0ff1755a0a8548a14bd336933147b3/cov.sym_tri.go(rem_out, 0xcb0ff1755a0a8548a14bd336933147b3/cov.sym_tri.push(0xcb0ff1755a0a8548a14bd336933147b3/cov.sym_row.go(rem_in, 0xcb0ff1755a0a8548a14bd336933147b3/cov.sym_row.push(p_cell, row), i, j, n), upper), 2n+s, U32.sub(i, 1), n)), jj, ii) : Maybe<&2, F32>}

Linear lexicographic proof that mirror_upper(sym_tri.go(...)) is bitwise symmetric!

def sym_tri_sym_start source · line 241 · raw

@nn:Nat -> @a:Array<F32> -> @+i:U32 -> @+n:U32 -> @+ii:Nat -> @+jj:Nat -> {0x868deae626c42bd4c69da030be0090fc/linalg.mat_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.mirror_upper(0xcb0ff1755a0a8548a14bd336933147b3/cov.sym_tri.go(nn, 0xcb0ff1755a0a8548a14bd336933147b3/cov.SymTri{a, []}, 1n, i, n)), ii, jj) == 0x868deae626c42bd4c69da030be0090fc/linalg.mat_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.mirror_upper(0xcb0ff1755a0a8548a14bd336933147b3/cov.sym_tri.go(nn, 0xcb0ff1755a0a8548a14bd336933147b3/cov.SymTri{a, []}, 1n, i, n)), jj, ii) : Maybe<&2, F32>}

def upper_sym_chk_sym source · line 249 · raw

@is_z:Bool -> @a:Array<F32> -> @+n:U32 -> @+i:Nat -> @+j:Nat -> {0x868deae626c42bd4c69da030be0090fc/linalg.mat_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.mirror_upper(0xcb0ff1755a0a8548a14bd336933147b3/cov.upper_sym_from_arr.chk(is_z, a, n)), i, j) == 0x868deae626c42bd4c69da030be0090fc/linalg.mat_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.mirror_upper(0xcb0ff1755a0a8548a14bd336933147b3/cov.upper_sym_from_arr.chk(is_z, a, n)), j, i) : Maybe<&2, F32>}

def symmetrize_raw_sym source · line 256 · raw

@+n:U32 -> @rows:List<&2, List<&2, F32>> -> @+i:Nat -> @+j:Nat -> {0x868deae626c42bd4c69da030be0090fc/linalg.Mat.get(0xcb0ff1755a0a8548a14bd336933147b3/cov.symmetrize_raw(n, rows), i, j) == 0x868deae626c42bd4c69da030be0090fc/linalg.Mat.get(0xcb0ff1755a0a8548a14bd336933147b3/cov.symmetrize_raw(n, rows), j, i) : Maybe<&2, F32>}

def hac_tri_lex source · line 260 · raw

@rem_out:Nat -> @rem_in:Nat -> @st1:0xcb0ff1755a0a8548a14bd336933147b3/cov.LagAcc -> @+row:List<&2, F32> -> @+upper:List<&2, List<&2, F32>> -> @+s:Nat -> @+i:U32 -> @+j:U32 -> @+t:U32 -> @+k:U32 -> @+le:U32 -> @+lm:U32 -> @+nw:Bool -> @+ii:Nat -> @+jj:Nat -> @hlen:{Nat.add(rem_in, 1n+List.length(&2, F32, row)) == 1n+s : Nat} -> @hup:{0xcb0ff1755a0a8548a14bd336933147b3/LAWS.upper_ok(upper, s) == True{} : Bool} -> {0x868deae626c42bd4c69da030be0090fc/linalg.mat_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.mirror_upper(0xcb0ff1755a0a8548a14bd336933147b3/cov.hac_tri.i(rem_out, 0xcb0ff1755a0a8548a14bd336933147b3/cov.hac_tri.push(0xcb0ff1755a0a8548a14bd336933147b3/cov.hac_row.j(rem_in, 0xcb0ff1755a0a8548a14bd336933147b3/cov.hac_row.push(st1, row), i, j, t, k, le, lm, nw), upper), 2n+s, U32.sub(i, 1), t, k, le, lm, nw)), ii, jj) == 0x868deae626c42bd4c69da030be0090fc/linalg.mat_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.mirror_upper(0xcb0ff1755a0a8548a14bd336933147b3/cov.hac_tri.i(rem_out, 0xcb0ff1755a0a8548a14bd336933147b3/cov.hac_tri.push(0xcb0ff1755a0a8548a14bd336933147b3/cov.hac_row.j(rem_in, 0xcb0ff1755a0a8548a14bd336933147b3/cov.hac_row.push(st1, row), i, j, t, k, le, lm, nw), upper), 2n+s, U32.sub(i, 1), t, k, le, lm, nw)), jj, ii) : Maybe<&2, F32>}

Linear lexicographic proof that mirror_upper(hac_tri.i(...)) is bitwise symmetric!

def hac_tri_sym_start source · line 300 · raw

@kn:Nat -> @x:Array<F32> -> @w:Array<F32> -> @+i:U32 -> @+t:U32 -> @+k:U32 -> @+le:U32 -> @+lm:U32 -> @+nw:Bool -> @+ii:Nat -> @+jj:Nat -> {0x868deae626c42bd4c69da030be0090fc/linalg.mat_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.mirror_upper(0xcb0ff1755a0a8548a14bd336933147b3/cov.hac_tri.i(kn, 0xcb0ff1755a0a8548a14bd336933147b3/cov.HacTri{x, w, []}, 1n, i, t, k, le, lm, nw)), ii, jj) == 0x868deae626c42bd4c69da030be0090fc/linalg.mat_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.mirror_upper(0xcb0ff1755a0a8548a14bd336933147b3/cov.hac_tri.i(kn, 0xcb0ff1755a0a8548a14bd336933147b3/cov.HacTri{x, w, []}, 1n, i, t, k, le, lm, nw)), jj, ii) : Maybe<&2, F32>}

def symmetrize_chk_sym source · line 315 · raw

@ok:Bool -> @+n:U32 -> @rows:List<&2, List<&2, F32>> -> @+i:Nat -> @+j:Nat -> {0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.symmetrize.chk(ok, n, rows), i, j) == 0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.symmetrize.chk(ok, n, rows), j, i) : Maybe<&2, F32>}

def sym_scale_fin_sym source · line 326 · raw

@m:0x868deae626c42bd4c69da030be0090fc/linalg.Mat -> @+i:Nat -> @+j:Nat -> {0x868deae626c42bd4c69da030be0090fc/linalg.Mat.get(0xcb0ff1755a0a8548a14bd336933147b3/cov.sym_scale.fin(m), i, j) == 0x868deae626c42bd4c69da030be0090fc/linalg.Mat.get(0xcb0ff1755a0a8548a14bd336933147b3/cov.sym_scale.fin(m), j, i) : Maybe<&2, F32>}

def sample_cov_centered_sym source · line 330 · raw

@ok:Bool -> @+t:U32 -> @+k:U32 -> @+rows:List<&2, List<&2, F32>> -> @+i:Nat -> @+j:Nat -> {0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.sample_cov.centered(ok, t, k, rows), i, j) == 0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.sample_cov.centered(ok, t, k, rows), j, i) : Maybe<&2, F32>}

def sample_cov_run_sym source · line 340 · raw

@center:Bool -> @+t:U32 -> @+k:U32 -> @+rows:List<&2, List<&2, F32>> -> @+i:Nat -> @+j:Nat -> {0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.sample_cov.run(center, t, k, rows), i, j) == 0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.sample_cov.run(center, t, k, rows), j, i) : Maybe<&2, F32>}

def sample_cov_chk_sym source · line 348 · raw

@ok:Bool -> @center:Bool -> @+t:U32 -> @+k:U32 -> @rows:List<&2, List<&2, F32>> -> @+i:Nat -> @+j:Nat -> {0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.sample_cov.chk(ok, center, t, k, rows), i, j) == 0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.sample_cov.chk(ok, center, t, k, rows), j, i) : Maybe<&2, F32>}

def ewma_wgram_sym source · line 359 · raw

@mg:Maybe<&2, 0x868deae626c42bd4c69da030be0090fc/linalg.Mat> -> @+sc:F32 -> @+i:Nat -> @+j:Nat -> {0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.ewma_cov.wgram_wrap(mg, sc), i, j) == 0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.ewma_cov.wgram_wrap(mg, sc), j, i) : Maybe<&2, F32>}

def ewma_centered_sym source · line 366 · raw

@ok:Bool -> @+den:F32 -> @+t:U32 -> @+k:U32 -> @+rows:List<&2, List<&2, F32>> -> @+ws:List<&2, F32> -> @+i:Nat -> @+j:Nat -> {0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.ewma_cov.centered(ok, den, t, k, rows, ws), i, j) == 0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.ewma_cov.centered(ok, den, t, k, rows, ws), j, i) : Maybe<&2, F32>}

def ewma_run_sym source · line 374 · raw

@center:Bool -> @+t:U32 -> @+k:U32 -> @+rows:List<&2, List<&2, F32>> -> @+ws:List<&2, F32> -> @+i:Nat -> @+j:Nat -> {0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.ewma_cov.run(center, t, k, rows, ws), i, j) == 0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.ewma_cov.run(center, t, k, rows, ws), j, i) : Maybe<&2, F32>}

def ewma_with_w_sym source · line 382 · raw

@mw:Maybe<&2, 0x868deae626c42bd4c69da030be0090fc/linalg.Vec> -> @center:Bool -> @+t:U32 -> @+k:U32 -> @rows:List<&2, List<&2, F32>> -> @+i:Nat -> @+j:Nat -> {0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.ewma_cov.with_w(mw, center, t, k, rows), i, j) == 0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.ewma_cov.with_w(mw, center, t, k, rows), j, i) : Maybe<&2, F32>}

def ewma_chk_sym source · line 389 · raw

@ok:Bool -> @center:Bool -> @+t:U32 -> @+k:U32 -> @rows:List<&2, List<&2, F32>> -> @+hl:F32 -> @+i:Nat -> @+j:Nat -> {0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.ewma_cov.chk(ok, center, t, k, rows, hl), i, j) == 0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.ewma_cov.chk(ok, center, t, k, rows, hl), j, i) : Maybe<&2, F32>}

def shrink_id_tr_sym source · line 400 · raw

@mtr:Maybe<&2, F32> -> @+n:U32 -> @rows:List<&2, List<&2, F32>> -> @+rho:F32 -> @+i:Nat -> @+j:Nat -> {0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.shrink_id.with_tr(mtr, n, rows, rho), i, j) == 0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.shrink_id.with_tr(mtr, n, rows, rho), j, i) : Maybe<&2, F32>}

def shrink_id_chk_sym source · line 409 · raw

@ok:Bool -> @+n:U32 -> @+rows:List<&2, List<&2, F32>> -> @+rho:F32 -> @+i:Nat -> @+j:Nat -> {0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.shrink_id.chk(ok, n, rows, rho), i, j) == 0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.shrink_id.chk(ok, n, rows, rho), j, i) : Maybe<&2, F32>}

def lw_with_s_sym source · line 421 · raw

@+s_mat:0x868deae626c42bd4c69da030be0090fc/linalg.Mat -> @+t:U32 -> @+k:U32 -> @xrows:List<&2, List<&2, F32>> -> @+i:Nat -> @+j:Nat -> {0xcb0ff1755a0a8548a14bd336933147b3/LAWS.ms_cov_get(0xcb0ff1755a0a8548a14bd336933147b3/risk.wrap_shrink(Some{0xcb0ff1755a0a8548a14bd336933147b3/cov.ledoit_wolf.with_s(s_mat, t, k, xrows)}), i, j) == 0xcb0ff1755a0a8548a14bd336933147b3/LAWS.ms_cov_get(0xcb0ff1755a0a8548a14bd336933147b3/risk.wrap_shrink(Some{0xcb0ff1755a0a8548a14bd336933147b3/cov.ledoit_wolf.with_s(s_mat, t, k, xrows)}), j, i) : Maybe<&2, F32>}

def lw_run_sym source · line 436 · raw

@+t:U32 -> @+k:U32 -> @+xrows:List<&2, List<&2, F32>> -> @+i:Nat -> @+j:Nat -> {0xcb0ff1755a0a8548a14bd336933147b3/LAWS.ms_cov_get(0xcb0ff1755a0a8548a14bd336933147b3/risk.wrap_shrink(Some{0xcb0ff1755a0a8548a14bd336933147b3/cov.ledoit_wolf.run(t, k, xrows)}), i, j) == 0xcb0ff1755a0a8548a14bd336933147b3/LAWS.ms_cov_get(0xcb0ff1755a0a8548a14bd336933147b3/risk.wrap_shrink(Some{0xcb0ff1755a0a8548a14bd336933147b3/cov.ledoit_wolf.run(t, k, xrows)}), j, i) : Maybe<&2, F32>}

def lw_prep_sym source · line 440 · raw

@center:Bool -> @+t:U32 -> @+k:U32 -> @+rows:List<&2, List<&2, F32>> -> @+i:Nat -> @+j:Nat -> {0xcb0ff1755a0a8548a14bd336933147b3/LAWS.ms_cov_get(0xcb0ff1755a0a8548a14bd336933147b3/risk.wrap_shrink(Some{0xcb0ff1755a0a8548a14bd336933147b3/cov.ledoit_wolf.prep(center, t, k, rows)}), i, j) == 0xcb0ff1755a0a8548a14bd336933147b3/LAWS.ms_cov_get(0xcb0ff1755a0a8548a14bd336933147b3/risk.wrap_shrink(Some{0xcb0ff1755a0a8548a14bd336933147b3/cov.ledoit_wolf.prep(center, t, k, rows)}), j, i) : Maybe<&2, F32>}

def lw_chk_sym source · line 448 · raw

@ok:Bool -> @center:Bool -> @+t:U32 -> @+k:U32 -> @rows:List<&2, List<&2, F32>> -> @+i:Nat -> @+j:Nat -> {0xcb0ff1755a0a8548a14bd336933147b3/LAWS.ms_cov_get(0xcb0ff1755a0a8548a14bd336933147b3/risk.wrap_shrink(0xcb0ff1755a0a8548a14bd336933147b3/cov.ledoit_wolf.chk(ok, center, t, k, rows)), i, j) == 0xcb0ff1755a0a8548a14bd336933147b3/LAWS.ms_cov_get(0xcb0ff1755a0a8548a14bd336933147b3/risk.wrap_shrink(0xcb0ff1755a0a8548a14bd336933147b3/cov.ledoit_wolf.chk(ok, center, t, k, rows)), j, i) : Maybe<&2, F32>}

def psd_fin_sym source · line 459 · raw

@mg:Maybe<&2, 0x868deae626c42bd4c69da030be0090fc/linalg.Mat> -> @+i:Nat -> @+j:Nat -> {0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.psd_project.fin(mg), i, j) == 0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.psd_project.fin(mg), j, i) : Maybe<&2, F32>}

def psd_eig_sym source · line 466 · raw

@me:Maybe<&2, 0x868deae626c42bd4c69da030be0090fc/linalg.Eigen> -> @+fl:F32 -> @+i:Nat -> @+j:Nat -> {0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.psd_project.with_eig(me, fl), i, j) == 0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.psd_project.with_eig(me, fl), j, i) : Maybe<&2, F32>}

def dcc_s4_sym source · line 476 · raw

@m:Maybe<&2, 0x868deae626c42bd4c69da030be0090fc/linalg.Mat> -> @+i:Nat -> @+j:Nat -> {0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.dcc_norm.s4(m), i, j) == 0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.dcc_norm.s4(m), j, i) : Maybe<&2, F32>}

def dcc_s3_sym source · line 483 · raw

@m:Maybe<&2, 0x868deae626c42bd4c69da030be0090fc/linalg.Mat> -> @lv:0x868deae626c42bd4c69da030be0090fc/linalg.Vec -> @+i:Nat -> @+j:Nat -> {0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.dcc_norm.s3(m, lv), i, j) == 0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.dcc_norm.s3(m, lv), j, i) : Maybe<&2, F32>}

def dcc_s2_sym source · line 490 · raw

@m:Maybe<&2, 0x868deae626c42bd4c69da030be0090fc/linalg.Mat> -> @+lv:0x868deae626c42bd4c69da030be0090fc/linalg.Vec -> @+i:Nat -> @+j:Nat -> {0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.dcc_norm.s2(m, lv), i, j) == 0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.dcc_norm.s2(m, lv), j, i) : Maybe<&2, F32>}

def dcc_s1_sym source · line 497 · raw

@m:Maybe<&2, 0x868deae626c42bd4c69da030be0090fc/linalg.Mat> -> @inv_d:0x868deae626c42bd4c69da030be0090fc/linalg.Vec -> @lv:0x868deae626c42bd4c69da030be0090fc/linalg.Vec -> @+i:Nat -> @+j:Nat -> {0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.dcc_norm.s1(m, inv_d, lv), i, j) == 0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.dcc_norm.s1(m, inv_d, lv), j, i) : Maybe<&2, F32>}

def dcc_diag1_sym source · line 504 · raw

@+inv_d:0x868deae626c42bd4c69da030be0090fc/linalg.Vec -> @cr:0x868deae626c42bd4c69da030be0090fc/linalg.Mat -> @lv:0x868deae626c42bd4c69da030be0090fc/linalg.Vec -> @+i:Nat -> @+j:Nat -> {0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.dcc_norm.diag1(inv_d, cr, lv), i, j) == 0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.dcc_norm.diag1(inv_d, cr, lv), j, i) : Maybe<&2, F32>}

def dcc_diag_sym source · line 507 · raw

@dv:0x868deae626c42bd4c69da030be0090fc/linalg.Vec -> @cr:0x868deae626c42bd4c69da030be0090fc/linalg.Mat -> @lv:0x868deae626c42bd4c69da030be0090fc/linalg.Vec -> @+i:Nat -> @+j:Nat -> {0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.dcc_norm.diag(dv, cr, lv), i, j) == 0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.dcc_norm.diag(dv, cr, lv), j, i) : Maybe<&2, F32>}

def dcc_craw_sym source · line 511 · raw

@mc:Maybe<&2, 0x868deae626c42bd4c69da030be0090fc/linalg.Mat> -> @lv:0x868deae626c42bd4c69da030be0090fc/linalg.Vec -> @+i:Nat -> @+j:Nat -> {0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.dcc_cov.with_craw(mc, lv), i, j) == 0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.dcc_cov.with_craw(mc, lv), j, i) : Maybe<&2, F32>}

def dcc_wv_sym source · line 518 · raw

@mwv:Maybe<&2, 0x868deae626c42bd4c69da030be0090fc/linalg.Vec> -> @sr:0xcb0ff1755a0a8548a14bd336933147b3/cov.DccScan -> @wc:0x868deae626c42bd4c69da030be0090fc/linalg.Vec -> @+t:U32 -> @+k:U32 -> @rows:List<&2, List<&2, F32>> -> @+i:Nat -> @+j:Nat -> {0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.dcc_cov.with_wv(mwv, sr, wc, t, k, rows), i, j) == 0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.dcc_cov.with_wv(mwv, sr, wc, t, k, rows), j, i) : Maybe<&2, F32>}

def dcc_wc_sym source · line 527 · raw

@mwc:Maybe<&2, 0x868deae626c42bd4c69da030be0090fc/linalg.Vec> -> @+t:U32 -> @+k:U32 -> @+rows:List<&2, List<&2, F32>> -> @+hlv:F32 -> @+i:Nat -> @+j:Nat -> {0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.dcc_cov.with_wc(mwc, t, k, rows, hlv), i, j) == 0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.dcc_cov.with_wc(mwc, t, k, rows, hlv), j, i) : Maybe<&2, F32>}

def dcc_chk_sym source · line 538 · raw

@ok:Bool -> @+t:U32 -> @+k:U32 -> @rows:List<&2, List<&2, F32>> -> @+hlv:F32 -> @+hlc:F32 -> @+i:Nat -> @+j:Nat -> {0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.dcc_cov.chk(ok, t, k, rows, hlv, hlc), i, j) == 0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.dcc_cov.chk(ok, t, k, rows, hlv, hlc), j, i) : Maybe<&2, F32>}

def hac_with_w_sym source · line 550 · raw

@ws:List<&2, F32> -> @+t:U32 -> @+k:U32 -> @rows:List<&2, List<&2, F32>> -> @+lm:U32 -> @+nw:Bool -> @+i:Nat -> @+j:Nat -> {0x868deae626c42bd4c69da030be0090fc/linalg.Mat.get(0xcb0ff1755a0a8548a14bd336933147b3/cov.hac_cov.with_w(ws, t, k, rows, lm, nw), i, j) == 0x868deae626c42bd4c69da030be0090fc/linalg.Mat.get(0xcb0ff1755a0a8548a14bd336933147b3/cov.hac_cov.with_w(ws, t, k, rows, lm, nw), j, i) : Maybe<&2, F32>}

def hac_from_mw_sym source · line 556 · raw

@mw:Maybe<&2, 0x868deae626c42bd4c69da030be0090fc/linalg.Vec> -> @+t:U32 -> @+k:U32 -> @rows:List<&2, List<&2, F32>> -> @+lm:U32 -> @nw:Bool -> @+i:Nat -> @+j:Nat -> {0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.hac_cov.from_mw(mw, t, k, rows, lm, nw), i, j) == 0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.hac_cov.from_mw(mw, t, k, rows, lm, nw), j, i) : Maybe<&2, F32>}

def hac_resolve_sym source · line 563 · raw

@use_ewma:Bool -> @+t:U32 -> @+k:U32 -> @rows:List<&2, List<&2, F32>> -> @+lm:U32 -> @+hl:F32 -> @nw:Bool -> @+i:Nat -> @+j:Nat -> {0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.hac_cov.resolve_w(use_ewma, t, k, rows, lm, hl, nw), i, j) == 0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.hac_cov.resolve_w(use_ewma, t, k, rows, lm, hl, nw), j, i) : Maybe<&2, F32>}

def hac_chk_sym source · line 571 · raw

@ok:Bool -> @+t:U32 -> @+k:U32 -> @rows:List<&2, List<&2, F32>> -> @+lm:U32 -> @+hl:F32 -> @nw:Bool -> @+i:Nat -> @+j:Nat -> {0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.hac_cov.chk(ok, t, k, rows, lm, hl, nw), i, j) == 0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_get(0xcb0ff1755a0a8548a14bd336933147b3/cov.hac_cov.chk(ok, t, k, rows, lm, hl, nw), j, i) : Maybe<&2, F32>}

def take_idem source · line 627 · raw

@-A:Data -> @k:Nat -> @xs:List<&2, A> -> {0xcb0ff1755a0a8548a14bd336933147b3/risk.list_take(A, k, 0xcb0ff1755a0a8548a14bd336933147b3/risk.list_take(A, k, xs)) == 0xcb0ff1755a0a8548a14bd336933147b3/risk.list_take(A, k, xs) : List<&2, A>}

def winsor_chk_causal.go source · line 637 · raw

@ok:Bool -> @+t:U32 -> @+t2:U32 -> @+n:U32 -> @+rows:List<&2, List<&2, F32>> -> @+w:U32 -> @+dmax:F32 -> @+k:Nat -> @+st0:0xcb0ff1755a0a8548a14bd336933147b3/cov.WinState -> {0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_take_rows(k, 0xcb0ff1755a0a8548a14bd336933147b3/cov.winsorize_log_mad.chk(ok, t, n, rows, w, dmax)) == 0xcb0ff1755a0a8548a14bd336933147b3/LAWS.mm_take_rows(k, 0xcb0ff1755a0a8548a14bd336933147b3/cov.winsorize_log_mad.chk(ok, t2, n, 0xcb0ff1755a0a8548a14bd336933147b3/risk.list_take(List<&2, F32>, k, rows), w, dmax)) : Maybe<&2, List<&2, List<&2, F32>>>}

def take_take_add source · line 655 · raw

@-A:Data -> @k:Nat -> @w:Nat -> @xs:List<&2, A> -> {0xcb0ff1755a0a8548a14bd336933147b3/risk.list_take(A, w, 0xcb0ff1755a0a8548a14bd336933147b3/risk.list_take(A, Nat.add(k, w), xs)) == 0xcb0ff1755a0a8548a14bd336933147b3/risk.list_take(A, w, xs) : List<&2, A>}

def lt_zero_absurd source · line 670 · raw

@i:Nat -> @h:{Nat.is_lt(i, 0n) == True{} : Bool} -> Empty

def drop_get source · line 706 · raw

@-A:Data -> @k:Nat -> @xs:List<&2, A> -> @+i:Nat -> {List.get(&2, A, 0xcb0ff1755a0a8548a14bd336933147b3/risk.list_drop(A, k, xs), i) == List.get(&2, A, xs, Nat.add(i, k)) : Maybe<&2, A>}

def maybe_pair_fm_none_r source · line 724 · raw

@mf:Maybe<&2, 0x7296d81d7ba08bf4ba6940be380b5adf/portfolio.FactorModel> -> {None{} == 0xcb0ff1755a0a8548a14bd336933147b3/LAWS.maybe_pair_fm(mf, None{}) : Maybe<&2, 0xcb0ff1755a0a8548a14bd336933147b3/risk.FmRetPair>}

def maybe_pair_fmw_none_m source · line 746 · raw

@mf:Maybe<&2, 0x7296d81d7ba08bf4ba6940be380b5adf/portfolio.FactorModel> -> @mr:Maybe<&2, List<&2, F32>> -> {None{} == 0xcb0ff1755a0a8548a14bd336933147b3/LAWS.maybe_pair_fmw(mf, None{}, mr) : Maybe<&2, 0xcb0ff1755a0a8548a14bd336933147b3/risk.FmWRet>}

def maybe_pair_fmw_none_r source · line 753 · raw

@mf:Maybe<&2, 0x7296d81d7ba08bf4ba6940be380b5adf/portfolio.FactorModel> -> @mw:Maybe<&2, List<&2, F32>> -> {None{} == 0xcb0ff1755a0a8548a14bd336933147b3/LAWS.maybe_pair_fmw(mf, mw, None{}) : Maybe<&2, 0xcb0ff1755a0a8548a14bd336933147b3/risk.FmWRet>}

def two_append source · line 793 · raw

@-A:Data -> @two:0xcb0ff1755a0a8548a14bd336933147b3/risk.Two<A> -> List<&2, A>

Clean two_append helper without field projections:

def two_append_cons source · line 797 · raw

@-A:Data -> @h:A -> @two:0xcb0ff1755a0a8548a14bd336933147b3/risk.Two<A> -> {two_append(A, 0xcb0ff1755a0a8548a14bd336933147b3/risk.split.cons(A, h, two)) == h <> two_append(A, two) : List<&2, A>}

def split_rejoin source · line 801 · raw

@-A:Data -> @k:Nat -> @xs:List<&2, A> -> {two_append(A, 0xcb0ff1755a0a8548a14bd336933147b3/risk.split(A, k, xs)) == xs : List<&2, A>}

Templates

template pseq_append source · line 812 · raw

@-A:Data -> @-B:Data -> @-C:Data -> @-f:(@_:C -> @_:A -> B) -> @xs:List<&2, A> -> @+ys:List<&2, A> -> @+c:C -> {List.append(&2, B, 0xcb0ff1755a0a8548a14bd336933147b3/risk.pseq(A, B, C, f, xs, c), 0xcb0ff1755a0a8548a14bd336933147b3/risk.pseq(A, B, C, f, ys, c)) == 0xcb0ff1755a0a8548a14bd336933147b3/risk.pseq(A, B, C, f, List.append(&2, A, xs, ys), c) : List<&2, B>}

template par_seq source · line 820 · raw

@-A:Data -> @-B:Data -> @-C:Data -> @-f:(@_:C -> @_:A -> B) -> @depth:Nat -> @two:0xcb0ff1755a0a8548a14bd336933147b3/risk.Two<A> -> @+h:U32 -> @+r:U32 -> @+c:C -> {0xcb0ff1755a0a8548a14bd336933147b3/risk.par(A, B, C, f, depth, two, h, r, c) == 0xcb0ff1755a0a8548a14bd336933147b3/risk.pseq(A, B, C, f, two_append(A, two), c) : List<&2, B>}