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