src/FOL/IFOL.thy
author wenzelm
Thu Jun 14 23:04:36 2007 +0200 (2007-06-14)
changeset 23393 31781b2de73d
parent 23171 861f63a35d31
child 24097 86734ba03ca2
permissions -rw-r--r--
tuned proofs: avoid implicit prems;
clasohm@1268
     1
(*  Title:      FOL/IFOL.thy
lcp@35
     2
    ID:         $Id$
wenzelm@11677
     3
    Author:     Lawrence C Paulson and Markus Wenzel
wenzelm@11677
     4
*)
lcp@35
     5
wenzelm@11677
     6
header {* Intuitionistic first-order logic *}
lcp@35
     7
paulson@15481
     8
theory IFOL
paulson@15481
     9
imports Pure
wenzelm@23155
    10
uses
wenzelm@23155
    11
  "~~/src/Provers/splitter.ML"
wenzelm@23155
    12
  "~~/src/Provers/hypsubst.ML"
wenzelm@23171
    13
  "~~/src/Tools/IsaPlanner/zipper.ML"
wenzelm@23171
    14
  "~~/src/Tools/IsaPlanner/isand.ML"
wenzelm@23171
    15
  "~~/src/Tools/IsaPlanner/rw_tools.ML"
wenzelm@23171
    16
  "~~/src/Tools/IsaPlanner/rw_inst.ML"
wenzelm@23155
    17
  "~~/src/Provers/eqsubst.ML"
wenzelm@23155
    18
  "~~/src/Provers/induct_method.ML"
wenzelm@23155
    19
  "~~/src/Provers/classical.ML"
wenzelm@23155
    20
  "~~/src/Provers/blast.ML"
wenzelm@23155
    21
  "~~/src/Provers/clasimp.ML"
wenzelm@23155
    22
  "~~/src/Provers/quantifier1.ML"
wenzelm@23155
    23
  "~~/src/Provers/project_rule.ML"
wenzelm@23155
    24
  ("fologic.ML")
wenzelm@23155
    25
  ("hypsubstdata.ML")
wenzelm@23155
    26
  ("intprover.ML")
paulson@15481
    27
begin
wenzelm@7355
    28
clasohm@0
    29
wenzelm@11677
    30
subsection {* Syntax and axiomatic basis *}
wenzelm@11677
    31
wenzelm@3906
    32
global
wenzelm@3906
    33
wenzelm@14854
    34
classes "term"
wenzelm@7355
    35
defaultsort "term"
clasohm@0
    36
wenzelm@7355
    37
typedecl o
wenzelm@79
    38
wenzelm@11747
    39
judgment
wenzelm@11747
    40
  Trueprop      :: "o => prop"                  ("(_)" 5)
clasohm@0
    41
wenzelm@11747
    42
consts
wenzelm@7355
    43
  True          :: o
wenzelm@7355
    44
  False         :: o
wenzelm@79
    45
wenzelm@79
    46
  (* Connectives *)
wenzelm@79
    47
wenzelm@17276
    48
  "op ="        :: "['a, 'a] => o"              (infixl "=" 50)
lcp@35
    49
wenzelm@7355
    50
  Not           :: "o => o"                     ("~ _" [40] 40)
wenzelm@17276
    51
  "op &"        :: "[o, o] => o"                (infixr "&" 35)
wenzelm@17276
    52
  "op |"        :: "[o, o] => o"                (infixr "|" 30)
wenzelm@17276
    53
  "op -->"      :: "[o, o] => o"                (infixr "-->" 25)
wenzelm@17276
    54
  "op <->"      :: "[o, o] => o"                (infixr "<->" 25)
wenzelm@79
    55
wenzelm@79
    56
  (* Quantifiers *)
wenzelm@79
    57
wenzelm@7355
    58
  All           :: "('a => o) => o"             (binder "ALL " 10)
wenzelm@7355
    59
  Ex            :: "('a => o) => o"             (binder "EX " 10)
wenzelm@7355
    60
  Ex1           :: "('a => o) => o"             (binder "EX! " 10)
wenzelm@79
    61
clasohm@0
    62
wenzelm@19363
    63
abbreviation
wenzelm@21404
    64
  not_equal :: "['a, 'a] => o"  (infixl "~=" 50) where
wenzelm@19120
    65
  "x ~= y == ~ (x = y)"
wenzelm@79
    66
wenzelm@21210
    67
notation (xsymbols)
wenzelm@19656
    68
  not_equal  (infixl "\<noteq>" 50)
wenzelm@19363
    69
wenzelm@21210
    70
notation (HTML output)
wenzelm@19656
    71
  not_equal  (infixl "\<noteq>" 50)
wenzelm@19363
    72
wenzelm@21524
    73
notation (xsymbols)
wenzelm@21539
    74
  Not       ("\<not> _" [40] 40) and
wenzelm@21539
    75
  "op &"    (infixr "\<and>" 35) and
wenzelm@21539
    76
  "op |"    (infixr "\<or>" 30) and
wenzelm@21539
    77
  All       (binder "\<forall>" 10) and
wenzelm@21539
    78
  Ex        (binder "\<exists>" 10) and
wenzelm@21539
    79
  Ex1       (binder "\<exists>!" 10) and
wenzelm@21524
    80
  "op -->"  (infixr "\<longrightarrow>" 25) and
wenzelm@21524
    81
  "op <->"  (infixr "\<longleftrightarrow>" 25)
lcp@35
    82
wenzelm@21524
    83
notation (HTML output)
wenzelm@21539
    84
  Not       ("\<not> _" [40] 40) and
wenzelm@21539
    85
  "op &"    (infixr "\<and>" 35) and
wenzelm@21539
    86
  "op |"    (infixr "\<or>" 30) and
wenzelm@21539
    87
  All       (binder "\<forall>" 10) and
wenzelm@21539
    88
  Ex        (binder "\<exists>" 10) and
wenzelm@21539
    89
  Ex1       (binder "\<exists>!" 10)
wenzelm@6340
    90
wenzelm@3932
    91
local
wenzelm@3906
    92
paulson@14236
    93
finalconsts
paulson@14236
    94
  False All Ex
paulson@14236
    95
  "op ="
paulson@14236
    96
  "op &"
paulson@14236
    97
  "op |"
paulson@14236
    98
  "op -->"
paulson@14236
    99
wenzelm@7355
   100
axioms
clasohm@0
   101
wenzelm@79
   102
  (* Equality *)
