Section rspec.
Context {A: Type} (argsig: list (ident*type)) (retty: type).
Context (R: ident -> A -> environ -> mpred) (p: @aspec A).
Definition rspec_init (r: ident) (init: A) : unit -> environ -> mpred :=
fun tt rho => rep r init R rho.
Definition rspec_pre (r: ident) : unit -> environ -> mpred :=
fun tt rho => EX x: A, rep r x R rho && !!p.(Pspec) x rho.
Definition rspec_post (r: ident) : unit -> environ -> mpred :=
fun tt rho => EX x: A, rep r x R rho && !!p.(Qspec) x rho (retval rho).
Definition init_rspec (r: ident) (init: A) : funspec :=
mk_funspec (argsig,Tvoid) cc_default unit TT (rspec_init r init * TT).
Definition rspec (r: ident) : funspec :=
mk_funspec (argsig,retty) cc_default unit (rspec_pre r) (rspec_post r).
End rspec.
Definition nonvoid (ty: type) := match ty with Tvoid => False | _ => True end.
Definition nonvoidty := {ty: type | nonvoid ty}.
Definition get_nonvoidty : nonvoidty -> type := @proj1_sig _ nonvoid.
Infix "$" := (fun f => [eta f]) (at level 50).

Lemma rfun_of_xident_eq {id f} : rfun_of_xident id = Some f -> f.(f_id) = id.