(************************************************************************)
(*         *   The Coq Proof Assistant / The Coq Development Team       *)
(*  v      *   INRIA, CNRS and contributors - Copyright 1999-2018       *)
(* <O___,, *       (see CREDITS file for the list of authors)           *)
(*   \VV/  **************************************************************)
(*    //   *    This file is distributed under the terms of the         *)
(*         *     GNU Lesser General Public License Version 2.1          *)
(*         *     (see LICENSE file for the text of the license)         *)
(************************************************************************)
Require Export Rtrigo_fun.
Require Export Rtrigo_def.
Require Export Rtrigo_alt.
Require Export Cos_rel.
Require Export Cos_plus.
Local Open Scope nat_scope.
Local Open Scope R_scope.
Definition PI_2_aux : {z | 7/8 <= z <= 7/4 /\ -cos z = 0}.
assert (cc : continuity (fun r =>- cos r)).
apply continuity_opp, continuity_cos.
assert (cvp : 0 < cos (7/8)).
assert (int78 : -2 <= 7/8 <= 2) by (split; lra).
destruct int78 as [lower upper].
case (pre_cos_bound _ 0 lower upper).
unfold cos_approx; simpl sum_f_R0; unfold cos_term.
intros cl _; apply Rlt_le_trans with (2 := cl); simpl.
lra.
assert (cun : cos (7/4) < 0).
replace (7/4) with (7/8 + 7/8) by field.
rewrite cos_plus.
apply Rlt_minus; apply Rsqr_incrst_1.
exact sin_gt_cos_7_8.
apply Rlt_le; assumption.
apply Rlt_le; apply Rlt_trans with (1 := cvp); exact sin_gt_cos_7_8.
apply IVT; auto; lra.
Qed.
Definition PI2 := proj1_sig PI_2_aux.
Definition PI := 2 * PI2.
unfold PI2; case PI_2_aux; simpl.
intros x [_ q]; rewrite <- (Ropp_involutive (cos x)), q; apply Ropp_0.
Qed.
unfold PI2; case PI_2_aux; simpl; tauto.
Qed.

Lemma sin2 : forall x:R, Rsqr (sin x) = 1 - Rsqr (cos x).