Proof using.
handler_unfold.
intros.
repeat break_match; repeat tuple_inversion; subst; intuition (auto; congruence).
Qed.

Lemma ServerNetHandler_cases :
forall src m st u out st' ms,
ServerNetHandler src m st = (u, out, st', ms) ->
out = [] /\
((exists c, src = Client c /\
(m = Lock /\
queue st' = queue st ++ [c] /\
((queue st = [] /\ ms = [(Client c, Locked)]) \/
(queue st <> [] /\ ms = [])))) \/
((m = Unlock /\
queue st' = tail (queue st) /\
((queue st' = [] /\ ms = []) \/
(exists next t, queue st' = next :: t /\ ms = [(Client next, Locked)])))) \/
ms = [] /\ st' = st /\ m <> Unlock).