13841
|
1 |
%
|
|
2 |
\begin{isabellebody}%
|
|
3 |
\def\isabellecontext{Arithmetic}%
|
|
4 |
\isamarkupfalse%
|
|
5 |
%
|
|
6 |
\isamarkupsubsection{Arithmetic%
|
|
7 |
}
|
|
8 |
\isamarkuptrue%
|
|
9 |
%
|
|
10 |
\isamarkupsubsubsection{Power%
|
|
11 |
}
|
|
12 |
\isamarkuptrue%
|
|
13 |
%
|
|
14 |
\begin{isamarkuptext}%
|
|
15 |
Define a primitive recursive function $pow~x~n$ that
|
|
16 |
computes $x^n$ on natural numbers.%
|
|
17 |
\end{isamarkuptext}%
|
|
18 |
\isamarkuptrue%
|
|
19 |
\isacommand{consts}\isanewline
|
|
20 |
\ \ pow\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequote}nat\ {\isacharequal}{\isachargreater}\ nat\ {\isacharequal}{\isachargreater}\ nat{\isachardoublequote}\isamarkupfalse%
|
|
21 |
%
|
|
22 |
\begin{isamarkuptext}%
|
|
23 |
Prove the well known equation $x^{m \cdot n} = (x^m)^n$:%
|
|
24 |
\end{isamarkuptext}%
|
|
25 |
\isamarkuptrue%
|
|
26 |
\isacommand{theorem}\ pow{\isacharunderscore}mult{\isacharcolon}\ {\isachardoublequote}pow\ x\ {\isacharparenleft}m\ {\isacharasterisk}\ n{\isacharparenright}\ {\isacharequal}\ pow\ {\isacharparenleft}pow\ x\ m{\isacharparenright}\ n{\isachardoublequote}\isamarkupfalse%
|
|
27 |
\isamarkupfalse%
|
|
28 |
%
|
|
29 |
\begin{isamarkuptext}%
|
|
30 |
Hint: prove a suitable lemma first. If you need to appeal to
|
|
31 |
associativity and commutativity of multiplication: the corresponding
|
|
32 |
simplification rules are named \isa{mult{\isacharunderscore}ac}.%
|
|
33 |
\end{isamarkuptext}%
|
|
34 |
\isamarkuptrue%
|
|
35 |
%
|
|
36 |
\isamarkupsubsubsection{Summation%
|
|
37 |
}
|
|
38 |
\isamarkuptrue%
|
|
39 |
%
|
|
40 |
\begin{isamarkuptext}%
|
|
41 |
Define a (primitive recursive) function $sum~ns$ that sums a list
|
|
42 |
of natural numbers: $sum [n_1, \dots, n_k] = n_1 + \cdots + n_k$.%
|
|
43 |
\end{isamarkuptext}%
|
|
44 |
\isamarkuptrue%
|
|
45 |
\isacommand{consts}\isanewline
|
|
46 |
\ \ sum\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequote}nat\ list\ {\isacharequal}{\isachargreater}\ nat{\isachardoublequote}\isamarkupfalse%
|
|
47 |
%
|
|
48 |
\begin{isamarkuptext}%
|
|
49 |
Show that $sum$ is compatible with $rev$. You may need a lemma.%
|
|
50 |
\end{isamarkuptext}%
|
|
51 |
\isamarkuptrue%
|
|
52 |
\isacommand{theorem}\ sum{\isacharunderscore}rev{\isacharcolon}\ {\isachardoublequote}sum\ {\isacharparenleft}rev\ ns{\isacharparenright}\ {\isacharequal}\ sum\ ns{\isachardoublequote}\isamarkupfalse%
|
|
53 |
\isamarkupfalse%
|
|
54 |
%
|
|
55 |
\begin{isamarkuptext}%
|
|
56 |
Define a function $Sum~f~k$ that sums $f$ from $0$
|
|
57 |
up to $k-1$: $Sum~f~k = f~0 + \cdots + f(k - 1)$.%
|
|
58 |
\end{isamarkuptext}%
|
|
59 |
\isamarkuptrue%
|
|
60 |
\isacommand{consts}\isanewline
|
|
61 |
\ \ Sum\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequote}{\isacharparenleft}nat\ {\isacharequal}{\isachargreater}\ nat{\isacharparenright}\ {\isacharequal}{\isachargreater}\ nat\ {\isacharequal}{\isachargreater}\ nat{\isachardoublequote}\isamarkupfalse%
|
|
62 |
%
|
|
63 |
\begin{isamarkuptext}%
|
|
64 |
Show the following equations for the pointwise summation of functions.
|
|
65 |
Determine first what the expression \isa{whatever} should be.%
|
|
66 |
\end{isamarkuptext}%
|
|
67 |
\isamarkuptrue%
|
|
68 |
\isacommand{theorem}\ {\isachardoublequote}Sum\ {\isacharparenleft}{\isacharpercent}i{\isachardot}\ f\ i\ {\isacharplus}\ g\ i{\isacharparenright}\ k\ {\isacharequal}\ Sum\ f\ k\ {\isacharplus}\ Sum\ g\ k{\isachardoublequote}\isamarkupfalse%
|
|
69 |
\isanewline
|
|
70 |
\isamarkupfalse%
|
|
71 |
\isacommand{theorem}\ {\isachardoublequote}Sum\ f\ {\isacharparenleft}k\ {\isacharplus}\ l{\isacharparenright}\ {\isacharequal}\ Sum\ f\ k\ {\isacharplus}\ Sum\ whatever\ l{\isachardoublequote}\isamarkupfalse%
|
|
72 |
\isamarkupfalse%
|
|
73 |
%
|
|
74 |
\begin{isamarkuptext}%
|
|
75 |
What is the relationship between \isa{sum} and \isa{Sum}?
|
|
76 |
Prove the following equation, suitably instantiated.%
|
|
77 |
\end{isamarkuptext}%
|
|
78 |
\isamarkuptrue%
|
|
79 |
\isacommand{theorem}\ {\isachardoublequote}Sum\ f\ k\ {\isacharequal}\ sum\ whatever{\isachardoublequote}\isamarkupfalse%
|
|
80 |
\isamarkupfalse%
|
|
81 |
%
|
|
82 |
\begin{isamarkuptext}%
|
|
83 |
Hint: familiarize yourself with the predefined functions \isa{map} and
|
|
84 |
\isa{{\isacharbrackleft}i{\isachardot}{\isachardot}j{\isacharparenleft}{\isacharbrackright}} on lists in theory List.%
|
|
85 |
\end{isamarkuptext}%
|
|
86 |
\isamarkuptrue%
|
|
87 |
\isamarkupfalse%
|
|
88 |
\end{isabellebody}%
|
|
89 |
%%% Local Variables:
|
|
90 |
%%% mode: latex
|
|
91 |
%%% TeX-master: "root"
|
|
92 |
%%% End:
|