doc-src/TutorialI/Rules/Basic.thy
author chaieb
Wed, 19 May 2004 11:23:59 +0200
changeset 14758 af3b71a46a1c
parent 13756 41abb61ecce9
child 16417 9bc16273c2d4
permissions -rw-r--r--
A new implementation for presburger arithmetic following the one suggested in technical report Chaieb Amine and Tobias Nipkow. It is generic an smaller. the tactic has also changed and allows the abstaction over fuction occurences whose type is nat or int.
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
10957
2a4a50e7ddf2 rename_tac example; tidying to use @subgoals
paulson
parents: 10843
diff changeset
    39
text {*
10843
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
13550
5a176b8dda84 removal of blast.overloaded
paulson
parents: 12408
diff changeset
    43
lemma imp_uncurry': "P \<longrightarrow> Q \<longrightarrow> R \<Longrightarrow> P \<and> Q \<longrightarrow> R"
10843
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
11182
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
    65
text {*
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
    66
the subst method
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
    67
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
    68
@{thm[display] mult_commute}
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
    69
\rulename{mult_commute}
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
    70
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
    71
this would fail:
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
    72
apply (simp add: mult_commute) 
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
    73
*};
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
    74
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
    75
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
    76
lemma "\<lbrakk>P x y z; Suc x < y\<rbrakk> \<Longrightarrow> f z = x*y"
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
    77
txt{*
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
    78
@{subgoals[display,indent=0,margin=65]}
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
    79
*};
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
    80
apply (subst mult_commute) 
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
    81
txt{*
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
    82
@{subgoals[display,indent=0,margin=65]}
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
    83
*};
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
    84
oops
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
    85
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
    86
(*exercise involving THEN*)
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
    87
lemma "\<lbrakk>P x y z; Suc x < y\<rbrakk> \<Longrightarrow> f z = x*y"
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
    88
apply (rule mult_commute [THEN ssubst]) 
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
    89
oops
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
    90
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
    91
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
    92
lemma "\<lbrakk>x = f x; triple (f x) (f x) x\<rbrakk> \<Longrightarrow> triple x x x"
10957
2a4a50e7ddf2 rename_tac example; tidying to use @subgoals
paulson
parents: 10843
diff changeset
    93
apply (erule ssubst) 
2a4a50e7ddf2 rename_tac example; tidying to use @subgoals
paulson
parents: 10843
diff changeset
    94
  --{* @{subgoals[display,indent=0,margin=65]} *}
2a4a50e7ddf2 rename_tac example; tidying to use @subgoals
paulson
parents: 10843
diff changeset
    95
back --{* @{subgoals[display,indent=0,margin=65]} *}
2a4a50e7ddf2 rename_tac example; tidying to use @subgoals
paulson
parents: 10843
diff changeset
    96
back --{* @{subgoals[display,indent=0,margin=65]} *}
2a4a50e7ddf2 rename_tac example; tidying to use @subgoals
paulson
parents: 10843
diff changeset
    97
back --{* @{subgoals[display,indent=0,margin=65]} *}
2a4a50e7ddf2 rename_tac example; tidying to use @subgoals
paulson
parents: 10843
diff changeset
    98
back --{* @{subgoals[display,indent=0,margin=65]} *}
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
    99
apply assumption
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   100
done
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   101
11182
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
   102
lemma "\<lbrakk> x = f x; triple (f x) (f x) x \<rbrakk> \<Longrightarrow> triple x x x"
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   103
apply (erule ssubst, assumption)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   104
done
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   105
10843
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   106
text{*
10957
2a4a50e7ddf2 rename_tac example; tidying to use @subgoals
paulson
parents: 10843
diff changeset
   107
or better still 
10843
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   108
*}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   109
11182
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
   110
lemma "\<lbrakk> x = f x; triple (f x) (f x) x \<rbrakk> \<Longrightarrow> triple x x x"
10843
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   111
by (erule ssubst)
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
11182
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
   114
lemma "\<lbrakk> x = f x; triple (f x) (f x) x \<rbrakk> \<Longrightarrow> triple x x x"
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
   115
apply (erule_tac P="\<lambda>u. triple u u x" in ssubst)
10843
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   116
apply (assumption)
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   117
done
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   118
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   119
11182
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
   120
lemma "\<lbrakk> x = f x; triple (f x) (f x) x \<rbrakk> \<Longrightarrow> triple x x x"
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
   121
by (erule_tac P="\<lambda>u. triple u u x" in ssubst)
10843
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   122
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   123
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   124
text {*
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   125
negation
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   126
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   127
@{thm[display] notI}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   128
\rulename{notI}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   129
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   130
@{thm[display] notE}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   131
\rulename{notE}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   132
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   133
@{thm[display] classical}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   134
\rulename{classical}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   135
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   136
@{thm[display] contrapos_pp}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   137
\rulename{contrapos_pp}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   138
11407
138919f1a135 tweaks for new version
paulson
parents: 11244
diff changeset
   139
@{thm[display] contrapos_pn}
138919f1a135 tweaks for new version
paulson
parents: 11244
diff changeset
   140
\rulename{contrapos_pn}
138919f1a135 tweaks for new version
paulson
parents: 11244
diff changeset
   141
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   142
@{thm[display] contrapos_np}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   143
\rulename{contrapos_np}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   144
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   145
@{thm[display] contrapos_nn}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   146
\rulename{contrapos_nn}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   147
*};
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   148
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   149
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   150
lemma "\<lbrakk>\<not>(P\<longrightarrow>Q); \<not>(R\<longrightarrow>Q)\<rbrakk> \<Longrightarrow> R"
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   151
apply (erule_tac Q="R\<longrightarrow>Q" in contrapos_np)
10957
2a4a50e7ddf2 rename_tac example; tidying to use @subgoals
paulson
parents: 10843
diff changeset
   152
	--{* @{subgoals[display,indent=0,margin=65]} *}
12390
2fa13b499975 adapted intr/elim uses;
wenzelm
parents: 11458
diff changeset
   153
apply (intro impI)
10957
2a4a50e7ddf2 rename_tac example; tidying to use @subgoals
paulson
parents: 10843
diff changeset
   154
	--{* @{subgoals[display,indent=0,margin=65]} *}
10843
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   155
by (erule notE)
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   156
11080
22855d091249 various revisions in response to comments from Tobias
paulson
parents: 10957
diff changeset
   157
text {*
22855d091249 various revisions in response to comments from Tobias
paulson
parents: 10957
diff changeset
   158
@{thm[display] disjCI}
22855d091249 various revisions in response to comments from Tobias
paulson
parents: 10957
diff changeset
   159
\rulename{disjCI}
22855d091249 various revisions in response to comments from Tobias
paulson
parents: 10957
diff changeset
   160
*};
22855d091249 various revisions in response to comments from Tobias
paulson
parents: 10957
diff changeset
   161
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   162
lemma "(P \<or> Q) \<and> R \<Longrightarrow> P \<or> Q \<and> R"
12408
2884148a9fe9 intro and elim now require arguments
paulson
parents: 12390
diff changeset
   163
apply (intro disjCI conjI)
10957
2a4a50e7ddf2 rename_tac example; tidying to use @subgoals
paulson
parents: 10843
diff changeset
   164
	--{* @{subgoals[display,indent=0,margin=65]} *}
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   165
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   166
apply (elim conjE disjE)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   167
 apply assumption
10957
2a4a50e7ddf2 rename_tac example; tidying to use @subgoals
paulson
parents: 10843
diff changeset
   168
	--{* @{subgoals[display,indent=0,margin=65]} *}
10295
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 contrapos_np, rule conjI)
10957
2a4a50e7ddf2 rename_tac example; tidying to use @subgoals
paulson
parents: 10843
diff changeset
   171
