summaryrefslogtreecommitdiff
path: root/theories/Arith
diff options
context:
space:
mode:
Diffstat (limited to 'theories/Arith')
-rw-r--r--theories/Arith/Arith.v4
-rw-r--r--theories/Arith/Arith_base.v4
-rw-r--r--theories/Arith/Between.v10
-rw-r--r--theories/Arith/Bool_nat.v8
-rw-r--r--theories/Arith/Compare.v12
-rw-r--r--theories/Arith/Compare_dec.v26
-rw-r--r--theories/Arith/Div2.v46
-rw-r--r--theories/Arith/EqNat.v20
-rw-r--r--theories/Arith/Euclid.v31
-rw-r--r--theories/Arith/Even.v8
-rw-r--r--theories/Arith/Factorial.v14
-rw-r--r--theories/Arith/Gt.v18
-rw-r--r--theories/Arith/Le.v17
-rw-r--r--theories/Arith/Lt.v21
-rw-r--r--theories/Arith/Max.v58
-rw-r--r--theories/Arith/Min.v54
-rw-r--r--theories/Arith/MinMax.v113
-rw-r--r--theories/Arith/Minus.v34
-rw-r--r--theories/Arith/Mult.v41
-rw-r--r--theories/Arith/NatOrderedType.v64
-rw-r--r--theories/Arith/Peano_dec.v30
-rw-r--r--theories/Arith/Plus.v63
-rw-r--r--theories/Arith/Wf_nat.v43
-rw-r--r--theories/Arith/vo.itarget2
24 files changed, 260 insertions, 481 deletions
diff --git a/theories/Arith/Arith.v b/theories/Arith/Arith.v
index 2e9dc2de..fea10ce1 100644
--- a/theories/Arith/Arith.v
+++ b/theories/Arith/Arith.v
@@ -1,12 +1,10 @@
(************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
-(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2011 *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *)
(* \VV/ **************************************************************)
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-(*i $Id: Arith.v 14641 2011-11-06 11:59:10Z herbelin $ i*)
-
Require Export Arith_base.
Require Export ArithRing.
diff --git a/theories/Arith/Arith_base.v b/theories/Arith/Arith_base.v
index e9953e54..9f0f05db 100644
--- a/theories/Arith/Arith_base.v
+++ b/theories/Arith/Arith_base.v
@@ -1,13 +1,11 @@
(************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
-(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2011 *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *)
(* \VV/ **************************************************************)
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-(*i $Id: Arith_base.v 14641 2011-11-06 11:59:10Z herbelin $ i*)
-
Require Export Le.
Require Export Lt.
Require Export Plus.
diff --git a/theories/Arith/Between.v b/theories/Arith/Between.v
index 65753e31..fb488526 100644
--- a/theories/Arith/Between.v
+++ b/theories/Arith/Between.v
@@ -1,17 +1,15 @@
(************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
-(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2011 *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *)
(* \VV/ **************************************************************)
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-(*i $Id: Between.v 14641 2011-11-06 11:59:10Z herbelin $ i*)
-
Require Import Le.
Require Import Lt.
-Open Local Scope nat_scope.
+Local Open Scope nat_scope.
Implicit Types k l p q r : nat.
@@ -76,7 +74,7 @@ Section Between.
Lemma in_int_intro : forall p q r, p <= r -> r < q -> in_int p q r.
Proof.
- red in |- *; auto with arith.
+ red; auto with arith.
Qed.
Hint Resolve in_int_intro: arith v62.
@@ -151,7 +149,7 @@ Section Between.
between k l ->
(forall n:nat, in_int k l n -> P n -> ~ Q n) -> ~ exists_between k l.
Proof.
- induction 1; red in |- *; intros.
+ induction 1; red; intros.
absurd (k < k); auto with arith.
absurd (Q l); auto with arith.
elim (exists_in_int k (S l)); auto with arith; intros l' inl' Ql'.
diff --git a/theories/Arith/Bool_nat.v b/theories/Arith/Bool_nat.v
index b3dcd8ec..4c15a173 100644
--- a/theories/Arith/Bool_nat.v
+++ b/theories/Arith/Bool_nat.v
@@ -1,18 +1,16 @@
(************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
-(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2011 *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *)
(* \VV/ **************************************************************)
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-(* $Id: Bool_nat.v 14641 2011-11-06 11:59:10Z herbelin $ *)
-
Require Export Compare_dec.
Require Export Peano_dec.
Require Import Sumbool.
-Open Local Scope nat_scope.
+Local Open Scope nat_scope.
Implicit Types m n x y : nat.
@@ -36,4 +34,4 @@ Definition nat_noteq_bool x y :=
bool_of_sumbool (sumbool_not _ _ (eq_nat_dec x y)).
Definition zerop_bool x := bool_of_sumbool (zerop x).
-Definition notzerop_bool x := bool_of_sumbool (notzerop x). \ No newline at end of file
+Definition notzerop_bool x := bool_of_sumbool (notzerop x).
diff --git a/theories/Arith/Compare.v b/theories/Arith/Compare.v
index 2fe5c0d9..65219655 100644
--- a/theories/Arith/Compare.v
+++ b/theories/Arith/Compare.v
@@ -1,18 +1,16 @@
(************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
-(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2011 *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *)
(* \VV/ **************************************************************)
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-(*i $Id: Compare.v 14641 2011-11-06 11:59:10Z herbelin $ i*)
-
(** Equality is decidable on [nat] *)
-Open Local Scope nat_scope.
+Local Open Scope nat_scope.
-Notation not_eq_sym := sym_not_eq.
+Notation not_eq_sym := not_eq_sym (only parsing).
Implicit Types m n p q : nat.
@@ -43,7 +41,7 @@ Proof.
lapply (lt_le_S m n); auto with arith.
intro H'; lapply (le_lt_or_eq (S m) n); auto with arith.
induction 1; auto with arith.
- right; exists (n - S (S m)); simpl in |- *.
+ right; exists (n - S (S m)); simpl.
rewrite (plus_comm m (n - S (S m))).
rewrite (plus_n_Sm (n - S (S m)) m).
rewrite (plus_n_Sm (n - S (S m)) (S m)).
@@ -52,4 +50,4 @@ Qed.
Require Export Wf_nat.
-Require Export Min Max. \ No newline at end of file
+Require Export Min Max.
diff --git a/theories/Arith/Compare_dec.v b/theories/Arith/Compare_dec.v
index 99c7415e..a90a9ce9 100644
--- a/theories/Arith/Compare_dec.v
+++ b/theories/Arith/Compare_dec.v
@@ -1,19 +1,17 @@
(************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
-(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2011 *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *)
(* \VV/ **************************************************************)
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-(*i $Id: Compare_dec.v 14641 2011-11-06 11:59:10Z herbelin $ i*)
-
Require Import Le.
Require Import Lt.
Require Import Gt.
Require Import Decidable.
-Open Local Scope nat_scope.
+Local Open Scope nat_scope.
Implicit Types m n x y : nat.
@@ -22,21 +20,21 @@ Proof.
destruct n; auto with arith.
Defined.
-Definition lt_eq_lt_dec : forall n m, {n < m} + {n = m} + {m < n}.
+Definition lt_eq_lt_dec n m : {n < m} + {n = m} + {m < n}.
Proof.
- induction n; destruct m; auto with arith.
+ induction n in m |- *; destruct m; auto with arith.
destruct (IHn m) as [H|H]; auto with arith.
destruct H; auto with arith.
Defined.
-Definition gt_eq_gt_dec : forall n m, {m > n} + {n = m} + {n > m}.
+Definition gt_eq_gt_dec n m : {m > n} + {n = m} + {n > m}.
Proof.
intros; apply lt_eq_lt_dec; assumption.
Defined.
-Definition le_lt_dec : forall n m, {n <= m} + {m < n}.
+Definition le_lt_dec n m : {n <= m} + {m < n}.
Proof.
- induction n.
+ induction n in m |- *.
auto with arith.
destruct m.
auto with arith.
@@ -140,7 +138,7 @@ Proof.
Qed.
-(** A ternary comparison function in the spirit of [Zcompare]. *)
+(** A ternary comparison function in the spirit of [Z.compare]. *)
Fixpoint nat_compare n m :=
match n, m with
@@ -200,16 +198,16 @@ Proof.
apply -> nat_compare_lt; auto.
Qed.
-Lemma nat_compare_spec : forall x y, CompSpec eq lt x y (nat_compare x y).
+Lemma nat_compare_spec :
+ forall x y, CompareSpec (x=y) (x<y) (y<x) (nat_compare x y).
Proof.
intros.
- destruct (nat_compare x y) as [ ]_eqn; constructor.
+ destruct (nat_compare x y) eqn:?; constructor.
apply nat_compare_eq; auto.
apply <- nat_compare_lt; auto.
apply <- nat_compare_gt; auto.
Qed.
-
(** Some projections of the above equivalences. *)
Lemma nat_compare_Lt_lt : forall n m, nat_compare n m = Lt -> n<m.
@@ -258,7 +256,7 @@ Lemma leb_correct : forall m n, m <= n -> leb m n = true.
Proof.
induction m as [| m IHm]. trivial.
destruct n. intro H. elim (le_Sn_O _ H).
- intros. simpl in |- *. apply IHm. apply le_S_n. assumption.
+ intros. simpl. apply IHm. apply le_S_n. assumption.
Qed.
Lemma leb_complete : forall m n, leb m n = true -> m <= n.
diff --git a/theories/Arith/Div2.v b/theories/Arith/Div2.v
index 89620f5f..56115c7f 100644
--- a/theories/Arith/Div2.v
+++ b/theories/Arith/Div2.v
@@ -1,19 +1,17 @@
(************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
-(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2011 *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *)
(* \VV/ **************************************************************)
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-(*i $Id: Div2.v 14641 2011-11-06 11:59:10Z herbelin $ i*)
-
Require Import Lt.
Require Import Plus.
Require Import Compare_dec.
Require Import Even.
-Open Local Scope nat_scope.
+Local Open Scope nat_scope.
Implicit Type n : nat.
@@ -45,7 +43,7 @@ Qed.
Lemma lt_div2 : forall n, 0 < n -> div2 n < n.
Proof.
- intro n. pattern n in |- *. apply ind_0_1_SS.
+ intro n. pattern n. apply ind_0_1_SS.
(* n = 0 *)
inversion 1.
(* n=1 *)
@@ -71,24 +69,24 @@ Proof.
(* S n *) inversion_clear H. apply even_div2 in H0 as <-. trivial.
Qed.
-Lemma div2_even : forall n, div2 n = div2 (S n) -> even n
-with div2_odd : forall n, S (div2 n) = div2 (S n) -> odd n.
+Lemma div2_even n : div2 n = div2 (S n) -> even n
+with div2_odd n : S (div2 n) = div2 (S n) -> odd n.
Proof.
- destruct n; intro H.
- (* 0 *) constructor.
- (* S n *) constructor. apply div2_odd. rewrite H. trivial.
- destruct n; intro H.
- (* 0 *) discriminate.
- (* S n *) constructor. apply div2_even. injection H as <-. trivial.
+{ destruct n; intro H.
+ - constructor.
+ - constructor. apply div2_odd. rewrite H. trivial. }
+{ destruct n; intro H.
+ - discriminate.
+ - constructor. apply div2_even. injection H as <-. trivial. }
Qed.
Hint Resolve even_div2 div2_even odd_div2 div2_odd: arith.
-Lemma even_odd_div2 :
- forall n,
- (even n <-> div2 n = div2 (S n)) /\ (odd n <-> S (div2 n) = div2 (S n)).
+Lemma even_odd_div2 n :
+ (even n <-> div2 n = div2 (S n)) /\
+ (odd n <-> S (div2 n) = div2 (S n)).
Proof.
- auto decomp using div2_odd, div2_even, odd_div2, even_div2.
+ split; split; auto using div2_odd, div2_even, odd_div2, even_div2.
Qed.
@@ -101,12 +99,12 @@ Hint Unfold double: arith.
Lemma double_S : forall n, double (S n) = S (S (double n)).
Proof.
- intro. unfold double in |- *. simpl in |- *. auto with arith.
+ intro. unfold double. simpl. auto with arith.
Qed.
Lemma double_plus : forall n (m:nat), double (n + m) = double n + double m.
Proof.
- intros m n. unfold double in |- *.
+ intros m n. unfold double.
do 2 rewrite plus_assoc_reverse. rewrite (plus_permute n).
reflexivity.
Qed.
@@ -117,7 +115,7 @@ Lemma even_odd_double :
forall n,
(even n <-> n = double (div2 n)) /\ (odd n <-> n = S (double (div2 n))).
Proof.
- intro n. pattern n in |- *. apply ind_0_1_SS.
+ intro n. pattern n. apply ind_0_1_SS.
(* n = 0 *)
split; split; auto with arith.
intro H. inversion H.
@@ -128,11 +126,11 @@ Proof.
intros. destruct H as ((IH1,IH2),(IH3,IH4)).
split; split.
intro H. inversion H. inversion H1.
- simpl in |- *. rewrite (double_S (div2 n0)). auto with arith.
- simpl in |- *. rewrite (double_S (div2 n0)). intro H. injection H. auto with arith.
+ simpl. rewrite (double_S (div2 n0)). auto with arith.
+ simpl. rewrite (double_S (div2 n0)). intro H. injection H. auto with arith.
intro H. inversion H. inversion H1.
- simpl in |- *. rewrite (double_S (div2 n0)). auto with arith.
- simpl in |- *. rewrite (double_S (div2 n0)). intro H. injection H. auto with arith.
+ simpl. rewrite (double_S (div2 n0)). auto with arith.
+ simpl. rewrite (double_S (div2 n0)). intro H. injection H. auto with arith.
Qed.
(** Specializations *)
diff --git a/theories/Arith/EqNat.v b/theories/Arith/EqNat.v
index 60575beb..ce8eb478 100644
--- a/theories/Arith/EqNat.v
+++ b/theories/Arith/EqNat.v
@@ -1,16 +1,14 @@
(************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
-(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2011 *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *)
(* \VV/ **************************************************************)
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-(*i $Id: EqNat.v 14641 2011-11-06 11:59:10Z herbelin $ i*)
-
(** Equality on natural numbers *)
-Open Local Scope nat_scope.
+Local Open Scope nat_scope.
Implicit Types m n x y : nat.
@@ -25,7 +23,7 @@ Fixpoint eq_nat n m : Prop :=
end.
Theorem eq_nat_refl : forall n, eq_nat n n.
- induction n; simpl in |- *; auto.
+ induction n; simpl; auto.
Qed.
Hint Resolve eq_nat_refl: arith v62.
@@ -37,7 +35,7 @@ Qed.
Hint Immediate eq_eq_nat: arith v62.
Lemma eq_nat_eq : forall n m, eq_nat n m -> n = m.
- induction n; induction m; simpl in |- *; contradiction || auto with arith.
+ induction n; induction m; simpl; contradiction || auto with arith.
Qed.
Hint Immediate eq_nat_eq: arith v62.
@@ -57,11 +55,11 @@ Proof.
induction n.
destruct m as [| n].
auto with arith.
- intros; right; red in |- *; trivial with arith.
+ intros; right; red; trivial with arith.
destruct m as [| n0].
- right; red in |- *; auto with arith.
+ right; red; auto with arith.
intros.
- simpl in |- *.
+ simpl.
apply IHn.
Defined.
@@ -78,12 +76,12 @@ Fixpoint beq_nat n m : bool :=
Lemma beq_nat_refl : forall n, true = beq_nat n n.
Proof.
- intro x; induction x; simpl in |- *; auto.
+ intro x; induction x; simpl; auto.
Qed.
Definition beq_nat_eq : forall x y, true = beq_nat x y -> x = y.
Proof.
- double induction x y; simpl in |- *.
+ double induction x y; simpl.
reflexivity.
intros n H1 H2. discriminate H2.
intros n H1 H2. discriminate H2.
diff --git a/theories/Arith/Euclid.v b/theories/Arith/Euclid.v
index f32e1ad4..3abdff98 100644
--- a/theories/Arith/Euclid.v
+++ b/theories/Arith/Euclid.v
@@ -1,71 +1,68 @@
(************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
-(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2011 *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *)
(* \VV/ **************************************************************)
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-(*i $Id: Euclid.v 14641 2011-11-06 11:59:10Z herbelin $ i*)
-
Require Import Mult.
Require Import Compare_dec.
Require Import Wf_nat.
-Open Local Scope nat_scope.
+Local Open Scope nat_scope.
Implicit Types a b n q r : nat.
Inductive diveucl a b : Set :=
divex : forall q r, b > r -> a = q * b + r -> diveucl a b.
-
Lemma eucl_dev : forall n, n > 0 -> forall m:nat, diveucl m n.
Proof.
- intros b H a; pattern a in |- *; apply gt_wf_rec; intros n H0.
+ intros b H a; pattern a; apply gt_wf_rec; intros n H0.
elim (le_gt_dec b n).
intro lebn.
elim (H0 (n - b)); auto with arith.
intros q r g e.
- apply divex with (S q) r; simpl in |- *; auto with arith.
+ apply divex with (S q) r; simpl; auto with arith.
elim plus_assoc.
elim e; auto with arith.
intros gtbn.
- apply divex with 0 n; simpl in |- *; auto with arith.
-Qed.
+ apply divex with 0 n; simpl; auto with arith.
+Defined.
Lemma quotient :
forall n,
n > 0 ->
forall m:nat, {q : nat | exists r : nat, m = q * n + r /\ n > r}.
Proof.
- intros b H a; pattern a in |- *; apply gt_wf_rec; intros n H0.
+ intros b H a; pattern a; apply gt_wf_rec; intros n H0.
elim (le_gt_dec b n).
intro lebn.
elim (H0 (n - b)); auto with arith.
intros q Hq; exists (S q).
elim Hq; intros r Hr.
- exists r; simpl in |- *; elim Hr; intros.
+ exists r; simpl; elim Hr; intros.
elim plus_assoc.
elim H1; auto with arith.
intros gtbn.
- exists 0; exists n; simpl in |- *; auto with arith.
-Qed.
+ exists 0; exists n; simpl; auto with arith.
+Defined.
Lemma modulo :
forall n,
n > 0 ->
forall m:nat, {r : nat | exists q : nat, m = q * n + r /\ n > r}.
Proof.
- intros b H a; pattern a in |- *; apply gt_wf_rec; intros n H0.
+ intros b H a; pattern a; apply gt_wf_rec; intros n H0.
elim (le_gt_dec b n).
intro lebn.
elim (H0 (n - b)); auto with arith.
intros r Hr; exists r.
elim Hr; intros q Hq.
- elim Hq; intros; exists (S q); simpl in |- *.
+ elim Hq; intros; exists (S q); simpl.
elim plus_assoc.
elim H1; auto with arith.
intros gtbn.
- exists n; exists 0; simpl in |- *; auto with arith.
-Qed.
+ exists n; exists 0; simpl; auto with arith.
+Defined.
diff --git a/theories/Arith/Even.v b/theories/Arith/Even.v
index 5bab97c2..4f679fe2 100644
--- a/theories/Arith/Even.v
+++ b/theories/Arith/Even.v
@@ -1,18 +1,16 @@
(************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
-(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2011 *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *)
(* \VV/ **************************************************************)
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-(*i $Id: Even.v 14641 2011-11-06 11:59:10Z herbelin $ i*)
-
(** Here we define the predicates [even] and [odd] by mutual induction
and we prove the decidability and the exclusion of those predicates.
The main results about parity are proved in the module Div2. *)
-Open Local Scope nat_scope.
+Local Open Scope nat_scope.
Implicit Types m n : nat.
@@ -147,7 +145,7 @@ Lemma even_mult_aux :
forall n m,
(odd (n * m) <-> odd n /\ odd m) /\ (even (n * m) <-> even n \/ even m).
Proof.
- intros n; elim n; simpl in |- *; auto with arith.
+ intros n; elim n; simpl; auto with arith.
intros m; split; split; auto with arith.
intros H'; inversion H'.
intros H'; elim H'; auto.
diff --git a/theories/Arith/Factorial.v b/theories/Arith/Factorial.v
index 3b434b96..37aa1b2c 100644
--- a/theories/Arith/Factorial.v
+++ b/theories/Arith/Factorial.v
@@ -1,37 +1,35 @@
(************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
-(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2011 *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *)
(* \VV/ **************************************************************)
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-(*i $Id: Factorial.v 14641 2011-11-06 11:59:10Z herbelin $ i*)
-
Require Import Plus.
Require Import Mult.
Require Import Lt.
-Open Local Scope nat_scope.
+Local Open Scope nat_scope.
(** Factorial *)
-Boxed Fixpoint fact (n:nat) : nat :=
+Fixpoint fact (n:nat) : nat :=
match n with
| O => 1
| S n => S n * fact n
end.
-Arguments Scope fact [nat_scope].
+Arguments fact n%nat.
Lemma lt_O_fact : forall n:nat, 0 < fact n.
Proof.
- simple induction n; unfold lt in |- *; simpl in |- *; auto with arith.
+ simple induction n; unfold lt; simpl; auto with arith.
Qed.
Lemma fact_neq_0 : forall n:nat, fact n <> 0.
Proof.
intro.
- apply sym_not_eq.
+ apply not_eq_sym.
apply lt_O_neq.
apply lt_O_fact.
Qed.
diff --git a/theories/Arith/Gt.v b/theories/Arith/Gt.v
index 43df01c0..31b15507 100644
--- a/theories/Arith/Gt.v
+++ b/theories/Arith/Gt.v
@@ -1,13 +1,11 @@
(************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
-(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2011 *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *)
(* \VV/ **************************************************************)
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-(*i $Id: Gt.v 14641 2011-11-06 11:59:10Z herbelin $ i*)
-
(** Theorems about [gt] in [nat]. [gt] is defined in [Init/Peano.v] as:
<<
Definition gt (n m:nat) := m < n.
@@ -17,7 +15,7 @@ Definition gt (n m:nat) := m < n.
Require Import Le.
Require Import Lt.
Require Import Plus.
-Open Local Scope nat_scope.
+Local Open Scope nat_scope.
Implicit Types m n p : nat.
@@ -49,7 +47,7 @@ Hint Immediate gt_S_n: arith v62.
Theorem gt_S : forall n m, S n > m -> n > m \/ m = n.
Proof.
- intros n m H; unfold gt in |- *; apply le_lt_or_eq; auto with arith.
+ intros n m H; unfold gt; apply le_lt_or_eq; auto with arith.
Qed.
Lemma gt_pred : forall n m, m > S n -> pred m > n.
@@ -112,23 +110,23 @@ Hint Resolve le_gt_S: arith v62.
Theorem le_gt_trans : forall n m p, m <= n -> m > p -> n > p.
Proof.
- red in |- *; intros; apply lt_le_trans with m; auto with arith.
+ red; intros; apply lt_le_trans with m; auto with arith.
Qed.
Theorem gt_le_trans : forall n m p, n > m -> p <= m -> n > p.
Proof.
- red in |- *; intros; apply le_lt_trans with m; auto with arith.
+ red; intros; apply le_lt_trans with m; auto with arith.
Qed.
Lemma gt_trans : forall n m p, n > m -> m > p -> n > p.
Proof.
- red in |- *; intros n m p H1 H2.
+ red; intros n m p H1 H2.
apply lt_trans with m; auto with arith.
Qed.
Theorem gt_trans_S : forall n m p, S n > m -> m > p -> n > p.
Proof.
- red in |- *; intros; apply lt_le_trans with m; auto with arith.
+ red; intros; apply lt_le_trans with m; auto with arith.
Qed.
Hint Resolve gt_trans_S le_gt_trans gt_le_trans: arith v62.
@@ -144,7 +142,7 @@ Qed.
Lemma plus_gt_reg_l : forall n m p, p + n > p + m -> n > m.
Proof.
- red in |- *; intros n m p H; apply plus_lt_reg_l with p; auto with arith.
+ red; intros n m p H; apply plus_lt_reg_l with p; auto with arith.
Qed.
Lemma plus_gt_compat_l : forall n m p, n > m -> p + n > p + m.
diff --git a/theories/Arith/Le.v b/theories/Arith/Le.v
index b73959e7..1febb76b 100644
--- a/theories/Arith/Le.v
+++ b/theories/Arith/Le.v
@@ -1,13 +1,11 @@
(************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
-(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2011 *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *)
(* \VV/ **************************************************************)
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-(*i $Id: Le.v 14641 2011-11-06 11:59:10Z herbelin $ i*)
-
(** Order on natural numbers. [le] is defined in [Init/Peano.v] as:
<<
Inductive le (n:nat) : nat -> Prop :=
@@ -18,7 +16,7 @@ where "n <= m" := (le n m) : nat_scope.
>>
*)
-Open Local Scope nat_scope.
+Local Open Scope nat_scope.
Implicit Types m n p : nat.
@@ -48,8 +46,8 @@ Qed.
Theorem le_Sn_0 : forall n, ~ S n <= 0.
Proof.
- red in |- *; intros n H.
- change (IsSucc 0) in |- *; elim H; simpl in |- *; auto with arith.
+ red; intros n H.
+ change (IsSucc 0); elim H; simpl; auto with arith.
Qed.
Hint Resolve le_0_n le_Sn_0: arith v62.
@@ -84,8 +82,7 @@ Hint Immediate le_Sn_le: arith v62.
Theorem le_S_n : forall n m, S n <= S m -> n <= m.
Proof.
- intros n m H; change (pred (S n) <= pred (S m)) in |- *.
- destruct H; simpl; auto with arith.
+ exact Peano.le_S_n.
Qed.
Hint Immediate le_S_n: arith v62.
@@ -105,11 +102,9 @@ Hint Resolve le_pred_n: arith v62.
Theorem le_pred : forall n m, n <= m -> pred n <= pred m.
Proof.
- destruct n; simpl; auto with arith.
- destruct m; simpl; auto with arith.
+ exact Peano.le_pred.
Qed.
-
(** * [le] is a order on [nat] *)
(** Antisymmetry *)
diff --git a/theories/Arith/Lt.v b/theories/Arith/Lt.v
index 004274fe..8559b782 100644
--- a/theories/Arith/Lt.v
+++ b/theories/Arith/Lt.v
@@ -1,13 +1,11 @@
(************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
-(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2011 *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *)
(* \VV/ **************************************************************)
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-(*i $Id: Lt.v 14641 2011-11-06 11:59:10Z herbelin $ i*)
-
(** Theorems about [lt] in nat. [lt] is defined in library [Init/Peano.v] as:
<<
Definition lt (n m:nat) := S n <= m.
@@ -16,7 +14,7 @@ Infix "<" := lt : nat_scope.
*)
Require Import Le.
-Open Local Scope nat_scope.
+Local Open Scope nat_scope.
Implicit Types m n p : nat.
@@ -53,7 +51,7 @@ Qed.
Theorem lt_not_le : forall n m, n < m -> ~ m <= n.
Proof.
- red in |- *; intros n m Lt Le; exact (le_not_lt m n Le Lt).
+ red; intros n m Lt Le; exact (le_not_lt m n Le Lt).
Qed.
Hint Immediate le_not_lt lt_not_le: arith v62.
@@ -96,9 +94,9 @@ Proof.
Qed.
Hint Resolve lt_0_Sn: arith v62.
-Theorem lt_n_O : forall n, ~ n < 0.
-Proof le_Sn_O.
-Hint Resolve lt_n_O: arith v62.
+Theorem lt_n_0 : forall n, ~ n < 0.
+Proof le_Sn_0.
+Hint Resolve lt_n_0: arith v62.
(** * Predecessor *)
@@ -109,12 +107,12 @@ Qed.
Lemma lt_pred : forall n m, S n < m -> n < pred m.
Proof.
-induction 1; simpl in |- *; auto with arith.
+induction 1; simpl; auto with arith.
Qed.
Hint Immediate lt_pred: arith v62.
Lemma lt_pred_n_n : forall n, 0 < n -> pred n < n.
-destruct 1; simpl in |- *; auto with arith.
+destruct 1; simpl; auto with arith.
Qed.
Hint Resolve lt_pred_n_n: arith v62.
@@ -161,7 +159,7 @@ Hint Immediate lt_le_weak: arith v62.
Theorem le_or_lt : forall n m, n <= m \/ m < n.
Proof.
- intros n m; pattern n, m in |- *; apply nat_double_ind; auto with arith.
+ intros n m; pattern n, m; apply nat_double_ind; auto with arith.
induction 1; auto with arith.
Qed.
@@ -192,4 +190,5 @@ Hint Immediate lt_0_neq: arith v62.
Notation lt_O_Sn := lt_0_Sn (only parsing).
Notation neq_O_lt := neq_0_lt (only parsing).
Notation lt_O_neq := lt_0_neq (only parsing).
+Notation lt_n_O := lt_n_0 (only parsing).
(* end hide *)
diff --git a/theories/Arith/Max.v b/theories/Arith/Max.v
index d1b1b269..5623564a 100644
--- a/theories/Arith/Max.v
+++ b/theories/Arith/Max.v
@@ -1,44 +1,48 @@
(************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
-(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2011 *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *)
(* \VV/ **************************************************************)
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-(*i $Id: Max.v 14641 2011-11-06 11:59:10Z herbelin $ i*)
+(** THIS FILE IS DEPRECATED. Use [NPeano.Nat] instead. *)
-(** THIS FILE IS DEPRECATED. Use [MinMax] instead. *)
-
-Require Export MinMax.
+Require Import NPeano.
Local Open Scope nat_scope.
Implicit Types m n p : nat.
-Notation max := MinMax.max (only parsing).
-
-Definition max_0_l := max_0_l.
-Definition max_0_r := max_0_r.
-Definition succ_max_distr := succ_max_distr.
-Definition plus_max_distr_l := plus_max_distr_l.
-Definition plus_max_distr_r := plus_max_distr_r.
-Definition max_case_strong := max_case_strong.
-Definition max_spec := max_spec.
-Definition max_dec := max_dec.
-Definition max_case := max_case.
-Definition max_idempotent := max_id.
-Definition max_assoc := max_assoc.
-Definition max_comm := max_comm.
-Definition max_l := max_l.
-Definition max_r := max_r.
-Definition le_max_l := le_max_l.
-Definition le_max_r := le_max_r.
-Definition max_lub_l := max_lub_l.
-Definition max_lub_r := max_lub_r.
-Definition max_lub := max_lub.
+Notation max := Peano.max (only parsing).
+
+Definition max_0_l := Nat.max_0_l.
+Definition max_0_r := Nat.max_0_r.
+Definition succ_max_distr := Nat.succ_max_distr.
+Definition plus_max_distr_l := Nat.add_max_distr_l.
+Definition plus_max_distr_r := Nat.add_max_distr_r.
+Definition max_case_strong := Nat.max_case_strong.
+Definition max_spec := Nat.max_spec.
+Definition max_dec := Nat.max_dec.
+Definition max_case := Nat.max_case.
+Definition max_idempotent := Nat.max_id.
+Definition max_assoc := Nat.max_assoc.
+Definition max_comm := Nat.max_comm.
+Definition max_l := Nat.max_l.
+Definition max_r := Nat.max_r.
+Definition le_max_l := Nat.le_max_l.
+Definition le_max_r := Nat.le_max_r.
+Definition max_lub_l := Nat.max_lub_l.
+Definition max_lub_r := Nat.max_lub_r.
+Definition max_lub := Nat.max_lub.
(* begin hide *)
(* Compatibility *)
Notation max_case2 := max_case (only parsing).
-Notation max_SS := succ_max_distr (only parsing).
+Notation max_SS := Nat.succ_max_distr (only parsing).
(* end hide *)
+
+Hint Resolve
+ Nat.max_l Nat.max_r Nat.le_max_l Nat.le_max_r : arith v62.
+
+Hint Resolve
+ Nat.min_l Nat.min_r Nat.le_min_l Nat.le_min_r : arith v62.
diff --git a/theories/Arith/Min.v b/theories/Arith/Min.v
index 0c8b5669..a2a7930d 100644
--- a/theories/Arith/Min.v
+++ b/theories/Arith/Min.v
@@ -1,44 +1,42 @@
(************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
-(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2011 *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *)
(* \VV/ **************************************************************)
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-(*i $Id: Min.v 14641 2011-11-06 11:59:10Z herbelin $ i*)
+(** THIS FILE IS DEPRECATED. Use [NPeano.Nat] instead. *)
-(** THIS FILE IS DEPRECATED. Use [MinMax] instead. *)
+Require Import NPeano.
-Require Export MinMax.
-
-Open Local Scope nat_scope.
+Local Open Scope nat_scope.
Implicit Types m n p : nat.
-Notation min := MinMax.min (only parsing).
+Notation min := Peano.min (only parsing).
-Definition min_0_l := min_0_l.
-Definition min_0_r := min_0_r.
-Definition succ_min_distr := succ_min_distr.
-Definition plus_min_distr_l := plus_min_distr_l.
-Definition plus_min_distr_r := plus_min_distr_r.
-Definition min_case_strong := min_case_strong.
-Definition min_spec := min_spec.
-Definition min_dec := min_dec.
-Definition min_case := min_case.
-Definition min_idempotent := min_id.
-Definition min_assoc := min_assoc.
-Definition min_comm := min_comm.
-Definition min_l := min_l.
-Definition min_r := min_r.
-Definition le_min_l := le_min_l.
-Definition le_min_r := le_min_r.
-Definition min_glb_l := min_glb_l.
-Definition min_glb_r := min_glb_r.
-Definition min_glb := min_glb.
+Definition min_0_l := Nat.min_0_l.
+Definition min_0_r := Nat.min_0_r.
+Definition succ_min_distr := Nat.succ_min_distr.
+Definition plus_min_distr_l := Nat.add_min_distr_l.
+Definition plus_min_distr_r := Nat.add_min_distr_r.
+Definition min_case_strong := Nat.min_case_strong.
+Definition min_spec := Nat.min_spec.
+Definition min_dec := Nat.min_dec.
+Definition min_case := Nat.min_case.
+Definition min_idempotent := Nat.min_id.
+Definition min_assoc := Nat.min_assoc.
+Definition min_comm := Nat.min_comm.
+Definition min_l := Nat.min_l.
+Definition min_r := Nat.min_r.
+Definition le_min_l := Nat.le_min_l.
+Definition le_min_r := Nat.le_min_r.
+Definition min_glb_l := Nat.min_glb_l.
+Definition min_glb_r := Nat.min_glb_r.
+Definition min_glb := Nat.min_glb.
(* begin hide *)
(* Compatibility *)
Notation min_case2 := min_case (only parsing).
-Notation min_SS := succ_min_distr (only parsing).
-(* end hide *) \ No newline at end of file
+Notation min_SS := Nat.succ_min_distr (only parsing).
+(* end hide *)
diff --git a/theories/Arith/MinMax.v b/theories/Arith/MinMax.v
deleted file mode 100644
index 8a23c8f6..00000000
--- a/theories/Arith/MinMax.v
+++ /dev/null
@@ -1,113 +0,0 @@
-(************************************************************************)
-(* v * The Coq Proof Assistant / The Coq Development Team *)
-(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2011 *)
-(* \VV/ **************************************************************)
-(* // * This file is distributed under the terms of the *)
-(* * GNU Lesser General Public License Version 2.1 *)
-(************************************************************************)
-
-Require Import Orders NatOrderedType GenericMinMax.
-
-(** * Maximum and Minimum of two natural numbers *)
-
-Fixpoint max n m : nat :=
- match n, m with
- | O, _ => m
- | S n', O => n
- | S n', S m' => S (max n' m')
- end.
-
-Fixpoint min n m : nat :=
- match n, m with
- | O, _ => 0
- | S n', O => 0
- | S n', S m' => S (min n' m')
- end.
-
-(** These functions implement indeed a maximum and a minimum *)
-
-Lemma max_l : forall x y, y<=x -> max x y = x.
-Proof.
- induction x; destruct y; simpl; auto with arith.
-Qed.
-
-Lemma max_r : forall x y, x<=y -> max x y = y.
-Proof.
- induction x; destruct y; simpl; auto with arith.
-Qed.
-
-Lemma min_l : forall x y, x<=y -> min x y = x.
-Proof.
- induction x; destruct y; simpl; auto with arith.
-Qed.
-
-Lemma min_r : forall x y, y<=x -> min x y = y.
-Proof.
- induction x; destruct y; simpl; auto with arith.
-Qed.
-
-
-Module NatHasMinMax <: HasMinMax Nat_as_OT.
- Definition max := max.
- Definition min := min.
- Definition max_l := max_l.
- Definition max_r := max_r.
- Definition min_l := min_l.
- Definition min_r := min_r.
-End NatHasMinMax.
-
-(** We obtain hence all the generic properties of [max] and [min],
- see file [GenericMinMax] or use SearchAbout. *)
-
-Module Export MMP := UsualMinMaxProperties Nat_as_OT NatHasMinMax.
-
-
-(** * Properties specific to the [nat] domain *)
-
-(** Simplifications *)
-
-Lemma max_0_l : forall n, max 0 n = n.
-Proof. reflexivity. Qed.
-
-Lemma max_0_r : forall n, max n 0 = n.
-Proof. destruct n; auto. Qed.
-
-Lemma min_0_l : forall n, min 0 n = 0.
-Proof. reflexivity. Qed.
-
-Lemma min_0_r : forall n, min n 0 = 0.
-Proof. destruct n; auto. Qed.
-
-(** Compatibilities (consequences of monotonicity) *)
-
-Lemma succ_max_distr : forall n m, S (max n m) = max (S n) (S m).
-Proof. auto. Qed.
-
-Lemma succ_min_distr : forall n m, S (min n m) = min (S n) (S m).
-Proof. auto. Qed.
-
-Lemma plus_max_distr_l : forall n m p, max (p + n) (p + m) = p + max n m.
-Proof.
-intros. apply max_monotone. repeat red; auto with arith.
-Qed.
-
-Lemma plus_max_distr_r : forall n m p, max (n + p) (m + p) = max n m + p.
-Proof.
-intros. apply max_monotone with (f:=fun x => x + p).
-repeat red; auto with arith.
-Qed.
-
-Lemma plus_min_distr_l : forall n m p, min (p + n) (p + m) = p + min n m.
-Proof.
-intros. apply min_monotone. repeat red; auto with arith.
-Qed.
-
-Lemma plus_min_distr_r : forall n m p, min (n + p) (m + p) = min n m + p.
-Proof.
-intros. apply min_monotone with (f:=fun x => x + p).
-repeat red; auto with arith.
-Qed.
-
-Hint Resolve
- max_l max_r le_max_l le_max_r
- min_l min_r le_min_l le_min_r : arith v62.
diff --git a/theories/Arith/Minus.v b/theories/Arith/Minus.v
index 1b36f236..48024331 100644
--- a/theories/Arith/Minus.v
+++ b/theories/Arith/Minus.v
@@ -1,13 +1,11 @@
(************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
-(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2011 *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *)
(* \VV/ **************************************************************)
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-(*i $Id: Minus.v 14641 2011-11-06 11:59:10Z herbelin $ i*)
-
(** [minus] (difference between two natural numbers) is defined in [Init/Peano.v] as:
<<
Fixpoint minus (n m:nat) : nat :=
@@ -23,7 +21,7 @@ where "n - m" := (minus n m) : nat_scope.
Require Import Lt.
Require Import Le.
-Open Local Scope nat_scope.
+Local Open Scope nat_scope.
Implicit Types m n p : nat.
@@ -31,7 +29,7 @@ Implicit Types m n p : nat.
Lemma minus_n_O : forall n, n = n - 0.
Proof.
- induction n; simpl in |- *; auto with arith.
+ induction n; simpl; auto with arith.
Qed.
Hint Resolve minus_n_O: arith v62.
@@ -39,21 +37,21 @@ Hint Resolve minus_n_O: arith v62.
Lemma minus_Sn_m : forall n m, m <= n -> S (n - m) = S n - m.
Proof.
- intros n m Le; pattern m, n in |- *; apply le_elim_rel; simpl in |- *;
+ intros n m Le; pattern m, n; apply le_elim_rel; simpl;
auto with arith.
Qed.
Hint Resolve minus_Sn_m: arith v62.
Theorem pred_of_minus : forall n, pred n = n - 1.
Proof.
- intro x; induction x; simpl in |- *; auto with arith.
+ intro x; induction x; simpl; auto with arith.
Qed.
(** * Diagonal *)
Lemma minus_diag : forall n, n - n = 0.
Proof.
- induction n; simpl in |- *; auto with arith.
+ induction n; simpl; auto with arith.
Qed.
Lemma minus_diag_reverse : forall n, 0 = n - n.
@@ -68,7 +66,7 @@ Notation minus_n_n := minus_diag_reverse.
Lemma minus_plus_simpl_l_reverse : forall n m p, n - m = p + n - (p + m).
Proof.
- induction p; simpl in |- *; auto with arith.
+ induction p; simpl; auto with arith.
Qed.
Hint Resolve minus_plus_simpl_l_reverse: arith v62.
@@ -76,7 +74,7 @@ Hint Resolve minus_plus_simpl_l_reverse: arith v62.
Lemma plus_minus : forall n m p, n = m + p -> p = n - m.
Proof.
- intros n m p; pattern m, n in |- *; apply nat_double_ind; simpl in |- *;
+ intros n m p; pattern m, n; apply nat_double_ind; simpl;
intros.
replace (n0 - 0) with n0; auto with arith.
absurd (0 = S (n0 + p)); auto with arith.
@@ -85,20 +83,20 @@ Qed.
Hint Immediate plus_minus: arith v62.
Lemma minus_plus : forall n m, n + m - n = m.
- symmetry in |- *; auto with arith.
+ symmetry ; auto with arith.
Qed.
Hint Resolve minus_plus: arith v62.
Lemma le_plus_minus : forall n m, n <= m -> m = n + (m - n).
Proof.
- intros n m Le; pattern n, m in |- *; apply le_elim_rel; simpl in |- *;
+ intros n m Le; pattern n, m; apply le_elim_rel; simpl;
auto with arith.
Qed.
Hint Resolve le_plus_minus: arith v62.
Lemma le_plus_minus_r : forall n m, n <= m -> n + (m - n) = m.
Proof.
- symmetry in |- *; auto with arith.
+ symmetry ; auto with arith.
Qed.
Hint Resolve le_plus_minus_r: arith v62.
@@ -134,7 +132,7 @@ Qed.
Lemma lt_minus : forall n m, m <= n -> 0 < m -> n - m < n.
Proof.
- intros n m Le; pattern m, n in |- *; apply le_elim_rel; simpl in |- *;
+ intros n m Le; pattern m, n; apply le_elim_rel; simpl;
auto using le_minus with arith.
intros; absurd (0 < 0); auto with arith.
Qed.
@@ -142,7 +140,7 @@ Hint Resolve lt_minus: arith v62.
Lemma lt_O_minus_lt : forall n m, 0 < n - m -> m < n.
Proof.
- intros n m; pattern n, m in |- *; apply nat_double_ind; simpl in |- *;
+ intros n m; pattern n, m; apply nat_double_ind; simpl;
auto with arith.
intros; absurd (0 < 0); trivial with arith.
Qed.
@@ -150,9 +148,9 @@ Hint Immediate lt_O_minus_lt: arith v62.
Theorem not_le_minus_0 : forall n m, ~ m <= n -> n - m = 0.
Proof.
- intros y x; pattern y, x in |- *; apply nat_double_ind;
- [ simpl in |- *; trivial with arith
+ intros y x; pattern y, x; apply nat_double_ind;
+ [ simpl; trivial with arith
| intros n H; absurd (0 <= S n); [ assumption | apply le_O_n ]
- | simpl in |- *; intros n m H1 H2; apply H1; unfold not in |- *; intros H3;
+ | simpl; intros n m H1 H2; apply H1; unfold not; intros H3;
apply H2; apply le_n_S; assumption ].
Qed.
diff --git a/theories/Arith/Mult.v b/theories/Arith/Mult.v
index 5dd61d67..cbb9b376 100644
--- a/theories/Arith/Mult.v
+++ b/theories/Arith/Mult.v
@@ -1,19 +1,17 @@
(************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
-(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2011 *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *)
(* \VV/ **************************************************************)
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-(*i $Id: Mult.v 14641 2011-11-06 11:59:10Z herbelin $ i*)
-
Require Export Plus.
Require Export Minus.
Require Export Lt.
Require Export Le.
-Open Local Scope nat_scope.
+Local Open Scope nat_scope.
Implicit Types m n p : nat.
@@ -25,7 +23,7 @@ Implicit Types m n p : nat.
Lemma mult_0_r : forall n, n * 0 = 0.
Proof.
- intro; symmetry in |- *; apply mult_n_O.
+ intro; symmetry ; apply mult_n_O.
Qed.
Lemma mult_0_l : forall n, 0 * n = 0.
@@ -37,7 +35,7 @@ Qed.
Lemma mult_1_l : forall n, 1 * n = n.
Proof.
- simpl in |- *; auto with arith.
+ simpl; auto with arith.
Qed.
Hint Resolve mult_1_l: arith v62.
@@ -70,12 +68,12 @@ Hint Resolve mult_plus_distr_r: arith v62.
Lemma mult_plus_distr_l : forall n m p, n * (m + p) = n * m + n * p.
Proof.
induction n. trivial.
- intros. simpl in |- *. rewrite IHn. symmetry. apply plus_permute_2_in_4.
+ intros. simpl. rewrite IHn. symmetry. apply plus_permute_2_in_4.
Qed.
Lemma mult_minus_distr_r : forall n m p, (n - m) * p = n * p - m * p.
Proof.
- intros; induction n m using nat_double_ind; simpl; auto with arith.
+ intros; induction n, m using nat_double_ind; simpl; auto with arith.
rewrite <- minus_plus_simpl_l_reverse; auto with arith.
Qed.
Hint Resolve mult_minus_distr_r: arith v62.
@@ -139,13 +137,13 @@ Qed.
Lemma mult_O_le : forall n m, m = 0 \/ n <= m * n.
Proof.
- induction m; simpl in |- *; auto with arith.
+ induction m; simpl; auto with arith.
Qed.
Hint Resolve mult_O_le: arith v62.
Lemma mult_le_compat_l : forall n m p, n <= m -> p * n <= p * m.
Proof.
- induction p as [| p IHp]; intros; simpl in |- *.
+ induction p as [| p IHp]; intros; simpl.
apply le_n.
auto using plus_le_compat.
Qed.
@@ -169,7 +167,7 @@ Proof.
assumption.
apply le_plus_l.
(* m*p<=m0*q -> m*p<=(S m0)*q *)
- simpl in |- *; apply le_trans with (m0 * q).
+ simpl; apply le_trans with (m0 * q).
assumption.
apply le_plus_r.
Qed.
@@ -177,19 +175,22 @@ Qed.
Lemma mult_S_lt_compat_l : forall n m p, m < p -> S n * m < S n * p.
Proof.
induction n; intros; simpl in *.
- rewrite <- 2! plus_n_O; assumption.
+ rewrite <- 2 plus_n_O; assumption.
auto using plus_lt_compat.
Qed.
Hint Resolve mult_S_lt_compat_l: arith.
+Lemma mult_lt_compat_l : forall n m p, n < m -> 0 < p -> p * n < p * m.
+Proof.
+ intros m n p H Hp. destruct p. elim (lt_irrefl _ Hp).
+ now apply mult_S_lt_compat_l.
+Qed.
+
Lemma mult_lt_compat_r : forall n m p, n < m -> 0 < p -> n * p < m * p.
Proof.
- intros m n p H H0.
- induction p.
- elim (lt_irrefl _ H0).
- rewrite mult_comm.
- replace (n * S p) with (S p * n); auto with arith.
+ intros m n p H Hp. destruct p. elim (lt_irrefl _ Hp).
+ rewrite (mult_comm m), (mult_comm n). now apply mult_S_lt_compat_l.
Qed.
Lemma mult_S_le_reg_l : forall n m p, S n * m <= S n * p -> m <= p.
@@ -231,7 +232,7 @@ Fixpoint mult_acc (s:nat) m n : nat :=
Lemma mult_acc_aux : forall n m p, m + n * p = mult_acc m p n.
Proof.
- induction n as [| p IHp]; simpl in |- *; auto.
+ induction n as [| p IHp]; simpl; auto.
intros s m; rewrite <- plus_tail_plus; rewrite <- IHp.
rewrite <- plus_assoc_reverse; apply f_equal2; auto.
rewrite plus_comm; auto.
@@ -241,7 +242,7 @@ Definition tail_mult n m := mult_acc 0 m n.
Lemma mult_tail_mult : forall n m, n * m = tail_mult n m.
Proof.
- intros; unfold tail_mult in |- *; rewrite <- mult_acc_aux; auto.
+ intros; unfold tail_mult; rewrite <- mult_acc_aux; auto.
Qed.
(** [TailSimpl] transforms any [tail_plus] and [tail_mult] into [plus]
@@ -249,4 +250,4 @@ Qed.
Ltac tail_simpl :=
repeat rewrite <- plus_tail_plus; repeat rewrite <- mult_tail_mult;
- simpl in |- *.
+ simpl.
diff --git a/theories/Arith/NatOrderedType.v b/theories/Arith/NatOrderedType.v
deleted file mode 100644
index fb4bf233..00000000
--- a/theories/Arith/NatOrderedType.v
+++ /dev/null
@@ -1,64 +0,0 @@
-(************************************************************************)
-(* v * The Coq Proof Assistant / The Coq Development Team *)
-(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2011 *)
-(* \VV/ **************************************************************)
-(* // * This file is distributed under the terms of the *)
-(* * GNU Lesser General Public License Version 2.1 *)
-(************************************************************************)
-
-Require Import Lt Peano_dec Compare_dec EqNat
- Equalities Orders OrdersTac.
-
-
-(** * DecidableType structure for Peano numbers *)
-
-Module Nat_as_UBE <: UsualBoolEq.
- Definition t := nat.
- Definition eq := @eq nat.
- Definition eqb := beq_nat.
- Definition eqb_eq := beq_nat_true_iff.
-End Nat_as_UBE.
-
-Module Nat_as_DT <: UsualDecidableTypeFull := Make_UDTF Nat_as_UBE.
-
-(** Note that the last module fulfills by subtyping many other
- interfaces, such as [DecidableType] or [EqualityType]. *)
-
-
-
-(** * OrderedType structure for Peano numbers *)
-
-Module Nat_as_OT <: OrderedTypeFull.
- Include Nat_as_DT.
- Definition lt := lt.
- Definition le := le.
- Definition compare := nat_compare.
-
- Instance lt_strorder : StrictOrder lt.
- Proof. split; [ exact lt_irrefl | exact lt_trans ]. Qed.
-
- Instance lt_compat : Proper (Logic.eq==>Logic.eq==>iff) lt.
- Proof. repeat red; intros; subst; auto. Qed.
-
- Definition le_lteq := le_lt_or_eq_iff.
- Definition compare_spec := nat_compare_spec.
-
-End Nat_as_OT.
-
-(** Note that [Nat_as_OT] can also be seen as a [UsualOrderedType]
- and a [OrderedType] (and also as a [DecidableType]). *)
-
-
-
-(** * An [order] tactic for Peano numbers *)
-
-Module NatOrder := OTF_to_OrderTac Nat_as_OT.
-Ltac nat_order := NatOrder.order.
-
-(** Note that [nat_order] is domain-agnostic: it will not prove
- [1<=2] or [x<=x+x], but rather things like [x<=y -> y<=x -> x=y]. *)
-
-Section Test.
-Let test : forall x y : nat, x<=y -> y<=x -> x=y.
-Proof. nat_order. Qed.
-End Test.
diff --git a/theories/Arith/Peano_dec.v b/theories/Arith/Peano_dec.v
index 5cceab8b..e0bed0d3 100644
--- a/theories/Arith/Peano_dec.v
+++ b/theories/Arith/Peano_dec.v
@@ -1,16 +1,15 @@
(************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
-(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2011 *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *)
(* \VV/ **************************************************************)
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-(*i $Id: Peano_dec.v 14641 2011-11-06 11:59:10Z herbelin $ i*)
-
Require Import Decidable.
-
-Open Local Scope nat_scope.
+Require Eqdep_dec.
+Require Import Le Lt.
+Local Open Scope nat_scope.
Implicit Types m n x y : nat.
@@ -30,5 +29,24 @@ Defined.
Hint Resolve O_or_S eq_nat_dec: arith.
Theorem dec_eq_nat : forall n m, decidable (n = m).
- intros x y; unfold decidable in |- *; elim (eq_nat_dec x y); auto with arith.
+ intros x y; unfold decidable; elim (eq_nat_dec x y); auto with arith.
Defined.
+
+Definition UIP_nat:= Eqdep_dec.UIP_dec eq_nat_dec.
+
+Lemma le_unique: forall m n (h1 h2: m <= n), h1 = h2.
+Proof.
+fix 3.
+refine (fun m _ h1 => match h1 as h' in _ <= k return forall hh: m <= k, h' = hh
+ with le_n => _ |le_S i H => _ end).
+refine (fun hh => match hh as h' in _ <= k return forall eq: m = k,
+ le_n m = match eq in _ = p return m <= p -> m <= m with |eq_refl => fun bli => bli end h' with
+ |le_n => fun eq => _ |le_S j H' => fun eq => _ end eq_refl).
+rewrite (UIP_nat _ _ eq eq_refl). reflexivity.
+subst m. destruct (Lt.lt_irrefl j H').
+refine (fun hh => match hh as h' in _ <= k return match k as k' return m <= k' -> Prop
+ with |0 => fun _ => True |S i' => fun h'' => forall H':m <= i', le_S m i' H' = h'' end h'
+ with |le_n => _ |le_S j H2 => fun H' => _ end H).
+destruct m. exact I. intros; destruct (Lt.lt_irrefl m H').
+f_equal. apply le_unique.
+Qed.
diff --git a/theories/Arith/Plus.v b/theories/Arith/Plus.v
index 12f12300..5428ada3 100644
--- a/theories/Arith/Plus.v
+++ b/theories/Arith/Plus.v
@@ -1,13 +1,11 @@
-(************************************************************************)
+ (************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
-(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2011 *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *)
(* \VV/ **************************************************************)
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-(*i $Id: Plus.v 14641 2011-11-06 11:59:10Z herbelin $ i*)
-
(** Properties of addition. [add] is defined in [Init/Peano.v] as:
<<
Fixpoint plus (n m:nat) : nat :=
@@ -22,45 +20,32 @@ where "n + m" := (plus n m) : nat_scope.
Require Import Le.
Require Import Lt.
-Open Local Scope nat_scope.
+Local Open Scope nat_scope.
Implicit Types m n p q : nat.
-(** * Zero is neutral *)
-
-Lemma plus_0_l : forall n, 0 + n = n.
-Proof.
- reflexivity.
-Qed.
-
-Lemma plus_0_r : forall n, n + 0 = n.
-Proof.
- intro; symmetry in |- *; apply plus_n_O.
-Qed.
+(** * Zero is neutral
+Deprecated : Already in Init/Peano.v *)
+Notation plus_0_l := plus_O_n (only parsing).
+Definition plus_0_r n := eq_sym (plus_n_O n).
(** * Commutativity *)
Lemma plus_comm : forall n m, n + m = m + n.
Proof.
- intros n m; elim n; simpl in |- *; auto with arith.
+ intros n m; elim n; simpl; auto with arith.
intros y H; elim (plus_n_Sm m y); auto with arith.
Qed.
Hint Immediate plus_comm: arith v62.
(** * Associativity *)
-Lemma plus_Snm_nSm : forall n m, S n + m = n + S m.
-Proof.
- intros.
- simpl in |- *.
- rewrite (plus_comm n m).
- rewrite (plus_comm n (S m)).
- trivial with arith.
-Qed.
+Definition plus_Snm_nSm : forall n m, S n + m = n + S m:=
+ plus_n_Sm.
Lemma plus_assoc : forall n m p, n + (m + p) = n + m + p.
Proof.
- intros n m p; elim n; simpl in |- *; auto with arith.
+ intros n m p; elim n; simpl; auto with arith.
Qed.
Hint Resolve plus_assoc: arith v62.
@@ -79,42 +64,42 @@ Hint Resolve plus_assoc_reverse: arith v62.
Lemma plus_reg_l : forall n m p, p + n = p + m -> n = m.
Proof.
- intros m p n; induction n; simpl in |- *; auto with arith.
+ intros m p n; induction n; simpl; auto with arith.
Qed.
Lemma plus_le_reg_l : forall n m p, p + n <= p + m -> n <= m.
Proof.
- induction p; simpl in |- *; auto with arith.
+ induction p; simpl; auto with arith.
Qed.
Lemma plus_lt_reg_l : forall n m p, p + n < p + m -> n < m.
Proof.
- induction p; simpl in |- *; auto with arith.
+ induction p; simpl; auto with arith.
Qed.
(** * Compatibility with order *)
Lemma plus_le_compat_l : forall n m p, n <= m -> p + n <= p + m.
Proof.
- induction p; simpl in |- *; auto with arith.
+ induction p; simpl; auto with arith.
Qed.
Hint Resolve plus_le_compat_l: arith v62.
Lemma plus_le_compat_r : forall n m p, n <= m -> n + p <= m + p.
Proof.
- induction 1; simpl in |- *; auto with arith.
+ induction 1; simpl; auto with arith.
Qed.
Hint Resolve plus_le_compat_r: arith v62.
Lemma le_plus_l : forall n m, n <= n + m.
Proof.
- induction n; simpl in |- *; auto with arith.
+ induction n; simpl; auto with arith.
Qed.
Hint Resolve le_plus_l: arith v62.
Lemma le_plus_r : forall n m, m <= n + m.
Proof.
- intros n m; elim n; simpl in |- *; auto with arith.
+ intros n m; elim n; simpl; auto with arith.
Qed.
Hint Resolve le_plus_r: arith v62.
@@ -132,7 +117,7 @@ Hint Immediate lt_plus_trans: arith v62.
Lemma plus_lt_compat_l : forall n m p, n < m -> p + n < p + m.
Proof.
- induction p; simpl in |- *; auto with arith.
+ induction p; simpl; auto with arith.
Qed.
Hint Resolve plus_lt_compat_l: arith v62.
@@ -146,18 +131,18 @@ Hint Resolve plus_lt_compat_r: arith v62.
Lemma plus_le_compat : forall n m p q, n <= m -> p <= q -> n + p <= m + q.
Proof.
intros n m p q H H0.
- elim H; simpl in |- *; auto with arith.
+ elim H; simpl; auto with arith.
Qed.
Lemma plus_le_lt_compat : forall n m p q, n <= m -> p < q -> n + p < m + q.
Proof.
- unfold lt in |- *. intros. change (S n + p <= m + q) in |- *. rewrite plus_Snm_nSm.
+ unfold lt. intros. change (S n + p <= m + q). rewrite plus_Snm_nSm.
apply plus_le_compat; assumption.
Qed.
Lemma plus_lt_le_compat : forall n m p q, n < m -> p <= q -> n + p < m + q.
Proof.
- unfold lt in |- *. intros. change (S n + p <= m + q) in |- *. apply plus_le_compat; assumption.
+ unfold lt. intros. change (S n + p <= m + q). apply plus_le_compat; assumption.
Qed.
Lemma plus_lt_compat : forall n m p q, n < m -> p < q -> n + p < m + q.
@@ -205,8 +190,8 @@ Fixpoint tail_plus n m : nat :=
end.
Lemma plus_tail_plus : forall n m, n + m = tail_plus n m.
-induction n as [| n IHn]; simpl in |- *; auto.
-intro m; rewrite <- IHn; simpl in |- *; auto.
+induction n as [| n IHn]; simpl; auto.
+intro m; rewrite <- IHn; simpl; auto.
Qed.
(** * Discrimination *)
diff --git a/theories/Arith/Wf_nat.v b/theories/Arith/Wf_nat.v
index 23419531..b5545123 100644
--- a/theories/Arith/Wf_nat.v
+++ b/theories/Arith/Wf_nat.v
@@ -1,18 +1,16 @@
(************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
-(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2011 *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *)
(* \VV/ **************************************************************)
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-(*i $Id: Wf_nat.v 14641 2011-11-06 11:59:10Z herbelin $ i*)
-
(** Well-founded relations and natural numbers *)
Require Import Lt.
-Open Local Scope nat_scope.
+Local Open Scope nat_scope.
Implicit Types m n p : nat.
@@ -26,14 +24,14 @@ Definition gtof (a b:A) := f b > f a.
Theorem well_founded_ltof : well_founded ltof.
Proof.
- red in |- *.
+ red.
cut (forall n (a:A), f a < n -> Acc ltof a).
intros H a; apply (H (S (f a))); auto with arith.
induction n.
intros; absurd (f a < 0); auto with arith.
intros a ltSma.
apply Acc_intro.
- unfold ltof in |- *; intros b ltfafb.
+ unfold ltof; intros b ltfafb.
apply IHn.
apply lt_le_trans with (f a); auto with arith.
Defined.
@@ -75,7 +73,7 @@ Proof.
intros; absurd (f a < 0); auto with arith.
intros a ltSma.
apply F.
- unfold ltof in |- *; intros b ltfafb.
+ unfold ltof; intros b ltfafb.
apply IHn.
apply lt_le_trans with (f a); auto with arith.
Defined.
@@ -110,7 +108,7 @@ Hypothesis H_compat : forall x y:A, R x y -> f x < f y.
Theorem well_founded_lt_compat : well_founded R.
Proof.
- red in |- *.
+ red.
cut (forall n (a:A), f a < n -> Acc R a).
intros H a; apply (H (S (f a))); auto with arith.
induction n.
@@ -163,8 +161,8 @@ Lemma lt_wf_double_rec :
(forall p q, p < n -> P p q) ->
(forall p, p < m -> P n p) -> P n m) -> forall n m, P n m.
Proof.
- intros P Hrec p; pattern p in |- *; apply lt_wf_rec.
- intros n H q; pattern q in |- *; apply lt_wf_rec; auto with arith.
+ intros P Hrec p; pattern p; apply lt_wf_rec.
+ intros n H q; pattern q; apply lt_wf_rec; auto with arith.
Defined.
Lemma lt_wf_double_ind :
@@ -173,8 +171,8 @@ Lemma lt_wf_double_ind :
(forall p (q:nat), p < n -> P p q) ->
(forall p, p < m -> P n p) -> P n m) -> forall n m, P n m.
Proof.
- intros P Hrec p; pattern p in |- *; apply lt_wf_ind.
- intros n H q; pattern q in |- *; apply lt_wf_ind; auto with arith.
+ intros P Hrec p; pattern p; apply lt_wf_ind.
+ intros n H q; pattern q; apply lt_wf_ind; auto with arith.
Qed.
Hint Resolve lt_wf: arith.
@@ -192,7 +190,7 @@ Section LT_WF_REL.
Remark acc_lt_rel : forall x:A, (exists n, F x n) -> Acc R x.
Proof.
intros x [n fxn]; generalize dependent x.
- pattern n in |- *; apply lt_wf_ind; intros.
+ pattern n; apply lt_wf_ind; intros.
constructor; intros.
destruct (F_compat y x) as (x0,H1,H2); trivial.
apply (H x0); auto.
@@ -260,19 +258,6 @@ Qed.
Unset Implicit Arguments.
-(** [n]th iteration of the function [f] *)
-
-Fixpoint iter_nat (n:nat) (A:Type) (f:A -> A) (x:A) : A :=
- match n with
- | O => x
- | S n' => f (iter_nat n' A f x)
- end.
-
-Theorem iter_nat_plus :
- forall (n m:nat) (A:Type) (f:A -> A) (x:A),
- iter_nat (n + m) A f x = iter_nat n A f (iter_nat m A f x).
-Proof.
- simple induction n;
- [ simpl in |- *; auto with arith
- | intros; simpl in |- *; apply f_equal with (f := f); apply H ].
-Qed.
+Notation iter_nat := @nat_iter (only parsing).
+Notation iter_nat_plus := @nat_iter_plus (only parsing).
+Notation iter_nat_invariant := @nat_iter_invariant (only parsing).
diff --git a/theories/Arith/vo.itarget b/theories/Arith/vo.itarget
index c3f29d21..0b6564e1 100644
--- a/theories/Arith/vo.itarget
+++ b/theories/Arith/vo.itarget
@@ -19,5 +19,3 @@ Mult.vo
Peano_dec.vo
Plus.vo
Wf_nat.vo
-NatOrderedType.vo
-MinMax.vo