src/HOL/Sledgehammer.thy
author blanchet
Sun, 25 Apr 2010 14:40:36 +0200
changeset 36394 1a48d18449d8
parent 36377 b3dce4c715d0
child 36569 3a29eb7606c3
permissions -rw-r--r--
move "neg_clausify" method and "clausify" attribute to "sledgehammer_isar.ML"
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
35827
f552152d7747 renamed "ATP_Linkup" theory to "Sledgehammer"
blanchet
parents: 35826
diff changeset
     1
(*  Title:      HOL/Sledgehammer.thy
21254
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
     2
    Author:     Lawrence C Paulson
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
     3
    Author:     Jia Meng, NICTA
35865
2f8fb5242799 more Sledgehammer refactoring
blanchet
parents: 35827
diff changeset
     4
    Author:     Fabian Immler, TU Muenchen
2f8fb5242799 more Sledgehammer refactoring
blanchet
parents: 35827
diff changeset
     5
    Author:     Jasmin Blanchette, TU Muenchen
21254
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
     6
*)
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
     7
35827
f552152d7747 renamed "ATP_Linkup" theory to "Sledgehammer"
blanchet
parents: 35826
diff changeset
     8
header {* Sledgehammer: Isabelle--ATP Linkup *}
21254
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
     9
35827
f552152d7747 renamed "ATP_Linkup" theory to "Sledgehammer"
blanchet
parents: 35826
diff changeset
    10
theory Sledgehammer
33593
ef54e2108b74 tuned imports
haftmann
parents: 33316
diff changeset
    11
imports Plain Hilbert_Choice
21254
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    12
uses
35865
2f8fb5242799 more Sledgehammer refactoring
blanchet
parents: 35827
diff changeset
    13
  "~~/src/Tools/Metis/metis.ML"
35967
b9659daa5b4b add new file "sledgehammer_util.ML" to setup
blanchet
parents: 35867
diff changeset
    14
  "Tools/Sledgehammer/sledgehammer_util.ML"
35865
2f8fb5242799 more Sledgehammer refactoring
blanchet
parents: 35827
diff changeset
    15
  ("Tools/Sledgehammer/sledgehammer_fol_clause.ML")
35825
a6aad5a70ed4 move Sledgehammer files in a directory of their own
blanchet
parents: 33593
diff changeset
    16
  ("Tools/Sledgehammer/sledgehammer_fact_preprocessor.ML")
a6aad5a70ed4 move Sledgehammer files in a directory of their own
blanchet
parents: 33593
diff changeset
    17
  ("Tools/Sledgehammer/sledgehammer_hol_clause.ML")
a6aad5a70ed4 move Sledgehammer files in a directory of their own
blanchet
parents: 33593
diff changeset
    18
  ("Tools/Sledgehammer/sledgehammer_proof_reconstruct.ML")
a6aad5a70ed4 move Sledgehammer files in a directory of their own
blanchet
parents: 33593
diff changeset
    19
  ("Tools/Sledgehammer/sledgehammer_fact_filter.ML")
32327
0971cc0b6a57 src/HOL/Tools/ATP_Manager as separate component, with (almost) everything in one place;
wenzelm
parents: 31835
diff changeset
    20
  ("Tools/ATP_Manager/atp_manager.ML")
36377
b3dce4c715d0 now rename the file "atp_wrapper.ML" to "atp_systems.ML" + fix typo in "SystemOnTPTP" script
blanchet
parents: 36376
diff changeset
    21
  ("Tools/ATP_Manager/atp_systems.ML")
36375
2482446a604c move the minimizer to the Sledgehammer directory
blanchet
parents: 36064
diff changeset
    22
  ("Tools/Sledgehammer/sledgehammer_fact_minimizer.ML")
35866
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
    23
  ("Tools/Sledgehammer/sledgehammer_isar.ML")
35865
2f8fb5242799 more Sledgehammer refactoring
blanchet
parents: 35827
diff changeset
    24
  ("Tools/Sledgehammer/meson_tactic.ML")
35825
a6aad5a70ed4 move Sledgehammer files in a directory of their own
blanchet
parents: 33593
diff changeset
    25
  ("Tools/Sledgehammer/metis_tactics.ML")
21254
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    26
begin
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    27
35865
2f8fb5242799 more Sledgehammer refactoring
blanchet
parents: 35827
diff changeset
    28
definition COMBI :: "'a \<Rightarrow> 'a"
2f8fb5242799 more Sledgehammer refactoring
blanchet
parents: 35827
diff changeset
    29
  where "COMBI P \<equiv> P"
24819
7d8e0a47392e modernized definitions;
wenzelm
parents: 24742
diff changeset
    30
35865
2f8fb5242799 more Sledgehammer refactoring
blanchet
parents: 35827
diff changeset
    31
