Inductive match_pc (f: function) (rs: regset) (m: mem): nat -> node -> node -> Prop :=
| match_pc_base: forall n pc,
match_pc f rs m n pc pc
| match_pc_nop: forall n pc s pcx,
f.(fn_code)!pc = Some (Inop s) ->
match_pc f rs m n s pcx ->
match_pc f rs m (S n) pc pcx
| match_pc_cond: forall n pc cond args s1 s2 pcx,
f.(fn_code)!pc = Some (Icond cond args s1 s2) ->
(forall b,
eval_condition cond rs##args m = Some b ->
match_pc f rs m n (if b then s1 else s2) pcx) ->
match_pc f rs m (S n) pc pcx.

(* Specifications: *)
Lemma match_successor_rec:
forall f rs m bc ae,
ematch bc rs ae ->
forall n pc,
match_pc f rs m n pc (successor_rec n f ae pc).
Lemma match_successor:
forall f rs m bc ae pc,
ematch bc rs ae -> match_pc f rs m num_iter pc (successor f ae pc).
Lemma builtin_arg_reduction_correct:
forall bc sp m rs ae, ematch bc rs ae ->
forall a v,
eval_builtin_arg ge (fun r => rs#r) sp m a v ->
eval_builtin_arg ge (fun r => rs#r) sp m (builtin_arg_reduction ae a) v.
Lemma builtin_arg_strength_reduction_correct:
forall bc sp m rs ae a v c,
ematch bc rs ae ->
eval_builtin_arg ge (fun r => rs#r) sp m a v ->
eval_builtin_arg ge (fun r => rs#r) sp m (builtin_arg_strength_reduction ae a c) v.
Lemma builtin_args_strength_reduction_correct:
forall bc sp m rs ae, ematch bc rs ae ->
forall al vl,
eval_builtin_args ge (fun r => rs#r) sp m al vl ->
forall cl,
eval_builtin_args ge (fun r => rs#r) sp m (builtin_args_strength_reduction ae al cl) vl.
Lemma debug_strength_reduction_correct:
forall bc sp m rs ae, ematch bc rs ae ->
forall al vl,
eval_builtin_args ge (fun r => rs#r) sp m al vl ->
exists vl', eval_builtin_args ge (fun r => rs#r) sp m (debug_strength_reduction ae al) vl'.
Lemma builtin_strength_reduction_correct:
forall sp bc ae rs ef args vargs m t vres m',
ematch bc rs ae ->
eval_builtin_args ge (fun r => rs#r) sp m args vargs ->
external_call ef ge vargs m t vres m' ->
exists vargs',
eval_builtin_args ge (fun r => rs#r) sp m (builtin_strength_reduction ae ef args) vargs'
/\ external_call ef ge vargs' m t vres m'.