(* ============================ *)

(* We prove preservation for most states of the machine, including Kblocked at acquire, but preservation does not hold for makelock or release, so, we make an exception and will use safety induction in the safety theorem.  Because it's faster to prove safety induction, we don't prove preservation for freelock and spawn, either, because we did those two last. *)
Theorem preservation ge Gamma n state state' :
~ blocked_at_external state CREATE ->
~ blocked_at_external state MKLOCK ->
~ blocked_at_external state FREE_LOCK ->
~ blocked_at_external state UNLOCK ->
state_step state state' ->
state_invariant Jspec' Gamma (S n) state ->
state_bupd(ge := ge) (state_invariant Jspec' Gamma n) state' \/
state_bupd(ge := ge) (state_invariant Jspec' Gamma (S n)) state'.