From Coq Require Export Reals.
Definition sup := completeness.
Open Scope R_scope.
Definition is_lower_bound (E:R->Prop) (m:R) :=
forall x:R, E x -> x >= m.
Definition lower_bound (E:R->Prop) :=
exists m:R, is_lower_bound E m.
Definition is_glb (E:R->Prop) (m:R) :=
is_lower_bound E m /\ (forall b:R, is_lower_bound E b -> b <= m).
Ltac cut_by_lra H := cut H; [ lra | ].
Definition inf: forall E:R->Prop, lower_bound E -> (exists x:R, E x) ->
{ m:R | is_glb E m }.
unshelve refine (fun E Hlb Hinh =>
let H:=_ in let H0:=_ in
exist _ (- (proj1_sig (sup (Im E Ropp) H H0))) _).
- destruct Hlb as [m].
exists (-m).
red. intros.
destruct H0.
rewrite H1.
auto with real.
- destruct Hinh as [x].
now exists (-x), x.
- destruct sup as [m].
simpl.
split; red; intros.
+ cut_by_lra (-x <= m).
apply i.
now exists x.
+ cut_by_lra (m <= -b).
apply i.
red. intros.
cut_by_lra (-x >= b).
apply H1.
destruct H2.
rewrite H3.
now replace (--x) with x by ring.
Defined.

Lemma gt_minus_epsilon_ge: forall x y:R,
(forall eps:R, eps > 0 -> x > y - eps) -> x >= y.