definition COMBK :: "'a \<Rightarrow> 'b \<Rightarrow> 'a"
2f8fb5242799 more Sledgehammer refactoring
blanchet
parents: 35827
diff changeset
    32
  where "COMBK P Q \<equiv> P"
21254
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    33
35865
2f8fb5242799 more Sledgehammer refactoring
blanchet
parents: 35827
diff changeset
    34
definition COMBB :: "('b => 'c) \<Rightarrow> ('a => 'b) \<Rightarrow> 'a \<Rightarrow> 'c"
2f8fb5242799 more Sledgehammer refactoring
blanchet
parents: 35827
diff changeset
    35
  where "COMBB P Q R \<equiv> P (Q R)"
21254
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    36
35865
2f8fb5242799 more Sledgehammer refactoring
blanchet
parents: 35827
diff changeset
    37
definition COMBC :: "('a \<Rightarrow> 'b \<Rightarrow> 'c) \<Rightarrow> 'b \<Rightarrow> 'a \<Rightarrow> 'c"
2f8fb5242799 more Sledgehammer refactoring
blanchet
parents: 35827
diff changeset
    38
  where "COMBC P Q R \<equiv> P R Q"
21254
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    39
35865
2f8fb5242799 more Sledgehammer refactoring
blanchet
parents: 35827
diff changeset
    40
definition COMBS :: "('a \<Rightarrow> 'b \<Rightarrow> 'c) \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> 'a \<Rightarrow> 'c"
2f8fb5242799 more Sledgehammer refactoring
blanchet
parents: 35827
diff changeset
    41
  where "COMBS P Q R \<equiv> P R (Q R)"
21254
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    42
35865
2f8fb5242799 more Sledgehammer refactoring
blanchet
parents: 35827
diff changeset
    43
definition fequal :: "'a \<Rightarrow> 'a \<Rightarrow> bool"
2f8fb5242799 more Sledgehammer refactoring
blanchet
parents: 35827
diff changeset
    44
  where "fequal X Y \<equiv> (X = Y)"
21254
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    45
35865
2f8fb5242799 more Sledgehammer refactoring
blanchet
parents: 35827
diff changeset
    46
lemma fequal_imp_equal: "fequal X Y \<Longrightarrow> X = Y"
21254
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    47
  by (simp add: fequal_def)
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    48
35865
2f8fb5242799 more Sledgehammer refactoring
blanchet
parents: 35827
diff changeset
    49
lemma equal_imp_fequal: "X = Y \<Longrightarrow> fequal X Y"
21254
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    50
  by (simp add: fequal_def)
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    51
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    52
text{*These two represent the equivalence between Boolean equality and iff.
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    53
They can't be converted to clauses automatically, as the iff would be
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    54
expanded...*}
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    55
35865
2f8fb5242799 more Sledgehammer refactoring
blanchet
parents: 35827
diff changeset
    56
lemma iff_positive: "P \<or> Q \<or> P = Q"
21254
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    57
by blast
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    58
35865
2f8fb5242799 more Sledgehammer refactoring
blanchet
parents: 35827
diff changeset
    59
lemma iff_negative: "\<not> P \<or> \<not> Q \<or> P = Q"
21254
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    60
by blast
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    61
24827
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    62
text{*Theorems for translation to combinators*}
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    63
35865
2f8fb5242799 more Sledgehammer refactoring
blanchet
parents: 35827
diff changeset
    64
lemma abs_S: "\<lambda>x. (f x) (g x) \<equiv> COMBS f g"
24827
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    65
apply (rule eq_reflection)
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    66
apply (rule ext) 
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    67
apply (simp add: COMBS_def) 
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    68
done
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    69
35865
2f8fb5242799 more Sledgehammer refactoring
blanchet
parents: 35827
diff changeset
    70
lemma abs_I: "\<lambda>x. x \<equiv> COMBI"
24827
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    71
apply (rule eq_reflection)
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    72
apply (rule ext) 
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    73
apply (simp add: COMBI_def) 
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    74
done
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    75
35865
2f8fb5242799 more Sledgehammer refactoring
blanchet
parents: 35827
diff changeset
    76
lemma abs_K: "\<lambda>x. y \<equiv> COMBK y"
24827
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    77
apply (rule eq_reflection)
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    78
apply (rule ext) 
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    79
apply (simp add: COMBK_def) 
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    80
done
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    81
35865
2f8fb5242799 more Sledgehammer refactoring
blanchet
parents: 35827
diff changeset
    82
lemma abs_B: "\<lambda>x. a (g x) \<equiv> COMBB a g"
24827
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    83
apply (rule eq_reflection)
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    84
apply (rule ext) 
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    85
apply (simp add: COMBB_def) 
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    86
done
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    87
35865
2f8fb5242799 more Sledgehammer refactoring
blanchet
parents: 35827
diff changeset
    88
