recursively replacing abstractions by new definitions in the predicate compiler
authorbulwahn
Tue, 03 Nov 2009 10:24:05 +0100
changeset 33403 a9b6497391b0
parent 33402 d9a25a87da4a
child 33404 66746e4b4531
recursively replacing abstractions by new definitions in the predicate compiler
src/HOL/Tools/Predicate_Compile/predicate_compile_pred.ML
--- a/src/HOL/Tools/Predicate_Compile/predicate_compile_pred.ML	Mon Nov 02 18:49:53 2009 -0800
+++ b/src/HOL/Tools/Predicate_Compile/predicate_compile_pred.ML	Tue Nov 03 10:24:05 2009 +0100
@@ -141,7 +141,6 @@
     fun process constname atom (new_defs, thy) =
       let
         val (pred, args) = strip_comb atom
-        val abs_args = filter is_Abs args
         fun replace_abs_arg (abs_arg as Abs _ ) (new_defs, thy) =
           let
             val vars = map Var (Term.add_vars abs_arg [])
@@ -160,7 +159,12 @@
           in
             (list_comb (Logic.varify const, vars), ((full_constname, [definition])::new_defs, thy'))
           end
-        | replace_abs_arg arg (new_defs, thy) = (arg, (new_defs, thy))
+        | replace_abs_arg arg (new_defs, thy) =
+          if (is_predT (fastype_of arg)) then
+            process constname arg (new_defs, thy)
+          else
+            (arg, (new_defs, thy))
+        
         val (args', (new_defs', thy')) = fold_map replace_abs_arg args (new_defs, thy)
       in
         (list_comb (pred, args'), (new_defs', thy'))