Section Prog.
Variable T : prog V A this.
Definition with_inv_set t :=
t = Unfinished \/ exists t', t' \In T /\ t = WithInv pr I ii (erefl _) t'.
Definition with_inv_prog := @Prog _ _ _ with_inv_set (or_introl (erefl _)).
End Prog.
Notation getS i := (getStatelet i l).
Definition with_inv_s : spec A :=
(fun i => s.1 i,
fun i y m => m \In Coh W /\ s.2 i y m).

Lemma with_inv_has_spec : with_inv_prog (code_of e) \In has_spec this W with_inv_s.