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 Rbasic_fun. Local Open Scope R_scope. (****************************************************)
Rsqr : some results
(****************************************************) Ltac ring_Rsqr := unfold Rsqr; ring.forall x : R, x² = (- x)²intros; ring_Rsqr. Qed.forall x : R, x² = (- x)²forall x y : R, (x * y)² = x² * y²intros; ring_Rsqr. Qed.forall x y : R, (x * y)² = x² * y²forall x y : R, (x + y)² = x² + y² + 2 * x * yintros; ring_Rsqr. Qed.forall x y : R, (x + y)² = x² + y² + 2 * x * yforall x y : R, (x - y)² = x² + y² - 2 * x * yintros; ring_Rsqr. Qed.forall x y : R, (x - y)² = x² + y² - 2 * x * yforall x y : R, (x - y)² = (y - x)²intros; ring_Rsqr. Qed.forall x y : R, (x - y)² = (y - x)²1² = 1ring_Rsqr. Qed.1² = 1forall x : R, 0 < x² -> x <> 0intros; red; intro; rewrite H0 in H; rewrite Rsqr_0 in H; elim (Rlt_irrefl 0 H). Qed.forall x : R, 0 < x² -> x <> 0forall x : R, x <> 0 -> 0 < x²intros; case (Rtotal_order 0 x); intro; [ unfold Rsqr; apply Rmult_lt_0_compat; assumption | elim H0; intro; [ elim H; symmetry ; exact H1 | rewrite Rsqr_neg; generalize (Ropp_lt_gt_contravar x 0 H1); rewrite Ropp_0; intro; unfold Rsqr; apply Rmult_lt_0_compat; assumption ] ]. Qed.forall x : R, x <> 0 -> 0 < x²forall x y : R, y <> 0 -> (x / y)² = x² / y²forall x y : R, y <> 0 -> (x / y)² = x² / y²x, y:RH:y <> 0x / y * (x / y) = x * x / (y * y)x, y:RH:y <> 0x * / y * (x * / y) = x * x * / (y * y)x, y:RH:y <> 0x * / y * (x * / y) = x * x * (/ y * / y)x, y:RH:y <> 0y <> 0x, y:RH:y <> 0y <> 0x, y:RH:y <> 0x * (/ y * (x * / y)) = x * (x * (/ y * / y))x, y:RH:y <> 0y <> 0x, y:RH:y <> 0y <> 0x, y:RH:y <> 0/ y * (x * / y) = x * (/ y * / y)x, y:RH:y <> 0y <> 0x, y:RH:y <> 0y <> 0x, y:RH:y <> 0x * / y * / y = x * (/ y * / y)x, y:RH:y <> 0y <> 0x, y:RH:y <> 0y <> 0x, y:RH:y <> 0x * (/ y * / y) = x * (/ y * / y)x, y:RH:y <> 0y <> 0x, y:RH:y <> 0y <> 0x, y:RH:y <> 0/ y * / y = / y * / yx, y:RH:y <> 0y <> 0x, y:RH:y <> 0y <> 0x, y:RH:y <> 0y <> 0x, y:RH:y <> 0y <> 0assumption. Qed.x, y:RH:y <> 0y <> 0forall x : R, x² = 0 -> x = 0unfold Rsqr; intros; generalize (Rmult_integral x x H); intro; elim H0; intro; assumption. Qed.forall x : R, x² = 0 -> x = 0forall a b : R, (a - b) * (a + b) = a² - b²intros; ring_Rsqr. Qed.forall a b : R, (a - b) * (a + b) = a² - b²forall a b : R, (a + b) * (a - b) = a² - b²intros; ring_Rsqr. Qed.forall a b : R, (a + b) * (a - b) = a² - b²forall x y : R, x² <= y² -> 0 <= x -> 0 <= y -> x <= yintros; destruct (Rle_dec x y) as [Hle|Hnle]; [ assumption | cut (y < x); [ intro; unfold Rsqr in H; generalize (Rmult_le_0_lt_compat y x y x H1 H1 H2 H2); intro; generalize (Rle_lt_trans (x * x) (y * y) (x * x) H H3); intro; elim (Rlt_irrefl (x * x) H4) | auto with real ] ]. Qed.forall x y : R, x² <= y² -> 0 <= x -> 0 <= y -> x <= yforall x y : R, x² <= y² -> 0 <= y -> x <= yintros; destruct (Rle_dec x y) as [Hle|Hnle]; [ assumption | cut (y < x); [ intro; unfold Rsqr in H; generalize (Rmult_le_0_lt_compat y x y x H0 H0 H1 H1); intro; generalize (Rle_lt_trans (x * x) (y * y) (x * x) H H2); intro; elim (Rlt_irrefl (x * x) H3) | auto with real ] ]. Qed.forall x y : R, x² <= y² -> 0 <= y -> x <= yforall x y : R, x <= y -> 0 <= x -> 0 <= y -> x² <= y²intros; unfold Rsqr; apply Rmult_le_compat; assumption. Qed.forall x y : R, x <= y -> 0 <= x -> 0 <= y -> x² <= y²forall x y : R, x² < y² -> 0 <= x -> 0 <= y -> x < yintros; case (Rtotal_order x y); intro; [ assumption | elim H2; intro; [ rewrite H3 in H; elim (Rlt_irrefl (Rsqr y) H) | generalize (Rmult_le_0_lt_compat y x y x H1 H1 H3 H3); intro; unfold Rsqr in H; generalize (Rlt_trans (x * x) (y * y) (x * x) H H4); intro; elim (Rlt_irrefl (x * x) H5) ] ]. Qed.forall x y : R, x² < y² -> 0 <= x -> 0 <= y -> x < yforall x y : R, x < y -> 0 <= x -> 0 <= y -> x² < y²intros; unfold Rsqr; apply Rmult_le_0_lt_compat; assumption. Qed.forall x y : R, x < y -> 0 <= x -> 0 <= y -> x² < y²forall x y : R, x² <= y² -> 0 <= y -> - y <= xforall x y : R, x² <= y² -> 0 <= y -> - y <= xx, y:RH:x² <= y²H0:0 <= yHlt:x < 0- y <= xx, y:RH:x² <= y²H0:0 <= yHle:x >= 0- y <= xapply Rle_trans with 0; [ rewrite <- Ropp_0; apply Ropp_ge_le_contravar; apply Rle_ge; assumption | apply Rge_le; assumption ]. Qed.x, y:RH:x² <= y²H0:0 <= yHle:x >= 0- y <= xforall x y : R, - y <= x -> x <= y -> 0 <= y -> x² <= y²forall x y : R, - y <= x -> x <= y -> 0 <= y -> x² <= y²x, y:RH:- y <= xH0:x <= yH1:0 <= yHlt:x < 0x² <= y²x, y:RH:- y <= xH0:x <= yH1:0 <= yHle:x >= 0x² <= y²apply Rge_le in Hle; apply Rsqr_incr_1; assumption. Qed.x, y:RH:- y <= xH0:x <= yH1:0 <= yHle:x >= 0x² <= y²forall x y : R, - y <= x -> x <= y -> x² <= y²forall x y : R, - y <= x -> x <= y -> x² <= y²x, y:RH:- y <= xH0:x <= yHlt:x < 0x² <= y²x, y:RH:- y <= xH0:x <= yHle:x >= 0x² <= y²x, y:RH:- x <= yH0:x <= yHlt:0 <= - xx² <= y²x, y:RH:- y <= xH0:x <= yHle:x >= 0x² <= y²x, y:RH:- x <= yH0:x <= yHlt:0 <= - xH1:0 <= yx² <= y²x, y:RH:- y <= xH0:x <= yHle:x >= 0x² <= y²x, y:RH:- y <= xH0:x <= yHle:x >= 0x² <= y²apply Rsqr_incr_1; assumption. Qed.x, y:RH:- y <= xH0:x <= yHle:0 <= xH1:0 <= yx² <= y²forall x : R, x² = (Rabs x)²intro; unfold Rabs; case (Rcase_abs x); intro; [ apply Rsqr_neg | reflexivity ]. Qed.forall x : R, x² = (Rabs x)²forall x y : R, x² <= y² -> Rabs x <= Rabs yintros; apply Rsqr_incr_0; repeat rewrite <- Rsqr_abs; [ assumption | apply Rabs_pos | apply Rabs_pos ]. Qed.forall x y : R, x² <= y² -> Rabs x <= Rabs yforall x y : R, Rabs x <= Rabs y -> x² <= y²intros; rewrite (Rsqr_abs x); rewrite (Rsqr_abs y); apply (Rsqr_incr_1 (Rabs x) (Rabs y) H (Rabs_pos x) (Rabs_pos y)). Qed.forall x y : R, Rabs x <= Rabs y -> x² <= y²forall x y : R, x² < y² -> Rabs x < Rabs yintros; apply Rsqr_incrst_0; repeat rewrite <- Rsqr_abs; [ assumption | apply Rabs_pos | apply Rabs_pos ]. Qed.forall x y : R, x² < y² -> Rabs x < Rabs yforall x y : R, Rabs x < Rabs y -> x² < y²intros; rewrite (Rsqr_abs x); rewrite (Rsqr_abs y); apply (Rsqr_incrst_1 (Rabs x) (Rabs y) H (Rabs_pos x) (Rabs_pos y)). Qed.forall x y : R, Rabs x < Rabs y -> x² < y²forall x y : R, 0 <= x -> 0 <= y -> x² = y² -> x = yintros; generalize (Rle_le_eq (Rsqr x) (Rsqr y)); intro; elim H2; intros _ H3; generalize (H3 H1); intro; elim H4; intros; apply Rle_antisym; apply Rsqr_incr_0; assumption. Qed.forall x y : R, 0 <= x -> 0 <= y -> x² = y² -> x = yforall x y : R, x² = y² -> Rabs x = Rabs yforall x y : R, x² = y² -> Rabs x = Rabs yx, y:RH:x² = y²Hltx:x < 0Hlty:y < 0- x = - yx, y:RH:x² = y²Hltx:x < 0Hgey:y >= 0- x = yx, y:RH:x² = y²Hgex:x >= 0Hlty:y < 0x = - yx, y:RH:x² = y²Hgex:x >= 0Hgey:y >= 0x = yx, y:RH:x² = y²Hltx:x < 0Hgey:y >= 0- x = yx, y:RH:x² = y²Hgex:x >= 0Hlty:y < 0x = - yx, y:RH:x² = y²Hgex:x >= 0Hgey:y >= 0x = yx, y:RH:x² = y²Hgex:x >= 0Hlty:y < 0x = - yx, y:RH:x² = y²Hgex:x >= 0Hgey:y >= 0x = yapply Rsqr_inj; auto using Rge_le. Qed.x, y:RH:x² = y²Hgex:x >= 0Hgey:y >= 0x = yforall x y : R, Rabs x = Rabs y -> x² = y²forall x y : R, Rabs x = Rabs y -> x² = y²x, y:RH:Rabs x = Rabs y(Rabs x)² = (Rabs y)² -> x² = y²x, y:RH:Rabs x = Rabs y(Rabs x)² = (Rabs y)²rewrite H; reflexivity. Qed.x, y:RH:Rabs x = Rabs y(Rabs x)² = (Rabs y)²forall x y z : R, 0 <= z -> x² + y² <= z² -> - z <= x <= z /\ - z <= y <= zintros; generalize (plus_le_is_le (Rsqr x) (Rsqr y) (Rsqr z) (Rle_0_sqr y) H0); rewrite Rplus_comm in H0; generalize (plus_le_is_le (Rsqr y) (Rsqr x) (Rsqr z) (Rle_0_sqr x) H0); intros; split; [ split; [ apply Rsqr_neg_pos_le_0; assumption | apply Rsqr_incr_0_var; assumption ] | split; [ apply Rsqr_neg_pos_le_0; assumption | apply Rsqr_incr_0_var; assumption ] ]. Qed.forall x y z : R, 0 <= z -> x² + y² <= z² -> - z <= x <= z /\ - z <= y <= zforall x y z : R, x² + y² < z² -> Rabs x < Rabs z /\ Rabs y < Rabs zintros; split; [ generalize (plus_lt_is_lt (Rsqr x) (Rsqr y) (Rsqr z) (Rle_0_sqr y) H); intro; apply Rsqr_lt_abs_0; assumption | rewrite Rplus_comm in H; generalize (plus_lt_is_lt (Rsqr y) (Rsqr x) (Rsqr z) (Rle_0_sqr x) H); intro; apply Rsqr_lt_abs_0; assumption ]. Qed.forall x y z : R, x² + y² < z² -> Rabs x < Rabs z /\ Rabs y < Rabs zforall x y z : R, x² + y² <= z² -> Rabs x <= Rabs z /\ Rabs y <= Rabs zintros; split; [ generalize (plus_le_is_le (Rsqr x) (Rsqr y) (Rsqr z) (Rle_0_sqr y) H); intro; apply Rsqr_le_abs_0; assumption | rewrite Rplus_comm in H; generalize (plus_le_is_le (Rsqr y) (Rsqr x) (Rsqr z) (Rle_0_sqr x) H); intro; apply Rsqr_le_abs_0; assumption ]. Qed.forall x y z : R, x² + y² <= z² -> Rabs x <= Rabs z /\ Rabs y <= Rabs zforall x : R, x <> 0 -> (/ x)² = / x²forall x : R, x <> 0 -> (/ x)² = / x²rewrite Rinv_mult_distr; try reflexivity || assumption. Qed.x:RH:x <> 0/ x * / x = / (x * x)forall (a : nonzeroreal) (b c x : R), a * x² + b * x + c = a * (x + b / (2 * a))² + (4 * a * c - b²) / (4 * a)forall (a : nonzeroreal) (b c x : R), a * x² + b * x + c = a * (x + b / (2 * a))² + (4 * a * c - b²) / (4 * a)a:nonzerorealb, c, x:Ra * x² + b * x + c = a * (x + b / (2 * a))² + (4 * a * c - b²) / (4 * a)a:nonzerorealb, c, x:Ra * (x * x) + b * x + c = a * ((x + b / (2 * a)) * (x + b / (2 * a))) + (4 * a * c - b * b) / (4 * a)apply a. Qed.a:nonzerorealb, c, x:Ra <> 0forall x y : R, x² = y² -> x = y \/ x = - yforall x y : R, x² = y² -> x = y \/ x = - yx, y:RH:x * x = y * y(x - y) * (x + y) = 0 -> x = y \/ x = - yx, y:RH:x * x = y * y(x - y) * (x + y) = - (y * y) + x * xx, y:RH:x * x = y * yH0:(x - y) * (x + y) = 0H1:x - y = 0 \/ x + y = 0H2:x - y = 0x = y \/ x = - yx, y:RH:x * x = y * yH0:(x - y) * (x + y) = 0H1:x - y = 0 \/ x + y = 0H2:x + y = 0x = y \/ x = - yx, y:RH:x * x = y * y(x - y) * (x + y) = - (y * y) + x * xx, y:RH:x * x = y * yH0:(x - y) * (x + y) = 0H1:x - y = 0 \/ x + y = 0H2:x + y = 0x = y \/ x = - yx, y:RH:x * x = y * y(x - y) * (x + y) = - (y * y) + x * xring. Qed.x, y:RH:x * x = y * y(x - y) * (x + y) = - (y * y) + x * x