clasohm@0
   103
wenzelm@7355
   104
  refl:         "a=a"
clasohm@0
   105
wenzelm@79
   106
  (* Propositional logic *)
clasohm@0
   107
wenzelm@7355
   108
  conjI:        "[| P;  Q |] ==> P&Q"
wenzelm@7355
   109
  conjunct1:    "P&Q ==> P"
wenzelm@7355
   110
  conjunct2:    "P&Q ==> Q"
clasohm@0
   111
wenzelm@7355
   112
  disjI1:       "P ==> P|Q"
wenzelm@7355
   113
  disjI2:       "Q ==> P|Q"
wenzelm@7355
   114
  disjE:        "[| P|Q;  P ==> R;  Q ==> R |] ==> R"
clasohm@0
   115
wenzelm@7355
   116
  impI:         "(P ==> Q) ==> P-->Q"
wenzelm@7355
   117
  mp:           "[| P-->Q;  P |] ==> Q"
clasohm@0
   118
wenzelm@7355
   119
  FalseE:       "False ==> P"
wenzelm@7355
   120
wenzelm@79
   121
  (* Quantifiers *)
clasohm@0
   122
wenzelm@7355
   123
  allI:         "(!!x. P(x)) ==> (ALL x. P(x))"
wenzelm@7355
   124
  spec:         "(ALL x. P(x)) ==> P(x)"
clasohm@0
   125
wenzelm@7355
   126
  exI:          "P(x) ==> (EX x. P(x))"
wenzelm@7355
   127
  exE:          "[| EX x. P(x);  !!x. P(x) ==> R |] ==> R"
clasohm@0
   128
clasohm@0
   129
  (* Reflection *)
clasohm@0
   130
wenzelm@7355
   131
  eq_reflection:  "(x=y)   ==> (x==y)"
wenzelm@7355
   132
  iff_reflection: "(P<->Q) ==> (P==Q)"
clasohm@0
   133
wenzelm@4092
   134
wenzelm@19756
   135
lemmas strip = impI allI
wenzelm@19756
   136
wenzelm@19756
   137
paulson@15377
   138
text{*Thanks to Stephan Merz*}
paulson@15377
   139
theorem subst:
paulson@15377
   140
  assumes eq: "a = b" and p: "P(a)"
paulson@15377
   141
  shows "P(b)"
paulson@15377
   142
proof -
paulson@15377
   143
  from eq have meta: "a \<equiv> b"
paulson@15377
   144
    by (rule eq_reflection)
paulson@15377
   145
  from p show ?thesis
paulson@15377
   146
    by (unfold meta)
paulson@15377
   147
qed
paulson@15377
   148
paulson@15377
   149
paulson@14236
   150
defs
paulson@14236
   151
  (* Definitions *)
paulson@14236
   152
paulson@14236
   153
  True_def:     "True  == False-->False"
paulson@14236
   154
  not_def:      "~P    == P-->False"
paulson@14236
   155
  iff_def:      "P<->Q == (P-->Q) & (Q-->P)"
paulson@14236
   156
paulson@14236
   157
  (* Unique existence *)
paulson@14236
   158
paulson@14236
   159
  ex1_def:      "Ex1(P) == EX x. P(x) & (ALL y. P(y) --> y=x)"
paulson@14236
   160
paulson@13779
   161
wenzelm@11677
   162
subsection {* Lemmas and proof tools *}
wenzelm@11677
   163
wenzelm@21539
   164
lemma TrueI: True
wenzelm@21539
   165
  unfolding True_def by (rule impI)
wenzelm@21539
   166
wenzelm@21539
   167
wenzelm@21539
   168
(*** Sequent-style elimination rules for & --> and ALL ***)
wenzelm@21539
   169
wenzelm@21539
   170
lemma conjE:
wenzelm@21539
   171
  assumes major: "P & Q"
wenzelm@21539
   172
    and r: "[| P; Q |] ==> R"
wenzelm@21539
   173
  shows R
wenzelm@21539
   174
  apply (rule r)
wenzelm@21539
   175
   apply (rule major [THEN conjunct1])
wenzelm@21539
   176
  apply (rule major [THEN conjunct2])
wenzelm@21539
   177
  done
wenzelm@21539
   178
wenzelm@21539
   179
lemma impE:
wenzelm@21539
   180
  assumes major: "P --> Q"
wenzelm@21539
   181
    and P
wenzelm@21539
   182
  and r: "Q ==> R"
wenzelm@21539
   183
  shows R
wenzelm@21539
   184
  apply (rule r)
wenzelm@21539
   185
  apply (rule major [THEN mp])
wenzelm@21539
   186
  apply (rule `P`)
wenzelm@21539
   187
  done
wenzelm@21539
   188
wenzelm@21539
   189
lemma allE:
wenzelm@21539
   190
  assumes major: "ALL x. P(x)"
wenzelm@21539
   191
    and r: "P(x) ==> R"
wenzelm@21539
   192
  shows R
wenzelm@21539
   193
  apply (rule r)
wenzelm@21539
   194
  apply (rule major [THEN spec])
wenzelm@21539
   195
  done
wenzelm@21539
   196
wenzelm@21539
   197
(*Duplicates the quantifier; for use with eresolve_tac*)
wenzelm@21539
   198
lemma all_dupE:
wenzelm@21539
   199
  assumes major: "ALL x. P(x)"
wenzelm@21539
   200
    and r: "[| P(x); ALL x. P(x) |] ==> R"
wenzelm@21539
   201
  shows R
wenzelm@21539
   202
  apply (rule r)
wenzelm@21539
   203
   apply (rule major [THEN spec])
wenzelm@21539
   204
  apply (rule major)
wenzelm@21539
   205
  done
wenzelm@21539
   206
wenzelm@21539
   207
wenzelm@21539
   208
(*** Negation rules, which translate between ~P and P-->False ***)
wenzelm@21539
   209
wenzelm@21539
   210
lemma notI: "(P ==> False) ==> ~P"
wenzelm@21539
   211
  unfolding not_def by (erule impI)
wenzelm@21539
   212
wenzelm@21539
   213
lemma notE: "[| ~P;  P |] ==> R"
wenzelm@21539
   214
  unfolding not_def by (erule mp [THEN FalseE])
wenzelm@21539
   215
wenzelm@21539
   216
lemma rev_notE: "[| P; ~P |] ==> R"
wenzelm@21539
   217
  by (erule notE)
