Ltac Inside_Square_Qsgn_ p1 p2 :=
repeat
match goal with
| id1:(?X1 < ?X2)%Z |- _ =>
unfold X2 in id1 || unfold X1 in id1;
repeat
match goal with
| id1:(2 < outside_square ?X1 ?X2 ?X3 ?X4)%Z,id2:
(~ (?X2 = 0%Z /\ ?X3 = 0%Z /\ ?X4 = 0%Z)) |- _ =>
generalize
(Qsgn_7 _ (outside_square_correct_1 X1 X2 X3 X4 p1 p2 id1 id2));
clear id1
| id1:(outside_square ?X1 ?X2 ?X3 ?X4 < -2)%Z,id2:
(~ (?X2 = 0%Z /\ ?X3 = 0%Z /\ ?X4 = 0%Z)) |- _ =>
generalize
(Qsgn_8 _ (outside_square_correct_2 X1 X2 X3 X4 p1 p2 id1 id2));
clear id1
end
end.

(* Specifications: *)
Lemma quadratic_sign :
forall (a b c d e f g h : Z) (p1 p2 : Qpositive)
(H_Qquadratic_sg_denom_nonzero : Qquadratic_sg_denom_nonzero e f g h p1 p2),
q_sign a b c d e f g h p1 p2 H_Qquadratic_sg_denom_nonzero =
Qsgn (spec_Qquadratic_Qpositive_to_Q a b c d e f g h p1 p2).
Lemma quadraticAcc_positive :
forall (a b c d e f g h : Z) (p1 p2 : Qpositive),
quadraticAcc a b c d e f g h p1 p2 ->
Qlt Zero
(Qplus
(Qplus
(Qplus (Qmult (Qmult a (Qpos p1)) (Qpos p2)) (Qmult b (Qpos p1)))
(Qmult c (Qpos p2))) d) /\
Qlt Zero
(Qplus
(Qplus
(Qplus (Qmult (Qmult e (Qpos p1)) (Qpos p2)) (Qmult f (Qpos p1)))
(Qmult g (Qpos p2))) h).
Lemma quadraticAcc_positive_numerator :
forall (a b c d e f g h : Z) (p1 p2 : Qpositive),
quadraticAcc a b c d e f g h p1 p2 ->
Qlt Zero
(Qplus
(Qplus
(Qplus (Qmult (Qmult a (Qpos p1)) (Qpos p2)) (Qmult b (Qpos p1)))
(Qmult c (Qpos p2))) d).
Lemma quadraticAcc_positive_denominator :
forall (a b c d e f g h : Z) (p1 p2 : Qpositive),
quadraticAcc a b c d e f g h p1 p2 ->
Qlt Zero
(Qplus
(Qplus
(Qplus (Qmult (Qmult e (Qpos p1)) (Qpos p2)) (Qmult f (Qpos p1)))
(Qmult g (Qpos p2))) h).
Lemma quadratic_output_bit :
forall (a b c d e f g h : Z) (p1 p2 : Qpositive)
(hyp_quadraticAcc : quadraticAcc a b c d e f g h p1 p2),
Qquadratic_Qpositive_to_Qpositive a b c d e f g h p1 p2 hyp_quadraticAcc =
spec_Qquadratic_Qpositive_to_Qpositive2 a b c d e f g h p1 p2.