Section Monoid.
Variable M : Set.
Variable MO : monoid M.
Let uM := u _ MO.
Let oM := o _ MO.
Inductive Stack : Set :=
| emptystack : Stack
| push : M -> Stack -> Stack.
Definition top (s : Stack) :=
match s return M with
| emptystack => uM
| push m _ => m
end.
Definition pop (s : Stack) :=
match s return Stack with
| emptystack => emptystack
| push _ r => r
end.
(* configurations of the abstract machine *)
(******************************************)
Record Config : Set := config {config_X : M; config_S : Stack}.

Lemma Config_inv :
forall (a a' : M) (s s' : Stack),
a = a' -> s = s' -> config a s = config a' s'.