(************************************************************************)
(*         *      The Rocq Prover / The Rocq Development Team           *)
(*  v      *         Copyright INRIA, CNRS and contributors             *)
(* <O___,, * (see version control and CREDITS file for authors & dates) *)
(*   \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 CMorphisms.
(*****************************************************************************)
(** * Q Auxiliary Lemmas                                                     *)
(*****************************************************************************)
(* Fixpoint PosPow2_nat (n : nat) : positive := match n with | O => 1 | S n' => 2 * (PosPow2_nat n') end.  Local Lemma Qpower_2_neg_eq_pospow_inv : forall n : nat, (2 ^ (- Z.of_nat n) == 1#(PosPow2_nat n)%positive)%Q. *)
Local Lemma Qpower_2_neg_eq_natpow_inv : forall n : nat,
(2 ^ (- Z.of_nat n) == 1#(Pos.of_nat (2^n)%nat))%Q.
Local Lemma Qpower_2_invneg_le_pow : forall n : Z,
(1 # Pos.of_nat (2 ^ Z.to_nat (- n)) <= 2 ^ n)%Q.
Local Lemma Qpower_2_neg_le_one : forall n : nat,
(2 ^ (- Z.of_nat n) <= 1)%Q.
(*****************************************************************************)
(** * Dedekind cuts                                                          *)
(*****************************************************************************)
(** ** Definition *)
(** Classical Dedekind reals. With the 3 logical axioms funext, sig_forall_dec and sig_not_dec, the lower cuts defined as functions Q -> bool have all the classical properties of the real numbers.  We could prove operations and theorems about them directly, but instead we notice that they are a quotient of the constructive Cauchy reals, from which they inherit many properties. *)

Axiom sig_not_dec : forall P : Prop, { ~~P } + { ~P }.
Definition isLowerCut (f : Q -> bool) : Prop
:= (forall q r:Q, Qle q r -> f r = true -> f q = true) (* interval *)
/\ ~(forall q:Q, f q = true) (* avoid positive infinity *)
/\ ~(forall q:Q, f q = false) (* avoid negative infinity *)
/\ (forall q:Q, f q = true -> ~(forall r:Q, Qle r q \/ f r = false)).