Skip to content

Commit 26626fa

Browse files
VilletaneuseYishuai Li
authored andcommitted
We remove some Arith files and NPeano from the stdlib after deprecation.
1 parent 3d4f7df commit 26626fa

File tree

6 files changed

+42
-46
lines changed

6 files changed

+42
-46
lines changed

examples/ConsiderDemo.v

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
Require Import Coq.Bool.Bool.
2-
Require NPeano.
3-
Import NPeano.Nat.
2+
Require Import Arith.PeanoNat.
43
Require Import ExtLib.Tactics.Consider.
54
Require Import ExtLib.Data.Nat.
65

@@ -12,19 +11,19 @@ Set Strict Implicit.
1211

1312
(** Some tests *)
1413
Section test.
15-
Goal forall x y z, (ltb x y && ltb y z) = true ->
16-
ltb x z = true.
14+
Goal forall x y z, (Nat.ltb x y && Nat.ltb y z) = true ->
15+
Nat.ltb x z = true.
1716
intros x y z.
18-
consider (ltb x y && ltb y z).
19-
consider (ltb x z); auto. intros. exfalso. lia.
17+
consider (Nat.ltb x y && Nat.ltb y z).
18+
consider (Nat.ltb x z); auto. intros. exfalso. lia.
2019
Qed.
2120

2221
Goal forall x y z,
23-
ltb x y = true ->
24-
ltb y z = true ->
25-
ltb x z = true.
22+
Nat.ltb x y = true ->
23+
Nat.ltb y z = true ->
24+
Nat.ltb x z = true.
2625
Proof.
27-
intros. consider (ltb x y); consider (ltb y z); consider (ltb x z); intros; auto.
26+
intros. consider (Nat.ltb x y); consider (Nat.ltb y z); consider (Nat.ltb x z); intros; auto.
2827
exfalso; lia.
2928
Qed.
3029

