src/FOL/FOL.thy
author wenzelm
Sun, 26 Nov 2006 23:43:53 +0100
changeset 21539 c5cf9243ad62
parent 20223 89d2758ecddf
child 22139 539a63b98f76
permissions -rw-r--r--
converted legacy ML scripts;
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
    ID:         $Id$
7e377f912629 improved comments;
wenzelm
parents: 8643
diff changeset
     3
    Author:     Lawrence C Paulson and Markus Wenzel
11678
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
     4
*)
9487
7e377f912629 improved comments;
wenzelm
parents: 8643
diff changeset
     5
11678
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
     6
header {* Classical first-order logic *}
4093
5e8f3d57dee7 added claset thy_data;
wenzelm
parents: 0
diff changeset
     7
18456
8cc35e95450a updated auxiliary facts for induct method;
wenzelm
parents: 16417
diff changeset
     8
theory FOL
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 15019
diff changeset
     9
imports IFOL
21539
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    10
uses ("cladata.ML") ("blastdata.ML") ("simpdata.ML")
18456
8cc35e95450a updated auxiliary facts for induct method;
wenzelm
parents: 16417
diff changeset
    11
begin
9487
7e377f912629 improved comments;
wenzelm
parents: 8643
diff changeset
    12
7e377f912629 improved comments;
wenzelm
parents: 8643
diff changeset
    13
7e377f912629 improved comments;
wenzelm
parents: 8643
diff changeset
    14
subsection {* The classical axiom *}
4093
5e8f3d57dee7 added claset thy_data;
wenzelm
parents: 0
diff changeset
    15
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 5887
diff changeset
    16
axioms
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 5887
diff changeset
    17
  classical: "(~P ==> P) ==> P"
4093
5e8f3d57dee7 added claset thy_data;
wenzelm
parents: 0
diff changeset
    18
9487
7e377f912629 improved comments;
wenzelm
parents: 8643
diff changeset
    19
11678
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
    20
subsection {* Lemmas and proof tools *}
9487
7e377f912629 improved comments;
wenzelm
parents: 8643
diff changeset
    21