wenzelm@21539
   218
wenzelm@21539
   219
(*This is useful with the special implication rules for each kind of P. *)
wenzelm@21539
   220
lemma not_to_imp:
wenzelm@21539
   221
  assumes "~P"
wenzelm@21539
   222
    and r: "P --> False ==> Q"
wenzelm@21539
   223
  shows Q
wenzelm@21539
   224
  apply (rule r)
wenzelm@21539
   225
  apply (rule impI)
wenzelm@21539
   226
  apply (erule notE [OF `~P`])
wenzelm@21539
   227
  done
wenzelm@21539
   228
wenzelm@21539
   229
(* For substitution into an assumption P, reduce Q to P-->Q, substitute into
wenzelm@21539
   230
   this implication, then apply impI to move P back into the assumptions.
wenzelm@21539
   231
   To specify P use something like
wenzelm@21539
   232
      eres_inst_tac [ ("P","ALL y. ?S(x,y)") ] rev_mp 1   *)
wenzelm@21539
   233
lemma rev_mp: "[| P;  P --> Q |] ==> Q"
wenzelm@21539
   234
  by (erule mp)
wenzelm@21539
   235
wenzelm@21539
   236
(*Contrapositive of an inference rule*)
wenzelm@21539
   237
lemma contrapos:
wenzelm@21539
   238
  assumes major: "~Q"
wenzelm@21539
   239
    and minor: "P ==> Q"
wenzelm@21539
   240
  shows "~P"
wenzelm@21539
   241
  apply (rule major [THEN notE, THEN notI])
wenzelm@21539
   242
  apply (erule minor)
wenzelm@21539
   243
  done
wenzelm@21539
   244
wenzelm@21539
   245
wenzelm@21539
   246
(*** Modus Ponens Tactics ***)
wenzelm@21539
   247
wenzelm@21539
   248
(*Finds P-->Q and P in the assumptions, replaces implication by Q *)
wenzelm@21539
   249
ML {*
wenzelm@22139
   250
  fun mp_tac i = eresolve_tac [@{thm notE}, @{thm impE}] i  THEN  assume_tac i
wenzelm@22139
   251
  fun eq_mp_tac i = eresolve_tac [@{thm notE}, @{thm impE}] i  THEN  eq_assume_tac i
wenzelm@21539
   252
*}
wenzelm@21539
   253
wenzelm@21539
   254
wenzelm@21539
   255
(*** If-and-only-if ***)
wenzelm@21539
   256
wenzelm@21539
   257
lemma iffI: "[| P ==> Q; Q ==> P |] ==> P<->Q"
wenzelm@21539
   258
  apply (unfold iff_def)
wenzelm@21539
   259
  apply (rule conjI)
wenzelm@21539
   260
   apply (erule impI)
wenzelm@21539
   261
  apply (erule impI)
wenzelm@21539
   262
  done
wenzelm@21539
   263
wenzelm@21539
   264
wenzelm@21539
   265
(*Observe use of rewrite_rule to unfold "<->" in meta-assumptions (prems) *)
wenzelm@21539
   266
lemma iffE:
wenzelm@21539
   267
  assumes major: "P <-> Q"
wenzelm@21539
   268
    and r: "P-->Q ==> Q-->P ==> R"
wenzelm@21539
   269
  shows R
wenzelm@21539
   270
  apply (insert major, unfold iff_def)
wenzelm@21539
   271
  apply (erule conjE)
wenzelm@21539
   272
  apply (erule r)
wenzelm@21539
   273
  apply assumption
wenzelm@21539
   274
  done
wenzelm@21539
   275
wenzelm@21539
   276
(* Destruct rules for <-> similar to Modus Ponens *)
wenzelm@21539
   277
wenzelm@21539
   278
lemma iffD1: "[| P <-> Q;  P |] ==> Q"
wenzelm@21539
   279
  apply (unfold iff_def)
wenzelm@21539
   280
  apply (erule conjunct1 [THEN mp])
wenzelm@21539
   281
  apply assumption
wenzelm@21539
   282
  done
wenzelm@21539
   283
wenzelm@21539
   284
lemma iffD2: "[| P <-> Q;  Q |] ==> P"
wenzelm@21539
   285
  apply (unfold iff_def)
wenzelm@21539
   286
  apply (erule conjunct2 [THEN mp])
wenzelm@21539
   287
  apply assumption
wenzelm@21539
   288
  done
wenzelm@21539
   289
wenzelm@21539
   290
lemma rev_iffD1: "[| P; P <-> Q |] ==> Q"
wenzelm@21539
   291
  apply (erule iffD1)
wenzelm@21539
   292
  apply assumption
wenzelm@21539
   293
  done
wenzelm@21539
   294
wenzelm@21539
   295
lemma rev_iffD2: "[| Q; P <-> Q |] ==> P"
wenzelm@21539
   296
  apply (erule iffD2)
wenzelm@21539
   297
  apply assumption
wenzelm@21539
   298
  done
wenzelm@21539
   299
wenzelm@21539
   300
lemma iff_refl: "P <-> P"
wenzelm@21539
   301
  by (rule iffI)
wenzelm@21539
   302
wenzelm@21539
   303
lemma iff_sym: "Q <-> P ==> P <-> Q"
wenzelm@21539
   304
  apply (erule iffE)
wenzelm@21539
   305
  apply (rule iffI)
wenzelm@21539
   306
  apply (assumption | erule mp)+
wenzelm@21539
   307
  done
wenzelm@21539
   308
wenzelm@21539
   309
lemma iff_trans: "[| P <-> Q;  Q<-> R |] ==> P <-> R"
wenzelm@21539
   310
  apply (rule iffI)
wenzelm@21539
   311
  apply (assumption | erule iffE | erule (1) notE impE)+
wenzelm@21539
   312
  done
wenzelm@21539
   313
wenzelm@21539
   314
wenzelm@21539
   315
(*** Unique existence.  NOTE THAT the following 2 quantifications
wenzelm@21539
   316
   EX!x such that [EX!y such that P(x,y)]     (sequential)
wenzelm@21539
   317
   EX!x,y such that P(x,y)                    (simultaneous)
wenzelm@21539
   318
 do NOT mean the same thing.  The parser treats EX!x y.P(x,y) as sequential.
wenzelm@21539
   319
***)
wenzelm@21539
   320
wenzelm@21539
   321
