src/HOL/Tools/Predicate_Compile/code_prolog.ML
changeset 40054 cd7b1fa20bce
parent 39798 9e7a0a9d194e
child 40301 bf39a257b3d3
equal deleted inserted replaced
40053:3fa49ea76cbb 40054:cd7b1fa20bce
   384           ((fn s => the (AList.lookup (op =) pos_modes s)),
   384           ((fn s => the (AList.lookup (op =) pos_modes s)),
   385            (fn s => the (AList.lookup (op =) neg_modes s)),
   385            (fn s => the (AList.lookup (op =) neg_modes s)),
   386            (fn s => member (op =) (the (AList.lookup (op =) random s))))
   386            (fn s => member (op =) (the (AList.lookup (op =) random s))))
   387         val (preds, all_vs, param_vs, all_modes, clauses) =
   387         val (preds, all_vs, param_vs, all_modes, clauses) =
   388           Predicate_Compile_Core.prepare_intrs options ctxt prednames
   388           Predicate_Compile_Core.prepare_intrs options ctxt prednames
   389             (maps (Predicate_Compile_Core.intros_of ctxt) prednames)
   389             (maps (Core_Data.intros_of ctxt) prednames)
   390         val ((moded_clauses, random'), _) =
   390         val ((moded_clauses, random'), _) =
   391           Predicate_Compile_Core.infer_modes mode_analysis_options options 
   391           Mode_Inference.infer_modes mode_analysis_options options 
   392             (lookup_modes, lookup_neg_modes, needs_random) ctxt preds all_modes param_vs clauses
   392             (lookup_modes, lookup_neg_modes, needs_random) ctxt preds all_modes param_vs clauses
   393         val modes = map (fn (p, mps) => (p, map fst mps)) moded_clauses
   393         val modes = map (fn (p, mps) => (p, map fst mps)) moded_clauses
   394         val pos_modes' = map (apsnd (map_filter (fn (true, m) => SOME m | _ => NONE))) modes
   394         val pos_modes' = map (apsnd (map_filter (fn (true, m) => SOME m | _ => NONE))) modes
   395         val neg_modes' = map (apsnd (map_filter (fn (false, m) => SOME m | _ => NONE))) modes
   395         val neg_modes' = map (apsnd (map_filter (fn (false, m) => SOME m | _ => NONE))) modes
   396         val _ = tracing ("Inferred modes:\n" ^
   396         val _ = tracing ("Inferred modes:\n" ^
   472 
   472 
   473 fun generate (use_modes, ensure_groundness) ctxt const =
   473 fun generate (use_modes, ensure_groundness) ctxt const =
   474   let 
   474   let 
   475     fun strong_conn_of gr keys =
   475     fun strong_conn_of gr keys =
   476       Graph.strong_conn (Graph.subgraph (member (op =) (Graph.all_succs gr keys)) gr)
   476       Graph.strong_conn (Graph.subgraph (member (op =) (Graph.all_succs gr keys)) gr)
   477     val gr = Predicate_Compile_Core.intros_graph_of ctxt
   477     val gr = Core_Data.intros_graph_of ctxt
   478     val gr' = add_edges depending_preds_of const gr
   478     val gr' = add_edges depending_preds_of const gr
   479     val scc = strong_conn_of gr' [const]
   479     val scc = strong_conn_of gr' [const]
   480     val initial_constant_table = 
   480     val initial_constant_table = 
   481       declare_consts [@{const_name "Groups.zero_class.zero"}, @{const_name "Suc"}] []
   481       declare_consts [@{const_name "Groups.zero_class.zero"}, @{const_name "Suc"}] []
   482   in
   482   in
   915   specialise = false,
   915   specialise = false,
   916   fail_safe_function_flattening = false,
   916   fail_safe_function_flattening = false,
   917   no_higher_order_predicate = [],
   917   no_higher_order_predicate = [],
   918   inductify = false,
   918   inductify = false,
   919   detect_switches = true,
   919   detect_switches = true,
       
   920   smart_depth_limiting = true,
   920   compilation = Predicate_Compile_Aux.Pred
   921   compilation = Predicate_Compile_Aux.Pred
   921 }
   922 }
   922 
   923 
   923 fun values ctxt soln t_compr =
   924 fun values ctxt soln t_compr =
   924   let
   925   let