mentioned method size_change in function tutorial
authorkrauss
Mon Nov 23 15:06:34 2009 +0100 (2009-11-23)
changeset 3385614a658faadb6
parent 33855 cd8acf137c9c
child 33857 0cb5002c52db
mentioned method size_change in function tutorial
doc-src/Functions/Thy/Functions.thy
doc-src/Functions/Thy/document/Functions.tex
doc-src/manual.bib
     1.1 --- a/doc-src/Functions/Thy/Functions.thy	Mon Nov 23 15:05:59 2009 +0100
     1.2 +++ b/doc-src/Functions/Thy/Functions.thy	Mon Nov 23 15:06:34 2009 +0100
     1.3 @@ -309,8 +309,6 @@
     1.4  *** At command "fun".\newline
     1.5  \end{isabelle}
     1.6  *}
     1.7 -
     1.8 -
     1.9  text {*
    1.10    The key to this error message is the matrix at the bottom. The rows
    1.11    of that matrix correspond to the different recursive calls (In our
    1.12 @@ -326,27 +324,30 @@
    1.13  
    1.14    For the failed proof attempts, the unfinished subgoals are also
    1.15    printed. Looking at these will often point to a missing lemma.
    1.16 +*}
    1.17  
    1.18 -%  As a more real example, here is quicksort:
    1.19 -*}
    1.20 -(*
    1.21 -function qs :: "nat list \<Rightarrow> nat list"
    1.22 -where
    1.23 -  "qs [] = []"
    1.24 -| "qs (x#xs) = qs [y\<in>xs. y < x] @ x # qs [y\<in>xs. y \<ge> x]"
    1.25 -by pat_completeness auto
    1.26 +subsection {* The @{text size_change} method *}
    1.27  
    1.28 -termination apply lexicographic_order
    1.29 -
    1.30 -text {* If we try @{text "lexicographic_order"} method, we get the
    1.31 -  following error *}
    1.32 -termination by (lexicographic_order simp:l2)
    1.33 +text {*
    1.34 +  Some termination goals that are beyond the powers of
    1.35 +  @{text lexicographic_order} can be solved automatically by the
    1.36 +  more powerful @{text size_change} method, which uses a variant of
    1.37 +  the size-change principle, together with some other
    1.38 +  techniques. While the details are discussed
    1.39 +  elsewhere\cite{krauss_phd},
    1.40 +  here are a few typical situations where
    1.41 +  @{text lexicographic_order} has difficulties and @{text size_change}
    1.42 +  may be worth a try:
    1.43 +  \begin{itemize}
    1.44 +  \item Arguments are permuted in a recursive call.
    1.45 +  \item Several mutually recursive functions with multiple arguments.
    1.46 +  \item Unusual control flow (e.g., when some recursive calls cannot
    1.47 +  occur in sequence).
    1.48 +  \end{itemize}
    1.49  
    1.50 -lemma l: "x \<le> y \<Longrightarrow> x < Suc y" by arith
    1.51 -
    1.52 -function 
    1.53 -
    1.54 -*)
    1.55 +  Loading the theory @{text Multiset} makes the @{text size_change}
    1.56 +  method a bit stronger: it can then use multiset orders internally.
    1.57 +*}
    1.58  
    1.59  section {* Mutual Recursion *}
    1.60  
     2.1 --- a/doc-src/Functions/Thy/document/Functions.tex	Mon Nov 23 15:05:59 2009 +0100
     2.2 +++ b/doc-src/Functions/Thy/document/Functions.tex	Mon Nov 23 15:06:34 2009 +0100
     2.3 @@ -453,9 +453,33 @@
     2.4    \isa{{\isacharless}}, \isa{{\isacharless}{\isacharequal}} and \isa{{\isacharquery}}.
     2.5  
     2.6    For the failed proof attempts, the unfinished subgoals are also
     2.7 -  printed. Looking at these will often point to a missing lemma.
     2.8 +  printed. Looking at these will often point to a missing lemma.%
     2.9 +\end{isamarkuptext}%
    2.10 +\isamarkuptrue%
    2.11 +%
    2.12 +\isamarkupsubsection{The \isa{size{\isacharunderscore}change} method%
    2.13 +}
    2.14 +\isamarkuptrue%
    2.15 +%
    2.16 +\begin{isamarkuptext}%
    2.17 +Some termination goals that are beyond the powers of
    2.18 +  \isa{lexicographic{\isacharunderscore}order} can be solved automatically by the
    2.19 +  more powerful \isa{size{\isacharunderscore}change} method, which uses a variant of
    2.20 +  the size-change principle, together with some other
    2.21 +  techniques. While the details are discussed
    2.22 +  elsewhere\cite{krauss_phd},
    2.23 +  here are a few typical situations where
    2.24 +  \isa{lexicographic{\isacharunderscore}order} has difficulties and \isa{size{\isacharunderscore}change}
    2.25 +  may be worth a try:
    2.26 +  \begin{itemize}
    2.27 +  \item Arguments are permuted in a recursive call.
    2.28 +  \item Several mutually recursive functions with multiple arguments.
    2.29 +  \item Unusual control flow (e.g., when some recursive calls cannot
    2.30 +  occur in sequence).
    2.31 +  \end{itemize}
    2.32  
    2.33 -%  As a more real example, here is quicksort:%
    2.34 +  Loading the theory \isa{Multiset} makes the \isa{size{\isacharunderscore}change}
    2.35 +  method a bit stronger: it can then use multiset orders internally.%
    2.36  \end{isamarkuptext}%
    2.37  \isamarkuptrue%
    2.38  %
     3.1 --- a/doc-src/manual.bib	Mon Nov 23 15:05:59 2009 +0100
     3.2 +++ b/doc-src/manual.bib	Mon Nov 23 15:06:34 2009 +0100
     3.3 @@ -660,6 +660,14 @@
     3.4    crossref =  {ijcar2006},
     3.5    pages =     {589--603}}
     3.6  
     3.7 +@PhdThesis{krauss_phd,
     3.8 +	author = {Alexander Krauss},
     3.9 +	title = {Automating Recursive Definitions and Termination Proofs in Higher-Order Logic},
    3.10 +  school = {Institut f{\"u}r Informatik, Technische Universit{\"a}t M{\"u}nchen},
    3.11 +	year = {2009},
    3.12 +	address = {Germany}
    3.13 +}
    3.14 +
    3.15  @manual{isabelle-function,
    3.16    author        = {Alexander Krauss},
    3.17    title         = {Defining Recursive Functions in {Isabelle/HOL}},