Skip to content

Commit 5632884

Browse files
authored
Merge pull request #104 from rocq-community/warn-cleaner
Handle some deprecation warnings
2 parents 5cb06a5 + 06b556c commit 5632884

File tree

6 files changed

+30
-43
lines changed

6 files changed

+30
-43
lines changed

BigNumPrelude.v

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,7 @@ Theorem Zmod_le_first: forall a b, 0 <= a -> 0 < b -> 0 <= a mod b <= a.
315315
Z.gcd a b = 0.
316316
Proof.
317317
intros.
318-
generalize (Zgcd_is_gcd a b); destruct 1.
319-
destruct H2 as (k,Hk).
318+
pose proof (Z.gcd_divide_r a b) as (k, Hk).
320319
generalize H; rewrite Hk at 1.
321320
destruct (Z.eq_dec (Z.gcd a b) 0) as [H'|H']; auto.
322321
rewrite Z_div_mult_full; auto.
@@ -326,9 +325,7 @@ Theorem Zmod_le_first: forall a b, 0 <= a -> 0 < b -> 0 <= a mod b <= a.
326325
Lemma Zgcd_mult_rel_prime : forall a b c,
327326
Z.gcd a c = 1 -> Z.gcd b c = 1 -> Z.gcd (a*b) c = 1.
328327
Proof.
329-
intros.
330-
rewrite Zgcd_1_rel_prime in *.
331-
apply rel_prime_sym; apply rel_prime_mult; apply rel_prime_sym; auto.
328+
exact Z.coprime_mul_l.
332329
Qed.
333330

