Section LOOKUP.
Context {A: Type} (sig_of: A -> signature).
Fixpoint lookup_builtin (name: string) (sg: signature) (l: list (string * A)) : option A :=
match l with
| nil => None
| (n, b) :: l =>
if string_dec name n && signature_eq sg (sig_of b)
then Some b
else lookup_builtin name sg l
end.

Lemma lookup_builtin_sig: forall name sg b l,
lookup_builtin name sg l = Some b -> sig_of b = sg.