src/FOL/IFOL.thy
author wenzelm
Sun, 11 Jan 2009 21:49:59 +0100
changeset 29450 ac7f67be7f1f
parent 28856 5e009a80fe6d
child 30160 5f7b17941730
child 30240 5b25fee0362c
permissions -rw-r--r--
tuned categories;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1268
f6ef556b3ede corrected title
clasohm
parents: 928
diff changeset
     1
(*  Title:      FOL/IFOL.thy
35
d71f96f1780e ifol.thy: added ~= for "not equals"
lcp
parents: 0
diff changeset
     2
    ID:         $Id$
11677
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
     3
    Author:     Lawrence C Paulson and Markus Wenzel
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
     4
*)
35
d71f96f1780e ifol.thy: added ~= for "not equals"
lcp
parents: 0
diff changeset
     5
11677
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
     6
header {* Intuitionistic first-order logic *}
35
d71f96f1780e ifol.thy: added ~= for "not equals"
lcp
parents: 0
diff changeset
     7
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 15377
diff changeset
     8
theory IFOL
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 15377
diff changeset
     9
imports Pure
23155
4b04f9d859af proper loading of ML files;
wenzelm
parents: 22931
diff changeset
    10
uses
4b04f9d859af proper loading of ML files;
wenzelm
parents: 22931
diff changeset
    11
  "~~/src/Provers/splitter.ML"
4b04f9d859af proper loading of ML files;
wenzelm
parents: 22931
diff changeset
    12
  "~~/src/Provers/hypsubst.ML"
23171
861f63a35d31 moved IsaPlanner from Provers to Tools;
wenzelm
parents: 23155
diff changeset
    13
  "~~/src/Tools/IsaPlanner/zipper.ML"
861f63a35d31 moved IsaPlanner from Provers to Tools;
wenzelm
parents: 23155
diff changeset
    14
  "~~/src/Tools/IsaPlanner/isand.ML"
861f63a35d31 moved IsaPlanner from Provers to Tools;
wenzelm
parents: 23155
diff changeset
    15
  "~~/src/Tools/IsaPlanner/rw_tools.ML"
861f63a35d31 moved IsaPlanner from Provers to Tools;
wenzelm
parents: 23155
diff changeset
    16
  "~~/src/Tools/IsaPlanner/rw_inst.ML"
23155
4b04f9d859af proper loading of ML files;
wenzelm
parents: 22931
diff changeset
    17
  "~~/src/Provers/eqsubst.ML"
4b04f9d859af proper loading of ML files;
wenzelm
parents: 22931
diff changeset
    18
  "~~/src/Provers/quantifier1.ML"
4b04f9d859af proper loading of ML files;
wenzelm
parents: 22931
diff changeset
    19
  "~~/src/Provers/project_rule.ML"
26580
c3e597a476fd Generic conversion and tactic "atomize_elim" to convert elimination rules
krauss
parents: 26286
diff changeset
    20
  "~~/src/Tools/atomize_elim.ML"
23155
4b04f9d859af proper loading of ML files;
wenzelm
parents: 22931
diff changeset
    21
  ("fologic.ML")
4b04f9d859af proper loading of ML files;
wenzelm
parents: 22931
diff changeset
    22
  ("hypsubstdata.ML")
4b04f9d859af proper loading of ML files;
wenzelm
parents: 22931
diff changeset
    23
  ("intprover.ML")
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents: 15377
diff changeset
    24
begin
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    25
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    26
11677
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
    27
subsection {* Syntax and axiomatic basis *}
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
    28
26956
1309a6a0a29f setup PureThy.old_appl_syntax_setup -- theory Pure provides regular application syntax by default;
wenzelm
parents: 26580
diff changeset
    29
setup PureThy.old_appl_syntax_setup
1309a6a0a29f setup PureThy.old_appl_syntax_setup -- theory Pure provides regular application syntax by default;
wenzelm
parents: 26580
diff changeset
    30
3906
5ae0e1324c56 global;
wenzelm
parents: 3835
diff changeset
    31
global
5ae0e1324c56 global;
wenzelm
parents: 3835
diff changeset
    32
14854
61bdf2ae4dc5 removed obsolete sort 'logic';
wenzelm
parents: 14565
diff changeset
    33
classes "term"
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    34
defaultsort "term"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    35
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    36
typedecl o
79
74e68ed3b4fd added white-space;
wenzelm
parents: 35
diff changeset
    37
11747
17a6dcd6f3cf judgment Trueprop;
wenzelm
parents: 11734
diff changeset
    38
judgment
17a6dcd6f3cf judgment Trueprop;
wenzelm
parents: 11734
diff changeset
    39
  Trueprop      :: "o => prop"                  ("(_)" 5)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    40
11747
17a6dcd6f3cf judgment Trueprop;
wenzelm
parents: 11734
diff changeset
    41
consts
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    42
  True          :: o
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    43
  False         :: o
79
74e68ed3b4fd added white-space;
wenzelm
parents: 35
diff changeset
    44
74e68ed3b4fd added white-space;
wenzelm
parents: 35
diff changeset
    45
  (* Connectives *)
74e68ed3b4fd added white-space;
wenzelm
parents: 35
diff changeset
    46
17276
3bb24e8b2cb2 avoid old-style infixes;
wenzelm
parents: 16417
diff changeset
    47
  "op ="        :: "['a, 'a] => o"              (infixl "=" 50)
35
d71f96f1780e ifol.thy: added ~= for "not equals"
lcp
parents: 0
diff changeset
    48
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    49
  Not           :: "o => o"                     ("~ _" [40] 40)
17276
3bb24e8b2cb2 avoid old-style infixes;
wenzelm
parents: 16417
diff changeset
    50
  "op &"        :: "[o, o] => o"                (infixr "&" 35)
3bb24e8b2cb2 avoid old-style infixes;
wenzelm
parents: 16417
diff changeset
    51
  "op |"        :: "[o, o] => o"                (infixr "|" 30)
3bb24e8b2cb2 avoid old-style infixes;
wenzelm
parents: 16417
diff changeset
    52
  "op -->"      :: "[o, o] => o"                (infixr "-->" 25)
3bb24e8b2cb2 avoid old-style infixes;
wenzelm
parents: 16417
diff changeset
    53
  "op <->"      :: "[o, o] => o"                (infixr "<->" 25)
79
74e68ed3b4fd added white-space;
wenzelm
parents: 35
diff changeset
    54
74e68ed3b4fd added white-space;
wenzelm
parents: 35
diff changeset
    55
  (* Quantifiers *)
74e68ed3b4fd added white-space;
wenzelm
parents: 35
diff changeset
    56
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    57
  All           :: "('a => o) => o"             (binder "ALL " 10)
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    58
  Ex            :: "('a => o) => o"             (binder "EX " 10)
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    59
  Ex1           :: "('a => o) => o"             (binder "EX! " 10)
79
74e68ed3b4fd added white-space;
wenzelm
parents: 35
diff changeset
    60
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    61
19363
667b5ea637dd refined 'abbreviation';
wenzelm
parents: 19120
diff changeset
    62
abbreviation
21404
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 21210
diff changeset
    63
  not_equal :: "['a, 'a] => o"  (infixl "~=" 50) where
19120
353d349740de not_equal: replaced syntax translation by abbreviation;
wenzelm
parents: 18861
diff changeset
    64
  "x ~= y == ~ (x = y)"
