diff options
author | Pierre Letouzey <pierre.letouzey@inria.fr> | 2016-02-26 20:16:00 +0100 |
---|---|---|
committer | Pierre Letouzey <pierre.letouzey@inria.fr> | 2016-02-26 20:18:49 +0100 |
commit | 3246b4fd3d03cba93c556986ed1a0f9629e4bb73 (patch) | |
tree | 21a4ba13706a174427f9e438b1927ab0103bb9ae /theories/QArith/Qreduction.v | |
parent | 20adaabfa96744442f201287e2900b1575614577 (diff) |
Qcabs : absolute value on normalized rational numbers Qc
File contributed by Cédric Auger (a long time ago, sorry!)
Qarith and Qc would probably deserve many more results like this one,
and a more modern style (for instance qualified names), but this commit
is better than nothing...
Diffstat (limited to 'theories/QArith/Qreduction.v')
-rw-r--r-- | theories/QArith/Qreduction.v | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/theories/QArith/Qreduction.v b/theories/QArith/Qreduction.v index c50c38b28..131214f51 100644 --- a/theories/QArith/Qreduction.v +++ b/theories/QArith/Qreduction.v @@ -93,11 +93,17 @@ Proof. Close Scope Z_scope. Qed. +Lemma Qred_eq_iff q q' : Qred q = Qred q' <-> q == q'. +Proof. + split. + - intros E. rewrite <- (Qred_correct q), <- (Qred_correct q'). + now rewrite E. + - apply Qred_complete. +Qed. + Add Morphism Qred : Qred_comp. Proof. - intros q q' H. - rewrite (Qred_correct q); auto. - rewrite (Qred_correct q'); auto. + intros. now rewrite !Qred_correct. Qed. Definition Qplus' (p q : Q) := Qred (Qplus p q). @@ -149,3 +155,13 @@ Theorem Qred_compare: forall x y, Proof. intros x y; apply Qcompare_comp; apply Qeq_sym; apply Qred_correct. Qed. + +Lemma Qred_le q q' : Qred q <= Qred q' <-> q <= q'. +Proof. + now rewrite !Qle_alt, <- Qred_compare. +Qed. + +Lemma Qred_lt q q' : Qred q < Qred q' <-> q < q'. +Proof. + now rewrite !Qlt_alt, <- Qred_compare. +Qed. |