Section Iter.
Context {A : Type}.
Variable (f : A -> A).
Fixpoint iter_nat (n : nat) (x : A) {struct n} : A :=
match n with
| S n' => iter_nat n' (f x)
| O => x
end.
Fixpoint iter_pos (n : positive) (x : A) {struct n} : A :=
match n with
| xI n' => iter_pos n' (iter_pos n' (f x))
| xO n' => iter_pos n' (iter_pos n' x)
| xH => f x
end.

Lemma iter_pos_nat :
forall (p : positive) (x : A),
iter_pos p x = iter_nat (Pos.to_nat p) x.