doc-src/Functions/intro.tex
author Walther Neuper <neuper@ist.tugraz.at>
Thu, 12 Aug 2010 15:03:34 +0200
branchisac-from-Isabelle2009-2
changeset 37913 20e3616b2d9c
parent 30209 2f4684e2ea95
permissions -rw-r--r--
prepare reactivation of isac-update-Isa09-2
krauss@23004
     1
\section{Introduction}
krauss@23004
     2
krauss@27026
     3
Starting from Isabelle 2007, new facilities for recursive
urbanc@26851
     4
function definitions~\cite{krauss2006} are available. They provide
krauss@23805
     5
better support for general recursive definitions than previous
urbanc@26851
     6
packages.  But despite all tool support, function definitions can
krauss@23805
     7
sometimes be a difficult thing. 
krauss@23004
     8
krauss@23188
     9
This tutorial is an example-guided introduction to the practical use
krauss@23805
    10
of the package and related tools. It should help you get started with
krauss@23805
    11
defining functions quickly. For the more difficult definitions we will
krauss@23805
    12
discuss what problems can arise, and how they can be solved.
krauss@23004
    13
krauss@27026
    14
We assume that you have mastered the fundamentals of Isabelle/HOL
krauss@23805
    15
and are able to write basic specifications and proofs. To start out
krauss@23805
    16
with Isabelle in general, consult the Isabelle/HOL tutorial
krauss@23805
    17
\cite{isa-tutorial}.
krauss@23004
    18
krauss@23805
    19
krauss@23805
    20
krauss@23805
    21
\paragraph{Structure of this tutorial.}
krauss@23805
    22
Section 2 introduces the syntax and basic operation of the \cmd{fun}
krauss@23805
    23
command, which provides full automation with reasonable default
krauss@27026
    24
behavior.  The impatient reader can stop after that
krauss@23805
    25
section, and consult the remaining sections only when needed.
krauss@23805
    26
Section 3 introduces the more verbose \cmd{function} command which
krauss@27026
    27
gives fine-grained control. This form should be used
krauss@23805
    28
whenever the short form fails.
krauss@27026
    29
After that we discuss more specialized issues:
krauss@27026
    30
termination, mutual, nested and higher-order recursion, partiality, pattern matching
krauss@23805
    31
and others.
krauss@23805
    32
krauss@23805
    33
krauss@23805
    34
\paragraph{Some background.}
krauss@23004
    35
Following the LCF tradition, the package is realized as a definitional
krauss@23004
    36
extension: Recursive definitions are internally transformed into a
krauss@23004
    37
non-recursive form, such that the function can be defined using
krauss@23004
    38
standard definition facilities. Then the recursive specification is
krauss@23004
    39
derived from the primitive definition.  This is a complex task, but it
krauss@23004
    40
is fully automated and mostly transparent to the user. Definitional
krauss@23004
    41
extensions are valuable because they are conservative by construction:
krauss@23805
    42
The \qt{new} concept of general wellfounded recursion is completely reduced
krauss@23004
    43
to existing principles.
krauss@23004
    44
krauss@23004
    45
krauss@23004
    46
krauss@23004
    47
krauss@27026
    48
The new \cmd{function} command, and its short form \cmd{fun} have mostly
krauss@27026
    49
replaced the traditional \cmd{recdef} command \cite{slind-tfl}. They solve
krauss@27026
    50
a few of technical issues around \cmd{recdef}, and allow definitions
krauss@23004
    51
which were not previously possible.
krauss@23004
    52
krauss@23004
    53
krauss@23004
    54
krauss@23188
    55