Program Definition getsn (n:nat) (stk stk':stack) (Q:pred world) : pred world :=
  fun pr => let (p,r) := pr in
    level p >= n -> exists n', n' < n /\
      exists p', exists r', stepN n' p p' r stk r' stk' /\
        Q (p',r').Program Definition haltsn (n : nat) (stk : stack) : pred world :=
  fun pr => let (p,r) := pr in
    (level p >= n -> eventually_halts_n n p r stk).Definition termMeas :=
  { R : store -> nat -> Prop |
    forall x y y', R x y -> R x y' -> y = y' }.Program Definition code (l : label) (c : instruction) : pred prog :=
  fun p =>
    exists i, prog_lookup p l = Some i /\ instr_approx_rel (level p) c i.Program Definition evalTM (t : termMeas) (n : nat) : pred world :=
  fun w => let (_, r) := w in
    proj1_sig t r n.Program Definition embedWP (P : pred world) : pred prog :=
  fun p => forall r, P (p,r).

Lemma hoare_getlabel : forall l v G R P, hoare' 0 G R (box (setM v (value_label l)) P) (instr_getlabel l v) P.