(***************************************)
(***************************************)
(* 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 lastkeyUn h1 h2 :
last_key (h1 \+ h2) =
if valid (h1 \+ h2) then maxn (last_key h1) (last_key h2) else 0.