Proof using.
handler_unfold.
intros.
repeat break_match; repeat tuple_inversion; subst; intuition.
Qed.

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