Interpreting and typechecking a dependent lambda calculus