Require Export Reals Coquelicot.Coquelicot.
Open Scope R_scope.
Section RC.
If a degree-2 polynomial is always nonnegative, its dicriminant is nonpositive
Lemma discr_neg:
forall a b c,
(
forall x, 0 <=
a*
x*
x+
b*
x+
c) ->
b*
b-4*
a*
c <= 0.
intros.
case (
Req_dec a 0);
intros H'.
cut (
b=0).
intros H1;
rewrite H';
rewrite H1.
right;
ring.
case (
Req_dec b 0);
trivial;
intros.
absurd (0 <=
a*((-
c-1)/
b)*((-
c-1)/
b)+
b*((-
c-1)/
b)+
c).
2:
apply H.
apply Rlt_not_le.
rewrite H';
apply Rle_lt_trans with (-1).
right;
field;
trivial.
apply Ropp_lt_gt_0_contravar;
apply Rlt_gt;
auto with real.
assert (0 <=
c).
apply Rle_trans with (
a*0*0+
b*0+
c);[
idtac|
right;
ring].
apply H.
assert (0 <
a).
cut (0 <=
a).
intros T;
case T;
auto with real.
intros T';
absurd (
a=0);
auto.
case (
Req_dec b 0);
intros.
case (
Rle_or_lt 0
a);
trivial;
intros.
absurd (0 <=
a*
sqrt ((
c+1)/(-
a)) *
sqrt ((
c+1)/(-
a)) +
b*
sqrt ((
c+1)/(-
a))+
c).
2:
apply H.
apply Rlt_not_le.
rewrite H1;
ring_simplify ( 0 *
sqrt ((
c + 1) / -
a)).
rewrite Rmult_assoc.
rewrite sqrt_sqrt.
apply Rle_lt_trans with (-1).
right;
field;
auto with real.
apply Ropp_lt_gt_0_contravar;
apply Rlt_gt;
auto with real.
unfold Rdiv;
apply Rmult_le_pos;
auto with real.
case H0;
intros.
apply Rmult_le_reg_l with (
c*
c/(
b*
b)).
unfold Rdiv;
apply Rmult_lt_0_compat.
apply Rmult_lt_0_compat;
trivial.
apply Rinv_0_lt_compat.
fold (
Rsqr b);
auto with real.
ring_simplify.
apply Rle_trans with (
a*(-
c/
b)*(-
c/
b)+
b*(-
c/
b)+
c).
apply H.
right;
field;
trivial.
apply Rmult_le_reg_l with (
b*
b).
fold (
Rsqr b);
auto with real.
ring_simplify.
apply Rle_trans with (
Rsqr b);
auto with real.
apply Rplus_le_reg_l with (-
Rsqr b);
ring_simplify.
apply Rle_trans with (
a*(-
b)*(-
b)+
b*(-
b)+
c).
apply H.
rewrite <-
H2;
unfold Rsqr;
right;
ring.
case (
Rle_or_lt (
b *
b - 4 *
a *
c) 0);
trivial.
intros H2.
absurd ( 0 <=
a * (-
b/(2*
a)) * (-
b/(2*
a)) +
b * (-
b/(2*
a)) +
c).
apply Rlt_not_le.
replace (
a * (-
b / (2*
a)) * (-
b / (2*
a)) +
b * (-
b / (2*
a)) +
c)
with
(-
b*
b/(4*
a)+
c).
apply Rmult_lt_reg_l with (4*
a).
repeat apply Rmult_lt_0_compat;
auto with real.
apply Rplus_lt_reg_r with (
b*
b-4*
a*
c).
apply Rle_lt_trans with 0%
R.
right;
field;
auto.
apply Rlt_le_trans with (1:=
H2);
right;
ring.
field;
auto.
apply H.
Qed.
Proof.
Proof.
Proof.
Proof.
Proof.
Proof.
Proof.
Proof.
Proof.
Proof.