rewrite G0_G1_1_equiv.
rewrite <- G1_2_G1_equiv.
eapply G1_1_2_close.
Qed.
Definition randomFunc_mem (D R : Set)(eqdd : EqDec D)(eqdr : EqDec R)(RndR : Comp R) (ls : list (D * R))d :=
match (arrayLookup _ ls d) with
| Some r =>
ret (r, (d, r) :: ls)
| None =>
r <-$ RndR; ret (r, (d, r) :: ls)
end.

(* Specifications: *)
Theorem randomFunc_mem_spec :
forall (D R : Set)(eqdd : EqDec D)(eqdr : EqDec R)(RndR : Comp R) (x1 x2 : list (D * R)) a,
(forall z, arrayLookup _ x1 z = arrayLookup _ x2 z) ->
comp_spec
(fun y1 y2 =>
fst y1 = fst y2 /\
(forall x,
arrayLookup _ (snd y1) x =
arrayLookup _ (snd y2) x))
(randomFunc_mem _ _ RndR x1 a)
(randomFunc RndR _ x2 a).
Theorem randomFunc_mem_spec :
forall (D R : Set)(eqdd : EqDec D)(eqdr : EqDec R)(RndR : Comp R) (x1 x2 : list (D * R)) a,
(forall z, arrayLookup _ x1 z = arrayLookup _ x2 z) ->
comp_spec
(fun y1 y2 =>
fst y1 = fst y2 /\
(forall x,
arrayLookup _ (snd y1) x =
arrayLookup _ (snd y2) x))
(randomFunc_mem _ _ RndR x1 a)
(randomFunc RndR _ x2 a).