@@ -18,6 +18,7 @@ Require Import DoubleBase.
1818Local Open Scope Z_scope.
1919
2020Ltac zarith := auto with zarith; fail.
21+ Ltac rm10 := try (rewrite_strat (repeat (topdown (hints rm10)))).
2122
2223Section DoubleSqrt.
2324 Variable w : univ_of_cycles.
@@ -445,7 +446,7 @@ intros x; case x; simpl ww_is_even.
445446 end .
446447 apply Z.pow_pos_nonneg; lia.
447448 }
448- unfold ww_digits; autorewrite with rm10.
449+ unfold ww_digits; rm10.
449450 assert (tmp: forall p q r, p + (q - r) = p + q - r) by zarith;
450451 rewrite tmp; clear tmp.
451452 assert (tmp: forall p, p + p = 2 * p) by zarith;
@@ -821,9 +822,9 @@ intros x; case x; simpl ww_is_even.
821822 assert (V1 := spec_ww_to_Z w_digits w_to_Z spec_to_Z (WW w4 w5)).
822823 enough (0 < [[WW w4 w5]]) by zarith.
823824 apply Z.lt_le_trans with (wB/ 2 * wB + 0).
824- autorewrite with rm10; apply Z.mul_pos_pos.
825+ rm10; apply Z.mul_pos_pos.
825826 apply Z.mul_lt_mono_pos_r with 2. zarith.
826- autorewrite with rm10.
827+ rm10.
827828 rewrite Z.mul_comm; rewrite wB_div_2.
828829 case (spec_to_Z w5);zarith.
829830 case (spec_to_Z w5);zarith.
@@ -849,9 +850,9 @@ intros x; case x; simpl ww_is_even.
849850 rename V1 into VV1.
850851 assert (VV2: 0 < [[WW w4 w5]]).
851852 apply Z.lt_le_trans with (wB/ 2 * wB + 0).
852- autorewrite with rm10; apply Z.mul_pos_pos.
853+ rm10; apply Z.mul_pos_pos.
853854 apply Z.mul_lt_mono_pos_r with 2. zarith.
854- autorewrite with rm10.
855+ rm10.
855856 rewrite Z.mul_comm, wB_div_2.
856857 assert (VV3 := spec_to_Z w5);zarith.
857858 assert (VV3 := spec_to_Z w5);zarith.
@@ -942,7 +943,7 @@ intros x; case x; simpl ww_is_even.
942943 end.
943944 assert (V := Zsquare_pos [|w5|]);
944945 rewrite Zsquare_mult in V; zarith.
945- autorewrite with rm10.
946+ rm10.
946947 match goal with |- _ <= 2 * (?U * ?V + ?W) =>
947948 apply Z.le_trans with (2 * U * V + 0)
948949 end.
@@ -989,7 +990,7 @@ intros x; case x; simpl ww_is_even.
989990 end.
990991 assert (V1 := Zsquare_pos [|w5|]);
991992 rewrite Zsquare_mult in V1; zarith.
992- autorewrite with rm10.
993+ rm10.
993994 match goal with |- _ <= 2 * (?U * ?V + ?W) =>
994995 apply Z.le_trans with (2 * U * V + 0)
995996 end.
@@ -1031,9 +1032,9 @@ intros x; case x; simpl ww_is_even.
10311032 match goal with |- _ <= _ * ?X =>
10321033 apply Z.le_trans with (1 * X); [ | zarith ]
10331034 end.
1034- autorewrite with rm10.
1035+ rm10.
10351036 rewrite <- wB_div_2; apply Z.mul_le_mono_nonneg_l; zarith.
1036- * rewrite <- V3 in VV; generalize VV; autorewrite with rm10;
1037+ * rewrite <- V3 in VV; generalize VV; rm10;
10371038 clear VV; intros VV.
10381039 rewrite spec_ww_add_c by zarith.
10391040 rewrite ww_add_mult_mult_2_plus_1.
@@ -1108,7 +1109,7 @@ Qed.
11081109 generalize (spec_ww_is_even (ww_head0 x)); case_eq (ww_is_even (ww_head0 x)).
11091110 intros HH H1; rewrite HH; split; auto.
11101111 intros H2.
1111- generalize (spec_ww_head0 x H2); case (ww_head0 x); autorewrite with rm10.
1112+ generalize (spec_ww_head0 x H2); case (ww_head0 x); rm10.
11121113 intros (H3, H4); split. 2: zarith.
11131114 apply Z.le_trans with (2 := H3).
11141115 apply Zdiv_le_compat_l; zarith.
@@ -1170,20 +1171,20 @@ Qed.
11701171 zarith.
11711172 intros H1.
11721173 rewrite spec_ww_compare. case Z.compare_spec;
1173- simpl ww_to_Z; autorewrite with rm10.
1174+ simpl ww_to_Z; rm10.
11741175 generalize H1; case x.
11751176 intros HH; contradict HH; simpl ww_to_Z; zarith.
11761177 intros w0 w1; simpl ww_to_Z; autorewrite with w_rewrite rm10.
11771178 intros H2; case (spec_ww_head1 (WW w0 w1)); intros H3 H4 H5.
11781179 generalize (H4 H2); clear H4; rewrite H5; clear H5; autorewrite with rm10.
11791180 intros (H4, H5).
11801181 assert (V: wB/4 <= [|w0|]). {
1181- apply beta_lex with 0 [|w1|] wB. 2-3: zarith. autorewrite with rm10.
1182+ apply beta_lex with 0 [|w1|] wB. 2-3: zarith. rm10.
11821183 rewrite <- wwB_4_wB_4; auto. }
11831184 generalize (@spec_w_sqrt2 w0 w1 V).
11841185 case (w_sqrt2 w0 w1); intros w2 c.
11851186 simpl ww_to_Z; simpl @fst.
1186- case c; unfold interp_carry; autorewrite with rm10.
1187+ case c; unfold interp_carry; rm10.
11871188 intros w3 (H6, H7); rewrite H6.
11881189 assert (V1 := spec_to_Z w3).
11891190 split. zarith.
@@ -1235,7 +1236,7 @@ Qed.
12351236 by (rewrite Z.mul_comm; zarith).
12361237 intros H2.
12371238 assert (V: wB/4 <= [|w0|]). {
1238- apply beta_lex with 0 [|w1|] wB. 2: zarith. autorewrite with rm10.
1239+ apply beta_lex with 0 [|w1|] wB. 2: zarith. rm10.
12391240 simpl ww_to_Z in H2; rewrite H2.
12401241 rewrite <- wwB_4_wB_4 by zarith.
12411242 rewrite Z.mul_comm; zarith.
@@ -1260,7 +1261,7 @@ Qed.
12601261 assert (Hv5: [[(ww_add_mul_div (ww_pred ww_zdigits) W0 (ww_head1 x))]]
12611262 = [[ww_head1 x]]/2).
12621263 rewrite spec_ww_add_mul_div.
1263- simpl ww_to_Z; autorewrite with rm10.
1264+ simpl ww_to_Z; rm10.
12641265 rewrite Hv3.
12651266 ring_simplify (Zpos (xO w_digits) - (Zpos (xO w_digits) - 1)).
12661267 rewrite Z.pow_1_r.
@@ -1277,7 +1278,7 @@ Qed.
12771278 rewrite spec_w_add_mul_div.
12781279 rewrite spec_w_sub.
12791280 rewrite spec_w_0.
1280- simpl ww_to_Z; autorewrite with rm10.
1281+ simpl ww_to_Z; rm10.
12811282 rewrite Hv6; rewrite spec_w_zdigits.
12821283 rewrite (fun x y => Zmod_small (x - y)).
12831284 ring_simplify (Zpos w_digits - (Zpos w_digits - [[ww_head1 x]] / 2)).
@@ -1304,7 +1305,7 @@ Qed.
13041305 enough (0 <= Y) by zarith
13051306 end .
13061307 case (Z_mod_lt [|w2|] (2 ^ ([[ww_head1 x]] / 2))); zarith.
1307- case c; unfold interp_carry; autorewrite with rm10;
1308+ case c; unfold interp_carry; rm10;
13081309 intros w3; assert (V3 := spec_to_Z w3);zarith.
13091310 apply Z.mul_lt_mono_pos_r with (2 ^ [[ww_head1 x]]). zarith.
13101311 rewrite H4.
@@ -1326,15 +1327,15 @@ Qed.
13261327 pattern [|w2|] at 1; rewrite (Z_div_mod_eq_full [|w2|] (2 ^ ([[ww_head1 x]]/2))) by
13271328 zarith.
13281329 rewrite <- Z.add_assoc; rewrite Z.mul_add_distr_l.
1329- autorewrite with rm10; apply Z.add_le_mono_l.
1330+ rm10; apply Z.add_le_mono_l.
13301331 case (Z_mod_lt [|w2|] (2 ^ ([[ww_head1 x]]/2))); zarith.
13311332 split. zarith.
13321333 apply Z.le_lt_trans with ([|w2|]). 2: zarith.
13331334 apply Zdiv_le_upper_bound. zarith.
13341335 pattern [|w2|] at 1; replace [|w2|] with ([|w2|] * 2 ^0).
13351336 apply Z.mul_le_mono_nonneg_l. zarith.
13361337 apply Zpower_le_monotone; zarith.
1337- rewrite Z.pow_0_r; autorewrite with rm10; auto.
1338+ rewrite Z.pow_0_r; rm10; auto.
13381339 split.
13391340 rewrite Hv0 in Hv2; rewrite (Pos2Z.inj_xO w_digits) in Hv2; zarith.
13401341 apply Z.le_lt_trans with (Zpos w_digits). zarith.
0 commit comments