# Proofs of MATH_LAWS.bend. A NaN law holds for every input because each function tests is_nan first: the # hypothesis rewrites that test to its value and the function reduces to its answer. The rest are literal instances # the checker computes. import Base import ./float64.bend as F import ./math.bend as M import ./MATH_LAWS.bend as Laws def Laws.unary_nan(m, x, h): %Equal.sym(Bool, F.is_nan(x), True{}, h) : {[M.unary(_, M.UExp{}, m, x), M.unary(_, M.UExp2{}, m, x), M.unary(_, M.UExpm1{}, m, x), M.unary(_, M.ULog{}, m, x), M.unary(_, M.ULog2{}, m, x), M.unary(_, M.ULog10{}, m, x), M.unary(_, M.ULog1p{}, m, x), M.unary(_, M.USin{}, m, x), M.unary(_, M.UCos{}, m, x), M.unary(_, M.UTan{}, m, x), M.unary(_, M.UArcsin{}, m, x), M.unary(_, M.UArccos{}, m, x), M.unary(_, M.UArctan{}, m, x), M.unary(_, M.USinh{}, m, x), M.unary(_, M.UCosh{}, m, x), M.unary(_, M.UArcsinh{}, m, x), M.unary(_, M.UArccosh{}, m, x), M.unary(_, M.UArctanh{}, m, x), M.unary(_, M.UCbrt{}, m, x), M.unary(_, M.UTanh{}, m, x)] == [F.quiet(x), F.quiet(x), F.quiet(x), F.quiet(x), F.quiet(x), F.quiet(x), F.quiet(x), F.quiet(x), F.quiet(x), F.quiet(x), F.quiet(x), F.quiet(x), F.quiet(x), F.quiet(x), F.quiet(x), F.quiet(x), F.quiet(x), F.quiet(x), F.quiet(x), F.F64{2146959360, 0}] : List<&2, F.F64>} {==} def Laws.atan2_nan_x(m, y, x, h): %Equal.sym(Bool, F.is_nan(x), True{}, h) : {M.out(M.atan2_n(_, F.is_nan(y), m, y, x), m) == F.quiet(x) : F.F64} {==} def Laws.atan2_nan_y(m, y, x, hx, hy): %Equal.sym(Bool, F.is_nan(x), False{}, hx) : {M.out(M.atan2_n(_, F.is_nan(y), m, y, x), m) == F.quiet(y) : F.F64} %Equal.sym(Bool, F.is_nan(y), True{}, hy) : {M.out(M.atan2_n(False{}, _, m, y, x), m) == F.quiet(y) : F.F64} {==} def Laws.special_values(): {==} def Laws.exact_exp_log(): {==} def Laws.exact_hypot(): {==} def Laws.atan2_zeros(): {==}