doc-src/TutorialI/Rules/Basic.thy
author paulson
Fri, 12 Jan 2001 16:28:14 +0100
changeset 10884 2995639c6a09
parent 10843 f2e4e383dbca
child 10957 2a4a50e7ddf2
permissions -rw-r--r--
renaming of some files
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10341
6eb91805a012 added the $Id:$ line
paulson
parents: 10295
diff changeset
     1
(* ID:         $Id$ *)
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
     2
theory Basic = Main:
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
     3
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
     4
lemma conj_rule: "\<lbrakk> P; Q \<rbrakk> \<Longrightarrow> P \<and> (Q \<and> P)"
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
     5
apply (rule conjI)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
     6
 apply assumption
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
     7
apply (rule conjI)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
     8
 apply assumption
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
     9
apply assumption
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    10
done
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    11
    
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    12
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    13
lemma disj_swap: "P | Q \<Longrightarrow> Q | P"
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    14
apply (erule disjE)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    15
 apply (rule disjI2)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    16
 apply assumption
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    17
apply (rule disjI1)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    18
apply assumption
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    19
done
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    20
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    21
lemma conj_swap: "P \<and> Q \<Longrightarrow> Q \<and> P"
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    22
apply (rule conjI)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    23
 apply (drule conjunct2)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    24
 apply assumption
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    25
apply (drule conjunct1)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    26
apply assumption
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    27
done
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    28
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    29
lemma imp_uncurry: "P \<longrightarrow> Q \<longrightarrow> R \<Longrightarrow> P \<and> Q \<longrightarrow> R"
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    30
apply (rule impI)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    31
apply (erule conjE)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    32
apply (drule mp)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    33
 apply assumption
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    34
apply (drule mp)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    35
  apply assumption
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    36
 apply assumption
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    37
done
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    38
10843
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
    39
text {*NEW
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
    40
by eliminates uses of assumption and done
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
    41
*}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
    42
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
    43
lemma imp_uncurry: "P \<longrightarrow> Q \<longrightarrow> R \<Longrightarrow> P \<and> Q \<longrightarrow> R"
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
    44
apply (rule impI)
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
    45
apply (erule conjE)
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
    46
apply (drule mp)
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
    47
 apply assumption
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
    48
by (drule mp)
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
    49
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
    50
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    51
text {*
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    52
substitution
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    53
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    54
@{thm[display] ssubst}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    55
\rulename{ssubst}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    56
*};
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    57
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    58
lemma "\<lbrakk> x = f x; P(f x) \<rbrakk> \<Longrightarrow> P x"
10843
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
    59
