1.1 --- a/doc-src/TutorialI/Recdef/document/examples.tex Wed Aug 08 14:33:10 2001 +0200
1.2 +++ b/doc-src/TutorialI/Recdef/document/examples.tex Wed Aug 08 14:50:28 2001 +0200
1.3 @@ -8,7 +8,7 @@
1.4 \isacommand{consts}\ fib\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequote}nat\ {\isasymRightarrow}\ nat{\isachardoublequote}\isanewline
1.5 \isacommand{recdef}\ fib\ {\isachardoublequote}measure{\isacharparenleft}{\isasymlambda}n{\isachardot}\ n{\isacharparenright}{\isachardoublequote}\isanewline
1.6 \ \ {\isachardoublequote}fib\ {\isadigit{0}}\ {\isacharequal}\ {\isadigit{0}}{\isachardoublequote}\isanewline
1.7 -\ \ {\isachardoublequote}fib\ {\isadigit{1}}\ {\isacharequal}\ {\isadigit{1}}{\isachardoublequote}\isanewline
1.8 +\ \ {\isachardoublequote}fib\ {\isadigit{1}}{\isacharprime}\ {\isacharequal}\ {\isadigit{1}}{\isachardoublequote}\isanewline
1.9 \ \ {\isachardoublequote}fib\ {\isacharparenleft}Suc{\isacharparenleft}Suc\ x{\isacharparenright}{\isacharparenright}\ {\isacharequal}\ fib\ x\ {\isacharplus}\ fib\ {\isacharparenleft}Suc\ x{\isacharparenright}{\isachardoublequote}%
1.10 \begin{isamarkuptext}%
1.11 \noindent
2.1 --- a/doc-src/TutorialI/Recdef/examples.thy Wed Aug 08 14:33:10 2001 +0200
2.2 +++ b/doc-src/TutorialI/Recdef/examples.thy Wed Aug 08 14:50:28 2001 +0200
2.3 @@ -9,7 +9,7 @@
2.4 consts fib :: "nat \<Rightarrow> nat";
2.5 recdef fib "measure(\<lambda>n. n)"
2.6 "fib 0 = 0"
2.7 - "fib 1 = 1"
2.8 + "fib 1' = 1"
2.9 "fib (Suc(Suc x)) = fib x + fib (Suc x)";
2.10
2.11 text{*\noindent
3.1 --- a/doc-src/TutorialI/Rules/Forward.thy Wed Aug 08 14:33:10 2001 +0200
3.2 +++ b/doc-src/TutorialI/Rules/Forward.thy Wed Aug 08 14:50:28 2001 +0200
3.3 @@ -21,12 +21,12 @@
3.4 apply (simp add: is_gcd)
3.5 done
3.6
3.7 -lemma gcd_1 [simp]: "gcd(m,1) = 1"
3.8 +lemma gcd_1 [simp]: "gcd(m,1') = 1'"
3.9 apply simp
3.10 done
3.11
3.12 -lemma gcd_1_left [simp]: "gcd(1,m) = 1"
3.13 -apply (simp add: gcd_commute [of 1])
3.14 +lemma gcd_1_left [simp]: "gcd(1',m) = 1'"
3.15 +apply (simp add: gcd_commute [of "1'"])
3.16 done
3.17
3.18 text{*\noindent
4.1 --- a/doc-src/TutorialI/Rules/rules.tex Wed Aug 08 14:33:10 2001 +0200
4.2 +++ b/doc-src/TutorialI/Rules/rules.tex Wed Aug 08 14:50:28 2001 +0200
4.3 @@ -1819,7 +1819,7 @@
4.4 appearance from left to right. In this case, the variables are \isa{?k}, \isa{?m}
4.5 and~\isa{?n}. So, the expression
4.6 \hbox{\texttt{[of k 1]}} replaces \isa{?k} by~\isa{k} and \isa{?m}
4.7 -by~\isa{1}.
4.8 +by~\isa{1}.\REMARK{which 1 do we use?? (right the way down)}
4.9 \begin{isabelle}
4.10 \isacommand{lemmas}\ gcd_mult_0\ =\ gcd_mult_distrib2\ [of\ k\ 1]
4.11 \end{isabelle}
5.1 --- a/doc-src/TutorialI/Trie/document/Trie.tex Wed Aug 08 14:33:10 2001 +0200
5.2 +++ b/doc-src/TutorialI/Trie/document/Trie.tex Wed Aug 08 14:50:28 2001 +0200
5.3 @@ -12,6 +12,7 @@
5.4 \isacommand{datatype}\ {\isacharparenleft}{\isacharprime}a{\isacharcomma}{\isacharprime}v{\isacharparenright}trie\ {\isacharequal}\ Trie\ \ {\isachardoublequote}{\isacharprime}v\ option{\isachardoublequote}\ \ {\isachardoublequote}{\isacharparenleft}{\isacharprime}a\ {\isacharasterisk}\ {\isacharparenleft}{\isacharprime}a{\isacharcomma}{\isacharprime}v{\isacharparenright}trie{\isacharparenright}list{\isachardoublequote}%
5.5 \begin{isamarkuptext}%
5.6 \noindent
5.7 +\index{datatypes!and nested recursion}%
5.8 The first component is the optional value, the second component the
5.9 association list of subtries. This is an example of nested recursion involving products,
5.10 which is fine because products are datatypes as well.
5.11 @@ -90,11 +91,11 @@
5.12 \noindent
5.13 Our plan is to induct on \isa{as}; hence the remaining variables are
5.14 quantified. From the definitions it is clear that induction on either
5.15 -\isa{as} or \isa{bs} is required. The choice of \isa{as} is merely
5.16 +\isa{as} or \isa{bs} is required. The choice of \isa{as} is
5.17 guided by the intuition that simplification of \isa{lookup} might be easier
5.18 if \isa{update} has already been simplified, which can only happen if
5.19 \isa{as} is instantiated.
5.20 -The start of the proof is completely conventional:%
5.21 +The start of the proof is conventional:%
5.22 \end{isamarkuptxt}%
5.23 \isacommand{apply}{\isacharparenleft}induct{\isacharunderscore}tac\ as{\isacharcomma}\ auto{\isacharparenright}%
5.24 \begin{isamarkuptxt}%
5.25 @@ -113,6 +114,7 @@
5.26 \isacommand{done}%
5.27 \begin{isamarkuptext}%
5.28 \noindent
5.29 +\index{subgoal numbering}%
5.30 All methods ending in \isa{tac} take an optional first argument that
5.31 specifies the range of subgoals they are applied to, where \isa{{\isacharbrackleft}{\isacharbang}{\isacharbrackright}} means
5.32 all subgoals, i.e.\ \isa{{\isacharbrackleft}{\isadigit{1}}{\isacharminus}{\isadigit{3}}{\isacharbrackright}} in our case. Individual subgoal numbers,
5.33 @@ -123,8 +125,7 @@
5.34 proof states are invisible, and we rely on the (possibly brittle) magic of
5.35 \isa{auto} (\isa{simp{\isacharunderscore}all} will not do --- try it) to split the subgoals
5.36 of the induction up in such a way that case distinction on \isa{bs} makes
5.37 -sense and solves the proof. Chapter~\ref{ch:Isar} shows you how to write readable
5.38 -and stable proofs.
5.39 +sense and solves the proof.
5.40
5.41 \begin{exercise}
5.42 Modify \isa{update} (and its type) such that it allows both insertion and
6.1 --- a/doc-src/TutorialI/Types/Numbers.thy Wed Aug 08 14:33:10 2001 +0200
6.2 +++ b/doc-src/TutorialI/Types/Numbers.thy Wed Aug 08 14:50:28 2001 +0200
6.3 @@ -83,8 +83,10 @@
6.4 *}
6.5
6.6
6.7 -lemma "(n-1)*(n+1) = n*n - 1"
6.8 -apply (simp split: nat_diff_split)
6.9 +lemma "(n-#2)*(n+#2) = n*n - (#4::nat)"
6.10 +apply (clarsimp split: nat_diff_split)
6.11 + --{* @{subgoals[display,indent=0,margin=65]} *}
6.12 +apply (subgoal_tac "n=0 | n=1", force, arith)
6.13 done
6.14
6.15 text{*
7.1 --- a/doc-src/TutorialI/Types/document/Numbers.tex Wed Aug 08 14:33:10 2001 +0200
7.2 +++ b/doc-src/TutorialI/Types/document/Numbers.tex Wed Aug 08 14:50:28 2001 +0200
7.3 @@ -113,8 +113,15 @@
7.4 \end{isabelle}
7.5 \rulename{nat_diff_split}%
7.6 \end{isamarkuptext}%
7.7 -\isacommand{lemma}\ {\isachardoublequote}{\isacharparenleft}n{\isacharminus}{\isadigit{1}}{\isacharparenright}{\isacharasterisk}{\isacharparenleft}n{\isacharplus}{\isadigit{1}}{\isacharparenright}\ {\isacharequal}\ n{\isacharasterisk}n\ {\isacharminus}\ {\isadigit{1}}{\isachardoublequote}\isanewline
7.8 -\isacommand{apply}\ {\isacharparenleft}simp\ split{\isacharcolon}\ nat{\isacharunderscore}diff{\isacharunderscore}split{\isacharparenright}\isanewline
7.9 +\isacommand{lemma}\ {\isachardoublequote}{\isacharparenleft}n{\isacharminus}{\isacharhash}{\isadigit{2}}{\isacharparenright}{\isacharasterisk}{\isacharparenleft}n{\isacharplus}{\isacharhash}{\isadigit{2}}{\isacharparenright}\ {\isacharequal}\ n{\isacharasterisk}n\ {\isacharminus}\ {\isacharparenleft}{\isacharhash}{\isadigit{4}}{\isacharcolon}{\isacharcolon}nat{\isacharparenright}{\isachardoublequote}\isanewline
7.10 +\isacommand{apply}\ {\isacharparenleft}clarsimp\ split{\isacharcolon}\ nat{\isacharunderscore}diff{\isacharunderscore}split{\isacharparenright}\isanewline
7.11 +\ %
7.12 +\isamarkupcmt{\begin{isabelle}%
7.13 +\ {\isadigit{1}}{\isachardot}\ {\isasymAnd}d{\isachardot}\ {\isasymlbrakk}n\ {\isacharless}\ {\isacharhash}{\isadigit{2}}{\isacharsemicolon}\ n\ {\isacharasterisk}\ n\ {\isacharequal}\ {\isacharhash}{\isadigit{4}}\ {\isacharplus}\ d{\isasymrbrakk}\ {\isasymLongrightarrow}\ d\ {\isacharequal}\ {\isadigit{0}}%
7.14 +\end{isabelle}%
7.15 +}
7.16 +\isanewline
7.17 +\isacommand{apply}\ {\isacharparenleft}subgoal{\isacharunderscore}tac\ {\isachardoublequote}n{\isacharequal}{\isadigit{0}}\ {\isacharbar}\ n{\isacharequal}{\isadigit{1}}{\isachardoublequote}{\isacharcomma}\ force{\isacharcomma}\ arith{\isacharparenright}\isanewline
7.18 \isacommand{done}%
7.19 \begin{isamarkuptext}%
7.20 \begin{isabelle}%
8.1 --- a/doc-src/TutorialI/Types/numerics.tex Wed Aug 08 14:33:10 2001 +0200
8.2 +++ b/doc-src/TutorialI/Types/numerics.tex Wed Aug 08 14:50:28 2001 +0200
8.3 @@ -225,7 +225,7 @@
8.4 \rulename{nat_diff_split}
8.5 \end{isabelle}
8.6 For example, it proves the following fact, which lies outside the scope of
8.7 -linear arithmetic:
8.8 +linear arithmetic:\REMARK{replace by new example!}
8.9 \begin{isabelle}
8.10 \isacommand{lemma}\ "(n-1)*(n+1)\ =\ n*n\ -\ 1"\isanewline
8.11 \isacommand{apply}\ (simp\ split:\ nat_diff_split)\isanewline