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)²

forall x : R, x² = (- x)²
intros; ring_Rsqr. Qed.

forall x y : R, (x * y)² = x² * y²

forall x y : R, (x * y)² = x² * y²
intros; ring_Rsqr. Qed.

forall x y : R, (x + y)² = x² + y² + 2 * x * y

forall x y : R, (x + y)² = x² + y² + 2 * x * y
intros; ring_Rsqr. Qed.

forall x y : R, (x - y)² = x² + y² - 2 * x * y

forall x y : R, (x - y)² = x² + y² - 2 * x * y
intros; ring_Rsqr. Qed.

forall x y : R, (x - y)² = (y - x)²

forall x y : R, (x - y)² = (y - x)²
intros; ring_Rsqr. Qed.

1² = 1

1² = 1
ring_Rsqr. Qed.

forall x : R, 0 < x² -> x <> 0

forall x : R, 0 < x² -> x <> 0
intros; red; intro; rewrite H0 in H; rewrite Rsqr_0 in H; elim (Rlt_irrefl 0 H). Qed.

forall x : R, x <> 0 -> 0 < x²

forall 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 y : R, y <> 0 -> (x / y)² = x² / y²

forall x y : R, y <> 0 -> (x / y)² = x² / y²
x, y:R
H:y <> 0

x / y * (x / y) = x * x / (y * y)
x, y:R
H:y <> 0

x * / y * (x * / y) = x * x * / (y * y)
x, y:R
H:y <> 0

x * / y * (x * / y) = x * x * (/ y * / y)
x, y:R
H:y <> 0
y <> 0
x, y:R
H:y <> 0
y <> 0
x, y:R
H:y <> 0

x * (/ y * (x * / y)) = x * (x * (/ y * / y))
x, y:R
H:y <> 0
y <> 0
x, y:R
H:y <> 0
y <> 0
x, y:R
H:y <> 0

/ y * (x * / y) = x * (/ y * / y)
x, y:R
H:y <> 0
y <> 0
x, y:R
H:y <> 0
y <> 0
x, y:R
H:y <> 0

x * / y * / y = x * (/ y * / y)
x, y:R
H:y <> 0
y <> 0
x, y:R
H:y <> 0
y <> 0
x, y:R
H:y <> 0

x * (/ y * / y) = x * (/ y * / y)
x, y:R
H:y <> 0
y <> 0
x, y:R
H:y <> 0
y <> 0
x, y:R
H:y <> 0

/ y * / y = / y * / y
x, y:R
H:y <> 0
y <> 0
x, y:R
H:y <> 0
y <> 0
x, y:R
H:y <> 0

y <> 0
x, y:R
H:y <> 0
y <> 0
x, y:R
H:y <> 0

y <> 0
assumption. Qed.

forall x : R, x² = 0 -> x = 0

forall x : R, x² = 0 -> x = 0
unfold Rsqr; intros; generalize (Rmult_integral x x H); intro; elim H0; intro; assumption. 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 a b : R, (a + b) * (a - b) = a² - b²
intros; ring_Rsqr. Qed.

forall x y : R, x² <= y² -> 0 <= x -> 0 <= y -> x <= y

forall x y : R, x² <= y² -> 0 <= x -> 0 <= y -> x <= y
intros; 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 <= y -> x <= y

forall x y : R, x² <= y² -> 0 <= y -> x <= y
intros; 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 <= x -> 0 <= y -> x² <= y²

forall 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 < y
intros; 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² < y²

forall 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 <= y -> - y <= x

forall x y : R, x² <= y² -> 0 <= y -> - y <= x
x, y:R
H:x² <= y²
H0:0 <= y
Hlt:x < 0

- y <= x
x, y:R
H:x² <= y²
H0:0 <= y
Hle:x >= 0
- y <= x
x, y:R
H:x² <= y²
H0:0 <= y
Hle:x >= 0

- y <= x
apply Rle_trans with 0; [ rewrite <- Ropp_0; apply Ropp_ge_le_contravar; apply Rle_ge; assumption | apply Rge_le; assumption ]. Qed.

forall 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:R
H:- y <= x
H0:x <= y
H1:0 <= y
Hlt:x < 0

x² <= y²
x, y:R
H:- y <= x
H0:x <= y
H1:0 <= y
Hle:x >= 0
x² <= y²
x, y:R
H:- y <= x
H0:x <= y
H1:0 <= y
Hle:x >= 0

x² <= y²
apply Rge_le in Hle; apply Rsqr_incr_1; assumption. Qed.

forall x y : R, - y <= x -> x <= y -> x² <= y²

forall x y : R, - y <= x -> x <= y -> x² <= y²
x, y:R
H:- y <= x
H0:x <= y
Hlt:x < 0

x² <= y²
x, y:R
H:- y <= x
H0:x <= y
Hle:x >= 0
x² <= y²
x, y:R
H:- x <= y
H0:x <= y
Hlt:0 <= - x

x² <= y²
x, y:R
H:- y <= x
H0:x <= y
Hle:x >= 0
x² <= y²
x, y:R
H:- x <= y
H0:x <= y
Hlt:0 <= - x
H1:0 <= y

x² <= y²
x, y:R
H:- y <= x
H0:x <= y
Hle:x >= 0
x² <= y²
x, y:R
H:- y <= x
H0:x <= y
Hle:x >= 0

x² <= y²
x, y:R
H:- y <= x
H0:x <= y
Hle:0 <= x
H1:0 <= y

