Built with Alectryon, running Coq+SerAPI v8.10.0+0.7.0. Coq sources are in this panel; goals and messages will appear in the other. Bubbles () indicate interactive fragments: hover for details, tap to reveal contents. Use Ctrl+↑ Ctrl+↓ to navigate, Ctrl+🖱️ to focus.
(************************************************************************) (* * 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 Import Rbase. Require Import Rfunctions. Require Import SeqSeries. Require Import Rtrigo1. Require Import R_sqrt. Local Open Scope R_scope.tan PI = 0unfold tan; rewrite sin_PI; rewrite cos_PI; unfold Rdiv; apply Rmult_0_l. Qed.tan PI = 0sin (3 * (PI / 2)) = -1sin (3 * (PI / 2)) = -1sin (PI + PI / 2) = -1PI + PI / 2 = 3 * (PI / 2)pattern PI at 1; rewrite (double_var PI); ring. Qed.PI + PI / 2 = 3 * (PI / 2)tan (2 * PI) = 0unfold tan; rewrite sin_2PI; unfold Rdiv; apply Rmult_0_l. Qed.tan (2 * PI) = 0sin (PI / 4) = cos (PI / 4)sin (PI / 4) = cos (PI / 4)sin (PI / 4) = sin (PI / 2 + PI / 4)rewrite neg_sin, sin_neg; ring. Qed.sin (PI / 4) = sin (- (PI / 4) + PI)sin (PI / 3) = cos (PI / 6)sin (PI / 3) = cos (PI / 6)now rewrite cos_shift. Qed.sin (PI / 3) = cos (PI / 2 - PI / 3)cos (PI / 3) = sin (PI / 6)cos (PI / 3) = sin (PI / 6)now rewrite sin_shift. Qed.cos (PI / 3) = sin (PI / 2 - PI / 3)0 < PI / 6unfold Rdiv; apply Rmult_lt_0_compat; [ apply PI_RGT_0 | apply Rinv_0_lt_compat; prove_sup0 ]. Qed.0 < PI / 6PI / 6 < PI / 2PI / 6 < PI / 20 < PI/ 6 < / 2apply Rinv_lt_contravar; prove_sup. Qed./ 6 < / 2sin (PI / 6) = 1 / 2sin (PI / 6) = 1 / 22 * cos (PI / 6) * sin (PI / 6) = 2 * cos (PI / 6) * (1 / 2)2 * cos (PI / 6) <> 02 * sin (PI / 6) * cos (PI / 6) = 2 * cos (PI / 6) * (1 / 2)2 * cos (PI / 6) <> 0sin (PI / 3) = 2 * cos (PI / 6) * (1 / 2)2 * cos (PI / 6) <> 0cos (PI / 6) = 2 * cos (PI / 6) * (1 / 2)2 * cos (PI / 6) <> 02 * cos (PI / 6) <> 02 <> 0cos (PI / 6) <> 0cut (0 < cos (PI / 6)); [ intro H1; auto with real | apply cos_gt_0; [ apply (Rlt_trans (- (PI / 2)) 0 (PI / 6) _PI2_RLT_0 PI6_RGT_0) | apply PI6_RLT_PI2 ] ]. Qed.cos (PI / 6) <> 0sqrt 2 <> 0assert (Hyp : 0 < 2); [ prove_sup0 | generalize (Rlt_le 0 2 Hyp); intro H1; red; intro H2; generalize (sqrt_eq_0 2 H1 H2); intro H; absurd (2 = 0); [ discrR | assumption ] ]. Qed.sqrt 2 <> 01 / sqrt 2 <> 0generalize (Rinv_neq_0_compat (sqrt 2) sqrt2_neq_0); intro H; generalize (prod_neq_R0 1 (/ sqrt 2) R1_neq_R0 H); intro H0; assumption. Qed.1 / sqrt 2 <> 02 * sqrt 3 <> 0apply prod_neq_R0; [ discrR | assert (Hyp : 0 < 3); [ prove_sup0 | generalize (Rlt_le 0 3 Hyp); intro H1; red; intro H2; generalize (sqrt_eq_0 3 H1 H2); intro H; absurd (3 = 0); [ discrR | assumption ] ] ]. Qed.2 * sqrt 3 <> 00 < sqrt 2assert (Hyp : 0 < 2); [ prove_sup0 | generalize (sqrt_positivity 2 (Rlt_le 0 2 Hyp)); intro H1; elim H1; intro H2; [ assumption | absurd (0 = sqrt 2); [ apply (not_eq_sym (A:=R)); apply sqrt2_neq_0 | assumption ] ] ]. Qed.0 < sqrt 20 < sqrt 3cut (0%nat <> 1%nat); [ intro H0; assert (Hyp : 0 < 2); [ prove_sup0 | generalize (Rlt_le 0 2 Hyp); intro H1; assert (Hyp2 : 0 < 3); [ prove_sup0 | generalize (Rlt_le 0 3 Hyp2); intro H2; generalize (lt_INR_0 1 (neq_O_lt 1 H0)); unfold INR; intro H3; generalize (Rplus_lt_compat_l 2 0 1 H3); rewrite Rplus_comm; rewrite Rplus_0_l; replace (2 + 1) with 3; [ intro H4; generalize (sqrt_lt_1 2 3 H1 H2 H4); clear H3; intro H3; apply (Rlt_trans 0 (sqrt 2) (sqrt 3) Rlt_sqrt2_0 H3) | ring ] ] ] | discriminate ]. Qed.0 < sqrt 30 < PI / 4unfold Rdiv; apply Rmult_lt_0_compat; [ apply PI_RGT_0 | apply Rinv_0_lt_compat; prove_sup0 ]. Qed.0 < PI / 4cos (PI / 4) = 1 / sqrt 2cos (PI / 4) = 1 / sqrt 20 <= cos (PI / 4)0 <= 1 / sqrt 2(cos (PI / 4))² = (1 / sqrt 2)²- (PI / 2) <= PI / 4PI / 4 <= PI / 20 <= 1 / sqrt 2(cos (PI / 4))² = (1 / sqrt 2)²PI / 4 <= PI / 20 <= 1 / sqrt 2(cos (PI / 4))² = (1 / sqrt 2)²0 <= 1 / sqrt 2(cos (PI / 4))² = (1 / sqrt 2)²0 < 10 < / sqrt 2(cos (PI / 4))² = (1 / sqrt 2)²0 < / sqrt 2(cos (PI / 4))² = (1 / sqrt 2)²(cos (PI / 4))² = (1 / sqrt 2)²(cos (PI / 4))² = 1² / (sqrt 2)²sqrt 2 <> 0(cos (PI / 4))² = 1 / 20 <= 2sqrt 2 <> 01 / 2 * (2 * sin (PI / 4) * cos (PI / 4)) = 1 / 20 <= 2sqrt 2 <> 01 / 2 * sin (PI / 2) = 1 / 20 <= 2sqrt 2 <> 01 / 2 * 1 = 1 / 20 <= 2sqrt 2 <> 00 <= 2sqrt 2 <> 0apply sqrt2_neq_0... Qed.sqrt 2 <> 0sin (PI / 4) = 1 / sqrt 2rewrite sin_cos_PI4; apply cos_PI4. Qed.sin (PI / 4) = 1 / sqrt 2tan (PI / 4) = 1tan (PI / 4) = 1cos (PI / 4) / cos (PI / 4) = 1change (cos (PI / 4) <> 0); rewrite cos_PI4; apply R1_sqrt2_neq_0. Qed.cos (PI * / 4) <> 0cos (3 * (PI / 4)) = -1 / sqrt 2cos (3 * (PI / 4)) = -1 / sqrt 2cos (PI / 2 - - (PI / 4)) = -1 / sqrt 2- (1 / sqrt 2) = -1 / sqrt 2ring. Qed. Notation cos3PI4 := cos_3PI4 (compat "8.10").- (1 * / sqrt 2) = -1 * / sqrt 2sin (3 * (PI / 4)) = 1 / sqrt 2sin (3 * (PI / 4)) = 1 / sqrt 2now rewrite sin_shift, cos_neg, cos_PI4. Qed. Notation sin3PI4 := sin_3PI4 (compat "8.10").sin (PI / 2 - - (PI / 4)) = 1 / sqrt 2cos (PI / 6) = sqrt 3 / 2cos (PI / 6) = sqrt 3 / 20 <= cos (PI / 6)0 <= sqrt 3 / 2(cos (PI / 6))² = (sqrt 3 / 2)²- (PI / 2) <= PI / 6PI / 6 <= PI / 20 <= sqrt 3 / 2(cos (PI / 6))² = (sqrt 3 / 2)²PI / 6 <= PI / 20 <= sqrt 3 / 2(cos (PI / 6))² = (sqrt 3 / 2)²0 <= sqrt 3 / 2(cos (PI / 6))² = (sqrt 3 / 2)²0 < sqrt 30 < / 2(cos (PI / 6))² = (sqrt 3 / 2)²0 < / 2(cos (PI / 6))² = (sqrt 3 / 2)²(cos (PI / 6))² = (sqrt 3 / 2)²(cos (PI / 6))² = (sqrt 3)² / 2²1 - 1 / 2 * (1 / 2) = 3 / (2 * 2)0 <= 3left ; prove_sup0. Qed.0 <= 3tan (PI / 6) = 1 / sqrt 3tan (PI / 6) = 1 / sqrt 3/ 2 * (/ sqrt 3 * / / 2) = / sqrt 3sqrt 3 <> 0/ 2 <> 0/ 2 * (/ sqrt 3 * 2) = / sqrt 32 <> 0sqrt 3 <> 0/ 2 <> 0/ sqrt 3 * 1 = / sqrt 32 <> 02 <> 0sqrt 3 <> 0/ 2 <> 02 <> 02 <> 0sqrt 3 <> 0/ 2 <> 02 <> 0sqrt 3 <> 0/ 2 <> 0sqrt 3 <> 0/ 2 <> 0apply Rinv_neq_0_compat; discrR. Qed./ 2 <> 0sin (PI / 3) = sqrt 3 / 2rewrite sin_PI3_cos_PI6; apply cos_PI6. Qed.sin (PI / 3) = sqrt 3 / 2cos (PI / 3) = 1 / 2rewrite sin_PI6_cos_PI3; apply sin_PI6. Qed.cos (PI / 3) = 1 / 2tan (PI / 3) = sqrt 3tan (PI / 3) = sqrt 3sqrt 3 * / 2 * 2 = sqrt 32 <> 0sqrt 3 * 1 = sqrt 32 <> 02 <> 02 <> 02 <> 0discrR. Qed.2 <> 0sin (2 * (PI / 3)) = sqrt 3 / 2rewrite double; rewrite sin_plus; rewrite sin_PI3; rewrite cos_PI3; unfold Rdiv; repeat rewrite Rmult_1_l; rewrite (Rmult_comm (/ 2)); repeat rewrite <- Rmult_assoc; rewrite double_var; reflexivity. Qed.sin (2 * (PI / 3)) = sqrt 3 / 2cos (2 * (PI / 3)) = -1 / 2cos (2 * (PI / 3)) = -1 / 21 / 2 * (1 / 2) - sqrt 3 / 2 * (sqrt 3 / 2) = -1 / 21 / 2 * (1 / 2) - sqrt 3 * sqrt 3 / 4 = -1 / 21 / 2 * (1 / 2) - 3 / 4 = -1 / 20 <= 3left ; prove_sup0. Qed.0 <= 3tan (2 * (PI / 3)) = - sqrt 3tan (2 * (PI / 3)) = - sqrt 3field. Qed.sqrt 3 / 2 / (-1 / 2) = - sqrt 3cos (5 * (PI / 4)) = -1 / sqrt 2cos (5 * (PI / 4)) = -1 / sqrt 2cos (PI / 4 + PI) = -1 / sqrt 2ring. Qed.- (1 * / sqrt 2) = -1 * / sqrt 2sin (5 * (PI / 4)) = -1 / sqrt 2sin (5 * (PI / 4)) = -1 / sqrt 2sin (PI / 4 + PI) = -1 / sqrt 2ring. Qed.- (1 * / sqrt 2) = -1 * / sqrt 2cos (5 * (PI / 4)) = sin (5 * (PI / 4))rewrite cos_5PI4; rewrite sin_5PI4; reflexivity. Qed.cos (5 * (PI / 4)) = sin (5 * (PI / 4))0 < 3 * (PI / 2)apply Rmult_lt_0_compat; [ prove_sup0 | unfold Rdiv; apply Rmult_lt_0_compat; [ apply PI_RGT_0 | apply Rinv_0_lt_compat; prove_sup0 ] ]. Qed.0 < 3 * (PI / 2)0 < 2 * PIapply Rmult_lt_0_compat; [ prove_sup0 | apply PI_RGT_0 ]. Qed.0 < 2 * PIPI < 3 * (PI / 2)PI < 3 * (PI / 2)H1:0 < PI / 2PI + 0 < 3 * (PI / 2) -> PI < 3 * (PI / 2)H1:0 < PI / 23 * (PI / 2) = PI + PI / 2pattern PI at 2; rewrite double_var; ring. Qed.H1:0 < PI / 23 * (PI / 2) = PI + PI / 23 * (PI / 2) < 2 * PI3 * (PI / 2) < 2 * PIH1:0 < PI / 23 * (PI / 2) + 0 < 2 * PI -> 3 * (PI / 2) < 2 * PIH1:0 < PI / 22 * PI = 3 * (PI / 2) + PI / 2rewrite double; pattern PI at 1 2; rewrite double_var; ring. Qed. (***************************************************************)H1:0 < PI / 22 * PI = 3 * (PI / 2) + PI / 2
Radian -> Degree | Degree -> Radian
(***************************************************************) Definition plat : R := 180. Definition toRad (x:R) : R := x * PI * / plat. Definition toDeg (x:R) : R := x * plat * / PI.forall x : R, toRad (toDeg x) = xforall x : R, toRad (toDeg x) = xx:Rx * (plat * / plat) * (PI * / PI) = xx:Rx * 1 * 1 = xx:RPI <> 0x:Rplat <> 0x:RPI <> 0x:Rplat <> 0unfold plat; discrR. Qed.x:Rplat <> 0forall x y : R, toRad x = toRad y -> x = yforall x y : R, toRad x = toRad y -> x = yx, y:RH:x * PI * / plat = y * PI * / platPI * x = PI * yx, y:RH:x * PI * / plat = y * PI * / platPI <> 0x, y:RH:x * PI * / plat = y * PI * / platx * PI = y * PIx, y:RH:x * PI * / plat = y * PI * / platPI <> 0x, y:RH:x * PI * / plat = y * PI * / plat/ plat * (x * PI) = / plat * (y * PI)x, y:RH:x * PI * / plat = y * PI * / plat/ plat <> 0x, y:RH:x * PI * / plat = y * PI * / platPI <> 0x, y:RH:x * PI * / plat = y * PI * / plat/ plat <> 0x, y:RH:x * PI * / plat = y * PI * / platPI <> 0apply PI_neq0. Qed.x, y:RH:x * PI * / plat = y * PI * / platPI <> 0forall x : R, toDeg (toRad x) = xintro x; apply toRad_inj; rewrite (rad_deg (toRad x)); reflexivity. Qed. Definition sind (x:R) : R := sin (toRad x). Definition cosd (x:R) : R := cos (toRad x). Definition tand (x:R) : R := tan (toRad x).forall x : R, toDeg (toRad x) = xforall x : R, (sind x)² + (cosd x)² = 1intro x; unfold sind; unfold cosd; apply sin2_cos2. Qed. (***************************************************)forall x : R, (sind x)² + (cosd x)² = 1
Other properties
(***************************************************)forall a : R, 0 <= a -> a <= PI / 2 -> 0 <= sin_lb aforall a : R, 0 <= a -> a <= PI / 2 -> 0 <= sin_lb aa:RH:0 <= aH0:a <= PI / 2H1:0 < a0 <= sin_lb aa:RH:0 <= aH0:a <= PI / 2H1:0 = a \/ 0 > a0 <= sin_lb aa:RH:0 <= aH0:a <= PI / 2H1:0 = a \/ 0 > a0 <= sin_lb aa:RH:0 <= aH0:a <= PI / 2H1:0 = a \/ 0 > aH2:0 = a0 <= sin_lb aa:RH:0 <= aH0:a <= PI / 2H1:0 = a \/ 0 > aH2:0 > a0 <= sin_lb aa:RH:0 <= aH0:a <= PI / 2H1:0 = a \/ 0 > aH2:0 = a0 <= (-1) ^ 0 * (0 / INR (fact (2 * 0 + 1))) + (-1) ^ 1 * (0 / INR (fact (2 * 1 + 1))) + (-1) ^ 2 * (0 / INR (fact (2 * 2 + 1))) + (-1) ^ 3 * (0 / INR (fact (2 * 3 + 1)))a:RH:0 <= aH0:a <= PI / 2H1:0 = a \/ 0 > aH2:0 = a(2 * 3 + 1)%nat <> 0%nata:RH:0 <= aH0:a <= PI / 2H1:0 = a \/ 0 > aH2:0 = a(2 * 2 + 1)%nat <> 0%nata:RH:0 <= aH0:a <= PI / 2H1:0 = a \/ 0 > aH2:0 = a(2 * 1 + 1)%nat <> 0%nata:RH:0 <= aH0:a <= PI / 2H1:0 = a \/ 0 > aH2:0 = a(2 * 0 + 1)%nat <> 0%nata:RH:0 <= aH0:a <= PI / 2H1:0 = a \/ 0 > aH2:0 > a0 <= sin_lb aa:RH:0 <= aH0:a <= PI / 2H1:0 = a \/ 0 > aH2:0 = a(2 * 3 + 1)%nat <> 0%nata:RH:0 <= aH0:a <= PI / 2H1:0 = a \/ 0 > aH2:0 = a(2 * 2 + 1)%nat <> 0%nata:RH:0 <= aH0:a <= PI / 2H1:0 = a \/ 0 > aH2:0 = a(2 * 1 + 1)%nat <> 0%nata:RH:0 <= aH0:a <= PI / 2H1:0 = a \/ 0 > aH2:0 = a(2 * 0 + 1)%nat <> 0%nata:RH:0 <= aH0:a <= PI / 2H1:0 = a \/ 0 > aH2:0 > a0 <= sin_lb aa:RH:0 <= aH0:a <= PI / 2H1:0 = a \/ 0 > aH2:0 = a(2 * 2 + 1)%nat <> 0%nata:RH:0 <= aH0:a <= PI / 2H1:0 = a \/ 0 > aH2:0 = a(2 * 1 + 1)%nat <> 0%nata:RH:0 <= aH0:a <= PI / 2H1:0 = a \/ 0 > aH2:0 = a(2 * 0 + 1)%nat <> 0%nata:RH:0 <= aH0:a <= PI / 2H1:0 = a \/ 0 > aH2:0 > a0 <= sin_lb aa:RH:0 <= aH0:a <= PI / 2H1:0 = a \/ 0 > aH2:0 = a(2 * 1 + 1)%nat <> 0%nata:RH:0 <= aH0:a <= PI / 2H1:0 = a \/ 0 > aH2:0 = a(2 * 0 + 1)%nat <> 0%nata:RH:0 <= aH0:a <= PI / 2H1:0 = a \/ 0 > aH2:0 > a0 <= sin_lb aa:RH:0 <= aH0:a <= PI / 2H1:0 = a \/ 0 > aH2:0 = a(2 * 0 + 1)%nat <> 0%nata:RH:0 <= aH0:a <= PI / 2H1:0 = a \/ 0 > aH2:0 > a0 <= sin_lb aelim (Rlt_irrefl 0 (Rle_lt_trans 0 a 0 H H2)). Qed.a:RH:0 <= aH0:a <= PI / 2H1:0 = a \/ 0 > aH2:0 > a0 <= sin_lb a