334331
Lemma Zcompare_gt : forall (A:Type)(a a':A)(p q:Z),

BigQ/QMake.v

Lines changed: 21 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ Module Make (NN:NType)(ZZ:ZType)(Import NZ:NType_ZType NN ZZ) <: QType.
230230
generalize (Zgcd_div_pos (ZZ.to_Z p) (NN.to_Z q)). lia.
231231
replace (NN.to_Z q) with 0%Z in * by (symmetry; assumption).
232232
rewrite Zdiv_0_l in *; auto with zarith.
233-
apply Zgcd_div_swap0; lia.
233+
apply Z.gcd_div_swap; lia.
234234
(* Gt *)
235235
qsimpl.
236236
assert (H' : Z.gcd (ZZ.to_Z p) (NN.to_Z q) = 0%Z).
@@ -253,10 +253,8 @@ Module Make (NN:NType)(ZZ:ZType)(Import NZ:NType_ZType NN ZZ) <: QType.
253253
qsimpl.
254254
(* Lt *)
255255
qsimpl.
256-
rewrite Zgcd_1_rel_prime.
257256
destruct (Z_lt_le_dec 0 (NN.to_Z q)).
258-
apply Zis_gcd_rel_prime; auto with zarith.
259-
apply Zgcd_is_gcd.
257+
apply Z.gcd_div_gcd; auto with zarith.
260258
replace (NN.to_Z q) with 0%Z in * by lia.
261259
rewrite Zdiv_0_l in *; lia.
262260
(* Gt *)
@@ -476,11 +474,9 @@ Module Make (NN:NType)(ZZ:ZType)(Import NZ:NType_ZType NN ZZ) <: QType.
476474
simpl.
477475
split.
478476
nzsimpl.
479-
destruct (Zgcd_is_gcd (ZZ.to_Z n) (NN.to_Z d)).
480-
rewrite Z.mul_comm; symmetry; apply Zdivide_Zdiv_eq; auto with zarith.
477+
rewrite Z.mul_comm; symmetry; apply Zdivide_Zdiv_eq; auto using Z.gcd_divide_l with zarith.
481478
nzsimpl.
482-
destruct (Zgcd_is_gcd (ZZ.to_Z n) (NN.to_Z d)).
483-
rewrite Z.mul_comm; symmetry; apply Zdivide_Zdiv_eq; auto with zarith.
479+
rewrite Z.mul_comm; symmetry; apply Zdivide_Zdiv_eq; auto using Z.gcd_divide_r with zarith.
484480
Qed.
485481

486482
Lemma spec_irred_zero : forall n d,
@@ -519,11 +515,9 @@ Module Make (NN:NType)(ZZ:ZType)(Import NZ:NType_ZType NN ZZ) <: QType.
519515
generalize (Z.gcd_nonneg (ZZ.to_Z n) (NN.to_Z d)); lia.
520516

521517
nzsimpl.
522-
rewrite Zgcd_1_rel_prime.
523-
apply Zis_gcd_rel_prime.
518+
apply Z.gcd_div_gcd.
524519
generalize (NN.spec_pos d); lia.
525520
generalize (Z.gcd_nonneg (ZZ.to_Z n) (NN.to_Z d)); lia.
526-
apply Zgcd_is_gcd; auto.
527521
Qed.
528522

529523
Definition mul_norm_Qz_Qq z n d :=
@@ -562,7 +556,7 @@ Module Make (NN:NType)(ZZ:ZType)(Import NZ:NType_ZType NN ZZ) <: QType.
562556
rewrite Zdiv_gcd_zero in GT; auto with zarith.
563557
nsubst. rewrite Zdiv_0_l in *; discriminate.
564558
rewrite <- Z.mul_assoc, (Z.mul_comm (ZZ.to_Z n)), Z.mul_assoc.
565-
rewrite Zgcd_div_swap0; lia.
559+
rewrite Z.gcd_div_swap; lia.
566560
Qed.
567561

568562
#[global]
@@ -602,17 +596,16 @@ Module Make (NN:NType)(ZZ:ZType)(Import NZ:NType_ZType NN ZZ) <: QType.
602596
intros; nzsimpl.
603597
rewrite Z2Pos.id; auto.
604598
apply Zgcd_mult_rel_prime.
605-
rewrite Zgcd_1_rel_prime.
606-
apply Zis_gcd_rel_prime.
599+
apply Z.gcd_div_gcd.
607600
generalize (NN.spec_pos d); lia.
608601
generalize (Z.gcd_nonneg (ZZ.to_Z z) (NN.to_Z d)); lia.
609-
apply Zgcd_is_gcd.
610-
destruct (Zgcd_is_gcd (ZZ.to_Z z) (NN.to_Z d)) as [ (z0,Hz0) (d0,Hd0) Hzd].
602+
destruct (Z.gcd_divide_l (ZZ.to_Z z) (NN.to_Z d)) as [ z0 Hz0 ].
603+
destruct (Z.gcd_divide_r (ZZ.to_Z z) (NN.to_Z d)) as [ d0 Hd0 ].
604+
pose proof (Z.gcd_greatest (ZZ.to_Z z) (NN.to_Z d)) as Hzd.
611605
replace (NN.to_Z d / Z.gcd (ZZ.to_Z z) (NN.to_Z d))%Z with d0.
612-
rewrite Zgcd_1_rel_prime in *.
613-
apply bezout_rel_prime.
614-
destruct (rel_prime_bezout _ _ H) as [u v Huv].
615-
apply Bezout_intro with u (v*(Z.gcd (ZZ.to_Z z) (NN.to_Z d)))%Z.
606+
apply Z.coprime_Bezout.
607+
destruct (Z.Bezout_coprime _ _ H) as [u [v Huv]].
608+
exists u, (v*(Z.gcd (ZZ.to_Z z) (NN.to_Z d)))%Z.
616609
rewrite <- Huv; rewrite Hd0 at 2; ring.
617610
rewrite Hd0 at 1.
618611
symmetry; apply Z_div_mult_full; auto with zarith.
@@ -691,16 +684,14 @@ Module Make (NN:NType)(ZZ:ZType)(Import NZ:NType_ZType NN ZZ) <: QType.
691684
apply Zgcd_mult_rel_prime; rewrite Z.gcd_comm;
692685
apply Zgcd_mult_rel_prime; rewrite Z.gcd_comm; auto.
693686

694-
rewrite Zgcd_1_rel_prime in *.
695-
apply bezout_rel_prime.
696-
destruct (rel_prime_bezout (ZZ.to_Z ny) (NN.to_Z dy)) as [u v Huv]; trivial.
697-
apply Bezout_intro with (u*g')%Z (v*g)%Z.
687+
apply Z.coprime_Bezout.
688+
destruct (Z.Bezout_coprime (ZZ.to_Z ny) (NN.to_Z dy)) as [u [v Huv]]; trivial.
689+
exists (u*g')%Z, (v*g)%Z.
698690
rewrite <- Huv, <- Hg1', <- Hg2. ring.
699691

700-
rewrite Zgcd_1_rel_prime in *.
701-
apply bezout_rel_prime.
702-
destruct (rel_prime_bezout (ZZ.to_Z nx) (NN.to_Z dx)) as [u v Huv]; trivial.
703-
apply Bezout_intro with (u*g)%Z (v*g')%Z.
692+
apply Z.coprime_Bezout.
693+
destruct (Z.Bezout_coprime (ZZ.to_Z nx) (NN.to_Z dx)) as [u [v Huv]]; trivial.
694+
exists (u*g)%Z, (v*g')%Z.
704695
rewrite <- Huv, <- Hg2', <- Hg1. ring.
705696
Qed.
706697

@@ -878,9 +869,7 @@ Module Make (NN:NType)(ZZ:ZType)(Import NZ:NType_ZType NN ZZ) <: QType.
878869
rewrite Z2Pos.id in *; auto.
879870
intros.
880871
rewrite Z.gcd_comm, Z.gcd_abs_l, Z.gcd_comm.
881-
apply Zis_gcd_gcd; auto with zarith.
882-
apply Zis_gcd_minus.
883-
rewrite Z.opp_involutive, <- H1; apply Zgcd_is_gcd.
872+
rewrite Z.gcd_opp_l, Z.gcd_comm; assumption.
884873
rewrite Z.abs_neq; lia.
885874
Qed.
886875

@@ -986,8 +975,7 @@ Module Make (NN:NType)(ZZ:ZType)(Import NZ:NType_ZType NN ZZ) <: QType.
986975
rewrite Z.pow_0_l' in *; [lia|discriminate].
987976
rewrite Z2Pos.id in *; auto.
988977
rewrite NN.spec_pow_pos, ZZ.spec_pow_pos; auto.
989-
rewrite Zgcd_1_rel_prime in *.
990-
apply rel_prime_Zpower; auto with zarith.
978+
apply Z.coprime_pow_l, Z.coprime_pow_r; auto with zarith.
991979
Qed.
992980

993981
Definition power (x : t) (z : Z) : t :=

CyclicDouble/DoubleDiv.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ Section POS_MOD.
139139
rewrite spec_low.
140140
rewrite spec_ww_sub.
141141
rewrite spec_w_0W; rewrite spec_zdigits.
142-
rewrite <- Zmod_div_mod. 2-3: zarith.
142+
rewrite Z.mod_mod_divide.
143143
rewrite Zmod_small. zarith.
144144
split. zarith.
145145
apply Z.lt_le_trans with (Zpos w_digits). zarith.

CyclicDouble/DoubleDivn1.v

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ Section GENDIVN1.
8787
Lemma spec_split : forall (n : nat) (x : zn2z (word w n)),
8888
let (h, l) := double_split w_0 n x in
8989
[!S n | x!] = [!n | h!] * double_wB w_digits n + [!n | l!].
90-
Proof (spec_double_split w_0 w_digits w_to_Z spec_0).
90+
Proof.
91+
exact (spec_double_split w_0 w_digits w_to_Z spec_0).
92+
Qed.
9193

9294
Lemma spec_double_divn1_0 : forall n r a,
9395
[|r|] < [|b2p|] ->

CyclicDouble/DoubleLift.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ Section DoubleLift.
297297
rewrite spec_low.
298298
rewrite spec_ww_sub.
299299
unfold zdigits; rewrite spec_w_0W; rewrite spec_zdigits.
300-
rewrite <- Zmod_div_mod; auto with zarith.
300+
rewrite Z.mod_mod_divide; auto with zarith.
301301
rewrite Zmod_small; auto with zarith.
302302
split; auto with zarith.
303303
apply Z.le_lt_trans with (Zpos w_digits); auto with zarith.
@@ -392,7 +392,7 @@ Section DoubleLift.
392392
revert H1.
393393
rewrite spec_low.
394394
rewrite spec_ww_sub; w_rewrite; intros H1.
395-
rewrite <- Zmod_div_mod; auto with zarith.
395+
rewrite Z.mod_mod_divide; auto with zarith.
396396
rewrite Zmod_small; auto with zarith.
397397
split; auto with zarith.
398398
apply Z.le_lt_trans with (Zpos w_digits); auto with zarith.

CyclicDouble/DoubleSqrt.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ intros x; case x; simpl ww_is_even.
273273
intros w1 w2; simpl.
274274
unfold base.
275275
rewrite Zplus_mod by zarith.
276-
rewrite (fun x y => (Zdivide_mod (x * y))).
276+
rewrite (fun x y => (Z.mod0_divide (x * y))).
277277
rewrite Z.add_0_l; rewrite Zmod_mod by zarith.
278278
apply spec_w_is_even; zarith.
279279
apply Z.divide_mul_r; apply Zpower_divide; zarith.

0 commit comments

Comments
 (0)