proposition: Lemma ltBleB_joinmsb0_adcB n : forall c (p1 p2: BITS n), if c then ltB (joinmsb0 p1) (adcBmain c p1 p2) else leB (joinmsb0 p1) (adcBmain c p1 p2).
proof: Proof. move => c p1 p2. rewrite ltB_nat leB_nat adcBmain_nat toNat_joinmsb0. assert (B1 := toNatBounded p1). assert (B2 := toNatBounded p2). assert (c + toNat p1 + toNat p2 < 2^n.+1). rewrite expnS mul2n -addnn. assert (B:=leq_add B1 B2). destruct c. rewrite addnC add1n -addn1 addnC addnA add1n. apply leq_add; done. rewrite add0n -addn1 addnC addnA add1n. apply leq_add; first done. by rewrite ltnW. destruct c. rewrite toNat_fromNatBounded; last done. by rewrite ltn_addr. rewrite toNat_fromNatBounded; last done. rewrite add0n. by rewrite leq_addr. Qed.
imports: HB(structures) mathcomp.ssreflect.ssreflect mathcomp(ssrfun ssrbool eqtype ssrnat seq fintype tuple zmodp div) ssrextra.tuple ssrextra.nat spec spec.properties operations mathcomp(ssralg)