lemma ex1I:
wenzelm@23393
   322
  "P(a) \<Longrightarrow> (!!x. P(x) ==> x=a) \<Longrightarrow> EX! x. P(x)"
wenzelm@21539
   323
  apply (unfold ex1_def)
wenzelm@23393
   324
  apply (assumption | rule exI conjI allI impI)+
wenzelm@21539
   325
  done
wenzelm@21539
   326
wenzelm@21539
   327
(*Sometimes easier to use: the premises have no shared variables.  Safe!*)
wenzelm@21539
   328
lemma ex_ex1I:
wenzelm@23393
   329
  "EX x. P(x) \<Longrightarrow> (!!x y. [| P(x); P(y) |] ==> x=y) \<Longrightarrow> EX! x. P(x)"
wenzelm@23393
   330
  apply (erule exE)
wenzelm@23393
   331
  apply (rule ex1I)
wenzelm@23393
   332
   apply assumption
wenzelm@23393
   333
  apply assumption
wenzelm@21539
   334
  done
wenzelm@21539
   335
wenzelm@21539
   336
lemma ex1E:
wenzelm@23393
   337
  "EX! x. P(x) \<Longrightarrow> (!!x. [| P(x);  ALL y. P(y) --> y=x |] ==> R) \<Longrightarrow> R"
wenzelm@23393
   338
  apply (unfold ex1_def)
wenzelm@21539
   339
  apply (assumption | erule exE conjE)+
wenzelm@21539
   340
  done
wenzelm@21539
   341
wenzelm@21539
   342
wenzelm@21539
   343
(*** <-> congruence rules for simplification ***)
wenzelm@21539
   344
wenzelm@21539
   345
(*Use iffE on a premise.  For conj_cong, imp_cong, all_cong, ex_cong*)
wenzelm@21539
   346
ML {*
wenzelm@22139
   347
  fun iff_tac prems i =
wenzelm@22139
   348
    resolve_tac (prems RL @{thms iffE}) i THEN
wenzelm@22139
   349
    REPEAT1 (eresolve_tac [@{thm asm_rl}, @{thm mp}] i)
wenzelm@21539
   350
*}
wenzelm@21539
   351
wenzelm@21539
   352
lemma conj_cong:
wenzelm@21539
   353
  assumes "P <-> P'"
wenzelm@21539
   354
    and "P' ==> Q <-> Q'"
wenzelm@21539
   355
  shows "(P&Q) <-> (P'&Q')"
wenzelm@21539
   356
  apply (insert assms)
wenzelm@21539
   357
  apply (assumption | rule iffI conjI | erule iffE conjE mp |
wenzelm@21539
   358
    tactic {* iff_tac (thms "assms") 1 *})+
wenzelm@21539
   359
  done
wenzelm@21539
   360
wenzelm@21539
   361
(*Reversed congruence rule!   Used in ZF/Order*)
wenzelm@21539
   362
lemma conj_cong2:
wenzelm@21539
   363
  assumes "P <-> P'"
wenzelm@21539
   364
    and "P' ==> Q <-> Q'"
wenzelm@21539
   365
  shows "(Q&P) <-> (Q'&P')"
wenzelm@21539
   366
  apply (insert assms)
wenzelm@21539
   367
  apply (assumption | rule iffI conjI | erule iffE conjE mp |
wenzelm@21539
   368
    tactic {* iff_tac (thms "assms") 1 *})+
wenzelm@21539
   369
  done
wenzelm@21539
   370
wenzelm@21539
   371
lemma disj_cong:
wenzelm@21539
   372
  assumes "P <-> P'" and "Q <-> Q'"
wenzelm@21539
   373
  shows "(P|Q) <-> (P'|Q')"
wenzelm@21539
   374
  apply (insert assms)
wenzelm@21539
   375
  apply (erule iffE disjE disjI1 disjI2 | assumption | rule iffI | erule (1) notE impE)+
wenzelm@21539
   376
  done
wenzelm@21539
   377
wenzelm@21539
   378
lemma imp_cong:
wenzelm@21539
   379
  assumes "P <-> P'"
wenzelm@21539
   380
    and "P' ==> Q <-> Q'"
wenzelm@21539
   381
  shows "(P-->Q) <-> (P'-->Q')"
wenzelm@21539
   382
  apply (insert assms)
wenzelm@21539
   383
  apply (assumption | rule iffI impI | erule iffE | erule (1) notE impE |
wenzelm@21539
   384
    tactic {* iff_tac (thms "assms") 1 *})+
wenzelm@21539
   385
  done
wenzelm@21539
   386
wenzelm@21539
   387
lemma iff_cong: "[| P <-> P'; Q <-> Q' |] ==> (P<->Q) <-> (P'<->Q')"
wenzelm@21539
   388
  apply (erule iffE | assumption | rule iffI | erule (1) notE impE)+
wenzelm@21539
   389
  done
wenzelm@21539
   390
wenzelm@21539
   391
lemma not_cong: "P <-> P' ==> ~P <-> ~P'"
wenzelm@21539
   392
  apply (assumption | rule iffI notI | erule (1) notE impE | erule iffE notE)+
wenzelm@21539
   393
  done
wenzelm@21539
   394
wenzelm@21539
   395
lemma all_cong:
wenzelm@21539
   396
  assumes "!!x. P(x) <-> Q(x)"
wenzelm@21539
   397
  shows "(ALL x. P(x)) <-> (ALL x. Q(x))"
wenzelm@21539
   398
  apply (assumption | rule iffI allI | erule (1) notE impE | erule allE |
wenzelm@21539
   399
    tactic {* iff_tac (thms "assms") 1 *})+
wenzelm@21539
   400
  done
wenzelm@21539
   401
wenzelm@21539
   402
lemma ex_cong:
wenzelm@21539
   403
  assumes "!!x. P(x) <-> Q(x)"
wenzelm@21539
   404
  shows "(EX x. P(x)) <-> (EX x. Q(x))"
wenzelm@21539
   405
  apply (erule exE | assumption | rule iffI exI | erule (1) notE impE |
wenzelm@21539
   406
    tactic {* iff_tac (thms "assms") 1 *})+
wenzelm@21539
   407
  done
wenzelm@21539
   408
wenzelm@21539
   409
lemma ex1_cong:
wenzelm@21539
   410
  assumes "!!x. P(x) <-> Q(x)"
wenzelm@21539
   411
  shows "(EX! x. P(x)) <-> (EX! x. Q(x))"