79
74e68ed3b4fd added white-space;
wenzelm
parents: 35
diff changeset
    65
21210
c17fd2df4e9e renamed 'const_syntax' to 'notation';
wenzelm
parents: 19756
diff changeset
    66
notation (xsymbols)
19656
09be06943252 tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents: 19380
diff changeset
    67
  not_equal  (infixl "\<noteq>" 50)
19363
667b5ea637dd refined 'abbreviation';
wenzelm
parents: 19120
diff changeset
    68
21210
c17fd2df4e9e renamed 'const_syntax' to 'notation';
wenzelm
parents: 19756
diff changeset
    69
notation (HTML output)
19656
09be06943252 tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents: 19380
diff changeset
    70
  not_equal  (infixl "\<noteq>" 50)
19363
667b5ea637dd refined 'abbreviation';
wenzelm
parents: 19120
diff changeset
    71
21524
7843e2fd14a9 updated (binder) syntax/notation;
wenzelm
parents: 21404
diff changeset
    72
notation (xsymbols)
21539
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
    73
  Not       ("\<not> _" [40] 40) and
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
    74
  "op &"    (infixr "\<and>" 35) and
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
    75
  "op |"    (infixr "\<or>" 30) and
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
    76
  All       (binder "\<forall>" 10) and
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
    77
  Ex        (binder "\<exists>" 10) and
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
    78
  Ex1       (binder "\<exists>!" 10) and
21524
7843e2fd14a9 updated (binder) syntax/notation;
wenzelm
parents: 21404
diff changeset
    79
  "op -->"  (infixr "\<longrightarrow>" 25) and
7843e2fd14a9 updated (binder) syntax/notation;
wenzelm
parents: 21404
diff changeset
    80
  "op <->"  (infixr "\<longleftrightarrow>" 25)
35
d71f96f1780e ifol.thy: added ~= for "not equals"
lcp
parents: 0
diff changeset
    81
21524
7843e2fd14a9 updated (binder) syntax/notation;
wenzelm
parents: 21404
diff changeset
    82
notation (HTML output)
21539
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
    83
  Not       ("\<not> _" [40] 40) and
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
    84
  "op &"    (infixr "\<and>" 35) and
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
    85
  "op |"    (infixr "\<or>" 30) and
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
    86
  All       (binder "\<forall>" 10) and
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
    87
  Ex        (binder "\<exists>" 10) and
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
    88
  Ex1       (binder "\<exists>!" 10)
6340
7d5cbd5819a0 HTML output;
wenzelm
parents: 6027
diff changeset
    89
3932
wenzelm
parents: 3906
diff changeset
    90
local
3906
5ae0e1324c56 global;
wenzelm
parents: 3835
diff changeset
    91
14236
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
    92
finalconsts
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
    93
  False All Ex
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
    94
  "op ="
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
    95
  "op &"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
    96
  "op |"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
    97
  "op -->"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
    98
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
    99
