doc/expl-for-ref.tex
author wneuper
Sat, 20 Aug 2005 21:20:16 +0200
changeset 2918 cac1f942e1a1
parent 2328 2051a6fa32a5
permissions -rw-r--r--
find out why IntegrateScript doesnt work
wneuper@2328
     1
\chapter{The example for reference}\label{AK:APP:exref}\label{use-expl}
wneuper@2328
     2
wneuper@2328
     3
This example intended to illustrate interaction with \isac{} is quoted from \cite{wn:matheng99}.
wneuper@2328
     4
wneuper@2328
     5
\sisac{} features a new kind of calculations in applied mathematics, and it is an issue to make the novel functionality of this software as clear as possible. In order to meet this issue, an example is given to be referenced by the use-cases within this document. The example is taken from a calculus course at highschools; thus it should not pose problems to understand the underlying mathematics. Nevertheless the example covers all major features offered by \sisac.
wneuper@2328
     6
wneuper@2328
     7
\section{Description, formalization and modeling phase}
wneuper@2328
     8
The {\bf description} of an {\bf example}\footnote{These {\bf terms} are defined in the appendix of \cite{isac:appendices} 'List of Terms used in the \sisac-project'} may consist of text, formulas and figures:
wneuper@2328
     9
\begin{center}\begin{minipage}{4.2in}\it 
wneuper@2328
    10
Given a circle with radius $r=7$, inscribe a rectangle with
wneuper@2328
    11
length~u and width~v. Determine u and v such that the rectangles area~A is a maximum.
wneuper@2328
    12
\end{minipage}\end{center}
wneuper@2328
    13
\begin{figure} [htb]
wneuper@2328
    14
\centerline{\includegraphics[width=5.0cm]{fig/coil-kernel-uv}}
wneuper@2328
    15
\caption{Figure for the maximum example}
wneuper@2328
    16
\label{fig.coil-kernel-uv}
wneuper@2328
    17
\end{figure}
wneuper@2328
    18
The inital step in solving such an example is, to construct a {\bf model} from the description. The respective model looks like this, if all items are input:\label{model}
wneuper@2328
    19
\begin{tabbing}
wneuper@2328
    20
1234,\=relate \=: \= \=\kill
wneuper@2328
    21
%\>Problem [maximum, calculus, optimization] \\
wneuper@2328
    22
\>given\>: $[$ Constants $\;$ \framebox{$r=7$} $]$\\
wneuper@2328
    23
\>where    \>: $\,0\leq 7$ \\
wneuper@2328
    24
\>find X \>: $[$ Maximum $\;$\framebox{$A$},\\
wneuper@2328
    25
\>       \>\>AdditionalValues $\;$\framebox{$[u,v]$} $]$\\
wneuper@2328
    26
\>with  \>:{\tiny  $\;A=2uv-u^2 \;\land\; (\frac{u}{2})^2+(\frac{v}{2})^2=r^2 \;\land$} \\
wneuper@2328
    27
