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"
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
blanchet@35865
    13
  "~~/src/Tools/Metis/metis.ML"
blanchet@35967
    14
  "Tools/Sledgehammer/sledgehammer_util.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")
blanchet@36377
    21
  ("Tools/ATP_Manager/atp_systems.ML")
blanchet@36375
    22
  ("Tools/Sledgehammer/sledgehammer_fact_minimizer.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@37410
    28
definition skolem_id :: "'a \<Rightarrow> 'a" where
blanchet@37410
    29
[no_atp]: "skolem_id = (\<lambda>x. x)"
blanchet@37399
    30
blanchet@36569
    31
definition COMBI :: "'a \<Rightarrow> 'a" where
blanchet@36569
    32
[no_atp]: "COMBI P \<equiv> P"
wenzelm@24819
    33
blanchet@36569
    34
definition COMBK :: "'a \<Rightarrow> 'b \<Rightarrow> 'a" where
blanchet@36569
    35
[no_atp]: "COMBK P Q \<equiv> P"
wenzelm@21254
    36
blanchet@36569
    37
definition COMBB :: "('b => 'c) \<Rightarrow> ('a => 'b) \<Rightarrow> 'a \<Rightarrow> 'c" where [no_atp]:
blanchet@36569
    38
"COMBB P Q R \<equiv> P (Q R)"
wenzelm@21254
    39
blanchet@36569
    40
definition COMBC :: "('a \<Rightarrow> 'b \<Rightarrow> 'c) \<Rightarrow> 'b \<Rightarrow> 'a \<Rightarrow> 'c" where
blanchet@36569
    41
[no_atp]: "COMBC P Q R \<equiv> P R Q"
wenzelm@21254
    42
blanchet@36569
    43
definition COMBS :: "('a \<Rightarrow> 'b \<Rightarrow> 'c) \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> 'a \<Rightarrow> 'c" where
blanchet@36569
    44
[no_atp]: "COMBS P Q R \<equiv> P R (Q R)"
wenzelm@21254
    45
blanchet@36569
    46
definition fequal :: "'a \<Rightarrow> 'a \<Rightarrow> bool" where [no_atp]:
blanchet@36569
    47
"fequal X Y \<equiv> (X = Y)"
wenzelm@21254
    48
blanchet@36569
    49
lemma fequal_imp_equal [no_atp]: "fequal X Y \<Longrightarrow> X = Y"
wenzelm@21254
    50
  by (simp add: fequal_def)
wenzelm@21254
    51
blanchet@36569
    52
lemma equal_imp_fequal [no_atp]: "X = Y \<Longrightarrow> fequal X Y"
wenzelm@21254
    53
  by (simp add: fequal_def)
wenzelm@21254
    54
wenzelm@21254
    55
text{*These two represent the equivalence between Boolean equality and iff.
wenzelm@21254
    56
They can't be converted to clauses automatically, as the iff would be
wenzelm@21254
    57
expanded...*}
wenzelm@21254
    58
blanchet@35865
    59
lemma iff_positive: "P \<or> Q \<or> P = Q"
wenzelm@21254
    60
by blast
wenzelm@21254
    61
blanchet@35865
    62
lemma iff_negative: "\<not> P \<or> \<not> Q \<or> P = Q"
wenzelm@21254
    63
by blast
wenzelm@21254
    64
paulson@24827
    65
text{*Theorems for translation to combinators*}
paulson@24827
    66
blanchet@36569
    67
lemma abs_S [no_atp]: "\<lambda>x. (f x) (g x) \<equiv> COMBS f g"
paulson@24827
    68
apply (rule eq_reflection)
paulson@24827
    69
apply (rule ext) 
paulson@24827
    70
apply (simp add: COMBS_def) 
paulson@24827
    71
done
paulson@24827
    72
blanchet@36569
    73
lemma abs_I [no_atp]: "\<lambda>x. x \<equiv> COMBI"
paulson@24827
    74
apply (rule eq_reflection)
paulson@24827
    75
apply (rule ext) 
paulson@24827
    76
apply (simp add: COMBI_def) 
paulson@24827
    77
done
paulson@24827
    78
blanchet@36569
    79
lemma abs_K [no_atp]: "\<lambda>x. y \<equiv> COMBK y"
paulson@24827
    80
apply (rule eq_reflection)
paulson@24827
    81
apply (rule ext) 
paulson@24827
    82
apply (simp add: COMBK_def) 
paulson@24827
    83
done
paulson@24827
    84
blanchet@36569
    85
lemma abs_B [no_atp]: "\<lambda>x. a (g x) \<equiv> COMBB a g"
paulson@24827
    86
apply (rule eq_reflection)
paulson@24827
    87
apply (rule ext) 
paulson@24827
    88
apply (simp add: COMBB_def) 
paulson@24827
    89
done
paulson@24827
    90
blanchet@36569
    91
lemma abs_C [no_atp]: "\<lambda>x. (f x) b \<equiv> COMBC f b"
paulson@24827
    92
apply (rule eq_reflection)
paulson@24827
    93
apply (rule ext) 
paulson@24827
    94
apply (simp add: COMBC_def) 
paulson@24827
    95
done
paulson@24827
    96
blanchet@35866
    97
wenzelm@28585
    98
subsection {* Setup of external ATPs *}
haftmann@27368
    99
blanchet@35865
   100
use "Tools/Sledgehammer/sledgehammer_fol_clause.ML"
blanchet@35825
   101
use "Tools/Sledgehammer/sledgehammer_fact_preprocessor.ML"
blanchet@35826
   102
setup Sledgehammer_Fact_Preprocessor.setup
blanchet@35825
   103
use "Tools/Sledgehammer/sledgehammer_hol_clause.ML"
blanchet@35825
   104
use "Tools/Sledgehammer/sledgehammer_proof_reconstruct.ML"
blanchet@35825
   105
use "Tools/Sledgehammer/sledgehammer_fact_filter.ML"
blanchet@35867
   106
use "Tools/ATP_Manager/atp_manager.ML"
blanchet@36377
   107
use "Tools/ATP_Manager/atp_systems.ML"
blanchet@36376
   108
setup ATP_Systems.setup
blanchet@36375
   109
use "Tools/Sledgehammer/sledgehammer_fact_minimizer.ML"
blanchet@35866
   110
use "Tools/Sledgehammer/sledgehammer_isar.ML"
blanchet@36394
   111
setup Sledgehammer_Isar.setup
blanchet@35866
   112
blanchet@35865
   113
blanchet@35865
   114
subsection {* The MESON prover *}
blanchet@35865
   115
blanchet@35865
   116
use "Tools/Sledgehammer/meson_tactic.ML"
blanchet@35865
   117
setup Meson_Tactic.setup
wenzelm@28573
   118
wenzelm@23444
   119
wenzelm@23444
   120
subsection {* The Metis prover *}
wenzelm@23444
   121
blanchet@35825
   122
use "Tools/Sledgehammer/metis_tactics.ML"
blanchet@35826
   123
setup Metis_Tactics.setup
wenzelm@23444
   124
wenzelm@21254
   125
end