intros w w' w''; make_fraction w ipattern:(p) ipattern:(q) ipattern:(Heq);
make_fraction w' ipattern:(p') ipattern:(q') ipattern:(Heq');
make_fraction w'' ipattern:(p'') ipattern:(q'') ipattern:(Heq'');
intros Hneq1 Hneq2.
intros H H1 H2; apply Qpositive_le'_to_Qpositive_le;
generalize (Qpositive_le_to_Qpositive_le' _ _ H)
(Qpositive_le_to_Qpositive_le' _ _ H1)
(Qpositive_le_to_Qpositive_le' _ _ H2); clear H H1 H2.
unfold Qpositive_le', Qpositive_sub in |- *; simpl in |- *; rewrite Heq;
rewrite Heq'; rewrite Heq''.
intros Hle Hle1 Hle2.
expand (S p'' * S q - S p * S q'') (S q'' * S q)
(S p'' * S q + S p * S q'' + S q'' * S q) ipattern:(d) ipattern:(p3) ipattern:(q3)
ipattern:(Heq3) ipattern:(Heq1) ipattern:(Heq2).
expand (S p'' * S q' - S p' * S q'') (S q'' * S q')
(S p'' * S q' + S p' * S q'' + S q'' * S q') ipattern:(d') ipattern:(p4)
ipattern:(q4) ipattern:(Heq4) ipattern:(Heq5) ipattern:(Heq6).
apply mult_S_le_reg_l with d'.
repeat rewrite (mult_comm (S d')); rewrite (mult_comm (S p4));
repeat rewrite <- mult_assoc.
rewrite <- Heq5; rewrite <- Heq6.
apply mult_S_le_reg_l with d; repeat rewrite mult_assoc;
repeat rewrite (mult_comm (S d)).
rewrite <- Heq1; rewrite <- Heq2.
rewrite mult_comm.
rewrite <- mult_assoc.
repeat rewrite mult_minus_distr_r.
repeat rewrite (mult_comm (S q'')).
repeat rewrite <- (mult_assoc (S p'')).
rewrite (mult_assoc (S q')).
rewrite (mult_assoc (S q)).
rewrite (mult_comm (S q) (S q')).
apply le_minus_left.
rewrite <- (mult_assoc (S q')).
rewrite (mult_assoc (S p'')).
repeat rewrite <- (mult_comm (S q * S q'')).
replace (S q * S q'') with (S (q'' + q * S q'')).
apply (fun m n p : nat => mult_le_compat_l p n m).
exact Hle1.
auto.
repeat rewrite <- (mult_comm (S q')) || rewrite mult_assoc.
repeat rewrite <- mult_assoc;
apply (fun m n p : nat => mult_le_compat_l p n m).
repeat rewrite mult_assoc; repeat rewrite <- (mult_comm (S q''));
apply (fun m n p : nat => mult_le_compat_l p n m).
rewrite (mult_comm (S q'')); exact Hle.
repeat rewrite mult_assoc; repeat rewrite <- (mult_comm (S q''));
apply (fun m n p : nat => mult_le_compat_l p n m).
repeat rewrite <- mult_assoc;
apply (fun m n p : nat => mult_le_compat_l p n m).
exact Hle2.
case (le_gt_dec (S p'' * S q') (S p' * S q'')).
intros l; try assumption.
elim Hneq2.
rewrite <- (construct_correct w' (S p') (S q') (S p' + S q')); auto with *.
rewrite <- (construct_correct w'' (S p'') (S q'') (S p'' + S q''));
auto with *.
apply construct_correct4'; auto with arith.
CaseEq (S p'' * S q' - S p' * S q'').
intros Dummy Dummy2; generalize (minus_O_le _ _ Dummy); intros Dummy1;
elim (le_not_gt _ _ Dummy1 Dummy2).
auto with arith.
apply plus_le_compat_r.
eapply le_trans; [ eapply minus_le | auto with arith ].
case (le_gt_dec (S p'' * S q) (S p * S q'')).
intros l; try assumption.
elim Hneq1.
rewrite <- (construct_correct w (S p) (S q) (S p + S q)); auto with *.
rewrite <- (construct_correct w'' (S p'') (S q'') (S p'' + S q''));
auto with *.
apply construct_correct4'; auto with arith.
CaseEq (S p'' * S q - S p * S q'').
intros Dummy Dummy2; generalize (minus_O_le _ _ Dummy); intros Dummy1;
elim (le_not_gt _ _ Dummy1 Dummy2).
auto with arith.
apply plus_le_compat_r.
eapply le_trans; [ eapply minus_le | auto with arith ].
Qed.

(* Specifications: *)
Theorem Qpositive_le_sub_r :
forall w w' w'' : Qpositive,
w <> w'' ->
w' <> w'' ->
Qpositive_le w'' w ->
Qpositive_le w'' w' ->
Qpositive_le w w' ->
Qpositive_le (Qpositive_sub w w'') (Qpositive_sub w' w'').