theories/Data/HList.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Require Import Coq.Lists.List.
1+
Require Import Coq.Lists.List Coq.Arith.PeanoNat.
22
Require Import Relations RelationClasses.
33
Require Import ExtLib.Core.RelDec.
44
Require Import ExtLib.Data.SigT.
@@ -658,7 +658,7 @@ Section hlist.
658658
{ clear H IHtvs.
659659
eexists; split; eauto. eexists; split; eauto.
660660
simpl. intros. rewrite (hlist_eta vs). reflexivity. }
661-
{ apply Lt.lt_S_n in H.
661+
{ apply Nat.succ_lt_mono in H.
662662
{ specialize (IHtvs _ H).
663663
forward_reason.
664664
rewrite H0. rewrite H1.

theories/Data/ListNth.v

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Require Import Coq.Lists.List.
2-
Require Import Coq.Arith.Lt Coq.Arith.Plus.
2+
Require Import Coq.Arith.PeanoNat.
33

44
Set Implicit Arguments.
55
Set Strict Implicit.
@@ -14,7 +14,7 @@ Section parametric.
1414
induction A; destruct n; simpl; intros; auto.
1515
{ inversion H. }
1616
{ inversion H. }
17-
{ eapply IHA. apply Lt.lt_S_n; assumption. }
17+
{ eapply IHA. apply Nat.succ_lt_mono; assumption. }
1818
Qed.
1919

2020
Lemma nth_error_app_R : forall (A B : list T) n,
@@ -23,7 +23,7 @@ Section parametric.
2323
Proof.
2424
induction A; destruct n; simpl; intros; auto.
2525
+ inversion H.
26-
+ apply IHA. apply Le.le_S_n; assumption.
26+
+ apply IHA. apply Nat.succ_le_mono; assumption.
2727
Qed.
2828

2929
Lemma nth_error_weaken : forall ls' (ls : list T) n v,
@@ -45,25 +45,25 @@ Section parametric.
4545
Proof.
4646
clear. induction ls; destruct n; simpl; intros; auto.
4747
+ inversion H.
48-
+ apply IHls. apply Le.le_S_n; assumption.
48+
+ apply IHls. apply Nat.succ_le_mono; assumption.
4949
Qed.
5050

5151
Lemma nth_error_length : forall (ls ls' : list T) n,
5252
nth_error (ls ++ ls') (n + length ls) = nth_error ls' n.
5353
Proof.
5454
induction ls; simpl; intros.
55-
rewrite Plus.plus_0_r. auto.
56-
rewrite <- Plus.plus_Snm_nSm.
55+
rewrite Nat.add_0_r. auto.
56+
rewrite <-Nat.add_succ_comm.
5757
simpl. eapply IHls.
5858
Qed.
5959

6060
Theorem nth_error_length_ge : forall T (ls : list T) n,
6161
nth_error ls n = None -> length ls <= n.
6262
Proof.
6363
induction ls; destruct n; simpl in *; auto; simpl in *.
64-
+ intro. apply Le.le_0_n.
64+
+ intro. apply Nat.le_0_l.
6565
+ inversion 1.
66-
+ intros. eapply Le.le_n_S. auto.
66+
+ intros. apply ->Nat.succ_le_mono. auto.
6767
Qed.
6868

6969
Lemma nth_error_length_lt : forall {T} (ls : list T) n val,
@@ -72,8 +72,8 @@ Section parametric.
7272
induction ls; destruct n; simpl; intros; auto.
7373
+ inversion H.
7474
+ inversion H.
75-
+ apply Lt.lt_0_Sn.
76-
+ apply Lt.lt_n_S. eauto.
75+
+ apply Nat.lt_0_succ.
76+
+ apply ->Nat.succ_lt_mono. apply IHls with (1 := H).
7777
Qed.
7878

7979

theories/Data/Nat.v

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,47 +9,45 @@ Set Strict Implicit.
99

1010

1111
Global Instance RelDec_eq : RelDec (@eq nat) :=
12-
{ rel_dec := EqNat.beq_nat }.
13-
14-
Require Coq.Numbers.Natural.Peano.NPeano.
12+
{ rel_dec := Nat.eqb }.
1513

1614
Global Instance RelDec_lt : RelDec lt :=
17-
{ rel_dec := NPeano.Nat.ltb }.
15+
{ rel_dec := Nat.ltb }.
1816

1917
Global Instance RelDec_le : RelDec le :=
20-
{ rel_dec := NPeano.Nat.leb }.
18+
{ rel_dec := Nat.leb }.
2119

2220
Global Instance RelDec_gt : RelDec gt :=
23-
{ rel_dec := fun x y => NPeano.Nat.ltb y x }.
21+
{ rel_dec := fun x y => Nat.ltb y x }.
2422

2523
Global Instance RelDec_ge : RelDec ge :=
26-
{ rel_dec := fun x y => NPeano.Nat.leb y x }.
24+
{ rel_dec := fun x y => Nat.leb y x }.
2725

2826
Global Instance RelDecCorrect_eq : RelDec_Correct RelDec_eq.
2927
Proof.
30-
constructor; simpl. apply EqNat.beq_nat_true_iff.
28+
constructor; simpl. apply PeanoNat.Nat.eqb_eq.
3129
Qed.
3230

3331
Global Instance RelDecCorrect_lt : RelDec_Correct RelDec_lt.
3432
Proof.
35-
constructor; simpl. eapply NPeano.Nat.ltb_lt.
33+
constructor; simpl. eapply PeanoNat.Nat.ltb_lt.
3634
Qed.
3735

3836
Global Instance RelDecCorrect_le : RelDec_Correct RelDec_le.
3937
Proof.
40-
constructor; simpl. eapply NPeano.Nat.leb_le.
38+
constructor; simpl. eapply PeanoNat.Nat.leb_le.
4139
Qed.
4240

4341
Global Instance RelDecCorrect_gt : RelDec_Correct RelDec_gt.
4442
Proof.
4543
constructor; simpl. unfold rel_dec; simpl.
46-
intros. eapply NPeano.Nat.ltb_lt.
44+
intros. eapply PeanoNat.Nat.ltb_lt.
4745
Qed.
4846

4947
Global Instance RelDecCorrect_ge : RelDec_Correct RelDec_ge.
5048
Proof.
5149
constructor; simpl. unfold rel_dec; simpl.
52-
intros. eapply NPeano.Nat.leb_le.
50+
intros. eapply PeanoNat.Nat.leb_le.
5351
Qed.
5452

5553
Inductive R_nat_S : nat -> nat -> Prop :=

theories/Data/String.v

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
Require Import Coq.Strings.String.
22
Require Import Coq.Program.Program.
3-
Require Import Coq.Numbers.Natural.Peano.NPeano.
4-
Require Import Coq.Arith.Arith.
3+
Require Import Coq.Arith.PeanoNat.
54

65
Require Import ExtLib.Tactics.Consider.
76
Require Import ExtLib.Core.RelDec.
@@ -99,19 +98,19 @@ Section Program_Scope.
9998
destruct n; destruct m; intros.
10099
inversion H. exfalso. apply H0. etransitivity. 2: eassumption. repeat constructor.
101100
inversion H.
102-
eapply neq_0_lt. congruence.
101+
now apply Nat.lt_0_succ.
103102
Qed.
104103

105104
Program Fixpoint nat2string (n:nat) {measure n}: string :=
106-
match NPeano.Nat.ltb n modulus as x return NPeano.Nat.ltb n modulus = x -> string with
105+
match Nat.ltb n modulus as x return Nat.ltb n modulus = x -> string with
107106
| true => fun _ => String (digit2ascii n) EmptyString
108107
| false => fun pf =>
109-
let m := NPeano.Nat.div n modulus in
108+
let m := Nat.div n modulus in
110109
append (nat2string m) (String (digit2ascii (n - modulus * m)) EmptyString)
111-
end (@Logic.eq_refl _ (NPeano.Nat.ltb n modulus)).
110+
end (@Logic.eq_refl _ (Nat.ltb n modulus)).
112111
Next Obligation.
113-
eapply NPeano.Nat.div_lt; auto.
114-
consider (NPeano.Nat.ltb n modulus); try congruence. intros.
112+
eapply Nat.div_lt; auto.
113+
consider (Nat.ltb n modulus); try congruence. intros.
115114
eapply _xxx; eassumption.
116115
Defined.
117116

theories/Programming/Show.v

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,12 @@ Section hiding_notation.
172172
if Compare_dec.le_gt_dec n 9 then
173173
inject (Char.digit2ascii n)
174174
else
175-
let n' := NPeano.Nat.div n 10 in
175+
let n' := Nat.div n 10 in
176176
(@nat_show n' _) << (inject (Char.digit2ascii (n - 10 * n'))).
177177
Next Obligation.
178-
assert (NPeano.Nat.div n 10 < n) ; eauto.
179-
eapply NPeano.Nat.div_lt.
180-
match goal with [ H : n > _ |- _ ] => inversion H end; apply Lt.lt_O_Sn.
178+
assert (Nat.div n 10 < n) ; eauto.
179+
eapply Nat.div_lt.
180+
match goal with [ H : n > _ |- _ ] => inversion H end; apply Nat.lt_0_succ.
181181
repeat constructor.
182182
Defined.
183183
Global Instance nat_Show : Show nat := { show := nat_show }.

0 commit comments

Comments
 (0)