src/HOL/ATP.thy
author haftmann
Mon Jun 05 15:59:41 2017 +0200 (2017-06-05)
changeset 66010 2f7d39285a1a
parent 60758 d8d85a8172b5
child 66364 fa3247e6ee4b
permissions -rw-r--r--
executable domain membership checks
blanchet@39951
     1
(*  Title:      HOL/ATP.thy
blanchet@39951
     2
    Author:     Fabian Immler, TU Muenchen
blanchet@39951
     3
    Author:     Jasmin Blanchette, TU Muenchen
blanchet@39951
     4
*)
blanchet@39951
     5
wenzelm@60758
     6
section \<open>Automatic Theorem Provers (ATPs)\<close>
blanchet@39951
     7
blanchet@39951
     8
theory ATP
fleury@57714
     9
imports Meson
blanchet@39951
    10
begin
blanchet@39951
    11
wenzelm@60758
    12
subsection \<open>ATP problems and proofs\<close>
blanchet@57263
    13
wenzelm@48891
    14
ML_file "Tools/ATP/atp_util.ML"
wenzelm@48891
    15
ML_file "Tools/ATP/atp_problem.ML"
wenzelm@48891
    16
ML_file "Tools/ATP/atp_proof.ML"
wenzelm@48891
    17
ML_file "Tools/ATP/atp_proof_redirect.ML"
fleury@57707
    18
ML_file "Tools/ATP/atp_satallax.ML"
fleury@57707
    19
wenzelm@48891
    20
wenzelm@60758
    21
subsection \<open>Higher-order reasoning helpers\<close>
blanchet@43085
    22
blanchet@54148
    23
definition fFalse :: bool where
blanchet@43085
    24
"fFalse \<longleftrightarrow> False"
blanchet@43085
    25
blanchet@54148
    26
definition fTrue :: bool where
blanchet@43085
    27
"fTrue \<longleftrightarrow> True"
blanchet@43085
    28
blanchet@54148
    29
definition fNot :: "bool \<Rightarrow> bool" where
blanchet@43085
    30
"fNot P \<longleftrightarrow> \<not> P"
blanchet@43085
    31
blanchet@54148
    32
definition fComp :: "('a \<Rightarrow> bool) \<Rightarrow> 'a \<Rightarrow> bool" where
blanchet@47946
    33
"fComp P = (\<lambda>x. \<not> P x)"
blanchet@47946
    34
blanchet@54148
    35
definition fconj :: "bool \<Rightarrow> bool \<Rightarrow> bool" where
blanchet@43085
    36
"fconj P Q \<longleftrightarrow> P \<and> Q"
blanchet@43085
    37
blanchet@54148
    38
definition fdisj :: "bool \<Rightarrow> bool \<Rightarrow> bool" where
blanchet@43085
    39
"fdisj P Q \<longleftrightarrow> P \<or> Q"
blanchet@43085
    40
blanchet@54148
    41
definition fimplies :: "bool \<Rightarrow> bool \<Rightarrow> bool" where
blanchet@43085
    42
"fimplies P Q \<longleftrightarrow> (P \<longrightarrow> Q)"
blanchet@43085
    43
blanchet@54148
    44
definition fAll :: "('a \<Rightarrow> bool) \<Rightarrow> bool" where
nik@43678
    45
"fAll P \<longleftrightarrow> All P"
nik@43678
    46
blanchet@54148
    47
definition fEx :: "('a \<Rightarrow> bool) \<Rightarrow> bool" where
nik@43678
    48
"fEx P \<longleftrightarrow> Ex P"
blanchet@43085
    49
blanchet@56946
    50
definition fequal :: "'a \<Rightarrow> 'a \<Rightarrow> bool" where
blanchet@56946
    51
"fequal x y \<longleftrightarrow> (x = y)"
blanchet@56946
    52
blanchet@47946
    53
lemma fTrue_ne_fFalse: "fFalse \<noteq> fTrue"
blanchet@47946
    54
unfolding fFalse_def fTrue_def by simp
blanchet@47946
    55
blanchet@47946
    56
lemma fNot_table:
blanchet@47946
    57
"fNot fFalse = fTrue"
blanchet@47946
    58
"fNot fTrue = fFalse"
blanchet@47946
    59
unfolding fFalse_def fTrue_def fNot_def by auto
blanchet@47946
    60
blanchet@47946
    61
lemma fconj_table:
blanchet@47946
    62
"fconj fFalse P = fFalse"
blanchet@47946
    63
"fconj P fFalse = fFalse"
blanchet@47946
    64
"fconj fTrue fTrue = fTrue"
blanchet@47946
    65
unfolding fFalse_def fTrue_def fconj_def by auto
blanchet@47946
    66
blanchet@47946
    67
lemma fdisj_table:
blanchet@47946
    68
"fdisj fTrue P = fTrue"
blanchet@47946
    69
"fdisj P fTrue = fTrue"
blanchet@47946
    70
"fdisj fFalse fFalse = fFalse"
blanchet@47946
    71
unfolding fFalse_def fTrue_def fdisj_def by auto
blanchet@47946
    72
blanchet@47946
    73
lemma fimplies_table:
blanchet@47946
    74
"fimplies P fTrue = fTrue"
blanchet@47946
    75
"fimplies fFalse P = fTrue"
blanchet@47946
    76
"fimplies fTrue fFalse = fFalse"
blanchet@47946
    77
unfolding fFalse_def fTrue_def fimplies_def by auto
blanchet@47946
    78
blanchet@47946
    79
