Section LoopMerge.
Variable A : Type. (* abstract state *)
Variable f : A -> A. (* abstract step function *)
Variable (h h' : A -> bool). (* abstract halting functions *)
(* Every non-halting state w.r.t. [h] is also a non-halting state w.r.t. [h'] *)
Hypothesis halt_comp : forall a, h a = false -> h' a = false.

Lemma loop_merge (k1 k2 : nat) (a1 a2 a3 : A) :
loop f h  a1 k1      = Some a2 ->
loop f h' a2 k2      = Some a3 ->
loop f h' a1 (k1+k2) = Some a3.