src/FOL/FOL.thy
author wenzelm
Wed, 27 Mar 2013 16:38:25 +0100
changeset 51553 63327f679cff
parent 48891 c0eafbd55de3
child 51687 3d8720271ebf
permissions -rw-r--r--
more ambitious Goal.skip_proofs: covers Goal.prove forms as well, and do not insist in quick_and_dirty (for the sake of Isabelle/jEdit);
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9487
7e377f912629 improved comments;
wenzelm
parents: 8643
diff changeset
     1
(*  Title:      FOL/FOL.thy
7e377f912629 improved comments;
wenzelm
parents: 8643
diff changeset
     2
    Author:     Lawrence C Paulson and Markus Wenzel
11678
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
     3
*)
9487
7e377f912629 improved comments;
wenzelm
parents: 8643
diff changeset
     4
11678
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
     5
header {* Classical first-order logic *}
4093
5e8f3d57dee7 added claset thy_data;
wenzelm
parents: 0
diff changeset
     6
18456
8cc35e95450a updated auxiliary facts for induct method;
wenzelm
parents: 16417
diff changeset
     7
theory FOL
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 15019
diff changeset
     8
imports IFOL
46950
d0181abdbdac declare command keywords via theory header, including strict checking outside Pure;
wenzelm
parents: 45654
diff changeset
     9
keywords "print_claset" "print_induct_rules" :: diag
18456
8cc35e95450a updated auxiliary facts for induct method;
wenzelm
parents: 16417
diff changeset
    10
begin
9487
7e377f912629 improved comments;
wenzelm
parents: 8643
diff changeset
    11
48891
c0eafbd55de3 prefer ML_file over old uses;
wenzelm
parents: 48776
diff changeset
    12
ML_file "~~/src/Provers/classical.ML"
c0eafbd55de3 prefer ML_file over old uses;
wenzelm
parents: 48776
diff changeset
    13
ML_file "~~/src/Provers/blast.ML"
c0eafbd55de3 prefer ML_file over old uses;
wenzelm
parents: 48776
diff changeset
    14
ML_file "~~/src/Provers/clasimp.ML"
c0eafbd55de3 prefer ML_file over old uses;
wenzelm
parents: 48776
diff changeset
    15
ML_file "~~/src/Tools/induct.ML"
c0eafbd55de3 prefer ML_file over old uses;
wenzelm
parents: 48776
diff changeset
    16
ML_file "~~/src/Tools/case_product.ML"
c0eafbd55de3 prefer ML_file over old uses;
wenzelm
parents: 48776
diff changeset
    17
9487
7e377f912629 improved comments;
wenzelm
parents: 8643
diff changeset
    18
7e377f912629 improved comments;
wenzelm
parents: 8643
diff changeset
    19
subsection {* The classical axiom *}
4093
5e8f3d57dee7 added claset thy_data;
wenzelm
parents: 0
diff changeset
    20
41779
a68f503805ed modernized specifications;
wenzelm
parents: 41310
diff changeset
    21
axiomatization where
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 5887
diff changeset
    22
  classical: "(~P ==> P) ==> P"
4093
5e8f3d57dee7 added claset thy_data;
wenzelm
parents: 0
diff changeset
    23
9487
7e377f912629 improved comments;
wenzelm
parents: 8643
diff changeset
    24
11678
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
    25
subsection {* Lemmas and proof tools *}
9487
7e377f912629 improved comments;
wenzelm
parents: 8643
diff changeset
    26
21539
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    27
lemma ccontr: "(\<not> P \<Longrightarrow> False) \<Longrightarrow> P"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    28
  by (erule FalseE [THEN classical])
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    29
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    30
(*** Classical introduction rules for | and EX ***)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    31
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    32
lemma disjCI: "(~Q ==> P) ==> P|Q"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    33
  apply (rule classical)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    34
  apply (assumption | erule meta_mp | rule disjI1 notI)+
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    35
  apply (erule notE disjI2)+
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    36
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    37
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    38
(*introduction rule involving only EX*)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    39
lemma ex_classical:
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    40
  assumes r: "~(EX x. P(x)) ==> P(a)"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    41
  shows "EX x. P(x)"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    42
  apply (rule classical)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    43
  apply (rule exI, erule r)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    44
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    45
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    46
(*version of above, simplifying ~EX to ALL~ *)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    47
lemma exCI:
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    48
  assumes r: "ALL x. ~P(x) ==> P(a)"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    49
  shows "EX x. P(x)"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    50
  apply (rule ex_classical)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    51
  apply (rule notI [THEN allI, THEN r])
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    52
  apply (erule notE)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    53
  apply (erule exI)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    54
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    55
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    56
lemma excluded_middle: "~P | P"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    57
  apply (rule disjCI)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    58
  apply assumption
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    59
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    60
27115
0dcafa5c9e3f eliminated obsolete case_split_thm -- use case_split;
wenzelm
parents: 26496
diff changeset
    61
