src/Pure/thm.ML
changeset 80295 8a9588ffc133
parent 80289 40a6a6ac1669
child 80560 960b866b1117
equal deleted inserted replaced
80294:eec06d39e5fa 80295:8a9588ffc133
   116   val future: thm future -> cterm -> thm
   116   val future: thm future -> cterm -> thm
   117   val thm_deps: thm -> Proofterm.thm Ord_List.T
   117   val thm_deps: thm -> Proofterm.thm Ord_List.T
   118   val extra_shyps: thm -> sort list
   118   val extra_shyps: thm -> sort list
   119   val strip_shyps: thm -> thm
   119   val strip_shyps: thm -> thm
   120   val derivation_closed: thm -> bool
   120   val derivation_closed: thm -> bool
   121   val derivation_name: thm -> string
   121   val derivation_name: thm -> Thm_Name.T
   122   val derivation_id: thm -> Proofterm.thm_id option
   122   val derivation_id: thm -> Proofterm.thm_id option
   123   val raw_derivation_name: thm -> string
   123   val raw_derivation_name: thm -> Thm_Name.T
   124   val expand_name: thm -> Proofterm.thm_header -> string option
   124   val expand_name: thm -> Proofterm.thm_header -> Thm_Name.T option
   125   val name_derivation: string * Position.T -> thm -> thm
   125   val name_derivation: Thm_Name.P -> thm -> thm
   126   val close_derivation: Position.T -> thm -> thm
   126   val close_derivation: Position.T -> thm -> thm
   127   val trim_context: thm -> thm
   127   val trim_context: thm -> thm
   128   val axiom: theory -> string -> thm
   128   val axiom: theory -> string -> thm
   129   val all_axioms_of: theory -> (string * thm) list
   129   val all_axioms_of: theory -> (string * thm) list
   130   val get_tags: thm -> Properties.T
   130   val get_tags: thm -> Properties.T
  1128   let
  1128   let
  1129     val self_id =
  1129     val self_id =
  1130       (case Proofterm.get_identity shyps hyps prop (Proofterm.proof_of body) of
  1130       (case Proofterm.get_identity shyps hyps prop (Proofterm.proof_of body) of
  1131         NONE => K false
  1131         NONE => K false
  1132       | SOME {serial, ...} => fn (header: Proofterm.thm_header) => serial = #serial header);
  1132       | SOME {serial, ...} => fn (header: Proofterm.thm_header) => serial = #serial header);
  1133     fun expand header = if self_id header orelse #name header = "" then SOME "" else NONE;
  1133     fun expand header =
       
  1134       if self_id header orelse Thm_Name.is_empty (#thm_name header)
       
  1135       then SOME Thm_Name.empty else NONE;
  1134   in expand end;
  1136   in expand end;
  1135 
  1137 
  1136 (*deterministic name of finished proof*)
  1138 (*deterministic name of finished proof*)
  1137 fun derivation_name (thm as Thm (_, {shyps, hyps, prop, ...})) =
  1139 fun derivation_name (thm as Thm (_, {shyps, hyps, prop, ...})) =
  1138   Proofterm.get_approximative_name shyps hyps prop (proof_of thm);
  1140   Proofterm.get_approximative_name shyps hyps prop (proof_of thm);
  1164     in Thm (make_deriv0 [] body', args) end);
  1166     in Thm (make_deriv0 [] body', args) end);
  1165 
  1167 
  1166 fun close_derivation pos =
  1168 fun close_derivation pos =
  1167   solve_constraints #> (fn thm =>
  1169   solve_constraints #> (fn thm =>
  1168     if not (null (tpairs_of thm)) orelse derivation_closed thm then thm
  1170     if not (null (tpairs_of thm)) orelse derivation_closed thm then thm
  1169     else name_derivation ("", pos) thm);
  1171     else name_derivation (Thm_Name.empty, pos) thm);
  1170 
  1172 
  1171 val trim_context = solve_constraints #> trim_context_thm;
  1173 val trim_context = solve_constraints #> trim_context_thm;
  1172 
  1174 
  1173 
  1175 
  1174 
  1176