101 val proof_bodies_of: thm list -> proof_body list |
101 val proof_bodies_of: thm list -> proof_body list |
102 val proof_body_of: thm -> proof_body |
102 val proof_body_of: thm -> proof_body |
103 val proof_of: thm -> proof |
103 val proof_of: thm -> proof |
104 val consolidate: thm list -> unit |
104 val consolidate: thm list -> unit |
105 val expose_proofs: theory -> thm list -> unit |
105 val expose_proofs: theory -> thm list -> unit |
|
106 val expose_proof: theory -> thm -> unit |
106 val future: thm future -> cterm -> thm |
107 val future: thm future -> cterm -> thm |
107 val thm_deps: thm -> Proofterm.thm Ord_List.T |
108 val thm_deps: thm -> Proofterm.thm Ord_List.T |
108 val derivation_closed: thm -> bool |
109 val derivation_closed: thm -> bool |
109 val derivation_name: thm -> string |
110 val derivation_name: thm -> string |
110 val derivation_id: thm -> Proofterm.thm_id option |
111 val derivation_id: thm -> Proofterm.thm_id option |
111 val raw_derivation_name: thm -> string |
112 val raw_derivation_name: thm -> string |
112 val expand_name: thm -> Proofterm.thm_header -> string option |
113 val expand_name: thm -> Proofterm.thm_header -> string option |
113 val name_derivation: string * Position.T -> thm -> thm |
114 val name_derivation: string * Position.T -> thm -> thm |
114 val close_derivation: Position.T -> thm -> thm |
115 val close_derivation: Position.T -> thm -> thm |
|
116 val expose_derivation: Position.T -> thm -> thm |
115 val trim_context: thm -> thm |
117 val trim_context: thm -> thm |
116 val axiom: theory -> string -> thm |
118 val axiom: theory -> string -> thm |
117 val all_axioms_of: theory -> (string * thm) list |
119 val all_axioms_of: theory -> (string * thm) list |
118 val get_tags: thm -> Properties.T |
120 val get_tags: thm -> Properties.T |
119 val map_tags: (Properties.T -> Properties.T) -> thm -> thm |
121 val map_tags: (Properties.T -> Properties.T) -> thm -> thm |
764 fun expose_proofs thy thms = |
766 fun expose_proofs thy thms = |
765 if Proofterm.export_proof_boxes_required thy then |
767 if Proofterm.export_proof_boxes_required thy then |
766 Proofterm.export_proof_boxes (map (proof_of o transfer thy) thms) |
768 Proofterm.export_proof_boxes (map (proof_of o transfer thy) thms) |
767 else (); |
769 else (); |
768 |
770 |
|
771 fun expose_proof thy = expose_proofs thy o single; |
|
772 |
769 |
773 |
770 (* future rule *) |
774 (* future rule *) |
771 |
775 |
772 fun future_result i orig_cert orig_shyps orig_prop thm = |
776 fun future_result i orig_cert orig_shyps orig_prop thm = |
773 let |
777 let |
1037 |
1041 |
1038 fun close_derivation pos = |
1042 fun close_derivation pos = |
1039 solve_constraints #> (fn thm => |
1043 solve_constraints #> (fn thm => |
1040 if not (null (tpairs_of thm)) orelse derivation_closed thm then thm |
1044 if not (null (tpairs_of thm)) orelse derivation_closed thm then thm |
1041 else name_derivation ("", pos) thm); |
1045 else name_derivation ("", pos) thm); |
|
1046 |
|
1047 fun expose_derivation pos thm = |
|
1048 close_derivation pos thm |
|
1049 |> tap (expose_proof (theory_of_thm thm)); |
1042 |
1050 |
1043 val trim_context = solve_constraints #> trim_context_thm; |
1051 val trim_context = solve_constraints #> trim_context_thm; |
1044 |
1052 |
1045 |
1053 |
1046 |
1054 |
2243 (false, |
2251 (false, |
2244 thy2 |
2252 thy2 |
2245 |> (map_classrels o Symreltab.update) ((c1, c2), |
2253 |> (map_classrels o Symreltab.update) ((c1, c2), |
2246 (the_classrel thy2 (c1, c) RS the_classrel thy2 (c, c2)) |
2254 (the_classrel thy2 (c1, c) RS the_classrel thy2 (c, c2)) |
2247 |> standard_tvars |
2255 |> standard_tvars |
2248 |> close_derivation \<^here> |
2256 |> expose_derivation \<^here> |
2249 |> trim_context)); |
2257 |> trim_context)); |
2250 |
2258 |
2251 val proven = is_classrel thy1; |
2259 val proven = is_classrel thy1; |
2252 val preds = Graph.Keys.fold (fn c1 => proven (c1, c) ? cons c1) all_preds []; |
2260 val preds = Graph.Keys.fold (fn c1 => proven (c1, c) ? cons c1) all_preds []; |
2253 val succs = Graph.Keys.fold (fn c2 => proven (c, c2) ? cons c2) all_succs []; |
2261 val succs = Graph.Keys.fold (fn c2 => proven (c, c2) ? cons c2) all_succs []; |
2276 else |
2284 else |
2277 let |
2285 let |
2278 val th1 = |
2286 val th1 = |
2279 (th RS the_classrel thy (c, c1)) |
2287 (th RS the_classrel thy (c, c1)) |
2280 |> standard_tvars |
2288 |> standard_tvars |
2281 |> close_derivation \<^here> |
2289 |> expose_derivation \<^here> |
2282 |> trim_context; |
2290 |> trim_context; |
2283 in SOME ((t, Ss, c1), (th1, thy_name, ser)) end); |
2291 in SOME ((t, Ss, c1), (th1, thy_name, ser)) end); |
2284 val finished' = finished andalso null completions; |
2292 val finished' = finished andalso null completions; |
2285 val arities' = fold Aritytab.update completions arities; |
2293 val arities' = fold Aritytab.update completions arities; |
2286 in (finished', arities') end; |
2294 in (finished', arities') end; |
2304 (* primitive rules *) |
2312 (* primitive rules *) |
2305 |
2313 |
2306 fun add_classrel raw_th thy = |
2314 fun add_classrel raw_th thy = |
2307 let |
2315 let |
2308 val th = strip_shyps (transfer thy raw_th); |
2316 val th = strip_shyps (transfer thy raw_th); |
|
2317 val th' = th |> unconstrainT |> tap (expose_proof thy) |> trim_context; |
2309 val prop = plain_prop_of th; |
2318 val prop = plain_prop_of th; |
2310 val (c1, c2) = Logic.dest_classrel prop; |
2319 val (c1, c2) = Logic.dest_classrel prop; |
2311 in |
2320 in |
2312 thy |
2321 thy |
2313 |> Sign.primitive_classrel (c1, c2) |
2322 |> Sign.primitive_classrel (c1, c2) |
2314 |> map_classrels (Symreltab.update ((c1, c2), th |> unconstrainT |> trim_context)) |
2323 |> map_classrels (Symreltab.update ((c1, c2), th')) |
2315 |> perhaps complete_classrels |
2324 |> perhaps complete_classrels |
2316 |> perhaps complete_arities |
2325 |> perhaps complete_arities |
2317 end; |
2326 end; |
2318 |
2327 |
2319 fun add_arity raw_th thy = |
2328 fun add_arity raw_th thy = |
2320 let |
2329 let |
2321 val th = strip_shyps (transfer thy raw_th); |
2330 val th = strip_shyps (transfer thy raw_th); |
|
2331 val th' = th |> unconstrainT |> tap (expose_proof thy) |> trim_context; |
2322 val prop = plain_prop_of th; |
2332 val prop = plain_prop_of th; |
2323 val (t, Ss, c) = Logic.dest_arity prop; |
2333 val (t, Ss, c) = Logic.dest_arity prop; |
2324 val ar = ((t, Ss, c), (th |> unconstrainT |> trim_context, Context.theory_name thy, serial ())); |
2334 val ar = ((t, Ss, c), (th', Context.theory_name thy, serial ())); |
2325 in |
2335 in |
2326 thy |
2336 thy |
2327 |> Sign.primitive_arity (t, Ss, [c]) |
2337 |> Sign.primitive_arity (t, Ss, [c]) |
2328 |> map_arities (Aritytab.update ar #> curry (insert_arity_completions thy ar) true #> #2) |
2338 |> map_arities (Aritytab.update ar #> curry (insert_arity_completions thy ar) true #> #2) |
2329 end; |
2339 end; |