src/HOL/Sledgehammer.thy
author blanchet
Fri Jun 11 17:10:23 2010 +0200 (2010-06-11)
changeset 37399 34f080a12063
parent 36569 3a29eb7606c3
child 37410 2bf7e6136047
permissions -rw-r--r--
proper polymorphic Skolemization of uncached facts + synchronization of caching and relevance filter
     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   "~~/src/Tools/Metis/metis.ML"
    14   "Tools/Sledgehammer/sledgehammer_util.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_systems.ML")
    22   ("Tools/Sledgehammer/sledgehammer_fact_minimizer.ML")
    23   ("Tools/Sledgehammer/sledgehammer_isar.ML")
    24   ("Tools/Sledgehammer/meson_tactic.ML")
    25   ("Tools/Sledgehammer/metis_tactics.ML")
    26 begin
    27 
    28 definition skolem_Eps :: "('a \<Rightarrow> bool) \<Rightarrow> 'a" where
    29 [no_atp]: "skolem_Eps = Eps"
    30 
    31 lemma skolem_someI_ex [no_atp]: "\<exists>x. P x \<Longrightarrow> P (skolem_Eps (\<lambda>x. P x))"
    32 unfolding skolem_Eps_def by (rule someI_ex)
    33 
    34 definition COMBI :: "'a \<Rightarrow> 'a" where
    35 [no_atp]: "COMBI P \<equiv> P"
    36 
    37 definition COMBK :: "'a \<Rightarrow> 'b \<Rightarrow> 'a" where
    38 [no_atp]: "COMBK P Q \<equiv> P"
    39 
    40 definition COMBB :: "('b => 'c) \<Rightarrow> ('a => 'b) \<Rightarrow> 'a \<Rightarrow> 'c" where [no_atp]:
    41 "COMBB P Q R \<equiv> P (Q R)"
    42 
    43 definition COMBC :: "('a \<Rightarrow> 'b \<Rightarrow> 'c) \<Rightarrow> 'b \<Rightarrow> 'a \<Rightarrow> 'c" where
    44 [no_atp]: "COMBC P Q R \<equiv> P R Q"
    45 
    46 definition COMBS :: "('a \<Rightarrow> 'b \<Rightarrow> 'c) \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> 'a \<Rightarrow> 'c" where
    47 [no_atp]: "COMBS P Q R \<equiv> P R (Q R)"
    48 
    49 definition fequal :: "'a \<Rightarrow> 'a \<Rightarrow> bool" where [no_atp]:
    50 "fequal X Y \<equiv> (X = Y)"
    51 
    52 lemma fequal_imp_equal [no_atp]: "fequal X Y \<Longrightarrow> X = Y"
    53   by (simp add: fequal_def)
    54 
    55 lemma equal_imp_fequal [no_atp]: "X = Y \<Longrightarrow> fequal X Y"
    56   by (simp add: fequal_def)
    57 
    58 text{*These two represent the equivalence between Boolean equality and iff.
    59 They can't be converted to clauses automatically, as the iff would be
    60 expanded...*}
    61 
    62 lemma iff_positive: "P \<or> Q \<or> P = Q"
    63 by blast
    64 
    65 lemma iff_negative: "\<not> P \<or> \<not> Q \<or> P = Q"
    66 by blast
    67 
    68 text{*Theorems for translation to combinators*}
    69 
    70 lemma abs_S [no_atp]: "\<lambda>x. (f x) (g x) \<equiv> COMBS f g"
    71 apply (rule eq_reflection)
    72 apply (rule ext) 
    73 apply (simp add: COMBS_def) 
    74 done
    75 
    76 lemma abs_I [no_atp]: "\<lambda>x. x \<equiv> COMBI"
    77 apply (rule eq_reflection)
    78 apply (rule ext) 
    79 apply (simp add: COMBI_def) 
    80 done
    81 
    82 lemma abs_K [no_atp]: "\<lambda>x. y \<equiv> COMBK y"
    83 apply (rule eq_reflection)
    84 apply (rule ext) 
    85 apply (simp add: COMBK_def) 
    86 done
    87 
    88 lemma abs_B [no_atp]: "\<lambda>x. a (g x) \<equiv> COMBB a g"
    89 apply (rule eq_reflection)
    90 apply (rule ext) 
    91 apply (simp add: COMBB_def) 
    92 done
    93 
    94 lemma abs_C [no_atp]: "\<lambda>x. (f x) b \<equiv> COMBC f b"
    95 apply (rule eq_reflection)
    96 apply (rule ext) 
    97 apply (simp add: COMBC_def) 
    98 done
    99 
   100 
   101 subsection {* Setup of external ATPs *}
   102 
   103 use "Tools/Sledgehammer/sledgehammer_fol_clause.ML"
   104 use "Tools/Sledgehammer/sledgehammer_fact_preprocessor.ML"
   105 setup Sledgehammer_Fact_Preprocessor.setup
   106 use "Tools/Sledgehammer/sledgehammer_hol_clause.ML"
   107 use "Tools/Sledgehammer/sledgehammer_proof_reconstruct.ML"
   108 use "Tools/Sledgehammer/sledgehammer_fact_filter.ML"
   109 use "Tools/ATP_Manager/atp_manager.ML"
   110 use "Tools/ATP_Manager/atp_systems.ML"
   111 setup ATP_Systems.setup
   112 use "Tools/Sledgehammer/sledgehammer_fact_minimizer.ML"
   113 use "Tools/Sledgehammer/sledgehammer_isar.ML"
   114 setup Sledgehammer_Isar.setup
   115 
   116 
   117 subsection {* The MESON prover *}
   118 
   119 use "Tools/Sledgehammer/meson_tactic.ML"
   120 setup Meson_Tactic.setup
   121 
   122 
   123 subsection {* The Metis prover *}
   124 
   125 use "Tools/Sledgehammer/metis_tactics.ML"
   126 setup Metis_Tactics.setup
   127 
   128 end