1005 val thy = theory_of_thm thm; |
1005 val thy = theory_of_thm thm; |
1006 |
1006 |
1007 val Deriv {promises, body} = der; |
1007 val Deriv {promises, body} = der; |
1008 val {shyps, hyps, prop, tpairs, ...} = args; |
1008 val {shyps, hyps, prop, tpairs, ...} = args; |
1009 |
1009 |
1010 fun err msg = raise THM ("name_derivation: " ^ msg, 0, [thm]); |
1010 val _ = null tpairs orelse raise THM ("name_derivation: bad flex-flex constraints", 0, [thm]); |
1011 val _ = null tpairs orelse err "bad flex-flex constraints"; |
|
1012 |
1011 |
1013 val ps = map (apsnd (Future.map fulfill_body)) promises; |
1012 val ps = map (apsnd (Future.map fulfill_body)) promises; |
1014 val (pthm, proof) = |
1013 val (pthm, proof) = |
1015 Proofterm.thm_proof thy (classrel_proof thy) (arity_proof thy) |
1014 Proofterm.thm_proof thy (classrel_proof thy) (arity_proof thy) |
1016 name_pos shyps hyps prop ps body; |
1015 name_pos shyps hyps prop ps body; |
1017 val der' = make_deriv [] [] [pthm] proof; |
1016 val der' = make_deriv [] [] [pthm] proof; |
1018 in Thm (der', args) end); |
1017 in Thm (der', args) end); |
1019 |
1018 |
1020 fun close_derivation pos = |
1019 fun close_derivation pos = |
1021 solve_constraints #> (fn thm => |
1020 solve_constraints #> (fn thm => |
1022 if derivation_closed thm then thm else name_derivation ("", pos) thm); |
1021 if not (null (tpairs_of thm)) orelse derivation_closed thm then thm |
|
1022 else name_derivation ("", pos) thm); |
1023 |
1023 |
1024 val trim_context = solve_constraints #> trim_context_thm; |
1024 val trim_context = solve_constraints #> trim_context_thm; |
1025 |
1025 |
1026 |
1026 |
1027 |
1027 |