lemma abs_C: "\<lambda>x. (f x) b \<equiv> COMBC f b"
24827
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    89
apply (rule eq_reflection)
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    90
apply (rule ext) 
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    91
apply (simp add: COMBC_def) 
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    92
done
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    93
35866
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
    94
28585
be3c44ac3e86 tuned comments;
wenzelm
parents: 28573
diff changeset
    95
subsection {* Setup of external ATPs *}
27368
9f90ac19e32b established Plain theory and image
haftmann
parents: 27182
diff changeset
    96
35865
2f8fb5242799 more Sledgehammer refactoring
blanchet
parents: 35827
diff changeset
    97
use "Tools/Sledgehammer/sledgehammer_fol_clause.ML"
35825
a6aad5a70ed4 move Sledgehammer files in a directory of their own
blanchet
parents: 33593
diff changeset
    98
use "Tools/Sledgehammer/sledgehammer_fact_preprocessor.ML"
35826
1590abc3d42a renamed Sledgehammer structures
blanchet
parents: 35825
diff changeset
    99
setup Sledgehammer_Fact_Preprocessor.setup
35825
a6aad5a70ed4 move Sledgehammer files in a directory of their own
blanchet
parents: 33593
diff changeset
   100
use "Tools/Sledgehammer/sledgehammer_hol_clause.ML"
a6aad5a70ed4 move Sledgehammer files in a directory of their own
blanchet
parents: 33593
diff changeset
   101
use "Tools/Sledgehammer/sledgehammer_proof_reconstruct.ML"
a6aad5a70ed4 move Sledgehammer files in a directory of their own
blanchet
parents: 33593
diff changeset
   102
use "Tools/Sledgehammer/sledgehammer_fact_filter.ML"
35867
16279c4c7a33 move all ATP setup code into ATP_Wrapper
blanchet
parents: 35866
diff changeset
   103
use "Tools/ATP_Manager/atp_manager.ML"
36377
b3dce4c715d0 now rename the file "atp_wrapper.ML" to "atp_systems.ML" + fix typo in "SystemOnTPTP" script
blanchet
parents: 36376
diff changeset
   104
use "Tools/ATP_Manager/atp_systems.ML"
36376
e83d52a52449 renamed module "ATP_Wrapper" to "ATP_Systems"
blanchet
parents: 36375
diff changeset
   105
setup ATP_Systems.setup
36375
2482446a604c move the minimizer to the Sledgehammer directory
blanchet
parents: 36064
diff changeset
   106
use "Tools/Sledgehammer/sledgehammer_fact_minimizer.ML"
35866
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
   107
use "Tools/Sledgehammer/sledgehammer_isar.ML"
36394
1a48d18449d8 move "neg_clausify" method and "clausify" attribute to "sledgehammer_isar.ML"
blanchet
parents: 36377
diff changeset
   108
setup Sledgehammer_Isar.setup
35866
513074557e06 move the Sledgehammer Isar commands together into one file;
blanchet
parents: 35865
diff changeset
   109
35865
2f8fb5242799 more Sledgehammer refactoring
blanchet
parents: 35827
diff changeset
   110
2f8fb5242799 more Sledgehammer refactoring
blanchet
parents: 35827
diff changeset
   111
subsection {* The MESON prover *}
2f8fb5242799 more Sledgehammer refactoring
blanchet
parents: 35827
diff changeset
   112
2f8fb5242799 more Sledgehammer refactoring
blanchet
parents: 35827
diff changeset
   113
use "Tools/Sledgehammer/meson_tactic.ML"
2f8fb5242799 more Sledgehammer refactoring
blanchet
parents: 35827
diff changeset
   114
setup Meson_Tactic.setup
28573
6403f0e16269 ** Update from Fabian **
wenzelm
parents: 28483
diff changeset
   115
23444
6d4703843f93 added Metis setup (from Metis.thy);
wenzelm
parents: 21999
diff changeset
   116
6d4703843f93 added Metis setup (from Metis.thy);
wenzelm
parents: 21999
diff changeset
   117
subsection {* The Metis prover *}
6d4703843f93 added Metis setup (from Metis.thy);
wenzelm
parents: 21999
diff changeset
   118
35825
a6aad5a70ed4 move Sledgehammer files in a directory of their own
blanchet
parents: 33593
diff changeset
   119
use "Tools/Sledgehammer/metis_tactics.ML"
35826
1590abc3d42a renamed Sledgehammer structures
blanchet
parents: 35825
diff changeset
   120
setup Metis_Tactics.setup
23444
6d4703843f93 added Metis setup (from Metis.thy);
wenzelm
parents: 21999
diff changeset
   121
21254
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
   122
end