(* The integer bump / unbump operations. *)
Definition unbump h i := i - (h < i).

(* Specifications: *)
Lemma bumpK h : cancel (bump h) (unbump h).
Lemma neq_bump h i : h != bump h i.
Lemma unbumpKcond h i : bump h (unbump h i) = (i == h) + i.
Lemma unbumpK {h} : {in predC1 h, cancel (unbump h) (bump h)}.
Lemma unbumpS h i : unbump h.+1 i.+1 = (unbump h i).+1.
Lemma leq_bump2 h i j : (bump h i <= bump h j) = (i <= j).
(* The lift operations on ordinals; to avoid a messy dependent type, *)
(* unlift is a partial operation (returns an option).                *)
Lemma lift_subproof n h (i : 'I_n.-1) : bump h i < n.
Definition unlift n (h i : 'I_n) :=
omap (fun u : {j | j != h} => Ordinal (unlift_subproof u)) (insub i).