src/HOL/Sledgehammer.thy
author blanchet
Wed Mar 24 12:31:37 2010 +0100 (2010-03-24)
changeset 35967 b9659daa5b4b
parent 35867 16279c4c7a33
child 36062 194cb6e3c13f
permissions -rw-r--r--
add new file "sledgehammer_util.ML" to setup
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@35967
    15
  "Tools/Sledgehammer/sledgehammer_util.ML"
blanchet@35865
    16
  ("Tools/Sledgehammer/sledgehammer_fol_clause.ML")
blanchet@35825
    17
  ("Tools/Sledgehammer/sledgehammer_fact_preprocessor.ML")
blanchet@35825
    18
  ("Tools/Sledgehammer/sledgehammer_hol_clause.ML")
blanchet@35825
    19
  ("Tools/Sledgehammer/sledgehammer_proof_reconstruct.ML")
blanchet@35825
    20
  ("Tools/Sledgehammer/sledgehammer_fact_filter.ML")
wenzelm@32327
    21
  ("Tools/ATP_Manager/atp_manager.ML")
wenzelm@32327
    22
  ("Tools/ATP_Manager/atp_wrapper.ML")
wenzelm@32327
    23
  ("Tools/ATP_Manager/atp_minimal.ML")
blanchet@35866
    24
  ("Tools/Sledgehammer/sledgehammer_isar.ML")
blanchet@35865
    25
  ("Tools/Sledgehammer/meson_tactic.ML")
blanchet@35825
    26
  ("Tools/Sledgehammer/metis_tactics.ML")
wenzelm@21254
    27
begin
wenzelm@21254
    28
blanchet@35865
    29
definition COMBI :: "'a \<Rightarrow> 'a"
blanchet@35865
    30
  where "COMBI P \<equiv> P"
wenzelm@24819
    31
blanchet@35865
    32
definition COMBK :: "'a \<Rightarrow> 'b \<Rightarrow> 'a"
blanchet@35865
    33
  where "COMBK P Q \<equiv> P"
wenzelm@21254
    34
blanchet@35865
    35
definition COMBB :: "('b => 'c) \<Rightarrow> ('a => 'b) \<Rightarrow> 'a \<Rightarrow> 'c"
blanchet@35865
    36
  where "COMBB P Q R \<equiv> P (Q R)"
wenzelm@21254
    37
blanchet@35865
    38
definition COMBC :: "('a \<Rightarrow> 'b \<Rightarrow> 'c) \<Rightarrow> 'b \<Rightarrow> 'a \<Rightarrow> 'c"
blanchet@35865
    39
  where "COMBC P Q R \<equiv> P R Q"
wenzelm@21254
    40
blanchet@35865
    41
definition COMBS :: "('a \<Rightarrow> 'b \<Rightarrow> 'c) \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> 'a \<Rightarrow> 'c"
blanchet@35865
    42
  where "COMBS P Q R \<equiv> P R (Q R)"
wenzelm@21254
    43
blanchet@35865
    44
definition fequal :: "'a \<Rightarrow> 'a \<Rightarrow> bool"
blanchet@35865
    45
  where "fequal X Y \<equiv> (X = Y)"
wenzelm@21254
    46
blanchet@35865
    47
lemma fequal_imp_equal: "fequal X Y \<Longrightarrow> X = Y"
wenzelm@21254
    48
  by (simp add: fequal_def)
wenzelm@21254
    49
blanchet@35865
    50
lemma equal_imp_fequal: "X = Y \<Longrightarrow> fequal X Y"
wenzelm@21254
    51
  by (simp add: fequal_def)
wenzelm@21254
    52
wenzelm@21254
    53
text{*These two represent the equivalence between Boolean equality and iff.
wenzelm@21254
    54
They can't be converted to clauses automatically, as the iff would be
wenzelm@21254
    55
expanded...*}
wenzelm@21254
    56
blanchet@35865
    57
lemma iff_positive: "P \<or> Q \<or> P = Q"
wenzelm@21254
    58