wenzelm@21539
   412
  apply (erule ex1E spec [THEN mp] | assumption | rule iffI ex1I | erule (1) notE impE |
wenzelm@21539
   413
    tactic {* iff_tac (thms "assms") 1 *})+
wenzelm@21539
   414
  done
wenzelm@21539
   415
wenzelm@21539
   416
(*** Equality rules ***)
wenzelm@21539
   417
wenzelm@21539
   418
lemma sym: "a=b ==> b=a"
wenzelm@21539
   419
  apply (erule subst)
wenzelm@21539
   420
  apply (rule refl)
wenzelm@21539
   421
  done
wenzelm@21539
   422
wenzelm@21539
   423
lemma trans: "[| a=b;  b=c |] ==> a=c"
wenzelm@21539
   424
  apply (erule subst, assumption)
wenzelm@21539
   425
  done
wenzelm@21539
   426
wenzelm@21539
   427
(**  **)
wenzelm@21539
   428
lemma not_sym: "b ~= a ==> a ~= b"
wenzelm@21539
   429
  apply (erule contrapos)
wenzelm@21539
   430
  apply (erule sym)
wenzelm@21539
   431
  done
wenzelm@21539
   432
  
wenzelm@21539
   433
(* Two theorms for rewriting only one instance of a definition:
wenzelm@21539
   434
   the first for definitions of formulae and the second for terms *)
wenzelm@21539
   435
wenzelm@21539
   436
lemma def_imp_iff: "(A == B) ==> A <-> B"
wenzelm@21539
   437
  apply unfold
wenzelm@21539
   438
  apply (rule iff_refl)
wenzelm@21539
   439
  done
wenzelm@21539
   440
wenzelm@21539
   441
lemma meta_eq_to_obj_eq: "(A == B) ==> A = B"
wenzelm@21539
   442
  apply unfold
wenzelm@21539
   443
  apply (rule refl)
wenzelm@21539
   444
  done
wenzelm@21539
   445
wenzelm@21539
   446
lemma meta_eq_to_iff: "x==y ==> x<->y"
wenzelm@21539
   447
  by unfold (rule iff_refl)
wenzelm@21539
   448
wenzelm@21539
   449
(*substitution*)
wenzelm@21539
   450
lemma ssubst: "[| b = a; P(a) |] ==> P(b)"
wenzelm@21539
   451
  apply (drule sym)
wenzelm@21539
   452
  apply (erule (1) subst)
wenzelm@21539
   453
  done
wenzelm@21539
   454
wenzelm@21539
   455
(*A special case of ex1E that would otherwise need quantifier expansion*)
wenzelm@21539
   456
lemma ex1_equalsE:
wenzelm@21539
   457
    "[| EX! x. P(x);  P(a);  P(b) |] ==> a=b"
wenzelm@21539
   458
  apply (erule ex1E)
wenzelm@21539
   459
  apply (rule trans)
wenzelm@21539
   460
   apply (rule_tac [2] sym)
wenzelm@21539
   461
   apply (assumption | erule spec [THEN mp])+
wenzelm@21539
   462
  done
wenzelm@21539
   463
wenzelm@21539
   464
(** Polymorphic congruence rules **)
wenzelm@21539
   465
wenzelm@21539
   466
lemma subst_context: "[| a=b |]  ==>  t(a)=t(b)"
wenzelm@21539
   467
  apply (erule ssubst)
wenzelm@21539
   468
  apply (rule refl)
wenzelm@21539
   469
  done
wenzelm@21539
   470
wenzelm@21539
   471
lemma subst_context2: "[| a=b;  c=d |]  ==>  t(a,c)=t(b,d)"
wenzelm@21539
   472
  apply (erule ssubst)+
wenzelm@21539
   473
  apply (rule refl)
wenzelm@21539
   474
  done
wenzelm@21539
   475
wenzelm@21539
   476
lemma subst_context3: "[| a=b;  c=d;  e=f |]  ==>  t(a,c,e)=t(b,d,f)"
wenzelm@21539
   477
  apply (erule ssubst)+
wenzelm@21539
   478
  apply (rule refl)
wenzelm@21539
   479
  done
wenzelm@21539
   480
wenzelm@21539
   481
(*Useful with eresolve_tac for proving equalties from known equalities.
wenzelm@21539
   482
        a = b
wenzelm@21539
   483
        |   |
wenzelm@21539
   484
        c = d   *)
wenzelm@21539
   485
lemma box_equals: "[| a=b;  a=c;  b=d |] ==> c=d"
wenzelm@21539
   486
  apply (rule trans)
wenzelm@21539
   487
   apply (rule trans)
wenzelm@21539
   488
    apply (rule sym)
wenzelm@21539
   489
    apply assumption+
wenzelm@21539
   490
  done
wenzelm@21539
   491
wenzelm@21539
   492
(*Dual of box_equals: for proving equalities backwards*)
wenzelm@21539
   493
lemma simp_equals: "[| a=c;  b=d;  c=d |] ==> a=b"
wenzelm@21539
   494
  apply (rule trans)
wenzelm@21539
   495
   apply (rule trans)
wenzelm@21539
   496
    apply assumption+
wenzelm@21539
   497
  apply (erule sym)
wenzelm@21539
   498
  done
wenzelm@21539
   499
wenzelm@21539
   500
(** Congruence rules for predicate letters **)
wenzelm@21539
   501
wenzelm@21539
   502
lemma pred1_cong: "a=a' ==> P(a) <-> P(a')"
wenzelm@21539
   503
  apply (rule iffI)
wenzelm@21539
   504
   apply (erule (1) subst)
wenzelm@21539
   505
  apply (erule (1) ssubst)
wenzelm@21539
   506
  done
wenzelm@21539
   507
wenzelm@21539
   508
lemma pred2_cong: "[| a=a';  b=b' |] ==> P(a,b) <-> P(a',b')"
wenzelm@21539
   509
  apply (rule iffI)
wenzelm@21539
   510
   apply (erule subst)+
wenzelm@21539
   511
   apply assumption
wenzelm@21539
   512
  apply (erule ssubst)+
wenzelm@21539
   513
  apply assumption
wenzelm@21539
   514
  done
wenzelm@21539
   515
wenzelm@21539
   516
lemma pred3_cong: "[| a=a';  b=b';  c=c' |] ==> P(a,b,c) <-> P(a',b',c')"
wenzelm@21539
   517
  apply (rule iffI)
