Definition spec_q (a b c d e f g h : Z) (q1 q2 : Q) : Q :=
  Qmult
    (Qplus (Qplus (Qplus (Qmult (Qmult a q1) q2) (Qmult b q1)) (Qmult c q2))
       d)
    (Qinv
       (Qplus
          (Qplus (Qplus (Qmult (Qmult e q1) q2) (Qmult f q1)) (Qmult g q2)) h)).Definition spec_Qquadratic_Qpositive_to_Q (a b c d e f g h : Z)
  (p1 p2 : Qpositive) : Q :=
  Qmult
    (Qplus
       (Qplus
          (Qplus (Qmult (Qmult a (Qpos p1)) (Qpos p2)) (Qmult b (Qpos p1)))
          (Qmult c (Qpos p2))) d)
    (Qinv
       (Qplus
          (Qplus
             (Qplus (Qmult (Qmult e (Qpos p1)) (Qpos p2)) (Qmult f (Qpos p1)))
             (Qmult g (Qpos p2))) h)).(* Here we should expect that ap1p2+bp1+cp2+d > 0 and ep1p1+fp1+gp2+h > 0, this follow - hopefully - from quadraticAcc *)
Definition spec_Qquadratic_Qpositive_to_Qpositive2 
  (a b c d e f g h : Z) (p1 p2 : Qpositive) : Qpositive :=
  Qpositive_mult
    (Q_tail
       (Qplus
          (Qplus
             (Qplus (Qmult (Qmult a (Qpos p1)) (Qpos p2)) (Qmult b (Qpos p1)))
             (Qmult c (Qpos p2))) d))
    (Qpositive_inv
       (Q_tail
          (Qplus
             (Qplus
                (Qplus (Qmult (Qmult e (Qpos p1)) (Qpos p2))
                   (Qmult f (Qpos p1))) (Qmult g (Qpos p2))) h))).

Lemma spec_Qquadratic_Qpositive_to_Q_dL_nR_unfolded : forall (a b c d e f g h : Z) (p1 p2 : Qpositive), Qmult (Qplus (Qplus (Qplus (Qmult (Qmult a (Qpos (dL p1))) (Qpos (nR p2))) (Qmult b (Qpos (dL p1)))) (Qmult c (Qpos (nR p2)))) d) (Qinv (Qplus (Qplus (Qplus (Qmult (Qmult e (Qpos (dL p1))) (Qpos (nR p2))) (Qmult f (Qpos (dL p1)))) (Qmult g (Qpos (nR p2)))) h)) = Qmult (Qplus (Qplus (Qplus (Qmult (Qmult (a + c)%Z (Qpos p1)) (Qpos p2)) (Qmult (a + b + c + d)%Z (Qpos p1))) (Qmult c (Qpos p2))) (c + d)%Z) (Qinv (Qplus (Qplus (Qplus (Qmult (Qmult (e + g)%Z (Qpos p1)) (Qpos p2)) (Qmult (e + f + g + h)%Z (Qpos p1))) (Qmult g (Qpos p2))) (g + h)%Z)).