src/FOL/FOL.thy
author wenzelm
Mon Apr 06 23:14:05 2015 +0200 (2015-04-06)
changeset 59940 087d81f5213e
parent 59780 23b67731f4f0
child 59942 6a3098313acf
permissions -rw-r--r--
local setup of induction tools, with restricted access to auxiliary consts;
proper antiquotations for formerly inaccessible consts;
wenzelm@9487
     1
(*  Title:      FOL/FOL.thy
wenzelm@9487
     2
    Author:     Lawrence C Paulson and Markus Wenzel
wenzelm@11678
     3
*)
wenzelm@9487
     4
wenzelm@58889
     5
section {* Classical first-order logic *}
wenzelm@4093
     6
wenzelm@18456
     7
theory FOL
paulson@15481
     8
imports IFOL
wenzelm@46950
     9
keywords "print_claset" "print_induct_rules" :: diag
wenzelm@18456
    10
begin
wenzelm@9487
    11
wenzelm@48891
    12
ML_file "~~/src/Provers/classical.ML"
wenzelm@48891
    13
ML_file "~~/src/Provers/blast.ML"
wenzelm@48891
    14
ML_file "~~/src/Provers/clasimp.ML"
wenzelm@48891
    15
wenzelm@9487
    16
wenzelm@9487
    17
subsection {* The classical axiom *}
wenzelm@4093
    18
wenzelm@41779
    19
axiomatization where
wenzelm@7355
    20
  classical: "(~P ==> P) ==> P"
wenzelm@4093
    21
wenzelm@9487
    22
wenzelm@11678
    23
subsection {* Lemmas and proof tools *}
wenzelm@9487
    24
wenzelm@21539
    25
lemma ccontr: "(\<not> P \<Longrightarrow> False) \<Longrightarrow> P"
wenzelm@21539
    26
  by (erule FalseE [THEN classical])
wenzelm@21539
    27
wenzelm@21539
    28
(*** Classical introduction rules for | and EX ***)
wenzelm@21539
    29
wenzelm@21539
    30
lemma disjCI: "(~Q ==> P) ==> P|Q"
wenzelm@21539
    31
  apply (rule classical)
wenzelm@21539
    32
  apply (assumption | erule meta_mp | rule disjI1 notI)+
wenzelm@21539
    33
  apply (erule notE disjI2)+
wenzelm@21539
    34
  done
wenzelm@21539
    35
wenzelm@21539
    36
(*introduction rule involving only EX*)
wenzelm@21539
    37
lemma ex_classical:
wenzelm@21539
    38
  assumes r: "~(EX x. P(x)) ==> P(a)"
wenzelm@21539
    39
  shows "EX x. P(x)"
wenzelm@21539
    40
  apply (rule classical)
wenzelm@21539
    41
  apply (rule exI, erule r)
wenzelm@21539
    42
  done
wenzelm@21539
    43
wenzelm@21539
    44
(*version of above, simplifying ~EX to ALL~ *)
wenzelm@21539
    45
lemma exCI:
wenzelm@21539
    46
  assumes r: "ALL x. ~P(x) ==> P(a)"
wenzelm@21539
    47
  shows "EX x. P(x)"
wenzelm@21539
    48
  apply (rule ex_classical)
wenzelm@21539
    49
  apply (rule notI [THEN allI, THEN r])
wenzelm@21539
    50
  apply (erule notE)
wenzelm@21539
    51
  apply (erule exI)
wenzelm@21539
    52
  done
wenzelm@21539
    53
wenzelm@21539
    54
lemma excluded_middle: "~P | P"
wenzelm@21539
    55
  apply (rule disjCI)
wenzelm@21539
    56
  apply assumption
wenzelm@21539
    57
  done
wenzelm@21539
    58
wenzelm@27115
    59
lemma case_split [case_names True False]:
wenzelm@21539
    60
  assumes r1: "P ==> Q"
wenzelm@21539
    61
    and r2: "~P ==> Q"
wenzelm@21539
    62
  shows Q
wenzelm@21539
    63
  apply (rule excluded_middle [THEN disjE])
wenzelm@21539
    64
  apply (erule r2)
