Lemma minusNonnegativeRationals_lecompat_r : ∏ k x y : NonnegativeRationals, x <= y -> k - y <= k - x. Proof. intros k x y Hxy. generalize (isdecrel_leNonnegativeRationals y k) ; apply sumofmaps ; intros Hky. - apply_pr2 (plusNonnegativeRationals_lecompat_r y). rewrite minusNonnegativeRationals_plus_r, minusNonnegativeRationals_plus_exchange, iscomm_plusNonnegativeRationals, <- minusNonnegativeRationals_plus_exchange. + apply plusNonnegativeRationals_le_l. + exact Hxy. + apply istrans_leNonnegativeRationals with y. * exact Hxy. * exact Hky. + exact Hky. - rewrite minusNonnegativeRationals_eq_zero. + now apply isnonnegative_NonnegativeRationals. + now apply lt_leNonnegativeRationals, notge_ltNonnegativeRationals. Qed.
Require Import UniMath.MoreFoundations.Tactics. Require Import UniMath.MoreFoundations.PartA. Require Import UniMath.MoreFoundations.Sets. Require Import UniMath.MoreFoundations.Orders. Require Import UniMath.RealNumbers.Sets. Require Import UniMath.RealNumbers.Fields. Require Import UniMath.OrderTheory.Lattice.Lattice. Require Import UniMath.RealNumbers.Prelim.