text{*
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   172
proof\ {\isacharparenleft}prove{\isacharparenright}{\isacharcolon}\ step\ {\isadigit{6}}\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   173
\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   174
goal\ {\isacharparenleft}lemma{\isacharparenright}{\isacharcolon}\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   175
{\isacharparenleft}P\ {\isasymor}\ Q{\isacharparenright}\ {\isasymand}\ R\ {\isasymLongrightarrow}\ P\ {\isasymor}\ Q\ {\isasymand}\ R\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   176
\ {\isadigit{1}}{\isachardot}\ {\isasymlbrakk}R{\isacharsemicolon}\ Q{\isacharsemicolon}\ {\isasymnot}\ P{\isasymrbrakk}\ {\isasymLongrightarrow}\ Q\isanewline
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   177
\ {\isadigit{2}}{\isachardot}\ {\isasymlbrakk}R{\isacharsemicolon}\ Q{\isacharsemicolon}\ {\isasymnot}\ P{\isasymrbrakk}\ {\isasymLongrightarrow}\ R
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   178
*}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   179
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   180
11182
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
   181
text{*rule_tac, etc.*}
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
   182
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
   183
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
   184
lemma "P&Q"
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
   185
apply (rule_tac P=P and Q=Q in conjI)
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
   186
oops
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
   187
