doc-src/TutorialI/Rules/Basic.thy
changeset 11080 22855d091249
parent 10957 2a4a50e7ddf2
child 11154 042015819774
equal deleted inserted replaced
11079:a378479996f7 11080:22855d091249
   121 apply (erule_tac Q="R\<longrightarrow>Q" in contrapos_np)
   121 apply (erule_tac Q="R\<longrightarrow>Q" in contrapos_np)
   122 	--{* @{subgoals[display,indent=0,margin=65]} *}
   122 	--{* @{subgoals[display,indent=0,margin=65]} *}
   123 apply intro
   123 apply intro
   124 	--{* @{subgoals[display,indent=0,margin=65]} *}
   124 	--{* @{subgoals[display,indent=0,margin=65]} *}
   125 by (erule notE)
   125 by (erule notE)
       
   126 
       
   127 text {*
       
   128 @{thm[display] disjCI}
       
   129 \rulename{disjCI}
       
   130 *};
   126 
   131 
   127 lemma "(P \<or> Q) \<and> R \<Longrightarrow> P \<or> Q \<and> R"
   132 lemma "(P \<or> Q) \<and> R \<Longrightarrow> P \<or> Q \<and> R"
   128 apply intro
   133 apply intro
   129 	--{* @{subgoals[display,indent=0,margin=65]} *}
   134 	--{* @{subgoals[display,indent=0,margin=65]} *}
   130 
   135 
   143 *}
   148 *}
   144 
   149 
   145 
   150 
   146 text{*Quantifiers*}
   151 text{*Quantifiers*}
   147 
   152 
       
   153 
       
   154 text {*
       
   155 @{thm[display] allI}
       
   156 \rulename{allI}
       
   157 
       
   158 @{thm[display] allE}
       
   159 \rulename{allE}
       
   160 
       
   161 @{thm[display] spec}
       
   162 \rulename{spec}
       
   163 *};
       
   164 
   148 lemma "\<forall>x. P x \<longrightarrow> P x"
   165 lemma "\<forall>x. P x \<longrightarrow> P x"
   149 apply (rule allI)
   166 apply (rule allI)
   150 by (rule impI)
   167 by (rule impI)
   151 
   168 
   152 lemma "(\<forall>x. P \<longrightarrow> Q x) \<Longrightarrow> P \<longrightarrow> (\<forall>x. Q x)"
   169 lemma "(\<forall>x. P \<longrightarrow> Q x) \<Longrightarrow> P \<longrightarrow> (\<forall>x. Q x)"
   153 apply (rule impI, rule allI)
   170 apply (rule impI, rule allI)
   154 apply (drule spec)
   171 apply (drule spec)
   155 by (drule mp)
   172 by (drule mp)
   156 
   173 
   157 text{*NEW: rename_tac*}
   174 text{*rename_tac*}
   158 lemma "x < y \<Longrightarrow> \<forall>x y. P x (f y)"
   175 lemma "x < y \<Longrightarrow> \<forall>x y. P x (f y)"
   159 apply intro
   176 apply intro
   160 	--{* @{subgoals[display,indent=0,margin=65]} *}
   177 	--{* @{subgoals[display,indent=0,margin=65]} *}
   161 apply (rename_tac v w)
   178 apply (rename_tac v w)
   162 	--{* @{subgoals[display,indent=0,margin=65]} *}
   179 	--{* @{subgoals[display,indent=0,margin=65]} *}
   186 \rulename{someI}
   203 \rulename{someI}
   187 
   204 
   188 @{thm[display] someI2[no_vars]}
   205 @{thm[display] someI2[no_vars]}
   189 \rulename{someI2}
   206 \rulename{someI2}
   190 
   207 
       
   208 @{thm[display] someI_ex[no_vars]}
       
   209 \rulename{someI_ex}
       
   210 
   191 needed for examples
   211 needed for examples
   192 
   212 
   193 @{thm[display] inv_def[no_vars]}
   213 @{thm[display] inv_def[no_vars]}
   194 \rulename{inv_def}
   214 \rulename{inv_def}
   195 
   215 
   199 @{thm[display] order_antisym[no_vars]}
   219 @{thm[display] order_antisym[no_vars]}
   200 \rulename{order_antisym}
   220 \rulename{order_antisym}
   201 *}
   221 *}
   202 
   222 
   203 
   223 
   204 lemma "inv Suc (Suc x) = x"
   224 lemma "inv Suc (Suc n) = n"
   205 by (simp add: inv_def)
   225 by (simp add: inv_def)
   206 
   226 
   207 text{*but we know nothing about inv Suc 0*}
   227 text{*but we know nothing about inv Suc 0*}
   208 
   228 
   209 theorem Least_equality:
   229 theorem Least_equality:
   223 *};
   243 *};
   224 by (auto intro: order_antisym)
   244 by (auto intro: order_antisym)
   225 
   245 
   226 
   246 
   227 theorem axiom_of_choice:
   247 theorem axiom_of_choice:
   228      "(\<forall>x. \<exists> y. P x y) \<Longrightarrow> \<exists>f. \<forall>x. P x (f x)"
   248      "(\<forall>x. \<exists>y. P x y) \<Longrightarrow> \<exists>f. \<forall>x. P x (f x)"
   229 apply (rule exI, rule allI)
   249 apply (rule exI, rule allI)
   230 
   250 
   231 txt{*
   251 txt{*
   232 @{subgoals[display,indent=0,margin=65]}
   252 @{subgoals[display,indent=0,margin=65]}
   233 
   253 
   247 (*both can be done by blast, which however hasn't been introduced yet*)
   267 (*both can be done by blast, which however hasn't been introduced yet*)
   248 lemma "[| P (k::nat);  \<forall>x. P x \<longrightarrow> k \<le> x |] ==> (LEAST x. P(x)) = k";
   268 lemma "[| P (k::nat);  \<forall>x. P x \<longrightarrow> k \<le> x |] ==> (LEAST x. P(x)) = k";
   249 apply (simp add: Least_def)
   269 apply (simp add: Least_def)
   250 by (blast intro: some_equality order_antisym);
   270 by (blast intro: some_equality order_antisym);
   251 
   271 
   252 theorem axiom_of_choice: "(\<forall>x. \<exists> y. P x y) \<Longrightarrow> \<exists>f. \<forall>x. P x (f x)"
   272 theorem axiom_of_choice: "(\<forall>x. \<exists>y. P x y) \<Longrightarrow> \<exists>f. \<forall>x. P x (f x)"
   253 apply (rule exI [of _  "\<lambda>x. SOME y. P x y"])
   273 apply (rule exI [of _  "\<lambda>x. SOME y. P x y"])
   254 by (blast intro: someI);
   274 by (blast intro: someI);
   255 
   275 
   256 text{*end of Epsilon section*}
   276 text{*end of Epsilon section*}
   257 
   277 
   296 apply (rule exI)
   316 apply (rule exI)
   297 apply (rule conjI)
   317 apply (rule conjI)
   298  apply assumption
   318  apply assumption
   299 oops
   319 oops
   300 
   320 
   301 lemma "\<forall> z. R z z \<Longrightarrow> \<exists>x. \<forall> y. R x y"
   321 lemma "\<forall> y. R y y \<Longrightarrow> \<exists>x. \<forall> y. R x y"
   302 apply (rule exI)
   322 apply (rule exI) 
   303 apply (rule allI)
   323   --{* @{subgoals[display,indent=0,margin=65]} *}
   304 apply (drule spec)
   324 apply (rule allI) 
       
   325   --{* @{subgoals[display,indent=0,margin=65]} *}
       
   326 apply (drule spec) 
       
   327   --{* @{subgoals[display,indent=0,margin=65]} *}
   305 oops
   328 oops
   306 
   329 
   307 lemma "\<forall>x. \<exists> y. x=y"
   330 lemma "\<forall>x. \<exists> y. x=y"
   308 apply (rule allI)
   331 apply (rule allI)
   309 apply (rule exI)
   332 apply (rule exI)