test/Tools/isac/ADDTESTS/course/T1_Basics.thy
author Walther Neuper <neuper@ist.tugraz.at>
Thu, 18 Nov 2010 17:28:45 +0100
branchisac-update-Isa09-2
changeset 38067 c7cea54ba4cb
child 38077 6f173c4caf79
permissions -rw-r--r--
material for teacher course/T* started, Basics finished, Rewrite partial

working on the material suggested some changes in Isac
neuper@38067
     1
(*
neuper@38067
     2
/usr/local/isabisac/bin/isabelle jedit -l Isac T1_Basics.thy &
neuper@38067
     3
*)
neuper@38067
     4
neuper@38067
     5
theory T1_Basics imports Isac begin
neuper@38067
     6
neuper@38067
     7
chapter {* Basics on Linux, Isabelle and ISAC *}
neuper@38067
     8
neuper@38067
     9
text {*This is an Isabelle/Isar theory, that means: in between the text there are parts which 
neuper@38067
    10
  can be evaluated by the theorem prover Isabelle if installed properly.
neuper@38067
    11
neuper@38067
    12
  The goal of the sequence beginning with this theory is to give a quick introduction to
neuper@38067
    13
  authoring the mathematics knowledge for the math assistant ISAC www.ist.tugraz.at/projects/isac.
neuper@38067
    14
neuper@38067
    15
  The course is self-contained for mathematics teachers, and probably for interested students.
neuper@38067
    16
*}
neuper@38067
    17
neuper@38067
    18
section {* Linux *}
neuper@38067
    19
neuper@38067
    20
text {* Isabelle is a computer theorem prover (CTP) under ongoing development. This
neuper@38067
    21
  development is done using Linux. However, now Isabelle supports cygwin and thus also can
neuper@38067
    22
  be run on Microsoft Windows.
neuper@38067
    23
neuper@38067
    24
  ISAC uses Isabelle as 'logical operating system'. You get both, ISAC and Isabelle
neuper@38067
    25
  installed into cygwin on an USB-stick at the beginning of the course.
neuper@38067
    26
neuper@38067
    27
  Authoring mathematics knowledge for ISAC (for instance, extending) requires basics
neuper@38067
    28
  in handling Linux (cygwin is Linux-like). Please notethat ISAC is an experimental system 
neuper@38067
    29
  and as such usability has not yet been considered.
neuper@38067
    30
neuper@38067
    31
  Having started cygwin you see a prompt '$' at the beginning of a line
neuper@38067
    32
  where you can input commands ('#' is the begin of a comment not interpreted by cygwin),
neuper@38067
    33
  for instance:
neuper@38067
    34
  \begin{itemize}
neuper@38067
    35
  \item $ cd /usr/local/Isabelle             # changes to directory of Isabelle
neuper@38067
    36
  \item $ ls -l                              # lists all files and subdirectories
neuper@38067
    37
  \item $ cd test/Tools/isac/ADDTESTS/course # go on to start the course
neuper@38067
    38
  \item $ /usr/local/isabisac/bin/isabelle jedit -l Isac T1_Basics.thy &
neuper@38067
    39
  \item $                                    # starts the first exercise
neuper@38067
    40
  \end{itemize}
neuper@38067
    41
neuper@38067
    42
  The arguments required for starting the first exercise tell about the underlying technology:
neuper@38067
    43
  \begin{itemize}
neuper@38067
    44
  \item $ \emph{jedit} is the editor to be used. jEdit www.jedit.org will be introduced to 
neuper@38067
    45
          Isabelle users within the next few years (so we are front-of-the-wave ;-).
neuper@38067
    46
  \item $ \emph{-l Isac} loads all functionality and knowledge of ISAC
neuper@38067
    47
  \item $ \emph{T1_Basics.thy} is the file name of the first exercise
neuper@38067
    48
  \item $ \emph{&} allows to use the same command line for further commands.
neuper@38067
    49
  \end{itemize}
neuper@38067
    50
neuper@38067
    51
  Furhter useful Linus commands are:
neuper@38067
    52
  \begin{itemize}
neuper@38067
    53
  \item $ TODO      # 
neuper@38067
    54
  \end{itemize}
neuper@38067
    55
*}
neuper@38067
    56
neuper@38067
    57
section {* Isabelle terms *}
neuper@38067
    58
neuper@38067
    59
text {* One basic kind of data required for mathematics are terms. ISAC uses Isabelle's terms.
neuper@38067
    60
  In order to allow for 'symbolic computation' terms require representation in an 
neuper@38067
    61
  appropriate data structure, which is defined at [ISABELLE_HOME]/src/Pure/term.ML.
neuper@38067
    62
neuper@38067
    63
  Let us give an example:
neuper@38067
    64
*}
neuper@38067
    65
neuper@38067
    66
ML {* @{term "a + b * 9"}*}
neuper@38067
    67
neuper@38067
    68