\>\>\>{\tiny $\;\forall \;A^\prime\; u^\prime \;v^\prime.\;A^\prime=2u^\prime v^\prime-(u^\prime)^2 \land
wneuper@2328
    28
(\frac{u^\prime}{2})^2+(\frac{v^\prime}{2})^2=r^2 $\\
wneuper@2328
    29
\`$\Longrightarrow A^\prime \leq A$} \\
wneuper@2328
    30
\>relate\>: $[$ \framebox{$A=2uv-u^2,\;(\frac{u}{2})^2+(\frac{v}{2})^2=r^2$} $]$
wneuper@2328
    31
\end{tabbing}
wneuper@2328
    32
The boxes mark the items meant for input by the user, whereas the surrounding information is provided by the system and serves user guidance. If the model is perfect, \sisac{} can solve the example autonomously.
wneuper@2328
    33
wneuper@2328
    34
In order to provide userguidance already in the model phase, each example is accompanied by a {\bf formalization} prepared by an author and normally hidden from the user:
wneuper@2328
    35
{\it
wneuper@2328
    36
\begin{tabbing}
wneuper@2328
    37
1234,\=$F_{III}$\=$\equiv\;\;(\;$\=\kill
wneuper@2328
    38
\>$F_I$\>$\equiv\;\;(\;$\>$\{r=7\},\;\; \{ A,[u,v]\},\;\;$\\
wneuper@2328
    39
\>\>\>$\{0\leq\frac{u}{2}\leq r,\;\; 
wneuper@2328
    40
   \{A=2uv-u^2,\;(\frac{u}{2})^2+(\frac{v}{2})^2=r^2\}\;)$\\
wneuper@2328
    41
\\
wneuper@2328
    42
\>$F_{II}$\>$\equiv\;\;(\;\{r=7\},\;\; \{ A,[u,v]\},\;\;$\\
wneuper@2328
    43
\>\>\>$\{0\leq\frac{v}{2}\leq r,\;\; 
wneuper@2328
    44
   \{A=2uv-u^2,\;(\frac{u}{2})^2+(\frac{v}{2})^2=r^2\}\;)$\\
wneuper@2328
    45
\\
wneuper@2328
    46
\>$F_{III}$            
wneuper@2328
    47
\>$\equiv\;\;(\;\{r=7\},\;\; \{ A,[u,v]\},\;\;$\\
wneuper@2328
    48
\>\>\>$\{0\leq\alpha\leq\frac{\pi}{2},\;
wneuper@2328
    49
   \{A=2uv-u^2,\frac{u}{2}=r\sin\alpha,\frac{v}{2}=r\cos\alpha\})$
wneuper@2328
    50
\end{tabbing}}
wneuper@2328
    51
In this case the formalization comprises three variants, $F_I, F_{II}, F_{III}$, which presumerably cover all possibilities students would consider in a particular course. All of such formalizations for {\em one} example together are called 'formalization' in the sequel.
wneuper@2328
    52
wneuper@2328
    53
Given such a formalization and a specification (see below) , \sisac{} can solve an example autonomously {\em and} in stepwise interaction down to the result.
wneuper@2328
    54
\\
wneuper@2328
    55
wneuper@2328
    56
If \sisac{} is being used to solve an example unknown to the system (i.e. without a hidden specification and formalization prepared by an author) \sisac{} cannot provide user guidance at the beginning of this phase (see \ref{START:from_scratch}). In particular, the items {\it Constants}, {\it Maximum} and {\it AdditionalValues} have to be found in the theory {\it Descript.thy}.
wneuper@2328
    57
wneuper@2328
    58
wneuper@2328
    59
wneuper@2328
    60
\section{Knowledgebase and specification phase}
wneuper@2328
    61
The knowledge base comprises three parts, theories, problems and methods.
wneuper@2328
    62
wneuper@2328
    63
\paragraph{Theories} contain the knowledge deduced from axioms and definitions by formal proof (done by the interactive theorem prover Isabelle). For the example at hand knowledge is prepared like the following:
wneuper@2328
    64
\begin{verbatim}
wneuper@2328
    65
wneuper@2328
    66
   theory 'calculus'
wneuper@2328
    67
wneuper@2328
    68
   consts
wneuper@2328
    69
     d_d         :: "[real, real]=> real"
wneuper@2328
    70
                 
wneuper@2328
    71
   rules         
wneuper@2328
    72
     diff_sum    "d_d bdv (u + v) = d_d bdv u + d_d bdv v"
wneuper@2328
    73
     diff_prod   "d_d bdv (u * v) = d_d bdv u * v + u * d_d bdv v"
wneuper@2328
    74
     diff_quot   "Not (v = 0)     ==> (d_d bdv (u / v) =
wneuper@2328
    75
                        (d_d bdv u * v - u * d_d bdv v) / v ^ 2)"
wneuper@2328
    76
     ...
wneuper@2328
    77
\end{verbatim}
wneuper@2328
    78
wneuper@2328
    79
\paragraph{Problems} capture the aspect of application of knowledge.
wneuper@2328
    80
{\it\begin{tabbing}
wneuper@2328
    81
123\=4512345\=\=4512345\kill
wneuper@2328
    82
\>\> $|$\\
wneuper@2328
    83
\>\> \nod e\=quation \\
wneuper@2328
    84
\>\> $|$\>\nod u\=nivariate\\
wneuper@2328
    85
\>\> $|$\>$|$   \>\nod linear \\
wneuper@2328
    86
\>\> $|$\>$|$   \>\nod p\=olynomial \\
wneuper@2328
    87
\>\> $|$\>$|$   \>\nod rational\\
wneuper@2328
    88
\>\> $|$\>$|$   \>\nod \dots\\
wneuper@2328
    89
\>\> \nod function \\
wneuper@2328
    90
\>\> $|$\>\nod make \\
wneuper@2328
    91
\>\> $|$\>      \>\nod by\_elimination \\
wneuper@2328
    92
\>\> $|$\>      \>\nod by\_new\_variable \\
wneuper@2328
    93
\>\> $|$\>\nod differentiate \\
wneuper@2328
    94
\>\> $|$\>$|$   \>\nod for\_maximum \\
wneuper@2328
    95
\>\> $|$\>$|$   \>$|$  \>\nod on\_interval\\
wneuper@2328
    96
\>\> $|$\>$|$   \>\nod \dots \\
wneuper@2328
    97
\>\> $|$\>\nod integrate \\
wneuper@2328
    98
\>\> $|$\>      \>\nod \dots \\
wneuper@2328
    99
\>\> \nod optimization \\
wneuper@2328
   100
\>\> $|$\>\nod linear \\
wneuper@2328
   101
\>\> $|$\>$|$   \>\nod \dots \\
wneuper@2328
   102
\>\> $|$\>\nod calculus \\
wneuper@2328
   103
\>\> $|$\>      \>\nod maximum \\
wneuper@2328
   104
\>\> $|$\>      \>$|$  \dots \\
wneuper@2328
   105
\end{tabbing}}
wneuper@2328
   106
The example at hand shall be described by the {\it problem [calculus, optimization]} (note the reverse order w.r.t. the hierarchy above, which seems more usual in many cases, e.g. {\it [linear, univariate, equation]}), and will be broken down into the subproblems {\it [make, function]}, {\it [on\_interval, for\_maximum, differentiate, function]} and {\it [tool, find\_values]}. The root-problem of the example looks like
wneuper@2328
   107
{\it 
wneuper@2328
   108
\begin{tabbing}
wneuper@2328
   109
1234,\=relate \=: $\equiv$\= ${\it let}\:$ \=$\exists m\_$\kill
wneuper@2328
   110
\>Solve\_problem [maximum, calculus, optimization] \\
wneuper@2328
   111
\>given\>: $[$ Constants fix\_ $]$\\
wneuper@2328
   112
\>where    \>: ${\it map}\;(\$\,0\leq\,\$)\; {\it fix\_}$ \\
wneuper@2328
   113
\>find  \>: $[$ Maximum m\_\\
wneuper@2328
   114
\>       \>\>AdditionalValues vs\_ $]$\\
wneuper@2328
   115
\>with  \>: ${\it let}\:x_1 = \{{\it m\_}\}\cup\{{\it vs\_}\}\cup({\it Vars}\:{\it rs\_});$\\
wneuper@2328
   116
\>\>\>\>$x_2 = {\it map}\:{\it primed}\:x_1;$\\
wneuper@2328
   117
\>\>\>$\:{\it in}\;\,{\it map}\:({\it op}\land)\:{\it rs\_}\:\$\: \land\:\$$ \\
wneuper@2328
   118
\>\>\>\>$\forall\,\$\,x_2\,\$.\,(\,\lambda\,\$\,x_1\,\$\,.\,\$\,{\it map}\,({\it op}\land)\,{\it rs\_}\,\$\,)\,\$\,x_2\,\$\, $ \\
wneuper@2328
   119
\>relate\>: rs\_
wneuper@2328
   120
\end{tabbing}}
wneuper@2328
   121
This problem is {\bf matched} with the formalization and yields the model shown above.
wneuper@2328
   122
wneuper@2328
   123
\paragraph{Methods} describe the algorithms solving the problems. The method solving the example calls the subproblems mentioned:
wneuper@2328
   124
{\it\begin{tabbing}
wneuper@2328
   125
123\=123\=123\=123\=123\=123\=\kill
wneuper@2328
   126
\>  {\tt Script} Maximum\_value (fix\_::bool list) (m\_::real) (rs\_::bool list)     \\
wneuper@2328
   127
\>\>\>\>\>         (v\_::real) (itv\_::real set) (err\_::bool) =                       \\
wneuper@2328
   128
\>\>     ({\tt let}\\
wneuper@2328
   129
\>\>\>        e\_ = (hd o (filter (Testvar m\_))) rs\_;                        \\
wneuper@2328
   130
\>\>\>        t\_ = ({\tt if} \#1 $<$ Length rs\_                                        \\
wneuper@2328
   131
\>\>\>\>                {\tt then} (Subproblem (Reals,[make, funtion],no\_met) [m\_, v\_, rs\_]) \\
wneuper@2328
   132
\>\>\>\>                {\tt else} (hd rs\_));                                         \\
wneuper@2328
   133
\>\>\>        mx\_ = Subproblem (Reals,[on\_interval, for\_maximum, differentiate, \\
wneuper@2328
   134
\>\>\>\>\>                 function], maximum\_on\_interval) [ t\_, v\_, itv\_ ]   \\
wneuper@2328
   135
\>\>      {\tt in} (Subproblem (Reals,[tool,find\_values],find\_values)               \\
wneuper@2328
   136
\>\>\>\>\>              [ mx\_, (Rhs t\_), v\_, m\_, (dropWhile (ident e\_), rs\_])))\\
wneuper@2328
   137
\end{tabbing}}
wneuper@2328
   138
wneuper@2328
   139
An example is given a {\bf specification} ('it is specified') by three pointers into each of the three parts of the knowledge base, i.e. a pointer to a theory, to a problem and to a method. For the example this is {\it (Differentiate, [calculus, optimization], Maximum\_value)}. 
wneuper@2328
   140
wneuper@2328
   141
\section{Interaction on the worksheet and the browsers}
wneuper@2328
   142
Within a calculation the centre of interaction with the user is a so-called {\bf worksheet}. At certain points the user may want to view the knowledge base in a so-called {\bf browser-window} and/or select some knowledge, or the dialog presents such a window.
wneuper@2328
   143
wneuper@2328
   144
\paragraph{In the modeling phase} the user inputs formulas on the worksheet, and on the worksheet they get most of the feedback. After a while the worksheet could look like this:
wneuper@2328
   145
{\it
wneuper@2328
   146
\begin{tabbing}
wneuper@2328
   147
123\=123\=123\=relate...\=123\=\kill
wneuper@2328
   148
\>Solve\_problem [maximum, calculus, optimization] \\
wneuper@2328
   149
\>\>Model\\
wneuper@2328
   150
\>\>\>given: \>$[$ Constants $r=7\;]$\\
wneuper@2328
   151
\>\>\>where: \>$\,0\leq r$\\
wneuper@2328
   152
\>\>\>find:  \>$[$ Maximum, AdditionalValues $[u,v]\;]$\\
wneuper@2328
   153
\>\>\>relate:\>$[A=2uv,\;(\frac{u}{2})^2+(\frac{v}{2})^2=r^2,\;\frac{u}{2}=r\sin{\alpha}\;]$
wneuper@2328
   154
\end{tabbing}}
wneuper@2328
   155
where {\it Solve\_problem [maximum, calculus, optimization]}, {\it Constants}, {\it Maximum}, {\it AdditionalValues}, and $0\leq r$ have been supplied by the system, and several items are marked: {\it Maximum} with 'missing', $A=2uv$ with 'incorrect', and $\frac{u}{2}=r\sin{\alpha}$ with 'superfluous'. Regarding this kind of feedback\label{model-feedback} users may successfully complete modeling; if they are not capable to do it, they just hit a 'go-on' button and \sisac{} gets the correct model from the hidden formalization and specification. For the following let us assume, that the model is completed correctly:
wneuper@2328
   156
{\it
wneuper@2328
   157
\begin{tabbing}
wneuper@2328
   158
123\=123\=123\=relate...\=123\=\kill
wneuper@2328
   159
\>Solve\_problem [maximum, calculus, optimization] \\
wneuper@2328
   160
\>\>Model\\
wneuper@2328
   161
\>\>\>given: \>$[$ Constants $r=7]$\\
wneuper@2328
   162
\>\>\>where: \>$\,0\leq r$\\
wneuper@2328
   163
\>\>\>find:  \>$[$ Maximum , AdditionalValues $[u,v]\;]$\\
wneuper@2328
   164
\>\>\>relate:\>$[A=2uv-u^2,\;(\frac{u}{2})^2+(\frac{v}{2})^2=r^2,\frac{u}{2}=r\sin{\alpha}]$\\
wneuper@2328
   165
\>\>Specification\\
wneuper@2328
   166
\>\>\>Theory: \>\>%Reals
wneuper@2328
   167
\\
wneuper@2328
   168
\>\>\>Problem:\>\>%[maximum, calculus, optimization]
wneuper@2328
   169
\\
wneuper@2328
   170
\>\>\>Method: \>\>%[make\_fun, by\_elimination]
wneuper@2328
   171
\end{tabbing}}
wneuper@2328
   172
The superfluous item $\frac{u}{2}=r\sin{\alpha}$ does not matter, below there are the {\bf specification-fields} to be determined (i.e. input by the user) within the specification phase.
wneuper@2328
   173
wneuper@2328
   174
\paragraph{The specification phase} requires data from the knowledge base in general. In the case of the examples model above the decision is required, which kind of problem the given model can be matched with: {\it[linear, optimization]}, or {\it[calculus, optimization]}, or some other problem. The information necessary for this decision can be found in the hierarchy of problems.
wneuper@2328
   175
wneuper@2328
   176
Learners can {\bf browse} the hierarchy of problems (theories, methods) and they can {\bf apply} the problem (theory, method); the latter transfers the problem (theory, method) to the respective field below the model on the worksheet.
wneuper@2328
   177
wneuper@2328
   178
For instance, applying the problem {\it[linear, optimization]} would cause this display on the worksheet:
wneuper@2328
   179
{\it
wneuper@2328
   180
\begin{tabbing}
wneuper@2328
   181
123\=123\=123\=relate...\=123\=\kill
wneuper@2328
   182
\>Solve\_problem [maximum, calculus, optimization] \\
wneuper@2328
   183
\>\>Model\\
wneuper@2328
   184
\>\>\>given: \>$[$\underline{Constants $r=7$}$]$\\
wneuper@2328
   185
\>\>\>where: \>$\,0\leq r$\\
wneuper@2328
   186
\>\>\>find:  \>$[$Maximum , \underline{AdditionalValues $[u,v]$}$]$\\
wneuper@2328
   187
\>\>\>relate:\>$[\underline{A=2uv-u^2,\;(\frac{u}{2})^2+(\frac{v}{2})^2=r^2,\frac{u}{2}=r\sin{\alpha}}]$\\
wneuper@2328
   188
\>\>Specification\\
wneuper@2328
   189
\>\>\>Theory:\\
wneuper@2328
   190
\>\>\>Problem:\>\> [linear, optimization]\\
wneuper@2328
   191
\>\>\>Method:
wneuper@2328
   192
\end{tabbing}}
wneuper@2328
   193
\noindent where some items in the model would be marked with some\underline{ error-feedback}. For instance, applying a theory even might cause the feedback 'syntax-error' when the model contains function constants not defined in the theory or in one of the theories parents.
wneuper@2328
   194
wneuper@2328
   195
Browsing problems (when started from a model on the worksheet) matches the problem selected with the model on the worksheet, i.e. on the browser-window the same feedbacks are given as for the model on the worksheet described on p.\pageref{model-feedback}.
wneuper@2328
   196
wneuper@2328
   197
\section{The solving phase and subproblems}
wneuper@2328
   198
Before we describe \sisac s features for the solving phase, we fix one correct model and one specification (out of several possible ones) as follows:
wneuper@2328
   199
{\it
wneuper@2328
   200
\begin{tabbing}
wneuper@2328
   201
123\=123\=123\=relate...\=123\=\kill
wneuper@2328
   202
\>Solve\_problem [maximum, calculus, optimization] \\
wneuper@2328
   203
\>\>Model\\
wneuper@2328
   204
\>\>\>given: \>$[$Constants $r=7]$\\
wneuper@2328
   205
\>\>\>where: \>$\,0\leq r$\\
wneuper@2328
   206
\>\>\>find:  \>$[$Maximum $A$, AdditionalValues $[u,v]]$\\
wneuper@2328
   207
\>\>\>relate:\>$[A=2uv-u^2,\;(\frac{u}{2})^2+(\frac{v}{2})^2=r^2,\frac{u}{2}=r\sin{\alpha}]$\\
wneuper@2328
   208
\>\>Specification\\
wneuper@2328
   209
\>\>\>Theory: \>\>Reals\\
wneuper@2328
   210
\>\>\>Problem:\>\>[maximum, calculus, optimization]\\
wneuper@2328
   211
\>\>\>Method: \>\>[make\_fun, by\_elimination]
wneuper@2328
   212
\end{tabbing}}
wneuper@2328
   213
wneuper@2328
   214
wneuper@2328
   215
The following worksheet shows the whole calculation without the respective models and specifications; this short-presentation could stem from an interaction, where the user is merely interested in the result and let the system calculate autonomously:
wneuper@2328
   216
{\it\small 
wneuper@2328
   217
\begin{tabbing}
wneuper@2328
   218
1234\=123\=123\=123\=123\=123\=123\=123\=123\=\kill
wneuper@2328
   219
\>Solve\_problem [maximum, calculus, optimization] \\
wneuper@2328
   220
\>\>1.\>SubProblem (DiffAppl, [make, function]) \\
wneuper@2328
   221
\>\>\>1.\>${\it solve\_univariate}\;\left(\left(\frac{u}{2}\right)^2+\left(\frac{v}{2}\right)^2=r^2\right)\;u$\\
wneuper@2328
   222
\>\>\>1'.\>$L = \left[u=2\sqrt{r^2-\left(\frac{v}{2}\right)^2},\;u=-2\sqrt{r^2-\left(\frac{v}{2}\right)^2}\right]$\\
wneuper@2328
   223
\>\>\>2.\>$L_1= \left[u=2\sqrt{r^2-\left(\frac{v}{2}\right)^2}\right]$\\
wneuper@2328
   224
\>\>1'.\>$A_1= 2\cdot 2\sqrt{r^2-\left(\frac{v}{2}\right)^2}\cdot v - v^2$\\
wneuper@2328
   225
\>\>2.\>SubProblem (DiffAppl, [on\_interval, for\_maximum, differentiate, function])\\
wneuper@2328
   226
\>\>\>1.\>$\frac{d}{dv}\left( 2\cdot 2\sqrt{r^2-\left(\frac{v}{2}\right)^2}\cdot v - v^2 \right)=$\\
wneuper@2328
   227
\>\>\>1'.\>$A_1^\prime = 2\sqrt{r^2-\left(\frac{v}{2}\right)^2} - \frac{v^2}{2\sqrt{r^2-\left(\frac{v}{2}\right)^2}} - 2v$\\
wneuper@2328
   228
\>\>\>2.\>${\it solve\_univariate}\;\left(2\sqrt{r^2-\left(\frac{v}{2}\right)^2} - \frac{v^2}{2\sqrt{r^2-\left(\frac{v}{2}\right)^2}} - 2v =0\right)\;v$\\
wneuper@2328
   229
\>\>\>2'.\>$L = [v=234.567]$\\
wneuper@2328
   230
\>\>3.\>SubProblem (DiffAppl, [find\_values, tool])\\
wneuper@2328
   231
\>\>3'.\>$[u=123.456, v=234.567]$\\
wneuper@2328
   232
\>$[u=123.456, v=234.567]$
wneuper@2328
   233
\end{tabbing}}
wneuper@2328
   234