wenzelm@21539
   518
   apply (erule subst)+
wenzelm@21539
   519
   apply assumption
wenzelm@21539
   520
  apply (erule ssubst)+
wenzelm@21539
   521
  apply assumption
wenzelm@21539
   522
  done
wenzelm@21539
   523
wenzelm@21539
   524
(*special cases for free variables P, Q, R, S -- up to 3 arguments*)
wenzelm@21539
   525
wenzelm@21539
   526
ML {*
wenzelm@21539
   527
bind_thms ("pred_congs",
wenzelm@21539
   528
  List.concat (map (fn c => 
wenzelm@21539
   529
               map (fn th => read_instantiate [("P",c)] th)
wenzelm@22139
   530
                   [@{thm pred1_cong}, @{thm pred2_cong}, @{thm pred3_cong}])
wenzelm@21539
   531
               (explode"PQRS")))
wenzelm@21539
   532
*}
wenzelm@21539
   533
wenzelm@21539
   534
(*special case for the equality predicate!*)
wenzelm@21539
   535
lemma eq_cong: "[| a = a'; b = b' |] ==> a = b <-> a' = b'"
wenzelm@21539
   536
  apply (erule (1) pred2_cong)
wenzelm@21539
   537
  done
wenzelm@21539
   538
wenzelm@21539
   539
wenzelm@21539
   540
(*** Simplifications of assumed implications.
wenzelm@21539
   541
     Roy Dyckhoff has proved that conj_impE, disj_impE, and imp_impE
wenzelm@21539
   542
     used with mp_tac (restricted to atomic formulae) is COMPLETE for 
wenzelm@21539
   543
     intuitionistic propositional logic.  See
wenzelm@21539
   544
   R. Dyckhoff, Contraction-free sequent calculi for intuitionistic logic
wenzelm@21539
   545
    (preprint, University of St Andrews, 1991)  ***)
wenzelm@21539
   546
wenzelm@21539
   547
lemma conj_impE:
wenzelm@21539
   548
  assumes major: "(P&Q)-->S"
wenzelm@21539
   549
    and r: "P-->(Q-->S) ==> R"
wenzelm@21539
   550
  shows R
wenzelm@21539
   551
  by (assumption | rule conjI impI major [THEN mp] r)+
wenzelm@21539
   552
wenzelm@21539
   553
lemma disj_impE:
wenzelm@21539
   554
  assumes major: "(P|Q)-->S"
wenzelm@21539
   555
    and r: "[| P-->S; Q-->S |] ==> R"
wenzelm@21539
   556
  shows R
wenzelm@21539
   557
  by (assumption | rule disjI1 disjI2 impI major [THEN mp] r)+
wenzelm@21539
   558
wenzelm@21539
   559
(*Simplifies the implication.  Classical version is stronger. 
wenzelm@21539
   560
  Still UNSAFE since Q must be provable -- backtracking needed.  *)
wenzelm@21539
   561
lemma imp_impE:
wenzelm@21539
   562
  assumes major: "(P-->Q)-->S"
wenzelm@21539
   563
    and r1: "[| P; Q-->S |] ==> Q"
wenzelm@21539
   564
    and r2: "S ==> R"
wenzelm@21539
   565
  shows R
wenzelm@21539
   566
  by (assumption | rule impI major [THEN mp] r1 r2)+
wenzelm@21539
   567
wenzelm@21539
   568
(*Simplifies the implication.  Classical version is stronger. 
wenzelm@21539
   569
  Still UNSAFE since ~P must be provable -- backtracking needed.  *)
wenzelm@21539
   570
lemma not_impE:
wenzelm@23393
   571
  "~P --> S \<Longrightarrow> (P ==> False) \<Longrightarrow> (S ==> R) \<Longrightarrow> R"
wenzelm@23393
   572
  apply (drule mp)
wenzelm@23393
   573
   apply (rule notI)
wenzelm@23393
   574
   apply assumption
wenzelm@23393
   575
  apply assumption
wenzelm@21539
   576
  done
wenzelm@21539
   577
wenzelm@21539
   578
(*Simplifies the implication.   UNSAFE.  *)
wenzelm@21539
   579
lemma iff_impE:
wenzelm@21539
   580
  assumes major: "(P<->Q)-->S"
wenzelm@21539
   581
    and r1: "[| P; Q-->S |] ==> Q"
wenzelm@21539
   582
    and r2: "[| Q; P-->S |] ==> P"
wenzelm@21539
   583
    and r3: "S ==> R"
wenzelm@21539
   584
  shows R
wenzelm@21539
   585
  apply (assumption | rule iffI impI major [THEN mp] r1 r2 r3)+
wenzelm@21539
   586
  done
wenzelm@21539
   587
wenzelm@21539
   588
(*What if (ALL x.~~P(x)) --> ~~(ALL x.P(x)) is an assumption? UNSAFE*)
wenzelm@21539
   589
lemma all_impE:
wenzelm@21539
   590
  assumes major: "(ALL x. P(x))-->S"
wenzelm@21539
   591
    and r1: "!!x. P(x)"
wenzelm@21539
   592
    and r2: "S ==> R"
wenzelm@21539
   593
  shows R
wenzelm@23393
   594
  apply (rule allI impI major [THEN mp] r1 r2)+
wenzelm@21539
   595
  done
wenzelm@21539
   596
wenzelm@21539
   597
(*Unsafe: (EX x.P(x))-->S  is equivalent to  ALL x.P(x)-->S.  *)
wenzelm@21539
   598
lemma ex_impE:
wenzelm@21539
   599
  assumes major: "(EX x. P(x))-->S"
wenzelm@21539
   600
    and r: "P(x)-->S ==> R"
wenzelm@21539
   601
  shows R
wenzelm@21539
   602
  apply (assumption | rule exI impI major [THEN mp] r)+
wenzelm@21539
   603
  done
wenzelm@21539
   604
wenzelm@21539
   605
(*** Courtesy of Krzysztof Grabczewski ***)
wenzelm@21539
   606
wenzelm@21539
   607
lemma disj_imp_disj:
wenzelm@23393
   608
  "P|Q \<Longrightarrow> (P==>R) \<Longrightarrow> (Q==>S) \<Longrightarrow> R|S"
wenzelm@23393
   609
  apply (erule disjE)
wenzelm@21539
   610
  apply (rule disjI1) apply assumption
wenzelm@21539
   611
  apply (rule disjI2) apply assumption
