src/HOL/Tools/Predicate_Compile/predicate_compile_pred.ML
changeset 39468 3cb3b1668c5d
parent 38952 694d0c88d86a
child 39557 fe5722fce758
equal deleted inserted replaced
39467:139c694299f6 39468:3cb3b1668c5d
   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