Groupoid interpretation of type theory