wenzelm@21539
    65
  apply (erule r1)
wenzelm@21539
    66
  done
wenzelm@21539
    67
wenzelm@21539
    68
ML {*
wenzelm@59780
    69
  fun case_tac ctxt a fixes =
wenzelm@59780
    70
    Rule_Insts.res_inst_tac ctxt [((("P", 0), Position.none), a)] fixes @{thm case_split}
wenzelm@21539
    71
*}
wenzelm@21539
    72
wenzelm@30549
    73
method_setup case_tac = {*
wenzelm@59780
    74
  Args.goal_spec -- Scan.lift (Args.name_inner_syntax -- Parse.for_fixes) >>
wenzelm@59780
    75
    (fn (quant, (s, fixes)) => fn ctxt => SIMPLE_METHOD'' quant (case_tac ctxt s fixes))
wenzelm@30549
    76
*} "case_tac emulation (dynamic instantiation!)"
wenzelm@27211
    77
wenzelm@21539
    78
wenzelm@21539
    79
(*** Special elimination rules *)
wenzelm@21539
    80
wenzelm@21539
    81
wenzelm@21539
    82
(*Classical implies (-->) elimination. *)
wenzelm@21539
    83
lemma impCE:
wenzelm@21539
    84
  assumes major: "P-->Q"
wenzelm@21539
    85
    and r1: "~P ==> R"
wenzelm@21539
    86
    and r2: "Q ==> R"
wenzelm@21539
    87
  shows R
wenzelm@21539
    88
  apply (rule excluded_middle [THEN disjE])
wenzelm@21539
    89
   apply (erule r1)
wenzelm@21539
    90
  apply (rule r2)
wenzelm@21539
    91
  apply (erule major [THEN mp])
wenzelm@21539
    92
  done
wenzelm@21539
    93
wenzelm@21539
    94
(*This version of --> elimination works on Q before P.  It works best for
wenzelm@21539
    95
  those cases in which P holds "almost everywhere".  Can't install as
wenzelm@21539
    96
  default: would break old proofs.*)
wenzelm@21539
    97
lemma impCE':
wenzelm@21539
    98
  assumes major: "P-->Q"
wenzelm@21539
    99
    and r1: "Q ==> R"
wenzelm@21539
   100
    and r2: "~P ==> R"
wenzelm@21539
   101
  shows R
wenzelm@21539
   102
  apply (rule excluded_middle [THEN disjE])
wenzelm@21539
   103
   apply (erule r2)
wenzelm@21539
   104
  apply (rule r1)
wenzelm@21539
   105
  apply (erule major [THEN mp])
wenzelm@21539
   106
  done
wenzelm@21539
   107
wenzelm@21539
   108
(*Double negation law*)
wenzelm@21539
   109
lemma notnotD: "~~P ==> P"
wenzelm@21539
   110
  apply (rule classical)
wenzelm@21539
   111
  apply (erule notE)
wenzelm@21539
   112
  apply assumption
wenzelm@21539
   113
  done
wenzelm@21539
   114
wenzelm@21539
   115
lemma contrapos2:  "[| Q; ~ P ==> ~ Q |] ==> P"
wenzelm@21539
   116
  apply (rule classical)
wenzelm@21539
   117
  apply (drule (1) meta_mp)
wenzelm@21539
   118
  apply (erule (1) notE)
wenzelm@21539
   119
  done
wenzelm@21539
   120
wenzelm@21539
   121
(*** Tactics for implication and contradiction ***)
wenzelm@21539
   122
wenzelm@42453
   123
(*Classical <-> elimination.  Proof substitutes P=Q in
wenzelm@21539
   124
    ~P ==> ~Q    and    P ==> Q  *)
wenzelm@21539
   125
lemma iffCE:
wenzelm@21539
   126
  assumes major: "P<->Q"
wenzelm@21539
   127
    and r1: "[| P; Q |] ==> R"
wenzelm@21539
   128
    and r2: "[| ~P; ~Q |] ==> R"
wenzelm@21539
   129
  shows R
wenzelm@21539
   130
  apply (rule major [unfolded iff_def, THEN conjE])
