doc-src/isac/mat-eng-de.tex
author Alexandra Hirn <alexandra.hirn@hotmail.com>
Mon, 26 Jul 2010 14:46:45 +0200
branchlatex-isac-doc
changeset 37882 d354cdcc0a5d
parent 37877 3b63f6bcf05f
child 37886 de15b4d5a6a4
permissions -rw-r--r--
translation until chapter 6
     1 \documentclass[11pt,a4paper,headline,headcount,towside,nocenter]{report}
     2 \usepackage{latexsym} 
     3 
     4 %\usepackage{ngerman}
     5 %\grmn@dq@error ...and \dq \string #1 is undefined}
     6 %l.989 ...tch the problem type \\{\tt["squareroot",
     7 %                                                  "univ
     8 \bibliographystyle{alpha}
     9 
    10 \def\isac{${\cal I}\mkern-2mu{\cal S}\mkern-5mu{\cal AC}$}
    11 
    12 \title{\isac --- Interface for\\
    13   Developers of Math Knowledge\\[1.0ex]
    14   and\\[1.0ex]
    15   Tools for Experiments in\\
    16   Symbolic Computation\\[1.0ex]}
    17 \author{The \isac-Team\\
    18   \tt isac-users@ist.tugraz.at\\[1.0ex]}
    19 \date{\today}
    20 
    21 \begin{document}
    22 \maketitle
    23 \newpage
    24 \tableofcontents
    25 \newpage
    26 \listoftables
    27 \newpage
    28 
    29 \chapter{Einleitung}
    30 \section{``Authoring'' und ``Tutoring''}
    31 {TO DO} Mathematik lernen -- verschiedene Autoren -- Isabelle
    32 Die Grundlage f\"ur \isac{} bildet Isabelle. Dies ist ein ``theorem prover'', der von L. Paulson und T. Nipkow entwickelt wird und Hard- und Software pr\"uft.
    33 \section{Der Inhalt des Dokuments}
    34 \paragraph{TO DO} {Als Anleitung:} Dieses Dokument beschreibt das Kerngebiet (KE) von \isac{}, das Gebiet der mathematics engine (ME) im Kerngebiet und die verschiedenen Funktionen wie das Umschreiben und der Vergleich.
    35 
    36 \isac{} und KE wurden in SML geschrieben, die Sprache in Verbindung mit dem Vorg\"anger des Theorem Provers Isabelle entwickelt. So kam es, dass in diesem Dokument die Ebene ASCII als SML Code pr\"asentiert wird. Der Leser wird vermutlich erkennen, dass der \isac{} Benutzer eine vollkommen andere Sichtweise auf eine grafische Benutzeroberfl\"ache bekommt.
    37 
    38 Das Dokument ist eigenst\"andig; Basiswissen \"uber SML (für eine Einf\"uhrung siehe \cite{Paulson:91}), Terme und Umschreibung wird vorrausgesetzt.
    39 
    40 %The interfaces will be moderately exended during the first phase of development of the mathematics knowledge. The work on the subprojects defined should {\em not} create interfaces of any interest to a user or another author of knowledge except identifiers (of type string) for theorems, rulesets etc.
    41 
    42 Hinweis: SML Code, Verzeichnis, Dateien sind {\tt in 'tt' geschrieben}; besonders in {\tt ML>} ist das Kerngebiet schnell.
    43 
    44 \paragraph{Versuchen Sie es!}  Ein weiteres Anliegen dieses Textes ist, dem Leser Tipps f\"ur Versuche mit den Anwendungen zu geben.
    45 
    46 \section{Gleich am Computer ausprobieren!}\label{get-started}
    47 \paragraph{TO DO screenshot} Bevor Sie mit Ihren Versuchen beginnen, m\"ochten wir Ihnen noch einige Hinweise geben.
    48 \begin{itemize}
    49  \item System starten
    50  \item Shell aufmachen und die Datei mat-eng-de.sml \"offnen.
    51  \item $>$  :  Hinter diesem Zeichen (``Prompt'') stehen jene, die Sie selbst eingeben bzw. mit Copy und Paste aus der Datei kopieren.
    52  \item Die Eingabe wird mit ``;'' und ``Enter'' abgeschlossen.
    53  \item Zeilen, die nicht mit Prompt beginnen, werden vom Computer ausgegeben.
    54  
    55 \end{itemize}
    56 
    57 \part{Experimentelle Ann\"aherung}
    58 
    59 \chapter{Terme und Theorien}
    60 Wie bereits erw\"ahnt, geht es um Computer-Mathematik. In den letzten Jahren hat die ``computer science'' grosse Fortschritte darin gemacht, Mathematik auf dem Computer verst\"andlich darzustellen. Dies gilt f\"ur mathematische Formeln, f\"ur die Beschreibung von Problem (behandelt in Abs.\ref{pbl}), f\"ur L\"osungsmethoden (behandelt in Abs.\ref{met}) etc. Wir beginnen mit mathematischen Formeln --- gleich zum Ausprobieren wie in Abs.\ref{get-started} oben vorbereitet.
    61 
    62 \section{Von der Formel zum Term}
    63 Um ein Beispiel zu nennen: Die Formel $a+b\cdot 3$ l\"asst sich in lesbarer Form so eingeben:
    64 {\footnotesize\begin{verbatim}
    65   > "a + b * 3";
    66   val it = "a + b * 3" : string
    67 \end{verbatim}}
    68 \noindent ``a + b * 3'' ist also ein String (=Zeichenfolge). In dieser Form weiss der Computer nicht, dass z.B. eine Multiplikation {\em vor} einer Addition zu rechnen ist. Isabelle braucht Formeln in einer anderen Form; Diese kann man mit der Funktion ``str2term'' (= string to term) umrechnen:
    69 {\footnotesize\begin{verbatim}
    70   > str2term "a + b * 3";
    71   val it =
    72      Const ("op +", "[RealDef.real, RealDef.real] => RealDef.real") $
    73            Free ("a", "RealDef.real") $
    74         (Const ("op *", "[RealDef.real, RealDef.real] => RealDef.real") $ ... $
    75            ...) : Term.term
    76 \end{verbatim}}
    77 \noindent Jene Form braucht Isabelle intern zum rechnen. Sie heisst Term und ist nicht lesbar, daf\"ur aber speicherbar mit Hilfe von ``val'' (=value) 
    78 {\footnotesize\begin{verbatim}
    79   > val term = str2term "a + b * 3";
    80   val term =  
    81      Const ("op +", "[RealDef.real, RealDef.real] => RealDef.real") $
    82            Free ("a", "RealDef.real") $
    83         (Const ("op *", "[RealDef.real, RealDef.real] => RealDef.real") $ ... $
    84            ...) : Term.term
    85 \end{verbatim}
    86 Der gespeicherte Term kann einer Funktion ``atomty'' \"ubergeben werden, die jenen in einer abstrakten Struktur zeigt:
    87 {\footnotesize\begin{verbatim}
    88   > atomty term;
    89  
    90   ***
    91   *** Const (op +, [real, real] => real)
    92   *** . Free (a, real)
    93   *** . Const (op *, [real, real] => real)
    94   *** . . Free (b, real)
    95   *** . . Free (3, real)
    96   ***
    97  
    98   val it = () : unit
    99 \end{verbatim}%size
   100 
   101 
   102 \section{``Theory'' und ``Parsing``}
   103 Die theory gibt an, welcher Ausdruck wo steht. Eine derzeitige theory wird intern als \texttt{thy} gekennzeichnet. Jene theory, die alles Wissen ent\"ahlt ist \isac{}. 
   104 
   105 {\footnotesize\begin{verbatim}
   106   > Isac.thy;
   107        val it =
   108           {ProtoPure, CPure, HOL, Set, Typedef, Fun, Product_Type, Lfp, Gfp,
   109           Sum_Type, Relation, Record, Inductive, Transitive_Closure,
   110           Wellfounded_Recursion, NatDef, Nat, NatArith, Divides, Power,
   111           SetInterval, Finite_Set, Equiv, IntDef, Int, Datatype_Universe,
   112           Datatype, Numeral, Bin, IntArith, Wellfounded_Relations, Recdef, IntDiv,
   113           IntPower, NatBin, NatSimprocs, Relation_Power, PreList, List, Map,
   114           Hilbert_Choice, Main, Lubs, PNat, PRat, PReal, RealDef, RealOrd,
   115           RealInt, RealBin, RealArith0, RealArith, RComplete, RealAbs, RealPow,
   116           Ring_and_Field, Complex_Numbers, Real, ListG, Tools, Script, Typefix,
   117           Float, ComplexI, Descript, Atools, Simplify, Poly, Rational, PolyMinus,
   118           Equation, LinEq, Root, RootEq, RatEq, RootRat, RootRatEq, PolyEq, Vect,
   119           Calculus, Trig, LogExp, Diff, DiffApp, Integrate, EqSystem, Biegelinie,
   120           AlgEin, Test, Isac} : Theory.theory
   121 \end{verbatim}
   122 Die, die ein Mal enth\"alt ist groups.thy. Suchen Sie nach '*' unter der Adresse:
   123 
   124 http://www.cl.cam.ac.uk/research/hvg/Isabelle/dist/library/HOL/Groups.html
   125 Hier wird Ihnen erkl\"art, wie das Mal vom Computer gelesen wird.
   126 {\footnotesize\begin{verbatim}
   127   > Group.thy
   128       fixes f :: "'a => 'a => 'a" (infixl "*" 70)
   129       assumes assoc [ac_simps]: "a * b * c = a * (b * c)"
   130 \end{verbatim}
   131 Der ''infix`` ist der Operator, der zwischen zwei Argumenten steht. 70 bedeutet, dass Mal eine hohe Priorit\"at hat (bei einem Plus liegt der Wert bei 50 oder 60). 
   132 
   133 Parsing entsteht durch einen string und eine theory. Es verwendet Informationen, die in der theory von Isabelle enthalten sind.
   134 {\footnotesize\begin{verbatim}
   135   > parse;
   136        val it = fn : Theory.theory -> string -> Thm.cterm Library.option
   137 \end{verbatim}
   138 Dieser term kann wieder in seine einzelnen Teile zerlegt werden.
   139 {\footnotesize\begin{verbatim}
   140    > val it = (term_of o the) it;
   141         val it =
   142            Const ("op +", "[RealDef.real, RealDef.real] => RealDef.real") $
   143                Free ("a", "RealDef.real") $
   144            (Const ("op *", "[RealDef.real, RealDef.real] => RealDef.real") $ ... $
   145                ...) : Term.term
   146 \end{verbatim}
   147 
   148 \paragraph{Versuchen Sie es!} Das mathematische Wissen w\"achst, indem man zu den Urspr\"ungen schaut. In den folgenden Beispielen werden verschiedene Meldungen genauer erkl\"art.
   149 
   150 {\footnotesize\begin{verbatim}
   151    > (*-1-*);
   152    > parse HOL.thy "2^^^3";
   153       *** Inner lexical error at: "^^^3"
   154       val it = None : Thm.cterm Library.option         
   155 \end{verbatim}
   156 ''Inner lexical error`` bedeutet, dass ein Fehler aufgetreten ist, vermutlich hat man sich vertippt.
   157 
   158 {\footnotesize\begin{verbatim}
   159    > (*-2-*);
   160    > parse HOL.thy "d_d x (a + x)";
   161       val it = None : Thm.cterm Library.option               
   162 \end{verbatim}
   163 Fehlt ''Inner lexical error`` wurde der Parse nicht gefunden.
   164 
   165 {\footnotesize\begin{verbatim}
   166    > (*-3-*);
   167    > parse Rational.thy "2^^^3";
   168       val it = Some "2 ^^^ 3" : Thm.cterm Library.option               
   169 \end{verbatim}
   170 
   171 {\footnotesize\begin{verbatim}
   172    > (*-4-*);
   173    > val Some t4 = parse Rational.thy "d_d x (a + x)";
   174       val t4 = "d_d x (a + x)" : Thm.cterm              
   175 \end{verbatim}
   176 
   177 {\footnotesize\begin{verbatim}
   178    > (*-5-*);
   179    > val Some t5 = parse Diff.thy  "d_d x (a + x)";
   180       val t5 = "d_d x (a + x)" : Thm.cterm             
   181 \end{verbatim}
   182 
   183 Der Pase liefert hier einen ''zu sch\"onen`` Ausdruck in Form eines cterms, der wie ein string aussieht. Am verl\"asslichsten sind terme, die sich selbst erzeugen lassen.
   184 
   185 \section{Details von Termen}
   186 Mit Hilfe der darunterliegenden Darstellung sieht man, dass ein cterm in einen term umgewandelt werden kann.
   187 {\footnotesize\begin{verbatim}
   188    > term_of;
   189       val it = fn : Thm.cterm -> Term.term
   190 \end{verbatim}
   191 Durch die Umwandlung eines cterms in einen term sieht man die einzelnen Teile des Terms. ''Free`` bedeutet, dass man die Variable \"andern kann.
   192 {\footnotesize\begin{verbatim}
   193    > term_of t4;
   194       val it =
   195          Free ("d_d", "[RealDef.real, RealDef.real] => RealDef.real") $ ... $
   196          ...: Term.term
   197 
   198 \end{verbatim}
   199 In diesem Fall sagt uns das ''Const``, dass die Variable eine Konstante ist, also ein Fixwert ist und immer die selbe Funktion hat.
   200 {\footnotesize\begin{verbatim}
   201    > term_of t5;
   202       val it =
   203          Const ("Diff.d_d", "[RealDef.real, RealDef.real] => RealDef.real") $ ... $
   204          ... : Term.term
   205 \end{verbatim}
   206 Sollten verschiedene Teile des Output nicht sichtbar sein, kann die Schriftgr\"osse ge\"andert werden.
   207 {\footnotesize\begin{verbatim}
   208    > print_depth;
   209       val it = fn : int -> unit
   210  \end{verbatim}
   211 Zuerst gibt man die Schriftgr\"osse ein, danach den term, der gr\"osser werden soll.
   212 {\footnotesize\begin{verbatim}
   213    > print_depth 10;
   214       val it = () : unit
   215    > term_of t4;
   216          val it =
   217             Free ("d_d", "[RealDef.real, RealDef.real] => RealDef.real") $
   218                 Free ("x", "RealDef.real") $
   219             (Const ("op +", "[RealDef.real, RealDef.real] => RealDef.real") $
   220                 Free ("a", "RealDef.real") $ Free ("x", "RealDef.real"))
   221          : Term.term
   222 
   223    > print_depth 10;
   224          val it = () : unit
   225    > term_of t5;
   226          val it =
   227             Const ("Diff.d_d", "[RealDef.real, RealDef.real] => RealDef.real") $
   228                 Free ("x", "RealDef.real") $
   229             (Const ("op +", "[RealDef.real, RealDef.real] => RealDef.real") $
   230                 Free ("a", "RealDef.real") $ Free ("x", "RealDef.real"))
   231          : Term.term
   232 \end{verbatim}
   233 
   234 Eine andere Variante um den Unterschied der beiden Terme zu sehen ist folgende: 
   235 {\footnotesize\begin{verbatim}
   236    > (*-4-*) val thy = Rational.thy;
   237       val thy =
   238          {ProtoPure, CPure, HOL, Set, Typedef, Fun, Product_Type, Lfp, Gfp,
   239          Sum_Type, Relation, Record, Inductive, Transitive_Closure,
   240          Wellfounded_Recursion, NatDef, Nat, NatArith, Divides, Power,
   241          SetInterval, Finite_Set, Equiv, IntDef, Int, Datatype_Universe,
   242          Datatype, Numeral, Bin, IntArith, Wellfounded_Relations, Recdef, IntDiv,
   243          IntPower, NatBin, NatSimprocs, Relation_Power, PreList, List, Map,
   244          Hilbert_Choice, Main, Lubs, PNat, PRat, PReal, RealDef, RealOrd,
   245          RealInt, RealBin, RealArith0, RealArith, RComplete, RealAbs, RealPow,
   246          Ring_and_Field, Complex_Numbers, Real, ListG, Tools, Script, Typefix,
   247          Float, ComplexI, Descript, Atools, Simplify, Poly, Rational}
   248      : Theory.theory
   249    > ((atomty) o term_of o the o (parse thy)) "d_d x (a + x)";
   250  
   251       ***
   252       *** Free (d_d, [real, real] => real)
   253       *** . Free (x, real)
   254       *** . Const (op +, [real, real] => real)
   255       *** . . Free (a, real)
   256       *** . . Free (x, real)
   257       ***
   258  
   259       val it = () : unit
   260 
   261 
   262    > (*-5-*) val thy = Diff.thy;
   263       val thy =
   264          {ProtoPure, CPure, HOL, Set, Typedef, Fun, Product_Type, Lfp, Gfp,
   265          Sum_Type, Relation, Record, Inductive, Transitive_Closure,
   266          Wellfounded_Recursion, NatDef, Nat, NatArith, Divides, Power,
   267          SetInterval, Finite_Set, Equiv, IntDef, Int, Datatype_Universe,
   268          Datatype, Numeral, Bin, IntArith, Wellfounded_Relations, Recdef, IntDiv,
   269          IntPower, NatBin, NatSimprocs, Relation_Power, PreList, List, Map,
   270          Hilbert_Choice, Main, Lubs, PNat, PRat, PReal, RealDef, RealOrd,
   271          RealInt, RealBin, RealArith0, RealArith, RComplete, RealAbs, RealPow,
   272          Ring_and_Field, Complex_Numbers, Real, Calculus, Trig, ListG, Tools,
   273          Script, Typefix, Float, ComplexI, Descript, Atools, Simplify, Poly,
   274          Equation, LinEq, Root, RootEq, Rational, RatEq, RootRat, RootRatEq,
   275          PolyEq, LogExp, Diff} : Theory.theory
   276  
   277    > ((atomty) o term_of o the o (parse thy)) "d_d x (a + x)";
   278  
   279       ***
   280       *** Const (Diff.d_d, [real, real] => real)
   281       *** . Free (x, real)
   282       *** . Const (op +, [real, real] => real)
   283       *** . . Free (a, real)
   284       *** . . Free (x, real)
   285       ***
   286  
   287       val it = () : unit
   288 \end{verbatim}
   289 
   290 
   291 {\chapter{''Rewriting``}}
   292 {\section{}}
   293 Bei Rewriting handelt es sich um die Vereinfachung eines Terms in vielen kleinen Schritten und nach bestimmten Regeln. Der Computer wendet dabei hintereinander verschiedene Rechengesetze an, weil er den Term ansonsten nicht l\"osen kann.
   294 
   295 {\footnotesize\begin{verbatim}
   296 > rewrite_;
   297 val it = fn
   298 :
   299    Theory.theory ->
   300    ((Term.term * Term.term) list -> Term.term * Term.term -> bool) ->
   301    rls ->
   302    bool ->
   303    Thm.thm -> Term.term -> (Term.term * Term.term list) Library.option
   304 
   305 > rewrite;
   306 val it = fn
   307 :
   308    theory' ->
   309    rew_ord' ->
   310    rls' -> bool -> thm' -> cterm' -> (string * string list) Library.option
   311 
   312 \end{verbatim}
   313 \textbf{Versuchen Sie es!} Um zu sehen, wie der Computer vorgeht und welche Rechengesetze er anwendet, zeigen wir Ihnen durch Differenzieren von (a + a * (2 + b)), die einzelnen Schritte. Sie k\"onnen nat\"urlichauch selbst einige Beispiele ausprobieren!
   314 
   315 Zuerst legt man fest, dass es sich um eine Differenzierung handelt.
   316 {\footnotesize\begin{verbatim}
   317    > val thy' = "Diff.thy";
   318       val thy' = "Diff.thy" : string
   319 \end{verbatim}
   320 Dann gibt man die zu l\"osende Rechnung ein.
   321 {\footnotesize\begin{verbatim}
   322    > val ct = "d_d x (a + a * (2 + b))";
   323       val ct = "d_d x (a + a * (2 + b))" : string
   324 \end{verbatim}
   325 Anschließend gibt man bekannt, dass die Summenregel angewandt werden soll.
   326 {\footnotesize\begin{verbatim}
   327    > val thm = ("diff_sum","");
   328       val thm = ("diff_sum", "") : string * string
   329 \end{verbatim}
   330 Schliesslich wird die erste Ableitung angezeigt.
   331 {\footnotesize\begin{verbatim}
   332    > val Some (ct,_) = rewrite_inst thy' "tless_true" "eval_rls" true
   333                         [("bdv","x::real")] thm ct;#
   334       val ct = "d_d x a + d_d x (a * (2 + b))" : cterm'
   335 \end{verbatim}
   336 Will man auch die zweite Ableitung sehen, geht man so vor:
   337 {\footnotesize\begin{verbatim}
   338    > val thm = ("diff_prod_const","");
   339       val thm = ("diff_prod_const", "") : string * string
   340 \end{verbatim} 
   341 Auch die zweite Ableitung wird sichtbar.
   342 {\footnotesize\begin{verbatim}
   343    > val Some (ct,_) = rewrite_inst thy' "tless_true" "eval_rls" true
   344                         [("bdv","x::real")] thm ct;#
   345       val ct = "d_d x a + a * d_d x (2 + b)" : cterm'
   346 \end{verbatim}
   347 
   348 {\section{M\"oglichkeiten von Rewriting}
   349 Es gibt verscheidene Varianten von Rewriting, die alle eine bestimmte Bedeutung haben.
   350 \textit{rewrite\_inst} bedeutet, dass die Liste der Terme vor dem Rewriting durch ein ''Theorem`` (ein mathematischer Begriff f\"ur einen Satz) ersetzt wird.
   351 {\footnotesize\begin{verbatim}
   352 > rewrite_inst;
   353 val it = fn
   354 :
   355    theory' ->
   356    rew_ord' ->
   357    rls' ->
   358    bool -> 'a -> thm' -> cterm' -> (cterm' * cterm' list) Library.option
   359 \end{verbatim}
   360 Mit Hilfe von \textit{rewrite\_set} werden Terme, die normalerweise nur mit einem Thoerem vereinfacht dargestellt werden, mit einem ganzen ''rule set`` (=Regelsatz, weiter unten erkl\"art) umgeschrieben.
   361 {\footnotesize\begin{verbatim}
   362    > rewrite_set;
   363       val it = fn
   364       : theory' -> bool -> rls' -> cterm' -> (string * string list) Library.option
   365 \end{verbatim}
   366 \textit{rewrite\_set\_inst} ist eine Kombination der beiden oben genannten M\"oglichkeiten.
   367 {\footnotesize\begin{verbatim}
   368    > rewrite_set_inst;
   369       val it = fn
   370       :
   371          theory' ->
   372          bool -> subs' -> rls' -> cterm' -> (string * string list) Library.option
   373 \end{verbatim}
   374 Wenn man sehen m\"ochte, wie Rewriting bei den einzelnen Theorems funktioniert, kann man dies mit \textit{trace\_rewrite} versuchen.
   375 {\footnotesize\begin{verbatim}
   376    > toggle;
   377       val it = fn : bool ref -> bool
   378    > toggle trace_rewrite;
   379       val it = true : bool
   380    > toggle trace_rewrite;
   381       val it = false : bool
   382 \end{verbatim}
   383  
   384 \section{Rule sets}
   385 Einige der oben genannten Varianten von Rewriting beziehen sich nicht nur auf einen Theorem, sondern auf einen ganzen Block von Theorems, die man als Rule set bezeichnet.
   386 Dieser wird so lange angewendet, bis ein Element davon f\"ur Rewriting verwendet werden kann. Sollte der Begriff ''terminate`` fehlen, wird das Rule set nicht beendet und l\"auft weiter.
   387 Ein Beispiel f\"ur einen Regelsatz ist folgendes:
   388 \footnotesize\begin{verbatim}
   389 ???????????
   390 \end{verbatim}
   391 
   392 \footnotesize\begin{verbatim}
   393    > sym;
   394       val it = "?s = ?t ==> ?t = ?s" : Thm.thm
   395    > rearrange_assoc;
   396       val it =
   397          Rls
   398             {id = "rearrange_assoc",
   399                scr = Script (Free ("empty_script", "RealDef.real")),
   400                calc = [],
   401                erls =
   402                Rls
   403                   {id = "e_rls",
   404                      scr = EmptyScr,
   405                      calc = [],
   406                      erls = Erls,
   407                      srls = Erls,
   408                      rules = [],
   409                      rew_ord = ("dummy_ord", fn),
   410                      preconds = []},
   411                srls =
   412                Rls
   413                   {id = "e_rls",
   414                      scr = EmptyScr,
   415                      calc = [],
   416                      erls = Erls,
   417                      srls = Erls,
   418                      rules = [],
   419                      rew_ord = ("dummy_ord", fn),
   420                      preconds = []},
   421                rules =
   422                [Thm ("sym_radd_assoc", "?m1 + (?n1 + ?k1) = ?m1 + ?n1 + ?k1"  [.]),
   423                   Thm
   424                      ("sym_rmult_assoc",
   425                         "?m1 * (?n1 * ?k1) = ?m1 * ?n1 * ?k1"  [.])],
   426                rew_ord = ("e_rew_ord", fn),
   427                preconds = []} : rls
   428 \end{verbatim}
   429 
   430 
   431 \section{Berechnung von Konstanten}
   432 Sobald Konstanten in dem Bereich des Subterms sind, k\"onnen sie von einer Funktion berechnet werden:
   433 \footnotesize\begin{verbatim}
   434    > calculate;
   435       val it = fn
   436       :
   437          theory' ->
   438          string *
   439          (
   440          string ->
   441          Term.term -> Theory.theory -> (string * Term.term) Library.option) ->
   442          cterm' -> (string * thm') Library.option
   443 
   444    > calculate_;
   445       val it = fn
   446       :
   447          Theory.theory ->
   448          string *
   449          (
   450          string ->
   451          Term.term -> Theory.theory -> (string * Term.term) Library.option) ->
   452          Term.term -> (Term.term * (string * Thm.thm)) Library.option
   453 \end{verbatim}
   454 Man bekommt das Ergebnis und die Theorem bezieht sich darauf. Daher sind die folgenden mathematischen Rechnungen m\"oglich:
   455 \footnotesize\begin{verbatim}
   456    > calclist;
   457       val it =
   458          [("Vars", ("Tools.Vars", fn)), ("matches", ("Tools.matches", fn)),
   459             ("lhs", ("Tools.lhs", fn)), ("plus", ("op +", fn)),
   460             ("times", ("op *", fn)), ("divide_", ("HOL.divide", fn)),
   461             ("power_", ("Atools.pow", fn)), ("is_const", ("Atools.is'_const", fn)),
   462             ("le", ("op <", fn)), ("leq", ("op <=", fn)),
   463             ("ident", ("Atools.ident", fn)), ("sqrt", ("Root.sqrt", fn)),
   464             ("Test.is_root_free", ("is'_root'_free", fn)),
   465             ("Test.contains_root", ("contains'_root", fn))]
   466       :
   467          (
   468          string *
   469          (
   470          string *
   471          (
   472          string ->
   473          Term.term -> Theory.theory -> (string * Term.term) Library.option))) list
   474 \end{verbatim}
   475 Diese werden so angewendet:
   476 \footnotesize\begin{verbatim}
   477 \end{verbatim}
   478 
   479 
   480 
   481 \chapter{Termordnung}
   482 Die Anordnungen der Begriffe sind unverzichtbar f\"ur den Gebrauch des Umschreibens von normalen Funktionen und von normalen Formeln, die n\"otig sind um passende Modelle für Probleme zu finden.
   483 
   484 \section{Beispiel f\"ur Termordnungen}
   485 Es ist nicht unbedeutend eine Verbindung $<$ zu Termen herzustellen, die wirklich eine Ordnung besitzen, wie eine \"ubergehende und antisymmetrische Verbindung. Diese Ordnungen sind selbstaufrufende Bahnordnungen.
   486 Hier ein Beispiel:
   487 
   488 {\footnotesize\begin{verbatim}
   489    > sqrt_right;
   490       val it = fn : bool -> Theory.theory -> subst -> Term.term * Term.term -> b       ool
   491    > tless_true;
   492       val it = fn : subst -> Term.term * Term.term -> bool
   493 \end{verbatim}
   494 
   495 Das bool Argument gibt Ihnen die M\"oglichkeit die Kontrolle zu den zugeh\"origen Unterordunungen zur\"uck zu verfolgen, damit sich die Unterordnungen, die 'true' sind als strings anzeigen lassen.
   496 
   497 
   498 \chapter{Methods}
   499 Methods werden dazu verwendet, Probleme von \texttt{type} zu l\"osen. Sie sind in einer anderen Programmiersprache beschrieben. Die Sprache sieht einfach aus, hat aber im Hintergrund einen enormen Pr\"ufauffwand. So muss sich der Programmierer nicht mit technischen Details befassen, gleichzeitig k\"onnen aber auch keine falschen Anweisungen eingegeben werden.
   500 
   501 \section{Der ''Syntax`` des Scriptes}
   502 Syntax beschreibt den Zusammenhang der einzelnen Zeichen und Zeichenfolgen mit den Theorien.
   503 Er kann so definiert werden:
   504 \begin{tabbing}
   505 123\=123\=expr ::=\=$|\;\;$\=\kill
   506 \>script ::= {\tt Script} id arg$\,^*$ = body\\
   507 \>\>arg ::= id $\;|\;\;($ ( id :: type ) $)$\\
   508 \>\>body ::= expr\\
   509 \>\>expr ::= \>\>{\tt let} id = expr $($ ; id = expr$)^*$ {\tt in} expr\\
   510 \>\>\>$|\;$\>{\tt if} prop {\tt then} expr {\tt else} expr\\
   511 \>\>\>$|\;$\>listexpr\\
   512 \>\>\>$|\;$\>id\\
   513 \>\>\>$|\;$\>seqex id\\
   514 \>\>seqex ::= \>\>{\tt While} prop {\tt Do} seqex\\
   515 \>\>\>$|\;$\>{\tt Repeat} seqex\\
   516 \>\>\>$|\;$\>{\tt Try} seqex\\
   517 \>\>\>$|\;$\>seqex {\tt Or} seqex\\
   518 \>\>\>$|\;$\>seqex {\tt @@} seqex\\
   519 \>\>\>$|\;$\>tac $($ id $|$ listexpr $)^*$\\
   520 \>\>type ::= id\\
   521 \>\>tac ::= id
   522 \end{tabbing}}
   523 
   524 
   525 
   526 \newpage
   527 ------------------------------- ALTER TEXT -------------------------------
   528 
   529 \chapter{The hierarchy of problem types}\label{pbt}
   530 \section{The standard-function for 'matching'}
   531 Matching \cite{nipk:rew-all-that} is a technique used within rewriting, and used by \isac{} also for (a generalized) 'matching' a problem with a problem type. The function which tests for matching has the following signature:
   532 {\footnotesize\begin{verbatim}
   533    ML> matches;
   534    val it = fn : theory -> term -> term -> bool
   535 \end{verbatim}}%size
   536 where the first of the two {\tt term} arguments is the particular term to be tested, and the second one is the pattern:
   537 {\footnotesize\begin{verbatim}
   538    ML> val t = (term_of o the o (parse thy)) "#3 * x^^^#2 = #1";
   539    val t = Const (#,#) $ (# $ # $ (# $ #)) $ Free ("#1","RealDef.real") : term
   540    ML>
   541    ML> val p = (term_of o the o (parse thy)) "a * b^^^#2 = c";
   542    val p = Const (#,#) $ (# $ # $ (# $ #)) $ Free ("c","RealDef.real") : term
   543    ML> atomt p;
   544    *** -------------
   545    *** Const ( op =)
   546    *** . Const ( op *)
   547    *** . . Free ( a, )
   548    *** . . Const ( RatArith.pow)
   549    *** . . . Free ( b, )
   550    *** . . . Free ( #2, )
   551    *** . Free ( c, )
   552    val it = () : unit
   553    ML>
   554    ML> free2var;
   555    val it = fn : term -> term
   556    ML>
   557    ML> val pat = free2var p;
   558    val pat = Const (#,#) $ (# $ # $ (# $ #)) $ Var ((#,#),"RealDef.real") : term
   559    ML> Sign.string_of_term (sign_of thy) pat;
   560    val it = "?a * ?b ^^^ #2 = ?c" : cterm' 
   561    ML> atomt pat;
   562    *** -------------
   563    *** Const ( op =)
   564    *** . Const ( op *)
   565    *** . . Var ((a, 0), )
   566    *** . . Const ( RatArith.pow)
   567    *** . . . Var ((b, 0), )
   568    *** . . . Free ( #2, )
   569    *** . Var ((c, 0), )
   570    val it = () : unit
   571 \end{verbatim}}%size % $ 
   572 Note that the pattern {\tt pat} contains so-called {\it scheme variables} decorated with a {\tt ?} (analoguous to theorems). The pattern is generated by the function {\tt free2var}. This format of the pattern is necessary in order to obtain results like these:
   573 {\footnotesize\begin{verbatim}
   574    ML> matches thy t pat;
   575    val it = true : bool
   576    ML>
   577    ML> val t2 = (term_of o the o (parse thy)) "x^^^#2 = #1";
   578    val t2 = Const (#,#) $ (# $ # $ Free #) $ Free ("#1","RealDef.real") : term
   579    ML> matches thy t2 pat;
   580    val it = false : bool    
   581    ML>
   582    ML> val pat2 = (term_of o the o (parse thy)) "?u^^^#2 = ?v";
   583    val pat2 = Const (#,#) $ (# $ # $ Free #) $ Var ((#,#),"RealDef.real") : term
   584    ML> matches thy t2 pat2;
   585    val it = true : bool 
   586 \end{verbatim}}%size % $
   587 
   588 \section{Accessing the hierarchy}
   589 The hierarchy of problem types is encapsulated; it can be accessed by the following functions. {\tt show\_ptyps} retrieves all leaves of the hierarchy (here in an early version for testing):
   590 {\footnotesize\begin{verbatim}
   591    ML> show_ptyps;
   592    val it = fn : unit -> unit
   593    ML> show_ptyps();
   594    [
   595     ["e_pblID"],
   596     ["equation", "univariate", "linear"],
   597     ["equation", "univariate", "plain_square"],
   598     ["equation", "univariate", "polynomial", "degree_two", "pq_formula"],
   599     ["equation", "univariate", "polynomial", "degree_two", "abc_formula"],
   600     ["equation", "univariate", "squareroot"],
   601     ["equation", "univariate", "normalize"],
   602     ["equation", "univariate", "sqroot-test"],
   603     ["function", "derivative_of"],
   604     ["function", "maximum_of", "on_interval"],
   605     ["function", "make"],
   606     ["tool", "find_values"],
   607     ["functional", "inssort"]
   608    ]
   609    val it = () : unit
   610 \end{verbatim}}%size
   611 The retrieve function for individual problem types is {\tt get\_pbt}
   612 \footnote{A function providing better readable output is in preparation}. Note that its argument, the 'problem identifier' {\tt pblID}, has the strings listed in reverse order w.r.t. the hierarchy, i.e. from the leave to the root. This order makes the {\tt pblID} closer to a natural description:
   613 {\footnotesize\begin{verbatim}
   614    ML> get_pbt;
   615    val it = fn : pblID -> pbt
   616    ML> get_pbt ["squareroot", "univariate", "equation"];
   617    val it =
   618      {met=[("SqRoot.thy","square_equation")],
   619       ppc=[("#Given",(Const (#,#),Free (#,#))),
   620            ("#Given",(Const (#,#),Free (#,#))),
   621            ("#Given",(Const (#,#),Free (#,#))),
   622            ("#Find",(Const (#,#),Free (#,#)))],
   623       thy={ProtoPure, CPure, HOL, Ord, Set, subset, equalities, mono, Vimage, Fun,
   624             Prod, Lfp, Relation, Trancl, WF, NatDef, Gfp, Sum, Inductive, Nat,
   625             Arith, Divides, Power, Finite, Equiv, IntDef, Int, Univ, Datatype,
   626             Numeral, Bin, IntArith, WF_Rel, Recdef, IntDiv, NatBin, List, Option,
   627             Map, Record, RelPow, Sexp, String, Calculation, SVC_Oracle, Main,
   628             Zorn, Filter, PNat, PRat, PReal, RealDef, RealOrd, RealInt, RealBin,
   629             HyperDef, Descript, ListG, Tools, Script, Typefix, Atools, RatArith,
   630             SqRoot},
   631       where_=[Const ("SqRoot.contains'_root","bool => bool") $
   632               Free ("e_","bool")]} : pbt
   633 \end{verbatim}}%size %$
   634 where the records fields hold the following data:
   635 \begin{description}
   636 \item [\tt thy]: the theory necessary for parsing the formulas
   637 \item [\tt ppc]: the items of the problem type, divided into those {\tt Given}, the precondition {\tt Where} and the output item(s) {\tt Find}. The items of {\tt Given} and {\tt Find} are all headed by so-called descriptions, which determine the type. These descriptions are defined in {\tt [isac-src]/Isa99/Descript.thy}.
   638 \item [\tt met]: the list of methods solving this problem type.\\
   639 \end{description}
   640 
   641 The following function adds or replaces a problem type (after having it prepared using {\tt prep\_pbt})
   642 {\footnotesize\begin{verbatim}
   643    ML> store_pbt;
   644    val it = fn : pbt * pblID -> unit
   645    ML> store_pbt
   646     (prep_pbt SqRoot.thy
   647     (["newtype","univariate","equation"],
   648      [("#Given" ,["equality e_","solveFor v_","errorBound err_"]),
   649       ("#Where" ,["contains_root (e_::bool)"]),
   650       ("#Find"  ,["solutions v_i_"])
   651      ],
   652      [("SqRoot.thy","square_equation")]));
   653    val it = () : unit
   654 \end{verbatim}}%size
   655 When adding a new type with argument {\tt pblID}, an immediate parent must already exist in the hierarchy (this is the one with the tail of {\tt pblID}).
   656 
   657 \section{Internals of the datastructure}
   658 This subsection only serves for the implementation of the hierarchy browser and can be skipped by the authors of math knowledge.
   659 
   660 A problem type is described by the following record type (in the file {\tt [isac-src]/globals.sml}, the respective functions are in {\tt [isac-src]/ME/ptyps.sml}), and held in a global reference variable:
   661 {\footnotesize\begin{verbatim}
   662    type pbt = 
   663         {thy   : theory,       (* the nearest to the root,
   664                                   which allows to compile that pbt  *)
   665          where_: term list,    (* where - predicates                *)
   666          ppc   : ((string *    (* fields "#Given","#Find"           *)
   667                    (term *     (* description                       *)
   668                     term))     (* id                                *)
   669                       list),                                        
   670          met   : metID list};  (* methods solving the pbt           *)
   671    datatype ptyp = 
   672             Ptyp of string *   (* key within pblID                  *)
   673                     pbt list * (* several pbts with different domIDs*)
   674                     ptyp list;
   675    val e_Ptyp = Ptyp ("empty",[],[]);
   676    
   677    type ptyps = ptyp list;
   678    val ptyps = ref ([e_Ptyp]:ptyps);
   679 \end{verbatim}}%size
   680 The predicates in {\tt where\_} (i.e. the preconditions) usually are defined in the respective theory in {\tt[isac-src]/knowledge}. Most of the predicates are not defined by rewriting, but by SML-code contained in the respective {\tt *.ML} file.
   681 
   682 Each item is headed by a so-called description which provides some guidance for interactive input. The descriptions are defined in {\tt[isac-src]/Isa99/Descript.thy}.
   683 
   684 
   685 
   686 \section{Match a formalization with a problem type}\label{pbl}
   687 A formalization is {\it match}ed with a problem type which yields a problem. A formal description of this kind of {\it match}ing can be found in \\{\tt ftp://ft.ist.tugraz.at/projects/isac/publ/calculemus01.ps.gz}. A formalization of an equation is e.g.
   688 {\footnotesize\begin{verbatim}
   689    ML> val fmz = ["equality (#1 + #2 * x = #0)",
   690                   "solveFor x",
   691                   "solutions L"] : fmz;
   692    val fmz = ["equality (#1 + #2 * x = #0)","solveFor x","solutions L"] : fmz
   693 \end{verbatim}}%size
   694 Given a formalization (and a specification of the problem, i.e. a theory, a problemtype, and a method) \isac{} can solve the respective problem automatically. The formalization must match the problem type for this purpose:
   695 {\footnotesize\begin{verbatim}
   696    ML> match_pbl;
   697    val it = fn : fmz -> pbt -> match'
   698    ML>
   699    ML> match_pbl fmz (get_pbt ["univariate","equation"]);
   700    val it =
   701      Matches'
   702        {Find=[Correct "solutions L"],
   703         Given=[Correct "equality (#1 + #2 * x = #0)",Correct "solveFor x"],
   704         Relate=[],Where=[Correct "matches (?a = ?b) (#1 + #2 * x = #0)"],With=[]}
   705      : match'
   706    ML>
   707    ML> match_pbl fmz (get_pbt ["linear","univariate","equation"]);
   708    val it =
   709      Matches'
   710        {Find=[Correct "solutions L"],
   711         Given=[Correct "equality (#1 + #2 * x = #0)",Correct "solveFor x"],
   712         Relate=[],
   713         Where=[Correct
   714                  "matches (          x = #0) (#1 + #2 * x = #0) |
   715                   matches (     ?b * x = #0) (#1 + #2 * x = #0) |
   716                   matches (?a      + x = #0) (#1 + #2 * x = #0) |
   717                   matches (?a + ?b * x = #0) (#1 + #2 * x = #0)"],
   718         With=[]} : match'
   719    ML>
   720    ML> match_pbl fmz (get_pbt ["squareroot","univariate","equation"]);
   721    val it =
   722      NoMatch'
   723        {Find=[Correct "solutions L"],
   724         Given=[Correct "equality (#1 + #2 * x = #0)",Correct "solveFor x",
   725                Missing "errorBound err_"],Relate=[],
   726         Where=[False "contains_root #1 + #2 * x = #0 "],With=[]} : match'
   727 \end{verbatim}}%size
   728 The above formalization does not match the problem type \\{\tt["squareroot","univariate","equation"]} which is explained by the tags:
   729 \begin{tabbing}
   730 123\=\kill
   731 \> {\tt Missing:} the item is missing in the formalization as required by the problem type\\
   732 \> {\tt Superfl:} the item is not required by the problem type\\
   733 \> {\tt Correct:} the item is correct, or the precondition ({\tt Where}) is true\\
   734 \> {\tt False:} the precondition ({\tt Where}) is false\\
   735 \> {\tt Incompl:} the item is incomlete, or not yet input.\\
   736 \end{tabbing}
   737 
   738 
   739 
   740 \section{Refine a problem specification}
   741 The challenge in constructing the problem hierarchy is, to design the branches in such a way, that problem refinement can be done automatically (as it is done in algebra system e.g. by a internal hierarchy of equations).
   742 
   743 For this purpose the hierarchy must be built using the following rules: Let $F$ be a formalization and $P$ and $P_i,\:i=1\cdots n$ problem types, where the $P_i$ are specialized problem types w.r.t. $P$ (i.e. $P$ is a parent node of $P_i$), then
   744 {\small
   745 \begin{enumerate}
   746 \item for all $F$ matching some $P_i$ must follow, that $F$ matches $P$
   747 \item an $F$ matching $P$ should not have more than {\em one} $P_i,\:i=1\cdots n-1$ with $F$ matching $P_i$ (if there are more than one $P_i$, the first one will be taken)
   748 \item for all $F$ matching some $P$ must follow, that $F$ matches $P_n$\\
   749 \end{enumerate}}%small
   750 \noindent Let us give an example for the point (1.) and (2.) first:
   751 {\footnotesize\begin{verbatim}
   752    ML> refine;
   753    val it = fn : fmz -> pblID -> match list
   754    ML>
   755    ML> val fmz = ["equality (sqrt(#9+#4*x)=sqrt x + sqrt(#5+x))",
   756               "solveFor x","errorBound (eps=#0)",
   757               "solutions L"];
   758    ML>
   759    ML> refine fmz ["univariate","equation"];
   760    *** pass ["equation","univariate"]
   761    *** pass ["equation","univariate","linear"]
   762    *** pass ["equation","univariate","plain_square"]
   763    *** pass ["equation","univariate","polynomial"]
   764    *** pass ["equation","univariate","squareroot"]
   765    val it =
   766      [Matches
   767         (["univariate","equation"],
   768          {Find=[Correct "solutions L"],
   769           Given=[Correct "equality (sqrt (#9 + #4 * x) = sqrt x + sqrt (#5 + x))",
   770                  Correct "solveFor x",Superfl "errorBound (eps = #0)"],Relate=[],
   771           Where=[Correct
   772                    "matches (?a = ?b) (sqrt (#9 + #4 * x) = sqrt x + sqrt (#5 + x))"],
   773           With=[]}),
   774       NoMatch
   775         (["linear","univariate","equation"],
   776          {Find=[Correct "solutions L"],
   777           Given=[Correct "equality (sqrt (#9 + #4 * x) = sqrt x + sqrt (#5 + x))",
   778                  Correct "solveFor x",Superfl "errorBound (eps = #0)"],Relate=[],
   779           Where=[False "(?a + ?b * x = #0) (sqrt (#9 + #4 * x#"],
   780           With=[]}),
   781       NoMatch
   782         (["plain_square","univariate","equation"],
   783          {Find=[Correct "solutions L"],
   784           Given=[Correct "equality (sqrt (#9 + #4 * x) = sqrt x + sqrt (#5 + x))",
   785                  Correct "solveFor x",Superfl "errorBound (eps = #0)"],Relate=[],
   786           Where=[False
   787                    "matches (?a + ?b * x ^^^ #2 = #0)"],
   788           With=[]}),
   789       NoMatch
   790         (["polynomial","univariate","equation"],
   791          {Find=[Correct "solutions L"],
   792           Given=[Correct "equality (sqrt (#9 + #4 * x) = sqrt x + sqrt (#5 + x))",
   793                  Correct "solveFor x",Superfl "errorBound (eps = #0)"],Relate=[],
   794           Where=[False 
   795                  "is_polynomial_in sqrt (#9 + #4 * x) = sqrt x + sqrt (#5 + x) x"],
   796           With=[]}),
   797       Matches
   798         (["squareroot","univariate","equation"],
   799          {Find=[Correct "solutions L"],
   800           Given=[Correct "equality (sqrt (#9 + #4 * x) = sqrt x + sqrt (#5 + x))",
   801                  Correct "solveFor x",Correct "errorBound (eps = #0)"],Relate=[],
   802           Where=[Correct
   803                    "contains_root sqrt (#9 + #4 * x) = sqrt x + sqrt (#5 + x) "],
   804           With=[]})] : match list
   805 \end{verbatim}}%size}%footnotesize\label{refine}
   806 This example shows, that in order to refine an {\tt["univariate","equation"]}, the formalization must match respective respective problem type (rule (1.)) and one of the descendants which should match selectively (rule (2.)).
   807 
   808 If no one of the descendants of {\tt["univariate","equation"]} match, rule (3.) comes into play: The {\em last} problem type on this level ($P_n$) provides for a special 'problem type' {\tt["normalize"]}. This node calls a method transforming the equation to a (or another) normal form, which then may match. Look at this example:
   809 {\footnotesize\begin{verbatim}
   810    ML>  val fmz = ["equality (x+#1=#2)",
   811                "solveFor x","errorBound (eps=#0)",
   812                "solutions L"];
   813    [...]
   814    ML>
   815    ML>  refine fmz ["univariate","equation"];
   816    *** pass ["equation","univariate"]
   817    *** pass ["equation","univariate","linear"]
   818    *** pass ["equation","univariate","plain_square"]
   819    *** pass ["equation","univariate","polynomial"]
   820    *** pass ["equation","univariate","squareroot"]
   821    *** pass ["equation","univariate","normalize"]
   822    val it =
   823      [Matches
   824         (["univariate","equation"],
   825          {Find=[Correct "solutions L"],
   826           Given=[Correct "equality (x + #1 = #2)",Correct "solveFor x",
   827                  Superfl "errorBound (eps = #0)"],Relate=[],
   828           Where=[Correct "matches (?a = ?b) (x + #1 = #2)"],With=[]}),
   829       NoMatch
   830         (["linear","univariate","equation"],
   831    [...]
   832           With=[]}),
   833       NoMatch
   834         (["squareroot","univariate","equation"],
   835          {Find=[Correct "solutions L"],
   836           Given=[Correct "equality (x + #1 = #2)",Correct "solveFor x",
   837                  Correct "errorBound (eps = #0)"],Relate=[],
   838           Where=[False "contains_root x + #1 = #2 "],With=[]}),
   839       Matches
   840         (["normalize","univariate","equation"],
   841          {Find=[Correct "solutions L"],
   842           Given=[Correct "equality (x + #1 = #2)",Correct "solveFor x",
   843                  Superfl "errorBound (eps = #0)"],Relate=[],Where=[],With=[]})]
   844      : match list
   845 \end{verbatim}}%size
   846 The problem type $P_n$, {\tt["normalize","univariate","equation"]}, will transform the equation {\tt x + \#1 = \#2} to the normal form {\tt \#-1 + x = \#0}, which then will match {\tt["linear","univariate","equation"]}.
   847 
   848 This recursive search on the problem hierarchy can be  done within a proof state. This leads to the next section.
   849 
   850 
   851 \chapter{Methods}\label{met}
   852 A problem type can have one ore more methods solving a respective problem. A method is described by means of another new program language. The language itself looks like a simple functional language, but constructs an imperative proof-state behind the scenes (thus liberating the programer from dealing with technical details and also prohibiting incorrect construction of the proof tree). The interpreter of 'scripts' written in this language evaluates the scriptexpressions, and also delivers certain parts of the script itself for discussion with the user.
   853 
   854 \section{The scripts' syntax}
   855 The syntax of scripts follows the definition given in Backus-normal-form:
   856 {\it
   857 \begin{tabbing}
   858 123\=123\=expr ::=\=$|\;\;$\=\kill
   859 \>script ::= {\tt Script} id arg$\,^*$ = body\\
   860 \>\>arg ::= id $\;|\;\;($ ( id :: type ) $)$\\
   861 \>\>body ::= expr\\
   862 \>\>expr ::= \>\>{\tt let} id = expr $($ ; id = expr$)^*$ {\tt in} expr\\
   863 \>\>\>$|\;$\>{\tt if} prop {\tt then} expr {\tt else} expr\\
   864 \>\>\>$|\;$\>listexpr\\
   865 \>\>\>$|\;$\>id\\
   866 \>\>\>$|\;$\>seqex id\\
   867 \>\>seqex ::= \>\>{\tt While} prop {\tt Do} seqex\\
   868 \>\>\>$|\;$\>{\tt Repeat} seqex\\
   869 \>\>\>$|\;$\>{\tt Try} seqex\\
   870 \>\>\>$|\;$\>seqex {\tt Or} seqex\\
   871 \>\>\>$|\;$\>seqex {\tt @@} seqex\\
   872 \>\>\>$|\;$\>tac $($ id $|$ listexpr $)^*$\\
   873 \>\>type ::= id\\
   874 \>\>tac ::= id
   875 \end{tabbing}}
   876 where {\it id} is an identifier with the usual syntax, {\it prop} is a proposition constructed by Isabelles logical operators (see \cite{Isa-obj} {\tt [isabelle]/src/HOL/HOL.thy}), {\it listexpr} (called {\bf list-expression}) is constructed by Isabelles list functions like {\tt hd, tl, nth} described in {\tt [isabelle]/src/HOL/List.thy}, and {\it type} are (virtually) all types declared in Isabelles version 99.
   877 
   878 Expressions containing some of the keywords {\tt let}, {\tt if} etc. are called {\bf script-expressions}.
   879 
   880 Tactics {\it tac} are (curried) functions. For clarity and simplicity reasons, {\it listexpr} must not contain a {\it tac}, and {\it tac}s must not be nested,
   881 
   882 
   883 \section{Control the flow of evaluation}
   884 The flow of control is managed by the following script-expressions called {\it tacticals}.
   885 \begin{description}
   886 \item{{\tt while} prop {\tt Do} expr id} 
   887 \item{{\tt if} prop {\tt then} expr {\tt else} expr}
   888 \end{description}
   889 While the the above script-expressions trigger the flow of control by evaluating the current formula, the other expressions depend on the applicability of the tactics within their respective subexpressions (which in turn depends on the proofstate)
   890 \begin{description}
   891 \item{{\tt Repeat} expr id}
   892 \item{{\tt Try} expr id}
   893 \item{expr {\tt Or} expr id}
   894 \item{expr {\tt @@} expr id}
   895 \end{description}
   896 
   897 \begin{description}
   898 \item xxx
   899 
   900 \end{description}
   901 
   902 \chapter{Do a calculational proof}
   903 First we list all the tactics available so far (this list may be extended during further development of \isac).
   904 
   905 \section{Tactics for doing steps in calculations}
   906 \input{tactics}
   907 
   908 \section{The functionality of the math engine}
   909 A proof is being started in the math engine {\tt me} by the tactic
   910 \footnote{In the present version a tactic is of type {\tt mstep}.}
   911  {\tt Init\_Proof}, and interactively promoted by other tactics. On input of each tactic the {\tt me} returns the resulting formula and the next tactic applicable. The proof is finished, when the {\tt me} proposes {\tt End\_Proof} as the next tactic.
   912 
   913 We show a calculation (calculational proof) concerning equation solving, where the type of equation is refined automatically: The equation is given by the respective formalization ...
   914 {\footnotesize\begin{verbatim}
   915    ML> val fmz = ["equality ((x+#1)*(x+#2)=x^^^#2+#8)","solveFor x",
   916                   "errorBound (eps=#0)","solutions L"];
   917    val fmz =
   918      ["equality ((x+#1)*(x+#2)=x^^^#2+#8)","solveFor x","errorBound (eps=#0)",
   919       "solutions L"] : string list
   920    ML>
   921    ML> val spec as (dom, pbt, met) = ("SqRoot.thy",["univariate","equation"],
   922                                  ("SqRoot.thy","no_met"));
   923    val dom = "SqRoot.thy" : string
   924    val pbt = ["univariate","equation"] : string list
   925    val met = ("SqRoot.thy","no_met") : string * string
   926 \end{verbatim}}%size
   927 ... and the specification {\tt spec} of a domain {\tt dom}, a problem type {\tt pbt} and a method {\tt met}. Note that the equation is such, that it is not immediatly clear, what type it is in particular (it could be a polynomial of degree 2; but, for sure, the type is some specialized type of a univariate equation). Thus, no method ({\tt no\_met}) can be specified for solving the problem.
   928 
   929 Nevertheless this specification is sufficient for automatically solving the equation --- the appropriate method will be found by refinement within the hierarchy of problem types.
   930 
   931 
   932 \section{Initialize the calculation}
   933 The start of a new proof requires the following initializations: The proof state is given by a proof tree {\tt ptree} and a position {\tt pos'}; both are empty at the beginning. The tactic {\tt Init\_Proof} is, like all other tactics, paired with an identifier of type {\tt string} for technical reasons.
   934 {\footnotesize\begin{verbatim}
   935    ML>  val (mID,m) = ("Init_Proof",Init_Proof (fmz, (dom,pbt,met)));
   936    val mID = "Init_Proof" : string
   937    val m =
   938      Init_Proof
   939        (["equality ((x+#1)*(x+#2)=x^^^#2+#8)","solveFor x","errorBound (eps=#0)",
   940          "solutions L"],("SqRoot.thy",[#,#],(#,#))) : mstep
   941    ML>
   942    ML>  val (p,_,f,nxt,_,pt) = me (mID,m) e_pos' c EmptyPtree;
   943    val p = ([],Pbl) : pos'
   944    val f = Form' (PpcKF (0,EdUndef,0,Nundef,(#,#))) : mout
   945    val nxt = ("Refine_Tacitly",Refine_Tacitly ["univariate","equation"])
   946      : string * mstep
   947    val pt =
   948      Nd
   949        (PblObj
   950           {branch=#,cell=#,env=#,loc=#,meth=#,model=#,origin=#,ostate=#,probl=#,
   951            result=#,spec=#},[]) : ptree
   952    \end{verbatim}}%size
   953 The mathematics engine {\tt me} returns the resulting formula {\tt f} of type {\tt mout} (which in this case is a problem), the next tactic {\tt nxt}, and a new proof state ({\tt ptree}, {\tt pos'}).
   954 
   955 We can convince ourselves, that the problem is still empty, by increasing {\tt Compiler.Control.Print.printDepth}:
   956 {\footnotesize\begin{verbatim}
   957    ML> Compiler.Control.Print.printDepth:=8; (*4 default*)
   958    val it = () : unit
   959    ML>
   960    ML> f;
   961    val it =
   962      Form'
   963        (PpcKF
   964           (0,EdUndef,0,Nundef,
   965            (Problem [],
   966             {Find=[Incompl "solutions []"],
   967              Given=[Incompl "equality",Incompl "solveFor"],Relate=[],
   968              Where=[False "matches (?a = ?b) e_"],With=[]}))) : mout
   969 \end{verbatim}}%size
   970 Recall, please, the format of a problem as presented in sect.\ref{pbl} on p.\pageref{pbl}; such an 'empty' problem can be found above encapsulated by several constructors containing additional data (necessary for the dialog guide, not relevant here).\\
   971 
   972 {\it In the sequel we will omit output of the {\tt me} if it is not important for the respective context}.\\
   973 
   974 In general, the dialog guide will hide the following two tactics {\tt Refine\_Tacitly} and {\tt Model\_Problem} from the user.
   975 {\footnotesize\begin{verbatim}
   976    ML>  nxt;
   977    val it = ("Refine_Tacitly",Refine_Tacitly ["univariate","equation"])
   978      : string * mstep
   979    ML>
   980    ML>  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   981    val nxt = ("Model_Problem",Model_Problem ["normalize","univariate","equation"])
   982      : string * mstep
   983    ML>
   984    ML>  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   985 \end{verbatim}}%size
   986 
   987 
   988 \section{The phase of modeling} 
   989 comprises the input of the items of the problem; the {\tt me} can help by use of the formalization tacitly transferred by {\tt Init\_Proof}. In particular, the {\tt me} in general 'knows' the next promising tactic; the first one has been returned by the (hidden) tactic {\tt Model\_Problem}.
   990 
   991 {\footnotesize\begin{verbatim}
   992    ML>  nxt;
   993    val it =
   994      ("Add_Given",Add_Given "equality ((x + #1) * (x + #2) = x ^^^ #2 + #8)")
   995      : string * mstep
   996    ML>
   997    ML>  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
   998    val nxt = ("Add_Given",Add_Given "solveFor x") : string * mstep
   999    ML>
  1000    ML>  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  1001    val nxt = ("Add_Find",Add_Find "solutions L") : string * mstep
  1002    ML>
  1003    ML>  val (p,_,f,nxt,_,pt) = me nxt p [1] pt; 
  1004    val f = Form' (PpcKF (0,EdUndef,0,Nundef,(#,#))) : mout
  1005 \end{verbatim}}%size
  1006 \noindent Now the problem is 'modeled', all items are input. We convince ourselves by increasing {\tt Compiler.Control.Print.printDepth} once more.
  1007 {\footnotesize\begin{verbatim}
  1008    ML>  Compiler.Control.Print.printDepth:=8;
  1009    ML>  f;
  1010    val it =
  1011      Form'
  1012        (PpcKF
  1013           (0,EdUndef,0,Nundef,
  1014            (Problem [],
  1015             {Find=[Correct "solutions L"],
  1016              Given=[Correct "equality ((x + #1) * (x + #2) = x ^^^ #2 + #8)",
  1017                     Correct "solveFor x"],Relate=[],Where=[],With=[]}))) : mout
  1018 \end{verbatim}}%size
  1019 %One of the input items is considered {\tt Superfluous} by the {\tt me} consulting the problem type {\tt ["univariate","equation"]}. The {\tt ErrorBound}, however, could become important in case the equation only could be solved by some iteration method.
  1020 
  1021 \section{The phase of specification} 
  1022 This phase provides for explicit determination of the domain, the problem type, and the method to be used. In particular, the search for the appropriate problem type is being supported. There are two tactics for this purpose: {\tt Specify\_Problem} generates feedback on how a candidate of a problem type matches the current problem, and {\tt Refine\_Problem} provides help by the system, if the user gets lost.
  1023 {\footnotesize\begin{verbatim}
  1024 ML> nxt;
  1025    val it = ("Specify_Domain",Specify_Domain "SqRoot.thy") : string * mstep
  1026    ML>
  1027    ML> val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  1028    val nxt =
  1029      ("Specify_Problem",Specify_Problem ["normalize","univariate","equation"])
  1030      : string * mstep
  1031    val pt =
  1032      Nd
  1033        (PblObj
  1034           {branch=#,cell=#,env=#,loc=#,meth=#,model=#,origin=#,ostate=#,probl=#,
  1035               result=#,spec=#},[]) : ptree
  1036 \end{verbatim}}%size
  1037 The {\tt me} is smart enough to know the appropriate problem type (transferred tacitly with {\tt Init\_Proof}). In order to challenge the student, the dialog guide may hide this information; then the {\tt me} works as follows.
  1038 {\footnotesize\begin{verbatim}
  1039    ML> val nxt = ("Specify_Problem",
  1040                Specify_Problem ["polynomial","univariate","equation"]);
  1041    ML> val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  1042    val f = Form' (PpcKF (0,EdUndef,0,Nundef,(#,#))) : mout
  1043    val nxt =
  1044      ("Refine_Problem",Refine_Problem ["normalize","univariate","equation"])
  1045      : string * mstep
  1046    ML>
  1047    ML> val nxt = ("Specify_Problem",
  1048                Specify_Problem ["linear","univariate","equation"]);
  1049    ML> val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  1050    val f =
  1051      Form'
  1052        (PpcKF
  1053           (0,EdUndef,0,Nundef,
  1054            (Problem ["linear","univariate","equation"],
  1055             {Find=[Correct "solutions L"],
  1056              Given=[Correct "equality ((x + #1) * (x + #2) = x ^^^ #2 + #8)",
  1057                     Correct "solveFor x"],Relate=[],
  1058              Where=[False
  1059                     "matches (?a + ?b * x = #0) ((x + #1) * (x + #2) = x ^^^ #2 + #8)"],
  1060              With=[]}))) : mout 
  1061 \end{verbatim}}%size
  1062 Again assuming that the dialog guide hide the next tactic proposed by the {\tt me}, and the student gets lost, {\tt Refine\_Problem} always 'knows' the way out, if applied to the problem type {\tt["univariate","equation"]}.
  1063 {\footnotesize\begin{verbatim}
  1064    ML> val nxt = ("Refine_Problem",
  1065                   Refine_Problem ["linear","univariate","equation
  1066    ML> val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  1067    val f = Problems (RefinedKF [NoMatch #]) : mout
  1068    ML>
  1069    ML>  Compiler.Control.Print.printDepth:=9;f;Compiler.Control.Print.printDepth:=4;
  1070    val f =
  1071      Problems
  1072        (RefinedKF
  1073           [NoMatch
  1074              (["linear","univariate","equation"],
  1075               {Find=[Correct "solutions L"],
  1076                Given=[Correct "equality ((x + #1) * (x + #2) = x ^^^ #2 + #8)",
  1077                       Correct "solveFor x"],Relate=[],
  1078                Where=[False
  1079                      "matches (?a + ?b * x = #0) ((x + #1) * (x + #2) = x ^^^ #2 + #8)"],
  1080                With=[]})]) : mout
  1081    ML>
  1082    ML> val nxt = ("Refine_Problem",Refine_Problem ["univariate","equation"]);
  1083    ML> val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  1084    val f =
  1085      Problems
  1086        (RefinedKF [Matches #,NoMatch #,NoMatch #,NoMatch #,NoMatch #,Matches #])
  1087      : mout
  1088    ML>
  1089    ML>
  1090    ML>  Compiler.Control.Print.printDepth:=9;f;Compiler.Control.Print.printDepth:=4;
  1091    val f =
  1092      Problems
  1093        (RefinedKF
  1094           [Matches
  1095              (["univariate","equation"],
  1096               {Find=[Correct "solutions L"],
  1097                Given=[Correct "equality ((x + #1) * (x + #2) = x ^^^ #2 + #8)",
  1098                       Correct "solveFor x"],Relate=[],
  1099                Where=[Correct
  1100                With=[]}),
  1101            NoMatch
  1102              (["linear","univariate","equation"],
  1103               {Find=[Correct "solutions L"],
  1104                Given=[Correct "equality ((x + #1) * (x + #2) = x ^^^ #2 + #8)",
  1105                       Correct "solveFor x"],Relate=[],
  1106                Where=[False
  1107                       "matches (?a + ?b * x = #0) ((x + #1) * (x + #2) = x ^^^ #2 + #8)"],
  1108                   With=[]}),
  1109            NoMatch
  1110              ...
  1111              ...   
  1112            Matches
  1113              (["normalize","univariate","equation"],
  1114               {Find=[Correct "solutions L"],
  1115                Given=[Correct "equality ((x + #1) * (x + #2) = x ^^^ #2 + #8)",
  1116                       Correct "solveFor x"],Relate=[],Where=[],With=[]})]) : mout
  1117 \end{verbatim}}%size
  1118 The tactic {\tt Refine\_Problem} returns all matches to problem types along the path traced in the problem hierarchy (anlogously to the authoring tool for refinement in sect.\ref{refine} on p.\pageref{refine}) --- a lot of information to be displayed appropriately in the hiearchy browser~!
  1119 
  1120 \section{The phase of solving} 
  1121 This phase starts by invoking a method, which acchieves the normal form within two tactics, {\tt Rewrite rnorm\_equation\_add} and {\tt Rewrite\_Set SqRoot\_simplify}:
  1122 {\footnotesize\begin{verbatim} 
  1123    ML> nxt;
  1124    val it = ("Apply_Method",Apply_Method ("SqRoot.thy","norm_univar_equation"))
  1125      : string * mstep
  1126    ML>
  1127    ML> val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  1128    val f =
  1129      Form' (FormKF (~1,EdUndef,1,Nundef,"(x + #1) * (x + #2) = x ^^^ #2 + #8"))
  1130    val nxt =
  1131      ("Rewrite", Rewrite
  1132         ("rnorm_equation_add","~ ?b =!= #0 ==> (?a = ?b) = (?a + #-1 * ?b = #0)"))
  1133    ML>
  1134    ML>  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  1135    val f =
  1136      Form' (FormKF (~1,EdUndef,1,Nundef,
  1137            "(x + #1) * (x + #2) + #-1 * (x ^^^ #2 + #8) = #0")) : mout
  1138    val nxt = ("Rewrite_Set",Rewrite_Set "SqRoot_simplify") : string * mstep
  1139    ML>
  1140    ML>  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  1141    val f = Form' (FormKF (~1,EdUndef,1,Nundef,"#-6 + #3 * x = #0")) : mout
  1142    val nxt = ("Subproblem",Subproblem ("SqRoot.thy",[#,#])) : string * mstep
  1143 \end{verbatim}}%size
  1144 Now the normal form {\tt \#-6 + \#3 * x = \#0} is the input to a subproblem, which again allows for specification of the type of equation, and the respective method:
  1145 {\footnotesize\begin{verbatim}
  1146    ML> nxt;
  1147    val it = ("Subproblem",Subproblem ("SqRoot.thy",["univariate","equation"]))
  1148    ML>   
  1149    ML> val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  1150    val f =
  1151      Form' (FormKF
  1152           (~1,EdUndef,1,Nundef,"Subproblem (SqRoot.thy, [univariate, equation])"))
  1153      : mout
  1154    val nxt = ("Refine_Tacitly",Refine_Tacitly ["univariate","equation"])
  1155    ML>
  1156    ML> val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  1157    val nxt = ("Model_Problem",Model_Problem ["linear","univariate","equation"])
  1158 \end{verbatim}}%size
  1159 As required, the tactic {\tt Refine ["univariate","equation"]} selects the appropriate type of equation from the problem hierarchy, which can be seen by the tactic {\tt Model\_Problem ["linear","univariate","equation"]} prosed by the system.
  1160 
  1161 Again the whole phase of modeling and specification follows; we skip it here, and \isac's dialog guide may decide to do so as well.
  1162 
  1163 
  1164 \section{The final phase: check the post-condition}
  1165 The type of problems solved by \isac{} are so-called 'example construction problems' as shown above. The most characteristic point of such a problem is the post-condition. The handling of the post-condition in the given context is an open research question.
  1166 
  1167 Thus the post-condition is just mentioned, in our example for both, the problem and the subproblem:
  1168 {\footnotesize\begin{verbatim}
  1169    ML> nxt;
  1170    val it = ("Check_Postcond",Check_Postcond ["linear","univariate","equation"])
  1171    ML>
  1172    ML>  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  1173    val f = Form' (FormKF (~1,EdUndef,1,Nundef,"[x = #2]")) : mout
  1174    val nxt =
  1175      ("Check_Postcond",Check_Postcond ["normalize","univariate","equation"])
  1176    ML>
  1177    ML>  val (p,_,f,nxt,_,pt) = me nxt p [1] pt;
  1178    val f = Form' (FormKF (~1,EdUndef,0,Nundef,"[x = #2]")) : mout
  1179    val nxt = ("End_Proof'",End_Proof') : string * mstep
  1180 \end{verbatim}}%size
  1181 The next tactic proposed by the system, {\tt End\_Proof'} indicates that the proof has finished successfully.\\
  1182 
  1183 {\it The tactics proposed by the system need {\em not} be followed by the user; the user is free to choose other tactics, and the system will report, if this is applicable at the respective proof state, or not~! The reader may try out~!}
  1184 
  1185 
  1186 
  1187 \part{Systematic description}
  1188 
  1189 
  1190 \chapter{The structure of the knowledge base}
  1191 
  1192 \section{Tactics and data}
  1193 First we view the ME from outside, i.e. we regard tactics and relate them to the knowledge base (KB). W.r.t. the KB we address the atomic items which have to be implemented in detail by the authors of the KB
  1194 \footnote{Some of these items are fetched by the tactics from intermediate storage within the ME, and not directly from the KB.}
  1195 . The items are listed in alphabetical order in Tab.\ref{kb-items} on p.\pageref{kb-items}.
  1196 {\begin{table}[h]
  1197 \caption{Atomic items of the KB} \label{kb-items}
  1198 %\tabcolsep=0.3mm
  1199 \begin{center}
  1200 \def\arraystretch{1.0}
  1201 \begin{tabular}{lp{9.0cm}}
  1202 abbrevation & description \\
  1203 \hline
  1204 &\\
  1205 {\it calc\_list}
  1206 & associationlist of the evaluation-functions {\it eval\_fn}\\
  1207 {\it eval\_fn}
  1208 & evaluation-function for numerals and for predicates coded in SML\\
  1209 {\it eval\_rls   }
  1210 & ruleset {\it rls} for simplifying expressions with {\it eval\_fn}s\\
  1211 {\it fmz}
  1212 & formalization, i.e. a minimal formula representation of an example \\
  1213 {\it met}
  1214 & a method, i.e. a datastructure holding all informations for the solving phase ({\it rew\_ord}, {\it scr}, etc.)\\
  1215 {\it metID}
  1216 & reference to a {\it met}\\
  1217 {\it op}
  1218 & operator as key to an {\it eval\_fn} in a {\it calc\_list}\\
  1219 {\it pbl}
  1220 & problem, i.e. a node in the problem-hierarchy\\
  1221 {\it pblID}
  1222 & reference to a {\it pbl}\\
  1223 {\it rew\_ord}
  1224 & rewrite-order\\
  1225 {\it rls}
  1226 & ruleset, i.e. a datastructure holding theorems {\it thm} and operators {\it op} for simplification (with a {\it rew\_ord})\\
  1227 {\it Rrls}
  1228 & ruleset for 'reverse rewriting' (an \isac-technique generating stepwise rewriting, e.g. for cancelling fractions)\\
  1229 {\it scr}
  1230 & script describing algorithms by tactics, part of a {\it met} \\
  1231 {\it norm\_rls}
  1232 & special ruleset calculating a normalform, associated with a {\it thy}\\
  1233 {\it spec}
  1234 & specification, i.e. a tripel ({\it thyID, pblID, metID})\\
  1235 {\it subs}
  1236 & substitution, i.e. a list of variable-value-pairs\\
  1237 {\it term}
  1238 & Isabelle term, i.e. a formula\\
  1239 {\it thm}
  1240 & theorem\\     
  1241 {\it thy}
  1242 & theory\\
  1243 {\it thyID}
  1244 & reference to a {\it thy} \\
  1245 \end{tabular}\end{center}\end{table}
  1246 }
  1247 The relations between tactics and data items are shown in Tab.\ref{tac-kb}on p.\pageref{tac-kb}.
  1248 {\def\arraystretch{1.2}
  1249 \begin{table}[h]
  1250 \caption{Which tactic uses which KB's item~?} \label{tac-kb}
  1251 \tabcolsep=0.3mm
  1252 \begin{center}
  1253 \begin{tabular}{|ll||cccc|ccc|cccc|} \hline
  1254 tactic  &input &    &    &    &norm\_&   &rew\_&rls &eval\_&eval\_&calc\_&   \\
  1255         &      &thy &scr &Rrls&rls  &thm &ord  &Rrls&fn    &rls   &list  &dsc\\
  1256 \hline\hline
  1257 Init\_Proof
  1258         &fmz   & x  &    &    & x   &    &     &    &      &      &      & x \\
  1259         &spec  &    &    &    &     &    &     &    &      &      &      &   \\
  1260 \hline
  1261 \multicolumn{13}{|l|}{model phase}\\
  1262 \hline
  1263 Add\_*  &term  & x  &    &    & x   &    &     &    &      &      &      & x \\
  1264 FormFK  &model & x  &    &    & x   &    &     &    &      &      &      & x \\
  1265 \hline
  1266 \multicolumn{13}{|l|}{specify phase}\\
  1267 \hline
  1268 Specify\_Theory 
  1269         &thyID & x  &    &    & x   &    &     &    & x    & x    &      & x \\
  1270 Specify\_Problem 
  1271         &pblID & x  &    &    & x   &    &     &    & x    & x    &      & x \\
  1272 Refine\_Problem 
  1273            &pblID & x  &    &    & x   &    &     &    & x    & x    &      & x \\
  1274 Specify\_Method 
  1275         &metID & x  &    &    & x   &    &     &    & x    & x    &      & x \\
  1276 Apply\_Method 
  1277         &metID & x  & x  &    & x   &    &     &    & x    & x    &      & x \\
  1278 \hline
  1279 \multicolumn{13}{|l|}{solve phase}\\
  1280 \hline
  1281 Rewrite,\_Inst 
  1282         &thm   & x  & x  &    &     & x  &met  &    & x    &met   &      &   \\
  1283 Rewrite, Detail
  1284         &thm   & x  & x  &    &     & x  &rls  &    & x    &rls   &      &   \\
  1285 Rewrite, Detail
  1286         &thm   & x  & x  &    &     & x  &Rrls &    & x    &Rrls  &      &   \\
  1287 Rewrite\_Set,\_Inst
  1288         &rls   & x  & x  &    &     &    &     & x  & x    & x    &      &   \\
  1289 Calculate  
  1290         &op    & x  & x  &    &     &    &     &    &      &      & x    &   \\
  1291 Substitute 
  1292         &subs  & x  &    &    & x   &    &     &    &      &      &      &   \\
  1293         &      &    &    &    &     &    &     &    &      &      &      &   \\
  1294 SubProblem 
  1295         &spec  & x  & x  &    & x   &    &     &    & x    & x    &      & x \\
  1296         &fmz   &    &    &    &     &    &     &    &      &      &      &   \\
  1297 \hline
  1298 \end{tabular}\end{center}\end{table}
  1299 }
  1300 
  1301 \section{\isac's theories}
  1302 \isac's theories build upon Isabelles theories for high-order-logic (HOL) up to the respective development of real numbers ({\tt HOL/Real}). Theories have a special format defined in \cite{Isa-ref} and the suffix {\tt *.thy}; usually theories are paired with SML-files having the same filename and the suffix {\tt *.ML}.
  1303 
  1304 \isac's theories represent the deductive part of \isac's knowledge base, the hierarchy of theories is structured accordingly. The {\tt *.ML}-files, however, contain {\em all} data of the other two axes of the knowledge base, the problems and the methods (without presenting their respective structure, which is done by the problem browser and the method browser, see \ref{pbt}).
  1305 
  1306 Tab.\ref{theories} on p.\pageref{theories} lists the basic theories planned to be implemented in version \isac.1. We expext the list to be expanded in the near future, actually, have a look to the theory browser~!
  1307 
  1308 The first three theories in the list do {\em not} belong to \isac's knowledge base; they are concerned with \isac's script-language for methods and listed here for completeness.
  1309 {\begin{table}[h]
  1310 \caption{Theories in \isac-version I} \label{theories}
  1311 %\tabcolsep=0.3mm
  1312 \begin{center}
  1313 \def\arraystretch{1.0}
  1314 \begin{tabular}{lp{9.0cm}}
  1315 theory & description \\
  1316 \hline
  1317 &\\
  1318 ListI.thy
  1319 & assigns identifiers to the functions defined in {\tt Isabelle2002/src/HOL/List.thy} and (intermediatly~?) defines some more list functions\\
  1320 ListI.ML
  1321 & {\tt eval\_fn} for the additional list functions\\
  1322 Tools.thy
  1323 & functions required for the evaluation of scripts\\
  1324 Tools.ML
  1325 & the respective {\tt eval\_fn}s\\
  1326 Script.thy
  1327 & prerequisites for scripts: types, tactics, tacticals,\\
  1328 Script.ML
  1329 & sets of tactics and functions for internal use\\
  1330 & \\
  1331 \hline
  1332 & \\
  1333 Typefix.thy
  1334 & an intermediate hack for escaping type errors\\
  1335 Descript.thy
  1336 & {\it description}s for the formulas in {\it model}s and {\it problem}s\\
  1337 Atools
  1338 & (re-)definition of operators; general predicates and functions for preconditions; theorems for the {\tt eval\_rls}\\
  1339 Float
  1340 & floating point numerals\\
  1341 Equation
  1342 & basic notions for equations and equational systems\\
  1343 Poly
  1344 & polynomials\\
  1345 PolyEq
  1346 & polynomial equations and equational systems \\
  1347 Rational.thy
  1348 & additional theorems for rationals\\
  1349 Rational.ML
  1350 & cancel, add and simplify rationals using (a generalization of) Euclids algorithm; respective reverse rulesets\\
  1351 RatEq
  1352 & equations on rationals\\
  1353 Root
  1354 & radicals; calculate normalform; respective reverse rulesets\\
  1355 RootEq
  1356 & equations on roots\\
  1357 RatRootEq
  1358 & equations on rationals and roots (i.e. on terms containing both operations)\\
  1359 Vect
  1360 & vector analysis\\
  1361 Trig
  1362 & trigonometriy\\
  1363 LogExp
  1364 & logarithms and exponential functions\\
  1365 Calculus
  1366 & nonstandard analysis\\
  1367 Diff
  1368 & differentiation\\
  1369 DiffApp
  1370 & applications of differentiaten (maxima-minima-problems)\\
  1371 Test
  1372 & (old) data for the test suite\\
  1373 Isac
  1374 & collects all \isac-theoris.\\
  1375 \end{tabular}\end{center}\end{table}
  1376 }
  1377 
  1378 
  1379 \section{Data in {\tt *.thy}- and {\tt *.ML}-files}
  1380 As already mentioned, theories come in pairs of {\tt *.thy}- and {\tt *.ML}-files with the same respective filename. How data are distributed between the two files is shown in Tab.\ref{thy-ML} on p.\pageref{thy-ML}.
  1381 {\begin{table}[h]
  1382 \caption{Data in {\tt *.thy}- and {\tt *.ML}-files} \label{thy-ML}
  1383 \tabcolsep=2.0mm
  1384 \begin{center}
  1385 \def\arraystretch{1.0}
  1386 \begin{tabular}{llp{7.7cm}}
  1387 file & data & description \\
  1388 \hline
  1389 & &\\
  1390 {\tt *.thy}
  1391 & consts 
  1392 & operators, predicates, functions, script-names ('{\tt Script} name \dots{\tt arguments}')
  1393 \\
  1394 & rules  
  1395 & theorems: \isac{} uses Isabelles theorems if possible; additional theorems analoguous to such existing in Isabelle get the Isabelle-identifier attached an {\it I}
  1396 \\& &\\
  1397 {\tt *.ML}
  1398 & {\tt theory' :=} 
  1399 & the theory defined by the actual {\tt *.thy}-file is made accessible to \isac
  1400 \\
  1401 & {\tt eval\_fn}
  1402 & evaluation function for operators and predicates, coded on the meta-level (SML); the identifier of such a function is a combination of the keyword {\tt eval\_} with the identifier of the function as defined in {\tt *.thy}
  1403 \\
  1404 & {\tt *\_simplify} 
  1405 & the canonical simplifier for the actual theory, i.e. the identifier for this ruleset is a combination of the theories identifier and the keyword {\tt *\_simplify}
  1406 \\
  1407 & {\tt norm\_rls :=}
  1408 & the canonical simplifier {\tt *\_simplify} is stored such that it is accessible for \isac
  1409 \\
  1410 & {\tt rew\_ord' :=}
  1411 & the same for rewrite orders, if needed outside of one particular ruleset
  1412 \\
  1413 & {\tt ruleset' :=}
  1414 & the same for rulesets (ordinary rulesets, reverse rulesets and {\tt eval\_rls})
  1415 \\
  1416 & {\tt calc\_list :=}
  1417 & the same for {\tt eval\_fn}s, if needed outside of one particular ruleset (e.g. for a tactic {\tt Calculate} in a script)
  1418 \\
  1419 & {\tt store\_pbl}
  1420 & problems defined within this {\tt *.ML}-file are made accessible for \isac
  1421 \\
  1422 & {\tt methods :=}
  1423 & methods defined within this {\tt *.ML}-file are made accessible for \isac
  1424 \\
  1425 \end{tabular}\end{center}\end{table}
  1426 }
  1427 The order of the data-items within the theories should adhere to the order given in this list.
  1428 
  1429 \section{Formal description of the problem-hierarchy}
  1430 %for Richard Lang
  1431 
  1432 \section{Script tactics}
  1433 The tactics actually promote the calculation: they construct the prooftree behind the scenes, and they are the points during evaluation where the script-interpreter transfers control to the user. Here we only describe the sytax of the tactics; the semantics is described on p.\pageref{user-tactics} below in context with the tactics the student uses ('user-tactics'): there is a 1-to-1 correspondence between user-tactics and script-tactics.
  1434 
  1435 
  1436 
  1437 
  1438 
  1439 \part{Authoring on the knowledge}
  1440 
  1441 
  1442 \section{Add a theorem}
  1443 \section{Define and add a problem}
  1444 \section{Define and add a predicate}
  1445 \section{Define and add a method}
  1446 \section{}
  1447 \section{}
  1448 \section{}
  1449 \section{}
  1450 
  1451 
  1452 
  1453 \newpage
  1454 \bibliography{bib/isac,bib/from-theses}
  1455 
  1456 \end{document}