lemma fAll_table:
blanchet@47946
    80
"Ex (fComp P) \<or> fAll P = fTrue"
blanchet@47946
    81
"All P \<or> fAll P = fFalse"
blanchet@47946
    82
unfolding fFalse_def fTrue_def fComp_def fAll_def by auto
blanchet@47946
    83
blanchet@47946
    84
lemma fEx_table:
blanchet@47946
    85
"All (fComp P) \<or> fEx P = fTrue"
blanchet@47946
    86
"Ex P \<or> fEx P = fFalse"
blanchet@47946
    87
unfolding fFalse_def fTrue_def fComp_def fEx_def by auto
blanchet@47946
    88
blanchet@56946
    89
lemma fequal_table:
blanchet@56946
    90
"fequal x x = fTrue"
blanchet@56946
    91
"x = y \<or> fequal x y = fFalse"
blanchet@56946
    92
unfolding fFalse_def fTrue_def fequal_def by auto
blanchet@56946
    93
blanchet@47946
    94
lemma fNot_law:
blanchet@47946
    95
"fNot P \<noteq> P"
blanchet@47946
    96
unfolding fNot_def by auto
blanchet@47946
    97
blanchet@47946
    98
lemma fComp_law:
blanchet@47946
    99
"fComp P x \<longleftrightarrow> \<not> P x"
blanchet@47946
   100
unfolding fComp_def ..
blanchet@47946
   101
blanchet@47946
   102
lemma fconj_laws:
blanchet@47946
   103
"fconj P P \<longleftrightarrow> P"
blanchet@47946
   104
"fconj P Q \<longleftrightarrow> fconj Q P"
blanchet@47946
   105
"fNot (fconj P Q) \<longleftrightarrow> fdisj (fNot P) (fNot Q)"
blanchet@47946
   106
unfolding fNot_def fconj_def fdisj_def by auto
blanchet@47946
   107
blanchet@47946
   108
lemma fdisj_laws:
blanchet@47946
   109
"fdisj P P \<longleftrightarrow> P"
blanchet@47946
   110
"fdisj P Q \<longleftrightarrow> fdisj Q P"
blanchet@47946
   111
"fNot (fdisj P Q) \<longleftrightarrow> fconj (fNot P) (fNot Q)"
blanchet@47946
   112
unfolding fNot_def fconj_def fdisj_def by auto
blanchet@47946
   113
blanchet@47946
   114
lemma fimplies_laws:
blanchet@47946
   115
"fimplies P Q \<longleftrightarrow> fdisj (\<not> P) Q"
blanchet@47946
   116
"fNot (fimplies P Q) \<longleftrightarrow> fconj P (fNot Q)"
blanchet@47946
   117
unfolding fNot_def fconj_def fdisj_def fimplies_def by auto
blanchet@47946
   118
blanchet@47946
   119
lemma fAll_law:
blanchet@47946
   120
"fNot (fAll R) \<longleftrightarrow> fEx (fComp R)"
blanchet@47946
   121
unfolding fNot_def fComp_def fAll_def fEx_def by auto
blanchet@47946
   122
blanchet@47946
   123
lemma fEx_law:
blanchet@47946
   124
"fNot (fEx R) \<longleftrightarrow> fAll (fComp R)"
blanchet@47946
   125
unfolding fNot_def fComp_def fAll_def fEx_def by auto
blanchet@47946
   126
blanchet@56946
   127
lemma fequal_laws:
blanchet@56946
   128
"fequal x y = fequal y x"
blanchet@56946
   129
"fequal x y = fFalse \<or> fequal y z = fFalse \<or> fequal x z = fTrue"
blanchet@56946
   130
"fequal x y = fFalse \<or> fequal (f x) (f y) = fTrue"
blanchet@56946
   131
unfolding fFalse_def fTrue_def fequal_def by auto
blanchet@56946
   132
blanchet@56946
   133
wenzelm@60758
   134
subsection \<open>Waldmeister helpers\<close>
blanchet@57262
   135
steckerm@58406
   136
(* Has all needed simplification lemmas for logic. *)
steckerm@58406
   137
lemma boolean_equality: "(P \<longleftrightarrow> P) = True"
steckerm@58406
   138
  by simp
steckerm@58406
   139
steckerm@58406
   140
lemma boolean_comm: "(P \<longleftrightarrow> Q) = (Q \<longleftrightarrow> P)"
steckerm@58407
   141
  by auto
steckerm@58406
   142
steckerm@58406
   143
lemmas waldmeister_fol = boolean_equality boolean_comm
steckerm@58406
   144
  simp_thms(1-5,7-8,11-25,27-33) disj_comms disj_assoc conj_comms conj_assoc
blanchet@57262
   145
blanchet@57262
   146
wenzelm@60758
   147
subsection \<open>Basic connection between ATPs and HOL\<close>
blanchet@43085
   148
blanchet@57263
   149
ML_file "Tools/lambda_lifting.ML"
blanchet@57263
   150
ML_file "Tools/monomorph.ML"
wenzelm@48891
   151
ML_file "Tools/ATP/atp_problem_generate.ML"
wenzelm@48891
   152
ML_file "Tools/ATP/atp_proof_reconstruct.ML"
wenzelm@48891
   153
ML_file "Tools/ATP/atp_systems.ML"
blanchet@57262
   154
ML_file "Tools/ATP/atp_waldmeister.ML"
blanchet@43085
   155
steckerm@58406
   156
hide_fact (open) waldmeister_fol boolean_equality boolean_comm
blanchet@39951
   157
blanchet@39951
   158
end