1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/doc-src/Functions/intro.tex Tue Mar 03 11:00:51 2009 +0100
1.3 @@ -0,0 +1,55 @@
1.4 +\section{Introduction}
1.5 +
1.6 +Starting from Isabelle 2007, new facilities for recursive
1.7 +function definitions~\cite{krauss2006} are available. They provide
1.8 +better support for general recursive definitions than previous
1.9 +packages. But despite all tool support, function definitions can
1.10 +sometimes be a difficult thing.
1.11 +
1.12 +This tutorial is an example-guided introduction to the practical use
1.13 +of the package and related tools. It should help you get started with
1.14 +defining functions quickly. For the more difficult definitions we will
1.15 +discuss what problems can arise, and how they can be solved.
1.16 +
1.17 +We assume that you have mastered the fundamentals of Isabelle/HOL
1.18 +and are able to write basic specifications and proofs. To start out
1.19 +with Isabelle in general, consult the Isabelle/HOL tutorial
1.20 +\cite{isa-tutorial}.
1.21 +
1.22 +
1.23 +
1.24 +\paragraph{Structure of this tutorial.}
1.25 +Section 2 introduces the syntax and basic operation of the \cmd{fun}
1.26 +command, which provides full automation with reasonable default
1.27 +behavior. The impatient reader can stop after that
1.28 +section, and consult the remaining sections only when needed.
1.29 +Section 3 introduces the more verbose \cmd{function} command which
1.30 +gives fine-grained control. This form should be used
1.31 +whenever the short form fails.
1.32 +After that we discuss more specialized issues:
1.33 +termination, mutual, nested and higher-order recursion, partiality, pattern matching
1.34 +and others.
1.35 +
1.36 +
1.37 +\paragraph{Some background.}
1.38 +Following the LCF tradition, the package is realized as a definitional
1.39 +extension: Recursive definitions are internally transformed into a
1.40 +non-recursive form, such that the function can be defined using
1.41 +standard definition facilities. Then the recursive specification is
1.42 +derived from the primitive definition. This is a complex task, but it
1.43 +is fully automated and mostly transparent to the user. Definitional
1.44 +extensions are valuable because they are conservative by construction:
1.45 +The \qt{new} concept of general wellfounded recursion is completely reduced
1.46 +to existing principles.
1.47 +
1.48 +
1.49 +
1.50 +
1.51 +The new \cmd{function} command, and its short form \cmd{fun} have mostly
1.52 +replaced the traditional \cmd{recdef} command \cite{slind-tfl}. They solve
1.53 +a few of technical issues around \cmd{recdef}, and allow definitions
1.54 +which were not previously possible.
1.55 +
1.56 +
1.57 +
1.58 +