Skip to content

Commit 861e53b

Browse files
authored
Merge pull request #40 from coq-community/fix-deprec
fix arith deprecations
2 parents bd99c28 + ffe25e5 commit 861e53b

File tree

11 files changed

+53
-52
lines changed

11 files changed

+53
-52
lines changed

theories/DKA_Construction.v

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ Module Algebraic.
249249
rewrite mx_point_blocks11 by trivial.
250250
setoid_rewrite mx_point_blocks01 at 2; trivial.
251251
cbn.
252-
rewrite 2minus_diag.
252+
rewrite 2 Nat.sub_diag.
253253
set (U := mx_point 1 n 0 i (1: regex)).
254254
set (V := mx_point n 1 f 0 (1: regex)).
255255
set (Y := mx_point n 1 s 0 (a: regex)).
@@ -522,9 +522,10 @@ Module Correctness.
522522
Proof.
523523
intros i j n A Hi Hj [Hd He]. split; auto.
524524
intros s a t Hst. apply delta_add_var in Hst as [Hst|[-> [-> ->]]]; split; auto; simpl.
525-
specialize (Hd _ _ _ Hst). destruct A. simpl. num_simpl. eapply lt_le_trans. apply Hd. apply Max.le_max_r.
525+
specialize (Hd _ _ _ Hst). destruct A. simpl. num_simpl. eapply Nat.lt_le_trans.
526+
apply Hd. apply Nat.le_max_r.
526527
specialize (Hd _ _ _ Hst). intuition.
527-
destruct A. simpl. num_simpl. apply Max.le_max_l.
528+
destruct A. simpl. num_simpl. apply Nat.le_max_l.
528529
destruct A. simpl. auto.
529530
Qed.
530531
#[local] Hint Resolve bounded_incr bounded_add_one bounded_add_var : core.
@@ -581,7 +582,7 @@ Module Correctness.
581582
Qed.
582583

583584
Lemma leb_S: forall n, leb (S n) xH = false.
584-
Proof. intros. case le_spec; intro H; trivial. num_simpl. elim (lt_n_O _ H). Qed.
585+
Proof. intros. case le_spec; intro H; trivial. num_simpl. elim (Nat.nlt_0_r _ H). Qed.
585586
Hint Rewrite leb_S : bool_simpl.
586587

587588
Lemma labelling_add_var : forall n A i j s t c,
@@ -602,7 +603,7 @@ Module Correctness.
602603
Lemma psurj A: A = mk (size A) (epsilonmap A) (deltamap A) (max_label A).
603604
Proof. destruct A. reflexivity. Qed.
604605

605-
Opaque Max.max.
606+
Opaque Nat.max.
606607
Lemma commute_add_var: forall n i f A,
607608
bounded A -> belong i A -> belong f A ->
608609
Algebraic.add_var (nat_of_state i) (nat_of_state f) n (preNFA_to_preMAUT A)
@@ -612,14 +613,14 @@ Module Correctness.
612613
rewrite <- plus_assoc. apply plus_compat; trivial.
613614
fold (add_var i f n (mk (size A) (epsilonmap A) (deltamap A) (max_label A))).
614615
rewrite labelling_add_var.
615-
rewrite (@labelling_crop (Max.max (Datatypes.S (nat_of_num n)) (max_label A))); auto with arith.
616+
rewrite (@labelling_crop (Nat.max (Datatypes.S (nat_of_num n)) (max_label A))); auto with arith.
616617
setoid_rewrite eqb_eq_nat_bool. setoid_rewrite id_nat.
617618
unfold labelling. num_simpl.
618619
nat_analyse; simpl; fold_regex; try semiring_reflexivity.
619620
num_analyse; simpl; fold_regex; try semiring_reflexivity.
620-
elim n0. clear. num_simpl. apply Max.le_max_l.
621+
elim n0. clear. num_simpl. apply Nat.le_max_l.
621622
Qed.
622-
Transparent Max.max.
623+
Transparent Nat.max.
623624

