27 fun dest_fun (ty as Type (_, [ty1, ty2])) = |
27 fun dest_fun (ty as Type (_, [ty1, ty2])) = |
28 if is_funtype ty then (ty1, ty2) |
28 if is_funtype ty then (ty1, ty2) |
29 else raise TYPE ("dest_fun", [ty], []) |
29 else raise TYPE ("dest_fun", [ty], []) |
30 | dest_fun ty = raise TYPE ("dest_fun", [ty], []); |
30 | dest_fun ty = raise TYPE ("dest_fun", [ty], []); |
31 val PROP = ObjectLogic.ensure_propT thy |
31 val PROP = ObjectLogic.ensure_propT thy |
32 val (ty_abs, ty_rep) = (dest_fun o type_of) repm; |
32 val (ty_abs, ty_rep) = (dest_fun o fastype_of) repm; |
33 val (tyco_abs, ty_parms) = dest_Type ty_abs; |
33 val (tyco_abs, ty_parms) = dest_Type ty_abs; |
34 val _ = if exists (fn TFree _ => false | _ => true) ty_parms then raise TYPE ("no TFree", ty_parms, []) else (); |
34 val _ = if exists (fn TFree _ => false | _ => true) ty_parms then raise TYPE ("no TFree", ty_parms, []) else (); |
35 val repv = Free ("x", ty_rep); |
35 val repv = Free ("x", ty_rep); |
36 val absv = Free ("x", ty_abs); |
36 val absv = Free ("x", ty_abs); |
37 val rep_mor = Logic.mk_implies |
37 val rep_mor = Logic.mk_implies |