(************************************************************************)
(*         *      The Rocq Prover / The Rocq Development Team           *)
(*  v      *   INRIA, CNRS and contributors - Copyright 1999-2019       *)
(* <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)         *)
(************************************************************************)
(************************************************************************)
(** Proof that LPO and the excluded middle for negations imply the existence of least upper bounds for all non-empty and bounded subsets of the real numbers.  WARNING: this file is experimental and likely to change in future releases. *)
Local Open Scope ConstructiveReals.
Definition sig_forall_dec_T : Type
:= forall (P : nat -> Prop), (forall n, {P n} + {~P n})
-> {n | ~P n} + {forall n, P n}.
Definition sig_not_dec_T : Type := forall P : Prop, { ~~P } + { ~P }.
Definition is_upper_bound {R : ConstructiveReals}
(E:CRcarrier R -> Prop) (m:CRcarrier R)
:= forall x:CRcarrier R, E x -> x <= m.
Definition is_lub {R : ConstructiveReals}
(E:CRcarrier R -> Prop) (m:CRcarrier R) :=
is_upper_bound E m /\ (forall b:CRcarrier R, is_upper_bound E b -> m <= b).

Lemma is_upper_bound_epsilon :
forall {R : ConstructiveReals} (E:CRcarrier R -> Prop),
sig_forall_dec_T
-> sig_not_dec_T
-> (exists x:CRcarrier R, is_upper_bound E x)
-> { n:nat | is_upper_bound E (CR_of_Q R (Z.of_nat n # 1)) }.