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