src/HOL/Tools/metis_tools.ML
changeset 27178 c8ddb3000743
parent 27153 56b6cdce22f1
child 27230 c0103bc7f7eb
equal deleted inserted replaced
27177:adefd3454174 27178:c8ddb3000743
   468 
   468 
   469   (* ------------------------------------------------------------------------- *)
   469   (* ------------------------------------------------------------------------- *)
   470   (* Translation of HO Clauses                                                 *)
   470   (* Translation of HO Clauses                                                 *)
   471   (* ------------------------------------------------------------------------- *)
   471   (* ------------------------------------------------------------------------- *)
   472 
   472 
   473   fun cnf_th th = hd (ResAxioms.cnf_axiom th);
   473   fun cnf_th thy th = hd (ResAxioms.cnf_axiom thy th);
   474 
   474 
   475   val equal_imp_fequal' = cnf_th (thm"equal_imp_fequal");
   475   val equal_imp_fequal' = cnf_th @{theory} (thm"equal_imp_fequal");
   476   val fequal_imp_equal' = cnf_th (thm"fequal_imp_equal");
   476   val fequal_imp_equal' = cnf_th @{theory} (thm"fequal_imp_equal");
   477 
   477 
   478   val comb_I = cnf_th ResHolClause.comb_I;
   478   val comb_I = cnf_th @{theory} ResHolClause.comb_I;
   479   val comb_K = cnf_th ResHolClause.comb_K;
   479   val comb_K = cnf_th @{theory} ResHolClause.comb_K;
   480   val comb_B = cnf_th ResHolClause.comb_B;
   480   val comb_B = cnf_th @{theory} ResHolClause.comb_B;
   481   val comb_C = cnf_th ResHolClause.comb_C;
   481   val comb_C = cnf_th @{theory} ResHolClause.comb_C;
   482   val comb_S = cnf_th ResHolClause.comb_S;
   482   val comb_S = cnf_th @{theory} ResHolClause.comb_S;
   483 
   483 
   484   fun type_ext thy tms =
   484   fun type_ext thy tms =
   485     let val subs = ResAtp.tfree_classes_of_terms tms
   485     let val subs = ResAtp.tfree_classes_of_terms tms
   486         val supers = ResAtp.tvar_classes_of_terms tms
   486         val supers = ResAtp.tvar_classes_of_terms tms
   487         and tycons = ResAtp.type_consts_of_terms thy tms
   487         and tycons = ResAtp.type_consts_of_terms thy tms
   565 
   565 
   566   fun common_thm ths1 ths2 = exists (member Thm.eq_thm ths1) (map Meson.make_meta_clause ths2);
   566   fun common_thm ths1 ths2 = exists (member Thm.eq_thm ths1) (map Meson.make_meta_clause ths2);
   567 
   567 
   568   (* Main function to start metis prove and reconstruction *)
   568   (* Main function to start metis prove and reconstruction *)
   569   fun FOL_SOLVE mode ctxt cls ths0 =
   569   fun FOL_SOLVE mode ctxt cls ths0 =
   570     let val th_cls_pairs = map (fn th => (PureThy.get_name_hint th, ResAxioms.cnf_axiom th)) ths0
   570     let val thy = ProofContext.theory_of ctxt
       
   571         val th_cls_pairs = map (fn th => (PureThy.get_name_hint th, ResAxioms.cnf_axiom thy th)) ths0
   571         val ths = List.concat (map #2 th_cls_pairs)
   572         val ths = List.concat (map #2 th_cls_pairs)
   572         val _ = if exists(is_false o prop_of) cls then error "problem contains the empty clause"
   573         val _ = if exists(is_false o prop_of) cls then error "problem contains the empty clause"
   573                 else ();
   574                 else ();
   574         val _ = Output.debug (fn () => "FOL_SOLVE: CONJECTURE CLAUSES")
   575         val _ = Output.debug (fn () => "FOL_SOLVE: CONJECTURE CLAUSES")
   575         val _ = app (fn th => Output.debug (fn () => Display.string_of_thm th)) cls
   576         val _ = app (fn th => Output.debug (fn () => Display.string_of_thm th)) cls