src/HOL/HOL.thy
author wenzelm
Thu Apr 21 22:02:06 2005 +0200 (2005-04-21)
changeset 15801 d2f5ca3c048d
parent 15676 042692b6275d
child 16019 0e1405402d53
permissions -rw-r--r--
superceded by Pure.thy and CPure.thy;
clasohm@923
     1
(*  Title:      HOL/HOL.thy
clasohm@923
     2
    ID:         $Id$
wenzelm@11750
     3
    Author:     Tobias Nipkow, Markus Wenzel, and Larry Paulson
wenzelm@11750
     4
*)
clasohm@923
     5
wenzelm@11750
     6
header {* The basis of Higher-Order Logic *}
clasohm@923
     7
nipkow@15131
     8
theory HOL
nipkow@15140
     9
imports CPure
nipkow@15524
    10
files ("cladata.ML") ("blastdata.ML") ("simpdata.ML") ("eqrule_HOL_data.ML")
paulson@15481
    11
      ("~~/src/Provers/eqsubst.ML")
nipkow@15131
    12
begin
wenzelm@2260
    13
wenzelm@11750
    14
subsection {* Primitive logic *}
wenzelm@11750
    15
wenzelm@11750
    16
subsubsection {* Core syntax *}
wenzelm@2260
    17
wenzelm@14854
    18
classes type
wenzelm@12338
    19
defaultsort type
wenzelm@3947
    20
wenzelm@12338
    21
global
clasohm@923
    22
wenzelm@7357
    23
typedecl bool
clasohm@923
    24
clasohm@923
    25
arities
wenzelm@12338
    26
  bool :: type
wenzelm@12338
    27
  fun :: (type, type) type
clasohm@923
    28
wenzelm@11750
    29
judgment
wenzelm@11750
    30
  Trueprop      :: "bool => prop"                   ("(_)" 5)
clasohm@923
    31
wenzelm@11750
    32
consts
wenzelm@7357
    33
  Not           :: "bool => bool"                   ("~ _" [40] 40)
wenzelm@7357
    34
  True          :: bool
wenzelm@7357
    35
  False         :: bool
wenzelm@7357
    36
  If            :: "[bool, 'a, 'a] => 'a"           ("(if (_)/ then (_)/ else (_))" 10)
wenzelm@3947
    37
  arbitrary     :: 'a
clasohm@923
    38
wenzelm@11432
    39
  The           :: "('a => bool) => 'a"
wenzelm@7357
    40
  All           :: "('a => bool) => bool"           (binder "ALL " 10)
wenzelm@7357
    41
  Ex            :: "('a => bool) => bool"           (binder "EX " 10)
wenzelm@7357
    42
  Ex1           :: "('a => bool) => bool"           (binder "EX! " 10)
wenzelm@7357
    43
  Let           :: "['a, 'a => 'b] => 'b"
clasohm@923
    44
wenzelm@7357
    45
  "="           :: "['a, 'a] => bool"               (infixl 50)
wenzelm@7357
    46
  &             :: "[bool, bool] => bool"           (infixr 35)
wenzelm@7357
    47
  "|"           :: "[bool, bool] => bool"           (infixr 30)
wenzelm@7357
    48
  -->           :: "[bool, bool] => bool"           (infixr 25)
clasohm@923
    49
wenzelm@10432
    50
local
wenzelm@10432
    51
wenzelm@2260
    52
wenzelm@11750
    53
subsubsection {* Additional concrete syntax *}
wenzelm@2260
    54
wenzelm@4868
    55
nonterminals
clasohm@923
    56
  letbinds  letbind
clasohm@923
    57
  case_syn  cases_syn
clasohm@923
    58
clasohm@923
    59
syntax
wenzelm@12650
    60
  "_not_equal"  :: "['a, 'a] => bool"                    (infixl "~=" 50)
wenzelm@11432
    61
  "_The"        :: "[pttrn, bool] => 'a"                 ("(3THE _./ _)" [0, 10] 10)
clasohm@923
    62
wenzelm@7357
    63
  "_bind"       :: "[pttrn, 'a] => letbind"              ("(2_ =/ _)" 10)
wenzelm@7357
    64
  ""            :: "letbind => letbinds"                 ("_")
wenzelm@7357
    65
  "_binds"      :: "[letbind, letbinds] => letbinds"     ("_;/ _")
wenzelm@7357
    66
  "_Let"        :: "[letbinds, 'a] => 'a"                ("(let (_)/ in (_))" 10)
clasohm@923
    67
wenzelm@9060
    68
  "_case_syntax":: "['a, cases_syn] => 'b"               ("(case _ of/ _)" 10)
wenzelm@9060
    69
  "_case1"      :: "['a, 'b] => case_syn"                ("(2_ =>/ _)" 10)
wenzelm@7357
    70
  ""            :: "case_syn => cases_syn"               ("_")
wenzelm@9060
    71
  "_case2"      :: "[case_syn, cases_syn] => cases_syn"  ("_/ | _")
clasohm@923
    72
clasohm@923
    73
translations
wenzelm@7238
    74
  "x ~= y"                == "~ (x = y)"
nipkow@13764
    75
  "THE x. P"              == "The (%x. P)"
clasohm@923
    76
  "_Let (_binds b bs) e"  == "_Let b (_Let bs e)"
nipkow@1114
    77
  "let x = a in e"        == "Let a (%x. e)"
clasohm@923
    78
nipkow@13763
    79
print_translation {*
nipkow@13763
    80
(* To avoid eta-contraction of body: *)
nipkow@13763
    81
[("The", fn [Abs abs] =>
nipkow@13763
    82
     let val (x,t) = atomic_abs_tr' abs
nipkow@13763
    83
     in Syntax.const "_The" $ x $ t end)]
nipkow@13763
    84
*}
nipkow@13763
    85
wenzelm@12633
    86
syntax (output)
wenzelm@11687
    87
  "="           :: "['a, 'a] => bool"                    (infix 50)
wenzelm@12650
    88
  "_not_equal"  :: "['a, 'a] => bool"                    (infix "~=" 50)
wenzelm@2260
    89
wenzelm@12114
    90
syntax (xsymbols)
wenzelm@11687
    91
  Not           :: "bool => bool"                        ("\<not> _" [40] 40)
wenzelm@11687
    92
  "op &"        :: "[bool, bool] => bool"                (infixr "\<and>" 35)
wenzelm@11687
    93
  "op |"        :: "[bool, bool] => bool"                (infixr "\<or>" 30)
wenzelm@12114
    94
  "op -->"      :: "[bool, bool] => bool"                (infixr "\<longrightarrow>" 25)
wenzelm@12650
    95
  "_not_equal"  :: "['a, 'a] => bool"                    (infix "\<noteq>" 50)
wenzelm@11687
    96
  "ALL "        :: "[idts, bool] => bool"                ("(3\<forall>_./ _)" [0, 10] 10)
wenzelm@11687
    97
  "EX "         :: "[idts, bool] => bool"                ("(3\<exists>_./ _)" [0, 10] 10)
wenzelm@11687
    98
  "EX! "        :: "[idts, bool] => bool"                ("(3\<exists>!_./ _)" [0, 10] 10)
wenzelm@11687
    99
  "_case1"      :: "['a, 'b] => case_syn"                ("(2_ \<Rightarrow>/ _)" 10)
schirmer@14361
   100
(*"_case2"      :: "[case_syn, cases_syn] => cases_syn"  ("_/ \<orelse> _")*)
wenzelm@2372
   101
wenzelm@12114
   102
syntax (xsymbols output)
wenzelm@12650
   103
  "_not_equal"  :: "['a, 'a] => bool"                    (infix "\<noteq>" 50)
wenzelm@3820
   104
wenzelm@6340
   105
syntax (HTML output)
kleing@14565
   106
  "_not_equal"  :: "['a, 'a] => bool"                    (infix "\<noteq>" 50)
wenzelm@11687
   107
  Not           :: "bool => bool"                        ("\<not> _" [40] 40)
kleing@14565
   108
  "op &"        :: "[bool, bool] => bool"                (infixr "\<and>" 35)
kleing@14565
   109
  "op |"        :: "[bool, bool] => bool"                (infixr "\<or>" 30)
kleing@14565
   110
  "_not_equal"  :: "['a, 'a] => bool"                    (infix "\<noteq>" 50)
kleing@14565
   111
  "ALL "        :: "[idts, bool] => bool"                ("(3\<forall>_./ _)" [0, 10] 10)
kleing@14565
   112
  "EX "         :: "[idts, bool] => bool"                ("(3\<exists>_./ _)" [0, 10] 10)
kleing@14565
   113
  "EX! "        :: "[idts, bool] => bool"                ("(3\<exists>!_./ _)" [0, 10] 10)
wenzelm@6340
   114
wenzelm@7238
   115
syntax (HOL)
wenzelm@7357
   116
  "ALL "        :: "[idts, bool] => bool"                ("(3! _./ _)" [0, 10] 10)
wenzelm@7357
   117
  "EX "         :: "[idts, bool] => bool"                ("(3? _./ _)" [0, 10] 10)
wenzelm@7357
   118
  "EX! "        :: "[idts, bool] => bool"                ("(3?! _./ _)" [0, 10] 10)
wenzelm@7238
   119
wenzelm@7238
   120
wenzelm@11750
   121
subsubsection {* Axioms and basic definitions *}
wenzelm@2260
   122
wenzelm@7357
   123
axioms
paulson@15380
   124
  eq_reflection:  "(x=y) ==> (x==y)"
clasohm@923
   125
paulson@15380
   126
  refl:           "t = (t::'a)"
paulson@6289
   127
paulson@15380
   128
  ext:            "(!!x::'a. (f x ::'b) = g x) ==> (%x. f x) = (%x. g x)"
