equal
deleted
inserted
replaced
166 This ought to be sufficient for emulating extcnf_combined, |
166 This ought to be sufficient for emulating extcnf_combined, |
167 but note that the complexity of the problem can be enormous.*) |
167 but note that the complexity of the problem can be enormous.*) |
168 fun inst_parametermatch_tac ctxt thms i = fn st => |
168 fun inst_parametermatch_tac ctxt thms i = fn st => |
169 let |
169 let |
170 val gls = |
170 val gls = |
171 prop_of st |
171 Thm.prop_of st |
172 |> Logic.strip_horn |
172 |> Logic.strip_horn |
173 |> fst |
173 |> fst |
174 |
174 |
175 val parameters = |
175 val parameters = |
176 if null gls then [] |
176 if null gls then [] |
202 match variables having identical names. Logically, this is |
202 match variables having identical names. Logically, this is |
203 a hack. But it reduces the complexity of the problem.*) |
203 a hack. But it reduces the complexity of the problem.*) |
204 fun nominal_inst_parametermatch_tac ctxt thm i = fn st => |
204 fun nominal_inst_parametermatch_tac ctxt thm i = fn st => |
205 let |
205 let |
206 val gls = |
206 val gls = |
207 prop_of st |
207 Thm.prop_of st |
208 |> Logic.strip_horn |
208 |> Logic.strip_horn |
209 |> fst |
209 |> fst |
210 |
210 |
211 val parameters = |
211 val parameters = |
212 if null gls then [] |
212 if null gls then [] |
245 the hypothesis' quantifiers to have the ones appearing in the |
245 the hypothesis' quantifiers to have the ones appearing in the |
246 conclusion first.*) |
246 conclusion first.*) |
247 fun canonicalise_qtfr_order ctxt i = fn st => |
247 fun canonicalise_qtfr_order ctxt i = fn st => |
248 let |
248 let |
249 val gls = |
249 val gls = |
250 prop_of st |
250 Thm.prop_of st |
251 |> Logic.strip_horn |
251 |> Logic.strip_horn |
252 |> fst |
252 |> fst |
253 in |
253 in |
254 if null gls then raise NO_GOALS |
254 if null gls then raise NO_GOALS |
255 else |
255 else |
647 fun forall_neg_tac candidate_consts ctxt i = fn st => |
647 fun forall_neg_tac candidate_consts ctxt i = fn st => |
648 let |
648 let |
649 val thy = Proof_Context.theory_of ctxt |
649 val thy = Proof_Context.theory_of ctxt |
650 |
650 |
651 val gls = |
651 val gls = |
652 prop_of st |
652 Thm.prop_of st |
653 |> Logic.strip_horn |
653 |> Logic.strip_horn |
654 |> fst |
654 |> fst |
655 |
655 |
656 val parameters = |
656 val parameters = |
657 if null gls then "" |
657 if null gls then "" |
687 fun absorb_skolem_def ctxt prob_name_opt i = fn st => |
687 fun absorb_skolem_def ctxt prob_name_opt i = fn st => |
688 let |
688 let |
689 val thy = Proof_Context.theory_of ctxt |
689 val thy = Proof_Context.theory_of ctxt |
690 |
690 |
691 val gls = |
691 val gls = |
692 prop_of st |
692 Thm.prop_of st |
693 |> Logic.strip_horn |
693 |> Logic.strip_horn |
694 |> fst |
694 |> fst |
695 |
695 |
696 val conclusion = |
696 val conclusion = |
697 if null gls then |
697 if null gls then |
762 fun find_skolem_term ctxt consts_candidate arity = fn st => |
762 fun find_skolem_term ctxt consts_candidate arity = fn st => |
763 let |
763 let |
764 val _ = @{assert} (arity > 0) |
764 val _ = @{assert} (arity > 0) |
765 |
765 |
766 val gls = |
766 val gls = |
767 prop_of st |
767 Thm.prop_of st |
768 |> Logic.strip_horn |
768 |> Logic.strip_horn |
769 |> fst |
769 |> fst |
770 |
770 |
771 (*extract the conclusion of each subgoal*) |
771 (*extract the conclusion of each subgoal*) |
772 val conclusions = |
772 val conclusions = |
807 fun instantiate_skols ctxt consts_candidates i = fn st => |
807 fun instantiate_skols ctxt consts_candidates i = fn st => |
808 let |
808 let |
809 val thy = Proof_Context.theory_of ctxt |
809 val thy = Proof_Context.theory_of ctxt |
810 |
810 |
811 val gls = |
811 val gls = |
812 prop_of st |
812 Thm.prop_of st |
813 |> Logic.strip_horn |
813 |> Logic.strip_horn |
814 |> fst |
814 |> fst |
815 |
815 |
816 val (params, conclusion) = |
816 val (params, conclusion) = |
817 if null gls then |
817 if null gls then |
915 |
915 |
916 (*prefix a skolem term with bindings for the parameters*) |
916 (*prefix a skolem term with bindings for the parameters*) |
917 (* val contextualise = fold absdummy (map snd params) *) |
917 (* val contextualise = fold absdummy (map snd params) *) |
918 val contextualise = fold absfree params |
918 val contextualise = fold absfree params |
919 |
919 |
920 val skolem_cts = map (contextualise #> cterm_of thy) skolem_terms |
920 val skolem_cts = map (contextualise #> Thm.cterm_of thy) skolem_terms |
921 |
921 |
922 |
922 |
923 (*now the instantiation code*) |
923 (*now the instantiation code*) |
924 |
924 |
925 (*there should only be one Var -- that is from the previous application of drule leo2_skolemise. We look for it at the head position in some equation at a conclusion of a subgoal.*) |
925 (*there should only be one Var -- that is from the previous application of drule leo2_skolemise. We look for it at the head position in some equation at a conclusion of a subgoal.*) |
935 |> maps (switch Term.add_vars []) |
935 |> maps (switch Term.add_vars []) |
936 |
936 |
937 fun make_var pre_var = |
937 fun make_var pre_var = |
938 the_single pre_var |
938 the_single pre_var |
939 |> Var |
939 |> Var |
940 |> cterm_of thy |
940 |> Thm.cterm_of thy |
941 |> SOME |
941 |> SOME |
942 in |
942 in |
943 if null pre_var then NONE |
943 if null pre_var then NONE |
944 else make_var pre_var |
944 else make_var pre_var |
945 end |
945 end |
1047 * Assumes that there is a single hypothesis |
1047 * Assumes that there is a single hypothesis |
1048 *) |
1048 *) |
1049 fun find_dec_arity i = fn st => |
1049 fun find_dec_arity i = fn st => |
1050 let |
1050 let |
1051 val gls = |
1051 val gls = |
1052 prop_of st |
1052 Thm.prop_of st |
1053 |> Logic.strip_horn |
1053 |> Logic.strip_horn |
1054 |> fst |
1054 |> fst |
1055 in |
1055 in |
1056 if null gls then raise NO_GOALS |
1056 if null gls then raise NO_GOALS |
1057 else |
1057 else |
1091 |
1091 |
1092 (*given an inference, it returns the parameters (i.e., we've already matched the leading & shared quantification in the hypothesis & conclusion clauses), and the "raw" inference*) |
1092 (*given an inference, it returns the parameters (i.e., we've already matched the leading & shared quantification in the hypothesis & conclusion clauses), and the "raw" inference*) |
1093 fun breakdown_inference i = fn st => |
1093 fun breakdown_inference i = fn st => |
1094 let |
1094 let |
1095 val gls = |
1095 val gls = |
1096 prop_of st |
1096 Thm.prop_of st |
1097 |> Logic.strip_horn |
1097 |> Logic.strip_horn |
1098 |> fst |
1098 |> fst |
1099 in |
1099 in |
1100 if null gls then raise NO_GOALS |
1100 if null gls then raise NO_GOALS |
1101 else |
1101 else |
1108 fun extuni_dec_elim_rule ctxt arity i = fn st => |
1108 fun extuni_dec_elim_rule ctxt arity i = fn st => |
1109 let |
1109 let |
1110 val rule = extuni_dec_n ctxt arity |
1110 val rule = extuni_dec_n ctxt arity |
1111 |
1111 |
1112 val rule_hyp = |
1112 val rule_hyp = |
1113 prop_of rule |
1113 Thm.prop_of rule |
1114 |> Logic.dest_implies |
1114 |> Logic.dest_implies |
1115 |> fst (*assuming that rule has single hypothesis*) |
1115 |> fst (*assuming that rule has single hypothesis*) |
1116 |
1116 |
1117 (*having run break_hypothesis earlier, we know that the hypothesis |
1117 (*having run break_hypothesis earlier, we know that the hypothesis |
1118 now consists of a single literal. We can (and should) |
1118 now consists of a single literal. We can (and should) |
1206 or implications; the number of antecedents; and the polarity |
1206 or implications; the number of antecedents; and the polarity |
1207 of the original clause -- I think this will always be "false".*) |
1207 of the original clause -- I think this will always be "false".*) |
1208 fun standard_cnf_type ctxt i : thm -> (TPTP_Reconstruct.formula_kind * int * bool) option = fn st => |
1208 fun standard_cnf_type ctxt i : thm -> (TPTP_Reconstruct.formula_kind * int * bool) option = fn st => |
1209 let |
1209 let |
1210 val gls = |
1210 val gls = |
1211 prop_of st |
1211 Thm.prop_of st |
1212 |> Logic.strip_horn |
1212 |> Logic.strip_horn |
1213 |> fst |
1213 |> fst |
1214 |
1214 |
1215 val hypos = |
1215 val hypos = |
1216 if null gls then raise NO_GOALS |
1216 if null gls then raise NO_GOALS |
1679 |
1679 |
1680 (*difference in constants between the hypothesis clause and the conclusion clause*) |
1680 (*difference in constants between the hypothesis clause and the conclusion clause*) |
1681 fun clause_consts_diff thm = |
1681 fun clause_consts_diff thm = |
1682 let |
1682 let |
1683 val t = |
1683 val t = |
1684 prop_of thm |
1684 Thm.prop_of thm |
1685 |> Logic.dest_implies |
1685 |> Logic.dest_implies |
1686 |> fst |
1686 |> fst |
1687 |
1687 |
1688 (*This bit should not be needed, since Leo2 inferences don't have parameters*) |
1688 (*This bit should not be needed, since Leo2 inferences don't have parameters*) |
1689 |> TPTP_Reconstruct.strip_top_all_vars [] |
1689 |> TPTP_Reconstruct.strip_top_all_vars [] |
1705 (*remove quantification in hypothesis clause (! X. t), if |
1705 (*remove quantification in hypothesis clause (! X. t), if |
1706 X not free in t*) |
1706 X not free in t*) |
1707 fun remove_redundant_quantification ctxt i = fn st => |
1707 fun remove_redundant_quantification ctxt i = fn st => |
1708 let |
1708 let |
1709 val gls = |
1709 val gls = |
1710 prop_of st |
1710 Thm.prop_of st |
1711 |> Logic.strip_horn |
1711 |> Logic.strip_horn |
1712 |> fst |
1712 |> fst |
1713 in |
1713 in |
1714 if null gls then raise NO_GOALS |
1714 if null gls then raise NO_GOALS |
1715 else |
1715 else |
1761 (*remove quantification in the literal "(! X. t) = True/False" |
1761 (*remove quantification in the literal "(! X. t) = True/False" |
1762 in the singleton hypothesis clause, if X not free in t*) |
1762 in the singleton hypothesis clause, if X not free in t*) |
1763 fun remove_redundant_quantification_in_lit ctxt i = fn st => |
1763 fun remove_redundant_quantification_in_lit ctxt i = fn st => |
1764 let |
1764 let |
1765 val gls = |
1765 val gls = |
1766 prop_of st |
1766 Thm.prop_of st |
1767 |> Logic.strip_horn |
1767 |> Logic.strip_horn |
1768 |> fst |
1768 |> fst |
1769 in |
1769 in |
1770 if null gls then raise NO_GOALS |
1770 if null gls then raise NO_GOALS |
1771 else |
1771 else |
2001 in |
2001 in |
2002 TPTP_Reconstruct.inference_at_node |
2002 TPTP_Reconstruct.inference_at_node |
2003 thy |
2003 thy |
2004 prob_name (#meta pannot) n |
2004 prob_name (#meta pannot) n |
2005 |> the |
2005 |> the |
2006 |> (fn {inference_fmla, ...} => cterm_of thy inference_fmla) |
2006 |> (fn {inference_fmla, ...} => Thm.cterm_of thy inference_fmla) |
2007 |> oracle_iinterp |
2007 |> oracle_iinterp |
2008 end |
2008 end |
2009 *} |
2009 *} |
2010 |
2010 |
2011 |
2011 |