src/HOL/Sledgehammer.thy
author blanchet
Fri Mar 19 15:07:44 2010 +0100 (2010-03-19)
changeset 35866 513074557e06
parent 35865 2f8fb5242799
child 35867 16279c4c7a33
permissions -rw-r--r--
move the Sledgehammer Isar commands together into one file;
this will make easier to add options and reorganize them later
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@35866
    23
  ("Tools/Sledgehammer/sledgehammer_isar.ML")
blanchet@35865
    24
  ("Tools/Sledgehammer/meson_tactic.ML")
blanchet@35825
    25
  ("Tools/Sledgehammer/metis_tactics.ML")
wenzelm@21254
    26
begin
wenzelm@21254
    27
blanchet@35865
    28
definition COMBI :: "'a \<Rightarrow> 'a"
blanchet@35865
    29
  where "COMBI P \<equiv> P"
wenzelm@24819
    30
blanchet@35865
    31
definition COMBK :: "'a \<Rightarrow> 'b \<Rightarrow> 'a"
blanchet@35865
    32
  where "COMBK P Q \<equiv> P"
wenzelm@21254
    33
blanchet@35865
    34
definition COMBB :: "('b => 'c) \<Rightarrow> ('a => 'b) \<Rightarrow> 'a \<Rightarrow> 'c"
blanchet@35865
    35
  where "COMBB P Q R \<equiv> P (Q R)"
wenzelm@21254
    36
blanchet@35865
    37
definition COMBC :: "('a \<Rightarrow> 'b \<Rightarrow> 'c) \<Rightarrow> 'b \<Rightarrow> 'a \<Rightarrow> 'c"
blanchet@35865
    38
  where "COMBC P Q R \<equiv> P R Q"
wenzelm@21254
    39
blanchet@35865
    40
definition COMBS :: "('a \<Rightarrow> 'b \<Rightarrow> 'c) \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> 'a \<Rightarrow> 'c"
blanchet@35865
    41
  where "COMBS P Q R \<equiv> P R (Q R)"
wenzelm@21254
    42
blanchet@35865
    43
definition fequal :: "'a \<Rightarrow> 'a \<Rightarrow> bool"
blanchet@35865
    44
  where "fequal X Y \<equiv> (X = Y)"
wenzelm@21254
    45
blanchet@35865
    46
lemma fequal_imp_equal: "fequal X Y \<Longrightarrow> X = Y"
wenzelm@21254
    47
  by (simp add: fequal_def)
wenzelm@21254
    48
blanchet@35865
    49
lemma equal_imp_fequal: "X = Y \<Longrightarrow> fequal X Y"
wenzelm@21254
    50
  by (simp add: fequal_def)
wenzelm@21254
    51
wenzelm@21254
    52
text{*These two represent the equivalence between Boolean equality and iff.
wenzelm@21254
    53
They can't be converted to clauses automatically, as the iff would be
wenzelm@21254
    54
expanded...*}
wenzelm@21254
    55
blanchet@35865
    56
lemma iff_positive: "P \<or> Q \<or> P = Q"
wenzelm@21254
    57
by blast
wenzelm@21254
    58
blanchet@35865
    59
lemma iff_negative: "\<not> P \<or> \<not> Q \<or> P = Q"
wenzelm@21254
    60
by blast
wenzelm@21254
    61
paulson@24827
    62
text{*Theorems for translation to combinators*}
paulson@24827
    63
blanchet@35865
    64
lemma abs_S: "\<lambda>x. (f x) (g x) \<equiv> COMBS f g"
paulson@24827
    65
apply (rule eq_reflection)
paulson@24827
    66
apply (rule ext) 
paulson@24827
    67
apply (simp add: COMBS_def) 
paulson@24827
    68
done
paulson@24827
    69
blanchet@35865
    70
lemma abs_I: "\<lambda>x. x \<equiv> COMBI"
paulson@24827
    71
apply (rule eq_reflection)
paulson@24827
    72
apply (rule ext) 
paulson@24827
    73
apply (simp add: COMBI_def) 
paulson@24827
    74
done
paulson@24827
    75
blanchet@35865
    76
lemma abs_K: "\<lambda>x. y \<equiv> COMBK y"
paulson@24827
    77
apply (rule eq_reflection)
paulson@24827
    78
