src/Doc/Prog_Prove/Isar.thy
changeset 58605 9d5013661ac6
parent 58602 ab56811d76c6
child 58999 ed09ae4ea2d8
equal deleted inserted replaced
58604:13dfea1621b2 58605:9d5013661ac6
   119 \subsection{\indexed{@{text this}}{this}, \indexed{\isacom{then}}{then}, \indexed{\isacom{hence}}{hence} and \indexed{\isacom{thus}}{thus}}
   119 \subsection{\indexed{@{text this}}{this}, \indexed{\isacom{then}}{then}, \indexed{\isacom{hence}}{hence} and \indexed{\isacom{thus}}{thus}}
   120 
   120 
   121 Labels should be avoided. They interrupt the flow of the reader who has to
   121 Labels should be avoided. They interrupt the flow of the reader who has to
   122 scan the context for the point where the label was introduced. Ideally, the
   122 scan the context for the point where the label was introduced. Ideally, the
   123 proof is a linear flow, where the output of one step becomes the input of the
   123 proof is a linear flow, where the output of one step becomes the input of the
   124 next step, piping the previously proved fact into the next proof, just like
   124 next step, piping the previously proved fact into the next proof, like
   125 in a UNIX pipe. In such cases the predefined name @{text this} can be used
   125 in a UNIX pipe. In such cases the predefined name @{text this} can be used
   126 to refer to the proposition proved in the previous step. This allows us to
   126 to refer to the proposition proved in the previous step. This allows us to
   127 eliminate all labels from our proof (we suppress the \isacom{lemma} statement):
   127 eliminate all labels from our proof (we suppress the \isacom{lemma} statement):
   128 *}
   128 *}
   129 (*<*)
   129 (*<*)
   872 to.  In the above proof, we do not need to refer to it, hence we do not give
   872 to.  In the above proof, we do not need to refer to it, hence we do not give
   873 it a specific name. In case one needs to refer to it one writes
   873 it a specific name. In case one needs to refer to it one writes
   874 \begin{quote}
   874 \begin{quote}
   875 \isacom{case} @{text"(evSS m)"}
   875 \isacom{case} @{text"(evSS m)"}
   876 \end{quote}
   876 \end{quote}
   877 just like \isacom{case}~@{text"(Suc n)"} in earlier structural inductions.
   877 like \isacom{case}~@{text"(Suc n)"} in earlier structural inductions.
   878 The name @{text m} is an arbitrary choice. As a result,
   878 The name @{text m} is an arbitrary choice. As a result,
   879 case @{thm[source] evSS} is derived from a renamed version of
   879 case @{thm[source] evSS} is derived from a renamed version of
   880 rule @{thm[source] evSS}: @{text"ev m \<Longrightarrow> ev(Suc(Suc m))"}.
   880 rule @{thm[source] evSS}: @{text"ev m \<Longrightarrow> ev(Suc(Suc m))"}.
   881 Here is an example with a (contrived) intermediate step that refers to @{text m}:
   881 Here is an example with a (contrived) intermediate step that refers to @{text m}:
   882 *}
   882 *}
  1037 need to see the expanded version of the lemma. This is what we need to write:
  1037 need to see the expanded version of the lemma. This is what we need to write:
  1038 \begin{isabelle}
  1038 \begin{isabelle}
  1039 \isacom{lemma} @{text[source]"I r s t \<Longrightarrow> \<dots>"}\isanewline
  1039 \isacom{lemma} @{text[source]"I r s t \<Longrightarrow> \<dots>"}\isanewline
  1040 \isacom{proof}@{text"(induction \"r\" \"s\" \"t\" arbitrary: \<dots> rule: I.induct)"}\index{inductionrule@@{text"induction ... rule:"}}\index{arbitrary@@{text"arbitrary:"}}
  1040 \isacom{proof}@{text"(induction \"r\" \"s\" \"t\" arbitrary: \<dots> rule: I.induct)"}\index{inductionrule@@{text"induction ... rule:"}}\index{arbitrary@@{text"arbitrary:"}}
  1041 \end{isabelle}
  1041 \end{isabelle}
  1042 Just like for rule inversion, cases that are impossible because of constructor clashes
  1042 Like for rule inversion, cases that are impossible because of constructor clashes
  1043 will not show up at all. Here is a concrete example: *}
  1043 will not show up at all. Here is a concrete example: *}
  1044 
  1044 
  1045 lemma "ev (Suc m) \<Longrightarrow> \<not> ev m"
  1045 lemma "ev (Suc m) \<Longrightarrow> \<not> ev m"
  1046 proof(induction "Suc m" arbitrary: m rule: ev.induct)
  1046 proof(induction "Suc m" arbitrary: m rule: ev.induct)
  1047   fix n assume IH: "\<And>m. n = Suc m \<Longrightarrow> \<not> ev m"
  1047   fix n assume IH: "\<And>m. n = Suc m \<Longrightarrow> \<not> ev m"