Lemma hr_to_NR_correct : ∏ (x : hr_commring), pr1 x (hr_to_NR x). Proof. intros X. generalize (pr1 (pr2 X)). apply hinhuniv. intros x. pattern X at 2. rewrite <- (setquotl0 _ X x). unfold hr_to_NR. rewrite setquotunivcomm. generalize (pr2 x). apply (pr1 (pr2 (pr2 X))). apply hinhpr. exists 0 ; simpl. change ((pr1 (pr1 x) + (pr2 (pr1 x) - pr1 (pr1 x)) + 0) = ((pr1 (pr1 x) - pr2 (pr1 x)) + pr2 (pr1 x) + 0))%NR. rewrite !isrunit_zero_plusNonnegativeReals. rewrite iscomm_plusNonnegativeReals, <- !maxNonnegativeReals_minus_plus. now apply iscomm_maxNonnegativeReals. Qed.
Require Import UniMath.Foundations.Preamble. Require Import UniMath.MoreFoundations.Orders. Require Import UniMath.MoreFoundations.Tactics. Require Import UniMath.OrderTheory.Lattice.Lattice. Require Import UniMath.RealNumbers.Prelim. Require Import UniMath.RealNumbers.Sets. Require Import UniMath.RealNumbers.NonnegativeRationals.