apply (rule ext) 
paulson@24827
    79
apply (simp add: COMBK_def) 
paulson@24827
    80
done
paulson@24827
    81
blanchet@35865
    82
lemma abs_B: "\<lambda>x. a (g x) \<equiv> COMBB a g"
paulson@24827
    83
apply (rule eq_reflection)
paulson@24827
    84
apply (rule ext) 
paulson@24827
    85
apply (simp add: COMBB_def) 
paulson@24827
    86
done
paulson@24827
    87
blanchet@35865
    88
lemma abs_C: "\<lambda>x. (f x) b \<equiv> COMBC f b"
paulson@24827
    89
apply (rule eq_reflection)
paulson@24827
    90
apply (rule ext) 
paulson@24827
    91
apply (simp add: COMBC_def) 
paulson@24827
    92
done
paulson@24827
    93
blanchet@35866
    94
wenzelm@28585
    95
subsection {* Setup of external ATPs *}
haftmann@27368
    96
blanchet@35865
    97
use "Tools/Sledgehammer/sledgehammer_fol_clause.ML"
blanchet@35825
    98
use "Tools/Sledgehammer/sledgehammer_fact_preprocessor.ML"
blanchet@35826
    99
setup Sledgehammer_Fact_Preprocessor.setup
blanchet@35825
   100
use "Tools/Sledgehammer/sledgehammer_hol_clause.ML"
blanchet@35825
   101
use "Tools/Sledgehammer/sledgehammer_proof_reconstruct.ML"
blanchet@35826
   102
setup Sledgehammer_Proof_Reconstruct.setup
blanchet@35825
   103
use "Tools/Sledgehammer/sledgehammer_fact_filter.ML"
wenzelm@28573
   104
blanchet@35825
   105
use "Tools/ATP_Manager/atp_wrapper.ML"
blanchet@35825
   106
setup ATP_Wrapper.setup
wenzelm@32327
   107
use "Tools/ATP_Manager/atp_manager.ML"
wenzelm@32327
   108
use "Tools/ATP_Manager/atp_minimal.ML"
immler@31037
   109
wenzelm@28483
   110
text {* basic provers *}
wenzelm@32936
   111
setup {* ATP_Manager.add_prover ATP_Wrapper.spass *}
wenzelm@32936
   112
setup {* ATP_Manager.add_prover ATP_Wrapper.vampire *}
wenzelm@32936
   113
setup {* ATP_Manager.add_prover ATP_Wrapper.eprover *}
wenzelm@28483
   114
wenzelm@28483
   115
text {* provers with stuctured output *}
wenzelm@32936
   116
setup {* ATP_Manager.add_prover ATP_Wrapper.vampire_full *}
wenzelm@32936
   117
setup {* ATP_Manager.add_prover ATP_Wrapper.eprover_full *}
wenzelm@28483
   118
wenzelm@28483
   119
text {* on some problems better results *}
wenzelm@32936
   120
setup {* ATP_Manager.add_prover ATP_Wrapper.spass_no_tc *}
wenzelm@27182
   121
wenzelm@28573
   122
text {* remote provers via SystemOnTPTP *}
wenzelm@32936
   123
setup {* ATP_Manager.add_prover ATP_Wrapper.remote_vampire *}
wenzelm@32936
   124
setup {* ATP_Manager.add_prover ATP_Wrapper.remote_spass *}
wenzelm@32936
   125
setup {* ATP_Manager.add_prover ATP_Wrapper.remote_eprover *}
blanchet@35865
   126
blanchet@35866
   127
use "Tools/Sledgehammer/sledgehammer_isar.ML"
blanchet@35866
   128
blanchet@35865
   129
blanchet@35865
   130
subsection {* The MESON prover *}
blanchet@35865
   131
blanchet@35865
   132
use "Tools/Sledgehammer/meson_tactic.ML"
blanchet@35865
   133
setup Meson_Tactic.setup
wenzelm@28573
   134
wenzelm@23444
   135
wenzelm@23444
   136
subsection {* The Metis prover *}
wenzelm@23444
   137
blanchet@35825
   138
use "Tools/Sledgehammer/metis_tactics.ML"
blanchet@35826
   139
setup Metis_Tactics.setup
wenzelm@23444
   140
wenzelm@21254
   141
end