diff options
| author | glondu | 2009-09-17 15:58:14 +0000 |
|---|---|---|
| committer | glondu | 2009-09-17 15:58:14 +0000 |
| commit | 61ccbc81a2f3b4662ed4a2bad9d07d2003dda3a2 (patch) | |
| tree | 961cc88c714aa91a0276ea9fbf8bc53b2b9d5c28 /theories/Numbers/Integer | |
| parent | 6d3fbdf36c6a47b49c2a4b16f498972c93c07574 (diff) | |
Delete trailing whitespaces in all *.{v,ml*} files
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@12337 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'theories/Numbers/Integer')
| -rw-r--r-- | theories/Numbers/Integer/BigZ/ZMake.v | 68 | ||||
| -rw-r--r-- | theories/Numbers/Integer/SpecViaZ/ZSig.v | 8 | ||||
| -rw-r--r-- | theories/Numbers/Integer/SpecViaZ/ZSigZAxioms.v | 6 |
3 files changed, 41 insertions, 41 deletions
diff --git a/theories/Numbers/Integer/BigZ/ZMake.v b/theories/Numbers/Integer/BigZ/ZMake.v index cbf6f701f2..dc22256348 100644 --- a/theories/Numbers/Integer/BigZ/ZMake.v +++ b/theories/Numbers/Integer/BigZ/ZMake.v @@ -17,31 +17,31 @@ Require Import ZSig. Open Scope Z_scope. -(** * ZMake - - A generic transformation from a structure of natural numbers +(** * ZMake + + A generic transformation from a structure of natural numbers [NSig.NType] to a structure of integers [ZSig.ZType]. *) Module Make (N:NType) <: ZType. - - Inductive t_ := + + Inductive t_ := | Pos : N.t -> t_ | Neg : N.t -> t_. - + Definition t := t_. Definition zero := Pos N.zero. Definition one := Pos N.one. Definition minus_one := Neg N.one. - Definition of_Z x := + Definition of_Z x := match x with | Zpos x => Pos (N.of_N (Npos x)) | Z0 => zero | Zneg x => Neg (N.of_N (Npos x)) end. - + Definition to_Z x := match x with | Pos nx => N.to_Z nx @@ -99,13 +99,13 @@ Module Make (N:NType) <: ZType. unfold compare, to_Z; intros x y; case x; case y; clear x y; intros x y; auto; generalize (N.spec_pos x) (N.spec_pos y). generalize (N.spec_compare y x); case N.compare; auto with zarith. - generalize (N.spec_compare y N.zero); case N.compare; + generalize (N.spec_compare y N.zero); case N.compare; try rewrite N.spec_0; auto with zarith. generalize (N.spec_compare x N.zero); case N.compare; rewrite N.spec_0; auto with zarith. generalize (N.spec_compare x N.zero); case N.compare; rewrite N.spec_0; auto with zarith. - generalize (N.spec_compare N.zero y); case N.compare; + generalize (N.spec_compare N.zero y); case N.compare; try rewrite N.spec_0; auto with zarith. generalize (N.spec_compare N.zero x); case N.compare; rewrite N.spec_0; auto with zarith. @@ -114,7 +114,7 @@ Module Make (N:NType) <: ZType. generalize (N.spec_compare x y); case N.compare; auto with zarith. Qed. - Definition eq_bool x y := + Definition eq_bool x y := match compare x y with | Eq => true | _ => false @@ -128,9 +128,9 @@ Module Make (N:NType) <: ZType. Definition cmp_sign x y := match x, y with - | Pos nx, Neg ny => - if N.eq_bool ny N.zero then Eq else Gt - | Neg nx, Pos ny => + | Pos nx, Neg ny => + if N.eq_bool ny N.zero then Eq else Gt + | Neg nx, Pos ny => if N.eq_bool nx N.zero then Eq else Lt | _, _ => Eq end. @@ -150,7 +150,7 @@ Module Make (N:NType) <: ZType. rewrite N.spec_0; unfold to_Z. generalize (N.spec_pos x) (N.spec_pos y); auto with zarith. Qed. - + Definition to_N x := match x with | Pos nx => nx @@ -164,9 +164,9 @@ Module Make (N:NType) <: ZType. simpl; rewrite Zabs_eq; auto. simpl; rewrite Zabs_non_eq; simpl; auto with zarith. Qed. - - Definition opp x := - match x with + + Definition opp x := + match x with | Pos nx => Neg nx | Neg nx => Pos nx end. @@ -174,7 +174,7 @@ Module Make (N:NType) <: ZType. Theorem spec_opp: forall x, to_Z (opp x) = - to_Z x. intros x; case x; simpl; auto with zarith. Qed. - + Definition succ x := match x with | Pos n => Pos (N.succ n) @@ -188,7 +188,7 @@ Module Make (N:NType) <: ZType. Theorem spec_succ: forall n, to_Z (succ n) = to_Z n + 1. intros x; case x; clear x; intros x. exact (N.spec_succ x). - simpl; generalize (N.spec_compare N.zero x); case N.compare; + simpl; generalize (N.spec_compare N.zero x); case N.compare; rewrite N.spec_0; simpl. intros HH; rewrite <- HH; rewrite N.spec_1; ring. intros HH; rewrite N.spec_pred; auto with zarith. @@ -212,7 +212,7 @@ Module Make (N:NType) <: ZType. end | Neg nx, Neg ny => Neg (N.add nx ny) end. - + Theorem spec_add: forall x y, to_Z (add x y) = to_Z x + to_Z y. unfold add, to_Z; intros [x | x] [y | y]. exact (N.spec_add x y). @@ -239,7 +239,7 @@ Module Make (N:NType) <: ZType. Theorem spec_pred: forall x, to_Z (pred x) = to_Z x - 1. unfold pred, to_Z, minus_one; intros [x | x]. - generalize (N.spec_compare N.zero x); case N.compare; + generalize (N.spec_compare N.zero x); case N.compare; rewrite N.spec_0; try rewrite N.spec_1; auto with zarith. intros H; exact (N.spec_pred _ H). generalize (N.spec_pos x); auto with zarith. @@ -248,7 +248,7 @@ Module Make (N:NType) <: ZType. Definition sub x y := match x, y with - | Pos nx, Pos ny => + | Pos nx, Pos ny => match N.compare nx ny with | Gt => Pos (N.sub nx ny) | Eq => zero @@ -256,7 +256,7 @@ Module Make (N:NType) <: ZType. end | Pos nx, Neg ny => Pos (N.add nx ny) | Neg nx, Pos ny => Neg (N.add nx ny) - | Neg nx, Neg ny => + | Neg nx, Neg ny => match N.compare nx ny with | Gt => Neg (N.sub nx ny) | Eq => zero @@ -278,7 +278,7 @@ Module Make (N:NType) <: ZType. intros; rewrite N.spec_sub; try ring; auto with zarith. Qed. - Definition mul x y := + Definition mul x y := match x, y with | Pos nx, Pos ny => Pos (N.mul nx ny) | Pos nx, Neg ny => Neg (N.mul nx ny) @@ -291,7 +291,7 @@ Module Make (N:NType) <: ZType. unfold mul, to_Z; intros [x | x] [y | y]; rewrite N.spec_mul; ring. Qed. - Definition square x := + Definition square x := match x with | Pos nx => Pos (N.square nx) | Neg nx => Pos (N.square nx) @@ -304,7 +304,7 @@ Module Make (N:NType) <: ZType. Definition power_pos x p := match x with | Pos nx => Pos (N.power_pos nx p) - | Neg nx => + | Neg nx => match p with | xH => x | xO _ => Pos (N.power_pos nx p) @@ -315,7 +315,7 @@ Module Make (N:NType) <: ZType. Theorem spec_power_pos: forall x n, to_Z (power_pos x n) = to_Z x ^ Zpos n. assert (F0: forall x, (-x)^2 = x^2). intros x; rewrite Zpower_2; ring. - unfold power_pos, to_Z; intros [x | x] [p | p |]; + unfold power_pos, to_Z; intros [x | x] [p | p |]; try rewrite N.spec_power_pos; try ring. assert (F: 0 <= 2 * Zpos p). assert (0 <= Zpos p); auto with zarith. @@ -336,7 +336,7 @@ Module Make (N:NType) <: ZType. end. - Theorem spec_sqrt: forall x, 0 <= to_Z x -> + Theorem spec_sqrt: forall x, 0 <= to_Z x -> to_Z (sqrt x) ^ 2 <= to_Z x < (to_Z (sqrt x) + 1) ^ 2. unfold to_Z, sqrt; intros [x | x] H. exact (N.spec_sqrt x). @@ -381,7 +381,7 @@ Module Make (N:NType) <: ZType. generalize (N.spec_pos y); auto with zarith. generalize (N.spec_div_eucl x y HH); case N.div_eucl; auto. intros q r; generalize (N.spec_pos x) HH; unfold Zdiv_eucl; - case_eq (N.to_Z x); case_eq (N.to_Z y); + case_eq (N.to_Z x); case_eq (N.to_Z y); try (intros; apply False_ind; auto with zarith; fail). intros p He1 He2 _ _ H1; injection H1; intros H2 H3. generalize (N.spec_compare N.zero r); case N.compare; @@ -407,13 +407,13 @@ Module Make (N:NType) <: ZType. assert (N.to_Z r = (Zpos p1 mod (Zpos p))). unfold Zmod, Zdiv_eucl; rewrite <- H3; auto. case (Z_mod_lt (Zpos p1) (Zpos p)); auto with zarith. - rewrite N.spec_0; intros H2; generalize (N.spec_pos r); + rewrite N.spec_0; intros H2; generalize (N.spec_pos r); intros; apply False_ind; auto with zarith. assert (HH: 0 < N.to_Z y). generalize (N.spec_pos y); auto with zarith. generalize (N.spec_div_eucl x y HH); case N.div_eucl; auto. intros q r; generalize (N.spec_pos x) HH; unfold Zdiv_eucl; - case_eq (N.to_Z x); case_eq (N.to_Z y); + case_eq (N.to_Z x); case_eq (N.to_Z y); try (intros; apply False_ind; auto with zarith; fail). intros p He1 He2 _ _ H1; injection H1; intros H2 H3. generalize (N.spec_compare N.zero r); case N.compare; @@ -443,7 +443,7 @@ Module Make (N:NType) <: ZType. generalize (N.spec_pos y); auto with zarith. generalize (N.spec_div_eucl x y H1); case N.div_eucl; auto. intros q r; generalize (N.spec_pos x) H1; unfold Zdiv_eucl; - case_eq (N.to_Z x); case_eq (N.to_Z y); + case_eq (N.to_Z x); case_eq (N.to_Z y); try (intros; apply False_ind; auto with zarith; fail). change (-0) with 0; lazy iota beta; auto. intros p _ _ _ _ H2; injection H2. @@ -478,7 +478,7 @@ Module Make (N:NType) <: ZType. | Pos nx, Pos ny => Pos (N.gcd nx ny) | Pos nx, Neg ny => Pos (N.gcd nx ny) | Neg nx, Pos ny => Pos (N.gcd nx ny) - | Neg nx, Neg ny => Pos (N.gcd nx ny) + | Neg nx, Neg ny => Pos (N.gcd nx ny) end. Theorem spec_gcd: forall a b, to_Z (gcd a b) = Zgcd (to_Z a) (to_Z b). diff --git a/theories/Numbers/Integer/SpecViaZ/ZSig.v b/theories/Numbers/Integer/SpecViaZ/ZSig.v index 4e45939831..00e292db0f 100644 --- a/theories/Numbers/Integer/SpecViaZ/ZSig.v +++ b/theories/Numbers/Integer/SpecViaZ/ZSig.v @@ -58,7 +58,7 @@ Module Type ZType. Parameter spec_eq_bool: forall x y, if eq_bool x y then [x] = [y] else [x] <> [y]. - + Parameter succ : t -> t. Parameter spec_succ: forall n, [succ n] = [n] + 1. @@ -93,21 +93,21 @@ Module Type ZType. Parameter sqrt : t -> t. - Parameter spec_sqrt: forall x, 0 <= [x] -> + Parameter spec_sqrt: forall x, 0 <= [x] -> [sqrt x] ^ 2 <= [x] < ([sqrt x] + 1) ^ 2. Parameter div_eucl : t -> t -> t * t. Parameter spec_div_eucl: forall x y, [y] <> 0 -> let (q,r) := div_eucl x y in ([q], [r]) = Zdiv_eucl [x] [y]. - + Parameter div : t -> t -> t. Parameter spec_div: forall x y, [y] <> 0 -> [div x y] = [x] / [y]. Parameter modulo : t -> t -> t. - Parameter spec_modulo: forall x y, [y] <> 0 -> + Parameter spec_modulo: forall x y, [y] <> 0 -> [modulo x y] = [x] mod [y]. Parameter gcd : t -> t -> t. diff --git a/theories/Numbers/Integer/SpecViaZ/ZSigZAxioms.v b/theories/Numbers/Integer/SpecViaZ/ZSigZAxioms.v index 4d1054553f..030c589ff9 100644 --- a/theories/Numbers/Integer/SpecViaZ/ZSigZAxioms.v +++ b/theories/Numbers/Integer/SpecViaZ/ZSigZAxioms.v @@ -27,7 +27,7 @@ Infix "-" := Z.sub : IntScope. Infix "*" := Z.mul : IntScope. Notation "- x" := (Z.opp x) : IntScope. -Hint Rewrite +Hint Rewrite Z.spec_0 Z.spec_1 Z.spec_add Z.spec_sub Z.spec_pred Z.spec_succ Z.spec_mul Z.spec_opp Z.spec_of_Z : Zspec. @@ -91,7 +91,7 @@ Section Induction. Variable A : Z.t -> Prop. Hypothesis A_wd : predicate_wd Z.eq A. Hypothesis A0 : A 0. -Hypothesis AS : forall n, A n <-> A (Z.succ n). +Hypothesis AS : forall n, A n <-> A (Z.succ n). Add Morphism A with signature Z.eq ==> iff as A_morph. Proof. apply A_wd. Qed. @@ -214,7 +214,7 @@ Proof. Qed. Add Morphism Z.compare with signature Z.eq ==> Z.eq ==> (@eq comparison) as compare_wd. -Proof. +Proof. intros x x' Hx y y' Hy. rewrite 2 spec_compare_alt; unfold Z.eq in *; rewrite Hx, Hy; intuition. Qed. |