21539
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    22
lemma ccontr: "(\<not> P \<Longrightarrow> False) \<Longrightarrow> P"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    23
  by (erule FalseE [THEN classical])
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    24
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    25
(*** Classical introduction rules for | and EX ***)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    26
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    27
lemma disjCI: "(~Q ==> P) ==> P|Q"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    28
  apply (rule classical)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    29
  apply (assumption | erule meta_mp | rule disjI1 notI)+
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    30
  apply (erule notE disjI2)+
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    31
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    32
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    33
(*introduction rule involving only EX*)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    34
lemma ex_classical:
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    35
  assumes r: "~(EX x. P(x)) ==> P(a)"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    36
  shows "EX x. P(x)"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    37
  apply (rule classical)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    38
  apply (rule exI, erule r)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    39
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    40
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    41
(*version of above, simplifying ~EX to ALL~ *)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    42
lemma exCI:
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    43
  assumes r: "ALL x. ~P(x) ==> P(a)"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    44
  shows "EX x. P(x)"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    45
  apply (rule ex_classical)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    46
  apply (rule notI [THEN allI, THEN r])
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    47
  apply (erule notE)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    48
  apply (erule exI)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    49
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    50
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    51
lemma excluded_middle: "~P | P"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    52
  apply (rule disjCI)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    53
  apply assumption
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
(*For disjunctive case analysis*)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    57
ML {*
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    58
  local
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    59
    val excluded_middle = thm "excluded_middle"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    60
    val disjE = thm "disjE"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    61
  in
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    62
    fun excluded_middle_tac sP =
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    63
      res_inst_tac [("Q",sP)] (excluded_middle RS disjE)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    64
  end
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    65
*}
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    66
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    67
lemma case_split_thm:
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    68
  assumes r1: "P ==> Q"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    69
    and r2: "~P ==> Q"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    70
  shows Q
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    71
  apply (rule excluded_middle [THEN disjE])
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    72
  apply (erule r2)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    73
  apply (erule r1)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    74
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    75
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    76
lemmas case_split = case_split_thm [case_names True False, cases type: o]
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    77
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    78
(*HOL's more natural case analysis tactic*)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    79
ML {*
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    80
  local
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    81
    val case_split_thm = thm "case_split_thm"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    82
  in
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    83
    fun case_tac a = res_inst_tac [("P",a)] case_split_thm
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    84
  end
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    85
*}
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    86
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    87
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    88
(*** Special elimination rules *)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    89
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    90
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    91
(*Classical implies (-->) elimination. *)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    92
lemma impCE:
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    93
  assumes major: "P-->Q"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    94
    and r1: "~P ==> R"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    95
    and r2: "Q ==> R"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    96
  shows R
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    97
  apply (rule excluded_middle [THEN disjE])
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    98
   apply (erule r1)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
    99
  apply (rule r2)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   100
  apply (erule major [THEN mp])
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   101
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   102
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   103
(*This version of --> elimination works on Q before P.  It works best for
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   104
  those cases in which P holds "almost everywhere".  Can't install as
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   105
  default: would break old proofs.*)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   106
lemma impCE':
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   107
  assumes major: "P-->Q"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   108
    and r1: "Q ==> R"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   109
    and r2: "~P ==> R"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   110
  shows R
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   111
  apply (rule excluded_middle [THEN disjE])
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   112
   apply (erule r2)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   113
  apply (rule r1)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   114
  apply (erule major [THEN mp])
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   115
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   116
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   117
(*Double negation law*)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   118
lemma notnotD: "~~P ==> P"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   119
  apply (rule classical)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   120
  apply (erule notE)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   121
  apply assumption
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   122
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   123
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   124
lemma contrapos2:  "[| Q; ~ P ==> ~ Q |] ==> P"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   125
  apply (rule classical)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   126
  apply (drule (1) meta_mp)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   127
  apply (erule (1) notE)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   128
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   129
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   130
(*** Tactics for implication and contradiction ***)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   131
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   132
(*Classical <-> elimination.  Proof substitutes P=Q in 
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   133
    ~P ==> ~Q    and    P ==> Q  *)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   134
lemma iffCE:
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   135
  assumes major: "P<->Q"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   136
    and r1: "[| P; Q |] ==> R"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   137
    and r2: "[| ~P; ~Q |] ==> R"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   138
  shows R
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   139
  apply (rule major [unfolded iff_def, THEN conjE])
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   140
  apply (elim impCE)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   141
     apply (erule (1) r2)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   142
    apply (erule (1) notE)+
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   143
  apply (erule (1) r1)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   144
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   145
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   146
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   147
(*Better for fast_tac: needs no quantifier duplication!*)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   148
lemma alt_ex1E:
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   149
  assumes major: "EX! x. P(x)"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   150
    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
   151
  shows R
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   152
  using major
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   153
proof (rule ex1E)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   154
  fix x
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   155
  assume * : "\<forall>y. P(y) \<longrightarrow> y = x"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   156
  assume "P(x)"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   157
  then show R
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   158
  proof (rule r)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   159
    { fix y y'
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   160
      assume "P(y)" and "P(y')"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   161
      with * have "x = y" and "x = y'" by - (tactic "IntPr.fast_tac 1")+
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   162
      then have "y = y'" by (rule subst)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   163
    } note r' = this
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   164
    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
   165
  qed
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   166
qed
9525
46fb9ccae463 lemmas atomize = all_eq imp_eq;
wenzelm
parents: 9487
diff changeset
   167
10383
a092ae7bb2a6 "atomize" for classical tactics;
wenzelm
parents: 10130
diff changeset
   168
use "cladata.ML"
a092ae7bb2a6 "atomize" for classical tactics;
wenzelm
parents: 10130
diff changeset
   169
setup Cla.setup
14156
2072802ab0e3 new case_tac method
paulson
parents: 14085
diff changeset
   170
setup cla_setup
2072802ab0e3 new case_tac method
paulson
parents: 14085
diff changeset
   171
setup case_setup
10383
a092ae7bb2a6 "atomize" for classical tactics;
wenzelm
parents: 10130
diff changeset
   172
9487
7e377f912629 improved comments;
wenzelm
parents: 8643
diff changeset
   173
use "blastdata.ML"
7e377f912629 improved comments;
wenzelm
parents: 8643
diff changeset
   174
setup Blast.setup
13550
5a176b8dda84 removal of blast.overloaded
paulson
parents: 12367
diff changeset
   175
5a176b8dda84 removal of blast.overloaded
paulson
parents: 12367
diff changeset
   176
5a176b8dda84 removal of blast.overloaded
paulson
parents: 12367
diff changeset
   177
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
   178
  by blast
20223
89d2758ecddf tuned proofs;
wenzelm
parents: 18816
diff changeset
   179
89d2758ecddf tuned proofs;
wenzelm
parents: 18816
diff changeset
   180
(* Elimination of True from asumptions: *)
89d2758ecddf tuned proofs;
wenzelm
parents: 18816
diff changeset
   181
lemma True_implies_equals: "(True ==> PROP P) == PROP P"
89d2758ecddf tuned proofs;
wenzelm
parents: 18816
diff changeset
   182
proof
89d2758ecddf tuned proofs;
wenzelm
parents: 18816
diff changeset
   183
  assume "True \<Longrightarrow> PROP P"
89d2758ecddf tuned proofs;
wenzelm
parents: 18816
diff changeset
   184
  from this and TrueI show "PROP P" .
89d2758ecddf tuned proofs;
wenzelm
parents: 18816
diff changeset
   185
next
89d2758ecddf tuned proofs;
wenzelm
parents: 18816
diff changeset
   186
  assume "PROP P"
89d2758ecddf tuned proofs;
wenzelm
parents: 18816
diff changeset
   187
  then show "PROP P" .
89d2758ecddf tuned proofs;
wenzelm
parents: 18816
diff changeset
   188
qed
9487
7e377f912629 improved comments;
wenzelm
parents: 8643
diff changeset
   189
21539
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   190
lemma uncurry: "P --> Q --> R ==> P & Q --> R"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   191
  by blast
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   192
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   193
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
   194
  by blast
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   195
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   196
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
   197
  by blast
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   198
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   199
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
   200
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 20223
diff changeset
   201
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
   202
9487
7e377f912629 improved comments;
wenzelm
parents: 8643
diff changeset
   203
use "simpdata.ML"
7e377f912629 improved comments;
wenzelm
parents: 8643
diff changeset
   204
setup simpsetup
7e377f912629 improved comments;
wenzelm
parents: 8643
diff changeset
   205
setup "Simplifier.method_setup Splitter.split_modifiers"
7e377f912629 improved comments;
wenzelm
parents: 8643
diff changeset
   206
setup Splitter.setup
7e377f912629 improved comments;
wenzelm
parents: 8643
diff changeset
   207
setup Clasimp.setup
18591
04b9f2bf5a48 tuned EqSubst setup;
wenzelm
parents: 18531
diff changeset
   208
setup EqSubst.setup
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 15019
diff changeset
   209
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 15019
diff changeset
   210
14085
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   211
subsection {* Other simple lemmas *}
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   212
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   213
lemma [simp]: "((P-->R) <-> (Q-->R)) <-> ((P<->Q) | R)"
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   214
by blast
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   215
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   216
lemma [simp]: "((P-->Q) <-> (P-->R)) <-> (P --> (Q<->R))"
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   217
by blast
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   218
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   219
lemma not_disj_iff_imp: "~P | Q <-> (P-->Q)"
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   220
by blast
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   221
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   222
(** Monotonicity of implications **)
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   223
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   224
lemma conj_mono: "[| P1-->Q1; P2-->Q2 |] ==> (P1&P2) --> (Q1&Q2)"
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   225
by fast (*or (IntPr.fast_tac 1)*)
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   226
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   227
lemma disj_mono: "[| P1-->Q1; P2-->Q2 |] ==> (P1|P2) --> (Q1|Q2)"
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   228
by fast (*or (IntPr.fast_tac 1)*)
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   229
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   230
lemma imp_mono: "[| Q1-->P1; P2-->Q2 |] ==> (P1-->P2)-->(Q1-->Q2)"
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   231
by fast (*or (IntPr.fast_tac 1)*)
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   232
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   233
lemma imp_refl: "P-->P"
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   234
by (rule impI, assumption)
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   235
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   236
(*The quantifier monotonicity rules are also intuitionistically valid*)
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   237
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
   238
by blast
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   239
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   240
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
   241
by blast
8dc3e532959a moved some lemmas here from ZF
paulson
parents: 13550
diff changeset
   242
11678
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   243
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   244
subsection {* Proof by cases and induction *}
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   245
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   246
text {* Proper handling of non-atomic rule statements. *}
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   247
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   248
constdefs
18456
8cc35e95450a updated auxiliary facts for induct method;
wenzelm
parents: 16417
diff changeset
   249
  induct_forall where "induct_forall(P) == \<forall>x. P(x)"
8cc35e95450a updated auxiliary facts for induct method;
wenzelm
parents: 16417
diff changeset
   250
  induct_implies where "induct_implies(A, B) == A \<longrightarrow> B"
8cc35e95450a updated auxiliary facts for induct method;
wenzelm
parents: 16417
diff changeset
   251
  induct_equal where "induct_equal(x, y) == x = y"
8cc35e95450a updated auxiliary facts for induct method;
wenzelm
parents: 16417
diff changeset
   252
  induct_conj where "induct_conj(A, B) == A \<and> B"
11678
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   253
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   254
lemma induct_forall_eq: "(!!x. P(x)) == Trueprop(induct_forall(\<lambda>x. P(x)))"
18816
aebd7f315b92 tuned proofs;
wenzelm
parents: 18595
diff changeset
   255
  unfolding atomize_all induct_forall_def .
11678
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   256
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   257
lemma induct_implies_eq: "(A ==> B) == Trueprop(induct_implies(A, B))"
18816
aebd7f315b92 tuned proofs;
wenzelm
parents: 18595
diff changeset
   258
  unfolding atomize_imp induct_implies_def .
11678
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   259
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   260
lemma induct_equal_eq: "(x == y) == Trueprop(induct_equal(x, y))"
18816
aebd7f315b92 tuned proofs;
wenzelm
parents: 18595
diff changeset
   261
  unfolding atomize_eq induct_equal_def .
11678
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   262
18456
8cc35e95450a updated auxiliary facts for induct method;
wenzelm
parents: 16417
diff changeset
   263
lemma induct_conj_eq:
8cc35e95450a updated auxiliary facts for induct method;
wenzelm
parents: 16417
diff changeset
   264
  includes meta_conjunction_syntax
8cc35e95450a updated auxiliary facts for induct method;
wenzelm
parents: 16417
diff changeset
   265
  shows "(A && B) == Trueprop(induct_conj(A, B))"
18816
aebd7f315b92 tuned proofs;
wenzelm
parents: 18595
diff changeset
   266
  unfolding atomize_conj induct_conj_def .
11988
8340fb172607 induct_impliesI;
wenzelm
parents: 11848
diff changeset
   267
18456
8cc35e95450a updated auxiliary facts for induct method;
wenzelm
parents: 16417
diff changeset
   268
lemmas induct_atomize = induct_forall_eq induct_implies_eq induct_equal_eq induct_conj_eq
8cc35e95450a updated auxiliary facts for induct method;
wenzelm
parents: 16417
diff changeset
   269
lemmas induct_rulify [symmetric, standard] = induct_atomize
8cc35e95450a updated auxiliary facts for induct method;
wenzelm
parents: 16417
diff changeset
   270
lemmas induct_rulify_fallback =
8cc35e95450a updated auxiliary facts for induct method;
wenzelm
parents: 16417
diff changeset
   271
  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
   272
18456
8cc35e95450a updated auxiliary facts for induct method;
wenzelm
parents: 16417
diff changeset
   273
hide const induct_forall induct_implies induct_equal induct_conj
11678
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   274
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   275
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   276
text {* Method setup. *}
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   277
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   278
ML {*
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   279
  structure InductMethod = InductMethodFun
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   280
  (struct
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   281
    val cases_default = thm "case_split";
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   282
    val atomize = thms "induct_atomize";
18456
8cc35e95450a updated auxiliary facts for induct method;
wenzelm
parents: 16417
diff changeset
   283
    val rulify = thms "induct_rulify";
8cc35e95450a updated auxiliary facts for induct method;
wenzelm
parents: 16417
diff changeset
   284
    val rulify_fallback = thms "induct_rulify_fallback";
11678
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   285
  end);
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   286
*}
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   287
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   288
setup InductMethod.setup
6aa3e2d26683 moved atomize stuff to theory IFOL;
wenzelm
parents: 11096
diff changeset
   289
4854
d1850e0964f2 tuned setup;
wenzelm
parents: 4793
diff changeset
   290
end