wenzelm@21539
   612
  done
wenzelm@11734
   613
wenzelm@18481
   614
ML {*
wenzelm@18481
   615
structure ProjectRule = ProjectRuleFun
wenzelm@18481
   616
(struct
wenzelm@22139
   617
  val conjunct1 = @{thm conjunct1}
wenzelm@22139
   618
  val conjunct2 = @{thm conjunct2}
wenzelm@22139
   619
  val mp = @{thm mp}
wenzelm@18481
   620
end)
wenzelm@18481
   621
*}
wenzelm@18481
   622
wenzelm@7355
   623
use "fologic.ML"
wenzelm@21539
   624
wenzelm@21539
   625
lemma thin_refl: "!!X. [|x=x; PROP W|] ==> PROP W" .
wenzelm@21539
   626
wenzelm@9886
   627
use "hypsubstdata.ML"
wenzelm@9886
   628
setup hypsubst_setup
wenzelm@7355
   629
use "intprover.ML"
wenzelm@7355
   630
wenzelm@4092
   631
wenzelm@12875
   632
subsection {* Intuitionistic Reasoning *}
wenzelm@12368
   633
wenzelm@12349
   634
lemma impE':
wenzelm@12937
   635
  assumes 1: "P --> Q"
wenzelm@12937
   636
    and 2: "Q ==> R"
wenzelm@12937
   637
    and 3: "P --> Q ==> P"
wenzelm@12937
   638
  shows R
wenzelm@12349
   639
proof -
wenzelm@12349
   640
  from 3 and 1 have P .
wenzelm@12368
   641
  with 1 have Q by (rule impE)
wenzelm@12349
   642
  with 2 show R .
wenzelm@12349
   643
qed
wenzelm@12349
   644
wenzelm@12349
   645
lemma allE':
wenzelm@12937
   646
  assumes 1: "ALL x. P(x)"
wenzelm@12937
   647
    and 2: "P(x) ==> ALL x. P(x) ==> Q"
wenzelm@12937
   648
  shows Q
wenzelm@12349
   649
proof -
wenzelm@12349
   650
  from 1 have "P(x)" by (rule spec)
wenzelm@12349
   651
  from this and 1 show Q by (rule 2)
wenzelm@12349
   652
qed
wenzelm@12349
   653
wenzelm@12937
   654
lemma notE':
wenzelm@12937
   655
  assumes 1: "~ P"
wenzelm@12937
   656
    and 2: "~ P ==> P"
wenzelm@12937
   657
  shows R
wenzelm@12349
   658
proof -
wenzelm@12349
   659
  from 2 and 1 have P .
wenzelm@12349
   660
  with 1 show R by (rule notE)
wenzelm@12349
   661
qed
wenzelm@12349
   662
wenzelm@12349
   663
lemmas [Pure.elim!] = disjE iffE FalseE conjE exE
wenzelm@12349
   664
  and [Pure.intro!] = iffI conjI impI TrueI notI allI refl
wenzelm@12349
   665
  and [Pure.elim 2] = allE notE' impE'
wenzelm@12349
   666
  and [Pure.intro] = exI disjI2 disjI1
wenzelm@12349
   667
wenzelm@18708
   668
