src/FOL/FOL.thy
author wenzelm
Wed, 25 Sep 2013 12:42:56 +0200
changeset 53873 08594daabcd9
parent 52241 5f6e885382e9
child 55111 5792f5106c40
permissions -rw-r--r--
tuned proofs;
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')"
51798
ad3a241def73 uniform Proof.context for hyp_subst_tac;
wenzelm
parents: 51717
diff changeset
   153
      with * have "x = y" and "x = y'" by - (tactic "IntPr.fast_tac @{context} 1")+
21539
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
10383
a092ae7bb2a6 "atomize" for classical tactics;
wenzelm
parents: 10130
diff changeset
   184
setup Cla.setup
42793
88bee9f6eec7 proper Proof.context for classical tactics;
wenzelm
parents: 42477
diff changeset
   185
88bee9f6eec7 proper Proof.context for classical tactics;
wenzelm
parents: 42477
diff changeset
   186
(*Propositional rules*)
88bee9f6eec7 proper Proof.context for classical tactics;
wenzelm
parents: 42477
diff changeset
   187
lemmas [intro!] = refl TrueI conjI disjCI impI notI iffI
88bee9f6eec7 proper Proof.context for classical tactics;
wenzelm
parents: 42477
diff changeset
   188
  and [elim!] = conjE disjE impCE FalseE iffCE
51687
3d8720271ebf discontinued obsolete ML antiquotation @{claset};
wenzelm
parents: 48891
diff changeset
   189
ML {* val prop_cs = claset_of @{context} *}
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
(*Quantifier rules*)
88bee9f6eec7 proper Proof.context for classical tactics;
wenzelm
parents: 42477
diff changeset
   192
lemmas [intro!] = allI ex_ex1I
88bee9f6eec7 proper Proof.context for classical tactics;
wenzelm
parents: 42477
diff changeset
   193
  and [intro] = exI
88bee9f6eec7 proper Proof.context for classical tactics;
wenzelm
parents: 42477
diff changeset
   194
  and [elim!] = exE alt_ex1E
88bee9f6eec7 proper Proof.context for classical tactics;
wenzelm
parents: 42477
diff changeset
   195
  and [elim] = allE
51687
3d8720271ebf discontinued obsolete ML antiquotation @{claset};
wenzelm
parents: 48891
diff changeset
   196
ML {* val FOL_cs = claset_of @{context} *}
10383
a092ae7bb2a6 "atomize" for classical tactics;
wenzelm
parents: 10130
diff changeset
   197
32176
893614e2c35c renamed functor BlastFun to Blast, require explicit theory;
wenzelm
parents: 32171
diff changeset
   198
ML {*
893614e2c35c renamed functor BlastFun to Blast, require explicit theory;
wenzelm
parents: 32171
diff changeset
   199
  structure Blast = Blast
893614e2c35c renamed functor BlastFun to Blast, require explicit theory;
wenzelm
parents: 32171
diff changeset
   200
  (
42477
52fa26b6c524 simplified Blast setup;
wenzelm
parents: 42459
diff changeset
   201
    structure Classical = Cla
42802
51d7e74f6899 simplified BLAST_DATA;
wenzelm
parents: 42799
diff changeset
   202
    val Trueprop_const = dest_Const @{const Trueprop}
41310
65631ca437c9 proper identifiers for consts and types;
wenzelm
parents: 36866
diff changeset
   203
    val equality_name = @{const_name eq}
32176
893614e2c35c renamed functor BlastFun to Blast, require explicit theory;
wenzelm
parents: 32171
diff changeset
   204
    val not_name = @{const_name Not}
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32261
diff changeset
   205
    val notE = @{thm notE}
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 32261
diff changeset
   206
    val ccontr = @{thm ccontr}
32176
893614e2c35c renamed functor BlastFun to Blast, require explicit theory;
wenzelm
parents: 32171
diff changeset
   207
    val hyp_subst_tac = Hypsubst.blast_hyp_subst_tac
893614e2c35c renamed functor BlastFun to Blast, require explicit theory;
wenzelm
parents: 32171
diff changeset
   208
  );
893614e2c35c renamed functor BlastFun to Blast, require explicit theory;
wenzelm
parents: 32171
diff changeset
   209
  val blast_tac = Blast.blast_tac;
893614e2c35c renamed functor BlastFun to Blast, require explicit theory;
wenzelm
parents: 32171
diff changeset
   210
*}
893614e2c35c renamed functor BlastFun to Blast, require explicit theory;
wenzelm
parents: 32171
diff changeset
   211
