src/HOL/ATP_Linkup.thy
author paulson
Thu, 04 Oct 2007 12:32:58 +0200
changeset 24827 646bdc51eb7d
parent 24819 7d8e0a47392e
child 24943 5f5679e2ec2f
permissions -rw-r--r--
combinator translation
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
21254
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
     1
(*  Title:      HOL/ATP_Linkup.thy
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
     2
    ID:         $Id$
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
     3
    Author:     Lawrence C Paulson
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
     4
    Author:     Jia Meng, NICTA
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
     5
*)
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
header{* The Isabelle-ATP Linkup *}
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
     8
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
     9
theory ATP_Linkup
24742
73b8b42a36b6 removal of some "ref"s from res_axioms.ML; a side-effect is that the ordering
paulson
parents: 24318
diff changeset
    10
imports Divides Record Hilbert_Choice Presburger Relation_Power SAT Recdef Extraction 
73b8b42a36b6 removal of some "ref"s from res_axioms.ML; a side-effect is that the ordering
paulson
parents: 24318
diff changeset
    11
   (*It must be a parent or a child of every other theory, to prevent theory-merge errors.*)
21254
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    12
uses
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    13
  "Tools/polyhash.ML"
21977
7f7177a95189 first version of structured proof reconstruction
paulson
parents: 21453
diff changeset
    14
  "Tools/res_clause.ML"
21254
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    15
  ("Tools/res_hol_clause.ML")
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    16
  ("Tools/res_axioms.ML")
21999
0cf192e489e2 improvements to proof reconstruction. Some files loaded in a different order
paulson
parents: 21977
diff changeset
    17
  ("Tools/res_reconstruct.ML")
23519
a4ffa756d8eb bug fixes to proof reconstruction
paulson
parents: 23444
diff changeset
    18
  ("Tools/watcher.ML")
21254
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    19
  ("Tools/res_atp.ML")
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    20
  ("Tools/res_atp_provers.ML")
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    21
  ("Tools/res_atp_methods.ML")
23444
6d4703843f93 added Metis setup (from Metis.thy);
wenzelm
parents: 21999
diff changeset
    22
  "~~/src/Tools/Metis/metis.ML"
6d4703843f93 added Metis setup (from Metis.thy);
wenzelm
parents: 21999
diff changeset
    23
  ("Tools/metis_tools.ML")
21254
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    24
begin
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    25
24819
7d8e0a47392e modernized definitions;
wenzelm
parents: 24742
diff changeset
    26
definition COMBI :: "'a => 'a"
7d8e0a47392e modernized definitions;
wenzelm
parents: 24742
diff changeset
    27
  where "COMBI P == P"
7d8e0a47392e modernized definitions;
wenzelm
parents: 24742
diff changeset
    28
7d8e0a47392e modernized definitions;
wenzelm
parents: 24742
diff changeset
    29
definition COMBK :: "'a => 'b => 'a"
7d8e0a47392e modernized definitions;
wenzelm
parents: 24742
diff changeset
    30
  where "COMBK P Q == P"
21254
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    31
24819
7d8e0a47392e modernized definitions;
wenzelm
parents: 24742
diff changeset
    32
definition COMBB :: "('b => 'c) => ('a => 'b) => 'a => 'c"
7d8e0a47392e modernized definitions;
wenzelm
parents: 24742
diff changeset
    33
  where "COMBB P Q R == P (Q R)"
21254
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    34
24819
7d8e0a47392e modernized definitions;
wenzelm
parents: 24742
diff changeset
    35
definition COMBC :: "('a => 'b => 'c) => 'b => 'a => 'c"
7d8e0a47392e modernized definitions;
wenzelm
parents: 24742
diff changeset
    36
  where "COMBC P Q R == P R Q"
21254
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    37
24819
7d8e0a47392e modernized definitions;
wenzelm
parents: 24742
diff changeset
    38
definition COMBS :: "('a => 'b => 'c) => ('a => 'b) => 'a => 'c"
7d8e0a47392e modernized definitions;
wenzelm
parents: 24742
diff changeset
    39
  where "COMBS P Q R == P R (Q R)"
21254
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    40
24819
7d8e0a47392e modernized definitions;
wenzelm
parents: 24742
diff changeset
    41
definition COMBB' :: "('a => 'c) => ('b => 'a) => ('d => 'b) => 'd => 'c"
7d8e0a47392e modernized definitions;
wenzelm
parents: 24742
diff changeset
    42
  where "COMBB' M P Q R == M (P (Q R))"
21254
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    43
24819
7d8e0a47392e modernized definitions;
wenzelm
parents: 24742
diff changeset
    44
definition COMBC' :: "('a => 'b => 'c) => ('d => 'a) => 'b => 'd => 'c"
7d8e0a47392e modernized definitions;
wenzelm
parents: 24742
diff changeset
    45
  where "COMBC' M P Q R == M (P R) Q"
21254
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    46
24819
7d8e0a47392e modernized definitions;
wenzelm
parents: 24742
diff changeset
    47
definition COMBS' :: "('a => 'b => 'c) => ('d => 'a) => ('d => 'b) => 'd => 'c"
7d8e0a47392e modernized definitions;
wenzelm
parents: 24742
diff changeset
    48
  where "COMBS' M P Q R == M (P R) (Q R)"