axioms
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   100
79
74e68ed3b4fd added white-space;
wenzelm
parents: 35
diff changeset
   101
  (* Equality *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   102
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   103
  refl:         "a=a"
28681
e8664643f543 subst is a proper axiom again
haftmann
parents: 27151
diff changeset
   104
  subst:        "a=b \<Longrightarrow> P(a) \<Longrightarrow> P(b)"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   105
79
74e68ed3b4fd added white-space;
wenzelm
parents: 35
diff changeset
   106
  (* Propositional logic *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   107
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   108
  conjI:        "[| P;  Q |] ==> P&Q"
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   109
  conjunct1:    "P&Q ==> P"
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   110
  conjunct2:    "P&Q ==> Q"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   111
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   112
  disjI1:       "P ==> P|Q"
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   113
  disjI2:       "Q ==> P|Q"
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   114
  disjE:        "[| P|Q;  P ==> R;  Q ==> R |] ==> R"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   115
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   116
  impI:         "(P ==> Q) ==> P-->Q"
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   117
  mp:           "[| P-->Q;  P |] ==> Q"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   118
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   119
  FalseE:       "False ==> P"
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   120
79
74e68ed3b4fd added white-space;
wenzelm
parents: 35
diff changeset
   121
  (* Quantifiers *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   122
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   123
  allI:         "(!!x. P(x)) ==> (ALL x. P(x))"
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   124
  spec:         "(ALL x. P(x)) ==> P(x)"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   125
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   126
  exI:          "P(x) ==> (EX x. P(x))"
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   127
  exE:          "[| EX x. P(x);  !!x. P(x) ==> R |] ==> R"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   128
28681
e8664643f543 subst is a proper axiom again
haftmann
parents: 27151
diff changeset
   129
e8664643f543 subst is a proper axiom again
haftmann
parents: 27151
diff changeset
   130
axioms
e8664643f543 subst is a proper axiom again
haftmann
parents: 27151
diff changeset
   131
e8664643f543 subst is a proper axiom again
haftmann
parents: 27151
diff changeset
   132
  (* Reflection, admissible *)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   133
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   134
  eq_reflection:  "(x=y)   ==> (x==y)"
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   135
  iff_reflection: "(P<->Q) ==> (P==Q)"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   136
4092
9faf228771dc added simpset thy_data;
wenzelm
parents: 3932
diff changeset
   137
19756
61c4117345c6 lemmas strip;
wenzelm
parents: 19683
diff changeset
   138
lemmas strip = impI allI
61c4117345c6 lemmas strip;
wenzelm
parents: 19683
diff changeset
   139
61c4117345c6 lemmas strip;
wenzelm
parents: 19683
diff changeset
   140
14236
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
   141
defs
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
   142
  (* Definitions *)
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
   143
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
   144
  True_def:     "True  == False-->False"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
   145
  not_def:      "~P    == P-->False"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
   146
  iff_def:      "P<->Q == (P-->Q) & (Q-->P)"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
   147
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
   148
  (* Unique existence *)
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
   149
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
   150
  ex1_def:      "Ex1(P) == EX x. P(x) & (ALL y. P(y) --> y=x)"
c73d62ce9d1c partial conversion to Isar scripts
paulson
parents: 13779
diff changeset
   151
13779
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   152
11677
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   153
subsection {* Lemmas and proof tools *}
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   154
21539
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   155
lemma TrueI: True
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   156
  unfolding True_def by (rule impI)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   157
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   158
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   159
(*** Sequent-style elimination rules for & --> and ALL ***)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   160
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   161
lemma conjE:
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   162
  assumes major: "P & Q"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   163
    and r: "[| P; Q |] ==> R"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   164
  shows R
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   165
  apply (rule r)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   166
   apply (rule major [THEN conjunct1])
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   167
  apply (rule major [THEN conjunct2])
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   168
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   169
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   170
lemma impE:
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   171
  assumes major: "P --> Q"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   172
    and P
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   173
  and r: "Q ==> R"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   174
  shows R
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   175
  apply (rule r)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   176
  apply (rule major [THEN mp])
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   177
  apply (rule `P`)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   178
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   179
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   180
lemma allE:
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   181
  assumes major: "ALL x. P(x)"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   182
    and r: "P(x) ==> R"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   183
  shows R
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   184
  apply (rule r)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   185
  apply (rule major [THEN spec])
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   186
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   187
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   188
(*Duplicates the quantifier; for use with eresolve_tac*)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   189
lemma all_dupE:
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   190
  assumes major: "ALL x. P(x)"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   191
    and r: "[| P(x); ALL x. P(x) |] ==> R"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   192
  shows R
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   193
  apply (rule r)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   194
   apply (rule major [THEN spec])
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   195
  apply (rule major)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   196
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   197
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   198
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   199
(*** Negation rules, which translate between ~P and P-->False ***)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   200
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   201
lemma notI: "(P ==> False) ==> ~P"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   202
  unfolding not_def by (erule impI)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   203
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   204
lemma notE: "[| ~P;  P |] ==> R"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   205
  unfolding not_def by (erule mp [THEN FalseE])
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   206
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   207
lemma rev_notE: "[| P; ~P |] ==> R"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   208
  by (erule notE)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   209
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   210
(*This is useful with the special implication rules for each kind of P. *)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   211
lemma not_to_imp:
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   212
  assumes "~P"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   213
    and r: "P --> False ==> Q"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   214
  shows Q
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   215
  apply (rule r)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   216
  apply (rule impI)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   217
  apply (erule notE [OF `~P`])
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   218
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   219
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   220
(* For substitution into an assumption P, reduce Q to P-->Q, substitute into
27150
a42aef558ce3 tuned comments;
wenzelm
parents: 26956
diff changeset
   221
   this implication, then apply impI to move P back into the assumptions.*)
21539
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   222
lemma rev_mp: "[| P;  P --> Q |] ==> Q"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   223
  by (erule mp)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   224
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   225
(*Contrapositive of an inference rule*)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   226
lemma contrapos:
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   227
  assumes major: "~Q"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   228
    and minor: "P ==> Q"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   229
  shows "~P"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   230
  apply (rule major [THEN notE, THEN notI])
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   231
  apply (erule minor)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   232
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   233
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   234
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   235
(*** Modus Ponens Tactics ***)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   236
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   237
(*Finds P-->Q and P in the assumptions, replaces implication by Q *)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   238
ML {*
22139
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   239
  fun mp_tac i = eresolve_tac [@{thm notE}, @{thm impE}] i  THEN  assume_tac i
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   240
  fun eq_mp_tac i = eresolve_tac [@{thm notE}, @{thm impE}] i  THEN  eq_assume_tac i
21539
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   241
*}
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   242
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   243
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   244
(*** If-and-only-if ***)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   245
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   246
lemma iffI: "[| P ==> Q; Q ==> P |] ==> P<->Q"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   247
  apply (unfold iff_def)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   248
  apply (rule conjI)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   249
   apply (erule impI)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   250
  apply (erule impI)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   251
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   252
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   253
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   254
(*Observe use of rewrite_rule to unfold "<->" in meta-assumptions (prems) *)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   255
lemma iffE:
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   256
  assumes major: "P <-> Q"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   257
    and r: "P-->Q ==> Q-->P ==> R"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   258
  shows R
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   259
  apply (insert major, unfold iff_def)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   260
  apply (erule conjE)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   261
  apply (erule r)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   262
  apply assumption
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   263
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   264
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   265
(* Destruct rules for <-> similar to Modus Ponens *)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   266
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   267
lemma iffD1: "[| P <-> Q;  P |] ==> Q"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   268
  apply (unfold iff_def)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   269
  apply (erule conjunct1 [THEN mp])
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   270
  apply assumption
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   271
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   272
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   273
lemma iffD2: "[| P <-> Q;  Q |] ==> P"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   274
  apply (unfold iff_def)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   275
  apply (erule conjunct2 [THEN mp])
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   276
  apply assumption
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   277
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   278
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   279
lemma rev_iffD1: "[| P; P <-> Q |] ==> Q"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   280
  apply (erule iffD1)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   281
  apply assumption
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   282
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   283
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   284
lemma rev_iffD2: "[| Q; P <-> Q |] ==> P"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   285
  apply (erule iffD2)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   286
  apply assumption
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   287
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   288
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   289
lemma iff_refl: "P <-> P"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   290
  by (rule iffI)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   291
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   292
lemma iff_sym: "Q <-> P ==> P <-> Q"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   293
  apply (erule iffE)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   294
  apply (rule iffI)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   295
  apply (assumption | erule mp)+
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   296
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   297
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   298
lemma iff_trans: "[| P <-> Q;  Q<-> R |] ==> P <-> R"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   299
  apply (rule iffI)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   300
  apply (assumption | erule iffE | erule (1) notE impE)+
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   301
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   302
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   303
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   304
(*** Unique existence.  NOTE THAT the following 2 quantifications
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   305
   EX!x such that [EX!y such that P(x,y)]     (sequential)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   306
   EX!x,y such that P(x,y)                    (simultaneous)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   307
 do NOT mean the same thing.  The parser treats EX!x y.P(x,y) as sequential.
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   308
***)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   309
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   310
lemma ex1I:
23393
31781b2de73d tuned proofs: avoid implicit prems;
wenzelm
parents: 23171
diff changeset
   311
  "P(a) \<Longrightarrow> (!!x. P(x) ==> x=a) \<Longrightarrow> EX! x. P(x)"
21539
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   312
  apply (unfold ex1_def)
23393
31781b2de73d tuned proofs: avoid implicit prems;
wenzelm
parents: 23171
diff changeset
   313
  apply (assumption | rule exI conjI allI impI)+
21539
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   314
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   315
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   316
(*Sometimes easier to use: the premises have no shared variables.  Safe!*)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   317
lemma ex_ex1I:
23393
31781b2de73d tuned proofs: avoid implicit prems;
wenzelm
parents: 23171
diff changeset
   318
  "EX x. P(x) \<Longrightarrow> (!!x y. [| P(x); P(y) |] ==> x=y) \<Longrightarrow> EX! x. P(x)"
31781b2de73d tuned proofs: avoid implicit prems;
wenzelm
parents: 23171
diff changeset
   319
  apply (erule exE)
31781b2de73d tuned proofs: avoid implicit prems;
wenzelm
parents: 23171
diff changeset
   320
  apply (rule ex1I)
31781b2de73d tuned proofs: avoid implicit prems;
wenzelm
parents: 23171
diff changeset
   321
   apply assumption
31781b2de73d tuned proofs: avoid implicit prems;
wenzelm
parents: 23171
diff changeset
   322
  apply assumption
21539
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   323
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   324
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   325
lemma ex1E:
23393
31781b2de73d tuned proofs: avoid implicit prems;
wenzelm
parents: 23171
diff changeset
   326
  "EX! x. P(x) \<Longrightarrow> (!!x. [| P(x);  ALL y. P(y) --> y=x |] ==> R) \<Longrightarrow> R"
31781b2de73d tuned proofs: avoid implicit prems;
wenzelm
parents: 23171
diff changeset
   327
  apply (unfold ex1_def)
21539
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   328
  apply (assumption | erule exE conjE)+
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   329
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   330
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   331
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   332
(*** <-> congruence rules for simplification ***)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   333
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   334
(*Use iffE on a premise.  For conj_cong, imp_cong, all_cong, ex_cong*)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   335
ML {*
22139
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   336
  fun iff_tac prems i =
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   337
    resolve_tac (prems RL @{thms iffE}) i THEN
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   338
    REPEAT1 (eresolve_tac [@{thm asm_rl}, @{thm mp}] i)
21539
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   339
*}
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   340
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   341
lemma conj_cong:
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   342
  assumes "P <-> P'"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   343
    and "P' ==> Q <-> Q'"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   344
  shows "(P&Q) <-> (P'&Q')"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   345
  apply (insert assms)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   346
  apply (assumption | rule iffI conjI | erule iffE conjE mp |
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   347
    tactic {* iff_tac (thms "assms") 1 *})+
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   348
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   349
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   350
(*Reversed congruence rule!   Used in ZF/Order*)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   351
lemma conj_cong2:
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   352
  assumes "P <-> P'"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   353
    and "P' ==> Q <-> Q'"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   354
  shows "(Q&P) <-> (Q'&P')"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   355
  apply (insert assms)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   356
  apply (assumption | rule iffI conjI | erule iffE conjE mp |
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   357
    tactic {* iff_tac (thms "assms") 1 *})+
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   358
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   359
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   360
lemma disj_cong:
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   361
  assumes "P <-> P'" and "Q <-> Q'"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   362
  shows "(P|Q) <-> (P'|Q')"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   363
  apply (insert assms)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   364
  apply (erule iffE disjE disjI1 disjI2 | assumption | rule iffI | erule (1) notE impE)+
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   365
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   366
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   367
lemma imp_cong:
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   368
  assumes "P <-> P'"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   369
    and "P' ==> Q <-> Q'"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   370
  shows "(P-->Q) <-> (P'-->Q')"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   371
  apply (insert assms)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   372
  apply (assumption | rule iffI impI | erule iffE | erule (1) notE impE |
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   373
    tactic {* iff_tac (thms "assms") 1 *})+
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   374
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   375
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   376
lemma iff_cong: "[| P <-> P'; Q <-> Q' |] ==> (P<->Q) <-> (P'<->Q')"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   377
  apply (erule iffE | assumption | rule iffI | erule (1) notE impE)+
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   378
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   379
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   380
lemma not_cong: "P <-> P' ==> ~P <-> ~P'"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   381
  apply (assumption | rule iffI notI | erule (1) notE impE | erule iffE notE)+
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   382
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   383
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   384
lemma all_cong:
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   385
  assumes "!!x. P(x) <-> Q(x)"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   386
  shows "(ALL x. P(x)) <-> (ALL x. Q(x))"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   387
  apply (assumption | rule iffI allI | erule (1) notE impE | erule allE |
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   388
    tactic {* iff_tac (thms "assms") 1 *})+
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   389
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   390
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   391
lemma ex_cong:
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   392
  assumes "!!x. P(x) <-> Q(x)"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   393
  shows "(EX x. P(x)) <-> (EX x. Q(x))"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   394
  apply (erule exE | assumption | rule iffI exI | erule (1) notE impE |
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   395
    tactic {* iff_tac (thms "assms") 1 *})+
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   396
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   397
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   398
lemma ex1_cong:
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   399
  assumes "!!x. P(x) <-> Q(x)"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   400
  shows "(EX! x. P(x)) <-> (EX! x. Q(x))"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   401
  apply (erule ex1E spec [THEN mp] | assumption | rule iffI ex1I | erule (1) notE impE |
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   402
    tactic {* iff_tac (thms "assms") 1 *})+
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   403
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   404
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   405
(*** Equality rules ***)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   406
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   407
lemma sym: "a=b ==> b=a"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   408
  apply (erule subst)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   409
  apply (rule refl)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   410
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   411
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   412
lemma trans: "[| a=b;  b=c |] ==> a=c"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   413
  apply (erule subst, assumption)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   414
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   415
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   416
(**  **)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   417
lemma not_sym: "b ~= a ==> a ~= b"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   418
  apply (erule contrapos)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   419
  apply (erule sym)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   420
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   421
  
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   422
(* Two theorms for rewriting only one instance of a definition:
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   423
   the first for definitions of formulae and the second for terms *)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   424
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   425
lemma def_imp_iff: "(A == B) ==> A <-> B"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   426
  apply unfold
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   427
  apply (rule iff_refl)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   428
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   429
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   430
lemma meta_eq_to_obj_eq: "(A == B) ==> A = B"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   431
  apply unfold
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   432
  apply (rule refl)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   433
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   434
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   435
lemma meta_eq_to_iff: "x==y ==> x<->y"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   436
  by unfold (rule iff_refl)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   437
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   438
(*substitution*)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   439
lemma ssubst: "[| b = a; P(a) |] ==> P(b)"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   440
  apply (drule sym)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   441
  apply (erule (1) subst)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   442
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   443
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   444
(*A special case of ex1E that would otherwise need quantifier expansion*)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   445
lemma ex1_equalsE:
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   446
    "[| EX! x. P(x);  P(a);  P(b) |] ==> a=b"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   447
  apply (erule ex1E)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   448
  apply (rule trans)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   449
   apply (rule_tac [2] sym)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   450
   apply (assumption | erule spec [THEN mp])+
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   451
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   452
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   453
(** Polymorphic congruence rules **)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   454
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   455
lemma subst_context: "[| a=b |]  ==>  t(a)=t(b)"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   456
  apply (erule ssubst)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   457
  apply (rule refl)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   458
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   459
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   460
lemma subst_context2: "[| a=b;  c=d |]  ==>  t(a,c)=t(b,d)"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   461
  apply (erule ssubst)+
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   462
  apply (rule refl)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   463
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   464
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   465
lemma subst_context3: "[| a=b;  c=d;  e=f |]  ==>  t(a,c,e)=t(b,d,f)"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   466
  apply (erule ssubst)+
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   467
  apply (rule refl)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   468
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   469
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   470
(*Useful with eresolve_tac for proving equalties from known equalities.
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   471
        a = b
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   472
        |   |
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   473
        c = d   *)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   474
lemma box_equals: "[| a=b;  a=c;  b=d |] ==> c=d"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   475
  apply (rule trans)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   476
   apply (rule trans)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   477
    apply (rule sym)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   478
    apply assumption+
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   479
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   480
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   481
(*Dual of box_equals: for proving equalities backwards*)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   482
lemma simp_equals: "[| a=c;  b=d;  c=d |] ==> a=b"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   483
  apply (rule trans)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   484
   apply (rule trans)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   485
    apply assumption+
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   486
  apply (erule sym)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   487
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   488
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   489
(** Congruence rules for predicate letters **)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   490
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   491
lemma pred1_cong: "a=a' ==> P(a) <-> P(a')"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   492
  apply (rule iffI)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   493
   apply (erule (1) subst)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   494
  apply (erule (1) ssubst)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   495
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   496
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   497
lemma pred2_cong: "[| a=a';  b=b' |] ==> P(a,b) <-> P(a',b')"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   498
  apply (rule iffI)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   499
   apply (erule subst)+
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   500
   apply assumption
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   501
  apply (erule ssubst)+
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   502
  apply assumption
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   503
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   504
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   505
lemma pred3_cong: "[| a=a';  b=b';  c=c' |] ==> P(a,b,c) <-> P(a',b',c')"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   506
  apply (rule iffI)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   507
   apply (erule subst)+
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   508
   apply assumption
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   509
  apply (erule ssubst)+
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   510
  apply assumption
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   511
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   512
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   513
(*special case for the equality predicate!*)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   514
lemma eq_cong: "[| a = a'; b = b' |] ==> a = b <-> a' = b'"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   515
  apply (erule (1) pred2_cong)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   516
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   517
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   518
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   519
(*** Simplifications of assumed implications.
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   520
     Roy Dyckhoff has proved that conj_impE, disj_impE, and imp_impE
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   521
     used with mp_tac (restricted to atomic formulae) is COMPLETE for 
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   522
     intuitionistic propositional logic.  See
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   523
   R. Dyckhoff, Contraction-free sequent calculi for intuitionistic logic
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   524
    (preprint, University of St Andrews, 1991)  ***)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   525
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   526
lemma conj_impE:
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   527
  assumes major: "(P&Q)-->S"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   528
    and r: "P-->(Q-->S) ==> R"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   529
  shows R
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   530
  by (assumption | rule conjI impI major [THEN mp] r)+
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   531
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   532
lemma disj_impE:
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   533
  assumes major: "(P|Q)-->S"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   534
    and r: "[| P-->S; Q-->S |] ==> R"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   535
  shows R
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   536
  by (assumption | rule disjI1 disjI2 impI major [THEN mp] r)+
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   537
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   538
(*Simplifies the implication.  Classical version is stronger. 
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   539
  Still UNSAFE since Q must be provable -- backtracking needed.  *)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   540
lemma imp_impE:
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   541
  assumes major: "(P-->Q)-->S"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   542
    and r1: "[| P; Q-->S |] ==> Q"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   543
    and r2: "S ==> R"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   544
  shows R
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   545
  by (assumption | rule impI major [THEN mp] r1 r2)+
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   546
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   547
(*Simplifies the implication.  Classical version is stronger. 
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   548
  Still UNSAFE since ~P must be provable -- backtracking needed.  *)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   549
lemma not_impE:
23393
31781b2de73d tuned proofs: avoid implicit prems;
wenzelm
parents: 23171
diff changeset
   550
  "~P --> S \<Longrightarrow> (P ==> False) \<Longrightarrow> (S ==> R) \<Longrightarrow> R"
31781b2de73d tuned proofs: avoid implicit prems;
wenzelm
parents: 23171
diff changeset
   551
  apply (drule mp)
31781b2de73d tuned proofs: avoid implicit prems;
wenzelm
parents: 23171
diff changeset
   552
   apply (rule notI)
31781b2de73d tuned proofs: avoid implicit prems;
wenzelm
parents: 23171
diff changeset
   553
   apply assumption
31781b2de73d tuned proofs: avoid implicit prems;
wenzelm
parents: 23171
diff changeset
   554
  apply assumption
21539
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   555
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   556
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   557
(*Simplifies the implication.   UNSAFE.  *)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   558
lemma iff_impE:
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   559
  assumes major: "(P<->Q)-->S"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   560
    and r1: "[| P; Q-->S |] ==> Q"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   561
    and r2: "[| Q; P-->S |] ==> P"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   562
    and r3: "S ==> R"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   563
  shows R
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   564
  apply (assumption | rule iffI impI major [THEN mp] r1 r2 r3)+
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   565
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   566
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   567
(*What if (ALL x.~~P(x)) --> ~~(ALL x.P(x)) is an assumption? UNSAFE*)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   568
lemma all_impE:
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   569
  assumes major: "(ALL x. P(x))-->S"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   570
    and r1: "!!x. P(x)"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   571
    and r2: "S ==> R"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   572
  shows R
23393
31781b2de73d tuned proofs: avoid implicit prems;
wenzelm
parents: 23171
diff changeset
   573
  apply (rule allI impI major [THEN mp] r1 r2)+
21539
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   574
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   575
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   576
(*Unsafe: (EX x.P(x))-->S  is equivalent to  ALL x.P(x)-->S.  *)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   577
lemma ex_impE:
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   578
  assumes major: "(EX x. P(x))-->S"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   579
    and r: "P(x)-->S ==> R"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   580
  shows R
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   581
  apply (assumption | rule exI impI major [THEN mp] r)+
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   582
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   583
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   584
(*** Courtesy of Krzysztof Grabczewski ***)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   585
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   586
lemma disj_imp_disj:
23393
31781b2de73d tuned proofs: avoid implicit prems;
wenzelm
parents: 23171
diff changeset
   587
  "P|Q \<Longrightarrow> (P==>R) \<Longrightarrow> (Q==>S) \<Longrightarrow> R|S"
31781b2de73d tuned proofs: avoid implicit prems;
wenzelm
parents: 23171
diff changeset
   588
  apply (erule disjE)
21539
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   589
  apply (rule disjI1) apply assumption
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   590
  apply (rule disjI2) apply assumption
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   591
  done
11734
7a21bf539412 declare impE iffD1 iffD2 ad elim of Pure;
wenzelm
parents: 11677
diff changeset
   592
18481
b75ce99617c7 structure ProjectRule;
wenzelm
parents: 17702
diff changeset
   593
ML {*
b75ce99617c7 structure ProjectRule;
wenzelm
parents: 17702
diff changeset
   594
structure ProjectRule = ProjectRuleFun
b75ce99617c7 structure ProjectRule;
wenzelm
parents: 17702
diff changeset
   595
(struct
22139
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   596
  val conjunct1 = @{thm conjunct1}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   597
  val conjunct2 = @{thm conjunct2}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   598
  val mp = @{thm mp}
18481
b75ce99617c7 structure ProjectRule;
wenzelm
parents: 17702
diff changeset
   599
end)
b75ce99617c7 structure ProjectRule;
wenzelm
parents: 17702
diff changeset
   600
*}
b75ce99617c7 structure ProjectRule;
wenzelm
parents: 17702
diff changeset
   601
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   602
use "fologic.ML"
21539
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   603
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   604
lemma thin_refl: "!!X. [|x=x; PROP W|] ==> PROP W" .
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   605
9886
897d6602cbfb updated setup;
wenzelm
parents: 9526
diff changeset
   606
use "hypsubstdata.ML"
897d6602cbfb updated setup;
wenzelm
parents: 9526
diff changeset
   607
setup hypsubst_setup
7355
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   608
use "intprover.ML"
4c43090659ca proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents: 6340
diff changeset
   609
4092
9faf228771dc added simpset thy_data;
wenzelm
parents: 3932
diff changeset
   610
12875
wenzelm
parents: 12662
diff changeset
   611
subsection {* Intuitionistic Reasoning *}
12368
2af9ad81ea56 sym declarations;
wenzelm
parents: 12352
diff changeset
   612
12349
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   613
lemma impE':
12937
0c4fd7529467 clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents: 12875
diff changeset
   614
  assumes 1: "P --> Q"
0c4fd7529467 clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents: 12875
diff changeset
   615
    and 2: "Q ==> R"
0c4fd7529467 clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents: 12875
diff changeset
   616
    and 3: "P --> Q ==> P"
0c4fd7529467 clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents: 12875
diff changeset
   617
  shows R
12349
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   618
proof -
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   619
  from 3 and 1 have P .
12368
2af9ad81ea56 sym declarations;
wenzelm
parents: 12352
diff changeset
   620
  with 1 have Q by (rule impE)
12349
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   621
  with 2 show R .
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   622
qed
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   623
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   624
lemma allE':
12937
0c4fd7529467 clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents: 12875
diff changeset
   625
  assumes 1: "ALL x. P(x)"
0c4fd7529467 clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents: 12875
diff changeset
   626
    and 2: "P(x) ==> ALL x. P(x) ==> Q"
0c4fd7529467 clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents: 12875
diff changeset
   627
  shows Q
12349
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   628
proof -
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   629
  from 1 have "P(x)" by (rule spec)
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   630
  from this and 1 show Q by (rule 2)
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   631
qed
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   632
12937
0c4fd7529467 clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents: 12875
diff changeset
   633
lemma notE':
0c4fd7529467 clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents: 12875
diff changeset
   634
  assumes 1: "~ P"
0c4fd7529467 clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents: 12875
diff changeset
   635
    and 2: "~ P ==> P"
0c4fd7529467 clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents: 12875
diff changeset
   636
  shows R
12349
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   637
proof -
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   638
  from 2 and 1 have P .
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   639
  with 1 show R by (rule notE)
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   640
qed
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   641
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   642
lemmas [Pure.elim!] = disjE iffE FalseE conjE exE
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   643
  and [Pure.intro!] = iffI conjI impI TrueI notI allI refl
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   644
  and [Pure.elim 2] = allE notE' impE'
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   645
  and [Pure.intro] = exI disjI2 disjI1
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   646
18708
4b3dadb4fe33 setup: theory -> theory;
wenzelm
parents: 18523
diff changeset
   647
setup {* ContextRules.addSWrapper (fn tac => hyp_subst_tac ORELSE' tac) *}
12349
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   648
94e812f9683e setup "rules" method;
wenzelm
parents: 12114
diff changeset
   649
12368
2af9ad81ea56 sym declarations;
wenzelm
parents: 12352
diff changeset
   650
lemma iff_not_sym: "~ (Q <-> P) ==> ~ (P <-> Q)"
17591
33d409318266 renamed rules to iprover
nipkow
parents: 17276
diff changeset
   651
  by iprover
12368
2af9ad81ea56 sym declarations;
wenzelm
parents: 12352
diff changeset
   652
2af9ad81ea56 sym declarations;
wenzelm
parents: 12352
diff changeset
   653
lemmas [sym] = sym iff_sym not_sym iff_not_sym
2af9ad81ea56 sym declarations;
wenzelm
parents: 12352
diff changeset
   654
  and [Pure.elim?] = iffD1 iffD2 impE
2af9ad81ea56 sym declarations;
wenzelm
parents: 12352
diff changeset
   655
2af9ad81ea56 sym declarations;
wenzelm
parents: 12352
diff changeset
   656
13435
05631e8f0258 new theorem eq_commute
paulson
parents: 12937
diff changeset
   657
lemma eq_commute: "a=b <-> b=a"
05631e8f0258 new theorem eq_commute
paulson
parents: 12937
diff changeset
   658
apply (rule iffI) 
05631e8f0258 new theorem eq_commute
paulson
parents: 12937
diff changeset
   659
apply (erule sym)+
05631e8f0258 new theorem eq_commute
paulson
parents: 12937
diff changeset
   660
done
05631e8f0258 new theorem eq_commute
paulson
parents: 12937
diff changeset
   661
05631e8f0258 new theorem eq_commute
paulson
parents: 12937
diff changeset
   662
11677
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   663
subsection {* Atomizing meta-level rules *}
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   664
11747
17a6dcd6f3cf judgment Trueprop;
wenzelm
parents: 11734
diff changeset
   665
lemma atomize_all [atomize]: "(!!x. P(x)) == Trueprop (ALL x. P(x))"
11976
075df6e46cef equal_intr_rule already declared in Pure;
wenzelm
parents: 11953
diff changeset
   666
proof
11677
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   667
  assume "!!x. P(x)"
22931
11cc1ccad58e tuned proofs;
wenzelm
parents: 22139
diff changeset
   668
  then show "ALL x. P(x)" ..
11677
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   669
next
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   670
  assume "ALL x. P(x)"
22931
11cc1ccad58e tuned proofs;
wenzelm
parents: 22139
diff changeset
   671
  then show "!!x. P(x)" ..
11677
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   672
qed
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   673
11747
17a6dcd6f3cf judgment Trueprop;
wenzelm
parents: 11734
diff changeset
   674
lemma atomize_imp [atomize]: "(A ==> B) == Trueprop (A --> B)"
11976
075df6e46cef equal_intr_rule already declared in Pure;
wenzelm
parents: 11953
diff changeset
   675
proof
12368
2af9ad81ea56 sym declarations;
wenzelm
parents: 12352
diff changeset
   676
  assume "A ==> B"
22931
11cc1ccad58e tuned proofs;
wenzelm
parents: 22139
diff changeset
   677
  then show "A --> B" ..
11677
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   678
next
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   679
  assume "A --> B" and A
22931
11cc1ccad58e tuned proofs;
wenzelm
parents: 22139
diff changeset
   680
  then show B by (rule mp)
11677
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   681
qed
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   682
11747
17a6dcd6f3cf judgment Trueprop;
wenzelm
parents: 11734
diff changeset
   683
lemma atomize_eq [atomize]: "(x == y) == Trueprop (x = y)"
11976
075df6e46cef equal_intr_rule already declared in Pure;
wenzelm
parents: 11953
diff changeset
   684
proof
11677
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   685
  assume "x == y"
22931
11cc1ccad58e tuned proofs;
wenzelm
parents: 22139
diff changeset
   686
  show "x = y" unfolding `x == y` by (rule refl)
11677
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   687
next
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   688
  assume "x = y"
22931
11cc1ccad58e tuned proofs;
wenzelm
parents: 22139
diff changeset
   689
  then show "x == y" by (rule eq_reflection)
11677
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   690
qed
ee12f18599e5 atomize stuff from theory FOL;
wenzelm
parents: 9886
diff changeset
   691
18813
fc35dcc2558b added atomize_iff;
wenzelm
parents: 18708
diff changeset
   692
lemma atomize_iff [atomize]: "(A == B) == Trueprop (A <-> B)"
fc35dcc2558b added atomize_iff;
wenzelm
parents: 18708
diff changeset
   693
proof
fc35dcc2558b added atomize_iff;
wenzelm
parents: 18708
diff changeset
   694
  assume "A == B"
22931
11cc1ccad58e tuned proofs;
wenzelm
parents: 22139
diff changeset
   695
  show "A <-> B" unfolding `A == B` by (rule iff_refl)
18813
fc35dcc2558b added atomize_iff;
wenzelm
parents: 18708
diff changeset
   696
next
fc35dcc2558b added atomize_iff;
wenzelm
parents: 18708
diff changeset
   697
  assume "A <-> B"
22931
11cc1ccad58e tuned proofs;
wenzelm
parents: 22139
diff changeset
   698
  then show "A == B" by (rule iff_reflection)
18813
fc35dcc2558b added atomize_iff;
wenzelm
parents: 18708
diff changeset
   699
qed
fc35dcc2558b added atomize_iff;
wenzelm
parents: 18708
diff changeset
   700
28856
5e009a80fe6d Pure syntax: more coherent treatment of aprop, permanent TERM and &&&;
wenzelm
parents: 28699
diff changeset
   701
lemma atomize_conj [atomize]: "(A &&& B) == Trueprop (A & B)"
11976
075df6e46cef equal_intr_rule already declared in Pure;
wenzelm
parents: 11953
diff changeset
   702
proof
28856
5e009a80fe6d Pure syntax: more coherent treatment of aprop, permanent TERM and &&&;
wenzelm
parents: 28699
diff changeset
   703
  assume conj: "A &&& B"
19120
353d349740de not_equal: replaced syntax translation by abbreviation;
wenzelm
parents: 18861
diff changeset
   704
  show "A & B"
353d349740de not_equal: replaced syntax translation by abbreviation;
wenzelm
parents: 18861
diff changeset
   705
  proof (rule conjI)
353d349740de not_equal: replaced syntax translation by abbreviation;
wenzelm
parents: 18861
diff changeset
   706
    from conj show A by (rule conjunctionD1)
353d349740de not_equal: replaced syntax translation by abbreviation;
wenzelm
parents: 18861
diff changeset
   707
    from conj show B by (rule conjunctionD2)
353d349740de not_equal: replaced syntax translation by abbreviation;
wenzelm
parents: 18861
diff changeset
   708
  qed
11953
f98623fdf6ef atomize_conj;
wenzelm
parents: 11848
diff changeset
   709
next
19120
353d349740de not_equal: replaced syntax translation by abbreviation;
wenzelm
parents: 18861
diff changeset
   710
  assume conj: "A & B"
28856
5e009a80fe6d Pure syntax: more coherent treatment of aprop, permanent TERM and &&&;
wenzelm
parents: 28699
diff changeset
   711
  show "A &&& B"
19120
353d349740de not_equal: replaced syntax translation by abbreviation;
wenzelm
parents: 18861
diff changeset
   712
  proof -
353d349740de not_equal: replaced syntax translation by abbreviation;
wenzelm
parents: 18861
diff changeset
   713
    from conj show A ..
353d349740de not_equal: replaced syntax translation by abbreviation;
wenzelm
parents: 18861
diff changeset
   714
    from conj show B ..
11953
f98623fdf6ef atomize_conj;
wenzelm
parents: 11848
diff changeset
   715
  qed
f98623fdf6ef atomize_conj;
wenzelm
parents: 11848
diff changeset
   716
qed
f98623fdf6ef atomize_conj;
wenzelm
parents: 11848
diff changeset
   717
12368
2af9ad81ea56 sym declarations;
wenzelm
parents: 12352
diff changeset
   718
lemmas [symmetric, rulify] = atomize_all atomize_imp
18861
38269ef5175a declare defn rules;
wenzelm
parents: 18813
diff changeset
   719
  and [symmetric, defn] = atomize_all atomize_imp atomize_eq atomize_iff
11771
b7b100a2de1d moved rulify to ObjectLogic;
wenzelm
parents: 11747
diff changeset
   720
11848
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   721
26580
c3e597a476fd Generic conversion and tactic "atomize_elim" to convert elimination rules
krauss
parents: 26286
diff changeset
   722
subsection {* Atomizing elimination rules *}
c3e597a476fd Generic conversion and tactic "atomize_elim" to convert elimination rules
krauss
parents: 26286
diff changeset
   723
c3e597a476fd Generic conversion and tactic "atomize_elim" to convert elimination rules
krauss
parents: 26286
diff changeset
   724
setup AtomizeElim.setup
c3e597a476fd Generic conversion and tactic "atomize_elim" to convert elimination rules
krauss
parents: 26286
diff changeset
   725
c3e597a476fd Generic conversion and tactic "atomize_elim" to convert elimination rules
krauss
parents: 26286
diff changeset
   726
lemma atomize_exL[atomize_elim]: "(!!x. P(x) ==> Q) == ((EX x. P(x)) ==> Q)"
c3e597a476fd Generic conversion and tactic "atomize_elim" to convert elimination rules
krauss
parents: 26286
diff changeset
   727
by rule iprover+
c3e597a476fd Generic conversion and tactic "atomize_elim" to convert elimination rules
krauss
parents: 26286
diff changeset
   728
c3e597a476fd Generic conversion and tactic "atomize_elim" to convert elimination rules
krauss
parents: 26286
diff changeset
   729
lemma atomize_conjL[atomize_elim]: "(A ==> B ==> C) == (A & B ==> C)"
c3e597a476fd Generic conversion and tactic "atomize_elim" to convert elimination rules
krauss
parents: 26286
diff changeset
   730
by rule iprover+
c3e597a476fd Generic conversion and tactic "atomize_elim" to convert elimination rules
krauss
parents: 26286
diff changeset
   731
c3e597a476fd Generic conversion and tactic "atomize_elim" to convert elimination rules
krauss
parents: 26286
diff changeset
   732
lemma atomize_disjL[atomize_elim]: "((A ==> C) ==> (B ==> C) ==> C) == ((A | B ==> C) ==> C)"
c3e597a476fd Generic conversion and tactic "atomize_elim" to convert elimination rules
krauss
parents: 26286
diff changeset
   733
by rule iprover+
c3e597a476fd Generic conversion and tactic "atomize_elim" to convert elimination rules
krauss
parents: 26286
diff changeset
   734
c3e597a476fd Generic conversion and tactic "atomize_elim" to convert elimination rules
krauss
parents: 26286
diff changeset
   735
lemma atomize_elimL[atomize_elim]: "(!!B. (A ==> B) ==> B) == Trueprop(A)" ..
c3e597a476fd Generic conversion and tactic "atomize_elim" to convert elimination rules
krauss
parents: 26286
diff changeset
   736
c3e597a476fd Generic conversion and tactic "atomize_elim" to convert elimination rules
krauss
parents: 26286
diff changeset
   737
11848
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   738
subsection {* Calculational rules *}
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   739
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   740
lemma forw_subst: "a = b ==> P(b) ==> P(a)"
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   741
  by (rule ssubst)
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   742
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   743
lemma back_subst: "P(a) ==> a = b ==> P(b)"
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   744
  by (rule subst)
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   745
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   746
text {*
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   747
  Note that this list of rules is in reverse order of priorities.
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   748
*}
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   749
12019
abe9b7c6016e transitive declared in Pure;
wenzelm
parents: 11976
diff changeset
   750
lemmas basic_trans_rules [trans] =
11848
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   751
  forw_subst
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   752
  back_subst
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   753
  rev_mp
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   754
  mp
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   755
  trans
6e3017adb8c0 calculational rules moved from FOL to IFOL;
wenzelm
parents: 11771
diff changeset
   756
13779
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   757
subsection {* ``Let'' declarations *}
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   758
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   759
nonterminals letbinds letbind
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   760
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   761
constdefs
14854
61bdf2ae4dc5 removed obsolete sort 'logic';
wenzelm
parents: 14565
diff changeset
   762
  Let :: "['a::{}, 'a => 'b] => ('b::{})"
13779
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   763
    "Let(s, f) == f(s)"
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   764
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   765
syntax
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   766
  "_bind"       :: "[pttrn, 'a] => letbind"           ("(2_ =/ _)" 10)
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   767
  ""            :: "letbind => letbinds"              ("_")
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   768
  "_binds"      :: "[letbind, letbinds] => letbinds"  ("_;/ _")
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   769
  "_Let"        :: "[letbinds, 'a] => 'a"             ("(let (_)/ in (_))" 10)
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   770
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   771
translations
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   772
  "_Let(_binds(b, bs), e)"  == "_Let(b, _Let(bs, e))"
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   773
  "let x = a in e"          == "Let(a, %x. e)"
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   774
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   775
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   776
lemma LetI: 
21539
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   777
  assumes "!!x. x=t ==> P(u(x))"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   778
  shows "P(let x=t in u(x))"
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   779
  apply (unfold Let_def)
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   780
  apply (rule refl [THEN assms])
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   781
  done
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   782
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   783
26286
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   784
subsection {* Intuitionistic simplification rules *}
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   785
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   786
lemma conj_simps:
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   787
  "P & True <-> P"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   788
  "True & P <-> P"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   789
  "P & False <-> False"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   790
  "False & P <-> False"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   791
  "P & P <-> P"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   792
  "P & P & Q <-> P & Q"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   793
  "P & ~P <-> False"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   794
  "~P & P <-> False"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   795
  "(P & Q) & R <-> P & (Q & R)"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   796
  by iprover+
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   797
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   798
lemma disj_simps:
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   799
  "P | True <-> True"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   800
  "True | P <-> True"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   801
  "P | False <-> P"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   802
  "False | P <-> P"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   803
  "P | P <-> P"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   804
  "P | P | Q <-> P | Q"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   805
  "(P | Q) | R <-> P | (Q | R)"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   806
  by iprover+
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   807
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   808
lemma not_simps:
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   809
  "~(P|Q)  <-> ~P & ~Q"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   810
  "~ False <-> True"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   811
  "~ True <-> False"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   812
  by iprover+
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   813
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   814
lemma imp_simps:
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   815
  "(P --> False) <-> ~P"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   816
  "(P --> True) <-> True"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   817
  "(False --> P) <-> True"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   818
  "(True --> P) <-> P"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   819
  "(P --> P) <-> True"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   820
  "(P --> ~P) <-> ~P"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   821
  by iprover+
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   822
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   823
lemma iff_simps:
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   824
  "(True <-> P) <-> P"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   825
  "(P <-> True) <-> P"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   826
  "(P <-> P) <-> True"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   827
  "(False <-> P) <-> ~P"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   828
  "(P <-> False) <-> ~P"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   829
  by iprover+
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   830
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   831
(*The x=t versions are needed for the simplification procedures*)
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   832
lemma quant_simps:
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   833
  "!!P. (ALL x. P) <-> P"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   834
  "(ALL x. x=t --> P(x)) <-> P(t)"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   835
  "(ALL x. t=x --> P(x)) <-> P(t)"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   836
  "!!P. (EX x. P) <-> P"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   837
  "EX x. x=t"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   838
  "EX x. t=x"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   839
  "(EX x. x=t & P(x)) <-> P(t)"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   840
  "(EX x. t=x & P(x)) <-> P(t)"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   841
  by iprover+
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   842
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   843
(*These are NOT supplied by default!*)
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   844
lemma distrib_simps:
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   845
  "P & (Q | R) <-> P&Q | P&R"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   846
  "(Q | R) & P <-> Q&P | R&P"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   847
  "(P | Q --> R) <-> (P --> R) & (Q --> R)"
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   848
  by iprover+
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   849
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   850
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   851
text {* Conversion into rewrite rules *}
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   852
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   853
lemma P_iff_F: "~P ==> (P <-> False)" by iprover
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   854
lemma iff_reflection_F: "~P ==> (P == False)" by (rule P_iff_F [THEN iff_reflection])
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   855
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   856
lemma P_iff_T: "P ==> (P <-> True)" by iprover
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   857
lemma iff_reflection_T: "P ==> (P == True)" by (rule P_iff_T [THEN iff_reflection])
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   858
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   859
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   860
text {* More rewrite rules *}
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   861
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   862
lemma conj_commute: "P&Q <-> Q&P" by iprover
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   863
lemma conj_left_commute: "P&(Q&R) <-> Q&(P&R)" by iprover
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   864
lemmas conj_comms = conj_commute conj_left_commute
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   865
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   866
lemma disj_commute: "P|Q <-> Q|P" by iprover
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   867
lemma disj_left_commute: "P|(Q|R) <-> Q|(P|R)" by iprover
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   868
lemmas disj_comms = disj_commute disj_left_commute
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   869
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   870
lemma conj_disj_distribL: "P&(Q|R) <-> (P&Q | P&R)" by iprover
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   871
lemma conj_disj_distribR: "(P|Q)&R <-> (P&R | Q&R)" by iprover
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   872
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   873
lemma disj_conj_distribL: "P|(Q&R) <-> (P|Q) & (P|R)" by iprover
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   874
lemma disj_conj_distribR: "(P&Q)|R <-> (P|R) & (Q|R)" by iprover
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   875
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   876
lemma imp_conj_distrib: "(P --> (Q&R)) <-> (P-->Q) & (P-->R)" by iprover
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   877
lemma imp_conj: "((P&Q)-->R)   <-> (P --> (Q --> R))" by iprover
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   878
lemma imp_disj: "(P|Q --> R)   <-> (P-->R) & (Q-->R)" by iprover
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   879
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   880
lemma de_Morgan_disj: "(~(P | Q)) <-> (~P & ~Q)" by iprover
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   881
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   882
lemma not_ex: "(~ (EX x. P(x))) <-> (ALL x.~P(x))" by iprover
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   883
lemma imp_ex: "((EX x. P(x)) --> Q) <-> (ALL x. P(x) --> Q)" by iprover
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   884
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   885
lemma ex_disj_distrib:
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   886
  "(EX x. P(x) | Q(x)) <-> ((EX x. P(x)) | (EX x. Q(x)))" by iprover
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   887
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   888
lemma all_conj_distrib:
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   889
  "(ALL x. P(x) & Q(x)) <-> ((ALL x. P(x)) & (ALL x. Q(x)))" by iprover
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   890
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   891
3ff5d257f175 added lemmas from simpdata.ML;
wenzelm
parents: 24830
diff changeset
   892
subsection {* Legacy ML bindings *}
13779
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   893
21539
c5cf9243ad62 converted legacy ML scripts;
wenzelm
parents: 21524
diff changeset
   894
ML {*
22139
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   895
val refl = @{thm refl}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   896
val trans = @{thm trans}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   897
val sym = @{thm sym}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   898
val subst = @{thm subst}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   899
val ssubst = @{thm ssubst}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   900
val conjI = @{thm conjI}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   901
val conjE = @{thm conjE}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   902
val conjunct1 = @{thm conjunct1}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   903
val conjunct2 = @{thm conjunct2}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   904
val disjI1 = @{thm disjI1}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   905
val disjI2 = @{thm disjI2}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   906
val disjE = @{thm disjE}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   907
val impI = @{thm impI}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   908
val impE = @{thm impE}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   909
val mp = @{thm mp}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   910
val rev_mp = @{thm rev_mp}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   911
val TrueI = @{thm TrueI}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   912
val FalseE = @{thm FalseE}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   913
val iff_refl = @{thm iff_refl}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   914
val iff_trans = @{thm iff_trans}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   915
val iffI = @{thm iffI}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   916
val iffE = @{thm iffE}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   917
val iffD1 = @{thm iffD1}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   918
val iffD2 = @{thm iffD2}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   919
val notI = @{thm notI}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   920
val notE = @{thm notE}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   921
val allI = @{thm allI}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   922
val allE = @{thm allE}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   923
val spec = @{thm spec}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   924
val exI = @{thm exI}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   925
val exE = @{thm exE}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   926
val eq_reflection = @{thm eq_reflection}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   927
val iff_reflection = @{thm iff_reflection}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   928
val meta_eq_to_obj_eq = @{thm meta_eq_to_obj_eq}
539a63b98f76 tuned ML setup;
wenzelm
parents: 21539
diff changeset
   929
val meta_eq_to_iff = @{thm meta_eq_to_iff}
13779
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   930
*}
2a34dc5cf79e moving "let" from ZF to FOL
paulson
parents: 13435
diff changeset
   931
4854
d1850e0964f2 tuned setup;
wenzelm
parents: 4793
diff changeset
   932
end