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