lemma case_split [case_names True False]:
21539
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    62
  assumes r1: "P ==> Q"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    63
    and r2: "~P ==> Q"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    64
  shows Q
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    65
  apply (rule excluded_middle [THEN disjE])
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    66
  apply (erule r2)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    67
  apply (erule r1)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    68
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    69
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    70
ML {*
27239
f2f42f9fa09d pervasive RuleInsts;
wenzelm
parents: 27211
diff changeset
    71
  fun case_tac ctxt a = res_inst_tac ctxt [(("P", 0), a)] @{thm case_split}
21539
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    72
*}
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    73
30549
d2d7874648bd simplified method setup;
wenzelm
parents: 28856
diff changeset
    74
method_setup case_tac = {*
d2d7874648bd simplified method setup;
wenzelm
parents: 28856
diff changeset
    75
  Args.goal_spec -- Scan.lift Args.name_source >>
42814
5af15f1e2ef6 simplified/unified method_setup/attribute_setup;
wenzelm
parents: 42802
diff changeset
    76
    (fn (quant, s) => fn ctxt => SIMPLE_METHOD'' quant (case_tac ctxt s))
30549
d2d7874648bd simplified method setup;
wenzelm
parents: 28856
diff changeset
    77
*} "case_tac emulation (dynamic instantiation!)"
27211
6724f31a1c8e removed unused excluded_middle_tac;
wenzelm
parents: 27115
diff changeset
    78
21539
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    79
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    80
(*** Special elimination rules *)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    81
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    82
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    83
(*Classical implies (-->) elimination. *)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    84
lemma impCE:
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    85
  assumes major: "P-->Q"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    86
    and r1: "~P ==> R"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    87
    and r2: "Q ==> R"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    88
  shows R
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    89
  apply (rule excluded_middle [THEN disjE])
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    90
   apply (erule r1)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    91
  apply (rule r2)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    92
  apply (erule major [THEN mp])
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    93
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    94
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    95
(*This version of --> elimination works on Q before P.  It works best for
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    96
  those cases in which P holds "almost everywhere".  Can't install as
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    97
  default: would break old proofs.*)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    98
lemma impCE':
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    99
  assumes major: "P-->Q"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   100
    and r1: "Q ==> R"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   101
    and r2: "~P ==> R"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   102
  shows R
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   103
  apply (rule excluded_middle [THEN disjE])
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   104
   apply (erule r2)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   105
  apply (rule r1)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   106
  apply (erule major [THEN mp])
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   107
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   108
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   109
(*Double negation law*)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   110
lemma notnotD: "~~P ==> P"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   111
  apply (rule classical)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   112
  apply (erule notE)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   113
  apply assumption
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   114
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   115
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   116
lemma contrapos2:  "[| Q; ~ P ==> ~ Q |] ==> P"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   117
  apply (rule classical)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   118
  apply (drule (1) meta_mp)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   119
  apply (erule (1) notE)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   120
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   121
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   122
(*** Tactics for implication and contradiction ***)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   123
42453
cd5005020f4e clarified simpset setup;
wenzelm
parents: 41827
diff changeset
   124
(*Classical <-> elimination.  Proof substitutes P=Q in
21539
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   125
    ~P ==> ~Q    and    P ==> Q  *)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   126
