(** * Infinite Data Types *)
(** ** Definition of infinite and generating types *)
Definition generating X :=
forall (A : list X), exists x, ~ x el A.
Definition injective X Y (f : X -> Y) :=
forall x x', f x = f x' -> x = x'.
Definition infinite X :=
exists (f : nat -> X), injective f.
Section Inf.
Variables (X : Type) (f' : nat -> option X).
Hypothesis Hf' : forall x, exists n, f' n = Some x.
Hypothesis HX : eq_dec X.
(** ** Infinite data types are generating *)
Section Gen.
Variable f : nat -> X.
Hypothesis Hf : injective f.
Fixpoint LX n :=
match n with
| 0 => [f 0]
| S n => f (S n) :: LX n
end.

Lemma LX_el n x :
x el LX n -> exists n', n' <= n /\ f n' = x.