e123a50aa949 minor fixes
paulson
parents: 11154
diff changeset
   188
13756
41abb61ecce9 new material for trace_unify_fail
paulson
parents: 13550
diff changeset
   189
text{*unification failure trace *}
41abb61ecce9 new material for trace_unify_fail
paulson
parents: 13550
diff changeset
   190
41abb61ecce9 new material for trace_unify_fail
paulson
parents: 13550
diff changeset
   191
ML "set trace_unify_fail"
41abb61ecce9 new material for trace_unify_fail
paulson
parents: 13550
diff changeset
   192
41abb61ecce9 new material for trace_unify_fail
paulson
parents: 13550
diff changeset
   193
lemma "P(a, f(b, g(e,a), b), a) \<Longrightarrow> P(a, f(b, g(c,a), b), a)"
41abb61ecce9 new material for trace_unify_fail
paulson
parents: 13550
diff changeset
   194
txt{*
41abb61ecce9 new material for trace_unify_fail
paulson
parents: 13550
diff changeset
   195
@{subgoals[display,indent=0,margin=65]}
41abb61ecce9 new material for trace_unify_fail
paulson
parents: 13550
diff changeset
   196
apply assumption
41abb61ecce9 new material for trace_unify_fail
paulson
parents: 13550
diff changeset
   197
Clash: e =/= c
41abb61ecce9 new material for trace_unify_fail
paulson
parents: 13550
diff changeset
   198
41abb61ecce9 new material for trace_unify_fail
paulson
parents: 13550
diff changeset
   199
Clash: == =/= Trueprop
41abb61ecce9 new material for trace_unify_fail
paulson
parents: 13550
diff changeset
   200
*}
41abb61ecce9 new material for trace_unify_fail
paulson
parents: 13550
diff changeset
   201
oops
41abb61ecce9 new material for trace_unify_fail
paulson
parents: 13550
diff changeset
   202
41abb61ecce9 new material for trace_unify_fail
paulson
parents: 13550
diff changeset
   203
lemma "\<forall>x y. P(x,y) --> P(y,x)"
41abb61ecce9 new material for trace_unify_fail
paulson
parents: 13550
diff changeset
   204
apply auto
41abb61ecce9 new material for trace_unify_fail
paulson
parents: 13550
diff changeset
   205
txt{*
41abb61ecce9 new material for trace_unify_fail
paulson
parents: 13550
diff changeset
   206
@{subgoals[display,indent=0,margin=65]}
41abb61ecce9 new material for trace_unify_fail
paulson
parents: 13550
diff changeset
   207
apply assumption
41abb61ecce9 new material for trace_unify_fail
paulson
parents: 13550
diff changeset
   208
41abb61ecce9 new material for trace_unify_fail
paulson
parents: 13550
diff changeset
   209
Clash: bound variable x (depth 1) =/= bound variable y (depth 0)
41abb61ecce9 new material for trace_unify_fail
paulson
parents: 13550
diff changeset
   210
41abb61ecce9 new material for trace_unify_fail
paulson
parents: 13550
diff changeset
   211
Clash: == =/= Trueprop
41abb61ecce9 new material for trace_unify_fail
paulson
parents: 13550
diff changeset
   212
Clash: == =/= Trueprop
41abb61ecce9 new material for trace_unify_fail
paulson
parents: 13550
diff changeset
   213
*}
41abb61ecce9 new material for trace_unify_fail
paulson
parents: 13550
diff changeset
   214
