(* as it is dynamically inferred by simpl *)
Arguments minus !n / m.
simpl.
match goal with |- (match y with O => S x | S _ => _ end = 0) => idtac end.
Abort.
(* we avoid exposing a match *)
Arguments minus n m : simpl nomatch.
simpl.
match goal with |- (0 = 0) => idtac end.
Abort.
simpl.
match goal with |- (S x - y = 0) => idtac end.
Abort.

Lemma foo x y : S (S x) - (S (match y with O => O | S z => S z end)) = 0.