624625
Lemma not_true_eq_false: forall b, ~ b = true -> b = false.
625626
Proof. intros [ ]; tauto. Qed.
@@ -927,7 +928,7 @@ Lemma build_max_label: forall a i e f A, i < max_label A -> i < max_label (build
927928
Proof.
928929
induction a; intros i e f A Hi; rewrite (psurj A); simpl; auto.
929930
rewrite max_label_add_one. auto.
930-
num_simpl. eauto 2 using Max.le_max_r with arith.
931+
num_simpl. eauto 2 using Nat.le_max_r with arith.
931932
Qed.
932933

933934
Lemma collect_max_label:
@@ -941,7 +942,7 @@ Proof.
941942
eapply IHa2 in Hi as [Hi|Hi]. left. apply build_max_label, Hi. auto.
942943
rewrite max_label_add_one. auto.
943944
revert Hi. NumSetProps.set_iff. intuition.
944-
subst. left. destruct A; simpl. num_simpl. eauto using Max.le_max_l with arith.
945+
subst. left. destruct A; simpl. num_simpl. eauto using Nat.le_max_l with arith.
945946
Qed.
946947

947948
Lemma max_label_collect:
@@ -958,7 +959,7 @@ Proof.
958959
eapply IHa2 in Hi as [[j ? ?]|Hi]. left. exists j; auto using collect_incr_2. right. assumption.
959960
eapply IHa in Hi as [Hi|Hi]; auto.
960961
revert Hi. rewrite max_label_add_one, max_label_incr. auto.
961-
revert Hi. rewrite max_label_add_var. num_simpl. apply Max.max_case; auto.
962+
revert Hi. rewrite max_label_add_var. num_simpl. apply Nat.max_case; auto.
962963
intro Hi. left. exists (nat_of_num p). auto with arith. num_simpl. auto with set.
963964
Qed.
964965

@@ -981,8 +982,9 @@ Proof.
981982

982983
clear. intros a b H. apply inf_leq. intros c Hc.
983984
apply max_label_collect in Hc as [[d ? Hd]|?].
984-
rewrite H in Hd. eapply collect_max_label in Hd as [Hd|?].
985-
eapply le_lt_trans. eassumption. unfold statesetelt_of_nat in Hd. rewrite id_nat in Hd. eassumption.
986-
NumSetProps.setdec.
987-
simpl in *. compute in H0. lia_false.
985+
rewrite H in Hd. eapply collect_max_label in Hd as [Hd|?].
986+
eapply Nat.le_lt_trans. eassumption. unfold statesetelt_of_nat in Hd.
987+
rewrite id_nat in Hd. eassumption.
988+
NumSetProps.setdec.
989+
simpl in *. compute in H0. lia_false.
988990
Qed.

theories/DKA_DFA_Equiv.v

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -389,11 +389,11 @@ Section correctness.
389389
constructor.
390390
intros l Hl. apply Htar. rewrite <- add_lists_S. apply Htar''. assumption.
391391
apply (ci_sameclass Htar'').
392-
transitivity tar''. apply Htar''. apply Htar.
393-
apply le_trans with (measure tar''). apply Htar. apply Htar''.
392+
transitivity tar''. apply Htar''. apply Htar.
393+
apply Nat.le_trans with (measure tar''). apply Htar. apply Htar''.
394394
apply Htar.
395395
apply Htar'', Hxy.
396-
eapply le_lt_trans. apply Htar''. apply Hsize.
396+
eapply Nat.le_lt_trans. apply Htar''. apply Hsize.
397397

398398
clear IHn. intro Hr.
399399
destruct (IH _ Hr) as [IH1 IH2]; clear Hr IH.
@@ -405,8 +405,8 @@ Section correctness.
405405
apply IH1. apply diag_ok; ti_auto.
406406

407407
transitivity (DS.union tarjan x y). apply DSUtils.le_union. apply IH1.
408-
apply le_trans with (measure (DS.union tarjan x y)).
409-
apply IH1. apply (measure_union_strict (size:=size)) in Hn; auto using lt_le_weak; num_lia.
408+
apply Nat.le_trans with (measure (DS.union tarjan x y)).
409+
apply IH1. apply (measure_union_strict (size:=size)) in Hn; auto using Nat.lt_le_incl; num_lia.
410410
apply IH1. apply in_union.
411411
Qed.
412412

theories/DKA_DFA_Language.v

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,12 @@ Proof.
9999
- compute. firstorder.
100100
lia.
101101
- intros j. simpl. unfold lang_union. rewrite IHn. clear IHn. intuition.
102-
exists O; auto with arith. rewrite plus_comm. assumption.
102+
exists O; auto with arith. rewrite Nat.add_comm. assumption.
103103
destruct H0 as [k ? ?]. exists (Datatypes.S k); auto with arith. rewrite <- plus_n_Sm. assumption.
104104
destruct H as [[|k] ? ?].
105-
+ left. rewrite plus_comm in H0. assumption.
105+
+ left. rewrite Nat.add_comm in H0. assumption.
106106
+ right. exists k; auto with arith. rewrite <- plus_n_Sm in H0. assumption.
107-
Qed.
107+
Qed.
108108

109109
Lemma mx_leq_pointwise `{SL: SemiLattice}: forall n m A (M N: MX_ A n m),
110110
M <== N <-> forall i j, i<n -> j<m -> !M i j <== !N i j.

theories/DKA_Merge.v

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,26 +53,24 @@ Definition compare_DFAs T (equiv: DFA.t -> state -> state -> option T) A B :=
5353

5454
Lemma below_max_pi0: forall n m m', below n m -> below (pi0 n) (max (pi0 m) (pi1 m')).
5555
Proof.
56-
intros. rewrite lt_nat_spec, max_spec. eapply lt_le_trans. 2: apply Max.le_max_l.
56+
intros. rewrite lt_nat_spec, max_spec. eapply Nat.lt_le_trans. 2: apply Nat.le_max_l.
5757
rewrite <- lt_nat_spec. apply lt_pi0. assumption.
5858
Qed.
5959

6060
Lemma below_max_pi1: forall n m m', below n m' -> below (pi1 n) (max (pi0 m) (pi1 m')).
6161
Proof.
62-
intros. rewrite lt_nat_spec, max_spec. eapply lt_le_trans. 2: apply Max.le_max_r.
62+
intros. rewrite lt_nat_spec, max_spec. eapply Nat.lt_le_trans. 2: apply Nat.le_max_r.
6363
rewrite <- lt_nat_spec. apply lt_pi1. assumption.
6464
Qed.
6565

66-
67-
6866
Lemma merge_bounded: forall A B, bounded A -> bounded B -> bounded (merge_DFAs A B).
6967
Proof.
7068
intros A B HA HB. constructor.
7169
intros a i. simpl. case_eq (pimatch i); intros p Hp.
7270
apply below_max_pi0. apply (bounded_delta HA).
7371
apply below_max_pi1. apply (bounded_delta HB).
74-
rewrite lt_nat_spec. apply le_lt_trans with (nat_of_state (pi0 (delta A 0 0))).
75-
apply le_O_n. rewrite <- lt_nat_spec. rapply below_max_pi0. apply (bounded_delta HA).
72+
rewrite lt_nat_spec. apply Nat.le_lt_trans with (nat_of_state (pi0 (delta A 0 0))).
73+
apply Nat.le_0_l. rewrite <- lt_nat_spec. rapply below_max_pi0. apply (bounded_delta HA).
7674
unfold finaux, merge_DFAs.
7775
apply NumSetProps.Props.fold_rec_nodep. apply NumSetProps.Props.fold_rec_nodep.
7876
intro i. NumSetProps.setdec.

theories/Model_MinPlus.v

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,15 @@ Section protect.
8585
Instance mp_ConverseSemiRing: ConverseIdemSemiRing mp_Graph.
8686
Proof.
8787
constructor; simpl; eauto with typeclass_instances.
88-
destruct x; trivial. destruct y; trivial. destruct z; trivial. simpl. rewrite Plus.plus_assoc. reflexivity.
88+
destruct x; trivial. destruct y; trivial. destruct z; trivial. simpl.
89+
rewrite Nat.add_assoc. reflexivity.
8990
destruct x; reflexivity.
90-
destruct x; trivial. destruct y; trivial. simpl. rewrite plus_comm. reflexivity.
91+
destruct x; trivial. destruct y; trivial. simpl. rewrite Nat.add_comm. reflexivity.
9192
destruct y; reflexivity.
9293
destruct x; trivial. destruct y; trivial. simpl. rewrite min_comm. reflexivity.
9394
destruct y; reflexivity.
9495
destruct x; trivial. destruct y; trivial; destruct z; trivial. simpl.
95-
rewrite Min.plus_min_distr_r. reflexivity.
96+
rewrite Nat.add_min_distr_r. reflexivity.
9697
Qed.
9798

9899
Definition mp_IdemSemiRing: IdemSemiRing mp_Graph := Converse.CISR_ISR.

theories/Monoid.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ Section Props1.
286286
intros until n.
287287
rewrite <- (iter_once a) at 4.
288288
rewrite <- iter_split.
289-
rewrite plus_comm.
289+
rewrite Nat.add_comm.
290290
reflexivity.
291291
Qed.
292292

theories/MxGraph.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ Ltac destruct_blocks :=
8585
Ltac mx_intros i j Hi Hj :=
8686
apply mx_equal'; intros i j Hi Hj;
8787
match type of Hi with
88-
| i < 0%nat => elim (lt_n_O _ Hi)
88+
| i < 0%nat => elim (Nat.nlt_0_r _ Hi)
8989
| i < 1%nat => destruct i; [clear Hi | elim (lt_n_1 Hi)]
9090
| _ => idtac
9191
end;
9292
match type of Hj with
93-
| j < 0%nat => elim (lt_n_O _ Hj)
93+
| j < 0%nat => elim (Nat.nlt_0_r _ Hj)
9494
| j < 1%nat => destruct j; [clear Hj | elim (lt_n_1 Hj)]
9595
| _ => idtac
9696
end.

theories/MxSemiRing.v

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -202,35 +202,35 @@ Section Props2.
202202
Proof.
203203
simpl. intros. destruct_blocks.
204204

205-
rewrite (plus_comm m), sum_cut.
205+
rewrite (Nat.add_comm m), sum_cut.
206206
apply plus_compat.
207207
apply sum_compat; intros.
208208
destruct_blocks. reflexivity. lia_false.
209-
rewrite (plus_comm m), sum_shift.
209+
rewrite (Nat.add_comm m), sum_shift.
210210
apply sum_compat; intros.
211211
destruct_blocks. reflexivity.
212212

213-
rewrite (plus_comm m), sum_cut.
213+
rewrite (Nat.add_comm m), sum_cut.
214214
apply plus_compat.
215215
apply sum_compat; intros.
216216
destruct_blocks. reflexivity. lia_false.
217-
rewrite (plus_comm m), sum_shift.
217+
rewrite (Nat.add_comm m), sum_shift.
218218
apply sum_compat; intros.
219219
destruct_blocks. reflexivity.
220220

221-
rewrite (plus_comm m), sum_cut.
221+
rewrite (Nat.add_comm m), sum_cut.
222222
apply plus_compat.
223223
apply sum_compat; intros.
224224
destruct_blocks. reflexivity. lia_false.
225-
rewrite (plus_comm m), sum_shift.
225+
rewrite (Nat.add_comm m), sum_shift.
226226
apply sum_compat; intros.
227227
destruct_blocks. reflexivity.
228228

229-
rewrite (plus_comm m), sum_cut.
229+
rewrite (Nat.add_comm m), sum_cut.
230230
apply plus_compat.
231231
apply sum_compat; intros.
232232
destruct_blocks. reflexivity. lia_false.
233-
rewrite (plus_comm m), sum_shift.
233+
rewrite (Nat.add_comm m), sum_shift.
234234
apply sum_compat; intros.
235235
destruct_blocks. reflexivity.
236236
Qed.

theories/Numbers.v

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Module Type NUM.
8282

8383
(* specification of operations and predicates, w.r.t. nat *)
8484
Axiom S_nat_spec : forall n, nat_of_num (S n) = Datatypes.S (nat_of_num n).
85-
Axiom max_spec : forall n m, nat_of_num (max n m) = Max.max (nat_of_num n) (nat_of_num m).
85+
Axiom max_spec : forall n m, nat_of_num (max n m) = Nat.max (nat_of_num n) (nat_of_num m).
8686
Axiom le_nat_spec : forall n m, n <= m <-> (nat_of_num n <= nat_of_num m)%nat.
8787
Axiom lt_nat_spec : forall n m, n < m <-> (nat_of_num n < nat_of_num m)%nat.
8888

@@ -136,12 +136,12 @@ Module NumUtils (N : NUM).
136136
Proof.
137137
constructor.
138138
intros x; unfold Pos.le. rewrite le_nat_spec. auto with arith.
139-
intros x y z Hxy Hyz. rewrite le_nat_spec in *. apply (le_trans _ (nat_of_num y)); auto.
139+
intros x y z Hxy Hyz. rewrite le_nat_spec in *. apply (Nat.le_trans _ (nat_of_num y)); auto.
140140
Qed.
141141

142142
#[global] Instance lt_transitive: Transitive lt.
143143
Proof.
144-
intros x y z Hxy Hyz. rewrite lt_nat_spec in *. apply (lt_trans _ (nat_of_num y)); auto.
144+
intros x y z Hxy Hyz. rewrite lt_nat_spec in *. apply (Nat.lt_trans _ (nat_of_num y)); auto.
145145
Qed.
146146

147147
Lemma num_peano_rec :
@@ -431,12 +431,12 @@ Module Positive <: NUM.
431431
lia.
432432
Qed.
433433

434-
Lemma max_spec : forall n m, nat_of_num (max n m) = Max.max (nat_of_num n) (nat_of_num m).
434+
Lemma max_spec : forall n m, nat_of_num (max n m) = Nat.max (nat_of_num n) (nat_of_num m).
435435
Proof.
436436
intros n m. unfold max, Pos.max. fold (compare n m). destruct (compare_spec n m).
437-
rewrite Max.max_r; trivial. apply lt_le_weak. rewrite <- lt_nat_spec. assumption.
438-
subst. rewrite Max.max_r; trivial.
439-
rewrite Max.max_l; trivial. apply lt_le_weak. rewrite <- lt_nat_spec. assumption.
437+
rewrite Nat.max_r; trivial. apply Nat.lt_le_incl. rewrite <- lt_nat_spec. assumption.
438+
subst. rewrite Nat.max_r; trivial.
439+
rewrite Nat.max_l; trivial. apply Nat.lt_le_incl. rewrite <- lt_nat_spec. assumption.
440440
Qed.
441441

442442

theories/SemiLattice.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ Section FSumDef.
183183
sum i (S k) f == sum i k f + f (i+k)%nat.
184184
Proof.
185185
revert i; induction k; intro i.
186-
simpl. rewrite plus_0_r; apply plus_com.
186+
simpl. rewrite Nat.add_0_r; apply plus_com.
187187
change (sum i (S (S k)) f) with (f i + sum (S i) (S k) f).
188188
rewrite IHk, plus_assoc. simpl. auto with compat.
189189
Qed.

theories/SemiRing.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ endtests*)
317317
(plus (VLSet_to_X b) (dot (VLst_to_X a) y))
318318
(VLSet_to_X (norm_aux' n b a y)))%nat.
319319
Proof.
320-
induction n; split; intros; try elim (lt_n_O _ H);
320+
induction n; split; intros; try elim (Nat.nlt_0_r _ H);
321321
destruct IHn as [IHnorm_aux IHnorm_aux'].
322322

323323
(* norm_aux *)

0 commit comments

Comments
 (0)