+ napply refl_eq
+ ##]
+nqed.
+
+nlemma eqb8w16_to_eq : ∀bw1,bw2.eq_b8w16 bw1 bw2 = true → bw1 = bw2.
+ #bw1; #bw2;
+ ncases bw1; #e1; ncases bw2; #e2;
+ ##[ ##1: nchange with ((eq_b8 e1 e2 = true) → ?); #H; nrewrite > (eqb8_to_eq … H); napply refl_eq
+ ##| ##2,3: nnormalize; #H; napply (bool_destruct … H)
+ ##| ##4: nchange with ((eq_w16 e1 e2 = true) → ?); #H; nrewrite > (eqw16_to_eq … H); napply refl_eq
+ ##]
+nqed.
+
+nlemma eq_to_eqb8w16 : ∀bw1,bw2.bw1 = bw2 → eq_b8w16 bw1 bw2 = true.
+ #bw1; #bw2;
+ ncases bw1; #e1; ncases bw2; #e2;
+ ##[ ##1: #H; nrewrite > (b8w16_destruct_b8_b8 … H);
+ nchange with (eq_b8 e2 e2 = true);
+ nrewrite > (eq_to_eqb8 e2 e2 (refl_eq …));
+ napply refl_eq
+ ##| ##2: #H; nelim (b8w16_destruct_b8_w16 … H)
+ ##| ##3: #H; nelim (b8w16_destruct_w16_b8 … H);
+ ##| ##4: #H; nrewrite > (b8w16_destruct_w16_w16 … H);
+ nchange with (eq_w16 e2 e2 = true);
+ nrewrite > (eq_to_eqw16 e2 e2 (refl_eq …));
+ napply refl_eq
+ ##]
+nqed.
+
+nlemma decidable_b8w16 : ∀x,y:byte8_or_word16.decidable (x = y).
+ #x; nelim x; #e1; #y; nelim y; #e2;
+ nnormalize;
+ ##[ ##1: napply (or2_elim (? = ?) (? ≠ ?) ? (decidable_b8 e1 e2) …);
+ ##[ ##2: #H; napply (or2_intro2 (? = ?) (? ≠ ?) … ); nnormalize; #H1; napply (H (b8w16_destruct_b8_b8 … H1))
+ ##| ##1: #H; nrewrite > H; napply (or2_intro1 (? = ?) (? ≠ ?) (refl_eq …))
+ ##]
+ ##| ##2: napply (or2_intro2 (? = ?) (? ≠ ?) …); nnormalize; #H; napply (b8w16_destruct_b8_w16 … H)
+ ##| ##3: napply (or2_intro2 (? = ?) (? ≠ ?) …); nnormalize; #H; napply (b8w16_destruct_w16_b8 … H)
+ ##| ##4: napply (or2_elim (? = ?) (? ≠ ?) ? (decidable_w16 e1 e2) …);
+ ##[ ##2: #H; napply (or2_intro2 (? = ?) (? ≠ ?) … ); nnormalize; #H1; napply (H (b8w16_destruct_w16_w16 … H1))
+ ##| ##1: #H; nrewrite > H; napply (or2_intro1 (? = ?) (? ≠ ?) (refl_eq …))
+ ##]
+ ##]
+nqed.
+
+nlemma neqb8w16_to_neq : ∀bw1,bw2.eq_b8w16 bw1 bw2 = false → bw1 ≠ bw2.
+ #bw1; #bw2;
+ ncases bw1; #e1; ncases bw2; #e2;
+ ##[ ##1: nchange with ((eq_b8 e1 e2 = false) → ?); #H;
+ nnormalize; #H1; napply (neqb8_to_neq … H); napply (b8w16_destruct_b8_b8 … H1)
+ ##| ##2: nnormalize; #H; #H1; napply (b8w16_destruct_b8_w16 … H1)
+ ##| ##3: nnormalize; #H; #H1; napply (b8w16_destruct_w16_b8 … H1)
+ ##| ##4: nchange with ((eq_w16 e1 e2 = false) → ?); #H;
+ nnormalize; #H1; napply (neqw16_to_neq … H); napply (b8w16_destruct_w16_w16 … H1)