oops
41abb61ecce9 new material for trace_unify_fail
paulson
parents: 13550
diff changeset
   215
41abb61ecce9 new material for trace_unify_fail
paulson
parents: 13550
diff changeset
   216
ML "reset trace_unify_fail"
41abb61ecce9 new material for trace_unify_fail
paulson
parents: 13550
diff changeset
   217
41abb61ecce9 new material for trace_unify_fail
paulson
parents: 13550
diff changeset
   218
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   219
text{*Quantifiers*}
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   220
11080
22855d091249 various revisions in response to comments from Tobias
paulson
parents: 10957
diff changeset
   221
text {*
22855d091249 various revisions in response to comments from Tobias
paulson
parents: 10957
diff changeset
   222
@{thm[display] allI}
22855d091249 various revisions in response to comments from Tobias
paulson
parents: 10957
diff changeset
   223
\rulename{allI}
22855d091249 various revisions in response to comments from Tobias
paulson
parents: 10957
diff changeset
   224
22855d091249 various revisions in response to comments from Tobias
paulson
parents: 10957
diff changeset
   225
@{thm[display] allE}
22855d091249 various revisions in response to comments from Tobias
paulson
parents: 10957
diff changeset
   226
\rulename{allE}
22855d091249 various revisions in response to comments from Tobias
paulson
parents: 10957
diff changeset
   227
22855d091249 various revisions in response to comments from Tobias
paulson
parents: 10957
diff changeset
   228
@{thm[display] spec}
22855d091249 various revisions in response to comments from Tobias
paulson
parents: 10957
diff changeset
   229
\rulename{spec}
22855d091249 various revisions in response to comments from Tobias
paulson
parents: 10957
diff changeset
   230
*};
22855d091249 various revisions in response to comments from Tobias
paulson
parents: 10957
diff changeset
   231
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   232
lemma "\<forall>x. P x \<longrightarrow> P x"
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   233
apply (rule allI)
10843
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   234
by (rule impI)
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   235
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   236
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
   237
apply (rule impI, rule allI)
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   238
apply (drule spec)
10843
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   239
by (drule mp)
10957
2a4a50e7ddf2 rename_tac example; tidying to use @subgoals
paulson
parents: 10843
diff changeset
   240
11080
22855d091249 various revisions in response to comments from Tobias
paulson
parents: 10957
diff changeset
   241
text{*rename_tac*}
10957
2a4a50e7ddf2 rename_tac example; tidying to use @subgoals
paulson
parents: 10843
diff changeset
   242
lemma "x < y \<Longrightarrow> \<forall>x y. P x (f y)"
12390
2fa13b499975 adapted intr/elim uses;
wenzelm
parents: 11458
diff changeset
   243
apply (intro allI)
10957
2a4a50e7ddf2 rename_tac example; tidying to use @subgoals
paulson
parents: 10843
diff changeset
   244
	--{* @{subgoals[display,indent=0,margin=65]} *}
2a4a50e7ddf2 rename_tac example; tidying to use @subgoals
paulson
parents: 10843
diff changeset
   245
apply (rename_tac v w)
2a4a50e7ddf2 rename_tac example; tidying to use @subgoals
paulson
parents: 10843
diff changeset
   246
	--{* @{subgoals[display,indent=0,margin=65]} *}
2a4a50e7ddf2 rename_tac example; tidying to use @subgoals
paulson
parents: 10843
diff changeset
   247
