(****************************)
(** * Some data structures  *)
(****************************)

(** ** Option type **)

(** The option type (opt X) : Typ1 (parametrized by X : Typ1) that
    would be inductively defined in Coq by

      Inductive opt [X:Typ1] : Typ1 :=
      | some : X->(opt X)
      | none : (opt X).

    is mimicked by the following definitions: *)

Definition opt (X : Typ1) : Typ1 := (X -> Prop) -> Prop.Definition some (X : Typ1) (x : X) : opt X := fun f => f x.Definition none (X : Typ1) : opt X := fun _ => bot.

(* Specifications: *)
Lemma eq_some_some : forall (X : Typ1) (x1 x2 : X), eq (opt X) (some X x1) (some X x2) -> eq X x1 x2.
Lemma eq_some_none : forall (X : Typ1) (x : X), eq (opt X) (some X x) (none X) -> bot.
Lemma eq_none_some : forall (X : Typ1) (x : X), eq (opt X) (none X) (some X x) -> bot.