Lemma minusNonnegativeRationals_ltcompat_r: ∏ x y z : NonnegativeRationals, x < y -> x < z -> z - y < z - x. Proof. intros x y z Hxy Hxz. generalize (isdecrel_leNonnegativeRationals y z) ; apply sumofmaps ; intros Hky. - apply_pr2 (plusNonnegativeRationals_ltcompat_r y). rewrite minusNonnegativeRationals_plus_r, minusNonnegativeRationals_plus_exchange, iscomm_plusNonnegativeRationals, <- minusNonnegativeRationals_plus_exchange. + pattern z at 1 ; rewrite <- (islunit_zeroNonnegativeRationals z). apply plusNonnegativeRationals_ltcompat_r. now apply (pr1 (ispositive_minusNonnegativeRationals _ _)), Hxy. + now apply lt_leNonnegativeRationals, Hxy. + now apply lt_leNonnegativeRationals, Hxz. + exact Hky. - rewrite minusNonnegativeRationals_eq_zero. + now apply (pr1 (ispositive_minusNonnegativeRationals _ _)), Hxz. + now apply lt_leNonnegativeRationals, notge_ltNonnegativeRationals, Hky. 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.