Inductive Q : Set :=
  | Zero : Q
  | Qpos : Qpositive -> Q
  | Qneg : Qpositive -> Q.Inductive Q : Set :=
  | Zero : Q
  | Qpos : Qpositive -> Q
  | Qneg : Qpositive -> Q.Inductive Q : Set :=
  | Zero : Q
  | Qpos : Qpositive -> Q
  | Qneg : Qpositive -> Q.Inductive Q : Set :=
  | Zero : Q
  | Qpos : Qpositive -> Q
  | Qneg : Qpositive -> Q.Definition Qone := Qpos One.Definition Qpositive_le_dec :
  forall w w' : Qpositive, {Qpositive_le w w'} + {~ Qpositive_le w w'}.Ltac Case' f :=
  match constr:(f) with
  | (Qpositive_le_dec ?X1 ?X2) =>
      case f;
       [ idtac
       | intros Dummy;
          generalize (not_Qpositive_le_not_eq _ _ Dummy)
           (not_Qpositive_le_Qpositive_le' _ _ Dummy) Dummy; 
          clear Dummy ]
  | _ => case f
  end.Definition Qpositive_eq_dec : forall w w' : Qpositive, {w = w'} + {w <> w'}.Definition Qplus (x y : Q) :=
  match x, y with
  | Qpos x', Qpos y' => Qpos (Qpositive_plus x' y')
  | Qpos x', Qneg y' =>
      match Qpositive_le_dec x' y' with
      | left h =>
          match Qpositive_eq_dec x' y' with
          | left h => Zero
          | right h => Qneg (Qpositive_sub y' x')
          end
      | right h => Qpos (Qpositive_sub x' y')
      end
  | Qneg x', Qneg y' => Qneg (Qpositive_plus x' y')
  | Qneg x', Qpos y' =>
      match Qpositive_le_dec x' y' with
      | left h =>
          match Qpositive_eq_dec x' y' with
          | left h => Zero
          | right h => Qpos (Qpositive_sub y' x')
          end
      | right h => Qneg (Qpositive_sub x' y')
      end
  | Qneg x', Zero => Qneg x'
  | Qpos x', Zero => Qpos x'
  | Zero, x => x
  end.Definition Qmult (x y : Q) :=
  match x, y with
  | Qpos x', Qpos y' => Qpos (Qpositive_mult x' y')
  | Qpos x', Qneg y' => Qneg (Qpositive_mult x' y')
  | Qneg x', Qpos y' => Qneg (Qpositive_mult x' y')
  | Qneg x', Qneg y' => Qpos (Qpositive_mult x' y')
  | _, _ => Zero
  end.Definition Qopp (x : Q) :=
  match x with
  | Zero => Zero
  | Qpos x' => Qneg x'
  | Qneg x' => Qpos x'
  end.

(* Specifications: *)
Theorem Qplus_sym : forall a b : Q, Qplus a b = Qplus b a.
Theorem Qplus_zero_left : forall n : Q, Qplus Zero n = n.
Theorem add_sub_le1 : forall a b c : Qpositive, a <> b -> Qpositive_le b a -> Qpositive_le (Qpositive_sub a b) c -> Qpositive_le a (Qpositive_plus b c).
Theorem add_sub_le2 : forall a b c : Qpositive, a <> b -> Qpositive_le b a -> Qpositive_le a (Qpositive_plus b c) -> Qpositive_le (Qpositive_sub a b) c.
Theorem add_sub_eq1 : forall a b c : Qpositive, a = Qpositive_plus b c -> Qpositive_sub a b = c.
Theorem add_sub_eq2 : forall a b c : Qpositive, a <> b -> Qpositive_le b a -> c = Qpositive_sub a b -> Qpositive_plus b c = a.
Theorem Qplus_assoc_two_neg : forall (n : Q) (m' p' : Qpositive), Qplus n (Qplus (Qneg m') (Qneg p')) = Qplus (Qplus n (Qneg m')) (Qneg p').
Theorem Qplus_assoc_one_neg : forall n' m' p' : Qpositive, Qplus (Qpos n') (Qplus (Qpos m') (Qneg p')) = Qplus (Qplus (Qpos n') (Qpos m')) (Qneg p').
Theorem Qplus_assoc_one_neg' : forall (n m : Q) (p' : Qpositive), Qplus n (Qplus m (Qneg p')) = Qplus (Qplus n m) (Qneg p').
Theorem Qplus_assoc : forall n m p : Q, Qplus n (Qplus m p) = Qplus (Qplus n m) p.