wenzelm@21539
   131
  apply (elim impCE)
wenzelm@21539
   132
     apply (erule (1) r2)
wenzelm@21539
   133
    apply (erule (1) notE)+
wenzelm@21539
   134
  apply (erule (1) r1)
wenzelm@21539
   135
  done
wenzelm@21539
   136
wenzelm@21539
   137
wenzelm@21539
   138
(*Better for fast_tac: needs no quantifier duplication!*)
wenzelm@21539
   139
lemma alt_ex1E:
wenzelm@21539
   140
  assumes major: "EX! x. P(x)"
wenzelm@21539
   141
    and r: "!!x. [| P(x);  ALL y y'. P(y) & P(y') --> y=y' |] ==> R"
wenzelm@21539
   142
  shows R
wenzelm@21539
   143
  using major
wenzelm@21539
   144
proof (rule ex1E)
wenzelm@21539
   145
  fix x
wenzelm@21539
   146
  assume * : "\<forall>y. P(y) \<longrightarrow> y = x"
wenzelm@21539
   147
  assume "P(x)"
wenzelm@21539
   148
  then show R
wenzelm@21539
   149
  proof (rule r)
wenzelm@21539
   150
    { fix y y'
wenzelm@21539
   151
      assume "P(y)" and "P(y')"
wenzelm@51798
   152
      with * have "x = y" and "x = y'" by - (tactic "IntPr.fast_tac @{context} 1")+
wenzelm@21539
   153
      then have "y = y'" by (rule subst)
wenzelm@21539
   154
    } note r' = this
