let apply s x =
  match x with
    | App _ -> raise Not_found (* Invariant: only vars in domain of [s]. *)
    | _ -> fst(Map.find x s)