oops
2a4a50e7ddf2 rename_tac example; tidying to use @subgoals
paulson
parents: 10843
diff changeset
   248
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   249
10843
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   250
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
   251
apply (frule spec)
10957
2a4a50e7ddf2 rename_tac example; tidying to use @subgoals
paulson
parents: 10843
diff changeset
   252
	--{* @{subgoals[display,indent=0,margin=65]} *}
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   253
apply (drule mp, assumption)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   254
apply (drule spec)
10957
2a4a50e7ddf2 rename_tac example; tidying to use @subgoals
paulson
parents: 10843
diff changeset
   255
	--{* @{subgoals[display,indent=0,margin=65]} *}
10843
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   256
by (drule mp)
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   257
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   258
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
   259
by blast
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   260
11234
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   261
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   262
text{*
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   263
the existential quantifier*}
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   264
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   265
text {*
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   266
@{thm[display]"exI"}
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   267
\rulename{exI}
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   268
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   269
@{thm[display]"exE"}
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   270
\rulename{exE}
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   271
*};
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   272
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   273
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   274
text{*
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   275
instantiating quantifiers explicitly by rule_tac and erule_tac*}
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   276
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   277
lemma "\<lbrakk>\<forall>x. P x \<longrightarrow> P (h x); P a\<rbrakk> \<Longrightarrow> P(h (h a))"
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   278
apply (frule spec)
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   279
	--{* @{subgoals[display,indent=0,margin=65]} *}
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   280
apply (drule mp, assumption)
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   281
	--{* @{subgoals[display,indent=0,margin=65]} *}
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   282
apply (drule_tac x = "h a" in spec)
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   283
	--{* @{subgoals[display,indent=0,margin=65]} *}
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   284
by (drule mp)
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   285
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   286
text {*
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   287
@{thm[display]"dvd_def"}
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   288
\rulename{dvd_def}
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   289
*};
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   290
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   291
lemma mult_dvd_mono: "\<lbrakk>i dvd m; j dvd n\<rbrakk> \<Longrightarrow> i*j dvd (m*n :: nat)"
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   292
apply (simp add: dvd_def)
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   293
	--{* @{subgoals[display,indent=0,margin=65]} *}
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   294
apply (erule exE) 
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   295
	--{* @{subgoals[display,indent=0,margin=65]} *}
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   296
apply (erule exE) 
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   297
	--{* @{subgoals[display,indent=0,margin=65]} *}
11407
138919f1a135 tweaks for new version
paulson
parents: 11244
diff changeset
   298
apply (rename_tac l)
138919f1a135 tweaks for new version
paulson
parents: 11244
diff changeset
   299
	--{* @{subgoals[display,indent=0,margin=65]} *}
138919f1a135 tweaks for new version
paulson
parents: 11244
diff changeset
   300
apply (rule_tac x="k*l" in exI) 
11244
ca1de97d67c8 extra display
paulson
parents: 11234
diff changeset
   301
	--{* @{subgoals[display,indent=0,margin=65]} *}
11234
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   302
apply simp
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   303
done
6902638af59e quantifier instantiation
paulson
parents: 11182
diff changeset
   304
10957
2a4a50e7ddf2 rename_tac example; tidying to use @subgoals
paulson
parents: 10843
diff changeset
   305
