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