src/HOL/Tools/Metis/metis_tactic.ML
changeset 67379 c2dfc510a38c
parent 62219 dbac573b27e7
child 69593 3dda49e08b9d
equal deleted inserted replaced
67378:2ebd0ef3a6b6 67379:c2dfc510a38c
   160              (0 upto length ths0 - 1) ths0
   160              (0 upto length ths0 - 1) ths0
   161       val ths = maps (snd o snd) th_cls_pairs
   161       val ths = maps (snd o snd) th_cls_pairs
   162       val dischargers = map (fst o snd) th_cls_pairs
   162       val dischargers = map (fst o snd) th_cls_pairs
   163       val cls = cls |> map (Drule.eta_contraction_rule #> do_lams)
   163       val cls = cls |> map (Drule.eta_contraction_rule #> do_lams)
   164       val _ = trace_msg ctxt (K "FOL_SOLVE: CONJECTURE CLAUSES")
   164       val _ = trace_msg ctxt (K "FOL_SOLVE: CONJECTURE CLAUSES")
   165       val _ = app (fn th => trace_msg ctxt (fn () => Thm.string_of_thm ctxt th)) cls
   165       val _ = List.app (fn th => trace_msg ctxt (fn () => Thm.string_of_thm ctxt th)) cls
   166       val _ = trace_msg ctxt (fn () => "type_enc = " ^ type_enc)
   166       val _ = trace_msg ctxt (fn () => "type_enc = " ^ type_enc)
   167       val type_enc = type_enc_of_string Strict type_enc
   167       val type_enc = type_enc_of_string Strict type_enc
   168       val (sym_tab, axioms, ord_info, concealed) =
   168       val (sym_tab, axioms, ord_info, concealed) =
   169         generate_metis_problem ctxt type_enc lam_trans cls ths
   169         generate_metis_problem ctxt type_enc lam_trans cls ths
   170       fun get_isa_thm mth Isa_Reflexive_or_Trivial =
   170       fun get_isa_thm mth Isa_Reflexive_or_Trivial =
   172         | get_isa_thm mth Isa_Lambda_Lifted =
   172         | get_isa_thm mth Isa_Lambda_Lifted =
   173           lam_lifted_of_metis ctxt type_enc sym_tab concealed mth
   173           lam_lifted_of_metis ctxt type_enc sym_tab concealed mth
   174         | get_isa_thm _ (Isa_Raw ith) = ith
   174         | get_isa_thm _ (Isa_Raw ith) = ith
   175       val axioms = axioms |> map (fn (mth, ith) => (mth, get_isa_thm mth ith))
   175       val axioms = axioms |> map (fn (mth, ith) => (mth, get_isa_thm mth ith))
   176       val _ = trace_msg ctxt (K "ISABELLE CLAUSES")
   176       val _ = trace_msg ctxt (K "ISABELLE CLAUSES")
   177       val _ = app (fn (_, ith) => trace_msg ctxt (fn () => Thm.string_of_thm ctxt ith)) axioms
   177       val _ = List.app (fn (_, ith) => trace_msg ctxt (fn () => Thm.string_of_thm ctxt ith)) axioms
   178       val _ = trace_msg ctxt (K "METIS CLAUSES")
   178       val _ = trace_msg ctxt (K "METIS CLAUSES")
   179       val _ = app (fn (mth, _) => trace_msg ctxt (fn () => Metis_Thm.toString mth)) axioms
   179       val _ = List.app (fn (mth, _) => trace_msg ctxt (fn () => Metis_Thm.toString mth)) axioms
   180       val _ = trace_msg ctxt (K "START METIS PROVE PROCESS")
   180       val _ = trace_msg ctxt (K "START METIS PROVE PROCESS")
   181       val ordering =
   181       val ordering =
   182         if Config.get ctxt advisory_simp then
   182         if Config.get ctxt advisory_simp then
   183           kbo_advisory_simp_ordering (ord_info ())
   183           kbo_advisory_simp_ordering (ord_info ())
   184         else
   184         else
   200                       (*add constraints arising from converting goal to clause form*)
   200                       (*add constraints arising from converting goal to clause form*)
   201          val proof = Metis_Proof.proof mth
   201          val proof = Metis_Proof.proof mth
   202          val result = fold (replay_one_inference ctxt' type_enc concealed sym_tab) proof axioms
   202          val result = fold (replay_one_inference ctxt' type_enc concealed sym_tab) proof axioms
   203          val used = map_filter (used_axioms axioms) proof
   203          val used = map_filter (used_axioms axioms) proof
   204          val _ = trace_msg ctxt (K "METIS COMPLETED; clauses actually used:")
   204          val _ = trace_msg ctxt (K "METIS COMPLETED; clauses actually used:")
   205          val _ = app (fn th => trace_msg ctxt (fn () => Thm.string_of_thm ctxt th)) used
   205          val _ = List.app (fn th => trace_msg ctxt (fn () => Thm.string_of_thm ctxt th)) used
   206          val (used_th_cls_pairs, unused_th_cls_pairs) =
   206          val (used_th_cls_pairs, unused_th_cls_pairs) =
   207            List.partition (have_common_thm ctxt used o snd o snd) th_cls_pairs
   207            List.partition (have_common_thm ctxt used o snd o snd) th_cls_pairs
   208          val unused_ths = maps (snd o snd) unused_th_cls_pairs
   208          val unused_ths = maps (snd o snd) unused_th_cls_pairs
   209          val unused_names = map fst unused_th_cls_pairs
   209          val unused_names = map fst unused_th_cls_pairs
   210        in
   210        in