src/Pure/Tools/find_theorems.ML
changeset 56140 ed92ce2ac88e
parent 56023 f252a315c26e
child 56141 c06202417c4a
equal deleted inserted replaced
56139:b7add947a6ef 56140:ed92ce2ac88e
   379 
   379 
   380 (* filter_theorems *)
   380 (* filter_theorems *)
   381 
   381 
   382 fun all_facts_of ctxt =
   382 fun all_facts_of ctxt =
   383   let
   383   let
   384     fun visible_facts facts =
   384     val facts = Proof_Context.facts_of ctxt
       
   385     val visible_facts =
   385       Facts.dest_static [] facts
   386       Facts.dest_static [] facts
   386       |> filter_out (Facts.is_concealed facts o #1);
   387       |> filter_out (Facts.is_concealed facts o #1);
   387   in
   388   in maps Facts.selections visible_facts end;
   388     maps Facts.selections
       
   389      (visible_facts (Proof_Context.facts_of ctxt) @
       
   390       visible_facts (Global_Theory.facts_of (Proof_Context.theory_of ctxt)))
       
   391   end;
       
   392 
   389 
   393 fun filter_theorems ctxt theorems query =
   390 fun filter_theorems ctxt theorems query =
   394   let
   391   let
   395     val {goal = opt_goal, limit = opt_limit, rem_dups, criteria} = query;
   392     val {goal = opt_goal, limit = opt_limit, rem_dups, criteria} = query;
   396     val filters = map (filter_criterion ctxt opt_goal) criteria;
   393     val filters = map (filter_criterion ctxt opt_goal) criteria;
   451   let
   448   let
   452     val (name, sel) =
   449     val (name, sel) =
   453       (case thmref of
   450       (case thmref of
   454         Facts.Named ((name, _), sel) => (name, sel)
   451         Facts.Named ((name, _), sel) => (name, sel)
   455       | Facts.Fact _ => raise Fail "Illegal literal fact");
   452       | Facts.Fact _ => raise Fail "Illegal literal fact");
   456   in
   453     val (markup, _) = Facts.markup_extern ctxt (Proof_Context.facts_of ctxt) name;
   457     [Pretty.mark (Proof_Context.markup_fact ctxt name) (Pretty.str name),
   454   in
   458       Pretty.str (Facts.string_of_selection sel), Pretty.str ":", Pretty.brk 1]
   455     [Pretty.mark_str (markup, name), Pretty.str (Facts.string_of_selection sel),
       
   456       Pretty.str ":", Pretty.brk 1]
   459   end;
   457   end;
   460 
   458 
   461 in
   459 in
   462 
   460 
   463 fun pretty_thm ctxt (thmref, thm) =
   461 fun pretty_thm ctxt (thmref, thm) =