Class ValNull (val : Type) := {
  null : val
}.Class ValNull (val : Type) := {
  null : val
}.Definition stack := A -> val.Definition stack_empty : stack := fun x => null.Definition stack_get (x : A) : stack -> val  := fun s => s x.Definition stack_add x v s : stack :=
    fun x' => if x' ?[ eq ] x then v else s x'.

Lemma stack_add_overwrite (s: stack) x v v': stack_add x v (stack_add x v' s) = stack_add x v s.