(***************************************)
(***************************************)
(* Constructions of last_key and fresh *)
(***************************************)
(***************************************)
Variable A : Type.
Implicit Type h : natmap A.
Definition last_key h := last 0 (dom h).
Definition fresh h := (last_key h).+1.

Lemma max_lastkey h x :
x \in dom h -> {in dom h, forall y, y <= x} -> last_key h = x.