lemma iffCE:
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   127
  assumes major: "P<->Q"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   128
    and r1: "[| P; Q |] ==> R"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   129
    and r2: "[| ~P; ~Q |] ==> R"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   130
  shows R
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   131
  apply (rule major [unfolded iff_def, THEN conjE])
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   132
  apply (elim impCE)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   133
     apply (erule (1) r2)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   134
    apply (erule (1) notE)+
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   135
  apply (erule (1) r1)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   136
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   137
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   138
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   139
(*Better for fast_tac: needs no quantifier duplication!*)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   140
lemma alt_ex1E:
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   141
  assumes major: "EX! x. P(x)"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   142
    and r: "!!x. [| P(x);  ALL y y'. P(y) & P(y') --> y=y' |] ==> R"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   143
  shows R
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   144
  using major
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   145
proof (rule ex1E)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   146
  fix x
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   147
  assume * : "\<forall>y. P(y) \<longrightarrow> y = x"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   148
  assume "P(x)"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   149
  then show R
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   150
  proof (rule r)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   151
    { fix y y'
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   152
      assume "P(y)" and "P(y')"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   153
      with * have "x = y" and "x = y'" by - (tactic "IntPr.fast_tac 1")+
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   154
      then have "y = y'" by (rule subst)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   155
    } note r' = this
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   156
    show "\<forall>y y'. P(y) \<and> P(y') \<longrightarrow> y = y'" by (intro strip, elim conjE) (rule r')
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   157
  qed
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   158
qed
9525
46fb9ccae463 lemmas atomize = all_eq imp_eq;
wenzelm
parents: 9487
diff changeset
   159
26411
cd74690f3bfb pass imp_elim, swap to classical prover;
wenzelm
parents: 26286
diff changeset
   160
lemma imp_elim: "P --> Q ==> (~ R ==> P) ==> (Q ==> R) ==> R"
cd74690f3bfb pass imp_elim, swap to classical prover;
wenzelm
parents: 26286
diff changeset
   161
  by (rule classical) iprover
cd74690f3bfb pass imp_elim, swap to classical prover;
wenzelm
parents: 26286
diff changeset
   162
cd74690f3bfb pass imp_elim, swap to classical prover;
wenzelm
parents: 26286
diff changeset
   163
lemma swap: "~ P ==> (~ R ==> P) ==> R"
cd74690f3bfb pass imp_elim, swap to classical prover;
wenzelm
parents: 26286
diff changeset
   164
  by (rule classical) iprover
cd74690f3bfb pass imp_elim, swap to classical prover;
wenzelm
parents: 26286
diff changeset
   165
27849
c74905423895 tuned document;
wenzelm
parents: 27239
diff changeset
   166
c74905423895 tuned document;
wenzelm
parents: 27239
diff changeset
   167
section {* Classical Reasoner *}
c74905423895 tuned document;
wenzelm
parents: 27239
diff changeset
   168
42793
88bee9f6eec7 proper Proof.context for classical tactics;
wenzelm
parents: 42477
diff changeset
   169
ML {*
42799
4e33894aec6d modernized functor names;
wenzelm
parents: 42795
diff changeset
   170
structure Cla = Classical
42793
88bee9f6eec7 proper Proof.context for classical tactics;
wenzelm
parents: 42477
diff changeset
   171
(
88bee9f6eec7 proper Proof.context for classical tactics;
wenzelm
parents: 42477
diff changeset
   172
  val imp_elim = @{thm imp_elim}
88bee9f6eec7 proper Proof.context for classical tactics;
wenzelm
parents: 42477
diff changeset
   173
  val not_elim = @{thm notE}
88bee9f6eec7 proper Proof.context for classical tactics;
wenzelm
parents: 42477
diff changeset
   174
  val swap = @{thm swap}
88bee9f6eec7 proper Proof.context for classical tactics;
wenzelm
parents: 42477
diff changeset
   175
  val classical = @{thm classical}
88bee9f6eec7 proper Proof.context for classical tactics;
wenzelm
parents: 42477
diff changeset
   176
  val sizef = size_of_thm
88bee9f6eec7 proper Proof.context for classical tactics;
wenzelm
parents: 42477
diff changeset
   177
  val hyp_subst_tacs = [hyp_subst_tac]
88bee9f6eec7 proper Proof.context for classical tactics;
wenzelm
parents: 42477
diff changeset
   178
);
88bee9f6eec7 proper Proof.context for classical tactics;
wenzelm
parents: 42477
diff changeset
   179
88bee9f6eec7 proper Proof.context for classical tactics;
wenzelm
parents: 42477
diff changeset
   180
structure Basic_Classical: BASIC_CLASSICAL = Cla;
88bee9f6eec7 proper Proof.context for classical tactics;
wenzelm
parents: 42477
diff changeset
   181
open Basic_Classical;
88bee9f6eec7 proper Proof.context for classical tactics;
wenzelm
parents: 42477
diff changeset
   182
*}
88bee9f6eec7 proper Proof.context for classical tactics;
wenzelm
parents: 42477
diff changeset
   183
43560
d1650e3720fd ML antiquotations are managed as theory data, with proper name space and entity markup;
wenzelm
parents: 42814
diff changeset
   184
setup {*
d1650e3720fd ML antiquotations are managed as theory data, with proper name space and entity markup;
wenzelm
parents: 42814
diff changeset
   185
  ML_Antiquote.value @{binding claset}
48776
37cd53e69840 faster compilation of ML with antiquotations: static ML_context is bound once in auxiliary structure Isabelle;
wenzelm
parents: 46950
diff changeset
   186
    (Scan.succeed "Cla.claset_of ML_context")
43560
d1650e3720fd ML antiquotations are managed as theory data, with proper name space and entity markup;
wenzelm
parents: 42814
diff changeset
   187
*}
d1650e3720fd ML antiquotations are managed as theory data, with proper name space and entity markup;
wenzelm
parents: 42814
diff changeset
   188
10383
a092ae7bb2a6 "atomize" for classical tactics;
wenzelm
parents: 10130
diff changeset
   189
setup Cla.setup
42793
88bee9f6eec7 proper Proof.context for classical tactics;
wenzelm
parents: 42477
diff changeset
   190
88bee9f6eec7 proper Proof.context for classical tactics;
wenzelm
parents: 42477
diff changeset
   191
(*Propositional rules*)
88bee9f6eec7 proper Proof.context for classical tactics;
wenzelm
parents: 42477
diff changeset
   192
lemmas [intro!] = refl TrueI conjI disjCI impI notI iffI
88bee9f6eec7 proper Proof.context for classical tactics;
wenzelm
parents: 42477
diff changeset
   193
  and [elim!] = conjE disjE impCE FalseE iffCE
88bee9f6eec7 proper Proof.context for classical tactics;
wenzelm
parents: 42477
diff changeset
   194
ML {* val prop_cs = @{claset} *}
88bee9f6eec7 proper Proof.context for classical tactics;
wenzelm
parents: 42477
diff changeset
   195
88bee9f6eec7 proper Proof.context for classical tactics;
wenzelm
parents: 42477
diff changeset
   196
(*Quantifier rules*)
88bee9f6eec7 proper Proof.context for classical tactics;
wenzelm
parents: 42477
diff changeset
   197
lemmas [intro!] = allI ex_ex1I
88bee9f6eec7 proper Proof.context for classical tactics;
wenzelm
parents: 42477
diff changeset
   198
  and [intro] = exI
88bee9f6eec7 proper Proof.context for classical tactics;
wenzelm
parents: 42477
diff changeset
   199
  and [elim!] = exE alt_ex1E
88bee9f6eec7 proper Proof.context for classical tactics;
wenzelm
parents: 42477
diff changeset
   200
  and [elim] = allE
88bee9f6eec7 proper Proof.context for classical tactics;
wenzelm
parents: 42477
diff changeset
   201
ML {* val FOL_cs = @{claset} *}
10383
a092ae7bb2a6 "atomize" for classical tactics;
wenzelm
parents: 10130
diff changeset
   202
32176
893614e2c35c renamed functor BlastFun to Blast, require explicit theory;
wenzelm
parents: 32171
diff changeset
   203
ML {*
893614e2c35c renamed functor BlastFun to Blast, require explicit theory;
wenzelm
parents: 32171
diff changeset
   204
  structure Blast = Blast
893614e2c35c renamed functor BlastFun to Blast, require explicit theory;
wenzelm
parents: 32171
diff changeset
   205
  (
42477
52fa26b6c524 simplified Blast setup;
wenzelm
parents: 42459
diff changeset
   206
    structure Classical = Cla
42802
51d7e74f6899 simplified BLAST_DATA;
wenzelm
parents: 42799
diff changeset
   207
    val Trueprop_const = dest_Const @{const Trueprop}
41310
65631ca437c9 proper identifiers for consts and types;
wenzelm
parents: 36866
diff changeset
   208
    val equality_name = @{const_name eq}
32176
893614e2c35c renamed functor BlastFun to Blast, require explicit theory;
wenzelm
parents: 32171
diff changeset
   209
    val not_name = @{const_name Not}
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32261
diff changeset
   210
    val notE = @{thm notE}
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32261
diff changeset
   211
    val ccontr = @{thm ccontr}
32176
893614e2c35c renamed functor BlastFun to Blast, require explicit theory;
wenzelm
parents: 32171
diff changeset
   212
    val hyp_subst_tac = Hypsubst.blast_hyp_subst_tac
893614e2c35c renamed functor BlastFun to Blast, require explicit theory;
wenzelm
parents: 32171
diff changeset
   213
  );
893614e2c35c renamed functor BlastFun to Blast, require explicit theory;
wenzelm
parents: 32171
diff changeset
   214
  val blast_tac = Blast.blast_tac;
893614e2c35c renamed functor BlastFun to Blast, require explicit theory;
wenzelm
parents: 32171
diff changeset
   215
*}
893614e2c35c renamed functor BlastFun to Blast, require explicit theory;
wenzelm
parents: 32171
diff changeset
   216
9487
7e377f912629 improved comments;
wenzelm
parents: 8643
diff changeset
   217
setup Blast.setup
13550
5a176b8dda84 removal of blast.overloaded
paulson
parents: 12367
diff changeset
   218
5a176b8dda84 removal of blast.overloaded
paulson
parents: 12367
diff changeset
   219
5a176b8dda84 removal of blast.overloaded
paulson
parents: 12367
diff changeset
   220
lemma ex1_functional: "[| EX! z. P(a,z);  P(a,b);  P(a,c) |] ==> b = c"
21539
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   221
  by blast
20223
89d2758ecddf tuned proofs;
wenzelm
parents: 18816
diff changeset
   222
89d2758ecddf tuned proofs;
wenzelm
parents: 18816
diff changeset
   223
(* Elimination of True from asumptions: *)
89d2758ecddf tuned proofs;
wenzelm
parents: 18816
diff changeset
   224
lemma True_implies_equals: "(True ==> PROP P) == PROP P"
89d2758ecddf tuned proofs;
wenzelm
parents: 18816
diff changeset
   225
proof
89d2758ecddf tuned proofs;
wenzelm
parents: 18816
diff changeset
   226
  assume "True \<Longrightarrow> PROP P"
89d2758ecddf tuned proofs;
wenzelm
parents: 18816
diff changeset
   227
  from this and TrueI show "PROP P" .
89d2758ecddf tuned proofs;
wenzelm
parents: 18816
diff changeset
   228
next
89d2758ecddf tuned proofs;
wenzelm
parents: 18816
diff changeset
   229
  assume "PROP P"
89d2758ecddf tuned proofs;
wenzelm
parents: 18816
diff changeset
   230
  then show "PROP P" .
89d2758ecddf tuned proofs;
wenzelm
parents: 18816
diff changeset
   231
qed
9487
7e377f912629 improved comments;
wenzelm
parents: 8643
diff changeset
   232
21539
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   233
lemma uncurry: "P --> Q --> R ==> P & Q --> R"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   234
  by blast
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   235
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   236
lemma iff_allI: "(!!x. P(x) <-> Q(x)) ==> (ALL x. P(x)) <-> (ALL x. Q(x))"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   237
  by blast
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   238
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   239
lemma iff_exI: "(!!x. P(x) <-> Q(x)) ==> (EX x. P(x)) <-> (EX x. Q(x))"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   240
  by blast
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   241
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   242
lemma all_comm: "(ALL x y. P(x,y)) <-> (ALL y x. P(x,y))" by blast
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   243
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   244
lemma ex_comm: "(EX x y. P(x,y)) <-> (EX y x. P(x,y))" by blast
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   245
26286
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   246
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   247
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   248
(*** Classical simplification rules ***)
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   249
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   250
(*Avoids duplication of subgoals after expand_if, when the true and false
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   251
  cases boil down to the same thing.*)
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   252
lemma cases_simp: "(P --> Q) & (~P --> Q) <-> Q" by blast
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   253
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   254
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   255
(*** Miniscoping: pushing quantifiers in
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   256
     We do NOT distribute of ALL over &, or dually that of EX over |
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   257
     Baaz and Leitsch, On Skolemization and Proof Complexity (1994)
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   258
     show that this step can increase proof length!
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   259
***)
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   260
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   261
(*existential miniscoping*)
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   262
lemma int_ex_simps:
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   263
  "!!P Q. (EX x. P(x) & Q) <-> (EX x. P(x)) & Q"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   264
  "!!P Q. (EX x. P & Q(x)) <-> P & (EX x. Q(x))"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   265
  "!!P Q. (EX x. P(x) | Q) <-> (EX x. P(x)) | Q"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   266
  "!!P Q. (EX x. P | Q(x)) <-> P | (EX x. Q(x))"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   267
  by iprover+
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   268
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   269
(*classical rules*)
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   270
lemma cla_ex_simps:
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   271
  "!!P Q. (EX x. P(x) --> Q) <-> (ALL x. P(x)) --> Q"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   272
  "!!P Q. (EX x. P --> Q(x)) <-> P --> (EX x. Q(x))"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   273
  by blast+
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   274
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   275
lemmas ex_simps = int_ex_simps cla_ex_simps
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   276
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   277
(*universal miniscoping*)
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   278
lemma int_all_simps:
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   279
  "!!P Q. (ALL x. P(x) & Q) <-> (ALL x. P(x)) & Q"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   280
  "!!P Q. (ALL x. P & Q(x)) <-> P & (ALL x. Q(x))"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   281
  "!!P Q. (ALL x. P(x) --> Q) <-> (EX x. P(x)) --> Q"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   282
  "!!P Q. (ALL x. P --> Q(x)) <-> P --> (ALL x. Q(x))"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   283
  by iprover+
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   284
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   285
(*classical rules*)
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   286
lemma cla_all_simps:
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   287
  "!!P Q. (ALL x. P(x) | Q) <-> (ALL x. P(x)) | Q"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   288
  "!!P Q. (ALL x. P | Q(x)) <-> P | (ALL x. Q(x))"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   289
  by blast+
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   290
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   291
lemmas all_simps = int_all_simps cla_all_simps
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   292
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   293
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   294
(*** Named rewrite rules proved for IFOL ***)
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   295
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   296
lemma imp_disj1: "(P-->Q) | R <-> (P-->Q | R)" by blast
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   297
lemma imp_disj2: "Q | (P-->R) <-> (P-->Q | R)" by blast
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   298
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   299
lemma de_Morgan_conj: "(~(P & Q)) <-> (~P | ~Q)" by blast
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   300
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   301
lemma not_imp: "~(P --> Q) <-> (P & ~Q)" by blast
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   302
lemma not_iff: "~(P <-> Q) <-> (P <-> ~Q)" by blast
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   303
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   304
lemma not_all: "(~ (ALL x. P(x))) <-> (EX x.~P(x))" by blast
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   305
lemma imp_all: "((ALL x. P(x)) --> Q) <-> (EX x. P(x) --> Q)" by blast
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   306
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   307
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   308
lemmas meta_simps =
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   309
  triv_forall_equality (* prunes params *)
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   310
  True_implies_equals  (* prune asms `True' *)
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   311
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   312
lemmas IFOL_simps =
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   313
  refl [THEN P_iff_T] conj_simps disj_simps not_simps
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   314
  imp_simps iff_simps quant_simps
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   315
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   316
lemma notFalseI: "~False" by iprover
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   317
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   318
lemma cla_simps_misc:
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   319
  "~(P&Q) <-> ~P | ~Q"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   320
  "P | ~P"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   321
  "~P | P"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   322
  "~ ~ P <-> P"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   323
  "(~P --> P) <-> P"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   324
  "(~P <-> ~Q) <-> (P<->Q)" by blast+
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   325
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   326
lemmas cla_simps =
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   327
  de_Morgan_conj de_Morgan_disj imp_disj1 imp_disj2
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   328
  not_imp not_all not_ex cases_simp cla_simps_misc
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   329
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   330
48891
c0eafbd55de3 prefer ML_file over old uses;
wenzelm
parents: 48776
diff changeset
   331
ML_file "simpdata.ML"
42455
6702c984bf5a modernized Quantifier1 simproc setup;
wenzelm
parents: 42453
diff changeset
   332
42459
38b9f023cc34 misc tuning and simplification;
wenzelm
parents: 42456
diff changeset
   333
simproc_setup defined_Ex ("EX x. P(x)") = {* fn _ => Quantifier1.rearrange_ex *}
38b9f023cc34 misc tuning and simplification;
wenzelm
parents: 42456
diff changeset
   334
simproc_setup defined_All ("ALL x. P(x)") = {* fn _ => Quantifier1.rearrange_all *}
42455
6702c984bf5a modernized Quantifier1 simproc setup;
wenzelm
parents: 42453
diff changeset
   335
42453
cd5005020f4e clarified simpset setup;
wenzelm
parents: 41827
diff changeset
   336
ML {*
cd5005020f4e clarified simpset setup;
wenzelm
parents: 41827
diff changeset
   337
(*intuitionistic simprules only*)
cd5005020f4e clarified simpset setup;
wenzelm
parents: 41827
diff changeset
   338
val IFOL_ss =
cd5005020f4e clarified simpset setup;
wenzelm
parents: 41827
diff changeset
   339
  FOL_basic_ss
45654
cf10bde35973 more antiquotations;
wenzelm
parents: 45620
diff changeset
   340
  addsimps @{thms meta_simps IFOL_simps int_ex_simps int_all_simps}
42455
6702c984bf5a modernized Quantifier1 simproc setup;
wenzelm
parents: 42453
diff changeset
   341
  addsimprocs [@{simproc defined_All}, @{simproc defined_Ex}]
45620
f2a587696afb modernized some old-style infix operations, which were left over from the time of ML proof scripts;
wenzelm
parents: 45594
diff changeset
   342
  |> Simplifier.add_cong @{thm imp_cong};
42453
cd5005020f4e clarified simpset setup;
wenzelm
parents: 41827
diff changeset
   343
cd5005020f4e clarified simpset setup;
wenzelm
parents: 41827
diff changeset
   344
(*classical simprules too*)
45654
cf10bde35973 more antiquotations;
wenzelm
parents: 45620
diff changeset
   345
val FOL_ss = IFOL_ss addsimps @{thms cla_simps cla_ex_simps cla_all_simps};
42453
cd5005020f4e clarified simpset setup;
wenzelm
parents: 41827
diff changeset
   346
*}
cd5005020f4e clarified simpset setup;
wenzelm
parents: 41827
diff changeset
   347
42795
66fcc9882784 clarified map_simpset versus Simplifier.map_simpset_global;
wenzelm
parents: 42793
diff changeset
   348
setup {* Simplifier.map_simpset_global (K FOL_ss) *}
42455
6702c984bf5a modernized Quantifier1 simproc setup;
wenzelm
parents: 42453
diff changeset
   349
9487
7e377f912629 improved comments;
wenzelm
parents: 8643
diff changeset
   350
setup "Simplifier.method_setup Splitter.split_modifiers"
7e377f912629 improved comments;
wenzelm
parents: 8643
diff changeset
   351
setup Splitter.setup
26496
49ae9456eba9 purely functional setup of claset/simpset/clasimpset;
wenzelm
parents: 26411
diff changeset
   352
setup clasimp_setup
18591
04b9f2bf5a48 tuned EqSubst setup;
wenzelm
parents: 18531
diff changeset
   353
setup EqSubst.setup
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 15019
diff changeset
   354
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 15019
diff changeset
   355
14085
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   356
subsection {* Other simple lemmas *}
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   357
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   358
lemma [simp]: "((P-->R) <-> (Q-->R)) <-> ((P<->Q) | R)"
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   359
by blast
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   360
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   361
lemma [simp]: "((P-->Q) <-> (P-->R)) <-> (P --> (Q<->R))"
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   362
by blast
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   363
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   364
lemma not_disj_iff_imp: "~P | Q <-> (P-->Q)"
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   365
by blast
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   366
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   367
(** Monotonicity of implications **)
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   368
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   369
lemma conj_mono: "[| P1-->Q1; P2-->Q2 |] ==> (P1&P2) --> (Q1&Q2)"
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   370
by fast (*or (IntPr.fast_tac 1)*)
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   371
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   372
lemma disj_mono: "[| P1-->Q1; P2-->Q2 |] ==> (P1|P2) --> (Q1|Q2)"
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   373
by fast (*or (IntPr.fast_tac 1)*)
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   374
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   375
lemma imp_mono: "[| Q1-->P1; P2-->Q2 |] ==> (P1-->P2)-->(Q1-->Q2)"
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   376
by fast (*or (IntPr.fast_tac 1)*)
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   377
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   378
lemma imp_refl: "P-->P"
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   379
by (rule impI, assumption)
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   380
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   381
(*The quantifier monotonicity rules are also intuitionistically valid*)
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   382
lemma ex_mono: "(!!x. P(x) --> Q(x)) ==> (EX x. P(x)) --> (EX x. Q(x))"
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   383
by blast
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   384
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   385
lemma all_mono: "(!!x. P(x) --> Q(x)) ==> (ALL x. P(x)) --> (ALL x. Q(x))"
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   386
by blast
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   387
11678
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   388
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   389
subsection {* Proof by cases and induction *}
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   390
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   391
text {* Proper handling of non-atomic rule statements. *}
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   392
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 36176
diff changeset
   393
definition "induct_forall(P) == \<forall>x. P(x)"
426d5781bb25 modernized specifications;
wenzelm
parents: 36176
diff changeset
   394
definition "induct_implies(A, B) == A \<longrightarrow> B"
426d5781bb25 modernized specifications;
wenzelm
parents: 36176
diff changeset
   395
definition "induct_equal(x, y) == x = y"
426d5781bb25 modernized specifications;
wenzelm
parents: 36176
diff changeset
   396
definition "induct_conj(A, B) == A \<and> B"
11678
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   397
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   398
lemma induct_forall_eq: "(!!x. P(x)) == Trueprop(induct_forall(\<lambda>x. P(x)))"
18816
aebd7f315b92 tuned proofs;
wenzelm
parents: 18595
diff changeset
   399
  unfolding atomize_all induct_forall_def .
11678
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   400
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   401
lemma induct_implies_eq: "(A ==> B) == Trueprop(induct_implies(A, B))"
18816
aebd7f315b92 tuned proofs;
wenzelm
parents: 18595
diff changeset
   402
  unfolding atomize_imp induct_implies_def .
11678
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   403
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   404
lemma induct_equal_eq: "(x == y) == Trueprop(induct_equal(x, y))"
18816
aebd7f315b92 tuned proofs;
wenzelm
parents: 18595
diff changeset
   405
  unfolding atomize_eq induct_equal_def .
11678
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   406
28856
5e009a80fe6d Pure syntax: more coherent treatment of aprop, permanent TERM and &&&;
wenzelm
parents: 28699
diff changeset
   407
lemma induct_conj_eq: "(A &&& B) == Trueprop(induct_conj(A, B))"
18816
aebd7f315b92 tuned proofs;
wenzelm
parents: 18595
diff changeset
   408
  unfolding atomize_conj induct_conj_def .
11988
8340fb172607 induct_impliesI;
wenzelm
parents: 11848
diff changeset
   409
18456
8cc35e95450a updated auxiliary facts for induct method;
wenzelm
parents: 16417
diff changeset
   410
lemmas induct_atomize = induct_forall_eq induct_implies_eq induct_equal_eq induct_conj_eq
45594
wenzelm
parents: 43560
diff changeset
   411
lemmas induct_rulify [symmetric] = induct_atomize
18456
8cc35e95450a updated auxiliary facts for induct method;
wenzelm
parents: 16417
diff changeset
   412
lemmas induct_rulify_fallback =
8cc35e95450a updated auxiliary facts for induct method;
wenzelm
parents: 16417
diff changeset
   413
  induct_forall_def induct_implies_def induct_equal_def induct_conj_def
11678
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   414
36176
3fe7e97ccca8 replaced generic 'hide' command by more conventional 'hide_class', 'hide_type', 'hide_const', 'hide_fact' -- frees some popular keywords;
wenzelm
parents: 34989
diff changeset
   415
hide_const induct_forall induct_implies induct_equal induct_conj
11678
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   416
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   417
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   418
text {* Method setup. *}
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   419
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   420
ML {*
32171
220abde9962b renamed functor InductFun to Induct;
wenzelm
parents: 31974
diff changeset
   421
  structure Induct = Induct
24830
a7b3ab44d993 moved Pure/Isar/induct_attrib.ML and Provers/induct_method.ML to Tools/induct.ML;
wenzelm
parents: 24097
diff changeset
   422
  (
22139
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   423
    val cases_default = @{thm case_split}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   424
    val atomize = @{thms induct_atomize}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   425
    val rulify = @{thms induct_rulify}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   426
    val rulify_fallback = @{thms induct_rulify_fallback}
34989
b5c6e59e2cd7 Adapted to changes in setup of cases method.
berghofe
parents: 34914
diff changeset
   427
    val equal_def = @{thm induct_equal_def}
34914
e391c3de0f6b Adapted to changes in setup of induct method.
berghofe
parents: 32960
diff changeset
   428
    fun dest_def _ = NONE
e391c3de0f6b Adapted to changes in setup of induct method.
berghofe
parents: 32960
diff changeset
   429
    fun trivial_tac _ = no_tac
24830
a7b3ab44d993 moved Pure/Isar/induct_attrib.ML and Provers/induct_method.ML to Tools/induct.ML;
wenzelm
parents: 24097
diff changeset
   430
  );
11678
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   431
*}
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   432
24830
a7b3ab44d993 moved Pure/Isar/induct_attrib.ML and Provers/induct_method.ML to Tools/induct.ML;
wenzelm
parents: 24097
diff changeset
   433
setup Induct.setup
a7b3ab44d993 moved Pure/Isar/induct_attrib.ML and Provers/induct_method.ML to Tools/induct.ML;
wenzelm
parents: 24097
diff changeset
   434
declare case_split [cases type: o]
11678
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   435
41827
98eda7ffde79 setup case_product attribute in HOL and FOL
noschinl
parents: 41779
diff changeset
   436
setup Case_Product.setup
98eda7ffde79 setup case_product attribute in HOL and FOL
noschinl
parents: 41779
diff changeset
   437
41310
65631ca437c9 proper identifiers for consts and types;
wenzelm
parents: 36866
diff changeset
   438
65631ca437c9 proper identifiers for consts and types;
wenzelm
parents: 36866
diff changeset
   439
hide_const (open) eq
65631ca437c9 proper identifiers for consts and types;
wenzelm
parents: 36866
diff changeset
   440
4854
d1850e0964f2 tuned setup;
wenzelm
parents: 4793
diff changeset
   441
end