(** * Safety definitions *)
Section Safety.
Definition rel X := X -> X -> Prop.
Variable X : Type.
Variable R : rel X.
Inductive safeN : nat -> X -> Prop :=
| safeO : forall x, safeN 0 x
| safeS : forall n x x', R x x' -> safeN n x' -> safeN (S n) x.
Definition safeN' n f : Prop := forall i, i < n -> R (f i) (f (1 + i)).
(** Relating [safeN] to [safeN'] (everything is finite, no axioms) *)

Lemma safeN_safeN' n x : safeN n x <-> (exists f, f 0 = x /\ safeN' n f).
Proof with auto with *.