9487
7e377f912629 improved comments;
wenzelm
parents: 8643
diff changeset
   212
setup Blast.setup
13550
5a176b8dda84 removal of blast.overloaded
paulson
parents: 12367
diff changeset
   213
5a176b8dda84 removal of blast.overloaded
paulson
parents: 12367
diff changeset
   214
5a176b8dda84 removal of blast.overloaded
paulson
parents: 12367
diff changeset
   215
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
   216
  by blast
20223
89d2758ecddf tuned proofs;
wenzelm
parents: 18816
diff changeset
   217
89d2758ecddf tuned proofs;
wenzelm
parents: 18816
diff changeset
   218
(* Elimination of True from asumptions: *)
89d2758ecddf tuned proofs;
wenzelm
parents: 18816
diff changeset
   219
lemma True_implies_equals: "(True ==> PROP P) == PROP P"
89d2758ecddf tuned proofs;
wenzelm
parents: 18816
diff changeset
   220
proof
89d2758ecddf tuned proofs;
wenzelm
parents: 18816
diff changeset
   221
  assume "True \<Longrightarrow> PROP P"
89d2758ecddf tuned proofs;
wenzelm
parents: 18816
diff changeset
   222
  from this and TrueI show "PROP P" .
89d2758ecddf tuned proofs;
wenzelm
parents: 18816
diff changeset
   223
next
89d2758ecddf tuned proofs;
wenzelm
parents: 18816
diff changeset
   224
  assume "PROP P"
89d2758ecddf tuned proofs;
wenzelm
parents: 18816
diff changeset
   225
  then show "PROP P" .
89d2758ecddf tuned proofs;
wenzelm
parents: 18816
diff changeset
   226
qed
9487
7e377f912629 improved comments;
wenzelm
parents: 8643
diff changeset
   227
21539
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   228
lemma uncurry: "P --> Q --> R ==> P & Q --> R"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   229
  by blast
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   230
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   231
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
   232
  by blast
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   233
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   234
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
   235
  by blast
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   236
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   237
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
   238
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   239
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
   240