wenzelm@21539
   155
    show "\<forall>y y'. P(y) \<and> P(y') \<longrightarrow> y = y'" by (intro strip, elim conjE) (rule r')
wenzelm@21539
   156
  qed
wenzelm@21539
   157
qed
wenzelm@9525
   158
wenzelm@26411
   159
lemma imp_elim: "P --> Q ==> (~ R ==> P) ==> (Q ==> R) ==> R"
wenzelm@26411
   160
  by (rule classical) iprover
wenzelm@26411
   161
wenzelm@26411
   162
lemma swap: "~ P ==> (~ R ==> P) ==> R"
wenzelm@26411
   163
  by (rule classical) iprover
wenzelm@26411
   164
wenzelm@27849
   165
wenzelm@27849
   166
section {* Classical Reasoner *}
wenzelm@27849
   167
wenzelm@42793
   168
ML {*
wenzelm@42799
   169
structure Cla = Classical
wenzelm@42793
   170
(
wenzelm@42793
   171
  val imp_elim = @{thm imp_elim}
wenzelm@42793
   172
  val not_elim = @{thm notE}
wenzelm@42793
   173
  val swap = @{thm swap}
wenzelm@42793
   174
  val classical = @{thm classical}
wenzelm@42793
   175
  val sizef = size_of_thm
wenzelm@42793
   176
  val hyp_subst_tacs = [hyp_subst_tac]
wenzelm@42793
   177
);
wenzelm@42793
   178
wenzelm@42793
   179
structure Basic_Classical: BASIC_CLASSICAL = Cla;
wenzelm@42793
   180
open Basic_Classical;
wenzelm@42793
   181
*}
wenzelm@42793
   182
wenzelm@42793
   183
(*Propositional rules*)
wenzelm@42793
   184
lemmas [intro!] = refl TrueI conjI disjCI impI notI iffI
wenzelm@42793
   185
  and [elim!] = conjE disjE impCE FalseE iffCE
wenzelm@51687
   186
ML {* val prop_cs = claset_of @{context} *}
wenzelm@42793
   187
wenzelm@42793
   188
(*Quantifier rules*)
wenzelm@42793
   189
lemmas [intro!] = allI ex_ex1I
wenzelm@42793
   190
  and [intro] = exI
wenzelm@42793
   191
  and [elim!] = exE alt_ex1E
wenzelm@42793
   192
  and [elim] = allE
wenzelm@51687
   193
ML {* val FOL_cs = claset_of @{context} *}
wenzelm@10383
   194
wenzelm@32176
   195
ML {*
wenzelm@32176
   196
  structure Blast = Blast
wenzelm@32176
   197
  (
wenzelm@42477
   198
    structure Classical = Cla
wenzelm@42802
   199
    val Trueprop_const = dest_Const @{const Trueprop}
wenzelm@41310
   200
    val equality_name = @{const_name eq}
wenzelm@32176
   201
    val not_name = @{const_name Not}
wenzelm@32960
   202
    val notE = @{thm notE}
wenzelm@32960
   203
    val ccontr = @{thm ccontr}
wenzelm@32176
   204
    val hyp_subst_tac = Hypsubst.blast_hyp_subst_tac
wenzelm@32176
   205
  );
wenzelm@32176
   206
  val blast_tac = Blast.blast_tac;
wenzelm@32176
   207
*}
wenzelm@32176
   208
paulson@13550
   209
paulson@13550
   210
lemma ex1_functional: "[| EX! z. P(a,z);  P(a,b);  P(a,c) |] ==> b = c"
wenzelm@21539
   211
  by blast
wenzelm@20223
   212
wenzelm@20223
   213
(* Elimination of True from asumptions: *)
wenzelm@20223
   214
lemma True_implies_equals: "(True ==> PROP P) == PROP P"
wenzelm@20223
   215
proof
wenzelm@20223
   216
  assume "True \<Longrightarrow> PROP P"
wenzelm@20223
   217
  from this and TrueI show "PROP P" .
wenzelm@20223
   218
next
wenzelm@20223
   219
  assume "PROP P"
wenzelm@20223
   220
  then show "PROP P" .
wenzelm@20223
   221
qed
wenzelm@9487
   222
wenzelm@21539
   223
lemma uncurry: "P --> Q --> R ==> P & Q --> R"
wenzelm@21539
   224
  by blast
wenzelm@21539
   225
wenzelm@21539
   226
lemma iff_allI: "(!!x. P(x) <-> Q(x)) ==> (ALL x. P(x)) <-> (ALL x. Q(x))"
wenzelm@21539
   227
  by blast
wenzelm@21539
   228
wenzelm@21539
   229
lemma iff_exI: "(!!x. P(x) <-> Q(x)) ==> (EX x. P(x)) <-> (EX x. Q(x))"
wenzelm@21539
   230
  by blast
wenzelm@21539
   231
wenzelm@21539
   232
lemma all_comm: "(ALL x y. P(x,y)) <-> (ALL y x. P(x,y))" by blast
wenzelm@21539
   233
wenzelm@21539
   234
lemma ex_comm: "(EX x y. P(x,y)) <-> (EX y x. P(x,y))" by blast
wenzelm@21539
   235
wenzelm@26286
   236
wenzelm@26286
   237
wenzelm@26286
   238
(*** Classical simplification rules ***)
wenzelm@26286
   239
wenzelm@26286
   240
(*Avoids duplication of subgoals after expand_if, when the true and false
wenzelm@26286
   241
  cases boil down to the same thing.*)
wenzelm@26286
   242
lemma cases_simp: "(P --> Q) & (~P --> Q) <-> Q" by blast
wenzelm@26286
   243
wenzelm@26286
   244
wenzelm@26286
   245
(*** Miniscoping: pushing quantifiers in
wenzelm@26286
   246
     We do NOT distribute of ALL over &, or dually that of EX over |
wenzelm@26286
   247
     Baaz and Leitsch, On Skolemization and Proof Complexity (1994)
wenzelm@26286
   248
     show that this step can increase proof length!
wenzelm@26286
   249
***)
wenzelm@26286
   250
wenzelm@26286
   251
(*existential miniscoping*)
wenzelm@26286
   252
lemma int_ex_simps:
wenzelm@26286
   253
  "!!P Q. (EX x. P(x) & Q) <-> (EX x. P(x)) & Q"
wenzelm@26286
   254
  "!!P Q. (EX x. P & Q(x)) <-> P & (EX x. Q(x))"
wenzelm@26286
   255
  "!!P Q. (EX x. P(x) | Q) <-> (EX x. P(x)) | Q"
wenzelm@26286
   256
  "!!P Q. (EX x. P | Q(x)) <-> P | (EX x. Q(x))"
wenzelm@26286
   257
  by iprover+
wenzelm@26286
   258
wenzelm@26286
   259
(*classical rules*)
wenzelm@26286
   260
lemma cla_ex_simps:
wenzelm@26286
   261
  "!!P Q. (EX x. P(x) --> Q) <-> (ALL x. P(x)) --> Q"
wenzelm@26286
   262
  "!!P Q. (EX x. P --> Q(x)) <-> P --> (EX x. Q(x))"
wenzelm@26286
   263
  by blast+
wenzelm@26286
   264
wenzelm@26286
   265
lemmas ex_simps = int_ex_simps cla_ex_simps
wenzelm@26286
   266
wenzelm@26286
   267
(*universal miniscoping*)
wenzelm@26286
   268
lemma int_all_simps:
wenzelm@26286
   269
  "!!P Q. (ALL x. P(x) & Q) <-> (ALL x. P(x)) & Q"
wenzelm@26286
   270
  "!!P Q. (ALL x. P & Q(x)) <-> P & (ALL x. Q(x))"
wenzelm@26286
   271
  "!!P Q. (ALL x. P(x) --> Q) <-> (EX x. P(x)) --> Q"
wenzelm@26286
   272
  "!!P Q. (ALL x. P --> Q(x)) <-> P --> (ALL x. Q(x))"
wenzelm@26286
   273
  by iprover+
wenzelm@26286
   274
wenzelm@26286
   275
(*classical rules*)
wenzelm@26286
   276
lemma cla_all_simps:
wenzelm@26286
   277
  "!!P Q. (ALL x. P(x) | Q) <-> (ALL x. P(x)) | Q"
wenzelm@26286
   278
  "!!P Q. (ALL x. P | Q(x)) <-> P | (ALL x. Q(x))"
wenzelm@26286
   279
  by blast+
wenzelm@26286
   280
wenzelm@26286
   281
lemmas all_simps = int_all_simps cla_all_simps
wenzelm@26286
   282
wenzelm@26286
   283
wenzelm@26286
   284
(*** Named rewrite rules proved for IFOL ***)
wenzelm@26286
   285
wenzelm@26286
   286
lemma imp_disj1: "(P-->Q) | R <-> (P-->Q | R)" by blast
wenzelm@26286
   287
lemma imp_disj2: "Q | (P-->R) <-> (P-->Q | R)" by blast
wenzelm@26286
   288
wenzelm@26286
   289
lemma de_Morgan_conj: "(~(P & Q)) <-> (~P | ~Q)" by blast
wenzelm@26286
   290
wenzelm@26286
   291
lemma not_imp: "~(P --> Q) <-> (P & ~Q)" by blast
wenzelm@26286
   292
lemma not_iff: "~(P <-> Q) <-> (P <-> ~Q)" by blast
wenzelm@26286
   293
wenzelm@26286
   294
lemma not_all: "(~ (ALL x. P(x))) <-> (EX x.~P(x))" by blast
wenzelm@26286
   295
lemma imp_all: "((ALL x. P(x)) --> Q) <-> (EX x. P(x) --> Q)" by blast
wenzelm@26286
   296
wenzelm@26286
   297
wenzelm@26286
   298
lemmas meta_simps =
wenzelm@26286
   299
  triv_forall_equality (* prunes params *)
wenzelm@26286
   300
  True_implies_equals  (* prune asms `True' *)
wenzelm@26286
   301
wenzelm@26286
   302
lemmas IFOL_simps =
wenzelm@26286
   303
  refl [THEN P_iff_T] conj_simps disj_simps not_simps
wenzelm@26286
   304
  imp_simps iff_simps quant_simps
wenzelm@26286
   305
wenzelm@26286
   306
lemma notFalseI: "~False" by iprover
wenzelm@26286
   307
wenzelm@26286
   308
lemma cla_simps_misc:
wenzelm@26286
   309
  "~(P&Q) <-> ~P | ~Q"
wenzelm@26286
   310
  "P | ~P"
wenzelm@26286
   311
  "~P | P"
wenzelm@26286
   312
  "~ ~ P <-> P"
wenzelm@26286
   313
  "(~P --> P) <-> P"
wenzelm@26286
   314
  "(~P <-> ~Q) <-> (P<->Q)" by blast+
wenzelm@26286
   315
wenzelm@26286
   316
lemmas cla_simps =
wenzelm@26286
   317
  de_Morgan_conj de_Morgan_disj imp_disj1 imp_disj2
wenzelm@26286
   318
  not_imp not_all not_ex cases_simp cla_simps_misc
wenzelm@26286
   319
wenzelm@26286
   320
wenzelm@48891
   321
ML_file "simpdata.ML"
wenzelm@42455
   322
wenzelm@42459
   323
simproc_setup defined_Ex ("EX x. P(x)") = {* fn _ => Quantifier1.rearrange_ex *}
wenzelm@42459
   324
simproc_setup defined_All ("ALL x. P(x)") = {* fn _ => Quantifier1.rearrange_all *}
wenzelm@42455
   325
wenzelm@42453
   326
ML {*
wenzelm@42453
   327
(*intuitionistic simprules only*)
wenzelm@42453
   328
val IFOL_ss =
wenzelm@51717
   329
  put_simpset FOL_basic_ss @{context}
wenzelm@45654
   330
  addsimps @{thms meta_simps IFOL_simps int_ex_simps int_all_simps}
wenzelm@42455
   331
  addsimprocs [@{simproc defined_All}, @{simproc defined_Ex}]
wenzelm@51717
   332
  |> Simplifier.add_cong @{thm imp_cong}
wenzelm@51717
   333
  |> simpset_of;
wenzelm@42453
   334
wenzelm@42453
   335
(*classical simprules too*)
wenzelm@51717
   336
val FOL_ss =
wenzelm@51717
   337
  put_simpset IFOL_ss @{context}
wenzelm@51717
   338
  addsimps @{thms cla_simps cla_ex_simps cla_all_simps}
wenzelm@51717
   339
  |> simpset_of;
wenzelm@42453
   340
*}
wenzelm@42453
   341
wenzelm@58826
   342
setup {*
wenzelm@58826
   343
  map_theory_simpset (put_simpset FOL_ss) #>
wenzelm@58826
   344
  Simplifier.method_setup Splitter.split_modifiers
wenzelm@58826
   345
*}
wenzelm@52241
   346
wenzelm@52241
   347
ML_file "~~/src/Tools/eqsubst.ML"
paulson@15481
   348
paulson@15481
   349
paulson@14085
   350
subsection {* Other simple lemmas *}
paulson@14085
   351
paulson@14085
   352
lemma [simp]: "((P-->R) <-> (Q-->R)) <-> ((P<->Q) | R)"
paulson@14085
   353
by blast
paulson@14085
   354
paulson@14085
   355
lemma [simp]: "((P-->Q) <-> (P-->R)) <-> (P --> (Q<->R))"
paulson@14085
   356
by blast
paulson@14085
   357
paulson@14085
   358
lemma not_disj_iff_imp: "~P | Q <-> (P-->Q)"
paulson@14085
   359
by blast
paulson@14085
   360
paulson@14085
   361
(** Monotonicity of implications **)
paulson@14085
   362
paulson@14085
   363
lemma conj_mono: "[| P1-->Q1; P2-->Q2 |] ==> (P1&P2) --> (Q1&Q2)"
paulson@14085
   364
by fast (*or (IntPr.fast_tac 1)*)
paulson@14085
   365
paulson@14085
   366
lemma disj_mono: "[| P1-->Q1; P2-->Q2 |] ==> (P1|P2) --> (Q1|Q2)"
paulson@14085
   367
by fast (*or (IntPr.fast_tac 1)*)
paulson@14085
   368
paulson@14085
   369
lemma imp_mono: "[| Q1-->P1; P2-->Q2 |] ==> (P1-->P2)-->(Q1-->Q2)"
paulson@14085
   370
by fast (*or (IntPr.fast_tac 1)*)
paulson@14085
   371
paulson@14085
   372
lemma imp_refl: "P-->P"
paulson@14085
   373
by (rule impI, assumption)
paulson@14085
   374
paulson@14085
   375
(*The quantifier monotonicity rules are also intuitionistically valid*)
paulson@14085
   376
lemma ex_mono: "(!!x. P(x) --> Q(x)) ==> (EX x. P(x)) --> (EX x. Q(x))"
paulson@14085
   377
by blast
paulson@14085
   378
paulson@14085
   379
lemma all_mono: "(!!x. P(x) --> Q(x)) ==> (ALL x. P(x)) --> (ALL x. Q(x))"
paulson@14085
   380
by blast
paulson@14085
   381
wenzelm@11678
   382
wenzelm@11678
   383
subsection {* Proof by cases and induction *}
wenzelm@11678
   384
wenzelm@11678
   385
text {* Proper handling of non-atomic rule statements. *}
wenzelm@11678
   386
wenzelm@59940
   387
context
wenzelm@59940
   388
begin
wenzelm@59940
   389
wenzelm@59940
   390
restricted definition "induct_forall(P) == \<forall>x. P(x)"
wenzelm@59940
   391
restricted definition "induct_implies(A, B) == A \<longrightarrow> B"
wenzelm@59940
   392
restricted definition "induct_equal(x, y) == x = y"
wenzelm@59940
   393
restricted definition "induct_conj(A, B) == A \<and> B"
wenzelm@11678
   394
wenzelm@11678
   395
lemma induct_forall_eq: "(!!x. P(x)) == Trueprop(induct_forall(\<lambda>x. P(x)))"
wenzelm@18816
   396
  unfolding atomize_all induct_forall_def .
wenzelm@11678
   397
wenzelm@11678
   398
lemma induct_implies_eq: "(A ==> B) == Trueprop(induct_implies(A, B))"
wenzelm@18816
   399
  unfolding atomize_imp induct_implies_def .
wenzelm@11678
   400
wenzelm@11678
   401
lemma induct_equal_eq: "(x == y) == Trueprop(induct_equal(x, y))"
wenzelm@18816
   402
  unfolding atomize_eq induct_equal_def .
wenzelm@11678
   403
wenzelm@28856
   404
lemma induct_conj_eq: "(A &&& B) == Trueprop(induct_conj(A, B))"
wenzelm@18816
   405
  unfolding atomize_conj induct_conj_def .
wenzelm@11988
   406
wenzelm@18456
   407
lemmas induct_atomize = induct_forall_eq induct_implies_eq induct_equal_eq induct_conj_eq
wenzelm@45594
   408
lemmas induct_rulify [symmetric] = induct_atomize
wenzelm@18456
   409
lemmas induct_rulify_fallback =
wenzelm@18456
   410
  induct_forall_def induct_implies_def induct_equal_def induct_conj_def
wenzelm@11678
   411
wenzelm@11678
   412
text {* Method setup. *}
wenzelm@11678
   413
wenzelm@58826
   414
ML_file "~~/src/Tools/induct.ML"
wenzelm@11678
   415
ML {*
wenzelm@32171
   416
  structure Induct = Induct
wenzelm@24830
   417
  (
wenzelm@22139
   418
    val cases_default = @{thm case_split}
wenzelm@22139
   419
    val atomize = @{thms induct_atomize}
wenzelm@22139
   420
    val rulify = @{thms induct_rulify}
wenzelm@22139
   421
    val rulify_fallback = @{thms induct_rulify_fallback}
berghofe@34989
   422
    val equal_def = @{thm induct_equal_def}
berghofe@34914
   423
    fun dest_def _ = NONE
wenzelm@58957
   424
    fun trivial_tac _ _ = no_tac
wenzelm@24830
   425
  );
wenzelm@11678
   426
*}
wenzelm@11678
   427
wenzelm@24830
   428
declare case_split [cases type: o]
wenzelm@11678
   429
wenzelm@59940
   430
end
wenzelm@59940
   431
wenzelm@58826
   432
ML_file "~~/src/Tools/case_product.ML"
noschinl@41827
   433
wenzelm@41310
   434
wenzelm@41310
   435
hide_const (open) eq
wenzelm@41310
   436
wenzelm@4854
   437
end