text{*
10843
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   306
Hilbert-epsilon theorems*}
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
text{*
11458
09a6c44a48ea numerous stylistic changes and indexing
paulson
parents: 11456
diff changeset
   309
@{thm[display] the_equality[no_vars]}
09a6c44a48ea numerous stylistic changes and indexing
paulson
parents: 11456
diff changeset
   310
\rulename{the_equality}
09a6c44a48ea numerous stylistic changes and indexing
paulson
parents: 11456
diff changeset
   311
10843
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   312
@{thm[display] some_equality[no_vars]}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   313
\rulename{some_equality}
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
@{thm[display] someI[no_vars]}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   316
\rulename{someI}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   317
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   318
@{thm[display] someI2[no_vars]}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   319
\rulename{someI2}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   320
11080
22855d091249 various revisions in response to comments from Tobias
paulson
parents: 10957
diff changeset
   321
@{thm[display] someI_ex[no_vars]}
22855d091249 various revisions in response to comments from Tobias
paulson
parents: 10957
diff changeset
   322
\rulename{someI_ex}
22855d091249 various revisions in response to comments from Tobias
paulson
parents: 10957
diff changeset
   323
10843
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   324
needed for examples
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
@{thm[display] inv_def[no_vars]}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   327
\rulename{inv_def}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   328
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   329
@{thm[display] Least_def[no_vars]}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   330
\rulename{Least_def}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   331
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   332
@{thm[display] order_antisym[no_vars]}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   333
\rulename{order_antisym}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   334
*}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   335
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   336
11080
22855d091249 various revisions in response to comments from Tobias
paulson
parents: 10957
diff changeset
   337
lemma "inv Suc (Suc n) = n"
10843
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   338
by (simp add: inv_def)
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   339
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   340
text{*but we know nothing about inv Suc 0*}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   341
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   342
theorem Least_equality:
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   343
     "\<lbrakk> P (k::nat);  \<forall>x. P x \<longrightarrow> k \<le> x \<rbrakk> \<Longrightarrow> (LEAST x. P(x)) = k"
11456
7eb63f63e6c6 revisions and indexing
paulson
parents: 11407
diff changeset
   344
apply (simp add: Least_def)
10843
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   345
 
11458
09a6c44a48ea numerous stylistic changes and indexing
paulson
parents: 11456
diff changeset
   346
txt{*
10843
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   347
@{subgoals[display,indent=0,margin=65]}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   348
*};
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   349
   
11456
7eb63f63e6c6 revisions and indexing
paulson
parents: 11407
diff changeset
   350
apply (rule the_equality)
10843
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   351
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   352
txt{*
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   353
@{subgoals[display,indent=0,margin=65]}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   354
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   355
first subgoal is existence; second is uniqueness
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   356
*};
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   357
by (auto intro: order_antisym)
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   358
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   359
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   360
theorem axiom_of_choice:
11080
22855d091249 various revisions in response to comments from Tobias
paulson
parents: 10957
diff changeset
   361
     "(\<forall>x. \<exists>y. P x y) \<Longrightarrow> \<exists>f. \<forall>x. P x (f x)"
