src/Pure/thm_deps.ML
changeset 71015 bb49abc2ecbb
parent 70975 19818f99b4ae
child 71465 910a081cca74
equal deleted inserted replaced
71014:58022ee70b35 71015:bb49abc2ecbb
    10   val all_oracles: thm list -> Proofterm.oracle list
    10   val all_oracles: thm list -> Proofterm.oracle list
    11   val has_skip_proof: thm list -> bool
    11   val has_skip_proof: thm list -> bool
    12   val pretty_thm_oracles: Proof.context -> thm list -> Pretty.T
    12   val pretty_thm_oracles: Proof.context -> thm list -> Pretty.T
    13   val thm_deps: theory -> thm list -> (Proofterm.thm_id * Thm_Name.T) list
    13   val thm_deps: theory -> thm list -> (Proofterm.thm_id * Thm_Name.T) list
    14   val pretty_thm_deps: theory -> thm list -> Pretty.T
    14   val pretty_thm_deps: theory -> thm list -> Pretty.T
    15   val thm_boxes: {included: Proofterm.thm_id -> bool, excluded: Proofterm.thm_id -> bool} ->
       
    16     thm list -> Proofterm.thm_id list
       
    17   val unused_thms_cmd: theory list * theory list -> (string * thm) list
    15   val unused_thms_cmd: theory list * theory list -> (string * thm) list
    18 end;
    16 end;
    19 
    17 
    20 structure Thm_Deps: THM_DEPS =
    18 structure Thm_Deps: THM_DEPS =
    21 struct
    19 struct
    79       |> map (fn ((marks, xname), i) =>
    77       |> map (fn ((marks, xname), i) =>
    80           Pretty.item [Pretty.marks_str (marks, Thm_Name.print (xname, i))]);
    78           Pretty.item [Pretty.marks_str (marks, Thm_Name.print (xname, i))]);
    81   in Pretty.big_list ("dependencies: " ^ string_of_int (length items)) items end;
    79   in Pretty.big_list ("dependencies: " ^ string_of_int (length items)) items end;
    82 
    80 
    83 
    81 
    84 (* thm boxes: intermediate PThm nodes *)
       
    85 
       
    86 fun thm_boxes {included, excluded} thms =
       
    87   let
       
    88     fun boxes (i, thm_node) res =
       
    89       let val thm_id = Proofterm.thm_id (i, thm_node) in
       
    90         if Inttab.defined res i orelse (excluded thm_id andalso not (included thm_id))
       
    91         then res
       
    92         else
       
    93           Inttab.update (i, thm_id) res
       
    94           |> fold boxes (Proofterm.thm_node_thms thm_node)
       
    95       end;
       
    96   in Inttab.fold_rev (cons o #2) (fold (fold boxes o Thm.thm_deps) thms Inttab.empty) [] end;
       
    97 
       
    98 
       
    99 (* unused_thms_cmd *)
    82 (* unused_thms_cmd *)
   100 
    83 
   101 fun unused_thms_cmd (base_thys, thys) =
    84 fun unused_thms_cmd (base_thys, thys) =
   102   let
    85   let
   103     fun add_fact transfer space (name, ths) =
    86     fun add_fact transfer space (name, ths) =