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