Fixpoint composeOptN' {A} (f : A -> option A) n x :=
match n with
| 0 => Some x
| S n =>
match composeOptN' f n x with
| Some y => f y
| None => None
end
end.

Lemma composeOptN_assoc_aux_Some {A} (f : A -> option A) n x y :
f x = Some y ->
match composeOptN f n x with
| Some x => f x
| None => None
end = composeOptN f n y.