x² <= y²
apply Rsqr_incr_1; assumption. Qed.

forall x : R, x² = (Rabs x)²

forall x : R, x² = (Rabs x)²
intro; unfold Rabs; case (Rcase_abs x); intro; [ apply Rsqr_neg | reflexivity ]. Qed.

forall x y : R, x² <= y² -> Rabs x <= Rabs y

forall x y : R, x² <= y² -> Rabs x <= Rabs y
intros; apply Rsqr_incr_0; repeat rewrite <- Rsqr_abs; [ assumption | apply Rabs_pos | apply Rabs_pos ]. Qed.

forall x y : R, Rabs x <= Rabs y -> x² <= y²

forall 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, x² < y² -> Rabs x < Rabs y

forall x y : R, x² < y² -> Rabs x < Rabs y
intros; apply Rsqr_incrst_0; repeat rewrite <- Rsqr_abs; [ assumption | apply Rabs_pos | apply Rabs_pos ]. Qed.

forall x y : R, Rabs x < Rabs y -> x² < y²

forall 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, 0 <= x -> 0 <= y -> x² = y² -> x = y

forall x y : R, 0 <= x -> 0 <= y -> x² = y² -> x = y
intros; 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, x² = y² -> Rabs x = Rabs y

forall x y : R, x² = y² -> Rabs x = Rabs y
x, y:R
H:x² = y²
Hltx:x < 0
Hlty:y < 0

- x = - y
x, y:R
H:x² = y²
Hltx:x < 0
Hgey:y >= 0
- x = y
x, y:R
H:x² = y²
Hgex:x >= 0
Hlty:y < 0
x = - y
x, y:R
H:x² = y²
Hgex:x >= 0
Hgey:y >= 0
x = y
x, y:R
H:x² = y²
Hltx:x < 0
Hgey:y >= 0

- x = y
x, y:R
H:x² = y²
Hgex:x >= 0
Hlty:y < 0
x = - y
x, y:R
H:x² = y²
Hgex:x >= 0
Hgey:y >= 0
x = y
x, y:R
H:x² = y²
Hgex:x >= 0
Hlty:y < 0

x = - y
x, y:R
H:x² = y²
Hgex:x >= 0
Hgey:y >= 0
x = y
x, y:R
H:x² = y²
Hgex:x >= 0
Hgey:y >= 0

x = y
apply Rsqr_inj; auto using Rge_le. Qed.

forall x y : R, Rabs x = Rabs y -> x² = y²

forall x y : R, Rabs x = Rabs y -> x² = y²
x, y:R
H:Rabs x = Rabs y

(Rabs x)² = (Rabs y)² -> x² = y²
x, y:R
H:Rabs x = Rabs y
(Rabs x)² = (Rabs y)²
x, y:R
H:Rabs x = Rabs y

(Rabs x)² = (Rabs y)²
rewrite H; reflexivity. Qed.

forall x y z : R, 0 <= z -> x² + y² <= z² -> - z <= x <= z /\ - z <= y <= z

forall x y z : R, 0 <= z -> x² + y² <= z² -> - z <= x <= z /\ - z <= y <= z
intros; 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, x² + y² < z² -> Rabs x < Rabs z /\ Rabs y < Rabs z

forall x y z : R, x² + y² < z² -> Rabs x < Rabs z /\ Rabs y < Rabs z
intros; 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 z

forall x y z : R, x² + y² <= z² -> Rabs x <= Rabs z /\ Rabs y <= Rabs z
intros; 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 : R, x <> 0 -> (/ x)² = / x²

forall x : R, x <> 0 -> (/ x)² = / x²
x:R
H:x <> 0

/ x * / x = / (x * x)
rewrite Rinv_mult_distr; try reflexivity || assumption. Qed.

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:nonzeroreal
b, c, x:R

a * x² + b * x + c = a * (x + b / (2 * a))² + (4 * a * c - b²) / (4 * a)
a:nonzeroreal
b, c, x:R

a * (x * x) + b * x + c = a * ((x + b / (2 * a)) * (x + b / (2 * a))) + (4 * a * c - b * b) / (4 * a)
a:nonzeroreal
b, c, x:R

a <> 0
apply a. Qed.

forall x y : R, x² = y² -> x = y \/ x = - y

forall x y : R, x² = y² -> x = y \/ x = - y
x, y:R
H:x * x = y * y

(x - y) * (x + y) = 0 -> x = y \/ x = - y
x, y:R
H:x * x = y * y
(x - y) * (x + y) = - (y * y) + x * x
x, y:R
H:x * x = y * y
H0:(x - y) * (x + y) = 0
H1:x - y = 0 \/ x + y = 0
H2:x - y = 0

x = y \/ x = - y
x, y:R
H:x * x = y * y
H0:(x - y) * (x + y) = 0
H1:x - y = 0 \/ x + y = 0
H2:x + y = 0
x = y \/ x = - y
x, y:R
H:x * x = y * y
(x - y) * (x + y) = - (y * y) + x * x
x, y:R
H:x * x = y * y
H0:(x - y) * (x + y) = 0
H1:x - y = 0 \/ x + y = 0
H2:x + y = 0

x = y \/ x = - y
x, y:R
H:x * x = y * y
(x - y) * (x + y) = - (y * y) + x * x
x, y:R
H:x * x = y * y

(x - y) * (x + y) = - (y * y) + x * x
ring. Qed.