10843
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   362
apply (rule exI, rule allI)
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   363
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   364
txt{*
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   365
@{subgoals[display,indent=0,margin=65]}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   366
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   367
state after intro rules
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   368
*};
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   369
apply (drule spec, erule exE)
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   370
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   371
txt{*
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   372
@{subgoals[display,indent=0,margin=65]}
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   373
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   374
applying @text{someI} automatically instantiates
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   375
@{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
   376
*};
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   377
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   378
by (rule someI)
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   379
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   380
(*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
   381
lemma "[| P (k::nat);  \<forall>x. P x \<longrightarrow> k \<le> x |] ==> (LEAST x. P(x)) = k";
11154
042015819774 for the change to LEAST
paulson
parents: 11080
diff changeset
   382
apply (simp add: Least_def LeastM_def)
10843
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   383
by (blast intro: some_equality order_antisym);
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   384
13550
5a176b8dda84 removal of blast.overloaded
paulson
parents: 12408
diff changeset
   385
theorem axiom_of_choice': "(\<forall>x. \<exists>y. P x y) \<Longrightarrow> \<exists>f. \<forall>x. P x (f x)"
10843
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   386
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
   387
by (blast intro: someI);
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   388
10957
2a4a50e7ddf2 rename_tac example; tidying to use @subgoals
paulson
parents: 10843
diff changeset
   389
text{*end of Epsilon section*}
2a4a50e7ddf2 rename_tac example; tidying to use @subgoals
paulson
parents: 10843
diff changeset
   390
10843
f2e4e383dbca introduction of "by" and a few examples of SOME
paulson
parents: 10341
diff changeset
   391
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   392
lemma "(\<exists>x. P x) \<or> (\<exists>x. Q x) \<Longrightarrow> \<exists>x. P x \<or> Q x"
12390
2fa13b499975 adapted intr/elim uses;
wenzelm
parents: 11458
diff changeset
   393
apply (elim exE disjE)
12408
2884148a9fe9 intro and elim now require arguments
paulson
parents: 12390
diff changeset
   394
 apply (intro exI disjI1)
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   395
 apply assumption
12408
2884148a9fe9 intro and elim now require arguments
paulson
parents: 12390
diff changeset
   396
apply (intro exI disjI2)
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   397
apply assumption
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   398
done
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   399
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   400
lemma "(P\<longrightarrow>Q) \<or> (Q\<longrightarrow>P)"
12390
2fa13b499975 adapted intr/elim uses;
wenzelm
parents: 11458
diff changeset
   401
apply (intro disjCI impI)
2fa13b499975 adapted intr/elim uses;
wenzelm
parents: 11458
diff changeset
   402
apply (elim notE)
2fa13b499975 adapted intr/elim uses;
wenzelm
parents: 11458
diff changeset
   403
apply (intro impI)
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   404
apply assumption
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   405
done
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   406
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   407
lemma "(P\<or>Q)\<and>(P\<or>R) \<Longrightarrow> P \<or> (Q\<and>R)"
12390
2fa13b499975 adapted intr/elim uses;
wenzelm
parents: 11458
diff changeset
   408
apply (intro disjCI conjI)
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   409
apply (elim conjE disjE)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   410
apply blast
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   411
apply blast
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   412
apply blast
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   413
apply blast
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   414
(*apply elim*)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   415
done
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   416
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   417
lemma "(\<exists>x. P \<and> Q x) \<Longrightarrow> P \<and> (\<exists>x. Q x)"
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   418
apply (erule exE)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   419
apply (erule conjE)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   420
apply (rule conjI)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   421
 apply assumption
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   422
apply (rule exI)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   423
 apply assumption
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   424
done
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   425
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   426
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
   427
apply (erule conjE)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   428
apply (erule exE)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   429
apply (erule exE)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   430
apply (rule exI)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   431
apply (rule conjI)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   432
 apply assumption
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   433
oops
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   434
11407
138919f1a135 tweaks for new version
paulson
parents: 11244
diff changeset
   435
lemma "\<forall>y. R y y \<Longrightarrow> \<exists>x. \<forall>y. R x y"
11080
22855d091249 various revisions in response to comments from Tobias
paulson
parents: 10957
diff changeset
   436
apply (rule exI) 
22855d091249 various revisions in response to comments from Tobias
paulson
parents: 10957
diff changeset
   437
  --{* @{subgoals[display,indent=0,margin=65]} *}
22855d091249 various revisions in response to comments from Tobias
paulson
parents: 10957
diff changeset
   438
apply (rule allI) 
22855d091249 various revisions in response to comments from Tobias
paulson
parents: 10957
diff changeset
   439
  --{* @{subgoals[display,indent=0,margin=65]} *}
22855d091249 various revisions in response to comments from Tobias
paulson
parents: 10957
diff changeset
   440
apply (drule spec) 
22855d091249 various revisions in response to comments from Tobias
paulson
parents: 10957
diff changeset
   441
  --{* @{subgoals[display,indent=0,margin=65]} *}
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   442
oops
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   443
11407
138919f1a135 tweaks for new version
paulson
parents: 11244
diff changeset
   444
lemma "\<forall>x. \<exists>y. x=y"
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   445
apply (rule allI)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   446
apply (rule exI)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   447
apply (rule refl)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   448
done
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   449
11407
138919f1a135 tweaks for new version
paulson
parents: 11244
diff changeset
   450
lemma "\<exists>x. \<forall>y. x=y"
10295
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   451
apply (rule exI)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   452
apply (rule allI)
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   453
oops
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   454
8eb12693cead the Rules chapter and theories
paulson
parents:
diff changeset
   455
end