@@ -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 :=
0 commit comments