(************************************************************************)
(* Copyright 2006 Milad Niqui                                           *)
(* This file is distributed under the terms of the                      *)
(* GNU Lesser General Public License Version 2.1                        *)
(* A copy of the license can be found at                                *)
(*                  <http://www.gnu.org/licenses/lgpl-2.1.html>         *)
(************************************************************************)
Require Export Qsyntax.
Require Export Field_Theory_Q.

(* Specifications: *)
Lemma Qmult_absorb_nonzero_r: forall x y : Q, x * y <> Zero -> y <> Zero.
Lemma Qmult_absorb_nonzero_l: forall x y : Q, x * y <> Zero -> x <> Zero.
Lemma Qle_Qminus_Zero: forall x y: Q, x <= y -> Zero <= y-x.
Lemma Qle_Qminus_Zero_neg: forall x y : Q, x <= y -> x-y <= Zero.
Lemma Qle_Zero_Qminus_neg: forall x y : Q, x-y <= Zero -> x <= y.
Lemma Qle_Zero_Qminus: forall x y: Q,  Zero <= y-x -> x <= y.
Lemma Qmult_mult_nonneg: forall x:Q, Zero <= x*x.
Lemma Qmult_mult_pos: forall x:Q, x<> Zero -> Zero < x*x.
Lemma Qlt_opp:forall x y, Qopp x < Qopp y -> y < x.
Lemma Qlt_plus:forall x y z : Q, x < y -> z + x < z + y.
Lemma Qlt_Qminus_Zero: forall x y : Q, x < y -> Zero < y - x.
Lemma Qlt_Qminus_Zero_neg: forall x y : Q, x < y -> x-y < Zero.
Lemma Qlt_Zero_Qminus_neg: forall x y : Q, x-y < Zero -> x < y.
Lemma Qlt_reg_mult_pos_l: forall x y z : Q, Zero < x -> y < z -> x * y < x * z.
Lemma Qlt_reg_mult_pos_r: forall x y z : Q, Zero < x -> y < z -> y * x < z * x.
Lemma Qlt_reg_mult_neg_l: forall x y z : Q, x < Zero -> y < z -> x * z < x * y.
Lemma Qlt_reg_mult_neg_r: forall x y z : Q, x < Zero -> y < z -> z * x < y * x.
Lemma Qdiv_Qmult_pos:forall x y z t: Q, Zero < z*t -> x/z < y/t -> x*t < y*z.
Lemma Qinv_involutive:forall x:Q, x<>Zero -> Qinv (Qinv x) = x.
Lemma Qmult_Qdiv_pos:forall x y z t: Q, Zero < z*t -> x*t < y*z -> x/z < y/t.
Lemma Qlt_Qopp_pos: forall x: Q, x < Zero -> Zero < - x.
Lemma Qlt_Qopp_neg: forall x: Q, Zero < x -> -x < Zero.
Lemma Qmult_one_left:forall x : Q, Qone * x = x.
Lemma Qdiv_Qone_Qone: Qdiv Qone Qone = Qone.
Lemma Qinv_Qdiv_Qone:forall x, Qinv x = Qone/x.
Lemma Qminus_Qdiv:forall x y z t, z<>Zero -> t<>Zero -> x/z - y/t = (x*t-y*z)/(z*t).
Lemma Qplus_Qdiv:forall x y z t, z<>Zero -> t<>Zero -> x/z + y/t = (x*t+y*z)/(z*t).
Definition Qmult_Qinv_l:= Qinv_defT.
Lemma Qmult_Qinv_r:forall x, x <> Zero -> x * (Qinv x) = Qone.
Lemma Qinv_Qmult:forall x y, x<>Zero -> y <> Zero -> Qinv (x*y) = (Qinv x)*(Qinv y).
Lemma Qplus_Qdiv_one:forall p q, q<> Zero -> (p+q) / q = p/q + Qone.
Lemma Qdiv_Qopp_numerator: forall x y : Q, y<> Zero -> Qdiv (-x) y = - (Qdiv x  y).
Lemma Qdiv_Qopp_denomintor: forall x y : Q, y<> Zero -> Qdiv x (-y) = - (Qdiv x  y).
Lemma Qdiv_Qdiv_simplify:forall x y z, z<> Zero -> y<> Zero -> (x/z)/(y/z) = x/y.
Lemma Qdiv_Qmult_Qone_denominator:forall x y z, z<>Zero -> y<>Zero -> x/(y*z) = (x/y)*(Qone/z).
Lemma Qdiv_Qmult_numerator_l: forall (x y z:Q), y<>Zero -> z*(x/y)=(z*x)/y.
Lemma Qdiv_Qmult_numerator_r: forall (x y z:Q), y<>Zero -> (x/y)*z=(x*z)/y.
Lemma Qlt_Qmult_cancel_l: forall x y z : Q, Zero < x -> x * y < x * z -> y < z.
Lemma Qlt_Qmult_cancel_r: forall x y z : Q, Zero < x -> y * x< z * x -> y < z.
Definition Qmult_resp_Qlt_pos_r:= Qlt_Qmult_cancel_r :  forall t x y : Q, Zero < t -> x * t < y * t -> x < y.