Definition funsig2signature (s : funsig) cc : signature :=
mksignature (map typ_of_type (map snd (fst s))) (opttyp_of_type (snd s)) cc.
(* NOTE.   ext_link: Strings.String.string -> ident represents the mapping from the _name_ of an external function (an ASCII string) to the [ident] that's used to represent it in this program module. That mapping can be computed from the prog_defs component of the Clight.program produced by clightgen. *)
Definition ef_id_sig (ext_link: Strings.String.string -> ident) ef :=
match ef with EF_external id sig => Some (ext_link id, sig) | _ => None end.
Section funspecs2jspec.
Variable Z : Type.
Variable Espec : juicy_ext_spec Z.
Definition symb2genv_upper_bound (s: PTree.t block) : block :=
Pos.succ (fold_right Pos.max  1%positive (map snd (PTree.elements s))).
Definition symb2genv (ge_s: injective_PTree block) : genv.
refine (Build_genv (@Genv.mkgenv _ _ nil (proj1_sig ge_s) (PTree.empty _) (symb2genv_upper_bound (proj1_sig ge_s)) _ _ _) (PTree.empty _)).
*
intros.
unfold Coqlib.Plt.
apply Pos.lt_le_trans with (Pos.succ b).
apply Pos.lt_succ_r.
apply Pos.le_refl.
unfold symb2genv_upper_bound.
apply -> Pos.succ_le_mono.
apply PTree.elements_correct in H.
revert H.
induction (PTree.elements (proj1_sig ge_s)); intros. inv H.
destruct H. subst. simpl.
apply Pos.le_max_l.
simpl.
eapply Pos.le_trans; [  | apply Pos.le_max_r].
auto.
*
intros.
rewrite PTree.gempty in H. inv H.
*
intros.
destruct ge_s; simpl in *.
revert id1 id2 b H H0.
simpl.
auto.
Defined.

Lemma symb2genv_ax : forall (ge: genv), Genv.genv_symb (symb2genv (genv_symb_injective ge)) = Genv.genv_symb ge.