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) *)
(************************************************************************)
Properties of Square Root Function
Require Import NAxioms NSub NZSqrt. Module NSqrtProp (Import A : NAxiomsSig')(Import B : NSubProp A). Module Import Private_NZSqrt := Nop <+ NZSqrtProp A A B. Ltac auto' := trivial; try rewrite <- neq_0_lt_0; auto using le_0_l. Ltac wrap l := intros; apply l; auto'.
We redefine NZSqrt's results, without the non-negative hyps
forall a : t, √ a * √ a <= a < S √ a * S √ awrap sqrt_spec. Qed. Definition sqrt_unique : forall a b, b*b<=a<(S b)*(S b) -> √a == b := sqrt_unique.forall a : t, √ a * √ a <= a < S √ a * S √ aforall a : t, √ (a * a) == awrap sqrt_square. Qed. Definition sqrt_le_mono : forall a b, a<=b -> √a <= √b := sqrt_le_mono. Definition sqrt_lt_cancel : forall a b, √a < √b -> a < b := sqrt_lt_cancel.forall a : t, √ (a * a) == aforall a b : t, b * b <= a <-> b <= √ awrap sqrt_le_square. Qed.forall a b : t, b * b <= a <-> b <= √ aforall a b : t, a < b * b <-> √ a < bwrap sqrt_lt_square. Qed. Definition sqrt_0 := sqrt_0. Definition sqrt_1 := sqrt_1. Definition sqrt_2 := sqrt_2. Definition sqrt_lt_lin : forall a, 1<a -> √a<a := sqrt_lt_lin.forall a b : t, a < b * b <-> √ a < bforall a : t, √ a <= awrap sqrt_le_lin. Qed. Definition sqrt_mul_below : forall a b, √a * √b <= √(a*b) := sqrt_mul_below.forall a : t, √ a <= aforall a b : t, √ (a * b) < S √ a * S √ bwrap sqrt_mul_above. Qed.forall a b : t, √ (a * b) < S √ a * S √ bforall a : t, √ (S a) <= S √ awrap sqrt_succ_le. Qed.forall a : t, √ (S a) <= S √ aforall a : t, √ (S a) == S √ a \/ √ (S a) == √ awrap sqrt_succ_or. Qed. Definition sqrt_add_le : forall a b, √(a+b) <= √a + √b := sqrt_add_le.forall a : t, √ (S a) == S √ a \/ √ (S a) == √ aforall a b : t, √ a + √ b <= √ (2 * (a + b))wrap add_sqrt_le. Qed.forall a b : t, √ a + √ b <= √ (2 * (a + b))
For the moment, we include stuff about sqrt_up with patching them.
Include NZSqrtUpProp A A B Private_NZSqrt. End NSqrtProp.