Definition instr_approx_rel (n:nat) (i1 i2:instruction) : Prop :=
fmap_instr (K.approx n) i1 = fmap_instr (K.approx n) i2.
Inductive stack_approx_rel (n:nat) : stack -> stack -> Prop :=
| stack_approx_nil : stack_approx_rel n nil nil
| stack_approx_cons : forall i i' stk stk',
instr_approx_rel n i i' ->
stack_approx_rel n stk stk' ->
stack_approx_rel n (i::stk) (i'::stk').

(* Specifications: *)
Lemma stack_approx_rel_refl : forall n stk,
stack_approx_rel n stk stk.
Lemma intro_instr_approx_rel : forall m n i,
m >= n ->
instr_approx_rel n i (fmap_instr (K.approx m) i).
Lemma step_approx :
forall n t t' p1 p2 s1 s1' s2 r1 r1' r2,
level p2 < n ->
termMeasure_incr t t' ->
store_incr r1 r1' ->
stack_approx_rel n s1 s2 ->
step t p1 p2 r1 s1 r2 s1' ->
exists r2', exists s2',
step t' p1 p2 r1' s2 r2' s2' /\
store_incr r2 r2' /\
stack_approx_rel n s1' s2'.
Lemma step_prog_levels : forall t p p' r s r' s',
step t p p' r s r' s' ->
level p' <= level p.
Lemma stepstar_prog_levels : forall t p p' r s r' s',
stepstar t p p' r s r' s' ->
level p' <= level p.
Lemma stepstar_approx :
forall n t t' p1 p2 s1 s1' s2 r1 r1' r2,
level p1 < n ->
termMeasure_incr t t' ->
store_incr r1 r1' ->
stack_approx_rel n s1 s2 ->
stepstar t p1 p2 r1 s1 r2 s1' ->
exists r2', exists s2',
stepstar t' p1 p2 r1' s2 r2' s2' /\
store_incr r2 r2' /\
stack_approx_rel n s1' s2'.