proof_force.bend source
proof_force.bend on the hub · documented module
import Baseimport ./defs.bend as D# D.force: force_append (fa_p hands its list back, for proofs that need the# list again) and force_length.# force_append's equation for ts and us.def FAeq(b, -B: Kind(b), -ts: List<&1, D.Task<b, B>>, -us: List<&1, D.Task<b, B>>) -> Type: {D.force(b, B, List.append(&1, D.Task<b, B>, ts, us)) == List.append(b, B, D.force(b, B, ts), D.force(b, B, us)) : List<b, B>}# ts handed back (as xs, equal to it), with force_append for ts and us.def FA(b, -B: Kind(b), -ts: List<&1, D.Task<b, B>>, -us: List<&1, D.Task<b, B>>) -> Type: Sigma<&1, &1, List<&1, D.Task<b, B>>, xs => {xs == ts : List<&1, D.Task<b, B>>} & FAeq(b, B, ts, us)>def fa_cons(b, -B: Kind(b), -h: D.Task<b, B>, -t: List<&1, D.Task<b, B>>, -us: List<&1, D.Task<b, B>>, e: FAeq(b, B, t, us)) -> FAeq(b, B, h <> t, us): %e : {D.call(b, B, h) <> D.force(b, B, List.append(&1, D.Task<b, B>, t, us)) == D.call(b, B, h) <> _ : List<b, B>} {==}def fa_p.k(b, -B: Kind(b), h: D.Task<b, B>, -t: List<&1, D.Task<b, B>>, -us: List<&1, D.Task<b, B>>, s: FA(b, B, t, us)) -> FA(b, B, h <> t, us): (t2, e) = s (e1, e2) = e (h <> t2, (Equal.cong(List<&1, D.Task<b, B>>, List<&1, D.Task<b, B>>, x => h <> x, t2, t, e1), fa_cons(b, B, h, t, us, e2)))def fa_p(b, -B: Kind(b), ts: List<&1, D.Task<b, B>>, -us: List<&1, D.Task<b, B>>) -> FA(b, B, ts, us): match ts: case Nil{}: (Nil{}, ({==}, {==})) case h <> t: fa_p.k(b, B, h, t, us, fa_p(b, B, t, us))def force_append(b, -B: Kind(b), -ts: List<&1, D.Task<b, B>>, -us: List<&1, D.Task<b, B>>, s: FA(b, B, ts, us)) -> FAeq(b, B, ts, us): (xs, e) = s (e1, e2) = e e2def force_length(b, -B: Kind(b), ts: List<&1, D.Task<b, B>>) -> {List.length(b, B, D.force(b, B, ts)) == List.length(&1, D.Task<b, B>, ts) : Nat}: match ts: case Nil{}: {==} case h <> t: %Equal.sym(Nat, List.length(b, B, D.force(b, B, t)), List.length(&1, D.Task<b, B>, t), force_length(b, B, t)) : {1n+_ == 1n+List.length(&1, D.Task<b, B>, t) : Nat} {==}