def cp_c

bend-collections-laws-math@1.0.0.0 · proofs/math/typed/f64addc.bend:51

import bend-collections-laws-math@1.0.0.0/proofs/math/typed/f64addc.bend as F64addc
import Base
import bend-collections-laws-math@1.0.0.0/src/math/w64.bend as X

51# X.cmp is the order of the values
52def cp_c(+x: Nat, +y: Nat, +c: Cmp, +hc: {Nat.cmp(x, y) == c : Cmp}) -> {X.cmp_pick(Nat.is_lt(x, y), Nat.is_eq(x, y)) == c : Cmp}:
53  match c:
54    case LT{}:
55      Equal.trans(Cmp, X.cmp_pick(Nat.is_lt(x, y), Nat.is_eq(x, y)), X.cmp_pick(True{}, Nat.is_eq(x, y)), LT{}, Equal.cong(Bool, Cmp, t => X.cmp_pick(t, Nat.is_eq(x, y)), Nat.is_lt(x, y), True{}, Equal.cong(Cmp, Bool, t => Cmp.is_lt(t), Nat.cmp(x, y), LT{}, hc)), {==})
56    case EQ{}:
57      Equal.trans(Cmp, X.cmp_pick(Nat.is_lt(x, y), Nat.is_eq(x, y)), X.cmp_pick(False{}, Nat.is_eq(x, y)), EQ{}, Equal.cong(Bool, Cmp, t => X.cmp_pick(t, Nat.is_eq(x, y)), Nat.is_lt(x, y), False{}, Equal.cong(Cmp, Bool, t => Cmp.is_lt(t), Nat.cmp(x, y), EQ{}, hc)), Equal.cong(Bool, Cmp, t => X.cmp_pick(False{}, t), Nat.is_eq(x, y), True{}, Equal.cong(Cmp, Bool, t => Cmp.is_eq(t), Nat.cmp(x, y), EQ{}, hc)))
58    case GT{}:
59      Equal.trans(Cmp, X.cmp_pick(Nat.is_lt(x, y), Nat.is_eq(x, y)), X.cmp_pick(False{}, Nat.is_eq(x, y)), GT{}, Equal.cong(Bool, Cmp, t => X.cmp_pick(t, Nat.is_eq(x, y)), Nat.is_lt(x, y), False{}, Equal.cong(Cmp, Bool, t => Cmp.is_lt(t), Nat.cmp(x, y), GT{}, hc)), Equal.cong(Bool, Cmp, t => X.cmp_pick(False{}, t), Nat.is_eq(x, y), False{}, Equal.cong(Cmp, Bool, t => Cmp.is_eq(t), Nat.cmp(x, y), GT{}, hc)))

Uses (11)

Used by (1)