2007 #> fold_rev (implies_intr_proof o snd) (#constraints ucontext) |
2007 #> fold_rev (implies_intr_proof o snd) (#constraints ucontext) |
2008 end; |
2008 end; |
2009 |
2009 |
2010 fun clean_proof thy = rew_proof thy #> shrink_proof; |
2010 fun clean_proof thy = rew_proof thy #> shrink_proof; |
2011 |
2011 |
|
2012 |
|
2013 local open XML.Encode Term_XML.Encode in |
|
2014 |
|
2015 fun proof prf = prf |> variant |
|
2016 [fn MinProof => ([], []), |
|
2017 fn PBound a => ([int_atom a], []), |
|
2018 fn Abst (a, SOME b, c) => ([a], pair typ proof (b, c)), |
|
2019 fn AbsP (a, SOME b, c) => ([a], pair term proof (b, c)), |
|
2020 fn a % SOME b => ([], pair proof term (a, b)), |
|
2021 fn a %% b => ([], pair proof proof (a, b)), |
|
2022 fn Hyp a => ([], term a), |
|
2023 fn PAxm (name, b, SOME Ts) => ([name], list typ Ts), |
|
2024 fn OfClass (T, c) => ([c], typ T), |
|
2025 fn Oracle (name, prop, SOME Ts) => ([name], pair term (list typ) (prop, Ts)), |
|
2026 fn PThm ({serial, name, types = SOME Ts, ...}, _) => ([int_atom serial, name], list typ Ts)]; |
|
2027 |
|
2028 fun encode_export prop prf = pair term proof (prop, prf); |
|
2029 |
|
2030 end; |
|
2031 |
2012 fun export_proof thy i prop prf = |
2032 fun export_proof thy i prop prf = |
2013 let |
2033 let |
2014 val xml = |
2034 val xml = reconstruct_proof thy prop prf |> encode_export prop; |
2015 reconstruct_proof thy prop prf |
|
2016 |> term_of {thm_const = K o string_of_int, axm_const = axm_const_default} |
|
2017 |> Term_XML.Encode.term; |
|
2018 val chunks = Buffer.chunks (YXML.buffer_body xml Buffer.empty); |
2035 val chunks = Buffer.chunks (YXML.buffer_body xml Buffer.empty); |
2019 in |
2036 in |
2020 chunks |> Export.export_params |
2037 chunks |> Export.export_params |
2021 {theory = thy, |
2038 {theory = thy, |
2022 binding = Path.binding0 (Path.make ["proofs", string_of_int i]), |
2039 binding = Path.binding0 (Path.make ["proofs", string_of_int i]), |