(****************************************************************)
(* Les registres: *)

Fixpoint R1 (st : nat) : BV :=
  match st return BV with
  | O => V1
  | S t =>
      appbv (highs (R1 t))
        (Mux (lowbit (R1 t))
           (consbv (lowbit (BV_full_adder_sum (R2 t) V2 false)) nilbv)
           (consbv (lowbit (R2 t)) nilbv))
  end
 
 with R2 (st : nat) : BV :=
  match st return BV with
  | O => BV_null size
  | S t =>
      appbv
        (highs
           (Mux (lowbit (R1 t)) (BV_full_adder_sum (R2 t) V2 false) (R2 t)))
        (Mux (lowbit (R1 t))
           (consbv (BV_full_adder_carry (R2 t) V2 false) nilbv)
           (consbv false nilbv))
  end.

(* Specifications: *)
Lemma R1_eq1 : R1 0 = V1.
Lemma R1_eq2 : forall t : nat, R1 (S t) = appbv (highs (R1 t)) (Mux (lowbit (R1 t)) (consbv (lowbit (BV_full_adder_sum (R2 t) V2 false)) nilbv) (consbv (lowbit (R2 t)) nilbv)).
Lemma R2_eq1 : R2 0 = BV_null size.
Lemma R2_eq2 : forall t : nat, R2 (S t) = appbv (highs (Mux (lowbit (R1 t)) (BV_full_adder_sum (R2 t) V2 false) (R2 t))) (Mux (lowbit (R1 t)) (consbv (BV_full_adder_carry (R2 t) V2 false) nilbv) (consbv false nilbv)).
Lemma length_R1 : forall t : nat, t <= size -> lengthbv (R1 t) = size.
Lemma length_R2 : forall t : nat, t <= size -> lengthbv (R2 t) = size.
Lemma R1_never_nil : forall t : nat, t <= size -> R1 t <> nilbv.