intros H H0. replace (Z_of_nat 0 * w) with 0 in H0. simpl in H0. cut (x = 0). intro H1. rewrite H1.
rewrite Zdiv_small_0. unfold P'. split. left. simpl. rewrite H1. rewrite Zdiv_small_0. replace (0 * 2 ^ p) with 0. symmetry.
apply modred. omega. omega. ring. rewrite Zdiv_small_0. replace (0 mod 2 ^ w) with 0. omega. symmetry. apply modred. omega.
exact lt02w. omega. omega. rewrite Zdiv_small_0. rewrite modred. apply lt_0_Zpow. unfold p. unfold p_in_Z_w. apply le_0_p.
omega. exact lt02w. omega. omega. simpl. rewrite H1. rewrite Zdiv_small_0. rewrite modred. rewrite modred. symmetry.
apply modred. omega. apply lt_0_Zpow. unfold p. unfold p_in_Z_w. apply le_0_p. apply Zmod_le_0_z. apply lt_0_Zpow. unfold p.
unfold p_in_Z_w. apply le_0_p. rewrite modred with (x := 0). omega. omega. apply lt_0_Zpow. unfold p. unfold p_in_Z_w.
apply le_0_p. apply Zmod_le_0_z. omega. apply Zlt_le_trans with M. apply Zmod_lt_z_m. omega. rewrite Zpow_2_w_is_2Zpow_2_wm1.
omega. omega. omega. omega. exact lt02w. omega. ring. Qed.

(* Specifications: *)
Lemma P_all : forall (n : nat),
0 <= x -> x < 2 ^ (Z_of_nat n * w) ->
P' M p (fst (foldlz f' (zero_in_Z_, zero_in_Z_) n))
(snd (foldlz f' (zero_in_Z_, zero_in_Z_) n)) (x / 2 ^ w) (x_ 0).