paulson@15380
   129
    -- {*Extensionality is built into the meta-logic, and this rule expresses
paulson@15380
   130
         a related property.  It is an eta-expanded version of the traditional
paulson@15380
   131
         rule, and similar to the ABS rule of HOL*}
paulson@6289
   132
wenzelm@11432
   133
  the_eq_trivial: "(THE x. x = a) = (a::'a)"
clasohm@923
   134
paulson@15380
   135
  impI:           "(P ==> Q) ==> P-->Q"
paulson@15380
   136
  mp:             "[| P-->Q;  P |] ==> Q"
paulson@15380
   137
paulson@15380
   138
paulson@15380
   139
text{*Thanks to Stephan Merz*}
paulson@15380
   140
theorem subst:
paulson@15380
   141
  assumes eq: "s = t" and p: "P(s)"
paulson@15380
   142
  shows "P(t::'a)"
paulson@15380
   143
proof -
paulson@15380
   144
  from eq have meta: "s \<equiv> t"
paulson@15380
   145
    by (rule eq_reflection)
paulson@15380
   146
  from p show ?thesis
paulson@15380
   147
    by (unfold meta)
paulson@15380
   148
qed
clasohm@923
   149
clasohm@923
   150
defs
wenzelm@7357
   151
  True_def:     "True      == ((%x::bool. x) = (%x. x))"
wenzelm@7357
   152
  All_def:      "All(P)    == (P = (%x. True))"
paulson@11451
   153
  Ex_def:       "Ex(P)     == !Q. (!x. P x --> Q) --> Q"
wenzelm@7357
   154
  False_def:    "False     == (!P. P)"
wenzelm@7357
   155
  not_def:      "~ P       == P-->False"
wenzelm@7357
   156
  and_def:      "P & Q     == !R. (P-->Q-->R) --> R"
wenzelm@7357
   157
  or_def:       "P | Q     == !R. (P-->R) --> (Q-->R) --> R"
wenzelm@7357
   158
  Ex1_def:      "Ex1(P)    == ? x. P(x) & (! y. P(y) --> y=x)"
clasohm@923
   159
wenzelm@7357
   160
axioms
wenzelm@7357
   161
  iff:          "(P-->Q) --> (Q-->P) --> (P=Q)"
wenzelm@7357
   162
  True_or_False:  "(P=True) | (P=False)"
clasohm@923
   163
clasohm@923
   164
defs
wenzelm@7357
   165
  Let_def:      "Let s f == f(s)"
paulson@11451
   166
  if_def:       "If P x y == THE z::'a. (P=True --> z=x) & (P=False --> z=y)"
wenzelm@5069
   167
skalberg@14223
   168
finalconsts
skalberg@14223
   169
  "op ="
skalberg@14223
   170
  "op -->"
skalberg@14223
   171
  The
skalberg@14223
   172
  arbitrary
nipkow@3320
   173
wenzelm@11750
   174
subsubsection {* Generic algebraic operations *}
wenzelm@4868
   175
wenzelm@12338
   176
axclass zero < type
wenzelm@12338
   177
axclass one < type
wenzelm@12338
   178
axclass plus < type
wenzelm@12338
   179
axclass minus < type
wenzelm@12338
   180
axclass times < type
wenzelm@12338
   181
axclass inverse < type
wenzelm@11750
   182
wenzelm@11750
   183
global
wenzelm@11750
   184
wenzelm@11750
   185
consts
wenzelm@11750
   186
  "0"           :: "'a::zero"                       ("0")
wenzelm@11750
   187
  "1"           :: "'a::one"                        ("1")
wenzelm@11750
   188
  "+"           :: "['a::plus, 'a]  => 'a"          (infixl 65)
wenzelm@11750
   189
  -             :: "['a::minus, 'a] => 'a"          (infixl 65)
wenzelm@11750
   190
  uminus        :: "['a::minus] => 'a"              ("- _" [81] 80)
wenzelm@11750
   191
  *             :: "['a::times, 'a] => 'a"          (infixl 70)
wenzelm@11750
   192
wenzelm@13456
   193
syntax
wenzelm@13456
   194
  "_index1"  :: index    ("\<^sub>1")
wenzelm@13456
   195
translations
wenzelm@14690
   196
  (index) "\<^sub>1" => (index) "\<^bsub>\<struct>\<^esub>"
wenzelm@13456
   197
wenzelm@11750
   198
local
wenzelm@11750
   199
wenzelm@11750
   200
typed_print_translation {*
wenzelm@11750
   201
  let
wenzelm@11750
   202
    fun tr' c = (c, fn show_sorts => fn T => fn ts =>
wenzelm@11750
   203
      if T = dummyT orelse not (! show_types) andalso can Term.dest_Type T then raise Match
wenzelm@11750
   204
      else Syntax.const Syntax.constrainC $ Syntax.const c $ Syntax.term_of_typ show_sorts T);
wenzelm@11750
   205
  in [tr' "0", tr' "1"] end;
wenzelm@11750
   206
*} -- {* show types that are presumably too general *}
wenzelm@11750
   207
wenzelm@11750
   208
wenzelm@11750
   209
consts
wenzelm@11750
   210
  abs           :: "'a::minus => 'a"
wenzelm@11750
   211
  inverse       :: "'a::inverse => 'a"
wenzelm@11750
   212
  divide        :: "['a::inverse, 'a] => 'a"        (infixl "'/" 70)
wenzelm@11750
   213
wenzelm@11750
   214
syntax (xsymbols)
wenzelm@11750
   215
  abs :: "'a::minus => 'a"    ("\<bar>_\<bar>")
wenzelm@11750
   216
syntax (HTML output)
wenzelm@11750
   217
  abs :: "'a::minus => 'a"    ("\<bar>_\<bar>")
wenzelm@11750
   218
wenzelm@11750
   219
paulson@15411
   220
subsection {*Equality*}
paulson@15411
   221
paulson@15411
   222
lemma sym: "s=t ==> t=s"
paulson@15411
   223
apply (erule subst)
paulson@15411
   224
apply (rule refl)
paulson@15411
   225
done
paulson@15411
   226
paulson@15411
   227
(*calling "standard" reduces maxidx to 0*)
paulson@15411
   228
lemmas ssubst = sym [THEN subst, standard]
paulson@15411
   229
paulson@15411
   230
lemma trans: "[| r=s; s=t |] ==> r=t"
paulson@15411
   231
apply (erule subst , assumption)
paulson@15411
   232
done
paulson@15411
   233
paulson@15411
   234
lemma def_imp_eq:  assumes meq: "A == B" shows "A = B"
paulson@15411
   235
apply (unfold meq)
paulson@15411
   236
apply (rule refl)
paulson@15411
   237
done
paulson@15411
   238
paulson@15411
   239
(*Useful with eresolve_tac for proving equalties from known equalities.
paulson@15411
   240
        a = b
paulson@15411
   241
        |   |
paulson@15411
   242
        c = d   *)
paulson@15411
   243
lemma box_equals: "[| a=b;  a=c;  b=d |] ==> c=d"
paulson@15411
   244
apply (rule trans)
paulson@15411
   245
apply (rule trans)
paulson@15411
   246
apply (rule sym)
paulson@15411
   247
apply assumption+
paulson@15411
   248
done
paulson@15411
   249
nipkow@15524
   250
text {* For calculational reasoning: *}
nipkow@15524
   251
nipkow@15524
   252
lemma forw_subst: "a = b ==> P b ==> P a"
nipkow@15524
   253
  by (rule ssubst)
nipkow@15524
   254
nipkow@15524
   255
lemma back_subst: "P a ==> a = b ==> P b"
nipkow@15524
   256
  by (rule subst)
nipkow@15524
   257
paulson@15411
   258
paulson@15411
   259
subsection {*Congruence rules for application*}
paulson@15411
   260
paulson@15411
   261
