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_split (k : nat) (a1 a3 : A) :
loop f h' a1 k = Some a3 ->
exists k1 a2 k2,
loop f h  a1 k1 = Some a2 /\
loop f h' a2 k2 = Some a3 /\
k1 + k2 <= k.