Remark decompose_int_thumb_nil:
forall N n p, decompose_int_thumb N n p = nil -> n = Int.zero.

(* Specifications: *)
Lemma decompose_int_general:
forall (f: val -> int -> val) (g: int -> int -> int),
(forall v1 n2 n3, f (f v1 n2) n3 = f v1 (g n2 n3)) ->
(forall n1 n2 n3, g (g n1 n2) n3 = g n1 (g n2 n3)) ->
(forall n, g Int.zero n = n) ->
(forall N n p x, List.fold_left g (decompose_int_arm N n p) x = g x n) ->
(forall N n p x, List.fold_left g (decompose_int_thumb N n p) x = g x n) ->
forall n v,
List.fold_left f (decompose_int n) v = f v n.
Lemma decompose_int_or:
forall n v,
List.fold_left (fun v i => Val.or v (Vint i)) (decompose_int n) v = Val.or v (Vint n).
Lemma decompose_int_bic:
forall n v,
List.fold_left (fun v i => Val.and v (Vint (Int.not i))) (decompose_int n) v = Val.and v (Vint (Int.not n)).
Lemma decompose_int_xor:
forall n v,
List.fold_left (fun v i => Val.xor v (Vint i)) (decompose_int n) v = Val.xor v (Vint n).
Lemma decompose_int_add:
forall n v,
List.fold_left (fun v i => Val.add v (Vint i)) (decompose_int n) v = Val.add v (Vint n).
Lemma decompose_int_sub:
forall n v,
List.fold_left (fun v i => Val.sub v (Vint i)) (decompose_int n) v = Val.sub v (Vint n).
Lemma iterate_op_correct:
forall op1 op2 (f: val -> int -> val) (rs: regset) (r: ireg) m v0 n k,
(forall (rs:regset) n,
exec_instr ge fn (op2 (SOimm n)) rs m =
Next (nextinstr_nf (rs#r <- (f (rs#r) n))) m) ->
(forall n,
exec_instr ge fn (op1 (SOimm n)) rs m =
Next (nextinstr_nf (rs#r <- (f v0 n))) m) ->
exists rs',
exec_straight ge fn (iterate_op op1 op2 (decompose_int n) k) rs m  k rs' m
/\ rs'#r = List.fold_left f (decompose_int n) v0
/\ forall r': preg, r' <> r -> if_preg r' = true -> rs'#r' = rs#r'.