End Keys.
(* Last_key and Fresh are constructs that work *)
(* for any union map with integer keys *)
(* Should be developed more generally for any union map class *)
(* with a proof that key U = nat, but I can't bother right now *)
Section FreshLastKey.
Variable V : Type.
Implicit Type f : union_map [ordType of nat] V.
Definition last_key f := last 0 (dom f).

Lemma last_keyfUn f1 f2 :
valid (f1 \+ f2) -> last_key f1 <= last_key (f1 \+ f2).