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