Definition Qabs (q:Q):Q:= 
  match q with 
  | Zero => Zero
  | Qpos qp => Qpos qp
  | Qneg qp => Qpos qp
  end.

(* Specifications: *)
Lemma Qabs_eq: forall q, Zero<=q -> Qabs q = q.
Lemma Qabs_non_eq: forall q, q<=Zero -> Qabs q = (-q).
Lemma Qabs_eq_pos: forall q, Zero<q -> Qabs q = q.
Lemma Qabs_non_eq_neg: forall q, q<Zero -> Qabs q = (-q).
Lemma Qabs_Qmult: forall q1 q2, Qabs (q1*q2) = (Qabs q1) * (Qabs q2).
Lemma Qabs_5: forall q p, Qabs q <= p -> (- p <= q)/\ (q<= p).
Lemma Qabs_6: forall q p, Qabs q <= p -> q<= p.
Lemma Qabs_7: forall q p, Qabs q <= p -> - p <= q.
Lemma Qabs_8: forall q p, - p <= q -> q <= p -> Qabs q <= p.
Lemma Qabs_nonneg: forall q, Zero <= Qabs q.
Lemma Qle_Qabs: forall q, q <= Qabs q.
Lemma Qle_Qabs_Qopp: forall q, -q <= Qabs q.
Lemma Qabs_Qle_Qopp: forall q, - (Qabs q) <= q.
Lemma Qabs_triangle: forall p q, Qabs (p + q) <= Qabs p + Qabs q.
Lemma Qabs_Qopp:forall q, Qabs q = Qabs (-q).
Lemma Qabs_Qminus_sym:forall q1 q2, Qabs (q1-q2) = Qabs (q2-q1).
Lemma Qabs_nonzero_pos:forall q, q<> Zero -> Zero < Qabs q.
Lemma Qabs_Qminus_Zero_eq:forall q1 q2, Qabs (q1-q2) = Zero -> q1=q2.
Lemma Qabs_Zero_Qminus_eq:forall q1 q2, q1=q2 -> Qabs (q1-q2) = Zero.
Lemma Qabs_Qminus_bound:forall low up q1 q2, low <= q1 -> q1 <= up -> low <= q2 -> q2 <= up -> Qabs (q1-q2) <= up-low.
Lemma upper_bound_affine_base_interval_twice:forall a b c d x, -Qone<=x -> x<=Qone -> (a*x+b)*(c*x+d) <= Qabs (a*c) + Qabs (a*d+c*b)+b*d.
Lemma lower_bound_affine_base_interval_twice:forall a b c d x, -Qone<=x -> x<=Qone -> -Qabs (a*c) + -Qabs (a*d+c*b)+b*d <= (a*x+b)*(c*x+d).