Definition last_val v h := atval v (last_key h) h.

(* Specifications: *)
Lemma lastval0 v : last_val v Unit = v.
Lemma lastval_fresh v x h :
valid h -> last_val v (fresh h \-> x \+ h) = x.2.
Lemma lastvalUn v h1 h2 :
last_val v (h1 \+ h2) =
if valid (h1 \+ h2) then
if last_key h1 < last_key h2 then last_val v h2 else last_val v h1
else v.
Lemma lastval_freshUn v x h1 h2 :
valid h1 -> [pcm h2 <= h1] ->
last_val v (fresh h1 \-> x \+ h2) = x.2.