93 val combination : term -> term -> term -> term -> typ -> proof -> proof -> proof |
93 val combination : term -> term -> term -> term -> typ -> proof -> proof -> proof |
94 val equal_intr : term -> term -> proof -> proof -> proof |
94 val equal_intr : term -> term -> proof -> proof -> proof |
95 val equal_elim : term -> term -> proof -> proof -> proof |
95 val equal_elim : term -> term -> proof -> proof -> proof |
96 val axm_proof : string -> term -> proof |
96 val axm_proof : string -> term -> proof |
97 val oracle_proof : string -> term -> proof |
97 val oracle_proof : string -> term -> proof |
98 val thm_proof : Sign.sg -> string * (string * string list) list -> |
98 val thm_proof : theory -> string * (string * string list) list -> |
99 term list -> term -> proof -> proof |
99 term list -> term -> proof -> proof |
100 val get_name_tags : term list -> term -> proof -> string * (string * string list) list |
100 val get_name_tags : term list -> term -> proof -> string * (string * string list) list |
101 |
101 |
102 (** rewriting on proof terms **) |
102 (** rewriting on proof terms **) |
103 val add_prf_rrules : (proof * proof) list -> theory -> theory |
103 val add_prf_rrules : (proof * proof) list -> theory -> theory |
1091 |
1091 |
1092 (**** theory data ****) |
1092 (**** theory data ****) |
1093 |
1093 |
1094 (* data kind 'Pure/proof' *) |
1094 (* data kind 'Pure/proof' *) |
1095 |
1095 |
1096 structure ProofArgs = |
1096 structure ProofData = TheoryDataFun |
1097 struct |
1097 (struct |
1098 val name = "Pure/proof"; |
1098 val name = "Pure/proof"; |
1099 type T = ((proof * proof) list * |
1099 type T = ((proof * proof) list * |
1100 (string * (typ list -> proof -> proof option)) list); |
1100 (string * (typ list -> proof -> proof option)) list); |
1101 |
1101 |
1102 val empty = ([], []); |
1102 val empty = ([], []); |
1103 val copy = I; |
1103 val copy = I; |
1104 val prep_ext = I; |
1104 val extend = I; |
1105 fun merge ((rules1, procs1), (rules2, procs2)) = |
1105 fun merge _ ((rules1, procs1), (rules2, procs2)) = |
1106 (merge_lists rules1 rules2, merge_alists procs1 procs2); |
1106 (merge_lists rules1 rules2, merge_alists procs1 procs2); |
1107 fun print _ _ = (); |
1107 fun print _ _ = (); |
1108 end; |
1108 end); |
1109 |
|
1110 structure ProofData = TheoryDataFun(ProofArgs); |
|
1111 |
1109 |
1112 val init = ProofData.init; |
1110 val init = ProofData.init; |
1113 |
1111 |
1114 fun add_prf_rrules rs thy = |
1112 fun add_prf_rrules rs thy = |
1115 let val r = ProofData.get thy |
1113 let val r = ProofData.get thy |
1117 |
1115 |
1118 fun add_prf_rprocs ps thy = |
1116 fun add_prf_rprocs ps thy = |
1119 let val r = ProofData.get thy |
1117 let val r = ProofData.get thy |
1120 in ProofData.put (fst r, ps @ snd r) thy end; |
1118 in ProofData.put (fst r, ps @ snd r) thy end; |
1121 |
1119 |
1122 fun thm_proof sign (name, tags) hyps prop prf = |
1120 fun thm_proof thy (name, tags) hyps prop prf = |
1123 let |
1121 let |
1124 val prop = Logic.list_implies (hyps, prop); |
1122 val prop = Logic.list_implies (hyps, prop); |
1125 val nvs = needed_vars prop; |
1123 val nvs = needed_vars prop; |
1126 val args = map (fn (v as Var (ixn, _)) => |
1124 val args = map (fn (v as Var (ixn, _)) => |
1127 if ixn mem nvs then SOME v else NONE) (vars_of prop) @ |
1125 if ixn mem nvs then SOME v else NONE) (vars_of prop) @ |
1128 map SOME (sort (make_ord atless) (term_frees prop)); |
1126 map SOME (sort (make_ord atless) (term_frees prop)); |
1129 val opt_prf = if ! proofs = 2 then |
1127 val opt_prf = if ! proofs = 2 then |
1130 #4 (shrink [] 0 (rewrite_prf fst (ProofData.get_sg sign) |
1128 #4 (shrink [] 0 (rewrite_prf fst (ProofData.get thy) |
1131 (foldr (uncurry implies_intr_proof) prf hyps))) |
1129 (foldr (uncurry implies_intr_proof) prf hyps))) |
1132 else MinProof (mk_min_proof ([], prf)); |
1130 else MinProof (mk_min_proof ([], prf)); |
1133 val head = (case strip_combt (fst (strip_combP prf)) of |
1131 val head = (case strip_combt (fst (strip_combP prf)) of |
1134 (PThm ((old_name, _), prf', prop', NONE), args') => |
1132 (PThm ((old_name, _), prf', prop', NONE), args') => |
1135 if (old_name="" orelse old_name=name) andalso |
1133 if (old_name="" orelse old_name=name) andalso |