text {* In the 'Output' window below you see what the above command produces, the internal
neuper@38067
    69
  representation of "a + b * 3". The '...' indicate that some details are still hidden;
neuper@38067
    70
  further details are received this way:
neuper@38067
    71
*}
neuper@38067
    72
neuper@38067
    73
ML {* print_depth 99;
neuper@38067
    74
  @{term "a + b * 9"}
neuper@38067
    75
*}
neuper@38067
    76
neuper@38067
    77
text {* The internal representation is too comprehensive for several kinds of inspection.
neuper@38067
    78
  Thus ISAC provides additional features, as we see below. First let us store the term
neuper@38067
    79
  in a variable 't':
neuper@38067
    80
*}
neuper@38067
    81
neuper@38067
    82
ML {* 
neuper@38067
    83
  val t = @{term "a + b * 9"};
neuper@38067
    84
  atomwy t;
neuper@38067
    85
*}
neuper@38067
    86
neuper@38067
    87
text {* Please, observe that in this case (whenever 'writeln' is involved, even invisibly)
neuper@38067
    88
  the output of 'atomwy t' is placed on top of the 'Output' window.
neuper@38067
    89
neuper@38067
    90
  Presently, ISAC uses a slightly different representation for terms (which soon will disappear),
neuper@38067
    91
  which does not encode numerals as binary numbers:
neuper@38067
    92
*}
neuper@38067
    93
neuper@38067
    94
ML {* val SOME t = parse (theory "Isac") "a + b * 3";
neuper@38067
    95
  atomwy (term_of t);
neuper@38067
    96
*}
neuper@38067
    97
neuper@38067
    98
text {* From the above we see: the internal representation of a term contains all the 
neuper@38067
    99
  knowledge it is built from, see
neuper@38067
   100
  http://isabelle.in.tum.de/dist/library/HOL/Groups.html for the definitions
neuper@38067
   101
  \begin{itemize}
neuper@38067
   102
  \item plus  :: "'a => 'a => 'a"  (infixl "+" 65)
neuper@38067
   103
  \item times :: "'a => 'a => 'a"  (infixl "*" 70)
neuper@38067
   104
  \end{itemize}
neuper@38067
   105
  together with relevant theorems about + and *.
neuper@38067
   106
  
neuper@38067
   107
  In the near future you will just click in order to get the requested knowledge. (The
neuper@38067
   108
  present experimental state of Isabelle/jEdit already shows the signature of the function
neuper@38067
   109
  under the cursor, if kept on place for a second.)
neuper@38067
   110
*}
neuper@38067
   111
neuper@38067
   112
section {* Isabelle theories *}
neuper@38067
   113
neuper@38067
   114
text {* As just mentioned, (almost) all the math knowledge used in a theorem prover is
neuper@38067
   115
  explicitly defined (and not built into the code like in a CAS). The knowledge is
neuper@38067
   116
  organised in \emph{theories}.
neuper@38067
   117
neuper@38067
   118
  Without these theories Isabelle cannot do any thing, it even does not understand '+' or '*'.
neuper@38067
   119
  For instance, in the theory 'HOL' (short for high order logic) even more basic knowledge is 
neuper@38067
   120
  defined ('=' etc), but not yet '+' and '*', so you get 'NONE':
neuper@38067
   121
*}
neuper@38067
   122
neuper@38067
   123
ML {*  parse (theory "HOL") "a + b * 3";
neuper@38067
   124
*}
neuper@38067
   125
neuper@38067
   126
text {* ISAC uses comparatively few definitions and theorems from Isabelle, see 
neuper@38067
   127
  \begin{itemize}
neuper@38067
   128
  \item http://www.ist.tugraz.at/projects/isac/www/kbase/thy/index_thy.html
neuper@38067
   129
  \end{itemize}
neuper@38067
   130
  We call this the dimension of 'deductive knowledge'.
neuper@38067
   131
neuper@38067
   132
  \bigskip However, ISAC provides two additional dimensions of knowledge, 'application
neuper@38067
   133
  oriented knowledge' (simply called \emph{problems}) and 'algorithmic knowledge' 
neuper@38067
   134
  (simply called \emph{methods}); See
neuper@38067
   135
  \begin{itemize}
neuper@38067
   136
  \item problems http://www.ist.tugraz.at/projects/isac/www/kbase/pbl/index_pbl.html
neuper@38067
   137
  \item methods http://www.ist.tugraz.at/projects/isac/www/kbase/met/index_met.html
neuper@38067
   138
  \end{itemize}
neuper@38067
   139
neuper@38067
   140
  \bigskip The three dimensions of knowledge together provide all what a 
neuper@38067
   141
  \emph{mechanized math assistant} like ISAC requires for autonomously solving problems.
neuper@38067
   142
  So, in ISAC too, is (almost) nothing built into the program code, rather, all
neuper@38067
   143
  is up to authoring.
neuper@38067
   144
neuper@38067
   145
  This coures intends to provide basic knowledge for authoring new examples in ISAC.
neuper@38067
   146
*}
neuper@38067
   147
neuper@38067
   148
end