exact lt02w. apply Zle_lt_trans with (x * 2 ^ w / 2 ^ w). apply Zdiv_le. exact lt02w.
apply Zmult_le_compat_l. apply Zlt_le_weak. apply lt_z__Z. apply le_0__Z. rewrite Z_div_mult.
apply lt_z__Z. apply Zlt_gt. exact lt02w. Qed.
(* <KEEP TOGETHER - plusminustimesuhwm *)
Definition plusw (x y : Z_ (2 ^ w)) :=
exist (in_Z_ (2 ^ w)) ((x + y) mod 2 ^ w)
(mod_in_Z__ (x + y)).
Definition minusw (x y : Z_ (2 ^ w)) :=
exist (in_Z_ (2 ^ w)) ((x - y) mod 2 ^ w) (mod_in_Z__ (x - y)).
Definition multw (x y : Z_ (2 ^ w)) :=
exist (in_Z_ (2 ^ w)) (x * y mod 2 ^ w) (mod_in_Z__ (x * y)).
Definition uhwm (x y : Z_ (2 ^ w)) :=
exist (in_Z_ (2 ^ w)) (x * y / 2 ^ w) (is_in_Z_R_uhwm x y).
(* KEEP TOGETHER> - plusminustimesuhwm *)
(* <KEEP TOGETHER - shifts *)
Definition multp2 (x : Z_ (2 ^ w)) (i : Z_ w) :=
exist (in_Z_ (2 ^ w)) (2 ^ i * x mod 2 ^ w) (mod_in_Z__ (2 ^ i * x)).
Definition ursh (x : Z_ (2 ^ w)) (i : Z_ w) :=
exist (in_Z_ (2 ^ w)) (x / 2 ^ i) (is_in_Z_R_ursh x i).
(* KEEP TOGETHER> - shifts *)
(* <KEEP TOGETHER - ltw *)
Definition ltw (x y t e : Z_ (2 ^ w)) :=
If (Zlt_bool x y) t e.
(* KEEP TOGETHER> - ltw *)

(* Specifications: *)
Lemma Z_from_plusw : forall (x y : Z_ (2 ^ w)), _Z (plusw x y) = (x + y) mod (2 ^ w).
trivial. Qed.
Lemma Z_from_multw : forall x y : Z_ (2 ^ w), _Z (multw x y) = x * y mod 2 ^ w.
trivial. Qed.
Lemma Z_from_minusw : forall x y : Z_ (2 ^ w), _Z (minusw x y) = Zmod (x - y) (2 ^ w).
trivial. Qed.
Lemma Z_from_multp2 : forall (x : Z_ (2 ^ w)) (i : Z_ w),
_Z (multp2 x i) = Zmod (2 ^ i * x) (2 ^ w).