setup {* ContextRules.addSWrapper (fn tac => hyp_subst_tac ORELSE' tac) *}
wenzelm@12349
   669
wenzelm@12349
   670
wenzelm@12368
   671
lemma iff_not_sym: "~ (Q <-> P) ==> ~ (P <-> Q)"
nipkow@17591
   672
  by iprover
wenzelm@12368
   673
wenzelm@12368
   674
lemmas [sym] = sym iff_sym not_sym iff_not_sym
wenzelm@12368
   675
  and [Pure.elim?] = iffD1 iffD2 impE
wenzelm@12368
   676
wenzelm@12368
   677
paulson@13435
   678
lemma eq_commute: "a=b <-> b=a"
paulson@13435
   679
apply (rule iffI) 
paulson@13435
   680
apply (erule sym)+
paulson@13435
   681
done
paulson@13435
   682
paulson@13435
   683
wenzelm@11677
   684
subsection {* Atomizing meta-level rules *}
wenzelm@11677
   685
wenzelm@11747
   686
lemma atomize_all [atomize]: "(!!x. P(x)) == Trueprop (ALL x. P(x))"
wenzelm@11976
   687
proof
wenzelm@11677
   688
  assume "!!x. P(x)"
wenzelm@22931
   689
  then show "ALL x. P(x)" ..
wenzelm@11677
   690
next
wenzelm@11677
   691
  assume "ALL x. P(x)"
wenzelm@22931
   692
  then show "!!x. P(x)" ..
wenzelm@11677
   693
qed
wenzelm@11677
   694
wenzelm@11747
   695
lemma atomize_imp [atomize]: "(A ==> B) == Trueprop (A --> B)"
wenzelm@11976
   696
proof
wenzelm@12368
   697
  assume "A ==> B"
wenzelm@22931
   698
  then show "A --> B" ..
wenzelm@11677
   699
next
wenzelm@11677
   700
  assume "A --> B" and A
wenzelm@22931
   701
  then show B by (rule mp)
wenzelm@11677
   702
qed
wenzelm@11677
   703
wenzelm@11747
   704
lemma atomize_eq [atomize]: "(x == y) == Trueprop (x = y)"
wenzelm@11976
   705
proof
wenzelm@11677
   706
  assume "x == y"
wenzelm@22931
   707
  show "x = y" unfolding `x == y` by (rule refl)
wenzelm@11677
   708
next
wenzelm@11677
   709
  assume "x = y"
wenzelm@22931
   710
  then show "x == y" by (rule eq_reflection)
wenzelm@11677
   711
qed
wenzelm@11677
   712
wenzelm@18813
   713
lemma atomize_iff [atomize]: "(A == B) == Trueprop (A <-> B)"
wenzelm@18813
   714
proof
wenzelm@18813
   715
  assume "A == B"
wenzelm@22931
   716
  show "A <-> B" unfolding `A == B` by (rule iff_refl)
wenzelm@18813
   717
next
wenzelm@18813
   718
  assume "A <-> B"
wenzelm@22931
   719
  then show "A == B" by (rule iff_reflection)
wenzelm@18813
   720
qed
wenzelm@18813
   721
wenzelm@12875
   722
lemma atomize_conj [atomize]:
wenzelm@19120
   723
  includes meta_conjunction_syntax
wenzelm@19120
   724
  shows "(A && B) == Trueprop (A & B)"
wenzelm@11976
   725
proof
wenzelm@19120
   726
  assume conj: "A && B"
wenzelm@19120
   727
  show "A & B"
wenzelm@19120
   728
  proof (rule conjI)
wenzelm@19120
   729
    from conj show A by (rule conjunctionD1)
wenzelm@19120
   730
    from conj show B by (rule conjunctionD2)
wenzelm@19120
   731
  qed
wenzelm@11953
   732
next
wenzelm@19120
   733
  assume conj: "A & B"
wenzelm@19120
   734
  show "A && B"
wenzelm@19120
   735
  proof -
wenzelm@19120
   736
    from conj show A ..
wenzelm@19120
   737
    from conj show B ..
wenzelm@11953
   738
  qed
wenzelm@11953
   739
qed
wenzelm@11953
   740
wenzelm@12368
   741
lemmas [symmetric, rulify] = atomize_all atomize_imp
wenzelm@18861
   742
  and [symmetric, defn] = atomize_all atomize_imp atomize_eq atomize_iff
wenzelm@11771
   743
wenzelm@11848
   744
wenzelm@11848
   745
subsection {* Calculational rules *}
wenzelm@11848
   746
wenzelm@11848
   747
lemma forw_subst: "a = b ==> P(b) ==> P(a)"
wenzelm@11848
   748
  by (rule ssubst)
wenzelm@11848
   749
wenzelm@11848
   750
lemma back_subst: "P(a) ==> a = b ==> P(b)"
wenzelm@11848
   751
  by (rule subst)
wenzelm@11848
   752
wenzelm@11848
   753
text {*
wenzelm@11848
   754
  Note that this list of rules is in reverse order of priorities.
wenzelm@11848
   755
*}
wenzelm@11848
   756
wenzelm@12019
   757
lemmas basic_trans_rules [trans] =
wenzelm@11848
   758
  forw_subst
wenzelm@11848
   759
  back_subst
wenzelm@11848
   760
  rev_mp
wenzelm@11848
   761
  mp
wenzelm@11848
   762
  trans
wenzelm@11848
   763
paulson@13779
   764
subsection {* ``Let'' declarations *}
paulson@13779
   765
paulson@13779
   766
nonterminals letbinds letbind
paulson@13779
   767
paulson@13779
   768
constdefs
wenzelm@14854
   769
  Let :: "['a::{}, 'a => 'b] => ('b::{})"
paulson@13779
   770
    "Let(s, f) == f(s)"
paulson@13779
   771
paulson@13779
   772
syntax
paulson@13779
   773
  "_bind"       :: "[pttrn, 'a] => letbind"           ("(2_ =/ _)" 10)
paulson@13779
   774
  ""            :: "letbind => letbinds"              ("_")
paulson@13779
   775
  "_binds"      :: "[letbind, letbinds] => letbinds"  ("_;/ _")
paulson@13779
   776
  "_Let"        :: "[letbinds, 'a] => 'a"             ("(let (_)/ in (_))" 10)
paulson@13779
   777
paulson@13779
   778
translations
paulson@13779
   779
  "_Let(_binds(b, bs), e)"  == "_Let(b, _Let(bs, e))"
paulson@13779
   780
  "let x = a in e"          == "Let(a, %x. e)"
paulson@13779
   781
paulson@13779
   782
paulson@13779
   783
lemma LetI: 
wenzelm@21539
   784
  assumes "!!x. x=t ==> P(u(x))"
wenzelm@21539
   785
  shows "P(let x=t in u(x))"
wenzelm@21539
   786
  apply (unfold Let_def)
wenzelm@21539
   787
  apply (rule refl [THEN assms])
wenzelm@21539
   788
  done
wenzelm@21539
   789
wenzelm@21539
   790
wenzelm@21539
   791
subsection {* ML bindings *}
paulson@13779
   792
wenzelm@21539
   793
ML {*
wenzelm@22139
   794
val refl = @{thm refl}
wenzelm@22139
   795
val trans = @{thm trans}
wenzelm@22139
   796
val sym = @{thm sym}
wenzelm@22139
   797
val subst = @{thm subst}
wenzelm@22139
   798
val ssubst = @{thm ssubst}
wenzelm@22139
   799
val conjI = @{thm conjI}
wenzelm@22139
   800
val conjE = @{thm conjE}
wenzelm@22139
   801
val conjunct1 = @{thm conjunct1}
wenzelm@22139
   802
val conjunct2 = @{thm conjunct2}
wenzelm@22139
   803
val disjI1 = @{thm disjI1}
wenzelm@22139
   804
val disjI2 = @{thm disjI2}
wenzelm@22139
   805
val disjE = @{thm disjE}
wenzelm@22139
   806
val impI = @{thm impI}
wenzelm@22139
   807
val impE = @{thm impE}
wenzelm@22139
   808
val mp = @{thm mp}
wenzelm@22139
   809
val rev_mp = @{thm rev_mp}
wenzelm@22139
   810
val TrueI = @{thm TrueI}
wenzelm@22139
   811
val FalseE = @{thm FalseE}
wenzelm@22139
   812
val iff_refl = @{thm iff_refl}
wenzelm@22139
   813
val iff_trans = @{thm iff_trans}
wenzelm@22139
   814
val iffI = @{thm iffI}
wenzelm@22139
   815
val iffE = @{thm iffE}
wenzelm@22139
   816
val iffD1 = @{thm iffD1}
wenzelm@22139
   817
val iffD2 = @{thm iffD2}
wenzelm@22139
   818
val notI = @{thm notI}
wenzelm@22139
   819
val notE = @{thm notE}
wenzelm@22139
   820
val allI = @{thm allI}
wenzelm@22139
   821
val allE = @{thm allE}
wenzelm@22139
   822
val spec = @{thm spec}
wenzelm@22139
   823
val exI = @{thm exI}
wenzelm@22139
   824
val exE = @{thm exE}
wenzelm@22139
   825
val eq_reflection = @{thm eq_reflection}
wenzelm@22139
   826
val iff_reflection = @{thm iff_reflection}
wenzelm@22139
   827
val meta_eq_to_obj_eq = @{thm meta_eq_to_obj_eq}
wenzelm@22139
   828
val meta_eq_to_iff = @{thm meta_eq_to_iff}
paulson@13779
   829
*}
paulson@13779
   830
wenzelm@4854
   831
end