src/HOL/Tools/sat.ML
changeset 74610 87fc10f5826c
parent 74290 b2ad24b5a42c
child 77808 b43ee37926a9
equal deleted inserted replaced
74609:3ef6e38c9847 74610:87fc10f5826c
    67 
    67 
    68 val solver = Attrib.setup_config_string \<^binding>\<open>sat_solver\<close> (K "cdclite");
    68 val solver = Attrib.setup_config_string \<^binding>\<open>sat_solver\<close> (K "cdclite");
    69   (*see HOL/Tools/sat_solver.ML for possible values*)
    69   (*see HOL/Tools/sat_solver.ML for possible values*)
    70 
    70 
    71 val counter = Unsynchronized.ref 0;
    71 val counter = Unsynchronized.ref 0;
    72 
       
    73 val resolution_thm =
       
    74   @{lemma "(P \<Longrightarrow> False) \<Longrightarrow> (\<not> P \<Longrightarrow> False) \<Longrightarrow> False" by (rule case_split)}
       
    75 
    72 
    76 (* ------------------------------------------------------------------------- *)
    73 (* ------------------------------------------------------------------------- *)
    77 (* lit_ord: an order on integers that considers their absolute values only,  *)
    74 (* lit_ord: an order on integers that considers their absolute values only,  *)
    78 (*      thereby treating integers that represent the same atom (positively   *)
    75 (*      thereby treating integers that represent the same atom (positively   *)
    79 (*      or negatively) as equal                                              *)
    76 (*      or negatively) as equal                                              *)
   164             val (hyp1_is_neg, hyp1, hyp2, new_hyps) = find_res_hyps (hyps1, hyps2) []
   161             val (hyp1_is_neg, hyp1, hyp2, new_hyps) = find_res_hyps (hyps1, hyps2) []
   165 
   162 
   166             val c1' = Thm.implies_intr hyp1 c1  (* Gamma1 |- hyp1 ==> False *)
   163             val c1' = Thm.implies_intr hyp1 c1  (* Gamma1 |- hyp1 ==> False *)
   167             val c2' = Thm.implies_intr hyp2 c2  (* Gamma2 |- hyp2 ==> False *)
   164             val c2' = Thm.implies_intr hyp2 c2  (* Gamma2 |- hyp2 ==> False *)
   168 
   165 
   169             val res_thm =  (* |- (lit ==> False) ==> (~lit ==> False) ==> False *)
   166             val res_thm =
   170               let
   167               let
   171                 val cLit =
   168                 val P =
   172                   snd (Thm.dest_comb (if hyp1_is_neg then hyp2 else hyp1))  (* strip Trueprop *)
   169                   snd (Thm.dest_comb (if hyp1_is_neg then hyp2 else hyp1))  (* strip Trueprop *)
   173               in
   170               in
   174                 Thm.instantiate (TVars.empty, Vars.make [(\<^var>\<open>?P::bool\<close>, cLit)]) resolution_thm
   171                 \<^instantiate>\<open>P in
       
   172                   lemma \<open>(P \<Longrightarrow> False) \<Longrightarrow> (\<not> P \<Longrightarrow> False) \<Longrightarrow> False\<close> by (rule case_split)\<close>
   175               end
   173               end
   176 
   174 
   177             val _ =
   175             val _ =
   178               cond_tracing ctxt
   176               cond_tracing ctxt
   179                 (fn () => "Resolution theorem: " ^ Thm.string_of_thm ctxt res_thm)
   177                 (fn () => "Resolution theorem: " ^ Thm.string_of_thm ctxt res_thm)