(*similar to AP_THM in Gordon's HOL*)
paulson@15411
   262
lemma fun_cong: "(f::'a=>'b) = g ==> f(x)=g(x)"
paulson@15411
   263
apply (erule subst)
paulson@15411
   264
apply (rule refl)
paulson@15411
   265
done
paulson@15411
   266
paulson@15411
   267
(*similar to AP_TERM in Gordon's HOL and FOL's subst_context*)
paulson@15411
   268
lemma arg_cong: "x=y ==> f(x)=f(y)"
paulson@15411
   269
apply (erule subst)
paulson@15411
   270
apply (rule refl)
paulson@15411
   271
done
paulson@15411
   272
paulson@15655
   273
lemma arg_cong2: "\<lbrakk> a = b; c = d \<rbrakk> \<Longrightarrow> f a c = f b d"
paulson@15655
   274
apply (erule ssubst)+
paulson@15655
   275
apply (rule refl)
paulson@15655
   276
done
paulson@15655
   277
paulson@15655
   278
paulson@15411
   279
lemma cong: "[| f = g; (x::'a) = y |] ==> f(x) = g(y)"
paulson@15411
   280
apply (erule subst)+
paulson@15411
   281
apply (rule refl)
paulson@15411
   282
done
paulson@15411
   283
paulson@15411
   284
paulson@15411
   285
subsection {*Equality of booleans -- iff*}
paulson@15411
   286
paulson@15411
   287
lemma iffI: assumes prems: "P ==> Q" "Q ==> P" shows "P=Q"
paulson@15411
   288
apply (rules intro: iff [THEN mp, THEN mp] impI prems)
paulson@15411
   289
done
paulson@15411
   290
paulson@15411
   291
lemma iffD2: "[| P=Q; Q |] ==> P"
paulson@15411
   292
apply (erule ssubst)
paulson@15411
   293
apply assumption
paulson@15411
   294
done
paulson@15411
   295
paulson@15411
   296
lemma rev_iffD2: "[| Q; P=Q |] ==> P"
paulson@15411
   297
apply (erule iffD2)
paulson@15411
   298
apply assumption
paulson@15411
   299
done
paulson@15411
   300
paulson@15411
   301
lemmas iffD1 = sym [THEN iffD2, standard]
paulson@15411
   302
lemmas rev_iffD1 = sym [THEN [2] rev_iffD2, standard]
paulson@15411
   303
paulson@15411
   304
lemma iffE:
paulson@15411
   305
  assumes major: "P=Q"
paulson@15411
   306
      and minor: "[| P --> Q; Q --> P |] ==> R"
paulson@15411
   307
  shows "R"
paulson@15411
   308
by (rules intro: minor impI major [THEN iffD2] major [THEN iffD1])
paulson@15411
   309
paulson@15411
   310
paulson@15411
   311
subsection {*True*}
paulson@15411
   312
paulson@15411
   313
lemma TrueI: "True"
paulson@15411
   314
apply (unfold True_def)
paulson@15411
   315
apply (rule refl)
paulson@15411
   316
done
paulson@15411
   317
paulson@15411
   318
lemma eqTrueI: "P ==> P=True"
paulson@15411
   319
by (rules intro: iffI TrueI)
paulson@15411
   320
paulson@15411
   321
lemma eqTrueE: "P=True ==> P"
paulson@15411
   322
apply (erule iffD2)
paulson@15411
   323
apply (rule TrueI)
paulson@15411
   324
done
paulson@15411
   325
paulson@15411
   326
paulson@15411
   327
subsection {*Universal quantifier*}
paulson@15411
   328
paulson@15411
   329
lemma allI: assumes p: "!!x::'a. P(x)" shows "ALL x. P(x)"
paulson@15411
   330
apply (unfold All_def)
paulson@15411
   331
apply (rules intro: ext eqTrueI p)
paulson@15411
   332
done
paulson@15411
   333
paulson@15411
   334
lemma spec: "ALL x::'a. P(x) ==> P(x)"
paulson@15411
   335
apply (unfold All_def)
paulson@15411
   336
apply (rule eqTrueE)
paulson@15411
   337
apply (erule fun_cong)
paulson@15411
   338
done
paulson@15411
   339
paulson@15411
   340
lemma allE:
paulson@15411
   341
  assumes major: "ALL x. P(x)"
paulson@15411
   342
      and minor: "P(x) ==> R"
paulson@15411
   343
  shows "R"
paulson@15411
   344
by (rules intro: minor major [THEN spec])
paulson@15411
   345
paulson@15411
   346
lemma all_dupE:
paulson@15411
   347
  assumes major: "ALL x. P(x)"
paulson@15411
   348
      and minor: "[| P(x); ALL x. P(x) |] ==> R"
paulson@15411
   349
  shows "R"
paulson@15411
   350
by (rules intro: minor major major [THEN spec])
paulson@15411
   351
paulson@15411
   352
paulson@15411
   353
subsection {*False*}
paulson@15411
   354
(*Depends upon spec; it is impossible to do propositional logic before quantifiers!*)
paulson@15411
   355
paulson@15411
   356
lemma FalseE: "False ==> P"
paulson@15411
   357
apply (unfold False_def)
paulson@15411
   358
apply (erule spec)
paulson@15411
   359
done
paulson@15411
   360
paulson@15411
   361
lemma False_neq_True: "False=True ==> P"
paulson@15411
   362
by (erule eqTrueE [THEN FalseE])
paulson@15411
   363
paulson@15411
   364
paulson@15411
   365
subsection {*Negation*}
paulson@15411
   366
paulson@15411
   367
lemma notI:
paulson@15411
   368
  assumes p: "P ==> False"
paulson@15411
   369
  shows "~P"
paulson@15411
   370
apply (unfold not_def)
paulson@15411
   371
apply (rules intro: impI p)
paulson@15411
   372
done
paulson@15411
   373
paulson@15411
   374
lemma False_not_True: "False ~= True"
paulson@15411
   375
apply (rule notI)
paulson@15411
   376
apply (erule False_neq_True)
paulson@15411
   377
done
paulson@15411
   378
paulson@15411
   379
lemma True_not_False: "True ~= False"
paulson@15411
   380
apply (rule notI)
paulson@15411
   381
apply (drule sym)
paulson@15411
   382
apply (erule False_neq_True)
paulson@15411
   383
done
paulson@15411
   384
paulson@15411
   385
lemma notE: "[| ~P;  P |] ==> R"
paulson@15411
   386
apply (unfold not_def)
paulson@15411
   387
apply (erule mp [THEN FalseE])
paulson@15411
   388
apply assumption
paulson@15411
   389
done
paulson@15411
   390
paulson@15411
   391
(* Alternative ~ introduction rule: [| P ==> ~ Pa; P ==> Pa |] ==> ~ P *)
paulson@15411
   392
lemmas notI2 = notE [THEN notI, standard]
paulson@15411
   393
paulson@15411
   394
paulson@15411
   395
subsection {*Implication*}
paulson@15411
   396
paulson@15411
   397
lemma impE:
paulson@15411
   398
  assumes "P-->Q" "P" "Q ==> R"
paulson@15411
   399
  shows "R"
paulson@15411
   400
by (rules intro: prems mp)
paulson@15411
   401
paulson@15411
   402
(* Reduces Q to P-->Q, allowing substitution in P. *)
paulson@15411
   403
lemma rev_mp: "[| P;  P --> Q |] ==> Q"
paulson@15411
   404
by (rules intro: mp)
paulson@15411
   405
paulson@15411
   406
lemma contrapos_nn:
paulson@15411
   407
  assumes major: "~Q"
paulson@15411
   408
      and minor: "P==>Q"
paulson@15411
   409
  shows "~P"
paulson@15411
   410
by (rules intro: notI minor major [THEN notE])
paulson@15411
   411
paulson@15411
   412
(*not used at all, but we already have the other 3 combinations *)
paulson@15411
   413
lemma contrapos_pn:
paulson@15411
   414
  assumes major: "Q"
paulson@15411
   415
      and minor: "P ==> ~Q"
paulson@15411
   416
  shows "~P"
paulson@15411
   417
by (rules intro: notI minor major notE)
paulson@15411
   418
paulson@15411
   419
lemma not_sym: "t ~= s ==> s ~= t"
paulson@15411
   420
apply (erule contrapos_nn)
paulson@15411
   421
apply (erule sym)
paulson@15411
   422
done
paulson@15411
   423
paulson@15411
   424
(*still used in HOLCF*)
paulson@15411
   425
lemma rev_contrapos:
paulson@15411
   426
  assumes pq: "P ==> Q"
paulson@15411
   427
      and nq: "~Q"
paulson@15411
   428
  shows "~P"
paulson@15411
   429
apply (rule nq [THEN contrapos_nn])
paulson@15411
   430
apply (erule pq)
paulson@15411
   431
done
paulson@15411
   432
paulson@15411
   433
subsection {*Existential quantifier*}
paulson@15411
   434
paulson@15411
   435
lemma exI: "P x ==> EX x::'a. P x"
paulson@15411
   436
apply (unfold Ex_def)
paulson@15411
   437
apply (rules intro: allI allE impI mp)
paulson@15411
   438
done
paulson@15411
   439
paulson@15411
   440
lemma exE:
paulson@15411
   441
  assumes major: "EX x::'a. P(x)"
paulson@15411
   442
      and minor: "!!x. P(x) ==> Q"
paulson@15411
   443
  shows "Q"
paulson@15411
   444
apply (rule major [unfolded Ex_def, THEN spec, THEN mp])
paulson@15411
   445
apply (rules intro: impI [THEN allI] minor)
paulson@15411
   446
done
paulson@15411
   447
paulson@15411
   448
paulson@15411
   449
subsection {*Conjunction*}
paulson@15411
   450
paulson@15411
   451
lemma conjI: "[| P; Q |] ==> P&Q"
paulson@15411
   452
apply (unfold and_def)
paulson@15411
   453
apply (rules intro: impI [THEN allI] mp)
paulson@15411
   454
done
paulson@15411
   455
paulson@15411
   456
lemma conjunct1: "[| P & Q |] ==> P"
paulson@15411
   457
apply (unfold and_def)
paulson@15411
   458
apply (rules intro: impI dest: spec mp)
paulson@15411
   459
done
paulson@15411
   460
paulson@15411
   461
lemma conjunct2: "[| P & Q |] ==> Q"
paulson@15411
   462
apply (unfold and_def)
paulson@15411
   463
apply (rules intro: impI dest: spec mp)
paulson@15411
   464
done
paulson@15411
   465
paulson@15411
   466
lemma conjE:
paulson@15411
   467
  assumes major: "P&Q"
paulson@15411
   468
      and minor: "[| P; Q |] ==> R"
paulson@15411
   469
  shows "R"
paulson@15411
   470
apply (rule minor)
paulson@15411
   471
apply (rule major [THEN conjunct1])
paulson@15411
   472
apply (rule major [THEN conjunct2])
paulson@15411
   473
done
paulson@15411
   474
paulson@15411
   475
lemma context_conjI:
paulson@15411
   476
  assumes prems: "P" "P ==> Q" shows "P & Q"
paulson@15411
   477
by (rules intro: conjI prems)
paulson@15411
   478
paulson@15411
   479
paulson@15411
   480
subsection {*Disjunction*}
paulson@15411
   481
paulson@15411
   482
lemma disjI1: "P ==> P|Q"
paulson@15411
   483
apply (unfold or_def)
paulson@15411
   484
apply (rules intro: allI impI mp)
paulson@15411
   485
done
paulson@15411
   486
paulson@15411
   487
lemma disjI2: "Q ==> P|Q"
paulson@15411
   488
apply (unfold or_def)
paulson@15411
   489
apply (rules intro: allI impI mp)
paulson@15411
   490
done
paulson@15411
   491
paulson@15411
   492
lemma disjE:
paulson@15411
   493
  assumes major: "P|Q"
paulson@15411
   494
      and minorP: "P ==> R"
paulson@15411
   495
      and minorQ: "Q ==> R"
paulson@15411
   496
  shows "R"
paulson@15411
   497
by (rules intro: minorP minorQ impI
paulson@15411
   498
                 major [unfolded or_def, THEN spec, THEN mp, THEN mp])
paulson@15411
   499
paulson@15411
   500
paulson@15411
   501
subsection {*Classical logic*}
paulson@15411
   502
paulson@15411
   503
paulson@15411
   504
lemma classical:
paulson@15411
   505
  assumes prem: "~P ==> P"
paulson@15411
   506
  shows "P"
paulson@15411
   507
apply (rule True_or_False [THEN disjE, THEN eqTrueE])
paulson@15411
   508
apply assumption
paulson@15411
   509
apply (rule notI [THEN prem, THEN eqTrueI])
paulson@15411
   510
apply (erule subst)
paulson@15411
   511
apply assumption
paulson@15411
   512
done
paulson@15411
   513
paulson@15411
   514
lemmas ccontr = FalseE [THEN classical, standard]
paulson@15411
   515
paulson@15411
   516
(*notE with premises exchanged; it discharges ~R so that it can be used to
paulson@15411
   517
  make elimination rules*)
paulson@15411
   518
lemma rev_notE:
paulson@15411
   519
  assumes premp: "P"
paulson@15411
   520
      and premnot: "~R ==> ~P"
paulson@15411
   521
  shows "R"
paulson@15411
   522
apply (rule ccontr)
paulson@15411
   523
apply (erule notE [OF premnot premp])
paulson@15411
   524
done
paulson@15411
   525
paulson@15411
   526
(*Double negation law*)
paulson@15411
   527
lemma notnotD: "~~P ==> P"
paulson@15411
   528
apply (rule classical)
paulson@15411
   529
apply (erule notE)
paulson@15411
   530
apply assumption
paulson@15411
   531
done
paulson@15411
   532
paulson@15411
   533
lemma contrapos_pp:
paulson@15411
   534
  assumes p1: "Q"
paulson@15411
   535
      and p2: "~P ==> ~Q"
paulson@15411
   536
  shows "P"
paulson@15411
   537
by (rules intro: classical p1 p2 notE)
paulson@15411
   538
paulson@15411
   539
paulson@15411
   540
subsection {*Unique existence*}
paulson@15411
   541
paulson@15411
   542
lemma ex1I:
paulson@15411
   543
  assumes prems: "P a" "!!x. P(x) ==> x=a"
paulson@15411
   544
  shows "EX! x. P(x)"
paulson@15411
   545
by (unfold Ex1_def, rules intro: prems exI conjI allI impI)
paulson@15411
   546
paulson@15411
   547
text{*Sometimes easier to use: the premises have no shared variables.  Safe!*}
paulson@15411
   548
lemma ex_ex1I:
paulson@15411
   549
  assumes ex_prem: "EX x. P(x)"
paulson@15411
   550
      and eq: "!!x y. [| P(x); P(y) |] ==> x=y"
paulson@15411
   551
  shows "EX! x. P(x)"
paulson@15411
   552
by (rules intro: ex_prem [THEN exE] ex1I eq)
paulson@15411
   553
paulson@15411
   554
lemma ex1E:
paulson@15411
   555
  assumes major: "EX! x. P(x)"
paulson@15411
   556
      and minor: "!!x. [| P(x);  ALL y. P(y) --> y=x |] ==> R"
paulson@15411
   557
  shows "R"
paulson@15411
   558
apply (rule major [unfolded Ex1_def, THEN exE])
paulson@15411
   559
apply (erule conjE)
paulson@15411
   560
apply (rules intro: minor)
paulson@15411
   561
done
paulson@15411
   562
paulson@15411
   563
lemma ex1_implies_ex: "EX! x. P x ==> EX x. P x"
paulson@15411
   564
apply (erule ex1E)
paulson@15411
   565
apply (rule exI)
paulson@15411
   566
apply assumption
paulson@15411
   567
done
paulson@15411
   568
paulson@15411
   569
paulson@15411
   570
subsection {*THE: definite description operator*}
paulson@15411
   571
paulson@15411
   572
lemma the_equality:
paulson@15411
   573
  assumes prema: "P a"
paulson@15411
   574
      and premx: "!!x. P x ==> x=a"
paulson@15411
   575
  shows "(THE x. P x) = a"
paulson@15411
   576
apply (rule trans [OF _ the_eq_trivial])
paulson@15411
   577
apply (rule_tac f = "The" in arg_cong)
paulson@15411
   578
apply (rule ext)
paulson@15411
   579
apply (rule iffI)
paulson@15411
   580
 apply (erule premx)
paulson@15411
   581
apply (erule ssubst, rule prema)
paulson@15411
   582
done
paulson@15411
   583
paulson@15411
   584
lemma theI:
paulson@15411
   585
  assumes "P a" and "!!x. P x ==> x=a"
paulson@15411
   586
  shows "P (THE x. P x)"
paulson@15411
   587
by (rules intro: prems the_equality [THEN ssubst])
paulson@15411
   588
paulson@15411
   589
lemma theI': "EX! x. P x ==> P (THE x. P x)"
paulson@15411
   590
apply (erule ex1E)
paulson@15411
   591
apply (erule theI)
paulson@15411
   592
apply (erule allE)
paulson@15411
   593
apply (erule mp)
paulson@15411
   594
apply assumption
paulson@15411
   595
done
paulson@15411
   596
paulson@15411
   597
(*Easier to apply than theI: only one occurrence of P*)
paulson@15411
   598
lemma theI2:
paulson@15411
   599
  assumes "P a" "!!x. P x ==> x=a" "!!x. P x ==> Q x"
paulson@15411
   600
  shows "Q (THE x. P x)"
paulson@15411
   601
by (rules intro: prems theI)
paulson@15411
   602
paulson@15411
   603
lemma the1_equality: "[| EX!x. P x; P a |] ==> (THE x. P x) = a"
paulson@15411
   604
apply (rule the_equality)
paulson@15411
   605
apply  assumption
paulson@15411
   606
apply (erule ex1E)
paulson@15411
   607
apply (erule all_dupE)
paulson@15411
   608
apply (drule mp)
paulson@15411
   609
apply  assumption
paulson@15411
   610
apply (erule ssubst)
paulson@15411
   611
apply (erule allE)
paulson@15411
   612
apply (erule mp)
paulson@15411
   613
apply assumption
paulson@15411
   614
done
paulson@15411
   615
paulson@15411
   616
lemma the_sym_eq_trivial: "(THE y. x=y) = x"
paulson@15411
   617
apply (rule the_equality)
paulson@15411
   618
apply (rule refl)
paulson@15411
   619
apply (erule sym)
paulson@15411
   620
done
paulson@15411
   621
paulson@15411
   622
paulson@15411
   623
subsection {*Classical intro rules for disjunction and existential quantifiers*}
paulson@15411
   624
paulson@15411
   625
lemma disjCI:
paulson@15411
   626
  assumes "~Q ==> P" shows "P|Q"
paulson@15411
   627
apply (rule classical)
paulson@15411
   628
apply (rules intro: prems disjI1 disjI2 notI elim: notE)
paulson@15411
   629
done
paulson@15411
   630
paulson@15411
   631
lemma excluded_middle: "~P | P"
paulson@15411
   632
by (rules intro: disjCI)
paulson@15411
   633
paulson@15411
   634
text{*case distinction as a natural deduction rule. Note that @{term "~P"}
paulson@15411
   635
   is the second case, not the first.*}
paulson@15411
   636
lemma case_split_thm:
paulson@15411
   637
  assumes prem1: "P ==> Q"
paulson@15411
   638
      and prem2: "~P ==> Q"
paulson@15411
   639
  shows "Q"
paulson@15411
   640
apply (rule excluded_middle [THEN disjE])
paulson@15411
   641
apply (erule prem2)
paulson@15411
   642
apply (erule prem1)
paulson@15411
   643
done
paulson@15411
   644
paulson@15411
   645
(*Classical implies (-->) elimination. *)
paulson@15411
   646
lemma impCE:
paulson@15411
   647
  assumes major: "P-->Q"
paulson@15411
   648
      and minor: "~P ==> R" "Q ==> R"
paulson@15411
   649
  shows "R"
paulson@15411
   650
apply (rule excluded_middle [of P, THEN disjE])
paulson@15411
   651
apply (rules intro: minor major [THEN mp])+
paulson@15411
   652
done
paulson@15411
   653
paulson@15411
   654
(*This version of --> elimination works on Q before P.  It works best for
paulson@15411
   655
  those cases in which P holds "almost everywhere".  Can't install as
paulson@15411
   656
  default: would break old proofs.*)
paulson@15411
   657
lemma impCE':
paulson@15411
   658
  assumes major: "P-->Q"
paulson@15411
   659
      and minor: "Q ==> R" "~P ==> R"
paulson@15411
   660
  shows "R"
paulson@15411
   661
apply (rule excluded_middle [of P, THEN disjE])
paulson@15411
   662
apply (rules intro: minor major [THEN mp])+
paulson@15411
   663
done
paulson@15411
   664
paulson@15411
   665
(*Classical <-> elimination. *)
paulson@15411
   666
lemma iffCE:
paulson@15411
   667
  assumes major: "P=Q"
paulson@15411
   668
      and minor: "[| P; Q |] ==> R"  "[| ~P; ~Q |] ==> R"
paulson@15411
   669
  shows "R"
paulson@15411
   670
apply (rule major [THEN iffE])
paulson@15411
   671
apply (rules intro: minor elim: impCE notE)
paulson@15411
   672
done
paulson@15411
   673
paulson@15411
   674
lemma exCI:
paulson@15411
   675
  assumes "ALL x. ~P(x) ==> P(a)"
paulson@15411
   676
  shows "EX x. P(x)"
paulson@15411
   677
apply (rule ccontr)
paulson@15411
   678
apply (rules intro: prems exI allI notI notE [of "\<exists>x. P x"])
paulson@15411
   679
done
paulson@15411
   680
paulson@15411
   681
paulson@15411
   682
wenzelm@11750
   683
subsection {* Theory and package setup *}
wenzelm@11750
   684
paulson@15411
   685
ML
paulson@15411
   686
{*
paulson@15411
   687
val plusI = thm "plusI"
paulson@15411
   688
val minusI = thm "minusI"
paulson@15411
   689
val timesI = thm "timesI"
paulson@15411
   690
val eq_reflection = thm "eq_reflection"
paulson@15411
   691
val refl = thm "refl"
paulson@15411
   692
val subst = thm "subst"
paulson@15411
   693
val ext = thm "ext"
paulson@15411
   694
val impI = thm "impI"
paulson@15411
   695
val mp = thm "mp"
paulson@15411
   696
val True_def = thm "True_def"
paulson@15411
   697
val All_def = thm "All_def"
paulson@15411
   698
val Ex_def = thm "Ex_def"
paulson@15411
   699
val False_def = thm "False_def"
paulson@15411
   700
val not_def = thm "not_def"
paulson@15411
   701
val and_def = thm "and_def"
paulson@15411
   702
val or_def = thm "or_def"
paulson@15411
   703
val Ex1_def = thm "Ex1_def"
paulson@15411
   704
val iff = thm "iff"
paulson@15411
   705
val True_or_False = thm "True_or_False"
paulson@15411
   706
val Let_def = thm "Let_def"
paulson@15411
   707
val if_def = thm "if_def"
paulson@15411
   708
val sym = thm "sym"
paulson@15411
   709
val ssubst = thm "ssubst"
paulson@15411
   710
val trans = thm "trans"
paulson@15411
   711
val def_imp_eq = thm "def_imp_eq"
paulson@15411
   712
val box_equals = thm "box_equals"
paulson@15411
   713
val fun_cong = thm "fun_cong"
paulson@15411
   714
val arg_cong = thm "arg_cong"
paulson@15411
   715
val cong = thm "cong"
paulson@15411
   716
val iffI = thm "iffI"
paulson@15411
   717
val iffD2 = thm "iffD2"
paulson@15411
   718
val rev_iffD2 = thm "rev_iffD2"
paulson@15411
   719
val iffD1 = thm "iffD1"
paulson@15411
   720
val rev_iffD1 = thm "rev_iffD1"
paulson@15411
   721
val iffE = thm "iffE"
paulson@15411
   722
val TrueI = thm "TrueI"
paulson@15411
   723
val eqTrueI = thm "eqTrueI"
paulson@15411
   724
val eqTrueE = thm "eqTrueE"
paulson@15411
   725
val allI = thm "allI"
paulson@15411
   726
val spec = thm "spec"
paulson@15411
   727
val allE = thm "allE"
paulson@15411
   728
val all_dupE = thm "all_dupE"
paulson@15411
   729
val FalseE = thm "FalseE"
paulson@15411
   730
val False_neq_True = thm "False_neq_True"
paulson@15411
   731
val notI = thm "notI"
paulson@15411
   732
val False_not_True = thm "False_not_True"
paulson@15411
   733
val True_not_False = thm "True_not_False"
paulson@15411
   734
val notE = thm "notE"
paulson@15411
   735
val notI2 = thm "notI2"
paulson@15411
   736
val impE = thm "impE"
paulson@15411
   737
val rev_mp = thm "rev_mp"
paulson@15411
   738
val contrapos_nn = thm "contrapos_nn"
paulson@15411
   739
val contrapos_pn = thm "contrapos_pn"
paulson@15411
   740
val not_sym = thm "not_sym"
paulson@15411
   741
val rev_contrapos = thm "rev_contrapos"
paulson@15411
   742
val exI = thm "exI"
paulson@15411
   743
val exE = thm "exE"
paulson@15411
   744
val conjI = thm "conjI"
paulson@15411
   745
val conjunct1 = thm "conjunct1"
paulson@15411
   746
val conjunct2 = thm "conjunct2"
paulson@15411
   747
val conjE = thm "conjE"
paulson@15411
   748
val context_conjI = thm "context_conjI"
paulson@15411
   749
val disjI1 = thm "disjI1"
paulson@15411
   750
val disjI2 = thm "disjI2"
paulson@15411
   751
val disjE = thm "disjE"
paulson@15411
   752
val classical = thm "classical"
paulson@15411
   753
val ccontr = thm "ccontr"
paulson@15411
   754
val rev_notE = thm "rev_notE"
paulson@15411
   755
val notnotD = thm "notnotD"
paulson@15411
   756
val contrapos_pp = thm "contrapos_pp"
paulson@15411
   757
val ex1I = thm "ex1I"
paulson@15411
   758
val ex_ex1I = thm "ex_ex1I"
paulson@15411
   759
val ex1E = thm "ex1E"
paulson@15411
   760
val ex1_implies_ex = thm "ex1_implies_ex"
paulson@15411
   761
val the_equality = thm "the_equality"
paulson@15411
   762
val theI = thm "theI"
paulson@15411
   763
val theI' = thm "theI'"
paulson@15411
   764
val theI2 = thm "theI2"
paulson@15411
   765
val the1_equality = thm "the1_equality"
paulson@15411
   766
val the_sym_eq_trivial = thm "the_sym_eq_trivial"
paulson@15411
   767
val disjCI = thm "disjCI"
paulson@15411
   768
val excluded_middle = thm "excluded_middle"
paulson@15411
   769
val case_split_thm = thm "case_split_thm"
paulson@15411
   770
val impCE = thm "impCE"
paulson@15411
   771
val impCE = thm "impCE"
paulson@15411
   772
val iffCE = thm "iffCE"
paulson@15411
   773
val exCI = thm "exCI"
wenzelm@4868
   774
paulson@15411
   775
(* combination of (spec RS spec RS ...(j times) ... spec RS mp) *)
paulson@15411
   776
local
paulson@15411
   777
  fun wrong_prem (Const ("All", _) $ (Abs (_, _, t))) = wrong_prem t
paulson@15411
   778
  |   wrong_prem (Bound _) = true
paulson@15411
   779
  |   wrong_prem _ = false
skalberg@15570
   780
  val filter_right = List.filter (fn t => not (wrong_prem (HOLogic.dest_Trueprop (hd (Thm.prems_of t)))))
paulson@15411
   781
in
paulson@15411
   782
  fun smp i = funpow i (fn m => filter_right ([spec] RL m)) ([mp])
paulson@15411
   783
  fun smp_tac j = EVERY'[dresolve_tac (smp j), atac]
paulson@15411
   784
end
paulson@15411
   785
paulson@15411
   786
paulson@15411
   787
fun strip_tac i = REPEAT(resolve_tac [impI,allI] i)
paulson@15411
   788
paulson@15411
   789
(*Obsolete form of disjunctive case analysis*)
paulson@15411
   790
fun excluded_middle_tac sP =
paulson@15411
   791
    res_inst_tac [("Q",sP)] (excluded_middle RS disjE)
paulson@15411
   792
paulson@15411
   793
fun case_tac a = res_inst_tac [("P",a)] case_split_thm
paulson@15411
   794
*}
paulson@15411
   795
wenzelm@11687
   796
theorems case_split = case_split_thm [case_names True False]
wenzelm@9869
   797
wenzelm@12386
   798
wenzelm@12386
   799
subsubsection {* Intuitionistic Reasoning *}
wenzelm@12386
   800
wenzelm@12386
   801
lemma impE':
wenzelm@12937
   802
  assumes 1: "P --> Q"
wenzelm@12937
   803
    and 2: "Q ==> R"
wenzelm@12937
   804
    and 3: "P --> Q ==> P"
wenzelm@12937
   805
  shows R
wenzelm@12386
   806
proof -
wenzelm@12386
   807
  from 3 and 1 have P .
wenzelm@12386
   808
  with 1 have Q by (rule impE)
wenzelm@12386
   809
  with 2 show R .
wenzelm@12386
   810
qed
wenzelm@12386
   811
wenzelm@12386
   812
lemma allE':
wenzelm@12937
   813
  assumes 1: "ALL x. P x"
wenzelm@12937
   814
    and 2: "P x ==> ALL x. P x ==> Q"
wenzelm@12937
   815
  shows Q
wenzelm@12386
   816
proof -
wenzelm@12386
   817
  from 1 have "P x" by (rule spec)
wenzelm@12386
   818
  from this and 1 show Q by (rule 2)
wenzelm@12386
   819
qed
wenzelm@12386
   820
wenzelm@12937
   821
lemma notE':
wenzelm@12937
   822
  assumes 1: "~ P"
wenzelm@12937
   823
    and 2: "~ P ==> P"
wenzelm@12937
   824
  shows R
wenzelm@12386
   825
proof -
wenzelm@12386
   826
  from 2 and 1 have P .
wenzelm@12386
   827
  with 1 show R by (rule notE)
wenzelm@12386
   828
qed
wenzelm@12386
   829
wenzelm@15801
   830
lemmas [Pure.elim!] = disjE iffE FalseE conjE exE
wenzelm@15801
   831
  and [Pure.intro!] = iffI conjI impI TrueI notI allI refl
wenzelm@15801
   832
  and [Pure.elim 2] = allE notE' impE'
wenzelm@15801
   833
  and [Pure.intro] = exI disjI2 disjI1
wenzelm@12386
   834
wenzelm@12386
   835
lemmas [trans] = trans
wenzelm@12386
   836
  and [sym] = sym not_sym
wenzelm@15801
   837
  and [Pure.elim?] = iffD1 iffD2 impE
wenzelm@11750
   838
wenzelm@11438
   839
wenzelm@11750
   840
subsubsection {* Atomizing meta-level connectives *}
wenzelm@11750
   841
wenzelm@11750
   842
lemma atomize_all [atomize]: "(!!x. P x) == Trueprop (ALL x. P x)"
wenzelm@12003
   843
proof
wenzelm@9488
   844
  assume "!!x. P x"
wenzelm@10383
   845
  show "ALL x. P x" by (rule allI)
wenzelm@9488
   846
next
wenzelm@9488
   847
  assume "ALL x. P x"
wenzelm@10383
   848
  thus "!!x. P x" by (rule allE)
wenzelm@9488
   849
qed
wenzelm@9488
   850
wenzelm@11750
   851
lemma atomize_imp [atomize]: "(A ==> B) == Trueprop (A --> B)"
wenzelm@12003
   852
proof
wenzelm@9488
   853
  assume r: "A ==> B"
wenzelm@10383
   854
  show "A --> B" by (rule impI) (rule r)
wenzelm@9488
   855
next
wenzelm@9488
   856
  assume "A --> B" and A
wenzelm@10383
   857
  thus B by (rule mp)
wenzelm@9488
   858
qed
wenzelm@9488
   859
paulson@14749
   860
lemma atomize_not: "(A ==> False) == Trueprop (~A)"
paulson@14749
   861
proof
paulson@14749
   862
  assume r: "A ==> False"
paulson@14749
   863
  show "~A" by (rule notI) (rule r)
paulson@14749
   864
next
paulson@14749
   865
  assume "~A" and A
paulson@14749
   866
  thus False by (rule notE)
paulson@14749
   867
qed
paulson@14749
   868
wenzelm@11750
   869
lemma atomize_eq [atomize]: "(x == y) == Trueprop (x = y)"
wenzelm@12003
   870
proof
wenzelm@10432
   871
  assume "x == y"
wenzelm@10432
   872
  show "x = y" by (unfold prems) (rule refl)
wenzelm@10432
   873
next
wenzelm@10432
   874
  assume "x = y"
wenzelm@10432
   875
  thus "x == y" by (rule eq_reflection)
wenzelm@10432
   876
qed
wenzelm@10432
   877
wenzelm@12023
   878
lemma atomize_conj [atomize]:
wenzelm@12023
   879
  "(!!C. (A ==> B ==> PROP C) ==> PROP C) == Trueprop (A & B)"
wenzelm@12003
   880
proof
wenzelm@11953
   881
  assume "!!C. (A ==> B ==> PROP C) ==> PROP C"
wenzelm@11953
   882
  show "A & B" by (rule conjI)
wenzelm@11953
   883
next
wenzelm@11953
   884
  fix C
wenzelm@11953
   885
  assume "A & B"
wenzelm@11953
   886
  assume "A ==> B ==> PROP C"
wenzelm@11953
   887
  thus "PROP C"
wenzelm@11953
   888
  proof this
wenzelm@11953
   889
    show A by (rule conjunct1)
wenzelm@11953
   890
    show B by (rule conjunct2)
wenzelm@11953
   891
  qed
wenzelm@11953
   892
qed
wenzelm@11953
   893
wenzelm@12386
   894
lemmas [symmetric, rulify] = atomize_all atomize_imp
wenzelm@12386
   895
wenzelm@11750
   896
wenzelm@11750
   897
subsubsection {* Classical Reasoner setup *}
wenzelm@9529
   898
wenzelm@10383
   899
use "cladata.ML"
wenzelm@10383
   900
setup hypsubst_setup
wenzelm@11977
   901
wenzelm@12386
   902
ML_setup {*
wenzelm@12386
   903
  Context.>> (ContextRules.addSWrapper (fn tac => hyp_subst_tac' ORELSE' tac));
wenzelm@12386
   904
*}
wenzelm@11977
   905
wenzelm@10383
   906
setup Classical.setup
wenzelm@10383
   907
setup clasetup
wenzelm@10383
   908
wenzelm@12386
   909
lemmas [intro?] = ext
wenzelm@12386
   910
  and [elim?] = ex1_implies_ex
wenzelm@11977
   911
wenzelm@9869
   912
use "blastdata.ML"
wenzelm@9869
   913
setup Blast.setup
wenzelm@4868
   914
wenzelm@11750
   915
paulson@15481
   916
subsection {* Simplifier setup *}
wenzelm@11750
   917
wenzelm@12281
   918
lemma meta_eq_to_obj_eq: "x == y ==> x = y"
wenzelm@12281
   919
proof -
wenzelm@12281
   920
  assume r: "x == y"
wenzelm@12281
   921
  show "x = y" by (unfold r) (rule refl)
wenzelm@12281
   922
qed
wenzelm@12281
   923
wenzelm@12281
   924
lemma eta_contract_eq: "(%s. f s) = f" ..
wenzelm@12281
   925
wenzelm@12281
   926
lemma simp_thms:
wenzelm@12937
   927
  shows not_not: "(~ ~ P) = P"
nipkow@15354
   928
  and Not_eq_iff: "((~P) = (~Q)) = (P = Q)"
wenzelm@12937
   929
  and
berghofe@12436
   930
    "(P ~= Q) = (P = (~Q))"
berghofe@12436
   931
    "(P | ~P) = True"    "(~P | P) = True"
wenzelm@12281
   932
    "(x = x) = True"
wenzelm@12281
   933
    "(~True) = False"  "(~False) = True"
berghofe@12436
   934
    "(~P) ~= P"  "P ~= (~P)"
wenzelm@12281
   935
    "(True=P) = P"  "(P=True) = P"  "(False=P) = (~P)"  "(P=False) = (~P)"
wenzelm@12281
   936
    "(True --> P) = P"  "(False --> P) = True"
wenzelm@12281
   937
    "(P --> True) = True"  "(P --> P) = True"
wenzelm@12281
   938
    "(P --> False) = (~P)"  "(P --> ~P) = (~P)"
wenzelm@12281
   939
    "(P & True) = P"  "(True & P) = P"
wenzelm@12281
   940
    "(P & False) = False"  "(False & P) = False"
wenzelm@12281
   941
    "(P & P) = P"  "(P & (P & Q)) = (P & Q)"
wenzelm@12281
   942
    "(P & ~P) = False"    "(~P & P) = False"
wenzelm@12281
   943
    "(P | True) = True"  "(True | P) = True"
wenzelm@12281
   944
    "(P | False) = P"  "(False | P) = P"
berghofe@12436
   945
    "(P | P) = P"  "(P | (P | Q)) = (P | Q)" and
wenzelm@12281
   946
    "(ALL x. P) = P"  "(EX x. P) = P"  "EX x. x=t"  "EX x. t=x"
wenzelm@12281
   947
    -- {* needed for the one-point-rule quantifier simplification procs *}
wenzelm@12281
   948
    -- {* essential for termination!! *} and
wenzelm@12281
   949
    "!!P. (EX x. x=t & P(x)) = P(t)"
wenzelm@12281
   950
    "!!P. (EX x. t=x & P(x)) = P(t)"
wenzelm@12281
   951
    "!!P. (ALL x. x=t --> P(x)) = P(t)"
wenzelm@12937
   952
    "!!P. (ALL x. t=x --> P(x)) = P(t)"
berghofe@12436
   953
  by (blast, blast, blast, blast, blast, rules+)
wenzelm@13421
   954
wenzelm@12281
   955
lemma imp_cong: "(P = P') ==> (P' ==> (Q = Q')) ==> ((P --> Q) = (P' --> Q'))"
wenzelm@12354
   956
  by rules
wenzelm@12281
   957
wenzelm@12281
   958
lemma ex_simps:
wenzelm@12281
   959
  "!!P Q. (EX x. P x & Q)   = ((EX x. P x) & Q)"
wenzelm@12281
   960
  "!!P Q. (EX x. P & Q x)   = (P & (EX x. Q x))"
wenzelm@12281
   961
  "!!P Q. (EX x. P x | Q)   = ((EX x. P x) | Q)"
wenzelm@12281
   962
  "!!P Q. (EX x. P | Q x)   = (P | (EX x. Q x))"
wenzelm@12281
   963
  "!!P Q. (EX x. P x --> Q) = ((ALL x. P x) --> Q)"
wenzelm@12281
   964
  "!!P Q. (EX x. P --> Q x) = (P --> (EX x. Q x))"
wenzelm@12281
   965
  -- {* Miniscoping: pushing in existential quantifiers. *}
berghofe@12436
   966
  by (rules | blast)+
wenzelm@12281
   967
wenzelm@12281
   968
lemma all_simps:
wenzelm@12281
   969
  "!!P Q. (ALL x. P x & Q)   = ((ALL x. P x) & Q)"
wenzelm@12281
   970
  "!!P Q. (ALL x. P & Q x)   = (P & (ALL x. Q x))"
wenzelm@12281
   971
  "!!P Q. (ALL x. P x | Q)   = ((ALL x. P x) | Q)"
wenzelm@12281
   972
  "!!P Q. (ALL x. P | Q x)   = (P | (ALL x. Q x))"
wenzelm@12281
   973
  "!!P Q. (ALL x. P x --> Q) = ((EX x. P x) --> Q)"
wenzelm@12281
   974
  "!!P Q. (ALL x. P --> Q x) = (P --> (ALL x. Q x))"
wenzelm@12281
   975
  -- {* Miniscoping: pushing in universal quantifiers. *}
berghofe@12436
   976
  by (rules | blast)+
wenzelm@12281
   977
paulson@14201
   978
lemma disj_absorb: "(A | A) = A"
paulson@14201
   979
  by blast
paulson@14201
   980
paulson@14201
   981
lemma disj_left_absorb: "(A | (A | B)) = (A | B)"
paulson@14201
   982
  by blast
paulson@14201
   983
paulson@14201
   984
lemma conj_absorb: "(A & A) = A"
paulson@14201
   985
  by blast
paulson@14201
   986
paulson@14201
   987
lemma conj_left_absorb: "(A & (A & B)) = (A & B)"
paulson@14201
   988
  by blast
paulson@14201
   989
wenzelm@12281
   990
lemma eq_ac:
wenzelm@12937
   991
  shows eq_commute: "(a=b) = (b=a)"
wenzelm@12937
   992
    and eq_left_commute: "(P=(Q=R)) = (Q=(P=R))"
wenzelm@12937
   993
    and eq_assoc: "((P=Q)=R) = (P=(Q=R))" by (rules, blast+)
berghofe@12436
   994
lemma neq_commute: "(a~=b) = (b~=a)" by rules
wenzelm@12281
   995
wenzelm@12281
   996
lemma conj_comms:
wenzelm@12937
   997
  shows conj_commute: "(P&Q) = (Q&P)"
wenzelm@12937
   998
    and conj_left_commute: "(P&(Q&R)) = (Q&(P&R))" by rules+
berghofe@12436
   999
lemma conj_assoc: "((P&Q)&R) = (P&(Q&R))" by rules
wenzelm@12281
  1000
wenzelm@12281
  1001
lemma disj_comms:
wenzelm@12937
  1002
  shows disj_commute: "(P|Q) = (Q|P)"
wenzelm@12937
  1003
    and disj_left_commute: "(P|(Q|R)) = (Q|(P|R))" by rules+
berghofe@12436
  1004
lemma disj_assoc: "((P|Q)|R) = (P|(Q|R))" by rules
wenzelm@12281
  1005
berghofe@12436
  1006
lemma conj_disj_distribL: "(P&(Q|R)) = (P&Q | P&R)" by rules
berghofe@12436
  1007
lemma conj_disj_distribR: "((P|Q)&R) = (P&R | Q&R)" by rules
wenzelm@12281
  1008
berghofe@12436
  1009
lemma disj_conj_distribL: "(P|(Q&R)) = ((P|Q) & (P|R))" by rules
berghofe@12436
  1010
lemma disj_conj_distribR: "((P&Q)|R) = ((P|R) & (Q|R))" by rules
wenzelm@12281
  1011
berghofe@12436
  1012
lemma imp_conjR: "(P --> (Q&R)) = ((P-->Q) & (P-->R))" by rules
berghofe@12436
  1013
lemma imp_conjL: "((P&Q) -->R)  = (P --> (Q --> R))" by rules
berghofe@12436
  1014
lemma imp_disjL: "((P|Q) --> R) = ((P-->R)&(Q-->R))" by rules
wenzelm@12281
  1015
wenzelm@12281
  1016
text {* These two are specialized, but @{text imp_disj_not1} is useful in @{text "Auth/Yahalom"}. *}
wenzelm@12281
  1017
lemma imp_disj_not1: "(P --> Q | R) = (~Q --> P --> R)" by blast
wenzelm@12281
  1018
lemma imp_disj_not2: "(P --> Q | R) = (~R --> P --> Q)" by blast
wenzelm@12281
  1019
wenzelm@12281
  1020
lemma imp_disj1: "((P-->Q)|R) = (P--> Q|R)" by blast
wenzelm@12281
  1021
lemma imp_disj2: "(Q|(P-->R)) = (P--> Q|R)" by blast
wenzelm@12281
  1022
berghofe@12436
  1023
lemma de_Morgan_disj: "(~(P | Q)) = (~P & ~Q)" by rules
wenzelm@12281
  1024
lemma de_Morgan_conj: "(~(P & Q)) = (~P | ~Q)" by blast
wenzelm@12281
  1025
lemma not_imp: "(~(P --> Q)) = (P & ~Q)" by blast
wenzelm@12281
  1026
lemma not_iff: "(P~=Q) = (P = (~Q))" by blast
wenzelm@12281
  1027
lemma disj_not1: "(~P | Q) = (P --> Q)" by blast
wenzelm@12281
  1028
lemma disj_not2: "(P | ~Q) = (Q --> P)"  -- {* changes orientation :-( *}
wenzelm@12281
  1029
  by blast
wenzelm@12281
  1030
lemma imp_conv_disj: "(P --> Q) = ((~P) | Q)" by blast
wenzelm@12281
  1031
berghofe@12436
  1032
lemma iff_conv_conj_imp: "(P = Q) = ((P --> Q) & (Q --> P))" by rules
wenzelm@12281
  1033
wenzelm@12281
  1034
wenzelm@12281
  1035
lemma cases_simp: "((P --> Q) & (~P --> Q)) = Q"
wenzelm@12281
  1036
  -- {* Avoids duplication of subgoals after @{text split_if}, when the true and false *}
wenzelm@12281
  1037
  -- {* cases boil down to the same thing. *}
wenzelm@12281
  1038
  by blast
wenzelm@12281
  1039
wenzelm@12281
  1040
lemma not_all: "(~ (! x. P(x))) = (? x.~P(x))" by blast
wenzelm@12281
  1041
lemma imp_all: "((! x. P x) --> Q) = (? x. P x --> Q)" by blast
berghofe@12436
  1042
lemma not_ex: "(~ (? x. P(x))) = (! x.~P(x))" by rules
berghofe@12436
  1043
lemma imp_ex: "((? x. P x) --> Q) = (! x. P x --> Q)" by rules
wenzelm@12281
  1044
berghofe@12436
  1045
lemma ex_disj_distrib: "(? x. P(x) | Q(x)) = ((? x. P(x)) | (? x. Q(x)))" by rules
berghofe@12436
  1046
lemma all_conj_distrib: "(!x. P(x) & Q(x)) = ((! x. P(x)) & (! x. Q(x)))" by rules
wenzelm@12281
  1047
wenzelm@12281
  1048
text {*
wenzelm@12281
  1049
  \medskip The @{text "&"} congruence rule: not included by default!
wenzelm@12281
  1050
  May slow rewrite proofs down by as much as 50\% *}
wenzelm@12281
  1051
wenzelm@12281
  1052
lemma conj_cong:
wenzelm@12281
  1053
    "(P = P') ==> (P' ==> (Q = Q')) ==> ((P & Q) = (P' & Q'))"
wenzelm@12354
  1054
  by rules
wenzelm@12281
  1055
wenzelm@12281
  1056
lemma rev_conj_cong:
wenzelm@12281
  1057
    "(Q = Q') ==> (Q' ==> (P = P')) ==> ((P & Q) = (P' & Q'))"
wenzelm@12354
  1058
  by rules
wenzelm@12281
  1059
wenzelm@12281
  1060
text {* The @{text "|"} congruence rule: not included by default! *}
wenzelm@12281
  1061
wenzelm@12281
  1062
lemma disj_cong:
wenzelm@12281
  1063
    "(P = P') ==> (~P' ==> (Q = Q')) ==> ((P | Q) = (P' | Q'))"
wenzelm@12281
  1064
  by blast
wenzelm@12281
  1065
wenzelm@12281
  1066
lemma eq_sym_conv: "(x = y) = (y = x)"
wenzelm@12354
  1067
  by rules
wenzelm@12281
  1068
wenzelm@12281
  1069
wenzelm@12281
  1070
text {* \medskip if-then-else rules *}
wenzelm@12281
  1071
wenzelm@12281
  1072
lemma if_True: "(if True then x else y) = x"
wenzelm@12281
  1073
  by (unfold if_def) blast
wenzelm@12281
  1074
wenzelm@12281
  1075
lemma if_False: "(if False then x else y) = y"
wenzelm@12281
  1076
  by (unfold if_def) blast
wenzelm@12281
  1077
wenzelm@12281
  1078
lemma if_P: "P ==> (if P then x else y) = x"
wenzelm@12281
  1079
  by (unfold if_def) blast
wenzelm@12281
  1080
wenzelm@12281
  1081
lemma if_not_P: "~P ==> (if P then x else y) = y"
wenzelm@12281
  1082
  by (unfold if_def) blast
wenzelm@12281
  1083
wenzelm@12281
  1084
lemma split_if: "P (if Q then x else y) = ((Q --> P(x)) & (~Q --> P(y)))"
wenzelm@12281
  1085
  apply (rule case_split [of Q])
paulson@15481
  1086
   apply (simplesubst if_P)
paulson@15481
  1087
    prefer 3 apply (simplesubst if_not_P, blast+)
wenzelm@12281
  1088
  done
wenzelm@12281
  1089
wenzelm@12281
  1090
lemma split_if_asm: "P (if Q then x else y) = (~((Q & ~P x) | (~Q & ~P y)))"
paulson@15481
  1091
by (simplesubst split_if, blast)
wenzelm@12281
  1092
wenzelm@12281
  1093
lemmas if_splits = split_if split_if_asm
wenzelm@12281
  1094
wenzelm@12281
  1095
lemma if_def2: "(if Q then x else y) = ((Q --> x) & (~ Q --> y))"
wenzelm@12281
  1096
  by (rule split_if)
wenzelm@12281
  1097
wenzelm@12281
  1098
lemma if_cancel: "(if c then x else x) = x"
paulson@15481
  1099
by (simplesubst split_if, blast)
wenzelm@12281
  1100
wenzelm@12281
  1101
lemma if_eq_cancel: "(if x = y then y else x) = x"
paulson@15481
  1102
by (simplesubst split_if, blast)
wenzelm@12281
  1103
wenzelm@12281
  1104
lemma if_bool_eq_conj: "(if P then Q else R) = ((P-->Q) & (~P-->R))"
wenzelm@12281
  1105
  -- {* This form is useful for expanding @{text if}s on the RIGHT of the @{text "==>"} symbol. *}
wenzelm@12281
  1106
  by (rule split_if)
wenzelm@12281
  1107
wenzelm@12281
  1108
lemma if_bool_eq_disj: "(if P then Q else R) = ((P&Q) | (~P&R))"
wenzelm@12281
  1109
  -- {* And this form is useful for expanding @{text if}s on the LEFT. *}
paulson@15481
  1110
  apply (simplesubst split_if, blast)
wenzelm@12281
  1111
  done
wenzelm@12281
  1112
berghofe@12436
  1113
lemma Eq_TrueI: "P ==> P == True" by (unfold atomize_eq) rules
berghofe@12436
  1114
lemma Eq_FalseI: "~P ==> P == False" by (unfold atomize_eq) rules
wenzelm@12281
  1115
schirmer@15423
  1116
text {* \medskip let rules for simproc *}
schirmer@15423
  1117
schirmer@15423
  1118
lemma Let_folded: "f x \<equiv> g x \<Longrightarrow>  Let x f \<equiv> Let x g"
schirmer@15423
  1119
  by (unfold Let_def)
schirmer@15423
  1120
schirmer@15423
  1121
lemma Let_unfold: "f x \<equiv> g \<Longrightarrow>  Let x f \<equiv> g"
schirmer@15423
  1122
  by (unfold Let_def)
schirmer@15423
  1123
paulson@14201
  1124
subsubsection {* Actual Installation of the Simplifier *}
paulson@14201
  1125
wenzelm@9869
  1126
use "simpdata.ML"
wenzelm@9869
  1127
setup Simplifier.setup
wenzelm@9869
  1128
setup "Simplifier.method_setup Splitter.split_modifiers" setup simpsetup
wenzelm@9869
  1129
setup Splitter.setup setup Clasimp.setup
wenzelm@9869
  1130
paulson@15481
  1131
paulson@15481
  1132
subsubsection {* Lucas Dixon's eqstep tactic *}
paulson@15481
  1133
paulson@15481
  1134
use "~~/src/Provers/eqsubst.ML";
paulson@15481
  1135
use "eqrule_HOL_data.ML";
paulson@15481
  1136
paulson@15481
  1137
setup EQSubstTac.setup
paulson@15481
  1138
paulson@15481
  1139
paulson@15481
  1140
subsection {* Other simple lemmas *}
paulson@15481
  1141
paulson@15411
  1142
declare disj_absorb [simp] conj_absorb [simp]
paulson@14201
  1143
nipkow@13723
  1144
lemma ex1_eq[iff]: "EX! x. x = t" "EX! x. t = x"
nipkow@13723
  1145
by blast+
nipkow@13723
  1146
paulson@15481
  1147
berghofe@13638
  1148
theorem choice_eq: "(ALL x. EX! y. P x y) = (EX! f. ALL x. P x (f x))"
berghofe@13638
  1149
  apply (rule iffI)
berghofe@13638
  1150
  apply (rule_tac a = "%x. THE y. P x y" in ex1I)
berghofe@13638
  1151
  apply (fast dest!: theI')
berghofe@13638
  1152
  apply (fast intro: ext the1_equality [symmetric])
berghofe@13638
  1153
  apply (erule ex1E)
berghofe@13638
  1154
  apply (rule allI)
berghofe@13638
  1155
  apply (rule ex1I)
berghofe@13638
  1156
  apply (erule spec)
berghofe@13638
  1157
  apply (erule_tac x = "%z. if z = x then y else f z" in allE)
berghofe@13638
  1158
  apply (erule impE)
berghofe@13638
  1159
  apply (rule allI)
berghofe@13638
  1160
  apply (rule_tac P = "xa = x" in case_split_thm)
paulson@14208
  1161
  apply (drule_tac [3] x = x in fun_cong, simp_all)
berghofe@13638
  1162
  done
berghofe@13638
  1163
nipkow@13438
  1164
text{*Needs only HOL-lemmas:*}
nipkow@13438
  1165
lemma mk_left_commute:
nipkow@13438
  1166
  assumes a: "\<And>x y z. f (f x y) z = f x (f y z)" and
nipkow@13438
  1167
          c: "\<And>x y. f x y = f y x"
nipkow@13438
  1168
  shows "f x (f y z) = f y (f x z)"
nipkow@13438
  1169
by(rule trans[OF trans[OF c a] arg_cong[OF c, of "f y"]])
nipkow@13438
  1170
wenzelm@11750
  1171
paulson@15481
  1172
subsection {* Generic cases and induction *}
wenzelm@11824
  1173
wenzelm@11824
  1174
constdefs
wenzelm@11989
  1175
  induct_forall :: "('a => bool) => bool"
wenzelm@11989
  1176
  "induct_forall P == \<forall>x. P x"
wenzelm@11989
  1177
  induct_implies :: "bool => bool => bool"
wenzelm@11989
  1178
  "induct_implies A B == A --> B"
wenzelm@11989
  1179
  induct_equal :: "'a => 'a => bool"
wenzelm@11989
  1180
  "induct_equal x y == x = y"
wenzelm@11989
  1181
  induct_conj :: "bool => bool => bool"
wenzelm@11989
  1182
  "induct_conj A B == A & B"
wenzelm@11824
  1183
wenzelm@11989
  1184
lemma induct_forall_eq: "(!!x. P x) == Trueprop (induct_forall (\<lambda>x. P x))"
wenzelm@11989
  1185
  by (simp only: atomize_all induct_forall_def)
wenzelm@11824
  1186
wenzelm@11989
  1187
lemma induct_implies_eq: "(A ==> B) == Trueprop (induct_implies A B)"
wenzelm@11989
  1188
  by (simp only: atomize_imp induct_implies_def)
wenzelm@11824
  1189
wenzelm@11989
  1190
lemma induct_equal_eq: "(x == y) == Trueprop (induct_equal x y)"
wenzelm@11989
  1191
  by (simp only: atomize_eq induct_equal_def)
wenzelm@11824
  1192
wenzelm@11989
  1193
lemma induct_forall_conj: "induct_forall (\<lambda>x. induct_conj (A x) (B x)) =
wenzelm@11989
  1194
    induct_conj (induct_forall A) (induct_forall B)"
wenzelm@12354
  1195
  by (unfold induct_forall_def induct_conj_def) rules
wenzelm@11824
  1196
wenzelm@11989
  1197
lemma induct_implies_conj: "induct_implies C (induct_conj A B) =
wenzelm@11989
  1198
    induct_conj (induct_implies C A) (induct_implies C B)"
wenzelm@12354
  1199
  by (unfold induct_implies_def induct_conj_def) rules
wenzelm@11989
  1200
berghofe@13598
  1201
lemma induct_conj_curry: "(induct_conj A B ==> PROP C) == (A ==> B ==> PROP C)"
berghofe@13598
  1202
proof
berghofe@13598
  1203
  assume r: "induct_conj A B ==> PROP C" and A B
berghofe@13598
  1204
  show "PROP C" by (rule r) (simp! add: induct_conj_def)
berghofe@13598
  1205
next
berghofe@13598
  1206
  assume r: "A ==> B ==> PROP C" and "induct_conj A B"
berghofe@13598
  1207
  show "PROP C" by (rule r) (simp! add: induct_conj_def)+
berghofe@13598
  1208
qed
wenzelm@11824
  1209
wenzelm@11989
  1210
lemma induct_impliesI: "(A ==> B) ==> induct_implies A B"
wenzelm@11989
  1211
  by (simp add: induct_implies_def)
wenzelm@11824
  1212
wenzelm@12161
  1213
lemmas induct_atomize = atomize_conj induct_forall_eq induct_implies_eq induct_equal_eq
wenzelm@12161
  1214
lemmas induct_rulify1 [symmetric, standard] = induct_forall_eq induct_implies_eq induct_equal_eq
wenzelm@12161
  1215
lemmas induct_rulify2 = induct_forall_def induct_implies_def induct_equal_def induct_conj_def
wenzelm@11989
  1216
lemmas induct_conj = induct_forall_conj induct_implies_conj induct_conj_curry
wenzelm@11824
  1217
wenzelm@11989
  1218
hide const induct_forall induct_implies induct_equal induct_conj
wenzelm@11824
  1219
wenzelm@11824
  1220
wenzelm@11824
  1221
text {* Method setup. *}
wenzelm@11824
  1222
wenzelm@11824
  1223
ML {*
wenzelm@11824
  1224
  structure InductMethod = InductMethodFun
wenzelm@11824
  1225
  (struct
paulson@15411
  1226
    val dest_concls = HOLogic.dest_concls
paulson@15411
  1227
    val cases_default = thm "case_split"
paulson@15411
  1228
    val local_impI = thm "induct_impliesI"
paulson@15411
  1229
    val conjI = thm "conjI"
paulson@15411
  1230
    val atomize = thms "induct_atomize"
paulson@15411
  1231
    val rulify1 = thms "induct_rulify1"
paulson@15411
  1232
    val rulify2 = thms "induct_rulify2"
paulson@15411
  1233
    val localize = [Thm.symmetric (thm "induct_implies_def")]
wenzelm@11824
  1234
  end);
wenzelm@11824
  1235
*}
wenzelm@11824
  1236
wenzelm@11824
  1237
setup InductMethod.setup
wenzelm@11824
  1238
wenzelm@11824
  1239
kleing@14357
  1240
end
paulson@15411
  1241