Definition d_i := minusw s'_i y_i.Definition rrr_i := minusw x_i_in_Z_ y_i.Definition r_i := ltw l'_i M_in_Z_ rrr_i (minusw rrr_i M_in_Z_).(* notation *)

Definition r''0 := ltw r'0 M_in_Z_ r'0 (minusw r'0 M_in_Z_).(* only needed after the loop *)
(* KE EP TOGETHER> *)

Definition r'0' := ltw d0 c_in_Z_ r0 (minusw r0 M_in_Z_).(* needed in loop *)

Definition r''0' := ltw r'0' M_in_Z_ r'0' (minusw r'0' M_in_Z_).Definition g' := r''0.

(* Specifications: *)
Lemma lt_0_2ppw : 0 < 2 ^ (p + w).
Lemma lt_0_2pp : 0 < 2 ^ p.
Lemma le_0_wm1 : 0 <= w - 1.
Lemma lt_p_w : p < w.
Lemma le_p_w : p <= w.
Lemma le_0_wmp : 0 <= w - p.
Lemma lt_M_2pw : M < 2 ^ w.
Lemma le_M_2pw : M <= 2 ^ w.
Lemma d_Si_eq : _Z d_Si = (h mod M * 2 ^ w + l) / 2 ^ p * 2 ^ p mod M \/ _Z d_Si = (h mod M * 2 ^ w + l) / 2 ^ p * 2 ^ p mod M + M \/ _Z d_Si = ((h mod M + M) * 2 ^ w + l) / 2 ^ p * 2 ^ p mod M \/ _Z d_Si = ((h mod M + M) * 2 ^ w + l) / 2 ^ p * 2 ^ p mod M + M.
Lemma r_Si_eq_lit : _Z r_Si = (d_Si + l mod 2 ^ p mod M) mod 2 ^ w.
Lemma r_Si_eq_a : _Z r_Si = (d_Si + (h mod M * 2 ^ w + l mod 2 ^ p mod M) mod 2 ^ p) mod 2 ^ w.
Lemma r_Si_eq_b : _Z r_Si = (_Z d_Si + ((h mod M + M) * 2 ^ w + l mod 2 ^ p mod M) mod 2 ^ p) mod 2 ^ w.
Lemma p2wp : 2 ^ w = 2 ^ (w - p) * 2 ^ p.
Lemma mod2p : forall a b c', (a * 2 ^ w + b) mod 2 ^ p = (c' * 2 ^ w + b) mod 2 ^ p.
Lemma M1_r'_i_eq : M = 1 -> _Z r'_i = 0.
Lemma M1_h_i_eq : M = 1 -> _Z h_i = 0.
Lemma M1_h'_i_eq : M = 1 -> _Z h'_i = x_i.
Lemma le_0_2pp : forall z : Z, 0 <= z mod 2 ^ p.
Lemma le_0_mod_M : forall z : Z, 0 <= z mod M.
Lemma lt_plus_M_2p_2w : forall a b : Z, a mod M + b mod 2 ^ p < 2 ^ w.
Lemma divmultmodM : forall a b : Z, (a * 2 ^ w + b) / 2 ^ p * 2 ^ p mod M = (a mod M * 2 ^ w + b) / 2 ^ p * 2 ^ p mod M.
Lemma r'0plus : forall a b : Z, (a * 2 ^ w + b) mod 2 ^ p = b mod 2 ^ p.
Lemma r'_i_eq : _Z r'_i = (h mod M * 2 ^ w + l) / 2 ^ p * 2 ^ p mod M + (h mod M * 2 ^ w + l mod 2 ^ p mod M) mod 2 ^ p \/ _Z r'_i = (h mod M * 2 ^ w + l) / 2 ^ p * 2 ^ p mod M + M + (h mod M * 2 ^ w + l mod 2 ^ p mod M) mod 2 ^ p.
Lemma r'_i_eq'_i : _Z r'_i = x mod M \/ _Z r'_i = x mod M + M \/ _Z r'_i = x mod M + M + M.
Lemma d_Si_small : d_Si < M + M.
Lemma r'0_eq_1 : _Z r'0 = ((h mod M * 2 ^ w + l) / 2 ^ p * 2 ^ p mod M + l mod 2 ^ p mod M) mod 2 ^ w \/ _Z r'0 = (((h mod M + M) * 2 ^ w + l) / 2 ^ p * 2 ^ p mod M + l mod 2 ^ p mod M) mod 2 ^ w.
Lemma r'0_eq_2 : _Z r'0 = (h mod M * 2 ^ w + l) / 2 ^ p * 2 ^ p mod M + l mod 2 ^ p mod M \/ _Z r'0 = ((h mod M + M) * 2 ^ w + l) / 2 ^ p * 2 ^ p mod M + l mod 2 ^ p mod M.
Lemma r'0_eq_5 : forall b : Z, ((b mod M + M) * 2 ^ w + l) mod M = (b * 2 ^ w + l) mod M.
Lemma r'0_eq_6 : forall b : Z, (b * 2 ^ w + l) mod 2 ^ p = l mod 2 ^ p.
Lemma r'0_eq_7 : _Z r'0 = (h mod M * 2 ^ w + l) / 2 ^ p * 2 ^ p mod M + (h mod M * 2 ^ w + l) mod 2 ^ p mod M \/ _Z r'0 = ((h mod M + M) * 2 ^ w + l) / 2 ^ p * 2 ^ p mod M + ((h mod M + M) * 2 ^ w + l) mod 2 ^ p mod M.
Lemma r'0_eq_8 : forall a b : Z, a = b / 2 ^ p * 2 ^ p mod M + b mod 2 ^ p mod M -> a = b mod M \/ a = b mod M + M.
Lemma r'0_eq_9 : (_Z r'0 = (h mod M * 2 ^ w + l) mod M \/ _Z r'0 = (h mod M * 2 ^ w + l) mod M + M) \/ (_Z r'0 = ((h mod M + M) * 2 ^ w + l) mod M \/ _Z r'0 = ((h mod M + M) * 2 ^ w + l) mod M + M).
Lemma r'0_eq : _Z r'0 = x mod M \/ _Z r'0 = x mod M + M.
Lemma r''0_eq : _Z r''0 = x mod M.
Lemma r'_small : r'_i < 2 ^ p + M.
Lemma r'a_small : r'a < 2 ^ p.
Lemma r'a_eq : _Z r'a = x mod M \/ _Z r'a = x mod M + M.
Lemma x_i_eq : x_i = x' mod 2 ^ w.
Lemma s_i_eq : _Z s_i = x' mod 2 ^ w / 2 ^ p.
Lemma s'_i_eq : _Z s'_i = x' mod 2 ^ w - x' mod 2 ^ p.
Lemma le_0_x' : 0 <= x'.
Lemma lt_x'_x'max : x' < 2 ^ (p + w).
Lemma le_x'_x'max : x' <= 2 ^ (p + w) - 1.
Lemma h'_i_eq_mod : M = 1 \/ _Z h'_i = (x' / 2 ^ p) mod 2 ^ w.
Lemma M1_r'a : M = 1 \/ _Z h'_i = x' / 2 ^ p.
Lemma q_i_eq_ch : M = 1 \/ _Z q_i = x' / 2 ^ p * (2 ^ (p + w) / M mod 2 ^ w) / 2 ^ w.
Lemma q_i_eq : _Z q_i = x' / 2 ^ p * (2 ^ (p + w) / M mod 2 ^ w) / 2 ^ w.
Lemma q'_i_eq_pre_ch : M = 1 \/ _Z q'_i = (x' / 2 ^ p * (2 ^ (p + w) / M) / 2 ^ w) mod 2 ^ w.
Lemma q'_i_eq_pre : _Z q'_i = (x' / 2 ^ p * (2 ^ (p + w) / M) / 2 ^ w) mod 2 ^ w.
Lemma mod_ab_mod : forall z a b m : Z, 0 < m -> z = a \/ z = b -> z mod m = a mod m \/ z mod m = b mod m.
Lemma q'_i_eq : _Z q'_i = (x' / 2 ^ p * 2 ^ p / M) mod 2 ^ w \/ _Z q'_i = (x' / 2 ^ p * 2 ^ p / M - 1) mod 2 ^ w.
Lemma y_i_eq : _Z y_i = x' / 2 ^ p * 2 ^ p / M * M mod 2 ^ w \/ _Z y_i = (x' / 2 ^ p * 2 ^ p / M * M - M) mod 2 ^ w.
Lemma d_i_eq : _Z d_i = x' / 2 ^ p * 2 ^ p mod M \/ _Z d_i = x' / 2 ^ p * 2 ^ p mod M + M.
Lemma rrr_i_eq : _Z rrr_i = (_Z d_i + x' mod 2 ^ p) mod 2 ^ w.
Lemma l'_i_eq : _Z l'_i = x' mod 2 ^ p.
Lemma le2ppMM : 2 ^ p < M + M.
Lemma r_i_eq : _Z r_i = (_Z d_i + x' mod 2 ^ p mod M) mod 2 ^ w.