(* This program is free software; you can redistribute it and/or      *)
(* modify it under the terms of the GNU Lesser General Public License *)
(* as published by the Free Software Foundation; either version 2.1   *)
(* of the License, or (at your option) any later version.             *)
(*                                                                    *)
(* This program is distributed in the hope that it will be useful,    *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of     *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *)
(* GNU General Public License for more details.                       *)
(*                                                                    *)
(* You should have received a copy of the GNU Lesser General Public   *)
(* License along with this program; if not, write to the Free         *)
(* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *)
(* 02110-1301 USA                                                     *)
Definition outside_square (a b c d : Z) :=
(Z.sgn a + Z.sgn b + Z.sgn c + Z.sgn d)%Z.
Inductive Qquadratic_sg_denom_nonzero :
Z -> Z -> Z -> Z -> Qpositive -> Qpositive -> Prop :=
| Qquadratic_signok0 :
forall (e f g h : Z) (p1 p2 : Qpositive),
p2 = One ->
Qhomographic_sg_denom_nonzero (e + f) (g + h) p1 ->
Qquadratic_sg_denom_nonzero e f g h p1 p2
| Qquadratic_signok0' :
forall (e f g h : Z) (p1 p2 : Qpositive),
p1 = One ->
Qhomographic_sg_denom_nonzero (e + g) (f + h) p2 ->
Qquadratic_sg_denom_nonzero e f g h p1 p2
| Qquadratic_signok1 :
forall (e f g h : Z) (p1 p2 : Qpositive),
Qquadratic_sg_denom_nonzero e (e + f)%Z (e + g)%Z
(e + f + g + h)%Z p1 p2 ->
Qquadratic_sg_denom_nonzero e f g h (nR p1) (nR p2)
| Qquadratic_signok2 :
forall (e f g h : Z) (p1 p2 : Qpositive),
Qquadratic_sg_denom_nonzero (e + f)%Z f (e + f + g + h)%Z
(f + h)%Z p1 p2 ->
Qquadratic_sg_denom_nonzero e f g h (nR p1) (dL p2)
| Qquadratic_signok3 :
forall (e f g h : Z) (p1 p2 : Qpositive),
Qquadratic_sg_denom_nonzero (e + g)%Z (e + f + g + h)%Z g
(g + h)%Z p1 p2 ->
Qquadratic_sg_denom_nonzero e f g h (dL p1) (nR p2)
| Qquadratic_signok4 :
forall (e f g h : Z) (p1 p2 : Qpositive),
Qquadratic_sg_denom_nonzero (e + f + g + h)%Z
(f + h)%Z (g + h)%Z h p1 p2 ->
Qquadratic_sg_denom_nonzero e f g h (dL p1) (dL p2).

Lemma Qquadratic_sign_equal_strong :
forall (a1 a2 b1 b2 c1 c2 d1 d2 e1 e2 f1 f2 g1 g2 h1 h2 : Z)
(x1 x2 y1 y2 : Qpositive)
(H_ok_1 : Qquadratic_sg_denom_nonzero e1 f1 g1 h1 x1 y1)
(H_ok_2 : Qquadratic_sg_denom_nonzero e2 f2 g2 h2 x2 y2),
a1 = a2 ->
b1 = b2 ->
c1 = c2 ->
d1 = d2 ->
e1 = e2 ->
f1 = f2 ->
g1 = g2 ->
h1 = h2 ->
x1 = x2 ->
y1 = y2 ->
Qquadratic_sign a1 b1 c1 d1 e1 f1 g1 h1 x1 y1 H_ok_1 =
Qquadratic_sign a2 b2 c2 d2 e2 f2 g2 h2 x2 y2 H_ok_2.