theory Reification_Test imports "Isabelle_DOF.DOF_Deep" begin ML\ val ty1 = ISA_core.reify_typ @{typ "int"} val ty2 = ISA_core.reify_typ @{typ "int \ bool"} val ty3 = ISA_core.reify_typ @{typ "prop"} val ty4 = ISA_core.reify_typ @{typ "'a list"} \ term*\@{typ \int\}\ value*\@{typ \int\}\ value*\@{typ \int \ bool\}\ term*\@{typ \prop\}\ value*\@{typ \prop\}\ term*\@{typ \'a list\}\ value*\@{typ \'a list\}\ ML\ val t1 = ISA_core.reify_term @{term "1::int"} val t2 = ISA_core.reify_term @{term "\x. x = 1"} val t3 = ISA_core.reify_term @{term "[2, 3::int]"} \ term*\@{term \1::int\}\ value*\@{term \1::int\}\ term*\@{term \\x. x = 1\}\ value*\@{term \\x. x = 1\}\ term*\@{term \[2, 3::int]\}\ value*\@{term \[2, 3::int]\}\ prf refl full_prf refl term*\@{thm \HOL.refl\}\ value*\proof @{thm \HOL.refl\}\ value*\depth (proof @{thm \HOL.refl\})\ value*\size (proof @{thm \HOL.refl\})\ value*\fv_Proof (proof @{thm \HOL.refl\})\ term*\@{thms-of \HOL.refl\}\ value*\@{thms-of \HOL.refl\}\ ML\ val t_schematic = TVar(("'a",0), []) val t = @{term "Tv (Var (STR '''a'', 0)) {}"} val rt_schematic = ISA_core.reify_typ t_schematic val true = rt_schematic = t \ lemma test : "AAA \ BBB \ BBB \ AAA" by auto lemma test2 : "AAA \ BBB \ BBB \ AAA" by auto lemma test3: "AAAAA \ BBBBB \ BBBBB \ AAAAA" proof assume "AAAAA \ BBBBB" then obtain BBBBB and AAAAA .. then show "BBBBB \ AAAAA" .. qed lemma test4: assumes "(AAA \ BBB)" shows "BBB \ AAA" apply (insert assms) by auto declare[[show_sorts]] declare[[ML_print_depth = 20]] ML\ val full = true val thm = @{thm "test2"} val hyps = Thm.hyps_of thm val prems = Thm.prems_of thm val reconstruct_proof = Thm.reconstruct_proof_of thm val standard_proof = Proof_Syntax.standard_proof_of {full = full, expand_name = Thm.expand_name thm} thm val term_of_proof = Proof_Syntax.term_of_proof standard_proof \ ML\ (*See: *) \<^file>\~~/src/HOL/Proofs/ex/Proof_Terms.thy\\ ML\ val thm = @{thm test}; (*proof body with digest*) val body = Proofterm.strip_thm_body (Thm.proof_body_of thm); (*proof term only*) val prf = Proofterm.proof_of body; (*clean output*) Pretty.writeln (Proof_Syntax.pretty_standard_proof_of \<^context> false thm); Pretty.writeln (Proof_Syntax.pretty_standard_proof_of \<^context> true thm); (*all theorems used in the graph of nested proofs*) val all_thms = Proofterm.fold_body_thms (fn {name, ...} => insert (op =) name) [body] []; \ prf test full_prf test term*\@{thm \Reification_Test.test\}\ value*\@{thm \Reification_Test.test\}\ term*\@{thms-of \Reification_Test.test\}\ value*\@{thms-of \Reification_Test.test\}\ ML\ (*See: *) \<^file>\~~/src/HOL/Proofs/ex/Proof_Terms.thy\\ ML\ val thm = @{thm test4}; (*proof body with digest*) val body = Proofterm.strip_thm_body (Thm.proof_body_of thm); (*proof term only*) val prf = Proofterm.proof_of body; (*clean output*) Pretty.writeln (Proof_Syntax.pretty_standard_proof_of \<^context> false thm); Pretty.writeln (Proof_Syntax.pretty_standard_proof_of \<^context> true thm); (*all theorems used in the graph of nested proofs*) val all_thms = Proofterm.fold_body_thms (fn {name, ...} => insert (op =) name) [body] []; \ ML\ (*See: *) \<^file>\~~/src/HOL/Proofs/ex/Proof_Terms.thy\\ ML\ val thm = @{thm test2}; (*proof body with digest*) val body = Proofterm.strip_thm_body (Thm.proof_body_of thm); (*proof term only*) val prf = Proofterm.proof_of body; (*clean output*) Pretty.writeln (Proof_Syntax.pretty_standard_proof_of \<^context> false thm); Pretty.writeln (Proof_Syntax.pretty_standard_proof_of \<^context> true thm); (*all theorems used in the graph of nested proofs*) val all_thms = Proofterm.fold_body_thms (fn {name, ...} => insert (op =) name) [body] []; \ prf test2 full_prf test2 term*\@{thm \Reification_Test.test2\}\ value*\proof @{thm \Reification_Test.test2\}\ ML\ (*See: *) \<^file>\~~/src/HOL/Proofs/ex/Proof_Terms.thy\\ ML\ val thm = @{thm test3}; (*proof body with digest*) val body = Proofterm.strip_thm_body (Thm.proof_body_of thm); (*proof term only*) val prf = Proofterm.proof_of body; (*clean output*) Pretty.writeln (Proof_Syntax.pretty_standard_proof_of \<^context> false thm); Pretty.writeln (Proof_Syntax.pretty_standard_proof_of \<^context> true thm); (*all theorems used in the graph of nested proofs*) val all_thms = Proofterm.fold_body_thms (fn {name, ...} => insert (op =) name) [body] []; \ prf test2 full_prf test2 term*\@{thm \Reification_Test.test3\}\ value*\@{thm \Reification_Test.test3\}\ ML\ (*See: *) \<^file>\~~/src/HOL/Proofs/ex/Proof_Terms.thy\\ ML\ val thm = @{thm Pure.symmetric}; (*proof body with digest*) val body = Proofterm.strip_thm_body (Thm.proof_body_of thm); (*proof term only*) val prf = Proofterm.proof_of body; (*clean output*) Pretty.writeln (Proof_Syntax.pretty_standard_proof_of \<^context> false thm); Pretty.writeln (Proof_Syntax.pretty_standard_proof_of \<^context> true thm); (*all theorems used in the graph of nested proofs*) val all_thms = Proofterm.fold_body_thms (fn {name, ...} => insert (op =) name) [body] []; \ prf symmetric full_prf symmetric term*\@{thm \Pure.symmetric\}\ value*\@{thm \Pure.symmetric\}\ ML\ val full = true val thm = @{thm "Groups.minus_class.super"} val standard_proof = Proof_Syntax.standard_proof_of {full = full, expand_name = Thm.expand_name thm} thm val term_of_proof = Proof_Syntax.term_of_proof standard_proof \ ML\ val thm = Proof_Context.get_thm \<^context> "Groups.minus_class.super" val prop = Thm.prop_of thm val proof = Thm.proof_of thm \ prf Groups.minus_class.super full_prf Groups.minus_class.super term*\@{thm \Groups.minus_class.super\}\ value*\@{thm \Groups.minus_class.super\}\ (*ML\ val full = true val thm = @{thm "Homotopy.starlike_imp_contractible"} val standard_proof = Proof_Syntax.standard_proof_of {full = full, expand_name = Thm.expand_name thm} thm val term_of_proof = Proof_Syntax.term_of_proof standard_proof \ ML\ val thm = Proof_Context.get_thm \<^context> "Homotopy.starlike_imp_contractible" val prop = Thm.prop_of thm val proof = Thm.proof_of thm \ prf Homotopy.starlike_imp_contractible full_prf Homotopy.starlike_imp_contractible term*\@{thm \Homotopy.starlike_imp_contractible\}\ value*\@{thm \Homotopy.starlike_imp_contractible\}\*) end