Lemma prev_stn {n : nat} (i : ⟦ n ⟧%stn) (p : i > 0) : ∑ j : ⟦ n ⟧%stn, S j = i. Proof. destruct (prev_nat i p) as [j Sj_i]. use tpair. - exists j. refine (istransnatlth _ _ _ (natgthsnn j) _ ). rewrite Sj_i. apply (pr2 i). - exact Sj_i. Defined.
Require Import UniMath.Foundations.All. Require Import UniMath.MoreFoundations.All. Require Import UniMath.Combinatorics.Maybe. Require Import UniMath.Combinatorics.StandardFiniteSets. Require Import UniMath.Algebra.Domains_and_Fields. Require Import UniMath.Algebra.RigsAndRings.