479 | _ => error "term_of_dB: function type expected" |
479 | _ => error "term_of_dB: function type expected" |
480 end |
480 end |
481 | term_of_dB' _ _ = error "term_of_dB: term not in normal form"; |
481 | term_of_dB' _ _ = error "term_of_dB: term not in normal form"; |
482 |
482 |
483 fun typing_of_term Ts e (Bound i) = |
483 fun typing_of_term Ts e (Bound i) = |
484 Norm.Var (e, nat_of_int i, dBtype_of_typ (List.nth (Ts, i))) |
484 Norm.Var (e, nat_of_int i, dBtype_of_typ (nth Ts i)) |
485 | typing_of_term Ts e (t $ u) = (case fastype_of1 (Ts, t) of |
485 | typing_of_term Ts e (t $ u) = (case fastype_of1 (Ts, t) of |
486 Type ("fun", [T, U]) => Norm.rtypingT_App (e, dB_of_term t, |
486 Type ("fun", [T, U]) => Norm.rtypingT_App (e, dB_of_term t, |
487 dBtype_of_typ T, dBtype_of_typ U, dB_of_term u, |
487 dBtype_of_typ T, dBtype_of_typ U, dB_of_term u, |
488 typing_of_term Ts e t, typing_of_term Ts e u) |
488 typing_of_term Ts e t, typing_of_term Ts e u) |
489 | _ => error "typing_of_term: function type expected") |
489 | _ => error "typing_of_term: function type expected") |