by (erule ssubst)
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    60
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    61
text {*
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    62
also provable by simp (re-orients)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    63
*};
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    64
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    65
lemma "\<lbrakk> x = f x; P (f x) (f x) x \<rbrakk> \<Longrightarrow> P x x x"
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    66
apply (erule ssubst)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    67
back
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    68
back
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    69
back
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    70
back
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    71
apply assumption
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    72
done
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    73
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    74
text {*
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    75
proof\ {\isacharparenleft}prove{\isacharparenright}{\isacharcolon}\ step\ \isadigit{1}\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    76
\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    77
goal\ {\isacharparenleft}lemma{\isacharparenright}{\isacharcolon}\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    78
{\isasymlbrakk}x\ {\isacharequal}\ f\ x{\isacharsemicolon}\ P\ {\isacharparenleft}f\ x{\isacharparenright}\ {\isacharparenleft}f\ x{\isacharparenright}\ x{\isasymrbrakk}\ {\isasymLongrightarrow}\ P\ x\ x\ x\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    79
\ \isadigit{1}{\isachardot}\ P\ {\isacharparenleft}f\ x{\isacharparenright}\ {\isacharparenleft}f\ x{\isacharparenright}\ x\ {\isasymLongrightarrow}\ P\ {\isacharparenleft}f\ x{\isacharparenright}\ {\isacharparenleft}f\ x{\isacharparenright}\ {\isacharparenleft}f\ x{\isacharparenright}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    80
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    81
proof\ {\isacharparenleft}prove{\isacharparenright}{\isacharcolon}\ step\ \isadigit{1}\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    82
\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    83
goal\ {\isacharparenleft}lemma{\isacharparenright}{\isacharcolon}\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    84
{\isasymlbrakk}x\ {\isacharequal}\ f\ x{\isacharsemicolon}\ P\ {\isacharparenleft}f\ x{\isacharparenright}\ {\isacharparenleft}f\ x{\isacharparenright}\ x{\isasymrbrakk}\ {\isasymLongrightarrow}\ P\ x\ x\ x\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    85
\ \isadigit{1}{\isachardot}\ P\ {\isacharparenleft}f\ x{\isacharparenright}\ {\isacharparenleft}f\ x{\isacharparenright}\ x\ {\isasymLongrightarrow}\ P\ x\ {\isacharparenleft}f\ x{\isacharparenright}\ {\isacharparenleft}f\ x{\isacharparenright}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    86
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    87
proof\ {\isacharparenleft}prove{\isacharparenright}{\isacharcolon}\ step\ \isadigit{1}\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    88
\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    89
goal\ {\isacharparenleft}lemma{\isacharparenright}{\isacharcolon}\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    90
{\isasymlbrakk}x\ {\isacharequal}\ f\ x{\isacharsemicolon}\ P\ {\isacharparenleft}f\ x{\isacharparenright}\ {\isacharparenleft}f\ x{\isacharparenright}\ x{\isasymrbrakk}\ {\isasymLongrightarrow}\ P\ x\ x\ x\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    91
\ \isadigit{1}{\isachardot}\ P\ {\isacharparenleft}f\ x{\isacharparenright}\ {\isacharparenleft}f\ x{\isacharparenright}\ x\ {\isasymLongrightarrow}\ P\ {\isacharparenleft}f\ x{\isacharparenright}\ x\ {\isacharparenleft}f\ x{\isacharparenright}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    92
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    93
proof\ {\isacharparenleft}prove{\isacharparenright}{\isacharcolon}\ step\ \isadigit{1}\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    94
\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    95
goal\ {\isacharparenleft}lemma{\isacharparenright}{\isacharcolon}\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    96
{\isasymlbrakk}x\ {\isacharequal}\ f\ x{\isacharsemicolon}\ P\ {\isacharparenleft}f\ x{\isacharparenright}\ {\isacharparenleft}f\ x{\isacharparenright}\ x{\isasymrbrakk}\ {\isasymLongrightarrow}\ P\ x\ x\ x\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    97
\ \isadigit{1}{\isachardot}\ P\ {\isacharparenleft}f\ x{\isacharparenright}\ {\isacharparenleft}f\ x{\isacharparenright}\ x\ {\isasymLongrightarrow}\ P\ x\ x\ {\isacharparenleft}f\ x{\isacharparenright}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    98
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    99
proof\ {\isacharparenleft}prove{\isacharparenright}{\isacharcolon}\ step\ \isadigit{1}\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   100
\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   101
goal\ {\isacharparenleft}lemma{\isacharparenright}{\isacharcolon}\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   102
{\isasymlbrakk}x\ {\isacharequal}\ f\ x{\isacharsemicolon}\ P\ {\isacharparenleft}f\ x{\isacharparenright}\ {\isacharparenleft}f\ x{\isacharparenright}\ x{\isasymrbrakk}\ {\isasymLongrightarrow}\ P\ x\ x\ x\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   103
\ \isadigit{1}{\isachardot}\ P\ {\isacharparenleft}f\ x{\isacharparenright}\ {\isacharparenleft}f\ x{\isacharparenright}\ x\ {\isasymLongrightarrow}\ P\ {\isacharparenleft}f\ x{\isacharparenright}\ {\isacharparenleft}f\ x{\isacharparenright}\ x
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   104
*};
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   105
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   106
lemma "\<lbrakk> x = f x; P (f x) (f x) x \<rbrakk> \<Longrightarrow> P x x x"
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   107
apply (erule ssubst, assumption)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   108
done
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   109
10843
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   110
text{*
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   111
or better still NEW
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   112
*}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   113
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   114
lemma "\<lbrakk> x = f x; P (f x) (f x) x \<rbrakk> \<Longrightarrow> P x x x"
10843
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   115
by (erule ssubst)
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   116
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   117
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   118
text{*NEW*}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   119
lemma "\<lbrakk> x = f x; P (f x) (f x) x \<rbrakk> \<Longrightarrow> P x x x"
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   120
apply (erule_tac P="\<lambda>u. P u u x" in ssubst)
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   121
apply (assumption)
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   122
done
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   123
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   124
10843
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   125
lemma "\<lbrakk> x = f x; P (f x) (f x) x \<rbrakk> \<Longrightarrow> P x x x"
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   126
by (erule_tac P="\<lambda>u. P u u x" in ssubst)
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   127
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   128
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   129
text {*
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   130
negation
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   131
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   132
@{thm[display] notI}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   133
\rulename{notI}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   134
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   135
@{thm[display] notE}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   136
\rulename{notE}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   137
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   138
@{thm[display] classical}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   139
\rulename{classical}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   140
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   141
@{thm[display] contrapos_pp}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   142
\rulename{contrapos_pp}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   143
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   144
@{thm[display] contrapos_np}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   145
\rulename{contrapos_np}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   146
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   147
@{thm[display] contrapos_nn}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   148
\rulename{contrapos_nn}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   149
*};
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   150
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   151
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   152
lemma "\<lbrakk>\<not>(P\<longrightarrow>Q); \<not>(R\<longrightarrow>Q)\<rbrakk> \<Longrightarrow> R"
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   153
apply (erule_tac Q="R\<longrightarrow>Q" in contrapos_np)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   154
txt{*
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   155
proof\ {\isacharparenleft}prove{\isacharparenright}{\isacharcolon}\ step\ {\isadigit{1}}\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   156
\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   157
goal\ {\isacharparenleft}lemma{\isacharparenright}{\isacharcolon}\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   158
{\isasymlbrakk}{\isasymnot}\ {\isacharparenleft}P\ {\isasymlongrightarrow}\ Q{\isacharparenright}{\isacharsemicolon}\ {\isasymnot}\ {\isacharparenleft}R\ {\isasymlongrightarrow}\ Q{\isacharparenright}{\isasymrbrakk}\ {\isasymLongrightarrow}\ R\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   159
\ {\isadigit{1}}{\isachardot}\ {\isasymlbrakk}{\isasymnot}\ {\isacharparenleft}P\ {\isasymlongrightarrow}\ Q{\isacharparenright}{\isacharsemicolon}\ {\isasymnot}\ R{\isasymrbrakk}\ {\isasymLongrightarrow}\ R\ {\isasymlongrightarrow}\ Q
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   160
*}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   161
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   162
apply intro
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   163
txt{*
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   164
proof\ {\isacharparenleft}prove{\isacharparenright}{\isacharcolon}\ step\ {\isadigit{3}}\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   165
\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   166
goal\ {\isacharparenleft}lemma{\isacharparenright}{\isacharcolon}\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   167
{\isasymlbrakk}{\isasymnot}\ {\isacharparenleft}P\ {\isasymlongrightarrow}\ Q{\isacharparenright}{\isacharsemicolon}\ {\isasymnot}\ {\isacharparenleft}R\ {\isasymlongrightarrow}\ Q{\isacharparenright}{\isasymrbrakk}\ {\isasymLongrightarrow}\ R\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   168
\ {\isadigit{1}}{\isachardot}\ {\isasymlbrakk}{\isasymnot}\ {\isacharparenleft}P\ {\isasymlongrightarrow}\ Q{\isacharparenright}{\isacharsemicolon}\ {\isasymnot}\ R{\isacharsemicolon}\ R{\isasymrbrakk}\ {\isasymLongrightarrow}\ Q
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   169
*}
10843
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   170
by (erule notE)
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   171
text{*NEW*}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   172
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   173
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   174
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   175
lemma "(P \<or> Q) \<and> R \<Longrightarrow> P \<or> Q \<and> R"
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   176
apply intro
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   177
txt{*
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   178
proof\ {\isacharparenleft}prove{\isacharparenright}{\isacharcolon}\ step\ {\isadigit{1}}\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   179
\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   180
goal\ {\isacharparenleft}lemma{\isacharparenright}{\isacharcolon}\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   181
{\isacharparenleft}P\ {\isasymor}\ Q{\isacharparenright}\ {\isasymand}\ R\ {\isasymLongrightarrow}\ P\ {\isasymor}\ Q\ {\isasymand}\ R\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   182
\ {\isadigit{1}}{\isachardot}\ {\isasymlbrakk}{\isacharparenleft}P\ {\isasymor}\ Q{\isacharparenright}\ {\isasymand}\ R{\isacharsemicolon}\ {\isasymnot}\ {\isacharparenleft}Q\ {\isasymand}\ R{\isacharparenright}{\isasymrbrakk}\ {\isasymLongrightarrow}\ P
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   183
*}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   184
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   185
apply (elim conjE disjE)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   186
 apply assumption
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   187
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   188
txt{*
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   189
proof\ {\isacharparenleft}prove{\isacharparenright}{\isacharcolon}\ step\ {\isadigit{4}}\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   190
\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   191
goal\ {\isacharparenleft}lemma{\isacharparenright}{\isacharcolon}\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   192
{\isacharparenleft}P\ {\isasymor}\ Q{\isacharparenright}\ {\isasymand}\ R\ {\isasymLongrightarrow}\ P\ {\isasymor}\ Q\ {\isasymand}\ R\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   193
\ {\isadigit{1}}{\isachardot}\ {\isasymlbrakk}{\isasymnot}\ {\isacharparenleft}Q\ {\isasymand}\ R{\isacharparenright}{\isacharsemicolon}\ R{\isacharsemicolon}\ Q{\isasymrbrakk}\ {\isasymLongrightarrow}\ P
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   194
*}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   195
10843
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   196
by (erule contrapos_np, rule conjI)
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   197
text{*NEW
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   198
proof\ {\isacharparenleft}prove{\isacharparenright}{\isacharcolon}\ step\ {\isadigit{6}}\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   199
\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   200
goal\ {\isacharparenleft}lemma{\isacharparenright}{\isacharcolon}\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   201
{\isacharparenleft}P\ {\isasymor}\ Q{\isacharparenright}\ {\isasymand}\ R\ {\isasymLongrightarrow}\ P\ {\isasymor}\ Q\ {\isasymand}\ R\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   202
\ {\isadigit{1}}{\isachardot}\ {\isasymlbrakk}R{\isacharsemicolon}\ Q{\isacharsemicolon}\ {\isasymnot}\ P{\isasymrbrakk}\ {\isasymLongrightarrow}\ Q\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   203
\ {\isadigit{2}}{\isachardot}\ {\isasymlbrakk}R{\isacharsemicolon}\ Q{\isacharsemicolon}\ {\isasymnot}\ P{\isasymrbrakk}\ {\isasymLongrightarrow}\ R
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   204
*}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   205
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   206
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   207
text{*Quantifiers*}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   208
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   209
lemma "\<forall>x. P x \<longrightarrow> P x"
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   210
apply (rule allI)
10843
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   211
by (rule impI)
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   212
text{*NEW*}
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   213
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   214
lemma "(\<forall>x. P \<longrightarrow> Q x) \<Longrightarrow> P \<longrightarrow> (\<forall>x. Q x)"
10843
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   215
apply (rule impI, rule allI)
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   216
apply (drule spec)
10843
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   217
by (drule mp)
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   218
text{*NEW*}
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   219
10843
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   220
lemma "\<lbrakk>\<forall>x. P x \<longrightarrow> P (h x); P a\<rbrakk> \<Longrightarrow> P(h (h a))"
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   221
apply (frule spec)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   222
apply (drule mp, assumption)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   223
apply (drule spec)
10843
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   224
by (drule mp)
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   225
text{*NEW*}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   226
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   227
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   228
text
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   229
{*
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   230
proof\ {\isacharparenleft}prove{\isacharparenright}{\isacharcolon}\ step\ {\isadigit{1}}\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   231
\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   232
goal\ {\isacharparenleft}lemma{\isacharparenright}{\isacharcolon}\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   233
{\isasymlbrakk}{\isasymforall}x{\isachardot}\ P\ x\ {\isasymlongrightarrow}\ P\ {\isacharparenleft}f\ x{\isacharparenright}{\isacharsemicolon}\ P\ a{\isasymrbrakk}\ {\isasymLongrightarrow}\ P\ {\isacharparenleft}f\ {\isacharparenleft}f\ a{\isacharparenright}{\isacharparenright}\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   234
\ {\isadigit{1}}{\isachardot}\ {\isasymlbrakk}{\isasymforall}x{\isachardot}\ P\ x\ {\isasymlongrightarrow}\ P\ {\isacharparenleft}f\ x{\isacharparenright}{\isacharsemicolon}\ P\ a{\isacharsemicolon}\ P\ {\isacharquery}x\ {\isasymlongrightarrow}\ P\ {\isacharparenleft}f\ {\isacharquery}x{\isacharparenright}{\isasymrbrakk}\ {\isasymLongrightarrow}\ P\ {\isacharparenleft}f\ {\isacharparenleft}f\ a{\isacharparenright}{\isacharparenright}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   235
*}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   236
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   237
text{*
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   238
proof\ {\isacharparenleft}prove{\isacharparenright}{\isacharcolon}\ step\ {\isadigit{3}}\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   239
\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   240
goal\ {\isacharparenleft}lemma{\isacharparenright}{\isacharcolon}\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   241
{\isasymlbrakk}{\isasymforall}x{\isachardot}\ P\ x\ {\isasymlongrightarrow}\ P\ {\isacharparenleft}f\ x{\isacharparenright}{\isacharsemicolon}\ P\ a{\isasymrbrakk}\ {\isasymLongrightarrow}\ P\ {\isacharparenleft}f\ {\isacharparenleft}f\ a{\isacharparenright}{\isacharparenright}\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   242
\ {\isadigit{1}}{\isachardot}\ {\isasymlbrakk}{\isasymforall}x{\isachardot}\ P\ x\ {\isasymlongrightarrow}\ P\ {\isacharparenleft}f\ x{\isacharparenright}{\isacharsemicolon}\ P\ a{\isacharsemicolon}\ P\ {\isacharparenleft}f\ a{\isacharparenright}{\isasymrbrakk}\ {\isasymLongrightarrow}\ P\ {\isacharparenleft}f\ {\isacharparenleft}f\ a{\isacharparenright}{\isacharparenright}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   243
*}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   244
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   245
lemma "\<lbrakk>\<forall>x. P x \<longrightarrow> P (f x); P a\<rbrakk> \<Longrightarrow> P(f (f a))"
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   246
by blast
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   247
10843
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   248
text{*NEW
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   249
Hilbert-epsilon theorems*}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   250
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   251
text{*
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   252
@{thm[display] some_equality[no_vars]}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   253
\rulename{some_equality}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   254
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   255
@{thm[display] someI[no_vars]}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   256
\rulename{someI}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   257
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   258
@{thm[display] someI2[no_vars]}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   259
\rulename{someI2}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   260
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   261
needed for examples
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   262
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   263
@{thm[display] inv_def[no_vars]}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   264
\rulename{inv_def}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   265
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   266
@{thm[display] Least_def[no_vars]}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   267
\rulename{Least_def}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   268
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   269
@{thm[display] order_antisym[no_vars]}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   270
\rulename{order_antisym}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   271
*}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   272
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   273
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   274
lemma "inv Suc (Suc x) = x"
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   275
by (simp add: inv_def)
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   276
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   277
text{*but we know nothing about inv Suc 0*}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   278
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   279
theorem Least_equality:
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   280
     "\<lbrakk> P (k::nat);  \<forall>x. P x \<longrightarrow> k \<le> x \<rbrakk> \<Longrightarrow> (LEAST x. P(x)) = k"
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   281
apply (simp add: Least_def)
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   282
 
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   283
txt{*omit maybe?
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   284
@{subgoals[display,indent=0,margin=65]}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   285
*};
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   286
   
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   287
apply (rule some_equality)
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   288
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   289
txt{*
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   290
@{subgoals[display,indent=0,margin=65]}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   291
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   292
first subgoal is existence; second is uniqueness
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   293
*};
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   294
by (auto intro: order_antisym)
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   295
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   296
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   297
theorem axiom_of_choice:
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   298
     "(\<forall>x. \<exists> y. P x y) \<Longrightarrow> \<exists>f. \<forall>x. P x (f x)"
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   299
apply (rule exI, rule allI)
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   300
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   301
txt{*
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   302
@{subgoals[display,indent=0,margin=65]}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   303
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   304
state after intro rules
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   305
*};
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   306
apply (drule spec, erule exE)
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   307
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   308
txt{*
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   309
@{subgoals[display,indent=0,margin=65]}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   310
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   311
applying @text{someI} automatically instantiates
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   312
@{term f} to @{term "\<lambda>x. SOME y. P x y"}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   313
*};
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   314
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   315
by (rule someI)
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   316
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   317
(*both can be done by blast, which however hasn't been introduced yet*)
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   318
lemma "[| P (k::nat);  \<forall>x. P x \<longrightarrow> k \<le> x |] ==> (LEAST x. P(x)) = k";
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   319
apply (simp add: Least_def)
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   320
by (blast intro: some_equality order_antisym);
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   321
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   322
theorem axiom_of_choice: "(\<forall>x. \<exists> y. P x y) \<Longrightarrow> \<exists>f. \<forall>x. P x (f x)"
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   323
apply (rule exI [of _  "\<lambda>x. SOME y. P x y"])
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   324
by (blast intro: someI);
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   325
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   326
text{*end of NEW material*}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   327
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   328
lemma "(\<exists>x. P x) \<or> (\<exists>x. Q x) \<Longrightarrow> \<exists>x. P x \<or> Q x"
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   329
apply elim
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   330
 apply intro
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   331
 apply assumption
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   332
apply (intro exI disjI2) (*or else we get disjCI*)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   333
apply assumption
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   334
done
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   335
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   336
lemma "(P\<longrightarrow>Q) \<or> (Q\<longrightarrow>P)"
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   337
apply intro
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   338
apply elim
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   339
apply assumption
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   340
done
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   341
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   342
lemma "(P\<or>Q)\<and>(P\<or>R) \<Longrightarrow> P \<or> (Q\<and>R)"
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   343
apply intro
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   344
apply (elim conjE disjE)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   345
apply blast
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   346
apply blast
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   347
apply blast
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   348
apply blast
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   349
(*apply elim*)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   350
done
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   351
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   352
lemma "(\<exists>x. P \<and> Q x) \<Longrightarrow> P \<and> (\<exists>x. Q x)"
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   353
apply (erule exE)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   354
apply (erule conjE)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   355
apply (rule conjI)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   356
 apply assumption
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   357
apply (rule exI)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   358
 apply assumption
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   359
done
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   360
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   361
lemma "(\<exists>x. P x) \<and> (\<exists>x. Q x) \<Longrightarrow> \<exists>x. P x \<and> Q x"
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   362
apply (erule conjE)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   363
apply (erule exE)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   364
apply (erule exE)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   365
apply (rule exI)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   366
apply (rule conjI)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   367
 apply assumption
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   368
oops
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   369
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   370
lemma "\<forall> z. R z z \<Longrightarrow> \<exists>x. \<forall> y. R x y"
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   371
apply (rule exI)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   372
apply (rule allI)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   373
apply (drule spec)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   374
oops
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   375
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   376
lemma "\<forall>x. \<exists> y. x=y"
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   377
apply (rule allI)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   378
apply (rule exI)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   379
apply (rule refl)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   380
done
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   381
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   382
lemma "\<exists>x. \<forall> y. x=y"
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   383
apply (rule exI)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   384
apply (rule allI)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   385
oops
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   386
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   387
end