src/HOL/Tools/Predicate_Compile/code_prolog.ML
changeset 39465 fcff6903595f
parent 39464 13493d3c28d0
child 39541 6605c1e87c7f
equal deleted inserted replaced
39464:13493d3c28d0 39465:fcff6903595f
   841     in
   841     in
   842       list_comb (Const (c, Envir.subst_type subst cT),
   842       list_comb (Const (c, Envir.subst_type subst cT),
   843         map (restore_term ctxt constant_table) (args ~~ argsT'))
   843         map (restore_term ctxt constant_table) (args ~~ argsT'))
   844     end
   844     end
   845 
   845 
       
   846     
       
   847 (* restore numerals in natural numbers *)
       
   848 
       
   849 fun restore_nat_numerals t =
       
   850   if fastype_of t = @{typ nat} andalso is_some (try HOLogic.dest_nat t) then
       
   851     HOLogic.mk_number @{typ nat} (HOLogic.dest_nat t)
       
   852   else
       
   853     (case t of
       
   854         t1 $ t2 => restore_nat_numerals t1 $ restore_nat_numerals t2
       
   855       | t => t)
       
   856   
   846 (* values command *)
   857 (* values command *)
   847 
   858 
   848 val preprocess_options = Predicate_Compile_Aux.Options {
   859 val preprocess_options = Predicate_Compile_Aux.Options {
   849   expected_modes = NONE,
   860   expected_modes = NONE,
   850   proposed_modes = [],
   861   proposed_modes = [],
   927                 (set_compr :: (if null in_insert then xs else (fold mk_insert in_insert empty) :: xs))  
   938                 (set_compr :: (if null in_insert then xs else (fold mk_insert in_insert empty) :: xs))  
   928             end
   939             end
   929         end
   940         end
   930   in
   941   in
   931       foldl1 (HOLogic.mk_binop @{const_name sup}) (mk_set_compr []
   942       foldl1 (HOLogic.mk_binop @{const_name sup}) (mk_set_compr []
   932         (map (fn ts => HOLogic.mk_tuple (map (restore_term ctxt' constant_table) (ts ~~ Ts))) tss) [])
   943         (map (fn ts => HOLogic.mk_tuple 
       
   944           (map (restore_nat_numerals o restore_term ctxt' constant_table) (ts ~~ Ts))) tss) [])
   933   end
   945   end
   934 
   946 
   935 fun values_cmd print_modes soln raw_t state =
   947 fun values_cmd print_modes soln raw_t state =
   936   let
   948   let
   937     val ctxt = Toplevel.context_of state
   949     val ctxt = Toplevel.context_of state