src/HOL/Sledgehammer.thy
author blanchet
Fri Mar 19 13:02:18 2010 +0100 (2010-03-19)
changeset 35865 2f8fb5242799
parent 35827 f552152d7747
child 35866 513074557e06
permissions -rw-r--r--
more Sledgehammer refactoring
     1 (*  Title:      HOL/Sledgehammer.thy
     2     Author:     Lawrence C Paulson
     3     Author:     Jia Meng, NICTA
     4     Author:     Fabian Immler, TU Muenchen
     5     Author:     Jasmin Blanchette, TU Muenchen
     6 *)
     7 
     8 header {* Sledgehammer: Isabelle--ATP Linkup *}
     9 
    10 theory Sledgehammer
    11 imports Plain Hilbert_Choice
    12 uses
    13   "Tools/polyhash.ML"
    14   "~~/src/Tools/Metis/metis.ML"
    15   ("Tools/Sledgehammer/sledgehammer_fol_clause.ML")
    16   ("Tools/Sledgehammer/sledgehammer_fact_preprocessor.ML")
    17   ("Tools/Sledgehammer/sledgehammer_hol_clause.ML")
    18   ("Tools/Sledgehammer/sledgehammer_proof_reconstruct.ML")
    19   ("Tools/Sledgehammer/sledgehammer_fact_filter.ML")
    20   ("Tools/ATP_Manager/atp_manager.ML")
    21   ("Tools/ATP_Manager/atp_wrapper.ML")
    22   ("Tools/ATP_Manager/atp_minimal.ML")
    23   ("Tools/Sledgehammer/meson_tactic.ML")
    24   ("Tools/Sledgehammer/metis_tactics.ML")
    25 begin
    26 
    27 definition COMBI :: "'a \<Rightarrow> 'a"
    28   where "COMBI P \<equiv> P"
    29 
    30 definition COMBK :: "'a \<Rightarrow> 'b \<Rightarrow> 'a"
    31   where "COMBK P Q \<equiv> P"
    32 
    33 definition COMBB :: "('b => 'c) \<Rightarrow> ('a => 'b) \<Rightarrow> 'a \<Rightarrow> 'c"
    34   where "COMBB P Q R \<equiv> P (Q R)"
    35 
    36 definition COMBC :: "('a \<Rightarrow> 'b \<Rightarrow> 'c) \<Rightarrow> 'b \<Rightarrow> 'a \<Rightarrow> 'c"
    37   where "COMBC P Q R \<equiv> P R Q"
    38 
    39 definition COMBS :: "('a \<Rightarrow> 'b \<Rightarrow> 'c) \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> 'a \<Rightarrow> 'c"
    40   where "COMBS P Q R \<equiv> P R (Q R)"
    41 
    42 definition fequal :: "'a \<Rightarrow> 'a \<Rightarrow> bool"
    43   where "fequal X Y \<equiv> (X = Y)"
    44 
    45 lemma fequal_imp_equal: "fequal X Y \<Longrightarrow> X = Y"
    46   by (simp add: fequal_def)
    47 
    48 lemma equal_imp_fequal: "X = Y \<Longrightarrow> fequal X Y"
    49   by (simp add: fequal_def)
    50 
    51 text{*These two represent the equivalence between Boolean equality and iff.
    52 They can't be converted to clauses automatically, as the iff would be
    53 expanded...*}
    54 
    55 lemma iff_positive: "P \<or> Q \<or> P = Q"
    56 by blast
    57 
    58 lemma iff_negative: "\<not> P \<or> \<not> Q \<or> P = Q"
    59 by blast
    60 
    61 text{*Theorems for translation to combinators*}
    62 
    63 lemma abs_S: "\<lambda>x. (f x) (g x) \<equiv> COMBS f g"
    64 apply (rule eq_reflection)
    65 apply (rule ext) 
    66 apply (simp add: COMBS_def) 
    67 done
    68 
    69 lemma abs_I: "\<lambda>x. x \<equiv> COMBI"
    70 apply (rule eq_reflection)
    71 apply (rule ext) 
    72 apply (simp add: COMBI_def) 
    73 done
    74 
    75 lemma abs_K: "\<lambda>x. y \<equiv> COMBK y"
    76 apply (rule eq_reflection)
    77 apply (rule ext) 
    78 apply (simp add: COMBK_def) 
    79 done
    80 
    81 lemma abs_B: "\<lambda>x. a (g x) \<equiv> COMBB a g"
    82 apply (rule eq_reflection)
    83 apply (rule ext) 
    84 apply (simp add: COMBB_def) 
    85 done
    86 
    87 lemma abs_C: "\<lambda>x. (f x) b \<equiv> COMBC f b"
    88 apply (rule eq_reflection)
    89 apply (rule ext) 
    90 apply (simp add: COMBC_def) 
    91 done
    92 
    93 subsection {* Setup of external ATPs *}
    94 
    95 use "Tools/Sledgehammer/sledgehammer_fol_clause.ML"
    96 use "Tools/Sledgehammer/sledgehammer_fact_preprocessor.ML"
    97 setup Sledgehammer_Fact_Preprocessor.setup
    98 use "Tools/Sledgehammer/sledgehammer_hol_clause.ML"
    99 use "Tools/Sledgehammer/sledgehammer_proof_reconstruct.ML"
   100 setup Sledgehammer_Proof_Reconstruct.setup
   101 use "Tools/Sledgehammer/sledgehammer_fact_filter.ML"
   102 
   103 use "Tools/ATP_Manager/atp_wrapper.ML"
   104 setup ATP_Wrapper.setup
   105 use "Tools/ATP_Manager/atp_manager.ML"
   106 use "Tools/ATP_Manager/atp_minimal.ML"
   107 
   108 text {* basic provers *}
   109 setup {* ATP_Manager.add_prover ATP_Wrapper.spass *}
   110 setup {* ATP_Manager.add_prover ATP_Wrapper.vampire *}
   111 setup {* ATP_Manager.add_prover ATP_Wrapper.eprover *}
   112 
   113 text {* provers with stuctured output *}
   114 setup {* ATP_Manager.add_prover ATP_Wrapper.vampire_full *}
   115 setup {* ATP_Manager.add_prover ATP_Wrapper.eprover_full *}
   116 
   117 text {* on some problems better results *}
   118 setup {* ATP_Manager.add_prover ATP_Wrapper.spass_no_tc *}
   119 
   120 text {* remote provers via SystemOnTPTP *}
   121 setup {* ATP_Manager.add_prover ATP_Wrapper.remote_vampire *}
   122 setup {* ATP_Manager.add_prover ATP_Wrapper.remote_spass *}
   123 setup {* ATP_Manager.add_prover ATP_Wrapper.remote_eprover *}
   124 
   125 
   126 subsection {* The MESON prover *}
   127 
   128 use "Tools/Sledgehammer/meson_tactic.ML"
   129 setup Meson_Tactic.setup
   130 
   131 
   132 subsection {* The Metis prover *}
   133 
   134 use "Tools/Sledgehammer/metis_tactics.ML"
   135 setup Metis_Tactics.setup
   136 
   137 end