aboutsummaryrefslogtreecommitdiffhomepage
path: root/plugins/setoid_ring/InitialRing.v
diff options
context:
space:
mode:
authorGravatar letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7>2011-05-05 15:12:15 +0000
committerGravatar letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7>2011-05-05 15:12:15 +0000
commitc0a3544d6351e19c695951796bcee838671d1098 (patch)
treed87f69afd73340492ac694b2aa837024a90e8692 /plugins/setoid_ring/InitialRing.v
parentf61a557fbbdb89a4c24a8050a67252c3ecda6ea7 (diff)
Modularization of BinPos + fixes in Stdlib
BinPos now contain a sub-module Pos, in which are placed functions like add (ex-Pplus), mul (ex-Pmult), ... and properties like add_comm, add_assoc, ... In addition to the name changes, the organisation is changed quite a lot, to try to take advantage more of the orders < and <= instead of speaking only of the comparison function. The main source of incompatibilities in scripts concerns this compare: Pos.compare is now a binary operation, expressed in terms of the ex-Pcompare which is ternary (expecting an initial comparision as 3rd arg), this ternary version being called now Pos.compare_cont. As for everything else, compatibility notations (only parsing) are provided. But notations "_ ?= _" on positive will have to be edited, since they now point to Pos.compare. We also make the sub-module Pos to be directly an OrderedType, and include results about min and max. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@14098 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'plugins/setoid_ring/InitialRing.v')
-rw-r--r--plugins/setoid_ring/InitialRing.v21
1 files changed, 7 insertions, 14 deletions
diff --git a/plugins/setoid_ring/InitialRing.v b/plugins/setoid_ring/InitialRing.v
index cd59b7cb6..86fada82a 100644
--- a/plugins/setoid_ring/InitialRing.v
+++ b/plugins/setoid_ring/InitialRing.v
@@ -172,7 +172,7 @@ Section ZMORPHISM.
Lemma gen_phiZ1_add_pos_neg : forall x y,
gen_phiZ1
- match (x ?= y)%positive Eq with
+ match (x ?= y)%positive with
| Eq => Z0
| Lt => Zneg (y - x)
| Gt => Zpos (x - y)
@@ -180,20 +180,14 @@ Section ZMORPHISM.
== gen_phiPOS1 x + -gen_phiPOS1 y.
Proof.
intros x y.
- assert (H:= (Pcompare_Eq_eq x y)); assert (H0 := Pminus_mask_Gt x y).
- generalize (Pminus_mask_Gt y x).
- replace Eq with (CompOpp Eq);[intro H1;simpl|trivial].
- rewrite <- Pcompare_antisym in H1.
- destruct ((x ?= y)%positive Eq).
- rewrite H;trivial. rewrite (Ropp_def Rth);rrefl.
- destruct H1 as [h [Heq1 [Heq2 Hor]]];trivial.
- unfold Pminus; rewrite Heq1;rewrite <- Heq2.
+ case Pos.compare_spec; intros H; simpl.
+ rewrite H. rewrite (Ropp_def Rth);rrefl.
+ rewrite <- (Pos.sub_add y x H) at 2. rewrite Pos.add_comm.
rewrite (ARgen_phiPOS_add ARth);simpl;norm.
rewrite (Ropp_def Rth);norm.
- destruct H0 as [h [Heq1 [Heq2 Hor]]];trivial.
- unfold Pminus; rewrite Heq1;rewrite <- Heq2.
+ rewrite <- (Pos.sub_add x y H) at 2.
rewrite (ARgen_phiPOS_add ARth);simpl;norm.
- add_push (gen_phiPOS1 h);rewrite (Ropp_def Rth); norm.
+ add_push (gen_phiPOS1 (x-y));rewrite (Ropp_def Rth); norm.
Qed.
Lemma match_compOpp : forall x (B:Type) (be bl bg:B),
@@ -207,8 +201,7 @@ Section ZMORPHISM.
induction x;destruct y;simpl;norm.
apply (ARgen_phiPOS_add ARth).
apply gen_phiZ1_add_pos_neg.
- replace Eq with (CompOpp Eq);trivial.
- rewrite <- Pcompare_antisym;simpl.
+ rewrite Pos.compare_antisym.
rewrite match_compOpp.
rewrite (Radd_comm Rth).
apply gen_phiZ1_add_pos_neg.