src/Doc/Tutorial/Misc/simp.thy
changeset 62392 747d36865c2c
parent 48985 5386df44a037
child 67350 f061129d891b
equal deleted inserted replaced
62391:1658fc9b2618 62392:747d36865c2c
   266 
   266 
   267 txt{*\noindent
   267 txt{*\noindent
   268 The goal can be split by a special method, \methdx{split}:
   268 The goal can be split by a special method, \methdx{split}:
   269 *}
   269 *}
   270 
   270 
   271 apply(split split_if)
   271 apply(split if_split)
   272 
   272 
   273 txt{*\noindent
   273 txt{*\noindent
   274 @{subgoals[display,indent=0]}
   274 @{subgoals[display,indent=0]}
   275 where \tdx{split_if} is a theorem that expresses splitting of
   275 where \tdx{if_split} is a theorem that expresses splitting of
   276 @{text"if"}s. Because
   276 @{text"if"}s. Because
   277 splitting the @{text"if"}s is usually the right proof strategy, the
   277 splitting the @{text"if"}s is usually the right proof strategy, the
   278 simplifier does it automatically.  Try \isacommand{apply}@{text"(simp)"}
   278 simplifier does it automatically.  Try \isacommand{apply}@{text"(simp)"}
   279 on the initial goal above.
   279 on the initial goal above.
   280 
   280 
   314 either locally
   314 either locally
   315 *}
   315 *}
   316 (*<*)
   316 (*<*)
   317 lemma "dummy=dummy"
   317 lemma "dummy=dummy"
   318 (*>*)
   318 (*>*)
   319 apply(simp split del: split_if)
   319 apply(simp split del: if_split)
   320 (*<*)
   320 (*<*)
   321 oops
   321 oops
   322 (*>*)
   322 (*>*)
   323 text{*\noindent
   323 text{*\noindent
   324 or globally:
   324 or globally:
   332 the @{text split} method can be
   332 the @{text split} method can be
   333 helpful in selectively exploring the effects of splitting.
   333 helpful in selectively exploring the effects of splitting.
   334 
   334 
   335 The split rules shown above are intended to affect only the subgoal's
   335 The split rules shown above are intended to affect only the subgoal's
   336 conclusion.  If you want to split an @{text"if"} or @{text"case"}-expression
   336 conclusion.  If you want to split an @{text"if"} or @{text"case"}-expression
   337 in the assumptions, you have to apply \tdx{split_if_asm} or
   337 in the assumptions, you have to apply \tdx{if_split_asm} or
   338 $t$@{text".split_asm"}: *}
   338 $t$@{text".split_asm"}: *}
   339 
   339 
   340 lemma "if xs = [] then ys \<noteq> [] else ys = [] \<Longrightarrow> xs @ ys \<noteq> []"
   340 lemma "if xs = [] then ys \<noteq> [] else ys = [] \<Longrightarrow> xs @ ys \<noteq> []"
   341 apply(split split_if_asm)
   341 apply(split if_split_asm)
   342 
   342 
   343 txt{*\noindent
   343 txt{*\noindent
   344 Unlike splitting the conclusion, this step creates two
   344 Unlike splitting the conclusion, this step creates two
   345 separate subgoals, which here can be solved by @{text"simp_all"}:
   345 separate subgoals, which here can be solved by @{text"simp_all"}:
   346 @{subgoals[display,indent=0]}
   346 @{subgoals[display,indent=0]}