A typed operational semantics for type theory