by blast
wenzelm@21254
    59
blanchet@35865
    60
lemma iff_negative: "\<not> P \<or> \<not> Q \<or> P = Q"
wenzelm@21254
    61
by blast
wenzelm@21254
    62
paulson@24827
    63
text{*Theorems for translation to combinators*}
paulson@24827
    64
blanchet@35865
    65
lemma abs_S: "\<lambda>x. (f x) (g x) \<equiv> COMBS f g"
paulson@24827
    66
apply (rule eq_reflection)
paulson@24827
    67
apply (rule ext) 
paulson@24827
    68
apply (simp add: COMBS_def) 
paulson@24827
    69
done
paulson@24827
    70
blanchet@35865
    71
lemma abs_I: "\<lambda>x. x \<equiv> COMBI"
paulson@24827
    72
apply (rule eq_reflection)
paulson@24827
    73
apply (rule ext) 
paulson@24827
    74
apply (simp add: COMBI_def) 
paulson@24827
    75
done
paulson@24827
    76
blanchet@35865
    77
lemma abs_K: "\<lambda>x. y \<equiv> COMBK y"
paulson@24827
    78
apply (rule eq_reflection)
paulson@24827
    79
apply (rule ext) 
paulson@24827
    80
apply (simp add: COMBK_def) 
paulson@24827
    81
done
paulson@24827
    82
blanchet@35865
    83
lemma abs_B: "\<lambda>x. a (g x) \<equiv> COMBB a g"
paulson@24827
    84
apply (rule eq_reflection)
paulson@24827
    85
apply (rule ext) 
paulson@24827
    86
apply (simp add: COMBB_def) 
paulson@24827
    87
done
paulson@24827
    88
blanchet@35865
    89
lemma abs_C: "\<lambda>x. (f x) b \<equiv> COMBC f b"
paulson@24827
    90
apply (rule eq_reflection)
paulson@24827
    91
apply (rule ext) 
paulson@24827
    92
apply (simp add: COMBC_def) 
paulson@24827
    93
done
paulson@24827
    94
blanchet@35866
    95
wenzelm@28585
    96
subsection {* Setup of external ATPs *}
haftmann@27368
    97
blanchet@35865
    98
use "Tools/Sledgehammer/sledgehammer_fol_clause.ML"
blanchet@35825
    99
use "Tools/Sledgehammer/sledgehammer_fact_preprocessor.ML"
blanchet@35826
   100
setup Sledgehammer_Fact_Preprocessor.setup
blanchet@35825
   101
use "Tools/Sledgehammer/sledgehammer_hol_clause.ML"
blanchet@35825
   102
use "Tools/Sledgehammer/sledgehammer_proof_reconstruct.ML"
blanchet@35826
   103
setup Sledgehammer_Proof_Reconstruct.setup
blanchet@35825
   104
use "Tools/Sledgehammer/sledgehammer_fact_filter.ML"
blanchet@35867
   105
use "Tools/ATP_Manager/atp_manager.ML"
blanchet@35825
   106
use "Tools/ATP_Manager/atp_wrapper.ML"
blanchet@35825
   107
setup ATP_Wrapper.setup
wenzelm@32327
   108
use "Tools/ATP_Manager/atp_minimal.ML"
blanchet@35866
   109
use "Tools/Sledgehammer/sledgehammer_isar.ML"
blanchet@35866
   110
blanchet@35865
   111
blanchet@35865
   112
subsection {* The MESON prover *}
blanchet@35865
   113
blanchet@35865
   114
use "Tools/Sledgehammer/meson_tactic.ML"
blanchet@35865
   115
setup Meson_Tactic.setup
wenzelm@28573
   116
wenzelm@23444
   117
wenzelm@23444
   118
subsection {* The Metis prover *}
wenzelm@23444
   119
blanchet@35825
   120
use "Tools/Sledgehammer/metis_tactics.ML"
blanchet@35826
   121
setup Metis_Tactics.setup
wenzelm@23444
   122
wenzelm@21254
   123
end