21254
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    49
24819
7d8e0a47392e modernized definitions;
wenzelm
parents: 24742
diff changeset
    50
definition fequal :: "'a => 'a => bool"
7d8e0a47392e modernized definitions;
wenzelm
parents: 24742
diff changeset
    51
  where "fequal X Y == (X=Y)"
21254
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    52
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    53
lemma fequal_imp_equal: "fequal X Y ==> X=Y"
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    54
  by (simp add: fequal_def)
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    55
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    56
lemma equal_imp_fequal: "X=Y ==> fequal X Y"
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    57
  by (simp add: fequal_def)
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    58
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    59
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
    60
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
    61
expanded...*}
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    62
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    63
lemma iff_positive: "P | Q | P=Q"
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    64
by blast
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    65
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    66
lemma iff_negative: "~P | ~Q | P=Q"
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    67
by blast
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
    68
24827
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    69
text{*Theorems for translation to combinators*}
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    70
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    71
lemma abs_S: "(%x. (f x) (g x)) == COMBS f g"
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    72
apply (rule eq_reflection)
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    73
apply (rule ext) 
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    74
apply (simp add: COMBS_def) 
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    75
done
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    76
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    77
lemma abs_I: "(%x. x) == COMBI"
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    78
apply (rule eq_reflection)
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    79
apply (rule ext) 
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    80
apply (simp add: COMBI_def) 
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    81
done
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    82
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    83
lemma abs_K: "(%x. y) == COMBK y"
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    84
apply (rule eq_reflection)
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    85
apply (rule ext) 
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    86
apply (simp add: COMBK_def) 
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    87
done
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    88
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    89
lemma abs_B: "(%x. a (g x)) == COMBB a g"
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    90
apply (rule eq_reflection)
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    91
apply (rule ext) 
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    92
apply (simp add: COMBB_def) 
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    93
done
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    94
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    95
lemma abs_C: "(%x. (f x) b) == COMBC f b"
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    96
apply (rule eq_reflection)
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    97
apply (rule ext) 
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    98
apply (simp add: COMBC_def) 
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
    99
done
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
   100
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
   101
21999
0cf192e489e2 improvements to proof reconstruction. Some files loaded in a different order
paulson
parents: 21977
diff changeset
   102
use "Tools/res_axioms.ML"      --{*requires the combinators declared above*}
24827
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
   103
use "Tools/res_hol_clause.ML"
21999
0cf192e489e2 improvements to proof reconstruction. Some files loaded in a different order
paulson
parents: 21977
diff changeset
   104
use "Tools/res_reconstruct.ML"
23519
a4ffa756d8eb bug fixes to proof reconstruction
paulson
parents: 23444
diff changeset
   105
use "Tools/watcher.ML"
21254
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
   106
use "Tools/res_atp.ML"
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
   107
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
   108
setup ResAxioms.meson_method_setup
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
   109
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
   110
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
   111
subsection {* Setup for Vampire, E prover and SPASS *}
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
   112
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
   113
use "Tools/res_atp_provers.ML"
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
   114
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
   115
oracle vampire_oracle ("string * int") = {* ResAtpProvers.vampire_o *}
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
   116
oracle eprover_oracle ("string * int") = {* ResAtpProvers.eprover_o *}
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
   117
oracle spass_oracle ("string * int") = {* ResAtpProvers.spass_o *}
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
   118
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
   119
use "Tools/res_atp_methods.ML"
24827
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
   120
setup ResAtpMethods.setup      --{*Oracle ATP methods: still useful?*}
646bdc51eb7d combinator translation
paulson
parents: 24819
diff changeset
   121
setup ResAxioms.setup          --{*Sledgehammer*}
23444
6d4703843f93 added Metis setup (from Metis.thy);
wenzelm
parents: 21999
diff changeset
   122
6d4703843f93 added Metis setup (from Metis.thy);
wenzelm
parents: 21999
diff changeset
   123
subsection {* The Metis prover *}
6d4703843f93 added Metis setup (from Metis.thy);
wenzelm
parents: 21999
diff changeset
   124
6d4703843f93 added Metis setup (from Metis.thy);
wenzelm
parents: 21999
diff changeset
   125
use "Tools/metis_tools.ML"
6d4703843f93 added Metis setup (from Metis.thy);
wenzelm
parents: 21999
diff changeset
   126
setup MetisTools.setup
6d4703843f93 added Metis setup (from Metis.thy);
wenzelm
parents: 21999
diff changeset
   127
24742
73b8b42a36b6 removal of some "ref"s from res_axioms.ML; a side-effect is that the ordering
paulson
parents: 24318
diff changeset
   128
setup {*
73b8b42a36b6 removal of some "ref"s from res_axioms.ML; a side-effect is that the ordering
paulson
parents: 24318
diff changeset
   129
  Theory.at_end ResAxioms.clause_cache_endtheory
73b8b42a36b6 removal of some "ref"s from res_axioms.ML; a side-effect is that the ordering
paulson
parents: 24318
diff changeset
   130
*}
73b8b42a36b6 removal of some "ref"s from res_axioms.ML; a side-effect is that the ordering
paulson
parents: 24318
diff changeset
   131
21254
d53f76357f41 incorporated former theories Reconstruction and ResAtpMethods into ATP_Linkup;
wenzelm
parents:
diff changeset
   132
end