331 in |
331 in |
332 (list_comb (Logic.varify_global const, vars), |
332 (list_comb (Logic.varify_global const, vars), |
333 ((full_constname, [definition])::new_defs, thy')) |
333 ((full_constname, [definition])::new_defs, thy')) |
334 end |
334 end |
335 | replace_abs_arg arg (new_defs, thy) = |
335 | replace_abs_arg arg (new_defs, thy) = |
336 if (is_predT (fastype_of arg)) then |
336 if is_some (try HOLogic.dest_prodT (fastype_of arg)) then |
|
337 (case try HOLogic.dest_prod arg of |
|
338 SOME (t1, t2) => |
|
339 (new_defs, thy) |
|
340 |> process constname t1 |
|
341 ||>> process constname t2 |
|
342 |>> HOLogic.mk_prod |
|
343 | NONE => (warning ("Replacing higher order arguments " ^ |
|
344 "is not applied in an undestructable product type"); (arg, (new_defs, thy)))) |
|
345 else if (is_predT (fastype_of arg)) then |
337 process constname arg (new_defs, thy) |
346 process constname arg (new_defs, thy) |
338 else |
347 else |
339 (arg, (new_defs, thy)) |
348 (arg, (new_defs, thy)) |
340 |
349 |
341 val (args', (new_defs', thy')) = fold_map replace_abs_arg |
350 val (args', (new_defs', thy')) = fold_map replace_abs_arg |
342 (map Envir.beta_eta_contract args) (new_defs, thy) |
351 (map Envir.beta_eta_contract args) (new_defs, thy) |
343 in |
352 in |
344 (list_comb (pred, args'), (new_defs', thy')) |
353 (list_comb (pred, args'), (new_defs', thy')) |
345 end |
354 end |