26286
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   241
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   242
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   243
(*** Classical simplification rules ***)
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   244
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   245
(*Avoids duplication of subgoals after expand_if, when the true and false
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   246
  cases boil down to the same thing.*)
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   247
lemma cases_simp: "(P --> Q) & (~P --> Q) <-> Q" by blast
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   248
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   249
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   250
(*** Miniscoping: pushing quantifiers in
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   251
     We do NOT distribute of ALL over &, or dually that of EX over |
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   252
     Baaz and Leitsch, On Skolemization and Proof Complexity (1994)
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   253
     show that this step can increase proof length!
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   254
***)
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   255
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   256
(*existential miniscoping*)
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   257
lemma int_ex_simps:
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   258
  "!!P Q. (EX x. P(x) & Q) <-> (EX x. P(x)) & Q"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   259
  "!!P Q. (EX x. P & Q(x)) <-> P & (EX x. Q(x))"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   260
  "!!P Q. (EX x. P(x) | Q) <-> (EX x. P(x)) | Q"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   261
  "!!P Q. (EX x. P | Q(x)) <-> P | (EX x. Q(x))"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   262
  by iprover+
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   263
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   264
(*classical rules*)
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   265
lemma cla_ex_simps:
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   266
  "!!P Q. (EX x. P(x) --> Q) <-> (ALL x. P(x)) --> Q"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   267
  "!!P Q. (EX x. P --> Q(x)) <-> P --> (EX x. Q(x))"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   268
  by blast+
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   269
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   270
lemmas ex_simps = int_ex_simps cla_ex_simps
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   271
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   272
(*universal miniscoping*)
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   273
lemma int_all_simps:
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   274
  "!!P Q. (ALL x. P(x) & Q) <-> (ALL x. P(x)) & Q"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   275
  "!!P Q. (ALL x. P & Q(x)) <-> P & (ALL x. Q(x))"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   276
  "!!P Q. (ALL x. P(x) --> Q) <-> (EX x. P(x)) --> Q"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   277
  "!!P Q. (ALL x. P --> Q(x)) <-> P --> (ALL x. Q(x))"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   278
  by iprover+
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   279
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   280
(*classical rules*)
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   281
lemma cla_all_simps:
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   282
  "!!P Q. (ALL x. P(x) | Q) <-> (ALL x. P(x)) | Q"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   283
  "!!P Q. (ALL x. P | Q(x)) <-> P | (ALL x. Q(x))"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   284
  by blast+
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   285
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   286
lemmas all_simps = int_all_simps cla_all_simps
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   287
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   288
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   289
(*** Named rewrite rules proved for IFOL ***)
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   290
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   291
lemma imp_disj1: "(P-->Q) | R <-> (P-->Q | R)" by blast
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   292
lemma imp_disj2: "Q | (P-->R) <-> (P-->Q | R)" by blast
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   293
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   294
lemma de_Morgan_conj: "(~(P & Q)) <-> (~P | ~Q)" by blast
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 not_imp: "~(P --> Q) <-> (P & ~Q)" by blast
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   297
lemma not_iff: "~(P <-> Q) <-> (P <-> ~Q)" 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 not_all: "(~ (ALL x. P(x))) <-> (EX x.~P(x))" by blast
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   300
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
   301
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   302
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   303
lemmas meta_simps =
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   304
  triv_forall_equality (* prunes params *)
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   305
  True_implies_equals  (* prune asms `True' *)
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   306
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   307
lemmas IFOL_simps =
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   308
  refl [THEN P_iff_T] conj_simps disj_simps not_simps
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   309
  imp_simps iff_simps quant_simps
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   310
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   311
lemma notFalseI: "~False" by iprover
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   312
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   313
lemma cla_simps_misc:
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   314
  "~(P&Q) <-> ~P | ~Q"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   315
  "P | ~P"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   316
  "~P | P"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   317
  "~ ~ P <-> P"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   318
  "(~P --> P) <-> P"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   319
  "(~P <-> ~Q) <-> (P<->Q)" by blast+
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   320
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   321
lemmas cla_simps =
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   322
  de_Morgan_conj de_Morgan_disj imp_disj1 imp_disj2
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   323
  not_imp not_all not_ex cases_simp cla_simps_misc
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   324
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   325
48891
c0eafbd55de3 prefer ML_file over old uses;
wenzelm
parents: 48776
diff changeset
   326
ML_file "simpdata.ML"
42455
6702c984bf5a modernized Quantifier1 simproc setup;
wenzelm
parents: 42453
diff changeset
   327
42459
38b9f023cc34 misc tuning and simplification;
wenzelm
parents: 42456
diff changeset
   328
simproc_setup defined_Ex ("EX x. P(x)") = {* fn _ => Quantifier1.rearrange_ex *}
38b9f023cc34 misc tuning and simplification;
wenzelm
parents: 42456
diff changeset
   329
simproc_setup defined_All ("ALL x. P(x)") = {* fn _ => Quantifier1.rearrange_all *}
42455
6702c984bf5a modernized Quantifier1 simproc setup;
wenzelm
parents: 42453
diff changeset
   330
42453
cd5005020f4e clarified simpset setup;
wenzelm
parents: 41827
diff changeset
   331
ML {*
cd5005020f4e clarified simpset setup;
wenzelm
parents: 41827
diff changeset
   332
(*intuitionistic simprules only*)
cd5005020f4e clarified simpset setup;
wenzelm
parents: 41827
diff changeset
   333
val IFOL_ss =
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 51687
diff changeset
   334
  put_simpset FOL_basic_ss @{context}
45654
cf10bde35973 more antiquotations;
wenzelm
parents: 45620
diff changeset
   335
  addsimps @{thms meta_simps IFOL_simps int_ex_simps int_all_simps}
42455
6702c984bf5a modernized Quantifier1 simproc setup;
wenzelm
parents: 42453
diff changeset
   336
  addsimprocs [@{simproc defined_All}, @{simproc defined_Ex}]
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 51687
diff changeset
   337
  |> Simplifier.add_cong @{thm imp_cong}
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 51687
diff changeset
   338
  |> simpset_of;
42453
cd5005020f4e clarified simpset setup;
wenzelm
parents: 41827
diff changeset
   339
cd5005020f4e clarified simpset setup;
wenzelm
parents: 41827
diff changeset
   340
(*classical simprules too*)
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 51687
diff changeset
   341
val FOL_ss =
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 51687
diff changeset
   342
  put_simpset IFOL_ss @{context}
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 51687
diff changeset
   343
  addsimps @{thms cla_simps cla_ex_simps cla_all_simps}
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 51687
diff changeset
   344
  |> simpset_of;
42453
cd5005020f4e clarified simpset setup;
wenzelm
parents: 41827
diff changeset
   345
*}
cd5005020f4e clarified simpset setup;
wenzelm
parents: 41827
diff changeset
   346
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 51687
diff changeset
   347
setup {* map_theory_simpset (put_simpset FOL_ss) *}
42455
6702c984bf5a modernized Quantifier1 simproc setup;
wenzelm
parents: 42453
diff changeset
   348
9487
7e377f912629 improved comments;
wenzelm
parents: 8643
diff changeset
   349
setup "Simplifier.method_setup Splitter.split_modifiers"
7e377f912629 improved comments;
wenzelm
parents: 8643
diff changeset
   350
setup Splitter.setup
26496
49ae9456eba9 purely functional setup of claset/simpset/clasimpset;
wenzelm
parents: 26411
diff changeset
   351
setup clasimp_setup
52241
5f6e885382e9 tuned import;
wenzelm
parents: 51798
diff changeset
   352
5f6e885382e9 tuned import;
wenzelm
parents: 51798
diff changeset
   353
ML_file "~~/src/Tools/eqsubst.ML"
18591
04b9f2bf5a48 tuned EqSubst setup;
wenzelm
parents: 18531
diff changeset
   354
setup EqSubst.setup
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 15019
diff changeset
   355
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 15019
diff changeset
   356
14085
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   357
subsection {* Other simple lemmas *}
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   358
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   359
lemma [simp]: "((P-->R) <-> (Q-->R)) <-> ((P<->Q) | R)"
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   360
by blast
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   361
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   362
lemma [simp]: "((P-->Q) <-> (P-->R)) <-> (P --> (Q<->R))"
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   363
by blast
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   364
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   365
lemma not_disj_iff_imp: "~P | Q <-> (P-->Q)"
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   366
by blast
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   367
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   368
(** Monotonicity of implications **)
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   369
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   370
lemma conj_mono: "[| P1-->Q1; P2-->Q2 |] ==> (P1&P2) --> (Q1&Q2)"
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   371
by fast (*or (IntPr.fast_tac 1)*)
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   372
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   373
lemma disj_mono: "[| P1-->Q1; P2-->Q2 |] ==> (P1|P2) --> (Q1|Q2)"
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   374
by fast (*or (IntPr.fast_tac 1)*)
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   375
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   376
lemma imp_mono: "[| Q1-->P1; P2-->Q2 |] ==> (P1-->P2)-->(Q1-->Q2)"
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   377
by fast (*or (IntPr.fast_tac 1)*)
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   378
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   379
lemma imp_refl: "P-->P"
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   380
by (rule impI, assumption)
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   381
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   382
(*The quantifier monotonicity rules are also intuitionistically valid*)
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   383
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
   384
by blast
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   385
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   386
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
   387
by blast
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   388
11678
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   389
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   390
subsection {* Proof by cases and induction *}
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   391
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   392
text {* Proper handling of non-atomic rule statements. *}
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   393
36866
426d5781bb25 modernized specifications;
wenzelm
parents: 36176
diff changeset
   394
definition "induct_forall(P) == \<forall>x. P(x)"
426d5781bb25 modernized specifications;
wenzelm
parents: 36176
diff changeset
   395
definition "induct_implies(A, B) == A \<longrightarrow> B"
426d5781bb25 modernized specifications;
wenzelm
parents: 36176
diff changeset
   396
definition "induct_equal(x, y) == x = y"
426d5781bb25 modernized specifications;
wenzelm
parents: 36176
diff changeset
   397
definition "induct_conj(A, B) == A \<and> B"
11678
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   398
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   399
lemma induct_forall_eq: "(!!x. P(x)) == Trueprop(induct_forall(\<lambda>x. P(x)))"
18816
aebd7f315b92 tuned proofs;
wenzelm
parents: 18595
diff changeset
   400
  unfolding atomize_all induct_forall_def .
11678
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   401
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   402
lemma induct_implies_eq: "(A ==> B) == Trueprop(induct_implies(A, B))"
18816
aebd7f315b92 tuned proofs;
wenzelm
parents: 18595
diff changeset
   403
  unfolding atomize_imp induct_implies_def .
11678
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   404
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   405
lemma induct_equal_eq: "(x == y) == Trueprop(induct_equal(x, y))"
18816
aebd7f315b92 tuned proofs;
wenzelm
parents: 18595
diff changeset
   406
  unfolding atomize_eq induct_equal_def .
11678
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   407
28856
5e009a80fe6d Pure syntax: more coherent treatment of aprop, permanent TERM and &&&;
wenzelm
parents: 28699
diff changeset
   408
lemma induct_conj_eq: "(A &&& B) == Trueprop(induct_conj(A, B))"
18816
aebd7f315b92 tuned proofs;
wenzelm
parents: 18595
diff changeset
   409
  unfolding atomize_conj induct_conj_def .
11988
8340fb172607 induct_impliesI;
wenzelm
parents: 11848
diff changeset
   410
18456
8cc35e95450a updated auxiliary facts for induct method;
wenzelm
parents: 16417
diff changeset
   411
lemmas induct_atomize = induct_forall_eq induct_implies_eq induct_equal_eq induct_conj_eq
45594
wenzelm
parents: 43560
diff changeset
   412
lemmas induct_rulify [symmetric] = induct_atomize
18456
8cc35e95450a updated auxiliary facts for induct method;
wenzelm
parents: 16417
diff changeset
   413
lemmas induct_rulify_fallback =
8cc35e95450a updated auxiliary facts for induct method;
wenzelm
parents: 16417
diff changeset
   414
  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
   415
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
   416
hide_const induct_forall induct_implies induct_equal induct_conj
11678
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
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   419
text {* Method setup. *}
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   420
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   421
ML {*
32171
220abde9962b renamed functor InductFun to Induct;
wenzelm
parents: 31974
diff changeset
   422
  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
   423
  (
22139
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   424
    val cases_default = @{thm case_split}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   425
    val atomize = @{thms induct_atomize}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   426
    val rulify = @{thms induct_rulify}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   427
    val rulify_fallback = @{thms induct_rulify_fallback}
34989
b5c6e59e2cd7 Adapted to changes in setup of cases method.
berghofe
parents: 34914
diff changeset
   428
    val equal_def = @{thm induct_equal_def}
34914
e391c3de0f6b Adapted to changes in setup of induct method.
berghofe
parents: 32960
diff changeset
   429
    fun dest_def _ = NONE
e391c3de0f6b Adapted to changes in setup of induct method.
berghofe
parents: 32960
diff changeset
   430
    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
   431
  );
11678
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   432
*}
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   433
24830
a7b3ab44d993 moved Pure/Isar/induct_attrib.ML and Provers/induct_method.ML to Tools/induct.ML;
wenzelm
parents: 24097
diff changeset
   434
setup Induct.setup
a7b3ab44d993 moved Pure/Isar/induct_attrib.ML and Provers/induct_method.ML to Tools/induct.ML;
wenzelm
parents: 24097
diff changeset
   435
declare case_split [cases type: o]
11678
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   436
41827
98eda7ffde79 setup case_product attribute in HOL and FOL
noschinl
parents: 41779
diff changeset
   437
setup Case_Product.setup
98eda7ffde79 setup case_product attribute in HOL and FOL
noschinl
parents: 41779
diff changeset
   438
41310
65631ca437c9 proper identifiers for consts and types;
wenzelm
parents: 36866
diff changeset
   439
65631ca437c9 proper identifiers for consts and types;
wenzelm
parents: 36866
diff changeset
   440
hide_const (open) eq
65631ca437c9 proper identifiers for consts and types;
wenzelm
parents: 36866
diff changeset
   441
4854
d1850e0964f2 tuned setup;
wenzelm
parents: 4793
diff changeset
   442
end