(** Let (X, A, a) be a pointed graph.  The powerset of the set represented
    by this pointed graph is itself represented by the pointed graph

      ((sum X X->Prop), (POWER X A a), (out X X->Prop))

    whose edge relation (POWER X A a) : (Rel (sum X X->Prop)) is defined
    by the following 3 clauses:

    1. Delocating A into the powerset:

         if (A x' x),
         then (POWER X A a (inl X X->Prop x') (inl X X->Prop x))

    2. Connecting each vertex x':X such that (A x' a) to all the
       predicates p : X->Prop such that (p x'):

         if (A x' a) and (p x'),
         then (POWER X A a (inl X X->Prop x') (inr X X->Prop p))

    3. Connecting all the predicates p : X->Prop to the new root:

         (POWER X A a (inr X X->Prop p) (out X X->Prop)).

    This relation is impredicatively encoded as follows: *)

Definition POWER (X : Typ1) (A : Rel X) (a : X) (z' z : sum X (X -> Prop)) :=
  forall E : Prop,
  (forall x x' : X,
   eq (sum X (X -> Prop)) z' (inl X (X -> Prop) x') ->
   eq (sum X (X -> Prop)) z (inl X (X -> Prop) x) -> A x' x -> E) ->
  (forall (x' : X) (p : X -> Prop),
   eq (sum X (X -> Prop)) z' (inl X (X -> Prop) x') ->
   eq (sum X (X -> Prop)) z (inr X (X -> Prop) p) -> A x' a -> p x' -> E) ->
  (forall p : X -> Prop,
   eq (sum X (X -> Prop)) z' (inr X (X -> Prop) p) ->
   eq (sum X (X -> Prop)) z (out X (X -> Prop)) -> E) -> E.

Lemma POWER_deloc : forall (X : Typ1) (A : Rel X) (a : X), deloc X A (sum X (X -> Prop)) (POWER X A a) (inl X (X -> Prop)).