src/HOL/Tools/Predicate_Compile/predicate_compile_data.ML
changeset 35405 fc130c5e81ec
parent 35404 de56579ae229
child 35624 c4e29a0bb8c1
equal deleted inserted replaced
35404:de56579ae229 35405:fc130c5e81ec
   255   else ()
   255   else ()
   256 
   256 
   257 fun obtain_specification_graph options thy t =
   257 fun obtain_specification_graph options thy t =
   258   let
   258   let
   259     fun is_nondefining_const (c, T) = member (op =) logic_operator_names c
   259     fun is_nondefining_const (c, T) = member (op =) logic_operator_names c
   260     fun has_code_pred_intros (c, T) = is_some (try (Predicate_Compile_Core.intros_of thy) c)
   260     fun has_code_pred_intros (c, T) = can (Predicate_Compile_Core.intros_of thy) c
   261     fun case_consts (c, T) = is_some (Datatype.info_of_case thy c)
   261     fun case_consts (c, T) = is_some (Datatype.info_of_case thy c)
   262     fun is_datatype_constructor (c, T) = is_some (Datatype.info_of_constr thy (c, T))
   262     fun is_datatype_constructor (c, T) = is_some (Datatype.info_of_constr thy (c, T))
   263     fun defiants_of specs =
   263     fun defiants_of specs =
   264       fold (Term.add_consts o prop_of) specs []
   264       fold (Term.add_consts o prop_of) specs []
   265       |> filter_out is_datatype_constructor
   265       |> filter_out is_datatype_constructor
   270       |> filter_out (fn (c, _) => Symtab.defined (#ignore_consts (Data.get thy)) c)
   270       |> filter_out (fn (c, _) => Symtab.defined (#ignore_consts (Data.get thy)) c)
   271       |> map (fn (c, _) => (c, Sign.the_const_constraint thy c))
   271       |> map (fn (c, _) => (c, Sign.the_const_constraint thy c))
   272       |> map Const
   272       |> map Const
   273       (*
   273       (*
   274       |> filter is_defining_constname*)
   274       |> filter is_defining_constname*)
   275     fun extend t =
   275     fun extend t gr =
   276       let
   276       if can (Term_Graph.get_node gr) t then gr
   277         val specs = get_specification options thy t
   277       else
   278           (*|> Predicate_Compile_Set.unfold_set_notation*)
   278         let
   279         (*val _ = print_specification options thy constname specs*)
   279           val specs = get_specification options thy t
   280       in (specs, defiants_of specs) end;
   280             (*|> Predicate_Compile_Set.unfold_set_notation*)
       
   281           (*val _ = print_specification options thy constname specs*)
       
   282           val us = defiants_of specs
       
   283         in
       
   284           gr
       
   285           |> Term_Graph.new_node (t, specs)
       
   286           |> fold extend us
       
   287           |> fold (fn u => Term_Graph.add_edge (t, u)) us
       
   288         end
   281   in
   289   in
   282     Term_Graph.extend extend t Term_Graph.empty
   290     extend t Term_Graph.empty
   283   end;
   291   end;
   284 
   292 
   285 
   293 
   286 fun present_graph gr =
   294 fun present_graph gr =
   287   let
   295   let