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_fresh f v : valid f -> last_key (f \+ fresh f \\-> v) = fresh f.
End FreshLastKey.