more canonical directory structure of manuals
authorhaftmann
Tue, 03 Mar 2009 11:00:51 +0100
changeset 302092f4684e2ea95
parent 30202 2775062fd3a9
child 30210 853abb4853cc
more canonical directory structure of manuals
doc-src/Classes/IsaMakefile
doc-src/Classes/Makefile
doc-src/Classes/Thy/Classes.thy
doc-src/Classes/Thy/ROOT.ML
doc-src/Classes/Thy/Setup.thy
doc-src/Classes/Thy/document/Classes.tex
doc-src/Classes/classes.tex
doc-src/Classes/style.sty
doc-src/Codegen/IsaMakefile
doc-src/Codegen/Makefile
doc-src/Codegen/Thy/Adaption.thy
doc-src/Codegen/Thy/Codegen.thy
doc-src/Codegen/Thy/Further.thy
doc-src/Codegen/Thy/Introduction.thy
doc-src/Codegen/Thy/ML.thy
doc-src/Codegen/Thy/Program.thy
doc-src/Codegen/Thy/ROOT.ML
doc-src/Codegen/Thy/Setup.thy
doc-src/Codegen/Thy/document/Adaption.tex
doc-src/Codegen/Thy/document/Codegen.tex
doc-src/Codegen/Thy/document/Further.tex
doc-src/Codegen/Thy/document/Introduction.tex
doc-src/Codegen/Thy/document/ML.tex
doc-src/Codegen/Thy/document/Program.tex
doc-src/Codegen/Thy/examples/Codegen.hs
doc-src/Codegen/Thy/examples/Example.hs
doc-src/Codegen/Thy/examples/arbitrary.ML
doc-src/Codegen/Thy/examples/bool_infix.ML
doc-src/Codegen/Thy/examples/bool_literal.ML
doc-src/Codegen/Thy/examples/bool_mlbool.ML
doc-src/Codegen/Thy/examples/class.ML
doc-src/Codegen/Thy/examples/class.ocaml
doc-src/Codegen/Thy/examples/collect_duplicates.ML
doc-src/Codegen/Thy/examples/dirty_set.ML
doc-src/Codegen/Thy/examples/example.ML
doc-src/Codegen/Thy/examples/fac.ML
doc-src/Codegen/Thy/examples/integers.ML
doc-src/Codegen/Thy/examples/lexicographic.ML
doc-src/Codegen/Thy/examples/lookup.ML
doc-src/Codegen/Thy/examples/monotype.ML
doc-src/Codegen/Thy/examples/nat_binary.ML
doc-src/Codegen/Thy/examples/pick1.ML
doc-src/Codegen/Thy/examples/tree.ML
doc-src/Codegen/codegen.tex
doc-src/Codegen/codegen_process.pdf
doc-src/Codegen/codegen_process.ps
doc-src/Codegen/style.sty
doc-src/Dirs
doc-src/Functions/IsaMakefile
doc-src/Functions/Makefile
doc-src/Functions/Thy/Functions.thy
doc-src/Functions/Thy/ROOT.ML
doc-src/Functions/Thy/document/Functions.tex
doc-src/Functions/Thy/document/session.tex
doc-src/Functions/conclusion.tex
doc-src/Functions/functions.tex
doc-src/Functions/intro.tex
doc-src/Functions/isabelle_isar.eps
doc-src/Functions/isabelle_isar.pdf
doc-src/Functions/mathpartir.sty
doc-src/Functions/style.sty
doc-src/IsarAdvanced/Classes/IsaMakefile
doc-src/IsarAdvanced/Classes/Makefile
doc-src/IsarAdvanced/Classes/Thy/Classes.thy
doc-src/IsarAdvanced/Classes/Thy/ROOT.ML
doc-src/IsarAdvanced/Classes/Thy/Setup.thy
doc-src/IsarAdvanced/Classes/Thy/document/Classes.tex
doc-src/IsarAdvanced/Classes/classes.tex
doc-src/IsarAdvanced/Classes/style.sty
doc-src/IsarAdvanced/Codegen/IsaMakefile
doc-src/IsarAdvanced/Codegen/Makefile
doc-src/IsarAdvanced/Codegen/Thy/Adaption.thy
doc-src/IsarAdvanced/Codegen/Thy/Codegen.thy
doc-src/IsarAdvanced/Codegen/Thy/Further.thy
doc-src/IsarAdvanced/Codegen/Thy/Introduction.thy
doc-src/IsarAdvanced/Codegen/Thy/ML.thy
doc-src/IsarAdvanced/Codegen/Thy/Program.thy
doc-src/IsarAdvanced/Codegen/Thy/ROOT.ML
doc-src/IsarAdvanced/Codegen/Thy/Setup.thy
doc-src/IsarAdvanced/Codegen/Thy/document/Adaption.tex
doc-src/IsarAdvanced/Codegen/Thy/document/Codegen.tex
doc-src/IsarAdvanced/Codegen/Thy/document/Further.tex
doc-src/IsarAdvanced/Codegen/Thy/document/Introduction.tex
doc-src/IsarAdvanced/Codegen/Thy/document/ML.tex
doc-src/IsarAdvanced/Codegen/Thy/document/Program.tex
doc-src/IsarAdvanced/Codegen/Thy/examples/Codegen.hs
doc-src/IsarAdvanced/Codegen/Thy/examples/Example.hs
doc-src/IsarAdvanced/Codegen/Thy/examples/arbitrary.ML
doc-src/IsarAdvanced/Codegen/Thy/examples/bool_infix.ML
doc-src/IsarAdvanced/Codegen/Thy/examples/bool_literal.ML
doc-src/IsarAdvanced/Codegen/Thy/examples/bool_mlbool.ML
doc-src/IsarAdvanced/Codegen/Thy/examples/class.ML
doc-src/IsarAdvanced/Codegen/Thy/examples/class.ocaml
doc-src/IsarAdvanced/Codegen/Thy/examples/collect_duplicates.ML
doc-src/IsarAdvanced/Codegen/Thy/examples/dirty_set.ML
doc-src/IsarAdvanced/Codegen/Thy/examples/example.ML
doc-src/IsarAdvanced/Codegen/Thy/examples/fac.ML
doc-src/IsarAdvanced/Codegen/Thy/examples/integers.ML
doc-src/IsarAdvanced/Codegen/Thy/examples/lexicographic.ML
doc-src/IsarAdvanced/Codegen/Thy/examples/lookup.ML
doc-src/IsarAdvanced/Codegen/Thy/examples/monotype.ML
doc-src/IsarAdvanced/Codegen/Thy/examples/nat_binary.ML
doc-src/IsarAdvanced/Codegen/Thy/examples/pick1.ML
doc-src/IsarAdvanced/Codegen/Thy/examples/tree.ML
doc-src/IsarAdvanced/Codegen/codegen.tex
doc-src/IsarAdvanced/Codegen/codegen_process.pdf
doc-src/IsarAdvanced/Codegen/codegen_process.ps
doc-src/IsarAdvanced/Codegen/style.sty
doc-src/IsarAdvanced/Functions/IsaMakefile
doc-src/IsarAdvanced/Functions/Makefile
doc-src/IsarAdvanced/Functions/Thy/Functions.thy
doc-src/IsarAdvanced/Functions/Thy/ROOT.ML
doc-src/IsarAdvanced/Functions/Thy/document/Functions.tex
doc-src/IsarAdvanced/Functions/Thy/document/session.tex
doc-src/IsarAdvanced/Functions/conclusion.tex
doc-src/IsarAdvanced/Functions/functions.tex
doc-src/IsarAdvanced/Functions/intro.tex
doc-src/IsarAdvanced/Functions/isabelle_isar.eps
doc-src/IsarAdvanced/Functions/isabelle_isar.pdf
doc-src/IsarAdvanced/Functions/mathpartir.sty
doc-src/IsarAdvanced/Functions/style.sty
doc-src/IsarAdvanced/Makefile.in
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/doc-src/Classes/IsaMakefile	Tue Mar 03 11:00:51 2009 +0100
     1.3 @@ -0,0 +1,33 @@
     1.4 +
     1.5 +## targets
     1.6 +
     1.7 +default: Thy
     1.8 +images: 
     1.9 +test: Thy
    1.10 +
    1.11 +all: images test
    1.12 +
    1.13 +
    1.14 +## global settings
    1.15 +
    1.16 +SRC = $(ISABELLE_HOME)/src
    1.17 +OUT = $(ISABELLE_OUTPUT)
    1.18 +LOG = $(OUT)/log
    1.19 +
    1.20 +USEDIR = $(ISABELLE_TOOL) usedir -v true -i false -d false -C false -D document
    1.21 +
    1.22 +
    1.23 +## Thy
    1.24 +
    1.25 +THY = $(LOG)/HOL-Thy.gz
    1.26 +
    1.27 +Thy: $(THY)
    1.28 +
    1.29 +$(THY): Thy/ROOT.ML Thy/Setup.thy Thy/Classes.thy ../antiquote_setup.ML ../more_antiquote.ML
    1.30 +	@$(USEDIR) HOL Thy
    1.31 +
    1.32 +
    1.33 +## clean
    1.34 +
    1.35 +clean:
    1.36 +	@rm -f $(THY)
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/doc-src/Classes/Makefile	Tue Mar 03 11:00:51 2009 +0100
     2.3 @@ -0,0 +1,35 @@
     2.4 +
     2.5 +## targets
     2.6 +
     2.7 +default: dvi
     2.8 +
     2.9 +
    2.10 +## dependencies
    2.11 +
    2.12 +include ../Makefile.in
    2.13 +
    2.14 +NAME = classes
    2.15 +
    2.16 +FILES = $(NAME).tex classes.tex Thy/document/Classes.tex \
    2.17 +  style.sty ../iman.sty ../extra.sty ../isar.sty \
    2.18 +  ../isabelle.sty ../isabellesym.sty ../pdfsetup.sty \
    2.19 +  ../manual.bib ../proof.sty
    2.20 +
    2.21 +dvi: $(NAME).dvi
    2.22 +
    2.23 +$(NAME).dvi: $(FILES) isabelle_isar.eps
    2.24 +	$(LATEX) $(NAME)
    2.25 +	$(BIBTEX) $(NAME)
    2.26 +	$(LATEX) $(NAME)
    2.27 +	$(LATEX) $(NAME)
    2.28 +
    2.29 +pdf: $(NAME).pdf
    2.30 +
    2.31 +$(NAME).pdf: $(FILES) isabelle_isar.pdf
    2.32 +	$(PDFLATEX) $(NAME)
    2.33 +	$(BIBTEX) $(NAME)
    2.34 +	$(PDFLATEX) $(NAME)
    2.35 +	$(PDFLATEX) $(NAME)
    2.36 +	$(FIXBOOKMARKS) $(NAME).out
    2.37 +	$(PDFLATEX) $(NAME)
    2.38 +	$(PDFLATEX) $(NAME)
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/doc-src/Classes/Thy/Classes.thy	Tue Mar 03 11:00:51 2009 +0100
     3.3 @@ -0,0 +1,635 @@
     3.4 +theory Classes
     3.5 +imports Main Setup
     3.6 +begin
     3.7 +
     3.8 +chapter {* Haskell-style classes with Isabelle/Isar *}
     3.9 +
    3.10 +section {* Introduction *}
    3.11 +
    3.12 +text {*
    3.13 +  Type classes were introduces by Wadler and Blott \cite{wadler89how}
    3.14 +  into the Haskell language, to allow for a reasonable implementation
    3.15 +  of overloading\footnote{throughout this tutorial, we are referring
    3.16 +  to classical Haskell 1.0 type classes, not considering
    3.17 +  later additions in expressiveness}.
    3.18 +  As a canonical example, a polymorphic equality function
    3.19 +  @{text "eq \<Colon> \<alpha> \<Rightarrow> \<alpha> \<Rightarrow> bool"} which is overloaded on different
    3.20 +  types for @{text "\<alpha>"}, which is achieved by splitting introduction
    3.21 +  of the @{text eq} function from its overloaded definitions by means
    3.22 +  of @{text class} and @{text instance} declarations:
    3.23 +
    3.24 +  \begin{quote}
    3.25 +
    3.26 +  \noindent@{text "class eq where"}\footnote{syntax here is a kind of isabellized Haskell} \\
    3.27 +  \hspace*{2ex}@{text "eq \<Colon> \<alpha> \<Rightarrow> \<alpha> \<Rightarrow> bool"}
    3.28 +
    3.29 +  \medskip\noindent@{text "instance nat \<Colon> eq where"} \\
    3.30 +  \hspace*{2ex}@{text "eq 0 0 = True"} \\
    3.31 +  \hspace*{2ex}@{text "eq 0 _ = False"} \\
    3.32 +  \hspace*{2ex}@{text "eq _ 0 = False"} \\
    3.33 +  \hspace*{2ex}@{text "eq (Suc n) (Suc m) = eq n m"}
    3.34 +
    3.35 +  \medskip\noindent@{text "instance (\<alpha>\<Colon>eq, \<beta>\<Colon>eq) pair \<Colon> eq where"} \\
    3.36 +  \hspace*{2ex}@{text "eq (x1, y1) (x2, y2) = eq x1 x2 \<and> eq y1 y2"}
    3.37 +
    3.38 +  \medskip\noindent@{text "class ord extends eq where"} \\
    3.39 +  \hspace*{2ex}@{text "less_eq \<Colon> \<alpha> \<Rightarrow> \<alpha> \<Rightarrow> bool"} \\
    3.40 +  \hspace*{2ex}@{text "less \<Colon> \<alpha> \<Rightarrow> \<alpha> \<Rightarrow> bool"}
    3.41 +
    3.42 +  \end{quote}
    3.43 +
    3.44 +  \noindent Type variables are annotated with (finitely many) classes;
    3.45 +  these annotations are assertions that a particular polymorphic type
    3.46 +  provides definitions for overloaded functions.
    3.47 +
    3.48 +  Indeed, type classes not only allow for simple overloading
    3.49 +  but form a generic calculus, an instance of order-sorted
    3.50 +  algebra \cite{Nipkow-Prehofer:1993,nipkow-sorts93,Wenzel:1997:TPHOL}.
    3.51 +
    3.52 +  From a software engeneering point of view, type classes
    3.53 +  roughly correspond to interfaces in object-oriented languages like Java;
    3.54 +  so, it is naturally desirable that type classes do not only
    3.55 +  provide functions (class parameters) but also state specifications
    3.56 +  implementations must obey.  For example, the @{text "class eq"}
    3.57 +  above could be given the following specification, demanding that
    3.58 +  @{text "class eq"} is an equivalence relation obeying reflexivity,
    3.59 +  symmetry and transitivity:
    3.60 +
    3.61 +  \begin{quote}
    3.62 +
    3.63 +  \noindent@{text "class eq where"} \\
    3.64 +  \hspace*{2ex}@{text "eq \<Colon> \<alpha> \<Rightarrow> \<alpha> \<Rightarrow> bool"} \\
    3.65 +  @{text "satisfying"} \\
    3.66 +  \hspace*{2ex}@{text "refl: eq x x"} \\
    3.67 +  \hspace*{2ex}@{text "sym: eq x y \<longleftrightarrow> eq x y"} \\
    3.68 +  \hspace*{2ex}@{text "trans: eq x y \<and> eq y z \<longrightarrow> eq x z"}
    3.69 +
    3.70 +  \end{quote}
    3.71 +
    3.72 +  \noindent From a theoretic point of view, type classes are lightweight
    3.73 +  modules; Haskell type classes may be emulated by
    3.74 +  SML functors \cite{classes_modules}. 
    3.75 +  Isabelle/Isar offers a discipline of type classes which brings
    3.76 +  all those aspects together:
    3.77 +
    3.78 +  \begin{enumerate}
    3.79 +    \item specifying abstract parameters together with
    3.80 +       corresponding specifications,
    3.81 +    \item instantiating those abstract parameters by a particular
    3.82 +       type
    3.83 +    \item in connection with a ``less ad-hoc'' approach to overloading,
    3.84 +    \item with a direct link to the Isabelle module system
    3.85 +      (aka locales \cite{kammueller-locales}).
    3.86 +  \end{enumerate}
    3.87 +
    3.88 +  \noindent Isar type classes also directly support code generation
    3.89 +  in a Haskell like fashion.
    3.90 +
    3.91 +  This tutorial demonstrates common elements of structured specifications
    3.92 +  and abstract reasoning with type classes by the algebraic hierarchy of
    3.93 +  semigroups, monoids and groups.  Our background theory is that of
    3.94 +  Isabelle/HOL \cite{isa-tutorial}, for which some
    3.95 +  familiarity is assumed.
    3.96 +
    3.97 +  Here we merely present the look-and-feel for end users.
    3.98 +  Internally, those are mapped to more primitive Isabelle concepts.
    3.99 +  See \cite{Haftmann-Wenzel:2006:classes} for more detail.
   3.100 +*}
   3.101 +
   3.102 +section {* A simple algebra example \label{sec:example} *}
   3.103 +
   3.104 +subsection {* Class definition *}
   3.105 +
   3.106 +text {*
   3.107 +  Depending on an arbitrary type @{text "\<alpha>"}, class @{text
   3.108 +  "semigroup"} introduces a binary operator @{text "(\<otimes>)"} that is
   3.109 +  assumed to be associative:
   3.110 +*}
   3.111 +
   3.112 +class %quote semigroup =
   3.113 +  fixes mult :: "\<alpha> \<Rightarrow> \<alpha> \<Rightarrow> \<alpha>"    (infixl "\<otimes>" 70)
   3.114 +  assumes assoc: "(x \<otimes> y) \<otimes> z = x \<otimes> (y \<otimes> z)"
   3.115 +
   3.116 +text {*
   3.117 +  \noindent This @{command class} specification consists of two
   3.118 +  parts: the \qn{operational} part names the class parameter
   3.119 +  (@{element "fixes"}), the \qn{logical} part specifies properties on them
   3.120 +  (@{element "assumes"}).  The local @{element "fixes"} and
   3.121 +  @{element "assumes"} are lifted to the theory toplevel,
   3.122 +  yielding the global
   3.123 +  parameter @{term [source] "mult \<Colon> \<alpha>\<Colon>semigroup \<Rightarrow> \<alpha> \<Rightarrow> \<alpha>"} and the
   3.124 +  global theorem @{fact "semigroup.assoc:"}~@{prop [source] "\<And>x y
   3.125 +  z \<Colon> \<alpha>\<Colon>semigroup. (x \<otimes> y) \<otimes> z = x \<otimes> (y \<otimes> z)"}.
   3.126 +*}
   3.127 +
   3.128 +
   3.129 +subsection {* Class instantiation \label{sec:class_inst} *}
   3.130 +
   3.131 +text {*
   3.132 +  The concrete type @{typ int} is made a @{class semigroup}
   3.133 +  instance by providing a suitable definition for the class parameter
   3.134 +  @{text "(\<otimes>)"} and a proof for the specification of @{fact assoc}.
   3.135 +  This is accomplished by the @{command instantiation} target:
   3.136 +*}
   3.137 +
   3.138 +instantiation %quote int :: semigroup
   3.139 +begin
   3.140 +
   3.141 +definition %quote
   3.142 +  mult_int_def: "i \<otimes> j = i + (j\<Colon>int)"
   3.143 +
   3.144 +instance %quote proof
   3.145 +  fix i j k :: int have "(i + j) + k = i + (j + k)" by simp
   3.146 +  then show "(i \<otimes> j) \<otimes> k = i \<otimes> (j \<otimes> k)"
   3.147 +    unfolding mult_int_def .
   3.148 +qed
   3.149 +
   3.150 +end %quote
   3.151 +
   3.152 +text {*
   3.153 +  \noindent @{command instantiation} allows to define class parameters
   3.154 +  at a particular instance using common specification tools (here,
   3.155 +  @{command definition}).  The concluding @{command instance}
   3.156 +  opens a proof that the given parameters actually conform
   3.157 +  to the class specification.  Note that the first proof step
   3.158 +  is the @{method default} method,
   3.159 +  which for such instance proofs maps to the @{method intro_classes} method.
   3.160 +  This boils down an instance judgement to the relevant primitive
   3.161 +  proof goals and should conveniently always be the first method applied
   3.162 +  in an instantiation proof.
   3.163 +
   3.164 +  From now on, the type-checker will consider @{typ int}
   3.165 +  as a @{class semigroup} automatically, i.e.\ any general results
   3.166 +  are immediately available on concrete instances.
   3.167 +
   3.168 +  \medskip Another instance of @{class semigroup} are the natural numbers:
   3.169 +*}
   3.170 +
   3.171 +instantiation %quote nat :: semigroup
   3.172 +begin
   3.173 +
   3.174 +primrec %quote mult_nat where
   3.175 +  "(0\<Colon>nat) \<otimes> n = n"
   3.176 +  | "Suc m \<otimes> n = Suc (m \<otimes> n)"
   3.177 +
   3.178 +instance %quote proof
   3.179 +  fix m n q :: nat 
   3.180 +  show "m \<otimes> n \<otimes> q = m \<otimes> (n \<otimes> q)"
   3.181 +    by (induct m) auto
   3.182 +qed
   3.183 +
   3.184 +end %quote
   3.185 +
   3.186 +text {*
   3.187 +  \noindent Note the occurence of the name @{text mult_nat}
   3.188 +  in the primrec declaration;  by default, the local name of
   3.189 +  a class operation @{text f} to instantiate on type constructor
   3.190 +  @{text \<kappa>} are mangled as @{text f_\<kappa>}.  In case of uncertainty,
   3.191 +  these names may be inspected using the @{command "print_context"} command
   3.192 +  or the corresponding ProofGeneral button.
   3.193 +*}
   3.194 +
   3.195 +subsection {* Lifting and parametric types *}
   3.196 +
   3.197 +text {*
   3.198 +  Overloaded definitions giving on class instantiation
   3.199 +  may include recursion over the syntactic structure of types.
   3.200 +  As a canonical example, we model product semigroups
   3.201 +  using our simple algebra:
   3.202 +*}
   3.203 +
   3.204 +instantiation %quote * :: (semigroup, semigroup) semigroup
   3.205 +begin
   3.206 +
   3.207 +definition %quote
   3.208 +  mult_prod_def: "p\<^isub>1 \<otimes> p\<^isub>2 = (fst p\<^isub>1 \<otimes> fst p\<^isub>2, snd p\<^isub>1 \<otimes> snd p\<^isub>2)"
   3.209 +
   3.210 +instance %quote proof
   3.211 +  fix p\<^isub>1 p\<^isub>2 p\<^isub>3 :: "\<alpha>\<Colon>semigroup \<times> \<beta>\<Colon>semigroup"
   3.212 +  show "p\<^isub>1 \<otimes> p\<^isub>2 \<otimes> p\<^isub>3 = p\<^isub>1 \<otimes> (p\<^isub>2 \<otimes> p\<^isub>3)"
   3.213 +    unfolding mult_prod_def by (simp add: assoc)
   3.214 +qed      
   3.215 +
   3.216 +end %quote
   3.217 +
   3.218 +text {*
   3.219 +  \noindent Associativity from product semigroups is
   3.220 +  established using
   3.221 +  the definition of @{text "(\<otimes>)"} on products and the hypothetical
   3.222 +  associativity of the type components;  these hypotheses
   3.223 +  are facts due to the @{class semigroup} constraints imposed
   3.224 +  on the type components by the @{command instance} proposition.
   3.225 +  Indeed, this pattern often occurs with parametric types
   3.226 +  and type classes.
   3.227 +*}
   3.228 +
   3.229 +
   3.230 +subsection {* Subclassing *}
   3.231 +
   3.232 +text {*
   3.233 +  We define a subclass @{text monoidl} (a semigroup with a left-hand neutral)
   3.234 +  by extending @{class semigroup}
   3.235 +  with one additional parameter @{text neutral} together
   3.236 +  with its property:
   3.237 +*}
   3.238 +
   3.239 +class %quote monoidl = semigroup +
   3.240 +  fixes neutral :: "\<alpha>" ("\<one>")
   3.241 +  assumes neutl: "\<one> \<otimes> x = x"
   3.242 +
   3.243 +text {*
   3.244 +  \noindent Again, we prove some instances, by
   3.245 +  providing suitable parameter definitions and proofs for the
   3.246 +  additional specifications.  Observe that instantiations
   3.247 +  for types with the same arity may be simultaneous:
   3.248 +*}
   3.249 +
   3.250 +instantiation %quote nat and int :: monoidl
   3.251 +begin
   3.252 +
   3.253 +definition %quote
   3.254 +  neutral_nat_def: "\<one> = (0\<Colon>nat)"
   3.255 +
   3.256 +definition %quote
   3.257 +  neutral_int_def: "\<one> = (0\<Colon>int)"
   3.258 +
   3.259 +instance %quote proof
   3.260 +  fix n :: nat
   3.261 +  show "\<one> \<otimes> n = n"
   3.262 +    unfolding neutral_nat_def by simp
   3.263 +next
   3.264 +  fix k :: int
   3.265 +  show "\<one> \<otimes> k = k"
   3.266 +    unfolding neutral_int_def mult_int_def by simp
   3.267 +qed
   3.268 +
   3.269 +end %quote
   3.270 +
   3.271 +instantiation %quote * :: (monoidl, monoidl) monoidl
   3.272 +begin
   3.273 +
   3.274 +definition %quote
   3.275 +  neutral_prod_def: "\<one> = (\<one>, \<one>)"
   3.276 +
   3.277 +instance %quote proof
   3.278 +  fix p :: "\<alpha>\<Colon>monoidl \<times> \<beta>\<Colon>monoidl"
   3.279 +  show "\<one> \<otimes> p = p"
   3.280 +    unfolding neutral_prod_def mult_prod_def by (simp add: neutl)
   3.281 +qed
   3.282 +
   3.283 +end %quote
   3.284 +
   3.285 +text {*
   3.286 +  \noindent Fully-fledged monoids are modelled by another subclass
   3.287 +  which does not add new parameters but tightens the specification:
   3.288 +*}
   3.289 +
   3.290 +class %quote monoid = monoidl +
   3.291 +  assumes neutr: "x \<otimes> \<one> = x"
   3.292 +
   3.293 +instantiation %quote nat and int :: monoid 
   3.294 +begin
   3.295 +
   3.296 +instance %quote proof
   3.297 +  fix n :: nat
   3.298 +  show "n \<otimes> \<one> = n"
   3.299 +    unfolding neutral_nat_def by (induct n) simp_all
   3.300 +next
   3.301 +  fix k :: int
   3.302 +  show "k \<otimes> \<one> = k"
   3.303 +    unfolding neutral_int_def mult_int_def by simp
   3.304 +qed
   3.305 +
   3.306 +end %quote
   3.307 +
   3.308 +instantiation %quote * :: (monoid, monoid) monoid
   3.309 +begin
   3.310 +
   3.311 +instance %quote proof 
   3.312 +  fix p :: "\<alpha>\<Colon>monoid \<times> \<beta>\<Colon>monoid"
   3.313 +  show "p \<otimes> \<one> = p"
   3.314 +    unfolding neutral_prod_def mult_prod_def by (simp add: neutr)
   3.315 +qed
   3.316 +
   3.317 +end %quote
   3.318 +
   3.319 +text {*
   3.320 +  \noindent To finish our small algebra example, we add a @{text group} class
   3.321 +  with a corresponding instance:
   3.322 +*}
   3.323 +
   3.324 +class %quote group = monoidl +
   3.325 +  fixes inverse :: "\<alpha> \<Rightarrow> \<alpha>"    ("(_\<div>)" [1000] 999)
   3.326 +  assumes invl: "x\<div> \<otimes> x = \<one>"
   3.327 +
   3.328 +instantiation %quote int :: group
   3.329 +begin
   3.330 +
   3.331 +definition %quote
   3.332 +  inverse_int_def: "i\<div> = - (i\<Colon>int)"
   3.333 +
   3.334 +instance %quote proof
   3.335 +  fix i :: int
   3.336 +  have "-i + i = 0" by simp
   3.337 +  then show "i\<div> \<otimes> i = \<one>"
   3.338 +    unfolding mult_int_def neutral_int_def inverse_int_def .
   3.339 +qed
   3.340 +
   3.341 +end %quote
   3.342 +
   3.343 +
   3.344 +section {* Type classes as locales *}
   3.345 +
   3.346 +subsection {* A look behind the scene *}
   3.347 +
   3.348 +text {*
   3.349 +  The example above gives an impression how Isar type classes work
   3.350 +  in practice.  As stated in the introduction, classes also provide
   3.351 +  a link to Isar's locale system.  Indeed, the logical core of a class
   3.352 +  is nothing else than a locale:
   3.353 +*}
   3.354 +
   3.355 +class %quote idem =
   3.356 +  fixes f :: "\<alpha> \<Rightarrow> \<alpha>"
   3.357 +  assumes idem: "f (f x) = f x"
   3.358 +
   3.359 +text {*
   3.360 +  \noindent essentially introduces the locale
   3.361 +*} setup %invisible {* Sign.add_path "foo" *}
   3.362 +
   3.363 +locale %quote idem =
   3.364 +  fixes f :: "\<alpha> \<Rightarrow> \<alpha>"
   3.365 +  assumes idem: "f (f x) = f x"
   3.366 +
   3.367 +text {* \noindent together with corresponding constant(s): *}
   3.368 +
   3.369 +consts %quote f :: "\<alpha> \<Rightarrow> \<alpha>"
   3.370 +
   3.371 +text {*
   3.372 +  \noindent The connection to the type system is done by means
   3.373 +  of a primitive axclass
   3.374 +*} setup %invisible {* Sign.add_path "foo" *}
   3.375 +
   3.376 +axclass %quote idem < type
   3.377 +  idem: "f (f x) = f x" setup %invisible {* Sign.parent_path *}
   3.378 +
   3.379 +text {* \noindent together with a corresponding interpretation: *}
   3.380 +
   3.381 +interpretation %quote idem_class:
   3.382 +  idem "f \<Colon> (\<alpha>\<Colon>idem) \<Rightarrow> \<alpha>"
   3.383 +proof qed (rule idem)
   3.384 +
   3.385 +text {*
   3.386 +  \noindent This gives you at hand the full power of the Isabelle module system;
   3.387 +  conclusions in locale @{text idem} are implicitly propagated
   3.388 +  to class @{text idem}.
   3.389 +*} setup %invisible {* Sign.parent_path *}
   3.390 +
   3.391 +subsection {* Abstract reasoning *}
   3.392 +
   3.393 +text {*
   3.394 +  Isabelle locales enable reasoning at a general level, while results
   3.395 +  are implicitly transferred to all instances.  For example, we can
   3.396 +  now establish the @{text "left_cancel"} lemma for groups, which
   3.397 +  states that the function @{text "(x \<otimes>)"} is injective:
   3.398 +*}
   3.399 +
   3.400 +lemma %quote (in group) left_cancel: "x \<otimes> y = x \<otimes> z \<longleftrightarrow> y = z"
   3.401 +proof
   3.402 +  assume "x \<otimes> y = x \<otimes> z"
   3.403 +  then have "x\<div> \<otimes> (x \<otimes> y) = x\<div> \<otimes> (x \<otimes> z)" by simp
   3.404 +  then have "(x\<div> \<otimes> x) \<otimes> y = (x\<div> \<otimes> x) \<otimes> z" using assoc by simp
   3.405 +  then show "y = z" using neutl and invl by simp
   3.406 +next
   3.407 +  assume "y = z"
   3.408 +  then show "x \<otimes> y = x \<otimes> z" by simp
   3.409 +qed
   3.410 +
   3.411 +text {*
   3.412 +  \noindent Here the \qt{@{keyword "in"} @{class group}} target specification
   3.413 +  indicates that the result is recorded within that context for later
   3.414 +  use.  This local theorem is also lifted to the global one @{fact
   3.415 +  "group.left_cancel:"} @{prop [source] "\<And>x y z \<Colon> \<alpha>\<Colon>group. x \<otimes> y = x \<otimes>
   3.416 +  z \<longleftrightarrow> y = z"}.  Since type @{text "int"} has been made an instance of
   3.417 +  @{text "group"} before, we may refer to that fact as well: @{prop
   3.418 +  [source] "\<And>x y z \<Colon> int. x \<otimes> y = x \<otimes> z \<longleftrightarrow> y = z"}.
   3.419 +*}
   3.420 +
   3.421 +
   3.422 +subsection {* Derived definitions *}
   3.423 +
   3.424 +text {*
   3.425 +  Isabelle locales support a concept of local definitions
   3.426 +  in locales:
   3.427 +*}
   3.428 +
   3.429 +primrec %quote (in monoid) pow_nat :: "nat \<Rightarrow> \<alpha> \<Rightarrow> \<alpha>" where
   3.430 +  "pow_nat 0 x = \<one>"
   3.431 +  | "pow_nat (Suc n) x = x \<otimes> pow_nat n x"
   3.432 +
   3.433 +text {*
   3.434 +  \noindent If the locale @{text group} is also a class, this local
   3.435 +  definition is propagated onto a global definition of
   3.436 +  @{term [source] "pow_nat \<Colon> nat \<Rightarrow> \<alpha>\<Colon>monoid \<Rightarrow> \<alpha>\<Colon>monoid"}
   3.437 +  with corresponding theorems
   3.438 +
   3.439 +  @{thm pow_nat.simps [no_vars]}.
   3.440 +
   3.441 +  \noindent As you can see from this example, for local
   3.442 +  definitions you may use any specification tool
   3.443 +  which works together with locales (e.g. \cite{krauss2006}).
   3.444 +*}
   3.445 +
   3.446 +
   3.447 +subsection {* A functor analogy *}
   3.448 +
   3.449 +text {*
   3.450 +  We introduced Isar classes by analogy to type classes
   3.451 +  functional programming;  if we reconsider this in the
   3.452 +  context of what has been said about type classes and locales,
   3.453 +  we can drive this analogy further by stating that type
   3.454 +  classes essentially correspond to functors which have
   3.455 +  a canonical interpretation as type classes.
   3.456 +  Anyway, there is also the possibility of other interpretations.
   3.457 +  For example, also @{text list}s form a monoid with
   3.458 +  @{text append} and @{term "[]"} as operations, but it
   3.459 +  seems inappropriate to apply to lists
   3.460 +  the same operations as for genuinely algebraic types.
   3.461 +  In such a case, we simply can do a particular interpretation
   3.462 +  of monoids for lists:
   3.463 +*}
   3.464 +
   3.465 +interpretation %quote list_monoid!: monoid append "[]"
   3.466 +  proof qed auto
   3.467 +
   3.468 +text {*
   3.469 +  \noindent This enables us to apply facts on monoids
   3.470 +  to lists, e.g. @{thm list_monoid.neutl [no_vars]}.
   3.471 +
   3.472 +  When using this interpretation pattern, it may also
   3.473 +  be appropriate to map derived definitions accordingly:
   3.474 +*}
   3.475 +
   3.476 +primrec %quote replicate :: "nat \<Rightarrow> \<alpha> list \<Rightarrow> \<alpha> list" where
   3.477 +  "replicate 0 _ = []"
   3.478 +  | "replicate (Suc n) xs = xs @ replicate n xs"
   3.479 +
   3.480 +interpretation %quote list_monoid!: monoid append "[]" where
   3.481 +  "monoid.pow_nat append [] = replicate"
   3.482 +proof -
   3.483 +  interpret monoid append "[]" ..
   3.484 +  show "monoid.pow_nat append [] = replicate"
   3.485 +  proof
   3.486 +    fix n
   3.487 +    show "monoid.pow_nat append [] n = replicate n"
   3.488 +      by (induct n) auto
   3.489 +  qed
   3.490 +qed intro_locales
   3.491 +
   3.492 +
   3.493 +subsection {* Additional subclass relations *}
   3.494 +
   3.495 +text {*
   3.496 +  Any @{text "group"} is also a @{text "monoid"};  this
   3.497 +  can be made explicit by claiming an additional
   3.498 +  subclass relation,
   3.499 +  together with a proof of the logical difference:
   3.500 +*}
   3.501 +
   3.502 +subclass %quote (in group) monoid
   3.503 +proof
   3.504 +  fix x
   3.505 +  from invl have "x\<div> \<otimes> x = \<one>" by simp
   3.506 +  with assoc [symmetric] neutl invl have "x\<div> \<otimes> (x \<otimes> \<one>) = x\<div> \<otimes> x" by simp
   3.507 +  with left_cancel show "x \<otimes> \<one> = x" by simp
   3.508 +qed
   3.509 +
   3.510 +text {*
   3.511 +  \noindent The logical proof is carried out on the locale level.
   3.512 +  Afterwards it is propagated
   3.513 +  to the type system, making @{text group} an instance of
   3.514 +  @{text monoid} by adding an additional edge
   3.515 +  to the graph of subclass relations
   3.516 +  (cf.\ \figref{fig:subclass}).
   3.517 +
   3.518 +  \begin{figure}[htbp]
   3.519 +   \begin{center}
   3.520 +     \small
   3.521 +     \unitlength 0.6mm
   3.522 +     \begin{picture}(40,60)(0,0)
   3.523 +       \put(20,60){\makebox(0,0){@{text semigroup}}}
   3.524 +       \put(20,40){\makebox(0,0){@{text monoidl}}}
   3.525 +       \put(00,20){\makebox(0,0){@{text monoid}}}
   3.526 +       \put(40,00){\makebox(0,0){@{text group}}}
   3.527 +       \put(20,55){\vector(0,-1){10}}
   3.528 +       \put(15,35){\vector(-1,-1){10}}
   3.529 +       \put(25,35){\vector(1,-3){10}}
   3.530 +     \end{picture}
   3.531 +     \hspace{8em}
   3.532 +     \begin{picture}(40,60)(0,0)
   3.533 +       \put(20,60){\makebox(0,0){@{text semigroup}}}
   3.534 +       \put(20,40){\makebox(0,0){@{text monoidl}}}
   3.535 +       \put(00,20){\makebox(0,0){@{text monoid}}}
   3.536 +       \put(40,00){\makebox(0,0){@{text group}}}
   3.537 +       \put(20,55){\vector(0,-1){10}}
   3.538 +       \put(15,35){\vector(-1,-1){10}}
   3.539 +       \put(05,15){\vector(3,-1){30}}
   3.540 +     \end{picture}
   3.541 +     \caption{Subclass relationship of monoids and groups:
   3.542 +        before and after establishing the relationship
   3.543 +        @{text "group \<subseteq> monoid"};  transitive edges are left out.}
   3.544 +     \label{fig:subclass}
   3.545 +   \end{center}
   3.546 +  \end{figure}
   3.547 +7
   3.548 +  For illustration, a derived definition
   3.549 +  in @{text group} which uses @{text pow_nat}:
   3.550 +*}
   3.551 +
   3.552 +definition %quote (in group) pow_int :: "int \<Rightarrow> \<alpha> \<Rightarrow> \<alpha>" where
   3.553 +  "pow_int k x = (if k >= 0
   3.554 +    then pow_nat (nat k) x
   3.555 +    else (pow_nat (nat (- k)) x)\<div>)"
   3.556 +
   3.557 +text {*
   3.558 +  \noindent yields the global definition of
   3.559 +  @{term [source] "pow_int \<Colon> int \<Rightarrow> \<alpha>\<Colon>group \<Rightarrow> \<alpha>\<Colon>group"}
   3.560 +  with the corresponding theorem @{thm pow_int_def [no_vars]}.
   3.561 +*}
   3.562 +
   3.563 +subsection {* A note on syntax *}
   3.564 +
   3.565 +text {*
   3.566 +  As a commodity, class context syntax allows to refer
   3.567 +  to local class operations and their global counterparts
   3.568 +  uniformly;  type inference resolves ambiguities.  For example:
   3.569 +*}
   3.570 +
   3.571 +context %quote semigroup
   3.572 +begin
   3.573 +
   3.574 +term %quote "x \<otimes> y" -- {* example 1 *}
   3.575 +term %quote "(x\<Colon>nat) \<otimes> y" -- {* example 2 *}
   3.576 +
   3.577 +end  %quote
   3.578 +
   3.579 +term %quote "x \<otimes> y" -- {* example 3 *}
   3.580 +
   3.581 +text {*
   3.582 +  \noindent Here in example 1, the term refers to the local class operation
   3.583 +  @{text "mult [\<alpha>]"}, whereas in example 2 the type constraint
   3.584 +  enforces the global class operation @{text "mult [nat]"}.
   3.585 +  In the global context in example 3, the reference is
   3.586 +  to the polymorphic global class operation @{text "mult [?\<alpha> \<Colon> semigroup]"}.
   3.587 +*}
   3.588 +
   3.589 +section {* Further issues *}
   3.590 +
   3.591 +subsection {* Type classes and code generation *}
   3.592 +
   3.593 +text {*
   3.594 +  Turning back to the first motivation for type classes,
   3.595 +  namely overloading, it is obvious that overloading
   3.596 +  stemming from @{command class} statements and
   3.597 +  @{command instantiation}
   3.598 +  targets naturally maps to Haskell type classes.
   3.599 +  The code generator framework \cite{isabelle-codegen} 
   3.600 +  takes this into account.  Concerning target languages
   3.601 +  lacking type classes (e.g.~SML), type classes
   3.602 +  are implemented by explicit dictionary construction.
   3.603 +  As example, let's go back to the power function:
   3.604 +*}
   3.605 +
   3.606 +definition %quote example :: int where
   3.607 +  "example = pow_int 10 (-2)"
   3.608 +
   3.609 +text {*
   3.610 +  \noindent This maps to Haskell as:
   3.611 +*}
   3.612 +
   3.613 +text %quote {*@{code_stmts example (Haskell)}*}
   3.614 +
   3.615 +text {*
   3.616 +  \noindent The whole code in SML with explicit dictionary passing:
   3.617 +*}
   3.618 +
   3.619 +text %quote {*@{code_stmts example (SML)}*}
   3.620 +
   3.621 +subsection {* Inspecting the type class universe *}
   3.622 +
   3.623 +text {*
   3.624 +  To facilitate orientation in complex subclass structures,
   3.625 +  two diagnostics commands are provided:
   3.626 +
   3.627 +  \begin{description}
   3.628 +
   3.629 +    \item[@{command "print_classes"}] print a list of all classes
   3.630 +      together with associated operations etc.
   3.631 +
   3.632 +    \item[@{command "class_deps"}] visualizes the subclass relation
   3.633 +      between all classes as a Hasse diagram.
   3.634 +
   3.635 +  \end{description}
   3.636 +*}
   3.637 +
   3.638 +end
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/doc-src/Classes/Thy/ROOT.ML	Tue Mar 03 11:00:51 2009 +0100
     4.3 @@ -0,0 +1,6 @@
     4.4 +
     4.5 +(* $Id$ *)
     4.6 +
     4.7 +no_document use_thy "Setup";
     4.8 +
     4.9 +use_thy "Classes";
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/doc-src/Classes/Thy/Setup.thy	Tue Mar 03 11:00:51 2009 +0100
     5.3 @@ -0,0 +1,34 @@
     5.4 +theory Setup
     5.5 +imports Main Code_Integer
     5.6 +uses
     5.7 +  "../../../antiquote_setup"
     5.8 +  "../../../more_antiquote"
     5.9 +begin
    5.10 +
    5.11 +ML {* Code_Target.code_width := 74 *}
    5.12 +
    5.13 +syntax
    5.14 +  "_alpha" :: "type"  ("\<alpha>")
    5.15 +  "_alpha_ofsort" :: "sort \<Rightarrow> type"  ("\<alpha>()\<Colon>_" [0] 1000)
    5.16 +  "_beta" :: "type"  ("\<beta>")
    5.17 +  "_beta_ofsort" :: "sort \<Rightarrow> type"  ("\<beta>()\<Colon>_" [0] 1000)
    5.18 +
    5.19 +parse_ast_translation {*
    5.20 +  let
    5.21 +    fun alpha_ast_tr [] = Syntax.Variable "'a"
    5.22 +      | alpha_ast_tr asts = raise Syntax.AST ("alpha_ast_tr", asts);
    5.23 +    fun alpha_ofsort_ast_tr [ast] =
    5.24 +      Syntax.Appl [Syntax.Constant "_ofsort", Syntax.Variable "'a", ast]
    5.25 +      | alpha_ofsort_ast_tr asts = raise Syntax.AST ("alpha_ast_tr", asts);
    5.26 +    fun beta_ast_tr [] = Syntax.Variable "'b"
    5.27 +      | beta_ast_tr asts = raise Syntax.AST ("beta_ast_tr", asts);
    5.28 +    fun beta_ofsort_ast_tr [ast] =
    5.29 +      Syntax.Appl [Syntax.Constant "_ofsort", Syntax.Variable "'b", ast]
    5.30 +      | beta_ofsort_ast_tr asts = raise Syntax.AST ("beta_ast_tr", asts);
    5.31 +  in [
    5.32 +    ("_alpha", alpha_ast_tr), ("_alpha_ofsort", alpha_ofsort_ast_tr),
    5.33 +    ("_beta", beta_ast_tr), ("_beta_ofsort", beta_ofsort_ast_tr)
    5.34 +  ] end
    5.35 +*}
    5.36 +
    5.37 +end
    5.38 \ No newline at end of file
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/doc-src/Classes/Thy/document/Classes.tex	Tue Mar 03 11:00:51 2009 +0100
     6.3 @@ -0,0 +1,1346 @@
     6.4 +%
     6.5 +\begin{isabellebody}%
     6.6 +\def\isabellecontext{Classes}%
     6.7 +%
     6.8 +\isadelimtheory
     6.9 +%
    6.10 +\endisadelimtheory
    6.11 +%
    6.12 +\isatagtheory
    6.13 +\isacommand{theory}\isamarkupfalse%
    6.14 +\ Classes\isanewline
    6.15 +\isakeyword{imports}\ Main\ Setup\isanewline
    6.16 +\isakeyword{begin}%
    6.17 +\endisatagtheory
    6.18 +{\isafoldtheory}%
    6.19 +%
    6.20 +\isadelimtheory
    6.21 +%
    6.22 +\endisadelimtheory
    6.23 +%
    6.24 +\isamarkupchapter{Haskell-style classes with Isabelle/Isar%
    6.25 +}
    6.26 +\isamarkuptrue%
    6.27 +%
    6.28 +\isamarkupsection{Introduction%
    6.29 +}
    6.30 +\isamarkuptrue%
    6.31 +%
    6.32 +\begin{isamarkuptext}%
    6.33 +Type classes were introduces by Wadler and Blott \cite{wadler89how}
    6.34 +  into the Haskell language, to allow for a reasonable implementation
    6.35 +  of overloading\footnote{throughout this tutorial, we are referring
    6.36 +  to classical Haskell 1.0 type classes, not considering
    6.37 +  later additions in expressiveness}.
    6.38 +  As a canonical example, a polymorphic equality function
    6.39 +  \isa{eq\ {\isasymColon}\ {\isasymalpha}\ {\isasymRightarrow}\ {\isasymalpha}\ {\isasymRightarrow}\ bool} which is overloaded on different
    6.40 +  types for \isa{{\isasymalpha}}, which is achieved by splitting introduction
    6.41 +  of the \isa{eq} function from its overloaded definitions by means
    6.42 +  of \isa{class} and \isa{instance} declarations:
    6.43 +
    6.44 +  \begin{quote}
    6.45 +
    6.46 +  \noindent\isa{class\ eq\ where}\footnote{syntax here is a kind of isabellized Haskell} \\
    6.47 +  \hspace*{2ex}\isa{eq\ {\isasymColon}\ {\isasymalpha}\ {\isasymRightarrow}\ {\isasymalpha}\ {\isasymRightarrow}\ bool}
    6.48 +
    6.49 +  \medskip\noindent\isa{instance\ nat\ {\isasymColon}\ eq\ where} \\
    6.50 +  \hspace*{2ex}\isa{eq\ {\isadigit{0}}\ {\isadigit{0}}\ {\isacharequal}\ True} \\
    6.51 +  \hspace*{2ex}\isa{eq\ {\isadigit{0}}\ {\isacharunderscore}\ {\isacharequal}\ False} \\
    6.52 +  \hspace*{2ex}\isa{eq\ {\isacharunderscore}\ {\isadigit{0}}\ {\isacharequal}\ False} \\
    6.53 +  \hspace*{2ex}\isa{eq\ {\isacharparenleft}Suc\ n{\isacharparenright}\ {\isacharparenleft}Suc\ m{\isacharparenright}\ {\isacharequal}\ eq\ n\ m}
    6.54 +
    6.55 +  \medskip\noindent\isa{instance\ {\isacharparenleft}{\isasymalpha}{\isasymColon}eq{\isacharcomma}\ {\isasymbeta}{\isasymColon}eq{\isacharparenright}\ pair\ {\isasymColon}\ eq\ where} \\
    6.56 +  \hspace*{2ex}\isa{eq\ {\isacharparenleft}x{\isadigit{1}}{\isacharcomma}\ y{\isadigit{1}}{\isacharparenright}\ {\isacharparenleft}x{\isadigit{2}}{\isacharcomma}\ y{\isadigit{2}}{\isacharparenright}\ {\isacharequal}\ eq\ x{\isadigit{1}}\ x{\isadigit{2}}\ {\isasymand}\ eq\ y{\isadigit{1}}\ y{\isadigit{2}}}
    6.57 +
    6.58 +  \medskip\noindent\isa{class\ ord\ extends\ eq\ where} \\
    6.59 +  \hspace*{2ex}\isa{less{\isacharunderscore}eq\ {\isasymColon}\ {\isasymalpha}\ {\isasymRightarrow}\ {\isasymalpha}\ {\isasymRightarrow}\ bool} \\
    6.60 +  \hspace*{2ex}\isa{less\ {\isasymColon}\ {\isasymalpha}\ {\isasymRightarrow}\ {\isasymalpha}\ {\isasymRightarrow}\ bool}
    6.61 +
    6.62 +  \end{quote}
    6.63 +
    6.64 +  \noindent Type variables are annotated with (finitely many) classes;
    6.65 +  these annotations are assertions that a particular polymorphic type
    6.66 +  provides definitions for overloaded functions.
    6.67 +
    6.68 +  Indeed, type classes not only allow for simple overloading
    6.69 +  but form a generic calculus, an instance of order-sorted
    6.70 +  algebra \cite{Nipkow-Prehofer:1993,nipkow-sorts93,Wenzel:1997:TPHOL}.
    6.71 +
    6.72 +  From a software engeneering point of view, type classes
    6.73 +  roughly correspond to interfaces in object-oriented languages like Java;
    6.74 +  so, it is naturally desirable that type classes do not only
    6.75 +  provide functions (class parameters) but also state specifications
    6.76 +  implementations must obey.  For example, the \isa{class\ eq}
    6.77 +  above could be given the following specification, demanding that
    6.78 +  \isa{class\ eq} is an equivalence relation obeying reflexivity,
    6.79 +  symmetry and transitivity:
    6.80 +
    6.81 +  \begin{quote}
    6.82 +
    6.83 +  \noindent\isa{class\ eq\ where} \\
    6.84 +  \hspace*{2ex}\isa{eq\ {\isasymColon}\ {\isasymalpha}\ {\isasymRightarrow}\ {\isasymalpha}\ {\isasymRightarrow}\ bool} \\
    6.85 +  \isa{satisfying} \\
    6.86 +  \hspace*{2ex}\isa{refl{\isacharcolon}\ eq\ x\ x} \\
    6.87 +  \hspace*{2ex}\isa{sym{\isacharcolon}\ eq\ x\ y\ {\isasymlongleftrightarrow}\ eq\ x\ y} \\
    6.88 +  \hspace*{2ex}\isa{trans{\isacharcolon}\ eq\ x\ y\ {\isasymand}\ eq\ y\ z\ {\isasymlongrightarrow}\ eq\ x\ z}
    6.89 +
    6.90 +  \end{quote}
    6.91 +
    6.92 +  \noindent From a theoretic point of view, type classes are lightweight
    6.93 +  modules; Haskell type classes may be emulated by
    6.94 +  SML functors \cite{classes_modules}. 
    6.95 +  Isabelle/Isar offers a discipline of type classes which brings
    6.96 +  all those aspects together:
    6.97 +
    6.98 +  \begin{enumerate}
    6.99 +    \item specifying abstract parameters together with
   6.100 +       corresponding specifications,
   6.101 +    \item instantiating those abstract parameters by a particular
   6.102 +       type
   6.103 +    \item in connection with a ``less ad-hoc'' approach to overloading,
   6.104 +    \item with a direct link to the Isabelle module system
   6.105 +      (aka locales \cite{kammueller-locales}).
   6.106 +  \end{enumerate}
   6.107 +
   6.108 +  \noindent Isar type classes also directly support code generation
   6.109 +  in a Haskell like fashion.
   6.110 +
   6.111 +  This tutorial demonstrates common elements of structured specifications
   6.112 +  and abstract reasoning with type classes by the algebraic hierarchy of
   6.113 +  semigroups, monoids and groups.  Our background theory is that of
   6.114 +  Isabelle/HOL \cite{isa-tutorial}, for which some
   6.115 +  familiarity is assumed.
   6.116 +
   6.117 +  Here we merely present the look-and-feel for end users.
   6.118 +  Internally, those are mapped to more primitive Isabelle concepts.
   6.119 +  See \cite{Haftmann-Wenzel:2006:classes} for more detail.%
   6.120 +\end{isamarkuptext}%
   6.121 +\isamarkuptrue%
   6.122 +%
   6.123 +\isamarkupsection{A simple algebra example \label{sec:example}%
   6.124 +}
   6.125 +\isamarkuptrue%
   6.126 +%
   6.127 +\isamarkupsubsection{Class definition%
   6.128 +}
   6.129 +\isamarkuptrue%
   6.130 +%
   6.131 +\begin{isamarkuptext}%
   6.132 +Depending on an arbitrary type \isa{{\isasymalpha}}, class \isa{semigroup} introduces a binary operator \isa{{\isacharparenleft}{\isasymotimes}{\isacharparenright}} that is
   6.133 +  assumed to be associative:%
   6.134 +\end{isamarkuptext}%
   6.135 +\isamarkuptrue%
   6.136 +%
   6.137 +\isadelimquote
   6.138 +%
   6.139 +\endisadelimquote
   6.140 +%
   6.141 +\isatagquote
   6.142 +\isacommand{class}\isamarkupfalse%
   6.143 +\ semigroup\ {\isacharequal}\isanewline
   6.144 +\ \ \isakeyword{fixes}\ mult\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isasymalpha}\ {\isasymRightarrow}\ {\isasymalpha}\ {\isasymRightarrow}\ {\isasymalpha}{\isachardoublequoteclose}\ \ \ \ {\isacharparenleft}\isakeyword{infixl}\ {\isachardoublequoteopen}{\isasymotimes}{\isachardoublequoteclose}\ {\isadigit{7}}{\isadigit{0}}{\isacharparenright}\isanewline
   6.145 +\ \ \isakeyword{assumes}\ assoc{\isacharcolon}\ {\isachardoublequoteopen}{\isacharparenleft}x\ {\isasymotimes}\ y{\isacharparenright}\ {\isasymotimes}\ z\ {\isacharequal}\ x\ {\isasymotimes}\ {\isacharparenleft}y\ {\isasymotimes}\ z{\isacharparenright}{\isachardoublequoteclose}%
   6.146 +\endisatagquote
   6.147 +{\isafoldquote}%
   6.148 +%
   6.149 +\isadelimquote
   6.150 +%
   6.151 +\endisadelimquote
   6.152 +%
   6.153 +\begin{isamarkuptext}%
   6.154 +\noindent This \hyperlink{command.class}{\mbox{\isa{\isacommand{class}}}} specification consists of two
   6.155 +  parts: the \qn{operational} part names the class parameter
   6.156 +  (\hyperlink{element.fixes}{\mbox{\isa{\isakeyword{fixes}}}}), the \qn{logical} part specifies properties on them
   6.157 +  (\hyperlink{element.assumes}{\mbox{\isa{\isakeyword{assumes}}}}).  The local \hyperlink{element.fixes}{\mbox{\isa{\isakeyword{fixes}}}} and
   6.158 +  \hyperlink{element.assumes}{\mbox{\isa{\isakeyword{assumes}}}} are lifted to the theory toplevel,
   6.159 +  yielding the global
   6.160 +  parameter \isa{{\isachardoublequote}mult\ {\isasymColon}\ {\isasymalpha}{\isasymColon}semigroup\ {\isasymRightarrow}\ {\isasymalpha}\ {\isasymRightarrow}\ {\isasymalpha}{\isachardoublequote}} and the
   6.161 +  global theorem \hyperlink{fact.semigroup.assoc:}{\mbox{\isa{semigroup{\isachardot}assoc{\isacharcolon}}}}~\isa{{\isachardoublequote}{\isasymAnd}x\ y\ z\ {\isasymColon}\ {\isasymalpha}{\isasymColon}semigroup{\isachardot}\ {\isacharparenleft}x\ {\isasymotimes}\ y{\isacharparenright}\ {\isasymotimes}\ z\ {\isacharequal}\ x\ {\isasymotimes}\ {\isacharparenleft}y\ {\isasymotimes}\ z{\isacharparenright}{\isachardoublequote}}.%
   6.162 +\end{isamarkuptext}%
   6.163 +\isamarkuptrue%
   6.164 +%
   6.165 +\isamarkupsubsection{Class instantiation \label{sec:class_inst}%
   6.166 +}
   6.167 +\isamarkuptrue%
   6.168 +%
   6.169 +\begin{isamarkuptext}%
   6.170 +The concrete type \isa{int} is made a \isa{semigroup}
   6.171 +  instance by providing a suitable definition for the class parameter
   6.172 +  \isa{{\isacharparenleft}{\isasymotimes}{\isacharparenright}} and a proof for the specification of \hyperlink{fact.assoc}{\mbox{\isa{assoc}}}.
   6.173 +  This is accomplished by the \hyperlink{command.instantiation}{\mbox{\isa{\isacommand{instantiation}}}} target:%
   6.174 +\end{isamarkuptext}%
   6.175 +\isamarkuptrue%
   6.176 +%
   6.177 +\isadelimquote
   6.178 +%
   6.179 +\endisadelimquote
   6.180 +%
   6.181 +\isatagquote
   6.182 +\isacommand{instantiation}\isamarkupfalse%
   6.183 +\ int\ {\isacharcolon}{\isacharcolon}\ semigroup\isanewline
   6.184 +\isakeyword{begin}\isanewline
   6.185 +\isanewline
   6.186 +\isacommand{definition}\isamarkupfalse%
   6.187 +\isanewline
   6.188 +\ \ mult{\isacharunderscore}int{\isacharunderscore}def{\isacharcolon}\ {\isachardoublequoteopen}i\ {\isasymotimes}\ j\ {\isacharequal}\ i\ {\isacharplus}\ {\isacharparenleft}j{\isasymColon}int{\isacharparenright}{\isachardoublequoteclose}\isanewline
   6.189 +\isanewline
   6.190 +\isacommand{instance}\isamarkupfalse%
   6.191 +\ \isacommand{proof}\isamarkupfalse%
   6.192 +\isanewline
   6.193 +\ \ \isacommand{fix}\isamarkupfalse%
   6.194 +\ i\ j\ k\ {\isacharcolon}{\isacharcolon}\ int\ \isacommand{have}\isamarkupfalse%
   6.195 +\ {\isachardoublequoteopen}{\isacharparenleft}i\ {\isacharplus}\ j{\isacharparenright}\ {\isacharplus}\ k\ {\isacharequal}\ i\ {\isacharplus}\ {\isacharparenleft}j\ {\isacharplus}\ k{\isacharparenright}{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
   6.196 +\ simp\isanewline
   6.197 +\ \ \isacommand{then}\isamarkupfalse%
   6.198 +\ \isacommand{show}\isamarkupfalse%
   6.199 +\ {\isachardoublequoteopen}{\isacharparenleft}i\ {\isasymotimes}\ j{\isacharparenright}\ {\isasymotimes}\ k\ {\isacharequal}\ i\ {\isasymotimes}\ {\isacharparenleft}j\ {\isasymotimes}\ k{\isacharparenright}{\isachardoublequoteclose}\isanewline
   6.200 +\ \ \ \ \isacommand{unfolding}\isamarkupfalse%
   6.201 +\ mult{\isacharunderscore}int{\isacharunderscore}def\ \isacommand{{\isachardot}}\isamarkupfalse%
   6.202 +\isanewline
   6.203 +\isacommand{qed}\isamarkupfalse%
   6.204 +\isanewline
   6.205 +\isanewline
   6.206 +\isacommand{end}\isamarkupfalse%
   6.207 +%
   6.208 +\endisatagquote
   6.209 +{\isafoldquote}%
   6.210 +%
   6.211 +\isadelimquote
   6.212 +%
   6.213 +\endisadelimquote
   6.214 +%
   6.215 +\begin{isamarkuptext}%
   6.216 +\noindent \hyperlink{command.instantiation}{\mbox{\isa{\isacommand{instantiation}}}} allows to define class parameters
   6.217 +  at a particular instance using common specification tools (here,
   6.218 +  \hyperlink{command.definition}{\mbox{\isa{\isacommand{definition}}}}).  The concluding \hyperlink{command.instance}{\mbox{\isa{\isacommand{instance}}}}
   6.219 +  opens a proof that the given parameters actually conform
   6.220 +  to the class specification.  Note that the first proof step
   6.221 +  is the \hyperlink{method.default}{\mbox{\isa{default}}} method,
   6.222 +  which for such instance proofs maps to the \hyperlink{method.intro-classes}{\mbox{\isa{intro{\isacharunderscore}classes}}} method.
   6.223 +  This boils down an instance judgement to the relevant primitive
   6.224 +  proof goals and should conveniently always be the first method applied
   6.225 +  in an instantiation proof.
   6.226 +
   6.227 +  From now on, the type-checker will consider \isa{int}
   6.228 +  as a \isa{semigroup} automatically, i.e.\ any general results
   6.229 +  are immediately available on concrete instances.
   6.230 +
   6.231 +  \medskip Another instance of \isa{semigroup} are the natural numbers:%
   6.232 +\end{isamarkuptext}%
   6.233 +\isamarkuptrue%
   6.234 +%
   6.235 +\isadelimquote
   6.236 +%
   6.237 +\endisadelimquote
   6.238 +%
   6.239 +\isatagquote
   6.240 +\isacommand{instantiation}\isamarkupfalse%
   6.241 +\ nat\ {\isacharcolon}{\isacharcolon}\ semigroup\isanewline
   6.242 +\isakeyword{begin}\isanewline
   6.243 +\isanewline
   6.244 +\isacommand{primrec}\isamarkupfalse%
   6.245 +\ mult{\isacharunderscore}nat\ \isakeyword{where}\isanewline
   6.246 +\ \ {\isachardoublequoteopen}{\isacharparenleft}{\isadigit{0}}{\isasymColon}nat{\isacharparenright}\ {\isasymotimes}\ n\ {\isacharequal}\ n{\isachardoublequoteclose}\isanewline
   6.247 +\ \ {\isacharbar}\ {\isachardoublequoteopen}Suc\ m\ {\isasymotimes}\ n\ {\isacharequal}\ Suc\ {\isacharparenleft}m\ {\isasymotimes}\ n{\isacharparenright}{\isachardoublequoteclose}\isanewline
   6.248 +\isanewline
   6.249 +\isacommand{instance}\isamarkupfalse%
   6.250 +\ \isacommand{proof}\isamarkupfalse%
   6.251 +\isanewline
   6.252 +\ \ \isacommand{fix}\isamarkupfalse%
   6.253 +\ m\ n\ q\ {\isacharcolon}{\isacharcolon}\ nat\ \isanewline
   6.254 +\ \ \isacommand{show}\isamarkupfalse%
   6.255 +\ {\isachardoublequoteopen}m\ {\isasymotimes}\ n\ {\isasymotimes}\ q\ {\isacharequal}\ m\ {\isasymotimes}\ {\isacharparenleft}n\ {\isasymotimes}\ q{\isacharparenright}{\isachardoublequoteclose}\isanewline
   6.256 +\ \ \ \ \isacommand{by}\isamarkupfalse%
   6.257 +\ {\isacharparenleft}induct\ m{\isacharparenright}\ auto\isanewline
   6.258 +\isacommand{qed}\isamarkupfalse%
   6.259 +\isanewline
   6.260 +\isanewline
   6.261 +\isacommand{end}\isamarkupfalse%
   6.262 +%
   6.263 +\endisatagquote
   6.264 +{\isafoldquote}%
   6.265 +%
   6.266 +\isadelimquote
   6.267 +%
   6.268 +\endisadelimquote
   6.269 +%
   6.270 +\begin{isamarkuptext}%
   6.271 +\noindent Note the occurence of the name \isa{mult{\isacharunderscore}nat}
   6.272 +  in the primrec declaration;  by default, the local name of
   6.273 +  a class operation \isa{f} to instantiate on type constructor
   6.274 +  \isa{{\isasymkappa}} are mangled as \isa{f{\isacharunderscore}{\isasymkappa}}.  In case of uncertainty,
   6.275 +  these names may be inspected using the \hyperlink{command.print-context}{\mbox{\isa{\isacommand{print{\isacharunderscore}context}}}} command
   6.276 +  or the corresponding ProofGeneral button.%
   6.277 +\end{isamarkuptext}%
   6.278 +\isamarkuptrue%
   6.279 +%
   6.280 +\isamarkupsubsection{Lifting and parametric types%
   6.281 +}
   6.282 +\isamarkuptrue%
   6.283 +%
   6.284 +\begin{isamarkuptext}%
   6.285 +Overloaded definitions giving on class instantiation
   6.286 +  may include recursion over the syntactic structure of types.
   6.287 +  As a canonical example, we model product semigroups
   6.288 +  using our simple algebra:%
   6.289 +\end{isamarkuptext}%
   6.290 +\isamarkuptrue%
   6.291 +%
   6.292 +\isadelimquote
   6.293 +%
   6.294 +\endisadelimquote
   6.295 +%
   6.296 +\isatagquote
   6.297 +\isacommand{instantiation}\isamarkupfalse%
   6.298 +\ {\isacharasterisk}\ {\isacharcolon}{\isacharcolon}\ {\isacharparenleft}semigroup{\isacharcomma}\ semigroup{\isacharparenright}\ semigroup\isanewline
   6.299 +\isakeyword{begin}\isanewline
   6.300 +\isanewline
   6.301 +\isacommand{definition}\isamarkupfalse%
   6.302 +\isanewline
   6.303 +\ \ mult{\isacharunderscore}prod{\isacharunderscore}def{\isacharcolon}\ {\isachardoublequoteopen}p\isactrlisub {\isadigit{1}}\ {\isasymotimes}\ p\isactrlisub {\isadigit{2}}\ {\isacharequal}\ {\isacharparenleft}fst\ p\isactrlisub {\isadigit{1}}\ {\isasymotimes}\ fst\ p\isactrlisub {\isadigit{2}}{\isacharcomma}\ snd\ p\isactrlisub {\isadigit{1}}\ {\isasymotimes}\ snd\ p\isactrlisub {\isadigit{2}}{\isacharparenright}{\isachardoublequoteclose}\isanewline
   6.304 +\isanewline
   6.305 +\isacommand{instance}\isamarkupfalse%
   6.306 +\ \isacommand{proof}\isamarkupfalse%
   6.307 +\isanewline
   6.308 +\ \ \isacommand{fix}\isamarkupfalse%
   6.309 +\ p\isactrlisub {\isadigit{1}}\ p\isactrlisub {\isadigit{2}}\ p\isactrlisub {\isadigit{3}}\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isasymalpha}{\isasymColon}semigroup\ {\isasymtimes}\ {\isasymbeta}{\isasymColon}semigroup{\isachardoublequoteclose}\isanewline
   6.310 +\ \ \isacommand{show}\isamarkupfalse%
   6.311 +\ {\isachardoublequoteopen}p\isactrlisub {\isadigit{1}}\ {\isasymotimes}\ p\isactrlisub {\isadigit{2}}\ {\isasymotimes}\ p\isactrlisub {\isadigit{3}}\ {\isacharequal}\ p\isactrlisub {\isadigit{1}}\ {\isasymotimes}\ {\isacharparenleft}p\isactrlisub {\isadigit{2}}\ {\isasymotimes}\ p\isactrlisub {\isadigit{3}}{\isacharparenright}{\isachardoublequoteclose}\isanewline
   6.312 +\ \ \ \ \isacommand{unfolding}\isamarkupfalse%
   6.313 +\ mult{\isacharunderscore}prod{\isacharunderscore}def\ \isacommand{by}\isamarkupfalse%
   6.314 +\ {\isacharparenleft}simp\ add{\isacharcolon}\ assoc{\isacharparenright}\isanewline
   6.315 +\isacommand{qed}\isamarkupfalse%
   6.316 +\ \ \ \ \ \ \isanewline
   6.317 +\isanewline
   6.318 +\isacommand{end}\isamarkupfalse%
   6.319 +%
   6.320 +\endisatagquote
   6.321 +{\isafoldquote}%
   6.322 +%
   6.323 +\isadelimquote
   6.324 +%
   6.325 +\endisadelimquote
   6.326 +%
   6.327 +\begin{isamarkuptext}%
   6.328 +\noindent Associativity from product semigroups is
   6.329 +  established using
   6.330 +  the definition of \isa{{\isacharparenleft}{\isasymotimes}{\isacharparenright}} on products and the hypothetical
   6.331 +  associativity of the type components;  these hypotheses
   6.332 +  are facts due to the \isa{semigroup} constraints imposed
   6.333 +  on the type components by the \hyperlink{command.instance}{\mbox{\isa{\isacommand{instance}}}} proposition.
   6.334 +  Indeed, this pattern often occurs with parametric types
   6.335 +  and type classes.%
   6.336 +\end{isamarkuptext}%
   6.337 +\isamarkuptrue%
   6.338 +%
   6.339 +\isamarkupsubsection{Subclassing%
   6.340 +}
   6.341 +\isamarkuptrue%
   6.342 +%
   6.343 +\begin{isamarkuptext}%
   6.344 +We define a subclass \isa{monoidl} (a semigroup with a left-hand neutral)
   6.345 +  by extending \isa{semigroup}
   6.346 +  with one additional parameter \isa{neutral} together
   6.347 +  with its property:%
   6.348 +\end{isamarkuptext}%
   6.349 +\isamarkuptrue%
   6.350 +%
   6.351 +\isadelimquote
   6.352 +%
   6.353 +\endisadelimquote
   6.354 +%
   6.355 +\isatagquote
   6.356 +\isacommand{class}\isamarkupfalse%
   6.357 +\ monoidl\ {\isacharequal}\ semigroup\ {\isacharplus}\isanewline
   6.358 +\ \ \isakeyword{fixes}\ neutral\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isasymalpha}{\isachardoublequoteclose}\ {\isacharparenleft}{\isachardoublequoteopen}{\isasymone}{\isachardoublequoteclose}{\isacharparenright}\isanewline
   6.359 +\ \ \isakeyword{assumes}\ neutl{\isacharcolon}\ {\isachardoublequoteopen}{\isasymone}\ {\isasymotimes}\ x\ {\isacharequal}\ x{\isachardoublequoteclose}%
   6.360 +\endisatagquote
   6.361 +{\isafoldquote}%
   6.362 +%
   6.363 +\isadelimquote
   6.364 +%
   6.365 +\endisadelimquote
   6.366 +%
   6.367 +\begin{isamarkuptext}%
   6.368 +\noindent Again, we prove some instances, by
   6.369 +  providing suitable parameter definitions and proofs for the
   6.370 +  additional specifications.  Observe that instantiations
   6.371 +  for types with the same arity may be simultaneous:%
   6.372 +\end{isamarkuptext}%
   6.373 +\isamarkuptrue%
   6.374 +%
   6.375 +\isadelimquote
   6.376 +%
   6.377 +\endisadelimquote
   6.378 +%
   6.379 +\isatagquote
   6.380 +\isacommand{instantiation}\isamarkupfalse%
   6.381 +\ nat\ \isakeyword{and}\ int\ {\isacharcolon}{\isacharcolon}\ monoidl\isanewline
   6.382 +\isakeyword{begin}\isanewline
   6.383 +\isanewline
   6.384 +\isacommand{definition}\isamarkupfalse%
   6.385 +\isanewline
   6.386 +\ \ neutral{\isacharunderscore}nat{\isacharunderscore}def{\isacharcolon}\ {\isachardoublequoteopen}{\isasymone}\ {\isacharequal}\ {\isacharparenleft}{\isadigit{0}}{\isasymColon}nat{\isacharparenright}{\isachardoublequoteclose}\isanewline
   6.387 +\isanewline
   6.388 +\isacommand{definition}\isamarkupfalse%
   6.389 +\isanewline
   6.390 +\ \ neutral{\isacharunderscore}int{\isacharunderscore}def{\isacharcolon}\ {\isachardoublequoteopen}{\isasymone}\ {\isacharequal}\ {\isacharparenleft}{\isadigit{0}}{\isasymColon}int{\isacharparenright}{\isachardoublequoteclose}\isanewline
   6.391 +\isanewline
   6.392 +\isacommand{instance}\isamarkupfalse%
   6.393 +\ \isacommand{proof}\isamarkupfalse%
   6.394 +\isanewline
   6.395 +\ \ \isacommand{fix}\isamarkupfalse%
   6.396 +\ n\ {\isacharcolon}{\isacharcolon}\ nat\isanewline
   6.397 +\ \ \isacommand{show}\isamarkupfalse%
   6.398 +\ {\isachardoublequoteopen}{\isasymone}\ {\isasymotimes}\ n\ {\isacharequal}\ n{\isachardoublequoteclose}\isanewline
   6.399 +\ \ \ \ \isacommand{unfolding}\isamarkupfalse%
   6.400 +\ neutral{\isacharunderscore}nat{\isacharunderscore}def\ \isacommand{by}\isamarkupfalse%
   6.401 +\ simp\isanewline
   6.402 +\isacommand{next}\isamarkupfalse%
   6.403 +\isanewline
   6.404 +\ \ \isacommand{fix}\isamarkupfalse%
   6.405 +\ k\ {\isacharcolon}{\isacharcolon}\ int\isanewline
   6.406 +\ \ \isacommand{show}\isamarkupfalse%
   6.407 +\ {\isachardoublequoteopen}{\isasymone}\ {\isasymotimes}\ k\ {\isacharequal}\ k{\isachardoublequoteclose}\isanewline
   6.408 +\ \ \ \ \isacommand{unfolding}\isamarkupfalse%
   6.409 +\ neutral{\isacharunderscore}int{\isacharunderscore}def\ mult{\isacharunderscore}int{\isacharunderscore}def\ \isacommand{by}\isamarkupfalse%
   6.410 +\ simp\isanewline
   6.411 +\isacommand{qed}\isamarkupfalse%
   6.412 +\isanewline
   6.413 +\isanewline
   6.414 +\isacommand{end}\isamarkupfalse%
   6.415 +\isanewline
   6.416 +\isanewline
   6.417 +\isacommand{instantiation}\isamarkupfalse%
   6.418 +\ {\isacharasterisk}\ {\isacharcolon}{\isacharcolon}\ {\isacharparenleft}monoidl{\isacharcomma}\ monoidl{\isacharparenright}\ monoidl\isanewline
   6.419 +\isakeyword{begin}\isanewline
   6.420 +\isanewline
   6.421 +\isacommand{definition}\isamarkupfalse%
   6.422 +\isanewline
   6.423 +\ \ neutral{\isacharunderscore}prod{\isacharunderscore}def{\isacharcolon}\ {\isachardoublequoteopen}{\isasymone}\ {\isacharequal}\ {\isacharparenleft}{\isasymone}{\isacharcomma}\ {\isasymone}{\isacharparenright}{\isachardoublequoteclose}\isanewline
   6.424 +\isanewline
   6.425 +\isacommand{instance}\isamarkupfalse%
   6.426 +\ \isacommand{proof}\isamarkupfalse%
   6.427 +\isanewline
   6.428 +\ \ \isacommand{fix}\isamarkupfalse%
   6.429 +\ p\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isasymalpha}{\isasymColon}monoidl\ {\isasymtimes}\ {\isasymbeta}{\isasymColon}monoidl{\isachardoublequoteclose}\isanewline
   6.430 +\ \ \isacommand{show}\isamarkupfalse%
   6.431 +\ {\isachardoublequoteopen}{\isasymone}\ {\isasymotimes}\ p\ {\isacharequal}\ p{\isachardoublequoteclose}\isanewline
   6.432 +\ \ \ \ \isacommand{unfolding}\isamarkupfalse%
   6.433 +\ neutral{\isacharunderscore}prod{\isacharunderscore}def\ mult{\isacharunderscore}prod{\isacharunderscore}def\ \isacommand{by}\isamarkupfalse%
   6.434 +\ {\isacharparenleft}simp\ add{\isacharcolon}\ neutl{\isacharparenright}\isanewline
   6.435 +\isacommand{qed}\isamarkupfalse%
   6.436 +\isanewline
   6.437 +\isanewline
   6.438 +\isacommand{end}\isamarkupfalse%
   6.439 +%
   6.440 +\endisatagquote
   6.441 +{\isafoldquote}%
   6.442 +%
   6.443 +\isadelimquote
   6.444 +%
   6.445 +\endisadelimquote
   6.446 +%
   6.447 +\begin{isamarkuptext}%
   6.448 +\noindent Fully-fledged monoids are modelled by another subclass
   6.449 +  which does not add new parameters but tightens the specification:%
   6.450 +\end{isamarkuptext}%
   6.451 +\isamarkuptrue%
   6.452 +%
   6.453 +\isadelimquote
   6.454 +%
   6.455 +\endisadelimquote
   6.456 +%
   6.457 +\isatagquote
   6.458 +\isacommand{class}\isamarkupfalse%
   6.459 +\ monoid\ {\isacharequal}\ monoidl\ {\isacharplus}\isanewline
   6.460 +\ \ \isakeyword{assumes}\ neutr{\isacharcolon}\ {\isachardoublequoteopen}x\ {\isasymotimes}\ {\isasymone}\ {\isacharequal}\ x{\isachardoublequoteclose}\isanewline
   6.461 +\isanewline
   6.462 +\isacommand{instantiation}\isamarkupfalse%
   6.463 +\ nat\ \isakeyword{and}\ int\ {\isacharcolon}{\isacharcolon}\ monoid\ \isanewline
   6.464 +\isakeyword{begin}\isanewline
   6.465 +\isanewline
   6.466 +\isacommand{instance}\isamarkupfalse%
   6.467 +\ \isacommand{proof}\isamarkupfalse%
   6.468 +\isanewline
   6.469 +\ \ \isacommand{fix}\isamarkupfalse%
   6.470 +\ n\ {\isacharcolon}{\isacharcolon}\ nat\isanewline
   6.471 +\ \ \isacommand{show}\isamarkupfalse%
   6.472 +\ {\isachardoublequoteopen}n\ {\isasymotimes}\ {\isasymone}\ {\isacharequal}\ n{\isachardoublequoteclose}\isanewline
   6.473 +\ \ \ \ \isacommand{unfolding}\isamarkupfalse%
   6.474 +\ neutral{\isacharunderscore}nat{\isacharunderscore}def\ \isacommand{by}\isamarkupfalse%
   6.475 +\ {\isacharparenleft}induct\ n{\isacharparenright}\ simp{\isacharunderscore}all\isanewline
   6.476 +\isacommand{next}\isamarkupfalse%
   6.477 +\isanewline
   6.478 +\ \ \isacommand{fix}\isamarkupfalse%
   6.479 +\ k\ {\isacharcolon}{\isacharcolon}\ int\isanewline
   6.480 +\ \ \isacommand{show}\isamarkupfalse%
   6.481 +\ {\isachardoublequoteopen}k\ {\isasymotimes}\ {\isasymone}\ {\isacharequal}\ k{\isachardoublequoteclose}\isanewline
   6.482 +\ \ \ \ \isacommand{unfolding}\isamarkupfalse%
   6.483 +\ neutral{\isacharunderscore}int{\isacharunderscore}def\ mult{\isacharunderscore}int{\isacharunderscore}def\ \isacommand{by}\isamarkupfalse%
   6.484 +\ simp\isanewline
   6.485 +\isacommand{qed}\isamarkupfalse%
   6.486 +\isanewline
   6.487 +\isanewline
   6.488 +\isacommand{end}\isamarkupfalse%
   6.489 +\isanewline
   6.490 +\isanewline
   6.491 +\isacommand{instantiation}\isamarkupfalse%
   6.492 +\ {\isacharasterisk}\ {\isacharcolon}{\isacharcolon}\ {\isacharparenleft}monoid{\isacharcomma}\ monoid{\isacharparenright}\ monoid\isanewline
   6.493 +\isakeyword{begin}\isanewline
   6.494 +\isanewline
   6.495 +\isacommand{instance}\isamarkupfalse%
   6.496 +\ \isacommand{proof}\isamarkupfalse%
   6.497 +\ \isanewline
   6.498 +\ \ \isacommand{fix}\isamarkupfalse%
   6.499 +\ p\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isasymalpha}{\isasymColon}monoid\ {\isasymtimes}\ {\isasymbeta}{\isasymColon}monoid{\isachardoublequoteclose}\isanewline
   6.500 +\ \ \isacommand{show}\isamarkupfalse%
   6.501 +\ {\isachardoublequoteopen}p\ {\isasymotimes}\ {\isasymone}\ {\isacharequal}\ p{\isachardoublequoteclose}\isanewline
   6.502 +\ \ \ \ \isacommand{unfolding}\isamarkupfalse%
   6.503 +\ neutral{\isacharunderscore}prod{\isacharunderscore}def\ mult{\isacharunderscore}prod{\isacharunderscore}def\ \isacommand{by}\isamarkupfalse%
   6.504 +\ {\isacharparenleft}simp\ add{\isacharcolon}\ neutr{\isacharparenright}\isanewline
   6.505 +\isacommand{qed}\isamarkupfalse%
   6.506 +\isanewline
   6.507 +\isanewline
   6.508 +\isacommand{end}\isamarkupfalse%
   6.509 +%
   6.510 +\endisatagquote
   6.511 +{\isafoldquote}%
   6.512 +%
   6.513 +\isadelimquote
   6.514 +%
   6.515 +\endisadelimquote
   6.516 +%
   6.517 +\begin{isamarkuptext}%
   6.518 +\noindent To finish our small algebra example, we add a \isa{group} class
   6.519 +  with a corresponding instance:%
   6.520 +\end{isamarkuptext}%
   6.521 +\isamarkuptrue%
   6.522 +%
   6.523 +\isadelimquote
   6.524 +%
   6.525 +\endisadelimquote
   6.526 +%
   6.527 +\isatagquote
   6.528 +\isacommand{class}\isamarkupfalse%
   6.529 +\ group\ {\isacharequal}\ monoidl\ {\isacharplus}\isanewline
   6.530 +\ \ \isakeyword{fixes}\ inverse\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isasymalpha}\ {\isasymRightarrow}\ {\isasymalpha}{\isachardoublequoteclose}\ \ \ \ {\isacharparenleft}{\isachardoublequoteopen}{\isacharparenleft}{\isacharunderscore}{\isasymdiv}{\isacharparenright}{\isachardoublequoteclose}\ {\isacharbrackleft}{\isadigit{1}}{\isadigit{0}}{\isadigit{0}}{\isadigit{0}}{\isacharbrackright}\ {\isadigit{9}}{\isadigit{9}}{\isadigit{9}}{\isacharparenright}\isanewline
   6.531 +\ \ \isakeyword{assumes}\ invl{\isacharcolon}\ {\isachardoublequoteopen}x{\isasymdiv}\ {\isasymotimes}\ x\ {\isacharequal}\ {\isasymone}{\isachardoublequoteclose}\isanewline
   6.532 +\isanewline
   6.533 +\isacommand{instantiation}\isamarkupfalse%
   6.534 +\ int\ {\isacharcolon}{\isacharcolon}\ group\isanewline
   6.535 +\isakeyword{begin}\isanewline
   6.536 +\isanewline
   6.537 +\isacommand{definition}\isamarkupfalse%
   6.538 +\isanewline
   6.539 +\ \ inverse{\isacharunderscore}int{\isacharunderscore}def{\isacharcolon}\ {\isachardoublequoteopen}i{\isasymdiv}\ {\isacharequal}\ {\isacharminus}\ {\isacharparenleft}i{\isasymColon}int{\isacharparenright}{\isachardoublequoteclose}\isanewline
   6.540 +\isanewline
   6.541 +\isacommand{instance}\isamarkupfalse%
   6.542 +\ \isacommand{proof}\isamarkupfalse%
   6.543 +\isanewline
   6.544 +\ \ \isacommand{fix}\isamarkupfalse%
   6.545 +\ i\ {\isacharcolon}{\isacharcolon}\ int\isanewline
   6.546 +\ \ \isacommand{have}\isamarkupfalse%
   6.547 +\ {\isachardoublequoteopen}{\isacharminus}i\ {\isacharplus}\ i\ {\isacharequal}\ {\isadigit{0}}{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
   6.548 +\ simp\isanewline
   6.549 +\ \ \isacommand{then}\isamarkupfalse%
   6.550 +\ \isacommand{show}\isamarkupfalse%
   6.551 +\ {\isachardoublequoteopen}i{\isasymdiv}\ {\isasymotimes}\ i\ {\isacharequal}\ {\isasymone}{\isachardoublequoteclose}\isanewline
   6.552 +\ \ \ \ \isacommand{unfolding}\isamarkupfalse%
   6.553 +\ mult{\isacharunderscore}int{\isacharunderscore}def\ neutral{\isacharunderscore}int{\isacharunderscore}def\ inverse{\isacharunderscore}int{\isacharunderscore}def\ \isacommand{{\isachardot}}\isamarkupfalse%
   6.554 +\isanewline
   6.555 +\isacommand{qed}\isamarkupfalse%
   6.556 +\isanewline
   6.557 +\isanewline
   6.558 +\isacommand{end}\isamarkupfalse%
   6.559 +%
   6.560 +\endisatagquote
   6.561 +{\isafoldquote}%
   6.562 +%
   6.563 +\isadelimquote
   6.564 +%
   6.565 +\endisadelimquote
   6.566 +%
   6.567 +\isamarkupsection{Type classes as locales%
   6.568 +}
   6.569 +\isamarkuptrue%
   6.570 +%
   6.571 +\isamarkupsubsection{A look behind the scene%
   6.572 +}
   6.573 +\isamarkuptrue%
   6.574 +%
   6.575 +\begin{isamarkuptext}%
   6.576 +The example above gives an impression how Isar type classes work
   6.577 +  in practice.  As stated in the introduction, classes also provide
   6.578 +  a link to Isar's locale system.  Indeed, the logical core of a class
   6.579 +  is nothing else than a locale:%
   6.580 +\end{isamarkuptext}%
   6.581 +\isamarkuptrue%
   6.582 +%
   6.583 +\isadelimquote
   6.584 +%
   6.585 +\endisadelimquote
   6.586 +%
   6.587 +\isatagquote
   6.588 +\isacommand{class}\isamarkupfalse%
   6.589 +\ idem\ {\isacharequal}\isanewline
   6.590 +\ \ \isakeyword{fixes}\ f\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isasymalpha}\ {\isasymRightarrow}\ {\isasymalpha}{\isachardoublequoteclose}\isanewline
   6.591 +\ \ \isakeyword{assumes}\ idem{\isacharcolon}\ {\isachardoublequoteopen}f\ {\isacharparenleft}f\ x{\isacharparenright}\ {\isacharequal}\ f\ x{\isachardoublequoteclose}%
   6.592 +\endisatagquote
   6.593 +{\isafoldquote}%
   6.594 +%
   6.595 +\isadelimquote
   6.596 +%
   6.597 +\endisadelimquote
   6.598 +%
   6.599 +\begin{isamarkuptext}%
   6.600 +\noindent essentially introduces the locale%
   6.601 +\end{isamarkuptext}%
   6.602 +\isamarkuptrue%
   6.603 +%
   6.604 +\isadeliminvisible
   6.605 +\ %
   6.606 +\endisadeliminvisible
   6.607 +%
   6.608 +\isataginvisible
   6.609 +\isacommand{setup}\isamarkupfalse%
   6.610 +\ {\isacharverbatimopen}\ Sign{\isachardot}add{\isacharunderscore}path\ {\isachardoublequote}foo{\isachardoublequote}\ {\isacharverbatimclose}%
   6.611 +\endisataginvisible
   6.612 +{\isafoldinvisible}%
   6.613 +%
   6.614 +\isadeliminvisible
   6.615 +%
   6.616 +\endisadeliminvisible
   6.617 +\isanewline
   6.618 +%
   6.619 +\isadelimquote
   6.620 +\isanewline
   6.621 +%
   6.622 +\endisadelimquote
   6.623 +%
   6.624 +\isatagquote
   6.625 +\isacommand{locale}\isamarkupfalse%
   6.626 +\ idem\ {\isacharequal}\isanewline
   6.627 +\ \ \isakeyword{fixes}\ f\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isasymalpha}\ {\isasymRightarrow}\ {\isasymalpha}{\isachardoublequoteclose}\isanewline
   6.628 +\ \ \isakeyword{assumes}\ idem{\isacharcolon}\ {\isachardoublequoteopen}f\ {\isacharparenleft}f\ x{\isacharparenright}\ {\isacharequal}\ f\ x{\isachardoublequoteclose}%
   6.629 +\endisatagquote
   6.630 +{\isafoldquote}%
   6.631 +%
   6.632 +\isadelimquote
   6.633 +%
   6.634 +\endisadelimquote
   6.635 +%
   6.636 +\begin{isamarkuptext}%
   6.637 +\noindent together with corresponding constant(s):%
   6.638 +\end{isamarkuptext}%
   6.639 +\isamarkuptrue%
   6.640 +%
   6.641 +\isadelimquote
   6.642 +%
   6.643 +\endisadelimquote
   6.644 +%
   6.645 +\isatagquote
   6.646 +\isacommand{consts}\isamarkupfalse%
   6.647 +\ f\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isasymalpha}\ {\isasymRightarrow}\ {\isasymalpha}{\isachardoublequoteclose}%
   6.648 +\endisatagquote
   6.649 +{\isafoldquote}%
   6.650 +%
   6.651 +\isadelimquote
   6.652 +%
   6.653 +\endisadelimquote
   6.654 +%
   6.655 +\begin{isamarkuptext}%
   6.656 +\noindent The connection to the type system is done by means
   6.657 +  of a primitive axclass%
   6.658 +\end{isamarkuptext}%
   6.659 +\isamarkuptrue%
   6.660 +%
   6.661 +\isadeliminvisible
   6.662 +\ %
   6.663 +\endisadeliminvisible
   6.664 +%
   6.665 +\isataginvisible
   6.666 +\isacommand{setup}\isamarkupfalse%
   6.667 +\ {\isacharverbatimopen}\ Sign{\isachardot}add{\isacharunderscore}path\ {\isachardoublequote}foo{\isachardoublequote}\ {\isacharverbatimclose}%
   6.668 +\endisataginvisible
   6.669 +{\isafoldinvisible}%
   6.670 +%
   6.671 +\isadeliminvisible
   6.672 +%
   6.673 +\endisadeliminvisible
   6.674 +\isanewline
   6.675 +%
   6.676 +\isadelimquote
   6.677 +\isanewline
   6.678 +%
   6.679 +\endisadelimquote
   6.680 +%
   6.681 +\isatagquote
   6.682 +\isacommand{axclass}\isamarkupfalse%
   6.683 +\ idem\ {\isacharless}\ type\isanewline
   6.684 +\ \ idem{\isacharcolon}\ {\isachardoublequoteopen}f\ {\isacharparenleft}f\ x{\isacharparenright}\ {\isacharequal}\ f\ x{\isachardoublequoteclose}%
   6.685 +\endisatagquote
   6.686 +{\isafoldquote}%
   6.687 +%
   6.688 +\isadelimquote
   6.689 +%
   6.690 +\endisadelimquote
   6.691 +%
   6.692 +\isadeliminvisible
   6.693 +\ %
   6.694 +\endisadeliminvisible
   6.695 +%
   6.696 +\isataginvisible
   6.697 +\isacommand{setup}\isamarkupfalse%
   6.698 +\ {\isacharverbatimopen}\ Sign{\isachardot}parent{\isacharunderscore}path\ {\isacharverbatimclose}%
   6.699 +\endisataginvisible
   6.700 +{\isafoldinvisible}%
   6.701 +%
   6.702 +\isadeliminvisible
   6.703 +%
   6.704 +\endisadeliminvisible
   6.705 +%
   6.706 +\begin{isamarkuptext}%
   6.707 +\noindent together with a corresponding interpretation:%
   6.708 +\end{isamarkuptext}%
   6.709 +\isamarkuptrue%
   6.710 +%
   6.711 +\isadelimquote
   6.712 +%
   6.713 +\endisadelimquote
   6.714 +%
   6.715 +\isatagquote
   6.716 +\isacommand{interpretation}\isamarkupfalse%
   6.717 +\ idem{\isacharunderscore}class{\isacharcolon}\isanewline
   6.718 +\ \ idem\ {\isachardoublequoteopen}f\ {\isasymColon}\ {\isacharparenleft}{\isasymalpha}{\isasymColon}idem{\isacharparenright}\ {\isasymRightarrow}\ {\isasymalpha}{\isachardoublequoteclose}\isanewline
   6.719 +\isacommand{proof}\isamarkupfalse%
   6.720 +\ \isacommand{qed}\isamarkupfalse%
   6.721 +\ {\isacharparenleft}rule\ idem{\isacharparenright}%
   6.722 +\endisatagquote
   6.723 +{\isafoldquote}%
   6.724 +%
   6.725 +\isadelimquote
   6.726 +%
   6.727 +\endisadelimquote
   6.728 +%
   6.729 +\begin{isamarkuptext}%
   6.730 +\noindent This gives you at hand the full power of the Isabelle module system;
   6.731 +  conclusions in locale \isa{idem} are implicitly propagated
   6.732 +  to class \isa{idem}.%
   6.733 +\end{isamarkuptext}%
   6.734 +\isamarkuptrue%
   6.735 +%
   6.736 +\isadeliminvisible
   6.737 +\ %
   6.738 +\endisadeliminvisible
   6.739 +%
   6.740 +\isataginvisible
   6.741 +\isacommand{setup}\isamarkupfalse%
   6.742 +\ {\isacharverbatimopen}\ Sign{\isachardot}parent{\isacharunderscore}path\ {\isacharverbatimclose}%
   6.743 +\endisataginvisible
   6.744 +{\isafoldinvisible}%
   6.745 +%
   6.746 +\isadeliminvisible
   6.747 +%
   6.748 +\endisadeliminvisible
   6.749 +%
   6.750 +\isamarkupsubsection{Abstract reasoning%
   6.751 +}
   6.752 +\isamarkuptrue%
   6.753 +%
   6.754 +\begin{isamarkuptext}%
   6.755 +Isabelle locales enable reasoning at a general level, while results
   6.756 +  are implicitly transferred to all instances.  For example, we can
   6.757 +  now establish the \isa{left{\isacharunderscore}cancel} lemma for groups, which
   6.758 +  states that the function \isa{{\isacharparenleft}x\ {\isasymotimes}{\isacharparenright}} is injective:%
   6.759 +\end{isamarkuptext}%
   6.760 +\isamarkuptrue%
   6.761 +%
   6.762 +\isadelimquote
   6.763 +%
   6.764 +\endisadelimquote
   6.765 +%
   6.766 +\isatagquote
   6.767 +\isacommand{lemma}\isamarkupfalse%
   6.768 +\ {\isacharparenleft}\isakeyword{in}\ group{\isacharparenright}\ left{\isacharunderscore}cancel{\isacharcolon}\ {\isachardoublequoteopen}x\ {\isasymotimes}\ y\ {\isacharequal}\ x\ {\isasymotimes}\ z\ {\isasymlongleftrightarrow}\ y\ {\isacharequal}\ z{\isachardoublequoteclose}\isanewline
   6.769 +\isacommand{proof}\isamarkupfalse%
   6.770 +\isanewline
   6.771 +\ \ \isacommand{assume}\isamarkupfalse%
   6.772 +\ {\isachardoublequoteopen}x\ {\isasymotimes}\ y\ {\isacharequal}\ x\ {\isasymotimes}\ z{\isachardoublequoteclose}\isanewline
   6.773 +\ \ \isacommand{then}\isamarkupfalse%
   6.774 +\ \isacommand{have}\isamarkupfalse%
   6.775 +\ {\isachardoublequoteopen}x{\isasymdiv}\ {\isasymotimes}\ {\isacharparenleft}x\ {\isasymotimes}\ y{\isacharparenright}\ {\isacharequal}\ x{\isasymdiv}\ {\isasymotimes}\ {\isacharparenleft}x\ {\isasymotimes}\ z{\isacharparenright}{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
   6.776 +\ simp\isanewline
   6.777 +\ \ \isacommand{then}\isamarkupfalse%
   6.778 +\ \isacommand{have}\isamarkupfalse%
   6.779 +\ {\isachardoublequoteopen}{\isacharparenleft}x{\isasymdiv}\ {\isasymotimes}\ x{\isacharparenright}\ {\isasymotimes}\ y\ {\isacharequal}\ {\isacharparenleft}x{\isasymdiv}\ {\isasymotimes}\ x{\isacharparenright}\ {\isasymotimes}\ z{\isachardoublequoteclose}\ \isacommand{using}\isamarkupfalse%
   6.780 +\ assoc\ \isacommand{by}\isamarkupfalse%
   6.781 +\ simp\isanewline
   6.782 +\ \ \isacommand{then}\isamarkupfalse%
   6.783 +\ \isacommand{show}\isamarkupfalse%
   6.784 +\ {\isachardoublequoteopen}y\ {\isacharequal}\ z{\isachardoublequoteclose}\ \isacommand{using}\isamarkupfalse%
   6.785 +\ neutl\ \isakeyword{and}\ invl\ \isacommand{by}\isamarkupfalse%
   6.786 +\ simp\isanewline
   6.787 +\isacommand{next}\isamarkupfalse%
   6.788 +\isanewline
   6.789 +\ \ \isacommand{assume}\isamarkupfalse%
   6.790 +\ {\isachardoublequoteopen}y\ {\isacharequal}\ z{\isachardoublequoteclose}\isanewline
   6.791 +\ \ \isacommand{then}\isamarkupfalse%
   6.792 +\ \isacommand{show}\isamarkupfalse%
   6.793 +\ {\isachardoublequoteopen}x\ {\isasymotimes}\ y\ {\isacharequal}\ x\ {\isasymotimes}\ z{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
   6.794 +\ simp\isanewline
   6.795 +\isacommand{qed}\isamarkupfalse%
   6.796 +%
   6.797 +\endisatagquote
   6.798 +{\isafoldquote}%
   6.799 +%
   6.800 +\isadelimquote
   6.801 +%
   6.802 +\endisadelimquote
   6.803 +%
   6.804 +\begin{isamarkuptext}%
   6.805 +\noindent Here the \qt{\hyperlink{keyword.in}{\mbox{\isa{\isakeyword{in}}}} \isa{group}} target specification
   6.806 +  indicates that the result is recorded within that context for later
   6.807 +  use.  This local theorem is also lifted to the global one \hyperlink{fact.group.left-cancel:}{\mbox{\isa{group{\isachardot}left{\isacharunderscore}cancel{\isacharcolon}}}} \isa{{\isachardoublequote}{\isasymAnd}x\ y\ z\ {\isasymColon}\ {\isasymalpha}{\isasymColon}group{\isachardot}\ x\ {\isasymotimes}\ y\ {\isacharequal}\ x\ {\isasymotimes}\ z\ {\isasymlongleftrightarrow}\ y\ {\isacharequal}\ z{\isachardoublequote}}.  Since type \isa{int} has been made an instance of
   6.808 +  \isa{group} before, we may refer to that fact as well: \isa{{\isachardoublequote}{\isasymAnd}x\ y\ z\ {\isasymColon}\ int{\isachardot}\ x\ {\isasymotimes}\ y\ {\isacharequal}\ x\ {\isasymotimes}\ z\ {\isasymlongleftrightarrow}\ y\ {\isacharequal}\ z{\isachardoublequote}}.%
   6.809 +\end{isamarkuptext}%
   6.810 +\isamarkuptrue%
   6.811 +%
   6.812 +\isamarkupsubsection{Derived definitions%
   6.813 +}
   6.814 +\isamarkuptrue%
   6.815 +%
   6.816 +\begin{isamarkuptext}%
   6.817 +Isabelle locales support a concept of local definitions
   6.818 +  in locales:%
   6.819 +\end{isamarkuptext}%
   6.820 +\isamarkuptrue%
   6.821 +%
   6.822 +\isadelimquote
   6.823 +%
   6.824 +\endisadelimquote
   6.825 +%
   6.826 +\isatagquote
   6.827 +\isacommand{primrec}\isamarkupfalse%
   6.828 +\ {\isacharparenleft}\isakeyword{in}\ monoid{\isacharparenright}\ pow{\isacharunderscore}nat\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ {\isasymalpha}\ {\isasymRightarrow}\ {\isasymalpha}{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
   6.829 +\ \ {\isachardoublequoteopen}pow{\isacharunderscore}nat\ {\isadigit{0}}\ x\ {\isacharequal}\ {\isasymone}{\isachardoublequoteclose}\isanewline
   6.830 +\ \ {\isacharbar}\ {\isachardoublequoteopen}pow{\isacharunderscore}nat\ {\isacharparenleft}Suc\ n{\isacharparenright}\ x\ {\isacharequal}\ x\ {\isasymotimes}\ pow{\isacharunderscore}nat\ n\ x{\isachardoublequoteclose}%
   6.831 +\endisatagquote
   6.832 +{\isafoldquote}%
   6.833 +%
   6.834 +\isadelimquote
   6.835 +%
   6.836 +\endisadelimquote
   6.837 +%
   6.838 +\begin{isamarkuptext}%
   6.839 +\noindent If the locale \isa{group} is also a class, this local
   6.840 +  definition is propagated onto a global definition of
   6.841 +  \isa{{\isachardoublequote}pow{\isacharunderscore}nat\ {\isasymColon}\ nat\ {\isasymRightarrow}\ {\isasymalpha}{\isasymColon}monoid\ {\isasymRightarrow}\ {\isasymalpha}{\isasymColon}monoid{\isachardoublequote}}
   6.842 +  with corresponding theorems
   6.843 +
   6.844 +  \isa{pow{\isacharunderscore}nat\ {\isadigit{0}}\ x\ {\isacharequal}\ {\isasymone}\isasep\isanewline%
   6.845 +pow{\isacharunderscore}nat\ {\isacharparenleft}Suc\ n{\isacharparenright}\ x\ {\isacharequal}\ x\ {\isasymotimes}\ pow{\isacharunderscore}nat\ n\ x}.
   6.846 +
   6.847 +  \noindent As you can see from this example, for local
   6.848 +  definitions you may use any specification tool
   6.849 +  which works together with locales (e.g. \cite{krauss2006}).%
   6.850 +\end{isamarkuptext}%
   6.851 +\isamarkuptrue%
   6.852 +%
   6.853 +\isamarkupsubsection{A functor analogy%
   6.854 +}
   6.855 +\isamarkuptrue%
   6.856 +%
   6.857 +\begin{isamarkuptext}%
   6.858 +We introduced Isar classes by analogy to type classes
   6.859 +  functional programming;  if we reconsider this in the
   6.860 +  context of what has been said about type classes and locales,
   6.861 +  we can drive this analogy further by stating that type
   6.862 +  classes essentially correspond to functors which have
   6.863 +  a canonical interpretation as type classes.
   6.864 +  Anyway, there is also the possibility of other interpretations.
   6.865 +  For example, also \isa{list}s form a monoid with
   6.866 +  \isa{append} and \isa{{\isacharbrackleft}{\isacharbrackright}} as operations, but it
   6.867 +  seems inappropriate to apply to lists
   6.868 +  the same operations as for genuinely algebraic types.
   6.869 +  In such a case, we simply can do a particular interpretation
   6.870 +  of monoids for lists:%
   6.871 +\end{isamarkuptext}%
   6.872 +\isamarkuptrue%
   6.873 +%
   6.874 +\isadelimquote
   6.875 +%
   6.876 +\endisadelimquote
   6.877 +%
   6.878 +\isatagquote
   6.879 +\isacommand{interpretation}\isamarkupfalse%
   6.880 +\ list{\isacharunderscore}monoid{\isacharbang}{\isacharcolon}\ monoid\ append\ {\isachardoublequoteopen}{\isacharbrackleft}{\isacharbrackright}{\isachardoublequoteclose}\isanewline
   6.881 +\ \ \isacommand{proof}\isamarkupfalse%
   6.882 +\ \isacommand{qed}\isamarkupfalse%
   6.883 +\ auto%
   6.884 +\endisatagquote
   6.885 +{\isafoldquote}%
   6.886 +%
   6.887 +\isadelimquote
   6.888 +%
   6.889 +\endisadelimquote
   6.890 +%
   6.891 +\begin{isamarkuptext}%
   6.892 +\noindent This enables us to apply facts on monoids
   6.893 +  to lists, e.g. \isa{{\isacharbrackleft}{\isacharbrackright}\ {\isacharat}\ x\ {\isacharequal}\ x}.
   6.894 +
   6.895 +  When using this interpretation pattern, it may also
   6.896 +  be appropriate to map derived definitions accordingly:%
   6.897 +\end{isamarkuptext}%
   6.898 +\isamarkuptrue%
   6.899 +%
   6.900 +\isadelimquote
   6.901 +%
   6.902 +\endisadelimquote
   6.903 +%
   6.904 +\isatagquote
   6.905 +\isacommand{primrec}\isamarkupfalse%
   6.906 +\ replicate\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ {\isasymalpha}\ list\ {\isasymRightarrow}\ {\isasymalpha}\ list{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
   6.907 +\ \ {\isachardoublequoteopen}replicate\ {\isadigit{0}}\ {\isacharunderscore}\ {\isacharequal}\ {\isacharbrackleft}{\isacharbrackright}{\isachardoublequoteclose}\isanewline
   6.908 +\ \ {\isacharbar}\ {\isachardoublequoteopen}replicate\ {\isacharparenleft}Suc\ n{\isacharparenright}\ xs\ {\isacharequal}\ xs\ {\isacharat}\ replicate\ n\ xs{\isachardoublequoteclose}\isanewline
   6.909 +\isanewline
   6.910 +\isacommand{interpretation}\isamarkupfalse%
   6.911 +\ list{\isacharunderscore}monoid{\isacharbang}{\isacharcolon}\ monoid\ append\ {\isachardoublequoteopen}{\isacharbrackleft}{\isacharbrackright}{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
   6.912 +\ \ {\isachardoublequoteopen}monoid{\isachardot}pow{\isacharunderscore}nat\ append\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharequal}\ replicate{\isachardoublequoteclose}\isanewline
   6.913 +\isacommand{proof}\isamarkupfalse%
   6.914 +\ {\isacharminus}\isanewline
   6.915 +\ \ \isacommand{interpret}\isamarkupfalse%
   6.916 +\ monoid\ append\ {\isachardoublequoteopen}{\isacharbrackleft}{\isacharbrackright}{\isachardoublequoteclose}\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
   6.917 +\isanewline
   6.918 +\ \ \isacommand{show}\isamarkupfalse%
   6.919 +\ {\isachardoublequoteopen}monoid{\isachardot}pow{\isacharunderscore}nat\ append\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharequal}\ replicate{\isachardoublequoteclose}\isanewline
   6.920 +\ \ \isacommand{proof}\isamarkupfalse%
   6.921 +\isanewline
   6.922 +\ \ \ \ \isacommand{fix}\isamarkupfalse%
   6.923 +\ n\isanewline
   6.924 +\ \ \ \ \isacommand{show}\isamarkupfalse%
   6.925 +\ {\isachardoublequoteopen}monoid{\isachardot}pow{\isacharunderscore}nat\ append\ {\isacharbrackleft}{\isacharbrackright}\ n\ {\isacharequal}\ replicate\ n{\isachardoublequoteclose}\isanewline
   6.926 +\ \ \ \ \ \ \isacommand{by}\isamarkupfalse%
   6.927 +\ {\isacharparenleft}induct\ n{\isacharparenright}\ auto\isanewline
   6.928 +\ \ \isacommand{qed}\isamarkupfalse%
   6.929 +\isanewline
   6.930 +\isacommand{qed}\isamarkupfalse%
   6.931 +\ intro{\isacharunderscore}locales%
   6.932 +\endisatagquote
   6.933 +{\isafoldquote}%
   6.934 +%
   6.935 +\isadelimquote
   6.936 +%
   6.937 +\endisadelimquote
   6.938 +%
   6.939 +\isamarkupsubsection{Additional subclass relations%
   6.940 +}
   6.941 +\isamarkuptrue%
   6.942 +%
   6.943 +\begin{isamarkuptext}%
   6.944 +Any \isa{group} is also a \isa{monoid};  this
   6.945 +  can be made explicit by claiming an additional
   6.946 +  subclass relation,
   6.947 +  together with a proof of the logical difference:%
   6.948 +\end{isamarkuptext}%
   6.949 +\isamarkuptrue%
   6.950 +%
   6.951 +\isadelimquote
   6.952 +%
   6.953 +\endisadelimquote
   6.954 +%
   6.955 +\isatagquote
   6.956 +\isacommand{subclass}\isamarkupfalse%
   6.957 +\ {\isacharparenleft}\isakeyword{in}\ group{\isacharparenright}\ monoid\isanewline
   6.958 +\isacommand{proof}\isamarkupfalse%
   6.959 +\isanewline
   6.960 +\ \ \isacommand{fix}\isamarkupfalse%
   6.961 +\ x\isanewline
   6.962 +\ \ \isacommand{from}\isamarkupfalse%
   6.963 +\ invl\ \isacommand{have}\isamarkupfalse%
   6.964 +\ {\isachardoublequoteopen}x{\isasymdiv}\ {\isasymotimes}\ x\ {\isacharequal}\ {\isasymone}{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
   6.965 +\ simp\isanewline
   6.966 +\ \ \isacommand{with}\isamarkupfalse%
   6.967 +\ assoc\ {\isacharbrackleft}symmetric{\isacharbrackright}\ neutl\ invl\ \isacommand{have}\isamarkupfalse%
   6.968 +\ {\isachardoublequoteopen}x{\isasymdiv}\ {\isasymotimes}\ {\isacharparenleft}x\ {\isasymotimes}\ {\isasymone}{\isacharparenright}\ {\isacharequal}\ x{\isasymdiv}\ {\isasymotimes}\ x{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
   6.969 +\ simp\isanewline
   6.970 +\ \ \isacommand{with}\isamarkupfalse%
   6.971 +\ left{\isacharunderscore}cancel\ \isacommand{show}\isamarkupfalse%
   6.972 +\ {\isachardoublequoteopen}x\ {\isasymotimes}\ {\isasymone}\ {\isacharequal}\ x{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
   6.973 +\ simp\isanewline
   6.974 +\isacommand{qed}\isamarkupfalse%
   6.975 +%
   6.976 +\endisatagquote
   6.977 +{\isafoldquote}%
   6.978 +%
   6.979 +\isadelimquote
   6.980 +%
   6.981 +\endisadelimquote
   6.982 +%
   6.983 +\begin{isamarkuptext}%
   6.984 +\noindent The logical proof is carried out on the locale level.
   6.985 +  Afterwards it is propagated
   6.986 +  to the type system, making \isa{group} an instance of
   6.987 +  \isa{monoid} by adding an additional edge
   6.988 +  to the graph of subclass relations
   6.989 +  (cf.\ \figref{fig:subclass}).
   6.990 +
   6.991 +  \begin{figure}[htbp]
   6.992 +   \begin{center}
   6.993 +     \small
   6.994 +     \unitlength 0.6mm
   6.995 +     \begin{picture}(40,60)(0,0)
   6.996 +       \put(20,60){\makebox(0,0){\isa{semigroup}}}
   6.997 +       \put(20,40){\makebox(0,0){\isa{monoidl}}}
   6.998 +       \put(00,20){\makebox(0,0){\isa{monoid}}}
   6.999 +       \put(40,00){\makebox(0,0){\isa{group}}}
  6.1000 +       \put(20,55){\vector(0,-1){10}}
  6.1001 +       \put(15,35){\vector(-1,-1){10}}
  6.1002 +       \put(25,35){\vector(1,-3){10}}
  6.1003 +     \end{picture}
  6.1004 +     \hspace{8em}
  6.1005 +     \begin{picture}(40,60)(0,0)
  6.1006 +       \put(20,60){\makebox(0,0){\isa{semigroup}}}
  6.1007 +       \put(20,40){\makebox(0,0){\isa{monoidl}}}
  6.1008 +       \put(00,20){\makebox(0,0){\isa{monoid}}}
  6.1009 +       \put(40,00){\makebox(0,0){\isa{group}}}
  6.1010 +       \put(20,55){\vector(0,-1){10}}
  6.1011 +       \put(15,35){\vector(-1,-1){10}}
  6.1012 +       \put(05,15){\vector(3,-1){30}}
  6.1013 +     \end{picture}
  6.1014 +     \caption{Subclass relationship of monoids and groups:
  6.1015 +        before and after establishing the relationship
  6.1016 +        \isa{group\ {\isasymsubseteq}\ monoid};  transitive edges left out.}
  6.1017 +     \label{fig:subclass}
  6.1018 +   \end{center}
  6.1019 +  \end{figure}
  6.1020 +7
  6.1021 +  For illustration, a derived definition
  6.1022 +  in \isa{group} which uses \isa{pow{\isacharunderscore}nat}:%
  6.1023 +\end{isamarkuptext}%
  6.1024 +\isamarkuptrue%
  6.1025 +%
  6.1026 +\isadelimquote
  6.1027 +%
  6.1028 +\endisadelimquote
  6.1029 +%
  6.1030 +\isatagquote
  6.1031 +\isacommand{definition}\isamarkupfalse%
  6.1032 +\ {\isacharparenleft}\isakeyword{in}\ group{\isacharparenright}\ pow{\isacharunderscore}int\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}int\ {\isasymRightarrow}\ {\isasymalpha}\ {\isasymRightarrow}\ {\isasymalpha}{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  6.1033 +\ \ {\isachardoublequoteopen}pow{\isacharunderscore}int\ k\ x\ {\isacharequal}\ {\isacharparenleft}if\ k\ {\isachargreater}{\isacharequal}\ {\isadigit{0}}\isanewline
  6.1034 +\ \ \ \ then\ pow{\isacharunderscore}nat\ {\isacharparenleft}nat\ k{\isacharparenright}\ x\isanewline
  6.1035 +\ \ \ \ else\ {\isacharparenleft}pow{\isacharunderscore}nat\ {\isacharparenleft}nat\ {\isacharparenleft}{\isacharminus}\ k{\isacharparenright}{\isacharparenright}\ x{\isacharparenright}{\isasymdiv}{\isacharparenright}{\isachardoublequoteclose}%
  6.1036 +\endisatagquote
  6.1037 +{\isafoldquote}%
  6.1038 +%
  6.1039 +\isadelimquote
  6.1040 +%
  6.1041 +\endisadelimquote
  6.1042 +%
  6.1043 +\begin{isamarkuptext}%
  6.1044 +\noindent yields the global definition of
  6.1045 +  \isa{{\isachardoublequote}pow{\isacharunderscore}int\ {\isasymColon}\ int\ {\isasymRightarrow}\ {\isasymalpha}{\isasymColon}group\ {\isasymRightarrow}\ {\isasymalpha}{\isasymColon}group{\isachardoublequote}}
  6.1046 +  with the corresponding theorem \isa{pow{\isacharunderscore}int\ k\ x\ {\isacharequal}\ {\isacharparenleft}if\ {\isadigit{0}}\ {\isasymle}\ k\ then\ pow{\isacharunderscore}nat\ {\isacharparenleft}nat\ k{\isacharparenright}\ x\ else\ {\isacharparenleft}pow{\isacharunderscore}nat\ {\isacharparenleft}nat\ {\isacharparenleft}{\isacharminus}\ k{\isacharparenright}{\isacharparenright}\ x{\isacharparenright}{\isasymdiv}{\isacharparenright}}.%
  6.1047 +\end{isamarkuptext}%
  6.1048 +\isamarkuptrue%
  6.1049 +%
  6.1050 +\isamarkupsubsection{A note on syntax%
  6.1051 +}
  6.1052 +\isamarkuptrue%
  6.1053 +%
  6.1054 +\begin{isamarkuptext}%
  6.1055 +As a commodity, class context syntax allows to refer
  6.1056 +  to local class operations and their global counterparts
  6.1057 +  uniformly;  type inference resolves ambiguities.  For example:%
  6.1058 +\end{isamarkuptext}%
  6.1059 +\isamarkuptrue%
  6.1060 +%
  6.1061 +\isadelimquote
  6.1062 +%
  6.1063 +\endisadelimquote
  6.1064 +%
  6.1065 +\isatagquote
  6.1066 +\isacommand{context}\isamarkupfalse%
  6.1067 +\ semigroup\isanewline
  6.1068 +\isakeyword{begin}\isanewline
  6.1069 +\isanewline
  6.1070 +\isacommand{term}\isamarkupfalse%
  6.1071 +\ {\isachardoublequoteopen}x\ {\isasymotimes}\ y{\isachardoublequoteclose}\ %
  6.1072 +\isamarkupcmt{example 1%
  6.1073 +}
  6.1074 +\isanewline
  6.1075 +\isacommand{term}\isamarkupfalse%
  6.1076 +\ {\isachardoublequoteopen}{\isacharparenleft}x{\isasymColon}nat{\isacharparenright}\ {\isasymotimes}\ y{\isachardoublequoteclose}\ %
  6.1077 +\isamarkupcmt{example 2%
  6.1078 +}
  6.1079 +\isanewline
  6.1080 +\isanewline
  6.1081 +\isacommand{end}\isamarkupfalse%
  6.1082 +\isanewline
  6.1083 +\isanewline
  6.1084 +\isacommand{term}\isamarkupfalse%
  6.1085 +\ {\isachardoublequoteopen}x\ {\isasymotimes}\ y{\isachardoublequoteclose}\ %
  6.1086 +\isamarkupcmt{example 3%
  6.1087 +}
  6.1088 +%
  6.1089 +\endisatagquote
  6.1090 +{\isafoldquote}%
  6.1091 +%
  6.1092 +\isadelimquote
  6.1093 +%
  6.1094 +\endisadelimquote
  6.1095 +%
  6.1096 +\begin{isamarkuptext}%
  6.1097 +\noindent Here in example 1, the term refers to the local class operation
  6.1098 +  \isa{mult\ {\isacharbrackleft}{\isasymalpha}{\isacharbrackright}}, whereas in example 2 the type constraint
  6.1099 +  enforces the global class operation \isa{mult\ {\isacharbrackleft}nat{\isacharbrackright}}.
  6.1100 +  In the global context in example 3, the reference is
  6.1101 +  to the polymorphic global class operation \isa{mult\ {\isacharbrackleft}{\isacharquery}{\isasymalpha}\ {\isasymColon}\ semigroup{\isacharbrackright}}.%
  6.1102 +\end{isamarkuptext}%
  6.1103 +\isamarkuptrue%
  6.1104 +%
  6.1105 +\isamarkupsection{Further issues%
  6.1106 +}
  6.1107 +\isamarkuptrue%
  6.1108 +%
  6.1109 +\isamarkupsubsection{Type classes and code generation%
  6.1110 +}
  6.1111 +\isamarkuptrue%
  6.1112 +%
  6.1113 +\begin{isamarkuptext}%
  6.1114 +Turning back to the first motivation for type classes,
  6.1115 +  namely overloading, it is obvious that overloading
  6.1116 +  stemming from \hyperlink{command.class}{\mbox{\isa{\isacommand{class}}}} statements and
  6.1117 +  \hyperlink{command.instantiation}{\mbox{\isa{\isacommand{instantiation}}}}
  6.1118 +  targets naturally maps to Haskell type classes.
  6.1119 +  The code generator framework \cite{isabelle-codegen} 
  6.1120 +  takes this into account.  Concerning target languages
  6.1121 +  lacking type classes (e.g.~SML), type classes
  6.1122 +  are implemented by explicit dictionary construction.
  6.1123 +  As example, let's go back to the power function:%
  6.1124 +\end{isamarkuptext}%
  6.1125 +\isamarkuptrue%
  6.1126 +%
  6.1127 +\isadelimquote
  6.1128 +%
  6.1129 +\endisadelimquote
  6.1130 +%
  6.1131 +\isatagquote
  6.1132 +\isacommand{definition}\isamarkupfalse%
  6.1133 +\ example\ {\isacharcolon}{\isacharcolon}\ int\ \isakeyword{where}\isanewline
  6.1134 +\ \ {\isachardoublequoteopen}example\ {\isacharequal}\ pow{\isacharunderscore}int\ {\isadigit{1}}{\isadigit{0}}\ {\isacharparenleft}{\isacharminus}{\isadigit{2}}{\isacharparenright}{\isachardoublequoteclose}%
  6.1135 +\endisatagquote
  6.1136 +{\isafoldquote}%
  6.1137 +%
  6.1138 +\isadelimquote
  6.1139 +%
  6.1140 +\endisadelimquote
  6.1141 +%
  6.1142 +\begin{isamarkuptext}%
  6.1143 +\noindent This maps to Haskell as:%
  6.1144 +\end{isamarkuptext}%
  6.1145 +\isamarkuptrue%
  6.1146 +%
  6.1147 +\isadelimquote
  6.1148 +%
  6.1149 +\endisadelimquote
  6.1150 +%
  6.1151 +\isatagquote
  6.1152 +%
  6.1153 +\begin{isamarkuptext}%
  6.1154 +\isatypewriter%
  6.1155 +\noindent%
  6.1156 +\hspace*{0pt}module Example where {\char123}\\
  6.1157 +\hspace*{0pt}\\
  6.1158 +\hspace*{0pt}\\
  6.1159 +\hspace*{0pt}data Nat = Zero{\char95}nat | Suc Nat;\\
  6.1160 +\hspace*{0pt}\\
  6.1161 +\hspace*{0pt}nat{\char95}aux ::~Integer -> Nat -> Nat;\\
  6.1162 +\hspace*{0pt}nat{\char95}aux i n = (if i <= 0 then n else nat{\char95}aux (i - 1) (Suc n));\\
  6.1163 +\hspace*{0pt}\\
  6.1164 +\hspace*{0pt}nat ::~Integer -> Nat;\\
  6.1165 +\hspace*{0pt}nat i = nat{\char95}aux i Zero{\char95}nat;\\
  6.1166 +\hspace*{0pt}\\
  6.1167 +\hspace*{0pt}class Semigroup a where {\char123}\\
  6.1168 +\hspace*{0pt} ~mult ::~a -> a -> a;\\
  6.1169 +\hspace*{0pt}{\char125};\\
  6.1170 +\hspace*{0pt}\\
  6.1171 +\hspace*{0pt}class (Semigroup a) => Monoidl a where {\char123}\\
  6.1172 +\hspace*{0pt} ~neutral ::~a;\\
  6.1173 +\hspace*{0pt}{\char125};\\
  6.1174 +\hspace*{0pt}\\
  6.1175 +\hspace*{0pt}class (Monoidl a) => Monoid a where {\char123}\\
  6.1176 +\hspace*{0pt}{\char125};\\
  6.1177 +\hspace*{0pt}\\
  6.1178 +\hspace*{0pt}class (Monoid a) => Group a where {\char123}\\
  6.1179 +\hspace*{0pt} ~inverse ::~a -> a;\\
  6.1180 +\hspace*{0pt}{\char125};\\
  6.1181 +\hspace*{0pt}\\
  6.1182 +\hspace*{0pt}inverse{\char95}int ::~Integer -> Integer;\\
  6.1183 +\hspace*{0pt}inverse{\char95}int i = negate i;\\
  6.1184 +\hspace*{0pt}\\
  6.1185 +\hspace*{0pt}neutral{\char95}int ::~Integer;\\
  6.1186 +\hspace*{0pt}neutral{\char95}int = 0;\\
  6.1187 +\hspace*{0pt}\\
  6.1188 +\hspace*{0pt}mult{\char95}int ::~Integer -> Integer -> Integer;\\
  6.1189 +\hspace*{0pt}mult{\char95}int i j = i + j;\\
  6.1190 +\hspace*{0pt}\\
  6.1191 +\hspace*{0pt}instance Semigroup Integer where {\char123}\\
  6.1192 +\hspace*{0pt} ~mult = mult{\char95}int;\\
  6.1193 +\hspace*{0pt}{\char125};\\
  6.1194 +\hspace*{0pt}\\
  6.1195 +\hspace*{0pt}instance Monoidl Integer where {\char123}\\
  6.1196 +\hspace*{0pt} ~neutral = neutral{\char95}int;\\
  6.1197 +\hspace*{0pt}{\char125};\\
  6.1198 +\hspace*{0pt}\\
  6.1199 +\hspace*{0pt}instance Monoid Integer where {\char123}\\
  6.1200 +\hspace*{0pt}{\char125};\\
  6.1201 +\hspace*{0pt}\\
  6.1202 +\hspace*{0pt}instance Group Integer where {\char123}\\
  6.1203 +\hspace*{0pt} ~inverse = inverse{\char95}int;\\
  6.1204 +\hspace*{0pt}{\char125};\\
  6.1205 +\hspace*{0pt}\\
  6.1206 +\hspace*{0pt}pow{\char95}nat ::~forall a.~(Monoid a) => Nat -> a -> a;\\
  6.1207 +\hspace*{0pt}pow{\char95}nat Zero{\char95}nat x = neutral;\\
  6.1208 +\hspace*{0pt}pow{\char95}nat (Suc n) x = mult x (pow{\char95}nat n x);\\
  6.1209 +\hspace*{0pt}\\
  6.1210 +\hspace*{0pt}pow{\char95}int ::~forall a.~(Group a) => Integer -> a -> a;\\
  6.1211 +\hspace*{0pt}pow{\char95}int k x =\\
  6.1212 +\hspace*{0pt} ~(if 0 <= k then pow{\char95}nat (nat k) x\\
  6.1213 +\hspace*{0pt} ~~~else inverse (pow{\char95}nat (nat (negate k)) x));\\
  6.1214 +\hspace*{0pt}\\
  6.1215 +\hspace*{0pt}example ::~Integer;\\
  6.1216 +\hspace*{0pt}example = pow{\char95}int 10 (-2);\\
  6.1217 +\hspace*{0pt}\\
  6.1218 +\hspace*{0pt}{\char125}%
  6.1219 +\end{isamarkuptext}%
  6.1220 +\isamarkuptrue%
  6.1221 +%
  6.1222 +\endisatagquote
  6.1223 +{\isafoldquote}%
  6.1224 +%
  6.1225 +\isadelimquote
  6.1226 +%
  6.1227 +\endisadelimquote
  6.1228 +%
  6.1229 +\begin{isamarkuptext}%
  6.1230 +\noindent The whole code in SML with explicit dictionary passing:%
  6.1231 +\end{isamarkuptext}%
  6.1232 +\isamarkuptrue%
  6.1233 +%
  6.1234 +\isadelimquote
  6.1235 +%
  6.1236 +\endisadelimquote
  6.1237 +%
  6.1238 +\isatagquote
  6.1239 +%
  6.1240 +\begin{isamarkuptext}%
  6.1241 +\isatypewriter%
  6.1242 +\noindent%
  6.1243 +\hspace*{0pt}structure Example = \\
  6.1244 +\hspace*{0pt}struct\\
  6.1245 +\hspace*{0pt}\\
  6.1246 +\hspace*{0pt}datatype nat = Zero{\char95}nat | Suc of nat;\\
  6.1247 +\hspace*{0pt}\\
  6.1248 +\hspace*{0pt}fun nat{\char95}aux i n =\\
  6.1249 +\hspace*{0pt} ~(if IntInf.<= (i,~(0 :~IntInf.int)) then n\\
  6.1250 +\hspace*{0pt} ~~~else nat{\char95}aux (IntInf.- (i,~(1 :~IntInf.int))) (Suc n));\\
  6.1251 +\hspace*{0pt}\\
  6.1252 +\hspace*{0pt}fun nat i = nat{\char95}aux i Zero{\char95}nat;\\
  6.1253 +\hspace*{0pt}\\
  6.1254 +\hspace*{0pt}type 'a semigroup = {\char123}mult :~'a -> 'a -> 'a{\char125};\\
  6.1255 +\hspace*{0pt}fun mult (A{\char95}:'a semigroup) = {\char35}mult A{\char95};\\
  6.1256 +\hspace*{0pt}\\
  6.1257 +\hspace*{0pt}type 'a monoidl =\\
  6.1258 +\hspace*{0pt} ~{\char123}Classes{\char95}{\char95}semigroup{\char95}monoidl :~'a semigroup,~neutral :~'a{\char125};\\
  6.1259 +\hspace*{0pt}fun semigroup{\char95}monoidl (A{\char95}:'a monoidl) = {\char35}Classes{\char95}{\char95}semigroup{\char95}monoidl A{\char95};\\
  6.1260 +\hspace*{0pt}fun neutral (A{\char95}:'a monoidl) = {\char35}neutral A{\char95};\\
  6.1261 +\hspace*{0pt}\\
  6.1262 +\hspace*{0pt}type 'a monoid = {\char123}Classes{\char95}{\char95}monoidl{\char95}monoid :~'a monoidl{\char125};\\
  6.1263 +\hspace*{0pt}fun monoidl{\char95}monoid (A{\char95}:'a monoid) = {\char35}Classes{\char95}{\char95}monoidl{\char95}monoid A{\char95};\\
  6.1264 +\hspace*{0pt}\\
  6.1265 +\hspace*{0pt}type 'a group = {\char123}Classes{\char95}{\char95}monoid{\char95}group :~'a monoid,~inverse :~'a -> 'a{\char125};\\
  6.1266 +\hspace*{0pt}fun monoid{\char95}group (A{\char95}:'a group) = {\char35}Classes{\char95}{\char95}monoid{\char95}group A{\char95};\\
  6.1267 +\hspace*{0pt}fun inverse (A{\char95}:'a group) = {\char35}inverse A{\char95};\\
  6.1268 +\hspace*{0pt}\\
  6.1269 +\hspace*{0pt}fun inverse{\char95}int i = IntInf.{\char126}~i;\\
  6.1270 +\hspace*{0pt}\\
  6.1271 +\hspace*{0pt}val neutral{\char95}int :~IntInf.int = (0 :~IntInf.int)\\
  6.1272 +\hspace*{0pt}\\
  6.1273 +\hspace*{0pt}fun mult{\char95}int i j = IntInf.+ (i,~j);\\
  6.1274 +\hspace*{0pt}\\
  6.1275 +\hspace*{0pt}val semigroup{\char95}int = {\char123}mult = mult{\char95}int{\char125}~:~IntInf.int semigroup;\\
  6.1276 +\hspace*{0pt}\\
  6.1277 +\hspace*{0pt}val monoidl{\char95}int =\\
  6.1278 +\hspace*{0pt} ~{\char123}Classes{\char95}{\char95}semigroup{\char95}monoidl = semigroup{\char95}int,~neutral = neutral{\char95}int{\char125}~:\\
  6.1279 +\hspace*{0pt} ~IntInf.int monoidl;\\
  6.1280 +\hspace*{0pt}\\
  6.1281 +\hspace*{0pt}val monoid{\char95}int = {\char123}Classes{\char95}{\char95}monoidl{\char95}monoid = monoidl{\char95}int{\char125}~:\\
  6.1282 +\hspace*{0pt} ~IntInf.int monoid;\\
  6.1283 +\hspace*{0pt}\\
  6.1284 +\hspace*{0pt}val group{\char95}int =\\
  6.1285 +\hspace*{0pt} ~{\char123}Classes{\char95}{\char95}monoid{\char95}group = monoid{\char95}int,~inverse = inverse{\char95}int{\char125}~:\\
  6.1286 +\hspace*{0pt} ~IntInf.int group;\\
  6.1287 +\hspace*{0pt}\\
  6.1288 +\hspace*{0pt}fun pow{\char95}nat A{\char95}~Zero{\char95}nat x = neutral (monoidl{\char95}monoid A{\char95})\\
  6.1289 +\hspace*{0pt} ~| pow{\char95}nat A{\char95}~(Suc n) x =\\
  6.1290 +\hspace*{0pt} ~~~mult ((semigroup{\char95}monoidl o monoidl{\char95}monoid) A{\char95}) x (pow{\char95}nat A{\char95}~n x);\\
  6.1291 +\hspace*{0pt}\\
  6.1292 +\hspace*{0pt}fun pow{\char95}int A{\char95}~k x =\\
  6.1293 +\hspace*{0pt} ~(if IntInf.<= ((0 :~IntInf.int),~k)\\
  6.1294 +\hspace*{0pt} ~~~then pow{\char95}nat (monoid{\char95}group A{\char95}) (nat k) x\\
  6.1295 +\hspace*{0pt} ~~~else inverse A{\char95}~(pow{\char95}nat (monoid{\char95}group A{\char95}) (nat (IntInf.{\char126}~k)) x));\\
  6.1296 +\hspace*{0pt}\\
  6.1297 +\hspace*{0pt}val example :~IntInf.int =\\
  6.1298 +\hspace*{0pt} ~pow{\char95}int group{\char95}int (10 :~IntInf.int) ({\char126}2 :~IntInf.int)\\
  6.1299 +\hspace*{0pt}\\
  6.1300 +\hspace*{0pt}end;~(*struct Example*)%
  6.1301 +\end{isamarkuptext}%
  6.1302 +\isamarkuptrue%
  6.1303 +%
  6.1304 +\endisatagquote
  6.1305 +{\isafoldquote}%
  6.1306 +%
  6.1307 +\isadelimquote
  6.1308 +%
  6.1309 +\endisadelimquote
  6.1310 +%
  6.1311 +\isamarkupsubsection{Inspecting the type class universe%
  6.1312 +}
  6.1313 +\isamarkuptrue%
  6.1314 +%
  6.1315 +\begin{isamarkuptext}%
  6.1316 +To facilitate orientation in complex subclass structures,
  6.1317 +  two diagnostics commands are provided:
  6.1318 +
  6.1319 +  \begin{description}
  6.1320 +
  6.1321 +    \item[\hyperlink{command.print-classes}{\mbox{\isa{\isacommand{print{\isacharunderscore}classes}}}}] print a list of all classes
  6.1322 +      together with associated operations etc.
  6.1323 +
  6.1324 +    \item[\hyperlink{command.class-deps}{\mbox{\isa{\isacommand{class{\isacharunderscore}deps}}}}] visualizes the subclass relation
  6.1325 +      between all classes as a Hasse diagram.
  6.1326 +
  6.1327 +  \end{description}%
  6.1328 +\end{isamarkuptext}%
  6.1329 +\isamarkuptrue%
  6.1330 +%
  6.1331 +\isadelimtheory
  6.1332 +%
  6.1333 +\endisadelimtheory
  6.1334 +%
  6.1335 +\isatagtheory
  6.1336 +\isacommand{end}\isamarkupfalse%
  6.1337 +%
  6.1338 +\endisatagtheory
  6.1339 +{\isafoldtheory}%
  6.1340 +%
  6.1341 +\isadelimtheory
  6.1342 +%
  6.1343 +\endisadelimtheory
  6.1344 +\isanewline
  6.1345 +\end{isabellebody}%
  6.1346 +%%% Local Variables:
  6.1347 +%%% mode: latex
  6.1348 +%%% TeX-master: "root"
  6.1349 +%%% End:
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/doc-src/Classes/classes.tex	Tue Mar 03 11:00:51 2009 +0100
     7.3 @@ -0,0 +1,50 @@
     7.4 +
     7.5 +\documentclass[12pt,a4paper,fleqn]{report}
     7.6 +\usepackage{latexsym,graphicx}
     7.7 +\usepackage[refpage]{nomencl}
     7.8 +\usepackage{../iman,../extra,../isar,../proof}
     7.9 +\usepackage{../isabelle,../isabellesym}
    7.10 +\usepackage{style}
    7.11 +\usepackage{../pdfsetup}
    7.12 +
    7.13 +
    7.14 +\hyphenation{Isabelle}
    7.15 +\hyphenation{Isar}
    7.16 +\isadroptag{theory}
    7.17 +
    7.18 +\title{\includegraphics[scale=0.5]{isabelle_isar}
    7.19 +  \\[4ex] Haskell-style type classes with Isabelle/Isar}
    7.20 +\author{\emph{Florian Haftmann}}
    7.21 +
    7.22 +\begin{document}
    7.23 +
    7.24 +\maketitle
    7.25 +
    7.26 +\begin{abstract}
    7.27 +  This tutorial introduces the look-and-feel of Isar type classes
    7.28 +  to the end-user; Isar type classes are a convenient mechanism
    7.29 +  for organizing specifications, overcoming some drawbacks
    7.30 +  of raw axiomatic type classes. Essentially, they combine
    7.31 +  an operational aspect (in the manner of Haskell) with
    7.32 +  a logical aspect, both managed uniformly.
    7.33 +\end{abstract}
    7.34 +
    7.35 +\thispagestyle{empty}\clearpage
    7.36 +
    7.37 +\pagenumbering{roman}
    7.38 +\clearfirst
    7.39 +
    7.40 +\input{Thy/document/Classes.tex}
    7.41 +
    7.42 +\begingroup
    7.43 +\bibliographystyle{plain} \small\raggedright\frenchspacing
    7.44 +\bibliography{../manual}
    7.45 +\endgroup
    7.46 +
    7.47 +\end{document}
    7.48 +
    7.49 +
    7.50 +%%% Local Variables: 
    7.51 +%%% mode: latex
    7.52 +%%% TeX-master: t
    7.53 +%%% End: 
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/doc-src/Classes/style.sty	Tue Mar 03 11:00:51 2009 +0100
     8.3 @@ -0,0 +1,43 @@
     8.4 +
     8.5 +%% toc
     8.6 +\newcommand{\tocentry}[1]{\cleardoublepage\phantomsection\addcontentsline{toc}{chapter}{#1}
     8.7 +\@mkboth{\MakeUppercase{#1}}{\MakeUppercase{#1}}}
     8.8 +
     8.9 +%% references
    8.10 +\newcommand{\secref}[1]{\S\ref{#1}}
    8.11 +\newcommand{\figref}[1]{figure~\ref{#1}}
    8.12 +
    8.13 +%% logical markup
    8.14 +\newcommand{\strong}[1]{{\bfseries {#1}}}
    8.15 +\newcommand{\qn}[1]{\emph{#1}}
    8.16 +
    8.17 +%% typographic conventions
    8.18 +\newcommand{\qt}[1]{``{#1}''}
    8.19 +
    8.20 +%% verbatim text
    8.21 +\newcommand{\isatypewriter}{\fontsize{9pt}{0pt}\tt\renewcommand{\baselinestretch}{1}\setlength{\baselineskip}{9pt}}
    8.22 +
    8.23 +%% quoted segments
    8.24 +\makeatletter
    8.25 +\isakeeptag{quote}
    8.26 +\newenvironment{quotesegment}{\begin{quote}\isa@parindent\parindent\parindent0pt\isa@parskip\parskip\parskip0pt}{\end{quote}}
    8.27 +\renewcommand{\isatagquote}{\begin{quotesegment}}
    8.28 +\renewcommand{\endisatagquote}{\end{quotesegment}}
    8.29 +\makeatother
    8.30 +
    8.31 +%% presentation
    8.32 +\setcounter{secnumdepth}{2} \setcounter{tocdepth}{2}
    8.33 +
    8.34 +\pagestyle{headings}
    8.35 +\binperiod
    8.36 +\underscoreoff
    8.37 +
    8.38 +\renewcommand{\isadigit}[1]{\isamath{#1}}
    8.39 +
    8.40 +\isabellestyle{it}
    8.41 +
    8.42 +
    8.43 +%%% Local Variables: 
    8.44 +%%% mode: latex
    8.45 +%%% TeX-master: "implementation"
    8.46 +%%% End: 
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/doc-src/Codegen/IsaMakefile	Tue Mar 03 11:00:51 2009 +0100
     9.3 @@ -0,0 +1,33 @@
     9.4 +
     9.5 +## targets
     9.6 +
     9.7 +default: Thy
     9.8 +images: 
     9.9 +test: Thy
    9.10 +
    9.11 +all: images test
    9.12 +
    9.13 +
    9.14 +## global settings
    9.15 +
    9.16 +SRC = $(ISABELLE_HOME)/src
    9.17 +OUT = $(ISABELLE_OUTPUT)
    9.18 +LOG = $(OUT)/log
    9.19 +
    9.20 +USEDIR = $(ISABELLE_TOOL) usedir -v true -i false -d false -C false -D document
    9.21 +
    9.22 +
    9.23 +## Thy
    9.24 +
    9.25 +THY = $(LOG)/HOL-Thy.gz
    9.26 +
    9.27 +Thy: $(THY)
    9.28 +
    9.29 +$(THY): Thy/ROOT.ML Thy/*.thy ../antiquote_setup.ML ../more_antiquote.ML
    9.30 +	@$(USEDIR) HOL Thy
    9.31 +
    9.32 +
    9.33 +## clean
    9.34 +
    9.35 +clean:
    9.36 +	@rm -f $(THY)
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/doc-src/Codegen/Makefile	Tue Mar 03 11:00:51 2009 +0100
    10.3 @@ -0,0 +1,35 @@
    10.4 +
    10.5 +## targets
    10.6 +
    10.7 +default: dvi
    10.8 +
    10.9 +
   10.10 +## dependencies
   10.11 +
   10.12 +include ../Makefile.in
   10.13 +
   10.14 +NAME = codegen
   10.15 +
   10.16 +FILES = $(NAME).tex Thy/document/*.tex \
   10.17 +  style.sty ../iman.sty ../extra.sty ../isar.sty \
   10.18 +  ../isabelle.sty ../isabellesym.sty ../pdfsetup.sty \
   10.19 +  ../manual.bib ../proof.sty
   10.20 +
   10.21 +dvi: $(NAME).dvi
   10.22 +
   10.23 +$(NAME).dvi: $(FILES) isabelle_isar.eps codegen_process.ps
   10.24 +	$(LATEX) $(NAME)
   10.25 +	$(BIBTEX) $(NAME)
   10.26 +	$(LATEX) $(NAME)
   10.27 +	$(LATEX) $(NAME)
   10.28 +
   10.29 +pdf: $(NAME).pdf
   10.30 +
   10.31 +$(NAME).pdf: $(FILES) isabelle_isar.pdf codegen_process.pdf
   10.32 +	$(PDFLATEX) $(NAME)
   10.33 +	$(BIBTEX) $(NAME)
   10.34 +	$(PDFLATEX) $(NAME)
   10.35 +	$(PDFLATEX) $(NAME)
   10.36 +	$(FIXBOOKMARKS) $(NAME).out
   10.37 +	$(PDFLATEX) $(NAME)
   10.38 +	$(PDFLATEX) $(NAME)
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/doc-src/Codegen/Thy/Adaption.thy	Tue Mar 03 11:00:51 2009 +0100
    11.3 @@ -0,0 +1,361 @@
    11.4 +theory Adaption
    11.5 +imports Setup
    11.6 +begin
    11.7 +
    11.8 +setup %invisible {* Code_Target.extend_target ("\<SML>", ("SML", K I)) *}
    11.9 +
   11.10 +section {* Adaption to target languages \label{sec:adaption} *}
   11.11 +
   11.12 +subsection {* Adapting code generation *}
   11.13 +
   11.14 +text {*
   11.15 +  The aspects of code generation introduced so far have two aspects
   11.16 +  in common:
   11.17 +
   11.18 +  \begin{itemize}
   11.19 +    \item They act uniformly, without reference to a specific
   11.20 +       target language.
   11.21 +    \item They are \emph{safe} in the sense that as long as you trust
   11.22 +       the code generator meta theory and implementation, you cannot
   11.23 +       produce programs that yield results which are not derivable
   11.24 +       in the logic.
   11.25 +  \end{itemize}
   11.26 +
   11.27 +  \noindent In this section we will introduce means to \emph{adapt} the serialiser
   11.28 +  to a specific target language, i.e.~to print program fragments
   11.29 +  in a way which accommodates \qt{already existing} ingredients of
   11.30 +  a target language environment, for three reasons:
   11.31 +
   11.32 +  \begin{itemize}
   11.33 +    \item improving readability and aesthetics of generated code
   11.34 +    \item gaining efficiency
   11.35 +    \item interface with language parts which have no direct counterpart
   11.36 +      in @{text "HOL"} (say, imperative data structures)
   11.37 +  \end{itemize}
   11.38 +
   11.39 +  \noindent Generally, you should avoid using those features yourself
   11.40 +  \emph{at any cost}:
   11.41 +
   11.42 +  \begin{itemize}
   11.43 +    \item The safe configuration methods act uniformly on every target language,
   11.44 +      whereas for adaption you have to treat each target language separate.
   11.45 +    \item Application is extremely tedious since there is no abstraction
   11.46 +      which would allow for a static check, making it easy to produce garbage.
   11.47 +    \item More or less subtle errors can be introduced unconsciously.
   11.48 +  \end{itemize}
   11.49 +
   11.50 +  \noindent However, even if you ought refrain from setting up adaption
   11.51 +  yourself, already the @{text "HOL"} comes with some reasonable default
   11.52 +  adaptions (say, using target language list syntax).  There also some
   11.53 +  common adaption cases which you can setup by importing particular
   11.54 +  library theories.  In order to understand these, we provide some clues here;
   11.55 +  these however are not supposed to replace a careful study of the sources.
   11.56 +*}
   11.57 +
   11.58 +subsection {* The adaption principle *}
   11.59 +
   11.60 +text {*
   11.61 +  The following figure illustrates what \qt{adaption} is conceptually
   11.62 +  supposed to be:
   11.63 +
   11.64 +  \begin{figure}[here]
   11.65 +    \begin{tikzpicture}[scale = 0.5]
   11.66 +      \tikzstyle water=[color = blue, thick]
   11.67 +      \tikzstyle ice=[color = black, very thick, cap = round, join = round, fill = white]
   11.68 +      \tikzstyle process=[color = green, semithick, ->]
   11.69 +      \tikzstyle adaption=[color = red, semithick, ->]
   11.70 +      \tikzstyle target=[color = black]
   11.71 +      \foreach \x in {0, ..., 24}
   11.72 +        \draw[style=water] (\x, 0.25) sin + (0.25, 0.25) cos + (0.25, -0.25) sin
   11.73 +          + (0.25, -0.25) cos + (0.25, 0.25);
   11.74 +      \draw[style=ice] (1, 0) --
   11.75 +        (3, 6) node[above, fill=white] {logic} -- (5, 0) -- cycle;
   11.76 +      \draw[style=ice] (9, 0) --
   11.77 +        (11, 6) node[above, fill=white] {intermediate language} -- (13, 0) -- cycle;
   11.78 +      \draw[style=ice] (15, -6) --
   11.79 +        (19, 6) node[above, fill=white] {target language} -- (23, -6) -- cycle;
   11.80 +      \draw[style=process]
   11.81 +        (3.5, 3) .. controls (7, 5) .. node[fill=white] {translation} (10.5, 3);
   11.82 +      \draw[style=process]
   11.83 +        (11.5, 3) .. controls (15, 5) .. node[fill=white] (serialisation) {serialisation} (18.5, 3);
   11.84 +      \node (adaption) at (11, -2) [style=adaption] {adaption};
   11.85 +      \node at (19, 3) [rotate=90] {generated};
   11.86 +      \node at (19.5, -5) {language};
   11.87 +      \node at (19.5, -3) {library};
   11.88 +      \node (includes) at (19.5, -1) {includes};
   11.89 +      \node (reserved) at (16.5, -3) [rotate=72] {reserved}; % proper 71.57
   11.90 +      \draw[style=process]
   11.91 +        (includes) -- (serialisation);
   11.92 +      \draw[style=process]
   11.93 +        (reserved) -- (serialisation);
   11.94 +      \draw[style=adaption]
   11.95 +        (adaption) -- (serialisation);
   11.96 +      \draw[style=adaption]
   11.97 +        (adaption) -- (includes);
   11.98 +      \draw[style=adaption]
   11.99 +        (adaption) -- (reserved);
  11.100 +    \end{tikzpicture}
  11.101 +    \caption{The adaption principle}
  11.102 +    \label{fig:adaption}
  11.103 +  \end{figure}
  11.104 +
  11.105 +  \noindent In the tame view, code generation acts as broker between
  11.106 +  @{text logic}, @{text "intermediate language"} and
  11.107 +  @{text "target language"} by means of @{text translation} and
  11.108 +  @{text serialisation};  for the latter, the serialiser has to observe
  11.109 +  the structure of the @{text language} itself plus some @{text reserved}
  11.110 +  keywords which have to be avoided for generated code.
  11.111 +  However, if you consider @{text adaption} mechanisms, the code generated
  11.112 +  by the serializer is just the tip of the iceberg:
  11.113 +
  11.114 +  \begin{itemize}
  11.115 +    \item @{text serialisation} can be \emph{parametrised} such that
  11.116 +      logical entities are mapped to target-specific ones
  11.117 +      (e.g. target-specific list syntax,
  11.118 +        see also \secref{sec:adaption_mechanisms})
  11.119 +    \item Such parametrisations can involve references to a
  11.120 +      target-specific standard @{text library} (e.g. using
  11.121 +      the @{text Haskell} @{verbatim Maybe} type instead
  11.122 +      of the @{text HOL} @{type "option"} type);
  11.123 +      if such are used, the corresponding identifiers
  11.124 +      (in our example, @{verbatim Maybe}, @{verbatim Nothing}
  11.125 +      and @{verbatim Just}) also have to be considered @{text reserved}.
  11.126 +    \item Even more, the user can enrich the library of the
  11.127 +      target-language by providing code snippets
  11.128 +      (\qt{@{text "includes"}}) which are prepended to
  11.129 +      any generated code (see \secref{sec:include});  this typically
  11.130 +      also involves further @{text reserved} identifiers.
  11.131 +  \end{itemize}
  11.132 +
  11.133 +  \noindent As figure \ref{fig:adaption} illustrates, all these adaption mechanisms
  11.134 +  have to act consistently;  it is at the discretion of the user
  11.135 +  to take care for this.
  11.136 +*}
  11.137 +
  11.138 +subsection {* Common adaption patterns *}
  11.139 +
  11.140 +text {*
  11.141 +  The @{theory HOL} @{theory Main} theory already provides a code
  11.142 +  generator setup
  11.143 +  which should be suitable for most applications.  Common extensions
  11.144 +  and modifications are available by certain theories of the @{text HOL}
  11.145 +  library; beside being useful in applications, they may serve
  11.146 +  as a tutorial for customising the code generator setup (see below
  11.147 +  \secref{sec:adaption_mechanisms}).
  11.148 +
  11.149 +  \begin{description}
  11.150 +
  11.151 +    \item[@{theory "Code_Integer"}] represents @{text HOL} integers by big
  11.152 +       integer literals in target languages.
  11.153 +    \item[@{theory "Code_Char"}] represents @{text HOL} characters by 
  11.154 +       character literals in target languages.
  11.155 +    \item[@{theory "Code_Char_chr"}] like @{text "Code_Char"},
  11.156 +       but also offers treatment of character codes; includes
  11.157 +       @{theory "Code_Char"}.
  11.158 +    \item[@{theory "Efficient_Nat"}] \label{eff_nat} implements natural numbers by integers,
  11.159 +       which in general will result in higher efficiency; pattern
  11.160 +       matching with @{term "0\<Colon>nat"} / @{const "Suc"}
  11.161 +       is eliminated;  includes @{theory "Code_Integer"}
  11.162 +       and @{theory "Code_Index"}.
  11.163 +    \item[@{theory "Code_Index"}] provides an additional datatype
  11.164 +       @{typ index} which is mapped to target-language built-in integers.
  11.165 +       Useful for code setups which involve e.g. indexing of
  11.166 +       target-language arrays.
  11.167 +    \item[@{theory "Code_Message"}] provides an additional datatype
  11.168 +       @{typ message_string} which is isomorphic to strings;
  11.169 +       @{typ message_string}s are mapped to target-language strings.
  11.170 +       Useful for code setups which involve e.g. printing (error) messages.
  11.171 +
  11.172 +  \end{description}
  11.173 +
  11.174 +  \begin{warn}
  11.175 +    When importing any of these theories, they should form the last
  11.176 +    items in an import list.  Since these theories adapt the
  11.177 +    code generator setup in a non-conservative fashion,
  11.178 +    strange effects may occur otherwise.
  11.179 +  \end{warn}
  11.180 +*}
  11.181 +
  11.182 +
  11.183 +subsection {* Parametrising serialisation \label{sec:adaption_mechanisms} *}
  11.184 +
  11.185 +text {*
  11.186 +  Consider the following function and its corresponding
  11.187 +  SML code:
  11.188 +*}
  11.189 +
  11.190 +primrec %quote in_interval :: "nat \<times> nat \<Rightarrow> nat \<Rightarrow> bool" where
  11.191 +  "in_interval (k, l) n \<longleftrightarrow> k \<le> n \<and> n \<le> l"
  11.192 +(*<*)
  11.193 +code_type %invisible bool
  11.194 +  (SML)
  11.195 +code_const %invisible True and False and "op \<and>" and Not
  11.196 +  (SML and and and)
  11.197 +(*>*)
  11.198 +text %quote {*@{code_stmts in_interval (SML)}*}
  11.199 +
  11.200 +text {*
  11.201 +  \noindent Though this is correct code, it is a little bit unsatisfactory:
  11.202 +  boolean values and operators are materialised as distinguished
  11.203 +  entities with have nothing to do with the SML-built-in notion
  11.204 +  of \qt{bool}.  This results in less readable code;
  11.205 +  additionally, eager evaluation may cause programs to
  11.206 +  loop or break which would perfectly terminate when
  11.207 +  the existing SML @{verbatim "bool"} would be used.  To map
  11.208 +  the HOL @{typ bool} on SML @{verbatim "bool"}, we may use
  11.209 +  \qn{custom serialisations}:
  11.210 +*}
  11.211 +
  11.212 +code_type %quotett bool
  11.213 +  (SML "bool")
  11.214 +code_const %quotett True and False and "op \<and>"
  11.215 +  (SML "true" and "false" and "_ andalso _")
  11.216 +
  11.217 +text {*
  11.218 +  \noindent The @{command code_type} command takes a type constructor
  11.219 +  as arguments together with a list of custom serialisations.
  11.220 +  Each custom serialisation starts with a target language
  11.221 +  identifier followed by an expression, which during
  11.222 +  code serialisation is inserted whenever the type constructor
  11.223 +  would occur.  For constants, @{command code_const} implements
  11.224 +  the corresponding mechanism.  Each ``@{verbatim "_"}'' in
  11.225 +  a serialisation expression is treated as a placeholder
  11.226 +  for the type constructor's (the constant's) arguments.
  11.227 +*}
  11.228 +
  11.229 +text %quote {*@{code_stmts in_interval (SML)}*}
  11.230 +
  11.231 +text {*
  11.232 +  \noindent This still is not perfect: the parentheses
  11.233 +  around the \qt{andalso} expression are superfluous.
  11.234 +  Though the serialiser
  11.235 +  by no means attempts to imitate the rich Isabelle syntax
  11.236 +  framework, it provides some common idioms, notably
  11.237 +  associative infixes with precedences which may be used here:
  11.238 +*}
  11.239 +
  11.240 +code_const %quotett "op \<and>"
  11.241 +  (SML infixl 1 "andalso")
  11.242 +
  11.243 +text %quote {*@{code_stmts in_interval (SML)}*}
  11.244 +
  11.245 +text {*
  11.246 +  \noindent The attentive reader may ask how we assert that no generated
  11.247 +  code will accidentally overwrite.  For this reason the serialiser has
  11.248 +  an internal table of identifiers which have to be avoided to be used
  11.249 +  for new declarations.  Initially, this table typically contains the
  11.250 +  keywords of the target language.  It can be extended manually, thus avoiding
  11.251 +  accidental overwrites, using the @{command "code_reserved"} command:
  11.252 +*}
  11.253 +
  11.254 +code_reserved %quote "\<SML>" bool true false andalso
  11.255 +
  11.256 +text {*
  11.257 +  \noindent Next, we try to map HOL pairs to SML pairs, using the
  11.258 +  infix ``@{verbatim "*"}'' type constructor and parentheses:
  11.259 +*}
  11.260 +(*<*)
  11.261 +code_type %invisible *
  11.262 +  (SML)
  11.263 +code_const %invisible Pair
  11.264 +  (SML)
  11.265 +(*>*)
  11.266 +code_type %quotett *
  11.267 +  (SML infix 2 "*")
  11.268 +code_const %quotett Pair
  11.269 +  (SML "!((_),/ (_))")
  11.270 +
  11.271 +text {*
  11.272 +  \noindent The initial bang ``@{verbatim "!"}'' tells the serialiser
  11.273 +  never to put
  11.274 +  parentheses around the whole expression (they are already present),
  11.275 +  while the parentheses around argument place holders
  11.276 +  tell not to put parentheses around the arguments.
  11.277 +  The slash ``@{verbatim "/"}'' (followed by arbitrary white space)
  11.278 +  inserts a space which may be used as a break if necessary
  11.279 +  during pretty printing.
  11.280 +
  11.281 +  These examples give a glimpse what mechanisms
  11.282 +  custom serialisations provide; however their usage
  11.283 +  requires careful thinking in order not to introduce
  11.284 +  inconsistencies -- or, in other words:
  11.285 +  custom serialisations are completely axiomatic.
  11.286 +
  11.287 +  A further noteworthy details is that any special
  11.288 +  character in a custom serialisation may be quoted
  11.289 +  using ``@{verbatim "'"}''; thus, in
  11.290 +  ``@{verbatim "fn '_ => _"}'' the first
  11.291 +  ``@{verbatim "_"}'' is a proper underscore while the
  11.292 +  second ``@{verbatim "_"}'' is a placeholder.
  11.293 +*}
  11.294 +
  11.295 +
  11.296 +subsection {* @{text Haskell} serialisation *}
  11.297 +
  11.298 +text {*
  11.299 +  For convenience, the default
  11.300 +  @{text HOL} setup for @{text Haskell} maps the @{class eq} class to
  11.301 +  its counterpart in @{text Haskell}, giving custom serialisations
  11.302 +  for the class @{class eq} (by command @{command code_class}) and its operation
  11.303 +  @{const HOL.eq}
  11.304 +*}
  11.305 +
  11.306 +code_class %quotett eq
  11.307 +  (Haskell "Eq")
  11.308 +
  11.309 +code_const %quotett "op ="
  11.310 +  (Haskell infixl 4 "==")
  11.311 +
  11.312 +text {*
  11.313 +  \noindent A problem now occurs whenever a type which
  11.314 +  is an instance of @{class eq} in @{text HOL} is mapped
  11.315 +  on a @{text Haskell}-built-in type which is also an instance
  11.316 +  of @{text Haskell} @{text Eq}:
  11.317 +*}
  11.318 +
  11.319 +typedecl %quote bar
  11.320 +
  11.321 +instantiation %quote bar :: eq
  11.322 +begin
  11.323 +
  11.324 +definition %quote "eq_class.eq (x\<Colon>bar) y \<longleftrightarrow> x = y"
  11.325 +
  11.326 +instance %quote by default (simp add: eq_bar_def)
  11.327 +
  11.328 +end %quote
  11.329 +
  11.330 +code_type %quotett bar
  11.331 +  (Haskell "Integer")
  11.332 +
  11.333 +text {*
  11.334 +  \noindent The code generator would produce
  11.335 +  an additional instance, which of course is rejected by the @{text Haskell}
  11.336 +  compiler.
  11.337 +  To suppress this additional instance, use
  11.338 +  @{text "code_instance"}:
  11.339 +*}
  11.340 +
  11.341 +code_instance %quotett bar :: eq
  11.342 +  (Haskell -)
  11.343 +
  11.344 +
  11.345 +subsection {* Enhancing the target language context \label{sec:include} *}
  11.346 +
  11.347 +text {*
  11.348 +  In rare cases it is necessary to \emph{enrich} the context of a
  11.349 +  target language;  this is accomplished using the @{command "code_include"}
  11.350 +  command:
  11.351 +*}
  11.352 +
  11.353 +code_include %quotett Haskell "Errno"
  11.354 +{*errno i = error ("Error number: " ++ show i)*}
  11.355 +
  11.356 +code_reserved %quotett Haskell Errno
  11.357 +
  11.358 +text {*
  11.359 +  \noindent Such named @{text include}s are then prepended to every generated code.
  11.360 +  Inspect such code in order to find out how @{command "code_include"} behaves
  11.361 +  with respect to a particular target language.
  11.362 +*}
  11.363 +
  11.364 +end
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/doc-src/Codegen/Thy/Codegen.thy	Tue Mar 03 11:00:51 2009 +0100
    12.3 @@ -0,0 +1,2 @@
    12.4 +
    12.5 +end
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/doc-src/Codegen/Thy/Further.thy	Tue Mar 03 11:00:51 2009 +0100
    13.3 @@ -0,0 +1,113 @@
    13.4 +theory Further
    13.5 +imports Setup
    13.6 +begin
    13.7 +
    13.8 +section {* Further issues \label{sec:further} *}
    13.9 +
   13.10 +subsection {* Further reading *}
   13.11 +
   13.12 +text {*
   13.13 +  Do dive deeper into the issue of code generation, you should visit
   13.14 +  the Isabelle/Isar Reference Manual \cite{isabelle-isar-ref} which
   13.15 +  contains exhaustive syntax diagrams.
   13.16 +*}
   13.17 +
   13.18 +subsection {* Modules *}
   13.19 +
   13.20 +text {*
   13.21 +  When invoking the @{command export_code} command it is possible to leave
   13.22 +  out the @{keyword "module_name"} part;  then code is distributed over
   13.23 +  different modules, where the module name space roughly is induced
   13.24 +  by the @{text Isabelle} theory name space.
   13.25 +
   13.26 +  Then sometimes the awkward situation occurs that dependencies between
   13.27 +  definitions introduce cyclic dependencies between modules, which in the
   13.28 +  @{text Haskell} world leaves you to the mercy of the @{text Haskell} implementation
   13.29 +  you are using,  while for @{text SML}/@{text OCaml} code generation is not possible.
   13.30 +
   13.31 +  A solution is to declare module names explicitly.
   13.32 +  Let use assume the three cyclically dependent
   13.33 +  modules are named \emph{A}, \emph{B} and \emph{C}.
   13.34 +  Then, by stating
   13.35 +*}
   13.36 +
   13.37 +code_modulename %quote SML
   13.38 +  A ABC
   13.39 +  B ABC
   13.40 +  C ABC
   13.41 +
   13.42 +text {*
   13.43 +  we explicitly map all those modules on \emph{ABC},
   13.44 +  resulting in an ad-hoc merge of this three modules
   13.45 +  at serialisation time.
   13.46 +*}
   13.47 +
   13.48 +subsection {* Evaluation oracle *}
   13.49 +
   13.50 +text {*
   13.51 +  Code generation may also be used to \emph{evaluate} expressions
   13.52 +  (using @{text SML} as target language of course).
   13.53 +  For instance, the @{command value} allows to reduce an expression to a
   13.54 +  normal form with respect to the underlying code equations:
   13.55 +*}
   13.56 +
   13.57 +value %quote "42 / (12 :: rat)"
   13.58 +
   13.59 +text {*
   13.60 +  \noindent will display @{term "7 / (2 :: rat)"}.
   13.61 +
   13.62 +  The @{method eval} method tries to reduce a goal by code generation to @{term True}
   13.63 +  and solves it in that case, but fails otherwise:
   13.64 +*}
   13.65 +
   13.66 +lemma %quote "42 / (12 :: rat) = 7 / 2"
   13.67 +  by %quote eval
   13.68 +
   13.69 +text {*
   13.70 +  \noindent The soundness of the @{method eval} method depends crucially 
   13.71 +  on the correctness of the code generator;  this is one of the reasons
   13.72 +  why you should not use adaption (see \secref{sec:adaption}) frivolously.
   13.73 +*}
   13.74 +
   13.75 +subsection {* Code antiquotation *}
   13.76 +
   13.77 +text {*
   13.78 +  In scenarios involving techniques like reflection it is quite common
   13.79 +  that code generated from a theory forms the basis for implementing
   13.80 +  a proof procedure in @{text SML}.  To facilitate interfacing of generated code
   13.81 +  with system code, the code generator provides a @{text code} antiquotation:
   13.82 +*}
   13.83 +
   13.84 +datatype %quote form = T | F | And form form | Or form form
   13.85 +
   13.86 +ML %quote {*
   13.87 +  fun eval_form @{code T} = true
   13.88 +    | eval_form @{code F} = false
   13.89 +    | eval_form (@{code And} (p, q)) =
   13.90 +        eval_form p andalso eval_form q
   13.91 +    | eval_form (@{code Or} (p, q)) =
   13.92 +        eval_form p orelse eval_form q;
   13.93 +*}
   13.94 +
   13.95 +text {*
   13.96 +  \noindent @{text code} takes as argument the name of a constant;  after the
   13.97 +  whole @{text SML} is read, the necessary code is generated transparently
   13.98 +  and the corresponding constant names are inserted.  This technique also
   13.99 +  allows to use pattern matching on constructors stemming from compiled
  13.100 +  @{text datatypes}.
  13.101 +
  13.102 +  For a less simplistic example, theory @{theory Ferrack} is
  13.103 +  a good reference.
  13.104 +*}
  13.105 +
  13.106 +subsection {* Imperative data structures *}
  13.107 +
  13.108 +text {*
  13.109 +  If you consider imperative data structures as inevitable for a specific
  13.110 +  application, you should consider
  13.111 +  \emph{Imperative Functional Programming with Isabelle/HOL}
  13.112 +  (\cite{bulwahn-et-al:2008:imperative});
  13.113 +  the framework described there is available in theory @{theory Imperative_HOL}.
  13.114 +*}
  13.115 +
  13.116 +end
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/doc-src/Codegen/Thy/Introduction.thy	Tue Mar 03 11:00:51 2009 +0100
    14.3 @@ -0,0 +1,206 @@
    14.4 +theory Introduction
    14.5 +imports Setup
    14.6 +begin
    14.7 +
    14.8 +chapter {* Code generation from @{text "Isabelle/HOL"} theories *}
    14.9 +
   14.10 +section {* Introduction and Overview *}
   14.11 +
   14.12 +text {*
   14.13 +  This tutorial introduces a generic code generator for the
   14.14 +  @{text Isabelle} system.
   14.15 +  Generic in the sense that the
   14.16 +  \qn{target language} for which code shall ultimately be
   14.17 +  generated is not fixed but may be an arbitrary state-of-the-art
   14.18 +  functional programming language (currently, the implementation
   14.19 +  supports @{text SML} \cite{SML}, @{text OCaml} \cite{OCaml} and @{text Haskell}
   14.20 +  \cite{haskell-revised-report}).
   14.21 +
   14.22 +  Conceptually the code generator framework is part
   14.23 +  of Isabelle's @{theory Pure} meta logic framework; the logic
   14.24 +  @{theory HOL} which is an extension of @{theory Pure}
   14.25 +  already comes with a reasonable framework setup and thus provides
   14.26 +  a good working horse for raising code-generation-driven
   14.27 +  applications.  So, we assume some familiarity and experience
   14.28 +  with the ingredients of the @{theory HOL} distribution theories.
   14.29 +  (see also \cite{isa-tutorial}).
   14.30 +
   14.31 +  The code generator aims to be usable with no further ado
   14.32 +  in most cases while allowing for detailed customisation.
   14.33 +  This manifests in the structure of this tutorial: after a short
   14.34 +  conceptual introduction with an example (\secref{sec:intro}),
   14.35 +  we discuss the generic customisation facilities (\secref{sec:program}).
   14.36 +  A further section (\secref{sec:adaption}) is dedicated to the matter of
   14.37 +  \qn{adaption} to specific target language environments.  After some
   14.38 +  further issues (\secref{sec:further}) we conclude with an overview
   14.39 +  of some ML programming interfaces (\secref{sec:ml}).
   14.40 +
   14.41 +  \begin{warn}
   14.42 +    Ultimately, the code generator which this tutorial deals with
   14.43 +    is supposed to replace the existing code generator
   14.44 +    by Stefan Berghofer \cite{Berghofer-Nipkow:2002}.
   14.45 +    So, for the moment, there are two distinct code generators
   14.46 +    in Isabelle.  In case of ambiguity, we will refer to the framework
   14.47 +    described here as @{text "generic code generator"}, to the
   14.48 +    other as @{text "SML code generator"}.
   14.49 +    Also note that while the framework itself is
   14.50 +    object-logic independent, only @{theory HOL} provides a reasonable
   14.51 +    framework setup.    
   14.52 +  \end{warn}
   14.53 +
   14.54 +*}
   14.55 +
   14.56 +subsection {* Code generation via shallow embedding \label{sec:intro} *}
   14.57 +
   14.58 +text {*
   14.59 +  The key concept for understanding @{text Isabelle}'s code generation is
   14.60 +  \emph{shallow embedding}, i.e.~logical entities like constants, types and
   14.61 +  classes are identified with corresponding concepts in the target language.
   14.62 +
   14.63 +  Inside @{theory HOL}, the @{command datatype} and
   14.64 +  @{command definition}/@{command primrec}/@{command fun} declarations form
   14.65 +  the core of a functional programming language.  The default code generator setup
   14.66 +  allows to turn those into functional programs immediately.
   14.67 +  This means that \qt{naive} code generation can proceed without further ado.
   14.68 +  For example, here a simple \qt{implementation} of amortised queues:
   14.69 +*}
   14.70 +
   14.71 +datatype %quote 'a queue = AQueue "'a list" "'a list"
   14.72 +
   14.73 +definition %quote empty :: "'a queue" where
   14.74 +  "empty = AQueue [] []"
   14.75 +
   14.76 +primrec %quote enqueue :: "'a \<Rightarrow> 'a queue \<Rightarrow> 'a queue" where
   14.77 +  "enqueue x (AQueue xs ys) = AQueue (x # xs) ys"
   14.78 +
   14.79 +fun %quote dequeue :: "'a queue \<Rightarrow> 'a option \<times> 'a queue" where
   14.80 +    "dequeue (AQueue [] []) = (None, AQueue [] [])"
   14.81 +  | "dequeue (AQueue xs (y # ys)) = (Some y, AQueue xs ys)"
   14.82 +  | "dequeue (AQueue xs []) =
   14.83 +      (case rev xs of y # ys \<Rightarrow> (Some y, AQueue [] ys))"
   14.84 +
   14.85 +text {* \noindent Then we can generate code e.g.~for @{text SML} as follows: *}
   14.86 +
   14.87 +export_code %quote empty dequeue enqueue in SML
   14.88 +  module_name Example file "examples/example.ML"
   14.89 +
   14.90 +text {* \noindent resulting in the following code: *}
   14.91 +
   14.92 +text %quote {*@{code_stmts empty enqueue dequeue (SML)}*}
   14.93 +
   14.94 +text {*
   14.95 +  \noindent The @{command export_code} command takes a space-separated list of
   14.96 +  constants for which code shall be generated;  anything else needed for those
   14.97 +  is added implicitly.  Then follows a target language identifier
   14.98 +  (@{text SML}, @{text OCaml} or @{text Haskell}) and a freely chosen module name.
   14.99 +  A file name denotes the destination to store the generated code.  Note that
  14.100 +  the semantics of the destination depends on the target language:  for
  14.101 +  @{text SML} and @{text OCaml} it denotes a \emph{file}, for @{text Haskell}
  14.102 +  it denotes a \emph{directory} where a file named as the module name
  14.103 +  (with extension @{text ".hs"}) is written:
  14.104 +*}
  14.105 +
  14.106 +export_code %quote empty dequeue enqueue in Haskell
  14.107 +  module_name Example file "examples/"
  14.108 +
  14.109 +text {*
  14.110 +  \noindent This is how the corresponding code in @{text Haskell} looks like:
  14.111 +*}
  14.112 +
  14.113 +text %quote {*@{code_stmts empty enqueue dequeue (Haskell)}*}
  14.114 +
  14.115 +text {*
  14.116 +  \noindent This demonstrates the basic usage of the @{command export_code} command;
  14.117 +  for more details see \secref{sec:further}.
  14.118 +*}
  14.119 +
  14.120 +subsection {* Code generator architecture \label{sec:concept} *}
  14.121 +
  14.122 +text {*
  14.123 +  What you have seen so far should be already enough in a lot of cases.  If you
  14.124 +  are content with this, you can quit reading here.  Anyway, in order to customise
  14.125 +  and adapt the code generator, it is inevitable to gain some understanding
  14.126 +  how it works.
  14.127 +
  14.128 +  \begin{figure}[h]
  14.129 +    \begin{tikzpicture}[x = 4.2cm, y = 1cm]
  14.130 +      \tikzstyle entity=[rounded corners, draw, thick, color = black, fill = white];
  14.131 +      \tikzstyle process=[ellipse, draw, thick, color = green, fill = white];
  14.132 +      \tikzstyle process_arrow=[->, semithick, color = green];
  14.133 +      \node (HOL) at (0, 4) [style=entity] {@{text "Isabelle/HOL"} theory};
  14.134 +      \node (eqn) at (2, 2) [style=entity] {code equations};
  14.135 +      \node (iml) at (2, 0) [style=entity] {intermediate language};
  14.136 +      \node (seri) at (1, 0) [style=process] {serialisation};
  14.137 +      \node (SML) at (0, 3) [style=entity] {@{text SML}};
  14.138 +      \node (OCaml) at (0, 2) [style=entity] {@{text OCaml}};
  14.139 +      \node (further) at (0, 1) [style=entity] {@{text "\<dots>"}};
  14.140 +      \node (Haskell) at (0, 0) [style=entity] {@{text Haskell}};
  14.141 +      \draw [style=process_arrow] (HOL) .. controls (2, 4) ..
  14.142 +        node [style=process, near start] {selection}
  14.143 +        node [style=process, near end] {preprocessing}
  14.144 +        (eqn);
  14.145 +      \draw [style=process_arrow] (eqn) -- node (transl) [style=process] {translation} (iml);
  14.146 +      \draw [style=process_arrow] (iml) -- (seri);
  14.147 +      \draw [style=process_arrow] (seri) -- (SML);
  14.148 +      \draw [style=process_arrow] (seri) -- (OCaml);
  14.149 +      \draw [style=process_arrow, dashed] (seri) -- (further);
  14.150 +      \draw [style=process_arrow] (seri) -- (Haskell);
  14.151 +    \end{tikzpicture}
  14.152 +    \caption{Code generator architecture}
  14.153 +    \label{fig:arch}
  14.154 +  \end{figure}
  14.155 +
  14.156 +  The code generator employs a notion of executability
  14.157 +  for three foundational executable ingredients known
  14.158 +  from functional programming:
  14.159 +  \emph{code equations}, \emph{datatypes}, and
  14.160 +  \emph{type classes}.  A code equation as a first approximation
  14.161 +  is a theorem of the form @{text "f t\<^isub>1 t\<^isub>2 \<dots> t\<^isub>n \<equiv> t"}
  14.162 +  (an equation headed by a constant @{text f} with arguments
  14.163 +  @{text "t\<^isub>1 t\<^isub>2 \<dots> t\<^isub>n"} and right hand side @{text t}).
  14.164 +  Code generation aims to turn code equations
  14.165 +  into a functional program.  This is achieved by three major
  14.166 +  components which operate sequentially, i.e. the result of one is
  14.167 +  the input
  14.168 +  of the next in the chain,  see diagram \ref{fig:arch}:
  14.169 +
  14.170 +  \begin{itemize}
  14.171 +
  14.172 +    \item Out of the vast collection of theorems proven in a
  14.173 +      \qn{theory}, a reasonable subset modelling
  14.174 +      code equations is \qn{selected}.
  14.175 +
  14.176 +    \item On those selected theorems, certain
  14.177 +      transformations are carried out
  14.178 +      (\qn{preprocessing}).  Their purpose is to turn theorems
  14.179 +      representing non- or badly executable
  14.180 +      specifications into equivalent but executable counterparts.
  14.181 +      The result is a structured collection of \qn{code theorems}.
  14.182 +
  14.183 +    \item Before the selected code equations are continued with,
  14.184 +      they can be \qn{preprocessed}, i.e. subjected to theorem
  14.185 +      transformations.  This \qn{preprocessor} is an interface which
  14.186 +      allows to apply
  14.187 +      the full expressiveness of ML-based theorem transformations
  14.188 +      to code generation;  motivating examples are shown below, see
  14.189 +      \secref{sec:preproc}.
  14.190 +      The result of the preprocessing step is a structured collection
  14.191 +      of code equations.
  14.192 +
  14.193 +    \item These code equations are \qn{translated} to a program
  14.194 +      in an abstract intermediate language.  Think of it as a kind
  14.195 +      of \qt{Mini-Haskell} with four \qn{statements}: @{text data}
  14.196 +      (for datatypes), @{text fun} (stemming from code equations),
  14.197 +      also @{text class} and @{text inst} (for type classes).
  14.198 +
  14.199 +    \item Finally, the abstract program is \qn{serialised} into concrete
  14.200 +      source code of a target language.
  14.201 +
  14.202 +  \end{itemize}
  14.203 +
  14.204 +  \noindent From these steps, only the two last are carried out outside the logic;  by
  14.205 +  keeping this layer as thin as possible, the amount of code to trust is
  14.206 +  kept to a minimum.
  14.207 +*}
  14.208 +
  14.209 +end
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/doc-src/Codegen/Thy/ML.thy	Tue Mar 03 11:00:51 2009 +0100
    15.3 @@ -0,0 +1,177 @@
    15.4 +theory "ML"
    15.5 +imports Setup
    15.6 +begin
    15.7 +
    15.8 +section {* ML system interfaces \label{sec:ml} *}
    15.9 +
   15.10 +text {*
   15.11 +  Since the code generator framework not only aims to provide
   15.12 +  a nice Isar interface but also to form a base for
   15.13 +  code-generation-based applications, here a short
   15.14 +  description of the most important ML interfaces.
   15.15 +*}
   15.16 +
   15.17 +subsection {* Executable theory content: @{text Code} *}
   15.18 +
   15.19 +text {*
   15.20 +  This Pure module implements the core notions of
   15.21 +  executable content of a theory.
   15.22 +*}
   15.23 +
   15.24 +subsubsection {* Managing executable content *}
   15.25 +
   15.26 +text %mlref {*
   15.27 +  \begin{mldecls}
   15.28 +  @{index_ML Code.add_eqn: "thm -> theory -> theory"} \\
   15.29 +  @{index_ML Code.del_eqn: "thm -> theory -> theory"} \\
   15.30 +  @{index_ML Code.add_eqnl: "string * (thm * bool) list lazy -> theory -> theory"} \\
   15.31 +  @{index_ML Code.map_pre: "(simpset -> simpset) -> theory -> theory"} \\
   15.32 +  @{index_ML Code.map_post: "(simpset -> simpset) -> theory -> theory"} \\
   15.33 +  @{index_ML Code.add_functrans: "string * (theory -> (thm * bool) list -> (thm * bool) list option)
   15.34 +    -> theory -> theory"} \\
   15.35 +  @{index_ML Code.del_functrans: "string -> theory -> theory"} \\
   15.36 +  @{index_ML Code.add_datatype: "(string * typ) list -> theory -> theory"} \\
   15.37 +  @{index_ML Code.get_datatype: "theory -> string
   15.38 +    -> (string * sort) list * (string * typ list) list"} \\
   15.39 +  @{index_ML Code.get_datatype_of_constr: "theory -> string -> string option"}
   15.40 +  \end{mldecls}
   15.41 +
   15.42 +  \begin{description}
   15.43 +
   15.44 +  \item @{ML Code.add_eqn}~@{text "thm"}~@{text "thy"} adds function
   15.45 +     theorem @{text "thm"} to executable content.
   15.46 +
   15.47 +  \item @{ML Code.del_eqn}~@{text "thm"}~@{text "thy"} removes function
   15.48 +     theorem @{text "thm"} from executable content, if present.
   15.49 +
   15.50 +  \item @{ML Code.add_eqnl}~@{text "(const, lthms)"}~@{text "thy"} adds
   15.51 +     suspended code equations @{text lthms} for constant
   15.52 +     @{text const} to executable content.
   15.53 +
   15.54 +  \item @{ML Code.map_pre}~@{text "f"}~@{text "thy"} changes
   15.55 +     the preprocessor simpset.
   15.56 +
   15.57 +  \item @{ML Code.add_functrans}~@{text "(name, f)"}~@{text "thy"} adds
   15.58 +     function transformer @{text f} (named @{text name}) to executable content;
   15.59 +     @{text f} is a transformer of the code equations belonging
   15.60 +     to a certain function definition, depending on the
   15.61 +     current theory context.  Returning @{text NONE} indicates that no
   15.62 +     transformation took place;  otherwise, the whole process will be iterated
   15.63 +     with the new code equations.
   15.64 +
   15.65 +  \item @{ML Code.del_functrans}~@{text "name"}~@{text "thy"} removes
   15.66 +     function transformer named @{text name} from executable content.
   15.67 +
   15.68 +  \item @{ML Code.add_datatype}~@{text cs}~@{text thy} adds
   15.69 +     a datatype to executable content, with generation
   15.70 +     set @{text cs}.
   15.71 +
   15.72 +  \item @{ML Code.get_datatype_of_constr}~@{text "thy"}~@{text "const"}
   15.73 +     returns type constructor corresponding to
   15.74 +     constructor @{text const}; returns @{text NONE}
   15.75 +     if @{text const} is no constructor.
   15.76 +
   15.77 +  \end{description}
   15.78 +*}
   15.79 +
   15.80 +subsection {* Auxiliary *}
   15.81 +
   15.82 +text %mlref {*
   15.83 +  \begin{mldecls}
   15.84 +  @{index_ML Code_Unit.read_const: "theory -> string -> string"} \\
   15.85 +  @{index_ML Code_Unit.head_eqn: "theory -> thm -> string * ((string * sort) list * typ)"} \\
   15.86 +  @{index_ML Code_Unit.rewrite_eqn: "simpset -> thm -> thm"} \\
   15.87 +  \end{mldecls}
   15.88 +
   15.89 +  \begin{description}
   15.90 +
   15.91 +  \item @{ML Code_Unit.read_const}~@{text thy}~@{text s}
   15.92 +     reads a constant as a concrete term expression @{text s}.
   15.93 +
   15.94 +  \item @{ML Code_Unit.head_eqn}~@{text thy}~@{text thm}
   15.95 +     extracts the constant and its type from a code equation @{text thm}.
   15.96 +
   15.97 +  \item @{ML Code_Unit.rewrite_eqn}~@{text ss}~@{text thm}
   15.98 +     rewrites a code equation @{text thm} with a simpset @{text ss};
   15.99 +     only arguments and right hand side are rewritten,
  15.100 +     not the head of the code equation.
  15.101 +
  15.102 +  \end{description}
  15.103 +
  15.104 +*}
  15.105 +
  15.106 +subsection {* Implementing code generator applications *}
  15.107 +
  15.108 +text {*
  15.109 +  Implementing code generator applications on top
  15.110 +  of the framework set out so far usually not only
  15.111 +  involves using those primitive interfaces
  15.112 +  but also storing code-dependent data and various
  15.113 +  other things.
  15.114 +*}
  15.115 +
  15.116 +subsubsection {* Data depending on the theory's executable content *}
  15.117 +
  15.118 +text {*
  15.119 +  Due to incrementality of code generation, changes in the
  15.120 +  theory's executable content have to be propagated in a
  15.121 +  certain fashion.  Additionally, such changes may occur
  15.122 +  not only during theory extension but also during theory
  15.123 +  merge, which is a little bit nasty from an implementation
  15.124 +  point of view.  The framework provides a solution
  15.125 +  to this technical challenge by providing a functorial
  15.126 +  data slot @{ML_functor CodeDataFun}; on instantiation
  15.127 +  of this functor, the following types and operations
  15.128 +  are required:
  15.129 +
  15.130 +  \medskip
  15.131 +  \begin{tabular}{l}
  15.132 +  @{text "type T"} \\
  15.133 +  @{text "val empty: T"} \\
  15.134 +  @{text "val purge: theory \<rightarrow> string list option \<rightarrow> T \<rightarrow> T"}
  15.135 +  \end{tabular}
  15.136 +
  15.137 +  \begin{description}
  15.138 +
  15.139 +  \item @{text T} the type of data to store.
  15.140 +
  15.141 +  \item @{text empty} initial (empty) data.
  15.142 +
  15.143 +  \item @{text purge}~@{text thy}~@{text consts} propagates changes in executable content;
  15.144 +    @{text consts} indicates the kind
  15.145 +    of change: @{ML NONE} stands for a fundamental change
  15.146 +    which invalidates any existing code, @{text "SOME consts"}
  15.147 +    hints that executable content for constants @{text consts}
  15.148 +    has changed.
  15.149 +
  15.150 +  \end{description}
  15.151 +
  15.152 +  \noindent An instance of @{ML_functor CodeDataFun} provides the following
  15.153 +  interface:
  15.154 +
  15.155 +  \medskip
  15.156 +  \begin{tabular}{l}
  15.157 +  @{text "get: theory \<rightarrow> T"} \\
  15.158 +  @{text "change: theory \<rightarrow> (T \<rightarrow> T) \<rightarrow> T"} \\
  15.159 +  @{text "change_yield: theory \<rightarrow> (T \<rightarrow> 'a * T) \<rightarrow> 'a * T"}
  15.160 +  \end{tabular}
  15.161 +
  15.162 +  \begin{description}
  15.163 +
  15.164 +  \item @{text get} retrieval of the current data.
  15.165 +
  15.166 +  \item @{text change} update of current data (cached!)
  15.167 +    by giving a continuation.
  15.168 +
  15.169 +  \item @{text change_yield} update with side result.
  15.170 +
  15.171 +  \end{description}
  15.172 +*}
  15.173 +
  15.174 +text {*
  15.175 +  \bigskip
  15.176 +
  15.177 +  \emph{Happy proving, happy hacking!}
  15.178 +*}
  15.179 +
  15.180 +end
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/doc-src/Codegen/Thy/Program.thy	Tue Mar 03 11:00:51 2009 +0100
    16.3 @@ -0,0 +1,534 @@
    16.4 +theory Program
    16.5 +imports Introduction
    16.6 +begin
    16.7 +
    16.8 +section {* Turning Theories into Programs \label{sec:program} *}
    16.9 +
   16.10 +subsection {* The @{text "Isabelle/HOL"} default setup *}
   16.11 +
   16.12 +text {*
   16.13 +  We have already seen how by default equations stemming from
   16.14 +  @{command definition}/@{command primrec}/@{command fun}
   16.15 +  statements are used for code generation.  This default behaviour
   16.16 +  can be changed, e.g. by providing different code equations.
   16.17 +  All kinds of customisation shown in this section is \emph{safe}
   16.18 +  in the sense that the user does not have to worry about
   16.19 +  correctness -- all programs generatable that way are partially
   16.20 +  correct.
   16.21 +*}
   16.22 +
   16.23 +subsection {* Selecting code equations *}
   16.24 +
   16.25 +text {*
   16.26 +  Coming back to our introductory example, we
   16.27 +  could provide an alternative code equations for @{const dequeue}
   16.28 +  explicitly:
   16.29 +*}
   16.30 +
   16.31 +lemma %quote [code]:
   16.32 +  "dequeue (AQueue xs []) =
   16.33 +     (if xs = [] then (None, AQueue [] [])
   16.34 +       else dequeue (AQueue [] (rev xs)))"
   16.35 +  "dequeue (AQueue xs (y # ys)) =
   16.36 +     (Some y, AQueue xs ys)"
   16.37 +  by (cases xs, simp_all) (cases "rev xs", simp_all)
   16.38 +
   16.39 +text {*
   16.40 +  \noindent The annotation @{text "[code]"} is an @{text Isar}
   16.41 +  @{text attribute} which states that the given theorems should be
   16.42 +  considered as code equations for a @{text fun} statement --
   16.43 +  the corresponding constant is determined syntactically.  The resulting code:
   16.44 +*}
   16.45 +
   16.46 +text %quote {*@{code_stmts dequeue (consts) dequeue (Haskell)}*}
   16.47 +
   16.48 +text {*
   16.49 +  \noindent You may note that the equality test @{term "xs = []"} has been
   16.50 +  replaced by the predicate @{term "null xs"}.  This is due to the default
   16.51 +  setup in the \qn{preprocessor} to be discussed further below (\secref{sec:preproc}).
   16.52 +
   16.53 +  Changing the default constructor set of datatypes is also
   16.54 +  possible.  See \secref{sec:datatypes} for an example.
   16.55 +
   16.56 +  As told in \secref{sec:concept}, code generation is based
   16.57 +  on a structured collection of code theorems.
   16.58 +  For explorative purpose, this collection
   16.59 +  may be inspected using the @{command code_thms} command:
   16.60 +*}
   16.61 +
   16.62 +code_thms %quote dequeue
   16.63 +
   16.64 +text {*
   16.65 +  \noindent prints a table with \emph{all} code equations
   16.66 +  for @{const dequeue}, including
   16.67 +  \emph{all} code equations those equations depend
   16.68 +  on recursively.
   16.69 +  
   16.70 +  Similarly, the @{command code_deps} command shows a graph
   16.71 +  visualising dependencies between code equations.
   16.72 +*}
   16.73 +
   16.74 +subsection {* @{text class} and @{text instantiation} *}
   16.75 +
   16.76 +text {*
   16.77 +  Concerning type classes and code generation, let us examine an example
   16.78 +  from abstract algebra:
   16.79 +*}
   16.80 +
   16.81 +class %quote semigroup =
   16.82 +  fixes mult :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixl "\<otimes>" 70)
   16.83 +  assumes assoc: "(x \<otimes> y) \<otimes> z = x \<otimes> (y \<otimes> z)"
   16.84 +
   16.85 +class %quote monoid = semigroup +
   16.86 +  fixes neutral :: 'a ("\<one>")
   16.87 +  assumes neutl: "\<one> \<otimes> x = x"
   16.88 +    and neutr: "x \<otimes> \<one> = x"
   16.89 +
   16.90 +instantiation %quote nat :: monoid
   16.91 +begin
   16.92 +
   16.93 +primrec %quote mult_nat where
   16.94 +    "0 \<otimes> n = (0\<Colon>nat)"
   16.95 +  | "Suc m \<otimes> n = n + m \<otimes> n"
   16.96 +
   16.97 +definition %quote neutral_nat where
   16.98 +  "\<one> = Suc 0"
   16.99 +
  16.100 +lemma %quote add_mult_distrib:
  16.101 +  fixes n m q :: nat
  16.102 +  shows "(n + m) \<otimes> q = n \<otimes> q + m \<otimes> q"
  16.103 +  by (induct n) simp_all
  16.104 +
  16.105 +instance %quote proof
  16.106 +  fix m n q :: nat
  16.107 +  show "m \<otimes> n \<otimes> q = m \<otimes> (n \<otimes> q)"
  16.108 +    by (induct m) (simp_all add: add_mult_distrib)
  16.109 +  show "\<one> \<otimes> n = n"
  16.110 +    by (simp add: neutral_nat_def)
  16.111 +  show "m \<otimes> \<one> = m"
  16.112 +    by (induct m) (simp_all add: neutral_nat_def)
  16.113 +qed
  16.114 +
  16.115 +end %quote
  16.116 +
  16.117 +text {*
  16.118 +  \noindent We define the natural operation of the natural numbers
  16.119 +  on monoids:
  16.120 +*}
  16.121 +
  16.122 +primrec %quote (in monoid) pow :: "nat \<Rightarrow> 'a \<Rightarrow> 'a" where
  16.123 +    "pow 0 a = \<one>"
  16.124 +  | "pow (Suc n) a = a \<otimes> pow n a"
  16.125 +
  16.126 +text {*
  16.127 +  \noindent This we use to define the discrete exponentiation function:
  16.128 +*}
  16.129 +
  16.130 +definition %quote bexp :: "nat \<Rightarrow> nat" where
  16.131 +  "bexp n = pow n (Suc (Suc 0))"
  16.132 +
  16.133 +text {*
  16.134 +  \noindent The corresponding code:
  16.135 +*}
  16.136 +
  16.137 +text %quote {*@{code_stmts bexp (Haskell)}*}
  16.138 +
  16.139 +text {*
  16.140 +  \noindent This is a convenient place to show how explicit dictionary construction
  16.141 +  manifests in generated code (here, the same example in @{text SML}):
  16.142 +*}
  16.143 +
  16.144 +text %quote {*@{code_stmts bexp (SML)}*}
  16.145 +
  16.146 +text {*
  16.147 +  \noindent Note the parameters with trailing underscore (@{verbatim "A_"})
  16.148 +    which are the dictionary parameters.
  16.149 +*}
  16.150 +
  16.151 +subsection {* The preprocessor \label{sec:preproc} *}
  16.152 +
  16.153 +text {*
  16.154 +  Before selected function theorems are turned into abstract
  16.155 +  code, a chain of definitional transformation steps is carried
  16.156 +  out: \emph{preprocessing}.  In essence, the preprocessor
  16.157 +  consists of two components: a \emph{simpset} and \emph{function transformers}.
  16.158 +
  16.159 +  The \emph{simpset} allows to employ the full generality of the Isabelle
  16.160 +  simplifier.  Due to the interpretation of theorems
  16.161 +  as code equations, rewrites are applied to the right
  16.162 +  hand side and the arguments of the left hand side of an
  16.163 +  equation, but never to the constant heading the left hand side.
  16.164 +  An important special case are \emph{inline theorems} which may be
  16.165 +  declared and undeclared using the
  16.166 +  \emph{code inline} or \emph{code inline del} attribute respectively.
  16.167 +
  16.168 +  Some common applications:
  16.169 +*}
  16.170 +
  16.171 +text_raw {*
  16.172 +  \begin{itemize}
  16.173 +*}
  16.174 +
  16.175 +text {*
  16.176 +     \item replacing non-executable constructs by executable ones:
  16.177 +*}     
  16.178 +
  16.179 +lemma %quote [code inline]:
  16.180 +  "x \<in> set xs \<longleftrightarrow> x mem xs" by (induct xs) simp_all
  16.181 +
  16.182 +text {*
  16.183 +     \item eliminating superfluous constants:
  16.184 +*}
  16.185 +
  16.186 +lemma %quote [code inline]:
  16.187 +  "1 = Suc 0" by simp
  16.188 +
  16.189 +text {*
  16.190 +     \item replacing executable but inconvenient constructs:
  16.191 +*}
  16.192 +
  16.193 +lemma %quote [code inline]:
  16.194 +  "xs = [] \<longleftrightarrow> List.null xs" by (induct xs) simp_all
  16.195 +
  16.196 +text_raw {*
  16.197 +  \end{itemize}
  16.198 +*}
  16.199 +
  16.200 +text {*
  16.201 +  \noindent \emph{Function transformers} provide a very general interface,
  16.202 +  transforming a list of function theorems to another
  16.203 +  list of function theorems, provided that neither the heading
  16.204 +  constant nor its type change.  The @{term "0\<Colon>nat"} / @{const Suc}
  16.205 +  pattern elimination implemented in
  16.206 +  theory @{text Efficient_Nat} (see \secref{eff_nat}) uses this
  16.207 +  interface.
  16.208 +
  16.209 +  \noindent The current setup of the preprocessor may be inspected using
  16.210 +  the @{command print_codesetup} command.
  16.211 +  @{command code_thms} provides a convenient
  16.212 +  mechanism to inspect the impact of a preprocessor setup
  16.213 +  on code equations.
  16.214 +
  16.215 +  \begin{warn}
  16.216 +    The attribute \emph{code unfold}
  16.217 +    associated with the @{text "SML code generator"} also applies to
  16.218 +    the @{text "generic code generator"}:
  16.219 +    \emph{code unfold} implies \emph{code inline}.
  16.220 +  \end{warn}
  16.221 +*}
  16.222 +
  16.223 +subsection {* Datatypes \label{sec:datatypes} *}
  16.224 +
  16.225 +text {*
  16.226 +  Conceptually, any datatype is spanned by a set of
  16.227 +  \emph{constructors} of type @{text "\<tau> = \<dots> \<Rightarrow> \<kappa> \<alpha>\<^isub>1 \<dots> \<alpha>\<^isub>n"} where @{text
  16.228 +  "{\<alpha>\<^isub>1, \<dots>, \<alpha>\<^isub>n}"} is exactly the set of \emph{all} type variables in
  16.229 +  @{text "\<tau>"}.  The HOL datatype package by default registers any new
  16.230 +  datatype in the table of datatypes, which may be inspected using the
  16.231 +  @{command print_codesetup} command.
  16.232 +
  16.233 +  In some cases, it is appropriate to alter or extend this table.  As
  16.234 +  an example, we will develop an alternative representation of the
  16.235 +  queue example given in \secref{sec:intro}.  The amortised
  16.236 +  representation is convenient for generating code but exposes its
  16.237 +  \qt{implementation} details, which may be cumbersome when proving
  16.238 +  theorems about it.  Therefore, here a simple, straightforward
  16.239 +  representation of queues:
  16.240 +*}
  16.241 +
  16.242 +datatype %quote 'a queue = Queue "'a list"
  16.243 +
  16.244 +definition %quote empty :: "'a queue" where
  16.245 +  "empty = Queue []"
  16.246 +
  16.247 +primrec %quote enqueue :: "'a \<Rightarrow> 'a queue \<Rightarrow> 'a queue" where
  16.248 +  "enqueue x (Queue xs) = Queue (xs @ [x])"
  16.249 +
  16.250 +fun %quote dequeue :: "'a queue \<Rightarrow> 'a option \<times> 'a queue" where
  16.251 +    "dequeue (Queue []) = (None, Queue [])"
  16.252 +  | "dequeue (Queue (x # xs)) = (Some x, Queue xs)"
  16.253 +
  16.254 +text {*
  16.255 +  \noindent This we can use directly for proving;  for executing,
  16.256 +  we provide an alternative characterisation:
  16.257 +*}
  16.258 +
  16.259 +definition %quote AQueue :: "'a list \<Rightarrow> 'a list \<Rightarrow> 'a queue" where
  16.260 +  "AQueue xs ys = Queue (ys @ rev xs)"
  16.261 +
  16.262 +code_datatype %quote AQueue
  16.263 +
  16.264 +text {*
  16.265 +  \noindent Here we define a \qt{constructor} @{const "AQueue"} which
  16.266 +  is defined in terms of @{text "Queue"} and interprets its arguments
  16.267 +  according to what the \emph{content} of an amortised queue is supposed
  16.268 +  to be.  Equipped with this, we are able to prove the following equations
  16.269 +  for our primitive queue operations which \qt{implement} the simple
  16.270 +  queues in an amortised fashion:
  16.271 +*}
  16.272 +
  16.273 +lemma %quote empty_AQueue [code]:
  16.274 +  "empty = AQueue [] []"
  16.275 +  unfolding AQueue_def empty_def by simp
  16.276 +
  16.277 +lemma %quote enqueue_AQueue [code]:
  16.278 +  "enqueue x (AQueue xs ys) = AQueue (x # xs) ys"
  16.279 +  unfolding AQueue_def by simp
  16.280 +
  16.281 +lemma %quote dequeue_AQueue [code]:
  16.282 +  "dequeue (AQueue xs []) =
  16.283 +    (if xs = [] then (None, AQueue [] [])
  16.284 +    else dequeue (AQueue [] (rev xs)))"
  16.285 +  "dequeue (AQueue xs (y # ys)) = (Some y, AQueue xs ys)"
  16.286 +  unfolding AQueue_def by simp_all
  16.287 +
  16.288 +text {*
  16.289 +  \noindent For completeness, we provide a substitute for the
  16.290 +  @{text case} combinator on queues:
  16.291 +*}
  16.292 +
  16.293 +definition %quote
  16.294 +  aqueue_case_def: "aqueue_case = queue_case"
  16.295 +
  16.296 +lemma %quote aqueue_case [code, code inline]:
  16.297 +  "queue_case = aqueue_case"
  16.298 +  unfolding aqueue_case_def ..
  16.299 +
  16.300 +lemma %quote case_AQueue [code]:
  16.301 +  "aqueue_case f (AQueue xs ys) = f (ys @ rev xs)"
  16.302 +  unfolding aqueue_case_def AQueue_def by simp
  16.303 +
  16.304 +text {*
  16.305 +  \noindent The resulting code looks as expected:
  16.306 +*}
  16.307 +
  16.308 +text %quote {*@{code_stmts empty enqueue dequeue (SML)}*}
  16.309 +
  16.310 +text {*
  16.311 +  \noindent From this example, it can be glimpsed that using own
  16.312 +  constructor sets is a little delicate since it changes the set of
  16.313 +  valid patterns for values of that type.  Without going into much
  16.314 +  detail, here some practical hints:
  16.315 +
  16.316 +  \begin{itemize}
  16.317 +
  16.318 +    \item When changing the constructor set for datatypes, take care
  16.319 +      to provide an alternative for the @{text case} combinator
  16.320 +      (e.g.~by replacing it using the preprocessor).
  16.321 +
  16.322 +    \item Values in the target language need not to be normalised --
  16.323 +      different values in the target language may represent the same
  16.324 +      value in the logic.
  16.325 +
  16.326 +    \item Usually, a good methodology to deal with the subtleties of
  16.327 +      pattern matching is to see the type as an abstract type: provide
  16.328 +      a set of operations which operate on the concrete representation
  16.329 +      of the type, and derive further operations by combinations of
  16.330 +      these primitive ones, without relying on a particular
  16.331 +      representation.
  16.332 +
  16.333 +  \end{itemize}
  16.334 +*}
  16.335 +
  16.336 +
  16.337 +subsection {* Equality and wellsortedness *}
  16.338 +
  16.339 +text {*
  16.340 +  Surely you have already noticed how equality is treated
  16.341 +  by the code generator:
  16.342 +*}
  16.343 +
  16.344 +primrec %quote collect_duplicates :: "'a list \<Rightarrow> 'a list \<Rightarrow> 'a list \<Rightarrow> 'a list" where
  16.345 +  "collect_duplicates xs ys [] = xs"
  16.346 +  | "collect_duplicates xs ys (z#zs) = (if z \<in> set xs
  16.347 +      then if z \<in> set ys
  16.348 +        then collect_duplicates xs ys zs
  16.349 +        else collect_duplicates xs (z#ys) zs
  16.350 +      else collect_duplicates (z#xs) (z#ys) zs)"
  16.351 +
  16.352 +text {*
  16.353 +  \noindent The membership test during preprocessing is rewritten,
  16.354 +  resulting in @{const List.member}, which itself
  16.355 +  performs an explicit equality check.
  16.356 +*}
  16.357 +
  16.358 +text %quote {*@{code_stmts collect_duplicates (SML)}*}
  16.359 +
  16.360 +text {*
  16.361 +  \noindent Obviously, polymorphic equality is implemented the Haskell
  16.362 +  way using a type class.  How is this achieved?  HOL introduces
  16.363 +  an explicit class @{class eq} with a corresponding operation
  16.364 +  @{const eq_class.eq} such that @{thm eq [no_vars]}.
  16.365 +  The preprocessing framework does the rest by propagating the
  16.366 +  @{class eq} constraints through all dependent code equations.
  16.367 +  For datatypes, instances of @{class eq} are implicitly derived
  16.368 +  when possible.  For other types, you may instantiate @{text eq}
  16.369 +  manually like any other type class.
  16.370 +
  16.371 +  Though this @{text eq} class is designed to get rarely in
  16.372 +  the way, a subtlety
  16.373 +  enters the stage when definitions of overloaded constants
  16.374 +  are dependent on operational equality.  For example, let
  16.375 +  us define a lexicographic ordering on tuples
  16.376 +  (also see theory @{theory Product_ord}):
  16.377 +*}
  16.378 +
  16.379 +instantiation %quote "*" :: (order, order) order
  16.380 +begin
  16.381 +
  16.382 +definition %quote [code del]:
  16.383 +  "x \<le> y \<longleftrightarrow> fst x < fst y \<or> fst x = fst y \<and> snd x \<le> snd y"
  16.384 +
  16.385 +definition %quote [code del]:
  16.386 +  "x < y \<longleftrightarrow> fst x < fst y \<or> fst x = fst y \<and> snd x < snd y"
  16.387 +
  16.388 +instance %quote proof
  16.389 +qed (auto simp: less_eq_prod_def less_prod_def intro: order_less_trans)
  16.390 +
  16.391 +end %quote
  16.392 +
  16.393 +lemma %quote order_prod [code]:
  16.394 +  "(x1 \<Colon> 'a\<Colon>order, y1 \<Colon> 'b\<Colon>order) < (x2, y2) \<longleftrightarrow>
  16.395 +     x1 < x2 \<or> x1 = x2 \<and> y1 < y2"
  16.396 +  "(x1 \<Colon> 'a\<Colon>order, y1 \<Colon> 'b\<Colon>order) \<le> (x2, y2) \<longleftrightarrow>
  16.397 +     x1 < x2 \<or> x1 = x2 \<and> y1 \<le> y2"
  16.398 +  by (simp_all add: less_prod_def less_eq_prod_def)
  16.399 +
  16.400 +text {*
  16.401 +  \noindent Then code generation will fail.  Why?  The definition
  16.402 +  of @{term "op \<le>"} depends on equality on both arguments,
  16.403 +  which are polymorphic and impose an additional @{class eq}
  16.404 +  class constraint, which the preprocessor does not propagate
  16.405 +  (for technical reasons).
  16.406 +
  16.407 +  The solution is to add @{class eq} explicitly to the first sort arguments in the
  16.408 +  code theorems:
  16.409 +*}
  16.410 +
  16.411 +lemma %quote order_prod_code [code]:
  16.412 +  "(x1 \<Colon> 'a\<Colon>{order, eq}, y1 \<Colon> 'b\<Colon>order) < (x2, y2) \<longleftrightarrow>
  16.413 +     x1 < x2 \<or> x1 = x2 \<and> y1 < y2"
  16.414 +  "(x1 \<Colon> 'a\<Colon>{order, eq}, y1 \<Colon> 'b\<Colon>order) \<le> (x2, y2) \<longleftrightarrow>
  16.415 +     x1 < x2 \<or> x1 = x2 \<and> y1 \<le> y2"
  16.416 +  by (simp_all add: less_prod_def less_eq_prod_def)
  16.417 +
  16.418 +text {*
  16.419 +  \noindent Then code generation succeeds:
  16.420 +*}
  16.421 +
  16.422 +text %quote {*@{code_stmts "op \<le> \<Colon> _ \<times> _ \<Rightarrow> _ \<times> _ \<Rightarrow> bool" (SML)}*}
  16.423 +
  16.424 +text {*
  16.425 +  In some cases, the automatically derived code equations
  16.426 +  for equality on a particular type may not be appropriate.
  16.427 +  As example, watch the following datatype representing
  16.428 +  monomorphic parametric types (where type constructors
  16.429 +  are referred to by natural numbers):
  16.430 +*}
  16.431 +
  16.432 +datatype %quote monotype = Mono nat "monotype list"
  16.433 +(*<*)
  16.434 +lemma monotype_eq:
  16.435 +  "eq_class.eq (Mono tyco1 typargs1) (Mono tyco2 typargs2) \<equiv> 
  16.436 +     eq_class.eq tyco1 tyco2 \<and> eq_class.eq typargs1 typargs2" by (simp add: eq)
  16.437 +(*>*)
  16.438 +
  16.439 +text {*
  16.440 +  \noindent Then code generation for SML would fail with a message
  16.441 +  that the generated code contains illegal mutual dependencies:
  16.442 +  the theorem @{thm monotype_eq [no_vars]} already requires the
  16.443 +  instance @{text "monotype \<Colon> eq"}, which itself requires
  16.444 +  @{thm monotype_eq [no_vars]};  Haskell has no problem with mutually
  16.445 +  recursive @{text instance} and @{text function} definitions,
  16.446 +  but the SML serialiser does not support this.
  16.447 +
  16.448 +  In such cases, you have to provide your own equality equations
  16.449 +  involving auxiliary constants.  In our case,
  16.450 +  @{const [show_types] list_all2} can do the job:
  16.451 +*}
  16.452 +
  16.453 +lemma %quote monotype_eq_list_all2 [code]:
  16.454 +  "eq_class.eq (Mono tyco1 typargs1) (Mono tyco2 typargs2) \<longleftrightarrow>
  16.455 +     eq_class.eq tyco1 tyco2 \<and> list_all2 eq_class.eq typargs1 typargs2"
  16.456 +  by (simp add: eq list_all2_eq [symmetric])
  16.457 +
  16.458 +text {*
  16.459 +  \noindent does not depend on instance @{text "monotype \<Colon> eq"}:
  16.460 +*}
  16.461 +
  16.462 +text %quote {*@{code_stmts "eq_class.eq :: monotype \<Rightarrow> monotype \<Rightarrow> bool" (SML)}*}
  16.463 +
  16.464 +
  16.465 +subsection {* Explicit partiality *}
  16.466 +
  16.467 +text {*
  16.468 +  Partiality usually enters the game by partial patterns, as
  16.469 +  in the following example, again for amortised queues:
  16.470 +*}
  16.471 +
  16.472 +definition %quote strict_dequeue :: "'a queue \<Rightarrow> 'a \<times> 'a queue" where
  16.473 +  "strict_dequeue q = (case dequeue q
  16.474 +    of (Some x, q') \<Rightarrow> (x, q'))"
  16.475 +
  16.476 +lemma %quote strict_dequeue_AQueue [code]:
  16.477 +  "strict_dequeue (AQueue xs (y # ys)) = (y, AQueue xs ys)"
  16.478 +  "strict_dequeue (AQueue xs []) =
  16.479 +    (case rev xs of y # ys \<Rightarrow> (y, AQueue [] ys))"
  16.480 +  by (simp_all add: strict_dequeue_def dequeue_AQueue split: list.splits)
  16.481 +
  16.482 +text {*
  16.483 +  \noindent In the corresponding code, there is no equation
  16.484 +  for the pattern @{term "AQueue [] []"}:
  16.485 +*}
  16.486 +
  16.487 +text %quote {*@{code_stmts strict_dequeue (consts) strict_dequeue (Haskell)}*}
  16.488 +
  16.489 +text {*
  16.490 +  \noindent In some cases it is desirable to have this
  16.491 +  pseudo-\qt{partiality} more explicitly, e.g.~as follows:
  16.492 +*}
  16.493 +
  16.494 +axiomatization %quote empty_queue :: 'a
  16.495 +
  16.496 +definition %quote strict_dequeue' :: "'a queue \<Rightarrow> 'a \<times> 'a queue" where
  16.497 +  "strict_dequeue' q = (case dequeue q of (Some x, q') \<Rightarrow> (x, q') | _ \<Rightarrow> empty_queue)"
  16.498 +
  16.499 +lemma %quote strict_dequeue'_AQueue [code]:
  16.500 +  "strict_dequeue' (AQueue xs []) = (if xs = [] then empty_queue
  16.501 +     else strict_dequeue' (AQueue [] (rev xs)))"
  16.502 +  "strict_dequeue' (AQueue xs (y # ys)) =
  16.503 +     (y, AQueue xs ys)"
  16.504 +  by (simp_all add: strict_dequeue'_def dequeue_AQueue split: list.splits)
  16.505 +
  16.506 +text {*
  16.507 +  Observe that on the right hand side of the definition of @{const
  16.508 +  "strict_dequeue'"} the constant @{const empty_queue} occurs
  16.509 +  which is unspecified.
  16.510 +
  16.511 +  Normally, if constants without any code equations occur in a
  16.512 +  program, the code generator complains (since in most cases this is
  16.513 +  not what the user expects).  But such constants can also be thought
  16.514 +  of as function definitions with no equations which always fail,
  16.515 +  since there is never a successful pattern match on the left hand
  16.516 +  side.  In order to categorise a constant into that category
  16.517 +  explicitly, use @{command "code_abort"}:
  16.518 +*}
  16.519 +
  16.520 +code_abort %quote empty_queue
  16.521 +
  16.522 +text {*
  16.523 +  \noindent Then the code generator will just insert an error or
  16.524 +  exception at the appropriate position:
  16.525 +*}
  16.526 +
  16.527 +text %quote {*@{code_stmts strict_dequeue' (consts) empty_queue strict_dequeue' (Haskell)}*}
  16.528 +
  16.529 +text {*
  16.530 +  \noindent This feature however is rarely needed in practice.
  16.531 +  Note also that the @{text HOL} default setup already declares
  16.532 +  @{const undefined} as @{command "code_abort"}, which is most
  16.533 +  likely to be used in such situations.
  16.534 +*}
  16.535 +
  16.536 +end
  16.537 + 
  16.538 \ No newline at end of file
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/doc-src/Codegen/Thy/ROOT.ML	Tue Mar 03 11:00:51 2009 +0100
    17.3 @@ -0,0 +1,11 @@
    17.4 +
    17.5 +(* $Id$ *)
    17.6 +
    17.7 +no_document use_thy "Setup";
    17.8 +no_document use_thys ["Efficient_Nat"];
    17.9 +
   17.10 +use_thy "Introduction";
   17.11 +use_thy "Program";
   17.12 +use_thy "Adaption";
   17.13 +use_thy "Further";
   17.14 +use_thy "ML";
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/doc-src/Codegen/Thy/Setup.thy	Tue Mar 03 11:00:51 2009 +0100
    18.3 @@ -0,0 +1,12 @@
    18.4 +theory Setup
    18.5 +imports Complex_Main
    18.6 +uses "../../../antiquote_setup.ML" "../../../more_antiquote.ML"
    18.7 +begin
    18.8 +
    18.9 +ML {* no_document use_thys
   18.10 +  ["Efficient_Nat", "Code_Char_chr", "Product_ord", "~~/src/HOL/Imperative_HOL/Imperative_HOL",
   18.11 +   "~~/src/HOL/Decision_Procs/Ferrack"] *}
   18.12 +
   18.13 +ML_val {* Code_Target.code_width := 74 *}
   18.14 +
   18.15 +end
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/doc-src/Codegen/Thy/document/Adaption.tex	Tue Mar 03 11:00:51 2009 +0100
    19.3 @@ -0,0 +1,679 @@
    19.4 +%
    19.5 +\begin{isabellebody}%
    19.6 +\def\isabellecontext{Adaption}%
    19.7 +%
    19.8 +\isadelimtheory
    19.9 +%
   19.10 +\endisadelimtheory
   19.11 +%
   19.12 +\isatagtheory
   19.13 +\isacommand{theory}\isamarkupfalse%
   19.14 +\ Adaption\isanewline
   19.15 +\isakeyword{imports}\ Setup\isanewline
   19.16 +\isakeyword{begin}%
   19.17 +\endisatagtheory
   19.18 +{\isafoldtheory}%
   19.19 +%
   19.20 +\isadelimtheory
   19.21 +\isanewline
   19.22 +%
   19.23 +\endisadelimtheory
   19.24 +%
   19.25 +\isadeliminvisible
   19.26 +\isanewline
   19.27 +%
   19.28 +\endisadeliminvisible
   19.29 +%
   19.30 +\isataginvisible
   19.31 +\isacommand{setup}\isamarkupfalse%
   19.32 +\ {\isacharverbatimopen}\ Code{\isacharunderscore}Target{\isachardot}extend{\isacharunderscore}target\ {\isacharparenleft}{\isachardoublequote}{\isasymSML}{\isachardoublequote}{\isacharcomma}\ {\isacharparenleft}{\isachardoublequote}SML{\isachardoublequote}{\isacharcomma}\ K\ I{\isacharparenright}{\isacharparenright}\ {\isacharverbatimclose}%
   19.33 +\endisataginvisible
   19.34 +{\isafoldinvisible}%
   19.35 +%
   19.36 +\isadeliminvisible
   19.37 +%
   19.38 +\endisadeliminvisible
   19.39 +%
   19.40 +\isamarkupsection{Adaption to target languages \label{sec:adaption}%
   19.41 +}
   19.42 +\isamarkuptrue%
   19.43 +%
   19.44 +\isamarkupsubsection{Adapting code generation%
   19.45 +}
   19.46 +\isamarkuptrue%
   19.47 +%
   19.48 +\begin{isamarkuptext}%
   19.49 +The aspects of code generation introduced so far have two aspects
   19.50 +  in common:
   19.51 +
   19.52 +  \begin{itemize}
   19.53 +    \item They act uniformly, without reference to a specific
   19.54 +       target language.
   19.55 +    \item They are \emph{safe} in the sense that as long as you trust
   19.56 +       the code generator meta theory and implementation, you cannot
   19.57 +       produce programs that yield results which are not derivable
   19.58 +       in the logic.
   19.59 +  \end{itemize}
   19.60 +
   19.61 +  \noindent In this section we will introduce means to \emph{adapt} the serialiser
   19.62 +  to a specific target language, i.e.~to print program fragments
   19.63 +  in a way which accommodates \qt{already existing} ingredients of
   19.64 +  a target language environment, for three reasons:
   19.65 +
   19.66 +  \begin{itemize}
   19.67 +    \item improving readability and aesthetics of generated code
   19.68 +    \item gaining efficiency
   19.69 +    \item interface with language parts which have no direct counterpart
   19.70 +      in \isa{HOL} (say, imperative data structures)
   19.71 +  \end{itemize}
   19.72 +
   19.73 +  \noindent Generally, you should avoid using those features yourself
   19.74 +  \emph{at any cost}:
   19.75 +
   19.76 +  \begin{itemize}
   19.77 +    \item The safe configuration methods act uniformly on every target language,
   19.78 +      whereas for adaption you have to treat each target language separate.
   19.79 +    \item Application is extremely tedious since there is no abstraction
   19.80 +      which would allow for a static check, making it easy to produce garbage.
   19.81 +    \item More or less subtle errors can be introduced unconsciously.
   19.82 +  \end{itemize}
   19.83 +
   19.84 +  \noindent However, even if you ought refrain from setting up adaption
   19.85 +  yourself, already the \isa{HOL} comes with some reasonable default
   19.86 +  adaptions (say, using target language list syntax).  There also some
   19.87 +  common adaption cases which you can setup by importing particular
   19.88 +  library theories.  In order to understand these, we provide some clues here;
   19.89 +  these however are not supposed to replace a careful study of the sources.%
   19.90 +\end{isamarkuptext}%
   19.91 +\isamarkuptrue%
   19.92 +%
   19.93 +\isamarkupsubsection{The adaption principle%
   19.94 +}
   19.95 +\isamarkuptrue%
   19.96 +%
   19.97 +\begin{isamarkuptext}%
   19.98 +The following figure illustrates what \qt{adaption} is conceptually
   19.99 +  supposed to be:
  19.100 +
  19.101 +  \begin{figure}[here]
  19.102 +    \begin{tikzpicture}[scale = 0.5]
  19.103 +      \tikzstyle water=[color = blue, thick]
  19.104 +      \tikzstyle ice=[color = black, very thick, cap = round, join = round, fill = white]
  19.105 +      \tikzstyle process=[color = green, semithick, ->]
  19.106 +      \tikzstyle adaption=[color = red, semithick, ->]
  19.107 +      \tikzstyle target=[color = black]
  19.108 +      \foreach \x in {0, ..., 24}
  19.109 +        \draw[style=water] (\x, 0.25) sin + (0.25, 0.25) cos + (0.25, -0.25) sin
  19.110 +          + (0.25, -0.25) cos + (0.25, 0.25);
  19.111 +      \draw[style=ice] (1, 0) --
  19.112 +        (3, 6) node[above, fill=white] {logic} -- (5, 0) -- cycle;
  19.113 +      \draw[style=ice] (9, 0) --
  19.114 +        (11, 6) node[above, fill=white] {intermediate language} -- (13, 0) -- cycle;
  19.115 +      \draw[style=ice] (15, -6) --
  19.116 +        (19, 6) node[above, fill=white] {target language} -- (23, -6) -- cycle;
  19.117 +      \draw[style=process]
  19.118 +        (3.5, 3) .. controls (7, 5) .. node[fill=white] {translation} (10.5, 3);
  19.119 +      \draw[style=process]
  19.120 +        (11.5, 3) .. controls (15, 5) .. node[fill=white] (serialisation) {serialisation} (18.5, 3);
  19.121 +      \node (adaption) at (11, -2) [style=adaption] {adaption};
  19.122 +      \node at (19, 3) [rotate=90] {generated};
  19.123 +      \node at (19.5, -5) {language};
  19.124 +      \node at (19.5, -3) {library};
  19.125 +      \node (includes) at (19.5, -1) {includes};
  19.126 +      \node (reserved) at (16.5, -3) [rotate=72] {reserved}; % proper 71.57
  19.127 +      \draw[style=process]
  19.128 +        (includes) -- (serialisation);
  19.129 +      \draw[style=process]
  19.130 +        (reserved) -- (serialisation);
  19.131 +      \draw[style=adaption]
  19.132 +        (adaption) -- (serialisation);
  19.133 +      \draw[style=adaption]
  19.134 +        (adaption) -- (includes);
  19.135 +      \draw[style=adaption]
  19.136 +        (adaption) -- (reserved);
  19.137 +    \end{tikzpicture}
  19.138 +    \caption{The adaption principle}
  19.139 +    \label{fig:adaption}
  19.140 +  \end{figure}
  19.141 +
  19.142 +  \noindent In the tame view, code generation acts as broker between
  19.143 +  \isa{logic}, \isa{intermediate\ language} and
  19.144 +  \isa{target\ language} by means of \isa{translation} and
  19.145 +  \isa{serialisation};  for the latter, the serialiser has to observe
  19.146 +  the structure of the \isa{language} itself plus some \isa{reserved}
  19.147 +  keywords which have to be avoided for generated code.
  19.148 +  However, if you consider \isa{adaption} mechanisms, the code generated
  19.149 +  by the serializer is just the tip of the iceberg:
  19.150 +
  19.151 +  \begin{itemize}
  19.152 +    \item \isa{serialisation} can be \emph{parametrised} such that
  19.153 +      logical entities are mapped to target-specific ones
  19.154 +      (e.g. target-specific list syntax,
  19.155 +        see also \secref{sec:adaption_mechanisms})
  19.156 +    \item Such parametrisations can involve references to a
  19.157 +      target-specific standard \isa{library} (e.g. using
  19.158 +      the \isa{Haskell} \verb|Maybe| type instead
  19.159 +      of the \isa{HOL} \isa{option} type);
  19.160 +      if such are used, the corresponding identifiers
  19.161 +      (in our example, \verb|Maybe|, \verb|Nothing|
  19.162 +      and \verb|Just|) also have to be considered \isa{reserved}.
  19.163 +    \item Even more, the user can enrich the library of the
  19.164 +      target-language by providing code snippets
  19.165 +      (\qt{\isa{includes}}) which are prepended to
  19.166 +      any generated code (see \secref{sec:include});  this typically
  19.167 +      also involves further \isa{reserved} identifiers.
  19.168 +  \end{itemize}
  19.169 +
  19.170 +  \noindent As figure \ref{fig:adaption} illustrates, all these adaption mechanisms
  19.171 +  have to act consistently;  it is at the discretion of the user
  19.172 +  to take care for this.%
  19.173 +\end{isamarkuptext}%
  19.174 +\isamarkuptrue%
  19.175 +%
  19.176 +\isamarkupsubsection{Common adaption patterns%
  19.177 +}
  19.178 +\isamarkuptrue%
  19.179 +%
  19.180 +\begin{isamarkuptext}%
  19.181 +The \hyperlink{theory.HOL}{\mbox{\isa{HOL}}} \hyperlink{theory.Main}{\mbox{\isa{Main}}} theory already provides a code
  19.182 +  generator setup
  19.183 +  which should be suitable for most applications.  Common extensions
  19.184 +  and modifications are available by certain theories of the \isa{HOL}
  19.185 +  library; beside being useful in applications, they may serve
  19.186 +  as a tutorial for customising the code generator setup (see below
  19.187 +  \secref{sec:adaption_mechanisms}).
  19.188 +
  19.189 +  \begin{description}
  19.190 +
  19.191 +    \item[\hyperlink{theory.Code-Integer}{\mbox{\isa{Code{\isacharunderscore}Integer}}}] represents \isa{HOL} integers by big
  19.192 +       integer literals in target languages.
  19.193 +    \item[\hyperlink{theory.Code-Char}{\mbox{\isa{Code{\isacharunderscore}Char}}}] represents \isa{HOL} characters by 
  19.194 +       character literals in target languages.
  19.195 +    \item[\hyperlink{theory.Code-Char-chr}{\mbox{\isa{Code{\isacharunderscore}Char{\isacharunderscore}chr}}}] like \isa{Code{\isacharunderscore}Char},
  19.196 +       but also offers treatment of character codes; includes
  19.197 +       \hyperlink{theory.Code-Char}{\mbox{\isa{Code{\isacharunderscore}Char}}}.
  19.198 +    \item[\hyperlink{theory.Efficient-Nat}{\mbox{\isa{Efficient{\isacharunderscore}Nat}}}] \label{eff_nat} implements natural numbers by integers,
  19.199 +       which in general will result in higher efficiency; pattern
  19.200 +       matching with \isa{{\isadigit{0}}} / \isa{Suc}
  19.201 +       is eliminated;  includes \hyperlink{theory.Code-Integer}{\mbox{\isa{Code{\isacharunderscore}Integer}}}
  19.202 +       and \hyperlink{theory.Code-Index}{\mbox{\isa{Code{\isacharunderscore}Index}}}.
  19.203 +    \item[\hyperlink{theory.Code-Index}{\mbox{\isa{Code{\isacharunderscore}Index}}}] provides an additional datatype
  19.204 +       \isa{index} which is mapped to target-language built-in integers.
  19.205 +       Useful for code setups which involve e.g. indexing of
  19.206 +       target-language arrays.
  19.207 +    \item[\hyperlink{theory.Code-Message}{\mbox{\isa{Code{\isacharunderscore}Message}}}] provides an additional datatype
  19.208 +       \isa{message{\isacharunderscore}string} which is isomorphic to strings;
  19.209 +       \isa{message{\isacharunderscore}string}s are mapped to target-language strings.
  19.210 +       Useful for code setups which involve e.g. printing (error) messages.
  19.211 +
  19.212 +  \end{description}
  19.213 +
  19.214 +  \begin{warn}
  19.215 +    When importing any of these theories, they should form the last
  19.216 +    items in an import list.  Since these theories adapt the
  19.217 +    code generator setup in a non-conservative fashion,
  19.218 +    strange effects may occur otherwise.
  19.219 +  \end{warn}%
  19.220 +\end{isamarkuptext}%
  19.221 +\isamarkuptrue%
  19.222 +%
  19.223 +\isamarkupsubsection{Parametrising serialisation \label{sec:adaption_mechanisms}%
  19.224 +}
  19.225 +\isamarkuptrue%
  19.226 +%
  19.227 +\begin{isamarkuptext}%
  19.228 +Consider the following function and its corresponding
  19.229 +  SML code:%
  19.230 +\end{isamarkuptext}%
  19.231 +\isamarkuptrue%
  19.232 +%
  19.233 +\isadelimquote
  19.234 +%
  19.235 +\endisadelimquote
  19.236 +%
  19.237 +\isatagquote
  19.238 +\isacommand{primrec}\isamarkupfalse%
  19.239 +\ in{\isacharunderscore}interval\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymtimes}\ nat\ {\isasymRightarrow}\ nat\ {\isasymRightarrow}\ bool{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  19.240 +\ \ {\isachardoublequoteopen}in{\isacharunderscore}interval\ {\isacharparenleft}k{\isacharcomma}\ l{\isacharparenright}\ n\ {\isasymlongleftrightarrow}\ k\ {\isasymle}\ n\ {\isasymand}\ n\ {\isasymle}\ l{\isachardoublequoteclose}%
  19.241 +\endisatagquote
  19.242 +{\isafoldquote}%
  19.243 +%
  19.244 +\isadelimquote
  19.245 +%
  19.246 +\endisadelimquote
  19.247 +%
  19.248 +\isadeliminvisible
  19.249 +%
  19.250 +\endisadeliminvisible
  19.251 +%
  19.252 +\isataginvisible
  19.253 +%
  19.254 +\endisataginvisible
  19.255 +{\isafoldinvisible}%
  19.256 +%
  19.257 +\isadeliminvisible
  19.258 +%
  19.259 +\endisadeliminvisible
  19.260 +%
  19.261 +\isadelimquote
  19.262 +%
  19.263 +\endisadelimquote
  19.264 +%
  19.265 +\isatagquote
  19.266 +%
  19.267 +\begin{isamarkuptext}%
  19.268 +\isatypewriter%
  19.269 +\noindent%
  19.270 +\hspace*{0pt}structure Example = \\
  19.271 +\hspace*{0pt}struct\\
  19.272 +\hspace*{0pt}\\
  19.273 +\hspace*{0pt}datatype nat = Zero{\char95}nat | Suc of nat;\\
  19.274 +\hspace*{0pt}\\
  19.275 +\hspace*{0pt}datatype boola = True | False;\\
  19.276 +\hspace*{0pt}\\
  19.277 +\hspace*{0pt}fun anda x True = x\\
  19.278 +\hspace*{0pt} ~| anda x False = False\\
  19.279 +\hspace*{0pt} ~| anda True x = x\\
  19.280 +\hspace*{0pt} ~| anda False x = False;\\
  19.281 +\hspace*{0pt}\\
  19.282 +\hspace*{0pt}fun less{\char95}nat m (Suc n) = less{\char95}eq{\char95}nat m n\\
  19.283 +\hspace*{0pt} ~| less{\char95}nat n Zero{\char95}nat = False\\
  19.284 +\hspace*{0pt}and less{\char95}eq{\char95}nat (Suc m) n = less{\char95}nat m n\\
  19.285 +\hspace*{0pt} ~| less{\char95}eq{\char95}nat Zero{\char95}nat n = True;\\
  19.286 +\hspace*{0pt}\\
  19.287 +\hspace*{0pt}fun in{\char95}interval (k,~l) n = anda (less{\char95}eq{\char95}nat k n) (less{\char95}eq{\char95}nat n l);\\
  19.288 +\hspace*{0pt}\\
  19.289 +\hspace*{0pt}end;~(*struct Example*)%
  19.290 +\end{isamarkuptext}%
  19.291 +\isamarkuptrue%
  19.292 +%
  19.293 +\endisatagquote
  19.294 +{\isafoldquote}%
  19.295 +%
  19.296 +\isadelimquote
  19.297 +%
  19.298 +\endisadelimquote
  19.299 +%
  19.300 +\begin{isamarkuptext}%
  19.301 +\noindent Though this is correct code, it is a little bit unsatisfactory:
  19.302 +  boolean values and operators are materialised as distinguished
  19.303 +  entities with have nothing to do with the SML-built-in notion
  19.304 +  of \qt{bool}.  This results in less readable code;
  19.305 +  additionally, eager evaluation may cause programs to
  19.306 +  loop or break which would perfectly terminate when
  19.307 +  the existing SML \verb|bool| would be used.  To map
  19.308 +  the HOL \isa{bool} on SML \verb|bool|, we may use
  19.309 +  \qn{custom serialisations}:%
  19.310 +\end{isamarkuptext}%
  19.311 +\isamarkuptrue%
  19.312 +%
  19.313 +\isadelimquotett
  19.314 +%
  19.315 +\endisadelimquotett
  19.316 +%
  19.317 +\isatagquotett
  19.318 +\isacommand{code{\isacharunderscore}type}\isamarkupfalse%
  19.319 +\ bool\isanewline
  19.320 +\ \ {\isacharparenleft}SML\ {\isachardoublequoteopen}bool{\isachardoublequoteclose}{\isacharparenright}\isanewline
  19.321 +\isacommand{code{\isacharunderscore}const}\isamarkupfalse%
  19.322 +\ True\ \isakeyword{and}\ False\ \isakeyword{and}\ {\isachardoublequoteopen}op\ {\isasymand}{\isachardoublequoteclose}\isanewline
  19.323 +\ \ {\isacharparenleft}SML\ {\isachardoublequoteopen}true{\isachardoublequoteclose}\ \isakeyword{and}\ {\isachardoublequoteopen}false{\isachardoublequoteclose}\ \isakeyword{and}\ {\isachardoublequoteopen}{\isacharunderscore}\ andalso\ {\isacharunderscore}{\isachardoublequoteclose}{\isacharparenright}%
  19.324 +\endisatagquotett
  19.325 +{\isafoldquotett}%
  19.326 +%
  19.327 +\isadelimquotett
  19.328 +%
  19.329 +\endisadelimquotett
  19.330 +%
  19.331 +\begin{isamarkuptext}%
  19.332 +\noindent The \hyperlink{command.code-type}{\mbox{\isa{\isacommand{code{\isacharunderscore}type}}}} command takes a type constructor
  19.333 +  as arguments together with a list of custom serialisations.
  19.334 +  Each custom serialisation starts with a target language
  19.335 +  identifier followed by an expression, which during
  19.336 +  code serialisation is inserted whenever the type constructor
  19.337 +  would occur.  For constants, \hyperlink{command.code-const}{\mbox{\isa{\isacommand{code{\isacharunderscore}const}}}} implements
  19.338 +  the corresponding mechanism.  Each ``\verb|_|'' in
  19.339 +  a serialisation expression is treated as a placeholder
  19.340 +  for the type constructor's (the constant's) arguments.%
  19.341 +\end{isamarkuptext}%
  19.342 +\isamarkuptrue%
  19.343 +%
  19.344 +\isadelimquote
  19.345 +%
  19.346 +\endisadelimquote
  19.347 +%
  19.348 +\isatagquote
  19.349 +%
  19.350 +\begin{isamarkuptext}%
  19.351 +\isatypewriter%
  19.352 +\noindent%
  19.353 +\hspace*{0pt}structure Example = \\
  19.354 +\hspace*{0pt}struct\\
  19.355 +\hspace*{0pt}\\
  19.356 +\hspace*{0pt}datatype nat = Zero{\char95}nat | Suc of nat;\\
  19.357 +\hspace*{0pt}\\
  19.358 +\hspace*{0pt}fun less{\char95}nat m (Suc n) = less{\char95}eq{\char95}nat m n\\
  19.359 +\hspace*{0pt} ~| less{\char95}nat n Zero{\char95}nat = false\\
  19.360 +\hspace*{0pt}and less{\char95}eq{\char95}nat (Suc m) n = less{\char95}nat m n\\
  19.361 +\hspace*{0pt} ~| less{\char95}eq{\char95}nat Zero{\char95}nat n = true;\\
  19.362 +\hspace*{0pt}\\
  19.363 +\hspace*{0pt}fun in{\char95}interval (k,~l) n = (less{\char95}eq{\char95}nat k n) andalso (less{\char95}eq{\char95}nat n l);\\
  19.364 +\hspace*{0pt}\\
  19.365 +\hspace*{0pt}end;~(*struct Example*)%
  19.366 +\end{isamarkuptext}%
  19.367 +\isamarkuptrue%
  19.368 +%
  19.369 +\endisatagquote
  19.370 +{\isafoldquote}%
  19.371 +%
  19.372 +\isadelimquote
  19.373 +%
  19.374 +\endisadelimquote
  19.375 +%
  19.376 +\begin{isamarkuptext}%
  19.377 +\noindent This still is not perfect: the parentheses
  19.378 +  around the \qt{andalso} expression are superfluous.
  19.379 +  Though the serialiser
  19.380 +  by no means attempts to imitate the rich Isabelle syntax
  19.381 +  framework, it provides some common idioms, notably
  19.382 +  associative infixes with precedences which may be used here:%
  19.383 +\end{isamarkuptext}%
  19.384 +\isamarkuptrue%
  19.385 +%
  19.386 +\isadelimquotett
  19.387 +%
  19.388 +\endisadelimquotett
  19.389 +%
  19.390 +\isatagquotett
  19.391 +\isacommand{code{\isacharunderscore}const}\isamarkupfalse%
  19.392 +\ {\isachardoublequoteopen}op\ {\isasymand}{\isachardoublequoteclose}\isanewline
  19.393 +\ \ {\isacharparenleft}SML\ \isakeyword{infixl}\ {\isadigit{1}}\ {\isachardoublequoteopen}andalso{\isachardoublequoteclose}{\isacharparenright}%
  19.394 +\endisatagquotett
  19.395 +{\isafoldquotett}%
  19.396 +%
  19.397 +\isadelimquotett
  19.398 +%
  19.399 +\endisadelimquotett
  19.400 +%
  19.401 +\isadelimquote
  19.402 +%
  19.403 +\endisadelimquote
  19.404 +%
  19.405 +\isatagquote
  19.406 +%
  19.407 +\begin{isamarkuptext}%
  19.408 +\isatypewriter%
  19.409 +\noindent%
  19.410 +\hspace*{0pt}structure Example = \\
  19.411 +\hspace*{0pt}struct\\
  19.412 +\hspace*{0pt}\\
  19.413 +\hspace*{0pt}datatype nat = Zero{\char95}nat | Suc of nat;\\
  19.414 +\hspace*{0pt}\\
  19.415 +\hspace*{0pt}fun less{\char95}nat m (Suc n) = less{\char95}eq{\char95}nat m n\\
  19.416 +\hspace*{0pt} ~| less{\char95}nat n Zero{\char95}nat = false\\
  19.417 +\hspace*{0pt}and less{\char95}eq{\char95}nat (Suc m) n = less{\char95}nat m n\\
  19.418 +\hspace*{0pt} ~| less{\char95}eq{\char95}nat Zero{\char95}nat n = true;\\
  19.419 +\hspace*{0pt}\\
  19.420 +\hspace*{0pt}fun in{\char95}interval (k,~l) n = less{\char95}eq{\char95}nat k n andalso less{\char95}eq{\char95}nat n l;\\
  19.421 +\hspace*{0pt}\\
  19.422 +\hspace*{0pt}end;~(*struct Example*)%
  19.423 +\end{isamarkuptext}%
  19.424 +\isamarkuptrue%
  19.425 +%
  19.426 +\endisatagquote
  19.427 +{\isafoldquote}%
  19.428 +%
  19.429 +\isadelimquote
  19.430 +%
  19.431 +\endisadelimquote
  19.432 +%
  19.433 +\begin{isamarkuptext}%
  19.434 +\noindent The attentive reader may ask how we assert that no generated
  19.435 +  code will accidentally overwrite.  For this reason the serialiser has
  19.436 +  an internal table of identifiers which have to be avoided to be used
  19.437 +  for new declarations.  Initially, this table typically contains the
  19.438 +  keywords of the target language.  It can be extended manually, thus avoiding
  19.439 +  accidental overwrites, using the \hyperlink{command.code-reserved}{\mbox{\isa{\isacommand{code{\isacharunderscore}reserved}}}} command:%
  19.440 +\end{isamarkuptext}%
  19.441 +\isamarkuptrue%
  19.442 +%
  19.443 +\isadelimquote
  19.444 +%
  19.445 +\endisadelimquote
  19.446 +%
  19.447 +\isatagquote
  19.448 +\isacommand{code{\isacharunderscore}reserved}\isamarkupfalse%
  19.449 +\ {\isachardoublequoteopen}{\isasymSML}{\isachardoublequoteclose}\ bool\ true\ false\ andalso%
  19.450 +\endisatagquote
  19.451 +{\isafoldquote}%
  19.452 +%
  19.453 +\isadelimquote
  19.454 +%
  19.455 +\endisadelimquote
  19.456 +%
  19.457 +\begin{isamarkuptext}%
  19.458 +\noindent Next, we try to map HOL pairs to SML pairs, using the
  19.459 +  infix ``\verb|*|'' type constructor and parentheses:%
  19.460 +\end{isamarkuptext}%
  19.461 +\isamarkuptrue%
  19.462 +%
  19.463 +\isadeliminvisible
  19.464 +%
  19.465 +\endisadeliminvisible
  19.466 +%
  19.467 +\isataginvisible
  19.468 +%
  19.469 +\endisataginvisible
  19.470 +{\isafoldinvisible}%
  19.471 +%
  19.472 +\isadeliminvisible
  19.473 +%
  19.474 +\endisadeliminvisible
  19.475 +%
  19.476 +\isadelimquotett
  19.477 +%
  19.478 +\endisadelimquotett
  19.479 +%
  19.480 +\isatagquotett
  19.481 +\isacommand{code{\isacharunderscore}type}\isamarkupfalse%
  19.482 +\ {\isacharasterisk}\isanewline
  19.483 +\ \ {\isacharparenleft}SML\ \isakeyword{infix}\ {\isadigit{2}}\ {\isachardoublequoteopen}{\isacharasterisk}{\isachardoublequoteclose}{\isacharparenright}\isanewline
  19.484 +\isacommand{code{\isacharunderscore}const}\isamarkupfalse%
  19.485 +\ Pair\isanewline
  19.486 +\ \ {\isacharparenleft}SML\ {\isachardoublequoteopen}{\isacharbang}{\isacharparenleft}{\isacharparenleft}{\isacharunderscore}{\isacharparenright}{\isacharcomma}{\isacharslash}\ {\isacharparenleft}{\isacharunderscore}{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}{\isacharparenright}%
  19.487 +\endisatagquotett
  19.488 +{\isafoldquotett}%
  19.489 +%
  19.490 +\isadelimquotett
  19.491 +%
  19.492 +\endisadelimquotett
  19.493 +%
  19.494 +\begin{isamarkuptext}%
  19.495 +\noindent The initial bang ``\verb|!|'' tells the serialiser
  19.496 +  never to put
  19.497 +  parentheses around the whole expression (they are already present),
  19.498 +  while the parentheses around argument place holders
  19.499 +  tell not to put parentheses around the arguments.
  19.500 +  The slash ``\verb|/|'' (followed by arbitrary white space)
  19.501 +  inserts a space which may be used as a break if necessary
  19.502 +  during pretty printing.
  19.503 +
  19.504 +  These examples give a glimpse what mechanisms
  19.505 +  custom serialisations provide; however their usage
  19.506 +  requires careful thinking in order not to introduce
  19.507 +  inconsistencies -- or, in other words:
  19.508 +  custom serialisations are completely axiomatic.
  19.509 +
  19.510 +  A further noteworthy details is that any special
  19.511 +  character in a custom serialisation may be quoted
  19.512 +  using ``\verb|'|''; thus, in
  19.513 +  ``\verb|fn '_ => _|'' the first
  19.514 +  ``\verb|_|'' is a proper underscore while the
  19.515 +  second ``\verb|_|'' is a placeholder.%
  19.516 +\end{isamarkuptext}%
  19.517 +\isamarkuptrue%
  19.518 +%
  19.519 +\isamarkupsubsection{\isa{Haskell} serialisation%
  19.520 +}
  19.521 +\isamarkuptrue%
  19.522 +%
  19.523 +\begin{isamarkuptext}%
  19.524 +For convenience, the default
  19.525 +  \isa{HOL} setup for \isa{Haskell} maps the \isa{eq} class to
  19.526 +  its counterpart in \isa{Haskell}, giving custom serialisations
  19.527 +  for the class \isa{eq} (by command \hyperlink{command.code-class}{\mbox{\isa{\isacommand{code{\isacharunderscore}class}}}}) and its operation
  19.528 +  \isa{eq{\isacharunderscore}class{\isachardot}eq}%
  19.529 +\end{isamarkuptext}%
  19.530 +\isamarkuptrue%
  19.531 +%
  19.532 +\isadelimquotett
  19.533 +%
  19.534 +\endisadelimquotett
  19.535 +%
  19.536 +\isatagquotett
  19.537 +\isacommand{code{\isacharunderscore}class}\isamarkupfalse%
  19.538 +\ eq\isanewline
  19.539 +\ \ {\isacharparenleft}Haskell\ {\isachardoublequoteopen}Eq{\isachardoublequoteclose}{\isacharparenright}\isanewline
  19.540 +\isanewline
  19.541 +\isacommand{code{\isacharunderscore}const}\isamarkupfalse%
  19.542 +\ {\isachardoublequoteopen}op\ {\isacharequal}{\isachardoublequoteclose}\isanewline
  19.543 +\ \ {\isacharparenleft}Haskell\ \isakeyword{infixl}\ {\isadigit{4}}\ {\isachardoublequoteopen}{\isacharequal}{\isacharequal}{\isachardoublequoteclose}{\isacharparenright}%
  19.544 +\endisatagquotett
  19.545 +{\isafoldquotett}%
  19.546 +%
  19.547 +\isadelimquotett
  19.548 +%
  19.549 +\endisadelimquotett
  19.550 +%
  19.551 +\begin{isamarkuptext}%
  19.552 +\noindent A problem now occurs whenever a type which
  19.553 +  is an instance of \isa{eq} in \isa{HOL} is mapped
  19.554 +  on a \isa{Haskell}-built-in type which is also an instance
  19.555 +  of \isa{Haskell} \isa{Eq}:%
  19.556 +\end{isamarkuptext}%
  19.557 +\isamarkuptrue%
  19.558 +%
  19.559 +\isadelimquote
  19.560 +%
  19.561 +\endisadelimquote
  19.562 +%
  19.563 +\isatagquote
  19.564 +\isacommand{typedecl}\isamarkupfalse%
  19.565 +\ bar\isanewline
  19.566 +\isanewline
  19.567 +\isacommand{instantiation}\isamarkupfalse%
  19.568 +\ bar\ {\isacharcolon}{\isacharcolon}\ eq\isanewline
  19.569 +\isakeyword{begin}\isanewline
  19.570 +\isanewline
  19.571 +\isacommand{definition}\isamarkupfalse%
  19.572 +\ {\isachardoublequoteopen}eq{\isacharunderscore}class{\isachardot}eq\ {\isacharparenleft}x{\isasymColon}bar{\isacharparenright}\ y\ {\isasymlongleftrightarrow}\ x\ {\isacharequal}\ y{\isachardoublequoteclose}\isanewline
  19.573 +\isanewline
  19.574 +\isacommand{instance}\isamarkupfalse%
  19.575 +\ \isacommand{by}\isamarkupfalse%
  19.576 +\ default\ {\isacharparenleft}simp\ add{\isacharcolon}\ eq{\isacharunderscore}bar{\isacharunderscore}def{\isacharparenright}\isanewline
  19.577 +\isanewline
  19.578 +\isacommand{end}\isamarkupfalse%
  19.579 +%
  19.580 +\endisatagquote
  19.581 +{\isafoldquote}%
  19.582 +%
  19.583 +\isadelimquote
  19.584 +%
  19.585 +\endisadelimquote
  19.586 +\isanewline
  19.587 +%
  19.588 +\isadelimquotett
  19.589 +\isanewline
  19.590 +%
  19.591 +\endisadelimquotett
  19.592 +%
  19.593 +\isatagquotett
  19.594 +\isacommand{code{\isacharunderscore}type}\isamarkupfalse%
  19.595 +\ bar\isanewline
  19.596 +\ \ {\isacharparenleft}Haskell\ {\isachardoublequoteopen}Integer{\isachardoublequoteclose}{\isacharparenright}%
  19.597 +\endisatagquotett
  19.598 +{\isafoldquotett}%
  19.599 +%
  19.600 +\isadelimquotett
  19.601 +%
  19.602 +\endisadelimquotett
  19.603 +%
  19.604 +\begin{isamarkuptext}%
  19.605 +\noindent The code generator would produce
  19.606 +  an additional instance, which of course is rejected by the \isa{Haskell}
  19.607 +  compiler.
  19.608 +  To suppress this additional instance, use
  19.609 +  \isa{code{\isacharunderscore}instance}:%
  19.610 +\end{isamarkuptext}%
  19.611 +\isamarkuptrue%
  19.612 +%
  19.613 +\isadelimquotett
  19.614 +%
  19.615 +\endisadelimquotett
  19.616 +%
  19.617 +\isatagquotett
  19.618 +\isacommand{code{\isacharunderscore}instance}\isamarkupfalse%
  19.619 +\ bar\ {\isacharcolon}{\isacharcolon}\ eq\isanewline
  19.620 +\ \ {\isacharparenleft}Haskell\ {\isacharminus}{\isacharparenright}%
  19.621 +\endisatagquotett
  19.622 +{\isafoldquotett}%
  19.623 +%
  19.624 +\isadelimquotett
  19.625 +%
  19.626 +\endisadelimquotett
  19.627 +%
  19.628 +\isamarkupsubsection{Enhancing the target language context \label{sec:include}%
  19.629 +}
  19.630 +\isamarkuptrue%
  19.631 +%
  19.632 +\begin{isamarkuptext}%
  19.633 +In rare cases it is necessary to \emph{enrich} the context of a
  19.634 +  target language;  this is accomplished using the \hyperlink{command.code-include}{\mbox{\isa{\isacommand{code{\isacharunderscore}include}}}}
  19.635 +  command:%
  19.636 +\end{isamarkuptext}%
  19.637 +\isamarkuptrue%
  19.638 +%
  19.639 +\isadelimquotett
  19.640 +%
  19.641 +\endisadelimquotett
  19.642 +%
  19.643 +\isatagquotett
  19.644 +\isacommand{code{\isacharunderscore}include}\isamarkupfalse%
  19.645 +\ Haskell\ {\isachardoublequoteopen}Errno{\isachardoublequoteclose}\isanewline
  19.646 +{\isacharverbatimopen}errno\ i\ {\isacharequal}\ error\ {\isacharparenleft}{\isachardoublequote}Error\ number{\isacharcolon}\ {\isachardoublequote}\ {\isacharplus}{\isacharplus}\ show\ i{\isacharparenright}{\isacharverbatimclose}\isanewline
  19.647 +\isanewline
  19.648 +\isacommand{code{\isacharunderscore}reserved}\isamarkupfalse%
  19.649 +\ Haskell\ Errno%
  19.650 +\endisatagquotett
  19.651 +{\isafoldquotett}%
  19.652 +%
  19.653 +\isadelimquotett
  19.654 +%
  19.655 +\endisadelimquotett
  19.656 +%
  19.657 +\begin{isamarkuptext}%
  19.658 +\noindent Such named \isa{include}s are then prepended to every generated code.
  19.659 +  Inspect such code in order to find out how \hyperlink{command.code-include}{\mbox{\isa{\isacommand{code{\isacharunderscore}include}}}} behaves
  19.660 +  with respect to a particular target language.%
  19.661 +\end{isamarkuptext}%
  19.662 +\isamarkuptrue%
  19.663 +%
  19.664 +\isadelimtheory
  19.665 +%
  19.666 +\endisadelimtheory
  19.667 +%
  19.668 +\isatagtheory
  19.669 +\isacommand{end}\isamarkupfalse%
  19.670 +%
  19.671 +\endisatagtheory
  19.672 +{\isafoldtheory}%
  19.673 +%
  19.674 +\isadelimtheory
  19.675 +%
  19.676 +\endisadelimtheory
  19.677 +\isanewline
  19.678 +\end{isabellebody}%
  19.679 +%%% Local Variables:
  19.680 +%%% mode: latex
  19.681 +%%% TeX-master: "root"
  19.682 +%%% End:
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/doc-src/Codegen/Thy/document/Codegen.tex	Tue Mar 03 11:00:51 2009 +0100
    20.3 @@ -0,0 +1,1690 @@
    20.4 +%
    20.5 +\begin{isabellebody}%
    20.6 +\def\isabellecontext{Codegen}%
    20.7 +%
    20.8 +\isadelimtheory
    20.9 +\isanewline
   20.10 +\isanewline
   20.11 +%
   20.12 +\endisadelimtheory
   20.13 +%
   20.14 +\isatagtheory
   20.15 +%
   20.16 +\endisatagtheory
   20.17 +{\isafoldtheory}%
   20.18 +%
   20.19 +\isadelimtheory
   20.20 +%
   20.21 +\endisadelimtheory
   20.22 +%
   20.23 +\isadelimML
   20.24 +%
   20.25 +\endisadelimML
   20.26 +%
   20.27 +\isatagML
   20.28 +%
   20.29 +\endisatagML
   20.30 +{\isafoldML}%
   20.31 +%
   20.32 +\isadelimML
   20.33 +%
   20.34 +\endisadelimML
   20.35 +%
   20.36 +\isamarkupchapter{Code generation from Isabelle theories%
   20.37 +}
   20.38 +\isamarkuptrue%
   20.39 +%
   20.40 +\isamarkupsection{Introduction%
   20.41 +}
   20.42 +\isamarkuptrue%
   20.43 +%
   20.44 +\isamarkupsubsection{Motivation%
   20.45 +}
   20.46 +\isamarkuptrue%
   20.47 +%
   20.48 +\begin{isamarkuptext}%
   20.49 +Executing formal specifications as programs is a well-established
   20.50 +  topic in the theorem proving community.  With increasing
   20.51 +  application of theorem proving systems in the area of
   20.52 +  software development and verification, its relevance manifests
   20.53 +  for running test cases and rapid prototyping.  In logical
   20.54 +  calculi like constructive type theory,
   20.55 +  a notion of executability is implicit due to the nature
   20.56 +  of the calculus.  In contrast, specifications in Isabelle
   20.57 +  can be highly non-executable.  In order to bridge
   20.58 +  the gap between logic and executable specifications,
   20.59 +  an explicit non-trivial transformation has to be applied:
   20.60 +  code generation.
   20.61 +
   20.62 +  This tutorial introduces a generic code generator for the
   20.63 +  Isabelle system \cite{isa-tutorial}.
   20.64 +  Generic in the sense that the
   20.65 +  \qn{target language} for which code shall ultimately be
   20.66 +  generated is not fixed but may be an arbitrary state-of-the-art
   20.67 +  functional programming language (currently, the implementation
   20.68 +  supports SML \cite{SML}, OCaml \cite{OCaml} and Haskell
   20.69 +  \cite{haskell-revised-report}).
   20.70 +  We aim to provide a
   20.71 +  versatile environment
   20.72 +  suitable for software development and verification,
   20.73 +  structuring the process
   20.74 +  of code generation into a small set of orthogonal principles
   20.75 +  while achieving a big coverage of application areas
   20.76 +  with maximum flexibility.
   20.77 +
   20.78 +  Conceptually the code generator framework is part
   20.79 +  of Isabelle's \isa{Pure} meta logic; the object logic
   20.80 +  \isa{HOL} which is an extension of \isa{Pure}
   20.81 +  already comes with a reasonable framework setup and thus provides
   20.82 +  a good working horse for raising code-generation-driven
   20.83 +  applications.  So, we assume some familiarity and experience
   20.84 +  with the ingredients of the \isa{HOL} \emph{Main} theory
   20.85 +  (see also \cite{isa-tutorial}).%
   20.86 +\end{isamarkuptext}%
   20.87 +\isamarkuptrue%
   20.88 +%
   20.89 +\isamarkupsubsection{Overview%
   20.90 +}
   20.91 +\isamarkuptrue%
   20.92 +%
   20.93 +\begin{isamarkuptext}%
   20.94 +The code generator aims to be usable with no further ado
   20.95 +  in most cases while allowing for detailed customization.
   20.96 +  This manifests in the structure of this tutorial:
   20.97 +  we start with a generic example \secref{sec:example}
   20.98 +  and introduce code generation concepts \secref{sec:concept}.
   20.99 +  Section
  20.100 +  \secref{sec:basics} explains how to use the framework naively,
  20.101 +  presuming a reasonable default setup.  Then, section
  20.102 +  \secref{sec:advanced} deals with advanced topics,
  20.103 +  introducing further aspects of the code generator framework
  20.104 +  in a motivation-driven manner.  Last, section \secref{sec:ml}
  20.105 +  introduces the framework's internal programming interfaces.
  20.106 +
  20.107 +  \begin{warn}
  20.108 +    Ultimately, the code generator which this tutorial deals with
  20.109 +    is supposed to replace the already established code generator
  20.110 +    by Stefan Berghofer \cite{Berghofer-Nipkow:2002}.
  20.111 +    So, for the moment, there are two distinct code generators
  20.112 +    in Isabelle.
  20.113 +    Also note that while the framework itself is
  20.114 +    object-logic independent, only \isa{HOL} provides a reasonable
  20.115 +    framework setup.    
  20.116 +  \end{warn}%
  20.117 +\end{isamarkuptext}%
  20.118 +\isamarkuptrue%
  20.119 +%
  20.120 +\isamarkupsection{An example: a simple theory of search trees \label{sec:example}%
  20.121 +}
  20.122 +\isamarkuptrue%
  20.123 +%
  20.124 +\begin{isamarkuptext}%
  20.125 +When writing executable specifications using \isa{HOL},
  20.126 +  it is convenient to use
  20.127 +  three existing packages: the datatype package for defining
  20.128 +  datatypes, the function package for (recursive) functions,
  20.129 +  and the class package for overloaded definitions.
  20.130 +
  20.131 +  We develope a small theory of search trees; trees are represented
  20.132 +  as a datatype with key type \isa{{\isacharprime}a} and value type \isa{{\isacharprime}b}:%
  20.133 +\end{isamarkuptext}%
  20.134 +\isamarkuptrue%
  20.135 +\isacommand{datatype}\isamarkupfalse%
  20.136 +\ {\isacharparenleft}{\isacharprime}a{\isacharcomma}\ {\isacharprime}b{\isacharparenright}\ searchtree\ {\isacharequal}\ Leaf\ {\isachardoublequoteopen}{\isacharprime}a{\isasymColon}linorder{\isachardoublequoteclose}\ {\isacharprime}b\isanewline
  20.137 +\ \ {\isacharbar}\ Branch\ {\isachardoublequoteopen}{\isacharparenleft}{\isacharprime}a{\isacharcomma}\ {\isacharprime}b{\isacharparenright}\ searchtree{\isachardoublequoteclose}\ {\isachardoublequoteopen}{\isacharprime}a{\isachardoublequoteclose}\ {\isachardoublequoteopen}{\isacharparenleft}{\isacharprime}a{\isacharcomma}\ {\isacharprime}b{\isacharparenright}\ searchtree{\isachardoublequoteclose}%
  20.138 +\begin{isamarkuptext}%
  20.139 +\noindent Note that we have constrained the type of keys
  20.140 +  to the class of total orders, \isa{linorder}.
  20.141 +
  20.142 +  We define \isa{find} and \isa{update} functions:%
  20.143 +\end{isamarkuptext}%
  20.144 +\isamarkuptrue%
  20.145 +\isacommand{primrec}\isamarkupfalse%
  20.146 +\isanewline
  20.147 +\ \ find\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharparenleft}{\isacharprime}a{\isasymColon}linorder{\isacharcomma}\ {\isacharprime}b{\isacharparenright}\ searchtree\ {\isasymRightarrow}\ {\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}b\ option{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  20.148 +\ \ {\isachardoublequoteopen}find\ {\isacharparenleft}Leaf\ key\ val{\isacharparenright}\ it\ {\isacharequal}\ {\isacharparenleft}if\ it\ {\isacharequal}\ key\ then\ Some\ val\ else\ None{\isacharparenright}{\isachardoublequoteclose}\isanewline
  20.149 +\ \ {\isacharbar}\ {\isachardoublequoteopen}find\ {\isacharparenleft}Branch\ t{\isadigit{1}}\ key\ t{\isadigit{2}}{\isacharparenright}\ it\ {\isacharequal}\ {\isacharparenleft}if\ it\ {\isasymle}\ key\ then\ find\ t{\isadigit{1}}\ it\ else\ find\ t{\isadigit{2}}\ it{\isacharparenright}{\isachardoublequoteclose}\isanewline
  20.150 +\isanewline
  20.151 +\isacommand{fun}\isamarkupfalse%
  20.152 +\isanewline
  20.153 +\ \ update\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a{\isasymColon}linorder\ {\isasymtimes}\ {\isacharprime}b\ {\isasymRightarrow}\ {\isacharparenleft}{\isacharprime}a{\isacharcomma}\ {\isacharprime}b{\isacharparenright}\ searchtree\ {\isasymRightarrow}\ {\isacharparenleft}{\isacharprime}a{\isacharcomma}\ {\isacharprime}b{\isacharparenright}\ searchtree{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  20.154 +\ \ {\isachardoublequoteopen}update\ {\isacharparenleft}it{\isacharcomma}\ entry{\isacharparenright}\ {\isacharparenleft}Leaf\ key\ val{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}\isanewline
  20.155 +\ \ \ \ if\ it\ {\isacharequal}\ key\ then\ Leaf\ key\ entry\isanewline
  20.156 +\ \ \ \ \ \ else\ if\ it\ {\isasymle}\ key\isanewline
  20.157 +\ \ \ \ \ \ then\ Branch\ {\isacharparenleft}Leaf\ it\ entry{\isacharparenright}\ it\ {\isacharparenleft}Leaf\ key\ val{\isacharparenright}\isanewline
  20.158 +\ \ \ \ \ \ else\ Branch\ {\isacharparenleft}Leaf\ key\ val{\isacharparenright}\ it\ {\isacharparenleft}Leaf\ it\ entry{\isacharparenright}\isanewline
  20.159 +\ \ \ {\isacharparenright}{\isachardoublequoteclose}\isanewline
  20.160 +\ \ {\isacharbar}\ {\isachardoublequoteopen}update\ {\isacharparenleft}it{\isacharcomma}\ entry{\isacharparenright}\ {\isacharparenleft}Branch\ t{\isadigit{1}}\ key\ t{\isadigit{2}}{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}\isanewline
  20.161 +\ \ \ \ if\ it\ {\isasymle}\ key\isanewline
  20.162 +\ \ \ \ \ \ then\ {\isacharparenleft}Branch\ {\isacharparenleft}update\ {\isacharparenleft}it{\isacharcomma}\ entry{\isacharparenright}\ t{\isadigit{1}}{\isacharparenright}\ key\ t{\isadigit{2}}{\isacharparenright}\isanewline
  20.163 +\ \ \ \ \ \ else\ {\isacharparenleft}Branch\ t{\isadigit{1}}\ key\ {\isacharparenleft}update\ {\isacharparenleft}it{\isacharcomma}\ entry{\isacharparenright}\ t{\isadigit{2}}{\isacharparenright}{\isacharparenright}\isanewline
  20.164 +\ \ \ {\isacharparenright}{\isachardoublequoteclose}%
  20.165 +\begin{isamarkuptext}%
  20.166 +\noindent For testing purpose, we define a small example
  20.167 +  using natural numbers \isa{nat} (which are a \isa{linorder})
  20.168 +  as keys and list of nats as values:%
  20.169 +\end{isamarkuptext}%
  20.170 +\isamarkuptrue%
  20.171 +\isacommand{definition}\isamarkupfalse%
  20.172 +\isanewline
  20.173 +\ \ example\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharparenleft}nat{\isacharcomma}\ nat\ list{\isacharparenright}\ searchtree{\isachardoublequoteclose}\isanewline
  20.174 +\isakeyword{where}\isanewline
  20.175 +\ \ {\isachardoublequoteopen}example\ {\isacharequal}\ update\ {\isacharparenleft}Suc\ {\isacharparenleft}Suc\ {\isacharparenleft}Suc\ {\isacharparenleft}Suc\ {\isadigit{0}}{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isacharcomma}\ {\isacharbrackleft}Suc\ {\isacharparenleft}Suc\ {\isadigit{0}}{\isacharparenright}{\isacharcomma}\ Suc\ {\isacharparenleft}Suc\ {\isadigit{0}}{\isacharparenright}{\isacharbrackright}{\isacharparenright}\ {\isacharparenleft}update\ {\isacharparenleft}Suc\ {\isacharparenleft}Suc\ {\isacharparenleft}Suc\ {\isadigit{0}}{\isacharparenright}{\isacharparenright}{\isacharcomma}\ {\isacharbrackleft}Suc\ {\isacharparenleft}Suc\ {\isacharparenleft}Suc\ {\isadigit{0}}{\isacharparenright}{\isacharparenright}{\isacharbrackright}{\isacharparenright}\isanewline
  20.176 +\ \ \ \ {\isacharparenleft}update\ {\isacharparenleft}Suc\ {\isacharparenleft}Suc\ {\isadigit{0}}{\isacharparenright}{\isacharcomma}\ {\isacharbrackleft}Suc\ {\isacharparenleft}Suc\ {\isadigit{0}}{\isacharparenright}{\isacharbrackright}{\isacharparenright}\ {\isacharparenleft}Leaf\ {\isacharparenleft}Suc\ {\isadigit{0}}{\isacharparenright}\ {\isacharbrackleft}{\isacharbrackright}{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}%
  20.177 +\begin{isamarkuptext}%
  20.178 +\noindent Then we generate code%
  20.179 +\end{isamarkuptext}%
  20.180 +\isamarkuptrue%
  20.181 +\isacommand{export{\isacharunderscore}code}\isamarkupfalse%
  20.182 +\ example\ \isakeyword{in}\ SML\ \isakeyword{file}\ {\isachardoublequoteopen}examples{\isacharslash}tree{\isachardot}ML{\isachardoublequoteclose}%
  20.183 +\begin{isamarkuptext}%
  20.184 +\noindent which looks like:
  20.185 +  \lstsml{Thy/examples/tree.ML}%
  20.186 +\end{isamarkuptext}%
  20.187 +\isamarkuptrue%
  20.188 +%
  20.189 +\isamarkupsection{Code generation concepts and process \label{sec:concept}%
  20.190 +}
  20.191 +\isamarkuptrue%
  20.192 +%
  20.193 +\begin{isamarkuptext}%
  20.194 +\begin{figure}[h]
  20.195 +  \centering
  20.196 +  \includegraphics[width=0.7\textwidth]{codegen_process}
  20.197 +  \caption{code generator -- processing overview}
  20.198 +  \label{fig:process}
  20.199 +  \end{figure}
  20.200 +
  20.201 +  The code generator employs a notion of executability
  20.202 +  for three foundational executable ingredients known
  20.203 +  from functional programming:
  20.204 +  \emph{defining equations}, \emph{datatypes}, and
  20.205 +  \emph{type classes}. A defining equation as a first approximation
  20.206 +  is a theorem of the form \isa{f\ t\isactrlisub {\isadigit{1}}\ t\isactrlisub {\isadigit{2}}\ {\isasymdots}\ t\isactrlisub n\ {\isasymequiv}\ t}
  20.207 +  (an equation headed by a constant \isa{f} with arguments
  20.208 +  \isa{t\isactrlisub {\isadigit{1}}\ t\isactrlisub {\isadigit{2}}\ {\isasymdots}\ t\isactrlisub n} and right hand side \isa{t}).
  20.209 +  Code generation aims to turn defining equations
  20.210 +  into a functional program by running through
  20.211 +  a process (see figure \ref{fig:process}):
  20.212 +
  20.213 +  \begin{itemize}
  20.214 +
  20.215 +    \item Out of the vast collection of theorems proven in a
  20.216 +      \qn{theory}, a reasonable subset modeling
  20.217 +      defining equations is \qn{selected}.
  20.218 +
  20.219 +    \item On those selected theorems, certain
  20.220 +      transformations are carried out
  20.221 +      (\qn{preprocessing}).  Their purpose is to turn theorems
  20.222 +      representing non- or badly executable
  20.223 +      specifications into equivalent but executable counterparts.
  20.224 +      The result is a structured collection of \qn{code theorems}.
  20.225 +
  20.226 +    \item These \qn{code theorems} then are \qn{translated}
  20.227 +      into an Haskell-like intermediate
  20.228 +      language.
  20.229 +
  20.230 +    \item Finally, out of the intermediate language the final
  20.231 +      code in the desired \qn{target language} is \qn{serialized}.
  20.232 +
  20.233 +  \end{itemize}
  20.234 +
  20.235 +  From these steps, only the two last are carried out
  20.236 +  outside the logic; by keeping this layer as
  20.237 +  thin as possible, the amount of code to trust is
  20.238 +  kept to a minimum.%
  20.239 +\end{isamarkuptext}%
  20.240 +\isamarkuptrue%
  20.241 +%
  20.242 +\isamarkupsection{Basics \label{sec:basics}%
  20.243 +}
  20.244 +\isamarkuptrue%
  20.245 +%
  20.246 +\isamarkupsubsection{Invoking the code generator%
  20.247 +}
  20.248 +\isamarkuptrue%
  20.249 +%
  20.250 +\begin{isamarkuptext}%
  20.251 +Thanks to a reasonable setup of the \isa{HOL} theories, in
  20.252 +  most cases code generation proceeds without further ado:%
  20.253 +\end{isamarkuptext}%
  20.254 +\isamarkuptrue%
  20.255 +\isacommand{primrec}\isamarkupfalse%
  20.256 +\isanewline
  20.257 +\ \ fac\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ nat{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  20.258 +\ \ \ \ {\isachardoublequoteopen}fac\ {\isadigit{0}}\ {\isacharequal}\ {\isadigit{1}}{\isachardoublequoteclose}\isanewline
  20.259 +\ \ {\isacharbar}\ {\isachardoublequoteopen}fac\ {\isacharparenleft}Suc\ n{\isacharparenright}\ {\isacharequal}\ Suc\ n\ {\isacharasterisk}\ fac\ n{\isachardoublequoteclose}%
  20.260 +\begin{isamarkuptext}%
  20.261 +\noindent This executable specification is now turned to SML code:%
  20.262 +\end{isamarkuptext}%
  20.263 +\isamarkuptrue%
  20.264 +\isacommand{export{\isacharunderscore}code}\isamarkupfalse%
  20.265 +\ fac\ \isakeyword{in}\ SML\ \isakeyword{file}\ {\isachardoublequoteopen}examples{\isacharslash}fac{\isachardot}ML{\isachardoublequoteclose}%
  20.266 +\begin{isamarkuptext}%
  20.267 +\noindent  The \isa{{\isasymEXPORTCODE}} command takes a space-separated list of
  20.268 +  constants together with \qn{serialization directives}
  20.269 +  These start with a \qn{target language}
  20.270 +  identifier, followed by a file specification
  20.271 +  where to write the generated code to.
  20.272 +
  20.273 +  Internally, the defining equations for all selected
  20.274 +  constants are taken, including any transitively required
  20.275 +  constants, datatypes and classes, resulting in the following
  20.276 +  code:
  20.277 +
  20.278 +  \lstsml{Thy/examples/fac.ML}
  20.279 +
  20.280 +  The code generator will complain when a required
  20.281 +  ingredient does not provide a executable counterpart,
  20.282 +  e.g.~generating code
  20.283 +  for constants not yielding
  20.284 +  a defining equation (e.g.~the Hilbert choice
  20.285 +  operation \isa{SOME}):%
  20.286 +\end{isamarkuptext}%
  20.287 +\isamarkuptrue%
  20.288 +%
  20.289 +\isadelimML
  20.290 +%
  20.291 +\endisadelimML
  20.292 +%
  20.293 +\isatagML
  20.294 +%
  20.295 +\endisatagML
  20.296 +{\isafoldML}%
  20.297 +%
  20.298 +\isadelimML
  20.299 +%
  20.300 +\endisadelimML
  20.301 +\isacommand{definition}\isamarkupfalse%
  20.302 +\isanewline
  20.303 +\ \ pick{\isacharunderscore}some\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a\ list\ {\isasymRightarrow}\ {\isacharprime}a{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  20.304 +\ \ {\isachardoublequoteopen}pick{\isacharunderscore}some\ xs\ {\isacharequal}\ {\isacharparenleft}SOME\ x{\isachardot}\ x\ {\isasymin}\ set\ xs{\isacharparenright}{\isachardoublequoteclose}%
  20.305 +\isadelimML
  20.306 +%
  20.307 +\endisadelimML
  20.308 +%
  20.309 +\isatagML
  20.310 +%
  20.311 +\endisatagML
  20.312 +{\isafoldML}%
  20.313 +%
  20.314 +\isadelimML
  20.315 +%
  20.316 +\endisadelimML
  20.317 +\isanewline
  20.318 +\isacommand{export{\isacharunderscore}code}\isamarkupfalse%
  20.319 +\ pick{\isacharunderscore}some\ \isakeyword{in}\ SML\ \isakeyword{file}\ {\isachardoublequoteopen}examples{\isacharslash}fail{\isacharunderscore}const{\isachardot}ML{\isachardoublequoteclose}%
  20.320 +\begin{isamarkuptext}%
  20.321 +\noindent will fail.%
  20.322 +\end{isamarkuptext}%
  20.323 +\isamarkuptrue%
  20.324 +%
  20.325 +\isamarkupsubsection{Theorem selection%
  20.326 +}
  20.327 +\isamarkuptrue%
  20.328 +%
  20.329 +\begin{isamarkuptext}%
  20.330 +The list of all defining equations in a theory may be inspected
  20.331 +  using the \isa{{\isasymPRINTCODESETUP}} command:%
  20.332 +\end{isamarkuptext}%
  20.333 +\isamarkuptrue%
  20.334 +\isacommand{print{\isacharunderscore}codesetup}\isamarkupfalse%
  20.335 +%
  20.336 +\begin{isamarkuptext}%
  20.337 +\noindent which displays a table of constant with corresponding
  20.338 +  defining equations (the additional stuff displayed
  20.339 +  shall not bother us for the moment).
  20.340 +
  20.341 +  The typical \isa{HOL} tools are already set up in a way that
  20.342 +  function definitions introduced by \isa{{\isasymDEFINITION}},
  20.343 +  \isa{{\isasymPRIMREC}}, \isa{{\isasymFUN}},
  20.344 +  \isa{{\isasymFUNCTION}}, \isa{{\isasymCONSTDEFS}},
  20.345 +  \isa{{\isasymRECDEF}} are implicitly propagated
  20.346 +  to this defining equation table. Specific theorems may be
  20.347 +  selected using an attribute: \emph{code func}. As example,
  20.348 +  a weight selector function:%
  20.349 +\end{isamarkuptext}%
  20.350 +\isamarkuptrue%
  20.351 +\isacommand{primrec}\isamarkupfalse%
  20.352 +\isanewline
  20.353 +\ \ pick\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharparenleft}nat\ {\isasymtimes}\ {\isacharprime}a{\isacharparenright}\ list\ {\isasymRightarrow}\ nat\ {\isasymRightarrow}\ {\isacharprime}a{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  20.354 +\ \ {\isachardoublequoteopen}pick\ {\isacharparenleft}x{\isacharhash}xs{\isacharparenright}\ n\ {\isacharequal}\ {\isacharparenleft}let\ {\isacharparenleft}k{\isacharcomma}\ v{\isacharparenright}\ {\isacharequal}\ x\ in\isanewline
  20.355 +\ \ \ \ if\ n\ {\isacharless}\ k\ then\ v\ else\ pick\ xs\ {\isacharparenleft}n\ {\isacharminus}\ k{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}%
  20.356 +\begin{isamarkuptext}%
  20.357 +\noindent We want to eliminate the explicit destruction
  20.358 +  of \isa{x} to \isa{{\isacharparenleft}k{\isacharcomma}\ v{\isacharparenright}}:%
  20.359 +\end{isamarkuptext}%
  20.360 +\isamarkuptrue%
  20.361 +\isacommand{lemma}\isamarkupfalse%
  20.362 +\ {\isacharbrackleft}code\ func{\isacharbrackright}{\isacharcolon}\isanewline
  20.363 +\ \ {\isachardoublequoteopen}pick\ {\isacharparenleft}{\isacharparenleft}k{\isacharcomma}\ v{\isacharparenright}{\isacharhash}xs{\isacharparenright}\ n\ {\isacharequal}\ {\isacharparenleft}if\ n\ {\isacharless}\ k\ then\ v\ else\ pick\ xs\ {\isacharparenleft}n\ {\isacharminus}\ k{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}\isanewline
  20.364 +%
  20.365 +\isadelimproof
  20.366 +\ \ %
  20.367 +\endisadelimproof
  20.368 +%
  20.369 +\isatagproof
  20.370 +\isacommand{by}\isamarkupfalse%
  20.371 +\ simp%
  20.372 +\endisatagproof
  20.373 +{\isafoldproof}%
  20.374 +%
  20.375 +\isadelimproof
  20.376 +\isanewline
  20.377 +%
  20.378 +\endisadelimproof
  20.379 +\isanewline
  20.380 +\isacommand{export{\isacharunderscore}code}\isamarkupfalse%
  20.381 +\ pick\ \ \isakeyword{in}\ SML\ \isakeyword{file}\ {\isachardoublequoteopen}examples{\isacharslash}pick{\isadigit{1}}{\isachardot}ML{\isachardoublequoteclose}%
  20.382 +\begin{isamarkuptext}%
  20.383 +\noindent This theorem now is used for generating code:
  20.384 +
  20.385 +  \lstsml{Thy/examples/pick1.ML}
  20.386 +
  20.387 +  \noindent The policy is that \emph{default equations} stemming from
  20.388 +  \isa{{\isasymDEFINITION}},
  20.389 +  \isa{{\isasymPRIMREC}}, \isa{{\isasymFUN}},
  20.390 +  \isa{{\isasymFUNCTION}}, \isa{{\isasymCONSTDEFS}},
  20.391 +  \isa{{\isasymRECDEF}} statements are discarded as soon as an
  20.392 +  equation is explicitly selected by means of \emph{code func}.
  20.393 +  Further applications of \emph{code func} add theorems incrementally,
  20.394 +  but syntactic redundancies are implicitly dropped.  For example,
  20.395 +  using a modified version of the \isa{fac} function
  20.396 +  as defining equation, the then redundant (since
  20.397 +  syntactically subsumed) original defining equations
  20.398 +  are dropped.
  20.399 +
  20.400 +  \begin{warn}
  20.401 +    The attributes \emph{code} and \emph{code del}
  20.402 +    associated with the existing code generator also apply to
  20.403 +    the new one: \emph{code} implies \emph{code func},
  20.404 +    and \emph{code del} implies \emph{code func del}.
  20.405 +  \end{warn}%
  20.406 +\end{isamarkuptext}%
  20.407 +\isamarkuptrue%
  20.408 +%
  20.409 +\isamarkupsubsection{Type classes%
  20.410 +}
  20.411 +\isamarkuptrue%
  20.412 +%
  20.413 +\begin{isamarkuptext}%
  20.414 +Type classes enter the game via the Isar class package.
  20.415 +  For a short introduction how to use it, see \cite{isabelle-classes};
  20.416 +  here we just illustrate its impact on code generation.
  20.417 +
  20.418 +  In a target language, type classes may be represented
  20.419 +  natively (as in the case of Haskell).  For languages
  20.420 +  like SML, they are implemented using \emph{dictionaries}.
  20.421 +  Our following example specifies a class \qt{null},
  20.422 +  assigning to each of its inhabitants a \qt{null} value:%
  20.423 +\end{isamarkuptext}%
  20.424 +\isamarkuptrue%
  20.425 +\isacommand{class}\isamarkupfalse%
  20.426 +\ null\ {\isacharequal}\ type\ {\isacharplus}\isanewline
  20.427 +\ \ \isakeyword{fixes}\ null\ {\isacharcolon}{\isacharcolon}\ {\isacharprime}a\isanewline
  20.428 +\isanewline
  20.429 +\isacommand{primrec}\isamarkupfalse%
  20.430 +\isanewline
  20.431 +\ \ head\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a{\isasymColon}null\ list\ {\isasymRightarrow}\ {\isacharprime}a{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  20.432 +\ \ {\isachardoublequoteopen}head\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharequal}\ null{\isachardoublequoteclose}\isanewline
  20.433 +\ \ {\isacharbar}\ {\isachardoublequoteopen}head\ {\isacharparenleft}x{\isacharhash}xs{\isacharparenright}\ {\isacharequal}\ x{\isachardoublequoteclose}%
  20.434 +\begin{isamarkuptext}%
  20.435 +\noindent  We provide some instances for our \isa{null}:%
  20.436 +\end{isamarkuptext}%
  20.437 +\isamarkuptrue%
  20.438 +\isacommand{instantiation}\isamarkupfalse%
  20.439 +\ option\ \isakeyword{and}\ list\ {\isacharcolon}{\isacharcolon}\ {\isacharparenleft}type{\isacharparenright}\ null\isanewline
  20.440 +\isakeyword{begin}\isanewline
  20.441 +\isanewline
  20.442 +\isacommand{definition}\isamarkupfalse%
  20.443 +\isanewline
  20.444 +\ \ {\isachardoublequoteopen}null\ {\isacharequal}\ None{\isachardoublequoteclose}\isanewline
  20.445 +\isanewline
  20.446 +\isacommand{definition}\isamarkupfalse%
  20.447 +\isanewline
  20.448 +\ \ {\isachardoublequoteopen}null\ {\isacharequal}\ {\isacharbrackleft}{\isacharbrackright}{\isachardoublequoteclose}\isanewline
  20.449 +\isanewline
  20.450 +\isacommand{instance}\isamarkupfalse%
  20.451 +%
  20.452 +\isadelimproof
  20.453 +\ %
  20.454 +\endisadelimproof
  20.455 +%
  20.456 +\isatagproof
  20.457 +\isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
  20.458 +%
  20.459 +\endisatagproof
  20.460 +{\isafoldproof}%
  20.461 +%
  20.462 +\isadelimproof
  20.463 +%
  20.464 +\endisadelimproof
  20.465 +\isanewline
  20.466 +\isanewline
  20.467 +\isacommand{end}\isamarkupfalse%
  20.468 +%
  20.469 +\begin{isamarkuptext}%
  20.470 +\noindent Constructing a dummy example:%
  20.471 +\end{isamarkuptext}%
  20.472 +\isamarkuptrue%
  20.473 +\isacommand{definition}\isamarkupfalse%
  20.474 +\isanewline
  20.475 +\ \ {\isachardoublequoteopen}dummy\ {\isacharequal}\ head\ {\isacharbrackleft}Some\ {\isacharparenleft}Suc\ {\isadigit{0}}{\isacharparenright}{\isacharcomma}\ None{\isacharbrackright}{\isachardoublequoteclose}%
  20.476 +\begin{isamarkuptext}%
  20.477 +Type classes offer a suitable occasion to introduce
  20.478 +  the Haskell serializer.  Its usage is almost the same
  20.479 +  as SML, but, in accordance with conventions
  20.480 +  some Haskell systems enforce, each module ends
  20.481 +  up in a single file. The module hierarchy is reflected in
  20.482 +  the file system, with root directory given as file specification.%
  20.483 +\end{isamarkuptext}%
  20.484 +\isamarkuptrue%
  20.485 +\isacommand{export{\isacharunderscore}code}\isamarkupfalse%
  20.486 +\ dummy\ \isakeyword{in}\ Haskell\ \isakeyword{file}\ {\isachardoublequoteopen}examples{\isacharslash}{\isachardoublequoteclose}%
  20.487 +\begin{isamarkuptext}%
  20.488 +\lsthaskell{Thy/examples/Codegen.hs}
  20.489 +  \noindent (we have left out all other modules).
  20.490 +
  20.491 +  \medskip
  20.492 +
  20.493 +  The whole code in SML with explicit dictionary passing:%
  20.494 +\end{isamarkuptext}%
  20.495 +\isamarkuptrue%
  20.496 +\isacommand{export{\isacharunderscore}code}\isamarkupfalse%
  20.497 +\ dummy\ \isakeyword{in}\ SML\ \isakeyword{file}\ {\isachardoublequoteopen}examples{\isacharslash}class{\isachardot}ML{\isachardoublequoteclose}%
  20.498 +\begin{isamarkuptext}%
  20.499 +\lstsml{Thy/examples/class.ML}
  20.500 +
  20.501 +  \medskip
  20.502 +
  20.503 +  \noindent or in OCaml:%
  20.504 +\end{isamarkuptext}%
  20.505 +\isamarkuptrue%
  20.506 +\isacommand{export{\isacharunderscore}code}\isamarkupfalse%
  20.507 +\ dummy\ \isakeyword{in}\ OCaml\ \isakeyword{file}\ {\isachardoublequoteopen}examples{\isacharslash}class{\isachardot}ocaml{\isachardoublequoteclose}%
  20.508 +\begin{isamarkuptext}%
  20.509 +\lstsml{Thy/examples/class.ocaml}
  20.510 +
  20.511 +  \medskip The explicit association of constants
  20.512 +  to classes can be inspected using the \isa{{\isasymPRINTCLASSES}}
  20.513 +  command.%
  20.514 +\end{isamarkuptext}%
  20.515 +\isamarkuptrue%
  20.516 +%
  20.517 +\isamarkupsection{Recipes and advanced topics \label{sec:advanced}%
  20.518 +}
  20.519 +\isamarkuptrue%
  20.520 +%
  20.521 +\begin{isamarkuptext}%
  20.522 +In this tutorial, we do not attempt to give an exhaustive
  20.523 +  description of the code generator framework; instead,
  20.524 +  we cast a light on advanced topics by introducing
  20.525 +  them together with practically motivated examples.  Concerning
  20.526 +  further reading, see
  20.527 +
  20.528 +  \begin{itemize}
  20.529 +
  20.530 +  \item the Isabelle/Isar Reference Manual \cite{isabelle-isar-ref}
  20.531 +    for exhaustive syntax diagrams.
  20.532 +  \item or \cite{Haftmann-Nipkow:2007:codegen} which deals with foundational issues
  20.533 +    of the code generator framework.
  20.534 +
  20.535 +  \end{itemize}%
  20.536 +\end{isamarkuptext}%
  20.537 +\isamarkuptrue%
  20.538 +%
  20.539 +\isamarkupsubsection{Library theories \label{sec:library}%
  20.540 +}
  20.541 +\isamarkuptrue%
  20.542 +%
  20.543 +\begin{isamarkuptext}%
  20.544 +The \isa{HOL} \isa{Main} theory already provides a code
  20.545 +  generator setup
  20.546 +  which should be suitable for most applications. Common extensions
  20.547 +  and modifications are available by certain theories of the \isa{HOL}
  20.548 +  library; beside being useful in applications, they may serve
  20.549 +  as a tutorial for customizing the code generator setup.
  20.550 +
  20.551 +  \begin{description}
  20.552 +
  20.553 +    \item[\isa{Code{\isacharunderscore}Integer}] represents \isa{HOL} integers by big
  20.554 +       integer literals in target languages.
  20.555 +    \item[\isa{Code{\isacharunderscore}Char}] represents \isa{HOL} characters by 
  20.556 +       character literals in target languages.
  20.557 +    \item[\isa{Code{\isacharunderscore}Char{\isacharunderscore}chr}] like \isa{Code{\isacharunderscore}Char},
  20.558 +       but also offers treatment of character codes; includes
  20.559 +       \isa{Code{\isacharunderscore}Integer}.
  20.560 +    \item[\isa{Efficient{\isacharunderscore}Nat}] \label{eff_nat} implements natural numbers by integers,
  20.561 +       which in general will result in higher efficency; pattern
  20.562 +       matching with \isa{{\isadigit{0}}} / \isa{Suc}
  20.563 +       is eliminated;  includes \isa{Code{\isacharunderscore}Integer}.
  20.564 +    \item[\isa{Code{\isacharunderscore}Index}] provides an additional datatype
  20.565 +       \isa{index} which is mapped to target-language built-in integers.
  20.566 +       Useful for code setups which involve e.g. indexing of
  20.567 +       target-language arrays.
  20.568 +    \item[\isa{Code{\isacharunderscore}Message}] provides an additional datatype
  20.569 +       \isa{message{\isacharunderscore}string} which is isomorphic to strings;
  20.570 +       \isa{message{\isacharunderscore}string}s are mapped to target-language strings.
  20.571 +       Useful for code setups which involve e.g. printing (error) messages.
  20.572 +
  20.573 +  \end{description}
  20.574 +
  20.575 +  \begin{warn}
  20.576 +    When importing any of these theories, they should form the last
  20.577 +    items in an import list.  Since these theories adapt the
  20.578 +    code generator setup in a non-conservative fashion,
  20.579 +    strange effects may occur otherwise.
  20.580 +  \end{warn}%
  20.581 +\end{isamarkuptext}%
  20.582 +\isamarkuptrue%
  20.583 +%
  20.584 +\isamarkupsubsection{Preprocessing%
  20.585 +}
  20.586 +\isamarkuptrue%
  20.587 +%
  20.588 +\begin{isamarkuptext}%
  20.589 +Before selected function theorems are turned into abstract
  20.590 +  code, a chain of definitional transformation steps is carried
  20.591 +  out: \emph{preprocessing}.  In essence, the preprocessor
  20.592 +  consists of two components: a \emph{simpset} and \emph{function transformers}.
  20.593 +
  20.594 +  The \emph{simpset} allows to employ the full generality of the Isabelle
  20.595 +  simplifier.  Due to the interpretation of theorems
  20.596 +  as defining equations, rewrites are applied to the right
  20.597 +  hand side and the arguments of the left hand side of an
  20.598 +  equation, but never to the constant heading the left hand side.
  20.599 +  An important special case are \emph{inline theorems} which may be
  20.600 +  declared an undeclared using the
  20.601 +  \emph{code inline} or \emph{code inline del} attribute respectively.
  20.602 +  Some common applications:%
  20.603 +\end{isamarkuptext}%
  20.604 +\isamarkuptrue%
  20.605 +%
  20.606 +\begin{itemize}
  20.607 +%
  20.608 +\begin{isamarkuptext}%
  20.609 +\item replacing non-executable constructs by executable ones:%
  20.610 +\end{isamarkuptext}%
  20.611 +\isamarkuptrue%
  20.612 +\ \ \isacommand{lemma}\isamarkupfalse%
  20.613 +\ {\isacharbrackleft}code\ inline{\isacharbrackright}{\isacharcolon}\isanewline
  20.614 +\ \ \ \ {\isachardoublequoteopen}x\ {\isasymin}\ set\ xs\ {\isasymlongleftrightarrow}\ x\ mem\ xs{\isachardoublequoteclose}%
  20.615 +\isadelimproof
  20.616 +\ %
  20.617 +\endisadelimproof
  20.618 +%
  20.619 +\isatagproof
  20.620 +\isacommand{by}\isamarkupfalse%
  20.621 +\ {\isacharparenleft}induct\ xs{\isacharparenright}\ simp{\isacharunderscore}all%
  20.622 +\endisatagproof
  20.623 +{\isafoldproof}%
  20.624 +%
  20.625 +\isadelimproof
  20.626 +%
  20.627 +\endisadelimproof
  20.628 +%
  20.629 +\begin{isamarkuptext}%
  20.630 +\item eliminating superfluous constants:%
  20.631 +\end{isamarkuptext}%
  20.632 +\isamarkuptrue%
  20.633 +\ \ \isacommand{lemma}\isamarkupfalse%
  20.634 +\ {\isacharbrackleft}code\ inline{\isacharbrackright}{\isacharcolon}\isanewline
  20.635 +\ \ \ \ {\isachardoublequoteopen}{\isadigit{1}}\ {\isacharequal}\ Suc\ {\isadigit{0}}{\isachardoublequoteclose}%
  20.636 +\isadelimproof
  20.637 +\ %
  20.638 +\endisadelimproof
  20.639 +%
  20.640 +\isatagproof
  20.641 +\isacommand{by}\isamarkupfalse%
  20.642 +\ simp%
  20.643 +\endisatagproof
  20.644 +{\isafoldproof}%
  20.645 +%
  20.646 +\isadelimproof
  20.647 +%
  20.648 +\endisadelimproof
  20.649 +%
  20.650 +\begin{isamarkuptext}%
  20.651 +\item replacing executable but inconvenient constructs:%
  20.652 +\end{isamarkuptext}%
  20.653 +\isamarkuptrue%
  20.654 +\ \ \isacommand{lemma}\isamarkupfalse%
  20.655 +\ {\isacharbrackleft}code\ inline{\isacharbrackright}{\isacharcolon}\isanewline
  20.656 +\ \ \ \ {\isachardoublequoteopen}xs\ {\isacharequal}\ {\isacharbrackleft}{\isacharbrackright}\ {\isasymlongleftrightarrow}\ List{\isachardot}null\ xs{\isachardoublequoteclose}%
  20.657 +\isadelimproof
  20.658 +\ %
  20.659 +\endisadelimproof
  20.660 +%
  20.661 +\isatagproof
  20.662 +\isacommand{by}\isamarkupfalse%
  20.663 +\ {\isacharparenleft}induct\ xs{\isacharparenright}\ simp{\isacharunderscore}all%
  20.664 +\endisatagproof
  20.665 +{\isafoldproof}%
  20.666 +%
  20.667 +\isadelimproof
  20.668 +%
  20.669 +\endisadelimproof
  20.670 +%
  20.671 +\end{itemize}
  20.672 +%
  20.673 +\begin{isamarkuptext}%
  20.674 +\emph{Function transformers} provide a very general interface,
  20.675 +  transforming a list of function theorems to another
  20.676 +  list of function theorems, provided that neither the heading
  20.677 +  constant nor its type change.  The \isa{{\isadigit{0}}} / \isa{Suc}
  20.678 +  pattern elimination implemented in
  20.679 +  theory \isa{Efficient{\isacharunderscore}Nat} (see \secref{eff_nat}) uses this
  20.680 +  interface.
  20.681 +
  20.682 +  \noindent The current setup of the preprocessor may be inspected using
  20.683 +  the \isa{{\isasymPRINTCODESETUP}} command.
  20.684 +
  20.685 +  \begin{warn}
  20.686 +    The attribute \emph{code unfold}
  20.687 +    associated with the existing code generator also applies to
  20.688 +    the new one: \emph{code unfold} implies \emph{code inline}.
  20.689 +  \end{warn}%
  20.690 +\end{isamarkuptext}%
  20.691 +\isamarkuptrue%
  20.692 +%
  20.693 +\isamarkupsubsection{Concerning operational equality%
  20.694 +}
  20.695 +\isamarkuptrue%
  20.696 +%
  20.697 +\begin{isamarkuptext}%
  20.698 +Surely you have already noticed how equality is treated
  20.699 +  by the code generator:%
  20.700 +\end{isamarkuptext}%
  20.701 +\isamarkuptrue%
  20.702 +\isacommand{primrec}\isamarkupfalse%
  20.703 +\isanewline
  20.704 +\ \ collect{\isacharunderscore}duplicates\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a\ list\ {\isasymRightarrow}\ {\isacharprime}a\ list\ {\isasymRightarrow}\ {\isacharprime}a\ list\ {\isasymRightarrow}\ {\isacharprime}a\ list{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  20.705 +\ \ \ \ {\isachardoublequoteopen}collect{\isacharunderscore}duplicates\ xs\ ys\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharequal}\ xs{\isachardoublequoteclose}\isanewline
  20.706 +\ \ {\isacharbar}\ {\isachardoublequoteopen}collect{\isacharunderscore}duplicates\ xs\ ys\ {\isacharparenleft}z{\isacharhash}zs{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}if\ z\ {\isasymin}\ set\ xs\isanewline
  20.707 +\ \ \ \ \ \ then\ if\ z\ {\isasymin}\ set\ ys\isanewline
  20.708 +\ \ \ \ \ \ \ \ then\ collect{\isacharunderscore}duplicates\ xs\ ys\ zs\isanewline
  20.709 +\ \ \ \ \ \ \ \ else\ collect{\isacharunderscore}duplicates\ xs\ {\isacharparenleft}z{\isacharhash}ys{\isacharparenright}\ zs\isanewline
  20.710 +\ \ \ \ \ \ else\ collect{\isacharunderscore}duplicates\ {\isacharparenleft}z{\isacharhash}xs{\isacharparenright}\ {\isacharparenleft}z{\isacharhash}ys{\isacharparenright}\ zs{\isacharparenright}{\isachardoublequoteclose}%
  20.711 +\begin{isamarkuptext}%
  20.712 +The membership test during preprocessing is rewritten,
  20.713 +  resulting in \isa{op\ mem}, which itself
  20.714 +  performs an explicit equality check.%
  20.715 +\end{isamarkuptext}%
  20.716 +\isamarkuptrue%
  20.717 +\isacommand{export{\isacharunderscore}code}\isamarkupfalse%
  20.718 +\ collect{\isacharunderscore}duplicates\ \isakeyword{in}\ SML\ \isakeyword{file}\ {\isachardoublequoteopen}examples{\isacharslash}collect{\isacharunderscore}duplicates{\isachardot}ML{\isachardoublequoteclose}%
  20.719 +\begin{isamarkuptext}%
  20.720 +\lstsml{Thy/examples/collect_duplicates.ML}%
  20.721 +\end{isamarkuptext}%
  20.722 +\isamarkuptrue%
  20.723 +%
  20.724 +\begin{isamarkuptext}%
  20.725 +Obviously, polymorphic equality is implemented the Haskell
  20.726 +  way using a type class.  How is this achieved?  HOL introduces
  20.727 +  an explicit class \isa{eq} with a corresponding operation
  20.728 +  \isa{eq{\isacharunderscore}class{\isachardot}eq} such that \isa{eq{\isacharunderscore}class{\isachardot}eq\ x\ y\ {\isacharequal}\ {\isacharparenleft}x\ {\isacharequal}\ y{\isacharparenright}}.
  20.729 +  The preprocessing framework does the rest.
  20.730 +  For datatypes, instances of \isa{eq} are implicitly derived
  20.731 +  when possible.  For other types, you may instantiate \isa{eq}
  20.732 +  manually like any other type class.
  20.733 +
  20.734 +  Though this \isa{eq} class is designed to get rarely in
  20.735 +  the way, a subtlety
  20.736 +  enters the stage when definitions of overloaded constants
  20.737 +  are dependent on operational equality.  For example, let
  20.738 +  us define a lexicographic ordering on tuples:%
  20.739 +\end{isamarkuptext}%
  20.740 +\isamarkuptrue%
  20.741 +\isacommand{instantiation}\isamarkupfalse%
  20.742 +\ {\isacharasterisk}\ {\isacharcolon}{\isacharcolon}\ {\isacharparenleft}ord{\isacharcomma}\ ord{\isacharparenright}\ ord\isanewline
  20.743 +\isakeyword{begin}\isanewline
  20.744 +\isanewline
  20.745 +\isacommand{definition}\isamarkupfalse%
  20.746 +\isanewline
  20.747 +\ \ {\isacharbrackleft}code\ func\ del{\isacharbrackright}{\isacharcolon}\ {\isachardoublequoteopen}p{\isadigit{1}}\ {\isacharless}\ p{\isadigit{2}}\ {\isasymlongleftrightarrow}\ {\isacharparenleft}let\ {\isacharparenleft}x{\isadigit{1}}{\isacharcomma}\ y{\isadigit{1}}{\isacharparenright}\ {\isacharequal}\ p{\isadigit{1}}{\isacharsemicolon}\ {\isacharparenleft}x{\isadigit{2}}{\isacharcomma}\ y{\isadigit{2}}{\isacharparenright}\ {\isacharequal}\ p{\isadigit{2}}\ in\isanewline
  20.748 +\ \ \ \ x{\isadigit{1}}\ {\isacharless}\ x{\isadigit{2}}\ {\isasymor}\ {\isacharparenleft}x{\isadigit{1}}\ {\isacharequal}\ x{\isadigit{2}}\ {\isasymand}\ y{\isadigit{1}}\ {\isacharless}\ y{\isadigit{2}}{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}\isanewline
  20.749 +\isanewline
  20.750 +\isacommand{definition}\isamarkupfalse%
  20.751 +\isanewline
  20.752 +\ \ {\isacharbrackleft}code\ func\ del{\isacharbrackright}{\isacharcolon}\ {\isachardoublequoteopen}p{\isadigit{1}}\ {\isasymle}\ p{\isadigit{2}}\ {\isasymlongleftrightarrow}\ {\isacharparenleft}let\ {\isacharparenleft}x{\isadigit{1}}{\isacharcomma}\ y{\isadigit{1}}{\isacharparenright}\ {\isacharequal}\ p{\isadigit{1}}{\isacharsemicolon}\ {\isacharparenleft}x{\isadigit{2}}{\isacharcomma}\ y{\isadigit{2}}{\isacharparenright}\ {\isacharequal}\ p{\isadigit{2}}\ in\isanewline
  20.753 +\ \ \ \ x{\isadigit{1}}\ {\isacharless}\ x{\isadigit{2}}\ {\isasymor}\ {\isacharparenleft}x{\isadigit{1}}\ {\isacharequal}\ x{\isadigit{2}}\ {\isasymand}\ y{\isadigit{1}}\ {\isasymle}\ y{\isadigit{2}}{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}\isanewline
  20.754 +\isanewline
  20.755 +\isacommand{instance}\isamarkupfalse%
  20.756 +%
  20.757 +\isadelimproof
  20.758 +\ %
  20.759 +\endisadelimproof
  20.760 +%
  20.761 +\isatagproof
  20.762 +\isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
  20.763 +%
  20.764 +\endisatagproof
  20.765 +{\isafoldproof}%
  20.766 +%
  20.767 +\isadelimproof
  20.768 +%
  20.769 +\endisadelimproof
  20.770 +\isanewline
  20.771 +\isanewline
  20.772 +\isacommand{end}\isamarkupfalse%
  20.773 +\isanewline
  20.774 +\isanewline
  20.775 +\isacommand{lemma}\isamarkupfalse%
  20.776 +\ ord{\isacharunderscore}prod\ {\isacharbrackleft}code\ func{\isacharbrackright}{\isacharcolon}\isanewline
  20.777 +\ \ {\isachardoublequoteopen}{\isacharparenleft}x{\isadigit{1}}\ {\isasymColon}\ {\isacharprime}a{\isasymColon}ord{\isacharcomma}\ y{\isadigit{1}}\ {\isasymColon}\ {\isacharprime}b{\isasymColon}ord{\isacharparenright}\ {\isacharless}\ {\isacharparenleft}x{\isadigit{2}}{\isacharcomma}\ y{\isadigit{2}}{\isacharparenright}\ {\isasymlongleftrightarrow}\ x{\isadigit{1}}\ {\isacharless}\ x{\isadigit{2}}\ {\isasymor}\ {\isacharparenleft}x{\isadigit{1}}\ {\isacharequal}\ x{\isadigit{2}}\ {\isasymand}\ y{\isadigit{1}}\ {\isacharless}\ y{\isadigit{2}}{\isacharparenright}{\isachardoublequoteclose}\isanewline
  20.778 +\ \ {\isachardoublequoteopen}{\isacharparenleft}x{\isadigit{1}}\ {\isasymColon}\ {\isacharprime}a{\isasymColon}ord{\isacharcomma}\ y{\isadigit{1}}\ {\isasymColon}\ {\isacharprime}b{\isasymColon}ord{\isacharparenright}\ {\isasymle}\ {\isacharparenleft}x{\isadigit{2}}{\isacharcomma}\ y{\isadigit{2}}{\isacharparenright}\ {\isasymlongleftrightarrow}\ x{\isadigit{1}}\ {\isacharless}\ x{\isadigit{2}}\ {\isasymor}\ {\isacharparenleft}x{\isadigit{1}}\ {\isacharequal}\ x{\isadigit{2}}\ {\isasymand}\ y{\isadigit{1}}\ {\isasymle}\ y{\isadigit{2}}{\isacharparenright}{\isachardoublequoteclose}\isanewline
  20.779 +%
  20.780 +\isadelimproof
  20.781 +\ \ %
  20.782 +\endisadelimproof
  20.783 +%
  20.784 +\isatagproof
  20.785 +\isacommand{unfolding}\isamarkupfalse%
  20.786 +\ less{\isacharunderscore}prod{\isacharunderscore}def\ less{\isacharunderscore}eq{\isacharunderscore}prod{\isacharunderscore}def\ \isacommand{by}\isamarkupfalse%
  20.787 +\ simp{\isacharunderscore}all%
  20.788 +\endisatagproof
  20.789 +{\isafoldproof}%
  20.790 +%
  20.791 +\isadelimproof
  20.792 +%
  20.793 +\endisadelimproof
  20.794 +%
  20.795 +\begin{isamarkuptext}%
  20.796 +Then code generation will fail.  Why?  The definition
  20.797 +  of \isa{op\ {\isasymle}} depends on equality on both arguments,
  20.798 +  which are polymorphic and impose an additional \isa{eq}
  20.799 +  class constraint, thus violating the type discipline
  20.800 +  for class operations.
  20.801 +
  20.802 +  The solution is to add \isa{eq} explicitly to the first sort arguments in the
  20.803 +  code theorems:%
  20.804 +\end{isamarkuptext}%
  20.805 +\isamarkuptrue%
  20.806 +\isacommand{lemma}\isamarkupfalse%
  20.807 +\ ord{\isacharunderscore}prod{\isacharunderscore}code\ {\isacharbrackleft}code\ func{\isacharbrackright}{\isacharcolon}\isanewline
  20.808 +\ \ {\isachardoublequoteopen}{\isacharparenleft}x{\isadigit{1}}\ {\isasymColon}\ {\isacharprime}a{\isasymColon}{\isacharbraceleft}ord{\isacharcomma}\ eq{\isacharbraceright}{\isacharcomma}\ y{\isadigit{1}}\ {\isasymColon}\ {\isacharprime}b{\isasymColon}ord{\isacharparenright}\ {\isacharless}\ {\isacharparenleft}x{\isadigit{2}}{\isacharcomma}\ y{\isadigit{2}}{\isacharparenright}\ {\isasymlongleftrightarrow}\isanewline
  20.809 +\ \ \ \ x{\isadigit{1}}\ {\isacharless}\ x{\isadigit{2}}\ {\isasymor}\ {\isacharparenleft}x{\isadigit{1}}\ {\isacharequal}\ x{\isadigit{2}}\ {\isasymand}\ y{\isadigit{1}}\ {\isacharless}\ y{\isadigit{2}}{\isacharparenright}{\isachardoublequoteclose}\isanewline
  20.810 +\ \ {\isachardoublequoteopen}{\isacharparenleft}x{\isadigit{1}}\ {\isasymColon}\ {\isacharprime}a{\isasymColon}{\isacharbraceleft}ord{\isacharcomma}\ eq{\isacharbraceright}{\isacharcomma}\ y{\isadigit{1}}\ {\isasymColon}\ {\isacharprime}b{\isasymColon}ord{\isacharparenright}\ {\isasymle}\ {\isacharparenleft}x{\isadigit{2}}{\isacharcomma}\ y{\isadigit{2}}{\isacharparenright}\ {\isasymlongleftrightarrow}\isanewline
  20.811 +\ \ \ \ x{\isadigit{1}}\ {\isacharless}\ x{\isadigit{2}}\ {\isasymor}\ {\isacharparenleft}x{\isadigit{1}}\ {\isacharequal}\ x{\isadigit{2}}\ {\isasymand}\ y{\isadigit{1}}\ {\isasymle}\ y{\isadigit{2}}{\isacharparenright}{\isachardoublequoteclose}\isanewline
  20.812 +%
  20.813 +\isadelimproof
  20.814 +\ \ %
  20.815 +\endisadelimproof
  20.816 +%
  20.817 +\isatagproof
  20.818 +\isacommand{unfolding}\isamarkupfalse%
  20.819 +\ ord{\isacharunderscore}prod\ \isacommand{by}\isamarkupfalse%
  20.820 +\ rule{\isacharplus}%
  20.821 +\endisatagproof
  20.822 +{\isafoldproof}%
  20.823 +%
  20.824 +\isadelimproof
  20.825 +%
  20.826 +\endisadelimproof
  20.827 +%
  20.828 +\begin{isamarkuptext}%
  20.829 +\noindent Then code generation succeeds:%
  20.830 +\end{isamarkuptext}%
  20.831 +\isamarkuptrue%
  20.832 +\isacommand{export{\isacharunderscore}code}\isamarkupfalse%
  20.833 +\ {\isachardoublequoteopen}op\ {\isasymle}\ {\isasymColon}\ {\isacharprime}a{\isasymColon}{\isacharbraceleft}eq{\isacharcomma}\ ord{\isacharbraceright}\ {\isasymtimes}\ {\isacharprime}b{\isasymColon}ord\ {\isasymRightarrow}\ {\isacharprime}a\ {\isasymtimes}\ {\isacharprime}b\ {\isasymRightarrow}\ bool{\isachardoublequoteclose}\isanewline
  20.834 +\ \ \isakeyword{in}\ SML\ \isakeyword{file}\ {\isachardoublequoteopen}examples{\isacharslash}lexicographic{\isachardot}ML{\isachardoublequoteclose}%
  20.835 +\begin{isamarkuptext}%
  20.836 +\lstsml{Thy/examples/lexicographic.ML}%
  20.837 +\end{isamarkuptext}%
  20.838 +\isamarkuptrue%
  20.839 +%
  20.840 +\begin{isamarkuptext}%
  20.841 +In general, code theorems for overloaded constants may have more
  20.842 +  restrictive sort constraints than the underlying instance relation
  20.843 +  between class and type constructor as long as the whole system of
  20.844 +  constraints is coregular; code theorems violating coregularity
  20.845 +  are rejected immediately.  Consequently, it might be necessary
  20.846 +  to delete disturbing theorems in the code theorem table,
  20.847 +  as we have done here with the original definitions \isa{less{\isacharunderscore}prod{\isacharunderscore}def}
  20.848 +  and \isa{less{\isacharunderscore}eq{\isacharunderscore}prod{\isacharunderscore}def}.
  20.849 +
  20.850 +  In some cases, the automatically derived defining equations
  20.851 +  for equality on a particular type may not be appropriate.
  20.852 +  As example, watch the following datatype representing
  20.853 +  monomorphic parametric types (where type constructors
  20.854 +  are referred to by natural numbers):%
  20.855 +\end{isamarkuptext}%
  20.856 +\isamarkuptrue%
  20.857 +\isacommand{datatype}\isamarkupfalse%
  20.858 +\ monotype\ {\isacharequal}\ Mono\ nat\ {\isachardoublequoteopen}monotype\ list{\isachardoublequoteclose}%
  20.859 +\isadelimproof
  20.860 +%
  20.861 +\endisadelimproof
  20.862 +%
  20.863 +\isatagproof
  20.864 +%
  20.865 +\endisatagproof
  20.866 +{\isafoldproof}%
  20.867 +%
  20.868 +\isadelimproof
  20.869 +%
  20.870 +\endisadelimproof
  20.871 +%
  20.872 +\begin{isamarkuptext}%
  20.873 +Then code generation for SML would fail with a message
  20.874 +  that the generated code conains illegal mutual dependencies:
  20.875 +  the theorem \isa{Mono\ tyco{\isadigit{1}}\ typargs{\isadigit{1}}\ {\isacharequal}\ Mono\ tyco{\isadigit{2}}\ typargs{\isadigit{2}}\ {\isasymequiv}\ tyco{\isadigit{1}}\ {\isacharequal}\ tyco{\isadigit{2}}\ {\isasymand}\ typargs{\isadigit{1}}\ {\isacharequal}\ typargs{\isadigit{2}}} already requires the
  20.876 +  instance \isa{monotype\ {\isasymColon}\ eq}, which itself requires
  20.877 +  \isa{Mono\ tyco{\isadigit{1}}\ typargs{\isadigit{1}}\ {\isacharequal}\ Mono\ tyco{\isadigit{2}}\ typargs{\isadigit{2}}\ {\isasymequiv}\ tyco{\isadigit{1}}\ {\isacharequal}\ tyco{\isadigit{2}}\ {\isasymand}\ typargs{\isadigit{1}}\ {\isacharequal}\ typargs{\isadigit{2}}};  Haskell has no problem with mutually
  20.878 +  recursive \isa{instance} and \isa{function} definitions,
  20.879 +  but the SML serializer does not support this.
  20.880 +
  20.881 +  In such cases, you have to provide you own equality equations
  20.882 +  involving auxiliary constants.  In our case,
  20.883 +  \isa{list{\isacharunderscore}all{\isadigit{2}}} can do the job:%
  20.884 +\end{isamarkuptext}%
  20.885 +\isamarkuptrue%
  20.886 +\isacommand{lemma}\isamarkupfalse%
  20.887 +\ monotype{\isacharunderscore}eq{\isacharunderscore}list{\isacharunderscore}all{\isadigit{2}}\ {\isacharbrackleft}code\ func{\isacharbrackright}{\isacharcolon}\isanewline
  20.888 +\ \ {\isachardoublequoteopen}Mono\ tyco{\isadigit{1}}\ typargs{\isadigit{1}}\ {\isacharequal}\ Mono\ tyco{\isadigit{2}}\ typargs{\isadigit{2}}\ {\isasymlongleftrightarrow}\isanewline
  20.889 +\ \ \ \ \ tyco{\isadigit{1}}\ {\isacharequal}\ tyco{\isadigit{2}}\ {\isasymand}\ list{\isacharunderscore}all{\isadigit{2}}\ {\isacharparenleft}op\ {\isacharequal}{\isacharparenright}\ typargs{\isadigit{1}}\ typargs{\isadigit{2}}{\isachardoublequoteclose}\isanewline
  20.890 +%
  20.891 +\isadelimproof
  20.892 +\ \ %
  20.893 +\endisadelimproof
  20.894 +%
  20.895 +\isatagproof
  20.896 +\isacommand{by}\isamarkupfalse%
  20.897 +\ {\isacharparenleft}simp\ add{\isacharcolon}\ list{\isacharunderscore}all{\isadigit{2}}{\isacharunderscore}eq\ {\isacharbrackleft}symmetric{\isacharbrackright}{\isacharparenright}%
  20.898 +\endisatagproof
  20.899 +{\isafoldproof}%
  20.900 +%
  20.901 +\isadelimproof
  20.902 +%
  20.903 +\endisadelimproof
  20.904 +%
  20.905 +\begin{isamarkuptext}%
  20.906 +does not depend on instance \isa{monotype\ {\isasymColon}\ eq}:%
  20.907 +\end{isamarkuptext}%
  20.908 +\isamarkuptrue%
  20.909 +\isacommand{export{\isacharunderscore}code}\isamarkupfalse%
  20.910 +\ {\isachardoublequoteopen}op\ {\isacharequal}\ {\isacharcolon}{\isacharcolon}\ monotype\ {\isasymRightarrow}\ monotype\ {\isasymRightarrow}\ bool{\isachardoublequoteclose}\isanewline
  20.911 +\ \ \isakeyword{in}\ SML\ \isakeyword{file}\ {\isachardoublequoteopen}examples{\isacharslash}monotype{\isachardot}ML{\isachardoublequoteclose}%
  20.912 +\begin{isamarkuptext}%
  20.913 +\lstsml{Thy/examples/monotype.ML}%
  20.914 +\end{isamarkuptext}%
  20.915 +\isamarkuptrue%
  20.916 +%
  20.917 +\isamarkupsubsection{Programs as sets of theorems%
  20.918 +}
  20.919 +\isamarkuptrue%
  20.920 +%
  20.921 +\begin{isamarkuptext}%
  20.922 +As told in \secref{sec:concept}, code generation is based
  20.923 +  on a structured collection of code theorems.
  20.924 +  For explorative purpose, this collection
  20.925 +  may be inspected using the \isa{{\isasymCODETHMS}} command:%
  20.926 +\end{isamarkuptext}%
  20.927 +\isamarkuptrue%
  20.928 +\isacommand{code{\isacharunderscore}thms}\isamarkupfalse%
  20.929 +\ {\isachardoublequoteopen}op\ mod\ {\isacharcolon}{\isacharcolon}\ nat\ {\isasymRightarrow}\ nat\ {\isasymRightarrow}\ nat{\isachardoublequoteclose}%
  20.930 +\begin{isamarkuptext}%
  20.931 +\noindent prints a table with \emph{all} defining equations
  20.932 +  for \isa{op\ mod}, including
  20.933 +  \emph{all} defining equations those equations depend
  20.934 +  on recursivly.  \isa{{\isasymCODETHMS}} provides a convenient
  20.935 +  mechanism to inspect the impact of a preprocessor setup
  20.936 +  on defining equations.
  20.937 +  
  20.938 +  Similarly, the \isa{{\isasymCODEDEPS}} command shows a graph
  20.939 +  visualizing dependencies between defining equations.%
  20.940 +\end{isamarkuptext}%
  20.941 +\isamarkuptrue%
  20.942 +%
  20.943 +\isamarkupsubsection{Constructor sets for datatypes%
  20.944 +}
  20.945 +\isamarkuptrue%
  20.946 +%
  20.947 +\begin{isamarkuptext}%
  20.948 +Conceptually, any datatype is spanned by a set of
  20.949 +  \emph{constructors} of type \isa{{\isasymtau}\ {\isacharequal}\ {\isasymdots}\ {\isasymRightarrow}\ {\isasymkappa}\ {\isasymalpha}\isactrlisub {\isadigit{1}}\ {\isasymdots}\ {\isasymalpha}\isactrlisub n}
  20.950 +  where \isa{{\isacharbraceleft}{\isasymalpha}\isactrlisub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ {\isasymalpha}\isactrlisub n{\isacharbraceright}} is excactly the set of \emph{all}
  20.951 +  type variables in \isa{{\isasymtau}}.  The HOL datatype package
  20.952 +  by default registers any new datatype in the table
  20.953 +  of datatypes, which may be inspected using
  20.954 +  the \isa{{\isasymPRINTCODESETUP}} command.
  20.955 +
  20.956 +  In some cases, it may be convenient to alter or
  20.957 +  extend this table;  as an example, we will develope an alternative
  20.958 +  representation of natural numbers as binary digits, whose
  20.959 +  size does increase logarithmically with its value, not linear
  20.960 +  \footnote{Indeed, the \isa{Efficient{\isacharunderscore}Nat} theory (see \ref{eff_nat})
  20.961 +    does something similar}.  First, the digit representation:%
  20.962 +\end{isamarkuptext}%
  20.963 +\isamarkuptrue%
  20.964 +\isacommand{definition}\isamarkupfalse%
  20.965 +\ Dig{\isadigit{0}}\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ nat{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  20.966 +\ \ {\isachardoublequoteopen}Dig{\isadigit{0}}\ n\ {\isacharequal}\ {\isadigit{2}}\ {\isacharasterisk}\ n{\isachardoublequoteclose}\isanewline
  20.967 +\isanewline
  20.968 +\isacommand{definition}\isamarkupfalse%
  20.969 +\ Dig{\isadigit{1}}\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ nat{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  20.970 +\ \ {\isachardoublequoteopen}Dig{\isadigit{1}}\ n\ {\isacharequal}\ Suc\ {\isacharparenleft}{\isadigit{2}}\ {\isacharasterisk}\ n{\isacharparenright}{\isachardoublequoteclose}%
  20.971 +\begin{isamarkuptext}%
  20.972 +\noindent We will use these two ">digits"< to represent natural numbers
  20.973 +  in binary digits, e.g.:%
  20.974 +\end{isamarkuptext}%
  20.975 +\isamarkuptrue%
  20.976 +\isacommand{lemma}\isamarkupfalse%
  20.977 +\ {\isadigit{4}}{\isadigit{2}}{\isacharcolon}\ {\isachardoublequoteopen}{\isadigit{4}}{\isadigit{2}}\ {\isacharequal}\ Dig{\isadigit{0}}\ {\isacharparenleft}Dig{\isadigit{1}}\ {\isacharparenleft}Dig{\isadigit{0}}\ {\isacharparenleft}Dig{\isadigit{1}}\ {\isacharparenleft}Dig{\isadigit{0}}\ {\isadigit{1}}{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}\isanewline
  20.978 +%
  20.979 +\isadelimproof
  20.980 +\ \ %
  20.981 +\endisadelimproof
  20.982 +%
  20.983 +\isatagproof
  20.984 +\isacommand{by}\isamarkupfalse%
  20.985 +\ {\isacharparenleft}simp\ add{\isacharcolon}\ Dig{\isadigit{0}}{\isacharunderscore}def\ Dig{\isadigit{1}}{\isacharunderscore}def{\isacharparenright}%
  20.986 +\endisatagproof
  20.987 +{\isafoldproof}%
  20.988 +%
  20.989 +\isadelimproof
  20.990 +%
  20.991 +\endisadelimproof
  20.992 +%
  20.993 +\begin{isamarkuptext}%
  20.994 +\noindent Of course we also have to provide proper code equations for
  20.995 +  the operations, e.g. \isa{op\ {\isacharplus}}:%
  20.996 +\end{isamarkuptext}%
  20.997 +\isamarkuptrue%
  20.998 +\isacommand{lemma}\isamarkupfalse%
  20.999 +\ plus{\isacharunderscore}Dig\ {\isacharbrackleft}code\ func{\isacharbrackright}{\isacharcolon}\isanewline
 20.1000 +\ \ {\isachardoublequoteopen}{\isadigit{0}}\ {\isacharplus}\ n\ {\isacharequal}\ n{\isachardoublequoteclose}\isanewline
 20.1001 +\ \ {\isachardoublequoteopen}m\ {\isacharplus}\ {\isadigit{0}}\ {\isacharequal}\ m{\isachardoublequoteclose}\isanewline
 20.1002 +\ \ {\isachardoublequoteopen}{\isadigit{1}}\ {\isacharplus}\ Dig{\isadigit{0}}\ n\ {\isacharequal}\ Dig{\isadigit{1}}\ n{\isachardoublequoteclose}\isanewline
 20.1003 +\ \ {\isachardoublequoteopen}Dig{\isadigit{0}}\ m\ {\isacharplus}\ {\isadigit{1}}\ {\isacharequal}\ Dig{\isadigit{1}}\ m{\isachardoublequoteclose}\isanewline
 20.1004 +\ \ {\isachardoublequoteopen}{\isadigit{1}}\ {\isacharplus}\ Dig{\isadigit{1}}\ n\ {\isacharequal}\ Dig{\isadigit{0}}\ {\isacharparenleft}n\ {\isacharplus}\ {\isadigit{1}}{\isacharparenright}{\isachardoublequoteclose}\isanewline
 20.1005 +\ \ {\isachardoublequoteopen}Dig{\isadigit{1}}\ m\ {\isacharplus}\ {\isadigit{1}}\ {\isacharequal}\ Dig{\isadigit{0}}\ {\isacharparenleft}m\ {\isacharplus}\ {\isadigit{1}}{\isacharparenright}{\isachardoublequoteclose}\isanewline
 20.1006 +\ \ {\isachardoublequoteopen}Dig{\isadigit{0}}\ m\ {\isacharplus}\ Dig{\isadigit{0}}\ n\ {\isacharequal}\ Dig{\isadigit{0}}\ {\isacharparenleft}m\ {\isacharplus}\ n{\isacharparenright}{\isachardoublequoteclose}\isanewline
 20.1007 +\ \ {\isachardoublequoteopen}Dig{\isadigit{0}}\ m\ {\isacharplus}\ Dig{\isadigit{1}}\ n\ {\isacharequal}\ Dig{\isadigit{1}}\ {\isacharparenleft}m\ {\isacharplus}\ n{\isacharparenright}{\isachardoublequoteclose}\isanewline
 20.1008 +\ \ {\isachardoublequoteopen}Dig{\isadigit{1}}\ m\ {\isacharplus}\ Dig{\isadigit{0}}\ n\ {\isacharequal}\ Dig{\isadigit{1}}\ {\isacharparenleft}m\ {\isacharplus}\ n{\isacharparenright}{\isachardoublequoteclose}\isanewline
 20.1009 +\ \ {\isachardoublequoteopen}Dig{\isadigit{1}}\ m\ {\isacharplus}\ Dig{\isadigit{1}}\ n\ {\isacharequal}\ Dig{\isadigit{0}}\ {\isacharparenleft}m\ {\isacharplus}\ n\ {\isacharplus}\ {\isadigit{1}}{\isacharparenright}{\isachardoublequoteclose}\isanewline
 20.1010 +%
 20.1011 +\isadelimproof
 20.1012 +\ \ %
 20.1013 +\endisadelimproof
 20.1014 +%
 20.1015 +\isatagproof
 20.1016 +\isacommand{by}\isamarkupfalse%
 20.1017 +\ {\isacharparenleft}simp{\isacharunderscore}all\ add{\isacharcolon}\ Dig{\isadigit{0}}{\isacharunderscore}def\ Dig{\isadigit{1}}{\isacharunderscore}def{\isacharparenright}%
 20.1018 +\endisatagproof
 20.1019 +{\isafoldproof}%
 20.1020 +%
 20.1021 +\isadelimproof
 20.1022 +%
 20.1023 +\endisadelimproof
 20.1024 +%
 20.1025 +\begin{isamarkuptext}%
 20.1026 +\noindent We then instruct the code generator to view \isa{{\isadigit{0}}},
 20.1027 +  \isa{{\isadigit{1}}}, \isa{Dig{\isadigit{0}}} and \isa{Dig{\isadigit{1}}} as
 20.1028 +  datatype constructors:%
 20.1029 +\end{isamarkuptext}%
 20.1030 +\isamarkuptrue%
 20.1031 +\isacommand{code{\isacharunderscore}datatype}\isamarkupfalse%
 20.1032 +\ {\isachardoublequoteopen}{\isadigit{0}}{\isasymColon}nat{\isachardoublequoteclose}\ {\isachardoublequoteopen}{\isadigit{1}}{\isasymColon}nat{\isachardoublequoteclose}\ Dig{\isadigit{0}}\ Dig{\isadigit{1}}%
 20.1033 +\begin{isamarkuptext}%
 20.1034 +\noindent For the former constructor \isa{Suc}, we provide a code
 20.1035 +  equation and remove some parts of the default code generator setup
 20.1036 +  which are an obstacle here:%
 20.1037 +\end{isamarkuptext}%
 20.1038 +\isamarkuptrue%
 20.1039 +\isacommand{lemma}\isamarkupfalse%
 20.1040 +\ Suc{\isacharunderscore}Dig\ {\isacharbrackleft}code\ func{\isacharbrackright}{\isacharcolon}\isanewline
 20.1041 +\ \ {\isachardoublequoteopen}Suc\ n\ {\isacharequal}\ n\ {\isacharplus}\ {\isadigit{1}}{\isachardoublequoteclose}\isanewline
 20.1042 +%
 20.1043 +\isadelimproof
 20.1044 +\ \ %
 20.1045 +\endisadelimproof
 20.1046 +%
 20.1047 +\isatagproof
 20.1048 +\isacommand{by}\isamarkupfalse%
 20.1049 +\ simp%
 20.1050 +\endisatagproof
 20.1051 +{\isafoldproof}%
 20.1052 +%
 20.1053 +\isadelimproof
 20.1054 +\isanewline
 20.1055 +%
 20.1056 +\endisadelimproof
 20.1057 +\isanewline
 20.1058 +\isacommand{declare}\isamarkupfalse%
 20.1059 +\ One{\isacharunderscore}nat{\isacharunderscore}def\ {\isacharbrackleft}code\ inline\ del{\isacharbrackright}\isanewline
 20.1060 +\isacommand{declare}\isamarkupfalse%
 20.1061 +\ add{\isacharunderscore}Suc{\isacharunderscore}shift\ {\isacharbrackleft}code\ func\ del{\isacharbrackright}%
 20.1062 +\begin{isamarkuptext}%
 20.1063 +\noindent This yields the following code:%
 20.1064 +\end{isamarkuptext}%
 20.1065 +\isamarkuptrue%
 20.1066 +\isacommand{export{\isacharunderscore}code}\isamarkupfalse%
 20.1067 +\ {\isachardoublequoteopen}op\ {\isacharplus}\ {\isasymColon}\ nat\ {\isasymRightarrow}\ nat\ {\isasymRightarrow}\ nat{\isachardoublequoteclose}\ \ \isakeyword{in}\ SML\ \isakeyword{file}\ {\isachardoublequoteopen}examples{\isacharslash}nat{\isacharunderscore}binary{\isachardot}ML{\isachardoublequoteclose}%
 20.1068 +\begin{isamarkuptext}%
 20.1069 +\lstsml{Thy/examples/nat_binary.ML}%
 20.1070 +\end{isamarkuptext}%
 20.1071 +\isamarkuptrue%
 20.1072 +%
 20.1073 +\begin{isamarkuptext}%
 20.1074 +\medskip
 20.1075 +
 20.1076 +  From this example, it can be easily glimpsed that using own constructor sets
 20.1077 +  is a little delicate since it changes the set of valid patterns for values
 20.1078 +  of that type.  Without going into much detail, here some practical hints:
 20.1079 +
 20.1080 +  \begin{itemize}
 20.1081 +    \item When changing the constuctor set for datatypes, take care to
 20.1082 +      provide an alternative for the \isa{case} combinator (e.g. by replacing
 20.1083 +      it using the preprocessor).
 20.1084 +    \item Values in the target language need not to be normalized -- different
 20.1085 +      values in the target language may represent the same value in the
 20.1086 +      logic (e.g. \isa{Dig{\isadigit{1}}\ {\isadigit{0}}\ {\isacharequal}\ {\isadigit{1}}}).
 20.1087 +    \item Usually, a good methodology to deal with the subleties of pattern
 20.1088 +      matching is to see the type as an abstract type: provide a set
 20.1089 +      of operations which operate on the concrete representation of the type,
 20.1090 +      and derive further operations by combinations of these primitive ones,
 20.1091 +      without relying on a particular representation.
 20.1092 +  \end{itemize}%
 20.1093 +\end{isamarkuptext}%
 20.1094 +\isamarkuptrue%
 20.1095 +%
 20.1096 +\isadeliminvisible
 20.1097 +%
 20.1098 +\endisadeliminvisible
 20.1099 +%
 20.1100 +\isataginvisible
 20.1101 +\isacommand{code{\isacharunderscore}datatype}\isamarkupfalse%
 20.1102 +\ {\isachardoublequoteopen}{\isadigit{0}}{\isacharcolon}{\isacharcolon}nat{\isachardoublequoteclose}\ Suc\isanewline
 20.1103 +\isacommand{declare}\isamarkupfalse%
 20.1104 +\ plus{\isacharunderscore}Dig\ {\isacharbrackleft}code\ func\ del{\isacharbrackright}\isanewline
 20.1105 +\isacommand{declare}\isamarkupfalse%
 20.1106 +\ One{\isacharunderscore}nat{\isacharunderscore}def\ {\isacharbrackleft}code\ inline{\isacharbrackright}\isanewline
 20.1107 +\isacommand{declare}\isamarkupfalse%
 20.1108 +\ add{\isacharunderscore}Suc{\isacharunderscore}shift\ {\isacharbrackleft}code\ func{\isacharbrackright}\ \isanewline
 20.1109 +\isacommand{lemma}\isamarkupfalse%
 20.1110 +\ {\isacharbrackleft}code\ func{\isacharbrackright}{\isacharcolon}\ {\isachardoublequoteopen}{\isadigit{0}}\ {\isacharplus}\ n\ {\isacharequal}\ {\isacharparenleft}n\ {\isasymColon}\ nat{\isacharparenright}{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
 20.1111 +\ simp%
 20.1112 +\endisataginvisible
 20.1113 +{\isafoldinvisible}%
 20.1114 +%
 20.1115 +\isadeliminvisible
 20.1116 +%
 20.1117 +\endisadeliminvisible
 20.1118 +%
 20.1119 +\isamarkupsubsection{Customizing serialization%
 20.1120 +}
 20.1121 +\isamarkuptrue%
 20.1122 +%
 20.1123 +\isamarkupsubsubsection{Basics%
 20.1124 +}
 20.1125 +\isamarkuptrue%
 20.1126 +%
 20.1127 +\begin{isamarkuptext}%
 20.1128 +Consider the following function and its corresponding
 20.1129 +  SML code:%
 20.1130 +\end{isamarkuptext}%
 20.1131 +\isamarkuptrue%
 20.1132 +\isacommand{primrec}\isamarkupfalse%
 20.1133 +\isanewline
 20.1134 +\ \ in{\isacharunderscore}interval\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymtimes}\ nat\ {\isasymRightarrow}\ nat\ {\isasymRightarrow}\ bool{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
 20.1135 +\ \ {\isachardoublequoteopen}in{\isacharunderscore}interval\ {\isacharparenleft}k{\isacharcomma}\ l{\isacharparenright}\ n\ {\isasymlongleftrightarrow}\ k\ {\isasymle}\ n\ {\isasymand}\ n\ {\isasymle}\ l{\isachardoublequoteclose}%
 20.1136 +\isadelimtt
 20.1137 +%
 20.1138 +\endisadelimtt
 20.1139 +%
 20.1140 +\isatagtt
 20.1141 +%
 20.1142 +\endisatagtt
 20.1143 +{\isafoldtt}%
 20.1144 +%
 20.1145 +\isadelimtt
 20.1146 +%
 20.1147 +\endisadelimtt
 20.1148 +\isacommand{export{\isacharunderscore}code}\isamarkupfalse%
 20.1149 +\ in{\isacharunderscore}interval\ \isakeyword{in}\ SML\ \isakeyword{file}\ {\isachardoublequoteopen}examples{\isacharslash}bool{\isacharunderscore}literal{\isachardot}ML{\isachardoublequoteclose}%
 20.1150 +\begin{isamarkuptext}%
 20.1151 +\lstsml{Thy/examples/bool_literal.ML}
 20.1152 +
 20.1153 +  \noindent Though this is correct code, it is a little bit unsatisfactory:
 20.1154 +  boolean values and operators are materialized as distinguished
 20.1155 +  entities with have nothing to do with the SML-builtin notion
 20.1156 +  of \qt{bool}.  This results in less readable code;
 20.1157 +  additionally, eager evaluation may cause programs to
 20.1158 +  loop or break which would perfectly terminate when
 20.1159 +  the existing SML \qt{bool} would be used.  To map
 20.1160 +  the HOL \qt{bool} on SML \qt{bool}, we may use
 20.1161 +  \qn{custom serializations}:%
 20.1162 +\end{isamarkuptext}%
 20.1163 +\isamarkuptrue%
 20.1164 +%
 20.1165 +\isadelimtt
 20.1166 +%
 20.1167 +\endisadelimtt
 20.1168 +%
 20.1169 +\isatagtt
 20.1170 +\isacommand{code{\isacharunderscore}type}\isamarkupfalse%
 20.1171 +\ bool\isanewline
 20.1172 +\ \ {\isacharparenleft}SML\ {\isachardoublequoteopen}bool{\isachardoublequoteclose}{\isacharparenright}\isanewline
 20.1173 +\isacommand{code{\isacharunderscore}const}\isamarkupfalse%
 20.1174 +\ True\ \isakeyword{and}\ False\ \isakeyword{and}\ {\isachardoublequoteopen}op\ {\isasymand}{\isachardoublequoteclose}\isanewline
 20.1175 +\ \ {\isacharparenleft}SML\ {\isachardoublequoteopen}true{\isachardoublequoteclose}\ \isakeyword{and}\ {\isachardoublequoteopen}false{\isachardoublequoteclose}\ \isakeyword{and}\ {\isachardoublequoteopen}{\isacharunderscore}\ andalso\ {\isacharunderscore}{\isachardoublequoteclose}{\isacharparenright}%
 20.1176 +\endisatagtt
 20.1177 +{\isafoldtt}%
 20.1178 +%
 20.1179 +\isadelimtt
 20.1180 +%
 20.1181 +\endisadelimtt
 20.1182 +%
 20.1183 +\begin{isamarkuptext}%
 20.1184 +The \isa{{\isasymCODETYPE}} commad takes a type constructor
 20.1185 +  as arguments together with a list of custom serializations.
 20.1186 +  Each custom serialization starts with a target language
 20.1187 +  identifier followed by an expression, which during
 20.1188 +  code serialization is inserted whenever the type constructor
 20.1189 +  would occur.  For constants, \isa{{\isasymCODECONST}} implements
 20.1190 +  the corresponding mechanism.  Each ``\verb|_|'' in
 20.1191 +  a serialization expression is treated as a placeholder
 20.1192 +  for the type constructor's (the constant's) arguments.%
 20.1193 +\end{isamarkuptext}%
 20.1194 +\isamarkuptrue%
 20.1195 +\isacommand{export{\isacharunderscore}code}\isamarkupfalse%
 20.1196 +\ in{\isacharunderscore}interval\ \ \isakeyword{in}\ SML\ \isakeyword{file}\ {\isachardoublequoteopen}examples{\isacharslash}bool{\isacharunderscore}mlbool{\isachardot}ML{\isachardoublequoteclose}%
 20.1197 +\begin{isamarkuptext}%
 20.1198 +\lstsml{Thy/examples/bool_mlbool.ML}
 20.1199 +
 20.1200 +  \noindent This still is not perfect: the parentheses
 20.1201 +  around the \qt{andalso} expression are superfluous.
 20.1202 +  Though the serializer
 20.1203 +  by no means attempts to imitate the rich Isabelle syntax
 20.1204 +  framework, it provides some common idioms, notably
 20.1205 +  associative infixes with precedences which may be used here:%
 20.1206 +\end{isamarkuptext}%
 20.1207 +\isamarkuptrue%
 20.1208 +%
 20.1209 +\isadelimtt
 20.1210 +%
 20.1211 +\endisadelimtt
 20.1212 +%
 20.1213 +\isatagtt
 20.1214 +\isacommand{code{\isacharunderscore}const}\isamarkupfalse%
 20.1215 +\ {\isachardoublequoteopen}op\ {\isasymand}{\isachardoublequoteclose}\isanewline
 20.1216 +\ \ {\isacharparenleft}SML\ \isakeyword{infixl}\ {\isadigit{1}}\ {\isachardoublequoteopen}andalso{\isachardoublequoteclose}{\isacharparenright}%
 20.1217 +\endisatagtt
 20.1218 +{\isafoldtt}%
 20.1219 +%
 20.1220 +\isadelimtt
 20.1221 +%
 20.1222 +\endisadelimtt
 20.1223 +\isanewline
 20.1224 +\isanewline
 20.1225 +\isacommand{export{\isacharunderscore}code}\isamarkupfalse%
 20.1226 +\ in{\isacharunderscore}interval\ \ \isakeyword{in}\ SML\ \isakeyword{file}\ {\isachardoublequoteopen}examples{\isacharslash}bool{\isacharunderscore}infix{\isachardot}ML{\isachardoublequoteclose}%
 20.1227 +\begin{isamarkuptext}%
 20.1228 +\lstsml{Thy/examples/bool_infix.ML}
 20.1229 +
 20.1230 +  \medskip
 20.1231 +
 20.1232 +  Next, we try to map HOL pairs to SML pairs, using the
 20.1233 +  infix ``\verb|*|'' type constructor and parentheses:%
 20.1234 +\end{isamarkuptext}%
 20.1235 +\isamarkuptrue%
 20.1236 +%
 20.1237 +\isadelimtt
 20.1238 +%
 20.1239 +\endisadelimtt
 20.1240 +%
 20.1241 +\isatagtt
 20.1242 +\isacommand{code{\isacharunderscore}type}\isamarkupfalse%
 20.1243 +\ {\isacharasterisk}\isanewline
 20.1244 +\ \ {\isacharparenleft}SML\ \isakeyword{infix}\ {\isadigit{2}}\ {\isachardoublequoteopen}{\isacharasterisk}{\isachardoublequoteclose}{\isacharparenright}\isanewline
 20.1245 +\isacommand{code{\isacharunderscore}const}\isamarkupfalse%
 20.1246 +\ Pair\isanewline
 20.1247 +\ \ {\isacharparenleft}SML\ {\isachardoublequoteopen}{\isacharbang}{\isacharparenleft}{\isacharparenleft}{\isacharunderscore}{\isacharparenright}{\isacharcomma}{\isacharslash}\ {\isacharparenleft}{\isacharunderscore}{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}{\isacharparenright}%
 20.1248 +\endisatagtt
 20.1249 +{\isafoldtt}%
 20.1250 +%
 20.1251 +\isadelimtt
 20.1252 +%
 20.1253 +\endisadelimtt
 20.1254 +%
 20.1255 +\begin{isamarkuptext}%
 20.1256 +The initial bang ``\verb|!|'' tells the serializer to never put
 20.1257 +  parentheses around the whole expression (they are already present),
 20.1258 +  while the parentheses around argument place holders
 20.1259 +  tell not to put parentheses around the arguments.
 20.1260 +  The slash ``\verb|/|'' (followed by arbitrary white space)
 20.1261 +  inserts a space which may be used as a break if necessary
 20.1262 +  during pretty printing.
 20.1263 +
 20.1264 +  These examples give a glimpse what mechanisms
 20.1265 +  custom serializations provide; however their usage
 20.1266 +  requires careful thinking in order not to introduce
 20.1267 +  inconsistencies -- or, in other words:
 20.1268 +  custom serializations are completely axiomatic.
 20.1269 +
 20.1270 +  A further noteworthy details is that any special
 20.1271 +  character in a custom serialization may be quoted
 20.1272 +  using ``\verb|'|''; thus, in
 20.1273 +  ``\verb|fn '_ => _|'' the first
 20.1274 +  ``\verb|_|'' is a proper underscore while the
 20.1275 +  second ``\verb|_|'' is a placeholder.
 20.1276 +
 20.1277 +  The HOL theories provide further
 20.1278 +  examples for custom serializations.%
 20.1279 +\end{isamarkuptext}%
 20.1280 +\isamarkuptrue%
 20.1281 +%
 20.1282 +\isamarkupsubsubsection{Haskell serialization%
 20.1283 +}
 20.1284 +\isamarkuptrue%
 20.1285 +%
 20.1286 +\begin{isamarkuptext}%
 20.1287 +For convenience, the default
 20.1288 +  HOL setup for Haskell maps the \isa{eq} class to
 20.1289 +  its counterpart in Haskell, giving custom serializations
 20.1290 +  for the class (\isa{{\isasymCODECLASS}}) and its operation:%
 20.1291 +\end{isamarkuptext}%
 20.1292 +\isamarkuptrue%
 20.1293 +%
 20.1294 +\isadelimtt
 20.1295 +%
 20.1296 +\endisadelimtt
 20.1297 +%
 20.1298 +\isatagtt
 20.1299 +\isacommand{code{\isacharunderscore}class}\isamarkupfalse%
 20.1300 +\ eq\isanewline
 20.1301 +\ \ {\isacharparenleft}Haskell\ {\isachardoublequoteopen}Eq{\isachardoublequoteclose}\ \isakeyword{where}\ {\isachardoublequoteopen}op\ {\isacharequal}{\isachardoublequoteclose}\ {\isasymequiv}\ {\isachardoublequoteopen}{\isacharparenleft}{\isacharequal}{\isacharequal}{\isacharparenright}{\isachardoublequoteclose}{\isacharparenright}\isanewline
 20.1302 +\isanewline
 20.1303 +\isacommand{code{\isacharunderscore}const}\isamarkupfalse%
 20.1304 +\ {\isachardoublequoteopen}op\ {\isacharequal}{\isachardoublequoteclose}\isanewline
 20.1305 +\ \ {\isacharparenleft}Haskell\ \isakeyword{infixl}\ {\isadigit{4}}\ {\isachardoublequoteopen}{\isacharequal}{\isacharequal}{\isachardoublequoteclose}{\isacharparenright}%
 20.1306 +\endisatagtt
 20.1307 +{\isafoldtt}%
 20.1308 +%
 20.1309 +\isadelimtt
 20.1310 +%
 20.1311 +\endisadelimtt
 20.1312 +%
 20.1313 +\begin{isamarkuptext}%
 20.1314 +A problem now occurs whenever a type which
 20.1315 +  is an instance of \isa{eq} in HOL is mapped
 20.1316 +  on a Haskell-builtin type which is also an instance
 20.1317 +  of Haskell \isa{Eq}:%
 20.1318 +\end{isamarkuptext}%
 20.1319 +\isamarkuptrue%
 20.1320 +\isacommand{typedecl}\isamarkupfalse%
 20.1321 +\ bar\isanewline
 20.1322 +\isanewline
 20.1323 +\isacommand{instantiation}\isamarkupfalse%
 20.1324 +\ bar\ {\isacharcolon}{\isacharcolon}\ eq\isanewline
 20.1325 +\isakeyword{begin}\isanewline
 20.1326 +\isanewline
 20.1327 +\isacommand{definition}\isamarkupfalse%
 20.1328 +\ {\isachardoublequoteopen}eq{\isacharunderscore}class{\isachardot}eq\ {\isacharparenleft}x{\isasymColon}bar{\isacharparenright}\ y\ {\isasymlongleftrightarrow}\ x\ {\isacharequal}\ y{\isachardoublequoteclose}\isanewline
 20.1329 +\isanewline
 20.1330 +\isacommand{instance}\isamarkupfalse%
 20.1331 +%
 20.1332 +\isadelimproof
 20.1333 +\ %
 20.1334 +\endisadelimproof
 20.1335 +%
 20.1336 +\isatagproof
 20.1337 +\isacommand{by}\isamarkupfalse%
 20.1338 +\ default\ {\isacharparenleft}simp\ add{\isacharcolon}\ eq{\isacharunderscore}bar{\isacharunderscore}def{\isacharparenright}%
 20.1339 +\endisatagproof
 20.1340 +{\isafoldproof}%
 20.1341 +%
 20.1342 +\isadelimproof
 20.1343 +%
 20.1344 +\endisadelimproof
 20.1345 +\isanewline
 20.1346 +\isanewline
 20.1347 +\isacommand{end}\isamarkupfalse%
 20.1348 +\isanewline
 20.1349 +%
 20.1350 +\isadelimtt
 20.1351 +\isanewline
 20.1352 +%
 20.1353 +\endisadelimtt
 20.1354 +%
 20.1355 +\isatagtt
 20.1356 +\isacommand{code{\isacharunderscore}type}\isamarkupfalse%
 20.1357 +\ bar\isanewline
 20.1358 +\ \ {\isacharparenleft}Haskell\ {\isachardoublequoteopen}Integer{\isachardoublequoteclose}{\isacharparenright}%
 20.1359 +\endisatagtt
 20.1360 +{\isafoldtt}%
 20.1361 +%
 20.1362 +\isadelimtt
 20.1363 +%
 20.1364 +\endisadelimtt
 20.1365 +%
 20.1366 +\begin{isamarkuptext}%
 20.1367 +The code generator would produce
 20.1368 +  an additional instance, which of course is rejected.
 20.1369 +  To suppress this additional instance, use
 20.1370 +  \isa{{\isasymCODEINSTANCE}}:%
 20.1371 +\end{isamarkuptext}%
 20.1372 +\isamarkuptrue%
 20.1373 +%
 20.1374 +\isadelimtt
 20.1375 +%
 20.1376 +\endisadelimtt
 20.1377 +%
 20.1378 +\isatagtt
 20.1379 +\isacommand{code{\isacharunderscore}instance}\isamarkupfalse%
 20.1380 +\ bar\ {\isacharcolon}{\isacharcolon}\ eq\isanewline
 20.1381 +\ \ {\isacharparenleft}Haskell\ {\isacharminus}{\isacharparenright}%
 20.1382 +\endisatagtt
 20.1383 +{\isafoldtt}%
 20.1384 +%
 20.1385 +\isadelimtt
 20.1386 +%
 20.1387 +\endisadelimtt
 20.1388 +%
 20.1389 +\isamarkupsubsubsection{Pretty printing%
 20.1390 +}
 20.1391 +\isamarkuptrue%
 20.1392 +%
 20.1393 +\begin{isamarkuptext}%
 20.1394 +The serializer provides ML interfaces to set up
 20.1395 +  pretty serializations for expressions like lists, numerals
 20.1396 +  and characters;  these are
 20.1397 +  monolithic stubs and should only be used with the
 20.1398 +  theories introduced in \secref{sec:library}.%
 20.1399 +\end{isamarkuptext}%
 20.1400 +\isamarkuptrue%
 20.1401 +%
 20.1402 +\isamarkupsubsection{Cyclic module dependencies%
 20.1403 +}
 20.1404 +\isamarkuptrue%
 20.1405 +%
 20.1406 +\begin{isamarkuptext}%
 20.1407 +Sometimes the awkward situation occurs that dependencies
 20.1408 +  between definitions introduce cyclic dependencies
 20.1409 +  between modules, which in the Haskell world leaves
 20.1410 +  you to the mercy of the Haskell implementation you are using,
 20.1411 +  while for SML code generation is not possible.
 20.1412 +
 20.1413 +  A solution is to declare module names explicitly.
 20.1414 +  Let use assume the three cyclically dependent
 20.1415 +  modules are named \emph{A}, \emph{B} and \emph{C}.
 20.1416 +  Then, by stating%
 20.1417 +\end{isamarkuptext}%
 20.1418 +\isamarkuptrue%
 20.1419 +\isacommand{code{\isacharunderscore}modulename}\isamarkupfalse%
 20.1420 +\ SML\isanewline
 20.1421 +\ \ A\ ABC\isanewline
 20.1422 +\ \ B\ ABC\isanewline
 20.1423 +\ \ C\ ABC%
 20.1424 +\begin{isamarkuptext}%
 20.1425 +we explicitly map all those modules on \emph{ABC},
 20.1426 +  resulting in an ad-hoc merge of this three modules
 20.1427 +  at serialization time.%
 20.1428 +\end{isamarkuptext}%
 20.1429 +\isamarkuptrue%
 20.1430 +%
 20.1431 +\isamarkupsubsection{Incremental code generation%
 20.1432 +}
 20.1433 +\isamarkuptrue%
 20.1434 +%
 20.1435 +\begin{isamarkuptext}%
 20.1436 +Code generation is \emph{incremental}: theorems
 20.1437 +  and abstract intermediate code are cached and extended on demand.
 20.1438 +  The cache may be partially or fully dropped if the underlying
 20.1439 +  executable content of the theory changes.
 20.1440 +  Implementation of caching is supposed to transparently
 20.1441 +  hid away the details from the user.  Anyway, caching
 20.1442 +  reaches the surface by using a slightly more general form
 20.1443 +  of the \isa{{\isasymCODETHMS}}, \isa{{\isasymCODEDEPS}}
 20.1444 +  and \isa{{\isasymEXPORTCODE}} commands: the list of constants
 20.1445 +  may be omitted.  Then, all constants with code theorems
 20.1446 +  in the current cache are referred to.%
 20.1447 +\end{isamarkuptext}%
 20.1448 +\isamarkuptrue%
 20.1449 +%
 20.1450 +\isamarkupsection{ML interfaces \label{sec:ml}%
 20.1451 +}
 20.1452 +\isamarkuptrue%
 20.1453 +%
 20.1454 +\begin{isamarkuptext}%
 20.1455 +Since the code generator framework not only aims to provide
 20.1456 +  a nice Isar interface but also to form a base for
 20.1457 +  code-generation-based applications, here a short
 20.1458 +  description of the most important ML interfaces.%
 20.1459 +\end{isamarkuptext}%
 20.1460 +\isamarkuptrue%
 20.1461 +%
 20.1462 +\isamarkupsubsection{Executable theory content: \isa{Code}%
 20.1463 +}
 20.1464 +\isamarkuptrue%
 20.1465 +%
 20.1466 +\begin{isamarkuptext}%
 20.1467 +This Pure module implements the core notions of
 20.1468 +  executable content of a theory.%
 20.1469 +\end{isamarkuptext}%
 20.1470 +\isamarkuptrue%
 20.1471 +%
 20.1472 +\isamarkupsubsubsection{Managing executable content%
 20.1473 +}
 20.1474 +\isamarkuptrue%
 20.1475 +%
 20.1476 +\isadelimmlref
 20.1477 +%
 20.1478 +\endisadelimmlref
 20.1479 +%
 20.1480 +\isatagmlref
 20.1481 +%
 20.1482 +\begin{isamarkuptext}%
 20.1483 +\begin{mldecls}
 20.1484 +  \indexml{Code.add\_func}\verb|Code.add_func: thm -> theory -> theory| \\
 20.1485 +  \indexml{Code.del\_func}\verb|Code.del_func: thm -> theory -> theory| \\
 20.1486 +  \indexml{Code.add\_funcl}\verb|Code.add_funcl: string * thm list Susp.T -> theory -> theory| \\
 20.1487 +  \indexml{Code.map\_pre}\verb|Code.map_pre: (MetaSimplifier.simpset -> MetaSimplifier.simpset) -> theory -> theory| \\
 20.1488 +  \indexml{Code.map\_post}\verb|Code.map_post: (MetaSimplifier.simpset -> MetaSimplifier.simpset) -> theory -> theory| \\
 20.1489 +  \indexml{Code.add\_functrans}\verb|Code.add_functrans: string * (theory -> thm list -> thm list option)|\isasep\isanewline%
 20.1490 +\verb|    -> theory -> theory| \\
 20.1491 +  \indexml{Code.del\_functrans}\verb|Code.del_functrans: string -> theory -> theory| \\
 20.1492 +  \indexml{Code.add\_datatype}\verb|Code.add_datatype: (string * typ) list -> theory -> theory| \\
 20.1493 +  \indexml{Code.get\_datatype}\verb|Code.get_datatype: theory -> string|\isasep\isanewline%
 20.1494 +\verb|    -> (string * sort) list * (string * typ list) list| \\
 20.1495 +  \indexml{Code.get\_datatype\_of\_constr}\verb|Code.get_datatype_of_constr: theory -> string -> string option|
 20.1496 +  \end{mldecls}
 20.1497 +
 20.1498 +  \begin{description}
 20.1499 +
 20.1500 +  \item \verb|Code.add_func|~\isa{thm}~\isa{thy} adds function
 20.1501 +     theorem \isa{thm} to executable content.
 20.1502 +
 20.1503 +  \item \verb|Code.del_func|~\isa{thm}~\isa{thy} removes function
 20.1504 +     theorem \isa{thm} from executable content, if present.
 20.1505 +
 20.1506 +  \item \verb|Code.add_funcl|~\isa{{\isacharparenleft}const{\isacharcomma}\ lthms{\isacharparenright}}~\isa{thy} adds
 20.1507 +     suspended defining equations \isa{lthms} for constant
 20.1508 +     \isa{const} to executable content.
 20.1509 +
 20.1510 +  \item \verb|Code.map_pre|~\isa{f}~\isa{thy} changes
 20.1511 +     the preprocessor simpset.
 20.1512 +
 20.1513 +  \item \verb|Code.add_functrans|~\isa{{\isacharparenleft}name{\isacharcomma}\ f{\isacharparenright}}~\isa{thy} adds
 20.1514 +     function transformer \isa{f} (named \isa{name}) to executable content;
 20.1515 +     \isa{f} is a transformer of the defining equations belonging
 20.1516 +     to a certain function definition, depending on the
 20.1517 +     current theory context.  Returning \isa{NONE} indicates that no
 20.1518 +     transformation took place;  otherwise, the whole process will be iterated
 20.1519 +     with the new defining equations.
 20.1520 +
 20.1521 +  \item \verb|Code.del_functrans|~\isa{name}~\isa{thy} removes
 20.1522 +     function transformer named \isa{name} from executable content.
 20.1523 +
 20.1524 +  \item \verb|Code.add_datatype|~\isa{cs}~\isa{thy} adds
 20.1525 +     a datatype to executable content, with generation
 20.1526 +     set \isa{cs}.
 20.1527 +
 20.1528 +  \item \verb|Code.get_datatype_of_constr|~\isa{thy}~\isa{const}
 20.1529 +     returns type constructor corresponding to
 20.1530 +     constructor \isa{const}; returns \isa{NONE}
 20.1531 +     if \isa{const} is no constructor.
 20.1532 +
 20.1533 +  \end{description}%
 20.1534 +\end{isamarkuptext}%
 20.1535 +\isamarkuptrue%
 20.1536 +%
 20.1537 +\endisatagmlref
 20.1538 +{\isafoldmlref}%
 20.1539 +%
 20.1540 +\isadelimmlref
 20.1541 +%
 20.1542 +\endisadelimmlref
 20.1543 +%
 20.1544 +\isamarkupsubsection{Auxiliary%
 20.1545 +}
 20.1546 +\isamarkuptrue%
 20.1547 +%
 20.1548 +\isadelimmlref
 20.1549 +%
 20.1550 +\endisadelimmlref
 20.1551 +%
 20.1552 +\isatagmlref
 20.1553 +%
 20.1554 +\begin{isamarkuptext}%
 20.1555 +\begin{mldecls}
 20.1556 +  \indexml{Code\_Unit.read\_const}\verb|Code_Unit.read_const: theory -> string -> string| \\
 20.1557 +  \indexml{Code\_Unit.head\_func}\verb|Code_Unit.head_func: thm -> string * ((string * sort) list * typ)| \\
 20.1558 +  \indexml{Code\_Unit.rewrite\_func}\verb|Code_Unit.rewrite_func: MetaSimplifier.simpset -> thm -> thm| \\
 20.1559 +  \end{mldecls}
 20.1560 +
 20.1561 +  \begin{description}
 20.1562 +
 20.1563 +  \item \verb|Code_Unit.read_const|~\isa{thy}~\isa{s}
 20.1564 +     reads a constant as a concrete term expression \isa{s}.
 20.1565 +
 20.1566 +  \item \verb|Code_Unit.head_func|~\isa{thm}
 20.1567 +     extracts the constant and its type from a defining equation \isa{thm}.
 20.1568 +
 20.1569 +  \item \verb|Code_Unit.rewrite_func|~\isa{ss}~\isa{thm}
 20.1570 +     rewrites a defining equation \isa{thm} with a simpset \isa{ss};
 20.1571 +     only arguments and right hand side are rewritten,
 20.1572 +     not the head of the defining equation.
 20.1573 +
 20.1574 +  \end{description}%
 20.1575 +\end{isamarkuptext}%
 20.1576 +\isamarkuptrue%
 20.1577 +%
 20.1578 +\endisatagmlref
 20.1579 +{\isafoldmlref}%
 20.1580 +%
 20.1581 +\isadelimmlref
 20.1582 +%
 20.1583 +\endisadelimmlref
 20.1584 +%
 20.1585 +\isamarkupsubsection{Implementing code generator applications%
 20.1586 +}
 20.1587 +\isamarkuptrue%
 20.1588 +%
 20.1589 +\begin{isamarkuptext}%
 20.1590 +Implementing code generator applications on top
 20.1591 +  of the framework set out so far usually not only
 20.1592 +  involves using those primitive interfaces
 20.1593 +  but also storing code-dependent data and various
 20.1594 +  other things.
 20.1595 +
 20.1596 +  \begin{warn}
 20.1597 +    Some interfaces discussed here have not reached
 20.1598 +    a final state yet.
 20.1599 +    Changes likely to occur in future.
 20.1600 +  \end{warn}%
 20.1601 +\end{isamarkuptext}%
 20.1602 +\isamarkuptrue%
 20.1603 +%
 20.1604 +\isamarkupsubsubsection{Data depending on the theory's executable content%
 20.1605 +}
 20.1606 +\isamarkuptrue%
 20.1607 +%
 20.1608 +\begin{isamarkuptext}%
 20.1609 +Due to incrementality of code generation, changes in the
 20.1610 +  theory's executable content have to be propagated in a
 20.1611 +  certain fashion.  Additionally, such changes may occur
 20.1612 +  not only during theory extension but also during theory
 20.1613 +  merge, which is a little bit nasty from an implementation
 20.1614 +  point of view.  The framework provides a solution
 20.1615 +  to this technical challenge by providing a functorial
 20.1616 +  data slot \verb|CodeDataFun|; on instantiation
 20.1617 +  of this functor, the following types and operations
 20.1618 +  are required:
 20.1619 +
 20.1620 +  \medskip
 20.1621 +  \begin{tabular}{l}
 20.1622 +  \isa{type\ T} \\
 20.1623 +  \isa{val\ empty{\isacharcolon}\ T} \\
 20.1624 +  \isa{val\ merge{\isacharcolon}\ Pretty{\isachardot}pp\ {\isasymrightarrow}\ T\ {\isacharasterisk}\ T\ {\isasymrightarrow}\ T} \\
 20.1625 +  \isa{val\ purge{\isacharcolon}\ theory\ option\ {\isasymrightarrow}\ CodeUnit{\isachardot}const\ list\ option\ {\isasymrightarrow}\ T\ {\isasymrightarrow}\ T}
 20.1626 +  \end{tabular}
 20.1627 +
 20.1628 +  \begin{description}
 20.1629 +
 20.1630 +  \item \isa{T} the type of data to store.
 20.1631 +
 20.1632 +  \item \isa{empty} initial (empty) data.
 20.1633 +
 20.1634 +  \item \isa{merge} merging two data slots.
 20.1635 +
 20.1636 +  \item \isa{purge}~\isa{thy}~\isa{consts} propagates changes in executable content;
 20.1637 +    if possible, the current theory context is handed over
 20.1638 +    as argument \isa{thy} (if there is no current theory context (e.g.~during
 20.1639 +    theory merge, \verb|NONE|); \isa{consts} indicates the kind
 20.1640 +    of change: \verb|NONE| stands for a fundamental change
 20.1641 +    which invalidates any existing code, \isa{SOME\ consts}
 20.1642 +    hints that executable content for constants \isa{consts}
 20.1643 +    has changed.
 20.1644 +
 20.1645 +  \end{description}
 20.1646 +
 20.1647 +  An instance of \verb|CodeDataFun| provides the following
 20.1648 +  interface:
 20.1649 +
 20.1650 +  \medskip
 20.1651 +  \begin{tabular}{l}
 20.1652 +  \isa{get{\isacharcolon}\ theory\ {\isasymrightarrow}\ T} \\
 20.1653 +  \isa{change{\isacharcolon}\ theory\ {\isasymrightarrow}\ {\isacharparenleft}T\ {\isasymrightarrow}\ T{\isacharparenright}\ {\isasymrightarrow}\ T} \\
 20.1654 +  \isa{change{\isacharunderscore}yield{\isacharcolon}\ theory\ {\isasymrightarrow}\ {\isacharparenleft}T\ {\isasymrightarrow}\ {\isacharprime}a\ {\isacharasterisk}\ T{\isacharparenright}\ {\isasymrightarrow}\ {\isacharprime}a\ {\isacharasterisk}\ T}
 20.1655 +  \end{tabular}
 20.1656 +
 20.1657 +  \begin{description}
 20.1658 +
 20.1659 +  \item \isa{get} retrieval of the current data.
 20.1660 +
 20.1661 +  \item \isa{change} update of current data (cached!)
 20.1662 +    by giving a continuation.
 20.1663 +
 20.1664 +  \item \isa{change{\isacharunderscore}yield} update with side result.
 20.1665 +
 20.1666 +  \end{description}%
 20.1667 +\end{isamarkuptext}%
 20.1668 +\isamarkuptrue%
 20.1669 +%
 20.1670 +\begin{isamarkuptext}%
 20.1671 +\emph{Happy proving, happy hacking!}%
 20.1672 +\end{isamarkuptext}%
 20.1673 +\isamarkuptrue%
 20.1674 +%
 20.1675 +\isadelimtheory
 20.1676 +%
 20.1677 +\endisadelimtheory
 20.1678 +%
 20.1679 +\isatagtheory
 20.1680 +\isacommand{end}\isamarkupfalse%
 20.1681 +%
 20.1682 +\endisatagtheory
 20.1683 +{\isafoldtheory}%
 20.1684 +%
 20.1685 +\isadelimtheory
 20.1686 +%
 20.1687 +\endisadelimtheory
 20.1688 +\isanewline
 20.1689 +\end{isabellebody}%
 20.1690 +%%% Local Variables:
 20.1691 +%%% mode: latex
 20.1692 +%%% TeX-master: "root"
 20.1693 +%%% End:
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/doc-src/Codegen/Thy/document/Further.tex	Tue Mar 03 11:00:51 2009 +0100
    21.3 @@ -0,0 +1,234 @@
    21.4 +%
    21.5 +\begin{isabellebody}%
    21.6 +\def\isabellecontext{Further}%
    21.7 +%
    21.8 +\isadelimtheory
    21.9 +%
   21.10 +\endisadelimtheory
   21.11 +%
   21.12 +\isatagtheory
   21.13 +\isacommand{theory}\isamarkupfalse%
   21.14 +\ Further\isanewline
   21.15 +\isakeyword{imports}\ Setup\isanewline
   21.16 +\isakeyword{begin}%
   21.17 +\endisatagtheory
   21.18 +{\isafoldtheory}%
   21.19 +%
   21.20 +\isadelimtheory
   21.21 +%
   21.22 +\endisadelimtheory
   21.23 +%
   21.24 +\isamarkupsection{Further issues \label{sec:further}%
   21.25 +}
   21.26 +\isamarkuptrue%
   21.27 +%
   21.28 +\isamarkupsubsection{Further reading%
   21.29 +}
   21.30 +\isamarkuptrue%
   21.31 +%
   21.32 +\begin{isamarkuptext}%
   21.33 +Do dive deeper into the issue of code generation, you should visit
   21.34 +  the Isabelle/Isar Reference Manual \cite{isabelle-isar-ref} which
   21.35 +  contains exhaustive syntax diagrams.%
   21.36 +\end{isamarkuptext}%
   21.37 +\isamarkuptrue%
   21.38 +%
   21.39 +\isamarkupsubsection{Modules%
   21.40 +}
   21.41 +\isamarkuptrue%
   21.42 +%
   21.43 +\begin{isamarkuptext}%
   21.44 +When invoking the \hyperlink{command.export-code}{\mbox{\isa{\isacommand{export{\isacharunderscore}code}}}} command it is possible to leave
   21.45 +  out the \hyperlink{keyword.module-name}{\mbox{\isa{\isakeyword{module{\isacharunderscore}name}}}} part;  then code is distributed over
   21.46 +  different modules, where the module name space roughly is induced
   21.47 +  by the \isa{Isabelle} theory name space.
   21.48 +
   21.49 +  Then sometimes the awkward situation occurs that dependencies between
   21.50 +  definitions introduce cyclic dependencies between modules, which in the
   21.51 +  \isa{Haskell} world leaves you to the mercy of the \isa{Haskell} implementation
   21.52 +  you are using,  while for \isa{SML}/\isa{OCaml} code generation is not possible.
   21.53 +
   21.54 +  A solution is to declare module names explicitly.
   21.55 +  Let use assume the three cyclically dependent
   21.56 +  modules are named \emph{A}, \emph{B} and \emph{C}.
   21.57 +  Then, by stating%
   21.58 +\end{isamarkuptext}%
   21.59 +\isamarkuptrue%
   21.60 +%
   21.61 +\isadelimquote
   21.62 +%
   21.63 +\endisadelimquote
   21.64 +%
   21.65 +\isatagquote
   21.66 +\isacommand{code{\isacharunderscore}modulename}\isamarkupfalse%
   21.67 +\ SML\isanewline
   21.68 +\ \ A\ ABC\isanewline
   21.69 +\ \ B\ ABC\isanewline
   21.70 +\ \ C\ ABC%
   21.71 +\endisatagquote
   21.72 +{\isafoldquote}%
   21.73 +%
   21.74 +\isadelimquote
   21.75 +%
   21.76 +\endisadelimquote
   21.77 +%
   21.78 +\begin{isamarkuptext}%
   21.79 +we explicitly map all those modules on \emph{ABC},
   21.80 +  resulting in an ad-hoc merge of this three modules
   21.81 +  at serialisation time.%
   21.82 +\end{isamarkuptext}%
   21.83 +\isamarkuptrue%
   21.84 +%
   21.85 +\isamarkupsubsection{Evaluation oracle%
   21.86 +}
   21.87 +\isamarkuptrue%
   21.88 +%
   21.89 +\begin{isamarkuptext}%
   21.90 +Code generation may also be used to \emph{evaluate} expressions
   21.91 +  (using \isa{SML} as target language of course).
   21.92 +  For instance, the \hyperlink{command.value}{\mbox{\isa{\isacommand{value}}}} allows to reduce an expression to a
   21.93 +  normal form with respect to the underlying code equations:%
   21.94 +\end{isamarkuptext}%
   21.95 +\isamarkuptrue%
   21.96 +%
   21.97 +\isadelimquote
   21.98 +%
   21.99 +\endisadelimquote
  21.100 +%
  21.101 +\isatagquote
  21.102 +\isacommand{value}\isamarkupfalse%
  21.103 +\ {\isachardoublequoteopen}{\isadigit{4}}{\isadigit{2}}\ {\isacharslash}\ {\isacharparenleft}{\isadigit{1}}{\isadigit{2}}\ {\isacharcolon}{\isacharcolon}\ rat{\isacharparenright}{\isachardoublequoteclose}%
  21.104 +\endisatagquote
  21.105 +{\isafoldquote}%
  21.106 +%
  21.107 +\isadelimquote
  21.108 +%
  21.109 +\endisadelimquote
  21.110 +%
  21.111 +\begin{isamarkuptext}%
  21.112 +\noindent will display \isa{{\isadigit{7}}\ {\isacharslash}\ {\isadigit{2}}}.
  21.113 +
  21.114 +  The \hyperlink{method.eval}{\mbox{\isa{eval}}} method tries to reduce a goal by code generation to \isa{True}
  21.115 +  and solves it in that case, but fails otherwise:%
  21.116 +\end{isamarkuptext}%
  21.117 +\isamarkuptrue%
  21.118 +%
  21.119 +\isadelimquote
  21.120 +%
  21.121 +\endisadelimquote
  21.122 +%
  21.123 +\isatagquote
  21.124 +\isacommand{lemma}\isamarkupfalse%
  21.125 +\ {\isachardoublequoteopen}{\isadigit{4}}{\isadigit{2}}\ {\isacharslash}\ {\isacharparenleft}{\isadigit{1}}{\isadigit{2}}\ {\isacharcolon}{\isacharcolon}\ rat{\isacharparenright}\ {\isacharequal}\ {\isadigit{7}}\ {\isacharslash}\ {\isadigit{2}}{\isachardoublequoteclose}\isanewline
  21.126 +\ \ \isacommand{by}\isamarkupfalse%
  21.127 +\ eval%
  21.128 +\endisatagquote
  21.129 +{\isafoldquote}%
  21.130 +%
  21.131 +\isadelimquote
  21.132 +%
  21.133 +\endisadelimquote
  21.134 +%
  21.135 +\begin{isamarkuptext}%
  21.136 +\noindent The soundness of the \hyperlink{method.eval}{\mbox{\isa{eval}}} method depends crucially 
  21.137 +  on the correctness of the code generator;  this is one of the reasons
  21.138 +  why you should not use adaption (see \secref{sec:adaption}) frivolously.%
  21.139 +\end{isamarkuptext}%
  21.140 +\isamarkuptrue%
  21.141 +%
  21.142 +\isamarkupsubsection{Code antiquotation%
  21.143 +}
  21.144 +\isamarkuptrue%
  21.145 +%
  21.146 +\begin{isamarkuptext}%
  21.147 +In scenarios involving techniques like reflection it is quite common
  21.148 +  that code generated from a theory forms the basis for implementing
  21.149 +  a proof procedure in \isa{SML}.  To facilitate interfacing of generated code
  21.150 +  with system code, the code generator provides a \isa{code} antiquotation:%
  21.151 +\end{isamarkuptext}%
  21.152 +\isamarkuptrue%
  21.153 +%
  21.154 +\isadelimquote
  21.155 +%
  21.156 +\endisadelimquote
  21.157 +%
  21.158 +\isatagquote
  21.159 +\isacommand{datatype}\isamarkupfalse%
  21.160 +\ form\ {\isacharequal}\ T\ {\isacharbar}\ F\ {\isacharbar}\ And\ form\ form\ {\isacharbar}\ Or\ form\ form\isanewline
  21.161 +\isanewline
  21.162 +\isacommand{ML}\isamarkupfalse%
  21.163 +\ {\isacharverbatimopen}\isanewline
  21.164 +\ \ fun\ eval{\isacharunderscore}form\ %
  21.165 +\isaantiq
  21.166 +code\ T%
  21.167 +\endisaantiq
  21.168 +\ {\isacharequal}\ true\isanewline
  21.169 +\ \ \ \ {\isacharbar}\ eval{\isacharunderscore}form\ %
  21.170 +\isaantiq
  21.171 +code\ F%
  21.172 +\endisaantiq
  21.173 +\ {\isacharequal}\ false\isanewline
  21.174 +\ \ \ \ {\isacharbar}\ eval{\isacharunderscore}form\ {\isacharparenleft}%
  21.175 +\isaantiq
  21.176 +code\ And%
  21.177 +\endisaantiq
  21.178 +\ {\isacharparenleft}p{\isacharcomma}\ q{\isacharparenright}{\isacharparenright}\ {\isacharequal}\isanewline
  21.179 +\ \ \ \ \ \ \ \ eval{\isacharunderscore}form\ p\ andalso\ eval{\isacharunderscore}form\ q\isanewline
  21.180 +\ \ \ \ {\isacharbar}\ eval{\isacharunderscore}form\ {\isacharparenleft}%
  21.181 +\isaantiq
  21.182 +code\ Or%
  21.183 +\endisaantiq
  21.184 +\ {\isacharparenleft}p{\isacharcomma}\ q{\isacharparenright}{\isacharparenright}\ {\isacharequal}\isanewline
  21.185 +\ \ \ \ \ \ \ \ eval{\isacharunderscore}form\ p\ orelse\ eval{\isacharunderscore}form\ q{\isacharsemicolon}\isanewline
  21.186 +{\isacharverbatimclose}%
  21.187 +\endisatagquote
  21.188 +{\isafoldquote}%
  21.189 +%
  21.190 +\isadelimquote
  21.191 +%
  21.192 +\endisadelimquote
  21.193 +%
  21.194 +\begin{isamarkuptext}%
  21.195 +\noindent \isa{code} takes as argument the name of a constant;  after the
  21.196 +  whole \isa{SML} is read, the necessary code is generated transparently
  21.197 +  and the corresponding constant names are inserted.  This technique also
  21.198 +  allows to use pattern matching on constructors stemming from compiled
  21.199 +  \isa{datatypes}.
  21.200 +
  21.201 +  For a less simplistic example, theory \hyperlink{theory.Ferrack}{\mbox{\isa{Ferrack}}} is
  21.202 +  a good reference.%
  21.203 +\end{isamarkuptext}%
  21.204 +\isamarkuptrue%
  21.205 +%
  21.206 +\isamarkupsubsection{Imperative data structures%
  21.207 +}
  21.208 +\isamarkuptrue%
  21.209 +%
  21.210 +\begin{isamarkuptext}%
  21.211 +If you consider imperative data structures as inevitable for a specific
  21.212 +  application, you should consider
  21.213 +  \emph{Imperative Functional Programming with Isabelle/HOL}
  21.214 +  (\cite{bulwahn-et-al:2008:imperative});
  21.215 +  the framework described there is available in theory \hyperlink{theory.Imperative-HOL}{\mbox{\isa{Imperative{\isacharunderscore}HOL}}}.%
  21.216 +\end{isamarkuptext}%
  21.217 +\isamarkuptrue%
  21.218 +%
  21.219 +\isadelimtheory
  21.220 +%
  21.221 +\endisadelimtheory
  21.222 +%
  21.223 +\isatagtheory
  21.224 +\isacommand{end}\isamarkupfalse%
  21.225 +%
  21.226 +\endisatagtheory
  21.227 +{\isafoldtheory}%
  21.228 +%
  21.229 +\isadelimtheory
  21.230 +%
  21.231 +\endisadelimtheory
  21.232 +\isanewline
  21.233 +\end{isabellebody}%
  21.234 +%%% Local Variables:
  21.235 +%%% mode: latex
  21.236 +%%% TeX-master: "root"
  21.237 +%%% End:
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/doc-src/Codegen/Thy/document/Introduction.tex	Tue Mar 03 11:00:51 2009 +0100
    22.3 @@ -0,0 +1,390 @@
    22.4 +%
    22.5 +\begin{isabellebody}%
    22.6 +\def\isabellecontext{Introduction}%
    22.7 +%
    22.8 +\isadelimtheory
    22.9 +%
   22.10 +\endisadelimtheory
   22.11 +%
   22.12 +\isatagtheory
   22.13 +\isacommand{theory}\isamarkupfalse%
   22.14 +\ Introduction\isanewline
   22.15 +\isakeyword{imports}\ Setup\isanewline
   22.16 +\isakeyword{begin}%
   22.17 +\endisatagtheory
   22.18 +{\isafoldtheory}%
   22.19 +%
   22.20 +\isadelimtheory
   22.21 +%
   22.22 +\endisadelimtheory
   22.23 +%
   22.24 +\isamarkupchapter{Code generation from \isa{Isabelle{\isacharslash}HOL} theories%
   22.25 +}
   22.26 +\isamarkuptrue%
   22.27 +%
   22.28 +\isamarkupsection{Introduction and Overview%
   22.29 +}
   22.30 +\isamarkuptrue%
   22.31 +%
   22.32 +\begin{isamarkuptext}%
   22.33 +This tutorial introduces a generic code generator for the
   22.34 +  \isa{Isabelle} system.
   22.35 +  Generic in the sense that the
   22.36 +  \qn{target language} for which code shall ultimately be
   22.37 +  generated is not fixed but may be an arbitrary state-of-the-art
   22.38 +  functional programming language (currently, the implementation
   22.39 +  supports \isa{SML} \cite{SML}, \isa{OCaml} \cite{OCaml} and \isa{Haskell}
   22.40 +  \cite{haskell-revised-report}).
   22.41 +
   22.42 +  Conceptually the code generator framework is part
   22.43 +  of Isabelle's \hyperlink{theory.Pure}{\mbox{\isa{Pure}}} meta logic framework; the logic
   22.44 +  \hyperlink{theory.HOL}{\mbox{\isa{HOL}}} which is an extension of \hyperlink{theory.Pure}{\mbox{\isa{Pure}}}
   22.45 +  already comes with a reasonable framework setup and thus provides
   22.46 +  a good working horse for raising code-generation-driven
   22.47 +  applications.  So, we assume some familiarity and experience
   22.48 +  with the ingredients of the \hyperlink{theory.HOL}{\mbox{\isa{HOL}}} distribution theories.
   22.49 +  (see also \cite{isa-tutorial}).
   22.50 +
   22.51 +  The code generator aims to be usable with no further ado
   22.52 +  in most cases while allowing for detailed customisation.
   22.53 +  This manifests in the structure of this tutorial: after a short
   22.54 +  conceptual introduction with an example (\secref{sec:intro}),
   22.55 +  we discuss the generic customisation facilities (\secref{sec:program}).
   22.56 +  A further section (\secref{sec:adaption}) is dedicated to the matter of
   22.57 +  \qn{adaption} to specific target language environments.  After some
   22.58 +  further issues (\secref{sec:further}) we conclude with an overview
   22.59 +  of some ML programming interfaces (\secref{sec:ml}).
   22.60 +
   22.61 +  \begin{warn}
   22.62 +    Ultimately, the code generator which this tutorial deals with
   22.63 +    is supposed to replace the existing code generator
   22.64 +    by Stefan Berghofer \cite{Berghofer-Nipkow:2002}.
   22.65 +    So, for the moment, there are two distinct code generators
   22.66 +    in Isabelle.  In case of ambiguity, we will refer to the framework
   22.67 +    described here as \isa{generic\ code\ generator}, to the
   22.68 +    other as \isa{SML\ code\ generator}.
   22.69 +    Also note that while the framework itself is
   22.70 +    object-logic independent, only \hyperlink{theory.HOL}{\mbox{\isa{HOL}}} provides a reasonable
   22.71 +    framework setup.    
   22.72 +  \end{warn}%
   22.73 +\end{isamarkuptext}%
   22.74 +\isamarkuptrue%
   22.75 +%
   22.76 +\isamarkupsubsection{Code generation via shallow embedding \label{sec:intro}%
   22.77 +}
   22.78 +\isamarkuptrue%
   22.79 +%
   22.80 +\begin{isamarkuptext}%
   22.81 +The key concept for understanding \isa{Isabelle}'s code generation is
   22.82 +  \emph{shallow embedding}, i.e.~logical entities like constants, types and
   22.83 +  classes are identified with corresponding concepts in the target language.
   22.84 +
   22.85 +  Inside \hyperlink{theory.HOL}{\mbox{\isa{HOL}}}, the \hyperlink{command.datatype}{\mbox{\isa{\isacommand{datatype}}}} and
   22.86 +  \hyperlink{command.definition}{\mbox{\isa{\isacommand{definition}}}}/\hyperlink{command.primrec}{\mbox{\isa{\isacommand{primrec}}}}/\hyperlink{command.fun}{\mbox{\isa{\isacommand{fun}}}} declarations form
   22.87 +  the core of a functional programming language.  The default code generator setup
   22.88 +  allows to turn those into functional programs immediately.
   22.89 +  This means that \qt{naive} code generation can proceed without further ado.
   22.90 +  For example, here a simple \qt{implementation} of amortised queues:%
   22.91 +\end{isamarkuptext}%
   22.92 +\isamarkuptrue%
   22.93 +%
   22.94 +\isadelimquote
   22.95 +%
   22.96 +\endisadelimquote
   22.97 +%
   22.98 +\isatagquote
   22.99 +\isacommand{datatype}\isamarkupfalse%
  22.100 +\ {\isacharprime}a\ queue\ {\isacharequal}\ AQueue\ {\isachardoublequoteopen}{\isacharprime}a\ list{\isachardoublequoteclose}\ {\isachardoublequoteopen}{\isacharprime}a\ list{\isachardoublequoteclose}\isanewline
  22.101 +\isanewline
  22.102 +\isacommand{definition}\isamarkupfalse%
  22.103 +\ empty\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a\ queue{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  22.104 +\ \ {\isachardoublequoteopen}empty\ {\isacharequal}\ AQueue\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharbrackleft}{\isacharbrackright}{\isachardoublequoteclose}\isanewline
  22.105 +\isanewline
  22.106 +\isacommand{primrec}\isamarkupfalse%
  22.107 +\ enqueue\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a\ queue\ {\isasymRightarrow}\ {\isacharprime}a\ queue{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  22.108 +\ \ {\isachardoublequoteopen}enqueue\ x\ {\isacharparenleft}AQueue\ xs\ ys{\isacharparenright}\ {\isacharequal}\ AQueue\ {\isacharparenleft}x\ {\isacharhash}\ xs{\isacharparenright}\ ys{\isachardoublequoteclose}\isanewline
  22.109 +\isanewline
  22.110 +\isacommand{fun}\isamarkupfalse%
  22.111 +\ dequeue\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a\ queue\ {\isasymRightarrow}\ {\isacharprime}a\ option\ {\isasymtimes}\ {\isacharprime}a\ queue{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  22.112 +\ \ \ \ {\isachardoublequoteopen}dequeue\ {\isacharparenleft}AQueue\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharbrackleft}{\isacharbrackright}{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}None{\isacharcomma}\ AQueue\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharbrackleft}{\isacharbrackright}{\isacharparenright}{\isachardoublequoteclose}\isanewline
  22.113 +\ \ {\isacharbar}\ {\isachardoublequoteopen}dequeue\ {\isacharparenleft}AQueue\ xs\ {\isacharparenleft}y\ {\isacharhash}\ ys{\isacharparenright}{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}Some\ y{\isacharcomma}\ AQueue\ xs\ ys{\isacharparenright}{\isachardoublequoteclose}\isanewline
  22.114 +\ \ {\isacharbar}\ {\isachardoublequoteopen}dequeue\ {\isacharparenleft}AQueue\ xs\ {\isacharbrackleft}{\isacharbrackright}{\isacharparenright}\ {\isacharequal}\isanewline
  22.115 +\ \ \ \ \ \ {\isacharparenleft}case\ rev\ xs\ of\ y\ {\isacharhash}\ ys\ {\isasymRightarrow}\ {\isacharparenleft}Some\ y{\isacharcomma}\ AQueue\ {\isacharbrackleft}{\isacharbrackright}\ ys{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}%
  22.116 +\endisatagquote
  22.117 +{\isafoldquote}%
  22.118 +%
  22.119 +\isadelimquote
  22.120 +%
  22.121 +\endisadelimquote
  22.122 +%
  22.123 +\begin{isamarkuptext}%
  22.124 +\noindent Then we can generate code e.g.~for \isa{SML} as follows:%
  22.125 +\end{isamarkuptext}%
  22.126 +\isamarkuptrue%
  22.127 +%
  22.128 +\isadelimquote
  22.129 +%
  22.130 +\endisadelimquote
  22.131 +%
  22.132 +\isatagquote
  22.133 +\isacommand{export{\isacharunderscore}code}\isamarkupfalse%
  22.134 +\ empty\ dequeue\ enqueue\ \isakeyword{in}\ SML\isanewline
  22.135 +\ \ \isakeyword{module{\isacharunderscore}name}\ Example\ \isakeyword{file}\ {\isachardoublequoteopen}examples{\isacharslash}example{\isachardot}ML{\isachardoublequoteclose}%
  22.136 +\endisatagquote
  22.137 +{\isafoldquote}%
  22.138 +%
  22.139 +\isadelimquote
  22.140 +%
  22.141 +\endisadelimquote
  22.142 +%
  22.143 +\begin{isamarkuptext}%
  22.144 +\noindent resulting in the following code:%
  22.145 +\end{isamarkuptext}%
  22.146 +\isamarkuptrue%
  22.147 +%
  22.148 +\isadelimquote
  22.149 +%
  22.150 +\endisadelimquote
  22.151 +%
  22.152 +\isatagquote
  22.153 +%
  22.154 +\begin{isamarkuptext}%
  22.155 +\isatypewriter%
  22.156 +\noindent%
  22.157 +\hspace*{0pt}structure Example = \\
  22.158 +\hspace*{0pt}struct\\
  22.159 +\hspace*{0pt}\\
  22.160 +\hspace*{0pt}fun foldl f a [] = a\\
  22.161 +\hspace*{0pt} ~| foldl f a (x ::~xs) = foldl f (f a x) xs;\\
  22.162 +\hspace*{0pt}\\
  22.163 +\hspace*{0pt}fun rev xs = foldl (fn xsa => fn x => x ::~xsa) [] xs;\\
  22.164 +\hspace*{0pt}\\
  22.165 +\hspace*{0pt}fun list{\char95}case f1 f2 (a ::~lista) = f2 a lista\\
  22.166 +\hspace*{0pt} ~| list{\char95}case f1 f2 [] = f1;\\
  22.167 +\hspace*{0pt}\\
  22.168 +\hspace*{0pt}datatype 'a queue = AQueue of 'a list * 'a list;\\
  22.169 +\hspace*{0pt}\\
  22.170 +\hspace*{0pt}val empty :~'a queue = AQueue ([],~[])\\
  22.171 +\hspace*{0pt}\\
  22.172 +\hspace*{0pt}fun dequeue (AQueue ([],~[])) = (NONE,~AQueue ([],~[]))\\
  22.173 +\hspace*{0pt} ~| dequeue (AQueue (xs,~y ::~ys)) = (SOME y,~AQueue (xs,~ys))\\
  22.174 +\hspace*{0pt} ~| dequeue (AQueue (v ::~va,~[])) =\\
  22.175 +\hspace*{0pt} ~~~let\\
  22.176 +\hspace*{0pt} ~~~~~val y ::~ys = rev (v ::~va);\\
  22.177 +\hspace*{0pt} ~~~in\\
  22.178 +\hspace*{0pt} ~~~~~(SOME y,~AQueue ([],~ys))\\
  22.179 +\hspace*{0pt} ~~~end;\\
  22.180 +\hspace*{0pt}\\
  22.181 +\hspace*{0pt}fun enqueue x (AQueue (xs,~ys)) = AQueue (x ::~xs,~ys);\\
  22.182 +\hspace*{0pt}\\
  22.183 +\hspace*{0pt}end;~(*struct Example*)%
  22.184 +\end{isamarkuptext}%
  22.185 +\isamarkuptrue%
  22.186 +%
  22.187 +\endisatagquote
  22.188 +{\isafoldquote}%
  22.189 +%
  22.190 +\isadelimquote
  22.191 +%
  22.192 +\endisadelimquote
  22.193 +%
  22.194 +\begin{isamarkuptext}%
  22.195 +\noindent The \hyperlink{command.export-code}{\mbox{\isa{\isacommand{export{\isacharunderscore}code}}}} command takes a space-separated list of
  22.196 +  constants for which code shall be generated;  anything else needed for those
  22.197 +  is added implicitly.  Then follows a target language identifier
  22.198 +  (\isa{SML}, \isa{OCaml} or \isa{Haskell}) and a freely chosen module name.
  22.199 +  A file name denotes the destination to store the generated code.  Note that
  22.200 +  the semantics of the destination depends on the target language:  for
  22.201 +  \isa{SML} and \isa{OCaml} it denotes a \emph{file}, for \isa{Haskell}
  22.202 +  it denotes a \emph{directory} where a file named as the module name
  22.203 +  (with extension \isa{{\isachardot}hs}) is written:%
  22.204 +\end{isamarkuptext}%
  22.205 +\isamarkuptrue%
  22.206 +%
  22.207 +\isadelimquote
  22.208 +%
  22.209 +\endisadelimquote
  22.210 +%
  22.211 +\isatagquote
  22.212 +\isacommand{export{\isacharunderscore}code}\isamarkupfalse%
  22.213 +\ empty\ dequeue\ enqueue\ \isakeyword{in}\ Haskell\isanewline
  22.214 +\ \ \isakeyword{module{\isacharunderscore}name}\ Example\ \isakeyword{file}\ {\isachardoublequoteopen}examples{\isacharslash}{\isachardoublequoteclose}%
  22.215 +\endisatagquote
  22.216 +{\isafoldquote}%
  22.217 +%
  22.218 +\isadelimquote
  22.219 +%
  22.220 +\endisadelimquote
  22.221 +%
  22.222 +\begin{isamarkuptext}%
  22.223 +\noindent This is how the corresponding code in \isa{Haskell} looks like:%
  22.224 +\end{isamarkuptext}%
  22.225 +\isamarkuptrue%
  22.226 +%
  22.227 +\isadelimquote
  22.228 +%
  22.229 +\endisadelimquote
  22.230 +%
  22.231 +\isatagquote
  22.232 +%
  22.233 +\begin{isamarkuptext}%
  22.234 +\isatypewriter%
  22.235 +\noindent%
  22.236 +\hspace*{0pt}module Example where {\char123}\\
  22.237 +\hspace*{0pt}\\
  22.238 +\hspace*{0pt}\\
  22.239 +\hspace*{0pt}foldla ::~forall a b.~(a -> b -> a) -> a -> [b] -> a;\\
  22.240 +\hspace*{0pt}foldla f a [] = a;\\
  22.241 +\hspace*{0pt}foldla f a (x :~xs) = foldla f (f a x) xs;\\
  22.242 +\hspace*{0pt}\\
  22.243 +\hspace*{0pt}rev ::~forall a.~[a] -> [a];\\
  22.244 +\hspace*{0pt}rev xs = foldla ({\char92}~xsa x -> x :~xsa) [] xs;\\
  22.245 +\hspace*{0pt}\\
  22.246 +\hspace*{0pt}list{\char95}case ::~forall t a.~t -> (a -> [a] -> t) -> [a] -> t;\\
  22.247 +\hspace*{0pt}list{\char95}case f1 f2 (a :~list) = f2 a list;\\
  22.248 +\hspace*{0pt}list{\char95}case f1 f2 [] = f1;\\
  22.249 +\hspace*{0pt}\\
  22.250 +\hspace*{0pt}data Queue a = AQueue [a] [a];\\
  22.251 +\hspace*{0pt}\\
  22.252 +\hspace*{0pt}empty ::~forall a.~Queue a;\\
  22.253 +\hspace*{0pt}empty = AQueue [] [];\\
  22.254 +\hspace*{0pt}\\
  22.255 +\hspace*{0pt}dequeue ::~forall a.~Queue a -> (Maybe a,~Queue a);\\
  22.256 +\hspace*{0pt}dequeue (AQueue [] []) = (Nothing,~AQueue [] []);\\
  22.257 +\hspace*{0pt}dequeue (AQueue xs (y :~ys)) = (Just y,~AQueue xs ys);\\
  22.258 +\hspace*{0pt}dequeue (AQueue (v :~va) []) =\\
  22.259 +\hspace*{0pt} ~let {\char123}\\
  22.260 +\hspace*{0pt} ~~~(y :~ys) = rev (v :~va);\\
  22.261 +\hspace*{0pt} ~{\char125}~in (Just y,~AQueue [] ys);\\
  22.262 +\hspace*{0pt}\\
  22.263 +\hspace*{0pt}enqueue ::~forall a.~a -> Queue a -> Queue a;\\
  22.264 +\hspace*{0pt}enqueue x (AQueue xs ys) = AQueue (x :~xs) ys;\\
  22.265 +\hspace*{0pt}\\
  22.266 +\hspace*{0pt}{\char125}%
  22.267 +\end{isamarkuptext}%
  22.268 +\isamarkuptrue%
  22.269 +%
  22.270 +\endisatagquote
  22.271 +{\isafoldquote}%
  22.272 +%
  22.273 +\isadelimquote
  22.274 +%
  22.275 +\endisadelimquote
  22.276 +%
  22.277 +\begin{isamarkuptext}%
  22.278 +\noindent This demonstrates the basic usage of the \hyperlink{command.export-code}{\mbox{\isa{\isacommand{export{\isacharunderscore}code}}}} command;
  22.279 +  for more details see \secref{sec:further}.%
  22.280 +\end{isamarkuptext}%
  22.281 +\isamarkuptrue%
  22.282 +%
  22.283 +\isamarkupsubsection{Code generator architecture \label{sec:concept}%
  22.284 +}
  22.285 +\isamarkuptrue%
  22.286 +%
  22.287 +\begin{isamarkuptext}%
  22.288 +What you have seen so far should be already enough in a lot of cases.  If you
  22.289 +  are content with this, you can quit reading here.  Anyway, in order to customise
  22.290 +  and adapt the code generator, it is inevitable to gain some understanding
  22.291 +  how it works.
  22.292 +
  22.293 +  \begin{figure}[h]
  22.294 +    \begin{tikzpicture}[x = 4.2cm, y = 1cm]
  22.295 +      \tikzstyle entity=[rounded corners, draw, thick, color = black, fill = white];
  22.296 +      \tikzstyle process=[ellipse, draw, thick, color = green, fill = white];
  22.297 +      \tikzstyle process_arrow=[->, semithick, color = green];
  22.298 +      \node (HOL) at (0, 4) [style=entity] {\isa{Isabelle{\isacharslash}HOL} theory};
  22.299 +      \node (eqn) at (2, 2) [style=entity] {code equations};
  22.300 +      \node (iml) at (2, 0) [style=entity] {intermediate language};
  22.301 +      \node (seri) at (1, 0) [style=process] {serialisation};
  22.302 +      \node (SML) at (0, 3) [style=entity] {\isa{SML}};
  22.303 +      \node (OCaml) at (0, 2) [style=entity] {\isa{OCaml}};
  22.304 +      \node (further) at (0, 1) [style=entity] {\isa{{\isasymdots}}};
  22.305 +      \node (Haskell) at (0, 0) [style=entity] {\isa{Haskell}};
  22.306 +      \draw [style=process_arrow] (HOL) .. controls (2, 4) ..
  22.307 +        node [style=process, near start] {selection}
  22.308 +        node [style=process, near end] {preprocessing}
  22.309 +        (eqn);
  22.310 +      \draw [style=process_arrow] (eqn) -- node (transl) [style=process] {translation} (iml);
  22.311 +      \draw [style=process_arrow] (iml) -- (seri);
  22.312 +      \draw [style=process_arrow] (seri) -- (SML);
  22.313 +      \draw [style=process_arrow] (seri) -- (OCaml);
  22.314 +      \draw [style=process_arrow, dashed] (seri) -- (further);
  22.315 +      \draw [style=process_arrow] (seri) -- (Haskell);
  22.316 +    \end{tikzpicture}
  22.317 +    \caption{Code generator architecture}
  22.318 +    \label{fig:arch}
  22.319 +  \end{figure}
  22.320 +
  22.321 +  The code generator employs a notion of executability
  22.322 +  for three foundational executable ingredients known
  22.323 +  from functional programming:
  22.324 +  \emph{code equations}, \emph{datatypes}, and
  22.325 +  \emph{type classes}.  A code equation as a first approximation
  22.326 +  is a theorem of the form \isa{f\ t\isactrlisub {\isadigit{1}}\ t\isactrlisub {\isadigit{2}}\ {\isasymdots}\ t\isactrlisub n\ {\isasymequiv}\ t}
  22.327 +  (an equation headed by a constant \isa{f} with arguments
  22.328 +  \isa{t\isactrlisub {\isadigit{1}}\ t\isactrlisub {\isadigit{2}}\ {\isasymdots}\ t\isactrlisub n} and right hand side \isa{t}).
  22.329 +  Code generation aims to turn code equations
  22.330 +  into a functional program.  This is achieved by three major
  22.331 +  components which operate sequentially, i.e. the result of one is
  22.332 +  the input
  22.333 +  of the next in the chain,  see diagram \ref{fig:arch}:
  22.334 +
  22.335 +  \begin{itemize}
  22.336 +
  22.337 +    \item Out of the vast collection of theorems proven in a
  22.338 +      \qn{theory}, a reasonable subset modelling
  22.339 +      code equations is \qn{selected}.
  22.340 +
  22.341 +    \item On those selected theorems, certain
  22.342 +      transformations are carried out
  22.343 +      (\qn{preprocessing}).  Their purpose is to turn theorems
  22.344 +      representing non- or badly executable
  22.345 +      specifications into equivalent but executable counterparts.
  22.346 +      The result is a structured collection of \qn{code theorems}.
  22.347 +
  22.348 +    \item Before the selected code equations are continued with,
  22.349 +      they can be \qn{preprocessed}, i.e. subjected to theorem
  22.350 +      transformations.  This \qn{preprocessor} is an interface which
  22.351 +      allows to apply
  22.352 +      the full expressiveness of ML-based theorem transformations
  22.353 +      to code generation;  motivating examples are shown below, see
  22.354 +      \secref{sec:preproc}.
  22.355 +      The result of the preprocessing step is a structured collection
  22.356 +      of code equations.
  22.357 +
  22.358 +    \item These code equations are \qn{translated} to a program
  22.359 +      in an abstract intermediate language.  Think of it as a kind
  22.360 +      of \qt{Mini-Haskell} with four \qn{statements}: \isa{data}
  22.361 +      (for datatypes), \isa{fun} (stemming from code equations),
  22.362 +      also \isa{class} and \isa{inst} (for type classes).
  22.363 +
  22.364 +    \item Finally, the abstract program is \qn{serialised} into concrete
  22.365 +      source code of a target language.
  22.366 +
  22.367 +  \end{itemize}
  22.368 +
  22.369 +  \noindent From these steps, only the two last are carried out outside the logic;  by
  22.370 +  keeping this layer as thin as possible, the amount of code to trust is
  22.371 +  kept to a minimum.%
  22.372 +\end{isamarkuptext}%
  22.373 +\isamarkuptrue%
  22.374 +%
  22.375 +\isadelimtheory
  22.376 +%
  22.377 +\endisadelimtheory
  22.378 +%
  22.379 +\isatagtheory
  22.380 +\isacommand{end}\isamarkupfalse%
  22.381 +%
  22.382 +\endisatagtheory
  22.383 +{\isafoldtheory}%
  22.384 +%
  22.385 +\isadelimtheory
  22.386 +%
  22.387 +\endisadelimtheory
  22.388 +\isanewline
  22.389 +\end{isabellebody}%
  22.390 +%%% Local Variables:
  22.391 +%%% mode: latex
  22.392 +%%% TeX-master: "root"
  22.393 +%%% End:
    23.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2 +++ b/doc-src/Codegen/Thy/document/ML.tex	Tue Mar 03 11:00:51 2009 +0100
    23.3 @@ -0,0 +1,255 @@
    23.4 +%
    23.5 +\begin{isabellebody}%
    23.6 +\def\isabellecontext{ML}%
    23.7 +%
    23.8 +\isadelimtheory
    23.9 +%
   23.10 +\endisadelimtheory
   23.11 +%
   23.12 +\isatagtheory
   23.13 +\isacommand{theory}\isamarkupfalse%
   23.14 +\ {\isachardoublequoteopen}ML{\isachardoublequoteclose}\isanewline
   23.15 +\isakeyword{imports}\ Setup\isanewline
   23.16 +\isakeyword{begin}%
   23.17 +\endisatagtheory
   23.18 +{\isafoldtheory}%
   23.19 +%
   23.20 +\isadelimtheory
   23.21 +%
   23.22 +\endisadelimtheory
   23.23 +%
   23.24 +\isamarkupsection{ML system interfaces \label{sec:ml}%
   23.25 +}
   23.26 +\isamarkuptrue%
   23.27 +%
   23.28 +\begin{isamarkuptext}%
   23.29 +Since the code generator framework not only aims to provide
   23.30 +  a nice Isar interface but also to form a base for
   23.31 +  code-generation-based applications, here a short
   23.32 +  description of the most important ML interfaces.%
   23.33 +\end{isamarkuptext}%
   23.34 +\isamarkuptrue%
   23.35 +%
   23.36 +\isamarkupsubsection{Executable theory content: \isa{Code}%
   23.37 +}
   23.38 +\isamarkuptrue%
   23.39 +%
   23.40 +\begin{isamarkuptext}%
   23.41 +This Pure module implements the core notions of
   23.42 +  executable content of a theory.%
   23.43 +\end{isamarkuptext}%
   23.44 +\isamarkuptrue%
   23.45 +%
   23.46 +\isamarkupsubsubsection{Managing executable content%
   23.47 +}
   23.48 +\isamarkuptrue%
   23.49 +%
   23.50 +\isadelimmlref
   23.51 +%
   23.52 +\endisadelimmlref
   23.53 +%
   23.54 +\isatagmlref
   23.55 +%
   23.56 +\begin{isamarkuptext}%
   23.57 +\begin{mldecls}
   23.58 +  \indexdef{}{ML}{Code.add\_eqn}\verb|Code.add_eqn: thm -> theory -> theory| \\
   23.59 +  \indexdef{}{ML}{Code.del\_eqn}\verb|Code.del_eqn: thm -> theory -> theory| \\
   23.60 +  \indexdef{}{ML}{Code.add\_eqnl}\verb|Code.add_eqnl: string * (thm * bool) list lazy -> theory -> theory| \\
   23.61 +  \indexdef{}{ML}{Code.map\_pre}\verb|Code.map_pre: (simpset -> simpset) -> theory -> theory| \\
   23.62 +  \indexdef{}{ML}{Code.map\_post}\verb|Code.map_post: (simpset -> simpset) -> theory -> theory| \\
   23.63 +  \indexdef{}{ML}{Code.add\_functrans}\verb|Code.add_functrans: string * (theory -> (thm * bool) list -> (thm * bool) list option)|\isasep\isanewline%
   23.64 +\verb|    -> theory -> theory| \\
   23.65 +  \indexdef{}{ML}{Code.del\_functrans}\verb|Code.del_functrans: string -> theory -> theory| \\
   23.66 +  \indexdef{}{ML}{Code.add\_datatype}\verb|Code.add_datatype: (string * typ) list -> theory -> theory| \\
   23.67 +  \indexdef{}{ML}{Code.get\_datatype}\verb|Code.get_datatype: theory -> string|\isasep\isanewline%
   23.68 +\verb|    -> (string * sort) list * (string * typ list) list| \\
   23.69 +  \indexdef{}{ML}{Code.get\_datatype\_of\_constr}\verb|Code.get_datatype_of_constr: theory -> string -> string option|
   23.70 +  \end{mldecls}
   23.71 +
   23.72 +  \begin{description}
   23.73 +
   23.74 +  \item \verb|Code.add_eqn|~\isa{thm}~\isa{thy} adds function
   23.75 +     theorem \isa{thm} to executable content.
   23.76 +
   23.77 +  \item \verb|Code.del_eqn|~\isa{thm}~\isa{thy} removes function
   23.78 +     theorem \isa{thm} from executable content, if present.
   23.79 +
   23.80 +  \item \verb|Code.add_eqnl|~\isa{{\isacharparenleft}const{\isacharcomma}\ lthms{\isacharparenright}}~\isa{thy} adds
   23.81 +     suspended code equations \isa{lthms} for constant
   23.82 +     \isa{const} to executable content.
   23.83 +
   23.84 +  \item \verb|Code.map_pre|~\isa{f}~\isa{thy} changes
   23.85 +     the preprocessor simpset.
   23.86 +
   23.87 +  \item \verb|Code.add_functrans|~\isa{{\isacharparenleft}name{\isacharcomma}\ f{\isacharparenright}}~\isa{thy} adds
   23.88 +     function transformer \isa{f} (named \isa{name}) to executable content;
   23.89 +     \isa{f} is a transformer of the code equations belonging
   23.90 +     to a certain function definition, depending on the
   23.91 +     current theory context.  Returning \isa{NONE} indicates that no
   23.92 +     transformation took place;  otherwise, the whole process will be iterated
   23.93 +     with the new code equations.
   23.94 +
   23.95 +  \item \verb|Code.del_functrans|~\isa{name}~\isa{thy} removes
   23.96 +     function transformer named \isa{name} from executable content.
   23.97 +
   23.98 +  \item \verb|Code.add_datatype|~\isa{cs}~\isa{thy} adds
   23.99 +     a datatype to executable content, with generation
  23.100 +     set \isa{cs}.
  23.101 +
  23.102 +  \item \verb|Code.get_datatype_of_constr|~\isa{thy}~\isa{const}
  23.103 +     returns type constructor corresponding to
  23.104 +     constructor \isa{const}; returns \isa{NONE}
  23.105 +     if \isa{const} is no constructor.
  23.106 +
  23.107 +  \end{description}%
  23.108 +\end{isamarkuptext}%
  23.109 +\isamarkuptrue%
  23.110 +%
  23.111 +\endisatagmlref
  23.112 +{\isafoldmlref}%
  23.113 +%
  23.114 +\isadelimmlref
  23.115 +%
  23.116 +\endisadelimmlref
  23.117 +%
  23.118 +\isamarkupsubsection{Auxiliary%
  23.119 +}
  23.120 +\isamarkuptrue%
  23.121 +%
  23.122 +\isadelimmlref
  23.123 +%
  23.124 +\endisadelimmlref
  23.125 +%
  23.126 +\isatagmlref
  23.127 +%
  23.128 +\begin{isamarkuptext}%
  23.129 +\begin{mldecls}
  23.130 +  \indexdef{}{ML}{Code\_Unit.read\_const}\verb|Code_Unit.read_const: theory -> string -> string| \\
  23.131 +  \indexdef{}{ML}{Code\_Unit.head\_eqn}\verb|Code_Unit.head_eqn: theory -> thm -> string * ((string * sort) list * typ)| \\
  23.132 +  \indexdef{}{ML}{Code\_Unit.rewrite\_eqn}\verb|Code_Unit.rewrite_eqn: simpset -> thm -> thm| \\
  23.133 +  \end{mldecls}
  23.134 +
  23.135 +  \begin{description}
  23.136 +
  23.137 +  \item \verb|Code_Unit.read_const|~\isa{thy}~\isa{s}
  23.138 +     reads a constant as a concrete term expression \isa{s}.
  23.139 +
  23.140 +  \item \verb|Code_Unit.head_eqn|~\isa{thy}~\isa{thm}
  23.141 +     extracts the constant and its type from a code equation \isa{thm}.
  23.142 +
  23.143 +  \item \verb|Code_Unit.rewrite_eqn|~\isa{ss}~\isa{thm}
  23.144 +     rewrites a code equation \isa{thm} with a simpset \isa{ss};
  23.145 +     only arguments and right hand side are rewritten,
  23.146 +     not the head of the code equation.
  23.147 +
  23.148 +  \end{description}%
  23.149 +\end{isamarkuptext}%
  23.150 +\isamarkuptrue%
  23.151 +%
  23.152 +\endisatagmlref
  23.153 +{\isafoldmlref}%
  23.154 +%
  23.155 +\isadelimmlref
  23.156 +%
  23.157 +\endisadelimmlref
  23.158 +%
  23.159 +\isamarkupsubsection{Implementing code generator applications%
  23.160 +}
  23.161 +\isamarkuptrue%
  23.162 +%
  23.163 +\begin{isamarkuptext}%
  23.164 +Implementing code generator applications on top
  23.165 +  of the framework set out so far usually not only
  23.166 +  involves using those primitive interfaces
  23.167 +  but also storing code-dependent data and various
  23.168 +  other things.%
  23.169 +\end{isamarkuptext}%
  23.170 +\isamarkuptrue%
  23.171 +%
  23.172 +\isamarkupsubsubsection{Data depending on the theory's executable content%
  23.173 +}
  23.174 +\isamarkuptrue%
  23.175 +%
  23.176 +\begin{isamarkuptext}%
  23.177 +Due to incrementality of code generation, changes in the
  23.178 +  theory's executable content have to be propagated in a
  23.179 +  certain fashion.  Additionally, such changes may occur
  23.180 +  not only during theory extension but also during theory
  23.181 +  merge, which is a little bit nasty from an implementation
  23.182 +  point of view.  The framework provides a solution
  23.183 +  to this technical challenge by providing a functorial
  23.184 +  data slot \verb|CodeDataFun|; on instantiation
  23.185 +  of this functor, the following types and operations
  23.186 +  are required:
  23.187 +
  23.188 +  \medskip
  23.189 +  \begin{tabular}{l}
  23.190 +  \isa{type\ T} \\
  23.191 +  \isa{val\ empty{\isacharcolon}\ T} \\
  23.192 +  \isa{val\ purge{\isacharcolon}\ theory\ {\isasymrightarrow}\ string\ list\ option\ {\isasymrightarrow}\ T\ {\isasymrightarrow}\ T}
  23.193 +  \end{tabular}
  23.194 +
  23.195 +  \begin{description}
  23.196 +
  23.197 +  \item \isa{T} the type of data to store.
  23.198 +
  23.199 +  \item \isa{empty} initial (empty) data.
  23.200 +
  23.201 +  \item \isa{purge}~\isa{thy}~\isa{consts} propagates changes in executable content;
  23.202 +    \isa{consts} indicates the kind
  23.203 +    of change: \verb|NONE| stands for a fundamental change
  23.204 +    which invalidates any existing code, \isa{SOME\ consts}
  23.205 +    hints that executable content for constants \isa{consts}
  23.206 +    has changed.
  23.207 +
  23.208 +  \end{description}
  23.209 +
  23.210 +  \noindent An instance of \verb|CodeDataFun| provides the following
  23.211 +  interface:
  23.212 +
  23.213 +  \medskip
  23.214 +  \begin{tabular}{l}
  23.215 +  \isa{get{\isacharcolon}\ theory\ {\isasymrightarrow}\ T} \\
  23.216 +  \isa{change{\isacharcolon}\ theory\ {\isasymrightarrow}\ {\isacharparenleft}T\ {\isasymrightarrow}\ T{\isacharparenright}\ {\isasymrightarrow}\ T} \\
  23.217 +  \isa{change{\isacharunderscore}yield{\isacharcolon}\ theory\ {\isasymrightarrow}\ {\isacharparenleft}T\ {\isasymrightarrow}\ {\isacharprime}a\ {\isacharasterisk}\ T{\isacharparenright}\ {\isasymrightarrow}\ {\isacharprime}a\ {\isacharasterisk}\ T}
  23.218 +  \end{tabular}
  23.219 +
  23.220 +  \begin{description}
  23.221 +
  23.222 +  \item \isa{get} retrieval of the current data.
  23.223 +
  23.224 +  \item \isa{change} update of current data (cached!)
  23.225 +    by giving a continuation.
  23.226 +
  23.227 +  \item \isa{change{\isacharunderscore}yield} update with side result.
  23.228 +
  23.229 +  \end{description}%
  23.230 +\end{isamarkuptext}%
  23.231 +\isamarkuptrue%
  23.232 +%
  23.233 +\begin{isamarkuptext}%
  23.234 +\bigskip
  23.235 +
  23.236 +  \emph{Happy proving, happy hacking!}%
  23.237 +\end{isamarkuptext}%
  23.238 +\isamarkuptrue%
  23.239 +%
  23.240 +\isadelimtheory
  23.241 +%
  23.242 +\endisadelimtheory
  23.243 +%
  23.244 +\isatagtheory
  23.245 +\isacommand{end}\isamarkupfalse%
  23.246 +%
  23.247 +\endisatagtheory
  23.248 +{\isafoldtheory}%
  23.249 +%
  23.250 +\isadelimtheory
  23.251 +%
  23.252 +\endisadelimtheory
  23.253 +\isanewline
  23.254 +\end{isabellebody}%
  23.255 +%%% Local Variables:
  23.256 +%%% mode: latex
  23.257 +%%% TeX-master: "root"
  23.258 +%%% End:
    24.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.2 +++ b/doc-src/Codegen/Thy/document/Program.tex	Tue Mar 03 11:00:51 2009 +0100
    24.3 @@ -0,0 +1,1250 @@
    24.4 +%
    24.5 +\begin{isabellebody}%
    24.6 +\def\isabellecontext{Program}%
    24.7 +%
    24.8 +\isadelimtheory
    24.9 +%
   24.10 +\endisadelimtheory
   24.11 +%
   24.12 +\isatagtheory
   24.13 +\isacommand{theory}\isamarkupfalse%
   24.14 +\ Program\isanewline
   24.15 +\isakeyword{imports}\ Introduction\isanewline
   24.16 +\isakeyword{begin}%
   24.17 +\endisatagtheory
   24.18 +{\isafoldtheory}%
   24.19 +%
   24.20 +\isadelimtheory
   24.21 +%
   24.22 +\endisadelimtheory
   24.23 +%
   24.24 +\isamarkupsection{Turning Theories into Programs \label{sec:program}%
   24.25 +}
   24.26 +\isamarkuptrue%
   24.27 +%
   24.28 +\isamarkupsubsection{The \isa{Isabelle{\isacharslash}HOL} default setup%
   24.29 +}
   24.30 +\isamarkuptrue%
   24.31 +%
   24.32 +\begin{isamarkuptext}%
   24.33 +We have already seen how by default equations stemming from
   24.34 +  \hyperlink{command.definition}{\mbox{\isa{\isacommand{definition}}}}/\hyperlink{command.primrec}{\mbox{\isa{\isacommand{primrec}}}}/\hyperlink{command.fun}{\mbox{\isa{\isacommand{fun}}}}
   24.35 +  statements are used for code generation.  This default behaviour
   24.36 +  can be changed, e.g. by providing different code equations.
   24.37 +  All kinds of customisation shown in this section is \emph{safe}
   24.38 +  in the sense that the user does not have to worry about
   24.39 +  correctness -- all programs generatable that way are partially
   24.40 +  correct.%
   24.41 +\end{isamarkuptext}%
   24.42 +\isamarkuptrue%
   24.43 +%
   24.44 +\isamarkupsubsection{Selecting code equations%
   24.45 +}
   24.46 +\isamarkuptrue%
   24.47 +%
   24.48 +\begin{isamarkuptext}%
   24.49 +Coming back to our introductory example, we
   24.50 +  could provide an alternative code equations for \isa{dequeue}
   24.51 +  explicitly:%
   24.52 +\end{isamarkuptext}%
   24.53 +\isamarkuptrue%
   24.54 +%
   24.55 +\isadelimquote
   24.56 +%
   24.57 +\endisadelimquote
   24.58 +%
   24.59 +\isatagquote
   24.60 +\isacommand{lemma}\isamarkupfalse%
   24.61 +\ {\isacharbrackleft}code{\isacharbrackright}{\isacharcolon}\isanewline
   24.62 +\ \ {\isachardoublequoteopen}dequeue\ {\isacharparenleft}AQueue\ xs\ {\isacharbrackleft}{\isacharbrackright}{\isacharparenright}\ {\isacharequal}\isanewline
   24.63 +\ \ \ \ \ {\isacharparenleft}if\ xs\ {\isacharequal}\ {\isacharbrackleft}{\isacharbrackright}\ then\ {\isacharparenleft}None{\isacharcomma}\ AQueue\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharbrackleft}{\isacharbrackright}{\isacharparenright}\isanewline
   24.64 +\ \ \ \ \ \ \ else\ dequeue\ {\isacharparenleft}AQueue\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharparenleft}rev\ xs{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}\isanewline
   24.65 +\ \ {\isachardoublequoteopen}dequeue\ {\isacharparenleft}AQueue\ xs\ {\isacharparenleft}y\ {\isacharhash}\ ys{\isacharparenright}{\isacharparenright}\ {\isacharequal}\isanewline
   24.66 +\ \ \ \ \ {\isacharparenleft}Some\ y{\isacharcomma}\ AQueue\ xs\ ys{\isacharparenright}{\isachardoublequoteclose}\isanewline
   24.67 +\ \ \isacommand{by}\isamarkupfalse%
   24.68 +\ {\isacharparenleft}cases\ xs{\isacharcomma}\ simp{\isacharunderscore}all{\isacharparenright}\ {\isacharparenleft}cases\ {\isachardoublequoteopen}rev\ xs{\isachardoublequoteclose}{\isacharcomma}\ simp{\isacharunderscore}all{\isacharparenright}%
   24.69 +\endisatagquote
   24.70 +{\isafoldquote}%
   24.71 +%
   24.72 +\isadelimquote
   24.73 +%
   24.74 +\endisadelimquote
   24.75 +%
   24.76 +\begin{isamarkuptext}%
   24.77 +\noindent The annotation \isa{{\isacharbrackleft}code{\isacharbrackright}} is an \isa{Isar}
   24.78 +  \isa{attribute} which states that the given theorems should be
   24.79 +  considered as code equations for a \isa{fun} statement --
   24.80 +  the corresponding constant is determined syntactically.  The resulting code:%
   24.81 +\end{isamarkuptext}%
   24.82 +\isamarkuptrue%
   24.83 +%
   24.84 +\isadelimquote
   24.85 +%
   24.86 +\endisadelimquote
   24.87 +%
   24.88 +\isatagquote
   24.89 +%
   24.90 +\begin{isamarkuptext}%
   24.91 +\isatypewriter%
   24.92 +\noindent%
   24.93 +\hspace*{0pt}dequeue ::~forall a.~Queue a -> (Maybe a,~Queue a);\\
   24.94 +\hspace*{0pt}dequeue (AQueue xs (y :~ys)) = (Just y,~AQueue xs ys);\\
   24.95 +\hspace*{0pt}dequeue (AQueue xs []) =\\
   24.96 +\hspace*{0pt} ~(if nulla xs then (Nothing,~AQueue [] [])\\
   24.97 +\hspace*{0pt} ~~~else dequeue (AQueue [] (rev xs)));%
   24.98 +\end{isamarkuptext}%
   24.99 +\isamarkuptrue%
  24.100 +%
  24.101 +\endisatagquote
  24.102 +{\isafoldquote}%
  24.103 +%
  24.104 +\isadelimquote
  24.105 +%
  24.106 +\endisadelimquote
  24.107 +%
  24.108 +\begin{isamarkuptext}%
  24.109 +\noindent You may note that the equality test \isa{xs\ {\isacharequal}\ {\isacharbrackleft}{\isacharbrackright}} has been
  24.110 +  replaced by the predicate \isa{null\ xs}.  This is due to the default
  24.111 +  setup in the \qn{preprocessor} to be discussed further below (\secref{sec:preproc}).
  24.112 +
  24.113 +  Changing the default constructor set of datatypes is also
  24.114 +  possible.  See \secref{sec:datatypes} for an example.
  24.115 +
  24.116 +  As told in \secref{sec:concept}, code generation is based
  24.117 +  on a structured collection of code theorems.
  24.118 +  For explorative purpose, this collection
  24.119 +  may be inspected using the \hyperlink{command.code-thms}{\mbox{\isa{\isacommand{code{\isacharunderscore}thms}}}} command:%
  24.120 +\end{isamarkuptext}%
  24.121 +\isamarkuptrue%
  24.122 +%
  24.123 +\isadelimquote
  24.124 +%
  24.125 +\endisadelimquote
  24.126 +%
  24.127 +\isatagquote
  24.128 +\isacommand{code{\isacharunderscore}thms}\isamarkupfalse%
  24.129 +\ dequeue%
  24.130 +\endisatagquote
  24.131 +{\isafoldquote}%
  24.132 +%
  24.133 +\isadelimquote
  24.134 +%
  24.135 +\endisadelimquote
  24.136 +%
  24.137 +\begin{isamarkuptext}%
  24.138 +\noindent prints a table with \emph{all} code equations
  24.139 +  for \isa{dequeue}, including
  24.140 +  \emph{all} code equations those equations depend
  24.141 +  on recursively.
  24.142 +  
  24.143 +  Similarly, the \hyperlink{command.code-deps}{\mbox{\isa{\isacommand{code{\isacharunderscore}deps}}}} command shows a graph
  24.144 +  visualising dependencies between code equations.%
  24.145 +\end{isamarkuptext}%
  24.146 +\isamarkuptrue%
  24.147 +%
  24.148 +\isamarkupsubsection{\isa{class} and \isa{instantiation}%
  24.149 +}
  24.150 +\isamarkuptrue%
  24.151 +%
  24.152 +\begin{isamarkuptext}%
  24.153 +Concerning type classes and code generation, let us examine an example
  24.154 +  from abstract algebra:%
  24.155 +\end{isamarkuptext}%
  24.156 +\isamarkuptrue%
  24.157 +%
  24.158 +\isadelimquote
  24.159 +%
  24.160 +\endisadelimquote
  24.161 +%
  24.162 +\isatagquote
  24.163 +\isacommand{class}\isamarkupfalse%
  24.164 +\ semigroup\ {\isacharequal}\isanewline
  24.165 +\ \ \isakeyword{fixes}\ mult\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a{\isachardoublequoteclose}\ {\isacharparenleft}\isakeyword{infixl}\ {\isachardoublequoteopen}{\isasymotimes}{\isachardoublequoteclose}\ {\isadigit{7}}{\isadigit{0}}{\isacharparenright}\isanewline
  24.166 +\ \ \isakeyword{assumes}\ assoc{\isacharcolon}\ {\isachardoublequoteopen}{\isacharparenleft}x\ {\isasymotimes}\ y{\isacharparenright}\ {\isasymotimes}\ z\ {\isacharequal}\ x\ {\isasymotimes}\ {\isacharparenleft}y\ {\isasymotimes}\ z{\isacharparenright}{\isachardoublequoteclose}\isanewline
  24.167 +\isanewline
  24.168 +\isacommand{class}\isamarkupfalse%
  24.169 +\ monoid\ {\isacharequal}\ semigroup\ {\isacharplus}\isanewline
  24.170 +\ \ \isakeyword{fixes}\ neutral\ {\isacharcolon}{\isacharcolon}\ {\isacharprime}a\ {\isacharparenleft}{\isachardoublequoteopen}{\isasymone}{\isachardoublequoteclose}{\isacharparenright}\isanewline
  24.171 +\ \ \isakeyword{assumes}\ neutl{\isacharcolon}\ {\isachardoublequoteopen}{\isasymone}\ {\isasymotimes}\ x\ {\isacharequal}\ x{\isachardoublequoteclose}\isanewline
  24.172 +\ \ \ \ \isakeyword{and}\ neutr{\isacharcolon}\ {\isachardoublequoteopen}x\ {\isasymotimes}\ {\isasymone}\ {\isacharequal}\ x{\isachardoublequoteclose}\isanewline
  24.173 +\isanewline
  24.174 +\isacommand{instantiation}\isamarkupfalse%
  24.175 +\ nat\ {\isacharcolon}{\isacharcolon}\ monoid\isanewline
  24.176 +\isakeyword{begin}\isanewline
  24.177 +\isanewline
  24.178 +\isacommand{primrec}\isamarkupfalse%
  24.179 +\ mult{\isacharunderscore}nat\ \isakeyword{where}\isanewline
  24.180 +\ \ \ \ {\isachardoublequoteopen}{\isadigit{0}}\ {\isasymotimes}\ n\ {\isacharequal}\ {\isacharparenleft}{\isadigit{0}}{\isasymColon}nat{\isacharparenright}{\isachardoublequoteclose}\isanewline
  24.181 +\ \ {\isacharbar}\ {\isachardoublequoteopen}Suc\ m\ {\isasymotimes}\ n\ {\isacharequal}\ n\ {\isacharplus}\ m\ {\isasymotimes}\ n{\isachardoublequoteclose}\isanewline
  24.182 +\isanewline
  24.183 +\isacommand{definition}\isamarkupfalse%
  24.184 +\ neutral{\isacharunderscore}nat\ \isakeyword{where}\isanewline
  24.185 +\ \ {\isachardoublequoteopen}{\isasymone}\ {\isacharequal}\ Suc\ {\isadigit{0}}{\isachardoublequoteclose}\isanewline
  24.186 +\isanewline
  24.187 +\isacommand{lemma}\isamarkupfalse%
  24.188 +\ add{\isacharunderscore}mult{\isacharunderscore}distrib{\isacharcolon}\isanewline
  24.189 +\ \ \isakeyword{fixes}\ n\ m\ q\ {\isacharcolon}{\isacharcolon}\ nat\isanewline
  24.190 +\ \ \isakeyword{shows}\ {\isachardoublequoteopen}{\isacharparenleft}n\ {\isacharplus}\ m{\isacharparenright}\ {\isasymotimes}\ q\ {\isacharequal}\ n\ {\isasymotimes}\ q\ {\isacharplus}\ m\ {\isasymotimes}\ q{\isachardoublequoteclose}\isanewline
  24.191 +\ \ \isacommand{by}\isamarkupfalse%
  24.192 +\ {\isacharparenleft}induct\ n{\isacharparenright}\ simp{\isacharunderscore}all\isanewline
  24.193 +\isanewline
  24.194 +\isacommand{instance}\isamarkupfalse%
  24.195 +\ \isacommand{proof}\isamarkupfalse%
  24.196 +\isanewline
  24.197 +\ \ \isacommand{fix}\isamarkupfalse%
  24.198 +\ m\ n\ q\ {\isacharcolon}{\isacharcolon}\ nat\isanewline
  24.199 +\ \ \isacommand{show}\isamarkupfalse%
  24.200 +\ {\isachardoublequoteopen}m\ {\isasymotimes}\ n\ {\isasymotimes}\ q\ {\isacharequal}\ m\ {\isasymotimes}\ {\isacharparenleft}n\ {\isasymotimes}\ q{\isacharparenright}{\isachardoublequoteclose}\isanewline
  24.201 +\ \ \ \ \isacommand{by}\isamarkupfalse%
  24.202 +\ {\isacharparenleft}induct\ m{\isacharparenright}\ {\isacharparenleft}simp{\isacharunderscore}all\ add{\isacharcolon}\ add{\isacharunderscore}mult{\isacharunderscore}distrib{\isacharparenright}\isanewline
  24.203 +\ \ \isacommand{show}\isamarkupfalse%
  24.204 +\ {\isachardoublequoteopen}{\isasymone}\ {\isasymotimes}\ n\ {\isacharequal}\ n{\isachardoublequoteclose}\isanewline
  24.205 +\ \ \ \ \isacommand{by}\isamarkupfalse%
  24.206 +\ {\isacharparenleft}simp\ add{\isacharcolon}\ neutral{\isacharunderscore}nat{\isacharunderscore}def{\isacharparenright}\isanewline
  24.207 +\ \ \isacommand{show}\isamarkupfalse%
  24.208 +\ {\isachardoublequoteopen}m\ {\isasymotimes}\ {\isasymone}\ {\isacharequal}\ m{\isachardoublequoteclose}\isanewline
  24.209 +\ \ \ \ \isacommand{by}\isamarkupfalse%
  24.210 +\ {\isacharparenleft}induct\ m{\isacharparenright}\ {\isacharparenleft}simp{\isacharunderscore}all\ add{\isacharcolon}\ neutral{\isacharunderscore}nat{\isacharunderscore}def{\isacharparenright}\isanewline
  24.211 +\isacommand{qed}\isamarkupfalse%
  24.212 +\isanewline
  24.213 +\isanewline
  24.214 +\isacommand{end}\isamarkupfalse%
  24.215 +%
  24.216 +\endisatagquote
  24.217 +{\isafoldquote}%
  24.218 +%
  24.219 +\isadelimquote
  24.220 +%
  24.221 +\endisadelimquote
  24.222 +%
  24.223 +\begin{isamarkuptext}%
  24.224 +\noindent We define the natural operation of the natural numbers
  24.225 +  on monoids:%
  24.226 +\end{isamarkuptext}%
  24.227 +\isamarkuptrue%
  24.228 +%
  24.229 +\isadelimquote
  24.230 +%
  24.231 +\endisadelimquote
  24.232 +%
  24.233 +\isatagquote
  24.234 +\isacommand{primrec}\isamarkupfalse%
  24.235 +\ {\isacharparenleft}\isakeyword{in}\ monoid{\isacharparenright}\ pow\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ {\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  24.236 +\ \ \ \ {\isachardoublequoteopen}pow\ {\isadigit{0}}\ a\ {\isacharequal}\ {\isasymone}{\isachardoublequoteclose}\isanewline
  24.237 +\ \ {\isacharbar}\ {\isachardoublequoteopen}pow\ {\isacharparenleft}Suc\ n{\isacharparenright}\ a\ {\isacharequal}\ a\ {\isasymotimes}\ pow\ n\ a{\isachardoublequoteclose}%
  24.238 +\endisatagquote
  24.239 +{\isafoldquote}%
  24.240 +%
  24.241 +\isadelimquote
  24.242 +%
  24.243 +\endisadelimquote
  24.244 +%
  24.245 +\begin{isamarkuptext}%
  24.246 +\noindent This we use to define the discrete exponentiation function:%
  24.247 +\end{isamarkuptext}%
  24.248 +\isamarkuptrue%
  24.249 +%
  24.250 +\isadelimquote
  24.251 +%
  24.252 +\endisadelimquote
  24.253 +%
  24.254 +\isatagquote
  24.255 +\isacommand{definition}\isamarkupfalse%
  24.256 +\ bexp\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ nat{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  24.257 +\ \ {\isachardoublequoteopen}bexp\ n\ {\isacharequal}\ pow\ n\ {\isacharparenleft}Suc\ {\isacharparenleft}Suc\ {\isadigit{0}}{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}%
  24.258 +\endisatagquote
  24.259 +{\isafoldquote}%
  24.260 +%
  24.261 +\isadelimquote
  24.262 +%
  24.263 +\endisadelimquote
  24.264 +%
  24.265 +\begin{isamarkuptext}%
  24.266 +\noindent The corresponding code:%
  24.267 +\end{isamarkuptext}%
  24.268 +\isamarkuptrue%
  24.269 +%
  24.270 +\isadelimquote
  24.271 +%
  24.272 +\endisadelimquote
  24.273 +%
  24.274 +\isatagquote
  24.275 +%
  24.276 +\begin{isamarkuptext}%
  24.277 +\isatypewriter%
  24.278 +\noindent%
  24.279 +\hspace*{0pt}module Example where {\char123}\\
  24.280 +\hspace*{0pt}\\
  24.281 +\hspace*{0pt}\\
  24.282 +\hspace*{0pt}data Nat = Zero{\char95}nat | Suc Nat;\\
  24.283 +\hspace*{0pt}\\
  24.284 +\hspace*{0pt}class Semigroup a where {\char123}\\
  24.285 +\hspace*{0pt} ~mult ::~a -> a -> a;\\
  24.286 +\hspace*{0pt}{\char125};\\
  24.287 +\hspace*{0pt}\\
  24.288 +\hspace*{0pt}class (Semigroup a) => Monoid a where {\char123}\\
  24.289 +\hspace*{0pt} ~neutral ::~a;\\
  24.290 +\hspace*{0pt}{\char125};\\
  24.291 +\hspace*{0pt}\\
  24.292 +\hspace*{0pt}pow ::~forall a.~(Monoid a) => Nat -> a -> a;\\
  24.293 +\hspace*{0pt}pow Zero{\char95}nat a = neutral;\\
  24.294 +\hspace*{0pt}pow (Suc n) a = mult a (pow n a);\\
  24.295 +\hspace*{0pt}\\
  24.296 +\hspace*{0pt}plus{\char95}nat ::~Nat -> Nat -> Nat;\\
  24.297 +\hspace*{0pt}plus{\char95}nat (Suc m) n = plus{\char95}nat m (Suc n);\\
  24.298 +\hspace*{0pt}plus{\char95}nat Zero{\char95}nat n = n;\\
  24.299 +\hspace*{0pt}\\
  24.300 +\hspace*{0pt}neutral{\char95}nat ::~Nat;\\
  24.301 +\hspace*{0pt}neutral{\char95}nat = Suc Zero{\char95}nat;\\
  24.302 +\hspace*{0pt}\\
  24.303 +\hspace*{0pt}mult{\char95}nat ::~Nat -> Nat -> Nat;\\
  24.304 +\hspace*{0pt}mult{\char95}nat Zero{\char95}nat n = Zero{\char95}nat;\\
  24.305 +\hspace*{0pt}mult{\char95}nat (Suc m) n = plus{\char95}nat n (mult{\char95}nat m n);\\
  24.306 +\hspace*{0pt}\\
  24.307 +\hspace*{0pt}instance Semigroup Nat where {\char123}\\
  24.308 +\hspace*{0pt} ~mult = mult{\char95}nat;\\
  24.309 +\hspace*{0pt}{\char125};\\
  24.310 +\hspace*{0pt}\\
  24.311 +\hspace*{0pt}instance Monoid Nat where {\char123}\\
  24.312 +\hspace*{0pt} ~neutral = neutral{\char95}nat;\\
  24.313 +\hspace*{0pt}{\char125};\\
  24.314 +\hspace*{0pt}\\
  24.315 +\hspace*{0pt}bexp ::~Nat -> Nat;\\
  24.316 +\hspace*{0pt}bexp n = pow n (Suc (Suc Zero{\char95}nat));\\
  24.317 +\hspace*{0pt}\\
  24.318 +\hspace*{0pt}{\char125}%
  24.319 +\end{isamarkuptext}%
  24.320 +\isamarkuptrue%
  24.321 +%
  24.322 +\endisatagquote
  24.323 +{\isafoldquote}%
  24.324 +%
  24.325 +\isadelimquote
  24.326 +%
  24.327 +\endisadelimquote
  24.328 +%
  24.329 +\begin{isamarkuptext}%
  24.330 +\noindent This is a convenient place to show how explicit dictionary construction
  24.331 +  manifests in generated code (here, the same example in \isa{SML}):%
  24.332 +\end{isamarkuptext}%
  24.333 +\isamarkuptrue%
  24.334 +%
  24.335 +\isadelimquote
  24.336 +%
  24.337 +\endisadelimquote
  24.338 +%
  24.339 +\isatagquote
  24.340 +%
  24.341 +\begin{isamarkuptext}%
  24.342 +\isatypewriter%
  24.343 +\noindent%
  24.344 +\hspace*{0pt}structure Example = \\
  24.345 +\hspace*{0pt}struct\\
  24.346 +\hspace*{0pt}\\
  24.347 +\hspace*{0pt}datatype nat = Zero{\char95}nat | Suc of nat;\\
  24.348 +\hspace*{0pt}\\
  24.349 +\hspace*{0pt}type 'a semigroup = {\char123}mult :~'a -> 'a -> 'a{\char125};\\
  24.350 +\hspace*{0pt}fun mult (A{\char95}:'a semigroup) = {\char35}mult A{\char95};\\
  24.351 +\hspace*{0pt}\\
  24.352 +\hspace*{0pt}type 'a monoid = {\char123}Program{\char95}{\char95}semigroup{\char95}monoid :~'a semigroup,~neutral :~'a{\char125};\\
  24.353 +\hspace*{0pt}fun semigroup{\char95}monoid (A{\char95}:'a monoid) = {\char35}Program{\char95}{\char95}semigroup{\char95}monoid A{\char95};\\
  24.354 +\hspace*{0pt}fun neutral (A{\char95}:'a monoid) = {\char35}neutral A{\char95};\\
  24.355 +\hspace*{0pt}\\
  24.356 +\hspace*{0pt}fun pow A{\char95}~Zero{\char95}nat a = neutral A{\char95}\\
  24.357 +\hspace*{0pt} ~| pow A{\char95}~(Suc n) a = mult (semigroup{\char95}monoid A{\char95}) a (pow A{\char95}~n a);\\
  24.358 +\hspace*{0pt}\\
  24.359 +\hspace*{0pt}fun plus{\char95}nat (Suc m) n = plus{\char95}nat m (Suc n)\\
  24.360 +\hspace*{0pt} ~| plus{\char95}nat Zero{\char95}nat n = n;\\
  24.361 +\hspace*{0pt}\\
  24.362 +\hspace*{0pt}val neutral{\char95}nat :~nat = Suc Zero{\char95}nat\\
  24.363 +\hspace*{0pt}\\
  24.364 +\hspace*{0pt}fun mult{\char95}nat Zero{\char95}nat n = Zero{\char95}nat\\
  24.365 +\hspace*{0pt} ~| mult{\char95}nat (Suc m) n = plus{\char95}nat n (mult{\char95}nat m n);\\
  24.366 +\hspace*{0pt}\\
  24.367 +\hspace*{0pt}val semigroup{\char95}nat = {\char123}mult = mult{\char95}nat{\char125}~:~nat semigroup;\\
  24.368 +\hspace*{0pt}\\
  24.369 +\hspace*{0pt}val monoid{\char95}nat =\\
  24.370 +\hspace*{0pt} ~{\char123}Program{\char95}{\char95}semigroup{\char95}monoid = semigroup{\char95}nat,~neutral = neutral{\char95}nat{\char125}~:\\
  24.371 +\hspace*{0pt} ~nat monoid;\\
  24.372 +\hspace*{0pt}\\
  24.373 +\hspace*{0pt}fun bexp n = pow monoid{\char95}nat n (Suc (Suc Zero{\char95}nat));\\
  24.374 +\hspace*{0pt}\\
  24.375 +\hspace*{0pt}end;~(*struct Example*)%
  24.376 +\end{isamarkuptext}%
  24.377 +\isamarkuptrue%
  24.378 +%
  24.379 +\endisatagquote
  24.380 +{\isafoldquote}%
  24.381 +%
  24.382 +\isadelimquote
  24.383 +%
  24.384 +\endisadelimquote
  24.385 +%
  24.386 +\begin{isamarkuptext}%
  24.387 +\noindent Note the parameters with trailing underscore (\verb|A_|)
  24.388 +    which are the dictionary parameters.%
  24.389 +\end{isamarkuptext}%
  24.390 +\isamarkuptrue%
  24.391 +%
  24.392 +\isamarkupsubsection{The preprocessor \label{sec:preproc}%
  24.393 +}
  24.394 +\isamarkuptrue%
  24.395 +%
  24.396 +\begin{isamarkuptext}%
  24.397 +Before selected function theorems are turned into abstract
  24.398 +  code, a chain of definitional transformation steps is carried
  24.399 +  out: \emph{preprocessing}.  In essence, the preprocessor
  24.400 +  consists of two components: a \emph{simpset} and \emph{function transformers}.
  24.401 +
  24.402 +  The \emph{simpset} allows to employ the full generality of the Isabelle
  24.403 +  simplifier.  Due to the interpretation of theorems
  24.404 +  as code equations, rewrites are applied to the right
  24.405 +  hand side and the arguments of the left hand side of an
  24.406 +  equation, but never to the constant heading the left hand side.
  24.407 +  An important special case are \emph{inline theorems} which may be
  24.408 +  declared and undeclared using the
  24.409 +  \emph{code inline} or \emph{code inline del} attribute respectively.
  24.410 +
  24.411 +  Some common applications:%
  24.412 +\end{isamarkuptext}%
  24.413 +\isamarkuptrue%
  24.414 +%
  24.415 +\begin{itemize}
  24.416 +%
  24.417 +\begin{isamarkuptext}%
  24.418 +\item replacing non-executable constructs by executable ones:%
  24.419 +\end{isamarkuptext}%
  24.420 +\isamarkuptrue%
  24.421 +%
  24.422 +\isadelimquote
  24.423 +%
  24.424 +\endisadelimquote
  24.425 +%
  24.426 +\isatagquote
  24.427 +\isacommand{lemma}\isamarkupfalse%
  24.428 +\ {\isacharbrackleft}code\ inline{\isacharbrackright}{\isacharcolon}\isanewline
  24.429 +\ \ {\isachardoublequoteopen}x\ {\isasymin}\ set\ xs\ {\isasymlongleftrightarrow}\ x\ mem\ xs{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
  24.430 +\ {\isacharparenleft}induct\ xs{\isacharparenright}\ simp{\isacharunderscore}all%
  24.431 +\endisatagquote
  24.432 +{\isafoldquote}%
  24.433 +%
  24.434 +\isadelimquote
  24.435 +%
  24.436 +\endisadelimquote
  24.437 +%
  24.438 +\begin{isamarkuptext}%
  24.439 +\item eliminating superfluous constants:%
  24.440 +\end{isamarkuptext}%
  24.441 +\isamarkuptrue%
  24.442 +%
  24.443 +\isadelimquote
  24.444 +%
  24.445 +\endisadelimquote
  24.446 +%
  24.447 +\isatagquote
  24.448 +\isacommand{lemma}\isamarkupfalse%
  24.449 +\ {\isacharbrackleft}code\ inline{\isacharbrackright}{\isacharcolon}\isanewline
  24.450 +\ \ {\isachardoublequoteopen}{\isadigit{1}}\ {\isacharequal}\ Suc\ {\isadigit{0}}{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
  24.451 +\ simp%
  24.452 +\endisatagquote
  24.453 +{\isafoldquote}%
  24.454 +%
  24.455 +\isadelimquote
  24.456 +%
  24.457 +\endisadelimquote
  24.458 +%
  24.459 +\begin{isamarkuptext}%
  24.460 +\item replacing executable but inconvenient constructs:%
  24.461 +\end{isamarkuptext}%
  24.462 +\isamarkuptrue%
  24.463 +%
  24.464 +\isadelimquote
  24.465 +%
  24.466 +\endisadelimquote
  24.467 +%
  24.468 +\isatagquote
  24.469 +\isacommand{lemma}\isamarkupfalse%
  24.470 +\ {\isacharbrackleft}code\ inline{\isacharbrackright}{\isacharcolon}\isanewline
  24.471 +\ \ {\isachardoublequoteopen}xs\ {\isacharequal}\ {\isacharbrackleft}{\isacharbrackright}\ {\isasymlongleftrightarrow}\ List{\isachardot}null\ xs{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
  24.472 +\ {\isacharparenleft}induct\ xs{\isacharparenright}\ simp{\isacharunderscore}all%
  24.473 +\endisatagquote
  24.474 +{\isafoldquote}%
  24.475 +%
  24.476 +\isadelimquote
  24.477 +%
  24.478 +\endisadelimquote
  24.479 +%
  24.480 +\end{itemize}
  24.481 +%
  24.482 +\begin{isamarkuptext}%
  24.483 +\noindent \emph{Function transformers} provide a very general interface,
  24.484 +  transforming a list of function theorems to another
  24.485 +  list of function theorems, provided that neither the heading
  24.486 +  constant nor its type change.  The \isa{{\isadigit{0}}} / \isa{Suc}
  24.487 +  pattern elimination implemented in
  24.488 +  theory \isa{Efficient{\isacharunderscore}Nat} (see \secref{eff_nat}) uses this
  24.489 +  interface.
  24.490 +
  24.491 +  \noindent The current setup of the preprocessor may be inspected using
  24.492 +  the \hyperlink{command.print-codesetup}{\mbox{\isa{\isacommand{print{\isacharunderscore}codesetup}}}} command.
  24.493 +  \hyperlink{command.code-thms}{\mbox{\isa{\isacommand{code{\isacharunderscore}thms}}}} provides a convenient
  24.494 +  mechanism to inspect the impact of a preprocessor setup
  24.495 +  on code equations.
  24.496 +
  24.497 +  \begin{warn}
  24.498 +    The attribute \emph{code unfold}
  24.499 +    associated with the \isa{SML\ code\ generator} also applies to
  24.500 +    the \isa{generic\ code\ generator}:
  24.501 +    \emph{code unfold} implies \emph{code inline}.
  24.502 +  \end{warn}%
  24.503 +\end{isamarkuptext}%
  24.504 +\isamarkuptrue%
  24.505 +%
  24.506 +\isamarkupsubsection{Datatypes \label{sec:datatypes}%
  24.507 +}
  24.508 +\isamarkuptrue%
  24.509 +%
  24.510 +\begin{isamarkuptext}%
  24.511 +Conceptually, any datatype is spanned by a set of
  24.512 +  \emph{constructors} of type \isa{{\isasymtau}\ {\isacharequal}\ {\isasymdots}\ {\isasymRightarrow}\ {\isasymkappa}\ {\isasymalpha}\isactrlisub {\isadigit{1}}\ {\isasymdots}\ {\isasymalpha}\isactrlisub n} where \isa{{\isacharbraceleft}{\isasymalpha}\isactrlisub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ {\isasymalpha}\isactrlisub n{\isacharbraceright}} is exactly the set of \emph{all} type variables in
  24.513 +  \isa{{\isasymtau}}.  The HOL datatype package by default registers any new
  24.514 +  datatype in the table of datatypes, which may be inspected using the
  24.515 +  \hyperlink{command.print-codesetup}{\mbox{\isa{\isacommand{print{\isacharunderscore}codesetup}}}} command.
  24.516 +
  24.517 +  In some cases, it is appropriate to alter or extend this table.  As
  24.518 +  an example, we will develop an alternative representation of the
  24.519 +  queue example given in \secref{sec:intro}.  The amortised
  24.520 +  representation is convenient for generating code but exposes its
  24.521 +  \qt{implementation} details, which may be cumbersome when proving
  24.522 +  theorems about it.  Therefore, here a simple, straightforward
  24.523 +  representation of queues:%
  24.524 +\end{isamarkuptext}%
  24.525 +\isamarkuptrue%
  24.526 +%
  24.527 +\isadelimquote
  24.528 +%
  24.529 +\endisadelimquote
  24.530 +%
  24.531 +\isatagquote
  24.532 +\isacommand{datatype}\isamarkupfalse%
  24.533 +\ {\isacharprime}a\ queue\ {\isacharequal}\ Queue\ {\isachardoublequoteopen}{\isacharprime}a\ list{\isachardoublequoteclose}\isanewline
  24.534 +\isanewline
  24.535 +\isacommand{definition}\isamarkupfalse%
  24.536 +\ empty\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a\ queue{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  24.537 +\ \ {\isachardoublequoteopen}empty\ {\isacharequal}\ Queue\ {\isacharbrackleft}{\isacharbrackright}{\isachardoublequoteclose}\isanewline
  24.538 +\isanewline
  24.539 +\isacommand{primrec}\isamarkupfalse%
  24.540 +\ enqueue\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a\ queue\ {\isasymRightarrow}\ {\isacharprime}a\ queue{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  24.541 +\ \ {\isachardoublequoteopen}enqueue\ x\ {\isacharparenleft}Queue\ xs{\isacharparenright}\ {\isacharequal}\ Queue\ {\isacharparenleft}xs\ {\isacharat}\ {\isacharbrackleft}x{\isacharbrackright}{\isacharparenright}{\isachardoublequoteclose}\isanewline
  24.542 +\isanewline
  24.543 +\isacommand{fun}\isamarkupfalse%
  24.544 +\ dequeue\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a\ queue\ {\isasymRightarrow}\ {\isacharprime}a\ option\ {\isasymtimes}\ {\isacharprime}a\ queue{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  24.545 +\ \ \ \ {\isachardoublequoteopen}dequeue\ {\isacharparenleft}Queue\ {\isacharbrackleft}{\isacharbrackright}{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}None{\isacharcomma}\ Queue\ {\isacharbrackleft}{\isacharbrackright}{\isacharparenright}{\isachardoublequoteclose}\isanewline
  24.546 +\ \ {\isacharbar}\ {\isachardoublequoteopen}dequeue\ {\isacharparenleft}Queue\ {\isacharparenleft}x\ {\isacharhash}\ xs{\isacharparenright}{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}Some\ x{\isacharcomma}\ Queue\ xs{\isacharparenright}{\isachardoublequoteclose}%
  24.547 +\endisatagquote
  24.548 +{\isafoldquote}%
  24.549 +%
  24.550 +\isadelimquote
  24.551 +%
  24.552 +\endisadelimquote
  24.553 +%
  24.554 +\begin{isamarkuptext}%
  24.555 +\noindent This we can use directly for proving;  for executing,
  24.556 +  we provide an alternative characterisation:%
  24.557 +\end{isamarkuptext}%
  24.558 +\isamarkuptrue%
  24.559 +%
  24.560 +\isadelimquote
  24.561 +%
  24.562 +\endisadelimquote
  24.563 +%
  24.564 +\isatagquote
  24.565 +\isacommand{definition}\isamarkupfalse%
  24.566 +\ AQueue\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a\ list\ {\isasymRightarrow}\ {\isacharprime}a\ list\ {\isasymRightarrow}\ {\isacharprime}a\ queue{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  24.567 +\ \ {\isachardoublequoteopen}AQueue\ xs\ ys\ {\isacharequal}\ Queue\ {\isacharparenleft}ys\ {\isacharat}\ rev\ xs{\isacharparenright}{\isachardoublequoteclose}\isanewline
  24.568 +\isanewline
  24.569 +\isacommand{code{\isacharunderscore}datatype}\isamarkupfalse%
  24.570 +\ AQueue%
  24.571 +\endisatagquote
  24.572 +{\isafoldquote}%
  24.573 +%
  24.574 +\isadelimquote
  24.575 +%
  24.576 +\endisadelimquote
  24.577 +%
  24.578 +\begin{isamarkuptext}%
  24.579 +\noindent Here we define a \qt{constructor} \isa{Program{\isachardot}AQueue} which
  24.580 +  is defined in terms of \isa{Queue} and interprets its arguments
  24.581 +  according to what the \emph{content} of an amortised queue is supposed
  24.582 +  to be.  Equipped with this, we are able to prove the following equations
  24.583 +  for our primitive queue operations which \qt{implement} the simple
  24.584 +  queues in an amortised fashion:%
  24.585 +\end{isamarkuptext}%
  24.586 +\isamarkuptrue%
  24.587 +%
  24.588 +\isadelimquote
  24.589 +%
  24.590 +\endisadelimquote
  24.591 +%
  24.592 +\isatagquote
  24.593 +\isacommand{lemma}\isamarkupfalse%
  24.594 +\ empty{\isacharunderscore}AQueue\ {\isacharbrackleft}code{\isacharbrackright}{\isacharcolon}\isanewline
  24.595 +\ \ {\isachardoublequoteopen}empty\ {\isacharequal}\ AQueue\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharbrackleft}{\isacharbrackright}{\isachardoublequoteclose}\isanewline
  24.596 +\ \ \isacommand{unfolding}\isamarkupfalse%
  24.597 +\ AQueue{\isacharunderscore}def\ empty{\isacharunderscore}def\ \isacommand{by}\isamarkupfalse%
  24.598 +\ simp\isanewline
  24.599 +\isanewline
  24.600 +\isacommand{lemma}\isamarkupfalse%
  24.601 +\ enqueue{\isacharunderscore}AQueue\ {\isacharbrackleft}code{\isacharbrackright}{\isacharcolon}\isanewline
  24.602 +\ \ {\isachardoublequoteopen}enqueue\ x\ {\isacharparenleft}AQueue\ xs\ ys{\isacharparenright}\ {\isacharequal}\ AQueue\ {\isacharparenleft}x\ {\isacharhash}\ xs{\isacharparenright}\ ys{\isachardoublequoteclose}\isanewline
  24.603 +\ \ \isacommand{unfolding}\isamarkupfalse%
  24.604 +\ AQueue{\isacharunderscore}def\ \isacommand{by}\isamarkupfalse%
  24.605 +\ simp\isanewline
  24.606 +\isanewline
  24.607 +\isacommand{lemma}\isamarkupfalse%
  24.608 +\ dequeue{\isacharunderscore}AQueue\ {\isacharbrackleft}code{\isacharbrackright}{\isacharcolon}\isanewline
  24.609 +\ \ {\isachardoublequoteopen}dequeue\ {\isacharparenleft}AQueue\ xs\ {\isacharbrackleft}{\isacharbrackright}{\isacharparenright}\ {\isacharequal}\isanewline
  24.610 +\ \ \ \ {\isacharparenleft}if\ xs\ {\isacharequal}\ {\isacharbrackleft}{\isacharbrackright}\ then\ {\isacharparenleft}None{\isacharcomma}\ AQueue\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharbrackleft}{\isacharbrackright}{\isacharparenright}\isanewline
  24.611 +\ \ \ \ else\ dequeue\ {\isacharparenleft}AQueue\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharparenleft}rev\ xs{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}\isanewline
  24.612 +\ \ {\isachardoublequoteopen}dequeue\ {\isacharparenleft}AQueue\ xs\ {\isacharparenleft}y\ {\isacharhash}\ ys{\isacharparenright}{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}Some\ y{\isacharcomma}\ AQueue\ xs\ ys{\isacharparenright}{\isachardoublequoteclose}\isanewline
  24.613 +\ \ \isacommand{unfolding}\isamarkupfalse%
  24.614 +\ AQueue{\isacharunderscore}def\ \isacommand{by}\isamarkupfalse%
  24.615 +\ simp{\isacharunderscore}all%
  24.616 +\endisatagquote
  24.617 +{\isafoldquote}%
  24.618 +%
  24.619 +\isadelimquote
  24.620 +%
  24.621 +\endisadelimquote
  24.622 +%
  24.623 +\begin{isamarkuptext}%
  24.624 +\noindent For completeness, we provide a substitute for the
  24.625 +  \isa{case} combinator on queues:%
  24.626 +\end{isamarkuptext}%
  24.627 +\isamarkuptrue%
  24.628 +%
  24.629 +\isadelimquote
  24.630 +%
  24.631 +\endisadelimquote
  24.632 +%
  24.633 +\isatagquote
  24.634 +\isacommand{definition}\isamarkupfalse%
  24.635 +\isanewline
  24.636 +\ \ aqueue{\isacharunderscore}case{\isacharunderscore}def{\isacharcolon}\ {\isachardoublequoteopen}aqueue{\isacharunderscore}case\ {\isacharequal}\ queue{\isacharunderscore}case{\isachardoublequoteclose}\isanewline
  24.637 +\isanewline
  24.638 +\isacommand{lemma}\isamarkupfalse%
  24.639 +\ aqueue{\isacharunderscore}case\ {\isacharbrackleft}code{\isacharcomma}\ code\ inline{\isacharbrackright}{\isacharcolon}\isanewline
  24.640 +\ \ {\isachardoublequoteopen}queue{\isacharunderscore}case\ {\isacharequal}\ aqueue{\isacharunderscore}case{\isachardoublequoteclose}\isanewline
  24.641 +\ \ \isacommand{unfolding}\isamarkupfalse%
  24.642 +\ aqueue{\isacharunderscore}case{\isacharunderscore}def\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
  24.643 +\isanewline
  24.644 +\isanewline
  24.645 +\isacommand{lemma}\isamarkupfalse%
  24.646 +\ case{\isacharunderscore}AQueue\ {\isacharbrackleft}code{\isacharbrackright}{\isacharcolon}\isanewline
  24.647 +\ \ {\isachardoublequoteopen}aqueue{\isacharunderscore}case\ f\ {\isacharparenleft}AQueue\ xs\ ys{\isacharparenright}\ {\isacharequal}\ f\ {\isacharparenleft}ys\ {\isacharat}\ rev\ xs{\isacharparenright}{\isachardoublequoteclose}\isanewline
  24.648 +\ \ \isacommand{unfolding}\isamarkupfalse%
  24.649 +\ aqueue{\isacharunderscore}case{\isacharunderscore}def\ AQueue{\isacharunderscore}def\ \isacommand{by}\isamarkupfalse%
  24.650 +\ simp%
  24.651 +\endisatagquote
  24.652 +{\isafoldquote}%
  24.653 +%
  24.654 +\isadelimquote
  24.655 +%
  24.656 +\endisadelimquote
  24.657 +%
  24.658 +\begin{isamarkuptext}%
  24.659 +\noindent The resulting code looks as expected:%
  24.660 +\end{isamarkuptext}%
  24.661 +\isamarkuptrue%
  24.662 +%
  24.663 +\isadelimquote
  24.664 +%
  24.665 +\endisadelimquote
  24.666 +%
  24.667 +\isatagquote
  24.668 +%
  24.669 +\begin{isamarkuptext}%
  24.670 +\isatypewriter%
  24.671 +\noindent%
  24.672 +\hspace*{0pt}structure Example = \\
  24.673 +\hspace*{0pt}struct\\
  24.674 +\hspace*{0pt}\\
  24.675 +\hspace*{0pt}fun foldl f a [] = a\\
  24.676 +\hspace*{0pt} ~| foldl f a (x ::~xs) = foldl f (f a x) xs;\\
  24.677 +\hspace*{0pt}\\
  24.678 +\hspace*{0pt}fun rev xs = foldl (fn xsa => fn x => x ::~xsa) [] xs;\\
  24.679 +\hspace*{0pt}\\
  24.680 +\hspace*{0pt}fun null [] = true\\
  24.681 +\hspace*{0pt} ~| null (x ::~xs) = false;\\
  24.682 +\hspace*{0pt}\\
  24.683 +\hspace*{0pt}datatype 'a queue = AQueue of 'a list * 'a list;\\
  24.684 +\hspace*{0pt}\\
  24.685 +\hspace*{0pt}val empty :~'a queue = AQueue ([],~[])\\
  24.686 +\hspace*{0pt}\\
  24.687 +\hspace*{0pt}fun dequeue (AQueue (xs,~y ::~ys)) = (SOME y,~AQueue (xs,~ys))\\
  24.688 +\hspace*{0pt} ~| dequeue (AQueue (xs,~[])) =\\
  24.689 +\hspace*{0pt} ~~~(if null xs then (NONE,~AQueue ([],~[]))\\
  24.690 +\hspace*{0pt} ~~~~~else dequeue (AQueue ([],~rev xs)));\\
  24.691 +\hspace*{0pt}\\
  24.692 +\hspace*{0pt}fun enqueue x (AQueue (xs,~ys)) = AQueue (x ::~xs,~ys);\\
  24.693 +\hspace*{0pt}\\
  24.694 +\hspace*{0pt}end;~(*struct Example*)%
  24.695 +\end{isamarkuptext}%
  24.696 +\isamarkuptrue%
  24.697 +%
  24.698 +\endisatagquote
  24.699 +{\isafoldquote}%
  24.700 +%
  24.701 +\isadelimquote
  24.702 +%
  24.703 +\endisadelimquote
  24.704 +%
  24.705 +\begin{isamarkuptext}%
  24.706 +\noindent From this example, it can be glimpsed that using own
  24.707 +  constructor sets is a little delicate since it changes the set of
  24.708 +  valid patterns for values of that type.  Without going into much
  24.709 +  detail, here some practical hints:
  24.710 +
  24.711 +  \begin{itemize}
  24.712 +
  24.713 +    \item When changing the constructor set for datatypes, take care
  24.714 +      to provide an alternative for the \isa{case} combinator
  24.715 +      (e.g.~by replacing it using the preprocessor).
  24.716 +
  24.717 +    \item Values in the target language need not to be normalised --
  24.718 +      different values in the target language may represent the same
  24.719 +      value in the logic.
  24.720 +
  24.721 +    \item Usually, a good methodology to deal with the subtleties of
  24.722 +      pattern matching is to see the type as an abstract type: provide
  24.723 +      a set of operations which operate on the concrete representation
  24.724 +      of the type, and derive further operations by combinations of
  24.725 +      these primitive ones, without relying on a particular
  24.726 +      representation.
  24.727 +
  24.728 +  \end{itemize}%
  24.729 +\end{isamarkuptext}%
  24.730 +\isamarkuptrue%
  24.731 +%
  24.732 +\isamarkupsubsection{Equality and wellsortedness%
  24.733 +}
  24.734 +\isamarkuptrue%
  24.735 +%
  24.736 +\begin{isamarkuptext}%
  24.737 +Surely you have already noticed how equality is treated
  24.738 +  by the code generator:%
  24.739 +\end{isamarkuptext}%
  24.740 +\isamarkuptrue%
  24.741 +%
  24.742 +\isadelimquote
  24.743 +%
  24.744 +\endisadelimquote
  24.745 +%
  24.746 +\isatagquote
  24.747 +\isacommand{primrec}\isamarkupfalse%
  24.748 +\ collect{\isacharunderscore}duplicates\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a\ list\ {\isasymRightarrow}\ {\isacharprime}a\ list\ {\isasymRightarrow}\ {\isacharprime}a\ list\ {\isasymRightarrow}\ {\isacharprime}a\ list{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  24.749 +\ \ {\isachardoublequoteopen}collect{\isacharunderscore}duplicates\ xs\ ys\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharequal}\ xs{\isachardoublequoteclose}\isanewline
  24.750 +\ \ {\isacharbar}\ {\isachardoublequoteopen}collect{\isacharunderscore}duplicates\ xs\ ys\ {\isacharparenleft}z{\isacharhash}zs{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}if\ z\ {\isasymin}\ set\ xs\isanewline
  24.751 +\ \ \ \ \ \ then\ if\ z\ {\isasymin}\ set\ ys\isanewline
  24.752 +\ \ \ \ \ \ \ \ then\ collect{\isacharunderscore}duplicates\ xs\ ys\ zs\isanewline
  24.753 +\ \ \ \ \ \ \ \ else\ collect{\isacharunderscore}duplicates\ xs\ {\isacharparenleft}z{\isacharhash}ys{\isacharparenright}\ zs\isanewline
  24.754 +\ \ \ \ \ \ else\ collect{\isacharunderscore}duplicates\ {\isacharparenleft}z{\isacharhash}xs{\isacharparenright}\ {\isacharparenleft}z{\isacharhash}ys{\isacharparenright}\ zs{\isacharparenright}{\isachardoublequoteclose}%
  24.755 +\endisatagquote
  24.756 +{\isafoldquote}%
  24.757 +%
  24.758 +\isadelimquote
  24.759 +%
  24.760 +\endisadelimquote
  24.761 +%
  24.762 +\begin{isamarkuptext}%
  24.763 +\noindent The membership test during preprocessing is rewritten,
  24.764 +  resulting in \isa{op\ mem}, which itself
  24.765 +  performs an explicit equality check.%
  24.766 +\end{isamarkuptext}%
  24.767 +\isamarkuptrue%
  24.768 +%
  24.769 +\isadelimquote
  24.770 +%
  24.771 +\endisadelimquote
  24.772 +%
  24.773 +\isatagquote
  24.774 +%
  24.775 +\begin{isamarkuptext}%
  24.776 +\isatypewriter%
  24.777 +\noindent%
  24.778 +\hspace*{0pt}structure Example = \\
  24.779 +\hspace*{0pt}struct\\
  24.780 +\hspace*{0pt}\\
  24.781 +\hspace*{0pt}type 'a eq = {\char123}eq :~'a -> 'a -> bool{\char125};\\
  24.782 +\hspace*{0pt}fun eq (A{\char95}:'a eq) = {\char35}eq A{\char95};\\
  24.783 +\hspace*{0pt}\\
  24.784 +\hspace*{0pt}fun eqop A{\char95}~a b = eq A{\char95}~a b;\\
  24.785 +\hspace*{0pt}\\
  24.786 +\hspace*{0pt}fun member A{\char95}~x [] = false\\
  24.787 +\hspace*{0pt} ~| member A{\char95}~x (y ::~ys) = eqop A{\char95}~x y orelse member A{\char95}~x ys;\\
  24.788 +\hspace*{0pt}\\
  24.789 +\hspace*{0pt}fun collect{\char95}duplicates A{\char95}~xs ys [] = xs\\
  24.790 +\hspace*{0pt} ~| collect{\char95}duplicates A{\char95}~xs ys (z ::~zs) =\\
  24.791 +\hspace*{0pt} ~~~(if member A{\char95}~z xs\\
  24.792 +\hspace*{0pt} ~~~~~then (if member A{\char95}~z ys then collect{\char95}duplicates A{\char95}~xs ys zs\\
  24.793 +\hspace*{0pt} ~~~~~~~~~~~~else collect{\char95}duplicates A{\char95}~xs (z ::~ys) zs)\\
  24.794 +\hspace*{0pt} ~~~~~else collect{\char95}duplicates A{\char95}~(z ::~xs) (z ::~ys) zs);\\
  24.795 +\hspace*{0pt}\\
  24.796 +\hspace*{0pt}end;~(*struct Example*)%
  24.797 +\end{isamarkuptext}%
  24.798 +\isamarkuptrue%
  24.799 +%
  24.800 +\endisatagquote
  24.801 +{\isafoldquote}%
  24.802 +%
  24.803 +\isadelimquote
  24.804 +%
  24.805 +\endisadelimquote
  24.806 +%
  24.807 +\begin{isamarkuptext}%
  24.808 +\noindent Obviously, polymorphic equality is implemented the Haskell
  24.809 +  way using a type class.  How is this achieved?  HOL introduces
  24.810 +  an explicit class \isa{eq} with a corresponding operation
  24.811 +  \isa{eq{\isacharunderscore}class{\isachardot}eq} such that \isa{eq{\isacharunderscore}class{\isachardot}eq\ {\isacharequal}\ op\ {\isacharequal}}.
  24.812 +  The preprocessing framework does the rest by propagating the
  24.813 +  \isa{eq} constraints through all dependent code equations.
  24.814 +  For datatypes, instances of \isa{eq} are implicitly derived
  24.815 +  when possible.  For other types, you may instantiate \isa{eq}
  24.816 +  manually like any other type class.
  24.817 +
  24.818 +  Though this \isa{eq} class is designed to get rarely in
  24.819 +  the way, a subtlety
  24.820 +  enters the stage when definitions of overloaded constants
  24.821 +  are dependent on operational equality.  For example, let
  24.822 +  us define a lexicographic ordering on tuples
  24.823 +  (also see theory \hyperlink{theory.Product-ord}{\mbox{\isa{Product{\isacharunderscore}ord}}}):%
  24.824 +\end{isamarkuptext}%
  24.825 +\isamarkuptrue%
  24.826 +%
  24.827 +\isadelimquote
  24.828 +%
  24.829 +\endisadelimquote
  24.830 +%
  24.831 +\isatagquote
  24.832 +\isacommand{instantiation}\isamarkupfalse%
  24.833 +\ {\isachardoublequoteopen}{\isacharasterisk}{\isachardoublequoteclose}\ {\isacharcolon}{\isacharcolon}\ {\isacharparenleft}order{\isacharcomma}\ order{\isacharparenright}\ order\isanewline
  24.834 +\isakeyword{begin}\isanewline
  24.835 +\isanewline
  24.836 +\isacommand{definition}\isamarkupfalse%
  24.837 +\ {\isacharbrackleft}code\ del{\isacharbrackright}{\isacharcolon}\isanewline
  24.838 +\ \ {\isachardoublequoteopen}x\ {\isasymle}\ y\ {\isasymlongleftrightarrow}\ fst\ x\ {\isacharless}\ fst\ y\ {\isasymor}\ fst\ x\ {\isacharequal}\ fst\ y\ {\isasymand}\ snd\ x\ {\isasymle}\ snd\ y{\isachardoublequoteclose}\isanewline
  24.839 +\isanewline
  24.840 +\isacommand{definition}\isamarkupfalse%
  24.841 +\ {\isacharbrackleft}code\ del{\isacharbrackright}{\isacharcolon}\isanewline
  24.842 +\ \ {\isachardoublequoteopen}x\ {\isacharless}\ y\ {\isasymlongleftrightarrow}\ fst\ x\ {\isacharless}\ fst\ y\ {\isasymor}\ fst\ x\ {\isacharequal}\ fst\ y\ {\isasymand}\ snd\ x\ {\isacharless}\ snd\ y{\isachardoublequoteclose}\isanewline
  24.843 +\isanewline
  24.844 +\isacommand{instance}\isamarkupfalse%
  24.845 +\ \isacommand{proof}\isamarkupfalse%
  24.846 +\isanewline
  24.847 +\isacommand{qed}\isamarkupfalse%
  24.848 +\ {\isacharparenleft}auto\ simp{\isacharcolon}\ less{\isacharunderscore}eq{\isacharunderscore}prod{\isacharunderscore}def\ less{\isacharunderscore}prod{\isacharunderscore}def\ intro{\isacharcolon}\ order{\isacharunderscore}less{\isacharunderscore}trans{\isacharparenright}\isanewline
  24.849 +\isanewline
  24.850 +\isacommand{end}\isamarkupfalse%
  24.851 +\isanewline
  24.852 +\isanewline
  24.853 +\isacommand{lemma}\isamarkupfalse%
  24.854 +\ order{\isacharunderscore}prod\ {\isacharbrackleft}code{\isacharbrackright}{\isacharcolon}\isanewline
  24.855 +\ \ {\isachardoublequoteopen}{\isacharparenleft}x{\isadigit{1}}\ {\isasymColon}\ {\isacharprime}a{\isasymColon}order{\isacharcomma}\ y{\isadigit{1}}\ {\isasymColon}\ {\isacharprime}b{\isasymColon}order{\isacharparenright}\ {\isacharless}\ {\isacharparenleft}x{\isadigit{2}}{\isacharcomma}\ y{\isadigit{2}}{\isacharparenright}\ {\isasymlongleftrightarrow}\isanewline
  24.856 +\ \ \ \ \ x{\isadigit{1}}\ {\isacharless}\ x{\isadigit{2}}\ {\isasymor}\ x{\isadigit{1}}\ {\isacharequal}\ x{\isadigit{2}}\ {\isasymand}\ y{\isadigit{1}}\ {\isacharless}\ y{\isadigit{2}}{\isachardoublequoteclose}\isanewline
  24.857 +\ \ {\isachardoublequoteopen}{\isacharparenleft}x{\isadigit{1}}\ {\isasymColon}\ {\isacharprime}a{\isasymColon}order{\isacharcomma}\ y{\isadigit{1}}\ {\isasymColon}\ {\isacharprime}b{\isasymColon}order{\isacharparenright}\ {\isasymle}\ {\isacharparenleft}x{\isadigit{2}}{\isacharcomma}\ y{\isadigit{2}}{\isacharparenright}\ {\isasymlongleftrightarrow}\isanewline
  24.858 +\ \ \ \ \ x{\isadigit{1}}\ {\isacharless}\ x{\isadigit{2}}\ {\isasymor}\ x{\isadigit{1}}\ {\isacharequal}\ x{\isadigit{2}}\ {\isasymand}\ y{\isadigit{1}}\ {\isasymle}\ y{\isadigit{2}}{\isachardoublequoteclose}\isanewline
  24.859 +\ \ \isacommand{by}\isamarkupfalse%
  24.860 +\ {\isacharparenleft}simp{\isacharunderscore}all\ add{\isacharcolon}\ less{\isacharunderscore}prod{\isacharunderscore}def\ less{\isacharunderscore}eq{\isacharunderscore}prod{\isacharunderscore}def{\isacharparenright}%
  24.861 +\endisatagquote
  24.862 +{\isafoldquote}%
  24.863 +%
  24.864 +\isadelimquote
  24.865 +%
  24.866 +\endisadelimquote
  24.867 +%
  24.868 +\begin{isamarkuptext}%
  24.869 +\noindent Then code generation will fail.  Why?  The definition
  24.870 +  of \isa{op\ {\isasymle}} depends on equality on both arguments,
  24.871 +  which are polymorphic and impose an additional \isa{eq}
  24.872 +  class constraint, which the preprocessor does not propagate
  24.873 +  (for technical reasons).
  24.874 +
  24.875 +  The solution is to add \isa{eq} explicitly to the first sort arguments in the
  24.876 +  code theorems:%
  24.877 +\end{isamarkuptext}%
  24.878 +\isamarkuptrue%
  24.879 +%
  24.880 +\isadelimquote
  24.881 +%
  24.882 +\endisadelimquote
  24.883 +%
  24.884 +\isatagquote
  24.885 +\isacommand{lemma}\isamarkupfalse%
  24.886 +\ order{\isacharunderscore}prod{\isacharunderscore}code\ {\isacharbrackleft}code{\isacharbrackright}{\isacharcolon}\isanewline
  24.887 +\ \ {\isachardoublequoteopen}{\isacharparenleft}x{\isadigit{1}}\ {\isasymColon}\ {\isacharprime}a{\isasymColon}{\isacharbraceleft}order{\isacharcomma}\ eq{\isacharbraceright}{\isacharcomma}\ y{\isadigit{1}}\ {\isasymColon}\ {\isacharprime}b{\isasymColon}order{\isacharparenright}\ {\isacharless}\ {\isacharparenleft}x{\isadigit{2}}{\isacharcomma}\ y{\isadigit{2}}{\isacharparenright}\ {\isasymlongleftrightarrow}\isanewline
  24.888 +\ \ \ \ \ x{\isadigit{1}}\ {\isacharless}\ x{\isadigit{2}}\ {\isasymor}\ x{\isadigit{1}}\ {\isacharequal}\ x{\isadigit{2}}\ {\isasymand}\ y{\isadigit{1}}\ {\isacharless}\ y{\isadigit{2}}{\isachardoublequoteclose}\isanewline
  24.889 +\ \ {\isachardoublequoteopen}{\isacharparenleft}x{\isadigit{1}}\ {\isasymColon}\ {\isacharprime}a{\isasymColon}{\isacharbraceleft}order{\isacharcomma}\ eq{\isacharbraceright}{\isacharcomma}\ y{\isadigit{1}}\ {\isasymColon}\ {\isacharprime}b{\isasymColon}order{\isacharparenright}\ {\isasymle}\ {\isacharparenleft}x{\isadigit{2}}{\isacharcomma}\ y{\isadigit{2}}{\isacharparenright}\ {\isasymlongleftrightarrow}\isanewline
  24.890 +\ \ \ \ \ x{\isadigit{1}}\ {\isacharless}\ x{\isadigit{2}}\ {\isasymor}\ x{\isadigit{1}}\ {\isacharequal}\ x{\isadigit{2}}\ {\isasymand}\ y{\isadigit{1}}\ {\isasymle}\ y{\isadigit{2}}{\isachardoublequoteclose}\isanewline
  24.891 +\ \ \isacommand{by}\isamarkupfalse%
  24.892 +\ {\isacharparenleft}simp{\isacharunderscore}all\ add{\isacharcolon}\ less{\isacharunderscore}prod{\isacharunderscore}def\ less{\isacharunderscore}eq{\isacharunderscore}prod{\isacharunderscore}def{\isacharparenright}%
  24.893 +\endisatagquote
  24.894 +{\isafoldquote}%
  24.895 +%
  24.896 +\isadelimquote
  24.897 +%
  24.898 +\endisadelimquote
  24.899 +%
  24.900 +\begin{isamarkuptext}%
  24.901 +\noindent Then code generation succeeds:%
  24.902 +\end{isamarkuptext}%
  24.903 +\isamarkuptrue%
  24.904 +%
  24.905 +\isadelimquote
  24.906 +%
  24.907 +\endisadelimquote
  24.908 +%
  24.909 +\isatagquote
  24.910 +%
  24.911 +\begin{isamarkuptext}%
  24.912 +\isatypewriter%
  24.913 +\noindent%
  24.914 +\hspace*{0pt}structure Example = \\
  24.915 +\hspace*{0pt}struct\\
  24.916 +\hspace*{0pt}\\
  24.917 +\hspace*{0pt}type 'a eq = {\char123}eq :~'a -> 'a -> bool{\char125};\\
  24.918 +\hspace*{0pt}fun eq (A{\char95}:'a eq) = {\char35}eq A{\char95};\\
  24.919 +\hspace*{0pt}\\
  24.920 +\hspace*{0pt}type 'a ord = {\char123}less{\char95}eq :~'a -> 'a -> bool,~less :~'a -> 'a -> bool{\char125};\\
  24.921 +\hspace*{0pt}fun less{\char95}eq (A{\char95}:'a ord) = {\char35}less{\char95}eq A{\char95};\\
  24.922 +\hspace*{0pt}fun less (A{\char95}:'a ord) = {\char35}less A{\char95};\\
  24.923 +\hspace*{0pt}\\
  24.924 +\hspace*{0pt}fun eqop A{\char95}~a b = eq A{\char95}~a b;\\
  24.925 +\hspace*{0pt}\\
  24.926 +\hspace*{0pt}type 'a preorder = {\char123}Orderings{\char95}{\char95}ord{\char95}preorder :~'a ord{\char125};\\
  24.927 +\hspace*{0pt}fun ord{\char95}preorder (A{\char95}:'a preorder) = {\char35}Orderings{\char95}{\char95}ord{\char95}preorder A{\char95};\\
  24.928 +\hspace*{0pt}\\
  24.929 +\hspace*{0pt}type 'a order = {\char123}Orderings{\char95}{\char95}preorder{\char95}order :~'a preorder{\char125};\\
  24.930 +\hspace*{0pt}fun preorder{\char95}order (A{\char95}:'a order) = {\char35}Orderings{\char95}{\char95}preorder{\char95}order A{\char95};\\
  24.931 +\hspace*{0pt}\\
  24.932 +\hspace*{0pt}fun less{\char95}eqa (A1{\char95},~A2{\char95}) B{\char95}~(x1,~y1) (x2,~y2) =\\
  24.933 +\hspace*{0pt} ~less ((ord{\char95}preorder o preorder{\char95}order) A2{\char95}) x1 x2 orelse\\
  24.934 +\hspace*{0pt} ~~~eqop A1{\char95}~x1 x2 andalso\\
  24.935 +\hspace*{0pt} ~~~~~less{\char95}eq ((ord{\char95}preorder o preorder{\char95}order) B{\char95}) y1 y2\\
  24.936 +\hspace*{0pt} ~| less{\char95}eqa (A1{\char95},~A2{\char95}) B{\char95}~(x1,~y1) (x2,~y2) =\\
  24.937 +\hspace*{0pt} ~~~less ((ord{\char95}preorder o preorder{\char95}order) A2{\char95}) x1 x2 orelse\\
  24.938 +\hspace*{0pt} ~~~~~eqop A1{\char95}~x1 x2 andalso\\
  24.939 +\hspace*{0pt} ~~~~~~~less{\char95}eq ((ord{\char95}preorder o preorder{\char95}order) B{\char95}) y1 y2;\\
  24.940 +\hspace*{0pt}\\
  24.941 +\hspace*{0pt}end;~(*struct Example*)%
  24.942 +\end{isamarkuptext}%
  24.943 +\isamarkuptrue%
  24.944 +%
  24.945 +\endisatagquote
  24.946 +{\isafoldquote}%
  24.947 +%
  24.948 +\isadelimquote
  24.949 +%
  24.950 +\endisadelimquote
  24.951 +%
  24.952 +\begin{isamarkuptext}%
  24.953 +In some cases, the automatically derived code equations
  24.954 +  for equality on a particular type may not be appropriate.
  24.955 +  As example, watch the following datatype representing
  24.956 +  monomorphic parametric types (where type constructors
  24.957 +  are referred to by natural numbers):%
  24.958 +\end{isamarkuptext}%
  24.959 +\isamarkuptrue%
  24.960 +%
  24.961 +\isadelimquote
  24.962 +%
  24.963 +\endisadelimquote
  24.964 +%
  24.965 +\isatagquote
  24.966 +\isacommand{datatype}\isamarkupfalse%
  24.967 +\ monotype\ {\isacharequal}\ Mono\ nat\ {\isachardoublequoteopen}monotype\ list{\isachardoublequoteclose}%
  24.968 +\endisatagquote
  24.969 +{\isafoldquote}%
  24.970 +%
  24.971 +\isadelimquote
  24.972 +%
  24.973 +\endisadelimquote
  24.974 +%
  24.975 +\isadelimproof
  24.976 +%
  24.977 +\endisadelimproof
  24.978 +%
  24.979 +\isatagproof
  24.980 +%
  24.981 +\endisatagproof
  24.982 +{\isafoldproof}%
  24.983 +%
  24.984 +\isadelimproof
  24.985 +%
  24.986 +\endisadelimproof
  24.987 +%
  24.988 +\begin{isamarkuptext}%
  24.989 +\noindent Then code generation for SML would fail with a message
  24.990 +  that the generated code contains illegal mutual dependencies:
  24.991 +  the theorem \isa{eq{\isacharunderscore}class{\isachardot}eq\ {\isacharparenleft}Mono\ tyco{\isadigit{1}}\ typargs{\isadigit{1}}{\isacharparenright}\ {\isacharparenleft}Mono\ tyco{\isadigit{2}}\ typargs{\isadigit{2}}{\isacharparenright}\ {\isasymequiv}\ eq{\isacharunderscore}class{\isachardot}eq\ tyco{\isadigit{1}}\ tyco{\isadigit{2}}\ {\isasymand}\ eq{\isacharunderscore}class{\isachardot}eq\ typargs{\isadigit{1}}\ typargs{\isadigit{2}}} already requires the
  24.992 +  instance \isa{monotype\ {\isasymColon}\ eq}, which itself requires
  24.993 +  \isa{eq{\isacharunderscore}class{\isachardot}eq\ {\isacharparenleft}Mono\ tyco{\isadigit{1}}\ typargs{\isadigit{1}}{\isacharparenright}\ {\isacharparenleft}Mono\ tyco{\isadigit{2}}\ typargs{\isadigit{2}}{\isacharparenright}\ {\isasymequiv}\ eq{\isacharunderscore}class{\isachardot}eq\ tyco{\isadigit{1}}\ tyco{\isadigit{2}}\ {\isasymand}\ eq{\isacharunderscore}class{\isachardot}eq\ typargs{\isadigit{1}}\ typargs{\isadigit{2}}};  Haskell has no problem with mutually
  24.994 +  recursive \isa{instance} and \isa{function} definitions,
  24.995 +  but the SML serialiser does not support this.
  24.996 +
  24.997 +  In such cases, you have to provide your own equality equations
  24.998 +  involving auxiliary constants.  In our case,
  24.999 +  \isa{list{\isacharunderscore}all{\isadigit{2}}} can do the job:%
 24.1000 +\end{isamarkuptext}%
 24.1001 +\isamarkuptrue%
 24.1002 +%
 24.1003 +\isadelimquote
 24.1004 +%
 24.1005 +\endisadelimquote
 24.1006 +%
 24.1007 +\isatagquote
 24.1008 +\isacommand{lemma}\isamarkupfalse%
 24.1009 +\ monotype{\isacharunderscore}eq{\isacharunderscore}list{\isacharunderscore}all{\isadigit{2}}\ {\isacharbrackleft}code{\isacharbrackright}{\isacharcolon}\isanewline
 24.1010 +\ \ {\isachardoublequoteopen}eq{\isacharunderscore}class{\isachardot}eq\ {\isacharparenleft}Mono\ tyco{\isadigit{1}}\ typargs{\isadigit{1}}{\isacharparenright}\ {\isacharparenleft}Mono\ tyco{\isadigit{2}}\ typargs{\isadigit{2}}{\isacharparenright}\ {\isasymlongleftrightarrow}\isanewline
 24.1011 +\ \ \ \ \ eq{\isacharunderscore}class{\isachardot}eq\ tyco{\isadigit{1}}\ tyco{\isadigit{2}}\ {\isasymand}\ list{\isacharunderscore}all{\isadigit{2}}\ eq{\isacharunderscore}class{\isachardot}eq\ typargs{\isadigit{1}}\ typargs{\isadigit{2}}{\isachardoublequoteclose}\isanewline
 24.1012 +\ \ \isacommand{by}\isamarkupfalse%
 24.1013 +\ {\isacharparenleft}simp\ add{\isacharcolon}\ eq\ list{\isacharunderscore}all{\isadigit{2}}{\isacharunderscore}eq\ {\isacharbrackleft}symmetric{\isacharbrackright}{\isacharparenright}%
 24.1014 +\endisatagquote
 24.1015 +{\isafoldquote}%
 24.1016 +%
 24.1017 +\isadelimquote
 24.1018 +%
 24.1019 +\endisadelimquote
 24.1020 +%
 24.1021 +\begin{isamarkuptext}%
 24.1022 +\noindent does not depend on instance \isa{monotype\ {\isasymColon}\ eq}:%
 24.1023 +\end{isamarkuptext}%
 24.1024 +\isamarkuptrue%
 24.1025 +%
 24.1026 +\isadelimquote
 24.1027 +%
 24.1028 +\endisadelimquote
 24.1029 +%
 24.1030 +\isatagquote
 24.1031 +%
 24.1032 +\begin{isamarkuptext}%
 24.1033 +\isatypewriter%
 24.1034 +\noindent%
 24.1035 +\hspace*{0pt}structure Example = \\
 24.1036 +\hspace*{0pt}struct\\
 24.1037 +\hspace*{0pt}\\
 24.1038 +\hspace*{0pt}datatype nat = Zero{\char95}nat | Suc of nat;\\
 24.1039 +\hspace*{0pt}\\
 24.1040 +\hspace*{0pt}fun null [] = true\\
 24.1041 +\hspace*{0pt} ~| null (x ::~xs) = false;\\
 24.1042 +\hspace*{0pt}\\
 24.1043 +\hspace*{0pt}fun eq{\char95}nat (Suc a) Zero{\char95}nat = false\\
 24.1044 +\hspace*{0pt} ~| eq{\char95}nat Zero{\char95}nat (Suc a) = false\\
 24.1045 +\hspace*{0pt} ~| eq{\char95}nat (Suc nat) (Suc nat') = eq{\char95}nat nat nat'\\
 24.1046 +\hspace*{0pt} ~| eq{\char95}nat Zero{\char95}nat Zero{\char95}nat = true;\\
 24.1047 +\hspace*{0pt}\\
 24.1048 +\hspace*{0pt}datatype monotype = Mono of nat * monotype list;\\
 24.1049 +\hspace*{0pt}\\
 24.1050 +\hspace*{0pt}fun list{\char95}all2 p (x ::~xs) (y ::~ys) = p x y andalso list{\char95}all2 p xs ys\\
 24.1051 +\hspace*{0pt} ~| list{\char95}all2 p xs [] = null xs\\
 24.1052 +\hspace*{0pt} ~| list{\char95}all2 p [] ys = null ys;\\
 24.1053 +\hspace*{0pt}\\
 24.1054 +\hspace*{0pt}fun eq{\char95}monotype (Mono (tyco1,~typargs1)) (Mono (tyco2,~typargs2)) =\\
 24.1055 +\hspace*{0pt} ~eq{\char95}nat tyco1 tyco2 andalso list{\char95}all2 eq{\char95}monotype typargs1 typargs2;\\
 24.1056 +\hspace*{0pt}\\
 24.1057 +\hspace*{0pt}end;~(*struct Example*)%
 24.1058 +\end{isamarkuptext}%
 24.1059 +\isamarkuptrue%
 24.1060 +%
 24.1061 +\endisatagquote
 24.1062 +{\isafoldquote}%
 24.1063 +%
 24.1064 +\isadelimquote
 24.1065 +%
 24.1066 +\endisadelimquote
 24.1067 +%
 24.1068 +\isamarkupsubsection{Explicit partiality%
 24.1069 +}
 24.1070 +\isamarkuptrue%
 24.1071 +%
 24.1072 +\begin{isamarkuptext}%
 24.1073 +Partiality usually enters the game by partial patterns, as
 24.1074 +  in the following example, again for amortised queues:%
 24.1075 +\end{isamarkuptext}%
 24.1076 +\isamarkuptrue%
 24.1077 +%
 24.1078 +\isadelimquote
 24.1079 +%
 24.1080 +\endisadelimquote
 24.1081 +%
 24.1082 +\isatagquote
 24.1083 +\isacommand{definition}\isamarkupfalse%
 24.1084 +\ strict{\isacharunderscore}dequeue\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a\ queue\ {\isasymRightarrow}\ {\isacharprime}a\ {\isasymtimes}\ {\isacharprime}a\ queue{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
 24.1085 +\ \ {\isachardoublequoteopen}strict{\isacharunderscore}dequeue\ q\ {\isacharequal}\ {\isacharparenleft}case\ dequeue\ q\isanewline
 24.1086 +\ \ \ \ of\ {\isacharparenleft}Some\ x{\isacharcomma}\ q{\isacharprime}{\isacharparenright}\ {\isasymRightarrow}\ {\isacharparenleft}x{\isacharcomma}\ q{\isacharprime}{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}\isanewline
 24.1087 +\isanewline
 24.1088 +\isacommand{lemma}\isamarkupfalse%
 24.1089 +\ strict{\isacharunderscore}dequeue{\isacharunderscore}AQueue\ {\isacharbrackleft}code{\isacharbrackright}{\isacharcolon}\isanewline
 24.1090 +\ \ {\isachardoublequoteopen}strict{\isacharunderscore}dequeue\ {\isacharparenleft}AQueue\ xs\ {\isacharparenleft}y\ {\isacharhash}\ ys{\isacharparenright}{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}y{\isacharcomma}\ AQueue\ xs\ ys{\isacharparenright}{\isachardoublequoteclose}\isanewline
 24.1091 +\ \ {\isachardoublequoteopen}strict{\isacharunderscore}dequeue\ {\isacharparenleft}AQueue\ xs\ {\isacharbrackleft}{\isacharbrackright}{\isacharparenright}\ {\isacharequal}\isanewline
 24.1092 +\ \ \ \ {\isacharparenleft}case\ rev\ xs\ of\ y\ {\isacharhash}\ ys\ {\isasymRightarrow}\ {\isacharparenleft}y{\isacharcomma}\ AQueue\ {\isacharbrackleft}{\isacharbrackright}\ ys{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}\isanewline
 24.1093 +\ \ \isacommand{by}\isamarkupfalse%
 24.1094 +\ {\isacharparenleft}simp{\isacharunderscore}all\ add{\isacharcolon}\ strict{\isacharunderscore}dequeue{\isacharunderscore}def\ dequeue{\isacharunderscore}AQueue\ split{\isacharcolon}\ list{\isachardot}splits{\isacharparenright}%
 24.1095 +\endisatagquote
 24.1096 +{\isafoldquote}%
 24.1097 +%
 24.1098 +\isadelimquote
 24.1099 +%
 24.1100 +\endisadelimquote
 24.1101 +%
 24.1102 +\begin{isamarkuptext}%
 24.1103 +\noindent In the corresponding code, there is no equation
 24.1104 +  for the pattern \isa{Program{\isachardot}AQueue\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharbrackleft}{\isacharbrackright}}:%
 24.1105 +\end{isamarkuptext}%
 24.1106 +\isamarkuptrue%
 24.1107 +%
 24.1108 +\isadelimquote
 24.1109 +%
 24.1110 +\endisadelimquote
 24.1111 +%
 24.1112 +\isatagquote
 24.1113 +%
 24.1114 +\begin{isamarkuptext}%
 24.1115 +\isatypewriter%
 24.1116 +\noindent%
 24.1117 +\hspace*{0pt}strict{\char95}dequeue ::~forall a.~Queue a -> (a,~Queue a);\\
 24.1118 +\hspace*{0pt}strict{\char95}dequeue (AQueue xs []) =\\
 24.1119 +\hspace*{0pt} ~let {\char123}\\
 24.1120 +\hspace*{0pt} ~~~(y :~ys) = rev xs;\\
 24.1121 +\hspace*{0pt} ~{\char125}~in (y,~AQueue [] ys);\\
 24.1122 +\hspace*{0pt}strict{\char95}dequeue (AQueue xs (y :~ys)) = (y,~AQueue xs ys);%
 24.1123 +\end{isamarkuptext}%
 24.1124 +\isamarkuptrue%
 24.1125 +%
 24.1126 +\endisatagquote
 24.1127 +{\isafoldquote}%
 24.1128 +%
 24.1129 +\isadelimquote
 24.1130 +%
 24.1131 +\endisadelimquote
 24.1132 +%
 24.1133 +\begin{isamarkuptext}%
 24.1134 +\noindent In some cases it is desirable to have this
 24.1135 +  pseudo-\qt{partiality} more explicitly, e.g.~as follows:%
 24.1136 +\end{isamarkuptext}%
 24.1137 +\isamarkuptrue%
 24.1138 +%
 24.1139 +\isadelimquote
 24.1140 +%
 24.1141 +\endisadelimquote
 24.1142 +%
 24.1143 +\isatagquote
 24.1144 +\isacommand{axiomatization}\isamarkupfalse%
 24.1145 +\ empty{\isacharunderscore}queue\ {\isacharcolon}{\isacharcolon}\ {\isacharprime}a\isanewline
 24.1146 +\isanewline
 24.1147 +\isacommand{definition}\isamarkupfalse%
 24.1148 +\ strict{\isacharunderscore}dequeue{\isacharprime}\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a\ queue\ {\isasymRightarrow}\ {\isacharprime}a\ {\isasymtimes}\ {\isacharprime}a\ queue{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
 24.1149 +\ \ {\isachardoublequoteopen}strict{\isacharunderscore}dequeue{\isacharprime}\ q\ {\isacharequal}\ {\isacharparenleft}case\ dequeue\ q\ of\ {\isacharparenleft}Some\ x{\isacharcomma}\ q{\isacharprime}{\isacharparenright}\ {\isasymRightarrow}\ {\isacharparenleft}x{\isacharcomma}\ q{\isacharprime}{\isacharparenright}\ {\isacharbar}\ {\isacharunderscore}\ {\isasymRightarrow}\ empty{\isacharunderscore}queue{\isacharparenright}{\isachardoublequoteclose}\isanewline
 24.1150 +\isanewline
 24.1151 +\isacommand{lemma}\isamarkupfalse%
 24.1152 +\ strict{\isacharunderscore}dequeue{\isacharprime}{\isacharunderscore}AQueue\ {\isacharbrackleft}code{\isacharbrackright}{\isacharcolon}\isanewline
 24.1153 +\ \ {\isachardoublequoteopen}strict{\isacharunderscore}dequeue{\isacharprime}\ {\isacharparenleft}AQueue\ xs\ {\isacharbrackleft}{\isacharbrackright}{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}if\ xs\ {\isacharequal}\ {\isacharbrackleft}{\isacharbrackright}\ then\ empty{\isacharunderscore}queue\isanewline
 24.1154 +\ \ \ \ \ else\ strict{\isacharunderscore}dequeue{\isacharprime}\ {\isacharparenleft}AQueue\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharparenleft}rev\ xs{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}\isanewline
 24.1155 +\ \ {\isachardoublequoteopen}strict{\isacharunderscore}dequeue{\isacharprime}\ {\isacharparenleft}AQueue\ xs\ {\isacharparenleft}y\ {\isacharhash}\ ys{\isacharparenright}{\isacharparenright}\ {\isacharequal}\isanewline
 24.1156 +\ \ \ \ \ {\isacharparenleft}y{\isacharcomma}\ AQueue\ xs\ ys{\isacharparenright}{\isachardoublequoteclose}\isanewline
 24.1157 +\ \ \isacommand{by}\isamarkupfalse%
 24.1158 +\ {\isacharparenleft}simp{\isacharunderscore}all\ add{\isacharcolon}\ strict{\isacharunderscore}dequeue{\isacharprime}{\isacharunderscore}def\ dequeue{\isacharunderscore}AQueue\ split{\isacharcolon}\ list{\isachardot}splits{\isacharparenright}%
 24.1159 +\endisatagquote
 24.1160 +{\isafoldquote}%
 24.1161 +%
 24.1162 +\isadelimquote
 24.1163 +%
 24.1164 +\endisadelimquote
 24.1165 +%
 24.1166 +\begin{isamarkuptext}%
 24.1167 +Observe that on the right hand side of the definition of \isa{strict{\isacharunderscore}dequeue{\isacharprime}} the constant \isa{empty{\isacharunderscore}queue} occurs
 24.1168 +  which is unspecified.
 24.1169 +
 24.1170 +  Normally, if constants without any code equations occur in a
 24.1171 +  program, the code generator complains (since in most cases this is
 24.1172 +  not what the user expects).  But such constants can also be thought
 24.1173 +  of as function definitions with no equations which always fail,
 24.1174 +  since there is never a successful pattern match on the left hand
 24.1175 +  side.  In order to categorise a constant into that category
 24.1176 +  explicitly, use \hyperlink{command.code-abort}{\mbox{\isa{\isacommand{code{\isacharunderscore}abort}}}}:%
 24.1177 +\end{isamarkuptext}%
 24.1178 +\isamarkuptrue%
 24.1179 +%
 24.1180 +\isadelimquote
 24.1181 +%
 24.1182 +\endisadelimquote
 24.1183 +%
 24.1184 +\isatagquote
 24.1185 +\isacommand{code{\isacharunderscore}abort}\isamarkupfalse%
 24.1186 +\ empty{\isacharunderscore}queue%
 24.1187 +\endisatagquote
 24.1188 +{\isafoldquote}%
 24.1189 +%
 24.1190 +\isadelimquote
 24.1191 +%
 24.1192 +\endisadelimquote
 24.1193 +%
 24.1194 +\begin{isamarkuptext}%
 24.1195 +\noindent Then the code generator will just insert an error or
 24.1196 +  exception at the appropriate position:%
 24.1197 +\end{isamarkuptext}%
 24.1198 +\isamarkuptrue%
 24.1199 +%
 24.1200 +\isadelimquote
 24.1201 +%
 24.1202 +\endisadelimquote
 24.1203 +%
 24.1204 +\isatagquote
 24.1205 +%
 24.1206 +\begin{isamarkuptext}%
 24.1207 +\isatypewriter%
 24.1208 +\noindent%
 24.1209 +\hspace*{0pt}empty{\char95}queue ::~forall a.~a;\\
 24.1210 +\hspace*{0pt}empty{\char95}queue = error {\char34}empty{\char95}queue{\char34};\\
 24.1211 +\hspace*{0pt}\\
 24.1212 +\hspace*{0pt}strict{\char95}dequeue' ::~forall a.~Queue a -> (a,~Queue a);\\
 24.1213 +\hspace*{0pt}strict{\char95}dequeue' (AQueue xs (y :~ys)) = (y,~AQueue xs ys);\\
 24.1214 +\hspace*{0pt}strict{\char95}dequeue' (AQueue xs []) =\\
 24.1215 +\hspace*{0pt} ~(if nulla xs then empty{\char95}queue\\
 24.1216 +\hspace*{0pt} ~~~else strict{\char95}dequeue' (AQueue [] (rev xs)));%
 24.1217 +\end{isamarkuptext}%
 24.1218 +\isamarkuptrue%
 24.1219 +%
 24.1220 +\endisatagquote
 24.1221 +{\isafoldquote}%
 24.1222 +%
 24.1223 +\isadelimquote
 24.1224 +%
 24.1225 +\endisadelimquote
 24.1226 +%
 24.1227 +\begin{isamarkuptext}%
 24.1228 +\noindent This feature however is rarely needed in practice.
 24.1229 +  Note also that the \isa{HOL} default setup already declares
 24.1230 +  \isa{undefined} as \hyperlink{command.code-abort}{\mbox{\isa{\isacommand{code{\isacharunderscore}abort}}}}, which is most
 24.1231 +  likely to be used in such situations.%
 24.1232 +\end{isamarkuptext}%
 24.1233 +\isamarkuptrue%
 24.1234 +%
 24.1235 +\isadelimtheory
 24.1236 +%
 24.1237 +\endisadelimtheory
 24.1238 +%
 24.1239 +\isatagtheory
 24.1240 +\isacommand{end}\isamarkupfalse%
 24.1241 +%
 24.1242 +\endisatagtheory
 24.1243 +{\isafoldtheory}%
 24.1244 +%
 24.1245 +\isadelimtheory
 24.1246 +%
 24.1247 +\endisadelimtheory
 24.1248 +\isanewline
 24.1249 +\ \end{isabellebody}%
 24.1250 +%%% Local Variables:
 24.1251 +%%% mode: latex
 24.1252 +%%% TeX-master: "root"
 24.1253 +%%% End:
    25.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.2 +++ b/doc-src/Codegen/Thy/examples/Codegen.hs	Tue Mar 03 11:00:51 2009 +0100
    25.3 @@ -0,0 +1,23 @@
    25.4 +module Codegen where {
    25.5 +
    25.6 +import qualified Nat;
    25.7 +
    25.8 +class Null a where {
    25.9 +  nulla :: a;
   25.10 +};
   25.11 +
   25.12 +heada :: forall a. (Codegen.Null a) => [a] -> a;
   25.13 +heada (x : xs) = x;
   25.14 +heada [] = Codegen.nulla;
   25.15 +
   25.16 +null_option :: forall a. Maybe a;
   25.17 +null_option = Nothing;
   25.18 +
   25.19 +instance Codegen.Null (Maybe a) where {
   25.20 +  nulla = Codegen.null_option;
   25.21 +};
   25.22 +
   25.23 +dummy :: Maybe Nat.Nat;
   25.24 +dummy = Codegen.heada [Just (Nat.Suc Nat.Zero_nat), Nothing];
   25.25 +
   25.26 +}
    26.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.2 +++ b/doc-src/Codegen/Thy/examples/Example.hs	Tue Mar 03 11:00:51 2009 +0100
    26.3 @@ -0,0 +1,33 @@
    26.4 +{-# OPTIONS_GHC -fglasgow-exts #-}
    26.5 +
    26.6 +module Example where {
    26.7 +
    26.8 +
    26.9 +foldla :: forall a b. (a -> b -> a) -> a -> [b] -> a;
   26.10 +foldla f a [] = a;
   26.11 +foldla f a (x : xs) = foldla f (f a x) xs;
   26.12 +
   26.13 +rev :: forall a. [a] -> [a];
   26.14 +rev xs = foldla (\ xsa x -> x : xsa) [] xs;
   26.15 +
   26.16 +list_case :: forall t a. t -> (a -> [a] -> t) -> [a] -> t;
   26.17 +list_case f1 f2 (a : list) = f2 a list;
   26.18 +list_case f1 f2 [] = f1;
   26.19 +
   26.20 +data Queue a = AQueue [a] [a];
   26.21 +
   26.22 +empty :: forall a. Queue a;
   26.23 +empty = AQueue [] [];
   26.24 +
   26.25 +dequeue :: forall a. Queue a -> (Maybe a, Queue a);
   26.26 +dequeue (AQueue [] []) = (Nothing, AQueue [] []);
   26.27 +dequeue (AQueue xs (y : ys)) = (Just y, AQueue xs ys);
   26.28 +dequeue (AQueue (v : va) []) =
   26.29 +  let {
   26.30 +    (y : ys) = rev (v : va);
   26.31 +  } in (Just y, AQueue [] ys);
   26.32 +
   26.33 +enqueue :: forall a. a -> Queue a -> Queue a;
   26.34 +enqueue x (AQueue xs ys) = AQueue (x : xs) ys;
   26.35 +
   26.36 +}
    27.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.2 +++ b/doc-src/Codegen/Thy/examples/arbitrary.ML	Tue Mar 03 11:00:51 2009 +0100
    27.3 @@ -0,0 +1,9 @@
    27.4 +structure Codegen = 
    27.5 +struct
    27.6 +
    27.7 +val arbitrary_option : 'a option = NONE;
    27.8 +
    27.9 +fun dummy_option [] = arbitrary_option
   27.10 +  | dummy_option (x :: xs) = SOME x;
   27.11 +
   27.12 +end; (*struct Codegen*)
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/doc-src/Codegen/Thy/examples/bool_infix.ML	Tue Mar 03 11:00:51 2009 +0100
    28.3 @@ -0,0 +1,19 @@
    28.4 +structure Nat = 
    28.5 +struct
    28.6 +
    28.7 +datatype nat = Suc of nat | Zero_nat;
    28.8 +
    28.9 +fun less_nat m (Suc n) = less_eq_nat m n
   28.10 +  | less_nat n Zero_nat = false
   28.11 +and less_eq_nat (Suc m) n = less_nat m n
   28.12 +  | less_eq_nat Zero_nat n = true;
   28.13 +
   28.14 +end; (*struct Nat*)
   28.15 +
   28.16 +structure Codegen = 
   28.17 +struct
   28.18 +
   28.19 +fun in_interval (k, l) n =
   28.20 +  Nat.less_eq_nat k n andalso Nat.less_eq_nat n l;
   28.21 +
   28.22 +end; (*struct Codegen*)
    29.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.2 +++ b/doc-src/Codegen/Thy/examples/bool_literal.ML	Tue Mar 03 11:00:51 2009 +0100
    29.3 @@ -0,0 +1,31 @@
    29.4 +structure HOL = 
    29.5 +struct
    29.6 +
    29.7 +datatype boola = False | True;
    29.8 +
    29.9 +fun anda x True = x
   29.10 +  | anda x False = False
   29.11 +  | anda True x = x
   29.12 +  | anda False x = False;
   29.13 +
   29.14 +end; (*struct HOL*)
   29.15 +
   29.16 +structure Nat = 
   29.17 +struct
   29.18 +
   29.19 +datatype nat = Suc of nat | Zero_nat;
   29.20 +
   29.21 +fun less_nat m (Suc n) = less_eq_nat m n
   29.22 +  | less_nat n Zero_nat = HOL.False
   29.23 +and less_eq_nat (Suc m) n = less_nat m n
   29.24 +  | less_eq_nat Zero_nat n = HOL.True;
   29.25 +
   29.26 +end; (*struct Nat*)
   29.27 +
   29.28 +structure Codegen = 
   29.29 +struct
   29.30 +
   29.31 +fun in_interval (k, l) n =
   29.32 +  HOL.anda (Nat.less_eq_nat k n) (Nat.less_eq_nat n l);
   29.33 +
   29.34 +end; (*struct Codegen*)
    30.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.2 +++ b/doc-src/Codegen/Thy/examples/bool_mlbool.ML	Tue Mar 03 11:00:51 2009 +0100
    30.3 @@ -0,0 +1,19 @@
    30.4 +structure Nat = 
    30.5 +struct
    30.6 +
    30.7 +datatype nat = Suc of nat | Zero_nat;
    30.8 +
    30.9 +fun less_nat m (Suc n) = less_eq_nat m n
   30.10 +  | less_nat n Zero_nat = false
   30.11 +and less_eq_nat (Suc m) n = less_nat m n
   30.12 +  | less_eq_nat Zero_nat n = true;
   30.13 +
   30.14 +end; (*struct Nat*)
   30.15 +
   30.16 +structure Codegen = 
   30.17 +struct
   30.18 +
   30.19 +fun in_interval (k, l) n =
   30.20 +  (Nat.less_eq_nat k n) andalso (Nat.less_eq_nat n l);
   30.21 +
   30.22 +end; (*struct Codegen*)
    31.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.2 +++ b/doc-src/Codegen/Thy/examples/class.ML	Tue Mar 03 11:00:51 2009 +0100
    31.3 @@ -0,0 +1,24 @@
    31.4 +structure Nat = 
    31.5 +struct
    31.6 +
    31.7 +datatype nat = Suc of nat | Zero_nat;
    31.8 +
    31.9 +end; (*struct Nat*)
   31.10 +
   31.11 +structure Codegen = 
   31.12 +struct
   31.13 +
   31.14 +type 'a null = {null : 'a};
   31.15 +fun null (A_:'a null) = #null A_;
   31.16 +
   31.17 +fun head A_ (x :: xs) = x
   31.18 +  | head A_ [] = null A_;
   31.19 +
   31.20 +val null_option : 'a option = NONE;
   31.21 +
   31.22 +fun null_optiona () = {null = null_option} : ('a option) null;
   31.23 +
   31.24 +val dummy : Nat.nat option =
   31.25 +  head (null_optiona ()) [SOME (Nat.Suc Nat.Zero_nat), NONE];
   31.26 +
   31.27 +end; (*struct Codegen*)
    32.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.2 +++ b/doc-src/Codegen/Thy/examples/class.ocaml	Tue Mar 03 11:00:51 2009 +0100
    32.3 @@ -0,0 +1,24 @@
    32.4 +module Nat = 
    32.5 +struct
    32.6 +
    32.7 +type nat = Suc of nat | Zero_nat;;
    32.8 +
    32.9 +end;; (*struct Nat*)
   32.10 +
   32.11 +module Codegen = 
   32.12 +struct
   32.13 +
   32.14 +type 'a null = {null : 'a};;
   32.15 +let null _A = _A.null;;
   32.16 +
   32.17 +let rec head _A = function x :: xs -> x
   32.18 +                  | [] -> null _A;;
   32.19 +
   32.20 +let rec null_option = None;;
   32.21 +
   32.22 +let null_optiona () = ({null = null_option} : ('a option) null);;
   32.23 +
   32.24 +let rec dummy
   32.25 +  = head (null_optiona ()) [Some (Nat.Suc Nat.Zero_nat); None];;
   32.26 +
   32.27 +end;; (*struct Codegen*)
    33.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.2 +++ b/doc-src/Codegen/Thy/examples/collect_duplicates.ML	Tue Mar 03 11:00:51 2009 +0100
    33.3 @@ -0,0 +1,30 @@
    33.4 +structure HOL = 
    33.5 +struct
    33.6 +
    33.7 +type 'a eq = {eq : 'a -> 'a -> bool};
    33.8 +fun eq (A_:'a eq) = #eq A_;
    33.9 +
   33.10 +fun eqop A_ a = eq A_ a;
   33.11 +
   33.12 +end; (*struct HOL*)
   33.13 +
   33.14 +structure List = 
   33.15 +struct
   33.16 +
   33.17 +fun member A_ x (y :: ys) =
   33.18 +  (if HOL.eqop A_ y x then true else member A_ x ys)
   33.19 +  | member A_ x [] = false;
   33.20 +
   33.21 +end; (*struct List*)
   33.22 +
   33.23 +structure Codegen = 
   33.24 +struct
   33.25 +
   33.26 +fun collect_duplicates A_ xs ys (z :: zs) =
   33.27 +  (if List.member A_ z xs
   33.28 +    then (if List.member A_ z ys then collect_duplicates A_ xs ys zs
   33.29 +           else collect_duplicates A_ xs (z :: ys) zs)
   33.30 +    else collect_duplicates A_ (z :: xs) (z :: ys) zs)
   33.31 +  | collect_duplicates A_ xs ys [] = xs;
   33.32 +
   33.33 +end; (*struct Codegen*)
    34.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.2 +++ b/doc-src/Codegen/Thy/examples/dirty_set.ML	Tue Mar 03 11:00:51 2009 +0100
    34.3 @@ -0,0 +1,102 @@
    34.4 +structure ROOT = 
    34.5 +struct
    34.6 +
    34.7 +structure Nat = 
    34.8 +struct
    34.9 +
   34.10 +datatype nat = Zero_nat | Suc of nat;
   34.11 +
   34.12 +end; (*struct Nat*)
   34.13 +
   34.14 +structure Integer = 
   34.15 +struct
   34.16 +
   34.17 +datatype bit = B0 | B1;
   34.18 +
   34.19 +datatype int = Pls | Min | Bit of int * bit | Number_of_int of int;
   34.20 +
   34.21 +fun pred (Bit (k, B0)) = Bit (pred k, B1)
   34.22 +  | pred (Bit (k, B1)) = Bit (k, B0)
   34.23 +  | pred Min = Bit (Min, B0)
   34.24 +  | pred Pls = Min;
   34.25 +
   34.26 +fun uminus_int (Number_of_int w) = Number_of_int (uminus_int w)
   34.27 +  | uminus_int (Bit (k, B0)) = Bit (uminus_int k, B0)
   34.28 +  | uminus_int (Bit (k, B1)) = Bit (pred (uminus_int k), B1)
   34.29 +  | uminus_int Min = Bit (Pls, B1)
   34.30 +  | uminus_int Pls = Pls;
   34.31 +
   34.32 +fun succ (Bit (k, B0)) = Bit (k, B1)
   34.33 +  | succ (Bit (k, B1)) = Bit (succ k, B0)
   34.34 +  | succ Min = Pls
   34.35 +  | succ Pls = Bit (Pls, B1);
   34.36 +
   34.37 +fun plus_int (Number_of_int v) (Number_of_int w) =
   34.38 +  Number_of_int (plus_int v w)
   34.39 +  | plus_int k Min = pred k
   34.40 +  | plus_int k Pls = k
   34.41 +  | plus_int (Bit (k, B1)) (Bit (l, B1)) = Bit (plus_int k (succ l), B0)
   34.42 +  | plus_int (Bit (k, B1)) (Bit (l, B0)) = Bit (plus_int k l, B1)
   34.43 +  | plus_int (Bit (k, B0)) (Bit (l, b)) = Bit (plus_int k l, b)
   34.44 +  | plus_int Min k = pred k
   34.45 +  | plus_int Pls k = k;
   34.46 +
   34.47 +fun minus_int (Number_of_int v) (Number_of_int w) =
   34.48 +  Number_of_int (plus_int v (uminus_int w))
   34.49 +  | minus_int z w = plus_int z (uminus_int w);
   34.50 +
   34.51 +fun less_eq_int (Number_of_int k) (Number_of_int l) = less_eq_int k l
   34.52 +  | less_eq_int (Bit (k1, B1)) (Bit (k2, B0)) = less_int k1 k2
   34.53 +  | less_eq_int (Bit (k1, v)) (Bit (k2, B1)) = less_eq_int k1 k2
   34.54 +  | less_eq_int (Bit (k1, B0)) (Bit (k2, v)) = less_eq_int k1 k2
   34.55 +  | less_eq_int (Bit (k, v)) Min = less_eq_int k Min
   34.56 +  | less_eq_int (Bit (k, B1)) Pls = less_int k Pls
   34.57 +  | less_eq_int (Bit (k, B0)) Pls = less_eq_int k Pls
   34.58 +  | less_eq_int Min (Bit (k, B1)) = less_eq_int Min k
   34.59 +  | less_eq_int Min (Bit (k, B0)) = less_int Min k
   34.60 +  | less_eq_int Min Min = true
   34.61 +  | less_eq_int Min Pls = true
   34.62 +  | less_eq_int Pls (Bit (k, v)) = less_eq_int Pls k
   34.63 +  | less_eq_int Pls Min = false
   34.64 +  | less_eq_int Pls Pls = true
   34.65 +and less_int (Number_of_int k) (Number_of_int l) = less_int k l
   34.66 +  | less_int (Bit (k1, B0)) (Bit (k2, B1)) = less_eq_int k1 k2
   34.67 +  | less_int (Bit (k1, B1)) (Bit (k2, v)) = less_int k1 k2
   34.68 +  | less_int (Bit (k1, v)) (Bit (k2, B0)) = less_int k1 k2
   34.69 +  | less_int (Bit (k, B1)) Min = less_int k Min
   34.70 +  | less_int (Bit (k, B0)) Min = less_eq_int k Min
   34.71 +  | less_int (Bit (k, v)) Pls = less_int k Pls
   34.72 +  | less_int Min (Bit (k, v)) = less_int Min k
   34.73 +  | less_int Min Min = false
   34.74 +  | less_int Min Pls = true
   34.75 +  | less_int Pls (Bit (k, B1)) = less_eq_int Pls k
   34.76 +  | less_int Pls (Bit (k, B0)) = less_int Pls k
   34.77 +  | less_int Pls Min = false
   34.78 +  | less_int Pls Pls = false;
   34.79 +
   34.80 +fun nat_aux n i =
   34.81 +  (if less_eq_int i (Number_of_int Pls) then n
   34.82 +    else nat_aux (Nat.Suc n)
   34.83 +           (minus_int i (Number_of_int (Bit (Pls, B1)))));
   34.84 +
   34.85 +fun nat i = nat_aux Nat.Zero_nat i;
   34.86 +
   34.87 +end; (*struct Integer*)
   34.88 +
   34.89 +structure Codegen = 
   34.90 +struct
   34.91 +
   34.92 +val dummy_set : (Nat.nat -> Nat.nat) list = Nat.Suc :: [];
   34.93 +
   34.94 +val foobar_set : Nat.nat list =
   34.95 +  Nat.Zero_nat ::
   34.96 +    (Nat.Suc Nat.Zero_nat ::
   34.97 +      (Integer.nat
   34.98 +         (Integer.Number_of_int
   34.99 +           (Integer.Bit
  34.100 +             (Integer.Bit (Integer.Pls, Integer.B1), Integer.B0)))
  34.101 +        :: []));
  34.102 +
  34.103 +end; (*struct Codegen*)
  34.104 +
  34.105 +end; (*struct ROOT*)
    35.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.2 +++ b/doc-src/Codegen/Thy/examples/example.ML	Tue Mar 03 11:00:51 2009 +0100
    35.3 @@ -0,0 +1,27 @@
    35.4 +structure Example = 
    35.5 +struct
    35.6 +
    35.7 +fun foldl f a [] = a
    35.8 +  | foldl f a (x :: xs) = foldl f (f a x) xs;
    35.9 +
   35.10 +fun rev xs = foldl (fn xsa => fn x => x :: xsa) [] xs;
   35.11 +
   35.12 +fun list_case f1 f2 (a :: lista) = f2 a lista
   35.13 +  | list_case f1 f2 [] = f1;
   35.14 +
   35.15 +datatype 'a queue = AQueue of 'a list * 'a list;
   35.16 +
   35.17 +val empty : 'a queue = AQueue ([], [])
   35.18 +
   35.19 +fun dequeue (AQueue ([], [])) = (NONE, AQueue ([], []))
   35.20 +  | dequeue (AQueue (xs, y :: ys)) = (SOME y, AQueue (xs, ys))
   35.21 +  | dequeue (AQueue (v :: va, [])) =
   35.22 +    let
   35.23 +      val y :: ys = rev (v :: va);
   35.24 +    in
   35.25 +      (SOME y, AQueue ([], ys))
   35.26 +    end;
   35.27 +
   35.28 +fun enqueue x (AQueue (xs, ys)) = AQueue (x :: xs, ys);
   35.29 +
   35.30 +end; (*struct Example*)
    36.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.2 +++ b/doc-src/Codegen/Thy/examples/fac.ML	Tue Mar 03 11:00:51 2009 +0100
    36.3 @@ -0,0 +1,22 @@
    36.4 +structure Nat = 
    36.5 +struct
    36.6 +
    36.7 +datatype nat = Suc of nat | Zero_nat;
    36.8 +
    36.9 +val one_nat : nat = Suc Zero_nat;
   36.10 +
   36.11 +fun plus_nat (Suc m) n = plus_nat m (Suc n)
   36.12 +  | plus_nat Zero_nat n = n;
   36.13 +
   36.14 +fun times_nat (Suc m) n = plus_nat n (times_nat m n)
   36.15 +  | times_nat Zero_nat n = Zero_nat;
   36.16 +
   36.17 +end; (*struct Nat*)
   36.18 +
   36.19 +structure Codegen = 
   36.20 +struct
   36.21 +
   36.22 +fun fac (Nat.Suc n) = Nat.times_nat (Nat.Suc n) (fac n)
   36.23 +  | fac Nat.Zero_nat = Nat.one_nat;
   36.24 +
   36.25 +end; (*struct Codegen*)
    37.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.2 +++ b/doc-src/Codegen/Thy/examples/integers.ML	Tue Mar 03 11:00:51 2009 +0100
    37.3 @@ -0,0 +1,59 @@
    37.4 +structure ROOT = 
    37.5 +struct
    37.6 +
    37.7 +structure Integer = 
    37.8 +struct
    37.9 +
   37.10 +datatype bit = B0 | B1;
   37.11 +
   37.12 +datatype int = Pls | Min | Bit of int * bit | Number_of_int of int;
   37.13 +
   37.14 +fun pred (Bit (k, B0)) = Bit (pred k, B1)
   37.15 +  | pred (Bit (k, B1)) = Bit (k, B0)
   37.16 +  | pred Min = Bit (Min, B0)
   37.17 +  | pred Pls = Min;
   37.18 +
   37.19 +fun succ (Bit (k, B0)) = Bit (k, B1)
   37.20 +  | succ (Bit (k, B1)) = Bit (succ k, B0)
   37.21 +  | succ Min = Pls
   37.22 +  | succ Pls = Bit (Pls, B1);
   37.23 +
   37.24 +fun plus_int (Number_of_int v) (Number_of_int w) =
   37.25 +  Number_of_int (plus_int v w)
   37.26 +  | plus_int k Min = pred k
   37.27 +  | plus_int k Pls = k
   37.28 +  | plus_int (Bit (k, B1)) (Bit (l, B1)) = Bit (plus_int k (succ l), B0)
   37.29 +  | plus_int (Bit (k, B1)) (Bit (l, B0)) = Bit (plus_int k l, B1)
   37.30 +  | plus_int (Bit (k, B0)) (Bit (l, b)) = Bit (plus_int k l, b)
   37.31 +  | plus_int Min k = pred k
   37.32 +  | plus_int Pls k = k;
   37.33 +
   37.34 +fun uminus_int (Number_of_int w) = Number_of_int (uminus_int w)
   37.35 +  | uminus_int (Bit (k, B0)) = Bit (uminus_int k, B0)
   37.36 +  | uminus_int (Bit (k, B1)) = Bit (pred (uminus_int k), B1)
   37.37 +  | uminus_int Min = Bit (Pls, B1)
   37.38 +  | uminus_int Pls = Pls;
   37.39 +
   37.40 +fun times_int (Number_of_int v) (Number_of_int w) =
   37.41 +  Number_of_int (times_int v w)
   37.42 +  | times_int (Bit (k, B0)) l = Bit (times_int k l, B0)
   37.43 +  | times_int (Bit (k, B1)) l = plus_int (Bit (times_int k l, B0)) l
   37.44 +  | times_int Min k = uminus_int k
   37.45 +  | times_int Pls w = Pls;
   37.46 +
   37.47 +end; (*struct Integer*)
   37.48 +
   37.49 +structure Codegen = 
   37.50 +struct
   37.51 +
   37.52 +fun double_inc k =
   37.53 +  Integer.plus_int
   37.54 +    (Integer.times_int
   37.55 +      (Integer.Number_of_int
   37.56 +        (Integer.Bit (Integer.Bit (Integer.Pls, Integer.B1), Integer.B0)))
   37.57 +      k)
   37.58 +    (Integer.Number_of_int (Integer.Bit (Integer.Pls, Integer.B1)));
   37.59 +
   37.60 +end; (*struct Codegen*)
   37.61 +
   37.62 +end; (*struct ROOT*)
    38.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    38.2 +++ b/doc-src/Codegen/Thy/examples/lexicographic.ML	Tue Mar 03 11:00:51 2009 +0100
    38.3 @@ -0,0 +1,19 @@
    38.4 +structure HOL = 
    38.5 +struct
    38.6 +
    38.7 +type 'a eq = {eq : 'a -> 'a -> bool};
    38.8 +fun eq (A_:'a eq) = #eq A_;
    38.9 +
   38.10 +type 'a ord = {less_eq : 'a -> 'a -> bool, less : 'a -> 'a -> bool};
   38.11 +fun less_eq (A_:'a ord) = #less_eq A_;
   38.12 +fun less (A_:'a ord) = #less A_;
   38.13 +
   38.14 +end; (*struct HOL*)
   38.15 +
   38.16 +structure Codegen = 
   38.17 +struct
   38.18 +
   38.19 +fun less_eq (A1_, A2_) B_ (x1, y1) (x2, y2) =
   38.20 +  HOL.less A2_ x1 x2 orelse HOL.eq A1_ x1 x2 andalso HOL.less_eq B_ y1 y2;
   38.21 +
   38.22 +end; (*struct Codegen*)
    39.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.2 +++ b/doc-src/Codegen/Thy/examples/lookup.ML	Tue Mar 03 11:00:51 2009 +0100
    39.3 @@ -0,0 +1,13 @@
    39.4 +structure ROOT = 
    39.5 +struct
    39.6 +
    39.7 +structure Codegen = 
    39.8 +struct
    39.9 +
   39.10 +fun lookup ((k, v) :: xs) l =
   39.11 +  (if ((k : string) = l) then SOME v else lookup xs l)
   39.12 +  | lookup [] l = NONE;
   39.13 +
   39.14 +end; (*struct Codegen*)
   39.15 +
   39.16 +end; (*struct ROOT*)
    40.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.2 +++ b/doc-src/Codegen/Thy/examples/monotype.ML	Tue Mar 03 11:00:51 2009 +0100
    40.3 @@ -0,0 +1,34 @@
    40.4 +structure Nat = 
    40.5 +struct
    40.6 +
    40.7 +datatype nat = Suc of nat | Zero_nat;
    40.8 +
    40.9 +fun eq_nat (Suc a) Zero_nat = false
   40.10 +  | eq_nat Zero_nat (Suc a) = false
   40.11 +  | eq_nat (Suc nat) (Suc nat') = eq_nat nat nat'
   40.12 +  | eq_nat Zero_nat Zero_nat = true;
   40.13 +
   40.14 +end; (*struct Nat*)
   40.15 +
   40.16 +structure List = 
   40.17 +struct
   40.18 +
   40.19 +fun null (x :: xs) = false
   40.20 +  | null [] = true;
   40.21 +
   40.22 +fun list_all2 p (x :: xs) (y :: ys) = p x y andalso list_all2 p xs ys
   40.23 +  | list_all2 p xs [] = null xs
   40.24 +  | list_all2 p [] ys = null ys;
   40.25 +
   40.26 +end; (*struct List*)
   40.27 +
   40.28 +structure Codegen = 
   40.29 +struct
   40.30 +
   40.31 +datatype monotype = Mono of Nat.nat * monotype list;
   40.32 +
   40.33 +fun eq_monotype (Mono (tyco1, typargs1)) (Mono (tyco2, typargs2)) =
   40.34 +  Nat.eq_nat tyco1 tyco2 andalso
   40.35 +    List.list_all2 eq_monotype typargs1 typargs2;
   40.36 +
   40.37 +end; (*struct Codegen*)
    41.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.2 +++ b/doc-src/Codegen/Thy/examples/nat_binary.ML	Tue Mar 03 11:00:51 2009 +0100
    41.3 @@ -0,0 +1,17 @@
    41.4 +structure Nat = 
    41.5 +struct
    41.6 +
    41.7 +datatype nat = Dig1 of nat | Dig0 of nat | One_nat | Zero_nat;
    41.8 +
    41.9 +fun plus_nat (Dig1 m) (Dig1 n) = Dig0 (plus_nat (plus_nat m n) One_nat)
   41.10 +  | plus_nat (Dig1 m) (Dig0 n) = Dig1 (plus_nat m n)
   41.11 +  | plus_nat (Dig0 m) (Dig1 n) = Dig1 (plus_nat m n)
   41.12 +  | plus_nat (Dig0 m) (Dig0 n) = Dig0 (plus_nat m n)
   41.13 +  | plus_nat (Dig1 m) One_nat = Dig0 (plus_nat m One_nat)
   41.14 +  | plus_nat One_nat (Dig1 n) = Dig0 (plus_nat n One_nat)
   41.15 +  | plus_nat (Dig0 m) One_nat = Dig1 m
   41.16 +  | plus_nat One_nat (Dig0 n) = Dig1 n
   41.17 +  | plus_nat m Zero_nat = m
   41.18 +  | plus_nat Zero_nat n = n;
   41.19 +
   41.20 +end; (*struct Nat*)
    42.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.2 +++ b/doc-src/Codegen/Thy/examples/pick1.ML	Tue Mar 03 11:00:51 2009 +0100
    42.3 @@ -0,0 +1,44 @@
    42.4 +structure HOL = 
    42.5 +struct
    42.6 +
    42.7 +fun leta s f = f s;
    42.8 +
    42.9 +end; (*struct HOL*)
   42.10 +
   42.11 +structure Nat = 
   42.12 +struct
   42.13 +
   42.14 +datatype nat = Suc of nat | Zero_nat;
   42.15 +
   42.16 +fun less_nat m (Suc n) = less_eq_nat m n
   42.17 +  | less_nat n Zero_nat = false
   42.18 +and less_eq_nat (Suc m) n = less_nat m n
   42.19 +  | less_eq_nat Zero_nat n = true;
   42.20 +
   42.21 +fun minus_nat (Suc m) (Suc n) = minus_nat m n
   42.22 +  | minus_nat Zero_nat n = Zero_nat
   42.23 +  | minus_nat m Zero_nat = m;
   42.24 +
   42.25 +end; (*struct Nat*)
   42.26 +
   42.27 +structure Product_Type = 
   42.28 +struct
   42.29 +
   42.30 +fun split f (a, b) = f a b;
   42.31 +
   42.32 +end; (*struct Product_Type*)
   42.33 +
   42.34 +structure Codegen = 
   42.35 +struct
   42.36 +
   42.37 +fun pick ((k, v) :: xs) n =
   42.38 +  (if Nat.less_nat n k then v else pick xs (Nat.minus_nat n k))
   42.39 +  | pick (x :: xs) n =
   42.40 +    let
   42.41 +      val a = x;
   42.42 +      val (k, v) = a;
   42.43 +    in
   42.44 +      (if Nat.less_nat n k then v else pick xs (Nat.minus_nat n k))
   42.45 +    end;
   42.46 +
   42.47 +end; (*struct Codegen*)
    43.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.2 +++ b/doc-src/Codegen/Thy/examples/tree.ML	Tue Mar 03 11:00:51 2009 +0100
    43.3 @@ -0,0 +1,95 @@
    43.4 +structure HOL = 
    43.5 +struct
    43.6 +
    43.7 +type 'a eq = {eq : 'a -> 'a -> bool};
    43.8 +fun eq (A_:'a eq) = #eq A_;
    43.9 +
   43.10 +type 'a ord = {less_eq : 'a -> 'a -> bool, less : 'a -> 'a -> bool};
   43.11 +fun less_eq (A_:'a ord) = #less_eq A_;
   43.12 +fun less (A_:'a ord) = #less A_;
   43.13 +
   43.14 +fun eqop A_ a = eq A_ a;
   43.15 +
   43.16 +end; (*struct HOL*)
   43.17 +
   43.18 +structure Orderings = 
   43.19 +struct
   43.20 +
   43.21 +type 'a preorder = {Orderings__ord_preorder : 'a HOL.ord};
   43.22 +fun ord_preorder (A_:'a preorder) = #Orderings__ord_preorder A_;
   43.23 +
   43.24 +type 'a order = {Orderings__preorder_order : 'a preorder};
   43.25 +fun preorder_order (A_:'a order) = #Orderings__preorder_order A_;
   43.26 +
   43.27 +type 'a linorder = {Orderings__order_linorder : 'a order};
   43.28 +fun order_linorder (A_:'a linorder) = #Orderings__order_linorder A_;
   43.29 +
   43.30 +end; (*struct Orderings*)
   43.31 +
   43.32 +structure Nat = 
   43.33 +struct
   43.34 +
   43.35 +datatype nat = Suc of nat | Zero_nat;
   43.36 +
   43.37 +fun eq_nat (Suc a) Zero_nat = false
   43.38 +  | eq_nat Zero_nat (Suc a) = false
   43.39 +  | eq_nat (Suc nat) (Suc nat') = eq_nat nat nat'
   43.40 +  | eq_nat Zero_nat Zero_nat = true;
   43.41 +
   43.42 +val eq_nata = {eq = eq_nat} : nat HOL.eq;
   43.43 +
   43.44 +fun less_nat m (Suc n) = less_eq_nat m n
   43.45 +  | less_nat n Zero_nat = false
   43.46 +and less_eq_nat (Suc m) n = less_nat m n
   43.47 +  | less_eq_nat Zero_nat n = true;
   43.48 +
   43.49 +val ord_nat = {less_eq = less_eq_nat, less = less_nat} : nat HOL.ord;
   43.50 +
   43.51 +val preorder_nat = {Orderings__ord_preorder = ord_nat} :
   43.52 +  nat Orderings.preorder;
   43.53 +
   43.54 +val order_nat = {Orderings__preorder_order = preorder_nat} :
   43.55 +  nat Orderings.order;
   43.56 +
   43.57 +val linorder_nat = {Orderings__order_linorder = order_nat} :
   43.58 +  nat Orderings.linorder;
   43.59 +
   43.60 +end; (*struct Nat*)
   43.61 +
   43.62 +structure Codegen = 
   43.63 +struct
   43.64 +
   43.65 +datatype ('a, 'b) searchtree =
   43.66 +  Branch of ('a, 'b) searchtree * 'a * ('a, 'b) searchtree |
   43.67 +  Leaf of 'a * 'b;
   43.68 +
   43.69 +fun update (A1_, A2_) (it, entry) (Leaf (key, vala)) =
   43.70 +  (if HOL.eqop A1_ it key then Leaf (key, entry)
   43.71 +    else (if HOL.less_eq
   43.72 +               ((Orderings.ord_preorder o Orderings.preorder_order o
   43.73 +                  Orderings.order_linorder)
   43.74 +                 A2_)
   43.75 +               it key
   43.76 +           then Branch (Leaf (it, entry), it, Leaf (key, vala))
   43.77 +           else Branch (Leaf (key, vala), it, Leaf (it, entry))))
   43.78 +  | update (A1_, A2_) (it, entry) (Branch (t1, key, t2)) =
   43.79 +    (if HOL.less_eq
   43.80 +          ((Orderings.ord_preorder o Orderings.preorder_order o
   43.81 +             Orderings.order_linorder)
   43.82 +            A2_)
   43.83 +          it key
   43.84 +      then Branch (update (A1_, A2_) (it, entry) t1, key, t2)
   43.85 +      else Branch (t1, key, update (A1_, A2_) (it, entry) t2));
   43.86 +
   43.87 +val example : (Nat.nat, (Nat.nat list)) searchtree =
   43.88 +  update (Nat.eq_nata, Nat.linorder_nat)
   43.89 +    (Nat.Suc (Nat.Suc (Nat.Suc (Nat.Suc Nat.Zero_nat))),
   43.90 +      [Nat.Suc (Nat.Suc Nat.Zero_nat), Nat.Suc (Nat.Suc Nat.Zero_nat)])
   43.91 +    (update (Nat.eq_nata, Nat.linorder_nat)
   43.92 +      (Nat.Suc (Nat.Suc (Nat.Suc Nat.Zero_nat)),
   43.93 +        [Nat.Suc (Nat.Suc (Nat.Suc Nat.Zero_nat))])
   43.94 +      (update (Nat.eq_nata, Nat.linorder_nat)
   43.95 +        (Nat.Suc (Nat.Suc Nat.Zero_nat), [Nat.Suc (Nat.Suc Nat.Zero_nat)])
   43.96 +        (Leaf (Nat.Suc Nat.Zero_nat, []))));
   43.97 +
   43.98 +end; (*struct Codegen*)
    44.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.2 +++ b/doc-src/Codegen/codegen.tex	Tue Mar 03 11:00:51 2009 +0100
    44.3 @@ -0,0 +1,53 @@
    44.4 +
    44.5 +\documentclass[12pt,a4paper,fleqn]{report}
    44.6 +\usepackage{latexsym,graphicx}
    44.7 +\usepackage[refpage]{nomencl}
    44.8 +\usepackage{../iman,../extra,../isar,../proof}
    44.9 +\usepackage{../isabelle,../isabellesym}
   44.10 +\usepackage{style}
   44.11 +\usepackage{pgf}
   44.12 +\usepackage{pgflibraryshapes}
   44.13 +\usepackage{tikz}
   44.14 +\usepackage{../pdfsetup}
   44.15 +
   44.16 +\hyphenation{Isabelle}
   44.17 +\hyphenation{Isar}
   44.18 +\isadroptag{theory}
   44.19 +
   44.20 +\title{\includegraphics[scale=0.5]{isabelle_isar}
   44.21 +  \\[4ex] Code generation from Isabelle/HOL theories}
   44.22 +\author{\emph{Florian Haftmann}}
   44.23 +
   44.24 +\begin{document}
   44.25 +
   44.26 +\maketitle
   44.27 +
   44.28 +\begin{abstract}
   44.29 +  This tutorial gives an introduction to a generic code generator framework in Isabelle
   44.30 +  for generating executable code in functional programming languages from logical
   44.31 +  specifications in Isabelle/HOL.
   44.32 +\end{abstract}
   44.33 +
   44.34 +\thispagestyle{empty}\clearpage
   44.35 +
   44.36 +\pagenumbering{roman}
   44.37 +\clearfirst
   44.38 +
   44.39 +\input{Thy/document/Introduction.tex}
   44.40 +\input{Thy/document/Program.tex}
   44.41 +\input{Thy/document/Adaption.tex}
   44.42 +\input{Thy/document/Further.tex}
   44.43 +\input{Thy/document/ML.tex}
   44.44 +
   44.45 +\begingroup
   44.46 +\bibliographystyle{plain} \small\raggedright\frenchspacing
   44.47 +\bibliography{../manual}
   44.48 +\endgroup
   44.49 +
   44.50 +\end{document}
   44.51 +
   44.52 +
   44.53 +%%% Local Variables: 
   44.54 +%%% mode: latex
   44.55 +%%% TeX-master: t
   44.56 +%%% End: 
    45.1 Binary file doc-src/Codegen/codegen_process.pdf has changed
    46.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    46.2 +++ b/doc-src/Codegen/codegen_process.ps	Tue Mar 03 11:00:51 2009 +0100
    46.3 @@ -0,0 +1,586 @@
    46.4 +%!PS-Adobe-2.0
    46.5 +%%Creator: dot version 2.2 (Mon Sep 12 23:33:36 UTC 2005)
    46.6 +%%For: (haftmann) Florian Haftmann
    46.7 +%%Title: _anonymous_0
    46.8 +%%Pages: (atend)
    46.9 +%%BoundingBox: 35 35 451 291
   46.10 +%%EndComments
   46.11 +save
   46.12 +%%BeginProlog
   46.13 +/DotDict 200 dict def
   46.14 +DotDict begin
   46.15 +
   46.16 +/setupLatin1 {
   46.17 +mark
   46.18 +/EncodingVector 256 array def
   46.19 + EncodingVector 0
   46.20 +
   46.21 +ISOLatin1Encoding 0 255 getinterval putinterval
   46.22 +
   46.23 +EncodingVector
   46.24 +  dup 306 /AE
   46.25 +  dup 301 /Aacute
   46.26 +  dup 302 /Acircumflex
   46.27 +  dup 304 /Adieresis
   46.28 +  dup 300 /Agrave
   46.29 +  dup 305 /Aring
   46.30 +  dup 303 /Atilde
   46.31 +  dup 307 /Ccedilla
   46.32 +  dup 311 /Eacute
   46.33 +  dup 312 /Ecircumflex
   46.34 +  dup 313 /Edieresis
   46.35 +  dup 310 /Egrave
   46.36 +  dup 315 /Iacute
   46.37 +  dup 316 /Icircumflex
   46.38 +  dup 317 /Idieresis
   46.39 +  dup 314 /Igrave
   46.40 +  dup 334 /Udieresis
   46.41 +  dup 335 /Yacute
   46.42 +  dup 376 /thorn
   46.43 +  dup 337 /germandbls
   46.44 +  dup 341 /aacute
   46.45 +  dup 342 /acircumflex
   46.46 +  dup 344 /adieresis
   46.47 +  dup 346 /ae
   46.48 +  dup 340 /agrave
   46.49 +  dup 345 /aring
   46.50 +  dup 347 /ccedilla
   46.51 +  dup 351 /eacute
   46.52 +  dup 352 /ecircumflex
   46.53 +  dup 353 /edieresis
   46.54 +  dup 350 /egrave
   46.55 +  dup 355 /iacute
   46.56 +  dup 356 /icircumflex
   46.57 +  dup 357 /idieresis
   46.58 +  dup 354 /igrave
   46.59 +  dup 360 /dcroat
   46.60 +  dup 361 /ntilde
   46.61 +  dup 363 /oacute
   46.62 +  dup 364 /ocircumflex
   46.63 +  dup 366 /odieresis
   46.64 +  dup 362 /ograve
   46.65 +  dup 365 /otilde
   46.66 +  dup 370 /oslash
   46.67 +  dup 372 /uacute
   46.68 +  dup 373 /ucircumflex
   46.69 +  dup 374 /udieresis
   46.70 +  dup 371 /ugrave
   46.71 +  dup 375 /yacute
   46.72 +  dup 377 /ydieresis  
   46.73 +
   46.74 +% Set up ISO Latin 1 character encoding
   46.75 +/starnetISO {
   46.76 +        dup dup findfont dup length dict begin
   46.77 +        { 1 index /FID ne { def }{ pop pop } ifelse
   46.78 +        } forall
   46.79 +        /Encoding EncodingVector def
   46.80 +        currentdict end definefont
   46.81 +} def
   46.82 +/Times-Roman starnetISO def
   46.83 +/Times-Italic starnetISO def
   46.84 +/Times-Bold starnetISO def
   46.85 +/Times-BoldItalic starnetISO def
   46.86 +/Helvetica starnetISO def
   46.87 +/Helvetica-Oblique starnetISO def
   46.88 +/Helvetica-Bold starnetISO def
   46.89 +/Helvetica-BoldOblique starnetISO def
   46.90 +/Courier starnetISO def
   46.91 +/Courier-Oblique starnetISO def
   46.92 +/Courier-Bold starnetISO def
   46.93 +/Courier-BoldOblique starnetISO def
   46.94 +cleartomark
   46.95 +} bind def
   46.96 +
   46.97 +%%BeginResource: procset graphviz 0 0
   46.98 +/coord-font-family /Times-Roman def
   46.99 +/default-font-family /Times-Roman def
  46.100 +/coordfont coord-font-family findfont 8 scalefont def
  46.101 +
  46.102 +/InvScaleFactor 1.0 def
  46.103 +/set_scale {
  46.104 +	dup 1 exch div /InvScaleFactor exch def
  46.105 +	dup scale
  46.106 +} bind def
  46.107 +
  46.108 +% styles
  46.109 +/solid { [] 0 setdash } bind def
  46.110 +/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
  46.111 +/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
  46.112 +/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
  46.113 +/bold { 2 setlinewidth } bind def
  46.114 +/filled { } bind def
  46.115 +/unfilled { } bind def
  46.116 +/rounded { } bind def
  46.117 +/diagonals { } bind def
  46.118 +
  46.119 +% hooks for setting color 
  46.120 +/nodecolor { sethsbcolor } bind def
  46.121 +/edgecolor { sethsbcolor } bind def
  46.122 +/graphcolor { sethsbcolor } bind def
  46.123 +/nopcolor {pop pop pop} bind def
  46.124 +
  46.125 +/beginpage {	% i j npages
  46.126 +	/npages exch def
  46.127 +	/j exch def
  46.128 +	/i exch def
  46.129 +	/str 10 string def
  46.130 +	npages 1 gt {
  46.131 +		gsave
  46.132 +			coordfont setfont
  46.133 +			0 0 moveto
  46.134 +			(\() show i str cvs show (,) show j str cvs show (\)) show
  46.135 +		grestore
  46.136 +	} if
  46.137 +} bind def
  46.138 +
  46.139 +/set_font {
  46.140 +	findfont exch
  46.141 +	scalefont setfont
  46.142 +} def
  46.143 +
  46.144 +% draw aligned label in bounding box aligned to current point
  46.145 +/alignedtext {			% width adj text
  46.146 +	/text exch def
  46.147 +	/adj exch def
  46.148 +	/width exch def
  46.149 +	gsave
  46.150 +		width 0 gt {
  46.151 +			text stringwidth pop adj mul 0 rmoveto
  46.152 +		} if
  46.153 +		[] 0 setdash
  46.154 +		text show
  46.155 +	grestore
  46.156 +} def
  46.157 +
  46.158 +/boxprim {				% xcorner ycorner xsize ysize
  46.159 +		4 2 roll
  46.160 +		moveto
  46.161 +		2 copy
  46.162 +		exch 0 rlineto
  46.163 +		0 exch rlineto
  46.164 +		pop neg 0 rlineto
  46.165 +		closepath
  46.166 +} bind def
  46.167 +
  46.168 +/ellipse_path {
  46.169 +	/ry exch def
  46.170 +	/rx exch def
  46.171 +	/y exch def
  46.172 +	/x exch def
  46.173 +	matrix currentmatrix
  46.174 +	newpath
  46.175 +	x y translate
  46.176 +	rx ry scale
  46.177 +	0 0 1 0 360 arc
  46.178 +	setmatrix
  46.179 +} bind def
  46.180 +
  46.181 +/endpage { showpage } bind def
  46.182 +/showpage { } def
  46.183 +
  46.184 +/layercolorseq
  46.185 +	[	% layer color sequence - darkest to lightest
  46.186 +		[0 0 0]
  46.187 +		[.2 .8 .8]
  46.188 +		[.4 .8 .8]
  46.189 +		[.6 .8 .8]
  46.190 +		[.8 .8 .8]
  46.191 +	]
  46.192 +def
  46.193 +
  46.194 +/layerlen layercolorseq length def
  46.195 +
  46.196 +/setlayer {/maxlayer exch def /curlayer exch def
  46.197 +	layercolorseq curlayer 1 sub layerlen mod get
  46.198 +	aload pop sethsbcolor
  46.199 +	/nodecolor {nopcolor} def
  46.200 +	/edgecolor {nopcolor} def
  46.201 +	/graphcolor {nopcolor} def
  46.202 +} bind def
  46.203 +
  46.204 +/onlayer { curlayer ne {invis} if } def
  46.205 +
  46.206 +/onlayers {
  46.207 +	/myupper exch def
  46.208 +	/mylower exch def
  46.209 +	curlayer mylower lt
  46.210 +	curlayer myupper gt
  46.211 +	or
  46.212 +	{invis} if
  46.213 +} def
  46.214 +
  46.215 +/curlayer 0 def
  46.216 +
  46.217 +%%EndResource
  46.218 +%%EndProlog
  46.219 +%%BeginSetup
  46.220 +14 default-font-family set_font
  46.221 +1 setmiterlimit
  46.222 +% /arrowlength 10 def
  46.223 +% /arrowwidth 5 def
  46.224 +
  46.225 +% make sure pdfmark is harmless for PS-interpreters other than Distiller
  46.226 +/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
  46.227 +% make '<<' and '>>' safe on PS Level 1 devices
  46.228 +/languagelevel where {pop languagelevel}{1} ifelse
  46.229 +2 lt {
  46.230 +    userdict (<<) cvn ([) cvn load put
  46.231 +    userdict (>>) cvn ([) cvn load put
  46.232 +} if
  46.233 +
  46.234 +%%EndSetup
  46.235 +%%Page: 1 1
  46.236 +%%PageBoundingBox: 36 36 451 291
  46.237 +%%PageOrientation: Portrait
  46.238 +gsave
  46.239 +35 35 416 256 boxprim clip newpath
  46.240 +36 36 translate
  46.241 +0 0 1 beginpage
  46.242 +0 0 translate 0 rotate
  46.243 +[ /CropBox [36 36 451 291] /PAGES pdfmark
  46.244 +0.000 0.000 0.000 graphcolor
  46.245 +14.00 /Times-Roman set_font
  46.246 +
  46.247 +%	theory
  46.248 +gsave 10 dict begin
  46.249 +newpath 93 254 moveto
  46.250 +1 254 lineto
  46.251 +1 214 lineto
  46.252 +93 214 lineto
  46.253 +closepath
  46.254 +stroke
  46.255 +gsave 10 dict begin
  46.256 +8 237 moveto
  46.257 +(Isabelle/HOL)
  46.258 +[4.56 5.52 6.24 6.96 6.24 3.84 3.84 6.24 3.84 10.08 10.08 8.64]
  46.259 +xshow
  46.260 +16 221 moveto
  46.261 +(Isar theory)
  46.262 +[4.56 5.52 6.24 4.56 3.6 4.08 6.96 6.24 6.96 4.8 6.96]
  46.263 +xshow
  46.264 +end grestore
  46.265 +end grestore
  46.266 +
  46.267 +%	selection
  46.268 +gsave 10 dict begin
  46.269 +183 234 38 18 ellipse_path
  46.270 +stroke
  46.271 +gsave 10 dict begin
  46.272 +158 229 moveto
  46.273 +(selection)
  46.274 +[5.52 6.24 3.84 6.24 6.24 3.84 3.84 6.96 6.96]
  46.275 +xshow
  46.276 +end grestore
  46.277 +end grestore
  46.278 +
  46.279 +%	theory -> selection
  46.280 +newpath 94 234 moveto
  46.281 +107 234 121 234 135 234 curveto
  46.282 +stroke
  46.283 +gsave 10 dict begin
  46.284 +solid
  46.285 +1 setlinewidth
  46.286 +0.000 0.000 0.000 edgecolor
  46.287 +newpath 135 238 moveto
  46.288 +145 234 lineto
  46.289 +135 231 lineto
  46.290 +closepath
  46.291 +fill
  46.292 +0.000 0.000 0.000 edgecolor
  46.293 +newpath 135 238 moveto
  46.294 +145 234 lineto
  46.295 +135 231 lineto
  46.296 +closepath
  46.297 +stroke
  46.298 +end grestore
  46.299 +
  46.300 +%	sml
  46.301 +gsave 10 dict begin
  46.302 +newpath 74 144 moveto
  46.303 +20 144 lineto
  46.304 +20 108 lineto
  46.305 +74 108 lineto
  46.306 +closepath
  46.307 +stroke
  46.308 +gsave 10 dict begin
  46.309 +32 121 moveto
  46.310 +(SML)
  46.311 +[7.68 12.48 8.64]
  46.312 +xshow
  46.313 +end grestore
  46.314 +end grestore
  46.315 +
  46.316 +%	other
  46.317 +gsave 10 dict begin
  46.318 +gsave 10 dict begin
  46.319 +41 67 moveto
  46.320 +(...)
  46.321 +[3.6 3.6 3.6]
  46.322 +xshow
  46.323 +end grestore
  46.324 +end grestore
  46.325 +
  46.326 +%	haskell
  46.327 +gsave 10 dict begin
  46.328 +newpath 77 36 moveto
  46.329 +17 36 lineto
  46.330 +17 0 lineto
  46.331 +77 0 lineto
  46.332 +closepath
  46.333 +stroke
  46.334 +gsave 10 dict begin
  46.335 +25 13 moveto
  46.336 +(Haskell)
  46.337 +[10.08 6.24 5.52 6.72 6.24 3.84 3.84]
  46.338 +xshow
  46.339 +end grestore
  46.340 +end grestore
  46.341 +
  46.342 +%	preprocessing
  46.343 +gsave 10 dict begin
  46.344 +183 180 52 18 ellipse_path
  46.345 +stroke
  46.346 +gsave 10 dict begin
  46.347 +143 175 moveto
  46.348 +(preprocessing)
  46.349 +[6.96 4.56 6.24 6.96 4.56 6.96 6.24 6.24 5.52 5.52 3.84 6.96 6.96]
  46.350 +xshow
  46.351 +end grestore
  46.352 +end grestore
  46.353 +
  46.354 +%	selection -> preprocessing
  46.355 +newpath 183 216 moveto
  46.356 +183 213 183 211 183 208 curveto
  46.357 +stroke
  46.358 +gsave 10 dict begin
  46.359 +solid
  46.360 +1 setlinewidth
  46.361 +0.000 0.000 0.000 edgecolor
  46.362 +newpath 187 208 moveto
  46.363 +183 198 lineto
  46.364 +180 208 lineto
  46.365 +closepath
  46.366 +fill
  46.367 +0.000 0.000 0.000 edgecolor
  46.368 +newpath 187 208 moveto
  46.369 +183 198 lineto
  46.370 +180 208 lineto
  46.371 +closepath
  46.372 +stroke
  46.373 +end grestore
  46.374 +
  46.375 +%	def_eqn
  46.376 +gsave 10 dict begin
  46.377 +newpath 403 198 moveto
  46.378 +283 198 lineto
  46.379 +283 162 lineto
  46.380 +403 162 lineto
  46.381 +closepath
  46.382 +stroke
  46.383 +gsave 10 dict begin
  46.384 +291 175 moveto
  46.385 +(defining equations)
  46.386 +[6.96 6.24 4.8 3.84 6.96 3.84 6.96 6.96 3.6 6.24 6.72 6.96 6.24 3.84 3.84 6.96 6.96 5.52]
  46.387 +xshow
  46.388 +end grestore
  46.389 +end grestore
  46.390 +
  46.391 +%	preprocessing -> def_eqn
  46.392 +newpath 236 180 moveto
  46.393 +248 180 260 180 273 180 curveto
  46.394 +stroke
  46.395 +gsave 10 dict begin
  46.396 +solid
  46.397 +1 setlinewidth
  46.398 +0.000 0.000 0.000 edgecolor
  46.399 +newpath 273 184 moveto
  46.400 +283 180 lineto
  46.401 +273 177 lineto
  46.402 +closepath
  46.403 +fill
  46.404 +0.000 0.000 0.000 edgecolor
  46.405 +newpath 273 184 moveto
  46.406 +283 180 lineto
  46.407 +273 177 lineto
  46.408 +closepath
  46.409 +stroke
  46.410 +end grestore
  46.411 +
  46.412 +%	serialization
  46.413 +gsave 10 dict begin
  46.414 +183 72 47 18 ellipse_path
  46.415 +stroke
  46.416 +gsave 10 dict begin
  46.417 +148 67 moveto
  46.418 +(serialization)
  46.419 +[5.52 6.24 4.8 3.84 6.24 3.84 3.84 6.24 6.24 3.84 3.84 6.96 6.96]
  46.420 +xshow
  46.421 +end grestore
  46.422 +end grestore
  46.423 +
  46.424 +%	serialization -> sml
  46.425 +newpath 150 85 moveto
  46.426 +129 93 104 103 83 111 curveto
  46.427 +stroke
  46.428 +gsave 10 dict begin
  46.429 +solid
  46.430 +1 setlinewidth
  46.431 +0.000 0.000 0.000 edgecolor
  46.432 +newpath 82 108 moveto
  46.433 +74 115 lineto
  46.434 +85 114 lineto
  46.435 +closepath
  46.436 +fill
  46.437 +0.000 0.000 0.000 edgecolor
  46.438 +newpath 82 108 moveto
  46.439 +74 115 lineto
  46.440 +85 114 lineto
  46.441 +closepath
  46.442 +stroke
  46.443 +end grestore
  46.444 +
  46.445 +%	serialization -> other
  46.446 +gsave 10 dict begin
  46.447 +dotted
  46.448 +newpath 135 72 moveto
  46.449 +119 72 100 72 84 72 curveto
  46.450 +stroke
  46.451 +gsave 10 dict begin
  46.452 +solid
  46.453 +1 setlinewidth
  46.454 +0.000 0.000 0.000 edgecolor
  46.455 +newpath 84 69 moveto
  46.456 +74 72 lineto
  46.457 +84 76 lineto
  46.458 +closepath
  46.459 +fill
  46.460 +0.000 0.000 0.000 edgecolor
  46.461 +newpath 84 69 moveto
  46.462 +74 72 lineto
  46.463 +84 76 lineto
  46.464 +closepath
  46.465 +stroke
  46.466 +end grestore
  46.467 +end grestore
  46.468 +
  46.469 +%	serialization -> haskell
  46.470 +newpath 150 59 moveto
  46.471 +131 51 107 42 86 34 curveto
  46.472 +stroke
  46.473 +gsave 10 dict begin
  46.474 +solid
  46.475 +1 setlinewidth
  46.476 +0.000 0.000 0.000 edgecolor
  46.477 +newpath 88 31 moveto
  46.478 +77 30 lineto
  46.479 +85 37 lineto
  46.480 +closepath
  46.481 +fill
  46.482 +0.000 0.000 0.000 edgecolor
  46.483 +newpath 88 31 moveto
  46.484 +77 30 lineto
  46.485 +85 37 lineto
  46.486 +closepath
  46.487 +stroke
  46.488 +end grestore
  46.489 +
  46.490 +%	translation
  46.491 +gsave 10 dict begin
  46.492 +343 126 43 18 ellipse_path
  46.493 +stroke
  46.494 +gsave 10 dict begin
  46.495 +313 121 moveto
  46.496 +(translation)
  46.497 +[3.84 4.56 6.24 6.96 5.52 3.84 6.24 3.84 3.84 6.96 6.96]
  46.498 +xshow
  46.499 +end grestore
  46.500 +end grestore
  46.501 +
  46.502 +%	def_eqn -> translation
  46.503 +newpath 343 162 moveto
  46.504 +343 159 343 157 343 154 curveto
  46.505 +stroke
  46.506 +gsave 10 dict begin
  46.507 +solid
  46.508 +1 setlinewidth
  46.509 +0.000 0.000 0.000 edgecolor
  46.510 +newpath 347 154 moveto
  46.511 +343 144 lineto
  46.512 +340 154 lineto
  46.513 +closepath
  46.514 +fill
  46.515 +0.000 0.000 0.000 edgecolor
  46.516 +newpath 347 154 moveto
  46.517 +343 144 lineto
  46.518 +340 154 lineto
  46.519 +closepath
  46.520 +stroke
  46.521 +end grestore
  46.522 +
  46.523 +%	iml
  46.524 +gsave 10 dict begin
  46.525 +newpath 413 90 moveto
  46.526 +273 90 lineto
  46.527 +273 54 lineto
  46.528 +413 54 lineto
  46.529 +closepath
  46.530 +stroke
  46.531 +gsave 10 dict begin
  46.532 +280 67 moveto
  46.533 +(intermediate language)
  46.534 +[3.84 6.96 3.84 6.24 4.8 10.8 6.24 6.96 3.84 6.24 3.84 6.24 3.6 3.84 6.24 6.96 6.96 6.96 6.24 6.72 6.24]
  46.535 +xshow
  46.536 +end grestore
  46.537 +end grestore
  46.538 +
  46.539 +%	translation -> iml
  46.540 +newpath 343 108 moveto
  46.541 +343 105 343 103 343 100 curveto
  46.542 +stroke
  46.543 +gsave 10 dict begin
  46.544 +solid
  46.545 +1 setlinewidth
  46.546 +0.000 0.000 0.000 edgecolor
  46.547 +newpath 347 100 moveto
  46.548 +343 90 lineto
  46.549 +340 100 lineto
  46.550 +closepath
  46.551 +fill
  46.552 +0.000 0.000 0.000 edgecolor
  46.553 +newpath 347 100 moveto
  46.554 +343 90 lineto
  46.555 +340 100 lineto
  46.556 +closepath
  46.557 +stroke
  46.558 +end grestore
  46.559 +
  46.560 +%	iml -> serialization
  46.561 +newpath 272 72 moveto
  46.562 +262 72 251 72 241 72 curveto
  46.563 +stroke
  46.564 +gsave 10 dict begin
  46.565 +solid
  46.566 +1 setlinewidth
  46.567 +0.000 0.000 0.000 edgecolor
  46.568 +newpath 241 69 moveto
  46.569 +231 72 lineto
  46.570 +241 76 lineto
  46.571 +closepath
  46.572 +fill
  46.573 +0.000 0.000 0.000 edgecolor
  46.574 +newpath 241 69 moveto
  46.575 +231 72 lineto
  46.576 +241 76 lineto
  46.577 +closepath
  46.578 +stroke
  46.579 +end grestore
  46.580 +endpage
  46.581 +showpage
  46.582 +grestore
  46.583 +%%PageTrailer
  46.584 +%%EndPage: 1
  46.585 +%%Trailer
  46.586 +%%Pages: 1
  46.587 +end
  46.588 +restore
  46.589 +%%EOF
    47.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    47.2 +++ b/doc-src/Codegen/style.sty	Tue Mar 03 11:00:51 2009 +0100
    47.3 @@ -0,0 +1,56 @@
    47.4 +
    47.5 +%% toc
    47.6 +\newcommand{\tocentry}[1]{\cleardoublepage\phantomsection\addcontentsline{toc}{chapter}{#1}
    47.7 +\@mkboth{\MakeUppercase{#1}}{\MakeUppercase{#1}}}
    47.8 +
    47.9 +%% references
   47.10 +\newcommand{\secref}[1]{\S\ref{#1}}
   47.11 +
   47.12 +%% logical markup
   47.13 +\newcommand{\strong}[1]{{\bfseries {#1}}}
   47.14 +\newcommand{\qn}[1]{\emph{#1}}
   47.15 +
   47.16 +%% typographic conventions
   47.17 +\newcommand{\qt}[1]{``{#1}''}
   47.18 +
   47.19 +%% verbatim text
   47.20 +\newcommand{\isatypewriter}{\fontsize{9pt}{0pt}\tt\renewcommand{\baselinestretch}{1}\setlength{\baselineskip}{9pt}}
   47.21 +
   47.22 +%% quoted segments
   47.23 +\makeatletter
   47.24 +\isakeeptag{quote}
   47.25 +\newenvironment{quotesegment}{\begin{quote}\isa@parindent\parindent\parindent0pt\isa@parskip\parskip\parskip0pt}{\end{quote}}
   47.26 +\renewcommand{\isatagquote}{\begin{quotesegment}}
   47.27 +\renewcommand{\endisatagquote}{\end{quotesegment}}
   47.28 +\makeatother
   47.29 +
   47.30 +\isakeeptag{quotett}
   47.31 +\renewcommand{\isatagquotett}{\begin{quotesegment}\isabellestyle{tt}\isastyle}
   47.32 +\renewcommand{\endisatagquotett}{\end{quotesegment}\isabellestyle{it}\isastyle}
   47.33 +
   47.34 +%% a trick
   47.35 +\newcommand{\isasymSML}{SML}
   47.36 +
   47.37 +%% presentation
   47.38 +\setcounter{secnumdepth}{2} \setcounter{tocdepth}{2}
   47.39 +
   47.40 +\pagestyle{headings}
   47.41 +\binperiod
   47.42 +\underscoreoff
   47.43 +
   47.44 +\renewcommand{\isadigit}[1]{\isamath{#1}}
   47.45 +
   47.46 +%% ml reference
   47.47 +\newenvironment{mldecls}{\par\noindent\begingroup\footnotesize\def\isanewline{\\}\begin{tabular}{l}}{\end{tabular}\smallskip\endgroup}
   47.48 +
   47.49 +\isakeeptag{mlref}
   47.50 +\renewcommand{\isatagmlref}{\subsection*{\makebox[0pt][r]{\fbox{\ML}~~}Reference}\begingroup\def\isastyletext{\rm}\small}
   47.51 +\renewcommand{\endisatagmlref}{\endgroup}
   47.52 +
   47.53 +\isabellestyle{it}
   47.54 +
   47.55 +
   47.56 +%%% Local Variables: 
   47.57 +%%% mode: latex
   47.58 +%%% TeX-master: "implementation"
   47.59 +%%% End: 
    48.1 --- a/doc-src/Dirs	Mon Mar 02 16:58:39 2009 +0100
    48.2 +++ b/doc-src/Dirs	Tue Mar 03 11:00:51 2009 +0100
    48.3 @@ -1,1 +1,1 @@
    48.4 -Intro Ref System Logics HOL ZF Inductive TutorialI IsarOverview IsarRef IsarImplementation Locales LaTeXsugar IsarAdvanced/Classes IsarAdvanced/Codegen IsarAdvanced/Functions
    48.5 +Intro Ref System Logics HOL ZF Inductive TutorialI IsarOverview IsarRef IsarImplementation Locales LaTeXsugar Classes Codegen Functions
    49.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    49.2 +++ b/doc-src/Functions/IsaMakefile	Tue Mar 03 11:00:51 2009 +0100
    49.3 @@ -0,0 +1,33 @@
    49.4 +
    49.5 +## targets
    49.6 +
    49.7 +default: Thy
    49.8 +images: 
    49.9 +test: Thy
   49.10 +
   49.11 +all: images test
   49.12 +
   49.13 +
   49.14 +## global settings
   49.15 +
   49.16 +SRC = $(ISABELLE_HOME)/src
   49.17 +OUT = $(ISABELLE_OUTPUT)
   49.18 +LOG = $(OUT)/log
   49.19 +
   49.20 +USEDIR = $(ISABELLE_TOOL) usedir -v true -i false -d false -C false -D document
   49.21 +
   49.22 +
   49.23 +## Thy
   49.24 +
   49.25 +THY = $(LOG)/HOL-Thy.gz
   49.26 +
   49.27 +Thy: $(THY)
   49.28 +
   49.29 +$(THY): Thy/ROOT.ML Thy/Functions.thy
   49.30 +	@$(USEDIR) HOL Thy
   49.31 +
   49.32 +
   49.33 +## clean
   49.34 +
   49.35 +clean:
   49.36 +	@rm -f $(THY)
    50.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.2 +++ b/doc-src/Functions/Makefile	Tue Mar 03 11:00:51 2009 +0100
    50.3 @@ -0,0 +1,38 @@
    50.4 +#
    50.5 +# $Id$
    50.6 +#
    50.7 +
    50.8 +## targets
    50.9 +
   50.10 +default: dvi
   50.11 +
   50.12 +
   50.13 +## dependencies
   50.14 +
   50.15 +include ../Makefile.in
   50.16 +
   50.17 +NAME = functions
   50.18 +
   50.19 +FILES = $(NAME).tex Thy/document/Functions.tex intro.tex conclusion.tex \
   50.20 +  style.sty ../iman.sty ../extra.sty ../isar.sty \
   50.21 +  ../isabelle.sty ../isabellesym.sty ../pdfsetup.sty \
   50.22 +  ../manual.bib ../proof.sty
   50.23 +
   50.24 +dvi: $(NAME).dvi
   50.25 +
   50.26 +$(NAME).dvi: $(FILES) isabelle_isar.eps
   50.27 +	$(LATEX) $(NAME)
   50.28 +	$(BIBTEX) $(NAME)
   50.29 +	$(LATEX) $(NAME)
   50.30 +	$(LATEX) $(NAME)
   50.31 +
   50.32 +pdf: $(NAME).pdf
   50.33 +
   50.34 +$(NAME).pdf: $(FILES) isabelle_isar.pdf
   50.35 +	$(PDFLATEX) $(NAME)
   50.36 +	$(BIBTEX) $(NAME)
   50.37 +	$(PDFLATEX) $(NAME)
   50.38 +	$(PDFLATEX) $(NAME)
   50.39 +	$(FIXBOOKMARKS) $(NAME).out
   50.40 +	$(PDFLATEX) $(NAME)
   50.41 +	$(PDFLATEX) $(NAME)
    51.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    51.2 +++ b/doc-src/Functions/Thy/Functions.thy	Tue Mar 03 11:00:51 2009 +0100
    51.3 @@ -0,0 +1,1264 @@
    51.4 +(*  Title:      doc-src/IsarAdvanced/Functions/Thy/Fundefs.thy
    51.5 +    Author:     Alexander Krauss, TU Muenchen
    51.6 +
    51.7 +Tutorial for function definitions with the new "function" package.
    51.8 +*)
    51.9 +
   51.10 +theory Functions
   51.11 +imports Main
   51.12 +begin
   51.13 +
   51.14 +section {* Function Definitions for Dummies *}
   51.15 +
   51.16 +text {*
   51.17 +  In most cases, defining a recursive function is just as simple as other definitions:
   51.18 +*}
   51.19 +
   51.20 +fun fib :: "nat \<Rightarrow> nat"
   51.21 +where
   51.22 +  "fib 0 = 1"
   51.23 +| "fib (Suc 0) = 1"
   51.24 +| "fib (Suc (Suc n)) = fib n + fib (Suc n)"
   51.25 +
   51.26 +text {*
   51.27 +  The syntax is rather self-explanatory: We introduce a function by
   51.28 +  giving its name, its type, 
   51.29 +  and a set of defining recursive equations.
   51.30 +  If we leave out the type, the most general type will be
   51.31 +  inferred, which can sometimes lead to surprises: Since both @{term
   51.32 +  "1::nat"} and @{text "+"} are overloaded, we would end up
   51.33 +  with @{text "fib :: nat \<Rightarrow> 'a::{one,plus}"}.
   51.34 +*}
   51.35 +
   51.36 +text {*
   51.37 +  The function always terminates, since its argument gets smaller in
   51.38 +  every recursive call. 
   51.39 +  Since HOL is a logic of total functions, termination is a
   51.40 +  fundamental requirement to prevent inconsistencies\footnote{From the
   51.41 +  \qt{definition} @{text "f(n) = f(n) + 1"} we could prove 
   51.42 +  @{text "0 = 1"} by subtracting @{text "f(n)"} on both sides.}.
   51.43 +  Isabelle tries to prove termination automatically when a definition
   51.44 +  is made. In \S\ref{termination}, we will look at cases where this
   51.45 +  fails and see what to do then.
   51.46 +*}
   51.47 +
   51.48 +subsection {* Pattern matching *}
   51.49 +
   51.50 +text {* \label{patmatch}
   51.51 +  Like in functional programming, we can use pattern matching to
   51.52 +  define functions. At the moment we will only consider \emph{constructor
   51.53 +  patterns}, which only consist of datatype constructors and
   51.54 +  variables. Furthermore, patterns must be linear, i.e.\ all variables
   51.55 +  on the left hand side of an equation must be distinct. In
   51.56 +  \S\ref{genpats} we discuss more general pattern matching.
   51.57 +
   51.58 +  If patterns overlap, the order of the equations is taken into
   51.59 +  account. The following function inserts a fixed element between any
   51.60 +  two elements of a list:
   51.61 +*}
   51.62 +
   51.63 +fun sep :: "'a \<Rightarrow> 'a list \<Rightarrow> 'a list"
   51.64 +where
   51.65 +  "sep a (x#y#xs) = x # a # sep a (y # xs)"
   51.66 +| "sep a xs       = xs"
   51.67 +
   51.68 +text {* 
   51.69 +  Overlapping patterns are interpreted as \qt{increments} to what is
   51.70 +  already there: The second equation is only meant for the cases where
   51.71 +  the first one does not match. Consequently, Isabelle replaces it
   51.72 +  internally by the remaining cases, making the patterns disjoint:
   51.73 +*}
   51.74 +
   51.75 +thm sep.simps
   51.76 +
   51.77 +text {* @{thm [display] sep.simps[no_vars]} *}
   51.78 +
   51.79 +text {* 
   51.80 +  \noindent The equations from function definitions are automatically used in
   51.81 +  simplification:
   51.82 +*}
   51.83 +
   51.84 +lemma "sep 0 [1, 2, 3] = [1, 0, 2, 0, 3]"
   51.85 +by simp
   51.86 +
   51.87 +subsection {* Induction *}
   51.88 +
   51.89 +text {*
   51.90 +
   51.91 +  Isabelle provides customized induction rules for recursive
   51.92 +  functions. These rules follow the recursive structure of the
   51.93 +  definition. Here is the rule @{text sep.induct} arising from the
   51.94 +  above definition of @{const sep}:
   51.95 +
   51.96 +  @{thm [display] sep.induct}
   51.97 +  
   51.98 +  We have a step case for list with at least two elements, and two
   51.99 +  base cases for the zero- and the one-element list. Here is a simple
  51.100 +  proof about @{const sep} and @{const map}
  51.101 +*}
  51.102 +
  51.103 +lemma "map f (sep x ys) = sep (f x) (map f ys)"
  51.104 +apply (induct x ys rule: sep.induct)
  51.105 +
  51.106 +txt {*
  51.107 +  We get three cases, like in the definition.
  51.108 +
  51.109 +  @{subgoals [display]}
  51.110 +*}
  51.111 +
  51.112 +apply auto 
  51.113 +done
  51.114 +text {*
  51.115 +
  51.116 +  With the \cmd{fun} command, you can define about 80\% of the
  51.117 +  functions that occur in practice. The rest of this tutorial explains
  51.118 +  the remaining 20\%.
  51.119 +*}
  51.120 +
  51.121 +
  51.122 +section {* fun vs.\ function *}
  51.123 +
  51.124 +text {* 
  51.125 +  The \cmd{fun} command provides a
  51.126 +  convenient shorthand notation for simple function definitions. In
  51.127 +  this mode, Isabelle tries to solve all the necessary proof obligations
  51.128 +  automatically. If any proof fails, the definition is
  51.129 +  rejected. This can either mean that the definition is indeed faulty,
  51.130 +  or that the default proof procedures are just not smart enough (or
  51.131 +  rather: not designed) to handle the definition.
  51.132 +
  51.133 +  By expanding the abbreviation to the more verbose \cmd{function} command, these proof obligations become visible and can be analyzed or
  51.134 +  solved manually. The expansion from \cmd{fun} to \cmd{function} is as follows:
  51.135 +
  51.136 +\end{isamarkuptext}
  51.137 +
  51.138 +
  51.139 +\[\left[\;\begin{minipage}{0.25\textwidth}\vspace{6pt}
  51.140 +\cmd{fun} @{text "f :: \<tau>"}\\%
  51.141 +\cmd{where}\\%
  51.142 +\hspace*{2ex}{\it equations}\\%
  51.143 +\hspace*{2ex}\vdots\vspace*{6pt}
  51.144 +\end{minipage}\right]
  51.145 +\quad\equiv\quad
  51.146 +\left[\;\begin{minipage}{0.48\textwidth}\vspace{6pt}
  51.147 +\cmd{function} @{text "("}\cmd{sequential}@{text ") f :: \<tau>"}\\%
  51.148 +\cmd{where}\\%
  51.149 +\hspace*{2ex}{\it equations}\\%
  51.150 +\hspace*{2ex}\vdots\\%
  51.151 +\cmd{by} @{text "pat_completeness auto"}\\%
  51.152 +\cmd{termination by} @{text "lexicographic_order"}\vspace{6pt}
  51.153 +\end{minipage}
  51.154 +\right]\]
  51.155 +
  51.156 +\begin{isamarkuptext}
  51.157 +  \vspace*{1em}
  51.158 +  \noindent Some details have now become explicit:
  51.159 +
  51.160 +  \begin{enumerate}
  51.161 +  \item The \cmd{sequential} option enables the preprocessing of
  51.162 +  pattern overlaps which we already saw. Without this option, the equations
  51.163 +  must already be disjoint and complete. The automatic completion only
  51.164 +  works with constructor patterns.
  51.165 +
  51.166 +  \item A function definition produces a proof obligation which
  51.167 +  expresses completeness and compatibility of patterns (we talk about
  51.168 +  this later). The combination of the methods @{text "pat_completeness"} and
  51.169 +  @{text "auto"} is used to solve this proof obligation.
  51.170 +
  51.171 +  \item A termination proof follows the definition, started by the
  51.172 +  \cmd{termination} command. This will be explained in \S\ref{termination}.
  51.173 + \end{enumerate}
  51.174 +  Whenever a \cmd{fun} command fails, it is usually a good idea to
  51.175 +  expand the syntax to the more verbose \cmd{function} form, to see
  51.176 +  what is actually going on.
  51.177 + *}
  51.178 +
  51.179 +
  51.180 +section {* Termination *}
  51.181 +
  51.182 +text {*\label{termination}
  51.183 +  The method @{text "lexicographic_order"} is the default method for
  51.184 +  termination proofs. It can prove termination of a
  51.185 +  certain class of functions by searching for a suitable lexicographic
  51.186 +  combination of size measures. Of course, not all functions have such
  51.187 +  a simple termination argument. For them, we can specify the termination
  51.188 +  relation manually.
  51.189 +*}
  51.190 +
  51.191 +subsection {* The {\tt relation} method *}
  51.192 +text{*
  51.193 +  Consider the following function, which sums up natural numbers up to
  51.194 +  @{text "N"}, using a counter @{text "i"}:
  51.195 +*}
  51.196 +
  51.197 +function sum :: "nat \<Rightarrow> nat \<Rightarrow> nat"
  51.198 +where
  51.199 +  "sum i N = (if i > N then 0 else i + sum (Suc i) N)"
  51.200 +by pat_completeness auto
  51.201 +
  51.202 +text {*
  51.203 +  \noindent The @{text "lexicographic_order"} method fails on this example, because none of the
  51.204 +  arguments decreases in the recursive call, with respect to the standard size ordering.
  51.205 +  To prove termination manually, we must provide a custom wellfounded relation.
  51.206 +
  51.207 +  The termination argument for @{text "sum"} is based on the fact that
  51.208 +  the \emph{difference} between @{text "i"} and @{text "N"} gets
  51.209 +  smaller in every step, and that the recursion stops when @{text "i"}
  51.210 +  is greater than @{text "N"}. Phrased differently, the expression 
  51.211 +  @{text "N + 1 - i"} always decreases.
  51.212 +
  51.213 +  We can use this expression as a measure function suitable to prove termination.
  51.214 +*}
  51.215 +
  51.216 +termination sum
  51.217 +apply (relation "measure (\<lambda>(i,N). N + 1 - i)")
  51.218 +
  51.219 +txt {*
  51.220 +  The \cmd{termination} command sets up the termination goal for the
  51.221 +  specified function @{text "sum"}. If the function name is omitted, it
  51.222 +  implicitly refers to the last function definition.
  51.223 +
  51.224 +  The @{text relation} method takes a relation of
  51.225 +  type @{typ "('a \<times> 'a) set"}, where @{typ "'a"} is the argument type of
  51.226 +  the function. If the function has multiple curried arguments, then
  51.227 +  these are packed together into a tuple, as it happened in the above
  51.228 +  example.
  51.229 +
  51.230 +  The predefined function @{term[source] "measure :: ('a \<Rightarrow> nat) \<Rightarrow> ('a \<times> 'a) set"} constructs a
  51.231 +  wellfounded relation from a mapping into the natural numbers (a
  51.232 +  \emph{measure function}). 
  51.233 +
  51.234 +  After the invocation of @{text "relation"}, we must prove that (a)
  51.235 +  the relation we supplied is wellfounded, and (b) that the arguments
  51.236 +  of recursive calls indeed decrease with respect to the
  51.237 +  relation:
  51.238 +
  51.239 +  @{subgoals[display,indent=0]}
  51.240 +
  51.241 +  These goals are all solved by @{text "auto"}:
  51.242 +*}
  51.243 +
  51.244 +apply auto
  51.245 +done
  51.246 +
  51.247 +text {*
  51.248 +  Let us complicate the function a little, by adding some more
  51.249 +  recursive calls: 
  51.250 +*}
  51.251 +
  51.252 +function foo :: "nat \<Rightarrow> nat \<Rightarrow> nat"
  51.253 +where
  51.254 +  "foo i N = (if i > N 
  51.255 +              then (if N = 0 then 0 else foo 0 (N - 1))
  51.256 +              else i + foo (Suc i) N)"
  51.257 +by pat_completeness auto
  51.258 +
  51.259 +text {*
  51.260 +  When @{text "i"} has reached @{text "N"}, it starts at zero again
  51.261 +  and @{text "N"} is decremented.
  51.262 +  This corresponds to a nested
  51.263 +  loop where one index counts up and the other down. Termination can
  51.264 +  be proved using a lexicographic combination of two measures, namely
  51.265 +  the value of @{text "N"} and the above difference. The @{const
  51.266 +  "measures"} combinator generalizes @{text "measure"} by taking a
  51.267 +  list of measure functions.  
  51.268 +*}
  51.269 +
  51.270 +termination 
  51.271 +by (relation "measures [\<lambda>(i, N). N, \<lambda>(i,N). N + 1 - i]") auto
  51.272 +
  51.273 +subsection {* How @{text "lexicographic_order"} works *}
  51.274 +
  51.275 +(*fun fails :: "nat \<Rightarrow> nat list \<Rightarrow> nat"
  51.276 +where
  51.277 +  "fails a [] = a"
  51.278 +| "fails a (x#xs) = fails (x + a) (x # xs)"
  51.279 +*)
  51.280 +
  51.281 +text {*
  51.282 +  To see how the automatic termination proofs work, let's look at an
  51.283 +  example where it fails\footnote{For a detailed discussion of the
  51.284 +  termination prover, see \cite{bulwahnKN07}}:
  51.285 +
  51.286 +\end{isamarkuptext}  
  51.287 +\cmd{fun} @{text "fails :: \"nat \<Rightarrow> nat list \<Rightarrow> nat\""}\\%
  51.288 +\cmd{where}\\%
  51.289 +\hspace*{2ex}@{text "\"fails a [] = a\""}\\%
  51.290 +|\hspace*{1.5ex}@{text "\"fails a (x#xs) = fails (x + a) (x#xs)\""}\\
  51.291 +\begin{isamarkuptext}
  51.292 +
  51.293 +\noindent Isabelle responds with the following error:
  51.294 +
  51.295 +\begin{isabelle}
  51.296 +*** Unfinished subgoals:\newline
  51.297 +*** (a, 1, <):\newline
  51.298 +*** \ 1.~@{text "\<And>x. x = 0"}\newline
  51.299 +*** (a, 1, <=):\newline
  51.300 +*** \ 1.~False\newline
  51.301 +*** (a, 2, <):\newline
  51.302 +*** \ 1.~False\newline
  51.303 +*** Calls:\newline
  51.304 +*** a) @{text "(a, x # xs) -->> (x + a, x # xs)"}\newline
  51.305 +*** Measures:\newline
  51.306 +*** 1) @{text "\<lambda>x. size (fst x)"}\newline
  51.307 +*** 2) @{text "\<lambda>x. size (snd x)"}\newline
  51.308 +*** Result matrix:\newline
  51.309 +*** \ \ \ \ 1\ \ 2  \newline
  51.310 +*** a:  ?   <= \newline
  51.311 +*** Could not find lexicographic termination order.\newline
  51.312 +*** At command "fun".\newline
  51.313 +\end{isabelle}
  51.314 +*}
  51.315 +
  51.316 +
  51.317 +text {*
  51.318 +  The key to this error message is the matrix at the bottom. The rows
  51.319 +  of that matrix correspond to the different recursive calls (In our
  51.320 +  case, there is just one). The columns are the function's arguments 
  51.321 +  (expressed through different measure functions, which map the
  51.322 +  argument tuple to a natural number). 
  51.323 +
  51.324 +  The contents of the matrix summarize what is known about argument
  51.325 +  descents: The second argument has a weak descent (@{text "<="}) at the
  51.326 +  recursive call, and for the first argument nothing could be proved,
  51.327 +  which is expressed by @{text "?"}. In general, there are the values
  51.328 +  @{text "<"}, @{text "<="} and @{text "?"}.
  51.329 +
  51.330 +  For the failed proof attempts, the unfinished subgoals are also
  51.331 +  printed. Looking at these will often point to a missing lemma.
  51.332 +
  51.333 +%  As a more real example, here is quicksort:
  51.334 +*}
  51.335 +(*
  51.336 +function qs :: "nat list \<Rightarrow> nat list"
  51.337 +where
  51.338 +  "qs [] = []"
  51.339 +| "qs (x#xs) = qs [y\<in>xs. y < x] @ x # qs [y\<in>xs. y \<ge> x]"
  51.340 +by pat_completeness auto
  51.341 +
  51.342 +termination apply lexicographic_order
  51.343 +
  51.344 +text {* If we try @{text "lexicographic_order"} method, we get the
  51.345 +  following error *}
  51.346 +termination by (lexicographic_order simp:l2)
  51.347 +
  51.348 +lemma l: "x \<le> y \<Longrightarrow> x < Suc y" by arith
  51.349 +
  51.350 +function 
  51.351 +
  51.352 +*)
  51.353 +
  51.354 +section {* Mutual Recursion *}
  51.355 +
  51.356 +text {*
  51.357 +  If two or more functions call one another mutually, they have to be defined
  51.358 +  in one step. Here are @{text "even"} and @{text "odd"}:
  51.359 +*}
  51.360 +
  51.361 +function even :: "nat \<Rightarrow> bool"
  51.362 +    and odd  :: "nat \<Rightarrow> bool"
  51.363 +where
  51.364 +  "even 0 = True"
  51.365 +| "odd 0 = False"
  51.366 +| "even (Suc n) = odd n"
  51.367 +| "odd (Suc n) = even n"
  51.368 +by pat_completeness auto
  51.369 +
  51.370 +text {*
  51.371 +  To eliminate the mutual dependencies, Isabelle internally
  51.372 +  creates a single function operating on the sum
  51.373 +  type @{typ "nat + nat"}. Then, @{const even} and @{const odd} are
  51.374 +  defined as projections. Consequently, termination has to be proved
  51.375 +  simultaneously for both functions, by specifying a measure on the
  51.376 +  sum type: 
  51.377 +*}
  51.378 +
  51.379 +termination 
  51.380 +by (relation "measure (\<lambda>x. case x of Inl n \<Rightarrow> n | Inr n \<Rightarrow> n)") auto
  51.381 +
  51.382 +text {* 
  51.383 +  We could also have used @{text lexicographic_order}, which
  51.384 +  supports mutual recursive termination proofs to a certain extent.
  51.385 +*}
  51.386 +
  51.387 +subsection {* Induction for mutual recursion *}
  51.388 +
  51.389 +text {*
  51.390 +
  51.391 +  When functions are mutually recursive, proving properties about them
  51.392 +  generally requires simultaneous induction. The induction rule @{text "even_odd.induct"}
  51.393 +  generated from the above definition reflects this.
  51.394 +
  51.395 +  Let us prove something about @{const even} and @{const odd}:
  51.396 +*}
  51.397 +
  51.398 +lemma even_odd_mod2:
  51.399 +  "even n = (n mod 2 = 0)"
  51.400 +  "odd n = (n mod 2 = 1)"
  51.401 +
  51.402 +txt {* 
  51.403 +  We apply simultaneous induction, specifying the induction variable
  51.404 +  for both goals, separated by \cmd{and}:  *}
  51.405 +
  51.406 +apply (induct n and n rule: even_odd.induct)
  51.407 +
  51.408 +txt {* 
  51.409 +  We get four subgoals, which correspond to the clauses in the
  51.410 +  definition of @{const even} and @{const odd}:
  51.411 +  @{subgoals[display,indent=0]}
  51.412 +  Simplification solves the first two goals, leaving us with two
  51.413 +  statements about the @{text "mod"} operation to prove:
  51.414 +*}
  51.415 +
  51.416 +apply simp_all
  51.417 +
  51.418 +txt {* 
  51.419 +  @{subgoals[display,indent=0]} 
  51.420 +
  51.421 +  \noindent These can be handled by Isabelle's arithmetic decision procedures.
  51.422 +  
  51.423 +*}
  51.424 +
  51.425 +apply arith
  51.426 +apply arith
  51.427 +done
  51.428 +
  51.429 +text {*
  51.430 +  In proofs like this, the simultaneous induction is really essential:
  51.431 +  Even if we are just interested in one of the results, the other
  51.432 +  one is necessary to strengthen the induction hypothesis. If we leave
  51.433 +  out the statement about @{const odd} and just write @{term True} instead,
  51.434 +  the same proof fails:
  51.435 +*}
  51.436 +
  51.437 +lemma failed_attempt:
  51.438 +  "even n = (n mod 2 = 0)"
  51.439 +  "True"
  51.440 +apply (induct n rule: even_odd.induct)
  51.441 +
  51.442 +txt {*
  51.443 +  \noindent Now the third subgoal is a dead end, since we have no
  51.444 +  useful induction hypothesis available:
  51.445 +
  51.446 +  @{subgoals[display,indent=0]} 
  51.447 +*}
  51.448 +
  51.449 +oops
  51.450 +
  51.451 +section {* General pattern matching *}
  51.452 +text{*\label{genpats} *}
  51.453 +
  51.454 +subsection {* Avoiding automatic pattern splitting *}
  51.455 +
  51.456 +text {*
  51.457 +
  51.458 +  Up to now, we used pattern matching only on datatypes, and the
  51.459 +  patterns were always disjoint and complete, and if they weren't,
  51.460 +  they were made disjoint automatically like in the definition of
  51.461 +  @{const "sep"} in \S\ref{patmatch}.
  51.462 +
  51.463 +  This automatic splitting can significantly increase the number of
  51.464 +  equations involved, and this is not always desirable. The following
  51.465 +  example shows the problem:
  51.466 +  
  51.467 +  Suppose we are modeling incomplete knowledge about the world by a
  51.468 +  three-valued datatype, which has values @{term "T"}, @{term "F"}
  51.469 +  and @{term "X"} for true, false and uncertain propositions, respectively. 
  51.470 +*}
  51.471 +
  51.472 +datatype P3 = T | F | X
  51.473 +
  51.474 +text {* \noindent Then the conjunction of such values can be defined as follows: *}
  51.475 +
  51.476 +fun And :: "P3 \<Rightarrow> P3 \<Rightarrow> P3"
  51.477 +where
  51.478 +  "And T p = p"
  51.479 +| "And p T = p"
  51.480 +| "And p F = F"
  51.481 +| "And F p = F"
  51.482 +| "And X X = X"
  51.483 +
  51.484 +
  51.485 +text {* 
  51.486 +  This definition is useful, because the equations can directly be used
  51.487 +  as simplification rules. But the patterns overlap: For example,
  51.488 +  the expression @{term "And T T"} is matched by both the first and
  51.489 +  the second equation. By default, Isabelle makes the patterns disjoint by
  51.490 +  splitting them up, producing instances:
  51.491 +*}
  51.492 +
  51.493 +thm And.simps
  51.494 +
  51.495 +text {*
  51.496 +  @{thm[indent=4] And.simps}
  51.497 +  
  51.498 +  \vspace*{1em}
  51.499 +  \noindent There are several problems with this:
  51.500 +
  51.501 +  \begin{enumerate}
  51.502 +  \item If the datatype has many constructors, there can be an
  51.503 +  explosion of equations. For @{const "And"}, we get seven instead of
  51.504 +  five equations, which can be tolerated, but this is just a small
  51.505 +  example.
  51.506 +
  51.507 +  \item Since splitting makes the equations \qt{less general}, they
  51.508 +  do not always match in rewriting. While the term @{term "And x F"}
  51.509 +  can be simplified to @{term "F"} with the original equations, a
  51.510 +  (manual) case split on @{term "x"} is now necessary.
  51.511 +
  51.512 +  \item The splitting also concerns the induction rule @{text
  51.513 +  "And.induct"}. Instead of five premises it now has seven, which
  51.514 +  means that our induction proofs will have more cases.
  51.515 +
  51.516 +  \item In general, it increases clarity if we get the same definition
  51.517 +  back which we put in.
  51.518 +  \end{enumerate}
  51.519 +
  51.520 +  If we do not want the automatic splitting, we can switch it off by
  51.521 +  leaving out the \cmd{sequential} option. However, we will have to
  51.522 +  prove that our pattern matching is consistent\footnote{This prevents
  51.523 +  us from defining something like @{term "f x = True"} and @{term "f x
  51.524 +  = False"} simultaneously.}:
  51.525 +*}
  51.526 +
  51.527 +function And2 :: "P3 \<Rightarrow> P3 \<Rightarrow> P3"
  51.528 +where
  51.529 +  "And2 T p = p"
  51.530 +| "And2 p T = p"
  51.531 +| "And2 p F = F"
  51.532 +| "And2 F p = F"
  51.533 +| "And2 X X = X"
  51.534 +
  51.535 +txt {*
  51.536 +  \noindent Now let's look at the proof obligations generated by a
  51.537 +  function definition. In this case, they are:
  51.538 +
  51.539 +  @{subgoals[display,indent=0]}\vspace{-1.2em}\hspace{3cm}\vdots\vspace{1.2em}
  51.540 +
  51.541 +  The first subgoal expresses the completeness of the patterns. It has
  51.542 +  the form of an elimination rule and states that every @{term x} of
  51.543 +  the function's input type must match at least one of the patterns\footnote{Completeness could
  51.544 +  be equivalently stated as a disjunction of existential statements: 
  51.545 +@{term "(\<exists>p. x = (T, p)) \<or> (\<exists>p. x = (p, T)) \<or> (\<exists>p. x = (p, F)) \<or>
  51.546 +  (\<exists>p. x = (F, p)) \<or> (x = (X, X))"}, and you can use the method @{text atomize_elim} to get that form instead.}. If the patterns just involve
  51.547 +  datatypes, we can solve it with the @{text "pat_completeness"}
  51.548 +  method:
  51.549 +*}
  51.550 +
  51.551 +apply pat_completeness
  51.552 +
  51.553 +txt {*
  51.554 +  The remaining subgoals express \emph{pattern compatibility}. We do
  51.555 +  allow that an input value matches multiple patterns, but in this
  51.556 +  case, the result (i.e.~the right hand sides of the equations) must
  51.557 +  also be equal. For each pair of two patterns, there is one such
  51.558 +  subgoal. Usually this needs injectivity of the constructors, which
  51.559 +  is used automatically by @{text "auto"}.
  51.560 +*}
  51.561 +
  51.562 +by auto
  51.563 +
  51.564 +
  51.565 +subsection {* Non-constructor patterns *}
  51.566 +
  51.567 +text {*
  51.568 +  Most of Isabelle's basic types take the form of inductive datatypes,
  51.569 +  and usually pattern matching works on the constructors of such types. 
  51.570 +  However, this need not be always the case, and the \cmd{function}
  51.571 +  command handles other kind of patterns, too.
  51.572 +
  51.573 +  One well-known instance of non-constructor patterns are
  51.574 +  so-called \emph{$n+k$-patterns}, which are a little controversial in
  51.575 +  the functional programming world. Here is the initial fibonacci
  51.576 +  example with $n+k$-patterns:
  51.577 +*}
  51.578 +
  51.579 +function fib2 :: "nat \<Rightarrow> nat"
  51.580 +where
  51.581 +  "fib2 0 = 1"
  51.582 +| "fib2 1 = 1"
  51.583 +| "fib2 (n + 2) = fib2 n + fib2 (Suc n)"
  51.584 +
  51.585 +(*<*)ML_val "goals_limit := 1"(*>*)
  51.586 +txt {*
  51.587 +  This kind of matching is again justified by the proof of pattern
  51.588 +  completeness and compatibility. 
  51.589 +  The proof obligation for pattern completeness states that every natural number is
  51.590 +  either @{term "0::nat"}, @{term "1::nat"} or @{term "n +
  51.591 +  (2::nat)"}:
  51.592 +
  51.593 +  @{subgoals[display,indent=0]}
  51.594 +
  51.595 +  This is an arithmetic triviality, but unfortunately the
  51.596 +  @{text arith} method cannot handle this specific form of an
  51.597 +  elimination rule. However, we can use the method @{text
  51.598 +  "atomize_elim"} to do an ad-hoc conversion to a disjunction of
  51.599 +  existentials, which can then be solved by the arithmetic decision procedure.
  51.600 +  Pattern compatibility and termination are automatic as usual.
  51.601 +*}
  51.602 +(*<*)ML_val "goals_limit := 10"(*>*)
  51.603 +apply atomize_elim
  51.604 +apply arith
  51.605 +apply auto
  51.606 +done
  51.607 +termination by lexicographic_order
  51.608 +text {*
  51.609 +  We can stretch the notion of pattern matching even more. The
  51.610 +  following function is not a sensible functional program, but a
  51.611 +  perfectly valid mathematical definition:
  51.612 +*}
  51.613 +
  51.614 +function ev :: "nat \<Rightarrow> bool"
  51.615 +where
  51.616 +  "ev (2 * n) = True"
  51.617 +| "ev (2 * n + 1) = False"
  51.618 +apply atomize_elim
  51.619 +by arith+
  51.620 +termination by (relation "{}") simp
  51.621 +
  51.622 +text {*
  51.623 +  This general notion of pattern matching gives you a certain freedom
  51.624 +  in writing down specifications. However, as always, such freedom should
  51.625 +  be used with care:
  51.626 +
  51.627 +  If we leave the area of constructor
  51.628 +  patterns, we have effectively departed from the world of functional
  51.629 +  programming. This means that it is no longer possible to use the
  51.630 +  code generator, and expect it to generate ML code for our
  51.631 +  definitions. Also, such a specification might not work very well together with
  51.632 +  simplification. Your mileage may vary.
  51.633 +*}
  51.634 +
  51.635 +
  51.636 +subsection {* Conditional equations *}
  51.637 +
  51.638 +text {* 
  51.639 +  The function package also supports conditional equations, which are
  51.640 +  similar to guards in a language like Haskell. Here is Euclid's
  51.641 +  algorithm written with conditional patterns\footnote{Note that the
  51.642 +  patterns are also overlapping in the base case}:
  51.643 +*}
  51.644 +
  51.645 +function gcd :: "nat \<Rightarrow> nat \<Rightarrow> nat"
  51.646 +where
  51.647 +  "gcd x 0 = x"
  51.648 +| "gcd 0 y = y"
  51.649 +| "x < y \<Longrightarrow> gcd (Suc x) (Suc y) = gcd (Suc x) (y - x)"
  51.650 +| "\<not> x < y \<Longrightarrow> gcd (Suc x) (Suc y) = gcd (x - y) (Suc y)"
  51.651 +by (atomize_elim, auto, arith)
  51.652 +termination by lexicographic_order
  51.653 +
  51.654 +text {*
  51.655 +  By now, you can probably guess what the proof obligations for the
  51.656 +  pattern completeness and compatibility look like. 
  51.657 +
  51.658 +  Again, functions with conditional patterns are not supported by the
  51.659 +  code generator.
  51.660 +*}
  51.661 +
  51.662 +
  51.663 +subsection {* Pattern matching on strings *}
  51.664 +
  51.665 +text {*
  51.666 +  As strings (as lists of characters) are normal datatypes, pattern
  51.667 +  matching on them is possible, but somewhat problematic. Consider the
  51.668 +  following definition:
  51.669 +
  51.670 +\end{isamarkuptext}
  51.671 +\noindent\cmd{fun} @{text "check :: \"string \<Rightarrow> bool\""}\\%
  51.672 +\cmd{where}\\%
  51.673 +\hspace*{2ex}@{text "\"check (''good'') = True\""}\\%
  51.674 +@{text "| \"check s = False\""}
  51.675 +\begin{isamarkuptext}
  51.676 +
  51.677 +  \noindent An invocation of the above \cmd{fun} command does not
  51.678 +  terminate. What is the problem? Strings are lists of characters, and
  51.679 +  characters are a datatype with a lot of constructors. Splitting the
  51.680 +  catch-all pattern thus leads to an explosion of cases, which cannot
  51.681 +  be handled by Isabelle.
  51.682 +
  51.683 +  There are two things we can do here. Either we write an explicit
  51.684 +  @{text "if"} on the right hand side, or we can use conditional patterns:
  51.685 +*}
  51.686 +
  51.687 +function check :: "string \<Rightarrow> bool"
  51.688 +where
  51.689 +  "check (''good'') = True"
  51.690 +| "s \<noteq> ''good'' \<Longrightarrow> check s = False"
  51.691 +by auto
  51.692 +
  51.693 +
  51.694 +section {* Partiality *}
  51.695 +
  51.696 +text {* 
  51.697 +  In HOL, all functions are total. A function @{term "f"} applied to
  51.698 +  @{term "x"} always has the value @{term "f x"}, and there is no notion
  51.699 +  of undefinedness. 
  51.700 +  This is why we have to do termination
  51.701 +  proofs when defining functions: The proof justifies that the
  51.702 +  function can be defined by wellfounded recursion.
  51.703 +
  51.704 +  However, the \cmd{function} package does support partiality to a
  51.705 +  certain extent. Let's look at the following function which looks
  51.706 +  for a zero of a given function f. 
  51.707 +*}
  51.708 +
  51.709 +function (*<*)(domintros, tailrec)(*>*)findzero :: "(nat \<Rightarrow> nat) \<Rightarrow> nat \<Rightarrow> nat"
  51.710 +where
  51.711 +  "findzero f n = (if f n = 0 then n else findzero f (Suc n))"
  51.712 +by pat_completeness auto
  51.713 +(*<*)declare findzero.simps[simp del](*>*)
  51.714 +
  51.715 +text {*
  51.716 +  \noindent Clearly, any attempt of a termination proof must fail. And without
  51.717 +  that, we do not get the usual rules @{text "findzero.simps"} and 
  51.718 +  @{text "findzero.induct"}. So what was the definition good for at all?
  51.719 +*}
  51.720 +
  51.721 +subsection {* Domain predicates *}
  51.722 +
  51.723 +text {*
  51.724 +  The trick is that Isabelle has not only defined the function @{const findzero}, but also
  51.725 +  a predicate @{term "findzero_dom"} that characterizes the values where the function
  51.726 +  terminates: the \emph{domain} of the function. If we treat a
  51.727 +  partial function just as a total function with an additional domain
  51.728 +  predicate, we can derive simplification and
  51.729 +  induction rules as we do for total functions. They are guarded
  51.730 +  by domain conditions and are called @{text psimps} and @{text
  51.731 +  pinduct}: 
  51.732 +*}
  51.733 +
  51.734 +text {*
  51.735 +  \noindent\begin{minipage}{0.79\textwidth}@{thm[display,margin=85] findzero.psimps}\end{minipage}
  51.736 +  \hfill(@{text "findzero.psimps"})
  51.737 +  \vspace{1em}
  51.738 +
  51.739 +  \noindent\begin{minipage}{0.79\textwidth}@{thm[display,margin=85] findzero.pinduct}\end{minipage}
  51.740 +  \hfill(@{text "findzero.pinduct"})
  51.741 +*}
  51.742 +
  51.743 +text {*
  51.744 +  Remember that all we
  51.745 +  are doing here is use some tricks to make a total function appear
  51.746 +  as if it was partial. We can still write the term @{term "findzero
  51.747 +  (\<lambda>x. 1) 0"} and like any other term of type @{typ nat} it is equal
  51.748 +  to some natural number, although we might not be able to find out
  51.749 +  which one. The function is \emph{underdefined}.
  51.750 +
  51.751 +  But it is defined enough to prove something interesting about it. We
  51.752 +  can prove that if @{term "findzero f n"}
  51.753 +  terminates, it indeed returns a zero of @{term f}:
  51.754 +*}
  51.755 +
  51.756 +lemma findzero_zero: "findzero_dom (f, n) \<Longrightarrow> f (findzero f n) = 0"
  51.757 +
  51.758 +txt {* \noindent We apply induction as usual, but using the partial induction
  51.759 +  rule: *}
  51.760 +
  51.761 +apply (induct f n rule: findzero.pinduct)
  51.762 +
  51.763 +txt {* \noindent This gives the following subgoals:
  51.764 +
  51.765 +  @{subgoals[display,indent=0]}
  51.766 +
  51.767 +  \noindent The hypothesis in our lemma was used to satisfy the first premise in
  51.768 +  the induction rule. However, we also get @{term
  51.769 +  "findzero_dom (f, n)"} as a local assumption in the induction step. This
  51.770 +  allows to unfold @{term "findzero f n"} using the @{text psimps}
  51.771 +  rule, and the rest is trivial. Since the @{text psimps} rules carry the
  51.772 +  @{text "[simp]"} attribute by default, we just need a single step:
  51.773 + *}
  51.774 +apply simp
  51.775 +done
  51.776 +
  51.777 +text {*
  51.778 +  Proofs about partial functions are often not harder than for total
  51.779 +  functions. Fig.~\ref{findzero_isar} shows a slightly more
  51.780 +  complicated proof written in Isar. It is verbose enough to show how
  51.781 +  partiality comes into play: From the partial induction, we get an
  51.782 +  additional domain condition hypothesis. Observe how this condition
  51.783 +  is applied when calls to @{term findzero} are unfolded.
  51.784 +*}
  51.785 +
  51.786 +text_raw {*
  51.787 +\begin{figure}
  51.788 +\hrule\vspace{6pt}
  51.789 +\begin{minipage}{0.8\textwidth}
  51.790 +\isabellestyle{it}
  51.791 +\isastyle\isamarkuptrue
  51.792 +*}
  51.793 +lemma "\<lbrakk>findzero_dom (f, n); x \<in> {n ..< findzero f n}\<rbrakk> \<Longrightarrow> f x \<noteq> 0"
  51.794 +proof (induct rule: findzero.pinduct)
  51.795 +  fix f n assume dom: "findzero_dom (f, n)"
  51.796 +               and IH: "\<lbrakk>f n \<noteq> 0; x \<in> {Suc n ..< findzero f (Suc n)}\<rbrakk> \<Longrightarrow> f x \<noteq> 0"
  51.797 +               and x_range: "x \<in> {n ..< findzero f n}"
  51.798 +  have "f n \<noteq> 0"
  51.799 +  proof 
  51.800 +    assume "f n = 0"
  51.801 +    with dom have "findzero f n = n" by simp
  51.802 +    with x_range show False by auto
  51.803 +  qed
  51.804 +  
  51.805 +  from x_range have "x = n \<or> x \<in> {Suc n ..< findzero f n}" by auto
  51.806 +  thus "f x \<noteq> 0"
  51.807 +  proof
  51.808 +    assume "x = n"
  51.809 +    with `f n \<noteq> 0` show ?thesis by simp
  51.810 +  next
  51.811 +    assume "x \<in> {Suc n ..< findzero f n}"
  51.812 +    with dom and `f n \<noteq> 0` have "x \<in> {Suc n ..< findzero f (Suc n)}" by simp
  51.813 +    with IH and `f n \<noteq> 0`
  51.814 +    show ?thesis by simp
  51.815 +  qed
  51.816 +qed
  51.817 +text_raw {*
  51.818 +\isamarkupfalse\isabellestyle{tt}
  51.819 +\end{minipage}\vspace{6pt}\hrule
  51.820 +\caption{A proof about a partial function}\label{findzero_isar}
  51.821 +\end{figure}
  51.822 +*}
  51.823 +
  51.824 +subsection {* Partial termination proofs *}
  51.825 +
  51.826 +text {*
  51.827 +  Now that we have proved some interesting properties about our
  51.828 +  function, we should turn to the domain predicate and see if it is
  51.829 +  actually true for some values. Otherwise we would have just proved
  51.830 +  lemmas with @{term False} as a premise.
  51.831 +
  51.832 +  Essentially, we need some introduction rules for @{text
  51.833 +  findzero_dom}. The function package can prove such domain
  51.834 +  introduction rules automatically. But since they are not used very
  51.835 +  often (they are almost never needed if the function is total), this
  51.836 +  functionality is disabled by default for efficiency reasons. So we have to go
  51.837 +  back and ask for them explicitly by passing the @{text
  51.838 +  "(domintros)"} option to the function package:
  51.839 +
  51.840 +\vspace{1ex}
  51.841 +\noindent\cmd{function} @{text "(domintros) findzero :: \"(nat \<Rightarrow> nat) \<Rightarrow> nat \<Rightarrow> nat\""}\\%
  51.842 +\cmd{where}\isanewline%
  51.843 +\ \ \ldots\\
  51.844 +
  51.845 +  \noindent Now the package has proved an introduction rule for @{text findzero_dom}:
  51.846 +*}
  51.847 +
  51.848 +thm findzero.domintros
  51.849 +
  51.850 +text {*
  51.851 +  @{thm[display] findzero.domintros}
  51.852 +
  51.853 +  Domain introduction rules allow to show that a given value lies in the
  51.854 +  domain of a function, if the arguments of all recursive calls
  51.855 +  are in the domain as well. They allow to do a \qt{single step} in a
  51.856 +  termination proof. Usually, you want to combine them with a suitable
  51.857 +  induction principle.
  51.858 +
  51.859 +  Since our function increases its argument at recursive calls, we
  51.860 +  need an induction principle which works \qt{backwards}. We will use
  51.861 +  @{text inc_induct}, which allows to do induction from a fixed number
  51.862 +  \qt{downwards}:
  51.863 +
  51.864 +  \begin{center}@{thm inc_induct}\hfill(@{text "inc_induct"})\end{center}
  51.865 +
  51.866 +  Figure \ref{findzero_term} gives a detailed Isar proof of the fact
  51.867 +  that @{text findzero} terminates if there is a zero which is greater
  51.868 +  or equal to @{term n}. First we derive two useful rules which will
  51.869 +  solve the base case and the step case of the induction. The
  51.870 +  induction is then straightforward, except for the unusual induction
  51.871 +  principle.
  51.872 +
  51.873 +*}
  51.874 +
  51.875 +text_raw {*
  51.876 +\begin{figure}
  51.877 +\hrule\vspace{6pt}
  51.878 +\begin{minipage}{0.8\textwidth}
  51.879 +\isabellestyle{it}
  51.880 +\isastyle\isamarkuptrue
  51.881 +*}
  51.882 +lemma findzero_termination:
  51.883 +  assumes "x \<ge> n" and "f x = 0"
  51.884 +  shows "findzero_dom (f, n)"
  51.885 +proof - 
  51.886 +  have base: "findzero_dom (f, x)"
  51.887 +    by (rule findzero.domintros) (simp add:`f x = 0`)
  51.888 +
  51.889 +  have step: "\<And>i. findzero_dom (f, Suc i) 
  51.890 +    \<Longrightarrow> findzero_dom (f, i)"
  51.891 +    by (rule findzero.domintros) simp
  51.892 +
  51.893 +  from `x \<ge> n` show ?thesis
  51.894 +  proof (induct rule:inc_induct)
  51.895 +    show "findzero_dom (f, x)" by (rule base)
  51.896 +  next
  51.897 +    fix i assume "findzero_dom (f, Suc i)"
  51.898 +    thus "findzero_dom (f, i)" by (rule step)
  51.899 +  qed
  51.900 +qed      
  51.901 +text_raw {*
  51.902 +\isamarkupfalse\isabellestyle{tt}
  51.903 +\end{minipage}\vspace{6pt}\hrule
  51.904 +\caption{Termination proof for @{text findzero}}\label{findzero_term}
  51.905 +\end{figure}
  51.906 +*}
  51.907 +      
  51.908 +text {*
  51.909 +  Again, the proof given in Fig.~\ref{findzero_term} has a lot of
  51.910 +  detail in order to explain the principles. Using more automation, we
  51.911 +  can also have a short proof:
  51.912 +*}
  51.913 +
  51.914 +lemma findzero_termination_short:
  51.915 +  assumes zero: "x >= n" 
  51.916 +  assumes [simp]: "f x = 0"
  51.917 +  shows "findzero_dom (f, n)"
  51.918 +using zero
  51.919 +by (induct rule:inc_induct) (auto intro: findzero.domintros)
  51.920 +    
  51.921 +text {*
  51.922 +  \noindent It is simple to combine the partial correctness result with the
  51.923 +  termination lemma:
  51.924 +*}
  51.925 +
  51.926 +lemma findzero_total_correctness:
  51.927 +  "f x = 0 \<Longrightarrow> f (findzero f 0) = 0"
  51.928 +by (blast intro: findzero_zero findzero_termination)
  51.929 +
  51.930 +subsection {* Definition of the domain predicate *}
  51.931 +
  51.932 +text {*
  51.933 +  Sometimes it is useful to know what the definition of the domain
  51.934 +  predicate looks like. Actually, @{text findzero_dom} is just an
  51.935 +  abbreviation:
  51.936 +
  51.937 +  @{abbrev[display] findzero_dom}
  51.938 +
  51.939 +  The domain predicate is the \emph{accessible part} of a relation @{const
  51.940 +  findzero_rel}, which was also created internally by the function
  51.941 +  package. @{const findzero_rel} is just a normal
  51.942 +  inductive predicate, so we can inspect its definition by
  51.943 +  looking at the introduction rules @{text findzero_rel.intros}.
  51.944 +  In our case there is just a single rule:
  51.945 +
  51.946 +  @{thm[display] findzero_rel.intros}
  51.947 +
  51.948 +  The predicate @{const findzero_rel}
  51.949 +  describes the \emph{recursion relation} of the function
  51.950 +  definition. The recursion relation is a binary relation on
  51.951 +  the arguments of the function that relates each argument to its
  51.952 +  recursive calls. In general, there is one introduction rule for each
  51.953 +  recursive call.
  51.954 +
  51.955 +  The predicate @{term "accp findzero_rel"} is the accessible part of
  51.956 +  that relation. An argument belongs to the accessible part, if it can
  51.957 +  be reached in a finite number of steps (cf.~its definition in @{text
  51.958 +  "Wellfounded.thy"}).
  51.959 +
  51.960 +  Since the domain predicate is just an abbreviation, you can use
  51.961 +  lemmas for @{const accp} and @{const findzero_rel} directly. Some
  51.962 +  lemmas which are occasionally useful are @{text accpI}, @{text
  51.963 +  accp_downward}, and of course the introduction and elimination rules
  51.964 +  for the recursion relation @{text "findzero.intros"} and @{text "findzero.cases"}.
  51.965 +*}
  51.966 +
  51.967 +(*lemma findzero_nicer_domintros:
  51.968 +  "f x = 0 \<Longrightarrow> findzero_dom (f, x)"
  51.969 +  "findzero_dom (f, Suc x) \<Longrightarrow> findzero_dom (f, x)"
  51.970 +by (rule accpI, erule findzero_rel.cases, auto)+
  51.971 +*)
  51.972 +  
  51.973 +subsection {* A Useful Special Case: Tail recursion *}
  51.974 +
  51.975 +text {*
  51.976 +  The domain predicate is our trick that allows us to model partiality
  51.977 +  in a world of total functions. The downside of this is that we have
  51.978 +  to carry it around all the time. The termination proof above allowed
  51.979 +  us to replace the abstract @{term "findzero_dom (f, n)"} by the more
  51.980 +  concrete @{term "(x \<ge> n \<and> f x = (0::nat))"}, but the condition is still
  51.981 +  there and can only be discharged for special cases.
  51.982 +  In particular, the domain predicate guards the unfolding of our
  51.983 +  function, since it is there as a condition in the @{text psimp}
  51.984 +  rules. 
  51.985 +
  51.986 +  Now there is an important special case: We can actually get rid
  51.987 +  of the condition in the simplification rules, \emph{if the function
  51.988 +  is tail-recursive}. The reason is that for all tail-recursive
  51.989 +  equations there is a total function satisfying them, even if they
  51.990 +  are non-terminating. 
  51.991 +
  51.992 +%  A function is tail recursive, if each call to the function is either
  51.993 +%  equal
  51.994 +%
  51.995 +%  So the outer form of the 
  51.996 +%
  51.997 +%if it can be written in the following
  51.998 +%  form:
  51.999 +%  {term[display] "f x = (if COND x then BASE x else f (LOOP x))"}
 51.1000 +
 51.1001 +
 51.1002 +  The function package internally does the right construction and can
 51.1003 +  derive the unconditional simp rules, if we ask it to do so. Luckily,
 51.1004 +  our @{const "findzero"} function is tail-recursive, so we can just go
 51.1005 +  back and add another option to the \cmd{function} command:
 51.1006 +
 51.1007 +\vspace{1ex}
 51.1008 +\noindent\cmd{function} @{text "(domintros, tailrec) findzero :: \"(nat \<Rightarrow> nat) \<Rightarrow> nat \<Rightarrow> nat\""}\\%
 51.1009 +\cmd{where}\isanewline%
 51.1010 +\ \ \ldots\\%
 51.1011 +
 51.1012 +  
 51.1013 +  \noindent Now, we actually get unconditional simplification rules, even
 51.1014 +  though the function is partial:
 51.1015 +*}
 51.1016 +
 51.1017 +thm findzero.simps
 51.1018 +
 51.1019 +text {*
 51.1020 +  @{thm[display] findzero.simps}
 51.1021 +
 51.1022 +  \noindent Of course these would make the simplifier loop, so we better remove
 51.1023 +  them from the simpset:
 51.1024 +*}
 51.1025 +
 51.1026 +declare findzero.simps[simp del]
 51.1027 +
 51.1028 +text {* 
 51.1029 +  Getting rid of the domain conditions in the simplification rules is
 51.1030 +  not only useful because it simplifies proofs. It is also required in
 51.1031 +  order to use Isabelle's code generator to generate ML code
 51.1032 +  from a function definition.
 51.1033 +  Since the code generator only works with equations, it cannot be
 51.1034 +  used with @{text "psimp"} rules. Thus, in order to generate code for
 51.1035 +  partial functions, they must be defined as a tail recursion.
 51.1036 +  Luckily, many functions have a relatively natural tail recursive
 51.1037 +  definition.
 51.1038 +*}
 51.1039 +
 51.1040 +section {* Nested recursion *}
 51.1041 +
 51.1042 +text {*
 51.1043 +  Recursive calls which are nested in one another frequently cause
 51.1044 +  complications, since their termination proof can depend on a partial
 51.1045 +  correctness property of the function itself. 
 51.1046 +
 51.1047 +  As a small example, we define the \qt{nested zero} function:
 51.1048 +*}
 51.1049 +
 51.1050 +function nz :: "nat \<Rightarrow> nat"
 51.1051 +where
 51.1052 +  "nz 0 = 0"
 51.1053 +| "nz (Suc n) = nz (nz n)"
 51.1054 +by pat_completeness auto
 51.1055 +
 51.1056 +text {*
 51.1057 +  If we attempt to prove termination using the identity measure on
 51.1058 +  naturals, this fails:
 51.1059 +*}
 51.1060 +
 51.1061 +termination
 51.1062 +  apply (relation "measure (\<lambda>n. n)")
 51.1063 +  apply auto
 51.1064 +
 51.1065 +txt {*
 51.1066 +  We get stuck with the subgoal
 51.1067 +
 51.1068 +  @{subgoals[display]}
 51.1069 +
 51.1070 +  Of course this statement is true, since we know that @{const nz} is
 51.1071 +  the zero function. And in fact we have no problem proving this
 51.1072 +  property by induction.
 51.1073 +*}
 51.1074 +(*<*)oops(*>*)
 51.1075 +lemma nz_is_zero: "nz_dom n \<Longrightarrow> nz n = 0"
 51.1076 +  by (induct rule:nz.pinduct) auto
 51.1077 +
 51.1078 +text {*
 51.1079 +  We formulate this as a partial correctness lemma with the condition
 51.1080 +  @{term "nz_dom n"}. This allows us to prove it with the @{text
 51.1081 +  pinduct} rule before we have proved termination. With this lemma,
 51.1082 +  the termination proof works as expected:
 51.1083 +*}
 51.1084 +
 51.1085 +termination
 51.1086 +  by (relation "measure (\<lambda>n. n)") (auto simp: nz_is_zero)
 51.1087 +
 51.1088 +text {*
 51.1089 +  As a general strategy, one should prove the statements needed for
 51.1090 +  termination as a partial property first. Then they can be used to do
 51.1091 +  the termination proof. This also works for less trivial
 51.1092 +  examples. Figure \ref{f91} defines the 91-function, a well-known
 51.1093 +  challenge problem due to John McCarthy, and proves its termination.
 51.1094 +*}
 51.1095 +
 51.1096 +text_raw {*
 51.1097 +\begin{figure}
 51.1098 +\hrule\vspace{6pt}
 51.1099 +\begin{minipage}{0.8\textwidth}
 51.1100 +\isabellestyle{it}
 51.1101 +\isastyle\isamarkuptrue
 51.1102 +*}
 51.1103 +
 51.1104 +function f91 :: "nat \<Rightarrow> nat"
 51.1105 +where
 51.1106 +  "f91 n = (if 100 < n then n - 10 else f91 (f91 (n + 11)))"
 51.1107 +by pat_completeness auto
 51.1108 +
 51.1109 +lemma f91_estimate: 
 51.1110 +  assumes trm: "f91_dom n" 
 51.1111 +  shows "n < f91 n + 11"
 51.1112 +using trm by induct auto
 51.1113 +
 51.1114 +termination
 51.1115 +proof
 51.1116 +  let ?R = "measure (\<lambda>x. 101 - x)"
 51.1117 +  show "wf ?R" ..
 51.1118 +
 51.1119 +  fix n :: nat assume "\<not> 100 < n" -- "Assumptions for both calls"
 51.1120 +
 51.1121 +  thus "(n + 11, n) \<in> ?R" by simp -- "Inner call"
 51.1122 +
 51.1123 +  assume inner_trm: "f91_dom (n + 11)" -- "Outer call"
 51.1124 +  with f91_estimate have "n + 11 < f91 (n + 11) + 11" .
 51.1125 +  with `\<not> 100 < n` show "(f91 (n + 11), n) \<in> ?R" by simp
 51.1126 +qed
 51.1127 +
 51.1128 +text_raw {*
 51.1129 +\isamarkupfalse\isabellestyle{tt}
 51.1130 +\end{minipage}
 51.1131 +\vspace{6pt}\hrule
 51.1132 +\caption{McCarthy's 91-function}\label{f91}
 51.1133 +\end{figure}
 51.1134 +*}
 51.1135 +
 51.1136 +
 51.1137 +section {* Higher-Order Recursion *}
 51.1138 +
 51.1139 +text {*
 51.1140 +  Higher-order recursion occurs when recursive calls
 51.1141 +  are passed as arguments to higher-order combinators such as @{const
 51.1142 +  map}, @{term filter} etc.
 51.1143 +  As an example, imagine a datatype of n-ary trees:
 51.1144 +*}
 51.1145 +
 51.1146 +datatype 'a tree = 
 51.1147 +  Leaf 'a 
 51.1148 +| Branch "'a tree list"
 51.1149 +
 51.1150 +
 51.1151 +text {* \noindent We can define a function which swaps the left and right subtrees recursively, using the 
 51.1152 +  list functions @{const rev} and @{const map}: *}
 51.1153 +
 51.1154 +fun mirror :: "'a tree \<Rightarrow> 'a tree"
 51.1155 +where
 51.1156 +  "mirror (Leaf n) = Leaf n"
 51.1157 +| "mirror (Branch l) = Branch (rev (map mirror l))"
 51.1158 +
 51.1159 +text {*
 51.1160 +  Although the definition is accepted without problems, let us look at the termination proof:
 51.1161 +*}
 51.1162 +
 51.1163 +termination proof
 51.1164 +  txt {*
 51.1165 +
 51.1166 +  As usual, we have to give a wellfounded relation, such that the
 51.1167 +  arguments of the recursive calls get smaller. But what exactly are
 51.1168 +  the arguments of the recursive calls when mirror is given as an
 51.1169 +  argument to @{const map}? Isabelle gives us the
 51.1170 +  subgoals
 51.1171 +
 51.1172 +  @{subgoals[display,indent=0]} 
 51.1173 +
 51.1174 +  So the system seems to know that @{const map} only
 51.1175 +  applies the recursive call @{term "mirror"} to elements
 51.1176 +  of @{term "l"}, which is essential for the termination proof.
 51.1177 +
 51.1178 +  This knowledge about @{const map} is encoded in so-called congruence rules,
 51.1179 +  which are special theorems known to the \cmd{function} command. The
 51.1180 +  rule for @{const map} is
 51.1181 +
 51.1182 +  @{thm[display] map_cong}
 51.1183 +
 51.1184 +  You can read this in the following way: Two applications of @{const
 51.1185 +  map} are equal, if the list arguments are equal and the functions
 51.1186 +  coincide on the elements of the list. This means that for the value 
 51.1187 +  @{term "map f l"} we only have to know how @{term f} behaves on
 51.1188 +  the elements of @{term l}.
 51.1189 +
 51.1190 +  Usually, one such congruence rule is
 51.1191 +  needed for each higher-order construct that is used when defining
 51.1192 +  new functions. In fact, even basic functions like @{const
 51.1193 +  If} and @{const Let} are handled by this mechanism. The congruence
 51.1194 +  rule for @{const If} states that the @{text then} branch is only
 51.1195 +  relevant if the condition is true, and the @{text else} branch only if it
 51.1196 +  is false:
 51.1197 +
 51.1198 +  @{thm[display] if_cong}
 51.1199 +  
 51.1200 +  Congruence rules can be added to the
 51.1201 +  function package by giving them the @{term fundef_cong} attribute.
 51.1202 +
 51.1203 +  The constructs that are predefined in Isabelle, usually
 51.1204 +  come with the respective congruence rules.
 51.1205 +  But if you define your own higher-order functions, you may have to
 51.1206 +  state and prove the required congruence rules yourself, if you want to use your
 51.1207 +  functions in recursive definitions. 
 51.1208 +*}
 51.1209 +(*<*)oops(*>*)
 51.1210 +
 51.1211 +subsection {* Congruence Rules and Evaluation Order *}
 51.1212 +
 51.1213 +text {* 
 51.1214 +  Higher order logic differs from functional programming languages in
 51.1215 +  that it has no built-in notion of evaluation order. A program is
 51.1216 +  just a set of equations, and it is not specified how they must be
 51.1217 +  evaluated. 
 51.1218 +
 51.1219 +  However for the purpose of function definition, we must talk about
 51.1220 +  evaluation order implicitly, when we reason about termination.
 51.1221 +  Congruence rules express that a certain evaluation order is
 51.1222 +  consistent with the logical definition. 
 51.1223 +
 51.1224 +  Consider the following function.
 51.1225 +*}
 51.1226 +
 51.1227 +function f :: "nat \<Rightarrow> bool"
 51.1228 +where
 51.1229 +  "f n = (n = 0 \<or> f (n - 1))"
 51.1230 +(*<*)by pat_completeness auto(*>*)
 51.1231 +
 51.1232 +text {*
 51.1233 +  For this definition, the termination proof fails. The default configuration
 51.1234 +  specifies no congruence rule for disjunction. We have to add a
 51.1235 +  congruence rule that specifies left-to-right evaluation order:
 51.1236 +
 51.1237 +  \vspace{1ex}
 51.1238 +  \noindent @{thm disj_cong}\hfill(@{text "disj_cong"})
 51.1239 +  \vspace{1ex}
 51.1240 +
 51.1241 +  Now the definition works without problems. Note how the termination
 51.1242 +  proof depends on the extra condition that we get from the congruence
 51.1243 +  rule.
 51.1244 +
 51.1245 +  However, as evaluation is not a hard-wired concept, we
 51.1246 +  could just turn everything around by declaring a different
 51.1247 +  congruence rule. Then we can make the reverse definition:
 51.1248 +*}
 51.1249 +
 51.1250 +lemma disj_cong2[fundef_cong]: 
 51.1251 +  "(\<not> Q' \<Longrightarrow> P = P') \<Longrightarrow> (Q = Q') \<Longrightarrow> (P \<or> Q) = (P' \<or> Q')"
 51.1252 +  by blast
 51.1253 +
 51.1254 +fun f' :: "nat \<Rightarrow> bool"
 51.1255 +where
 51.1256 +  "f' n = (f' (n - 1) \<or> n = 0)"
 51.1257 +
 51.1258 +text {*
 51.1259 +  \noindent These examples show that, in general, there is no \qt{best} set of
 51.1260 +  congruence rules.
 51.1261 +
 51.1262 +  However, such tweaking should rarely be necessary in
 51.1263 +  practice, as most of the time, the default set of congruence rules
 51.1264 +  works well.
 51.1265 +*}
 51.1266 +
 51.1267 +end
    52.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    52.2 +++ b/doc-src/Functions/Thy/ROOT.ML	Tue Mar 03 11:00:51 2009 +0100
    52.3 @@ -0,0 +1,4 @@
    52.4 +
    52.5 +(* $Id$ *)
    52.6 +
    52.7 +use_thy "Functions";
    53.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    53.2 +++ b/doc-src/Functions/Thy/document/Functions.tex	Tue Mar 03 11:00:51 2009 +0100
    53.3 @@ -0,0 +1,1985 @@
    53.4 +%
    53.5 +\begin{isabellebody}%
    53.6 +\def\isabellecontext{Functions}%
    53.7 +%
    53.8 +\isadelimtheory
    53.9 +\isanewline
   53.10 +\isanewline
   53.11 +%
   53.12 +\endisadelimtheory
   53.13 +%
   53.14 +\isatagtheory
   53.15 +\isacommand{theory}\isamarkupfalse%
   53.16 +\ Functions\isanewline
   53.17 +\isakeyword{imports}\ Main\isanewline
   53.18 +\isakeyword{begin}%
   53.19 +\endisatagtheory
   53.20 +{\isafoldtheory}%
   53.21 +%
   53.22 +\isadelimtheory
   53.23 +%
   53.24 +\endisadelimtheory
   53.25 +%
   53.26 +\isamarkupsection{Function Definitions for Dummies%
   53.27 +}
   53.28 +\isamarkuptrue%
   53.29 +%
   53.30 +\begin{isamarkuptext}%
   53.31 +In most cases, defining a recursive function is just as simple as other definitions:%
   53.32 +\end{isamarkuptext}%
   53.33 +\isamarkuptrue%
   53.34 +\isacommand{fun}\isamarkupfalse%
   53.35 +\ fib\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ nat{\isachardoublequoteclose}\isanewline
   53.36 +\isakeyword{where}\isanewline
   53.37 +\ \ {\isachardoublequoteopen}fib\ {\isadigit{0}}\ {\isacharequal}\ {\isadigit{1}}{\isachardoublequoteclose}\isanewline
   53.38 +{\isacharbar}\ {\isachardoublequoteopen}fib\ {\isacharparenleft}Suc\ {\isadigit{0}}{\isacharparenright}\ {\isacharequal}\ {\isadigit{1}}{\isachardoublequoteclose}\isanewline
   53.39 +{\isacharbar}\ {\isachardoublequoteopen}fib\ {\isacharparenleft}Suc\ {\isacharparenleft}Suc\ n{\isacharparenright}{\isacharparenright}\ {\isacharequal}\ fib\ n\ {\isacharplus}\ fib\ {\isacharparenleft}Suc\ n{\isacharparenright}{\isachardoublequoteclose}%
   53.40 +\begin{isamarkuptext}%
   53.41 +The syntax is rather self-explanatory: We introduce a function by
   53.42 +  giving its name, its type, 
   53.43 +  and a set of defining recursive equations.
   53.44 +  If we leave out the type, the most general type will be
   53.45 +  inferred, which can sometimes lead to surprises: Since both \isa{{\isadigit{1}}} and \isa{{\isacharplus}} are overloaded, we would end up
   53.46 +  with \isa{fib\ {\isacharcolon}{\isacharcolon}\ nat\ {\isasymRightarrow}\ {\isacharprime}a{\isacharcolon}{\isacharcolon}{\isacharbraceleft}one{\isacharcomma}plus{\isacharbraceright}}.%
   53.47 +\end{isamarkuptext}%
   53.48 +\isamarkuptrue%
   53.49 +%
   53.50 +\begin{isamarkuptext}%
   53.51 +The function always terminates, since its argument gets smaller in
   53.52 +  every recursive call. 
   53.53 +  Since HOL is a logic of total functions, termination is a
   53.54 +  fundamental requirement to prevent inconsistencies\footnote{From the
   53.55 +  \qt{definition} \isa{f{\isacharparenleft}n{\isacharparenright}\ {\isacharequal}\ f{\isacharparenleft}n{\isacharparenright}\ {\isacharplus}\ {\isadigit{1}}} we could prove 
   53.56 +  \isa{{\isadigit{0}}\ {\isacharequal}\ {\isadigit{1}}} by subtracting \isa{f{\isacharparenleft}n{\isacharparenright}} on both sides.}.
   53.57 +  Isabelle tries to prove termination automatically when a definition
   53.58 +  is made. In \S\ref{termination}, we will look at cases where this
   53.59 +  fails and see what to do then.%
   53.60 +\end{isamarkuptext}%
   53.61 +\isamarkuptrue%
   53.62 +%
   53.63 +\isamarkupsubsection{Pattern matching%
   53.64 +}
   53.65 +\isamarkuptrue%
   53.66 +%
   53.67 +\begin{isamarkuptext}%
   53.68 +\label{patmatch}
   53.69 +  Like in functional programming, we can use pattern matching to
   53.70 +  define functions. At the moment we will only consider \emph{constructor
   53.71 +  patterns}, which only consist of datatype constructors and
   53.72 +  variables. Furthermore, patterns must be linear, i.e.\ all variables
   53.73 +  on the left hand side of an equation must be distinct. In
   53.74 +  \S\ref{genpats} we discuss more general pattern matching.
   53.75 +
   53.76 +  If patterns overlap, the order of the equations is taken into
   53.77 +  account. The following function inserts a fixed element between any
   53.78 +  two elements of a list:%
   53.79 +\end{isamarkuptext}%
   53.80 +\isamarkuptrue%
   53.81 +\isacommand{fun}\isamarkupfalse%
   53.82 +\ sep\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a\ list\ {\isasymRightarrow}\ {\isacharprime}a\ list{\isachardoublequoteclose}\isanewline
   53.83 +\isakeyword{where}\isanewline
   53.84 +\ \ {\isachardoublequoteopen}sep\ a\ {\isacharparenleft}x{\isacharhash}y{\isacharhash}xs{\isacharparenright}\ {\isacharequal}\ x\ {\isacharhash}\ a\ {\isacharhash}\ sep\ a\ {\isacharparenleft}y\ {\isacharhash}\ xs{\isacharparenright}{\isachardoublequoteclose}\isanewline
   53.85 +{\isacharbar}\ {\isachardoublequoteopen}sep\ a\ xs\ \ \ \ \ \ \ {\isacharequal}\ xs{\isachardoublequoteclose}%
   53.86 +\begin{isamarkuptext}%
   53.87 +Overlapping patterns are interpreted as \qt{increments} to what is
   53.88 +  already there: The second equation is only meant for the cases where
   53.89 +  the first one does not match. Consequently, Isabelle replaces it
   53.90 +  internally by the remaining cases, making the patterns disjoint:%
   53.91 +\end{isamarkuptext}%
   53.92 +\isamarkuptrue%
   53.93 +\isacommand{thm}\isamarkupfalse%
   53.94 +\ sep{\isachardot}simps%
   53.95 +\begin{isamarkuptext}%
   53.96 +\begin{isabelle}%
   53.97 +sep\ a\ {\isacharparenleft}x\ {\isacharhash}\ y\ {\isacharhash}\ xs{\isacharparenright}\ {\isacharequal}\ x\ {\isacharhash}\ a\ {\isacharhash}\ sep\ a\ {\isacharparenleft}y\ {\isacharhash}\ xs{\isacharparenright}\isasep\isanewline%
   53.98 +sep\ a\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharequal}\ {\isacharbrackleft}{\isacharbrackright}\isasep\isanewline%
   53.99 +sep\ a\ {\isacharbrackleft}v{\isacharbrackright}\ {\isacharequal}\ {\isacharbrackleft}v{\isacharbrackright}%
  53.100 +\end{isabelle}%
  53.101 +\end{isamarkuptext}%
  53.102 +\isamarkuptrue%
  53.103 +%
  53.104 +\begin{isamarkuptext}%
  53.105 +\noindent The equations from function definitions are automatically used in
  53.106 +  simplification:%
  53.107 +\end{isamarkuptext}%
  53.108 +\isamarkuptrue%
  53.109 +\isacommand{lemma}\isamarkupfalse%
  53.110 +\ {\isachardoublequoteopen}sep\ {\isadigit{0}}\ {\isacharbrackleft}{\isadigit{1}}{\isacharcomma}\ {\isadigit{2}}{\isacharcomma}\ {\isadigit{3}}{\isacharbrackright}\ {\isacharequal}\ {\isacharbrackleft}{\isadigit{1}}{\isacharcomma}\ {\isadigit{0}}{\isacharcomma}\ {\isadigit{2}}{\isacharcomma}\ {\isadigit{0}}{\isacharcomma}\ {\isadigit{3}}{\isacharbrackright}{\isachardoublequoteclose}\isanewline
  53.111 +%
  53.112 +\isadelimproof
  53.113 +%
  53.114 +\endisadelimproof
  53.115 +%
  53.116 +\isatagproof
  53.117 +\isacommand{by}\isamarkupfalse%
  53.118 +\ simp%
  53.119 +\endisatagproof
  53.120 +{\isafoldproof}%
  53.121 +%
  53.122 +\isadelimproof
  53.123 +%
  53.124 +\endisadelimproof
  53.125 +%
  53.126 +\isamarkupsubsection{Induction%
  53.127 +}
  53.128 +\isamarkuptrue%
  53.129 +%
  53.130 +\begin{isamarkuptext}%
  53.131 +Isabelle provides customized induction rules for recursive
  53.132 +  functions. These rules follow the recursive structure of the
  53.133 +  definition. Here is the rule \isa{sep{\isachardot}induct} arising from the
  53.134 +  above definition of \isa{sep}:
  53.135 +
  53.136 +  \begin{isabelle}%
  53.137 +{\isasymlbrakk}{\isasymAnd}a\ x\ y\ xs{\isachardot}\ {\isacharquery}P\ a\ {\isacharparenleft}y\ {\isacharhash}\ xs{\isacharparenright}\ {\isasymLongrightarrow}\ {\isacharquery}P\ a\ {\isacharparenleft}x\ {\isacharhash}\ y\ {\isacharhash}\ xs{\isacharparenright}{\isacharsemicolon}\ {\isasymAnd}a{\isachardot}\ {\isacharquery}P\ a\ {\isacharbrackleft}{\isacharbrackright}{\isacharsemicolon}\ {\isasymAnd}a\ v{\isachardot}\ {\isacharquery}P\ a\ {\isacharbrackleft}v{\isacharbrackright}{\isasymrbrakk}\isanewline
  53.138 +{\isasymLongrightarrow}\ {\isacharquery}P\ {\isacharquery}a{\isadigit{0}}{\isachardot}{\isadigit{0}}\ {\isacharquery}a{\isadigit{1}}{\isachardot}{\isadigit{0}}%
  53.139 +\end{isabelle}
  53.140 +  
  53.141 +  We have a step case for list with at least two elements, and two
  53.142 +  base cases for the zero- and the one-element list. Here is a simple
  53.143 +  proof about \isa{sep} and \isa{map}%
  53.144 +\end{isamarkuptext}%
  53.145 +\isamarkuptrue%
  53.146 +\isacommand{lemma}\isamarkupfalse%
  53.147 +\ {\isachardoublequoteopen}map\ f\ {\isacharparenleft}sep\ x\ ys{\isacharparenright}\ {\isacharequal}\ sep\ {\isacharparenleft}f\ x{\isacharparenright}\ {\isacharparenleft}map\ f\ ys{\isacharparenright}{\isachardoublequoteclose}\isanewline
  53.148 +%
  53.149 +\isadelimproof
  53.150 +%
  53.151 +\endisadelimproof
  53.152 +%
  53.153 +\isatagproof
  53.154 +\isacommand{apply}\isamarkupfalse%
  53.155 +\ {\isacharparenleft}induct\ x\ ys\ rule{\isacharcolon}\ sep{\isachardot}induct{\isacharparenright}%
  53.156 +\begin{isamarkuptxt}%
  53.157 +We get three cases, like in the definition.
  53.158 +
  53.159 +  \begin{isabelle}%
  53.160 +\ {\isadigit{1}}{\isachardot}\ {\isasymAnd}a\ x\ y\ xs{\isachardot}\isanewline
  53.161 +\isaindent{\ {\isadigit{1}}{\isachardot}\ \ \ \ }map\ f\ {\isacharparenleft}sep\ a\ {\isacharparenleft}y\ {\isacharhash}\ xs{\isacharparenright}{\isacharparenright}\ {\isacharequal}\ sep\ {\isacharparenleft}f\ a{\isacharparenright}\ {\isacharparenleft}map\ f\ {\isacharparenleft}y\ {\isacharhash}\ xs{\isacharparenright}{\isacharparenright}\ {\isasymLongrightarrow}\isanewline
  53.162 +\isaindent{\ {\isadigit{1}}{\isachardot}\ \ \ \ }map\ f\ {\isacharparenleft}sep\ a\ {\isacharparenleft}x\ {\isacharhash}\ y\ {\isacharhash}\ xs{\isacharparenright}{\isacharparenright}\ {\isacharequal}\ sep\ {\isacharparenleft}f\ a{\isacharparenright}\ {\isacharparenleft}map\ f\ {\isacharparenleft}x\ {\isacharhash}\ y\ {\isacharhash}\ xs{\isacharparenright}{\isacharparenright}\isanewline
  53.163 +\ {\isadigit{2}}{\isachardot}\ {\isasymAnd}a{\isachardot}\ map\ f\ {\isacharparenleft}sep\ a\ {\isacharbrackleft}{\isacharbrackright}{\isacharparenright}\ {\isacharequal}\ sep\ {\isacharparenleft}f\ a{\isacharparenright}\ {\isacharparenleft}map\ f\ {\isacharbrackleft}{\isacharbrackright}{\isacharparenright}\isanewline
  53.164 +\ {\isadigit{3}}{\isachardot}\ {\isasymAnd}a\ v{\isachardot}\ map\ f\ {\isacharparenleft}sep\ a\ {\isacharbrackleft}v{\isacharbrackright}{\isacharparenright}\ {\isacharequal}\ sep\ {\isacharparenleft}f\ a{\isacharparenright}\ {\isacharparenleft}map\ f\ {\isacharbrackleft}v{\isacharbrackright}{\isacharparenright}%
  53.165 +\end{isabelle}%
  53.166 +\end{isamarkuptxt}%
  53.167 +\isamarkuptrue%
  53.168 +\isacommand{apply}\isamarkupfalse%
  53.169 +\ auto\ \isanewline
  53.170 +\isacommand{done}\isamarkupfalse%
  53.171 +%
  53.172 +\endisatagproof
  53.173 +{\isafoldproof}%
  53.174 +%
  53.175 +\isadelimproof
  53.176 +%
  53.177 +\endisadelimproof
  53.178 +%
  53.179 +\begin{isamarkuptext}%
  53.180 +With the \cmd{fun} command, you can define about 80\% of the
  53.181 +  functions that occur in practice. The rest of this tutorial explains
  53.182 +  the remaining 20\%.%
  53.183 +\end{isamarkuptext}%
  53.184 +\isamarkuptrue%
  53.185 +%
  53.186 +\isamarkupsection{fun vs.\ function%
  53.187 +}
  53.188 +\isamarkuptrue%
  53.189 +%
  53.190 +\begin{isamarkuptext}%
  53.191 +The \cmd{fun} command provides a
  53.192 +  convenient shorthand notation for simple function definitions. In
  53.193 +  this mode, Isabelle tries to solve all the necessary proof obligations
  53.194 +  automatically. If any proof fails, the definition is
  53.195 +  rejected. This can either mean that the definition is indeed faulty,
  53.196 +  or that the default proof procedures are just not smart enough (or
  53.197 +  rather: not designed) to handle the definition.
  53.198 +
  53.199 +  By expanding the abbreviation to the more verbose \cmd{function} command, these proof obligations become visible and can be analyzed or
  53.200 +  solved manually. The expansion from \cmd{fun} to \cmd{function} is as follows:
  53.201 +
  53.202 +\end{isamarkuptext}
  53.203 +
  53.204 +
  53.205 +\[\left[\;\begin{minipage}{0.25\textwidth}\vspace{6pt}
  53.206 +\cmd{fun} \isa{f\ {\isacharcolon}{\isacharcolon}\ {\isasymtau}}\\%
  53.207 +\cmd{where}\\%
  53.208 +\hspace*{2ex}{\it equations}\\%
  53.209 +\hspace*{2ex}\vdots\vspace*{6pt}
  53.210 +\end{minipage}\right]
  53.211 +\quad\equiv\quad
  53.212 +\left[\;\begin{minipage}{0.48\textwidth}\vspace{6pt}
  53.213 +\cmd{function} \isa{{\isacharparenleft}}\cmd{sequential}\isa{{\isacharparenright}\ f\ {\isacharcolon}{\isacharcolon}\ {\isasymtau}}\\%
  53.214 +\cmd{where}\\%
  53.215 +\hspace*{2ex}{\it equations}\\%
  53.216 +\hspace*{2ex}\vdots\\%
  53.217 +\cmd{by} \isa{pat{\isacharunderscore}completeness\ auto}\\%
  53.218 +\cmd{termination by} \isa{lexicographic{\isacharunderscore}order}\vspace{6pt}
  53.219 +\end{minipage}
  53.220 +\right]\]
  53.221 +
  53.222 +\begin{isamarkuptext}
  53.223 +  \vspace*{1em}
  53.224 +  \noindent Some details have now become explicit:
  53.225 +
  53.226 +  \begin{enumerate}
  53.227 +  \item The \cmd{sequential} option enables the preprocessing of
  53.228 +  pattern overlaps which we already saw. Without this option, the equations
  53.229 +  must already be disjoint and complete. The automatic completion only
  53.230 +  works with constructor patterns.
  53.231 +
  53.232 +  \item A function definition produces a proof obligation which
  53.233 +  expresses completeness and compatibility of patterns (we talk about
  53.234 +  this later). The combination of the methods \isa{pat{\isacharunderscore}completeness} and
  53.235 +  \isa{auto} is used to solve this proof obligation.
  53.236 +
  53.237 +  \item A termination proof follows the definition, started by the
  53.238 +  \cmd{termination} command. This will be explained in \S\ref{termination}.
  53.239 + \end{enumerate}
  53.240 +  Whenever a \cmd{fun} command fails, it is usually a good idea to
  53.241 +  expand the syntax to the more verbose \cmd{function} form, to see
  53.242 +  what is actually going on.%
  53.243 +\end{isamarkuptext}%
  53.244 +\isamarkuptrue%
  53.245 +%
  53.246 +\isamarkupsection{Termination%
  53.247 +}
  53.248 +\isamarkuptrue%
  53.249 +%
  53.250 +\begin{isamarkuptext}%
  53.251 +\label{termination}
  53.252 +  The method \isa{lexicographic{\isacharunderscore}order} is the default method for
  53.253 +  termination proofs. It can prove termination of a
  53.254 +  certain class of functions by searching for a suitable lexicographic
  53.255 +  combination of size measures. Of course, not all functions have such
  53.256 +  a simple termination argument. For them, we can specify the termination
  53.257 +  relation manually.%
  53.258 +\end{isamarkuptext}%
  53.259 +\isamarkuptrue%
  53.260 +%
  53.261 +\isamarkupsubsection{The {\tt relation} method%
  53.262 +}
  53.263 +\isamarkuptrue%
  53.264 +%
  53.265 +\begin{isamarkuptext}%
  53.266 +Consider the following function, which sums up natural numbers up to
  53.267 +  \isa{N}, using a counter \isa{i}:%
  53.268 +\end{isamarkuptext}%
  53.269 +\isamarkuptrue%
  53.270 +\isacommand{function}\isamarkupfalse%
  53.271 +\ sum\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ nat\ {\isasymRightarrow}\ nat{\isachardoublequoteclose}\isanewline
  53.272 +\isakeyword{where}\isanewline
  53.273 +\ \ {\isachardoublequoteopen}sum\ i\ N\ {\isacharequal}\ {\isacharparenleft}if\ i\ {\isachargreater}\ N\ then\ {\isadigit{0}}\ else\ i\ {\isacharplus}\ sum\ {\isacharparenleft}Suc\ i{\isacharparenright}\ N{\isacharparenright}{\isachardoublequoteclose}\isanewline
  53.274 +%
  53.275 +\isadelimproof
  53.276 +%
  53.277 +\endisadelimproof
  53.278 +%
  53.279 +\isatagproof
  53.280 +\isacommand{by}\isamarkupfalse%
  53.281 +\ pat{\isacharunderscore}completeness\ auto%
  53.282 +\endisatagproof
  53.283 +{\isafoldproof}%
  53.284 +%
  53.285 +\isadelimproof
  53.286 +%
  53.287 +\endisadelimproof
  53.288 +%
  53.289 +\begin{isamarkuptext}%
  53.290 +\noindent The \isa{lexicographic{\isacharunderscore}order} method fails on this example, because none of the
  53.291 +  arguments decreases in the recursive call, with respect to the standard size ordering.
  53.292 +  To prove termination manually, we must provide a custom wellfounded relation.
  53.293 +
  53.294 +  The termination argument for \isa{sum} is based on the fact that
  53.295 +  the \emph{difference} between \isa{i} and \isa{N} gets
  53.296 +  smaller in every step, and that the recursion stops when \isa{i}
  53.297 +  is greater than \isa{N}. Phrased differently, the expression 
  53.298 +  \isa{N\ {\isacharplus}\ {\isadigit{1}}\ {\isacharminus}\ i} always decreases.
  53.299 +
  53.300 +  We can use this expression as a measure function suitable to prove termination.%
  53.301 +\end{isamarkuptext}%
  53.302 +\isamarkuptrue%
  53.303 +\isacommand{termination}\isamarkupfalse%
  53.304 +\ sum\isanewline
  53.305 +%
  53.306 +\isadelimproof
  53.307 +%
  53.308 +\endisadelimproof
  53.309 +%
  53.310 +\isatagproof
  53.311 +\isacommand{apply}\isamarkupfalse%
  53.312 +\ {\isacharparenleft}relation\ {\isachardoublequoteopen}measure\ {\isacharparenleft}{\isasymlambda}{\isacharparenleft}i{\isacharcomma}N{\isacharparenright}{\isachardot}\ N\ {\isacharplus}\ {\isadigit{1}}\ {\isacharminus}\ i{\isacharparenright}{\isachardoublequoteclose}{\isacharparenright}%
  53.313 +\begin{isamarkuptxt}%
  53.314 +The \cmd{termination} command sets up the termination goal for the
  53.315 +  specified function \isa{sum}. If the function name is omitted, it
  53.316 +  implicitly refers to the last function definition.
  53.317 +
  53.318 +  The \isa{relation} method takes a relation of
  53.319 +  type \isa{{\isacharparenleft}{\isacharprime}a\ {\isasymtimes}\ {\isacharprime}a{\isacharparenright}\ set}, where \isa{{\isacharprime}a} is the argument type of
  53.320 +  the function. If the function has multiple curried arguments, then
  53.321 +  these are packed together into a tuple, as it happened in the above
  53.322 +  example.
  53.323 +
  53.324 +  The predefined function \isa{{\isachardoublequote}measure\ {\isacharcolon}{\isacharcolon}\ {\isacharparenleft}{\isacharprime}a\ {\isasymRightarrow}\ nat{\isacharparenright}\ {\isasymRightarrow}\ {\isacharparenleft}{\isacharprime}a\ {\isasymtimes}\ {\isacharprime}a{\isacharparenright}\ set{\isachardoublequote}} constructs a
  53.325 +  wellfounded relation from a mapping into the natural numbers (a
  53.326 +  \emph{measure function}). 
  53.327 +
  53.328 +  After the invocation of \isa{relation}, we must prove that (a)
  53.329 +  the relation we supplied is wellfounded, and (b) that the arguments
  53.330 +  of recursive calls indeed decrease with respect to the
  53.331 +  relation:
  53.332 +
  53.333 +  \begin{isabelle}%
  53.334 +\ {\isadigit{1}}{\isachardot}\ wf\ {\isacharparenleft}measure\ {\isacharparenleft}{\isasymlambda}{\isacharparenleft}i{\isacharcomma}\ N{\isacharparenright}{\isachardot}\ N\ {\isacharplus}\ {\isadigit{1}}\ {\isacharminus}\ i{\isacharparenright}{\isacharparenright}\isanewline
  53.335 +\ {\isadigit{2}}{\isachardot}\ {\isasymAnd}i\ N{\isachardot}\ {\isasymnot}\ N\ {\isacharless}\ i\ {\isasymLongrightarrow}\ {\isacharparenleft}{\isacharparenleft}Suc\ i{\isacharcomma}\ N{\isacharparenright}{\isacharcomma}\ i{\isacharcomma}\ N{\isacharparenright}\ {\isasymin}\ measure\ {\isacharparenleft}{\isasymlambda}{\isacharparenleft}i{\isacharcomma}\ N{\isacharparenright}{\isachardot}\ N\ {\isacharplus}\ {\isadigit{1}}\ {\isacharminus}\ i{\isacharparenright}%
  53.336 +\end{isabelle}
  53.337 +
  53.338 +  These goals are all solved by \isa{auto}:%
  53.339 +\end{isamarkuptxt}%
  53.340 +\isamarkuptrue%
  53.341 +\isacommand{apply}\isamarkupfalse%
  53.342 +\ auto\isanewline
  53.343 +\isacommand{done}\isamarkupfalse%
  53.344 +%
  53.345 +\endisatagproof
  53.346 +{\isafoldproof}%
  53.347 +%
  53.348 +\isadelimproof
  53.349 +%
  53.350 +\endisadelimproof
  53.351 +%
  53.352 +\begin{isamarkuptext}%
  53.353 +Let us complicate the function a little, by adding some more
  53.354 +  recursive calls:%
  53.355 +\end{isamarkuptext}%
  53.356 +\isamarkuptrue%
  53.357 +\isacommand{function}\isamarkupfalse%
  53.358 +\ foo\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ nat\ {\isasymRightarrow}\ nat{\isachardoublequoteclose}\isanewline
  53.359 +\isakeyword{where}\isanewline
  53.360 +\ \ {\isachardoublequoteopen}foo\ i\ N\ {\isacharequal}\ {\isacharparenleft}if\ i\ {\isachargreater}\ N\ \isanewline
  53.361 +\ \ \ \ \ \ \ \ \ \ \ \ \ \ then\ {\isacharparenleft}if\ N\ {\isacharequal}\ {\isadigit{0}}\ then\ {\isadigit{0}}\ else\ foo\ {\isadigit{0}}\ {\isacharparenleft}N\ {\isacharminus}\ {\isadigit{1}}{\isacharparenright}{\isacharparenright}\isanewline
  53.362 +\ \ \ \ \ \ \ \ \ \ \ \ \ \ else\ i\ {\isacharplus}\ foo\ {\isacharparenleft}Suc\ i{\isacharparenright}\ N{\isacharparenright}{\isachardoublequoteclose}\isanewline
  53.363 +%
  53.364 +\isadelimproof
  53.365 +%
  53.366 +\endisadelimproof
  53.367 +%
  53.368 +\isatagproof
  53.369 +\isacommand{by}\isamarkupfalse%
  53.370 +\ pat{\isacharunderscore}completeness\ auto%
  53.371 +\endisatagproof
  53.372 +{\isafoldproof}%
  53.373 +%
  53.374 +\isadelimproof
  53.375 +%
  53.376 +\endisadelimproof
  53.377 +%
  53.378 +\begin{isamarkuptext}%
  53.379 +When \isa{i} has reached \isa{N}, it starts at zero again
  53.380 +  and \isa{N} is decremented.
  53.381 +  This corresponds to a nested
  53.382 +  loop where one index counts up and the other down. Termination can
  53.383 +  be proved using a lexicographic combination of two measures, namely
  53.384 +  the value of \isa{N} and the above difference. The \isa{measures} combinator generalizes \isa{measure} by taking a
  53.385 +  list of measure functions.%
  53.386 +\end{isamarkuptext}%
  53.387 +\isamarkuptrue%
  53.388 +\isacommand{termination}\isamarkupfalse%
  53.389 +\ \isanewline
  53.390 +%
  53.391 +\isadelimproof
  53.392 +%
  53.393 +\endisadelimproof
  53.394 +%
  53.395 +\isatagproof
  53.396 +\isacommand{by}\isamarkupfalse%
  53.397 +\ {\isacharparenleft}relation\ {\isachardoublequoteopen}measures\ {\isacharbrackleft}{\isasymlambda}{\isacharparenleft}i{\isacharcomma}\ N{\isacharparenright}{\isachardot}\ N{\isacharcomma}\ {\isasymlambda}{\isacharparenleft}i{\isacharcomma}N{\isacharparenright}{\isachardot}\ N\ {\isacharplus}\ {\isadigit{1}}\ {\isacharminus}\ i{\isacharbrackright}{\isachardoublequoteclose}{\isacharparenright}\ auto%
  53.398 +\endisatagproof
  53.399 +{\isafoldproof}%
  53.400 +%
  53.401 +\isadelimproof
  53.402 +%
  53.403 +\endisadelimproof
  53.404 +%
  53.405 +\isamarkupsubsection{How \isa{lexicographic{\isacharunderscore}order} works%
  53.406 +}
  53.407 +\isamarkuptrue%
  53.408 +%
  53.409 +\begin{isamarkuptext}%
  53.410 +To see how the automatic termination proofs work, let's look at an
  53.411 +  example where it fails\footnote{For a detailed discussion of the
  53.412 +  termination prover, see \cite{bulwahnKN07}}:
  53.413 +
  53.414 +\end{isamarkuptext}  
  53.415 +\cmd{fun} \isa{fails\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequote}nat\ {\isasymRightarrow}\ nat\ list\ {\isasymRightarrow}\ nat{\isachardoublequote}}\\%
  53.416 +\cmd{where}\\%
  53.417 +\hspace*{2ex}\isa{{\isachardoublequote}fails\ a\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharequal}\ a{\isachardoublequote}}\\%
  53.418 +|\hspace*{1.5ex}\isa{{\isachardoublequote}fails\ a\ {\isacharparenleft}x{\isacharhash}xs{\isacharparenright}\ {\isacharequal}\ fails\ {\isacharparenleft}x\ {\isacharplus}\ a{\isacharparenright}\ {\isacharparenleft}x{\isacharhash}xs{\isacharparenright}{\isachardoublequote}}\\
  53.419 +\begin{isamarkuptext}
  53.420 +
  53.421 +\noindent Isabelle responds with the following error:
  53.422 +
  53.423 +\begin{isabelle}
  53.424 +*** Unfinished subgoals:\newline
  53.425 +*** (a, 1, <):\newline
  53.426 +*** \ 1.~\isa{{\isasymAnd}x{\isachardot}\ x\ {\isacharequal}\ {\isadigit{0}}}\newline
  53.427 +*** (a, 1, <=):\newline
  53.428 +*** \ 1.~False\newline
  53.429 +*** (a, 2, <):\newline
  53.430 +*** \ 1.~False\newline
  53.431 +*** Calls:\newline
  53.432 +*** a) \isa{{\isacharparenleft}a{\isacharcomma}\ x\ {\isacharhash}\ xs{\isacharparenright}\ {\isacharminus}{\isacharminus}{\isachargreater}{\isachargreater}\ {\isacharparenleft}x\ {\isacharplus}\ a{\isacharcomma}\ x\ {\isacharhash}\ xs{\isacharparenright}}\newline
  53.433 +*** Measures:\newline
  53.434 +*** 1) \isa{{\isasymlambda}x{\isachardot}\ size\ {\isacharparenleft}fst\ x{\isacharparenright}}\newline
  53.435 +*** 2) \isa{{\isasymlambda}x{\isachardot}\ size\ {\isacharparenleft}snd\ x{\isacharparenright}}\newline
  53.436 +*** Result matrix:\newline
  53.437 +*** \ \ \ \ 1\ \ 2  \newline
  53.438 +*** a:  ?   <= \newline
  53.439 +*** Could not find lexicographic termination order.\newline
  53.440 +*** At command "fun".\newline
  53.441 +\end{isabelle}%
  53.442 +\end{isamarkuptext}%
  53.443 +\isamarkuptrue%
  53.444 +%
  53.445 +\begin{isamarkuptext}%
  53.446 +The key to this error message is the matrix at the bottom. The rows
  53.447 +  of that matrix correspond to the different recursive calls (In our
  53.448 +  case, there is just one). The columns are the function's arguments 
  53.449 +  (expressed through different measure functions, which map the
  53.450 +  argument tuple to a natural number). 
  53.451 +
  53.452 +  The contents of the matrix summarize what is known about argument
  53.453 +  descents: The second argument has a weak descent (\isa{{\isacharless}{\isacharequal}}) at the
  53.454 +  recursive call, and for the first argument nothing could be proved,
  53.455 +  which is expressed by \isa{{\isacharquery}}. In general, there are the values
  53.456 +  \isa{{\isacharless}}, \isa{{\isacharless}{\isacharequal}} and \isa{{\isacharquery}}.
  53.457 +
  53.458 +  For the failed proof attempts, the unfinished subgoals are also
  53.459 +  printed. Looking at these will often point to a missing lemma.
  53.460 +
  53.461 +%  As a more real example, here is quicksort:%
  53.462 +\end{isamarkuptext}%
  53.463 +\isamarkuptrue%
  53.464 +%
  53.465 +\isamarkupsection{Mutual Recursion%
  53.466 +}
  53.467 +\isamarkuptrue%
  53.468 +%
  53.469 +\begin{isamarkuptext}%
  53.470 +If two or more functions call one another mutually, they have to be defined
  53.471 +  in one step. Here are \isa{even} and \isa{odd}:%
  53.472 +\end{isamarkuptext}%
  53.473 +\isamarkuptrue%
  53.474 +\isacommand{function}\isamarkupfalse%
  53.475 +\ even\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ bool{\isachardoublequoteclose}\isanewline
  53.476 +\ \ \ \ \isakeyword{and}\ odd\ \ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ bool{\isachardoublequoteclose}\isanewline
  53.477 +\isakeyword{where}\isanewline
  53.478 +\ \ {\isachardoublequoteopen}even\ {\isadigit{0}}\ {\isacharequal}\ True{\isachardoublequoteclose}\isanewline
  53.479 +{\isacharbar}\ {\isachardoublequoteopen}odd\ {\isadigit{0}}\ {\isacharequal}\ False{\isachardoublequoteclose}\isanewline
  53.480 +{\isacharbar}\ {\isachardoublequoteopen}even\ {\isacharparenleft}Suc\ n{\isacharparenright}\ {\isacharequal}\ odd\ n{\isachardoublequoteclose}\isanewline
  53.481 +{\isacharbar}\ {\isachardoublequoteopen}odd\ {\isacharparenleft}Suc\ n{\isacharparenright}\ {\isacharequal}\ even\ n{\isachardoublequoteclose}\isanewline
  53.482 +%
  53.483 +\isadelimproof
  53.484 +%
  53.485 +\endisadelimproof
  53.486 +%
  53.487 +\isatagproof
  53.488 +\isacommand{by}\isamarkupfalse%
  53.489 +\ pat{\isacharunderscore}completeness\ auto%
  53.490 +\endisatagproof
  53.491 +{\isafoldproof}%
  53.492 +%
  53.493 +\isadelimproof
  53.494 +%
  53.495 +\endisadelimproof
  53.496 +%
  53.497 +\begin{isamarkuptext}%
  53.498 +To eliminate the mutual dependencies, Isabelle internally
  53.499 +  creates a single function operating on the sum
  53.500 +  type \isa{nat\ {\isacharplus}\ nat}. Then, \isa{even} and \isa{odd} are
  53.501 +  defined as projections. Consequently, termination has to be proved
  53.502 +  simultaneously for both functions, by specifying a measure on the
  53.503 +  sum type:%
  53.504 +\end{isamarkuptext}%
  53.505 +\isamarkuptrue%
  53.506 +\isacommand{termination}\isamarkupfalse%
  53.507 +\ \isanewline
  53.508 +%
  53.509 +\isadelimproof
  53.510 +%
  53.511 +\endisadelimproof
  53.512 +%
  53.513 +\isatagproof
  53.514 +\isacommand{by}\isamarkupfalse%
  53.515 +\ {\isacharparenleft}relation\ {\isachardoublequoteopen}measure\ {\isacharparenleft}{\isasymlambda}x{\isachardot}\ case\ x\ of\ Inl\ n\ {\isasymRightarrow}\ n\ {\isacharbar}\ Inr\ n\ {\isasymRightarrow}\ n{\isacharparenright}{\isachardoublequoteclose}{\isacharparenright}\ auto%
  53.516 +\endisatagproof
  53.517 +{\isafoldproof}%
  53.518 +%
  53.519 +\isadelimproof
  53.520 +%
  53.521 +\endisadelimproof
  53.522 +%
  53.523 +\begin{isamarkuptext}%
  53.524 +We could also have used \isa{lexicographic{\isacharunderscore}order}, which
  53.525 +  supports mutual recursive termination proofs to a certain extent.%
  53.526 +\end{isamarkuptext}%
  53.527 +\isamarkuptrue%
  53.528 +%
  53.529 +\isamarkupsubsection{Induction for mutual recursion%
  53.530 +}
  53.531 +\isamarkuptrue%
  53.532 +%
  53.533 +\begin{isamarkuptext}%
  53.534 +When functions are mutually recursive, proving properties about them
  53.535 +  generally requires simultaneous induction. The induction rule \isa{even{\isacharunderscore}odd{\isachardot}induct}
  53.536 +  generated from the above definition reflects this.
  53.537 +
  53.538 +  Let us prove something about \isa{even} and \isa{odd}:%
  53.539 +\end{isamarkuptext}%
  53.540 +\isamarkuptrue%
  53.541 +\isacommand{lemma}\isamarkupfalse%
  53.542 +\ even{\isacharunderscore}odd{\isacharunderscore}mod{\isadigit{2}}{\isacharcolon}\isanewline
  53.543 +\ \ {\isachardoublequoteopen}even\ n\ {\isacharequal}\ {\isacharparenleft}n\ mod\ {\isadigit{2}}\ {\isacharequal}\ {\isadigit{0}}{\isacharparenright}{\isachardoublequoteclose}\isanewline
  53.544 +\ \ {\isachardoublequoteopen}odd\ n\ {\isacharequal}\ {\isacharparenleft}n\ mod\ {\isadigit{2}}\ {\isacharequal}\ {\isadigit{1}}{\isacharparenright}{\isachardoublequoteclose}%
  53.545 +\isadelimproof
  53.546 +%
  53.547 +\endisadelimproof
  53.548 +%
  53.549 +\isatagproof
  53.550 +%
  53.551 +\begin{isamarkuptxt}%
  53.552 +We apply simultaneous induction, specifying the induction variable
  53.553 +  for both goals, separated by \cmd{and}:%
  53.554 +\end{isamarkuptxt}%
  53.555 +\isamarkuptrue%
  53.556 +\isacommand{apply}\isamarkupfalse%
  53.557 +\ {\isacharparenleft}induct\ n\ \isakeyword{and}\ n\ rule{\isacharcolon}\ even{\isacharunderscore}odd{\isachardot}induct{\isacharparenright}%
  53.558 +\begin{isamarkuptxt}%
  53.559 +We get four subgoals, which correspond to the clauses in the
  53.560 +  definition of \isa{even} and \isa{odd}:
  53.561 +  \begin{isabelle}%
  53.562 +\ {\isadigit{1}}{\isachardot}\ even\ {\isadigit{0}}\ {\isacharequal}\ {\isacharparenleft}{\isadigit{0}}\ mod\ {\isadigit{2}}\ {\isacharequal}\ {\isadigit{0}}{\isacharparenright}\isanewline
  53.563 +\ {\isadigit{2}}{\isachardot}\ odd\ {\isadigit{0}}\ {\isacharequal}\ {\isacharparenleft}{\isadigit{0}}\ mod\ {\isadigit{2}}\ {\isacharequal}\ {\isadigit{1}}{\isacharparenright}\isanewline
  53.564 +\ {\isadigit{3}}{\isachardot}\ {\isasymAnd}n{\isachardot}\ odd\ n\ {\isacharequal}\ {\isacharparenleft}n\ mod\ {\isadigit{2}}\ {\isacharequal}\ {\isadigit{1}}{\isacharparenright}\ {\isasymLongrightarrow}\ even\ {\isacharparenleft}Suc\ n{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}Suc\ n\ mod\ {\isadigit{2}}\ {\isacharequal}\ {\isadigit{0}}{\isacharparenright}\isanewline
  53.565 +\ {\isadigit{4}}{\isachardot}\ {\isasymAnd}n{\isachardot}\ even\ n\ {\isacharequal}\ {\isacharparenleft}n\ mod\ {\isadigit{2}}\ {\isacharequal}\ {\isadigit{0}}{\isacharparenright}\ {\isasymLongrightarrow}\ odd\ {\isacharparenleft}Suc\ n{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}Suc\ n\ mod\ {\isadigit{2}}\ {\isacharequal}\ {\isadigit{1}}{\isacharparenright}%
  53.566 +\end{isabelle}
  53.567 +  Simplification solves the first two goals, leaving us with two
  53.568 +  statements about the \isa{mod} operation to prove:%
  53.569 +\end{isamarkuptxt}%
  53.570 +\isamarkuptrue%
  53.571 +\isacommand{apply}\isamarkupfalse%
  53.572 +\ simp{\isacharunderscore}all%
  53.573 +\begin{isamarkuptxt}%
  53.574 +\begin{isabelle}%
  53.575 +\ {\isadigit{1}}{\isachardot}\ {\isasymAnd}n{\isachardot}\ odd\ n\ {\isacharequal}\ {\isacharparenleft}n\ mod\ {\isadigit{2}}\ {\isacharequal}\ Suc\ {\isadigit{0}}{\isacharparenright}\ {\isasymLongrightarrow}\ {\isacharparenleft}n\ mod\ {\isadigit{2}}\ {\isacharequal}\ Suc\ {\isadigit{0}}{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}Suc\ n\ mod\ {\isadigit{2}}\ {\isacharequal}\ {\isadigit{0}}{\isacharparenright}\isanewline
  53.576 +\ {\isadigit{2}}{\isachardot}\ {\isasymAnd}n{\isachardot}\ even\ n\ {\isacharequal}\ {\isacharparenleft}n\ mod\ {\isadigit{2}}\ {\isacharequal}\ {\isadigit{0}}{\isacharparenright}\ {\isasymLongrightarrow}\ {\isacharparenleft}n\ mod\ {\isadigit{2}}\ {\isacharequal}\ {\isadigit{0}}{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}Suc\ n\ mod\ {\isadigit{2}}\ {\isacharequal}\ Suc\ {\isadigit{0}}{\isacharparenright}%
  53.577 +\end{isabelle} 
  53.578 +
  53.579 +  \noindent These can be handled by Isabelle's arithmetic decision procedures.%
  53.580 +\end{isamarkuptxt}%
  53.581 +\isamarkuptrue%
  53.582 +\isacommand{apply}\isamarkupfalse%
  53.583 +\ arith\isanewline
  53.584 +\isacommand{apply}\isamarkupfalse%
  53.585 +\ arith\isanewline
  53.586 +\isacommand{done}\isamarkupfalse%
  53.587 +%
  53.588 +\endisatagproof
  53.589 +{\isafoldproof}%
  53.590 +%
  53.591 +\isadelimproof
  53.592 +%
  53.593 +\endisadelimproof
  53.594 +%
  53.595 +\begin{isamarkuptext}%
  53.596 +In proofs like this, the simultaneous induction is really essential:
  53.597 +  Even if we are just interested in one of the results, the other
  53.598 +  one is necessary to strengthen the induction hypothesis. If we leave
  53.599 +  out the statement about \isa{odd} and just write \isa{True} instead,
  53.600 +  the same proof fails:%
  53.601 +\end{isamarkuptext}%
  53.602 +\isamarkuptrue%
  53.603 +\isacommand{lemma}\isamarkupfalse%
  53.604 +\ failed{\isacharunderscore}attempt{\isacharcolon}\isanewline
  53.605 +\ \ {\isachardoublequoteopen}even\ n\ {\isacharequal}\ {\isacharparenleft}n\ mod\ {\isadigit{2}}\ {\isacharequal}\ {\isadigit{0}}{\isacharparenright}{\isachardoublequoteclose}\isanewline
  53.606 +\ \ {\isachardoublequoteopen}True{\isachardoublequoteclose}\isanewline
  53.607 +%
  53.608 +\isadelimproof
  53.609 +%
  53.610 +\endisadelimproof
  53.611 +%
  53.612 +\isatagproof
  53.613 +\isacommand{apply}\isamarkupfalse%
  53.614 +\ {\isacharparenleft}induct\ n\ rule{\isacharcolon}\ even{\isacharunderscore}odd{\isachardot}induct{\isacharparenright}%
  53.615 +\begin{isamarkuptxt}%
  53.616 +\noindent Now the third subgoal is a dead end, since we have no
  53.617 +  useful induction hypothesis available:
  53.618 +
  53.619 +  \begin{isabelle}%
  53.620 +\ {\isadigit{1}}{\isachardot}\ even\ {\isadigit{0}}\ {\isacharequal}\ {\isacharparenleft}{\isadigit{0}}\ mod\ {\isadigit{2}}\ {\isacharequal}\ {\isadigit{0}}{\isacharparenright}\isanewline
  53.621 +\ {\isadigit{2}}{\isachardot}\ True\isanewline
  53.622 +\ {\isadigit{3}}{\isachardot}\ {\isasymAnd}n{\isachardot}\ True\ {\isasymLongrightarrow}\ even\ {\isacharparenleft}Suc\ n{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}Suc\ n\ mod\ {\isadigit{2}}\ {\isacharequal}\ {\isadigit{0}}{\isacharparenright}\isanewline
  53.623 +\ {\isadigit{4}}{\isachardot}\ {\isasymAnd}n{\isachardot}\ even\ n\ {\isacharequal}\ {\isacharparenleft}n\ mod\ {\isadigit{2}}\ {\isacharequal}\ {\isadigit{0}}{\isacharparenright}\ {\isasymLongrightarrow}\ True%
  53.624 +\end{isabelle}%
  53.625 +\end{isamarkuptxt}%
  53.626 +\isamarkuptrue%
  53.627 +\isacommand{oops}\isamarkupfalse%
  53.628 +%
  53.629 +\endisatagproof
  53.630 +{\isafoldproof}%
  53.631 +%
  53.632 +\isadelimproof
  53.633 +%
  53.634 +\endisadelimproof
  53.635 +%
  53.636 +\isamarkupsection{General pattern matching%
  53.637 +}
  53.638 +\isamarkuptrue%
  53.639 +%
  53.640 +\begin{isamarkuptext}%
  53.641 +\label{genpats}%
  53.642 +\end{isamarkuptext}%
  53.643 +\isamarkuptrue%
  53.644 +%
  53.645 +\isamarkupsubsection{Avoiding automatic pattern splitting%
  53.646 +}
  53.647 +\isamarkuptrue%
  53.648 +%
  53.649 +\begin{isamarkuptext}%
  53.650 +Up to now, we used pattern matching only on datatypes, and the
  53.651 +  patterns were always disjoint and complete, and if they weren't,
  53.652 +  they were made disjoint automatically like in the definition of
  53.653 +  \isa{sep} in \S\ref{patmatch}.
  53.654 +
  53.655 +  This automatic splitting can significantly increase the number of
  53.656 +  equations involved, and this is not always desirable. The following
  53.657 +  example shows the problem:
  53.658 +  
  53.659 +  Suppose we are modeling incomplete knowledge about the world by a
  53.660 +  three-valued datatype, which has values \isa{T}, \isa{F}
  53.661 +  and \isa{X} for true, false and uncertain propositions, respectively.%
  53.662 +\end{isamarkuptext}%
  53.663 +\isamarkuptrue%
  53.664 +\isacommand{datatype}\isamarkupfalse%
  53.665 +\ P{\isadigit{3}}\ {\isacharequal}\ T\ {\isacharbar}\ F\ {\isacharbar}\ X%
  53.666 +\begin{isamarkuptext}%
  53.667 +\noindent Then the conjunction of such values can be defined as follows:%
  53.668 +\end{isamarkuptext}%
  53.669 +\isamarkuptrue%
  53.670 +\isacommand{fun}\isamarkupfalse%
  53.671 +\ And\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}P{\isadigit{3}}\ {\isasymRightarrow}\ P{\isadigit{3}}\ {\isasymRightarrow}\ P{\isadigit{3}}{\isachardoublequoteclose}\isanewline
  53.672 +\isakeyword{where}\isanewline
  53.673 +\ \ {\isachardoublequoteopen}And\ T\ p\ {\isacharequal}\ p{\isachardoublequoteclose}\isanewline
  53.674 +{\isacharbar}\ {\isachardoublequoteopen}And\ p\ T\ {\isacharequal}\ p{\isachardoublequoteclose}\isanewline
  53.675 +{\isacharbar}\ {\isachardoublequoteopen}And\ p\ F\ {\isacharequal}\ F{\isachardoublequoteclose}\isanewline
  53.676 +{\isacharbar}\ {\isachardoublequoteopen}And\ F\ p\ {\isacharequal}\ F{\isachardoublequoteclose}\isanewline
  53.677 +{\isacharbar}\ {\isachardoublequoteopen}And\ X\ X\ {\isacharequal}\ X{\isachardoublequoteclose}%
  53.678 +\begin{isamarkuptext}%
  53.679 +This definition is useful, because the equations can directly be used
  53.680 +  as simplification rules. But the patterns overlap: For example,
  53.681 +  the expression \isa{And\ T\ T} is matched by both the first and
  53.682 +  the second equation. By default, Isabelle makes the patterns disjoint by
  53.683 +  splitting them up, producing instances:%
  53.684 +\end{isamarkuptext}%
  53.685 +\isamarkuptrue%
  53.686 +\isacommand{thm}\isamarkupfalse%
  53.687 +\ And{\isachardot}simps%
  53.688 +\begin{isamarkuptext}%
  53.689 +\isa{And\ T\ {\isacharquery}p\ {\isacharequal}\ {\isacharquery}p\isasep\isanewline%
  53.690 +And\ F\ T\ {\isacharequal}\ F\isasep\isanewline%
  53.691 +And\ X\ T\ {\isacharequal}\ X\isasep\isanewline%
  53.692 +And\ F\ F\ {\isacharequal}\ F\isasep\isanewline%
  53.693 +And\ X\ F\ {\isacharequal}\ F\isasep\isanewline%
  53.694 +And\ F\ X\ {\isacharequal}\ F\isasep\isanewline%
  53.695 +And\ X\ X\ {\isacharequal}\ X}
  53.696 +  
  53.697 +  \vspace*{1em}
  53.698 +  \noindent There are several problems with this:
  53.699 +
  53.700 +  \begin{enumerate}
  53.701 +  \item If the datatype has many constructors, there can be an
  53.702 +  explosion of equations. For \isa{And}, we get seven instead of
  53.703 +  five equations, which can be tolerated, but this is just a small
  53.704 +  example.
  53.705 +
  53.706 +  \item Since splitting makes the equations \qt{less general}, they
  53.707 +  do not always match in rewriting. While the term \isa{And\ x\ F}
  53.708 +  can be simplified to \isa{F} with the original equations, a
  53.709 +  (manual) case split on \isa{x} is now necessary.
  53.710 +
  53.711 +  \item The splitting also concerns the induction rule \isa{And{\isachardot}induct}. Instead of five premises it now has seven, which
  53.712 +  means that our induction proofs will have more cases.
  53.713 +
  53.714 +  \item In general, it increases clarity if we get the same definition
  53.715 +  back which we put in.
  53.716 +  \end{enumerate}
  53.717 +
  53.718 +  If we do not want the automatic splitting, we can switch it off by
  53.719 +  leaving out the \cmd{sequential} option. However, we will have to
  53.720 +  prove that our pattern matching is consistent\footnote{This prevents
  53.721 +  us from defining something like \isa{f\ x\ {\isacharequal}\ True} and \isa{f\ x\ {\isacharequal}\ False} simultaneously.}:%
  53.722 +\end{isamarkuptext}%
  53.723 +\isamarkuptrue%
  53.724 +\isacommand{function}\isamarkupfalse%
  53.725 +\ And{\isadigit{2}}\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}P{\isadigit{3}}\ {\isasymRightarrow}\ P{\isadigit{3}}\ {\isasymRightarrow}\ P{\isadigit{3}}{\isachardoublequoteclose}\isanewline
  53.726 +\isakeyword{where}\isanewline
  53.727 +\ \ {\isachardoublequoteopen}And{\isadigit{2}}\ T\ p\ {\isacharequal}\ p{\isachardoublequoteclose}\isanewline
  53.728 +{\isacharbar}\ {\isachardoublequoteopen}And{\isadigit{2}}\ p\ T\ {\isacharequal}\ p{\isachardoublequoteclose}\isanewline
  53.729 +{\isacharbar}\ {\isachardoublequoteopen}And{\isadigit{2}}\ p\ F\ {\isacharequal}\ F{\isachardoublequoteclose}\isanewline
  53.730 +{\isacharbar}\ {\isachardoublequoteopen}And{\isadigit{2}}\ F\ p\ {\isacharequal}\ F{\isachardoublequoteclose}\isanewline
  53.731 +{\isacharbar}\ {\isachardoublequoteopen}And{\isadigit{2}}\ X\ X\ {\isacharequal}\ X{\isachardoublequoteclose}%
  53.732 +\isadelimproof
  53.733 +%
  53.734 +\endisadelimproof
  53.735 +%
  53.736 +\isatagproof
  53.737 +%
  53.738 +\begin{isamarkuptxt}%
  53.739 +\noindent Now let's look at the proof obligations generated by a
  53.740 +  function definition. In this case, they are:
  53.741 +
  53.742 +  \begin{isabelle}%
  53.743 +\ {\isadigit{1}}{\isachardot}\ {\isasymAnd}P\ x{\isachardot}\ {\isasymlbrakk}{\isasymAnd}p{\isachardot}\ x\ {\isacharequal}\ {\isacharparenleft}T{\isacharcomma}\ p{\isacharparenright}\ {\isasymLongrightarrow}\ P{\isacharsemicolon}\ {\isasymAnd}p{\isachardot}\ x\ {\isacharequal}\ {\isacharparenleft}p{\isacharcomma}\ T{\isacharparenright}\ {\isasymLongrightarrow}\ P{\isacharsemicolon}\ {\isasymAnd}p{\isachardot}\ x\ {\isacharequal}\ {\isacharparenleft}p{\isacharcomma}\ F{\isacharparenright}\ {\isasymLongrightarrow}\ P{\isacharsemicolon}\isanewline
  53.744 +\isaindent{\ {\isadigit{1}}{\isachardot}\ {\isasymAnd}P\ x{\isachardot}\ \ }{\isasymAnd}p{\isachardot}\ x\ {\isacharequal}\ {\isacharparenleft}F{\isacharcomma}\ p{\isacharparenright}\ {\isasymLongrightarrow}\ P{\isacharsemicolon}\ x\ {\isacharequal}\ {\isacharparenleft}X{\isacharcomma}\ X{\isacharparenright}\ {\isasymLongrightarrow}\ P{\isasymrbrakk}\isanewline
  53.745 +\isaindent{\ {\isadigit{1}}{\isachardot}\ {\isasymAnd}P\ x{\isachardot}\ }{\isasymLongrightarrow}\ P\isanewline
  53.746 +\ {\isadigit{2}}{\isachardot}\ {\isasymAnd}p\ pa{\isachardot}\ {\isacharparenleft}T{\isacharcomma}\ p{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}T{\isacharcomma}\ pa{\isacharparenright}\ {\isasymLongrightarrow}\ p\ {\isacharequal}\ pa\isanewline
  53.747 +\ {\isadigit{3}}{\isachardot}\ {\isasymAnd}p\ pa{\isachardot}\ {\isacharparenleft}T{\isacharcomma}\ p{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}pa{\isacharcomma}\ T{\isacharparenright}\ {\isasymLongrightarrow}\ p\ {\isacharequal}\ pa\isanewline
  53.748 +\ {\isadigit{4}}{\isachardot}\ {\isasymAnd}p\ pa{\isachardot}\ {\isacharparenleft}T{\isacharcomma}\ p{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}pa{\isacharcomma}\ F{\isacharparenright}\ {\isasymLongrightarrow}\ p\ {\isacharequal}\ F\isanewline
  53.749 +\ {\isadigit{5}}{\isachardot}\ {\isasymAnd}p\ pa{\isachardot}\ {\isacharparenleft}T{\isacharcomma}\ p{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}F{\isacharcomma}\ pa{\isacharparenright}\ {\isasymLongrightarrow}\ p\ {\isacharequal}\ F\isanewline
  53.750 +\ {\isadigit{6}}{\isachardot}\ {\isasymAnd}p{\isachardot}\ {\isacharparenleft}T{\isacharcomma}\ p{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}X{\isacharcomma}\ X{\isacharparenright}\ {\isasymLongrightarrow}\ p\ {\isacharequal}\ X\isanewline
  53.751 +\ {\isadigit{7}}{\isachardot}\ {\isasymAnd}p\ pa{\isachardot}\ {\isacharparenleft}p{\isacharcomma}\ T{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}pa{\isacharcomma}\ T{\isacharparenright}\ {\isasymLongrightarrow}\ p\ {\isacharequal}\ pa\isanewline
  53.752 +\ {\isadigit{8}}{\isachardot}\ {\isasymAnd}p\ pa{\isachardot}\ {\isacharparenleft}p{\isacharcomma}\ T{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}pa{\isacharcomma}\ F{\isacharparenright}\ {\isasymLongrightarrow}\ p\ {\isacharequal}\ F\isanewline
  53.753 +\ {\isadigit{9}}{\isachardot}\ {\isasymAnd}p\ pa{\isachardot}\ {\isacharparenleft}p{\isacharcomma}\ T{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}F{\isacharcomma}\ pa{\isacharparenright}\ {\isasymLongrightarrow}\ p\ {\isacharequal}\ F\isanewline
  53.754 +\ {\isadigit{1}}{\isadigit{0}}{\isachardot}\ {\isasymAnd}p{\isachardot}\ {\isacharparenleft}p{\isacharcomma}\ T{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}X{\isacharcomma}\ X{\isacharparenright}\ {\isasymLongrightarrow}\ p\ {\isacharequal}\ X%
  53.755 +\end{isabelle}\vspace{-1.2em}\hspace{3cm}\vdots\vspace{1.2em}
  53.756 +
  53.757 +  The first subgoal expresses the completeness of the patterns. It has
  53.758 +  the form of an elimination rule and states that every \isa{x} of
  53.759 +  the function's input type must match at least one of the patterns\footnote{Completeness could
  53.760 +  be equivalently stated as a disjunction of existential statements: 
  53.761 +\isa{{\isacharparenleft}{\isasymexists}p{\isachardot}\ x\ {\isacharequal}\ {\isacharparenleft}T{\isacharcomma}\ p{\isacharparenright}{\isacharparenright}\ {\isasymor}\ {\isacharparenleft}{\isasymexists}p{\isachardot}\ x\ {\isacharequal}\ {\isacharparenleft}p{\isacharcomma}\ T{\isacharparenright}{\isacharparenright}\ {\isasymor}\ {\isacharparenleft}{\isasymexists}p{\isachardot}\ x\ {\isacharequal}\ {\isacharparenleft}p{\isacharcomma}\ F{\isacharparenright}{\isacharparenright}\ {\isasymor}\ {\isacharparenleft}{\isasymexists}p{\isachardot}\ x\ {\isacharequal}\ {\isacharparenleft}F{\isacharcomma}\ p{\isacharparenright}{\isacharparenright}\ {\isasymor}\ x\ {\isacharequal}\ {\isacharparenleft}X{\isacharcomma}\ X{\isacharparenright}}, and you can use the method \isa{atomize{\isacharunderscore}elim} to get that form instead.}. If the patterns just involve
  53.762 +  datatypes, we can solve it with the \isa{pat{\isacharunderscore}completeness}
  53.763 +  method:%
  53.764 +\end{isamarkuptxt}%
  53.765 +\isamarkuptrue%
  53.766 +\isacommand{apply}\isamarkupfalse%
  53.767 +\ pat{\isacharunderscore}completeness%
  53.768 +\begin{isamarkuptxt}%
  53.769 +The remaining subgoals express \emph{pattern compatibility}. We do
  53.770 +  allow that an input value matches multiple patterns, but in this
  53.771 +  case, the result (i.e.~the right hand sides of the equations) must
  53.772 +  also be equal. For each pair of two patterns, there is one such
  53.773 +  subgoal. Usually this needs injectivity of the constructors, which
  53.774 +  is used automatically by \isa{auto}.%
  53.775 +\end{isamarkuptxt}%
  53.776 +\isamarkuptrue%
  53.777 +\isacommand{by}\isamarkupfalse%
  53.778 +\ auto%
  53.779 +\endisatagproof
  53.780 +{\isafoldproof}%
  53.781 +%
  53.782 +\isadelimproof
  53.783 +%
  53.784 +\endisadelimproof
  53.785 +%
  53.786 +\isamarkupsubsection{Non-constructor patterns%
  53.787 +}
  53.788 +\isamarkuptrue%
  53.789 +%
  53.790 +\begin{isamarkuptext}%
  53.791 +Most of Isabelle's basic types take the form of inductive datatypes,
  53.792 +  and usually pattern matching works on the constructors of such types. 
  53.793 +  However, this need not be always the case, and the \cmd{function}
  53.794 +  command handles other kind of patterns, too.
  53.795 +
  53.796 +  One well-known instance of non-constructor patterns are
  53.797 +  so-called \emph{$n+k$-patterns}, which are a little controversial in
  53.798 +  the functional programming world. Here is the initial fibonacci
  53.799 +  example with $n+k$-patterns:%
  53.800 +\end{isamarkuptext}%
  53.801 +\isamarkuptrue%
  53.802 +\isacommand{function}\isamarkupfalse%
  53.803 +\ fib{\isadigit{2}}\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ nat{\isachardoublequoteclose}\isanewline
  53.804 +\isakeyword{where}\isanewline
  53.805 +\ \ {\isachardoublequoteopen}fib{\isadigit{2}}\ {\isadigit{0}}\ {\isacharequal}\ {\isadigit{1}}{\isachardoublequoteclose}\isanewline
  53.806 +{\isacharbar}\ {\isachardoublequoteopen}fib{\isadigit{2}}\ {\isadigit{1}}\ {\isacharequal}\ {\isadigit{1}}{\isachardoublequoteclose}\isanewline
  53.807 +{\isacharbar}\ {\isachardoublequoteopen}fib{\isadigit{2}}\ {\isacharparenleft}n\ {\isacharplus}\ {\isadigit{2}}{\isacharparenright}\ {\isacharequal}\ fib{\isadigit{2}}\ n\ {\isacharplus}\ fib{\isadigit{2}}\ {\isacharparenleft}Suc\ n{\isacharparenright}{\isachardoublequoteclose}\isanewline
  53.808 +%
  53.809 +\isadelimML
  53.810 +%
  53.811 +\endisadelimML
  53.812 +%
  53.813 +\isatagML
  53.814 +%
  53.815 +\endisatagML
  53.816 +{\isafoldML}%
  53.817 +%
  53.818 +\isadelimML
  53.819 +%
  53.820 +\endisadelimML
  53.821 +%
  53.822 +\isadelimproof
  53.823 +%
  53.824 +\endisadelimproof
  53.825 +%
  53.826 +\isatagproof
  53.827 +%
  53.828 +\begin{isamarkuptxt}%
  53.829 +This kind of matching is again justified by the proof of pattern
  53.830 +  completeness and compatibility. 
  53.831 +  The proof obligation for pattern completeness states that every natural number is
  53.832 +  either \isa{{\isadigit{0}}}, \isa{{\isadigit{1}}} or \isa{n\ {\isacharplus}\ {\isadigit{2}}}:
  53.833 +
  53.834 +  \begin{isabelle}%
  53.835 +\ {\isadigit{1}}{\isachardot}\ {\isasymAnd}P\ x{\isachardot}\ {\isasymlbrakk}x\ {\isacharequal}\ {\isadigit{0}}\ {\isasymLongrightarrow}\ P{\isacharsemicolon}\ x\ {\isacharequal}\ {\isadigit{1}}\ {\isasymLongrightarrow}\ P{\isacharsemicolon}\ {\isasymAnd}n{\isachardot}\ x\ {\isacharequal}\ n\ {\isacharplus}\ {\isadigit{2}}\ {\isasymLongrightarrow}\ P{\isasymrbrakk}\ {\isasymLongrightarrow}\ P\isanewline
  53.836 +\ {\isadigit{2}}{\isachardot}\ {\isadigit{0}}\ {\isacharequal}\ {\isadigit{0}}\ {\isasymLongrightarrow}\ {\isadigit{1}}\ {\isacharequal}\ {\isadigit{1}}\isanewline
  53.837 +\ {\isadigit{3}}{\isachardot}\ {\isadigit{0}}\ {\isacharequal}\ {\isadigit{1}}\ {\isasymLongrightarrow}\ {\isadigit{1}}\ {\isacharequal}\ {\isadigit{1}}\isanewline
  53.838 +\ {\isadigit{4}}{\isachardot}\ {\isasymAnd}n{\isachardot}\ {\isadigit{0}}\ {\isacharequal}\ n\ {\isacharplus}\ {\isadigit{2}}\ {\isasymLongrightarrow}\ {\isadigit{1}}\ {\isacharequal}\ fib{\isadigit{2}}{\isacharunderscore}sumC\ n\ {\isacharplus}\ fib{\isadigit{2}}{\isacharunderscore}sumC\ {\isacharparenleft}Suc\ n{\isacharparenright}\isanewline
  53.839 +\ {\isadigit{5}}{\isachardot}\ {\isadigit{1}}\ {\isacharequal}\ {\isadigit{1}}\ {\isasymLongrightarrow}\ {\isadigit{1}}\ {\isacharequal}\ {\isadigit{1}}\isanewline
  53.840 +\ {\isadigit{6}}{\isachardot}\ {\isasymAnd}n{\isachardot}\ {\isadigit{1}}\ {\isacharequal}\ n\ {\isacharplus}\ {\isadigit{2}}\ {\isasymLongrightarrow}\ {\isadigit{1}}\ {\isacharequal}\ fib{\isadigit{2}}{\isacharunderscore}sumC\ n\ {\isacharplus}\ fib{\isadigit{2}}{\isacharunderscore}sumC\ {\isacharparenleft}Suc\ n{\isacharparenright}\isanewline
  53.841 +\ {\isadigit{7}}{\isachardot}\ {\isasymAnd}n\ na{\isachardot}\isanewline
  53.842 +\isaindent{\ {\isadigit{7}}{\isachardot}\ \ \ \ }n\ {\isacharplus}\ {\isadigit{2}}\ {\isacharequal}\ na\ {\isacharplus}\ {\isadigit{2}}\ {\isasymLongrightarrow}\isanewline
  53.843 +\isaindent{\ {\isadigit{7}}{\isachardot}\ \ \ \ }fib{\isadigit{2}}{\isacharunderscore}sumC\ n\ {\isacharplus}\ fib{\isadigit{2}}{\isacharunderscore}sumC\ {\isacharparenleft}Suc\ n{\isacharparenright}\ {\isacharequal}\ fib{\isadigit{2}}{\isacharunderscore}sumC\ na\ {\isacharplus}\ fib{\isadigit{2}}{\isacharunderscore}sumC\ {\isacharparenleft}Suc\ na{\isacharparenright}%
  53.844 +\end{isabelle}
  53.845 +
  53.846 +  This is an arithmetic triviality, but unfortunately the
  53.847 +  \isa{arith} method cannot handle this specific form of an
  53.848 +  elimination rule. However, we can use the method \isa{atomize{\isacharunderscore}elim} to do an ad-hoc conversion to a disjunction of
  53.849 +  existentials, which can then be solved by the arithmetic decision procedure.
  53.850 +  Pattern compatibility and termination are automatic as usual.%
  53.851 +\end{isamarkuptxt}%
  53.852 +\isamarkuptrue%
  53.853 +%
  53.854 +\endisatagproof
  53.855 +{\isafoldproof}%
  53.856 +%
  53.857 +\isadelimproof
  53.858 +%
  53.859 +\endisadelimproof
  53.860 +%
  53.861 +\isadelimML
  53.862 +%
  53.863 +\endisadelimML
  53.864 +%
  53.865 +\isatagML
  53.866 +%
  53.867 +\endisatagML
  53.868 +{\isafoldML}%
  53.869 +%
  53.870 +\isadelimML
  53.871 +%
  53.872 +\endisadelimML
  53.873 +%
  53.874 +\isadelimproof
  53.875 +%
  53.876 +\endisadelimproof
  53.877 +%
  53.878 +\isatagproof
  53.879 +\isacommand{apply}\isamarkupfalse%
  53.880 +\ atomize{\isacharunderscore}elim\isanewline
  53.881 +\isacommand{apply}\isamarkupfalse%
  53.882 +\ arith\isanewline
  53.883 +\isacommand{apply}\isamarkupfalse%
  53.884 +\ auto\isanewline
  53.885 +\isacommand{done}\isamarkupfalse%
  53.886 +%
  53.887 +\endisatagproof
  53.888 +{\isafoldproof}%
  53.889 +%
  53.890 +\isadelimproof
  53.891 +%
  53.892 +\endisadelimproof
  53.893 +\isanewline
  53.894 +\isacommand{termination}\isamarkupfalse%
  53.895 +%
  53.896 +\isadelimproof
  53.897 +\ %
  53.898 +\endisadelimproof
  53.899 +%
  53.900 +\isatagproof
  53.901 +\isacommand{by}\isamarkupfalse%
  53.902 +\ lexicographic{\isacharunderscore}order%
  53.903 +\endisatagproof
  53.904 +{\isafoldproof}%
  53.905 +%
  53.906 +\isadelimproof
  53.907 +%
  53.908 +\endisadelimproof
  53.909 +%
  53.910 +\begin{isamarkuptext}%
  53.911 +We can stretch the notion of pattern matching even more. The
  53.912 +  following function is not a sensible functional program, but a
  53.913 +  perfectly valid mathematical definition:%
  53.914 +\end{isamarkuptext}%
  53.915 +\isamarkuptrue%
  53.916 +\isacommand{function}\isamarkupfalse%
  53.917 +\ ev\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ bool{\isachardoublequoteclose}\isanewline
  53.918 +\isakeyword{where}\isanewline
  53.919 +\ \ {\isachardoublequoteopen}ev\ {\isacharparenleft}{\isadigit{2}}\ {\isacharasterisk}\ n{\isacharparenright}\ {\isacharequal}\ True{\isachardoublequoteclose}\isanewline
  53.920 +{\isacharbar}\ {\isachardoublequoteopen}ev\ {\isacharparenleft}{\isadigit{2}}\ {\isacharasterisk}\ n\ {\isacharplus}\ {\isadigit{1}}{\isacharparenright}\ {\isacharequal}\ False{\isachardoublequoteclose}\isanewline
  53.921 +%
  53.922 +\isadelimproof
  53.923 +%
  53.924 +\endisadelimproof
  53.925 +%
  53.926 +\isatagproof
  53.927 +\isacommand{apply}\isamarkupfalse%
  53.928 +\ atomize{\isacharunderscore}elim\isanewline
  53.929 +\isacommand{by}\isamarkupfalse%
  53.930 +\ arith{\isacharplus}%
  53.931 +\endisatagproof
  53.932 +{\isafoldproof}%
  53.933 +%
  53.934 +\isadelimproof
  53.935 +\isanewline
  53.936 +%
  53.937 +\endisadelimproof
  53.938 +\isacommand{termination}\isamarkupfalse%
  53.939 +%
  53.940 +\isadelimproof
  53.941 +\ %
  53.942 +\endisadelimproof
  53.943 +%
  53.944 +\isatagproof
  53.945 +\isacommand{by}\isamarkupfalse%
  53.946 +\ {\isacharparenleft}relation\ {\isachardoublequoteopen}{\isacharbraceleft}{\isacharbraceright}{\isachardoublequoteclose}{\isacharparenright}\ simp%
  53.947 +\endisatagproof
  53.948 +{\isafoldproof}%
  53.949 +%
  53.950 +\isadelimproof
  53.951 +%
  53.952 +\endisadelimproof
  53.953 +%
  53.954 +\begin{isamarkuptext}%
  53.955 +This general notion of pattern matching gives you a certain freedom
  53.956 +  in writing down specifications. However, as always, such freedom should
  53.957 +  be used with care:
  53.958 +
  53.959 +  If we leave the area of constructor
  53.960 +  patterns, we have effectively departed from the world of functional
  53.961 +  programming. This means that it is no longer possible to use the
  53.962 +  code generator, and expect it to generate ML code for our
  53.963 +  definitions. Also, such a specification might not work very well together with
  53.964 +  simplification. Your mileage may vary.%
  53.965 +\end{isamarkuptext}%
  53.966 +\isamarkuptrue%
  53.967 +%
  53.968 +\isamarkupsubsection{Conditional equations%
  53.969 +}
  53.970 +\isamarkuptrue%
  53.971 +%
  53.972 +\begin{isamarkuptext}%
  53.973 +The function package also supports conditional equations, which are
  53.974 +  similar to guards in a language like Haskell. Here is Euclid's
  53.975 +  algorithm written with conditional patterns\footnote{Note that the
  53.976 +  patterns are also overlapping in the base case}:%
  53.977 +\end{isamarkuptext}%
  53.978 +\isamarkuptrue%
  53.979 +\isacommand{function}\isamarkupfalse%
  53.980 +\ gcd\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ nat\ {\isasymRightarrow}\ nat{\isachardoublequoteclose}\isanewline
  53.981 +\isakeyword{where}\isanewline
  53.982 +\ \ {\isachardoublequoteopen}gcd\ x\ {\isadigit{0}}\ {\isacharequal}\ x{\isachardoublequoteclose}\isanewline
  53.983 +{\isacharbar}\ {\isachardoublequoteopen}gcd\ {\isadigit{0}}\ y\ {\isacharequal}\ y{\isachardoublequoteclose}\isanewline
  53.984 +{\isacharbar}\ {\isachardoublequoteopen}x\ {\isacharless}\ y\ {\isasymLongrightarrow}\ gcd\ {\isacharparenleft}Suc\ x{\isacharparenright}\ {\isacharparenleft}Suc\ y{\isacharparenright}\ {\isacharequal}\ gcd\ {\isacharparenleft}Suc\ x{\isacharparenright}\ {\isacharparenleft}y\ {\isacharminus}\ x{\isacharparenright}{\isachardoublequoteclose}\isanewline
  53.985 +{\isacharbar}\ {\isachardoublequoteopen}{\isasymnot}\ x\ {\isacharless}\ y\ {\isasymLongrightarrow}\ gcd\ {\isacharparenleft}Suc\ x{\isacharparenright}\ {\isacharparenleft}Suc\ y{\isacharparenright}\ {\isacharequal}\ gcd\ {\isacharparenleft}x\ {\isacharminus}\ y{\isacharparenright}\ {\isacharparenleft}Suc\ y{\isacharparenright}{\isachardoublequoteclose}\isanewline
  53.986 +%
  53.987 +\isadelimproof
  53.988 +%
  53.989 +\endisadelimproof
  53.990 +%
  53.991 +\isatagproof
  53.992 +\isacommand{by}\isamarkupfalse%
  53.993 +\ {\isacharparenleft}atomize{\isacharunderscore}elim{\isacharcomma}\ auto{\isacharcomma}\ arith{\isacharparenright}%
  53.994 +\endisatagproof
  53.995 +{\isafoldproof}%
  53.996 +%
  53.997 +\isadelimproof
  53.998 +\isanewline
  53.999 +%
 53.1000 +\endisadelimproof
 53.1001 +\isacommand{termination}\isamarkupfalse%
 53.1002 +%
 53.1003 +\isadelimproof
 53.1004 +\ %
 53.1005 +\endisadelimproof
 53.1006 +%
 53.1007 +\isatagproof
 53.1008 +\isacommand{by}\isamarkupfalse%
 53.1009 +\ lexicographic{\isacharunderscore}order%
 53.1010 +\endisatagproof
 53.1011 +{\isafoldproof}%
 53.1012 +%
 53.1013 +\isadelimproof
 53.1014 +%
 53.1015 +\endisadelimproof
 53.1016 +%
 53.1017 +\begin{isamarkuptext}%
 53.1018 +By now, you can probably guess what the proof obligations for the
 53.1019 +  pattern completeness and compatibility look like. 
 53.1020 +
 53.1021 +  Again, functions with conditional patterns are not supported by the
 53.1022 +  code generator.%
 53.1023 +\end{isamarkuptext}%
 53.1024 +\isamarkuptrue%
 53.1025 +%
 53.1026 +\isamarkupsubsection{Pattern matching on strings%
 53.1027 +}
 53.1028 +\isamarkuptrue%
 53.1029 +%
 53.1030 +\begin{isamarkuptext}%
 53.1031 +As strings (as lists of characters) are normal datatypes, pattern
 53.1032 +  matching on them is possible, but somewhat problematic. Consider the
 53.1033 +  following definition:
 53.1034 +
 53.1035 +\end{isamarkuptext}
 53.1036 +\noindent\cmd{fun} \isa{check\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequote}string\ {\isasymRightarrow}\ bool{\isachardoublequote}}\\%
 53.1037 +\cmd{where}\\%
 53.1038 +\hspace*{2ex}\isa{{\isachardoublequote}check\ {\isacharparenleft}{\isacharprime}{\isacharprime}good{\isacharprime}{\isacharprime}{\isacharparenright}\ {\isacharequal}\ True{\isachardoublequote}}\\%
 53.1039 +\isa{{\isacharbar}\ {\isachardoublequote}check\ s\ {\isacharequal}\ False{\isachardoublequote}}
 53.1040 +\begin{isamarkuptext}
 53.1041 +
 53.1042 +  \noindent An invocation of the above \cmd{fun} command does not
 53.1043 +  terminate. What is the problem? Strings are lists of characters, and
 53.1044 +  characters are a datatype with a lot of constructors. Splitting the
 53.1045 +  catch-all pattern thus leads to an explosion of cases, which cannot
 53.1046 +  be handled by Isabelle.
 53.1047 +
 53.1048 +  There are two things we can do here. Either we write an explicit
 53.1049 +  \isa{if} on the right hand side, or we can use conditional patterns:%
 53.1050 +\end{isamarkuptext}%
 53.1051 +\isamarkuptrue%
 53.1052 +\isacommand{function}\isamarkupfalse%
 53.1053 +\ check\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}string\ {\isasymRightarrow}\ bool{\isachardoublequoteclose}\isanewline
 53.1054 +\isakeyword{where}\isanewline
 53.1055 +\ \ {\isachardoublequoteopen}check\ {\isacharparenleft}{\isacharprime}{\isacharprime}good{\isacharprime}{\isacharprime}{\isacharparenright}\ {\isacharequal}\ True{\isachardoublequoteclose}\isanewline
 53.1056 +{\isacharbar}\ {\isachardoublequoteopen}s\ {\isasymnoteq}\ {\isacharprime}{\isacharprime}good{\isacharprime}{\isacharprime}\ {\isasymLongrightarrow}\ check\ s\ {\isacharequal}\ False{\isachardoublequoteclose}\isanewline
 53.1057 +%
 53.1058 +\isadelimproof
 53.1059 +%
 53.1060 +\endisadelimproof
 53.1061 +%
 53.1062 +\isatagproof
 53.1063 +\isacommand{by}\isamarkupfalse%
 53.1064 +\ auto%
 53.1065 +\endisatagproof
 53.1066 +{\isafoldproof}%
 53.1067 +%
 53.1068 +\isadelimproof
 53.1069 +%
 53.1070 +\endisadelimproof
 53.1071 +%
 53.1072 +\isamarkupsection{Partiality%
 53.1073 +}
 53.1074 +\isamarkuptrue%
 53.1075 +%
 53.1076 +\begin{isamarkuptext}%
 53.1077 +In HOL, all functions are total. A function \isa{f} applied to
 53.1078 +  \isa{x} always has the value \isa{f\ x}, and there is no notion
 53.1079 +  of undefinedness. 
 53.1080 +  This is why we have to do termination
 53.1081 +  proofs when defining functions: The proof justifies that the
 53.1082 +  function can be defined by wellfounded recursion.
 53.1083 +
 53.1084 +  However, the \cmd{function} package does support partiality to a
 53.1085 +  certain extent. Let's look at the following function which looks
 53.1086 +  for a zero of a given function f.%
 53.1087 +\end{isamarkuptext}%
 53.1088 +\isamarkuptrue%
 53.1089 +\isacommand{function}\isamarkupfalse%
 53.1090 +\ findzero\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharparenleft}nat\ {\isasymRightarrow}\ nat{\isacharparenright}\ {\isasymRightarrow}\ nat\ {\isasymRightarrow}\ nat{\isachardoublequoteclose}\isanewline
 53.1091 +\isakeyword{where}\isanewline
 53.1092 +\ \ {\isachardoublequoteopen}findzero\ f\ n\ {\isacharequal}\ {\isacharparenleft}if\ f\ n\ {\isacharequal}\ {\isadigit{0}}\ then\ n\ else\ findzero\ f\ {\isacharparenleft}Suc\ n{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}\isanewline
 53.1093 +%
 53.1094 +\isadelimproof
 53.1095 +%
 53.1096 +\endisadelimproof
 53.1097 +%
 53.1098 +\isatagproof
 53.1099 +\isacommand{by}\isamarkupfalse%
 53.1100 +\ pat{\isacharunderscore}completeness\ auto%
 53.1101 +\endisatagproof
 53.1102 +{\isafoldproof}%
 53.1103 +%
 53.1104 +\isadelimproof
 53.1105 +%
 53.1106 +\endisadelimproof
 53.1107 +%
 53.1108 +\begin{isamarkuptext}%
 53.1109 +\noindent Clearly, any attempt of a termination proof must fail. And without
 53.1110 +  that, we do not get the usual rules \isa{findzero{\isachardot}simps} and 
 53.1111 +  \isa{findzero{\isachardot}induct}. So what was the definition good for at all?%
 53.1112 +\end{isamarkuptext}%
 53.1113 +\isamarkuptrue%
 53.1114 +%
 53.1115 +\isamarkupsubsection{Domain predicates%
 53.1116 +}
 53.1117 +\isamarkuptrue%
 53.1118 +%
 53.1119 +\begin{isamarkuptext}%
 53.1120 +The trick is that Isabelle has not only defined the function \isa{findzero}, but also
 53.1121 +  a predicate \isa{findzero{\isacharunderscore}dom} that characterizes the values where the function
 53.1122 +  terminates: the \emph{domain} of the function. If we treat a
 53.1123 +  partial function just as a total function with an additional domain
 53.1124 +  predicate, we can derive simplification and
 53.1125 +  induction rules as we do for total functions. They are guarded
 53.1126 +  by domain conditions and are called \isa{psimps} and \isa{pinduct}:%
 53.1127 +\end{isamarkuptext}%
 53.1128 +\isamarkuptrue%
 53.1129 +%
 53.1130 +\begin{isamarkuptext}%
 53.1131 +\noindent\begin{minipage}{0.79\textwidth}\begin{isabelle}%
 53.1132 +findzero{\isacharunderscore}dom\ {\isacharparenleft}{\isacharquery}f{\isacharcomma}\ {\isacharquery}n{\isacharparenright}\ {\isasymLongrightarrow}\isanewline
 53.1133 +findzero\ {\isacharquery}f\ {\isacharquery}n\ {\isacharequal}\ {\isacharparenleft}if\ {\isacharquery}f\ {\isacharquery}n\ {\isacharequal}\ {\isadigit{0}}\ then\ {\isacharquery}n\ else\ findzero\ {\isacharquery}f\ {\isacharparenleft}Suc\ {\isacharquery}n{\isacharparenright}{\isacharparenright}%
 53.1134 +\end{isabelle}\end{minipage}
 53.1135 +  \hfill(\isa{findzero{\isachardot}psimps})
 53.1136 +  \vspace{1em}
 53.1137 +
 53.1138 +  \noindent\begin{minipage}{0.79\textwidth}\begin{isabelle}%
 53.1139 +{\isasymlbrakk}findzero{\isacharunderscore}dom\ {\isacharparenleft}{\isacharquery}a{\isadigit{0}}{\isachardot}{\isadigit{0}}{\isacharcomma}\ {\isacharquery}a{\isadigit{1}}{\isachardot}{\isadigit{0}}{\isacharparenright}{\isacharsemicolon}\isanewline
 53.1140 +\isaindent{\ }{\isasymAnd}f\ n{\isachardot}\ {\isasymlbrakk}findzero{\isacharunderscore}dom\ {\isacharparenleft}f{\isacharcomma}\ n{\isacharparenright}{\isacharsemicolon}\ f\ n\ {\isasymnoteq}\ {\isadigit{0}}\ {\isasymLongrightarrow}\ {\isacharquery}P\ f\ {\isacharparenleft}Suc\ n{\isacharparenright}{\isasymrbrakk}\ {\isasymLongrightarrow}\ {\isacharquery}P\ f\ n{\isasymrbrakk}\isanewline
 53.1141 +{\isasymLongrightarrow}\ {\isacharquery}P\ {\isacharquery}a{\isadigit{0}}{\isachardot}{\isadigit{0}}\ {\isacharquery}a{\isadigit{1}}{\isachardot}{\isadigit{0}}%
 53.1142 +\end{isabelle}\end{minipage}
 53.1143 +  \hfill(\isa{findzero{\isachardot}pinduct})%
 53.1144 +\end{isamarkuptext}%
 53.1145 +\isamarkuptrue%
 53.1146 +%
 53.1147 +\begin{isamarkuptext}%
 53.1148 +Remember that all we
 53.1149 +  are doing here is use some tricks to make a total function appear
 53.1150 +  as if it was partial. We can still write the term \isa{findzero\ {\isacharparenleft}{\isasymlambda}x{\isachardot}\ {\isadigit{1}}{\isacharparenright}\ {\isadigit{0}}} and like any other term of type \isa{nat} it is equal
 53.1151 +  to some natural number, although we might not be able to find out
 53.1152 +  which one. The function is \emph{underdefined}.
 53.1153 +
 53.1154 +  But it is defined enough to prove something interesting about it. We
 53.1155 +  can prove that if \isa{findzero\ f\ n}
 53.1156 +  terminates, it indeed returns a zero of \isa{f}:%
 53.1157 +\end{isamarkuptext}%
 53.1158 +\isamarkuptrue%
 53.1159 +\isacommand{lemma}\isamarkupfalse%
 53.1160 +\ findzero{\isacharunderscore}zero{\isacharcolon}\ {\isachardoublequoteopen}findzero{\isacharunderscore}dom\ {\isacharparenleft}f{\isacharcomma}\ n{\isacharparenright}\ {\isasymLongrightarrow}\ f\ {\isacharparenleft}findzero\ f\ n{\isacharparenright}\ {\isacharequal}\ {\isadigit{0}}{\isachardoublequoteclose}%
 53.1161 +\isadelimproof
 53.1162 +%
 53.1163 +\endisadelimproof
 53.1164 +%
 53.1165 +\isatagproof
 53.1166 +%
 53.1167 +\begin{isamarkuptxt}%
 53.1168 +\noindent We apply induction as usual, but using the partial induction
 53.1169 +  rule:%
 53.1170 +\end{isamarkuptxt}%
 53.1171 +\isamarkuptrue%
 53.1172 +\isacommand{apply}\isamarkupfalse%
 53.1173 +\ {\isacharparenleft}induct\ f\ n\ rule{\isacharcolon}\ findzero{\isachardot}pinduct{\isacharparenright}%
 53.1174 +\begin{isamarkuptxt}%
 53.1175 +\noindent This gives the following subgoals:
 53.1176 +
 53.1177 +  \begin{isabelle}%
 53.1178 +\ {\isadigit{1}}{\isachardot}\ {\isasymAnd}f\ n{\isachardot}\ {\isasymlbrakk}findzero{\isacharunderscore}dom\ {\isacharparenleft}f{\isacharcomma}\ n{\isacharparenright}{\isacharsemicolon}\ f\ n\ {\isasymnoteq}\ {\isadigit{0}}\ {\isasymLongrightarrow}\ f\ {\isacharparenleft}findzero\ f\ {\isacharparenleft}Suc\ n{\isacharparenright}{\isacharparenright}\ {\isacharequal}\ {\isadigit{0}}{\isasymrbrakk}\isanewline
 53.1179 +\isaindent{\ {\isadigit{1}}{\isachardot}\ {\isasymAnd}f\ n{\isachardot}\ }{\isasymLongrightarrow}\ f\ {\isacharparenleft}findzero\ f\ n{\isacharparenright}\ {\isacharequal}\ {\isadigit{0}}%
 53.1180 +\end{isabelle}
 53.1181 +
 53.1182 +  \noindent The hypothesis in our lemma was used to satisfy the first premise in
 53.1183 +  the induction rule. However, we also get \isa{findzero{\isacharunderscore}dom\ {\isacharparenleft}f{\isacharcomma}\ n{\isacharparenright}} as a local assumption in the induction step. This
 53.1184 +  allows to unfold \isa{findzero\ f\ n} using the \isa{psimps}
 53.1185 +  rule, and the rest is trivial. Since the \isa{psimps} rules carry the
 53.1186 +  \isa{{\isacharbrackleft}simp{\isacharbrackright}} attribute by default, we just need a single step:%
 53.1187 +\end{isamarkuptxt}%
 53.1188 +\isamarkuptrue%
 53.1189 +\isacommand{apply}\isamarkupfalse%
 53.1190 +\ simp\isanewline
 53.1191 +\isacommand{done}\isamarkupfalse%
 53.1192 +%
 53.1193 +\endisatagproof
 53.1194 +{\isafoldproof}%
 53.1195 +%
 53.1196 +\isadelimproof
 53.1197 +%
 53.1198 +\endisadelimproof
 53.1199 +%
 53.1200 +\begin{isamarkuptext}%
 53.1201 +Proofs about partial functions are often not harder than for total
 53.1202 +  functions. Fig.~\ref{findzero_isar} shows a slightly more
 53.1203 +  complicated proof written in Isar. It is verbose enough to show how
 53.1204 +  partiality comes into play: From the partial induction, we get an
 53.1205 +  additional domain condition hypothesis. Observe how this condition
 53.1206 +  is applied when calls to \isa{findzero} are unfolded.%
 53.1207 +\end{isamarkuptext}%
 53.1208 +\isamarkuptrue%
 53.1209 +%
 53.1210 +\begin{figure}
 53.1211 +\hrule\vspace{6pt}
 53.1212 +\begin{minipage}{0.8\textwidth}
 53.1213 +\isabellestyle{it}
 53.1214 +\isastyle\isamarkuptrue
 53.1215 +\isacommand{lemma}\isamarkupfalse%
 53.1216 +\ {\isachardoublequoteopen}{\isasymlbrakk}findzero{\isacharunderscore}dom\ {\isacharparenleft}f{\isacharcomma}\ n{\isacharparenright}{\isacharsemicolon}\ x\ {\isasymin}\ {\isacharbraceleft}n\ {\isachardot}{\isachardot}{\isacharless}\ findzero\ f\ n{\isacharbraceright}{\isasymrbrakk}\ {\isasymLongrightarrow}\ f\ x\ {\isasymnoteq}\ {\isadigit{0}}{\isachardoublequoteclose}\isanewline
 53.1217 +%
 53.1218 +\isadelimproof
 53.1219 +%
 53.1220 +\endisadelimproof
 53.1221 +%
 53.1222 +\isatagproof
 53.1223 +\isacommand{proof}\isamarkupfalse%
 53.1224 +\ {\isacharparenleft}induct\ rule{\isacharcolon}\ findzero{\isachardot}pinduct{\isacharparenright}\isanewline
 53.1225 +\ \ \isacommand{fix}\isamarkupfalse%
 53.1226 +\ f\ n\ \isacommand{assume}\isamarkupfalse%
 53.1227 +\ dom{\isacharcolon}\ {\isachardoublequoteopen}findzero{\isacharunderscore}dom\ {\isacharparenleft}f{\isacharcomma}\ n{\isacharparenright}{\isachardoublequoteclose}\isanewline
 53.1228 +\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \isakeyword{and}\ IH{\isacharcolon}\ {\isachardoublequoteopen}{\isasymlbrakk}f\ n\ {\isasymnoteq}\ {\isadigit{0}}{\isacharsemicolon}\ x\ {\isasymin}\ {\isacharbraceleft}Suc\ n\ {\isachardot}{\isachardot}{\isacharless}\ findzero\ f\ {\isacharparenleft}Suc\ n{\isacharparenright}{\isacharbraceright}{\isasymrbrakk}\ {\isasymLongrightarrow}\ f\ x\ {\isasymnoteq}\ {\isadigit{0}}{\isachardoublequoteclose}\isanewline
 53.1229 +\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \isakeyword{and}\ x{\isacharunderscore}range{\isacharcolon}\ {\isachardoublequoteopen}x\ {\isasymin}\ {\isacharbraceleft}n\ {\isachardot}{\isachardot}{\isacharless}\ findzero\ f\ n{\isacharbraceright}{\isachardoublequoteclose}\isanewline
 53.1230 +\ \ \isacommand{have}\isamarkupfalse%
 53.1231 +\ {\isachardoublequoteopen}f\ n\ {\isasymnoteq}\ {\isadigit{0}}{\isachardoublequoteclose}\isanewline
 53.1232 +\ \ \isacommand{proof}\isamarkupfalse%
 53.1233 +\ \isanewline
 53.1234 +\ \ \ \ \isacommand{assume}\isamarkupfalse%
 53.1235 +\ {\isachardoublequoteopen}f\ n\ {\isacharequal}\ {\isadigit{0}}{\isachardoublequoteclose}\isanewline
 53.1236 +\ \ \ \ \isacommand{with}\isamarkupfalse%
 53.1237 +\ dom\ \isacommand{have}\isamarkupfalse%
 53.1238 +\ {\isachardoublequoteopen}findzero\ f\ n\ {\isacharequal}\ n{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
 53.1239 +\ simp\isanewline
 53.1240 +\ \ \ \ \isacommand{with}\isamarkupfalse%
 53.1241 +\ x{\isacharunderscore}range\ \isacommand{show}\isamarkupfalse%
 53.1242 +\ False\ \isacommand{by}\isamarkupfalse%
 53.1243 +\ auto\isanewline
 53.1244 +\ \ \isacommand{qed}\isamarkupfalse%
 53.1245 +\isanewline
 53.1246 +\ \ \isanewline
 53.1247 +\ \ \isacommand{from}\isamarkupfalse%
 53.1248 +\ x{\isacharunderscore}range\ \isacommand{have}\isamarkupfalse%
 53.1249 +\ {\isachardoublequoteopen}x\ {\isacharequal}\ n\ {\isasymor}\ x\ {\isasymin}\ {\isacharbraceleft}Suc\ n\ {\isachardot}{\isachardot}{\isacharless}\ findzero\ f\ n{\isacharbraceright}{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
 53.1250 +\ auto\isanewline
 53.1251 +\ \ \isacommand{thus}\isamarkupfalse%
 53.1252 +\ {\isachardoublequoteopen}f\ x\ {\isasymnoteq}\ {\isadigit{0}}{\isachardoublequoteclose}\isanewline
 53.1253 +\ \ \isacommand{proof}\isamarkupfalse%
 53.1254 +\isanewline
 53.1255 +\ \ \ \ \isacommand{assume}\isamarkupfalse%
 53.1256 +\ {\isachardoublequoteopen}x\ {\isacharequal}\ n{\isachardoublequoteclose}\isanewline
 53.1257 +\ \ \ \ \isacommand{with}\isamarkupfalse%
 53.1258 +\ {\isacharbackquoteopen}f\ n\ {\isasymnoteq}\ {\isadigit{0}}{\isacharbackquoteclose}\ \isacommand{show}\isamarkupfalse%
 53.1259 +\ {\isacharquery}thesis\ \isacommand{by}\isamarkupfalse%
 53.1260 +\ simp\isanewline
 53.1261 +\ \ \isacommand{next}\isamarkupfalse%
 53.1262 +\isanewline
 53.1263 +\ \ \ \ \isacommand{assume}\isamarkupfalse%
 53.1264 +\ {\isachardoublequoteopen}x\ {\isasymin}\ {\isacharbraceleft}Suc\ n\ {\isachardot}{\isachardot}{\isacharless}\ findzero\ f\ n{\isacharbraceright}{\isachardoublequoteclose}\isanewline
 53.1265 +\ \ \ \ \isacommand{with}\isamarkupfalse%
 53.1266 +\ dom\ \isakeyword{and}\ {\isacharbackquoteopen}f\ n\ {\isasymnoteq}\ {\isadigit{0}}{\isacharbackquoteclose}\ \isacommand{have}\isamarkupfalse%
 53.1267 +\ {\isachardoublequoteopen}x\ {\isasymin}\ {\isacharbraceleft}Suc\ n\ {\isachardot}{\isachardot}{\isacharless}\ findzero\ f\ {\isacharparenleft}Suc\ n{\isacharparenright}{\isacharbraceright}{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
 53.1268 +\ simp\isanewline
 53.1269 +\ \ \ \ \isacommand{with}\isamarkupfalse%
 53.1270 +\ IH\ \isakeyword{and}\ {\isacharbackquoteopen}f\ n\ {\isasymnoteq}\ {\isadigit{0}}{\isacharbackquoteclose}\isanewline
 53.1271 +\ \ \ \ \isacommand{show}\isamarkupfalse%
 53.1272 +\ {\isacharquery}thesis\ \isacommand{by}\isamarkupfalse%
 53.1273 +\ simp\isanewline
 53.1274 +\ \ \isacommand{qed}\isamarkupfalse%
 53.1275 +\isanewline
 53.1276 +\isacommand{qed}\isamarkupfalse%
 53.1277 +%
 53.1278 +\endisatagproof
 53.1279 +{\isafoldproof}%
 53.1280 +%
 53.1281 +\isadelimproof
 53.1282 +%
 53.1283 +\endisadelimproof
 53.1284 +%
 53.1285 +\isamarkupfalse\isabellestyle{tt}
 53.1286 +\end{minipage}\vspace{6pt}\hrule
 53.1287 +\caption{A proof about a partial function}\label{findzero_isar}
 53.1288 +\end{figure}
 53.1289 +%
 53.1290 +\isamarkupsubsection{Partial termination proofs%
 53.1291 +}
 53.1292 +\isamarkuptrue%
 53.1293 +%
 53.1294 +\begin{isamarkuptext}%
 53.1295 +Now that we have proved some interesting properties about our
 53.1296 +  function, we should turn to the domain predicate and see if it is
 53.1297 +  actually true for some values. Otherwise we would have just proved
 53.1298 +  lemmas with \isa{False} as a premise.
 53.1299 +
 53.1300 +  Essentially, we need some introduction rules for \isa{findzero{\isacharunderscore}dom}. The function package can prove such domain
 53.1301 +  introduction rules automatically. But since they are not used very
 53.1302 +  often (they are almost never needed if the function is total), this
 53.1303 +  functionality is disabled by default for efficiency reasons. So we have to go
 53.1304 +  back and ask for them explicitly by passing the \isa{{\isacharparenleft}domintros{\isacharparenright}} option to the function package:
 53.1305 +
 53.1306 +\vspace{1ex}
 53.1307 +\noindent\cmd{function} \isa{{\isacharparenleft}domintros{\isacharparenright}\ findzero\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequote}{\isacharparenleft}nat\ {\isasymRightarrow}\ nat{\isacharparenright}\ {\isasymRightarrow}\ nat\ {\isasymRightarrow}\ nat{\isachardoublequote}}\\%
 53.1308 +\cmd{where}\isanewline%
 53.1309 +\ \ \ldots\\
 53.1310 +
 53.1311 +  \noindent Now the package has proved an introduction rule for \isa{findzero{\isacharunderscore}dom}:%
 53.1312 +\end{isamarkuptext}%
 53.1313 +\isamarkuptrue%
 53.1314 +\isacommand{thm}\isamarkupfalse%
 53.1315 +\ findzero{\isachardot}domintros%
 53.1316 +\begin{isamarkuptext}%
 53.1317 +\begin{isabelle}%
 53.1318 +{\isacharparenleft}{\isadigit{0}}\ {\isacharless}\ {\isacharquery}f\ {\isacharquery}n\ {\isasymLongrightarrow}\ findzero{\isacharunderscore}dom\ {\isacharparenleft}{\isacharquery}f{\isacharcomma}\ Suc\ {\isacharquery}n{\isacharparenright}{\isacharparenright}\ {\isasymLongrightarrow}\ findzero{\isacharunderscore}dom\ {\isacharparenleft}{\isacharquery}f{\isacharcomma}\ {\isacharquery}n{\isacharparenright}%
 53.1319 +\end{isabelle}
 53.1320 +
 53.1321 +  Domain introduction rules allow to show that a given value lies in the
 53.1322 +  domain of a function, if the arguments of all recursive calls
 53.1323 +  are in the domain as well. They allow to do a \qt{single step} in a
 53.1324 +  termination proof. Usually, you want to combine them with a suitable
 53.1325 +  induction principle.
 53.1326 +
 53.1327 +  Since our function increases its argument at recursive calls, we
 53.1328 +  need an induction principle which works \qt{backwards}. We will use
 53.1329 +  \isa{inc{\isacharunderscore}induct}, which allows to do induction from a fixed number
 53.1330 +  \qt{downwards}:
 53.1331 +
 53.1332 +  \begin{center}\isa{{\isasymlbrakk}{\isacharquery}i\ {\isasymle}\ {\isacharquery}j{\isacharsemicolon}\ {\isacharquery}P\ {\isacharquery}j{\isacharsemicolon}\ {\isasymAnd}i{\isachardot}\ {\isasymlbrakk}i\ {\isacharless}\ {\isacharquery}j{\isacharsemicolon}\ {\isacharquery}P\ {\isacharparenleft}Suc\ i{\isacharparenright}{\isasymrbrakk}\ {\isasymLongrightarrow}\ {\isacharquery}P\ i{\isasymrbrakk}\ {\isasymLongrightarrow}\ {\isacharquery}P\ {\isacharquery}i}\hfill(\isa{inc{\isacharunderscore}induct})\end{center}
 53.1333 +
 53.1334 +  Figure \ref{findzero_term} gives a detailed Isar proof of the fact
 53.1335 +  that \isa{findzero} terminates if there is a zero which is greater
 53.1336 +  or equal to \isa{n}. First we derive two useful rules which will
 53.1337 +  solve the base case and the step case of the induction. The
 53.1338 +  induction is then straightforward, except for the unusual induction
 53.1339 +  principle.%
 53.1340 +\end{isamarkuptext}%
 53.1341 +\isamarkuptrue%
 53.1342 +%
 53.1343 +\begin{figure}
 53.1344 +\hrule\vspace{6pt}
 53.1345 +\begin{minipage}{0.8\textwidth}
 53.1346 +\isabellestyle{it}
 53.1347 +\isastyle\isamarkuptrue
 53.1348 +\isacommand{lemma}\isamarkupfalse%
 53.1349 +\ findzero{\isacharunderscore}termination{\isacharcolon}\isanewline
 53.1350 +\ \ \isakeyword{assumes}\ {\isachardoublequoteopen}x\ {\isasymge}\ n{\isachardoublequoteclose}\ \isakeyword{and}\ {\isachardoublequoteopen}f\ x\ {\isacharequal}\ {\isadigit{0}}{\isachardoublequoteclose}\isanewline
 53.1351 +\ \ \isakeyword{shows}\ {\isachardoublequoteopen}findzero{\isacharunderscore}dom\ {\isacharparenleft}f{\isacharcomma}\ n{\isacharparenright}{\isachardoublequoteclose}\isanewline
 53.1352 +%
 53.1353 +\isadelimproof
 53.1354 +%
 53.1355 +\endisadelimproof
 53.1356 +%
 53.1357 +\isatagproof
 53.1358 +\isacommand{proof}\isamarkupfalse%
 53.1359 +\ {\isacharminus}\ \isanewline
 53.1360 +\ \ \isacommand{have}\isamarkupfalse%
 53.1361 +\ base{\isacharcolon}\ {\isachardoublequoteopen}findzero{\isacharunderscore}dom\ {\isacharparenleft}f{\isacharcomma}\ x{\isacharparenright}{\isachardoublequoteclose}\isanewline
 53.1362 +\ \ \ \ \isacommand{by}\isamarkupfalse%
 53.1363 +\ {\isacharparenleft}rule\ findzero{\isachardot}domintros{\isacharparenright}\ {\isacharparenleft}simp\ add{\isacharcolon}{\isacharbackquoteopen}f\ x\ {\isacharequal}\ {\isadigit{0}}{\isacharbackquoteclose}{\isacharparenright}\isanewline
 53.1364 +\isanewline
 53.1365 +\ \ \isacommand{have}\isamarkupfalse%
 53.1366 +\ step{\isacharcolon}\ {\isachardoublequoteopen}{\isasymAnd}i{\isachardot}\ findzero{\isacharunderscore}dom\ {\isacharparenleft}f{\isacharcomma}\ Suc\ i{\isacharparenright}\ \isanewline
 53.1367 +\ \ \ \ {\isasymLongrightarrow}\ findzero{\isacharunderscore}dom\ {\isacharparenleft}f{\isacharcomma}\ i{\isacharparenright}{\isachardoublequoteclose}\isanewline
 53.1368 +\ \ \ \ \isacommand{by}\isamarkupfalse%
 53.1369 +\ {\isacharparenleft}rule\ findzero{\isachardot}domintros{\isacharparenright}\ simp\isanewline
 53.1370 +\isanewline
 53.1371 +\ \ \isacommand{from}\isamarkupfalse%
 53.1372 +\ {\isacharbackquoteopen}x\ {\isasymge}\ n{\isacharbackquoteclose}\ \isacommand{show}\isamarkupfalse%
 53.1373 +\ {\isacharquery}thesis\isanewline
 53.1374 +\ \ \isacommand{proof}\isamarkupfalse%
 53.1375 +\ {\isacharparenleft}induct\ rule{\isacharcolon}inc{\isacharunderscore}induct{\isacharparenright}\isanewline
 53.1376 +\ \ \ \ \isacommand{show}\isamarkupfalse%
 53.1377 +\ {\isachardoublequoteopen}findzero{\isacharunderscore}dom\ {\isacharparenleft}f{\isacharcomma}\ x{\isacharparenright}{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
 53.1378 +\ {\isacharparenleft}rule\ base{\isacharparenright}\isanewline
 53.1379 +\ \ \isacommand{next}\isamarkupfalse%
 53.1380 +\isanewline
 53.1381 +\ \ \ \ \isacommand{fix}\isamarkupfalse%
 53.1382 +\ i\ \isacommand{assume}\isamarkupfalse%
 53.1383 +\ {\isachardoublequoteopen}findzero{\isacharunderscore}dom\ {\isacharparenleft}f{\isacharcomma}\ Suc\ i{\isacharparenright}{\isachardoublequoteclose}\isanewline
 53.1384 +\ \ \ \ \isacommand{thus}\isamarkupfalse%
 53.1385 +\ {\isachardoublequoteopen}findzero{\isacharunderscore}dom\ {\isacharparenleft}f{\isacharcomma}\ i{\isacharparenright}{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
 53.1386 +\ {\isacharparenleft}rule\ step{\isacharparenright}\isanewline
 53.1387 +\ \ \isacommand{qed}\isamarkupfalse%
 53.1388 +\isanewline
 53.1389 +\isacommand{qed}\isamarkupfalse%
 53.1390 +%
 53.1391 +\endisatagproof
 53.1392 +{\isafoldproof}%
 53.1393 +%
 53.1394 +\isadelimproof
 53.1395 +%
 53.1396 +\endisadelimproof
 53.1397 +%
 53.1398 +\isamarkupfalse\isabellestyle{tt}
 53.1399 +\end{minipage}\vspace{6pt}\hrule
 53.1400 +\caption{Termination proof for \isa{findzero}}\label{findzero_term}
 53.1401 +\end{figure}
 53.1402 +%
 53.1403 +\begin{isamarkuptext}%
 53.1404 +Again, the proof given in Fig.~\ref{findzero_term} has a lot of
 53.1405 +  detail in order to explain the principles. Using more automation, we
 53.1406 +  can also have a short proof:%
 53.1407 +\end{isamarkuptext}%
 53.1408 +\isamarkuptrue%
 53.1409 +\isacommand{lemma}\isamarkupfalse%
 53.1410 +\ findzero{\isacharunderscore}termination{\isacharunderscore}short{\isacharcolon}\isanewline
 53.1411 +\ \ \isakeyword{assumes}\ zero{\isacharcolon}\ {\isachardoublequoteopen}x\ {\isachargreater}{\isacharequal}\ n{\isachardoublequoteclose}\ \isanewline
 53.1412 +\ \ \isakeyword{assumes}\ {\isacharbrackleft}simp{\isacharbrackright}{\isacharcolon}\ {\isachardoublequoteopen}f\ x\ {\isacharequal}\ {\isadigit{0}}{\isachardoublequoteclose}\isanewline
 53.1413 +\ \ \isakeyword{shows}\ {\isachardoublequoteopen}findzero{\isacharunderscore}dom\ {\isacharparenleft}f{\isacharcomma}\ n{\isacharparenright}{\isachardoublequoteclose}\isanewline
 53.1414 +%
 53.1415 +\isadelimproof
 53.1416 +%
 53.1417 +\endisadelimproof
 53.1418 +%
 53.1419 +\isatagproof
 53.1420 +\isacommand{using}\isamarkupfalse%
 53.1421 +\ zero\isanewline
 53.1422 +\isacommand{by}\isamarkupfalse%
 53.1423 +\ {\isacharparenleft}induct\ rule{\isacharcolon}inc{\isacharunderscore}induct{\isacharparenright}\ {\isacharparenleft}auto\ intro{\isacharcolon}\ findzero{\isachardot}domintros{\isacharparenright}%
 53.1424 +\endisatagproof
 53.1425 +{\isafoldproof}%
 53.1426 +%
 53.1427 +\isadelimproof
 53.1428 +%
 53.1429 +\endisadelimproof
 53.1430 +%
 53.1431 +\begin{isamarkuptext}%
 53.1432 +\noindent It is simple to combine the partial correctness result with the
 53.1433 +  termination lemma:%
 53.1434 +\end{isamarkuptext}%
 53.1435 +\isamarkuptrue%
 53.1436 +\isacommand{lemma}\isamarkupfalse%
 53.1437 +\ findzero{\isacharunderscore}total{\isacharunderscore}correctness{\isacharcolon}\isanewline
 53.1438 +\ \ {\isachardoublequoteopen}f\ x\ {\isacharequal}\ {\isadigit{0}}\ {\isasymLongrightarrow}\ f\ {\isacharparenleft}findzero\ f\ {\isadigit{0}}{\isacharparenright}\ {\isacharequal}\ {\isadigit{0}}{\isachardoublequoteclose}\isanewline
 53.1439 +%
 53.1440 +\isadelimproof
 53.1441 +%
 53.1442 +\endisadelimproof
 53.1443 +%
 53.1444 +\isatagproof
 53.1445 +\isacommand{by}\isamarkupfalse%
 53.1446 +\ {\isacharparenleft}blast\ intro{\isacharcolon}\ findzero{\isacharunderscore}zero\ findzero{\isacharunderscore}termination{\isacharparenright}%
 53.1447 +\endisatagproof
 53.1448 +{\isafoldproof}%
 53.1449 +%
 53.1450 +\isadelimproof
 53.1451 +%
 53.1452 +\endisadelimproof
 53.1453 +%
 53.1454 +\isamarkupsubsection{Definition of the domain predicate%
 53.1455 +}
 53.1456 +\isamarkuptrue%
 53.1457 +%
 53.1458 +\begin{isamarkuptext}%
 53.1459 +Sometimes it is useful to know what the definition of the domain
 53.1460 +  predicate looks like. Actually, \isa{findzero{\isacharunderscore}dom} is just an
 53.1461 +  abbreviation:
 53.1462 +
 53.1463 +  \begin{isabelle}%
 53.1464 +findzero{\isacharunderscore}dom\ {\isasymequiv}\ accp\ findzero{\isacharunderscore}rel%
 53.1465 +\end{isabelle}
 53.1466 +
 53.1467 +  The domain predicate is the \emph{accessible part} of a relation \isa{findzero{\isacharunderscore}rel}, which was also created internally by the function
 53.1468 +  package. \isa{findzero{\isacharunderscore}rel} is just a normal
 53.1469 +  inductive predicate, so we can inspect its definition by
 53.1470 +  looking at the introduction rules \isa{findzero{\isacharunderscore}rel{\isachardot}intros}.
 53.1471 +  In our case there is just a single rule:
 53.1472 +
 53.1473 +  \begin{isabelle}%
 53.1474 +{\isacharquery}f\ {\isacharquery}n\ {\isasymnoteq}\ {\isadigit{0}}\ {\isasymLongrightarrow}\ findzero{\isacharunderscore}rel\ {\isacharparenleft}{\isacharquery}f{\isacharcomma}\ Suc\ {\isacharquery}n{\isacharparenright}\ {\isacharparenleft}{\isacharquery}f{\isacharcomma}\ {\isacharquery}n{\isacharparenright}%
 53.1475 +\end{isabelle}
 53.1476 +
 53.1477 +  The predicate \isa{findzero{\isacharunderscore}rel}
 53.1478 +  describes the \emph{recursion relation} of the function
 53.1479 +  definition. The recursion relation is a binary relation on
 53.1480 +  the arguments of the function that relates each argument to its
 53.1481 +  recursive calls. In general, there is one introduction rule for each
 53.1482 +  recursive call.
 53.1483 +
 53.1484 +  The predicate \isa{findzero{\isacharunderscore}dom} is the accessible part of
 53.1485 +  that relation. An argument belongs to the accessible part, if it can
 53.1486 +  be reached in a finite number of steps (cf.~its definition in \isa{Wellfounded{\isachardot}thy}).
 53.1487 +
 53.1488 +  Since the domain predicate is just an abbreviation, you can use
 53.1489 +  lemmas for \isa{accp} and \isa{findzero{\isacharunderscore}rel} directly. Some
 53.1490 +  lemmas which are occasionally useful are \isa{accpI}, \isa{accp{\isacharunderscore}downward}, and of course the introduction and elimination rules
 53.1491 +  for the recursion relation \isa{findzero{\isachardot}intros} and \isa{findzero{\isachardot}cases}.%
 53.1492 +\end{isamarkuptext}%
 53.1493 +\isamarkuptrue%
 53.1494 +%
 53.1495 +\isamarkupsubsection{A Useful Special Case: Tail recursion%
 53.1496 +}
 53.1497 +\isamarkuptrue%
 53.1498 +%
 53.1499 +\begin{isamarkuptext}%
 53.1500 +The domain predicate is our trick that allows us to model partiality
 53.1501 +  in a world of total functions. The downside of this is that we have
 53.1502 +  to carry it around all the time. The termination proof above allowed
 53.1503 +  us to replace the abstract \isa{findzero{\isacharunderscore}dom\ {\isacharparenleft}f{\isacharcomma}\ n{\isacharparenright}} by the more
 53.1504 +  concrete \isa{n\ {\isasymle}\ x\ {\isasymand}\ f\ x\ {\isacharequal}\ {\isadigit{0}}}, but the condition is still
 53.1505 +  there and can only be discharged for special cases.
 53.1506 +  In particular, the domain predicate guards the unfolding of our
 53.1507 +  function, since it is there as a condition in the \isa{psimp}
 53.1508 +  rules. 
 53.1509 +
 53.1510 +  Now there is an important special case: We can actually get rid
 53.1511 +  of the condition in the simplification rules, \emph{if the function
 53.1512 +  is tail-recursive}. The reason is that for all tail-recursive
 53.1513 +  equations there is a total function satisfying them, even if they
 53.1514 +  are non-terminating. 
 53.1515 +
 53.1516 +%  A function is tail recursive, if each call to the function is either
 53.1517 +%  equal
 53.1518 +%
 53.1519 +%  So the outer form of the 
 53.1520 +%
 53.1521 +%if it can be written in the following
 53.1522 +%  form:
 53.1523 +%  {term[display] "f x = (if COND x then BASE x else f (LOOP x))"}
 53.1524 +
 53.1525 +
 53.1526 +  The function package internally does the right construction and can
 53.1527 +  derive the unconditional simp rules, if we ask it to do so. Luckily,
 53.1528 +  our \isa{findzero} function is tail-recursive, so we can just go
 53.1529 +  back and add another option to the \cmd{function} command:
 53.1530 +
 53.1531 +\vspace{1ex}
 53.1532 +\noindent\cmd{function} \isa{{\isacharparenleft}domintros{\isacharcomma}\ tailrec{\isacharparenright}\ findzero\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequote}{\isacharparenleft}nat\ {\isasymRightarrow}\ nat{\isacharparenright}\ {\isasymRightarrow}\ nat\ {\isasymRightarrow}\ nat{\isachardoublequote}}\\%
 53.1533 +\cmd{where}\isanewline%
 53.1534 +\ \ \ldots\\%
 53.1535 +
 53.1536 +  
 53.1537 +  \noindent Now, we actually get unconditional simplification rules, even
 53.1538 +  though the function is partial:%
 53.1539 +\end{isamarkuptext}%
 53.1540 +\isamarkuptrue%
 53.1541 +\isacommand{thm}\isamarkupfalse%
 53.1542 +\ findzero{\isachardot}simps%
 53.1543 +\begin{isamarkuptext}%
 53.1544 +\begin{isabelle}%
 53.1545 +findzero\ {\isacharquery}f\ {\isacharquery}n\ {\isacharequal}\ {\isacharparenleft}if\ {\isacharquery}f\ {\isacharquery}n\ {\isacharequal}\ {\isadigit{0}}\ then\ {\isacharquery}n\ else\ findzero\ {\isacharquery}f\ {\isacharparenleft}Suc\ {\isacharquery}n{\isacharparenright}{\isacharparenright}%
 53.1546 +\end{isabelle}
 53.1547 +
 53.1548 +  \noindent Of course these would make the simplifier loop, so we better remove
 53.1549 +  them from the simpset:%
 53.1550 +\end{isamarkuptext}%
 53.1551 +\isamarkuptrue%
 53.1552 +\isacommand{declare}\isamarkupfalse%
 53.1553 +\ findzero{\isachardot}simps{\isacharbrackleft}simp\ del{\isacharbrackright}%
 53.1554 +\begin{isamarkuptext}%
 53.1555 +Getting rid of the domain conditions in the simplification rules is
 53.1556 +  not only useful because it simplifies proofs. It is also required in
 53.1557 +  order to use Isabelle's code generator to generate ML code
 53.1558 +  from a function definition.
 53.1559 +  Since the code generator only works with equations, it cannot be
 53.1560 +  used with \isa{psimp} rules. Thus, in order to generate code for
 53.1561 +  partial functions, they must be defined as a tail recursion.
 53.1562 +  Luckily, many functions have a relatively natural tail recursive
 53.1563 +  definition.%
 53.1564 +\end{isamarkuptext}%
 53.1565 +\isamarkuptrue%
 53.1566 +%
 53.1567 +\isamarkupsection{Nested recursion%
 53.1568 +}
 53.1569 +\isamarkuptrue%
 53.1570 +%
 53.1571 +\begin{isamarkuptext}%
 53.1572 +Recursive calls which are nested in one another frequently cause
 53.1573 +  complications, since their termination proof can depend on a partial
 53.1574 +  correctness property of the function itself. 
 53.1575 +
 53.1576 +  As a small example, we define the \qt{nested zero} function:%
 53.1577 +\end{isamarkuptext}%
 53.1578 +\isamarkuptrue%
 53.1579 +\isacommand{function}\isamarkupfalse%
 53.1580 +\ nz\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ nat{\isachardoublequoteclose}\isanewline
 53.1581 +\isakeyword{where}\isanewline
 53.1582 +\ \ {\isachardoublequoteopen}nz\ {\isadigit{0}}\ {\isacharequal}\ {\isadigit{0}}{\isachardoublequoteclose}\isanewline
 53.1583 +{\isacharbar}\ {\isachardoublequoteopen}nz\ {\isacharparenleft}Suc\ n{\isacharparenright}\ {\isacharequal}\ nz\ {\isacharparenleft}nz\ n{\isacharparenright}{\isachardoublequoteclose}\isanewline
 53.1584 +%
 53.1585 +\isadelimproof
 53.1586 +%
 53.1587 +\endisadelimproof
 53.1588 +%
 53.1589 +\isatagproof
 53.1590 +\isacommand{by}\isamarkupfalse%
 53.1591 +\ pat{\isacharunderscore}completeness\ auto%
 53.1592 +\endisatagproof
 53.1593 +{\isafoldproof}%
 53.1594 +%
 53.1595 +\isadelimproof
 53.1596 +%
 53.1597 +\endisadelimproof
 53.1598 +%
 53.1599 +\begin{isamarkuptext}%
 53.1600 +If we attempt to prove termination using the identity measure on
 53.1601 +  naturals, this fails:%
 53.1602 +\end{isamarkuptext}%
 53.1603 +\isamarkuptrue%
 53.1604 +\isacommand{termination}\isamarkupfalse%
 53.1605 +\isanewline
 53.1606 +%
 53.1607 +\isadelimproof
 53.1608 +\ \ %
 53.1609 +\endisadelimproof
 53.1610 +%
 53.1611 +\isatagproof
 53.1612 +\isacommand{apply}\isamarkupfalse%
 53.1613 +\ {\isacharparenleft}relation\ {\isachardoublequoteopen}measure\ {\isacharparenleft}{\isasymlambda}n{\isachardot}\ n{\isacharparenright}{\isachardoublequoteclose}{\isacharparenright}\isanewline
 53.1614 +\ \ \isacommand{apply}\isamarkupfalse%
 53.1615 +\ auto%
 53.1616 +\begin{isamarkuptxt}%
 53.1617 +We get stuck with the subgoal
 53.1618 +
 53.1619 +  \begin{isabelle}%
 53.1620 +\ {\isadigit{1}}{\isachardot}\ {\isasymAnd}n{\isachardot}\ nz{\isacharunderscore}dom\ n\ {\isasymLongrightarrow}\ nz\ n\ {\isacharless}\ Suc\ n%
 53.1621 +\end{isabelle}
 53.1622 +
 53.1623 +  Of course this statement is true, since we know that \isa{nz} is
 53.1624 +  the zero function. And in fact we have no problem proving this
 53.1625 +  property by induction.%
 53.1626 +\end{isamarkuptxt}%
 53.1627 +\isamarkuptrue%
 53.1628 +%
 53.1629 +\endisatagproof
 53.1630 +{\isafoldproof}%
 53.1631 +%
 53.1632 +\isadelimproof
 53.1633 +%
 53.1634 +\endisadelimproof
 53.1635 +\isacommand{lemma}\isamarkupfalse%
 53.1636 +\ nz{\isacharunderscore}is{\isacharunderscore}zero{\isacharcolon}\ {\isachardoublequoteopen}nz{\isacharunderscore}dom\ n\ {\isasymLongrightarrow}\ nz\ n\ {\isacharequal}\ {\isadigit{0}}{\isachardoublequoteclose}\isanewline
 53.1637 +%
 53.1638 +\isadelimproof
 53.1639 +\ \ %
 53.1640 +\endisadelimproof
 53.1641 +%
 53.1642 +\isatagproof
 53.1643 +\isacommand{by}\isamarkupfalse%
 53.1644 +\ {\isacharparenleft}induct\ rule{\isacharcolon}nz{\isachardot}pinduct{\isacharparenright}\ auto%
 53.1645 +\endisatagproof
 53.1646 +{\isafoldproof}%
 53.1647 +%
 53.1648 +\isadelimproof
 53.1649 +%
 53.1650 +\endisadelimproof
 53.1651 +%
 53.1652 +\begin{isamarkuptext}%
 53.1653 +We formulate this as a partial correctness lemma with the condition
 53.1654 +  \isa{nz{\isacharunderscore}dom\ n}. This allows us to prove it with the \isa{pinduct} rule before we have proved termination. With this lemma,
 53.1655 +  the termination proof works as expected:%
 53.1656 +\end{isamarkuptext}%
 53.1657 +\isamarkuptrue%
 53.1658 +\isacommand{termination}\isamarkupfalse%
 53.1659 +\isanewline
 53.1660 +%
 53.1661 +\isadelimproof
 53.1662 +\ \ %
 53.1663 +\endisadelimproof
 53.1664 +%
 53.1665 +\isatagproof
 53.1666 +\isacommand{by}\isamarkupfalse%
 53.1667 +\ {\isacharparenleft}relation\ {\isachardoublequoteopen}measure\ {\isacharparenleft}{\isasymlambda}n{\isachardot}\ n{\isacharparenright}{\isachardoublequoteclose}{\isacharparenright}\ {\isacharparenleft}auto\ simp{\isacharcolon}\ nz{\isacharunderscore}is{\isacharunderscore}zero{\isacharparenright}%
 53.1668 +\endisatagproof
 53.1669 +{\isafoldproof}%
 53.1670 +%
 53.1671 +\isadelimproof
 53.1672 +%
 53.1673 +\endisadelimproof
 53.1674 +%
 53.1675 +\begin{isamarkuptext}%
 53.1676 +As a general strategy, one should prove the statements needed for
 53.1677 +  termination as a partial property first. Then they can be used to do
 53.1678 +  the termination proof. This also works for less trivial
 53.1679 +  examples. Figure \ref{f91} defines the 91-function, a well-known
 53.1680 +  challenge problem due to John McCarthy, and proves its termination.%
 53.1681 +\end{isamarkuptext}%
 53.1682 +\isamarkuptrue%
 53.1683 +%
 53.1684 +\begin{figure}
 53.1685 +\hrule\vspace{6pt}
 53.1686 +\begin{minipage}{0.8\textwidth}
 53.1687 +\isabellestyle{it}
 53.1688 +\isastyle\isamarkuptrue
 53.1689 +\isacommand{function}\isamarkupfalse%
 53.1690 +\ f{\isadigit{9}}{\isadigit{1}}\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ nat{\isachardoublequoteclose}\isanewline
 53.1691 +\isakeyword{where}\isanewline
 53.1692 +\ \ {\isachardoublequoteopen}f{\isadigit{9}}{\isadigit{1}}\ n\ {\isacharequal}\ {\isacharparenleft}if\ {\isadigit{1}}{\isadigit{0}}{\isadigit{0}}\ {\isacharless}\ n\ then\ n\ {\isacharminus}\ {\isadigit{1}}{\isadigit{0}}\ else\ f{\isadigit{9}}{\isadigit{1}}\ {\isacharparenleft}f{\isadigit{9}}{\isadigit{1}}\ {\isacharparenleft}n\ {\isacharplus}\ {\isadigit{1}}{\isadigit{1}}{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}\isanewline
 53.1693 +%
 53.1694 +\isadelimproof
 53.1695 +%
 53.1696 +\endisadelimproof
 53.1697 +%
 53.1698 +\isatagproof
 53.1699 +\isacommand{by}\isamarkupfalse%
 53.1700 +\ pat{\isacharunderscore}completeness\ auto%
 53.1701 +\endisatagproof
 53.1702 +{\isafoldproof}%
 53.1703 +%
 53.1704 +\isadelimproof
 53.1705 +\isanewline
 53.1706 +%
 53.1707 +\endisadelimproof
 53.1708 +\isanewline
 53.1709 +\isacommand{lemma}\isamarkupfalse%
 53.1710 +\ f{\isadigit{9}}{\isadigit{1}}{\isacharunderscore}estimate{\isacharcolon}\ \isanewline
 53.1711 +\ \ \isakeyword{assumes}\ trm{\isacharcolon}\ {\isachardoublequoteopen}f{\isadigit{9}}{\isadigit{1}}{\isacharunderscore}dom\ n{\isachardoublequoteclose}\ \isanewline
 53.1712 +\ \ \isakeyword{shows}\ {\isachardoublequoteopen}n\ {\isacharless}\ f{\isadigit{9}}{\isadigit{1}}\ n\ {\isacharplus}\ {\isadigit{1}}{\isadigit{1}}{\isachardoublequoteclose}\isanewline
 53.1713 +%
 53.1714 +\isadelimproof
 53.1715 +%
 53.1716 +\endisadelimproof
 53.1717 +%
 53.1718 +\isatagproof
 53.1719 +\isacommand{using}\isamarkupfalse%
 53.1720 +\ trm\ \isacommand{by}\isamarkupfalse%
 53.1721 +\ induct\ auto%
 53.1722 +\endisatagproof
 53.1723 +{\isafoldproof}%
 53.1724 +%
 53.1725 +\isadelimproof
 53.1726 +\isanewline
 53.1727 +%
 53.1728 +\endisadelimproof
 53.1729 +\isanewline
 53.1730 +\isacommand{termination}\isamarkupfalse%
 53.1731 +\isanewline
 53.1732 +%
 53.1733 +\isadelimproof
 53.1734 +%
 53.1735 +\endisadelimproof
 53.1736 +%
 53.1737 +\isatagproof
 53.1738 +\isacommand{proof}\isamarkupfalse%
 53.1739 +\isanewline
 53.1740 +\ \ \isacommand{let}\isamarkupfalse%
 53.1741 +\ {\isacharquery}R\ {\isacharequal}\ {\isachardoublequoteopen}measure\ {\isacharparenleft}{\isasymlambda}x{\isachardot}\ {\isadigit{1}}{\isadigit{0}}{\isadigit{1}}\ {\isacharminus}\ x{\isacharparenright}{\isachardoublequoteclose}\isanewline
 53.1742 +\ \ \isacommand{show}\isamarkupfalse%
 53.1743 +\ {\isachardoublequoteopen}wf\ {\isacharquery}R{\isachardoublequoteclose}\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
 53.1744 +\isanewline
 53.1745 +\isanewline
 53.1746 +\ \ \isacommand{fix}\isamarkupfalse%
 53.1747 +\ n\ {\isacharcolon}{\isacharcolon}\ nat\ \isacommand{assume}\isamarkupfalse%
 53.1748 +\ {\isachardoublequoteopen}{\isasymnot}\ {\isadigit{1}}{\isadigit{0}}{\isadigit{0}}\ {\isacharless}\ n{\isachardoublequoteclose}\ %
 53.1749 +\isamarkupcmt{Assumptions for both calls%
 53.1750 +}
 53.1751 +\isanewline
 53.1752 +\isanewline
 53.1753 +\ \ \isacommand{thus}\isamarkupfalse%
 53.1754 +\ {\isachardoublequoteopen}{\isacharparenleft}n\ {\isacharplus}\ {\isadigit{1}}{\isadigit{1}}{\isacharcomma}\ n{\isacharparenright}\ {\isasymin}\ {\isacharquery}R{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
 53.1755 +\ simp\ %
 53.1756 +\isamarkupcmt{Inner call%
 53.1757 +}
 53.1758 +\isanewline
 53.1759 +\isanewline
 53.1760 +\ \ \isacommand{assume}\isamarkupfalse%
 53.1761 +\ inner{\isacharunderscore}trm{\isacharcolon}\ {\isachardoublequoteopen}f{\isadigit{9}}{\isadigit{1}}{\isacharunderscore}dom\ {\isacharparenleft}n\ {\isacharplus}\ {\isadigit{1}}{\isadigit{1}}{\isacharparenright}{\isachardoublequoteclose}\ %
 53.1762 +\isamarkupcmt{Outer call%
 53.1763 +}
 53.1764 +\isanewline
 53.1765 +\ \ \isacommand{with}\isamarkupfalse%
 53.1766 +\ f{\isadigit{9}}{\isadigit{1}}{\isacharunderscore}estimate\ \isacommand{have}\isamarkupfalse%
 53.1767 +\ {\isachardoublequoteopen}n\ {\isacharplus}\ {\isadigit{1}}{\isadigit{1}}\ {\isacharless}\ f{\isadigit{9}}{\isadigit{1}}\ {\isacharparenleft}n\ {\isacharplus}\ {\isadigit{1}}{\isadigit{1}}{\isacharparenright}\ {\isacharplus}\ {\isadigit{1}}{\isadigit{1}}{\isachardoublequoteclose}\ \isacommand{{\isachardot}}\isamarkupfalse%
 53.1768 +\isanewline
 53.1769 +\ \ \isacommand{with}\isamarkupfalse%
 53.1770 +\ {\isacharbackquoteopen}{\isasymnot}\ {\isadigit{1}}{\isadigit{0}}{\isadigit{0}}\ {\isacharless}\ n{\isacharbackquoteclose}\ \isacommand{show}\isamarkupfalse%
 53.1771 +\ {\isachardoublequoteopen}{\isacharparenleft}f{\isadigit{9}}{\isadigit{1}}\ {\isacharparenleft}n\ {\isacharplus}\ {\isadigit{1}}{\isadigit{1}}{\isacharparenright}{\isacharcomma}\ n{\isacharparenright}\ {\isasymin}\ {\isacharquery}R{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
 53.1772 +\ simp\isanewline
 53.1773 +\isacommand{qed}\isamarkupfalse%
 53.1774 +%
 53.1775 +\endisatagproof
 53.1776 +{\isafoldproof}%
 53.1777 +%
 53.1778 +\isadelimproof
 53.1779 +%
 53.1780 +\endisadelimproof
 53.1781 +%
 53.1782 +\isamarkupfalse\isabellestyle{tt}
 53.1783 +\end{minipage}
 53.1784 +\vspace{6pt}\hrule
 53.1785 +\caption{McCarthy's 91-function}\label{f91}
 53.1786 +\end{figure}
 53.1787 +%
 53.1788 +\isamarkupsection{Higher-Order Recursion%
 53.1789 +}
 53.1790 +\isamarkuptrue%
 53.1791 +%
 53.1792 +\begin{isamarkuptext}%
 53.1793 +Higher-order recursion occurs when recursive calls
 53.1794 +  are passed as arguments to higher-order combinators such as \isa{map}, \isa{filter} etc.
 53.1795 +  As an example, imagine a datatype of n-ary trees:%
 53.1796 +\end{isamarkuptext}%
 53.1797 +\isamarkuptrue%
 53.1798 +\isacommand{datatype}\isamarkupfalse%
 53.1799 +\ {\isacharprime}a\ tree\ {\isacharequal}\ \isanewline
 53.1800 +\ \ Leaf\ {\isacharprime}a\ \isanewline
 53.1801 +{\isacharbar}\ Branch\ {\isachardoublequoteopen}{\isacharprime}a\ tree\ list{\isachardoublequoteclose}%
 53.1802 +\begin{isamarkuptext}%
 53.1803 +\noindent We can define a function which swaps the left and right subtrees recursively, using the 
 53.1804 +  list functions \isa{rev} and \isa{map}:%
 53.1805 +\end{isamarkuptext}%
 53.1806 +\isamarkuptrue%
 53.1807 +\isacommand{fun}\isamarkupfalse%
 53.1808 +\ mirror\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a\ tree\ {\isasymRightarrow}\ {\isacharprime}a\ tree{\isachardoublequoteclose}\isanewline
 53.1809 +\isakeyword{where}\isanewline
 53.1810 +\ \ {\isachardoublequoteopen}mirror\ {\isacharparenleft}Leaf\ n{\isacharparenright}\ {\isacharequal}\ Leaf\ n{\isachardoublequoteclose}\isanewline
 53.1811 +{\isacharbar}\ {\isachardoublequoteopen}mirror\ {\isacharparenleft}Branch\ l{\isacharparenright}\ {\isacharequal}\ Branch\ {\isacharparenleft}rev\ {\isacharparenleft}map\ mirror\ l{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}%
 53.1812 +\begin{isamarkuptext}%
 53.1813 +Although the definition is accepted without problems, let us look at the termination proof:%
 53.1814 +\end{isamarkuptext}%
 53.1815 +\isamarkuptrue%
 53.1816 +\isacommand{termination}\isamarkupfalse%
 53.1817 +%
 53.1818 +\isadelimproof
 53.1819 +\ %
 53.1820 +\endisadelimproof
 53.1821 +%
 53.1822 +\isatagproof
 53.1823 +\isacommand{proof}\isamarkupfalse%
 53.1824 +%
 53.1825 +\begin{isamarkuptxt}%
 53.1826 +As usual, we have to give a wellfounded relation, such that the
 53.1827 +  arguments of the recursive calls get smaller. But what exactly are
 53.1828 +  the arguments of the recursive calls when mirror is given as an
 53.1829 +  argument to \isa{map}? Isabelle gives us the
 53.1830 +  subgoals
 53.1831 +
 53.1832 +  \begin{isabelle}%
 53.1833 +\ {\isadigit{1}}{\isachardot}\ wf\ {\isacharquery}R\isanewline
 53.1834 +\ {\isadigit{2}}{\isachardot}\ {\isasymAnd}l\ x{\isachardot}\ x\ {\isasymin}\ set\ l\ {\isasymLongrightarrow}\ {\isacharparenleft}x{\isacharcomma}\ Branch\ l{\isacharparenright}\ {\isasymin}\ {\isacharquery}R%
 53.1835 +\end{isabelle} 
 53.1836 +
 53.1837 +  So the system seems to know that \isa{map} only
 53.1838 +  applies the recursive call \isa{mirror} to elements
 53.1839 +  of \isa{l}, which is essential for the termination proof.
 53.1840 +
 53.1841 +  This knowledge about \isa{map} is encoded in so-called congruence rules,
 53.1842 +  which are special theorems known to the \cmd{function} command. The
 53.1843 +  rule for \isa{map} is
 53.1844 +
 53.1845 +  \begin{isabelle}%
 53.1846 +{\isasymlbrakk}{\isacharquery}xs\ {\isacharequal}\ {\isacharquery}ys{\isacharsemicolon}\ {\isasymAnd}x{\isachardot}\ x\ {\isasymin}\ set\ {\isacharquery}ys\ {\isasymLongrightarrow}\ {\isacharquery}f\ x\ {\isacharequal}\ {\isacharquery}g\ x{\isasymrbrakk}\ {\isasymLongrightarrow}\ map\ {\isacharquery}f\ {\isacharquery}xs\ {\isacharequal}\ map\ {\isacharquery}g\ {\isacharquery}ys%
 53.1847 +\end{isabelle}
 53.1848 +
 53.1849 +  You can read this in the following way: Two applications of \isa{map} are equal, if the list arguments are equal and the functions
 53.1850 +  coincide on the elements of the list. This means that for the value 
 53.1851 +  \isa{map\ f\ l} we only have to know how \isa{f} behaves on
 53.1852 +  the elements of \isa{l}.
 53.1853 +
 53.1854 +  Usually, one such congruence rule is
 53.1855 +  needed for each higher-order construct that is used when defining
 53.1856 +  new functions. In fact, even basic functions like \isa{If} and \isa{Let} are handled by this mechanism. The congruence
 53.1857 +  rule for \isa{If} states that the \isa{then} branch is only
 53.1858 +  relevant if the condition is true, and the \isa{else} branch only if it
 53.1859 +  is false:
 53.1860 +
 53.1861 +  \begin{isabelle}%
 53.1862 +{\isasymlbrakk}{\isacharquery}b\ {\isacharequal}\ {\isacharquery}c{\isacharsemicolon}\ {\isacharquery}c\ {\isasymLongrightarrow}\ {\isacharquery}x\ {\isacharequal}\ {\isacharquery}u{\isacharsemicolon}\ {\isasymnot}\ {\isacharquery}c\ {\isasymLongrightarrow}\ {\isacharquery}y\ {\isacharequal}\ {\isacharquery}v{\isasymrbrakk}\isanewline
 53.1863 +{\isasymLongrightarrow}\ {\isacharparenleft}if\ {\isacharquery}b\ then\ {\isacharquery}x\ else\ {\isacharquery}y{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}if\ {\isacharquery}c\ then\ {\isacharquery}u\ else\ {\isacharquery}v{\isacharparenright}%
 53.1864 +\end{isabelle}
 53.1865 +  
 53.1866 +  Congruence rules can be added to the
 53.1867 +  function package by giving them the \isa{fundef{\isacharunderscore}cong} attribute.
 53.1868 +
 53.1869 +  The constructs that are predefined in Isabelle, usually
 53.1870 +  come with the respective congruence rules.
 53.1871 +  But if you define your own higher-order functions, you may have to
 53.1872 +  state and prove the required congruence rules yourself, if you want to use your
 53.1873 +  functions in recursive definitions.%
 53.1874 +\end{isamarkuptxt}%
 53.1875 +\isamarkuptrue%
 53.1876 +%
 53.1877 +\endisatagproof
 53.1878 +{\isafoldproof}%
 53.1879 +%
 53.1880 +\isadelimproof
 53.1881 +%
 53.1882 +\endisadelimproof
 53.1883 +%
 53.1884 +\isamarkupsubsection{Congruence Rules and Evaluation Order%
 53.1885 +}
 53.1886 +\isamarkuptrue%
 53.1887 +%
 53.1888 +\begin{isamarkuptext}%
 53.1889 +Higher order logic differs from functional programming languages in
 53.1890 +  that it has no built-in notion of evaluation order. A program is
 53.1891 +  just a set of equations, and it is not specified how they must be
 53.1892 +  evaluated. 
 53.1893 +
 53.1894 +  However for the purpose of function definition, we must talk about
 53.1895 +  evaluation order implicitly, when we reason about termination.
 53.1896 +  Congruence rules express that a certain evaluation order is
 53.1897 +  consistent with the logical definition. 
 53.1898 +
 53.1899 +  Consider the following function.%
 53.1900 +\end{isamarkuptext}%
 53.1901 +\isamarkuptrue%
 53.1902 +\isacommand{function}\isamarkupfalse%
 53.1903 +\ f\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ bool{\isachardoublequoteclose}\isanewline
 53.1904 +\isakeyword{where}\isanewline
 53.1905 +\ \ {\isachardoublequoteopen}f\ n\ {\isacharequal}\ {\isacharparenleft}n\ {\isacharequal}\ {\isadigit{0}}\ {\isasymor}\ f\ {\isacharparenleft}n\ {\isacharminus}\ {\isadigit{1}}{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}%
 53.1906 +\isadelimproof
 53.1907 +%
 53.1908 +\endisadelimproof
 53.1909 +%
 53.1910 +\isatagproof
 53.1911 +%
 53.1912 +\endisatagproof
 53.1913 +{\isafoldproof}%
 53.1914 +%
 53.1915 +\isadelimproof
 53.1916 +%
 53.1917 +\endisadelimproof
 53.1918 +%
 53.1919 +\begin{isamarkuptext}%
 53.1920 +For this definition, the termination proof fails. The default configuration
 53.1921 +  specifies no congruence rule for disjunction. We have to add a
 53.1922 +  congruence rule that specifies left-to-right evaluation order:
 53.1923 +
 53.1924 +  \vspace{1ex}
 53.1925 +  \noindent \isa{{\isasymlbrakk}{\isacharquery}P\ {\isacharequal}\ {\isacharquery}P{\isacharprime}{\isacharsemicolon}\ {\isasymnot}\ {\isacharquery}P{\isacharprime}\ {\isasymLongrightarrow}\ {\isacharquery}Q\ {\isacharequal}\ {\isacharquery}Q{\isacharprime}{\isasymrbrakk}\ {\isasymLongrightarrow}\ {\isacharparenleft}{\isacharquery}P\ {\isasymor}\ {\isacharquery}Q{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}{\isacharquery}P{\isacharprime}\ {\isasymor}\ {\isacharquery}Q{\isacharprime}{\isacharparenright}}\hfill(\isa{disj{\isacharunderscore}cong})
 53.1926 +  \vspace{1ex}
 53.1927 +
 53.1928 +  Now the definition works without problems. Note how the termination
 53.1929 +  proof depends on the extra condition that we get from the congruence
 53.1930 +  rule.
 53.1931 +
 53.1932 +  However, as evaluation is not a hard-wired concept, we
 53.1933 +  could just turn everything around by declaring a different
 53.1934 +  congruence rule. Then we can make the reverse definition:%
 53.1935 +\end{isamarkuptext}%
 53.1936 +\isamarkuptrue%
 53.1937 +\isacommand{lemma}\isamarkupfalse%
 53.1938 +\ disj{\isacharunderscore}cong{\isadigit{2}}{\isacharbrackleft}fundef{\isacharunderscore}cong{\isacharbrackright}{\isacharcolon}\ \isanewline
 53.1939 +\ \ {\isachardoublequoteopen}{\isacharparenleft}{\isasymnot}\ Q{\isacharprime}\ {\isasymLongrightarrow}\ P\ {\isacharequal}\ P{\isacharprime}{\isacharparenright}\ {\isasymLongrightarrow}\ {\isacharparenleft}Q\ {\isacharequal}\ Q{\isacharprime}{\isacharparenright}\ {\isasymLongrightarrow}\ {\isacharparenleft}P\ {\isasymor}\ Q{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}P{\isacharprime}\ {\isasymor}\ Q{\isacharprime}{\isacharparenright}{\isachardoublequoteclose}\isanewline
 53.1940 +%
 53.1941 +\isadelimproof
 53.1942 +\ \ %
 53.1943 +\endisadelimproof
 53.1944 +%
 53.1945 +\isatagproof
 53.1946 +\isacommand{by}\isamarkupfalse%
 53.1947 +\ blast%
 53.1948 +\endisatagproof
 53.1949 +{\isafoldproof}%
 53.1950 +%
 53.1951 +\isadelimproof
 53.1952 +\isanewline
 53.1953 +%
 53.1954 +\endisadelimproof
 53.1955 +\isanewline
 53.1956 +\isacommand{fun}\isamarkupfalse%
 53.1957 +\ f{\isacharprime}\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ bool{\isachardoublequoteclose}\isanewline
 53.1958 +\isakeyword{where}\isanewline
 53.1959 +\ \ {\isachardoublequoteopen}f{\isacharprime}\ n\ {\isacharequal}\ {\isacharparenleft}f{\isacharprime}\ {\isacharparenleft}n\ {\isacharminus}\ {\isadigit{1}}{\isacharparenright}\ {\isasymor}\ n\ {\isacharequal}\ {\isadigit{0}}{\isacharparenright}{\isachardoublequoteclose}%
 53.1960 +\begin{isamarkuptext}%
 53.1961 +\noindent These examples show that, in general, there is no \qt{best} set of
 53.1962 +  congruence rules.
 53.1963 +
 53.1964 +  However, such tweaking should rarely be necessary in
 53.1965 +  practice, as most of the time, the default set of congruence rules
 53.1966 +  works well.%
 53.1967 +\end{isamarkuptext}%
 53.1968 +\isamarkuptrue%
 53.1969 +%
 53.1970 +\isadelimtheory
 53.1971 +%
 53.1972 +\endisadelimtheory
 53.1973 +%
 53.1974 +\isatagtheory
 53.1975 +\isacommand{end}\isamarkupfalse%
 53.1976 +%
 53.1977 +\endisatagtheory
 53.1978 +{\isafoldtheory}%
 53.1979 +%
 53.1980 +\isadelimtheory
 53.1981 +%
 53.1982 +\endisadelimtheory
 53.1983 +\isanewline
 53.1984 +\end{isabellebody}%
 53.1985 +%%% Local Variables:
 53.1986 +%%% mode: latex
 53.1987 +%%% TeX-master: "root"
 53.1988 +%%% End:
    54.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    54.2 +++ b/doc-src/Functions/Thy/document/session.tex	Tue Mar 03 11:00:51 2009 +0100
    54.3 @@ -0,0 +1,6 @@
    54.4 +\input{Functions.tex}
    54.5 +
    54.6 +%%% Local Variables:
    54.7 +%%% mode: latex
    54.8 +%%% TeX-master: "root"
    54.9 +%%% End:
    55.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    55.2 +++ b/doc-src/Functions/conclusion.tex	Tue Mar 03 11:00:51 2009 +0100
    55.3 @@ -0,0 +1,7 @@
    55.4 +\section{Conclusion}
    55.5 +
    55.6 +\fixme{}
    55.7 +
    55.8 +
    55.9 +
   55.10 +
    56.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    56.2 +++ b/doc-src/Functions/functions.tex	Tue Mar 03 11:00:51 2009 +0100
    56.3 @@ -0,0 +1,91 @@
    56.4 +
    56.5 +\documentclass[a4paper,fleqn]{article}
    56.6 +
    56.7 +\usepackage{latexsym,graphicx}
    56.8 +\usepackage[refpage]{nomencl}
    56.9 +\usepackage{../iman,../extra,../isar,../proof}
   56.10 +\usepackage{../isabelle,../isabellesym}
   56.11 +\usepackage{style}
   56.12 +\usepackage{mathpartir}
   56.13 +\usepackage{amsthm}
   56.14 +\usepackage{../pdfsetup}
   56.15 +
   56.16 +\newcommand{\cmd}[1]{\isacommand{#1}}
   56.17 +
   56.18 +\newcommand{\isasymINFIX}{\cmd{infix}}
   56.19 +\newcommand{\isasymLOCALE}{\cmd{locale}}
   56.20 +\newcommand{\isasymINCLUDES}{\cmd{includes}}
   56.21 +\newcommand{\isasymDATATYPE}{\cmd{datatype}}
   56.22 +\newcommand{\isasymAXCLASS}{\cmd{axclass}}
   56.23 +\newcommand{\isasymDEFINES}{\cmd{defines}}
   56.24 +\newcommand{\isasymNOTES}{\cmd{notes}}
   56.25 +\newcommand{\isasymCLASS}{\cmd{class}}
   56.26 +\newcommand{\isasymINSTANCE}{\cmd{instance}}
   56.27 +\newcommand{\isasymLEMMA}{\cmd{lemma}}
   56.28 +\newcommand{\isasymPROOF}{\cmd{proof}}
   56.29 +\newcommand{\isasymQED}{\cmd{qed}}
   56.30 +\newcommand{\isasymFIX}{\cmd{fix}}
   56.31 +\newcommand{\isasymASSUME}{\cmd{assume}}
   56.32 +\newcommand{\isasymSHOW}{\cmd{show}}
   56.33 +\newcommand{\isasymNOTE}{\cmd{note}}
   56.34 +\newcommand{\isasymCODEGEN}{\cmd{code\_gen}}
   56.35 +\newcommand{\isasymPRINTCODETHMS}{\cmd{print\_codethms}}
   56.36 +\newcommand{\isasymFUN}{\cmd{fun}}
   56.37 +\newcommand{\isasymFUNCTION}{\cmd{function}}
   56.38 +\newcommand{\isasymPRIMREC}{\cmd{primrec}}
   56.39 +\newcommand{\isasymRECDEF}{\cmd{recdef}}
   56.40 +
   56.41 +\newcommand{\qt}[1]{``#1''}
   56.42 +\newcommand{\qtt}[1]{"{}{#1}"{}}
   56.43 +\newcommand{\qn}[1]{\emph{#1}}
   56.44 +\newcommand{\strong}[1]{{\bfseries #1}}
   56.45 +\newcommand{\fixme}[1][!]{\strong{FIXME: #1}}
   56.46 +
   56.47 +\newtheorem{exercise}{Exercise}{\bf}{\itshape}
   56.48 +%\newtheorem*{thmstar}{Theorem}{\bf}{\itshape}
   56.49 +
   56.50 +\hyphenation{Isabelle}
   56.51 +\hyphenation{Isar}
   56.52 +
   56.53 +\isadroptag{theory}
   56.54 +\title{Defining Recursive Functions in Isabelle/HOL}
   56.55 +\author{Alexander Krauss}
   56.56 +
   56.57 +\isabellestyle{tt}
   56.58 +\renewcommand{\isastyletxt}{\isastyletext}% use same formatting for txt and text
   56.59 +
   56.60 +\begin{document}
   56.61 +
   56.62 +\date{\ \\}
   56.63 +\maketitle
   56.64 +
   56.65 +\begin{abstract}
   56.66 +  This tutorial describes the use of the new \emph{function} package,
   56.67 +	which provides general recursive function definitions for Isabelle/HOL.
   56.68 +	We start with very simple examples and then gradually move on to more
   56.69 +	advanced topics such as manual termination proofs, nested recursion,
   56.70 +	partiality, tail recursion and congruence rules.
   56.71 +\end{abstract}
   56.72 +
   56.73 +%\thispagestyle{empty}\clearpage
   56.74 +
   56.75 +%\pagenumbering{roman}
   56.76 +%\clearfirst
   56.77 +
   56.78 +\input{intro.tex}
   56.79 +\input{Thy/document/Functions.tex}
   56.80 +%\input{conclusion.tex}
   56.81 +
   56.82 +\begingroup
   56.83 +%\tocentry{\bibname}
   56.84 +\bibliographystyle{plain} \small\raggedright\frenchspacing
   56.85 +\bibliography{../manual}
   56.86 +\endgroup
   56.87 +
   56.88 +\end{document}
   56.89 +
   56.90 +
   56.91 +%%% Local Variables: 
   56.92 +%%% mode: latex
   56.93 +%%% TeX-master: t
   56.94 +%%% End: 
    57.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    57.2 +++ b/doc-src/Functions/intro.tex	Tue Mar 03 11:00:51 2009 +0100
    57.3 @@ -0,0 +1,55 @@
    57.4 +\section{Introduction}
    57.5 +
    57.6 +Starting from Isabelle 2007, new facilities for recursive
    57.7 +function definitions~\cite{krauss2006} are available. They provide
    57.8 +better support for general recursive definitions than previous
    57.9 +packages.  But despite all tool support, function definitions can
   57.10 +sometimes be a difficult thing. 
   57.11 +
   57.12 +This tutorial is an example-guided introduction to the practical use
   57.13 +of the package and related tools. It should help you get started with
   57.14 +defining functions quickly. For the more difficult definitions we will
   57.15 +discuss what problems can arise, and how they can be solved.
   57.16 +
   57.17 +We assume that you have mastered the fundamentals of Isabelle/HOL
   57.18 +and are able to write basic specifications and proofs. To start out
   57.19 +with Isabelle in general, consult the Isabelle/HOL tutorial
   57.20 +\cite{isa-tutorial}.
   57.21 +
   57.22 +
   57.23 +
   57.24 +\paragraph{Structure of this tutorial.}
   57.25 +Section 2 introduces the syntax and basic operation of the \cmd{fun}
   57.26 +command, which provides full automation with reasonable default
   57.27 +behavior.  The impatient reader can stop after that
   57.28 +section, and consult the remaining sections only when needed.
   57.29 +Section 3 introduces the more verbose \cmd{function} command which
   57.30 +gives fine-grained control. This form should be used
   57.31 +whenever the short form fails.
   57.32 +After that we discuss more specialized issues:
   57.33 +termination, mutual, nested and higher-order recursion, partiality, pattern matching
   57.34 +and others.
   57.35 +
   57.36 +
   57.37 +\paragraph{Some background.}
   57.38 +Following the LCF tradition, the package is realized as a definitional
   57.39 +extension: Recursive definitions are internally transformed into a
   57.40 +non-recursive form, such that the function can be defined using
   57.41 +standard definition facilities. Then the recursive specification is
   57.42 +derived from the primitive definition.  This is a complex task, but it
   57.43 +is fully automated and mostly transparent to the user. Definitional
   57.44 +extensions are valuable because they are conservative by construction:
   57.45 +The \qt{new} concept of general wellfounded recursion is completely reduced
   57.46 +to existing principles.
   57.47 +
   57.48 +
   57.49 +
   57.50 +
   57.51 +The new \cmd{function} command, and its short form \cmd{fun} have mostly
   57.52 +replaced the traditional \cmd{recdef} command \cite{slind-tfl}. They solve
   57.53 +a few of technical issues around \cmd{recdef}, and allow definitions
   57.54 +which were not previously possible.
   57.55 +
   57.56 +
   57.57 +
   57.58 +
    58.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    58.2 +++ b/doc-src/Functions/isabelle_isar.eps	Tue Mar 03 11:00:51 2009 +0100
    58.3 @@ -0,0 +1,6488 @@
    58.4 +%!PS-Adobe-2.0 EPSF-1.2
    58.5 +%%Title: isabelle_any
    58.6 +%%Creator: FreeHand 5.5
    58.7 +%%CreationDate: 24.09.1998 21:04 Uhr
    58.8 +%%BoundingBox: 0 0 202 178
    58.9 +%%FHPathName:MacSystem:Home:Markus:TUM:Isabelle Logo:export:isabelle_any
   58.10 +%ALDOriginalFile:MacSystem:Home:Markus:TUM:Isabelle Logo:export:isabelle_any
   58.11 +%ALDBoundingBox: -153 -386 442 456
   58.12 +%%FHPageNum:1
   58.13 +%%DocumentSuppliedResources: procset Altsys_header 4 0
   58.14 +%%ColorUsage: Color
   58.15 +%%DocumentProcessColors: Cyan Magenta Yellow Black
   58.16 +%%DocumentNeededResources: font Symbol
   58.17 +%%+ font ZapfHumanist601BT-Bold
   58.18 +%%DocumentFonts: Symbol
   58.19 +%%+ ZapfHumanist601BT-Bold
   58.20 +%%DocumentNeededFonts: Symbol
   58.21 +%%+ ZapfHumanist601BT-Bold
   58.22 +%%EndComments
   58.23 +%!PS-AdobeFont-1.0: ZapfHumanist601BT-Bold 003.001
   58.24 +%%CreationDate: Mon Jun 22 16:09:28 1992
   58.25 +%%VMusage: 35200 38400   
   58.26 +% Bitstream Type 1 Font Program
   58.27 +% Copyright 1990-1992 as an unpublished work by Bitstream Inc., Cambridge, MA.
   58.28 +% All rights reserved.
   58.29 +% Confidential and proprietary to Bitstream Inc.
   58.30 +% U.S. GOVERNMENT RESTRICTED RIGHTS
   58.31 +% This software typeface product is provided with RESTRICTED RIGHTS. Use,
   58.32 +% duplication or disclosure by the Government is subject to restrictions
   58.33 +% as set forth in the license agreement and in FAR 52.227-19 (c) (2) (May, 1987),
   58.34 +% when applicable, or the applicable provisions of the DOD FAR supplement
   58.35 +% 252.227-7013 subdivision (a) (15) (April, 1988) or subdivision (a) (17)
   58.36 +% (April, 1988).  Contractor/manufacturer is Bitstream Inc.,
   58.37 +% 215 First Street, Cambridge, MA 02142.
   58.38 +% Bitstream is a registered trademark of Bitstream Inc.
   58.39 +11 dict begin
   58.40 +/FontInfo 9 dict dup begin
   58.41 +  /version (003.001) readonly def
   58.42 +  /Notice (Copyright 1990-1992 as an unpublished work by Bitstream Inc.  All rights reserved.  Confidential.) readonly def
   58.43 +  /FullName (Zapf Humanist 601 Bold) readonly def
   58.44 +  /FamilyName (Zapf Humanist 601) readonly def
   58.45 +  /Weight (Bold) readonly def
   58.46 +  /ItalicAngle 0 def
   58.47 +  /isFixedPitch false def
   58.48 +  /UnderlinePosition -136 def
   58.49 +  /UnderlineThickness 85 def
   58.50 +end readonly def
   58.51 +/FontName /ZapfHumanist601BT-Bold def
   58.52 +/PaintType 0 def
   58.53 +/FontType 1 def
   58.54 +/FontMatrix [0.001 0 0 0.001 0 0] readonly def
   58.55 +/Encoding StandardEncoding def
   58.56 +/FontBBox {-167 -275 1170 962} readonly def
   58.57 +/UniqueID 15530396 def
   58.58 +currentdict end
   58.59 +currentfile eexec
   58.60 +a2951840838a4133839ca9d22e2b99f2b61c767cd675080aacfcb24e19cd
   58.61 +1336739bb64994c56737090b4cec92c9945ff0745ef7ffc61bb0a9a3b849
   58.62 +e7e98740e56c0b5af787559cc6956ab31e33cf8553d55c0b0e818ef5ec6b
   58.63 +f48162eac42e7380ca921dae1c82b38fd6bcf2001abb5d001a56157094cf
   58.64 +e27d8f4eac9693e88372d20358b47e0c3876558ebf757a1fbc5c1cddf62b
   58.65 +3c57bf727ef1c4879422c142a084d1c7462ac293e097fabe3a3ecfcd8271
   58.66 +f259833bac7912707218ec9a3063bf7385e02d8c1058ac06df00b33b8c01
   58.67 +8768b278010eb4dd58c7ba59321899741cb7215d8a55bee8d3398c887f02
   58.68 +e1f4869387f89141de693fcb429c7884c22dcdeddcaa62b7f5060249dfab
   58.69 +cfc351201f7d188b6ed68a228abda4d33b3d269ac09cde172bc045e67449
   58.70 +c0f25d224efbe8c9f9d2968a01edbfb039123c365ed0db58ad38aabe015b
   58.71 +8881191dd23092f6d53d5c1cd68ebd038e098d32cb24b433b7d5d89c28ee
   58.72 +05ea0b6070bb785a2974b5a160ee4cf8b6d8c73445d36720af0530441cd9
   58.73 +61bc0c367f1af1ec1c5ab7255ddda153c1868aba58cd5b44835535d85326
   58.74 +5d7fed5ff7118adb5d5b76cc3b72e5ff27e21eb857261b3afb7688fca12d
   58.75 +1663b0d8bdc1dd47a84b65b47d3e76d3b8fa8b319f17e1bb22b45a7482fd
   58.76 +f9ad1b6129e09ae47f15cd2447484cd2d64f59ab0f2f876c81e7d87ccdf9
   58.77 +005aa8fc093d02db51a075d571e925f2d309a1c535a1e59d34215c6cd33e
   58.78 +3c38997b4956461f376399901a8d0943dca6a335baac93fc8482c0659f04
   58.79 +329c6f040b35828ea6dd1bd1858f2a9be4ef77731b5b75a1c536c6bc9479
   58.80 +0821e5d88f6e2981835dbfd65ec254ebcf2cf49c917d121cd3bbb476a12b
   58.81 +69c15f17d9c17bb15ad1e7d31d2afcf58c8f0ad526d68615a0f1ac3b1d1c
   58.82 +d3beafeea3cf56c8f8a66367c70df9159f0b1b3157ccfd010045c4718e0e
   58.83 +625c0891e85790c9b97b85517c74c9d55eaca31a01cddc64898bf0eeadf3
   58.84 +53391a185e507dcb0a6f52661a56357ac818dfc740a540aadf02f4e7a79d
   58.85 +8008a77cd30abde337025b01217d6a68c306abe145b7260c3478fa5f366f
   58.86 +b2d37259ead8a8ec2db2f09ae0eb3a682d27b0d73a60935f80254c24426a
   58.87 +003a87a29a4370cbf1b2ef1e19ad8466ec725fd5b463d06011a5e0da2258
   58.88 +ff6c1483c4532bc21f2ed9b99b929b2800ddefc1a98d12ba085adc210bac
   58.89 +e0274b69e24d16af015a51ca73edf779a7534a887aa780337ad966839881
   58.90 +edc22ba72038aa1a96a6deba24ad676795da711b92f8cf5f54cb4322ec04
   58.91 +40ef9e15b11e3005f3ff69376ecb29bb66e8fc1b685f2b05fb162fcb35aa
   58.92 +d7eb2a8ec39b97ab1ff05ef02f8dbbc12085a5cd252cc4010fab7f63dfd5
   58.93 +7fa1be86f724d37db5faef17ae8e8e537444e8e9db917b270344183473af
   58.94 +7f47d5703a160d8ef1e772438620d3336b2fbcf6433612e4b5e64fae0329
   58.95 +8a3c4010c17d93f13ba66d549c69dd58c7d26ddc90285fed831918563a16
   58.96 +2a7ac2511e2f18c9eb3df905a9dcba65a31cc1c39f07458abb11b4c60346
   58.97 +aea19070e126982f1dde336e79be0ecd69a8afbe2493d064d4d2ff38788b
   58.98 +b3038125961302db9761403c3b8019ec641e107425002205a77ae2ae0f4f
   58.99 +7550d623dd03f0ec0199f42a9a8b89514e2e21baca9b3c8c96ca48cbf9dc
  58.100 +ee6d6241d713e014b49e83ad85e62a6b2f70b58e4cc72d41ea6fcbdd3b5c
  58.101 +890c8af0d24200658773b1628c6cc9aaaabb08865ee4c7ff2c513ad7aa23
  58.102 +155a321213fa94731683a3e282a0e60aa3c87aade3da231465bdd9097f2c
  58.103 +89a1af8e5b9649143f2d9482546501ea97e8bea2f5d5eea97d4f19bb6835
  58.104 +3138d3babb2461c08d537491aaede1f23d734c6f099eb5bef6e2ffaaf138
  58.105 +e5ab71b8b41599091037e440127a4eaedf208c20c8a2fc62eadab191d1ab
  58.106 +4d5531f826aa6b9fff2797a7f54673e0a3fae09a93a0dfafb8b11d60dc69
  58.107 +5acf9b7e1a47c31d0b5a0b85b7b50cddff5ac831651d9c7469c2139c7a89
  58.108 +7d2f868f36c65156921803eccfdbdd1618595ab6d2a9230ef523a1b5ee51
  58.109 +f2a0d200fc0e94aff7f546593ff2a3eb865d129895af01b8ab6e4616fe20
  58.110 +9123b6e2b7e0817adc3cdb78ae8b0b1d75f2986ebd8fb24c4de92ac9e8c3
  58.111 +6afa520636bcad2e6a03d11c268d97fa578561f6e7523e042c4cc73a0eac
  58.112 +7a841907450e83d8e7a8de4db5085f6e8b25dc85b59e018380f4b9523a7f
  58.113 +02cbeec989f0221b7681ec427519062b429dcd8fc2e4f81173519f88e2e4
  58.114 +3798b90a84060920f6ae789afd6a9182e7fec87cd2d4235d37a65c3f3bcc
  58.115 +c742c89cbe5f3e2ba6c4f40ebba162e12569d20684cc167685285a087e7a
  58.116 +0a995fe1939bf25c09553512ba2cf77ef21d2ef8da1c73ba6e5826f4099e
  58.117 +27d8bc7b3545fc592b75228e70127c15a382774357457cd4586d80dc0bd6
  58.118 +065aee32acfd5c0523303cece85a3dbf46853b917618c0330146f527c15b
  58.119 +dbb9f6526964368b2b8593eed1551dad75659565d54c6a0a52da7a8e366f
  58.120 +dd009ef853491c0fb995e19933cba1dbdc8902721c3ea6017ffdd5851cb8
  58.121 +3c8bada46075ac121afe13a70e87529e40693157adcc999ed4657e017adf
  58.122 +f7dbac4bc0d204f204c6f47b769aaf714f9ec1d25226f24d0a1b53e28ac5
  58.123 +374ab99755852c1431b2486df5fd637e2005a25303345a1c95a15a1189ba
  58.124 +f6f6883de1ad46d48427b137c2003d210ab2b2f5680f2633939f289d7553
  58.125 +eb943adf8127f1c3ee7d6453b5566393700ad74ab86eb9a89f8b0380af55
  58.126 +6b62f51b7dbd0c5dcc9a9fb658944d7ad5845d58dedc2d38200d0ef7cb0f
  58.127 +76041dc104ef3ab89c1dc2f6a75635d48051c8a7dd9f5e60253a53957ec8
  58.128 +9d1266566d7ed20d79dfc2807b397d7cf056bdaccdb72528a88aa4987682
  58.129 +c909b2fe1e35a71c2f29e89a2bf32173967e79610367ce4574ba6a1cc031
  58.130 +cfb176fc0313f74f91a866ef9954b95b29caf917a6b919586f54d23cb7ce
  58.131 +23305886ae7760ebd6263df0d3c511ac7afc361df78bc2621f66d3268b99
  58.132 +078fa59124f0eb9476496c938eb4584e87455dc6f2faa999e938460b31c6
  58.133 +28021c652acfa12d4556aa4302bbcd043e60389480b796c3fc0b2e51b81e
  58.134 +c2afa4a34335318a1c5a842dcaa120df414acba2e79ab5cc61c99e98108c
  58.135 +5cb907a96b30d731131782f9df79aabfc16a20ace8852d047497982e11c8
  58.136 +26321addf679de8a96a2d18743f6f2c3b2bc397370b10ad273fcfb76b48b
  58.137 +9dad27cf89ca2c370149cd48ab956e9bbce01cbf8e1f0c661b99cf19b36e
  58.138 +87b6165dd85ae3f3674525e17d85971093e110520d17f2d6253611e35ec9
  58.139 +e17000e48e2926454c1e8eb4098e0115b49536f2c33505eb5e574f7a414b
  58.140 +e176398c5ddf6d846ea5ddf2a5e94c0422e0115c57a8c9e56bf8ba962c82
  58.141 +698c96bd6138baaca7347e44352cc62df4eeba364954ad921a5a43280980
  58.142 +264df4a7fb29d005423179f7bd1d98b4280d62ce23c927551f1ffc2b8f17
  58.143 +0a9c23656c0c91b640cdcfdbd88089ffb28d3ac68bad25dbbed82c083696
  58.144 +1f9f86a6183cc1061ffdb32279796569d05b31c946955402d0be1fb9f2bf
  58.145 +304d1ad8e1e357be49e6e2ee67f7f1e7bc699d46a5f7853fe659ba2e1930
  58.146 +0d3e3ea658b9862701dcab08fdd23bf1d751777f25efbe9e02d12b5612b3
  58.147 +c3fc2275190346b94ec4024e4ade08e54d75c0b4c48f4956b9182e8ce997
  58.148 +74b54da4a9318c099d89f1ce3b6803a95f48b9fb8b845372be25e54478e8
  58.149 +49e4707ea03a36e134efa661e4e6250d89649ae074cfd9d6b9e2071c1099
  58.150 +3b8a5a5ebc3e1cb228c97565aef7f254e3f90af8a3dd281c83792755719d
  58.151 +c6a5b3bab4aa6be5afe9624050eee8dfb13b018f4088c932cd48ace38dfe
  58.152 +b1b4218dba8f7fada6628076acf1b54db0c95d4fb12232f1fa9d1ba848f9
  58.153 +fe80c65b75d6946c00fe78839142c5302707d9269b24565dbcc551aca060
  58.154 +b4d0f99b961dd3cc795a982063ac42e9fc81fc98add42744a9f92e74b00d
  58.155 +637ee4606ea2099b6c763493c3159f8e52a90dafca682010c0e92bc9038a
  58.156 +10abb066c75c8d97f7ad6fb1a37136e52cf2093c4fa485fe12adad10e4d0
  58.157 +83b78b023628ddc5326cbf8392516027a9f3de4945f93488e4a1997efd2a
  58.158 +22c2c136dbac1bdb829e082beac48cdd06dcb17bacf09451c7b636bd49a8
  58.159 +fc60cb1d2292250bea78e1dd276725ab4c526b66ddabf4e1b2bf0a2571df
  58.160 +2490df70735f5da321fac74fe4fab54444e53dace9832cff38a70c58104a
  58.161 +4f0c0545dcf7a1a9ecb54e0e32d6d8195d30b2c98a567741fcf325a4ddeb
  58.162 +244a1a35676e246ddc835fac13b569f35f22ec93191eca3efbe17ff9a950
  58.163 +d08f863710b2bbecec969068c498eb2338b68f3fc3f5447449fe4de2b065
  58.164 +e068ecd9255d369b2bb6c4b0b7423774bed69294758aca2bdb1a8d5bf618
  58.165 +d3fa09462f7838e8a79b7a53bebe6dacb0a1561eaa074bc6f069f6a06fb2
  58.166 +c4a5cb13e2172bce9be659a82665da5cded73da84322bb16aa6e19ac1958
  58.167 +7515cb5d2b65e65e803f76700ce5efd3df7fe4ed431fae0e8e286b1d5056
  58.168 +a0d18df926b2be7a93c503ab903abd4788680a6201fdc299f2cb5d6a9b6e
  58.169 +2048109c8d1fb633a54128938594b2cce86a7e0185e7d59e6536584039ec
  58.170 +9e30ff7be6ddba9fdba82de7415fdc47de84d97afb1aa3ba495bd91dee9d
  58.171 +f3b21ee1164987dd8510925087cd0919f1085cba6e4dd3c7384d26667f94
  58.172 +ad7f736a60d8bd76dfaa4b53c23536fc309ff2317c48ee0107ff2ca4d1b3
  58.173 +f78c5a27b901c931128bdb636094ef0cd543a5b62b7dbe10ed83aed5780c
  58.174 +a16067a4a7e8b7c5bf8a8e822149bc1b5bcdabe13a7f6aa6eaeff24a42f4
  58.175 +a58a2b70f545103540169137fda9abb589f734b6776cb50402d6123ce802
  58.176 +10dce05e3697a98c9411cf60a02c278c91e03d540b936cd00c668960e357
  58.177 +1aeaf4d94cfb496b259ec0d8fdba9199fb46634ff177bc8d310ea1314eef
  58.178 +d46c927a981c58e88743ed4e07d80fe841edee812e3053412bf2e710146c
  58.179 +b25dec8ea70c38bb1f6e4db3c2e8ba521963c1584eeb60ea1e9555058f13
  58.180 +e98307c13cbd15c26b611f543149b1ddf88dd6296ae703f58daeb67f1b03
  58.181 +ab5b24c72d5770cb9d8ed242c4faaad1dd940ada00e98ff3a61799d13355
  58.182 +aba916910aa9a6e5ee8af438d0ba8235346fcd139b9d2cb7db7bd3f298a3
  58.183 +94ff0aff3b9042f32a004e042c346a5ea35917f229848a9c5a32909b0090
  58.184 +4aa715640277a6ada99f8b2927fda22899ff1347f42bac73e2bd4bbf3945
  58.185 +55fd7dd30d5c6dadf5c259fdb2455d8c607de1c5da588e20159f18e4e8da
  58.186 +b714e532d888a0386c52c2b85964251af003ac9d10c0c8b9b3465e1dde48
  58.187 +2e74a29e17a7cf6c9a43b5af1646f0b8508f98e9a1279ec3908073d89dcb
  58.188 +aa093e8dd1004c1ecccce0803095b0069d4be7a1eb14b02efc37d137dfe3
  58.189 +f0190bc9628069abc257f45d0e050e60c7f5281277937dd986fcd5b94a2b
  58.190 +845a1a75addd74a142800f18ef408c08a2c2ad16a93298f148c0ae7d2990
  58.191 +ded147f92f053809a60d4f992a227167aad5b5eb2bbe8a4a77dc77a08b72
  58.192 +6acb34422e2532eec7e274e4a42d71ee584f5f3df5a3a5b379974ede73ab
  58.193 +5f1b0a2dbfcc8cfac4747ca26eb6030dc2f85a104b754432977850c093b9
  58.194 +97ed90af711b544ff682e7b1eac82b2b7b44014b09c17ecf084c994a095d
  58.195 +9eeef5391305caf093b62ac9916f982a436d521fcf4d75c5b8e4d92266fd
  58.196 +e99a58aa39d7693ecd1796b8851761d64bbca39a6d5a0b4533ae47123327
  58.197 +f98d0ad0e8b36625cc3647b55459552906d8a1d5766845ffac101980efcf
  58.198 +79657e365510be5db557cefef21193ca3cf3dad175ee2e7ae91d174fdc06
  58.199 +2ff5c51ffe2f021122e96df042019d3a1883e662537ec1b69c11fbb6e750
  58.200 +0132eabf5803c816153ecbff60ca3b3b39708c26cb1751afb2e65d8e5f4a
  58.201 +c4397a88fb1f112672fcdd24e4ba545c5b2a7968c17b62f8e2530a8acbff
  58.202 +cfca82c64b7abcab84e2c4a0a7ced67b15669301fe9ff2c756e70ff7ce33
  58.203 +497be6acc4ac5617e1f043bd8a87416299a39bf17fc31c02d72d75fdc2a1
  58.204 +e60669fa4d5e4a49d9afea2f53f4626680e9c0dfca223529efa415c4343a
  58.205 +b6067aa800c484457ea050eaaa5d3fafeedd0eec72f327e02c6b3912b5a8
  58.206 +c404de4839c9c4a99da42681cde43316606a34c7d2f02269de1aab776857
  58.207 +e668f35946af4d618d36d444bdc02b1f63ea25b6260b4fb606ac8575b5c9
  58.208 +782a5de4037350d5753b1537537ccb008c454eeb264e6cd4727c999e240e
  58.209 +0ac89e95a896b67d54910a3531345f64198ad394b5ceb52881f1dd9e6beb
  58.210 +95862dc188d45b3e46aacb5fe40097947dab9bc3c1ee46bfc9b1b3ed6167
  58.211 +efd0d65ceb043d7b24c1456676e4baa47b1209a315f199bb3a91f4374cd9
  58.212 +cc0b40d3f09f19f8dd8a46915eee55eeeeb3c7b8f437106ee491ef0f4ff9
  58.213 +2c5c6f779e0fbe7bd5293964bb645ca362b106abeb773571d9ae83b786a3
  58.214 +d5a4ea3ea970daadc46cc5e6037f76fd20e0fffc47cf4e7af9522b91f96b
  58.215 +3297720fd45d9bc2200622ad2ca9445556c8a8202b1991bc63da360d021d
  58.216 +55be2528e043f803e08da99b91ab9cfc5e65b2655d78206b4aecd445a7b0
  58.217 +1caa0d06b0a55e8f04b70b60b04a860c8e1ab439f4910051e3f7441b47c7
  58.218 +8aa3ab8519f181a9e833f3242fa58d02ed76bf0031f71f9def8484ecced8
  58.219 +b6e41aca56176b6b32a2443d12492c8a0f5ba8a3e227219dfd1dd23fcb48
  58.220 +fcfd255dbbf3e198874e607399db8d8498e719f00e9ed8bdd96c88817606
  58.221 +357a0063c23854e64ad4e59ddd5060845b2c4cddd00c40081458f8ee02c7
  58.222 +303c11747bd104440046bf2d09794fca2c4beb23ed1b66d9ccb9a4dd57ad
  58.223 +a24943461ecc00704c916bdc621bfddb17913dfb0f3513b65f3ab015786a
  58.224 +caa51ee9546bc8ddf87e2e104137e35ddf8f8d23724e9a53824169bc7cfa
  58.225 +99562656e6f1c888d4dbff0b269c5d1e733e5f212d91297610201eb43249
  58.226 +35e336dd0052738db2d64f3e89429903bb5c1810009cf766e9a06223dd2f
  58.227 +219b706394a121dc029af55c6ada9052af59682ef7c51e121cf16f0319ac
  58.228 +0aa9512ef900c548d673fe361da19052808797e958209072e145d46ec8cc
  58.229 +a89fafd76630eff30ae979973bdf0f8c9e469d8edd3b1c93731c72f976b7
  58.230 +d81142bc15c376403f967affaa5f482efd57c6f91970729d16db851f0ed3
  58.231 +ea7d82f409307b5b436886c1beda94a1fa3ab1b60686f6574c844fb2c0b3
  58.232 +a07174dc4f27b4fed2f8bd4d5436be4b343e5efdf0400d235bd910255341
  58.233 +a20770804a26f8437e9bce6da8e9f8258a343c7aee291f1510be306ae67a
  58.234 +ab1d7696453530c02fd153bbe49dbf62baad6146029cbd1656cdb76c952c
  58.235 +b93edfee76fe33832930be59636bb947e8ad285f20f663cccf484fba97d6
  58.236 +7446c7b6c6f5857428bb1737d9ae801df75d9cb4d7bd59ef7a4cbadde928
  58.237 +38f15d232005585d2e40483d2d3e08cc8f398bb43afedb84343c3ba3835d
  58.238 +0ba82a86dce859cf655f85e63e41365e0dbefcf511b9a27a2b6e66b2ad3a
  58.239 +c657902842287a317e46ceaa93b5088f09d53a65815b44538af90ad3b06b
  58.240 +4e5e2dc509f02e30a01e05201c67d4d39582bbe64e20b669f5fd787909a3
  58.241 +30fc50a95b31426bbb57a4fbf9feacdc31f98bcf50da7e50c2bfc169c6fd
  58.242 +ccf213cdb878653bcea372968ea6e31fd30dd55434cc91c0af22179ce669
  58.243 +a05493f195e12432c6173ae2ac3c94fb83f38210014a9f969ea2b44e99f5
  58.244 +e5a7317e848d429ad62167a4fc5001149676c0c28cdf59b8d1c5a582f516
  58.245 +3eee855312777fee6dacbf993f5c058f355dbde6552dc960d336eee445dd
  58.246 +11d53fd21b745d1e5ec317efbbef25e070d0a36797a6081c356ac2328e64
  58.247 +e5c55fbc81dc75d9c1575548ece74b8307eef485aa8e28859a2e0435c831
  58.248 +23a600efb323c362fe9f02407a5411c41a69566cd50add324b63ab939980
  58.249 +b9d7a929ae4887163cfa7acbfc9fabaab8987a1f6906b9881491cd055b94
  58.250 +485c968479dbb05b34ed0cd6844729a692978c6928c3392e33e8324ded88
  58.251 +814cacdac8128e1425c0091a13558100d7cdbed5992795d94d39c32f32dc
  58.252 +621ab6f3b75187a66741f61d6a9c91d791b1cfc3d0e94d4a76302e0c3f2e
  58.253 +cbdc51f14f3251aa5c8bb989f0e13ee500b7b7f2f1e52ca970ad8a7b4b99
  58.254 +57e93126254297380d67179deb8ff1e99d5cdf7a35c5bb9fa7b402e63234
  58.255 +78640344e1f10c378ad23c5cd1aa18e1e0b308db70d3a624a455f8e291a2
  58.256 +ee102ad10776208c2d546cb76d89ca8103a8b95f8acc2d2bdc9791324915
  58.257 +6c9e05429091071f0c5b76d82c8d1c8a69d840fd460922cd2090624bc218
  58.258 +0c9391005926a25042a55e322060807363462e1cdeab309033124ba3a884
  58.259 +1db13f39edae04ec52cde9dbde64ddda1ad805141d4230ec76bd81fd98d7
  58.260 +0d90fa1aaa26ea551bf687ddd6cdcf3de5a446b266c68434f07d9c0b382d
  58.261 +5816c4e22f22cc03ff78064c6dffb12315c6bcbbf5dc510f5aaabf23471a
  58.262 +234efceeb4aa2f9af9ea787c014c5587ef162fc5b35e8f4c23b168c6e247
  58.263 +41d33dcc11d2a56d3ba9d8eed6e79aebf9f0faf1a3aeb89d792d69041f0b
  58.264 +b8fadfc0aa090effc6ae5e2f13cdbf54b5bed69b039eef2627769613b6f1
  58.265 +aefe9b66747fe8feaf7455796740f411a770d4a1764f0483719584880f45
  58.266 +430e38d3af184145892a08b2add234a3f3ee4ccfc9f6995c02392adafccd
  58.267 +722f366d748cfe9373fbf5f878ed47e9d221fd156bb28369df9e7d2b79da
  58.268 +76120d135ebaf36cff93beb7e313c2b2de7477176fc19609a1b906c995cd
  58.269 +defef08899265b6b8aefb44da1aadefd1c523dce5ca1b84c0c652b3009fd
  58.270 +057789892d4d31764f181754b2e0a62c465587585509989a219711a5e4e2
  58.271 +5b3b340ca8fdd3f04fef204b1b722b2f6c2ccb00c3cf1a94ba9bdfbfeda9
  58.272 +e2a062c6f1ced3b8aae5dae32ade1fca1001f98d0ad0e8b36625cc3647b5
  58.273 +5459552906d8a788eb8bc734ccb65fe9582c71df94fd95d22c5323de235c
  58.274 +28220fb9a2ccb37362174d8cd5922c9e5a87b51d0668555100a33e33750e
  58.275 +f1f795cbed962494a994be7ce8cf71fc58ff4204551b1615ed27cf088171
  58.276 +fd000b72462b67935961e7c6c3a05bfd67b9ba094ea2c16fdf486da912e1
  58.277 +e97bfd1c17934535e551cede20c001b5d2adb2be4cbad7d6ba0bdeae4b1a
  58.278 +a739f90293e67ecbdeea4d35825e092697fb05b215083e3f3d6be260790e
  58.279 +2a175fd44eb1c4c16759504827a6eb58a838c4d65fec6eef108495577019
  58.280 +15740cac164111892e8d1cc447cd208e243a89ab847d8ebf4fb98bff49e7
  58.281 +a3453facf3b0e8cb67590f390173ddba68324531d2e426aed152e12301d7
  58.282 +538c1f3c0048a9cc00c009a1a9138460082123209c1e007266fbf236eb72
  58.283 +21f87d4ca38a0b699e84ca230ffb5095f90a6528bf2a9118f95ac9ab8d2d
  58.284 +ed9eed9b8b27be894b717469758c8d94fa89acc64f530f432d0e5f16c922
  58.285 +36d6a63410f099c9e909450fd731d698ef658d8ffc1de14817b850814f68
  58.286 +1a4a9be5cc7a71c381974c249f0b209bfdc2e97f9540c96f57bb4d283622
  58.287 +00969b82011315289e6a025b137030a0af3b4b42b00fed7cec49df43c59e
  58.288 +3b2495a036dd1b17a8e6adae63bfbbd48807c44b5bbf71813355e1b0e58e
  58.289 +22b6fb88005fc55565be49c17244901b73ef02fc4eb7669be5af22d89c0d
  58.290 +dff0fc6821d810d13e5821d48d4a71d7e463d5b60bc279d0dcf5f8da3a95
  58.291 +905b56d6f2be95e6d4243b1048e3b662e62401ffaa3bc3f5f90b0854b8a3
  58.292 +8c38039f61fcb359b06bbb7d59e3b39a295dccd6db9a8b83a6f64ef8dc94
  58.293 +a77123dd164cfd1c46f1ee51aa19c3d6e7db92a298d10159f2b5eff2caf9
  58.294 +dc93a6d267fb65bd900d6adf0c6be598050b6d3a9b3a322ab3c9e880d774
  58.295 +1f58016ff97e5f606b5dbd72ba99252c669209bb556dd5be84fdd7c1ce92
  58.296 +8a3b3d3aab8d37e6b740227563bb4d60f6bb04052356e1a48d2079feca44
  58.297 +7ea17fd06f208426d045dee660d1d6460455f8d20dbc5ae64550bbdf60d7
  58.298 +27d96cc9afef842a8c8c78ea2257e6c6d0d207c80cfe399e8874c693274e
  58.299 +d2c2022d303ca50a70624b07434fb85040a76a823f446c7454dab4f9c05f
  58.300 +10274eb5ba164aa3649d1bc90694316ba5cb3e7df4442e777124cff7ebef
  58.301 +53df2320a0c441ab61666493cb43da46d5711c21699de85bc74359444da2
  58.302 +e3e397d4c16234f81531505b621aa242a6698886f82b447104b1f1062f60
  58.303 +b5c87cea9151bb3c627bfa4532b06fd147c556ed8d61ae30a8719dfb8705
  58.304 +f8a6c74368381403640cc57026d3790c49e2bbd1c0e48285ec6ba44de678
  58.305 +e3a1394d659c412f09644b83ee1a333a1f51ad8deb4e6d77b3b226ac2c4f
  58.306 +fe653411a7976ae7c4a3cb7df309788da6b483f8a7bab4a6990db74362f5
  58.307 +bc41d545a320389b2599fd726e426ed9fa2916ece67b058f6a269544e517
  58.308 +128bda38d117f402409d0d8f8c88ed509aa2ba882e0c579b45af4be80770
  58.309 +22d7269684eaf0f9afc3054316da6611e3fd260d67fb6fe52c9ade5dda24
  58.310 +a0050a819ed21342aac9d25194778beb3145f56a66980f620998923521ea
  58.311 +3f957b6ed0c5470734af9f416a16427dd03eff9a0e023452097d4ef936d5
  58.312 +49a90823cef6de340a1ee02a52851b310cbcf41ae274947a62f9d1d8702a
  58.313 +669023e3caf967204a340694b45fecbda4bf9552f6bdc62d43b3b2c3d571
  58.314 +9983c182453e22ee34241ab908e667115f7988174684cd70084aefc55caa
  58.315 +f5352a88e9dac45d1ea0e032af61fe9a9118a3931b2050fc6db66ab96a39
  58.316 +74353b597f34dfd9f72150de23285eda5e555a607d198c291965a7233715
  58.317 +3f4946a57af0b440ff8567b01a6f46c6d32fea5f8bf57d89dccbab7da882
  58.318 +ee6c9260e89443b1d7db099477492bd0468850df3db668d741123e7ebe3d
  58.319 +c21748ab4c5cbeb5de33b8963aecafe76bba0c4f6ed8e8263a116ed85e58
  58.320 +fb71ec4ab0071301be7c7d3afd5fa6ad46c0232807bb7fe129e44bfd16e9
  58.321 +fd0c8bb5e7cdd86a78b5fb0669093c22eda9151d85b6f58a9c8ead3727c0
  58.322 +09850bd31a8b4a873d0a506240bb2aeccb8dcb6369532f21d9b967aa8443
  58.323 +fd6d77cb2d65c4678a5fad188db85940f0a187aa1031dcf5b8e0d0cbfb6d
  58.324 +b3b96fedec5b249b7a69de9b42dfa605bd622de7a220cce9b66e9f3394d6
  58.325 +13487dc5e82c1e619079cd057b1e19ac05ebdfd7c8bf01c6c66fab49e0b6
  58.326 +613df9e42beae2f7b9407a2bff8896d8035cea0fd5c11bc5889cb3d90876
  58.327 +61766138d2625f42d0244adca65d1bc73989328c0eea0b97c7c766285ab3
  58.328 +351ce2b183f774488a8806c33178090a3808f0ce5e339b87cf7add933301
  58.329 +ca486742831ca751f0626864ce13172829a8419af5c78794a0eaa17b5bcd
  58.330 +fcb684f7d4bb7af15deb432e44dc7dedf56eb8bea08b46f1e8123a49a349
  58.331 +a7cbccf833a528f5e22d2d463040e09b91e543a2f33077b3e7b9ecc64f14
  58.332 +306186cdae1fc317a6ced7e9b4d51a10bbbcf2fadff876b4d9082e3f4aef
  58.333 +dfef230e4232572f4fa33a6e065f6895aa2ea96c5659cb579b023179f0fe
  58.334 +de7ba64bbd9362a7b2b8c4eaec254915629e81d01c839096339b99bc9e25
  58.335 +84536955feaa52fa20666f65bafd9b2e69c3e8c15d24fa407e7d881679b1
  58.336 +789a0e2a695d13553c92c0214c9b7562cd6a9a3d77c8b0c2196cef76dc51
  58.337 +d855c1dac37f96eae4cc7bf07e17dc7c08333d7af33c8b2965ea1f23446b
  58.338 +3c96c52b30ea628ad572694d145b58a606f90b278290297aa372cff56b6f
  58.339 +56f4aad6612eb7c7bd07db4f7d1a70d8044d16d0b5c1605ee02a852ffdb4
  58.340 +450147b3f9b87d72dc431b34fcdc899462dcc1b6bb6ab1758b6a589e91e5
  58.341 +8f5196251d00133b43749b7a11fb67a22664c5e38e336dbdeb5509c2d9d6
  58.342 +2642c07275949df0e2db59314ae0fb34641fc171d3fe1289f919136d853c
  58.343 +d9048ee9db50c699c49e27a8df199590bbc65b23b55bb387eed0c73f2db5
  58.344 +1cb091f8c22af83103f214199e371f7de1df23f757817200be30610004df
  58.345 +81fe8ed6eba79e856fca21a126ca326ad2f313c16e15754663ad6a065e08
  58.346 +4050ff005fc899d6e233691b918a093b5f1ffda8839ab23ae66b1bb7b953
  58.347 +0a7f896ec55de6fb9faf1b49656ff2e57488cd7f1c44114c75f9d571461f
  58.348 +767a6040ffa14e9fb43096f164d60ca530d7cca76d526d1999ac1b52a793
  58.349 +28651112a65db1f2564ecf90ea6bf2c9ecf515640719c3fb5e36cfc58591
  58.350 +e227793f39b9d3a9025cb10f324a95c29c488724aa74812366ff0b118fc7
  58.351 +19f9fd0f202a040be47ec99b46b4dfc3d2a17902a5779c8d52b27231a1bb
  58.352 +5cd794c838daddc3e6824ca8297ba669a818c239b389400faf17aa04b802
  58.353 +f763029edb9784dfdc42f223e6496a938e613463bf9bbbd59d63300a9ad7
  58.354 +4e71865cac4b4e81a5864388c3886e70799c8989188341f7d17cb514cd99
  58.355 +3b211883f171ec6402cc361885f4f4b110757bb3e52941a94bfaebb2faa0
  58.356 +3e32eb72e25e31abdde82c2a9015478afa0f434ae3f8b97a4bef598d6eda
  58.357 +44ffe1915c26ee0e8339d2d45a6a080550f538ded5542c8b96ca2f596979
  58.358 +8bb6223e460e857516ab5a3323136ee8fc4b0556a7c39d0cf7acb45e48be
  58.359 +4ae9db325e4750b73289e36a61b301795bdb2ca2a8b933be1c09fd0cd2cb
  58.360 +8677df171d36ef1519a2269b21e4103b2ee151c513df3e10b2a216d6fb22
  58.361 +18bf2005fa7e0f0563ad96661a7f55e1b5b991f8ca285651b2683c6a7c9d
  58.362 +2d1941374989b06f2e9b42a6af60193dc758dd8e9fcfc7c1aa06eab47e81
  58.363 +bd79660666defac0c6b9e484df9c17a61ce7a61ef73150e8cd406af6da17
  58.364 +4d9c2392cc420eddda40f975ffbeacad8ce1b4e14bee29ba8552ff03376f
  58.365 +c034784b38dc1d0ab7bc53943d2545b03d39797af8d58d6dffce56a353d9
  58.366 +bebc833f04db321ca8642bbb7fcc63ed2349ffa08a33a5d0d78f4fd2c5ea
  58.367 +4258e4671e362036f1f67fcef9d878ae2c203fd9c05200c59cc98633e65a
  58.368 +99d912ec51d6f74500d5358b70e799a6817f59adfc43365d7bba1fd6766c
  58.369 +5c8e76248daf3f01e7a8950fe875d657397797a45e7f99a92887300b6806
  58.370 +b86db61e03c4c09d6cf507800aeead874a94e6f665746752937214302045
  58.371 +0b19cfa8db69230517183a03a16e5503882ea1e419c333d3e3b73cef6762
  58.372 +873ac06bec34c3f736494483442619f5bbadd86f128a5a40b854051893ea
  58.373 +8d31dd6656777ad4ac2572d17c6fb21385b053495d1270e65d78334a4115
  58.374 +2787ea89b86f97e72718905a11e9c5664837701a3c1c65ccaf26aebe8dab
  58.375 +c1207d5da2079c37883d9235708f370203b3b2a8ec3a5bb35fab93dae115
  58.376 +aef626dc44b67ca56fac18caf1c22e6fbab93564829a75776630b9c42513
  58.377 +721ca0fbb0b402f4d1db8f701d2b29fa60162feaa8a167eb3113c6f57036
  58.378 +e8361357913eb24dd38dc6d3bf4c3176a07ffc75cecf8e5940a310f79a8e
  58.379 +f590844383d631796ade04a91144d073a9413cff34fb454f1fd75cfbe5e6
  58.380 +525c3bd36ddab80138f6c19aad7417d47df1f1e0fc958fb190a8205b5321
  58.381 +7c43a4dcb0599be404473d6faebe7240dc402a0e0caa21b56a601b154524
  58.382 +f44988e5074c71ae8e1948bb2a2ce72fc24cf3b1813cf7408a6b097aff22
  58.383 +f9d285134d09b7053464259531eb7b270cd5f39f81bbf41a36420f61e5f6
  58.384 +b429036bbf20e27af1a437becd74c5bbc25ee2519402454fc94d430636e1
  58.385 +736fe65a643d9b9d21c9a54eac5a8fed51ff60a47b85a0e9423e330e00cf
  58.386 +220c23e056d20aec2fca3e6bc7a61a8366eb940c9bc99fb90e8704e27655
  58.387 +20335a983eccc7e20b13745c4b4f30a842f1ba64745718c152697c688c73
  58.388 +6cffcf5cc8eb5756201560413117a45ad3d264291cd51404f98448d31474
  58.389 +d47d17d201def12867ba679f0e2605de8f3e8135ed0234890cffa68848f0
  58.390 +6de427741b34c2ea654251ae8450a152538eb806ace3ecfe86d8c4a137ec
  58.391 +c98c6d6cbdc191a5f8f5b5972c70b4896960037b6d4c7c63586a52d5eb59
  58.392 +47af8c192eb980d0801fa670bb1d08740819f9da1dd9e153010bf9580a1d
  58.393 +0925d8327ea1b88db8d934f40266ddf93e5ea137f267847d826cd7999b33
  58.394 +c795d0ac05abe2ec1770dd98eea67912f1939118defc9b379e237d6477bc
  58.395 +91ad08e0046b0836fafa1272b0213dce990c90815f5b30d0eb103ac9539c
  58.396 +2f7bd2280264cd95b4be84cbc5139a7628ed211905dcb92cbc3180ac9e6b
  58.397 +b9ecc3cb08608b2395827d5729781dea49d328ba0c1b4cf2cec9f6bbc822
  58.398 +1f2bbbb9d88f9e7682b9ecc06b9705faa8a90a51678183db1e24cc2c4307
  58.399 +e16b3c20f08f179ec69df7a8c4261427f5886f9179c493bf2d0ef36640d7
  58.400 +79925585724aba69df6d1b4f0bd2a356eedfd74a88bea667b102420c2300
  58.401 +ec420e99b9ce8be1472b617e1255a7f43a0b52f11657f1a4dbb624a24886
  58.402 +9604fe2062b98f5787d010723e520a4f42a0c3943e151ee627f3d5db90e0
  58.403 +7747e1a88a53c4784c8d2b042b9c23c9e436d7d88343171161a364cd8961
  58.404 +37a19582a00d774ef01c7c3fc9e9c7be5074c858d2bacd707a6a4f322027
  58.405 +137d6ca0421ed9f9c7e7229e867678e5272cfc7156a419e893404ad7dabf
  58.406 +a5d8b6fd0787cb4fe1a901c34dd931f1b64f0c470ff807005fb66350d0ea
  58.407 +eb84ebef2c2399cd14a4454ea5004bddd99988b39c4134b92121ec77faee
  58.408 +55cc716eecc58b594b39c41dcab308efa4458ed71943ec5805dcd0194ddc
  58.409 +1ba04a5d3d42d07ac62a907ea25cd2a7e77aba470324d41dc1a3fe088388
  58.410 +787b3312f472cb4f23a414fa5f7c7a0cc5d121d7642b5b3f0cf7ca2173af
  58.411 +3f878f374938251feb3ce5ddd2d7703fc79a130978ac516daf70ae903799
  58.412 +28bea3a4296f48725d578d2e8fb0f932e398404fa8a242024bc011c0ae81
  58.413 +7b92bb104712253a5d89c543a744332069e33ca08bd133211d233ef799f2
  58.414 +fed6a20a9073021e505def8b79e1279dacc062cfd4dddc2e8e0a7fda5dd6
  58.415 +bb5a745f99cccb7ec1df532308da3da0f236c74639c280ea649b2f7ec27d
  58.416 +24221470b642567f3b2e1cd0b3ffa65c5ac986b557aa9b444bf470380435
  58.417 +abae9b51c6da7ff753810ca7938d8a1c47d2b41fafd236cb5998f3ef365e
  58.418 +1f700bb257679ba3a82e235a3e97a667a6ad94412839c96dcd49dd86ccbb
  58.419 +6df8ad01756b311e9fd57ccd2eb2f19f035e214804e2b77769319a5389c2
  58.420 +35f3ca2a73c616c9ef0984abcba167d7d652b330c68f4f6378aba69628b4
  58.421 +2d59eaa2a7e4c782f6eb96f6758d17d35650b15cb5de9bf973b3b6f67c1d
  58.422 +f3285be8322fc2b44359640a3ba5d6d7b96142583a00a9a0ef84fbf14046
  58.423 +09ad55b2aefe8c5c8f58ed21623bf765f81dbb6cca6d2a51fb7730a14839
  58.424 +392cad6b47f5e03448350ab36a37d9ff2b9dab69be5196511072b10cc91f
  58.425 +2e6b5160b2b1bd112e6c02d14063a9bb46977b0d4bc79b921fd942f916c9
  58.426 +c5708e0d133c8309de2f6ee0b1afc996c889c36de20fbbbfd32878f477cd
  58.427 +7735c7c3fa59e9c46e654ea20b4381d9f6c6431082e6918d532bcd539284
  58.428 +af0333a783c9e7fd4fa1e4da5ce8fea2ea4037644a24532d65fa5c1ee982
  58.429 +89e4b9abaf71a35d308a9b8c337f70babc5fc8dbb0327143707ca5b675c5
  58.430 +2d3cf09f7a4f667fcda03d8c82d157e661517787ce6bfb35ea772de13c66
  58.431 +2bd24b74ff9ab0fbcf6635d8e06b54b5b3125d17ae13d175cb7922338ec8
  58.432 +9d1159fea2110995ce48f7d2b094f06d11d59b3a64a44a83d48c78855e47
  58.433 +21243e82d9858401b094a236fa0a90d61863931c30d13b9bf33a35ac0d11
  58.434 +a999f2b4dfba6fc187f8c235a5217d777a5a97112e7db6a8a4b06b07d9c9
  58.435 +f41820e233c8b58b9e47ac56ad1ddcc0b35dd03976bc776c6ac3692ec0ca
  58.436 +f8c75ea7825bc84156468ca7b269d890ec9d4a365b0b31d2f6530185d5e0
  58.437 +2acc3ce14eea55ebb5667067825a8682e135d23c78863d32065ddcf1a755
  58.438 +e0de6dea7220d1a28416b96db40b1e9f159aeb070c9a9515f301f162b0cf
  58.439 +e32c6c89287de6e2b40458e3393826189a10af8517ff5a10c41c9d05d999
  58.440 +aa9305a2ee8e7fe46076bc9c5722ee0a140a144ae383e84a8abe70af5d29
  58.441 +96a0a896cd499caa0ed7867e7c3aac563763216e7769d12218b584d853ec
  58.442 +01db93ca22d0c8d6b286b20b6b26d6ef19f2cebe7030ecaa68d069fac7a0
  58.443 +09d61770b5e8f83024a99142f59d88297cb8d093992c3c6c11b043b151e8
  58.444 +20df640407d8bc829bfc196bf2901e63c6f16102d03ffb7c54a7a560f5f9
  58.445 +5cf8379f4a2eccdcb604bd553e6157b4381940d1b3c768dbfbf2618812f5
  58.446 +7fbe744b3d8ad680dd9223d8bf2412ecbb614d05b485e3b4669d22b417f5
  58.447 +02cce2d705c208b15fa83b5be77ccfc1c840f385a58ae49fbe6ab4e53912
  58.448 +473630e0cfecefab95ebc632a2b10a2103bfe801ca0302542080cfb4cf4d
  58.449 +4c241b1a6c8d28114516e3f1bf39dc02db73e6d9a797279acfd79b02a71b
  58.450 +ae34860dd0e11b18954129f8dd57c039bb7063a4c92f0f6a1e25f4ae59d6
  58.451 +6c1cc6b73a79d6a56f7f2a8a64d571caa8a760f4f485d770d000ddf393ba
  58.452 +784bb27b781c47678dd78ae9b5d5e8b57d163c42c7a55e4aae22061686bf
  58.453 +aebcede728ff2f65e75955585208c176d100912836b5200a79062d4f09b1
  58.454 +ba9465b0e937e289160ec543a4cedbbe0cdb5ecfbb4838138ee9e1ac757d
  58.455 +3c5f04fb6b510b389e2f521759e403bfc8ec6bd79e2d40bdd81901c10dd7
  58.456 +4620acaac9108940daf03af23f09d3c8b785db562b05e597056406557857
  58.457 +e96fc8bea53c2c2ccd0ea6572abb0acacfe29e737173d665ab6dc2995f60
  58.458 +807aaa4073a183aed23c26c67eb137c937999fafc63b66a021125e4ee5c1
  58.459 +a745ad1fff2bd828dcef392052965ce0e9af7a2c88d730fef69da91083fd
  58.460 +83d9fe9f73d42a8dbdcaba85b0fa93b210dbf49cdcbf5d4b69e07375fab1
  58.461 +a39038cc51f66f0b10eebe0cc61f697f7025d9755830b2d65f1ad0db91ef
  58.462 +ebbfb578053de329935bb28d6ed6c12f748a2f70458990f04d56c35557e3
  58.463 +8bc5d2e5de7f52bcf00c3bcce091aaa8852d53ac686f8f407baf3f7c8968
  58.464 +69f3b62f44a5e2291aff9d30d7b5c663658a41add74562dbb0f1062f564a
  58.465 +9b907846291700151de04c1a55cb945eaa2e7a709218ec56d1becce1c0b7
  58.466 +dc41d5f016ae8080c3b07311590a0def35337fc3c844c0ccd04926be9fec
  58.467 +509b1255ef12f368d20601b1ac8c68b0a935f987a21de0f8191604e921ea
  58.468 +0c04b00dc188fd73499852dbcccd4119ef799472b353be7f7dcc904ddfdb
  58.469 +920839f3d4a13bb1796f2dc886f31217845f8d7a543aabbc720311fd0e6d
  58.470 +a31ad3daa06d5e7e6270a34304f35ef170a7abe733428e96b0522fddbb5d
  58.471 +eb35aacec147067fe066c9ef145246fa3d444d176c274b91fddb8a7bd7ff
  58.472 +7cc7693c25895bf931eb321dc9d79f662a17691f9bd1662fecbcecf6d1f9
  58.473 +cd8ddcda56d19811f05fa48bcb492feb355b0ec7c04d6046549c56f7799c
  58.474 +2cd0d9dade8809de7d510702e525ad9cc82c41b4fb36218e3d72e905c507
  58.475 +159076a9c0e4a008ccca17bd594c69f5eee656426f865fc1988d677b72ce
  58.476 +b710b29a0aa8f8337552ae30e93bf7c6e5d013555872dba4737dc5f08c0f
  58.477 +efd428c66fc8da675373f13f89102688977e18e14dedd7f3b676256b0263
  58.478 +b66b013617d9a026794b0d6040c23c5506a98530249633a6beec46117c96
  58.479 +ec036eaf6439e25b8e57754af5ebaaf9b57880ad4fc93f002fb03e9fda21
  58.480 +df4acb78296b0c49a5a852c134c3b10755177a0dbd6c54ea7a2b9bdac62b
  58.481 +5d7f3da649df856478e4baf97899e0f891a96536c283f5c81200c51c6ab6
  58.482 +77285450c7f7e96836b6da5660f6cb76782ddfc64b6fc348ebc3ba4a46f7
  58.483 +19176296d8c5a31132b3fa7d935a5d777c1dc84d669d564cb4fd689a38ce
  58.484 +680d0b3b130caea0be43864826d0d154019fd0d865f1c389cd367cb5248e
  58.485 +24640eb6f66603e50581f6fb5aca6cfec1d6dbf4196da10a5e1ebb14e4ca
  58.486 +0251c4c8412cc1673d6e7a9666b04b090567efa0b830d2362fd384cb0303
  58.487 +8a40290597bdaffe429bb89fb66b9dfcfa92f39d92a8baba7266d144ac04
  58.488 +f069093ebb3fcea961ba4497d3628ad207e0c8c4fac0e5f3f2a663a8d05d
  58.489 +b6dc33b890ae13d84dce64b495d24cc749b121659373ca31cee09bff2e9e
  58.490 +e5b62e89d5faa4482a75f341dd172500a54b98fc108a69a3ea94db696513
  58.491 +d4c7691e0095ed3900cd4489ab008b5460b34ae8dedf3721c60de7086605
  58.492 +6c391137cf23255c565bf11403bdeecf8bf39ad5e4317a4bb37003b2e7c1
  58.493 +400c3b8ed7f63719bddf07908dc2decdb0f68e8ef722851c4420303f6de1
  58.494 +b5efc9b2598732fd1f2cbe45a504bd7fbfdafeade3add7274a1e875aba3c
  58.495 +4e0abfc6444944b79f95b5009560818f7a0599e5bab4405378fadfe084f1
  58.496 +653e5a0166714047e8bd4e4cb116596d8089bae9147ec1d62cd94491af75
  58.497 +a1743d58bafa11b63b447c954a8d7fe11d39d969feac8fa93c614f97807d
  58.498 +ac62cb7a84a974a0fa555a2e3f0ef662706efcb828ef72e2ea83b29e212d
  58.499 +f89ffecabcb08dbb7119203c4c5db823bf4e8b698b763fbd4d21e57940d9
  58.500 +1754959d21f3f649d856ac6615eac692ebcbac555f772eb6ba3cece5ebfb
  58.501 +cfcc2f3d8dcad7edc697df93aef762cd47cc3ba9e2cdd10940be676efe7a
  58.502 +a3749170edb47b7562805e3f8bd978b18057c9110ff8d19b466ea238af32
  58.503 +993e2d3021745b238021f824d887d2e01a7ff12fc6f084b35292f4864579
  58.504 +406c0f61d0ac7cdf7e4770b424e2ccc22353e6c82bf8ff172973df267ded
  58.505 +bdaabc2a742beea02e35b9b253f98de9ca131f802deee2905ca1a6dc4608
  58.506 +19a59b4a4265c723007d0215fc8ac2a91ec5f86cd6aac1e370a297103c3a
  58.507 +3cff58c7ae201cbaaa8a12c93e95e73974f9abcd678451b1db02ebb2e10c
  58.508 +c5abfa573a2ea4219fd1851765649318bb556b728d432ec05a86e9894aad
  58.509 +9cdca63d08642655801bb37f28b6e11b958e8e800c8d521ca4aa045fe9ab
  58.510 +ac02dc015d18b1901d519181ef60227170a07f3328a6d5fe4c5aedb35fc1
  58.511 +3dbe86564a9b1dd4c7ec648880360cdd1742ed4ac409450f1d9681cb5e46
  58.512 +5edd1de2a2c7f8ed63436f98e849504ae71bb872683ae107ad5df3ca0b47
  58.513 +a5b79513e02d7c540257d465ae4521cb3449d79c931e2ce8c5b0a0a4ac88
  58.514 +cef7b9e5f92bf721ad51682d6b6f6c14747f78eaac1891fe29aed4eaf177
  58.515 +e3d2fc655ae889c0c30a3575a76c52e95db2f6a4d8ffee9518391954b92d
  58.516 +39dae4e97c4022031f8ab390b66ada6dc9ab2de4d1dddf26ac4032981a69
  58.517 +08f73d34b4849ae28832cddc0dcd116a47d9262b0f93c24fbfdf8a78e6ae
  58.518 +ae3357f3fb89530854257a9db773a1acf5271fc4ca04a06b46dbe661ca11
  58.519 +9f45e0080cd129e1a7c23a33f1c48af960761b117d9d91fa5a0ed3e47865
  58.520 +b774a322f7dddfda2960b91fa7ba20c8f9eb213251299ae328b28ef54b0f
  58.521 +55fd54f8047c555e4045cbd70964e1c953e471408e4f25fe8ca7009bfe44
  58.522 +0244b1e30dff518ea7ce5078027baba4e07ecf0ebecb497b4bd88f1ff72e
  58.523 +b261f6dffec0ed895e237b5608d31ef479e8c9ae9003039a5fe67252ee39
  58.524 +774e1501100c0fcf154f5c5c81c70539e03118ab91f4ce247f6132d46346
  58.525 +bbbb126c09d7459c1977e6e367a0c83d14edf7dea081e5f795a7c831fd1b
  58.526 +325b33674ec9c2b68029a0e600746329ea2e1b9bdd5cb2b140468e53c108
  58.527 +8e8f2567425443f8146ec37101fa4dfccb0e032fff6cdfd76382463551b1
  58.528 +ae8ca6cbff0e34a3f75ad400a9573217f8cbb00a6d59ff46e48421e97091
  58.529 +cb17f53f20ebeb89609ea55ed6ba4101f2f3ceccbc7ade21202439ef91d8
  58.530 +a9a783c22de7e6601b50c4342e094d0eff223494489fa92150425da1b432
  58.531 +908423fb3f41e0b115ec1ba592a4f920d15610b9fb33f9912aba67912d05
  58.532 +1ee00a13282c1909a3a56c4ed06f2f4d1739dc296b7492aad0446f87a416
  58.533 +c6db4d42b504dec3a6756f3d0845ab2d2e151aa5fde12b31a9c3b5ae1cc9
  58.534 +d97192bc048f00dead66940004281c4d5a92c20b1f77795cb4f98b8eaa7c
  58.535 +be16f9b9d4a34a1a53e0a0deadb4fb4b20d9e8064d3412ea8d2ebd259b8f
  58.536 +2f04bf4bf11a5ab7883c99943d762549c3d5866bb6ed85a0e862eafbcfc7
  58.537 +03bf4b77cecc0d65bce4df33e0d65456397f231f8cbf66672457cf539817
  58.538 +6aa5292fae24695009e55904a04588659a3a23fa11989b925705ab45f954
  58.539 +6f862b0e176fddf75b70d9ef7389f750becbffae25d58a1252cc04a79e13
  58.540 +fbb6a666fd87cec5562c3e14fd78ad05be28ff3871d6fceff5aa8965bb65
  58.541 +67ec76d105a6348e915b27767f5010011e80e0e2f9c34742a4eeba369e66
  58.542 +8faf086a45ac9bcdd76c758db01a78602412a4244c759ece0b963d9ea58b
  58.543 +0efbf4376bf115288803a54cfcf78584c8af80da2a3324096463e3898285
  58.544 +57de6c6354444b12a74d5e66053f6907c48522cae9e93bccdb4632131add
  58.545 +52eb374213888125de71994c31dba481b70b2e4c1f10b865d58ef09fc9dd
  58.546 +2ca7f69bd2855895256caa5dd6bf7d4d8b341d677c56ca08fd7ba37485b1
  58.547 +444af8be0dcdb233a512088936ab4d7fc8c03139df396b7408747b142782
  58.548 +d9406db0dcd31368d2f23ddef61b0da3c0704e9049ccf7f904548c3ca963
  58.549 +76eadf1ccf77f94c157f5b84f74b0c43466134876a90c5fdc2c53af70c3f
  58.550 +f5c2d13cb665fed9016454bac1a629361c8ea62f4b2399233e8587db6e75
  58.551 +a9cde3530f20a68ec155d275a4aa6f63aa5cd115244643b54911c954feca
  58.552 +d57be2a6c40f1bac38e393969617b066f7d94e8b18dd80fccd0168d4a385
  58.553 +f2f1489d1dd41b68d47e5ec66ec568333d1f584e3dca90f1367a990630d0
  58.554 +14355be7dc45378aa111c319838edd441f15e125f928e044640f25ffdcc5
  58.555 +c116c3f6ce0d4d3195187b22200808366eca9b508ec45e664e562186efec
  58.556 +a97b22835d384758849605a01973cd9ffc1657b124950c9d9fa3e18b1a20
  58.557 +7156c4f96f08b87824373c2865845d17a0dda71b1d69f5331c5676d0648b
  58.558 +ca80a7958a2aa034d7e1e9fafead9248e6e64f9ec327c60ae4f724e1fb95
  58.559 +8a71e82ac3842768b27b506b5982311557432dc3f270ae6eab23a42fef70
  58.560 +dd0d407a02cbadeb7b8b74a2523cf46a5f61e52b053c2007f75ae053a96d
  58.561 +e00646662d027d93f950e516cddff40501c76cd0d7cf76c66b7bcd1998d2
  58.562 +7a19f52635c8e27511324aabbb641dd524d11d48a946937b7fa0d89a5dbc
  58.563 +4b582d921811b3fd84c2a432dacb67d684a77ac08845e078e2417c7d9e08
  58.564 +bd555c5265024aeb55fef4579b46f8c5e79770432c5349d5a65a47ce9338
  58.565 +e1b599328bb1dff2a838f732852f3debf4bb9b828f9274d03d7cf813b123
  58.566 +687c5e78a26310d87870bfcb0a76bf32aa20e46f6b2826912e562f503aed
  58.567 +11e427b7765cd2a68da2ec0609259ff14f57c07963d075e96f8bd2eab9a0
  58.568 +dc32714dd8905f2627c6d6f33563436bda2d7fa9a976f88947b84c72f454
  58.569 +bf0b66ca84470375d2ff252b4a2df52ab613d0c8ef0465ff1d809ca82025
  58.570 +c2122a8f44c56ebfa25690bf6a05675ebb8634ddfd24c3734fe8cb32d6d6
  58.571 +c69c72a4951cb959175770b4286d383e7a3f158450945c8a2ccf7e54fb19
  58.572 +aa8d2d98a07f0c55f834f2728d89f82a598269750115a02287c4d415cdaa
  58.573 +14e1d9e7032684002f90603c0108dd26b40fb569bb21cc63d0da7e9e1873
  58.574 +9df0a9c85bc340d2b0940860d95571dc244628c59bab449f057e409e58ca
  58.575 +cc3369f4baa8e53c6765a55620e78341dae06e5cdf2fa5e5ba58634b29ee
  58.576 +ddfee7f78672e55f18a7debbc30862f278f83f4cc123ab591371f548fbf9
  58.577 +bd24b3453b9b57051c2e67edff2104f3a05a9f0cb7efd81c1b1b0a2bbe95
  58.578 +21854902526e5d4fa1b3be270811b972e8726623410cec7911c07f871428
  58.579 +1caaead97c503714eaadb14ae5923f020093722df1b9d9c055d7d5f95af2
  58.580 +a9fbc5ab6f6c2bd655f685534d7dc5fbb5ebded6ccdcf369bd83c644dc62
  58.581 +84c2810495888e9d8f464a42228cdc231d5b561c6b210bc493fc1e7bfd66
  58.582 +5a6c4055a6a629f571f4f05c15cb2104b4f9d0bd1b1f0ab8252da384eeae
  58.583 +f5fd5c663ad7a2c29f65a48a30ed8de196f9eb8ea314c6e86989298146a5
  58.584 +589f76f12664c8d008228b33144679d16ff564453b5e4e9f813191b6c99e
  58.585 +2680e20a410949ac30691b1428a255b6185b7e3802e8511192e73c376f3d
  58.586 +eb807ad2727fbb4b27538b3213da0746231b1c1b595a958466155835c537
  58.587 +e0df4a0ef272d4c3f7f2ef011daed38bc58bb0fd7458e48060db98971bd4
  58.588 +b24bc7bd0de92573a1c7a80a5fa2b34fbe50271dabeb83aaa4235cb7f63d
  58.589 +6a6b399360df8b1235e4e9ab59698930044a98d5e083b5f5a5772309b390
  58.590 +9e1ff2a252734b32fee3940f0e1ba61f54dd1d3f6ff0d57c9ae75a302d14
  58.591 +b9dd9034279aaca80b6bd05c74bf3d968305a5046910871223a3ef8c77d8
  58.592 +25d7e6d3d2809e76064c473d1cd7c05666040b6eba647e34588f49fd70a0
  58.593 +3c937933a2272c938d2fd3aa8149f215bb48f3bb45090bcb9a6ace393a44
  58.594 +f1a9bda2ad09a5f566b2e8887880afa45a603a63ffe7c188e3eae926a903
  58.595 +4f1803368e773f42c7391dff1b9ce8599161515c549aca46aebae7db23ec
  58.596 +8f09db0e0f590aab75e8eb890df354b37cd886bdc230369783a4f22ab51e
  58.597 +0f623738681b0d3f0099c925b93bbb56411205d63f6c05647b3e460ab354
  58.598 +1bf98c59f7f6c2ea8f29d8fe08df254d8a16aab686baf6856c4fed3ec96b
  58.599 +0328738183dbc1eebb2a3d301b0390ed8bd128bd8e7801c89941485c3c86
  58.600 +22b5f223cb07dca74f0e8643240044e8c376abbd8c82ff98c6dba9b6d244
  58.601 +5b6cf4189d63c6acd6e45f07485a0fa55eff370da7e71c26469740a68627
  58.602 +a3c297d2bf215121fb67815b7b9403aecca10d21e59fabcbe38f5ca66e7b
  58.603 +551b22e28f2d1fd7303d15a42c45bf54b40ef7fc93060ae5164e54f91c55
  58.604 +20bd303a98d0667a02a900813b260c0343021ac01872fd62cb6abebc7ad3
  58.605 +a4456805159839ca4a3e35db586221169ded66f852e8974e3815d4d7659f
  58.606 +6a9bb93585aaf264f06cb6da6a26e51683945224158ea69719b8e4e36eb1
  58.607 +01333aac974db8f84b051724cf245fe7a4c86582b5dbb9a5d9318180e33b
  58.608 +8d92c22c44b0d18f8ca34dfa4ee9693c1a26fedece01635fc5eac1fefa81
  58.609 +32458254ad46dfdfd2be12a1e7f32f3728f286f1d5d4394424a073696b65
  58.610 +e3c459aee9310752231fa703faf35e11796c4eeef698f4109ca8c46ee322
  58.611 +5dc2e3e04fa787188e583321f8410b68b9624ff60679d3f25c13e5ea7506
  58.612 +a3ce8d0bebb99d9a959ad92d8cf909988d9250b310629903d6bfcad4581a
  58.613 +504b91b2c91889987f36d6fd0be1d0ee5aac00aa0cb48d78a1f7a64a777f
  58.614 +089573ba79452efcc31c8258fb317369feb0d7ccd48cf13da6d1ccb59a4a
  58.615 +48ea0b398e590c1169113fed81639e13e96aa268d99cfdb7aee977fbe85f
  58.616 +f784853a06642b5521ae0a7f610c9739af31ba7a5157ebbbad999e23794a
  58.617 +d2cf25af987dc85dfa29639957cf28e7f2b7671188045130a6e2785f8d8e
  58.618 +30e91f0f68c1cc9f2de902952730003e816e4f5703db7a97b4c566f80547
  58.619 +42fa77be563ef681a4513b9a68b2b0956551c74545cc9883428dfa72fd5c
  58.620 +4eee93256b26bc86ea34f7427cb0c0cc22c0cc343f739c6c0c46d0923675
  58.621 +5e04d70587426ef875f8c89ff8492ea23e4e4d763b84a6437a440e69eb70
  58.622 +65ab6d8cf5f8444a844e6ef3d158b451d121daea2d0e2b423eea24254226
  58.623 +7eff1b4224c4e80af2a7becac1649e4bbef09f39415e9b1e3750d7ac47a1
  58.624 +068a4f5ce30840b00574eb4e683e3ec25f6e690feeb0d354568efbc354ba
  58.625 +813ca1400734a67693af127b0f636d58b83e91548f98e3d87da7fd7cdebf
  58.626 +f3ecb4b9272d1c83d4980170378d32f1d98b87c440881af9ec052510982a
  58.627 +0c02ba6743bdc7691a44bae5e044c25304c1a2525cf2c0694494a2e9aa34
  58.628 +f36af43ab288807ffa4bd418ad51d98c75f2b2f01abfd834d3305682b6b8
  58.629 +62ef69d05962aac485bb4f560583a5dbb74e967eaf6d299160753ec32249
  58.630 +bb1d9851d5441cb0c624208e69dc876cd8841a66976b5d7f9c99be68363b
  58.631 +8112d33d971f2c4f2a1feca88ba1a794ddb725c5e2e2c248082231059aef
  58.632 +729bb5fee5006ab8809f63e162fc0743c047c7984a9e6333b433fa143d73
  58.633 +72d4a74fe37314508e04f54dc7a1445e2d6178ec9c041d0cd4fda5cae830
  58.634 +4b16feb21f3222261c293a8b058dc708405c1a97ff34eee4ca69ff4e1ee2
  58.635 +a03380d52297574e3aa50c8afb826fc94a14e8caa9ba89d6e92913be9e07
  58.636 +bf7ae011e6bd142d8952d9c2304735e875d1ddcf82fa9fc0c6449df2acf0
  58.637 +d5f6cff6d21ef6b2d29022ed79c4226c97f163284f2311cf34d5b0524a1a
  58.638 +a446645b9d05554f8b49075075f0734b3d1ea31410759c174fcc7305d2c1
  58.639 +d7128781043cba326251a3375784a506cf32d6a11a4876f85ffa2606fbdf
  58.640 +27dd16d64b2108d808e33c409dd33f6e0c6079e47e7196016f261e824fba
  58.641 +b0e4f91a189747053e648ad2d942ece8f582f052668b63a23a2fae4c75a5
  58.642 +180db7811aac654270ec6e341126e3561429f1d41fe7ba3f1de9f8bbb8d9
  58.643 +fc5cebdef869376a2e42dcaa578c0807835e58d75c39f91a83d5c1eb86a1
  58.644 +b0f7aab991f65eef030f212d38d10b1913bff71717c06c78d9a1be136f21
  58.645 +4be157ba11ba309326c55c23ae8512646751fb82ae200c06bd2e644bed38
  58.646 +c7cee826cb587ee8ff378b7fdc00ec316bd4a9c24e2c250cb3d64f8ecbb8
  58.647 +7f4d81626d7f1e4491908bf17c48c84bb1736693eb4d0fe634484cdd590f
  58.648 +a40ae94d44f348ba683a43004b487f047745fcdfdee2e913328a11a99530
  58.649 +9bd117e0e5be4fb25d176d59dc2b1842418141190ed9ae1f33e5354cacfd
  58.650 +a5e4bc186119e1461bcd98517e675276ddf0296d3b3cef617dfa36b4759c
  58.651 +944fd721e1bf63d45cea90b5817a40d153a2f779e03487cad3c1375425ac
  58.652 +8cbabf7f754d16cabe45c65f1be4441908e0969d5a5111c931e724537dea
  58.653 +7cd3fbfec9b2f7d3efa747bf586e9218c3106c49276b89fa28f770fa0644
  58.654 +fe1f3fe3adf07f59c755a5b39a2ac1d6f23c256a293bf3b31b6b9cf4c622
  58.655 +b188d6e7401c038657c78bfde9ba09f508f1bbe3ed79793772cfc928c4da
  58.656 +519f7dbf3ff7074284437d2de8d7b7c78829642d924abacf353119e9088d
  58.657 +14739935a23667c432806085c3af71ffb7c5fe6b4412b9b1044c1e62ee0a
  58.658 +a5ce7e0322bc65a8c7d874270d84136526e52d0c7f9f93199c6bb7301216
  58.659 +a19bebcef3c5633f21d012b448d367157ad928e21f8e471e46982bc46a7f
  58.660 +df1bf816a86dc62657c4ebf286134b327ce363ab6a66634eaa2a42e99034
  58.661 +069fe1302febf06959eab8e7304da4d94a83ac1650a02c38c1c4b7e65c43
  58.662 +e3a6fb0213e57ac49e58721a4f36996069caedefeb48f1a59303459d5873
  58.663 +f3bedcdb9d00c1cf31130c27b60928f210e1aa5e1c8e04b86d2049f31265
  58.664 +9198fa646c53afa9058eb8ceb41bda65f415c79ac92af5790b176de1d300
  58.665 +f1c06b782d584f458dbd07d32c427d894f84215a8e7819e295ee98d976d5
  58.666 +644f11920ff2f49cb1075c3bb42b9fe4b561362902f11a75669b7e7c4475
  58.667 +b65f1ae48834cd67816eb63b58cda2f50bc22eeb0cc965569b476bedded1
  58.668 +2701668f609393659b266bb0e37bb27afc90bca271366e34754383363592
  58.669 +0f9a3b508aabfe8deef585b07a992460c592a150b325b1e50e4214a2f483
  58.670 +e9dfc826c54b488493a96eaa37276f5a9666f0a5388fe388263d2c0cf614
  58.671 +c6cd01571da4389f01fcdbd0ade1c435d64c5921b5bf7dbebd5268100a03
  58.672 +1e1abb8cbd83873089a9e08cf80276c7e30d2bb40280278c29fa818eb079
  58.673 +87623b1cfe13e0b01e27be0a8320b69b5afee820f4705202158b7f3059b3
  58.674 +655bc28a754d088fde23d43d6a9389da8bc1cf3e8ea1a6f4328c196e655e
  58.675 +42184444d8c0614c7167c91a492c24c8357794c61f5e47cdaf4b38004a5c
  58.676 +8fceaa8151e929328bce1b8f67b22034f3f75e4d105283337c3d460e7d99
  58.677 +89920c43f5e1449c74ad6ab5ea029cc6e497ea60068451c4ef2132fb87ae
  58.678 +049077a156c868b768df4a4c475a532e2a22d999931c64f8bcc18f51d25f
  58.679 +0f94fbd3e9e6c094f78da062f80c4aa2b86fa572cc469e629deb4ba0c553
  58.680 +55e8422b562ed2f694d0e8e5540144e30841d7593b255edd4a61dd345d5a
  58.681 +00e411d2c50d64782a3ebedf945fc31c00d2fe4ca800f5aeeaf12ab399db
  58.682 +956362e979bd7ef0787188e43835e5389ac444d13204af6bf1875622f175
  58.683 +09f32015c28729cfa3b3cca90308eefaf260e3fd9df10f3e76786b8bc0eb
  58.684 +a30e8cd33689aabc55e3ce387cdb89a30573495852a48009cb58a0fd34bd
  58.685 +da911159ccacc94698ffb94c5f45f15ecc9e82365174cefbe746f95eee44
  58.686 +7a33b4d823487e203478eeb2d8c4bc7b743427778249c56e48fe17d0a501
  58.687 +7b693509ddfe1f42bdef97aedcc26ceffa9357dd985cdf2c70bbfc987354
  58.688 +6f0aa7df227ec42f9ca2482f58809e3f9650444568c54d3520bd0a7301ef
  58.689 +48bfebef1fc4332b5ca851fd786c1ece136fe9e575b69393b5aec2611903
  58.690 +fae6e7a5046e2ff350becb8700f209b1131044afd32fed1bc1297b6a2f29
  58.691 +6ec3b87f170e92aabacc8867360e4dbce9ea29f0c1df981f6cecc8986767
  58.692 +0ccfb4c9faeaad7ca9029b8ff0129fec4a040f80ead041b3bc8af7526675
  58.693 +ed9e13204e64d76440a097d77c535d34165bfe9ffcade530abcc75ae224e
  58.694 +890d5c110004e218bd827a02ac7340e18bf3684c43e664e0a37d5fd4fd1c
  58.695 +4d4489d25a99d542c16e06685652cfa3567da4eb0cb517be1482939da0cd
  58.696 +d0ea3519ad1e51bd9dc7b9077375a8cd3b5de9888697e853bacddbbdd1a3
  58.697 +0e442e1d6f2d652046821813d0cc0e8f16c97cdd32daf239f5b2b65ef620
  58.698 +46f6e9821b2e2ec539302747795fa746318514d38bdf0d0e490c00e114d5
  58.699 +03e7fc9a8fb83b14337a5bb4d640b52630f5450bb3bfcf7cecfbb1ef5192
  58.700 +ae401265450db197bcfa07315ff95a809bc5fb4249e3a728a817f2580ae3
  58.701 +50d8d6577f79c883ab4a3119d9ab98219aed0d1e826023a66da814396058
  58.702 +d95e52d9af8bdbcb0454721f27855b686d13bdb473f650c9865f3e04f08d
  58.703 +b10f5256a3e59bcf16b12a84bb7ef3b370647cdad5929b722a05f5b3669e
  58.704 +14c232bb82fcb9c1dd8155ff4515f4e83c895cafb86754e896f38e5f3beb
  58.705 +5d29f1bd99cb8a09c5e50f412f6d8a773b79021ab2c4831aa663c5defc4d
  58.706 +553616874dd5bd8b75c7a2af7d029aab5a72528fbc4b5ee3d30d523412c9
  58.707 +60b432434017c4cd68b2062d28f307fc287e11663511d1a6b52143afac0d
  58.708 +ce0f7ba3f326fb707fb8d2c985dd60090e6664f2344e098a7a1a6448026a
  58.709 +2ee651e8141cd7786b6543f512e4c31d25dcaf6652b1eb52706300b771cc
  58.710 +0c49295067befc044ea46341927123ad4b7d094784bda7fa7b568853d0b6
  58.711 +1e4cc39e1abcc9479f91a2501009ae34ef7d5ff56205cf5288503591cc55
  58.712 +c48abcc78daa4804549562afc713a4c11152e6e4331619b2e474a25ffb62
  58.713 +7c46112fa4259f07871f8d6882e9a7ec62d20a86a0c502815d0a8f3f5ce7
  58.714 +cb4a6a74b6db8e17d54bc919b82c7c729cc05b98855b9d8a0fabd8a9bdfd
  58.715 +4333f395607631f57c0473be0fb290c4f40a7aa6ac49208570ffa1d0f849
  58.716 +d4871ebcf9ef6f5106301cf54ff8cc9918d6de74d519fccba58bb1c21543
  58.717 +f3bca9f43c211b2e5c233ff6dff2c9b56d3f656f6070d13dfd0be04653e4
  58.718 +98c670770e01c07b731ca0e2eb56e608828fedaf1a31087f2d43cb4c0074
  58.719 +e576769b0830577c86ad5de48ee216df02d7c4e4ec231afd8e76c608fc9d
  58.720 +06cc86f38cf4d839e0a0829902f56cf2f86f08b975a6bdd0642d6b4c78e2
  58.721 +57cf9a4f52646a952f6a220c36c91db7f44c7f44bddf33328ea8cc01827b
  58.722 +5f2d79e3ee6c514a4f8597a847ef5f32c6400736e6ade28faa7bc6e9c6ba
  58.723 +e4bbff236fa6dd2b0ed23fc77f92649feba149f82488260b0bea2a4fe1f4
  58.724 +65d96d8c51719e5e10d4c17d1b67e700aac36b1ed55c93b4b2604e72f51e
  58.725 +b30fbf5b64c6fcaaef764639ebd789f82ed354712c7f9fcd1df257e14c0e
  58.726 +8fd59a0eddab684bb1b4176d79b22ad2605bf534e4b8fac2272fbdeaf210
  58.727 +0424a2c5cc65f8dd5faa13313dd926128ed466046ee94bd3eb41f3ea5505
  58.728 +5a70603a2ae1981bfae8e77d850fc5a5bf1bacb3df9b7cbce68ce7979fad
  58.729 +a73c2900526b68236c6d37197b0c521c5b1cf5cbbc89238586eceb99818e
  58.730 +aa47ca94ff615233575fe83d0d50d734351e0363030a12300f7b20450946
  58.731 +17bb209c346ac1d35402b617d6260fce04ce8b3231ab5c05af30b0f3ccb3
  58.732 +3616d3df334c8d963279537563222dfbb705c3e14616ad01927f952e6364
  58.733 +4c4b7fa44ac97616c1521facd066aa33b2296dc03682eb6a3b9dd8e5bf62
  58.734 +53f10667ecb07bbd50553f1b211067f5cf098b64b84d94ba9ad8b146dc9e
  58.735 +8e9be06bc14cfe0945e22fd819856d6996e857c0bb5f292defeb493589f4
  58.736 +515700753885d61eee1b8c19e6e94fe2302c07933f949d6bf119d207fb04
  58.737 +dae7bcff7578bf33d77e29611c7cf03b2df12c242827ec4c4e5b5343ca3e
  58.738 +4f7f38ed337583e30dedd78a082f41d60cbad55d59dbba11af1bd296ed6f
  58.739 +e31d2e10d3a8b5ea698e656ff97755a47ddd862d23309e2e6ed3e3e111c0
  58.740 +2c3a713d782fe301dbaff0a4225f932576622d1cbae40d20f46958298d01
  58.741 +783851c894f2712bfc4736d3802e548a704878e2d139348671fb96d0ddbb
  58.742 +f56d9349172caef0dfed4b84d867116d91063dcdf9ec401dfe8abb269ee6
  58.743 +0d646bd12e0752313e2ddc272d9f4aeb9d940987596ab623f9198765cec4
  58.744 +62f7b6c540c9a70c9a872bd28ea62e056560b61ec51fc68eafe008f20760
  58.745 +246e06374ae5a6bd2577217700507978811ec29985ab644e474e41e8a105
  58.746 +295fa67ae05e0739e8c7fbc51104522934942f53e1e1df1ec2a66f0a74b5
  58.747 +9885cf2c2fad1cab3e2b609f126ac8b7350d5408a7df9ed5c27a10ef6505
  58.748 +6f0d877cd7bb902977ba93e6e8520d2d018560ec8143876ad0dcb95b173d
  58.749 +af72c0d413bbb5541f14faa57eedb3ac2430e36911d2f486d9ebf9cb6745
  58.750 +2ccc763e1e46e7a4b8373e06082176a6c66d045e18f90b4b2ad15802f6ef
  58.751 +cf2130cdc627601ecc19887784b6de7fb6a193bc3d057ace29f74199acae
  58.752 +69526ba6f7a2c669593f9d0849f12e37201c32c88384e4548a6718cbb2ab
  58.753 +714ccc917d93b865ac7d7d4dbd13979843f4f5c1f8b937ef12fcdc9aff50
  58.754 +f09d2625f4367ee70a98772a273d8919952102aa03297e3cbcd876da5abd
  58.755 +2ceb162b8fe1d9a22ff694495528c09a8819fbfb6946ab205d4b2424f6d5
  58.756 +6fa1c704065cb64fb2aa0fdf291fd5e7daa38667e6d8e889be7f4c453da0
  58.757 +59c492cd25fcf4a03a6995897145273a66cd6ba999138bc8e2aa7d080f9d
  58.758 +231497ed28a9a27b6b0d4785bfaee46fee71b26d6839f2549a14e7ab7347
  58.759 +0b6cf368d2d49e74c78d93477828e4582589cb447d795181d3f13dd8ad52
  58.760 +3c750df8f19b3260c17a6598b406472a7204dd26c5988911ce9884de9a1d
  58.761 +ce33d834becb1dc80efb07f32d3ed6c2a484c5d53746071576c3f67f25ff
  58.762 +1558986fe2dc2265b4fff79c07e3f4c6c0ce8319e04c14728ed722cf214f
  58.763 +65066148bc817753dfdcc0950bf80dc515002e1a92e7d8936e9b3aa9635a
  58.764 +a6d512c68aebc79a62a6bd17a411bba7684e1f06be9bc3d1aca25d50c8bd
  58.765 +1d75597194cf87c9ffe04ff28bea91b5b9521fd356ed9e036466137586ee
  58.766 +f0a8795486438d0d9707cb2854f12963929edac394c562235ca71376d938
  58.767 +e4e1518668180b857d75318bc22e9f0683749047e7649f9e20b35204b6ee
  58.768 +60c0d47bebf53179a083f0b4cad5b3327a3faf2cf03753e3e46c05773629
  58.769 +7e9bb305f603369cbb568350b2b5c6d23a35c551e0ab28b082e321ef4ed0
  58.770 +e2704d35c75b4750af782160c2f2e9aab0e14e541e95b64ebedd66db2c12
  58.771 +a8935a60177cab634e20a8871a3a72f4b21c3a34d9dac37176a321c2ce3e
  58.772 +e828d140c8445117e7fe4738000c30ffae8e2a48bd618cc8813e38fa0f86
  58.773 +92ca634d1e56010987483aa0f08980d91528df3d370ac724acb238e141ab
  58.774 +595dcb3da7a769de170edd5763078d1084e2ebefadf8a50a816b50722617
  58.775 +c9539dbd68d9062b015639708dd900aecf4f15adb36339c05a9aec7403ed
  58.776 +771f9f28c60e52bda3ba6902e06334036c1dfd66d35ed00e3fc0bebf55da
  58.777 +416093b5cf512217c47f905ccc91fad879d63dd1380519a02025ddf15d70
  58.778 +eaa1bd8cb6be67608fbc5c94796bd09ba35933f64c5e72a26db1ae40ef49
  58.779 +af5e972fa44660588292b67ac670bf046cb1f5a7a0d73ffd6df862744786
  58.780 +4a56393b0f1b4cfcfa362c74634713093161b29c94a2526b7138aa92fdde
  58.781 +b37a8c1f30a6b3837d9500b340515f0412e681f5bf36e7869fa157df18e5
  58.782 +c79df3e6aca924d7b7dd2e0d5b87682d7ea6913b26397ac180fb75fabc1b
  58.783 +8e156ed542b9d8c83079bccd141c187f90d72694de4f6d08520d11cd454b
  58.784 +bd3c2e6d259694fda0c8decc724bdd650163b7f6ce1181590c06de4c0dd8
  58.785 +536aba318cabf54782c919e07c2ffa1034143175d05deddfcd7dce6c86a9
  58.786 +ec9bf6a4437da474aac2dbce2c91aedc20043f179d5c9120f3dfb1cf6906
  58.787 +c27f2ec68cd75035c283e1672ea90d953a23a1515c420b81c3270fa06573
  58.788 +4d003eca1bb71a2dacdab67e44f47c266c2ea1776648b62bc110671e6eca
  58.789 +4546d3c72c8acd956e10452c32532ed51bf3d0518467fa829efd9c896e8e
  58.790 +1e5c7ff6da0b51e872e403470affc95f25e1d2b9b59ddb0472705e14fdc8
  58.791 +fc2af16527188508be10d098372cd7eb7d62a85c8d8dd1d0f55ae3ccd0a6
  58.792 +5dd6bf776dc187bf4de409d5db3fcc5a6d852848a251f4fb4e01dac5e9b9
  58.793 +587fa8c46ce03689709008b34dfb3dc105def80a1b515abcbe06e73fdf7e
  58.794 +7136e40cc922fe9a9da1726747e84427f288d934747b6c587490734906b8
  58.795 +a91144ac82a57957cffab561714e1ff5148a39499dfc8cc96bf5d87ced17
  58.796 +825e8f80cd943d9a73945fb8bc51cf1f9cb39c605491c1bb8f1c4139974a
  58.797 +59471ead310d041b1ca1ecd5e9f92007cd8243cb3fb1ec5256444699a9fc
  58.798 +ed6cb31eaf0912c16fa480a1cb4a8f4a9cb6a4d9a9903d1e2f674286032b
  58.799 +489b8a23ac4719fe435a9fa2d79abdbaba740e69d5ed611421b1aefcd06a
  58.800 +362ddbb7b79aac41e3e90657afc0b87a6e8c57ceef70a628efe19f568634
  58.801 +50f47b5c6d95870039caa3d07a54e58df064bb5f59dbe9b9a2c7c84d7e0f
  58.802 +32386309560a0efa2cbfa27f861b208b2df4a062ffe2c59c057296aaf5c2
  58.803 +0f48ffc9ff0692f8cfbd6fc6ed1f3a14537ba40d7267e6b5f69c997a949b
  58.804 +26577a9a99db3f53167355c4967dabd522292ddaca3c537bcf303ce76add
  58.805 +eb99f6664227a94d6a698dd5a5d40008349376067d057e28e55972264502
  58.806 +e035b1f5e33d7b3aeae016f9be50f2aa09aa138d15d7af3c1ccb805f2d5b
  58.807 +cd4e9b2b5c288b2af4a25abf0a9093749377c9e8232ba1af17962f85064a
  58.808 +23b0a13f11acbb471cc700f9f1b588f72cb63d3d1a95a93502ef74ed212a
  58.809 +c452f1a84619bbdf61a1dc79c0d9ba29c7f19b400f682cf66f7705849314
  58.810 +f5c8bbf973f2c53bdb060932156bf2c9cd8d36cf6271075500b0e3e6ad49
  58.811 +958af46a9dc950f4c29f1ab5dc0a85924f7ffef259f778459c80118b1eb1
  58.812 +ed29208d1145b21b19d62f755de4972c57a09b3decb0a8096ab025fe6b9d
  58.813 +be49ae35394f0ea40d3693980f97f712b27f0e28d8a549acbf1da63518d0
  58.814 +374941effacf63ac3de0523cfac0dcaeb690de5836741fe58917c7ecffc1
  58.815 +95e7b560a3e763aa70fc883751bd60ea0a0f893d8e9fe75a66c67e202c24
  58.816 +84f66708ae74413c0101fe0b5003be20881345d917203b582a247e6c74a8
  58.817 +1d0479f317aba7b9dbbc0a92e91c51fbe8775a44c57699acc9da84ad60fb
  58.818 +9629929d1edabbd70b4ef9887ce4ec2469f154fada42de54240cf3302364
  58.819 +7c492ba17e6936a4d85e0751df0945463368a803fb40d8ded22abe118250
  58.820 +86cfff1878abe5b100bc08b991cda6fdfd579332360f0c3374842edce6ed
  58.821 +e43649d6702f34668a29bf387e647f96d78f33395e8d4b3521cb4fb0956d
  58.822 +12c924c16eee798cde68e319a358cc3524c753177d976d4e14a2e0cb72a4
  58.823 +80cd87bfb842060b1266568af298bbec58a717c577be73ad808e004348f1
  58.824 +6aead32a3d57457376ab57197534d6e469ed24474a83618f3ce21df515a1
  58.825 +22918f4b62c642de0c8a62315ebe02bcfc529c5b8f7c127085c2d819e29a
  58.826 +f44be20fa077ee01a8d427bbe3d97a9d2bafd77f17835279bf135900aee5
  58.827 +9bc49582b18d468bf93e47ce0bdd627775264ebe9e4172839a444f928580
  58.828 +8c95895b7e23592b2dcd41ee82e966c26aa2143e3057161511796e980998
  58.829 +1f2e4ef5868b3bf4576e3546e6407e35cdf14654bcefa7557d09407545a2
  58.830 +38173080b4771ea52054736677a8d9749a2b22b46b24fbff93c55aa2274b
  58.831 +8c7ddbd751bcaf1df00ccbe1f24a80622aff192fd6db2238db941ec44ae0
  58.832 +dd73f6b2f80d89bd0aa30c038583deba14913d38a7b61b54522755e251b2
  58.833 +aeca62033a39ec1143b2b960f9cb87f748428bec3243b8164f07d5ff72eb
  58.834 +f2ef69347bb933241c2401a96ba5ffa3f9ad060c41f4e6bf7280af65293a
  58.835 +bbae49d723dbc4be61d7e13f7a5931a697e7f2c6582dff416341ccf5a24e
  58.836 +9a53686a1e13bbe0bb480c19a4e72a5e477bd29f39dce1a17f63f1e8c696
  58.837 +d5f8855cefdbf7ce681c7d6ac46798ca9bbdc01f9ad78ce26011ee4b0a55
  58.838 +786bb41995e509058610650d4858836fcedfe72b42e1d8ba4d607e7ddbbe
  58.839 +3b0222919c85de3cd428fed182f37f0d38e254378c56358e258f8e336126
  58.840 +9b1f1acd7f387686e8022326a6bbc1511ed3684e2d2fc9b4e53e83e127e7
  58.841 +84da13550e593bbad1c87493f27b60240852e7fa24392fbf3f478f411047
  58.842 +3f00a8fdb6dcb8aae629dc7f055d85341d119f7f6951ae612ffa7df82111
  58.843 +d1ca48306a57a922cf4c3106f0b5e87efba6815f6de4294c7a0394087067
  58.844 +677889d22a3fd86b0796200300d2716445078027fe0c0b05c86ac80d2095
  58.845 +ae874324ee6ea3553bcb92fc1522a6d1524f6fa22b71598fbce784a10b5b
  58.846 +61e50307ef4409ffb7b38f27800f2185140ed08fc4ab396050b068025a9d
  58.847 +e4bddcad201e72ed9b41c4ffd4cee743c9c2345b95c5071442defc8ba5fa
  58.848 +9c63c56e209df41d10d93135a8080f7cccacf67e0b0ddb3e0a31df32b83f
  58.849 +290b3c536e9949973cdc80aa5c8a4feee20290a95f68e59f54050192de42
  58.850 +f27464ee374e4d2451ee8708933b970402c90ca3070843a449d7c3146347
  58.851 +1efa666a60fd5cbf55a47e4a3c5c318fc1af944d58d32690a2c7eeef09b2
  58.852 +d94721896e1e3e76e44a8efd524ed5d6f5eb9da093d277441546c6828745
  58.853 +ad71b6c13f653dd631bc6fc55d0eb4648b7bd9c0eddb13222542f2b6e8d8
  58.854 +b80bfab4365f4199a41ac690979285d917de79359a183e6fc254b63e6408
  58.855 +6d33e3c029f472f40742a99f92999f302f79994ffd615f1a848194cb56c7
  58.856 +12146850f5e400303bf5bcd4e5fdccd1fe2edf5352d525cb15d8327f45a2
  58.857 +6e3ac276dc8780c65724d28dc6bf9c7c985840070c35e32859168890d599
  58.858 +a884dc2a90194cc2e9cc6a20c6c0ee11b20adf3aff01db48eb8dba7b0c81
  58.859 +7fc10cf5a66e8171a2823a4cd22f0e80c82011ae56dd895ae2d3ebe84ff3
  58.860 +d521c31453e0909cb9b1cf0b030eb6b7059ec38038cae12d0e1cc4b5b3bf
  58.861 +e6c821faac9b8792441e2612aa1ee9318b71f9966d7d3a64abe349be68b1
  58.862 +744de7b212f6be73a0e1eb2fa30850acc3d9562f989cb2d4fbfbcd5d3ef7
  58.863 +ba55717da1cabf197b06ee4d8650e968518b6103fbe68fcd5aab70bdd21d
  58.864 +66f09f96208db67c1b345672486657295a39a7fd689b2c9216c6b46a29dd
  58.865 +1283bdba295dfa839a45b86c14f553ff903a6f7a962f035ce90c241f7cde
  58.866 +13bab01d8b94d89abdf5288288a5b32879f0532148c188d42233613b7a1a
  58.867 +7f68e98e63b44af842b924167da2ab0cab8c470a1696a92a19e190a8e84b
  58.868 +1d307b824506e72e68377107166c9c6b6dc0eed258e71e2c6c7d3e63d921
  58.869 +39690865d3f347c95070cd9691a025825421be84bd571802c85e2c83ba53
  58.870 +841223435a9ced5dead103b470a4c6ae9efcc8b53331c61d0e1e6d3246cd
  58.871 +aa1b0da347685121196a07e97d21b10ad34e7031d95c1bafa37b4141bf33
  58.872 +a6be401129dcd64086885f4b5f1b25bce75a4cc8be60af35479509e64044
  58.873 +d49c8a0c286e4158a5f346ef5fe93a6d4b0a9372233c7434a7a6f9e7ea21
  58.874 +30c0b4b9f62e3a74cc5d2916ebdaa51a1ef81fceb6cf221e70002a8a3106
  58.875 +bfbccc2d1809dde18e9607fcaac008fabb72e8c50244507f4013c5a268a3
  58.876 +6135ead9cc25362c37aa9511589f18d812e6039490f9c599f44e88754ac1
  58.877 +4f6c1841d570efde27958c7f1b2c68772584e1d12fea252e3a6ec3b051a7
  58.878 +6faebbf6f5101978e24a9ca927c02065e8e49150a55c64dd30757e8a33d5
  58.879 +2a788437a9181efb47414dbc22fdeda203d4122137bd045611f68314e12d
  58.880 +1d6a5ec270c8919562c03e3af7b0e0deceeddbdaf3eab8fb5632e44dc1e8
  58.881 +d46e2396b0236a46659164e33709415e7b347f7f7b87a9224a189ddf5178
  58.882 +2cf66c9d385470a51efc88696176f6d3ac3b7b95fa074c981194e22981f5
  58.883 +1d925f980393b7102f1f836b12855149ef1a20d2949371ddba037b53a389
  58.884 +7617c257bbdfcd74bc51c2b40f8addfe1b5f8bc45aa4d953c0d1d5f4091c
  58.885 +6af796af6513c820499969593bfd22f8c6dcde1d2ee2c0ceebb5bd6a1ce4
  58.886 +5fa61094e932b380cee381f4485e39b4b1797f2a7d8d90bcbf89b9cb1006
  58.887 +2d50fff083743bf318157caac1c0179c87c03a2857fc002979e7cc97feda
  58.888 +966b09ceb761d3f55cf07637256c6aa8b8e5cb6aa9739452a330afbe7082
  58.889 +975ee39fad5e8106e8ee05771157e92d99003533d922ccc37add065b6236
  58.890 +7613d039741f99edc77c230fe8d1baba720a185186662376b947bbe1a686
  58.891 +4b42c61ebe1abd40d890751ab8945c629de3b6d2a49809dc693f9e397097
  58.892 +cf1e568c258081242460af2de0ca44b7ba2734573967b3bdec0e5e64598c
  58.893 +cbf41e630d821491504f414d9b54a3100dd5105a141cf61bd3ec41b67368
  58.894 +c8cd366c543754ee800ffee3d19c9cd0d408cc772da10e4d8134964b0a61
  58.895 +232e2dfbeacd0fdee12792504bb327a2e1fc44127f8577ca51d380a760b3
  58.896 +740e6be46455cbf3917b90f0dfeadaa25d5d9f66cda43ebf9f75e0191a06
  58.897 +25ba29666bbe8678822a453d4e876bad4a6b0d4b6cf98feb60339c9eba2a
  58.898 +dce4ef7faba428422c503d0210dcf8d884ca9f5094aab9f3b1a2238b569f
  58.899 +444748902907cb0d9d7ca33fccdd0cd29bc68e44f7bca5092be6272bc949
  58.900 +baae5af92c302bb21f91b6ea8463265680f7c16f45d8ff35392a10eab87e
  58.901 +296f3af4478032b5b021db8510deb617941130d45c46fb3647d94b162fe2
  58.902 +2738766fb6d76a06ab6803818b27c5ff4205ba668f95b5ec5ce4ce6da545
  58.903 +c13ff56f417a4e0b3b8554a1e2a985a167e168adc8c4db28a601a80ab451
  58.904 +91bf32acfd8d25c39c2f17fb3bca1296d3d160f25b43b4d6b94f20ffe012
  58.905 +b779339b12860dfc897b366e3d400e756f4f9f4d2c86fb9d94c11ebd1450
  58.906 +eaf720056e2c39529331bdcb104d113b42c94af2c6a5035750b7ae7fdcba
  58.907 +b6116d74bc07a11d4357ecf73d99221dad5cba4a7136425c2a3ac0e092fd
  58.908 +606a4ab722195e3b7fdfb5a5e3ccbb85fc701c42bec43b54e964dff3fa04
  58.909 +193043eead7681cedae9cce6919949ea60ef5630c4b9263c8f98b4bc74a1
  58.910 +63ccf3d0a0bc1deff39b800ac90bd734dda7ecdc73169ad77e129887db80
  58.911 +7a253f8807a422eda8a16c9ee9bb8fc0942634bfe035dac9f7e36d09844e
  58.912 +39477c043399db4d07b3617da9d6eee76d0fde9201da98b906050748b68d
  58.913 +8c944ace3c96e90a3c2b63eae27b9152cb7274fa336866d71b65a57f1bc2
  58.914 +bb1f482a67f3993dcb3ff24abb0223f9a026c81b2b33127a1dad8929dec7
  58.915 +5d46bdd790eb1addd771c5c3965a2f514d3a128117a44560cc10a729bade
  58.916 +4e6c86de7c09a39602235c803902e34f5c176b18e127d71a011dd9a3a61e
  58.917 +ebfaa4a4e2a5651be6f4067e5e09bb4f3514d67c2129e4d3ea9568661138
  58.918 +1e45af07bd84f883c70577a986416747f3bd8d1bf86d3d7b07e8a350899d
  58.919 +3c2dae237bd5ece45faba7a0ba30fcda7b7eec9fbeaa5a94620686d1e403
  58.920 +1cd2512e8d89451c7bd8eb432c8862023d66f3f9fcec0d47598e2df59525
  58.921 +d673a5ff493d458748cd6341f161a0a3e8996ca5b496508578fe4f653924
  58.922 +2ae28bf4b7397c02b726fd5f9d8b898938bb668a546be6e42865f4f030d9
  58.923 +5faa289eb24f7b8e249b224a95a2245605d67417a489626df7417855b8d3
  58.924 +1c0043cadd2b461d32e1b39ccf409757c37b68f84e752bde6b5bbb847bf1
  58.925 +57ea3434802def983d6ce5ceb3e9fbc4911b5484e99bb94dc3f383e50672
  58.926 +0e85a91ed378e352838cf02921ee0ea94be01b5a60f9b1f58fcc1b4f527e
  58.927 +43725de9b9dadc3ef462fa279bd7138095d4cff2a0563039f71e383430dc
  58.928 +f628dc9611b2e3db08fb2da1d5383dc1a3c784e1e64541fde1d9d7f42505
  58.929 +de96d3d0a401099fc2879af0293b0eeb143b78cc221f670c0479bc150047
  58.930 +0cacb9a282e334e428b527acdfbfc56e6aec8d4d60745c1dc000011b6248
  58.931 +d9ab4a17dca7cc74e17d33c0641710b02cb1edb0addc6be214b17e9f845b
  58.932 +2d9c8bf03c19e131e00f91f2a393b5f2ae7c3d4ae9021c4d7891d84d5067
  58.933 +377ce92836e42eacd7e540824f7ac95360ce116d41d17a50748748971c82
  58.934 +27f089a22ee0d21940de854f737547b73c7517addd9bdaab425a6c2908f6
  58.935 +87dd990d6cba4d84308bdd4c4435a6480ecfa1a14daabd4d8e2398178e48
  58.936 +de28b84f7ce4b61d2e6e64fe043c29a941f6de7621ee6f6d8b506221df05
  58.937 +db238b8fe4323cb5f259d4d3d9c94d4ae1ca37d6c34345489c0284171346
  58.938 +e9830e2e3c6c167238a7ffe0989d3eac870cd44102cae139469b9d909b5a
  58.939 +9c34792f693ac94ecd35d2277080e30a2d24b50391b6f2a3d3b6c81f7ed1
  58.940 +a7b218903e7fed7a63269e27d793a2e0b40320ebf447c71f36d40dee002d
  58.941 +7257f43c8add31edf2c571123e46fdb413e007cc89e99b6f98d77ab38bff
  58.942 +cf140f787e45ffb2c7cc4ddbb59a4e32dfc36e2875f204ac851d757c1236
  58.943 +12deb31324ea4c201d27fdab46e9f3988ad2bcfb8e9cfa8c487831a9b0c6
  58.944 +60b20fb66b4c77f52359ac96f3b3d189aa0571c1c53db06ddb10f08882db
  58.945 +0b1e93e9478d4c75626c5fbdbc6044c4d82684b310ab2af144d12bf36f1a
  58.946 +c0bf6249d1da9ab319453594cb19d0e93c4e047fb49229c0cce76d0cece4
  58.947 +2e76fabd2425382afe707db032cf617b046a59a2fc1bb3838d98fd5c8053
  58.948 +ecb918bc14762e4ca45027623988f434ff4cb08bc9bff5d7de21940e3e03
  58.949 +1ee042d9c30662aa76f96213fb5a92047af60f320e4660eadd1ec19d0086
  58.950 +072f2202af5f219725f81882f10d1e065a8035a9946d0ca0e48a5e7dcf61
  58.951 +0283b834eda01e7d94b3453830daade2aa6c947989b290c02ade0d7b2620
  58.952 +813ad177ed82813b6a985d5c0a2d42419bda763d409da085936e33c817ae
  58.953 +68e5467eddc30be172de855a0f7f5c527555b3f4d942401b450f08273b1e
  58.954 +c5b5352fdb8562a71f276284cf7c27537e628f94bcbffe8d669ea2645752
  58.955 +60830f1e65e83a2204cec393f6d92d4f61f317471b4b93039d298ca2cc94
  58.956 +eeada0140823a2bcd1573e732e7b4bde7368f2ecca5961ad547f554ae989
  58.957 +98d87b7e5d07a85c382bcea1693a697224f41eb8b406bc6a0c3eddfe8b5c
  58.958 +f25b11c3e4bd91ea7d6274cd6b3ee7b8f18cc3fd502a324c645568dce9e0
  58.959 +d43caa61f7306fd5488fcfc439d85f8160ebf0ac90fc541f9c74d35d7833
  58.960 +09309807a639477bb038200738342e50136dc64baa7cc1b879c61f7e1b90
  58.961 +e1f2bd4f6e54c4dc97b8e4adeb102979203a31fe26a7f58c609915a95abc
  58.962 +4acc263179423f8ab16b04272d5592fc536f29a45cbcdbe15890f119ca9f
  58.963 +c7a52eef41dfa5c4fed087eef8e698ba738e300bd58f2a1a10da1198c1f9
  58.964 +b60e2032f8384a86aa84027df21cb87977528e3bb9bea1e3a6879c56402e
  58.965 +a29063afc6ac0194f4944433f9a5872cf0a2a741382d7f3c0ca7817d5d7c
  58.966 +4b8bf53af0f18b1eb54480519cebb61d983157e039b13025e7980eb36f54
  58.967 +3451bbb84e470ffd0f98eba80c74f238729dd6278294388a2e06de68a719
  58.968 +47b6d478c85f124d14aaa835620e49b7f5a4f21347302c0f0864f7ebaeec
  58.969 +d0831c36187cbe9c848736764a31056d2cef27c07cca00033dcddca9a2f3
  58.970 +b9ebf28e67257b69cd38bc23c711b6a2f6e4dda9bf5a19da275e6a8d683c
  58.971 +723bfbb95a90a344a6f421f0b67ae84c74652288b0597e4c86c28f73808a
  58.972 +77455f2948e8df634c2d14f221626b019033f9230c9167982cca9ae6dc37
  58.973 +aecbcb49fd9fc1dbf2d11bba7187888721bc42a7f47c23e07d2fc5a7a91c
  58.974 +0dfe255a7f9d17e69af1618502a6b90b1dd748c7eaca1e1ebe8b861b04ff
  58.975 +e5f628f47eb4e7e65311037d7a5713d7cc3552dc85f452ba74c4f12aecd0
  58.976 +d72892c940c3325640d62fe3bbbc71361dce6d54766e1fb99dedcb2d19d2
  58.977 +fa6fa21f9116e03952ebbef659816a62db51a9b5b3916ff818518774ccd6
  58.978 +79d44100d7236f211f36fa80a4cbafb3db76ba1e7e7f12082b0140eed2cb
  58.979 +5e793e24501715c6c170ad4f856a4bf16bb10210025156e635264d3cf18b
  58.980 +1fc1e8cd2fcfdc2ab1a24af9087975bfcf6fb703fb36e288e58d0d2ffc98
  58.981 +bb4318001d931ad6161dcdf8984e6690e0f6bb07af81bf07445f8f57b355
  58.982 +6b960d24e7cd152708489e4d953ab6a155a757e002ead97585e6c5333d7e
  58.983 +5aaab2731f047f3490432e0ebf3d0d628eefa8c1f665b9c86aabb0706639
  58.984 +5bc372e16378f0d9b439c98e7bf87be73e934995d58e4e70d3ae9a5b54c8
  58.985 +87a19f2826a772c39d41805c642354d9bec75b065f148f7c1e435dabbeaf
  58.986 +e4a5744e3f2894a928121ab069bffa3218a106a9dbb83971353a7c7a5616
  58.987 +d9da66fbb908173f9b07aadcbd4d112cc353e7b70476046ce5a92e86eaff
  58.988 +4eec40acc840005f51f55c9f5874216851e9cf3fa431d95d3032e779e356
  58.989 +4bdce33966a3a798b170a06c4cc9f73700224c858c36bbf2d0326c337ce9
  58.990 +46f69c19a84187fa50afc5b36010f9a7612e3a25e846d49bb907af9505e7
  58.991 +d8c78748d7dcb501bbb3d6603e829deee3784f2f3ca583d3738d6d2ecfb8
  58.992 +eaa887103606211a3c1b5cd74a3e0e96fb57da91baebaecd3669661e7b1d
  58.993 +579ba41928a40a7028acff6cd409e601d23ff66ff2c8acb12e535360d727
  58.994 +60d2e988d801930e0e9443d60dcb9f378fa75d58d73e6a3b6e5b26407c82
  58.995 +67d50ad97787f8a9b91765e41552283cb67e43e59bf71cf08b9755c8ce47
  58.996 +0cf374832c72d1e9702b55bcfc8b5a4e966d5072fb2a72a2108574c58601
  58.997 +03082ac8c4bba3e7eeb34d6b13181365a0fbd4e0aa25ffded22008d76f67
  58.998 +d44c3e29741961dbe7cbaae1622a9d2c8bca23056d2a609581d5b5e3d697
  58.999 +08d7e369b48b08fa69660e0ce3157c24f8d6e59bf2f564ce495d0fca4741
 58.1000 +c3a58ec9f924986399480ee547ad1853288e994940bd1d0a2d2519797bf2
 58.1001 +8f345e1bb9cbf6997dae764e69c64534e7f9dd98f86b5710ff8b500e1c4d
 58.1002 +f509da50c64e213ebdf91978553a5d90908eb554f09b8fc2748c9c405903
 58.1003 +e7bfbf0ea7e84254fb6735f09bf865244238e5fed85336c995bc3a3b9948
 58.1004 +947a6eb95db4cd1b64c0fccf82d247a2202e9e7eef5a550557625a0192bc
 58.1005 +8bcc9e461e52833f6b8729ccd957d5c4b6e07016e864fc02b792c7400ace
 58.1006 +d0a8f43c755f87bba6e5c6e1022416e5454cb34a19865d951f7aea527760
 58.1007 +53658cbf306ead832244f3062c39a0a121a1157a8e47008163c5bfc88197
 58.1008 +be16e9a1ba26a035a16dd38cc28dffb666dd4ba7356c66b7bced9e26e905
 58.1009 +4ce25f6d36607d8f5dda1e21ac96a815bb2989f01130ba1aca9aade554fe
 58.1010 +effdfef5d6b0d2a01aad92f599f6a12e121010ae6acc6f150f19e7305271
 58.1011 +97da761b07530ca19b84b119e5edca1fad18462143b8913d6b3f6864b713
 58.1012 +7a93bb9e1bc29c09d660704e8d8292c61072ebfe35c354a2342b2458a353
 58.1013 +31d043874380d439388e46688a53bcfe01bc190ef1a6b5dec9d40aafe822
 58.1014 +261b28bf3e2d76f3dc4302506ce3387b4aa2a51cd4ba1faa2ed1fd7df664
 58.1015 +6772fe9f83d253451eeb0448b444b8ca80cc7cb653c2d1eaa0de6f2b1c72
 58.1016 +47e6d24ae72e620e200aff83a557a1aa7a0ce0a9cfbbeae03c31d8cbf1d8
 58.1017 +20b53b688ed2ffbd83418d743ee31e3d62216ac7be6c12bc1917548cf670
 58.1018 +d69fd2e78d9f7786ada0ea30a6f6d9fbd1f1406337151ffa1d3d40afbe03
 58.1019 +728fd1aa2fa8a4f075796b9de9586b71218b4356fb52daa01d3c18cb75ae
 58.1020 +d4d33fc809dcb6e3dcf7aee408a0cef21353d76ed480bf522fdfe86e0e0a
 58.1021 +b7d097defcb793057f0ce98ea4989a9b6787b14029a4bf10315a2557149a
 58.1022 +fe9c91e7d825f7518b343fb556f0177a8f6ca08fbda9913d52997511590e
 58.1023 +b9942c9813b4cf4d4aae4919401f2fc11fef0620eb5c40532cdb22d5fad6
 58.1024 +919a3a710de6c40d54993b5386636499c866938e33bc703a99c73adc228d
 58.1025 +95cac73ff4f4a275c04d0d787b62c6a184dacc4024d23f593e7721be232e
 58.1026 +9882fb738160e52ab905f0ce2c76ae6ff2c8bbe118a1acdb3b464178cf01
 58.1027 +94bc6a50df1090e9221be11e49f254b06c3236a31569b947ad041d1c6b55
 58.1028 +bfdec3c18c791ace0fe2a59504eef64a4eec4b5c8dd38b092745e0d5ad29
 58.1029 +276bf02c419c546627672a5764a4904635bff86fd0781d36fbdf13485229
 58.1030 +71f355de2b0ad250052f50ad70f61afc870ac7a816561d3232b73360d4ab
 58.1031 +2727b2fd045f254c782bb3f1f49d94c6d625047071b7e32da5c6d21a86de
 58.1032 +9283fd632074430772bfbd85e0c9ccab1dec16bbc049c3e223bec1b65c8a
 58.1033 +9e98cf58b30a74f74f1a842dc91e30c023498e280ac55edd58f4cc731d81
 58.1034 +e443d9b9efdf5fea63c9f357320e01b8740eedaeef2495cd02eb2f338b3e
 58.1035 +674fb074cc497d7b1937b188da857c2c230e9a931cbc00c85a7a36fa80b4
 58.1036 +56588e1bbabbe4ef429a6aef9bd4eb89c5752421bd049aa13f4dcf9b51ce
 58.1037 +2503e90bc118fac78a25d187353d6f5d496cd6130b337666f49619cea985
 58.1038 +dfbeb7e49c67c1e0f0f8e9ec8ba14624ed0982dcbb69415e4b3c8ddba140
 58.1039 +397eb1fc1ddd36c94c374f018873ba41109e45afa51f0e691157d5958c06
 58.1040 +26fbc0903ae25e47ee372389cf65472a3e4d9769550bdc42c0b72f9a297c
 58.1041 +d5d3c16ec67e06036e740ab664abc9f10b9499269b73ad3678daf4474329
 58.1042 +c2c7252c1f0df1e3b5e8f198dfef8325cb1e7e8057897a3d7fb5bb5858e0
 58.1043 +cfc0c115bbd7362d8e8ee41862af6eeda681cabbb06f72ebd2ae0b0be45b
 58.1044 +a9e1be83f1da30687a655e5d148fcc17d9f53b760810a565f6d2f4cd5da3
 58.1045 +5434116edef756adb4d3df544a1de593be988f2bb8d36c34deaac7d9dc15
 58.1046 +cba49764f1e03aa09fe21fcd7c74e3d6487ebe219569e019f10dd163046b
 58.1047 +c1a3cb2bcbaa8558197cb2c18709a998b4efa8ab8c9a71d2ccf942c17662
 58.1048 +1b88dee6b424165d6ce10ac48375e760983818e0085276b1674dd41042e1
 58.1049 +a01a8de111c903f74834199b3230bd475d92c6226ef74eb1daaec3475a6a
 58.1050 +fcb47644a17c7e390ee3b16bef1c1ca6c55eddc44fbefbdde525921b3047
 58.1051 +0d76817bd8ac724739a8e743eb09cf78e88adad527d4f115b8a32ed4898f
 58.1052 +45bab3eb802b8168aec061e3ecdb026c056fb9efe7e2df48bd516ccb12ce
 58.1053 +00de08ed8be4ee0c41f40f4c8f64483e0ade90a78d6d4fe9203fe0b97c60
 58.1054 +3b2f8882bc15a212453c691c52d00fae8a3a26934ff8acf68d4352eef75a
 58.1055 +0b10d938e55b7333dda2db0296a69e9775bf82b1aa6d684fd9080fc1c11f
 58.1056 +ab4369c7a95a9504063db900a6e345bf6dd99be041230b2e60cc86b8c345
 58.1057 +1d84a9c2cb4ab6d74d63dd43dc26eb6b384f5222796d4083dcc3e1651548
 58.1058 +d9469f09a33b213a33ac52a6a2e23802d8f8a75c01a607940daab0051410
 58.1059 +73a88130bc192f303616adb113c0051b65e12086cb319c0a5323fa7def40
 58.1060 +402f5f87a3b2c2cf0e92789985f6775ac2743e1ffe2d0668291059740d45
 58.1061 +43bae7a2897e5e658592bf5a72966097742e0702deecb0cb12499eab701d
 58.1062 +34ba37a08346217a415e44297a181bbf3744f0a49230ad6f030e11462be9
 58.1063 +afc2ae14e0587bc02311b48b8e2122c28cdf14414f3680fa52dbbb63b17f
 58.1064 +6ebe4a1204f3c5d6150cbf89a8023890383153838d4dde77d4c8b1b78823
 58.1065 +8918c564d3babfe58eeb154307dd1997f5ab7105426e35c279008b2677e4
 58.1066 +695c60f956b348799c04b734338018fc27f7de7ad9d73468fdbc5283bd14
 58.1067 +c066ddad9a3562f16baae15d72d7bfcb409e1c874e9db1a8cde233b282b9
 58.1068 +6e76e9c08d85ddfbd3cce7e64104d0b0e95291bd91f405ff82f41601ee20
 58.1069 +8471e613fbbee67f269e4e954c36d1d18ca9880b7cc2b08fc990978efdc5
 58.1070 +1d157deefedaa765c1e26ee125d4a2514a41a3b95e9151a824532d7d6486
 58.1071 +35ad622718fe71219a697e94c2e64f26424cbb767acdef5cda70e179cd29
 58.1072 +b7e318d1c6d3ad26fd5fdcbf2fc221301cc1f10f5ed86b40a1a6bcc01c90
 58.1073 +eafd65183e75609610637b99fea57885efe76437df02a2ffc21223d039b5
 58.1074 +74955d9a54ff41980eddaa8768c5ad883a0c9150877392b990d63c6805db
 58.1075 +7b8d6ab1358cbedaedb6feadb0ee4fb8f9c1ca03a3e755a74227a8930bb7
 58.1076 +2ea0a00b48fc626fa14d7d48624aedc31c556f44e982f3ccbde7ee735f73
 58.1077 +629ab1b65bcbcf0a3586a920477e8c960219802fcb1bc3a179032b324f8d
 58.1078 +c424899b38275886cb5bc771f26a0880767d49cc23426a40a4b6ff8fe48f
 58.1079 +d747565fc537565f6d7fd08706accc60f5fbcb45bc785f45ee9b0812366f
 58.1080 +ae71b23ec43f3549c8224d78baf18719f05108d5741e681457ead8abc050
 58.1081 +462481771a8dc6cfeb98956e163981a98c59ab44d90e9c3a946c453b5071
 58.1082 +db0c769f7fb5144c7ab0c9ef1a6db1addcde1d4ae1daee1b4035af256a04
 58.1083 +df53926c7a2dcdb94caaf12f986e20929ba4e396f3aa7c93a7abaef1294f
 58.1084 +5f13a0dd3c3aaa8fb38da3e15daa32163b7437af683b4f5e64cb14aebbde
 58.1085 +8c69ed2e8cdbfb213fc8129af29ca2c06c8f85a5038d688d1fa5d1b54ebe
 58.1086 +4dea81a49ce24131f8e6702e7aa4e2cba078d5dd373f894ccb275f49c690
 58.1087 +1dc772e1d2f5fb3fe15dbfffac62c87110162074eb72ae4e5e446bf7e650
 58.1088 +a554178d0d64d3c07f330f0d99e99f2239cb1597f2e5f443854cdb0f5fab
 58.1089 +b28fe62f22e7f3419d017980f325351bb04f8f3c3dc57fee03cc029bd29b
 58.1090 +202308d5a800ed2d500d41ace8e54e2557bf25b627883beb8118d800eb94
 58.1091 +f4253f855168f7fc8a2d29c5fcb76bb90a6c4e345722b8991a854047f46e
 58.1092 +4e97336be85470b6be2b9ba573dbc4967ddcdbfc3b6fc35b0c7f3f2f570c
 58.1093 +55dc3fee6d80bc6f46cc7e4d86a0b86f6fa61d062e213d9e442db63fbf11
 58.1094 +d03165b44572096995ed342893bb672f6bb55ff8fed944667995f0f89a48
 58.1095 +a904c47420f32afd14129c6e2bedffce1f07ea69d550b6909bb5beb4aa08
 58.1096 +b0b44f35e018ba5206fdb4df0228462c1fdbb95a429e53eb27bb1b0490db
 58.1097 +f07202c3608d0f4ce08570e3d6aa3d4581c569b57bd8c1ea0e4ed3fc5497
 58.1098 +e316ecec06e6be582d9170d426f6d22d8c7287b8219945c124941ca8812b
 58.1099 +e97efd9105eb6999edc0665016633b3b48820df736125b7c76c9f3a67d93
 58.1100 +8a2a0a6b743fd42aebc46a0249be459f16811ac9eba7b63bad7c2e88f175
 58.1101 +0eff8da5faaab5659824f9d19b3225aad2ac17c52c523414d3031d08a926
 58.1102 +30abf474fe02a32b44d3b7d9fe0c19aec16ca6d018b71d9d395ffaea0788
 58.1103 +0d4501d7cdf0f7077a2d63303d09083080d67f1f714a1b271dab9fc9866e
 58.1104 +4b0571a171eec8a4e351ba2d02438cd108a33b1106acaad0ccdb051061ea
 58.1105 +7f40543748115f29debfb4be4b42cae8762d62114ec6f8ef68c478a8e05d
 58.1106 +ecfa18b0368428efec9eafb2353f95e3d71e1636b9d9f94a77e692843255
 58.1107 +698576dce13b2b858d2d15ee47cdba3ed08d64b77ab46dd29bba6aac2106
 58.1108 +ab847de378cccdaf35c64e50840248915f4fc110992c493cb1b9cd0b483f
 58.1109 +0f1abf5e9b018210b477fea28234ffbe5e0bbe01338e0842a89f1e00a0ca
 58.1110 +7cdde0b2d7c324d5e17d8d3415ccad703507497ac95360ce660b656e5f66
 58.1111 +72a2f50761f3d02ccdc1d5692d7797699b8e2147cfd4817c81a432ff6a5f
 58.1112 +39cc54927fa146cbed56a55f85f123c0a94b7553a8819b329d9dd122c502
 58.1113 +94e3f6314d5117db89ae7597c4691b6c542979a1ca3d26a8e23d3eb698c7
 58.1114 +1841651e08ec771cfb974d6613f2143872c739b62796bd0a45172530793c
 58.1115 +28d93a65b59f79c245248d2c09428657a35b0c0e367bf7a4a4f0425b3f4b
 58.1116 +485d9f402e164328a4b963f456829a39035c00283d2e4fcb71a42da6d42a
 58.1117 +d46cb751287de34e6519c60bb3f1a6ba91f7bfa21dca96ee712af5681701
 58.1118 +18ece8a0535d9ba1dd4bd835e004a2f38c5ba43c9b30d17045e5649fbbac
 58.1119 +188922e442182d4bdafaefb39e00106a5a7765f3d67850471e3629e526af
 58.1120 +8691f935b57bd38465665204a214fef1006ea37dc0781073ced5fc042781
 58.1121 +93650393c3cadfddedcc5550ed483bb6355f54600e9758e647f9c9711f1b
 58.1122 +e7df05d0e50a698615307c18f6d4886f50188011ba499d03831185915f3f
 58.1123 +77c4b9ce708d78423b110776aaaf90396be0381616d1e9b0c1dcf68b6396
 58.1124 +82399da2a7323bf42ae5347599ef4ae9e5c135522c5ecb87e201853eb899
 58.1125 +db60d24acad17d6b7c2c7ea4dc221f3cb6d6caacd1ac0822ea3242ad9b4d
 58.1126 +d15116c3874e3012fad26074a23b3cc7e25d67ef349811dbc6b87b53377f
 58.1127 +0cf972040a037ecb91e3406a9bac68c9cab9be9a6bb28e93e3275b177cd5
 58.1128 +0b66935cbe8dd3d6a8365625db936b2cfc87d4d6e7322df3dbe6ccda2421
 58.1129 +a5e5372566f626a5e9d8bc66959e443286f8eb4bcfdeb6c49a799f1efa69
 58.1130 +63260d0ea2d51260baba9207fb246da927fc4c89e9c4dd5848fd4ef6f81a
 58.1131 +cd836f5f06ff0fe135cafd7ab512af55a57727dd05a5fe1f7c3c7bbe8ea7
 58.1132 +e6680fcb3bbbee1cf2e2c0bba20185f00e2dc3afd42f22de472cdb3eaa5a
 58.1133 +ddf8c6fb3682eea5548c51ddca25ca615221127b4438ea535ab3089c9ed9
 58.1134 +b971f35245cf831d9461a5da9d57bc4e5606d26535a7414cef6aee2a7b95
 58.1135 +bf2276044818ee0f3b0a16532934b8b745d8137b42ec2b28fae7d55fc02c
 58.1136 +9ccfa4e0055f8a4be96e1e235c01b8b6ad509b832a3e90161e0a449934e7
 58.1137 +4be973c939b31cbc19dad4c58e9be89d242f0ce200548cdd4fa2081ab3f8
 58.1138 +e01f358d5db24b7a50eb2096d833378921f561f132cd7988708ee10cffb6
 58.1139 +2256201801c667e176b1dfaecde9756d725bef093457805e16f550e8a7de
 58.1140 +87ecd46e5b09646b73ee74f890a36867636911e4cda2c46a40e7d57cf297
 58.1141 +9696046614c85b1a47ba55c60544ebd3ad7d750d003bda56dd7eed8c4702
 58.1142 +f8b319aaeef9d3cdc59b3e63ee93c6e1e857af273eb90909ecf36ef4c276
 58.1143 +895c78aa762e5376c5c542f854fba864ebce56e4b0207091139f053c2c08
 58.1144 +3b7ddcd0a9909b52100002bc3f8c47bcb19e7a9cb58b1ac03fee95e81195
 58.1145 +072d3aa7c8079632725f63425a3550a947834d29ac9a26d0774e90248e18
 58.1146 +996731fd9aa53ab62b40ce557d98e874b763d9d629a173f0c7babfc00ae7
 58.1147 +82daef5f00cf3608ebeef403dbbc19e16a1d160b889f4a10359d9eacc19d
 58.1148 +7b5f126b31720dce7fc35ec861dfa56ea23fa18423ff4e8fe6e53fc6ba16
 58.1149 +b95a2b5dec00f614e4f835281ee0b4bf549e7e882689e0b445dd46fc40c9
 58.1150 +090e5575fa2c34b02a51ad0bccf6a7bb83ca3b929285e5e9fd054b72c47b
 58.1151 +733a66c5abda526b18b2e49d0746e067e63b948a45eab2f4221c5b62ae21
 58.1152 +a5d9d7cd8aa9eeb49588891d22c56b14b55ceb6488f02b73ab3b7f6c5555
 58.1153 +b75452594658255e4cd58ac4815f2e1bc3888c6777f62aac2f0a57d416c3
 58.1154 +765c991f0f9a33d888aeb2d527b482c042ee23783a04a73ad13dfc590a52
 58.1155 +f3116f8296cacc7ab29b7d87e7864561a5d0a12bde2d36ee697064f41d1b
 58.1156 +ca6ef2f801caab5295d19bf4c02b10c19f73b44635ba48a0806b967d7dfc
 58.1157 +ce9a4850171a78532cb30020c0d66b3b1e7c75eaa7894904c181a022e8bc
 58.1158 +9b2b8ef1202f3c7d36bcab4742d4a4761bb55b64da0d99685d319f5da8fa
 58.1159 +132be6c0483f50e2657ae8af1e28f969440d6ed43eb00e95fd9e1cd490a4
 58.1160 +8646f6d008598751f7a41b43fbec7770fe591012b6b0c4ae18775ccc7db5
 58.1161 +de0ded2dd53e82c89648d46f0d0cc5d3ac5aa104239608d512a4353b9547
 58.1162 +04fe6eb7e73d718323cf9d748b8ec5da01ec9358267de12cc22b05ef0312
 58.1163 +e4b6ac5dbb6d06d7f2d911f20d527f504d62547aef136834b3695df8044c
 58.1164 +383b6145e824d3931a602f081d9d656f84987a1ef121772f1f5b37a116bb
 58.1165 +d2e77d4ccda01411545d24e15ce595db4cd62ee876b8754df0b85b44e011
 58.1166 +b82d76ce45795e6c2c58be8690b734a8880a074f303a70da4a1b086a6de6
 58.1167 +56c02cc7a4c25258eff18cb0fd868214bb46f972e26509f868d065b3cb14
 58.1168 +1c316898cf22293391bd7051ac3a6927aada952a8fd0658ce63357c07f34
 58.1169 +acbf8c99a5537da0023e901f0eb5547e1b466b7d982c8c539798b76ee2a2
 58.1170 +252437a81a37c3b63f625172d682eeed0b795860b2755f020ef52a138353
 58.1171 +003c61be2052cdd7d73b2cdcd26b127660a7b22fc51a6a2f6034f37e3e46
 58.1172 +c1d7f83f8b28c7c965993abba1d358362833580d9c63fa85d4cb949f97de
 58.1173 +579fb6807b95a58b78f596db50055947dd0d0e597d9687083e9bc0266e86
 58.1174 +90b884b27f4094d8fb82ffdbaac4d580340a9ef8aa242be87e54b601af19
 58.1175 +87a48d267c04e371ae77163ebd0de3f5297b1060442ecdeac38334844e38
 58.1176 +0f294d4be73935fd8a38de7fba6d082c3d9156d7e88f2cfff0459377cbb6
 58.1177 +041f37a7e05010753b98e0b67d5827aa312129bb3c3bd883c12323756406
 58.1178 +d555720da8a0bb30edcfa760c01ecc2ba3b15fecccf5a10e9f358822e0ff
 58.1179 +b64178fce2ea6a1105bfb72df0e4bc499b207ae26b8ea960de48e7ee7010
 58.1180 +b4e671dff795e4cdc5b43e81b1604d224f0616ae311f1208859c502c1a10
 58.1181 +940e7b9cd11be728bd3a0c8005ae23aea32c1b642812198a6f1aed32cb75
 58.1182 +97152b1340dd35ada1b81051e393d38f3740fa9523df6a83b8ca7dbceb33
 58.1183 +6e299b54cd998d4dfef804733c76156585e42b7284cbcc4047ba6b290efc
 58.1184 +aa60953e98cd2b4bc2893857fa6a339f820142a52ccab0df09a2709df550
 58.1185 +f22e5921cbca408e7998cc1cccb8adf6d8f8b71e6685ae59d290fa33f5cd
 58.1186 +664d73e434237424060f634262f04e9a71a977556e93b692ddc3aad26d92
 58.1187 +97dde71e4def64932151ad572af6e681082e9944ddbec6e7a8bdfd534233
 58.1188 +9ca3106ca1ccc80eab14f1655978b137fad8f399df7cbfa2d7d3d9675e0e
 58.1189 +9afec37369a8ede2c93145ab3f42a375926946680c215fa16bf7416fc892
 58.1190 +bacd806cd424b9f85b47802c4336918f7486af2a03bf0d39b10169d35494
 58.1191 +419cb1ab7b8f407897f70c18303e91563b497d70b7181ede6aa0c3efe089
 58.1192 +ca6135b34dd1019b298e3677f8da61f864a67023c31eaa716c40cf3d397f
 58.1193 +9a1209564c9ec759c37028079661d2a56374203c78b023ec61340bce5d96
 58.1194 +e477a4f77e5c0db7c0d1257b4bbbc6f889b17e6eaab045b8adef6f931e4d
 58.1195 +0795583d60a6b7002cf61639c6f930671f3b8ac05a1c4e002f4bfc50d8b2
 58.1196 +3029fc4dce1b602cc3a5533336271bccc226559ffb127e3a562f92f89824
 58.1197 +552b9a70466d5a3c74ae515a222b109d490f26e8fc2d9d72bc8af6d1dcc7
 58.1198 +80463c7af81993bac2ce4aece9d95ab736b1dc73e32d1237bc8ec2b52513
 58.1199 +36dbabb4ecc7ceb5d18b02043281eb9a3bfdf19bc4853c9b1722ef1cdcf4
 58.1200 +fcec534923db2e2653dc48545a9850c0ac2e4594abc9f7d18a0bcf2fadfb
 58.1201 +bf085d465a4d10528312f5d790eb9511ca01061c0d94136b99a043bcf278
 58.1202 +c18223b1e0f1cc062b32b79e28dec2dc59a0aaa4b5f3506923c83e6a87fa
 58.1203 +08a1d941bb644c994491cf7f3b0e2ccf6c8a8ba89376f76dfdb592374f93
 58.1204 +528e78e31e0b18719346b9f1486f652638e3120687774030444674cb0778
 58.1205 +96385c41f6566819652d825dd58f9a4308ff79b45d7828dcbfebc406e40a
 58.1206 +c46e866cb0e3e97d6ce7fcac19a9d0fe39bbde66c5f0cf775eb3b1e6d7e1
 58.1207 +1f67e7edb3d5c4facc85c916bf13322b56a0414ca27d145cb740fa2c37cd
 58.1208 +8c142d9301f1ac3704cf6a8e93973a07fde5a331cf0cbb370c7ba555de61
 58.1209 +18a6cea0ecb2c0e37152390cc57e2e4fb3791ddbc383ee26b6f4006d0d68
 58.1210 +4880888011020f856a9de47f45440f127cf27ccaea7d40a3869d39ec7dec
 58.1211 +ebc06382d294717644b6118354e15544fd4c6d88df9245c9a83b30e6ce09
 58.1212 +e2498dd1df488a019b179cb859889e6ad2838f749e3b038b280ebc8d5c3a
 58.1213 +b03e8f15751214691edf0f86281e612d7ec0773c8a5d2b433266402df62f
 58.1214 +fcc06879ca196aaf1fc73a5f01ac46b44d6cbe7743ae9a862c20445ae2be
 58.1215 +1544f413d010280cc2941900bf3c42ec088cb21b44a915bb810e7666b545
 58.1216 +5324465c5943eedcef0c09128a995f431382e2062f5e39f4338c8eba1bca
 58.1217 +e553cb60bb8f3e5038ac8073398c49f06dc734b18afa7921ea0d455e6e73
 58.1218 +db8ad9f77fb5ba6c28af6b4f18cbe46cf842c82d6c960be1520a5fd929df
 58.1219 +ac7e00ede976fb2be0a07f659079a421fca693de89ce9b8fcb42b0176d9d
 58.1220 +f3ddd58f921e13e216933d27b49d175b423751c451be7618eaab054d3b8c
 58.1221 +23e8dd6fd60182d61e9b5c86b3b764a29a62f913ee7524d8cb33737d7224
 58.1222 +d95dc4bb8c2ad6397604a0ffecc8865adcb540e5da1cd769077838515118
 58.1223 +ebc9f0b988545c1881dd2e7a8fd73e11bd7ae9085fb4d45526b23a346b0f
 58.1224 +e4281ee3d588106db5f7c386c488d8f2f4dd02d4c08e74c1034f987a44e5
 58.1225 +d39fd07538de57a42987ce290fb2f6557e8b5cbcaec168f5780927226415
 58.1226 +1e11e3667d33b36a793aa53e9e2d1102c9eb30cb3ba0ebac953e0227fe4a
 58.1227 +3d3c0eb57e4390c3d35db0c41946e45be2830a1ae33fa25cf2c7c9cb4550
 58.1228 +ce9ff6c6e3d628fc7284daa6241604c90dde6339b7f7e7df3733416cdac8
 58.1229 +e5291357e4983d74d3582a490438a7fdb0af97001a31990b1de68e6adb48
 58.1230 +917daa387e647f9f13312db57310c7dedc2a2ea80800b4f4bbaa99c6b7b2
 58.1231 +7ac8345cb659489307e2565ebfd17774642c9ae5d3c18068dc35170c7d58
 58.1232 +4cf4173f1baf98137fa249c81f3347e1dadd6b1ba0f50c3b64c1eab183a0
 58.1233 +937b0f7278eff101e5267fa6480da7d602844416490c2c2c7eb0d44ac8f4
 58.1234 +75cfd611db5ec268db07c0b3608825c3e12834a2b2efaf5e2723c5199c42
 58.1235 +6011cf22e64e4c0d31d563f321097935ea0c6fcbf5acd3748d90079f6ab8
 58.1236 +687288dc55df29fe7958f566b27b73e2ea30747247f7a2b2add0602c7d64
 58.1237 +d23f52e7c96748e6a54ee8c4629b2aab8882169653f0ba7f05236bf14364
 58.1238 +244720f3259cbed73a318b29e4a9305deb65a2c9dec8a9d0f9a9f6fae541
 58.1239 +83e0f4b9a9a567057a1794945168dc23cec25d1c02ea9242c9fb6d8fc11e
 58.1240 +e8874bd80a5226373ae87cea91853d0625c777ceb1f5a6f3debcf2f75a61
 58.1241 +460c7b4067f568ecd01f62901ade8bf8fbc5db9c6720420496f0cb48a002
 58.1242 +99870773c2e7b12e83987a5d0290d9bbf589ac889bf7d4334a5147187a7f
 58.1243 +71008f216ce917ca4cfba5347078f354897fd87ac48af6a6c62711d2eb3a
 58.1244 +5882bf3b32c0f1bfda976f850c9dcb97170e78c229a27fd5e292d161ece9
 58.1245 +a8c47a223cbdc28e24f79f6429c72b5752a08f917feda941582c36d9acb5
 58.1246 +748c86072858d053170fdbf708971a0bd5a8d8034ec769cb72ea88eb5cd7
 58.1247 +49f35be6ee5e9b5df6021926cae9dac3f5ec2b33680b12e95fd4ecbf28eb
 58.1248 +a0503c10c6f2be6c7c47e9d66a0fae6038441c50e6447892f4aaf0a25ccd
 58.1249 +952c2e8b201bb479099f16fc4903993ac18d4667c84c124685ae7648a826
 58.1250 +6bc1701cc600964fdcc01258a72104a0e5e9996b34c2691a66fa20f48d7c
 58.1251 +2522333dfdabf3785f37dd9b021e8ee29fa10f76f43d5f935996cbf9d98d
 58.1252 +92d0a84ce65613f7c4a5052f4c408bf10679fc28a4a9ff848d9e0c4976bb
 58.1253 +dfdfb78bb934cd72434db596cb49e199f386a0bda69449ce2e11e3a4f53d
 58.1254 +be134c6d7fe452a0927cf6a9a15b2406f8bd354adcde0ce136378baa565f
 58.1255 +b9c51a03b1fbe1e166a1f92af26bd9f072250aaa6596a236ba2d5a200c90
 58.1256 +a760ca050421abc78223b2e8b2eea958ab23084fa1947574e846e48aeb12
 58.1257 +26cebb8b5a92089e9ea771557599e2fff44d75bcf600e76ae7289ba98cf3
 58.1258 +98208c5104562834f568ebd62801b988b0a9fdf132b6564566103b3d2d8e
 58.1259 +6a099b7fbad8a13b8cd7f6729bb6651fc1019e66c4bd6ff27410bd5cdae7
 58.1260 +4010bd68b066bffdb4fd5e3dd9cf7e1a1353f7a4c5157e3ad508f4ca0259
 58.1261 +9761b7cdd6a81b3560b8765be3b0432fe4c25dcb4001b00c7fa62874f681
 58.1262 +ed22127dc3974605a05be8d8fcf9701f859ffce4dc598091891ab7596ac3
 58.1263 +4cd851ecfd2dbbaa2f99dac376f7bb40703fd0700d7499a7c24726bdc9bb
 58.1264 +3b88c6a82e52686c1ee945d8825092bc81848a08722ac5a1d24353f95ec8
 58.1265 +18f3fa487d9600318091b0ae9874b42bb3cb683a2518b18cc1bd86c6e5e8
 58.1266 +3d37c14ef4fe0c77b03a3314995b1e7c1066b98c4375bd1fc5fadee1b024
 58.1267 +7ece4f95a0f59978d543910deb2e5761632c74c508269c4e4b9e315bda02
 58.1268 +975dc771fc30c8164b9df9172a4e571d8ca578cd2aaeaa0dd083e74cdc2e
 58.1269 +d938b984b96d76a64b8c5fd12e63220bbac41e5bcd5ccb6b84bdbf6a02d5
 58.1270 +934ac50c654c0853209a6758bcdf560e53566d78987484bb6672ebe93f22
 58.1271 +dcba14e3acc132a2d9ae837adde04d8b16
 58.1272 +0000000000000000000000000000000000000000000000000000000000000000
 58.1273 +0000000000000000000000000000000000000000000000000000000000000000
 58.1274 +0000000000000000000000000000000000000000000000000000000000000000
 58.1275 +0000000000000000000000000000000000000000000000000000000000000000
 58.1276 +0000000000000000000000000000000000000000000000000000000000000000
 58.1277 +0000000000000000000000000000000000000000000000000000000000000000
 58.1278 +0000000000000000000000000000000000000000000000000000000000000000
 58.1279 +0000000000000000000000000000000000000000000000000000000000000000
 58.1280 +cleartomark
 58.1281 +%%BeginResource: procset Altsys_header 4 0
 58.1282 +userdict begin /AltsysDict 245 dict def end
 58.1283 +AltsysDict begin
 58.1284 +/bdf{bind def}bind def
 58.1285 +/xdf{exch def}bdf
 58.1286 +/defed{where{pop true}{false}ifelse}bdf
 58.1287 +/ndf{1 index where{pop pop pop}{dup xcheck{bind}if def}ifelse}bdf
 58.1288 +/d{setdash}bdf
 58.1289 +/h{closepath}bdf
 58.1290 +/H{}bdf
 58.1291 +/J{setlinecap}bdf
 58.1292 +/j{setlinejoin}bdf
 58.1293 +/M{setmiterlimit}bdf
 58.1294 +/n{newpath}bdf
 58.1295 +/N{newpath}bdf
 58.1296 +/q{gsave}bdf
 58.1297 +/Q{grestore}bdf
 58.1298 +/w{setlinewidth}bdf
 58.1299 +/sepdef{
 58.1300 + dup where not
 58.1301 + {
 58.1302 +AltsysSepDict
 58.1303 + }
 58.1304 + if 
 58.1305 + 3 1 roll exch put
 58.1306 +}bdf
 58.1307 +/st{settransfer}bdf
 58.1308 +/colorimage defed /_rci xdf
 58.1309 +/_NXLevel2 defed { 
 58.1310 + _NXLevel2 not {   
 58.1311 +/colorimage where {
 58.1312 +userdict eq {
 58.1313 +/_rci false def 
 58.1314 +} if
 58.1315 +} if
 58.1316 + } if
 58.1317 +} if
 58.1318 +/md defed{ 
 58.1319 + md type /dicttype eq {  
 58.1320 +/colorimage where { 
 58.1321 +md eq { 
 58.1322 +/_rci false def 
 58.1323 +}if
 58.1324 +}if
 58.1325 +/settransfer where {
 58.1326 +md eq {
 58.1327 +/st systemdict /settransfer get def
 58.1328 +}if
 58.1329 +}if
 58.1330 + }if 
 58.1331 +}if
 58.1332 +/setstrokeadjust defed
 58.1333 +{
 58.1334 + true setstrokeadjust
 58.1335 + /C{curveto}bdf
 58.1336 + /L{lineto}bdf
 58.1337 + /m{moveto}bdf
 58.1338 +}
 58.1339 +{
 58.1340 + /dr{transform .25 sub round .25 add 
 58.1341 +exch .25 sub round .25 add exch itransform}bdf
 58.1342 + /C{dr curveto}bdf
 58.1343 + /L{dr lineto}bdf
 58.1344 + /m{dr moveto}bdf
 58.1345 + /setstrokeadjust{pop}bdf 
 58.1346 +}ifelse
 58.1347 +/rectstroke defed /xt xdf
 58.1348 +xt {/yt save def} if
 58.1349 +/privrectpath { 
 58.1350 + 4 -2 roll m
 58.1351 + dtransform round exch round exch idtransform 
 58.1352 + 2 copy 0 lt exch 0 lt xor
 58.1353 + {dup 0 exch rlineto exch 0 rlineto neg 0 exch rlineto}
 58.1354 + {exch dup 0 rlineto exch 0 exch rlineto neg 0 rlineto}
 58.1355 + ifelse
 58.1356 + closepath
 58.1357 +}bdf
 58.1358 +/rectclip{newpath privrectpath clip newpath}def
 58.1359 +/rectfill{gsave newpath privrectpath fill grestore}def
 58.1360 +/rectstroke{gsave newpath privrectpath stroke grestore}def
 58.1361 +xt {yt restore} if
 58.1362 +/_fonthacksave false def
 58.1363 +/currentpacking defed 
 58.1364 +{
 58.1365 + /_bfh {/_fonthacksave currentpacking def false setpacking} bdf
 58.1366 + /_efh {_fonthacksave setpacking} bdf
 58.1367 +}
 58.1368 +{
 58.1369 + /_bfh {} bdf
 58.1370 + /_efh {} bdf
 58.1371 +}ifelse
 58.1372 +/packedarray{array astore readonly}ndf
 58.1373 +/` 
 58.1374 +{ 
 58.1375 + false setoverprint  
 58.1376 + 
 58.1377 + 
 58.1378 + /-save0- save def
 58.1379 + 5 index concat
 58.1380 + pop
 58.1381 + storerect left bottom width height rectclip
 58.1382 + pop
 58.1383 + 
 58.1384 + /dict_count countdictstack def
 58.1385 + /op_count count 1 sub def
 58.1386 + userdict begin
 58.1387 + 
 58.1388 + /showpage {} def
 58.1389 + 
 58.1390 + 0 setgray 0 setlinecap 1 setlinewidth
 58.1391 + 0 setlinejoin 10 setmiterlimit [] 0 setdash newpath
 58.1392 + 
 58.1393 +} bdf
 58.1394 +/currentpacking defed{true setpacking}if
 58.1395 +/min{2 copy gt{exch}if pop}bdf
 58.1396 +/max{2 copy lt{exch}if pop}bdf
 58.1397 +/xformfont { currentfont exch makefont setfont } bdf
 58.1398 +/fhnumcolors 1 
 58.1399 + statusdict begin
 58.1400 +/processcolors defed 
 58.1401 +{
 58.1402 +pop processcolors
 58.1403 +}
 58.1404 +{
 58.1405 +/deviceinfo defed {
 58.1406 +deviceinfo /Colors known {
 58.1407 +pop deviceinfo /Colors get
 58.1408 +} if
 58.1409 +} if
 58.1410 +} ifelse
 58.1411 + end 
 58.1412 +def
 58.1413 +/printerRes 
 58.1414 + gsave
 58.1415 + matrix defaultmatrix setmatrix
 58.1416 + 72 72 dtransform
 58.1417 + abs exch abs
 58.1418 + max
 58.1419 + grestore
 58.1420 + def
 58.1421 +/graycalcs
 58.1422 +[
 58.1423 + {Angle Frequency}   
 58.1424 + {GrayAngle GrayFrequency} 
 58.1425 + {0 Width Height matrix defaultmatrix idtransform 
 58.1426 +dup mul exch dup mul add sqrt 72 exch div} 
 58.1427 + {0 GrayWidth GrayHeight matrix defaultmatrix idtransform 
 58.1428 +dup mul exch dup mul add sqrt 72 exch div} 
 58.1429 +] def
 58.1430 +/calcgraysteps {
 58.1431 + forcemaxsteps
 58.1432 + {
 58.1433 +maxsteps
 58.1434 + }
 58.1435 + {
 58.1436 +/currenthalftone defed
 58.1437 +{currenthalftone /dicttype eq}{false}ifelse
 58.1438 +{
 58.1439 +currenthalftone begin
 58.1440 +HalftoneType 4 le
 58.1441 +{graycalcs HalftoneType 1 sub get exec}
 58.1442 +{
 58.1443 +HalftoneType 5 eq
 58.1444 +{
 58.1445 +Default begin
 58.1446 +{graycalcs HalftoneType 1 sub get exec}
 58.1447 +end
 58.1448 +}
 58.1449 +{0 60} 
 58.1450 +ifelse
 58.1451 +}
 58.1452 +ifelse
 58.1453 +end
 58.1454 +}
 58.1455 +{
 58.1456 +currentscreen pop exch 
 58.1457 +}
 58.1458 +ifelse
 58.1459 + 
 58.1460 +printerRes 300 max exch div exch 
 58.1461 +2 copy 
 58.1462 +sin mul round dup mul 
 58.1463 +3 1 roll 
 58.1464 +cos mul round dup mul 
 58.1465 +add 1 add 
 58.1466 +dup maxsteps gt {pop maxsteps} if 
 58.1467 + }
 58.1468 + ifelse
 58.1469 +} bdf
 58.1470 +/nextrelease defed { 
 58.1471 + /languagelevel defed not {    
 58.1472 +/framebuffer defed { 
 58.1473 +0 40 string framebuffer 9 1 roll 8 {pop} repeat
 58.1474 +dup 516 eq exch 520 eq or
 58.1475 +{
 58.1476 +/fhnumcolors 3 def
 58.1477 +/currentscreen {60 0 {pop pop 1}}bdf
 58.1478 +/calcgraysteps {maxsteps} bdf
 58.1479 +}if
 58.1480 +}if
 58.1481 + }if
 58.1482 +}if
 58.1483 +fhnumcolors 1 ne {
 58.1484 + /calcgraysteps {maxsteps} bdf
 58.1485 +} if
 58.1486 +/currentpagedevice defed {
 58.1487 + 
 58.1488 + 
 58.1489 + currentpagedevice /PreRenderingEnhance known
 58.1490 + {
 58.1491 +currentpagedevice /PreRenderingEnhance get
 58.1492 +{
 58.1493 +/calcgraysteps 
 58.1494 +{
 58.1495 +forcemaxsteps 
 58.1496 +{maxsteps}
 58.1497 +{256 maxsteps min}
 58.1498 +ifelse
 58.1499 +} def
 58.1500 +} if
 58.1501 + } if
 58.1502 +} if
 58.1503 +/gradfrequency 144 def
 58.1504 +printerRes 1000 lt {
 58.1505 + /gradfrequency 72 def
 58.1506 +} if
 58.1507 +/adjnumsteps {
 58.1508 + 
 58.1509 + dup dtransform abs exch abs max  
 58.1510 + 
 58.1511 + printerRes div       
 58.1512 + 
 58.1513 + gradfrequency mul      
 58.1514 + round        
 58.1515 + 5 max       
 58.1516 + min        
 58.1517 +}bdf
 58.1518 +/goodsep {
 58.1519 + spots exch get 4 get dup sepname eq exch (_vc_Registration) eq or
 58.1520 +}bdf
 58.1521 +/BeginGradation defed
 58.1522 +{/bb{BeginGradation}bdf}
 58.1523 +{/bb{}bdf}
 58.1524 +ifelse
 58.1525 +/EndGradation defed
 58.1526 +{/eb{EndGradation}bdf}
 58.1527 +{/eb{}bdf}
 58.1528 +ifelse
 58.1529 +/bottom -0 def 
 58.1530 +/delta -0 def 
 58.1531 +/frac -0 def 
 58.1532 +/height -0 def 
 58.1533 +/left -0 def 
 58.1534 +/numsteps1 -0 def 
 58.1535 +/radius -0 def 
 58.1536 +/right -0 def 
 58.1537 +/top -0 def 
 58.1538 +/width -0 def 
 58.1539 +/xt -0 def 
 58.1540 +/yt -0 def 
 58.1541 +/df currentflat def 
 58.1542 +/tempstr 1 string def 
 58.1543 +/clipflatness currentflat def 
 58.1544 +/inverted? 
 58.1545 + 0 currenttransfer exec .5 ge def
 58.1546 +/tc1 [0 0 0 1] def 
 58.1547 +/tc2 [0 0 0 1] def 
 58.1548 +/storerect{/top xdf /right xdf /bottom xdf /left xdf 
 58.1549 +/width right left sub def /height top bottom sub def}bdf
 58.1550 +/concatprocs{
 58.1551 + systemdict /packedarray known 
 58.1552 + {dup type /packedarraytype eq 2 index type /packedarraytype eq or}{false}ifelse
 58.1553 + { 
 58.1554 +/proc2 exch cvlit def /proc1 exch cvlit def
 58.1555 +proc1 aload pop proc2 aload pop
 58.1556 +proc1 length proc2 length add packedarray cvx
 58.1557 + }
 58.1558 + { 
 58.1559 +/proc2 exch cvlit def /proc1 exch cvlit def
 58.1560 +/newproc proc1 length proc2 length add array def
 58.1561 +newproc 0 proc1 putinterval newproc proc1 length proc2 putinterval
 58.1562 +newproc cvx
 58.1563 + }ifelse
 58.1564 +}bdf
 58.1565 +/i{dup 0 eq
 58.1566 + {pop df dup} 
 58.1567 + {dup} ifelse 
 58.1568 + /clipflatness xdf setflat
 58.1569 +}bdf
 58.1570 +version cvr 38.0 le
 58.1571 +{/setrgbcolor{
 58.1572 +currenttransfer exec 3 1 roll
 58.1573 +currenttransfer exec 3 1 roll
 58.1574 +currenttransfer exec 3 1 roll
 58.1575 +setrgbcolor}bdf}if
 58.1576 +/vms {/vmsv save def} bdf
 58.1577 +/vmr {vmsv restore} bdf
 58.1578 +/vmrs{vmsv restore /vmsv save def}bdf
 58.1579 +/eomode{ 
 58.1580 + {/filler /eofill load def /clipper /eoclip load def}
 58.1581 + {/filler /fill load def /clipper /clip load def}
 58.1582 + ifelse
 58.1583 +}bdf
 58.1584 +/normtaper{}bdf
 58.1585 +/logtaper{9 mul 1 add log}bdf
 58.1586 +/CD{
 58.1587 + /NF exch def 
 58.1588 + {    
 58.1589 +exch dup 
 58.1590 +/FID ne 1 index/UniqueID ne and
 58.1591 +{exch NF 3 1 roll put}
 58.1592 +{pop pop}
 58.1593 +ifelse
 58.1594 + }forall 
 58.1595 + NF
 58.1596 +}bdf
 58.1597 +/MN{
 58.1598 + 1 index length   
 58.1599 + /Len exch def 
 58.1600 + dup length Len add  
 58.1601 + string dup    
 58.1602 + Len     
 58.1603 + 4 -1 roll    
 58.1604 + putinterval   
 58.1605 + dup     
 58.1606 + 0      
 58.1607 + 4 -1 roll   
 58.1608 + putinterval   
 58.1609 +}bdf
 58.1610 +/RC{4 -1 roll /ourvec xdf 256 string cvs(|______)anchorsearch
 58.1611 + {1 index MN cvn/NewN exch def cvn
 58.1612 + findfont dup maxlength dict CD dup/FontName NewN put dup
 58.1613 + /Encoding ourvec put NewN exch definefont pop}{pop}ifelse}bdf
 58.1614 +/RF{ 
 58.1615 + dup      
 58.1616 + FontDirectory exch   
 58.1617 + known     
 58.1618 + {pop 3 -1 roll pop}  
 58.1619 + {RC}
 58.1620 + ifelse
 58.1621 +}bdf
 58.1622 +/FF{dup 256 string cvs(|______)exch MN cvn dup FontDirectory exch known
 58.1623 + {exch pop findfont 3 -1 roll pop}
 58.1624 + {pop dup findfont dup maxlength dict CD dup dup
 58.1625 + /Encoding exch /Encoding get 256 array copy 7 -1 roll 
 58.1626 + {3 -1 roll dup 4 -2 roll put}forall put definefont}
 58.1627 + ifelse}bdf
 58.1628 +/RFJ{ 
 58.1629 + dup      
 58.1630 + FontDirectory exch   
 58.1631 + known     
 58.1632 + {pop 3 -1 roll pop  
 58.1633 + FontDirectory /Ryumin-Light-83pv-RKSJ-H known 
 58.1634 + {pop pop /Ryumin-Light-83pv-RKSJ-H dup}if  
 58.1635 + }      
 58.1636 + {RC}
 58.1637 + ifelse
 58.1638 +}bdf
 58.1639 +/FFJ{dup 256 string cvs(|______)exch MN cvn dup FontDirectory exch known
 58.1640 + {exch pop findfont 3 -1 roll pop}
 58.1641 + {pop
 58.1642 +dup FontDirectory exch known not 
 58.1643 + {FontDirectory /Ryumin-Light-83pv-RKSJ-H known 
 58.1644 +{pop /Ryumin-Light-83pv-RKSJ-H}if 
 58.1645 + }if            
 58.1646 + dup findfont dup maxlength dict CD dup dup
 58.1647 + /Encoding exch /Encoding get 256 array copy 7 -1 roll 
 58.1648 + {3 -1 roll dup 4 -2 roll put}forall put definefont}
 58.1649 + ifelse}bdf
 58.1650 +/fps{
 58.1651 + currentflat   
 58.1652 + exch     
 58.1653 + dup 0 le{pop 1}if 
 58.1654 + {
 58.1655 +dup setflat 3 index stopped
 58.1656 +{1.3 mul dup 3 index gt{pop setflat pop pop stop}if} 
 58.1657 +{exit} 
 58.1658 +ifelse
 58.1659 + }loop 
 58.1660 + pop setflat pop pop
 58.1661 +}bdf
 58.1662 +/fp{100 currentflat fps}bdf
 58.1663 +/clipper{clip}bdf 
 58.1664 +/W{/clipper load 100 clipflatness dup setflat fps}bdf
 58.1665 +userdict begin /BDFontDict 29 dict def end
 58.1666 +BDFontDict begin
 58.1667 +/bu{}def
 58.1668 +/bn{}def
 58.1669 +/setTxMode{av 70 ge{pop}if pop}def
 58.1670 +/gm{m}def
 58.1671 +/show{pop}def
 58.1672 +/gr{pop}def
 58.1673 +/fnt{pop pop pop}def
 58.1674 +/fs{pop}def
 58.1675 +/fz{pop}def
 58.1676 +/lin{pop pop}def
 58.1677 +/:M {pop pop} def
 58.1678 +/sf {pop} def
 58.1679 +/S {pop} def
 58.1680 +/@b {pop pop pop pop pop pop pop pop} def
 58.1681 +/_bdsave /save load def
 58.1682 +/_bdrestore /restore load def
 58.1683 +/save { dup /fontsave eq {null} {_bdsave} ifelse } def
 58.1684 +/restore { dup null eq { pop } { _bdrestore } ifelse } def
 58.1685 +/fontsave null def
 58.1686 +end
 58.1687 +/MacVec 256 array def 
 58.1688 +MacVec 0 /Helvetica findfont
 58.1689 +/Encoding get 0 128 getinterval putinterval
 58.1690 +MacVec 127 /DEL put MacVec 16#27 /quotesingle put MacVec 16#60 /grave put
 58.1691 +/NUL/SOH/STX/ETX/EOT/ENQ/ACK/BEL/BS/HT/LF/VT/FF/CR/SO/SI
 58.1692 +/DLE/DC1/DC2/DC3/DC4/NAK/SYN/ETB/CAN/EM/SUB/ESC/FS/GS/RS/US
 58.1693 +MacVec 0 32 getinterval astore pop
 58.1694 +/Adieresis/Aring/Ccedilla/Eacute/Ntilde/Odieresis/Udieresis/aacute
 58.1695 +/agrave/acircumflex/adieresis/atilde/aring/ccedilla/eacute/egrave
 58.1696 +/ecircumflex/edieresis/iacute/igrave/icircumflex/idieresis/ntilde/oacute
 58.1697 +/ograve/ocircumflex/odieresis/otilde/uacute/ugrave/ucircumflex/udieresis
 58.1698 +/dagger/degree/cent/sterling/section/bullet/paragraph/germandbls
 58.1699 +/registered/copyright/trademark/acute/dieresis/notequal/AE/Oslash
 58.1700 +/infinity/plusminus/lessequal/greaterequal/yen/mu/partialdiff/summation
 58.1701 +/product/pi/integral/ordfeminine/ordmasculine/Omega/ae/oslash 
 58.1702 +/questiondown/exclamdown/logicalnot/radical/florin/approxequal/Delta/guillemotleft
 58.1703 +/guillemotright/ellipsis/nbspace/Agrave/Atilde/Otilde/OE/oe
 58.1704 +/endash/emdash/quotedblleft/quotedblright/quoteleft/quoteright/divide/lozenge
 58.1705 +/ydieresis/Ydieresis/fraction/currency/guilsinglleft/guilsinglright/fi/fl
 58.1706 +/daggerdbl/periodcentered/quotesinglbase/quotedblbase
 58.1707 +/perthousand/Acircumflex/Ecircumflex/Aacute
 58.1708 +/Edieresis/Egrave/Iacute/Icircumflex/Idieresis/Igrave/Oacute/Ocircumflex
 58.1709 +/apple/Ograve/Uacute/Ucircumflex/Ugrave/dotlessi/circumflex/tilde
 58.1710 +/macron/breve/dotaccent/ring/cedilla/hungarumlaut/ogonek/caron
 58.1711 +MacVec 128 128 getinterval astore pop
 58.1712 +end %. AltsysDict
 58.1713 +%%EndResource
 58.1714 +%%EndProlog
 58.1715 +%%BeginSetup
 58.1716 +AltsysDict begin
 58.1717 +_bfh
 58.1718 +%%IncludeResource: font Symbol
 58.1719 +_efh
 58.1720 +0 dict dup begin
 58.1721 +end 
 58.1722 +/f0 /Symbol FF def
 58.1723 +_bfh
 58.1724 +%%IncludeResource: font ZapfHumanist601BT-Bold
 58.1725 +_efh
 58.1726 +0 dict dup begin
 58.1727 +end 
 58.1728 +/f1 /ZapfHumanist601BT-Bold FF def
 58.1729 +end %. AltsysDict
 58.1730 +%%EndSetup
 58.1731 +AltsysDict begin 
 58.1732 +/onlyk4{false}ndf
 58.1733 +/ccmyk{dup 5 -1 roll sub 0 max exch}ndf
 58.1734 +/cmyk2gray{
 58.1735 + 4 -1 roll 0.3 mul 4 -1 roll 0.59 mul 4 -1 roll 0.11 mul
 58.1736 + add add add 1 min neg 1 add
 58.1737 +}bdf
 58.1738 +/setcmykcolor{1 exch sub ccmyk ccmyk ccmyk pop setrgbcolor}ndf
 58.1739 +/maxcolor { 
 58.1740 + max max max  
 58.1741 +} ndf
 58.1742 +/maxspot {
 58.1743 + pop
 58.1744 +} ndf
 58.1745 +/setcmykcoloroverprint{4{dup -1 eq{pop 0}if 4 1 roll}repeat setcmykcolor}ndf
 58.1746 +/findcmykcustomcolor{5 packedarray}ndf
 58.1747 +/setcustomcolor{exch aload pop pop 4{4 index mul 4 1 roll}repeat setcmykcolor pop}ndf
 58.1748 +/setseparationgray{setgray}ndf
 58.1749 +/setoverprint{pop}ndf 
 58.1750 +/currentoverprint false ndf
 58.1751 +/cmykbufs2gray{
 58.1752 + 0 1 2 index length 1 sub
 58.1753 + { 
 58.1754 +4 index 1 index get 0.3 mul 
 58.1755 +4 index 2 index get 0.59 mul 
 58.1756 +4 index 3 index get 0.11 mul 
 58.1757 +4 index 4 index get 
 58.1758 +add add add cvi 255 min
 58.1759 +255 exch sub
 58.1760 +2 index 3 1 roll put
 58.1761 + }for
 58.1762 + 4 1 roll pop pop pop
 58.1763 +}bdf
 58.1764 +/colorimage{
 58.1765 + pop pop
 58.1766 + [
 58.1767 +5 -1 roll/exec cvx 
 58.1768 +6 -1 roll/exec cvx 
 58.1769 +7 -1 roll/exec cvx 
 58.1770 +8 -1 roll/exec cvx
 58.1771 +/cmykbufs2gray cvx
 58.1772 + ]cvx 
 58.1773 + image
 58.1774 +}
 58.1775 +%. version 47.1 on Linotronic of Postscript defines colorimage incorrectly (rgb model only)
 58.1776 +version cvr 47.1 le 
 58.1777 +statusdict /product get (Lino) anchorsearch{pop pop true}{pop false}ifelse
 58.1778 +and{userdict begin bdf end}{ndf}ifelse
 58.1779 +fhnumcolors 1 ne {/yt save def} if
 58.1780 +/customcolorimage{
 58.1781 + aload pop
 58.1782 + (_vc_Registration) eq 
 58.1783 + {
 58.1784 +pop pop pop pop separationimage
 58.1785 + }
 58.1786 + {
 58.1787 +/ik xdf /iy xdf /im xdf /ic xdf
 58.1788 +ic im iy ik cmyk2gray /xt xdf
 58.1789 +currenttransfer
 58.1790 +{dup 1.0 exch sub xt mul add}concatprocs
 58.1791 +st 
 58.1792 +image
 58.1793 + }
 58.1794 + ifelse
 58.1795 +}ndf
 58.1796 +fhnumcolors 1 ne {yt restore} if
 58.1797 +fhnumcolors 3 ne {/yt save def} if
 58.1798 +/customcolorimage{
 58.1799 + aload pop 
 58.1800 + (_vc_Registration) eq 
 58.1801 + {
 58.1802 +pop pop pop pop separationimage
 58.1803 + }
 58.1804 + {
 58.1805 +/ik xdf /iy xdf /im xdf /ic xdf
 58.1806 +1.0 dup ic ik add min sub 
 58.1807 +1.0 dup im ik add min sub 
 58.1808 +1.0 dup iy ik add min sub 
 58.1809 +/ic xdf /iy xdf /im xdf
 58.1810 +currentcolortransfer
 58.1811 +4 1 roll 
 58.1812 +{dup 1.0 exch sub ic mul add}concatprocs 4 1 roll 
 58.1813 +{dup 1.0 exch sub iy mul add}concatprocs 4 1 roll 
 58.1814 +{dup 1.0 exch sub im mul add}concatprocs 4 1 roll 
 58.1815 +setcolortransfer
 58.1816 +{/dummy xdf dummy}concatprocs{dummy}{dummy}true 3 colorimage
 58.1817 + }
 58.1818 + ifelse
 58.1819 +}ndf
 58.1820 +fhnumcolors 3 ne {yt restore} if
 58.1821 +fhnumcolors 4 ne {/yt save def} if
 58.1822 +/customcolorimage{
 58.1823 + aload pop
 58.1824 + (_vc_Registration) eq 
 58.1825 + {
 58.1826 +pop pop pop pop separationimage
 58.1827 + }
 58.1828 + {
 58.1829 +/ik xdf /iy xdf /im xdf /ic xdf
 58.1830 +currentcolortransfer
 58.1831 +{1.0 exch sub ik mul ik sub 1 add}concatprocs 4 1 roll
 58.1832 +{1.0 exch sub iy mul iy sub 1 add}concatprocs 4 1 roll
 58.1833 +{1.0 exch sub im mul im sub 1 add}concatprocs 4 1 roll
 58.1834 +{1.0 exch sub ic mul ic sub 1 add}concatprocs 4 1 roll
 58.1835 +setcolortransfer
 58.1836 +{/dummy xdf dummy}concatprocs{dummy}{dummy}{dummy}
 58.1837 +true 4 colorimage
 58.1838 + }
 58.1839 + ifelse
 58.1840 +}ndf
 58.1841 +fhnumcolors 4 ne {yt restore} if
 58.1842 +/separationimage{image}ndf
 58.1843 +/newcmykcustomcolor{6 packedarray}ndf
 58.1844 +/inkoverprint false ndf
 58.1845 +/setinkoverprint{pop}ndf 
 58.1846 +/setspotcolor { 
 58.1847 + spots exch get
 58.1848 + dup 4 get (_vc_Registration) eq
 58.1849 + {pop 1 exch sub setseparationgray}
 58.1850 + {0 5 getinterval exch setcustomcolor}
 58.1851 + ifelse
 58.1852 +}ndf
 58.1853 +/currentcolortransfer{currenttransfer dup dup dup}ndf
 58.1854 +/setcolortransfer{st pop pop pop}ndf
 58.1855 +/fas{}ndf
 58.1856 +/sas{}ndf
 58.1857 +/fhsetspreadsize{pop}ndf
 58.1858 +/filler{fill}bdf 
 58.1859 +/F{gsave {filler}fp grestore}bdf
 58.1860 +/f{closepath F}bdf
 58.1861 +/S{gsave {stroke}fp grestore}bdf
 58.1862 +/s{closepath S}bdf
 58.1863 +/bc4 [0 0 0 0] def 
 58.1864 +/_lfp4 {
 58.1865 + /iosv inkoverprint def
 58.1866 + /cosv currentoverprint def
 58.1867 + /yt xdf       
 58.1868 + /xt xdf       
 58.1869 + /ang xdf      
 58.1870 + storerect
 58.1871 + /taperfcn xdf
 58.1872 + /k2 xdf /y2 xdf /m2 xdf /c2 xdf
 58.1873 + /k1 xdf /y1 xdf /m1 xdf /c1 xdf
 58.1874 + c1 c2 sub abs
 58.1875 + m1 m2 sub abs
 58.1876 + y1 y2 sub abs
 58.1877 + k1 k2 sub abs
 58.1878 + maxcolor      
 58.1879 + calcgraysteps mul abs round  
 58.1880 + height abs adjnumsteps   
 58.1881 + dup 2 lt {pop 1} if    
 58.1882 + 1 sub /numsteps1 xdf
 58.1883 + currentflat mark    
 58.1884 + currentflat clipflatness  
 58.1885 + /delta top bottom sub numsteps1 1 add div def 
 58.1886 + /right right left sub def  
 58.1887 + /botsv top delta sub def  
 58.1888 + {
 58.1889 +{
 58.1890 +W
 58.1891 +xt yt translate 
 58.1892 +ang rotate
 58.1893 +xt neg yt neg translate 
 58.1894 +dup setflat 
 58.1895 +/bottom botsv def
 58.1896 +0 1 numsteps1 
 58.1897 +{
 58.1898 +numsteps1 dup 0 eq {pop 0.5 } { div } ifelse 
 58.1899 +taperfcn /frac xdf
 58.1900 +bc4 0 c2 c1 sub frac mul c1 add put
 58.1901 +bc4 1 m2 m1 sub frac mul m1 add put
 58.1902 +bc4 2 y2 y1 sub frac mul y1 add put
 58.1903 +bc4 3 k2 k1 sub frac mul k1 add put
 58.1904 +bc4 vc
 58.1905 +1 index setflat 
 58.1906 +{ 
 58.1907 +mark {newpath left bottom right delta rectfill}stopped
 58.1908 +{cleartomark exch 1.3 mul dup setflat exch 2 copy gt{stop}if}
 58.1909 +{cleartomark exit}ifelse
 58.1910 +}loop
 58.1911 +/bottom bottom delta sub def
 58.1912 +}for
 58.1913 +}
 58.1914 +gsave stopped grestore
 58.1915 +{exch pop 2 index exch 1.3 mul dup 100 gt{cleartomark setflat stop}if}
 58.1916 +{exit}ifelse
 58.1917 + }loop
 58.1918 + cleartomark setflat
 58.1919 + iosv setinkoverprint
 58.1920 + cosv setoverprint
 58.1921 +}bdf
 58.1922 +/bcs [0 0] def 
 58.1923 +/_lfs4 {
 58.1924 + /iosv inkoverprint def
 58.1925 + /cosv currentoverprint def
 58.1926 + /yt xdf       
 58.1927 + /xt xdf       
 58.1928 + /ang xdf      
 58.1929 + storerect
 58.1930 + /taperfcn xdf
 58.1931 + /tint2 xdf      
 58.1932 + /tint1 xdf      
 58.1933 + bcs exch 1 exch put    
 58.1934 + tint1 tint2 sub abs    
 58.1935 + bcs 1 get maxspot    
 58.1936 + calcgraysteps mul abs round  
 58.1937 + height abs adjnumsteps   
 58.1938 + dup 2 lt {pop 2} if    
 58.1939 + 1 sub /numsteps1 xdf
 58.1940 + currentflat mark    
 58.1941 + currentflat clipflatness  
 58.1942 + /delta top bottom sub numsteps1 1 add div def 
 58.1943 + /right right left sub def  
 58.1944 + /botsv top delta sub def  
 58.1945 + {
 58.1946 +{
 58.1947 +W
 58.1948 +xt yt translate 
 58.1949 +ang rotate
 58.1950 +xt neg yt neg translate 
 58.1951 +dup setflat 
 58.1952 +/bottom botsv def
 58.1953 +0 1 numsteps1 
 58.1954 +{
 58.1955 +numsteps1 div taperfcn /frac xdf
 58.1956 +bcs 0
 58.1957 +1.0 tint2 tint1 sub frac mul tint1 add sub
 58.1958 +put bcs vc
 58.1959 +1 index setflat 
 58.1960 +{ 
 58.1961 +mark {newpath left bottom right delta rectfill}stopped
 58.1962 +{cleartomark exch 1.3 mul dup setflat exch 2 copy gt{stop}if}
 58.1963 +{cleartomark exit}ifelse
 58.1964 +}loop
 58.1965 +/bottom bottom delta sub def
 58.1966 +}for
 58.1967 +}
 58.1968 +gsave stopped grestore
 58.1969 +{exch pop 2 index exch 1.3 mul dup 100 gt{cleartomark setflat stop}if}
 58.1970 +{exit}ifelse
 58.1971 + }loop
 58.1972 + cleartomark setflat
 58.1973 + iosv setinkoverprint
 58.1974 + cosv setoverprint
 58.1975 +}bdf
 58.1976 +/_rfs4 {
 58.1977 + /iosv inkoverprint def
 58.1978 + /cosv currentoverprint def
 58.1979 + /tint2 xdf      
 58.1980 + /tint1 xdf      
 58.1981 + bcs exch 1 exch put    
 58.1982 + /radius xdf      
 58.1983 + /yt xdf       
 58.1984 + /xt xdf       
 58.1985 + tint1 tint2 sub abs    
 58.1986 + bcs 1 get maxspot    
 58.1987 + calcgraysteps mul abs round  
 58.1988 + radius abs adjnumsteps   
 58.1989 + dup 2 lt {pop 2} if    
 58.1990 + 1 sub /numsteps1 xdf
 58.1991 + radius numsteps1 div 2 div /halfstep xdf 
 58.1992 + currentflat mark    
 58.1993 + currentflat clipflatness  
 58.1994 + {
 58.1995 +{
 58.1996 +dup setflat 
 58.1997 +W 
 58.1998 +0 1 numsteps1 
 58.1999 +{
 58.2000 +dup /radindex xdf
 58.2001 +numsteps1 div /frac xdf
 58.2002 +bcs 0
 58.2003 +tint2 tint1 sub frac mul tint1 add
 58.2004 +put bcs vc
 58.2005 +1 index setflat 
 58.2006 +{ 
 58.2007 +newpath mark xt yt radius 1 frac sub mul halfstep add 0 360
 58.2008 +{ arc
 58.2009 +radindex numsteps1 ne 
 58.2010 +{
 58.2011 +xt yt 
 58.2012 +radindex 1 add numsteps1 
 58.2013 +div 1 exch sub 
 58.2014 +radius mul halfstep add
 58.2015 +dup xt add yt moveto 
 58.2016 +360 0 arcn 
 58.2017 +} if
 58.2018 +fill
 58.2019 +}stopped
 58.2020 +{cleartomark exch 1.3 mul dup setflat exch 2 copy gt{stop}if}
 58.2021 +{cleartomark exit}ifelse
 58.2022 +}loop
 58.2023 +}for
 58.2024 +}
 58.2025 +gsave stopped grestore
 58.2026 +{exch pop 2 index exch 1.3 mul dup 100 gt{cleartomark setflat stop}if}
 58.2027 +{exit}ifelse
 58.2028 + }loop
 58.2029 + cleartomark setflat
 58.2030 + iosv setinkoverprint
 58.2031 + cosv setoverprint
 58.2032 +}bdf
 58.2033 +/_rfp4 {
 58.2034 + /iosv inkoverprint def
 58.2035 + /cosv currentoverprint def
 58.2036 + /k2 xdf /y2 xdf /m2 xdf /c2 xdf
 58.2037 + /k1 xdf /y1 xdf /m1 xdf /c1 xdf
 58.2038 + /radius xdf      
 58.2039 + /yt xdf       
 58.2040 + /xt xdf       
 58.2041 + c1 c2 sub abs
 58.2042 + m1 m2 sub abs
 58.2043 + y1 y2 sub abs
 58.2044 + k1 k2 sub abs
 58.2045 + maxcolor      
 58.2046 + calcgraysteps mul abs round  
 58.2047 + radius abs adjnumsteps   
 58.2048 + dup 2 lt {pop 1} if    
 58.2049 + 1 sub /numsteps1 xdf
 58.2050 + radius numsteps1 dup 0 eq {pop} {div} ifelse 
 58.2051 + 2 div /halfstep xdf 
 58.2052 + currentflat mark    
 58.2053 + currentflat clipflatness  
 58.2054 + {
 58.2055 +{
 58.2056 +dup setflat 
 58.2057 +W 
 58.2058 +0 1 numsteps1 
 58.2059 +{
 58.2060 +dup /radindex xdf
 58.2061 +numsteps1 dup 0 eq {pop 0.5 } { div } ifelse 
 58.2062 +/frac xdf
 58.2063 +bc4 0 c2 c1 sub frac mul c1 add put
 58.2064 +bc4 1 m2 m1 sub frac mul m1 add put
 58.2065 +bc4 2 y2 y1 sub frac mul y1 add put
 58.2066 +bc4 3 k2 k1 sub frac mul k1 add put
 58.2067 +bc4 vc
 58.2068 +1 index setflat 
 58.2069 +{ 
 58.2070 +newpath mark xt yt radius 1 frac sub mul halfstep add 0 360
 58.2071 +{ arc
 58.2072 +radindex numsteps1 ne 
 58.2073 +{
 58.2074 +xt yt 
 58.2075 +radindex 1 add 
 58.2076 +numsteps1 dup 0 eq {pop} {div} ifelse 
 58.2077 +1 exch sub 
 58.2078 +radius mul halfstep add
 58.2079 +dup xt add yt moveto 
 58.2080 +360 0 arcn 
 58.2081 +} if
 58.2082 +fill
 58.2083 +}stopped
 58.2084 +{cleartomark exch 1.3 mul dup setflat exch 2 copy gt{stop}if}
 58.2085 +{cleartomark exit}ifelse
 58.2086 +}loop
 58.2087 +}for
 58.2088 +}
 58.2089 +gsave stopped grestore
 58.2090 +{exch pop 2 index exch 1.3 mul dup 100 gt{cleartomark setflat stop}if}
 58.2091 +{exit}ifelse
 58.2092 + }loop
 58.2093 + cleartomark setflat
 58.2094 + iosv setinkoverprint
 58.2095 + cosv setoverprint
 58.2096 +}bdf
 58.2097 +/lfp4{_lfp4}ndf
 58.2098 +/lfs4{_lfs4}ndf
 58.2099 +/rfs4{_rfs4}ndf
 58.2100 +/rfp4{_rfp4}ndf
 58.2101 +/cvc [0 0 0 1] def 
 58.2102 +/vc{
 58.2103 + AltsysDict /cvc 2 index put 
 58.2104 + aload length 4 eq
 58.2105 + {setcmykcolor}
 58.2106 + {setspotcolor}
 58.2107 + ifelse
 58.2108 +}bdf 
 58.2109 +/origmtx matrix currentmatrix def
 58.2110 +/ImMatrix matrix currentmatrix def
 58.2111 +0 setseparationgray
 58.2112 +/imgr {1692 1570.1102 2287.2756 2412 } def 
 58.2113 +/bleed 0 def 
 58.2114 +/clpr {1692 1570.1102 2287.2756 2412 } def 
 58.2115 +/xs 1 def 
 58.2116 +/ys 1 def 
 58.2117 +/botx 0 def 
 58.2118 +/overlap 0 def 
 58.2119 +/wdist 18 def 
 58.2120 +0 2 mul fhsetspreadsize 
 58.2121 +0 0 ne {/df 0 def /clipflatness 0 def} if 
 58.2122 +/maxsteps 256 def 
 58.2123 +/forcemaxsteps false def 
 58.2124 +vms
 58.2125 +-1845 -1956 translate
 58.2126 +/currentpacking defed{false setpacking}if 
 58.2127 +/spots[
 58.2128 +1 0 0 0 (Process Cyan) false newcmykcustomcolor
 58.2129 +0 1 0 0 (Process Magenta) false newcmykcustomcolor
 58.2130 +0 0 1 0 (Process Yellow) false newcmykcustomcolor
 58.2131 +0 0 0 1 (Process Black) false newcmykcustomcolor
 58.2132 +]def
 58.2133 +/textopf false def
 58.2134 +/curtextmtx{}def
 58.2135 +/otw .25 def
 58.2136 +/msf{dup/curtextmtx xdf makefont setfont}bdf
 58.2137 +/makesetfont/msf load def
 58.2138 +/curtextheight{.707104 .707104 curtextmtx dtransform
 58.2139 + dup mul exch dup mul add sqrt}bdf
 58.2140 +/ta2{ 
 58.2141 +tempstr 2 index gsave exec grestore 
 58.2142 +cwidth cheight rmoveto 
 58.2143 +4 index eq{5 index 5 index rmoveto}if 
 58.2144 +2 index 2 index rmoveto 
 58.2145 +}bdf
 58.2146 +/ta{exch systemdict/cshow known
 58.2147 +{{/cheight xdf/cwidth xdf tempstr 0 2 index put ta2}exch cshow} 
 58.2148 +{{tempstr 0 2 index put tempstr stringwidth/cheight xdf/cwidth xdf ta2}forall} 
 58.2149 +ifelse 6{pop}repeat}bdf
 58.2150 +/sts{/textopf currentoverprint def vc setoverprint
 58.2151 +/ts{awidthshow}def exec textopf setoverprint}bdf
 58.2152 +/stol{/xt currentlinewidth def 
 58.2153 + setlinewidth vc newpath 
 58.2154 + /ts{{false charpath stroke}ta}def exec 
 58.2155 + xt setlinewidth}bdf 
 58.2156 + 
 58.2157 +/strk{/textopf currentoverprint def vc setoverprint
 58.2158 + /ts{{false charpath stroke}ta}def exec 
 58.2159 + textopf setoverprint
 58.2160 + }bdf 
 58.2161 +n
 58.2162 +[] 0 d
 58.2163 +3.863708 M
 58.2164 +1 w
 58.2165 +0 j
 58.2166 +0 J
 58.2167 +false setoverprint
 58.2168 +0 i
 58.2169 +false eomode
 58.2170 +[0 0 0 1] vc
 58.2171 +vms
 58.2172 +%white border -- disabled
 58.2173 +%1845.2293 2127.8588 m
 58.2174 +%2045.9437 2127.8588 L
 58.2175 +%2045.9437 1956.1412 L
 58.2176 +%1845.2293 1956.1412 L
 58.2177 +%1845.2293 2127.8588 L
 58.2178 +%0.1417 w
 58.2179 +%2 J
 58.2180 +%2 M
 58.2181 +%[0 0 0 0]  vc
 58.2182 +%s 
 58.2183 +n
 58.2184 +1950.8 2097.2 m
 58.2185 +1958.8 2092.5 1967.3 2089 1975.5 2084.9 C
 58.2186 +1976.7 2083.5 1976.1 2081.5 1976.7 2079.9 C
 58.2187 +1979.6 2081.1 1981.6 2086.8 1985.3 2084 C
 58.2188 +1993.4 2079.3 2001.8 2075.8 2010 2071.7 C
 58.2189 +2010.5 2071.5 2010.5 2071.1 2010.8 2070.8 C
 58.2190 +2011.2 2064.3 2010.9 2057.5 2011 2050.8 C
 58.2191 +2015.8 2046.9 2022.2 2046.2 2026.6 2041.7 C
 58.2192 +2026.5 2032.5 2026.8 2022.9 2026.4 2014.1 C
 58.2193 +2020.4 2008.3 2015 2002.4 2008.8 1997.1 C
 58.2194 +2003.8 1996.8 2000.7 2001.2 1996.1 2002.1 C
 58.2195 +1995.2 1996.4 1996.9 1990.5 1995.6 1984.8 C
 58.2196 +1989.9 1979 1984.5 1973.9 1978.8 1967.8 C
 58.2197 +1977.7 1968.6 1976 1967.6 1974.5 1968.3 C
 58.2198 +1967.4 1972.5 1960.1 1976.1 1952.7 1979.3 C
 58.2199 +1946.8 1976.3 1943.4 1970.7 1938.5 1966.1 C
 58.2200 +1933.9 1966.5 1929.4 1968.8 1925.1 1970.7 C
 58.2201 +1917.2 1978.2 1906 1977.9 1897.2 1983.4 C
 58.2202 +1893.2 1985.6 1889.4 1988.6 1885 1990.1 C
 58.2203 +1884.6 1990.6 1883.9 1991 1883.8 1991.6 C
 58.2204 +1883.7 2000.4 1884 2009.9 1883.6 2018.9 C
 58.2205 +1887.7 2024 1893.2 2028.8 1898 2033.8 C
 58.2206 +1899.1 2035.5 1900.9 2036.8 1902.5 2037.9 C
 58.2207 +1903.9 2037.3 1905.2 2036.6 1906.4 2035.5 C
 58.2208 +1906.3 2039.7 1906.5 2044.6 1906.1 2048.9 C
 58.2209 +1906.3 2049.6 1906.7 2050.2 1907.1 2050.8 C
 58.2210 +1913.4 2056 1918.5 2062.7 1924.8 2068.1 C
 58.2211 +1926.6 2067.9 1928 2066.9 1929.4 2066 C
 58.2212 +1930.2 2071 1927.7 2077.1 1930.6 2081.6 C
 58.2213 +1936.6 2086.9 1941.5 2092.9 1947.9 2097.9 C
 58.2214 +1949 2098.1 1949.9 2097.5 1950.8 2097.2 C
 58.2215 +[0 0 0 0.18]  vc
 58.2216 +f 
 58.2217 +0.4 w
 58.2218 +S 
 58.2219 +n
 58.2220 +1975.2 2084.7 m
 58.2221 +1976.6 2083.4 1975.7 2081.1 1976 2079.4 C
 58.2222 +1979.3 2079.5 1980.9 2086.2 1984.8 2084 C
 58.2223 +1992.9 2078.9 2001.7 2075.6 2010 2071.2 C
 58.2224 +2011 2064.6 2010.2 2057.3 2010.8 2050.6 C
 58.2225 +2015.4 2046.9 2021.1 2045.9 2025.9 2042.4 C
 58.2226 +2026.5 2033.2 2026.8 2022.9 2025.6 2013.9 C
 58.2227 +2020.5 2008.1 2014.5 2003.1 2009.3 1997.6 C
 58.2228 +2004.1 1996.7 2000.7 2001.6 1995.9 2002.6 C
 58.2229 +1995.2 1996.7 1996.3 1990.2 1994.9 1984.6 C
 58.2230 +1989.8 1978.7 1983.6 1973.7 1978.4 1968 C
 58.2231 +1977.3 1969.3 1976 1967.6 1974.8 1968.5 C
 58.2232 +1967.7 1972.7 1960.4 1976.3 1952.9 1979.6 C
 58.2233 +1946.5 1976.9 1943.1 1970.5 1937.8 1966.1 C
 58.2234 +1928.3 1968.2 1920.6 1974.8 1911.6 1978.4 C
 58.2235 +1901.9 1979.7 1893.9 1986.6 1885 1990.6 C
 58.2236 +1884.3 1991 1884.3 1991.7 1884 1992.3 C
 58.2237 +1884.5 2001 1884.2 2011 1884.3 2019.9 C
 58.2238 +1890.9 2025.3 1895.9 2031.9 1902.3 2037.4 C
 58.2239 +1904.2 2037.9 1905.6 2034.2 1906.8 2035.7 C
 58.2240 +1907.4 2040.9 1905.7 2046.1 1907.3 2050.8 C
 58.2241 +1913.6 2056.2 1919.2 2062.6 1925.1 2067.9 C
 58.2242 +1926.9 2067.8 1928 2066.3 1929.6 2065.7 C
 58.2243 +1929.9 2070.5 1929.2 2076 1930.1 2080.8 C
 58.2244 +1936.5 2086.1 1941.6 2092.8 1948.4 2097.6 C
 58.2245 +1957.3 2093.3 1966.2 2088.8 1975.2 2084.7 C
 58.2246 +[0 0 0 0]  vc
 58.2247 +f 
 58.2248 +S 
 58.2249 +n
 58.2250 +1954.8 2093.8 m
 58.2251 +1961.6 2090.5 1968.2 2087 1975 2084 C
 58.2252 +1975 2082.8 1975.6 2080.9 1974.8 2080.6 C
 58.2253 +1974.3 2075.2 1974.6 2069.6 1974.5 2064 C
 58.2254 +1977.5 2059.7 1984.5 2060 1988.9 2056.4 C
 58.2255 +1989.5 2055.5 1990.5 2055.3 1990.8 2054.4 C
 58.2256 +1991.1 2045.7 1991.4 2036.1 1990.6 2027.8 C
 58.2257 +1990.7 2026.6 1992 2027.3 1992.8 2027.1 C
 58.2258 +1997 2032.4 2002.6 2037.8 2007.6 2042.2 C
 58.2259 +2008.7 2042.3 2007.8 2040.6 2007.4 2040 C
 58.2260 +2002.3 2035.6 1997.5 2030 1992.8 2025.2 C
 58.2261 +1991.6 2024.7 1990.8 2024.9 1990.1 2025.4 C
 58.2262 +1989.4 2024.9 1988.1 2025.2 1987.2 2024.4 C
 58.2263 +1987.1 2025.8 1988.3 2026.5 1989.4 2026.8 C
 58.2264 +1989.4 2026.6 1989.3 2026.2 1989.6 2026.1 C
 58.2265 +1989.9 2026.2 1989.9 2026.6 1989.9 2026.8 C
 58.2266 +1989.8 2026.6 1990 2026.5 1990.1 2026.4 C
 58.2267 +1990.2 2027 1991.1 2028.3 1990.1 2028 C
 58.2268 +1989.9 2037.9 1990.5 2044.1 1989.6 2054.2 C
 58.2269 +1985.9 2058 1979.7 2057.4 1976 2061.2 C
 58.2270 +1974.5 2061.6 1975.2 2059.9 1974.5 2059.5 C
 58.2271 +1973.9 2058 1975.6 2057.8 1975 2056.6 C
 58.2272 +1974.5 2057.1 1974.6 2055.3 1973.6 2055.9 C
 58.2273 +1971.9 2059.3 1974.7 2062.1 1973.1 2065.5 C
 58.2274 +1973.1 2071.2 1972.9 2077 1973.3 2082.5 C
 58.2275 +1967.7 2085.6 1962 2088 1956.3 2090.7 C
 58.2276 +1953.9 2092.4 1951 2093 1948.6 2094.8 C
 58.2277 +1943.7 2089.9 1937.9 2084.3 1933 2079.6 C
 58.2278 +1931.3 2076.1 1933.2 2071.3 1932.3 2067.2 C
 58.2279 +1931.3 2062.9 1933.3 2060.6 1932 2057.6 C
 58.2280 +1932.7 2056.5 1930.9 2053.3 1933.2 2051.8 C
 58.2281 +1936.8 2050.1 1940.1 2046.9 1944 2046.8 C
 58.2282 +1946.3 2049.7 1949.3 2051.9 1952 2054.4 C
 58.2283 +1954.5 2054.2 1956.4 2052.3 1958.7 2051.3 C
 58.2284 +1960.8 2050 1963.2 2049 1965.6 2048.4 C
 58.2285 +1968.3 2050.8 1970.7 2054.3 1973.6 2055.4 C
 58.2286 +1973 2052.2 1969.7 2050.4 1967.6 2048.2 C
 58.2287 +1967.1 2046.7 1968.8 2046.6 1969.5 2045.8 C
 58.2288 +1972.8 2043.3 1980.6 2043.4 1979.3 2038.4 C
 58.2289 +1979.4 2038.6 1979.2 2038.7 1979.1 2038.8 C
 58.2290 +1978.7 2038.6 1978.9 2038.1 1978.8 2037.6 C
 58.2291 +1978.9 2037.9 1978.7 2038 1978.6 2038.1 C
 58.2292 +1978.2 2032.7 1978.4 2027.1 1978.4 2021.6 C
 58.2293 +1979.3 2021.1 1980 2020.2 1981.5 2020.1 C
 58.2294 +1983.5 2020.5 1984 2021.8 1985.1 2023.5 C
 58.2295 +1985.7 2024 1987.4 2023.7 1986 2022.8 C
 58.2296 +1984.7 2021.7 1983.3 2020.8 1983.9 2018.7 C
 58.2297 +1987.2 2015.9 1993 2015.4 1994.9 2011.5 C
 58.2298 +1992.2 2004.9 1999.3 2005.2 2002.1 2002.4 C
 58.2299 +2005.9 2002.7 2004.8 1997.4 2009.1 1999 C
 58.2300 +2011 1999.3 2010 2002.9 2012.7 2002.4 C
 58.2301 +2010.2 2000.7 2009.4 1996.1 2005.5 1998.5 C
 58.2302 +2002.1 2000.3 1999 2002.5 1995.4 2003.8 C
 58.2303 +1995.2 2003.6 1994.9 2003.3 1994.7 2003.1 C
 58.2304 +1994.3 1997 1995.6 1991.1 1994.4 1985.3 C
 58.2305 +1994.3 1986 1993.8 1985 1994 1985.6 C
 58.2306 +1993.8 1995.4 1994.4 2001.6 1993.5 2011.7 C
 58.2307 +1989.7 2015.5 1983.6 2014.9 1979.8 2018.7 C
 58.2308 +1978.3 2019.1 1979.1 2017.4 1978.4 2017 C
 58.2309 +1977.8 2015.5 1979.4 2015.3 1978.8 2014.1 C
 58.2310 +1978.4 2014.6 1978.5 2012.8 1977.4 2013.4 C
 58.2311 +1975.8 2016.8 1978.5 2019.6 1976.9 2023 C
 58.2312 +1977 2028.7 1976.7 2034.5 1977.2 2040 C
 58.2313 +1971.6 2043.1 1965.8 2045.6 1960.1 2048.2 C
 58.2314 +1957.7 2049.9 1954.8 2050.5 1952.4 2052.3 C
 58.2315 +1947.6 2047.4 1941.8 2041.8 1936.8 2037.2 C
 58.2316 +1935.2 2033.6 1937.1 2028.8 1936.1 2024.7 C
 58.2317 +1935.1 2020.4 1937.1 2018.1 1935.9 2015.1 C
 58.2318 +1936.5 2014.1 1934.7 2010.8 1937.1 2009.3 C
 58.2319 +1944.4 2004.8 1952 2000.9 1959.9 1997.8 C
 58.2320 +1963.9 1997 1963.9 2001.9 1966.8 2003.3 C
 58.2321 +1970.3 2006.9 1973.7 2009.9 1976.9 2012.9 C
 58.2322 +1977.9 2013 1977.1 2011.4 1976.7 2010.8 C
 58.2323 +1971.6 2006.3 1966.8 2000.7 1962 1995.9 C
 58.2324 +1960 1995.2 1960.1 1996.6 1958.2 1995.6 C
 58.2325 +1957 1997 1955.1 1998.8 1953.2 1998 C
 58.2326 +1951.7 1994.5 1954.1 1993.4 1952.9 1991.1 C
 58.2327 +1952.1 1990.5 1953.3 1990.2 1953.2 1989.6 C
 58.2328 +1954.2 1986.8 1950.9 1981.4 1954.4 1981.2 C
 58.2329 +1954.7 1981.6 1954.7 1981.7 1955.1 1982 C
 58.2330 +1961.9 1979.1 1967.6 1975 1974.3 1971.6 C
 58.2331 +1974.7 1969.8 1976.7 1969.5 1978.4 1969.7 C
 58.2332 +1980.3 1970 1979.3 1973.6 1982 1973.1 C
 58.2333 +1975.8 1962.2 1968 1975.8 1960.8 1976.7 C
 58.2334 +1956.9 1977.4 1953.3 1982.4 1949.1 1978.8 C
 58.2335 +1946 1975.8 1941.2 1971 1939.5 1969.2 C
 58.2336 +1938.5 1968.6 1938.9 1967.4 1937.8 1966.8 C
 58.2337 +1928.7 1969.4 1920.6 1974.5 1912.4 1979.1 C
 58.2338 +1904 1980 1896.6 1985 1889.3 1989.4 C
 58.2339 +1887.9 1990.4 1885.1 1990.3 1885 1992.5 C
 58.2340 +1885.4 2000.6 1885.2 2012.9 1885.2 2019.9 C
 58.2341 +1886.1 2022 1889.7 2019.5 1888.4 2022.8 C
 58.2342 +1889 2023.3 1889.8 2024.4 1890.3 2024 C
 58.2343 +1891.2 2023.5 1891.8 2028.2 1893.4 2026.6 C
 58.2344 +1894.2 2026.3 1893.9 2027.3 1894.4 2027.6 C
 58.2345 +1893.4 2027.6 1894.7 2028.3 1894.1 2028.5 C
 58.2346 +1894.4 2029.6 1896 2030 1896 2029.2 C
 58.2347 +1896.2 2029 1896.3 2029 1896.5 2029.2 C
 58.2348 +1896.8 2029.8 1897.3 2030 1897 2030.7 C
 58.2349 +1896.5 2030.7 1896.9 2031.5 1897.2 2031.6 C
 58.2350 +1898.3 2034 1899.5 2030.6 1899.6 2033.3 C
 58.2351 +1898.5 2033 1899.6 2034.4 1900.1 2034.8 C
 58.2352 +1901.3 2035.8 1903.2 2034.6 1902.5 2036.7 C
 58.2353 +1904.4 2036.9 1906.1 2032.2 1907.6 2035.5 C
 58.2354 +1907.5 2040.1 1907.7 2044.9 1907.3 2049.4 C
 58.2355 +1908 2050.2 1908.3 2051.4 1909.5 2051.6 C
 58.2356 +1910.1 2051.1 1911.6 2051.1 1911.4 2052.3 C
 58.2357 +1909.7 2052.8 1912.4 2054 1912.6 2054.7 C
 58.2358 +1913.4 2055.2 1913 2053.7 1913.6 2054.4 C
 58.2359 +1913.6 2054.5 1913.6 2055.3 1913.6 2054.7 C
 58.2360 +1913.7 2054.4 1913.9 2054.4 1914 2054.7 C
 58.2361 +1914 2054.9 1914.1 2055.3 1913.8 2055.4 C
 58.2362 +1913.7 2056 1915.2 2057.6 1916 2057.6 C
 58.2363 +1915.9 2057.3 1916.1 2057.2 1916.2 2057.1 C
 58.2364 +1917 2056.8 1916.7 2057.7 1917.2 2058 C
 58.2365 +1917 2058.3 1916.7 2058.3 1916.4 2058.3 C
 58.2366 +1917.1 2059 1917.3 2060.1 1918.4 2060.4 C
 58.2367 +1918.1 2059.2 1919.1 2060.6 1919.1 2059.5 C
 58.2368 +1919 2060.6 1920.6 2060.1 1919.8 2061.2 C
 58.2369 +1919.6 2061.2 1919.3 2061.2 1919.1 2061.2 C
 58.2370 +1919.6 2061.9 1921.4 2064.2 1921.5 2062.6 C
 58.2371 +1922.4 2062.1 1921.6 2063.9 1922.2 2064.3 C
 58.2372 +1922.9 2067.3 1926.1 2064.3 1925.6 2067.2 C
 58.2373 +1927.2 2066.8 1928.4 2064.6 1930.1 2065.2 C
 58.2374 +1931.8 2067.8 1931 2071.8 1930.8 2074.8 C
 58.2375 +1930.6 2076.4 1930.1 2078.6 1930.6 2080.4 C
 58.2376 +1936.6 2085.4 1941.8 2091.6 1948.1 2096.9 C
 58.2377 +1950.7 2096.7 1952.6 2094.8 1954.8 2093.8 C
 58.2378 +[0 0.33 0.33 0.99]  vc
 58.2379 +f 
 58.2380 +S 
 58.2381 +n
 58.2382 +1989.4 2080.6 m
 58.2383 +1996.1 2077.3 2002.7 2073.8 2009.6 2070.8 C
 58.2384 +2009.6 2069.6 2010.2 2067.7 2009.3 2067.4 C
 58.2385 +2008.9 2062 2009.1 2056.4 2009.1 2050.8 C
 58.2386 +2012.3 2046.6 2019 2046.6 2023.5 2043.2 C
 58.2387 +2024 2042.3 2025.1 2042.1 2025.4 2041.2 C
 58.2388 +2025.3 2032.7 2025.6 2023.1 2025.2 2014.6 C
 58.2389 +2025 2015.3 2024.6 2014.2 2024.7 2014.8 C
 58.2390 +2024.5 2024.7 2025.1 2030.9 2024.2 2041 C
 58.2391 +2020.4 2044.8 2014.3 2044.2 2010.5 2048 C
 58.2392 +2009 2048.4 2009.8 2046.7 2009.1 2046.3 C
 58.2393 +2008.5 2044.8 2010.2 2044.6 2009.6 2043.4 C
 58.2394 +2009.1 2043.9 2009.2 2042.1 2008.1 2042.7 C
 58.2395 +2006.5 2046.1 2009.3 2048.9 2007.6 2052.3 C
 58.2396 +2007.7 2058 2007.5 2063.8 2007.9 2069.3 C
 58.2397 +2002.3 2072.4 1996.5 2074.8 1990.8 2077.5 C
 58.2398 +1988.4 2079.2 1985.6 2079.8 1983.2 2081.6 C
 58.2399 +1980.5 2079 1977.9 2076.5 1975.5 2074.1 C
 58.2400 +1975.5 2075.1 1975.5 2076.2 1975.5 2077.2 C
 58.2401 +1977.8 2079.3 1980.3 2081.6 1982.7 2083.7 C
 58.2402 +1985.3 2083.5 1987.1 2081.6 1989.4 2080.6 C
 58.2403 +f 
 58.2404 +S 
 58.2405 +n
 58.2406 +1930.1 2079.9 m
 58.2407 +1931.1 2075.6 1929.2 2071.1 1930.8 2067.2 C
 58.2408 +1930.3 2066.3 1930.1 2064.6 1928.7 2065.5 C
 58.2409 +1927.7 2066.4 1926.5 2067 1925.3 2067.4 C
 58.2410 +1924.5 2066.9 1925.6 2065.7 1924.4 2066 C
 58.2411 +1924.2 2067.2 1923.6 2065.5 1923.2 2065.7 C
 58.2412 +1922.3 2063.6 1917.8 2062.1 1919.6 2060.4 C
 58.2413 +1919.3 2060.5 1919.2 2060.3 1919.1 2060.2 C
 58.2414 +1919.7 2060.9 1918.2 2061 1917.6 2060.2 C
 58.2415 +1917 2059.6 1916.1 2058.8 1916.4 2058 C
 58.2416 +1915.5 2058 1917.4 2057.1 1915.7 2057.8 C
 58.2417 +1914.8 2057.1 1913.4 2056.2 1913.3 2054.9 C
 58.2418 +1913.1 2055.4 1911.3 2054.3 1910.9 2053.2 C
 58.2419 +1910.7 2052.9 1910.2 2052.5 1910.7 2052.3 C
 58.2420 +1911.1 2052.5 1910.9 2052 1910.9 2051.8 C
 58.2421 +1910.5 2051.2 1909.9 2052.6 1909.2 2051.8 C
 58.2422 +1908.2 2051.4 1907.8 2050.2 1907.1 2049.4 C
 58.2423 +1907.5 2044.8 1907.3 2040 1907.3 2035.2 C
 58.2424 +1905.3 2033 1902.8 2039.3 1902.3 2035.7 C
 58.2425 +1899.6 2036 1898.4 2032.5 1896.3 2030.7 C
 58.2426 +1895.7 2030.1 1897.5 2030 1896.3 2029.7 C
 58.2427 +1896.3 2030.6 1895 2029.7 1894.4 2029.2 C
 58.2428 +1892.9 2028.1 1894.2 2027.4 1893.6 2027.1 C
 58.2429 +1892.1 2027.9 1891.7 2025.6 1890.8 2024.9 C
 58.2430 +1891.1 2024.6 1889.1 2024.3 1888.4 2023 C
 58.2431 +1887.5 2022.6 1888.2 2021.9 1888.1 2021.3 C
 58.2432 +1886.7 2022 1885.2 2020.4 1884.8 2019.2 C
 58.2433 +1884.8 2010 1884.6 2000.2 1885 1991.8 C
 58.2434 +1886.9 1989.6 1889.9 1989.3 1892.2 1987.5 C
 58.2435 +1898.3 1982.7 1905.6 1980.1 1912.8 1978.6 C
 58.2436 +1921 1974.2 1928.8 1968.9 1937.8 1966.6 C
 58.2437 +1939.8 1968.3 1938.8 1968.3 1940.4 1970 C
 58.2438 +1945.4 1972.5 1947.6 1981.5 1954.6 1979.3 C
 58.2439 +1952.3 1981 1950.4 1978.4 1948.6 1977.9 C
 58.2440 +1945.1 1973.9 1941.1 1970.6 1938 1966.6 C
 58.2441 +1928.4 1968.5 1920.6 1974.8 1911.9 1978.8 C
 58.2442 +1907.1 1979.2 1902.6 1981.7 1898.2 1983.6 C
 58.2443 +1893.9 1986 1889.9 1989 1885.5 1990.8 C
 58.2444 +1884.9 1991.2 1884.8 1991.8 1884.5 1992.3 C
 58.2445 +1884.9 2001.3 1884.7 2011.1 1884.8 2019.6 C
 58.2446 +1890.6 2025 1896.5 2031.2 1902.3 2036.9 C
 58.2447 +1904.6 2037.6 1905 2033 1907.3 2035.5 C
 58.2448 +1907.2 2040.2 1907 2044.8 1907.1 2049.6 C
 58.2449 +1913.6 2055.3 1918.4 2061.5 1925.1 2067.4 C
 58.2450 +1927.3 2068.2 1929.6 2062.5 1930.6 2066.9 C
 58.2451 +1929.7 2070.7 1930.3 2076 1930.1 2080.1 C
 58.2452 +1935.6 2085.7 1941.9 2090.7 1947.2 2096.7 C
 58.2453 +1942.2 2091.1 1935.5 2085.2 1930.1 2079.9 C
 58.2454 +[0.18 0.18 0 0.78]  vc
 58.2455 +f 
 58.2456 +S 
 58.2457 +n
 58.2458 +1930.8 2061.9 m
 58.2459 +1930.3 2057.8 1931.8 2053.4 1931.1 2050.4 C
 58.2460 +1931.3 2050.3 1931.7 2050.5 1931.6 2050.1 C
 58.2461 +1933 2051.1 1934.4 2049.5 1935.9 2048.7 C
 58.2462 +1937 2046.5 1939.5 2047.1 1941.2 2045.1 C
 58.2463 +1939.7 2042.6 1937.3 2041.2 1935.4 2039.3 C
 58.2464 +1934 2039.7 1934.5 2038.1 1933.7 2037.6 C
 58.2465 +1934 2033.3 1933.1 2027.9 1934.4 2024.4 C
 58.2466 +1934.3 2023.8 1933.9 2022.8 1933 2022.8 C
 58.2467 +1931.6 2023.1 1930.5 2024.4 1929.2 2024.9 C
 58.2468 +1928.4 2024.5 1929.8 2023.5 1928.7 2023.5 C
 58.2469 +1927.7 2024.1 1926.2 2022.6 1925.6 2021.6 C
 58.2470 +1926.9 2021.6 1924.8 2020.6 1925.6 2020.4 C
 58.2471 +1924.7 2021.7 1923.9 2019.6 1923.2 2019.2 C
 58.2472 +1923.3 2018.3 1923.8 2018.1 1923.2 2018 C
 58.2473 +1922.9 2017.8 1922.9 2017.5 1922.9 2017.2 C
 58.2474 +1922.8 2018.3 1921.3 2017.3 1920.3 2018 C
 58.2475 +1916.6 2019.7 1913 2022.1 1910 2024.7 C
 58.2476 +1910 2032.9 1910 2041.2 1910 2049.4 C
 58.2477 +1915.4 2055.2 1920 2058.7 1925.3 2064.8 C
 58.2478 +1927.2 2064 1929 2061.4 1930.8 2061.9 C
 58.2479 +[0 0 0 0]  vc
 58.2480 +f 
 58.2481 +S 
 58.2482 +n
 58.2483 +1907.6 2030.4 m
 58.2484 +1907.5 2027.1 1906.4 2021.7 1908.5 2019.9 C
 58.2485 +1908.8 2020.1 1908.9 2019 1909.2 2019.6 C
 58.2486 +1910 2019.6 1912 2019.2 1913.1 2018.2 C
 58.2487 +1913.7 2016.5 1920.2 2015.7 1917.4 2012.7 C
 58.2488 +1918.2 2011.2 1917 2013.8 1917.2 2012 C
 58.2489 +1916.9 2012.3 1916 2012.4 1915.2 2012 C
 58.2490 +1912.5 2010.5 1916.6 2008.8 1913.6 2009.6 C
 58.2491 +1912.6 2009.2 1911.1 2009 1910.9 2007.6 C
 58.2492 +1911 1999.2 1911.8 1989.8 1911.2 1982.2 C
 58.2493 +1910.1 1981.1 1908.8 1982.2 1907.6 1982.2 C
 58.2494 +1900.8 1986.5 1893.2 1988.8 1887.2 1994.2 C
 58.2495 +1887.2 2002.4 1887.2 2010.7 1887.2 2018.9 C
 58.2496 +1892.6 2024.7 1897.2 2028.2 1902.5 2034.3 C
 58.2497 +1904.3 2033.3 1906.2 2032.1 1907.6 2030.4 C
 58.2498 +f 
 58.2499 +S 
 58.2500 +n
 58.2501 +1910.7 2025.4 m
 58.2502 +1912.7 2022.4 1916.7 2020.8 1919.8 2018.9 C
 58.2503 +1920.2 2018.7 1920.6 2018.6 1921 2018.4 C
 58.2504 +1925 2020 1927.4 2028.5 1932 2024.2 C
 58.2505 +1932.3 2025 1932.5 2023.7 1932.8 2024.4 C
 58.2506 +1932.8 2028 1932.8 2031.5 1932.8 2035 C
 58.2507 +1931.9 2033.9 1932.5 2036.3 1932.3 2036.9 C
 58.2508 +1933.2 2036.4 1932.5 2038.5 1933 2038.4 C
 58.2509 +1933.1 2040.5 1935.6 2042.2 1936.6 2043.2 C
 58.2510 +1936.2 2042.4 1935.1 2040.8 1933.7 2040.3 C
 58.2511 +1932.2 2034.4 1933.8 2029.8 1933 2023.2 C
 58.2512 +1931.1 2024.9 1928.4 2026.4 1926.5 2023.5 C
 58.2513 +1925.1 2021.6 1923 2019.8 1921.5 2018.2 C
 58.2514 +1917.8 2018.9 1915.2 2022.5 1911.6 2023.5 C
 58.2515 +1910.8 2023.8 1911.2 2024.7 1910.4 2025.2 C
 58.2516 +1910.9 2031.8 1910.6 2039.1 1910.7 2045.6 C
 58.2517 +1910.1 2048 1910.7 2045.9 1911.2 2044.8 C
 58.2518 +1910.6 2038.5 1911.2 2031.8 1910.7 2025.4 C
 58.2519 +[0.07 0.06 0 0.58]  vc
 58.2520 +f 
 58.2521 +S 
 58.2522 +n
 58.2523 +1910.7 2048.9 m
 58.2524 +1910.3 2047.4 1911.3 2046.5 1911.6 2045.3 C
 58.2525 +1912.9 2045.3 1913.9 2047.1 1915.2 2045.8 C
 58.2526 +1915.2 2044.9 1916.6 2043.3 1917.2 2042.9 C
 58.2527 +1918.7 2042.9 1919.4 2044.4 1920.5 2043.2 C
 58.2528 +1921.2 2042.2 1921.4 2040.9 1922.4 2040.3 C
 58.2529 +1924.5 2040.3 1925.7 2040.9 1926.8 2039.6 C
 58.2530 +1927.1 2037.9 1926.8 2038.1 1927.7 2037.6 C
 58.2531 +1929 2037.5 1930.4 2037 1931.6 2037.2 C
 58.2532 +1932.3 2038.2 1933.1 2038.7 1932.8 2040.3 C
 58.2533 +1935 2041.8 1935.9 2043.8 1938.5 2044.8 C
 58.2534 +1938.6 2045 1938.3 2045.5 1938.8 2045.3 C
 58.2535 +1939.1 2042.9 1935.4 2044.2 1935.4 2042.2 C
 58.2536 +1932.1 2040.8 1932.8 2037.2 1932 2034.8 C
 58.2537 +1932.3 2034 1932.7 2035.4 1932.5 2034.8 C
 58.2538 +1931.3 2031.8 1935.5 2020.1 1928.9 2025.9 C
 58.2539 +1924.6 2024.7 1922.6 2014.5 1917.4 2020.4 C
 58.2540 +1915.5 2022.8 1912 2022.6 1910.9 2025.4 C
 58.2541 +1911.5 2031.9 1910.9 2038.8 1911.4 2045.3 C
 58.2542 +1911.1 2046.5 1910 2047.4 1910.4 2048.9 C
 58.2543 +1915.1 2054.4 1920.4 2058.3 1925.1 2063.8 C
 58.2544 +1920.8 2058.6 1914.9 2054.3 1910.7 2048.9 C
 58.2545 +[0.4 0.4 0 0]  vc
 58.2546 +f 
 58.2547 +S 
 58.2548 +n
 58.2549 +1934.7 2031.9 m
 58.2550 +1934.6 2030.7 1934.9 2029.5 1934.4 2028.5 C
 58.2551 +1934 2029.5 1934.3 2031.2 1934.2 2032.6 C
 58.2552 +1933.8 2031.7 1934.9 2031.6 1934.7 2031.9 C
 58.2553 +[0.92 0.92 0 0.67]  vc
 58.2554 +f 
 58.2555 +S 
 58.2556 +n
 58.2557 +vmrs
 58.2558 +1934.7 2019.4 m
 58.2559 +1934.1 2015.3 1935.6 2010.9 1934.9 2007.9 C
 58.2560 +1935.1 2007.8 1935.6 2008.1 1935.4 2007.6 C
 58.2561 +1936.8 2008.6 1938.2 2007 1939.7 2006.2 C
 58.2562 +1940.1 2004.3 1942.7 2005 1943.6 2003.8 C
 58.2563 +1945.1 2000.3 1954 2000.8 1950 1996.6 C
 58.2564 +1952.1 1993.3 1948.2 1989.2 1951.2 1985.6 C
 58.2565 +1953 1981.4 1948.4 1982.3 1947.9 1979.8 C
 58.2566 +1945.4 1979.6 1945.1 1975.5 1942.4 1975 C
 58.2567 +1942.4 1972.3 1938 1973.6 1938.5 1970.4 C
 58.2568 +1937.4 1969 1935.6 1970.1 1934.2 1970.2 C
 58.2569 +1927.5 1974.5 1919.8 1976.8 1913.8 1982.2 C
 58.2570 +1913.8 1990.4 1913.8 1998.7 1913.8 2006.9 C
 58.2571 +1919.3 2012.7 1923.8 2016.2 1929.2 2022.3 C
 58.2572 +1931.1 2021.6 1932.8 2018.9 1934.7 2019.4 C
 58.2573 +[0 0 0 0]  vc
 58.2574 +f 
 58.2575 +0.4 w
 58.2576 +2 J
 58.2577 +2 M
 58.2578 +S 
 58.2579 +n
 58.2580 +2024.2 2038.1 m
 58.2581 +2024.1 2029.3 2024.4 2021.7 2024.7 2014.4 C
 58.2582 +2024.4 2013.6 2020.6 2013.4 2021.3 2011.2 C
 58.2583 +2020.5 2010.3 2018.4 2010.6 2018.9 2008.6 C
 58.2584 +2019 2008.8 2018.8 2009 2018.7 2009.1 C
 58.2585 +2018.2 2006.7 2015.2 2007.9 2015.3 2005.5 C
 58.2586 +2014.7 2004.8 2012.4 2005.1 2013.2 2003.6 C
 58.2587 +2012.3 2004.2 2012.8 2002.4 2012.7 2002.6 C
 58.2588 +2009.4 2003.3 2011.2 1998.6 2008.4 1999.2 C
 58.2589 +2007 1999.1 2006.1 1999.4 2005.7 2000.4 C
 58.2590 +2006.9 1998.5 2007.7 2000.5 2009.3 2000.2 C
 58.2591 +2009.2 2003.7 2012.4 2002.1 2012.9 2005.2 C
 58.2592 +2015.9 2005.6 2015.2 2008.6 2017.7 2008.8 C
 58.2593 +2018.4 2009.6 2018.3 2011.4 2019.6 2011 C
 58.2594 +2021.1 2011.7 2021.4 2014.8 2023.7 2015.1 C
 58.2595 +2023.7 2023.5 2023.9 2031.6 2023.5 2040.5 C
 58.2596 +2021.8 2041.7 2020.7 2043.6 2018.4 2043.9 C
 58.2597 +2020.8 2042.7 2025.5 2041.8 2024.2 2038.1 C
 58.2598 +[0 0.87 0.91 0.83]  vc
 58.2599 +f 
 58.2600 +S 
 58.2601 +n
 58.2602 +2023.5 2040 m
 58.2603 +2023.5 2031.1 2023.5 2023.4 2023.5 2015.1 C
 58.2604 +2020.2 2015 2021.8 2010.3 2018.4 2011 C
 58.2605 +2018.6 2007.5 2014.7 2009.3 2014.8 2006.4 C
 58.2606 +2011.8 2006.3 2012.2 2002.3 2009.8 2002.4 C
 58.2607 +2009.7 2001.5 2009.2 2000.1 2008.4 2000.2 C
 58.2608 +2008.7 2000.9 2009.7 2001.2 2009.3 2002.4 C
 58.2609 +2008.4 2004.2 2007.5 2003.1 2007.9 2005.5 C
 58.2610 +2007.9 2010.8 2007.7 2018.7 2008.1 2023.2 C
 58.2611 +2009 2024.3 2007.3 2023.4 2007.9 2024 C
 58.2612 +2007.7 2024.6 2007.3 2026.3 2008.6 2027.1 C
 58.2613 +2009.7 2026.8 2010 2027.6 2010.5 2028 C
 58.2614 +2010.5 2028.2 2010.5 2029.1 2010.5 2028.5 C
 58.2615 +2011.5 2028 2010.5 2030 2011.5 2030 C
 58.2616 +2014.2 2029.7 2012.9 2032.2 2014.8 2032.6 C
 58.2617 +2015.1 2033.6 2015.3 2033 2016 2033.3 C
 58.2618 +2017 2033.9 2016.6 2035.4 2017.2 2036.2 C
 58.2619 +2018.7 2036.4 2019.2 2039 2021.3 2038.4 C
 58.2620 +2021.6 2035.4 2019.7 2029.5 2021.1 2027.3 C
 58.2621 +2020.9 2023.5 2021.5 2018.5 2020.6 2016 C
 58.2622 +2020.9 2013.9 2021.5 2015.4 2022.3 2014.4 C
 58.2623 +2022.2 2015.1 2023.3 2014.8 2023.2 2015.6 C
 58.2624 +2022.7 2019.8 2023.3 2024.3 2022.8 2028.5 C
 58.2625 +2022.3 2028.2 2022.6 2027.6 2022.5 2027.1 C
 58.2626 +2022.5 2027.8 2022.5 2029.2 2022.5 2029.2 C
 58.2627 +2022.6 2029.2 2022.7 2029.1 2022.8 2029 C
 58.2628 +2023.9 2032.8 2022.6 2037 2023 2040.8 C
 58.2629 +2022.3 2041.2 2021.6 2041.5 2021.1 2042.2 C
 58.2630 +2022 2041.2 2022.9 2041.4 2023.5 2040 C
 58.2631 +[0 1 1 0.23]  vc
 58.2632 +f 
 58.2633 +S 
 58.2634 +n
 58.2635 +2009.1 1997.8 m
 58.2636 +2003.8 1997.7 2000.1 2002.4 1995.4 2003.1 C
 58.2637 +1995 1999.5 1995.2 1995 1995.2 1992 C
 58.2638 +1995.2 1995.8 1995 1999.7 1995.4 2003.3 C
 58.2639 +2000.3 2002.2 2003.8 1997.9 2009.1 1997.8 C
 58.2640 +2012.3 2001.2 2015.6 2004.8 2018.7 2008.1 C
 58.2641 +2021.6 2011.2 2027.5 2013.9 2025.9 2019.9 C
 58.2642 +2026.1 2017.9 2025.6 2016.2 2025.4 2014.4 C
 58.2643 +2020.2 2008.4 2014 2003.6 2009.1 1997.8 C
 58.2644 +[0.18 0.18 0 0.78]  vc
 58.2645 +f 
 58.2646 +S 
 58.2647 +n
 58.2648 +2009.3 1997.8 m
 58.2649 +2008.7 1997.4 2007.9 1997.6 2007.2 1997.6 C
 58.2650 +2007.9 1997.6 2008.9 1997.4 2009.6 1997.8 C
 58.2651 +2014.7 2003.6 2020.8 2008.8 2025.9 2014.8 C
 58.2652 +2025.8 2017.7 2026.1 2014.8 2025.6 2014.1 C
 58.2653 +2020.4 2008.8 2014.8 2003.3 2009.3 1997.8 C
 58.2654 +[0.07 0.06 0 0.58]  vc
 58.2655 +f 
 58.2656 +S 
 58.2657 +n
 58.2658 +2009.6 1997.6 m
 58.2659 +2009 1997.1 2008.1 1997.4 2007.4 1997.3 C
 58.2660 +2008.1 1997.4 2009 1997.1 2009.6 1997.6 C
 58.2661 +2014.8 2003.7 2021.1 2008.3 2025.9 2014.4 C
 58.2662 +2021.1 2008.3 2014.7 2003.5 2009.6 1997.6 C
 58.2663 +[0.4 0.4 0 0]  vc
 58.2664 +f 
 58.2665 +S 
 58.2666 +n
 58.2667 +2021.8 2011.5 m
 58.2668 +2021.9 2012.2 2022.3 2013.5 2023.7 2013.6 C
 58.2669 +2023.4 2012.7 2022.8 2011.8 2021.8 2011.5 C
 58.2670 +[0 0.33 0.33 0.99]  vc
 58.2671 +f 
 58.2672 +S 
 58.2673 +n
 58.2674 +2021.1 2042 m
 58.2675 +2022.1 2041.1 2020.9 2040.2 2020.6 2039.6 C
 58.2676 +2018.4 2039.5 2018.1 2036.9 2016.3 2036.4 C
 58.2677 +2015.8 2035.5 2015.3 2033.8 2014.8 2033.6 C
 58.2678 +2012.4 2033.8 2013 2030.4 2010.5 2030.2 C
 58.2679 +2009.6 2028.9 2009.6 2028.3 2008.4 2028 C
 58.2680 +2006.9 2026.7 2007.5 2024.3 2006 2023.2 C
 58.2681 +2006.6 2023.2 2005.7 2023.3 2005.7 2023 C
 58.2682 +2006.4 2022.5 2006.3 2021.1 2006.7 2020.6 C
 58.2683 +2006.6 2015 2006.9 2009 2006.4 2003.8 C
 58.2684 +2006.9 2002.5 2007.6 2001.1 2006.9 2000.7 C
 58.2685 +2004.6 2003.6 2003 2002.9 2000.2 2004.3 C
 58.2686 +1999.3 2005.8 1997.9 2006.3 1996.1 2006.7 C
 58.2687 +1995.7 2008.9 1996 2011.1 1995.9 2012.9 C
 58.2688 +1993.4 2015.1 1990.5 2016.2 1987.7 2017.7 C
 58.2689 +1987.1 2019.3 1991.1 2019.4 1990.4 2021.3 C
 58.2690 +1990.5 2021.5 1991.9 2022.3 1992 2023 C
 58.2691 +1994.8 2024.4 1996.2 2027.5 1998.5 2030 C
 58.2692 +2002.4 2033 2005.2 2037.2 2008.8 2041 C
 58.2693 +2010.2 2041.3 2011.6 2042 2011 2043.9 C
 58.2694 +2011.2 2044.8 2010.1 2045.3 2010.5 2046.3 C
 58.2695 +2013.8 2044.8 2017.5 2043.4 2021.1 2042 C
 58.2696 +[0 0.5 0.5 0.2]  vc
 58.2697 +f 
 58.2698 +S 
 58.2699 +n
 58.2700 +2019.4 2008.8 m
 58.2701 +2018.9 2009.2 2019.3 2009.9 2019.6 2010.3 C
 58.2702 +2022.2 2011.5 2020.3 2009.1 2019.4 2008.8 C
 58.2703 +[0 0.33 0.33 0.99]  vc
 58.2704 +f 
 58.2705 +S 
 58.2706 +n
 58.2707 +2018 2007.4 m
 58.2708 +2015.7 2006.7 2015.3 2003.6 2012.9 2002.8 C
 58.2709 +2013.5 2003.7 2013.5 2005.1 2015.6 2005.2 C
 58.2710 +2016.4 2006.1 2015.7 2007.7 2018 2007.4 C
 58.2711 +f 
 58.2712 +S 
 58.2713 +n
 58.2714 +vmrs
 58.2715 +1993.5 2008.8 m
 58.2716 +1993.4 2000 1993.7 1992.5 1994 1985.1 C
 58.2717 +1993.7 1984.3 1989.9 1984.1 1990.6 1982 C
 58.2718 +1989.8 1981.1 1987.7 1981.4 1988.2 1979.3 C
 58.2719 +1988.3 1979.6 1988.1 1979.7 1988 1979.8 C
 58.2720 +1987.5 1977.5 1984.5 1978.6 1984.6 1976.2 C
 58.2721 +1983.9 1975.5 1981.7 1975.8 1982.4 1974.3 C
 58.2722 +1981.6 1974.9 1982.1 1973.1 1982 1973.3 C
 58.2723 +1979 1973.7 1980 1968.8 1976.9 1969.7 C
 58.2724 +1975.9 1969.8 1975.3 1970.3 1975 1971.2 C
 58.2725 +1976.2 1969.2 1977 1971.2 1978.6 1970.9 C
 58.2726 +1978.5 1974.4 1981.7 1972.8 1982.2 1976 C
 58.2727 +1985.2 1976.3 1984.5 1979.3 1987 1979.6 C
 58.2728 +1987.7 1980.3 1987.5 1982.1 1988.9 1981.7 C
 58.2729 +1990.4 1982.4 1990.7 1985.5 1993 1985.8 C
 58.2730 +1992.9 1994.3 1993.2 2002.3 1992.8 2011.2 C
 58.2731 +1991.1 2012.4 1990 2014.4 1987.7 2014.6 C
 58.2732 +1990.1 2013.4 1994.7 2012.6 1993.5 2008.8 C
 58.2733 +[0 0.87 0.91 0.83]  vc
 58.2734 +f 
 58.2735 +0.4 w
 58.2736 +2 J
 58.2737 +2 M
 58.2738 +S 
 58.2739 +n
 58.2740 +1992.8 2010.8 m
 58.2741 +1992.8 2001.8 1992.8 1994.1 1992.8 1985.8 C
 58.2742 +1989.5 1985.7 1991.1 1981.1 1987.7 1981.7 C
 58.2743 +1987.9 1978.2 1983.9 1980 1984.1 1977.2 C
 58.2744 +1981.1 1977 1981.5 1973 1979.1 1973.1 C
 58.2745 +1979 1972.2 1978.5 1970.9 1977.6 1970.9 C
 58.2746 +1977.9 1971.6 1979 1971.9 1978.6 1973.1 C
 58.2747 +1977.6 1974.9 1976.8 1973.9 1977.2 1976.2 C
 58.2748 +1977.2 1981.5 1977 1989.4 1977.4 1994 C
 58.2749 +1978.3 1995 1976.6 1994.1 1977.2 1994.7 C
 58.2750 +1977 1995.3 1976.6 1997 1977.9 1997.8 C
 58.2751 +1979 1997.5 1979.3 1998.3 1979.8 1998.8 C
 58.2752 +1979.8 1998.9 1979.8 1999.8 1979.8 1999.2 C
 58.2753 +1980.8 1998.7 1979.7 2000.7 1980.8 2000.7 C
 58.2754 +1983.5 2000.4 1982.1 2003 1984.1 2003.3 C
 58.2755 +1984.4 2004.3 1984.5 2003.7 1985.3 2004 C
 58.2756 +1986.3 2004.6 1985.9 2006.1 1986.5 2006.9 C
 58.2757 +1988 2007.1 1988.4 2009.7 1990.6 2009.1 C
 58.2758 +1990.9 2006.1 1989 2000.2 1990.4 1998 C
 58.2759 +1990.2 1994.3 1990.8 1989.2 1989.9 1986.8 C
 58.2760 +1990.2 1984.7 1990.8 1986.2 1991.6 1985.1 C
 58.2761 +1991.5 1985.9 1992.6 1985.5 1992.5 1986.3 C
 58.2762 +1992 1990.5 1992.6 1995 1992 1999.2 C
 58.2763 +1991.6 1998.9 1991.9 1998.3 1991.8 1997.8 C
 58.2764 +1991.8 1998.5 1991.8 2000 1991.8 2000 C
 58.2765 +1991.9 1999.9 1992 1999.8 1992 1999.7 C
 58.2766 +1993.2 2003.5 1991.9 2007.7 1992.3 2011.5 C
 58.2767 +1991.6 2012 1990.9 2012.2 1990.4 2012.9 C
 58.2768 +1991.3 2011.9 1992.2 2012.1 1992.8 2010.8 C
 58.2769 +[0 1 1 0.23]  vc
 58.2770 +f 
 58.2771 +S 
 58.2772 +n
 58.2773 +1978.4 1968.5 m
 58.2774 +1977 1969.2 1975.8 1968.2 1974.5 1969 C
 58.2775 +1968.3 1973 1961.6 1976 1955.1 1979.1 C
 58.2776 +1962 1975.9 1968.8 1972.5 1975.5 1968.8 C
 58.2777 +1976.5 1968.8 1977.6 1968.8 1978.6 1968.8 C
 58.2778 +1981.7 1972.1 1984.8 1975.7 1988 1978.8 C
 58.2779 +1990.9 1981.9 1996.8 1984.6 1995.2 1990.6 C
 58.2780 +1995.3 1988.6 1994.9 1986.9 1994.7 1985.1 C
 58.2781 +1989.5 1979.1 1983.3 1974.3 1978.4 1968.5 C
 58.2782 +[0.18 0.18 0 0.78]  vc
 58.2783 +f 
 58.2784 +S 
 58.2785 +n
 58.2786 +1978.4 1968.3 m
 58.2787 +1977.9 1968.7 1977.1 1968.5 1976.4 1968.5 C
 58.2788 +1977.3 1968.8 1978.1 1967.9 1978.8 1968.5 C
 58.2789 +1984 1974.3 1990.1 1979.5 1995.2 1985.6 C
 58.2790 +1995.1 1988.4 1995.3 1985.6 1994.9 1984.8 C
 58.2791 +1989.5 1979.4 1983.9 1973.8 1978.4 1968.3 C
 58.2792 +[0.07 0.06 0 0.58]  vc
 58.2793 +f 
 58.2794 +S 
 58.2795 +n
 58.2796 +1978.6 1968 m
 58.2797 +1977.9 1968 1977.4 1968.6 1978.4 1968 C
 58.2798 +1983.9 1973.9 1990.1 1979.1 1995.2 1985.1 C
 58.2799 +1990.2 1979 1983.8 1974.1 1978.6 1968 C
 58.2800 +[0.4 0.4 0 0]  vc
 58.2801 +f 
 58.2802 +S 
 58.2803 +n
 58.2804 +1991.1 1982.2 m
 58.2805 +1991.2 1982.9 1991.6 1984.2 1993 1984.4 C
 58.2806 +1992.6 1983.5 1992.1 1982.5 1991.1 1982.2 C
 58.2807 +[0 0.33 0.33 0.99]  vc
 58.2808 +f 
 58.2809 +S 
 58.2810 +n
 58.2811 +1990.4 2012.7 m
 58.2812 +1991.4 2011.8 1990.2 2010.9 1989.9 2010.3 C
 58.2813 +1987.7 2010.2 1987.4 2007.6 1985.6 2007.2 C
 58.2814 +1985.1 2006.2 1984.6 2004.5 1984.1 2004.3 C
 58.2815 +1981.7 2004.5 1982.3 2001.2 1979.8 2000.9 C
 58.2816 +1978.8 1999.6 1978.8 1999.1 1977.6 1998.8 C
 58.2817 +1976.1 1997.4 1976.7 1995 1975.2 1994 C
 58.2818 +1975.8 1994 1975 1994 1975 1993.7 C
 58.2819 +1975.7 1993.2 1975.6 1991.8 1976 1991.3 C
 58.2820 +1975.9 1985.7 1976.1 1979.7 1975.7 1974.5 C
 58.2821 +1976.2 1973.3 1976.9 1971.8 1976.2 1971.4 C
 58.2822 +1973.9 1974.3 1972.2 1973.6 1969.5 1975 C
 58.2823 +1967.9 1977.5 1963.8 1977.1 1961.8 1980 C
 58.2824 +1959 1980 1957.6 1983 1954.8 1982.9 C
 58.2825 +1953.8 1984.2 1954.8 1985.7 1955.1 1987.2 C
 58.2826 +1956.2 1989.5 1959.7 1990.1 1959.9 1991.8 C
 58.2827 +1965.9 1998 1971.8 2005.2 1978.1 2011.7 C
 58.2828 +1979.5 2012 1980.9 2012.7 1980.3 2014.6 C
 58.2829 +1980.5 2015.6 1979.4 2016 1979.8 2017 C
 58.2830 +1983 2015.6 1986.8 2014.1 1990.4 2012.7 C
 58.2831 +[0 0.5 0.5 0.2]  vc
 58.2832 +f 
 58.2833 +S 
 58.2834 +n
 58.2835 +1988.7 1979.6 m
 58.2836 +1988.2 1979.9 1988.6 1980.6 1988.9 1981 C
 58.2837 +1991.4 1982.2 1989.6 1979.9 1988.7 1979.6 C
 58.2838 +[0 0.33 0.33 0.99]  vc
 58.2839 +f 
 58.2840 +S 
 58.2841 +n
 58.2842 +1987.2 1978.1 m
 58.2843 +1985 1977.5 1984.6 1974.3 1982.2 1973.6 C
 58.2844 +1982.7 1974.5 1982.8 1975.8 1984.8 1976 C
 58.2845 +1985.7 1976.9 1985 1978.4 1987.2 1978.1 C
 58.2846 +f 
 58.2847 +S 
 58.2848 +n
 58.2849 +1975.5 2084 m
 58.2850 +1975.5 2082 1975.3 2080 1975.7 2078.2 C
 58.2851 +1978.8 2079 1980.9 2085.5 1984.8 2083.5 C
 58.2852 +1993 2078.7 2001.6 2075 2010 2070.8 C
 58.2853 +2010.1 2064 2009.9 2057.2 2010.3 2050.6 C
 58.2854 +2014.8 2046.2 2020.9 2045.7 2025.6 2042 C
 58.2855 +2026.1 2035.1 2025.8 2028 2025.9 2021.1 C
 58.2856 +2025.8 2027.8 2026.1 2034.6 2025.6 2041.2 C
 58.2857 +2022.2 2044.9 2017.6 2046.8 2012.9 2048 C
 58.2858 +2012.5 2049.5 2010.4 2049.4 2009.8 2051.1 C
 58.2859 +2009.9 2057.6 2009.6 2064.2 2010 2070.5 C
 58.2860 +2001.2 2075.4 1992 2079.1 1983.2 2084 C
 58.2861 +1980.3 2082.3 1977.8 2079.2 1975.2 2077.5 C
 58.2862 +1974.9 2079.9 1977.2 2084.6 1973.3 2085.2 C
 58.2863 +1964.7 2088.6 1956.8 2093.7 1948.1 2097.2 C
 58.2864 +1949 2097.3 1949.6 2096.9 1950.3 2096.7 C
 58.2865 +1958.4 2091.9 1967.1 2088.2 1975.5 2084 C
 58.2866 +[0.18 0.18 0 0.78]  vc
 58.2867 +f 
 58.2868 +S 
 58.2869 +n
 58.2870 +vmrs
 58.2871 +1948.6 2094.5 m
 58.2872 +1950.2 2093.7 1951.8 2092.9 1953.4 2092.1 C
 58.2873 +1951.8 2092.9 1950.2 2093.7 1948.6 2094.5 C
 58.2874 +[0 0.87 0.91 0.83]  vc
 58.2875 +f 
 58.2876 +0.4 w
 58.2877 +2 J
 58.2878 +2 M
 58.2879 +S 
 58.2880 +n
 58.2881 +1971.6 2082.3 m
 58.2882 +1971.6 2081.9 1970.7 2081.1 1970.9 2081.3 C
 58.2883 +1970.7 2081.6 1970.6 2081.6 1970.4 2081.3 C
 58.2884 +1970.8 2080.1 1968.7 2081.7 1968.3 2080.8 C
 58.2885 +1966.6 2080.9 1966.7 2078 1964.2 2078.2 C
 58.2886 +1964.8 2075 1960.1 2075.8 1960.1 2072.9 C
 58.2887 +1958 2072.3 1957.5 2069.3 1955.3 2069.3 C
 58.2888 +1953.9 2070.9 1948.8 2067.8 1950 2072 C
 58.2889 +1949 2074 1943.2 2070.6 1944 2074.8 C
 58.2890 +1942.2 2076.6 1937.6 2073.9 1938 2078.2 C
 58.2891 +1936.7 2078.6 1935 2078.6 1933.7 2078.2 C
 58.2892 +1933.5 2080 1936.8 2080.7 1937.3 2082.8 C
 58.2893 +1939.9 2083.5 1940.6 2086.4 1942.6 2088 C
 58.2894 +1945.2 2089.2 1946 2091.3 1948.4 2093.6 C
 58.2895 +1956 2089.5 1963.9 2086.1 1971.6 2082.3 C
 58.2896 +[0 0.01 1 0]  vc
 58.2897 +f 
 58.2898 +S 
 58.2899 +n
 58.2900 +1958.2 2089.7 m
 58.2901 +1956.4 2090 1955.6 2091.3 1953.9 2091.9 C
 58.2902 +1955.6 2091.9 1956.5 2089.7 1958.2 2089.7 C
 58.2903 +[0 0.87 0.91 0.83]  vc
 58.2904 +f 
 58.2905 +S 
 58.2906 +n
 58.2907 +1929.9 2080.4 m
 58.2908 +1929.5 2077.3 1929.7 2073.9 1929.6 2070.8 C
 58.2909 +1929.8 2074.1 1929.2 2077.8 1930.1 2080.8 C
 58.2910 +1935.8 2085.9 1941.4 2091.3 1946.9 2096.9 C
 58.2911 +1941.2 2091 1935.7 2086 1929.9 2080.4 C
 58.2912 +[0.4 0.4 0 0]  vc
 58.2913 +f 
 58.2914 +S 
 58.2915 +n
 58.2916 +1930.1 2080.4 m
 58.2917 +1935.8 2086 1941.5 2090.7 1946.9 2096.7 C
 58.2918 +1941.5 2090.9 1935.7 2085.8 1930.1 2080.4 C
 58.2919 +[0.07 0.06 0 0.58]  vc
 58.2920 +f 
 58.2921 +S 
 58.2922 +n
 58.2923 +1940.9 2087.1 m
 58.2924 +1941.7 2088 1944.8 2090.6 1943.6 2089.2 C
 58.2925 +1942.5 2089 1941.6 2087.7 1940.9 2087.1 C
 58.2926 +[0 0.87 0.91 0.83]  vc
 58.2927 +f 
 58.2928 +S 
 58.2929 +n
 58.2930 +1972.8 2082.8 m
 58.2931 +1973 2075.3 1972.4 2066.9 1973.3 2059.5 C
 58.2932 +1972.5 2058.9 1972.8 2057.3 1973.1 2056.4 C
 58.2933 +1974.8 2055.2 1973.4 2055.5 1972.4 2055.4 C
 58.2934 +1970.1 2053.2 1967.9 2050.9 1965.6 2048.7 C
 58.2935 +1960.9 2049.9 1956.9 2052.7 1952.4 2054.7 C
 58.2936 +1949.3 2052.5 1946.3 2049.5 1943.6 2046.8 C
 58.2937 +1939.9 2047.7 1936.8 2050.1 1933.5 2051.8 C
 58.2938 +1930.9 2054.9 1933.5 2056.2 1932.3 2059.7 C
 58.2939 +1933.2 2059.7 1932.2 2060.5 1932.5 2060.2 C
 58.2940 +1933.2 2062.5 1931.6 2064.6 1932.5 2067.4 C
 58.2941 +1932.9 2069.7 1932.7 2072.2 1932.8 2074.6 C
 58.2942 +1933.6 2070.6 1932.2 2066.3 1933 2062.6 C
 58.2943 +1934.4 2058.2 1929.8 2053.5 1935.2 2051.1 C
 58.2944 +1937.7 2049.7 1940.2 2048 1942.8 2046.8 C
 58.2945 +1945.9 2049.2 1948.8 2052 1951.7 2054.7 C
 58.2946 +1952.7 2054.7 1953.6 2054.6 1954.4 2054.2 C
 58.2947 +1958.1 2052.5 1961.7 2049.3 1965.9 2049.2 C
 58.2948 +1968.2 2052.8 1975.2 2055 1972.6 2060.9 C
 58.2949 +1973.3 2062.4 1972.2 2065.2 1972.6 2067.6 C
 58.2950 +1972.7 2072.6 1972.4 2077.7 1972.8 2082.5 C
 58.2951 +1968.1 2084.9 1963.5 2087.5 1958.7 2089.5 C
 58.2952 +1963.5 2087.4 1968.2 2085 1972.8 2082.8 C
 58.2953 +f 
 58.2954 +S 
 58.2955 +n
 58.2956 +1935.2 2081.1 m
 58.2957 +1936.8 2083.4 1938.6 2084.6 1940.4 2086.6 C
 58.2958 +1938.8 2084.4 1936.7 2083.4 1935.2 2081.1 C
 58.2959 +f 
 58.2960 +S 
 58.2961 +n
 58.2962 +1983.2 2081.3 m
 58.2963 +1984.8 2080.5 1986.3 2079.7 1988 2078.9 C
 58.2964 +1986.3 2079.7 1984.8 2080.5 1983.2 2081.3 C
 58.2965 +f 
 58.2966 +S 
 58.2967 +n
 58.2968 +2006.2 2069.1 m
 58.2969 +2006.2 2068.7 2005.2 2067.9 2005.5 2068.1 C
 58.2970 +2005.3 2068.4 2005.2 2068.4 2005 2068.1 C
 58.2971 +2005.4 2066.9 2003.3 2068.5 2002.8 2067.6 C
 58.2972 +2001.2 2067.7 2001.2 2064.8 1998.8 2065 C
 58.2973 +1999.4 2061.8 1994.7 2062.6 1994.7 2059.7 C
 58.2974 +1992.4 2059.5 1992.4 2055.8 1990.1 2056.8 C
 58.2975 +1985.9 2059.5 1981.1 2061 1976.9 2063.8 C
 58.2976 +1977.2 2067.6 1974.9 2074.2 1978.8 2075.8 C
 58.2977 +1979.6 2077.8 1981.7 2078.4 1982.9 2080.4 C
 58.2978 +1990.6 2076.3 1998.5 2072.9 2006.2 2069.1 C
 58.2979 +[0 0.01 1 0]  vc
 58.2980 +f 
 58.2981 +S 
 58.2982 +n
 58.2983 +vmrs
 58.2984 +1992.8 2076.5 m
 58.2985 +1991 2076.8 1990.2 2078.1 1988.4 2078.7 C
 58.2986 +1990.2 2078.7 1991 2076.5 1992.8 2076.5 C
 58.2987 +[0 0.87 0.91 0.83]  vc
 58.2988 +f 
 58.2989 +0.4 w
 58.2990 +2 J
 58.2991 +2 M
 58.2992 +S 
 58.2993 +n
 58.2994 +1975.5 2073.4 m
 58.2995 +1976.1 2069.7 1973.9 2064.6 1977.4 2062.4 C
 58.2996 +1973.9 2064.5 1976.1 2069.9 1975.5 2073.6 C
 58.2997 +1976 2074.8 1979.3 2077.4 1978.1 2076 C
 58.2998 +1977 2075.7 1975.8 2074.5 1975.5 2073.4 C
 58.2999 +f 
 58.3000 +S 
 58.3001 +n
 58.3002 +2007.4 2069.6 m
 58.3003 +2007.6 2062.1 2007 2053.7 2007.9 2046.3 C
 58.3004 +2007.1 2045.7 2007.3 2044.1 2007.6 2043.2 C
 58.3005 +2009.4 2042 2007.9 2042.3 2006.9 2042.2 C
 58.3006 +2002.2 2037.4 1996.7 2032.4 1992.5 2027.3 C
 58.3007 +1992 2027.3 1991.6 2027.3 1991.1 2027.3 C
 58.3008 +1991.4 2035.6 1991.4 2045.6 1991.1 2054.4 C
 58.3009 +1990.5 2055.5 1988.4 2056.6 1990.6 2055.4 C
 58.3010 +1991.6 2055.4 1991.6 2054.1 1991.6 2053.2 C
 58.3011 +1990.8 2044.7 1991.9 2035.4 1991.6 2027.6 C
 58.3012 +1991.8 2027.6 1992 2027.6 1992.3 2027.6 C
 58.3013 +1997 2032.8 2002.5 2037.7 2007.2 2042.9 C
 58.3014 +2007.3 2044.8 2006.7 2047.4 2007.6 2048.4 C
 58.3015 +2006.9 2055.1 2007.1 2062.5 2007.4 2069.3 C
 58.3016 +2002.7 2071.7 1998.1 2074.3 1993.2 2076.3 C
 58.3017 +1998 2074.2 2002.7 2071.8 2007.4 2069.6 C
 58.3018 +f 
 58.3019 +S 
 58.3020 +n
 58.3021 +2006.7 2069.1 m
 58.3022 +2006.3 2068.6 2005.9 2067.7 2005.7 2066.9 C
 58.3023 +2005.7 2059.7 2005.9 2051.4 2005.5 2045.1 C
 58.3024 +2004.9 2045.3 2004.7 2044.5 2004.3 2045.3 C
 58.3025 +2005.1 2045.3 2004.2 2045.8 2004.8 2046 C
 58.3026 +2004.8 2052.2 2004.8 2059.2 2004.8 2064.5 C
 58.3027 +2005.7 2065.7 2005.1 2065.7 2005 2066.7 C
 58.3028 +2003.8 2067 2002.7 2067.2 2001.9 2066.4 C
 58.3029 +2001.3 2064.6 1998 2063.1 1998 2061.9 C
 58.3030 +1996.1 2062.3 1996.6 2058.3 1994.2 2058.8 C
 58.3031 +1992.6 2057.7 1992.7 2054.8 1989.9 2056.6 C
 58.3032 +1985.6 2059.3 1980.9 2060.8 1976.7 2063.6 C
 58.3033 +1976 2066.9 1976 2071.2 1976.7 2074.6 C
 58.3034 +1977.6 2070.8 1973.1 2062.1 1980.5 2061.2 C
 58.3035 +1984.3 2060.3 1987.5 2058.2 1990.8 2056.4 C
 58.3036 +1991.7 2056.8 1992.9 2057.2 1993.5 2059.2 C
 58.3037 +1994.3 2058.6 1994.4 2060.6 1994.7 2059.2 C
 58.3038 +1995.3 2062.7 1999.2 2061.4 1998.8 2064.8 C
 58.3039 +2001.8 2065.4 2002.5 2068.4 2005.2 2067.4 C
 58.3040 +2004.9 2067.9 2006 2068 2006.4 2069.1 C
 58.3041 +2001.8 2071.1 1997.4 2073.9 1992.8 2075.8 C
 58.3042 +1997.5 2073.8 2002 2071.2 2006.7 2069.1 C
 58.3043 +[0 0.2 1 0]  vc
 58.3044 +f 
 58.3045 +S 
 58.3046 +n
 58.3047 +1988.7 2056.6 m
 58.3048 +1985.1 2058.7 1981.1 2060.1 1977.6 2061.9 C
 58.3049 +1981.3 2060.5 1985.6 2058.1 1988.7 2056.6 C
 58.3050 +[0 0.87 0.91 0.83]  vc
 58.3051 +f 
 58.3052 +S 
 58.3053 +n
 58.3054 +1977.9 2059.5 m
 58.3055 +1975.7 2064.5 1973.7 2054.7 1975.2 2060.9 C
 58.3056 +1976 2060.6 1977.6 2059.7 1977.9 2059.5 C
 58.3057 +f 
 58.3058 +S 
 58.3059 +n
 58.3060 +1989.6 2051.3 m
 58.3061 +1990.1 2042.3 1989.8 2036.6 1989.9 2028 C
 58.3062 +1989.8 2027 1990.8 2028.3 1990.1 2027.3 C
 58.3063 +1988.9 2026.7 1986.7 2026.9 1986.8 2024.7 C
 58.3064 +1987.4 2023 1985.9 2024.6 1985.1 2023.7 C
 58.3065 +1984.1 2021.4 1982.5 2020.5 1980.3 2020.6 C
 58.3066 +1979.9 2020.8 1979.5 2021.1 1979.3 2021.6 C
 58.3067 +1979.7 2025.8 1978.4 2033 1979.6 2038.1 C
 58.3068 +1983.7 2042.9 1968.8 2044.6 1978.8 2042.7 C
 58.3069 +1979.3 2042.3 1979.6 2041.9 1980 2041.5 C
 58.3070 +1980 2034.8 1980 2027 1980 2021.6 C
 58.3071 +1981.3 2020.5 1981.7 2021.5 1982.9 2021.8 C
 58.3072 +1983.6 2024.7 1986.1 2023.8 1986.8 2026.4 C
 58.3073 +1987.1 2027.7 1988.6 2027.1 1989.2 2028.3 C
 58.3074 +1989.1 2036.7 1989.3 2044.8 1988.9 2053.7 C
 58.3075 +1987.2 2054.9 1986.2 2056.8 1983.9 2057.1 C
 58.3076 +1986.3 2055.9 1990.9 2055 1989.6 2051.3 C
 58.3077 +f 
 58.3078 +S 
 58.3079 +n
 58.3080 +1971.6 2078.9 m
 58.3081 +1971.4 2070.5 1972.1 2062.2 1971.6 2055.9 C
 58.3082 +1969.9 2053.7 1967.6 2051.7 1965.6 2049.6 C
 58.3083 +1961.4 2050.4 1957.6 2053.6 1953.4 2055.2 C
 58.3084 +1949.8 2055.6 1948.2 2051.2 1945.5 2049.6 C
 58.3085 +1945.1 2048.8 1944.5 2047.9 1943.6 2047.5 C
 58.3086 +1940.1 2047.8 1937.3 2051 1934 2052.3 C
 58.3087 +1933.7 2052.6 1933.7 2053 1933.2 2053.2 C
 58.3088 +1933.7 2060.8 1933.4 2067.2 1933.5 2074.6 C
 58.3089 +1933.8 2068.1 1934 2060.9 1933.2 2054 C
 58.3090 +1935.3 2050.9 1939.3 2049.6 1942.4 2047.5 C
 58.3091 +1942.8 2047.5 1943.4 2047.4 1943.8 2047.7 C
 58.3092 +1947.1 2050.2 1950.3 2057.9 1955.3 2054.4 C
 58.3093 +1955.4 2054.4 1955.5 2054.3 1955.6 2054.2 C
 58.3094 +1955.9 2057.6 1956.1 2061.8 1955.3 2064.8 C
 58.3095 +1955.4 2064.3 1955.1 2063.8 1955.6 2063.6 C
 58.3096 +1956 2066.6 1955.3 2068.7 1958.7 2069.8 C
 58.3097 +1959.2 2071.7 1961.4 2071.7 1962 2074.1 C
 58.3098 +1964.4 2074.2 1964 2077.7 1967.3 2078.4 C
 58.3099 +1967 2079.7 1968.1 2079.9 1969 2080.1 C
 58.3100 +1971.1 2079.9 1970 2079.2 1970.4 2078 C
 58.3101 +1969.5 2077.2 1970.3 2075.9 1969.7 2075.1 C
 58.3102 +1970.1 2069.8 1970.1 2063.6 1969.7 2058.8 C
 58.3103 +1969.2 2058.5 1970 2058.1 1970.2 2057.8 C
 58.3104 +1970.4 2058.3 1971.2 2057.7 1971.4 2058.3 C
 58.3105 +1971.5 2065.3 1971.2 2073.6 1971.6 2081.1 C
 58.3106 +1974.1 2081.4 1969.8 2084.3 1972.4 2082.5 C
 58.3107 +1971.9 2081.4 1971.6 2080.2 1971.6 2078.9 C
 58.3108 +[0 0.4 1 0]  vc
 58.3109 +f 
 58.3110 +S 
 58.3111 +n
 58.3112 +1952.4 2052 m
 58.3113 +1954.1 2051.3 1955.6 2050.4 1957.2 2049.6 C
 58.3114 +1955.6 2050.4 1954.1 2051.3 1952.4 2052 C
 58.3115 +[0 0.87 0.91 0.83]  vc
 58.3116 +f 
 58.3117 +S 
 58.3118 +n
 58.3119 +1975.5 2039.8 m
 58.3120 +1975.5 2039.4 1974.5 2038.7 1974.8 2038.8 C
 58.3121 +1974.6 2039.1 1974.5 2039.1 1974.3 2038.8 C
 58.3122 +1974.6 2037.6 1972.5 2039.3 1972.1 2038.4 C
 58.3123 +1970.4 2038.4 1970.5 2035.5 1968 2035.7 C
 58.3124 +1968.6 2032.5 1964 2033.3 1964 2030.4 C
 58.3125 +1961.9 2029.8 1961.4 2026.8 1959.2 2026.8 C
 58.3126 +1957.7 2028.5 1952.6 2025.3 1953.9 2029.5 C
 58.3127 +1952.9 2031.5 1947 2028.2 1947.9 2032.4 C
 58.3128 +1946 2034.2 1941.5 2031.5 1941.9 2035.7 C
 58.3129 +1940.6 2036.1 1938.9 2036.1 1937.6 2035.7 C
 58.3130 +1937.3 2037.5 1940.7 2038.2 1941.2 2040.3 C
 58.3131 +1943.7 2041.1 1944.4 2043.9 1946.4 2045.6 C
 58.3132 +1949.1 2046.7 1949.9 2048.8 1952.2 2051.1 C
 58.3133 +1959.9 2047.1 1967.7 2043.6 1975.5 2039.8 C
 58.3134 +[0 0.01 1 0]  vc
 58.3135 +f 
 58.3136 +S 
 58.3137 +n
 58.3138 +vmrs
 58.3139 +1962 2047.2 m
 58.3140 +1960.2 2047.5 1959.5 2048.9 1957.7 2049.4 C
 58.3141 +1959.5 2049.5 1960.3 2047.2 1962 2047.2 C
 58.3142 +[0 0.87 0.91 0.83]  vc
 58.3143 +f 
 58.3144 +0.4 w
 58.3145 +2 J
 58.3146 +2 M
 58.3147 +S 
 58.3148 +n
 58.3149 +2012.4 2046.3 m
 58.3150 +2010.3 2051.3 2008.3 2041.5 2009.8 2047.7 C
 58.3151 +2010.5 2047.4 2012.2 2046.5 2012.4 2046.3 C
 58.3152 +f 
 58.3153 +S 
 58.3154 +n
 58.3155 +1944.8 2044.6 m
 58.3156 +1945.5 2045.6 1948.6 2048.1 1947.4 2046.8 C
 58.3157 +1946.3 2046.5 1945.5 2045.2 1944.8 2044.6 C
 58.3158 +f 
 58.3159 +S 
 58.3160 +n
 58.3161 +1987.2 2054.9 m
 58.3162 +1983.7 2057.3 1979.6 2058 1976 2060.2 C
 58.3163 +1974.7 2058.2 1977.2 2055.8 1974.3 2054.9 C
 58.3164 +1973.1 2052 1970.4 2050.2 1968 2048 C
 58.3165 +1968 2047.7 1968 2047.4 1968.3 2047.2 C
 58.3166 +1969.5 2046.1 1983 2040.8 1972.4 2044.8 C
 58.3167 +1971.2 2046.6 1967.9 2046 1968 2048.2 C
 58.3168 +1970.5 2050.7 1973.8 2052.6 1974.3 2055.6 C
 58.3169 +1975.1 2055 1975.7 2056.7 1975.7 2057.1 C
 58.3170 +1975.7 2058.2 1974.8 2059.3 1975.5 2060.4 C
 58.3171 +1979.3 2058.2 1983.9 2057.7 1987.2 2054.9 C
 58.3172 +[0.18 0.18 0 0.78]  vc
 58.3173 +f 
 58.3174 +S 
 58.3175 +n
 58.3176 +1967.8 2047.5 m
 58.3177 +1968.5 2047 1969.1 2046.5 1969.7 2046 C
 58.3178 +1969.1 2046.5 1968.5 2047 1967.8 2047.5 C
 58.3179 +[0 0.87 0.91 0.83]  vc
 58.3180 +f 
 58.3181 +S 
 58.3182 +n
 58.3183 +1976.7 2040.3 m
 58.3184 +1976.9 2032.8 1976.3 2024.4 1977.2 2017 C
 58.3185 +1976.4 2016.5 1976.6 2014.8 1976.9 2013.9 C
 58.3186 +1978.7 2012.7 1977.2 2013 1976.2 2012.9 C
 58.3187 +1971.5 2008.1 1965.9 2003.1 1961.8 1998 C
 58.3188 +1960.9 1998 1960.1 1998 1959.2 1998 C
 58.3189 +1951.5 2001.1 1944.3 2005.5 1937.1 2009.6 C
 58.3190 +1935 2012.9 1937 2013.6 1936.1 2017.2 C
 58.3191 +1937.1 2017.2 1936 2018 1936.4 2017.7 C
 58.3192 +1937 2020.1 1935.5 2022.1 1936.4 2024.9 C
 58.3193 +1936.8 2027.2 1936.5 2029.7 1936.6 2032.1 C
 58.3194 +1937.4 2028.2 1936 2023.8 1936.8 2020.1 C
 58.3195 +1938.3 2015.7 1933.6 2011 1939 2008.6 C
 58.3196 +1945.9 2004.5 1953.1 2000.3 1960.6 1998.3 C
 58.3197 +1960.9 1998.3 1961.3 1998.3 1961.6 1998.3 C
 58.3198 +1966.2 2003.5 1971.8 2008.4 1976.4 2013.6 C
 58.3199 +1976.6 2015.5 1976 2018.1 1976.9 2019.2 C
 58.3200 +1976.1 2025.8 1976.4 2033.2 1976.7 2040 C
 58.3201 +1971.9 2042.4 1967.4 2045 1962.5 2047 C
 58.3202 +1967.3 2044.9 1972 2042.6 1976.7 2040.3 C
 58.3203 +f 
 58.3204 +S 
 58.3205 +n
 58.3206 +1939 2038.6 m
 58.3207 +1940.6 2040.9 1942.5 2042.1 1944.3 2044.1 C
 58.3208 +1942.7 2041.9 1940.6 2040.9 1939 2038.6 C
 58.3209 +f 
 58.3210 +S 
 58.3211 +n
 58.3212 +2006.2 2065.7 m
 58.3213 +2006 2057.3 2006.7 2049 2006.2 2042.7 C
 58.3214 +2002.1 2038.4 1997.7 2033.4 1993 2030 C
 58.3215 +1992.9 2029.3 1992.5 2028.6 1992 2028.3 C
 58.3216 +1992.1 2036.6 1991.9 2046.2 1992.3 2054.9 C
 58.3217 +1990.8 2056.2 1989 2056.7 1987.5 2058 C
 58.3218 +1988.7 2057.7 1990.7 2054.4 1993 2056.4 C
 58.3219 +1993.4 2058.8 1996 2058.2 1996.6 2060.9 C
 58.3220 +1999 2061 1998.5 2064.5 2001.9 2065.2 C
 58.3221 +2001.5 2066.5 2002.7 2066.7 2003.6 2066.9 C
 58.3222 +2005.7 2066.7 2004.6 2066 2005 2064.8 C
 58.3223 +2004 2064 2004.8 2062.7 2004.3 2061.9 C
 58.3224 +2004.6 2056.6 2004.6 2050.4 2004.3 2045.6 C
 58.3225 +2003.7 2045.3 2004.6 2044.9 2004.8 2044.6 C
 58.3226 +2005 2045.1 2005.7 2044.5 2006 2045.1 C
 58.3227 +2006 2052.1 2005.8 2060.4 2006.2 2067.9 C
 58.3228 +2008.7 2068.2 2004.4 2071.1 2006.9 2069.3 C
 58.3229 +2006.4 2068.2 2006.2 2067 2006.2 2065.7 C
 58.3230 +[0 0.4 1 0]  vc
 58.3231 +f 
 58.3232 +S 
 58.3233 +n
 58.3234 +2021.8 2041.7 m
 58.3235 +2018.3 2044.1 2014.1 2044.8 2010.5 2047 C
 58.3236 +2009.3 2045 2011.7 2042.6 2008.8 2041.7 C
 58.3237 +2004.3 2035.1 1997.6 2030.9 1993 2024.4 C
 58.3238 +1992.1 2024 1991.5 2024.3 1990.8 2024 C
 58.3239 +1993.2 2023.9 1995.3 2027.1 1996.8 2029 C
 58.3240 +2000.4 2032.6 2004.9 2036.9 2008.4 2040.8 C
 58.3241 +2008.2 2043.1 2011.4 2042.8 2009.8 2045.8 C
 58.3242 +2009.8 2046.3 2009.7 2046.9 2010 2047.2 C
 58.3243 +2013.8 2045 2018.5 2044.5 2021.8 2041.7 C
 58.3244 +[0.18 0.18 0 0.78]  vc
 58.3245 +f 
 58.3246 +S 
 58.3247 +n
 58.3248 +2001.6 2034 m
 58.3249 +2000.7 2033.1 1999.9 2032.3 1999 2031.4 C
 58.3250 +1999.9 2032.3 2000.7 2033.1 2001.6 2034 C
 58.3251 +[0 0.87 0.91 0.83]  vc
 58.3252 +f 
 58.3253 +S 
 58.3254 +n
 58.3255 +vmrs
 58.3256 +1989.4 2024.4 m
 58.3257 +1989.5 2025.4 1988.6 2024.3 1988.9 2024.7 C
 58.3258 +1990.5 2025.8 1990.7 2024.2 1992.8 2024.9 C
 58.3259 +1993.8 2025.9 1995 2027.1 1995.9 2028 C
 58.3260 +1994.3 2026 1991.9 2023.4 1989.4 2024.4 C
 58.3261 +[0 0.87 0.91 0.83]  vc
 58.3262 +f 
 58.3263 +0.4 w
 58.3264 +2 J
 58.3265 +2 M
 58.3266 +S 
 58.3267 +n
 58.3268 +1984.8 2019.9 m
 58.3269 +1984.6 2018.6 1986.3 2017.2 1987.7 2016.8 C
 58.3270 +1987.2 2017.5 1982.9 2017.9 1984.4 2020.6 C
 58.3271 +1984.1 2019.9 1984.9 2020 1984.8 2019.9 C
 58.3272 +f 
 58.3273 +S 
 58.3274 +n
 58.3275 +1981.7 2017 m
 58.3276 +1979.6 2022 1977.6 2012.3 1979.1 2018.4 C
 58.3277 +1979.8 2018.1 1981.5 2017.2 1981.7 2017 C
 58.3278 +f 
 58.3279 +S 
 58.3280 +n
 58.3281 +1884.3 2019.2 m
 58.3282 +1884.7 2010.5 1884.5 2000.6 1884.5 1991.8 C
 58.3283 +1886.6 1989.3 1889.9 1988.9 1892.4 1987 C
 58.3284 +1890.8 1988.7 1886 1989.1 1884.3 1992.3 C
 58.3285 +1884.7 2001 1884.5 2011.3 1884.5 2019.9 C
 58.3286 +1891 2025.1 1895.7 2031.5 1902 2036.9 C
 58.3287 +1896.1 2031 1890 2024.9 1884.3 2019.2 C
 58.3288 +[0.07 0.06 0 0.58]  vc
 58.3289 +f 
 58.3290 +S 
 58.3291 +n
 58.3292 +1884 2019.4 m
 58.3293 +1884.5 2010.6 1884.2 2000.4 1884.3 1991.8 C
 58.3294 +1884.8 1990.4 1887.8 1989 1884.8 1990.8 C
 58.3295 +1884.3 1991.3 1884.3 1992 1884 1992.5 C
 58.3296 +1884.5 2001.2 1884.2 2011.1 1884.3 2019.9 C
 58.3297 +1887.9 2023.1 1891.1 2026.4 1894.4 2030 C
 58.3298 +1891.7 2026.1 1887.1 2022.9 1884 2019.4 C
 58.3299 +[0.4 0.4 0 0]  vc
 58.3300 +f 
 58.3301 +S 
 58.3302 +n
 58.3303 +1885 2011.7 m
 58.3304 +1885 2006.9 1885 2001.9 1885 1997.1 C
 58.3305 +1885 2001.9 1885 2006.9 1885 2011.7 C
 58.3306 +[0 0.87 0.91 0.83]  vc
 58.3307 +f 
 58.3308 +S 
 58.3309 +n
 58.3310 +1975.5 2036.4 m
 58.3311 +1975.2 2028 1976 2019.7 1975.5 2013.4 C
 58.3312 +1971.1 2008.5 1965.6 2003.6 1961.6 1999 C
 58.3313 +1958.8 1998 1956 2000 1953.6 2001.2 C
 58.3314 +1948.2 2004.7 1941.9 2006.5 1937.1 2010.8 C
 58.3315 +1937.5 2018.3 1937.3 2024.7 1937.3 2032.1 C
 58.3316 +1937.6 2025.6 1937.9 2018.4 1937.1 2011.5 C
 58.3317 +1937.3 2011 1937.6 2010.5 1937.8 2010 C
 58.3318 +1944.6 2005.7 1951.9 2002.3 1959.2 1999 C
 58.3319 +1960.1 1998.5 1960.1 1999.8 1960.4 2000.4 C
 58.3320 +1959.7 2006.9 1959.7 2014.2 1959.4 2021.1 C
 58.3321 +1959 2021.1 1959.2 2021.9 1959.2 2022.3 C
 58.3322 +1959.2 2021.9 1959 2021.3 1959.4 2021.1 C
 58.3323 +1959.8 2024.1 1959.2 2026.2 1962.5 2027.3 C
 58.3324 +1963 2029.2 1965.3 2029.2 1965.9 2031.6 C
 58.3325 +1968.3 2031.8 1967.8 2035.2 1971.2 2036 C
 58.3326 +1970.8 2037.2 1971.9 2037.5 1972.8 2037.6 C
 58.3327 +1974.9 2037.4 1973.9 2036.7 1974.3 2035.5 C
 58.3328 +1973.3 2034.7 1974.1 2033.4 1973.6 2032.6 C
 58.3329 +1973.9 2027.3 1973.9 2021.1 1973.6 2016.3 C
 58.3330 +1973 2016 1973.9 2015.6 1974 2015.3 C
 58.3331 +1974.3 2015.9 1975 2015.3 1975.2 2015.8 C
 58.3332 +1975.3 2022.8 1975.1 2031.2 1975.5 2038.6 C
 58.3333 +1977.9 2039 1973.7 2041.8 1976.2 2040 C
 58.3334 +1975.7 2039 1975.5 2037.8 1975.5 2036.4 C
 58.3335 +[0 0.4 1 0]  vc
 58.3336 +f 
 58.3337 +S 
 58.3338 +n
 58.3339 +1991.1 2012.4 m
 58.3340 +1987.5 2014.8 1983.4 2015.6 1979.8 2017.7 C
 58.3341 +1978.5 2015.7 1981 2013.3 1978.1 2012.4 C
 58.3342 +1973.6 2005.8 1966.8 2001.6 1962.3 1995.2 C
 58.3343 +1961.4 1994.7 1960.8 1995 1960.1 1994.7 C
 58.3344 +1962.5 1994.6 1964.6 1997.8 1966.1 1999.7 C
 58.3345 +1969.7 2003.3 1974.2 2007.6 1977.6 2011.5 C
 58.3346 +1977.5 2013.8 1980.6 2013.5 1979.1 2016.5 C
 58.3347 +1979.1 2017 1979 2017.6 1979.3 2018 C
 58.3348 +1983.1 2015.7 1987.8 2015.2 1991.1 2012.4 C
 58.3349 +[0.18 0.18 0 0.78]  vc
 58.3350 +f 
 58.3351 +S 
 58.3352 +n
 58.3353 +1970.9 2004.8 m
 58.3354 +1970 2003.9 1969.2 2003 1968.3 2002.1 C
 58.3355 +1969.2 2003 1970 2003.9 1970.9 2004.8 C
 58.3356 +[0 0.87 0.91 0.83]  vc
 58.3357 +f 
 58.3358 +S 
 58.3359 +n
 58.3360 +1887.9 1994.9 m
 58.3361 +1888.5 1992.3 1891.4 1992.2 1893.2 1990.8 C
 58.3362 +1898.4 1987.5 1904 1984.8 1909.5 1982.2 C
 58.3363 +1909.7 1982.7 1910.3 1982.1 1910.4 1982.7 C
 58.3364 +1909.5 1990.5 1910.1 1996.4 1910 2004.5 C
 58.3365 +1909.1 2003.4 1909.7 2005.8 1909.5 2006.4 C
 58.3366 +1910.4 2006 1909.7 2008 1910.2 2007.9 C
 58.3367 +1911.3 2010.6 1912.5 2012.6 1915.7 2013.4 C
 58.3368 +1915.8 2013.7 1915.5 2014.4 1916 2014.4 C
 58.3369 +1916.3 2015 1915.4 2016 1915.2 2016 C
 58.3370 +1916.1 2015.5 1916.5 2014.5 1916 2013.6 C
 58.3371 +1913.4 2013.3 1913.1 2010.5 1910.9 2009.8 C
 58.3372 +1910.7 2008.8 1910.4 2007.9 1910.2 2006.9 C
 58.3373 +1911.1 1998.8 1909.4 1990.7 1910.7 1982.4 C
 58.3374 +1910 1982.1 1908.9 1982.1 1908.3 1982.4 C
 58.3375 +1901.9 1986.1 1895 1988.7 1888.8 1993 C
 58.3376 +1888 1993.4 1888.4 1994.3 1887.6 1994.7 C
 58.3377 +1888.1 2001.3 1887.8 2008.6 1887.9 2015.1 C
 58.3378 +1887.3 2017.5 1887.9 2015.4 1888.4 2014.4 C
 58.3379 +1887.8 2008 1888.4 2001.3 1887.9 1994.9 C
 58.3380 +[0.07 0.06 0 0.58]  vc
 58.3381 +f 
 58.3382 +S 
 58.3383 +n
 58.3384 +vmrs
 58.3385 +1887.9 2018.4 m
 58.3386 +1887.5 2016.9 1888.5 2016 1888.8 2014.8 C
 58.3387 +1890.1 2014.8 1891.1 2016.6 1892.4 2015.3 C
 58.3388 +1892.4 2014.4 1893.8 2012.9 1894.4 2012.4 C
 58.3389 +1895.9 2012.4 1896.6 2013.9 1897.7 2012.7 C
 58.3390 +1898.4 2011.7 1898.6 2010.4 1899.6 2009.8 C
 58.3391 +1901.7 2009.9 1902.9 2010.4 1904 2009.1 C
 58.3392 +1904.3 2007.4 1904 2007.6 1904.9 2007.2 C
 58.3393 +1906.2 2007 1907.6 2006.5 1908.8 2006.7 C
 58.3394 +1910.6 2008.2 1909.8 2011.5 1912.6 2012 C
 58.3395 +1912.4 2013 1913.8 2012.7 1914 2013.2 C
 58.3396 +1911.5 2011.1 1909.1 2007.9 1909.2 2004.3 C
 58.3397 +1909.5 2003.5 1909.9 2004.9 1909.7 2004.3 C
 58.3398 +1909.9 1996.2 1909.3 1990.5 1910.2 1982.7 C
 58.3399 +1909.5 1982.6 1909.5 1982.6 1908.8 1982.7 C
 58.3400 +1903.1 1985.7 1897 1987.9 1891.7 1992 C
 58.3401 +1890.5 1993 1888.2 1992.9 1888.1 1994.9 C
 58.3402 +1888.7 2001.4 1888.1 2008.4 1888.6 2014.8 C
 58.3403 +1888.3 2016 1887.2 2016.9 1887.6 2018.4 C
 58.3404 +1892.3 2023.9 1897.6 2027.9 1902.3 2033.3 C
 58.3405 +1898 2028.2 1892.1 2023.8 1887.9 2018.4 C
 58.3406 +[0.4 0.4 0 0]  vc
 58.3407 +f 
 58.3408 +0.4 w
 58.3409 +2 J
 58.3410 +2 M
 58.3411 +S 
 58.3412 +n
 58.3413 +1910.9 1995.2 m
 58.3414 +1910.4 1999.8 1911 2003.3 1910.9 2008.1 C
 58.3415 +1910.9 2003.8 1910.9 1999.2 1910.9 1995.2 C
 58.3416 +[0.18 0.18 0 0.78]  vc
 58.3417 +f 
 58.3418 +S 
 58.3419 +n
 58.3420 +1911.2 2004.3 m
 58.3421 +1911.2 2001.9 1911.2 1999.7 1911.2 1997.3 C
 58.3422 +1911.2 1999.7 1911.2 2001.9 1911.2 2004.3 C
 58.3423 +[0 0.87 0.91 0.83]  vc
 58.3424 +f 
 58.3425 +S 
 58.3426 +n
 58.3427 +1958.7 1995.2 m
 58.3428 +1959 1995.6 1956.2 1995 1956.5 1996.8 C
 58.3429 +1955.8 1997.6 1954.2 1998.5 1953.6 1997.3 C
 58.3430 +1953.6 1990.8 1954.9 1989.6 1953.4 1983.9 C
 58.3431 +1953.4 1983.3 1953.3 1982.1 1954.4 1982 C
 58.3432 +1955.5 1982.6 1956.5 1981.3 1957.5 1981 C
 58.3433 +1956.3 1981.8 1954.7 1982.6 1953.9 1981.5 C
 58.3434 +1951.4 1983 1954.7 1988.8 1952.9 1990.6 C
 58.3435 +1953.8 1990.6 1953.2 1992.7 1953.4 1993.7 C
 58.3436 +1953.8 1994.5 1952.3 1996.1 1953.2 1997.8 C
 58.3437 +1956.3 1999.4 1957.5 1994 1959.9 1995.6 C
 58.3438 +1962 1994.4 1963.7 1997.7 1965.2 1998.8 C
 58.3439 +1963.5 1996.7 1961.2 1994.1 1958.7 1995.2 C
 58.3440 +f 
 58.3441 +S 
 58.3442 +n
 58.3443 +1945 2000.7 m
 58.3444 +1945.4 1998.7 1945.4 1997.9 1945 1995.9 C
 58.3445 +1944.5 1995.3 1944.2 1992.6 1945.7 1993.2 C
 58.3446 +1946 1992.2 1948.7 1992.5 1948.4 1990.6 C
 58.3447 +1947.5 1990.3 1948.1 1988.7 1947.9 1988.2 C
 58.3448 +1948.9 1987.8 1950.5 1986.8 1950.5 1984.6 C
 58.3449 +1951.5 1980.9 1946.7 1983 1947.2 1979.8 C
 58.3450 +1944.5 1979.9 1945.2 1976.6 1943.1 1976.7 C
 58.3451 +1941.8 1975.7 1942.1 1972.7 1939.2 1973.8 C
 58.3452 +1938.2 1974.6 1939.3 1971.6 1938.3 1970.9 C
 58.3453 +1938.8 1969.2 1933.4 1970.3 1937.3 1970 C
 58.3454 +1939.4 1971.2 1937.2 1973 1937.6 1974.3 C
 58.3455 +1937.2 1976.3 1937.1 1981.2 1937.8 1984.1 C
 58.3456 +1938.8 1982.3 1937.9 1976.6 1938.5 1973.1 C
 58.3457 +1938.9 1975 1938.5 1976.4 1939.7 1977.2 C
 58.3458 +1939.5 1983.5 1938.9 1991.3 1940.2 1997.3 C
 58.3459 +1939.4 1999.1 1938.6 1997.1 1937.8 1997.1 C
 58.3460 +1937.4 1996.7 1937.6 1996.1 1937.6 1995.6 C
 58.3461 +1936.5 1998.5 1940.1 1998.4 1940.9 2000.7 C
 58.3462 +1942.1 2000.4 1943.2 2001.3 1943.1 2002.4 C
 58.3463 +1943.6 2003.1 1941.1 2004.6 1942.8 2003.8 C
 58.3464 +1943.9 2002.5 1942.6 2000.6 1945 2000.7 C
 58.3465 +[0.65 0.65 0 0.42]  vc
 58.3466 +f 
 58.3467 +S 
 58.3468 +n
 58.3469 +1914.5 2006.4 m
 58.3470 +1914.1 2004.9 1915.2 2004 1915.5 2002.8 C
 58.3471 +1916.7 2002.8 1917.8 2004.6 1919.1 2003.3 C
 58.3472 +1919 2002.4 1920.4 2000.9 1921 2000.4 C
 58.3473 +1922.5 2000.4 1923.2 2001.9 1924.4 2000.7 C
 58.3474 +1925 1999.7 1925.3 1998.4 1926.3 1997.8 C
 58.3475 +1928.4 1997.9 1929.5 1998.4 1930.6 1997.1 C
 58.3476 +1930.9 1995.4 1930.7 1995.6 1931.6 1995.2 C
 58.3477 +1932.8 1995 1934.3 1994.5 1935.4 1994.7 C
 58.3478 +1936.1 1995.8 1936.9 1996.2 1936.6 1997.8 C
 58.3479 +1938.9 1999.4 1939.7 2001.3 1942.4 2002.4 C
 58.3480 +1942.4 2002.5 1942.2 2003 1942.6 2002.8 C
 58.3481 +1942.9 2000.4 1939.2 2001.8 1939.2 1999.7 C
 58.3482 +1936.2 1998.6 1937 1995.3 1935.9 1993.5 C
 58.3483 +1937.1 1986.5 1935.2 1977.9 1937.6 1971.2 C
 58.3484 +1937.6 1970.3 1936.6 1971 1936.4 1970.4 C
 58.3485 +1930.2 1973.4 1924 1976 1918.4 1980 C
 58.3486 +1917.2 1981 1914.9 1980.9 1914.8 1982.9 C
 58.3487 +1915.3 1989.4 1914.7 1996.4 1915.2 2002.8 C
 58.3488 +1914.9 2004 1913.9 2004.9 1914.3 2006.4 C
 58.3489 +1919 2011.9 1924.2 2015.9 1928.9 2021.3 C
 58.3490 +1924.6 2016.2 1918.7 2011.8 1914.5 2006.4 C
 58.3491 +[0.4 0.4 0 0]  vc
 58.3492 +f 
 58.3493 +S 
 58.3494 +n
 58.3495 +1914.5 1982.9 m
 58.3496 +1915.1 1980.3 1918 1980.2 1919.8 1978.8 C
 58.3497 +1925 1975.5 1930.6 1972.8 1936.1 1970.2 C
 58.3498 +1939.4 1970.6 1936.1 1974.2 1936.6 1976.4 C
 58.3499 +1936.5 1981.9 1936.8 1987.5 1936.4 1992.8 C
 58.3500 +1935.9 1992.8 1936.2 1993.5 1936.1 1994 C
 58.3501 +1937.1 1993.6 1936.2 1995.9 1936.8 1995.9 C
 58.3502 +1937 1998 1939.5 1999.7 1940.4 2000.7 C
 58.3503 +1940.1 1998.6 1935 1997.2 1937.6 1993.7 C
 58.3504 +1938.3 1985.7 1935.9 1976.8 1937.8 1970.7 C
 58.3505 +1936.9 1969.8 1935.4 1970.3 1934.4 1970.7 C
 58.3506 +1928.3 1974.4 1921.4 1976.7 1915.5 1981 C
 58.3507 +1914.6 1981.4 1915.1 1982.3 1914.3 1982.7 C
 58.3508 +1914.7 1989.3 1914.5 1996.6 1914.5 2003.1 C
 58.3509 +1913.9 2005.5 1914.5 2003.4 1915 2002.4 C
 58.3510 +1914.5 1996 1915.1 1989.3 1914.5 1982.9 C
 58.3511 +[0.07 0.06 0 0.58]  vc
 58.3512 +f 
 58.3513 +S 
 58.3514 +n
 58.3515 +1939.2 1994.9 m
 58.3516 +1939.3 1995 1939.4 1995.1 1939.5 1995.2 C
 58.3517 +1939.1 1989 1939.3 1981.6 1939 1976.7 C
 58.3518 +1938.6 1976.3 1938.6 1974.6 1938.5 1973.3 C
 58.3519 +1938.7 1976.1 1938.1 1979.4 1939 1981.7 C
 58.3520 +1937.3 1986 1937.7 1991.6 1938 1996.4 C
 58.3521 +1937.3 1994.3 1939.6 1996.2 1939.2 1994.9 C
 58.3522 +[0.18 0.18 0 0.78]  vc
 58.3523 +f 
 58.3524 +S 
 58.3525 +n
 58.3526 +1938.3 1988.4 m
 58.3527 +1938.5 1990.5 1937.9 1994.1 1938.8 1994.7 C
 58.3528 +1937.9 1992.6 1939 1990.6 1938.3 1988.4 C
 58.3529 +[0 0.87 0.91 0.83]  vc
 58.3530 +f 
 58.3531 +S 
 58.3532 +n
 58.3533 +1938.8 1985.8 m
 58.3534 +1938.5 1985.9 1938.4 1985.7 1938.3 1985.6 C
 58.3535 +1938.4 1986.2 1938 1989.5 1938.8 1987.2 C
 58.3536 +1938.8 1986.8 1938.8 1986.3 1938.8 1985.8 C
 58.3537 +f 
 58.3538 +S 
 58.3539 +n
 58.3540 +vmrs
 58.3541 +1972.8 2062.1 m
 58.3542 +1971.9 2061 1972.5 2059.4 1972.4 2058 C
 58.3543 +1972.2 2063.8 1971.9 2073.7 1972.4 2081.3 C
 58.3544 +1972.5 2074.9 1971.9 2067.9 1972.8 2062.1 C
 58.3545 +[0 1 1 0.36]  vc
 58.3546 +f 
 58.3547 +0.4 w
 58.3548 +2 J
 58.3549 +2 M
 58.3550 +S 
 58.3551 +n
 58.3552 +1940.2 2071.7 m
 58.3553 +1941.3 2072 1943.1 2072.3 1944 2071.5 C
 58.3554 +1943.6 2069.9 1945.2 2069.1 1946 2068.8 C
 58.3555 +1950 2071.1 1948.7 2065.9 1951.7 2066.2 C
 58.3556 +1953.5 2063.9 1956.9 2069.4 1955.6 2063.8 C
 58.3557 +1955.5 2064.2 1955.7 2064.8 1955.3 2065 C
 58.3558 +1954.3 2063.7 1956.2 2063.6 1955.6 2062.1 C
 58.3559 +1954.5 2060 1958.3 2050.3 1952.2 2055.6 C
 58.3560 +1949.1 2053.8 1946 2051 1943.8 2048 C
 58.3561 +1940.3 2048 1937.5 2051.3 1934.2 2052.5 C
 58.3562 +1933.1 2054.6 1934.4 2057.3 1934 2060 C
 58.3563 +1934 2065.1 1934 2069.7 1934 2074.6 C
 58.3564 +1934.4 2069 1934.1 2061.5 1934.2 2054.9 C
 58.3565 +1934.6 2054.5 1935.3 2054.7 1935.9 2054.7 C
 58.3566 +1937 2055.3 1935.9 2056.1 1935.9 2056.8 C
 58.3567 +1936.5 2063 1935.6 2070.5 1935.9 2074.6 C
 58.3568 +1936.7 2074.4 1937.3 2075.2 1938 2074.6 C
 58.3569 +1937.9 2073.6 1939.1 2072.1 1940.2 2071.7 C
 58.3570 +[0 0.2 1 0]  vc
 58.3571 +f 
 58.3572 +S 
 58.3573 +n
 58.3574 +1933.2 2074.1 m
 58.3575 +1933.2 2071.5 1933.2 2069 1933.2 2066.4 C
 58.3576 +1933.2 2069 1933.2 2071.5 1933.2 2074.1 C
 58.3577 +[0 1 1 0.36]  vc
 58.3578 +f 
 58.3579 +S 
 58.3580 +n
 58.3581 +2007.4 2048.9 m
 58.3582 +2006.5 2047.8 2007.1 2046.2 2006.9 2044.8 C
 58.3583 +2006.7 2050.6 2006.5 2060.5 2006.9 2068.1 C
 58.3584 +2007.1 2061.7 2006.5 2054.7 2007.4 2048.9 C
 58.3585 +f 
 58.3586 +S 
 58.3587 +n
 58.3588 +1927.2 2062.4 m
 58.3589 +1925.8 2060.1 1928.1 2058.2 1927 2056.4 C
 58.3590 +1927.3 2055.5 1926.5 2053.5 1926.8 2051.8 C
 58.3591 +1926.8 2052.8 1926 2052.5 1925.3 2052.5 C
 58.3592 +1924.1 2052.8 1925 2050.5 1924.4 2050.1 C
 58.3593 +1925.3 2050.2 1925.4 2048.8 1926.3 2049.4 C
 58.3594 +1926.5 2052.3 1928.4 2047.2 1928.4 2051.1 C
 58.3595 +1928.9 2050.5 1929 2051.4 1928.9 2051.8 C
 58.3596 +1928.9 2052 1928.9 2052.3 1928.9 2052.5 C
 58.3597 +1929.4 2051.4 1928.9 2049 1930.1 2048.2 C
 58.3598 +1928.9 2047.1 1930.5 2047.1 1930.4 2046.5 C
 58.3599 +1931.9 2046.2 1933.1 2046.1 1934.7 2046.5 C
 58.3600 +1934.6 2046.9 1935.2 2047.9 1934.4 2048.4 C
 58.3601 +1936.9 2048.1 1933.6 2043.8 1935.9 2043.9 C
 58.3602 +1935.7 2043.9 1934.8 2041.3 1933.2 2041.7 C
 58.3603 +1932.5 2041.6 1932.4 2039.6 1932.3 2041 C
 58.3604 +1930.8 2042.6 1929 2040.6 1927.7 2042 C
 58.3605 +1927.5 2041.4 1927.1 2040.9 1927.2 2040.3 C
 58.3606 +1927.8 2040.6 1927.4 2039.1 1928.2 2038.6 C
 58.3607 +1929.4 2038 1930.5 2038.8 1931.3 2037.9 C
 58.3608 +1931.7 2039 1932.5 2038.6 1931.8 2037.6 C
 58.3609 +1930.9 2037 1928.7 2037.8 1928.2 2037.9 C
 58.3610 +1926.7 2037.8 1928 2039 1927 2038.8 C
 58.3611 +1927.4 2040.4 1925.6 2040.8 1925.1 2041 C
 58.3612 +1924.3 2040.4 1923.2 2040.5 1922.2 2040.5 C
 58.3613 +1921.4 2041.7 1921 2043.9 1919.3 2043.9 C
 58.3614 +1918.8 2043.4 1917.2 2043.3 1916.4 2043.4 C
 58.3615 +1915.9 2044.4 1915.7 2046 1914.3 2046.5 C
 58.3616 +1913.1 2046.6 1912 2044.5 1911.4 2046.3 C
 58.3617 +1912.8 2046.5 1913.8 2047.4 1915.7 2047 C
 58.3618 +1916.9 2047.7 1915.6 2048.8 1916 2049.4 C
 58.3619 +1915.4 2049.3 1913.9 2050.3 1913.3 2051.1 C
 58.3620 +1913.9 2054.1 1916 2050.2 1916.7 2053 C
 58.3621 +1916.9 2053.8 1915.5 2054.1 1916.7 2054.4 C
 58.3622 +1917 2054.7 1920.2 2054.3 1919.3 2056.6 C
 58.3623 +1918.8 2056.1 1920.2 2058.6 1920.3 2057.6 C
 58.3624 +1921.2 2057.9 1922.1 2057.5 1922.4 2059 C
 58.3625 +1922.3 2059.1 1922.2 2059.3 1922 2059.2 C
 58.3626 +1922.1 2059.7 1922.4 2060.3 1922.9 2060.7 C
 58.3627 +1923.2 2060.1 1923.8 2060.4 1924.6 2060.7 C
 58.3628 +1925.9 2062.6 1923.2 2062 1925.6 2063.6 C
 58.3629 +1926.1 2063.1 1927.3 2062.5 1927.2 2062.4 C
 58.3630 +[0.21 0.21 0 0]  vc
 58.3631 +f 
 58.3632 +S 
 58.3633 +n
 58.3634 +1933.2 2063.3 m
 58.3635 +1933.2 2060.7 1933.2 2058.2 1933.2 2055.6 C
 58.3636 +1933.2 2058.2 1933.2 2060.7 1933.2 2063.3 C
 58.3637 +[0 1 1 0.36]  vc
 58.3638 +f 
 58.3639 +S 
 58.3640 +n
 58.3641 +1965.2 2049.2 m
 58.3642 +1967.1 2050.1 1969.9 2053.7 1972.1 2056.4 C
 58.3643 +1970.5 2054 1967.6 2051.3 1965.2 2049.2 C
 58.3644 +f 
 58.3645 +S 
 58.3646 +n
 58.3647 +1991.8 2034.8 m
 58.3648 +1991.7 2041.5 1992 2048.5 1991.6 2055.2 C
 58.3649 +1990.5 2056.4 1991.9 2054.9 1991.8 2054.4 C
 58.3650 +1991.8 2047.9 1991.8 2041.3 1991.8 2034.8 C
 58.3651 +f 
 58.3652 +S 
 58.3653 +n
 58.3654 +1988.9 2053.2 m
 58.3655 +1988.9 2044.3 1988.9 2036.6 1988.9 2028.3 C
 58.3656 +1985.7 2028.2 1987.2 2023.5 1983.9 2024.2 C
 58.3657 +1983.9 2022.4 1982 2021.6 1981 2021.3 C
 58.3658 +1980.6 2021.1 1980.6 2021.7 1980.3 2021.6 C
 58.3659 +1980.3 2027 1980.3 2034.8 1980.3 2041.5 C
 58.3660 +1979.3 2043.2 1977.6 2043 1976.2 2043.6 C
 58.3661 +1977.1 2043.8 1978.5 2043.2 1978.8 2044.1 C
 58.3662 +1978.5 2045.3 1979.9 2045.3 1980.3 2045.8 C
 58.3663 +1980.5 2046.8 1980.7 2046.2 1981.5 2046.5 C
 58.3664 +1982.4 2047.1 1982 2048.6 1982.7 2049.4 C
 58.3665 +1984.2 2049.6 1984.6 2052.2 1986.8 2051.6 C
 58.3666 +1987.1 2048.6 1985.1 2042.7 1986.5 2040.5 C
 58.3667 +1986.3 2036.7 1986.9 2031.7 1986 2029.2 C
 58.3668 +1986.3 2027.1 1986.9 2028.6 1987.7 2027.6 C
 58.3669 +1987.7 2028.3 1988.7 2028 1988.7 2028.8 C
 58.3670 +1988.1 2033 1988.7 2037.5 1988.2 2041.7 C
 58.3671 +1987.8 2041.4 1988 2040.8 1988 2040.3 C
 58.3672 +1988 2041 1988 2042.4 1988 2042.4 C
 58.3673 +1988 2042.4 1988.1 2042.3 1988.2 2042.2 C
 58.3674 +1989.3 2046 1988 2050.2 1988.4 2054 C
 58.3675 +1987.8 2054.4 1987.1 2054.7 1986.5 2055.4 C
 58.3676 +1987.4 2054.4 1988.4 2054.6 1988.9 2053.2 C
 58.3677 +[0 1 1 0.23]  vc
 58.3678 +f 
 58.3679 +S 
 58.3680 +n
 58.3681 +1950.8 2054.4 m
 58.3682 +1949.7 2053.4 1948.7 2052.3 1947.6 2051.3 C
 58.3683 +1948.7 2052.3 1949.7 2053.4 1950.8 2054.4 C
 58.3684 +[0 1 1 0.36]  vc
 58.3685 +f 
 58.3686 +S 
 58.3687 +n
 58.3688 +vmrs
 58.3689 +2006.7 2043.2 m
 58.3690 +2004.5 2040.8 2002.4 2038.4 2000.2 2036 C
 58.3691 +2002.4 2038.4 2004.5 2040.8 2006.7 2043.2 C
 58.3692 +[0 1 1 0.36]  vc
 58.3693 +f 
 58.3694 +0.4 w
 58.3695 +2 J
 58.3696 +2 M
 58.3697 +S 
 58.3698 +n
 58.3699 +1976.7 2019.6 m
 58.3700 +1975.8 2018.6 1976.4 2016.9 1976.2 2015.6 C
 58.3701 +1976 2021.3 1975.8 2031.2 1976.2 2038.8 C
 58.3702 +1976.4 2032.4 1975.8 2025.5 1976.7 2019.6 C
 58.3703 +f 
 58.3704 +S 
 58.3705 +n
 58.3706 +1988.4 2053.5 m
 58.3707 +1988.6 2049.2 1988.1 2042.8 1988 2040 C
 58.3708 +1988.4 2040.4 1988.1 2041 1988.2 2041.5 C
 58.3709 +1988.3 2037.2 1988 2032.7 1988.4 2028.5 C
 58.3710 +1987.6 2027.1 1987.2 2028.6 1986.8 2028 C
 58.3711 +1985.9 2028.5 1986.5 2029.7 1986.3 2030.4 C
 58.3712 +1986.9 2029.8 1986.6 2031 1987 2031.2 C
 58.3713 +1987.4 2039.6 1985 2043 1987.2 2050.4 C
 58.3714 +1987.2 2051.6 1985.9 2052.3 1984.6 2051.3 C
 58.3715 +1981.9 2049.7 1982.9 2047 1980.3 2046.5 C
 58.3716 +1980.3 2045.2 1978.1 2046.2 1978.6 2043.9 C
 58.3717 +1975.6 2043.3 1979.3 2045.6 1979.6 2046.5 C
 58.3718 +1980.8 2046.6 1981.5 2048.5 1982.2 2049.9 C
 58.3719 +1983.7 2050.8 1984.8 2052.8 1986.5 2053 C
 58.3720 +1986.7 2053.5 1987.5 2054.1 1987 2054.7 C
 58.3721 +1987.4 2053.9 1988.3 2054.3 1988.4 2053.5 C
 58.3722 +[0 1 1 0.23]  vc
 58.3723 +f 
 58.3724 +S 
 58.3725 +n
 58.3726 +1988 2038.1 m
 58.3727 +1988 2036.7 1988 2035.4 1988 2034 C
 58.3728 +1988 2035.4 1988 2036.7 1988 2038.1 C
 58.3729 +[0 1 1 0.36]  vc
 58.3730 +f 
 58.3731 +S 
 58.3732 +n
 58.3733 +1999.7 2035.7 m
 58.3734 +1997.6 2033.5 1995.4 2031.2 1993.2 2029 C
 58.3735 +1995.4 2031.2 1997.6 2033.5 1999.7 2035.7 C
 58.3736 +f 
 58.3737 +S 
 58.3738 +n
 58.3739 +1944 2029.2 m
 58.3740 +1945.2 2029.5 1946.9 2029.8 1947.9 2029 C
 58.3741 +1947.4 2027.4 1949 2026.7 1949.8 2026.4 C
 58.3742 +1953.9 2028.6 1952.6 2023.4 1955.6 2023.7 C
 58.3743 +1957.4 2021.4 1960.7 2027 1959.4 2021.3 C
 58.3744 +1959.3 2021.7 1959.6 2022.3 1959.2 2022.5 C
 58.3745 +1958.1 2021.2 1960.1 2021.1 1959.4 2019.6 C
 58.3746 +1959.1 2012.7 1959.9 2005.1 1959.6 1999.2 C
 58.3747 +1955.3 2000.1 1951.3 2003.1 1947.2 2005 C
 58.3748 +1943.9 2006 1941.2 2008.7 1938 2010 C
 58.3749 +1936.9 2012.1 1938.2 2014.8 1937.8 2017.5 C
 58.3750 +1937.8 2022.6 1937.8 2027.3 1937.8 2032.1 C
 58.3751 +1938.2 2026.5 1938 2019 1938 2012.4 C
 58.3752 +1938.5 2012 1939.2 2012.3 1939.7 2012.2 C
 58.3753 +1940.8 2012.8 1939.7 2013.6 1939.7 2014.4 C
 58.3754 +1940.4 2020.5 1939.4 2028 1939.7 2032.1 C
 58.3755 +1940.6 2031.9 1941.2 2032.7 1941.9 2032.1 C
 58.3756 +1941.7 2031.2 1943 2029.7 1944 2029.2 C
 58.3757 +[0 0.2 1 0]  vc
 58.3758 +f 
 58.3759 +S 
 58.3760 +n
 58.3761 +1937.1 2031.6 m
 58.3762 +1937.1 2029.1 1937.1 2026.5 1937.1 2024 C
 58.3763 +1937.1 2026.5 1937.1 2029.1 1937.1 2031.6 C
 58.3764 +[0 1 1 0.36]  vc
 58.3765 +f 
 58.3766 +S 
 58.3767 +n
 58.3768 +1991.8 2028 m
 58.3769 +1992.5 2027.8 1993.2 2029.9 1994 2030.2 C
 58.3770 +1992.9 2029.6 1993.1 2028.1 1991.8 2028 C
 58.3771 +[0 1 1 0.23]  vc
 58.3772 +f 
 58.3773 +S 
 58.3774 +n
 58.3775 +1991.8 2027.8 m
 58.3776 +1992.4 2027.6 1992.6 2028.3 1993 2028.5 C
 58.3777 +1992.6 2028.2 1992.2 2027.6 1991.6 2027.8 C
 58.3778 +1991.6 2028.5 1991.6 2029.1 1991.6 2029.7 C
 58.3779 +1991.6 2029.1 1991.4 2028.3 1991.8 2027.8 C
 58.3780 +[0 1 1 0.36]  vc
 58.3781 +f 
 58.3782 +S 
 58.3783 +n
 58.3784 +1985.8 2025.4 m
 58.3785 +1985.3 2025.2 1984.8 2024.7 1984.1 2024.9 C
 58.3786 +1983.3 2025.3 1983.6 2027.3 1983.9 2027.6 C
 58.3787 +1985 2028 1986.9 2026.9 1985.8 2025.4 C
 58.3788 +[0 1 1 0.23]  vc
 58.3789 +f 
 58.3790 +S 
 58.3791 +n
 58.3792 +vmrs
 58.3793 +1993.5 2024.4 m
 58.3794 +1992.4 2023.7 1991.3 2022.9 1990.1 2023.2 C
 58.3795 +1990.7 2023.7 1989.8 2023.8 1989.4 2023.7 C
 58.3796 +1989.1 2023.7 1988.6 2023.9 1988.4 2023.5 C
 58.3797 +1988.5 2023.2 1988.3 2022.7 1988.7 2022.5 C
 58.3798 +1989 2022.6 1988.9 2023 1988.9 2023.2 C
 58.3799 +1989.1 2022.8 1990.4 2022.3 1990.6 2021.3 C
 58.3800 +1990.4 2021.8 1990 2021.3 1990.1 2021.1 C
 58.3801 +1990.1 2020.9 1990.1 2020.1 1990.1 2020.6 C
 58.3802 +1989.9 2021.1 1989.5 2020.6 1989.6 2020.4 C
 58.3803 +1989.6 2019.8 1988.7 2019.6 1988.2 2019.2 C
 58.3804 +1987.5 2018.7 1987.7 2020.2 1987 2019.4 C
 58.3805 +1987.5 2020.4 1986 2021.1 1987.5 2021.8 C
 58.3806 +1986.8 2023.1 1986.6 2021.1 1986 2021.1 C
 58.3807 +1986.1 2020.1 1985.9 2019 1986.3 2018.2 C
 58.3808 +1986.7 2018.4 1986.5 2019 1986.5 2019.4 C
 58.3809 +1986.5 2018.7 1986.4 2017.8 1987.2 2017.7 C
 58.3810 +1986.5 2017.2 1985.5 2019.3 1985.3 2020.4 C
 58.3811 +1986.2 2022 1987.3 2023.5 1989.2 2024.2 C
 58.3812 +1990.8 2024.3 1991.6 2022.9 1993.2 2024.4 C
 58.3813 +1993.8 2025.4 1995 2026.6 1995.9 2027.1 C
 58.3814 +1995 2026.5 1994.1 2025.5 1993.5 2024.4 C
 58.3815 +[0 1 1 0.36]  vc
 58.3816 +f 
 58.3817 +0.4 w
 58.3818 +2 J
 58.3819 +2 M
 58.3820 +[0 0.5 0.5 0.2]  vc
 58.3821 +S 
 58.3822 +n
 58.3823 +2023 2040.3 m
 58.3824 +2023.2 2036 2022.7 2029.6 2022.5 2026.8 C
 58.3825 +2022.9 2027.2 2022.7 2027.8 2022.8 2028.3 C
 58.3826 +2022.8 2024 2022.6 2019.5 2023 2015.3 C
 58.3827 +2022.2 2013.9 2021.7 2015.4 2021.3 2014.8 C
 58.3828 +2020.4 2015.3 2021 2016.5 2020.8 2017.2 C
 58.3829 +2021.4 2016.6 2021.1 2017.8 2021.6 2018 C
 58.3830 +2022 2026.4 2019.6 2029.8 2021.8 2037.2 C
 58.3831 +2021.7 2038.4 2020.5 2039.1 2019.2 2038.1 C
 58.3832 +2016.5 2036.5 2017.5 2033.8 2014.8 2033.3 C
 58.3833 +2014.9 2032 2012.6 2033 2013.2 2030.7 C
 58.3834 +2011.9 2030.8 2011.2 2030.1 2010.8 2029.2 C
 58.3835 +2010.8 2029.1 2010.8 2028.2 2010.8 2028.8 C
 58.3836 +2010 2028.8 2010.4 2026.5 2008.6 2027.3 C
 58.3837 +2007.9 2026.6 2007.3 2025.9 2007.9 2027.1 C
 58.3838 +2009.7 2028 2010 2030.1 2012.2 2030.9 C
 58.3839 +2012.9 2032.1 2013.7 2033.6 2015.1 2033.6 C
 58.3840 +2015.7 2035.1 2016.9 2036.7 2018.4 2038.4 C
 58.3841 +2019.8 2039.3 2022 2039.4 2021.6 2041.5 C
 58.3842 +2021.9 2040.7 2022.9 2041.1 2023 2040.3 C
 58.3843 +[0 1 1 0.23]  vc
 58.3844 +f 
 58.3845 +S 
 58.3846 +n
 58.3847 +2022.5 2024.9 m
 58.3848 +2022.5 2023.5 2022.5 2022.2 2022.5 2020.8 C
 58.3849 +2022.5 2022.2 2022.5 2023.5 2022.5 2024.9 C
 58.3850 +[0 1 1 0.36]  vc
 58.3851 +f 
 58.3852 +S 
 58.3853 +n
 58.3854 +1983.2 2022.8 m
 58.3855 +1982.4 2022.5 1982.1 2021.6 1981.2 2022.3 C
 58.3856 +1981.1 2022.9 1980.5 2024 1981 2024.2 C
 58.3857 +1981.8 2024.6 1982.9 2024.4 1983.2 2022.8 C
 58.3858 +[0 1 1 0.23]  vc
 58.3859 +f 
 58.3860 +S 
 58.3861 +n
 58.3862 +1931.1 2019.9 m
 58.3863 +1929.6 2017.7 1932 2015.7 1930.8 2013.9 C
 58.3864 +1931.1 2013 1930.3 2011 1930.6 2009.3 C
 58.3865 +1930.6 2010.3 1929.8 2010 1929.2 2010 C
 58.3866 +1928 2010.3 1928.8 2008.1 1928.2 2007.6 C
 58.3867 +1929.1 2007.8 1929.3 2006.3 1930.1 2006.9 C
 58.3868 +1930.3 2009.8 1932.2 2004.8 1932.3 2008.6 C
 58.3869 +1932.7 2008 1932.8 2009 1932.8 2009.3 C
 58.3870 +1932.8 2009.6 1932.8 2009.8 1932.8 2010 C
 58.3871 +1933.2 2009 1932.7 2006.6 1934 2005.7 C
 58.3872 +1932.7 2004.6 1934.3 2004.6 1934.2 2004 C
 58.3873 +1935.8 2003.7 1937 2003.6 1938.5 2004 C
 58.3874 +1938.5 2004.5 1939.1 2005.4 1938.3 2006 C
 58.3875 +1940.7 2005.7 1937.4 2001.3 1939.7 2001.4 C
 58.3876 +1939.5 2001.4 1938.6 1998.8 1937.1 1999.2 C
 58.3877 +1936.3 1999.1 1936.2 1997.1 1936.1 1998.5 C
 58.3878 +1934.7 2000.1 1932.9 1998.2 1931.6 1999.5 C
 58.3879 +1931.3 1998.9 1930.9 1998.5 1931.1 1997.8 C
 58.3880 +1931.6 1998.2 1931.3 1996.6 1932 1996.1 C
 58.3881 +1933.2 1995.5 1934.3 1996.4 1935.2 1995.4 C
 58.3882 +1935.5 1996.5 1936.3 1996.1 1935.6 1995.2 C
 58.3883 +1934.7 1994.5 1932.5 1995.3 1932 1995.4 C
 58.3884 +1930.5 1995.3 1931.9 1996.5 1930.8 1996.4 C
 58.3885 +1931.2 1997.9 1929.5 1998.3 1928.9 1998.5 C
 58.3886 +1928.1 1997.9 1927.1 1998 1926 1998 C
 58.3887 +1925.3 1999.2 1924.8 2001.4 1923.2 2001.4 C
 58.3888 +1922.6 2000.9 1921 2000.9 1920.3 2000.9 C
 58.3889 +1919.7 2001.9 1919.6 2003.5 1918.1 2004 C
 58.3890 +1916.9 2004.1 1915.8 2002 1915.2 2003.8 C
 58.3891 +1916.7 2004 1917.6 2004.9 1919.6 2004.5 C
 58.3892 +1920.7 2005.2 1919.4 2006.3 1919.8 2006.9 C
 58.3893 +1919.2 2006.9 1917.7 2007.8 1917.2 2008.6 C
 58.3894 +1917.8 2011.6 1919.8 2007.8 1920.5 2010.5 C
 58.3895 +1920.8 2011.3 1919.3 2011.6 1920.5 2012 C
 58.3896 +1920.8 2012.3 1924 2011.8 1923.2 2014.1 C
 58.3897 +1922.6 2013.6 1924.1 2016.1 1924.1 2015.1 C
 58.3898 +1925.1 2015.4 1925.9 2015 1926.3 2016.5 C
 58.3899 +1926.2 2016.6 1926 2016.8 1925.8 2016.8 C
 58.3900 +1925.9 2017.2 1926.2 2017.8 1926.8 2018.2 C
 58.3901 +1927.1 2017.6 1927.7 2018 1928.4 2018.2 C
 58.3902 +1929.7 2020.1 1927.1 2019.5 1929.4 2021.1 C
 58.3903 +1929.9 2020.7 1931.1 2020 1931.1 2019.9 C
 58.3904 +[0.21 0.21 0 0]  vc
 58.3905 +f 
 58.3906 +S 
 58.3907 +n
 58.3908 +1937.1 2020.8 m
 58.3909 +1937.1 2018.3 1937.1 2015.7 1937.1 2013.2 C
 58.3910 +1937.1 2015.7 1937.1 2018.3 1937.1 2020.8 C
 58.3911 +[0 1 1 0.36]  vc
 58.3912 +f 
 58.3913 +S 
 58.3914 +n
 58.3915 +2020.4 2012.2 m
 58.3916 +2019.8 2012 2019.3 2011.5 2018.7 2011.7 C
 58.3917 +2017.9 2012.1 2018.1 2014.1 2018.4 2014.4 C
 58.3918 +2019.6 2014.8 2021.4 2013.7 2020.4 2012.2 C
 58.3919 +[0 1 1 0.23]  vc
 58.3920 +f 
 58.3921 +S 
 58.3922 +n
 58.3923 +1976 2013.9 m
 58.3924 +1973.8 2011.5 1971.6 2009.1 1969.5 2006.7 C
 58.3925 +1971.6 2009.1 1973.8 2011.5 1976 2013.9 C
 58.3926 +[0 1 1 0.36]  vc
 58.3927 +f 
 58.3928 +S 
 58.3929 +n
 58.3930 +1995.4 2012.7 m
 58.3931 +1996.1 2010.3 1993.8 2006.2 1997.3 2005.7 C
 58.3932 +1998.9 2005.4 2000 2003.7 2001.4 2003.1 C
 58.3933 +2003.9 2003.1 2005.3 2001.3 2006.9 1999.7 C
 58.3934 +2004.5 2003.5 2000 2002.2 1997.6 2005.7 C
 58.3935 +1996.5 2005.9 1994.8 2006.1 1995.2 2007.6 C
 58.3936 +1995.7 2009.4 1995.2 2011.6 1994.7 2012.9 C
 58.3937 +1992 2015.8 1987.8 2015.7 1985.3 2018.7 C
 58.3938 +1988.3 2016.3 1992.3 2015.3 1995.4 2012.7 C
 58.3939 +[0.18 0.18 0 0.78]  vc
 58.3940 +f 
 58.3941 +S 
 58.3942 +n
 58.3943 +1995.6 2012.4 m
 58.3944 +1995.6 2011.2 1995.6 2010 1995.6 2008.8 C
 58.3945 +1995.6 2010 1995.6 2011.2 1995.6 2012.4 C
 58.3946 +[0 1 1 0.36]  vc
 58.3947 +f 
 58.3948 +S 
 58.3949 +n
 58.3950 +vmrs
 58.3951 +2017.7 2009.6 m
 58.3952 +2016.9 2009.3 2016.7 2008.4 2015.8 2009.1 C
 58.3953 +2014.2 2010.6 2016 2010.6 2016.5 2011.5 C
 58.3954 +2017.2 2010.9 2018.1 2010.8 2017.7 2009.6 C
 58.3955 +[0 1 1 0.23]  vc
 58.3956 +f 
 58.3957 +0.4 w
 58.3958 +2 J
 58.3959 +2 M
 58.3960 +S 
 58.3961 +n
 58.3962 +2014.4 2006.4 m
 58.3963 +2013.5 2006.8 2012.1 2005.6 2012 2006.7 C
 58.3964 +2013 2007.3 2011.9 2009.2 2012.9 2008.4 C
 58.3965 +2014.2 2008.3 2014.6 2007.8 2014.4 2006.4 C
 58.3966 +f 
 58.3967 +S 
 58.3968 +n
 58.3969 +1969 2006.4 m
 58.3970 +1966.5 2003.8 1964 2001.2 1961.6 1998.5 C
 58.3971 +1964 2001.2 1966.5 2003.8 1969 2006.4 C
 58.3972 +[0 1 1 0.36]  vc
 58.3973 +f 
 58.3974 +S 
 58.3975 +n
 58.3976 +2012 2005.2 m
 58.3977 +2012.2 2004.2 2011.4 2003.3 2010.3 2003.3 C
 58.3978 +2009 2003.6 2010 2004.7 2009.6 2004.8 C
 58.3979 +2009.3 2005.7 2011.4 2006.7 2012 2005.2 C
 58.3980 +[0 1 1 0.23]  vc
 58.3981 +f 
 58.3982 +S 
 58.3983 +n
 58.3984 +1962.8 1995.2 m
 58.3985 +1961.7 1994.4 1960.6 1993.7 1959.4 1994 C
 58.3986 +1959.5 1994.9 1957.5 1994.1 1956.8 1994.7 C
 58.3987 +1955.9 1995.5 1956.7 1997 1955.1 1997.3 C
 58.3988 +1956.9 1996.7 1956.8 1994 1959.2 1994.7 C
 58.3989 +1961.1 1991 1968.9 2003.2 1962.8 1995.2 C
 58.3990 +[0 1 1 0.36]  vc
 58.3991 +f 
 58.3992 +S 
 58.3993 +n
 58.3994 +1954.6 1995.6 m
 58.3995 +1955.9 1994.7 1955.1 1989.8 1955.3 1988 C
 58.3996 +1954.5 1988.3 1954.9 1986.6 1954.4 1986 C
 58.3997 +1955.7 1989.2 1953.9 1991.1 1954.8 1994.2 C
 58.3998 +1954.5 1995.9 1953.5 1995.3 1953.9 1997.3 C
 58.3999 +1955.3 1998.3 1953.2 1995.5 1954.6 1995.6 C
 58.4000 +f 
 58.4001 +S 
 58.4002 +n
 58.4003 +1992.3 2011 m
 58.4004 +1992.5 2006.7 1992 2000.3 1991.8 1997.6 C
 58.4005 +1992.2 1997.9 1992 1998.5 1992 1999 C
 58.4006 +1992.1 1994.7 1991.9 1990.2 1992.3 1986 C
 58.4007 +1991.4 1984.6 1991 1986.1 1990.6 1985.6 C
 58.4008 +1989.7 1986 1990.3 1987.2 1990.1 1988 C
 58.4009 +1990.7 1987.4 1990.4 1988.5 1990.8 1988.7 C
 58.4010 +1991.3 1997.1 1988.9 2000.6 1991.1 2007.9 C
 58.4011 +1991 2009.1 1989.8 2009.9 1988.4 2008.8 C
 58.4012 +1985.7 2007.2 1986.8 2004.5 1984.1 2004 C
 58.4013 +1984.2 2002.7 1981.9 2003.7 1982.4 2001.4 C
 58.4014 +1981.2 2001.5 1980.5 2000.8 1980 2000 C
 58.4015 +1980 1999.8 1980 1998.9 1980 1999.5 C
 58.4016 +1979.3 1999.5 1979.7 1997.2 1977.9 1998 C
 58.4017 +1977.2 1997.3 1976.6 1996.7 1977.2 1997.8 C
 58.4018 +1979 1998.7 1979.3 2000.8 1981.5 2001.6 C
 58.4019 +1982.2 2002.8 1983 2004.3 1984.4 2004.3 C
 58.4020 +1985 2005.8 1986.2 2007.5 1987.7 2009.1 C
 58.4021 +1989 2010 1991.3 2010.2 1990.8 2012.2 C
 58.4022 +1991.2 2011.4 1992.2 2011.8 1992.3 2011 C
 58.4023 +[0 1 1 0.23]  vc
 58.4024 +f 
 58.4025 +S 
 58.4026 +n
 58.4027 +1991.8 1995.6 m
 58.4028 +1991.8 1994.3 1991.8 1992.9 1991.8 1991.6 C
 58.4029 +1991.8 1992.9 1991.8 1994.3 1991.8 1995.6 C
 58.4030 +[0 1 1 0.36]  vc
 58.4031 +f 
 58.4032 +S 
 58.4033 +n
 58.4034 +1959.2 1994.2 m
 58.4035 +1958.8 1993.3 1960.7 1993.9 1961.1 1993.7 C
 58.4036 +1961.5 1993.9 1961.2 1994.4 1961.8 1994.2 C
 58.4037 +1960.9 1994 1960.8 1992.9 1959.9 1992.5 C
 58.4038 +1959.6 1993.5 1958.3 1993.5 1958.2 1994.2 C
 58.4039 +1958.1 1994.1 1958 1994 1958 1994 C
 58.4040 +1957.2 1994.9 1958 1993.4 1956.8 1993 C
 58.4041 +1955.6 1992.5 1956 1991 1956.3 1989.9 C
 58.4042 +1956.5 1989.8 1956.6 1990 1956.8 1990.1 C
 58.4043 +1957.1 1989 1956 1989.1 1955.8 1988.2 C
 58.4044 +1955.1 1990.4 1956.2 1995 1954.8 1995.9 C
 58.4045 +1954.1 1995.5 1954.5 1996.5 1954.4 1997.1 C
 58.4046 +1955 1996.8 1954.8 1997.4 1955.6 1996.8 C
 58.4047 +1956 1996 1956.3 1993.2 1958.7 1994.2 C
 58.4048 +1958.9 1994.2 1959.7 1994.2 1959.2 1994.2 C
 58.4049 +[0 1 1 0.23]  vc
 58.4050 +f 
 58.4051 +S 
 58.4052 +n
 58.4053 +1958.2 1994 m
 58.4054 +1958.4 1993.5 1959.7 1993.1 1959.9 1992 C
 58.4055 +1959.7 1992.5 1959.3 1992 1959.4 1991.8 C
 58.4056 +1959.4 1991.6 1959.4 1990.8 1959.4 1991.3 C
 58.4057 +1959.2 1991.8 1958.8 1991.3 1958.9 1991.1 C
 58.4058 +1958.9 1990.5 1958 1990.3 1957.5 1989.9 C
 58.4059 +1956.8 1989.5 1956.9 1991 1956.3 1990.1 C
 58.4060 +1956.7 1991 1955.4 1992.1 1956.5 1992.3 C
 58.4061 +1956.8 1993.5 1958.3 1992.9 1957.2 1994 C
 58.4062 +1957.8 1994.3 1958.1 1992.4 1958.2 1994 C
 58.4063 +[0 0.5 0.5 0.2]  vc
 58.4064 +f 
 58.4065 +S 
 58.4066 +n
 58.4067 +vmrs
 58.4068 +1954.4 1982.7 m
 58.4069 +1956.1 1982.7 1954.1 1982.5 1953.9 1982.9 C
 58.4070 +1953.9 1983.7 1953.7 1984.7 1954.1 1985.3 C
 58.4071 +1954.4 1984.2 1953.6 1983.6 1954.4 1982.7 C
 58.4072 +[0 1 1 0.36]  vc
 58.4073 +f 
 58.4074 +0.4 w
 58.4075 +2 J
 58.4076 +2 M
 58.4077 +S 
 58.4078 +n
 58.4079 +1989.6 1982.9 m
 58.4080 +1989.1 1982.7 1988.6 1982.3 1988 1982.4 C
 58.4081 +1987.2 1982.8 1987.4 1984.8 1987.7 1985.1 C
 58.4082 +1988.9 1985.6 1990.7 1984.4 1989.6 1982.9 C
 58.4083 +[0 1 1 0.23]  vc
 58.4084 +f 
 58.4085 +S 
 58.4086 +n
 58.4087 +1987 1980.3 m
 58.4088 +1986.2 1980 1986 1979.1 1985.1 1979.8 C
 58.4089 +1983.5 1981.4 1985.3 1981.4 1985.8 1982.2 C
 58.4090 +1986.5 1981.7 1987.4 1981.5 1987 1980.3 C
 58.4091 +f 
 58.4092 +S 
 58.4093 +n
 58.4094 +1983.6 1977.2 m
 58.4095 +1982.7 1977.5 1981.4 1976.3 1981.2 1977.4 C
 58.4096 +1982.3 1978 1981.2 1979.9 1982.2 1979.1 C
 58.4097 +1983.5 1979 1983.9 1978.5 1983.6 1977.2 C
 58.4098 +f 
 58.4099 +S 
 58.4100 +n
 58.4101 +1981.2 1976 m
 58.4102 +1981.5 1974.9 1980.6 1974 1979.6 1974 C
 58.4103 +1978.3 1974.3 1979.3 1975.4 1978.8 1975.5 C
 58.4104 +1978.6 1976.4 1980.7 1977.4 1981.2 1976 C
 58.4105 +f 
 58.4106 +S 
 58.4107 +n
 58.4108 +1972.1 2082.3 m
 58.4109 +1971.8 2081.8 1971.3 2080.9 1971.2 2080.1 C
 58.4110 +1971.1 2072.9 1971.3 2064.6 1970.9 2058.3 C
 58.4111 +1970.3 2058.5 1970.1 2057.7 1969.7 2058.5 C
 58.4112 +1970.6 2058.5 1969.7 2059 1970.2 2059.2 C
 58.4113 +1970.2 2065.4 1970.2 2072.4 1970.2 2077.7 C
 58.4114 +1971.1 2078.9 1970.6 2078.9 1970.4 2079.9 C
 58.4115 +1969.2 2080.2 1968.2 2080.4 1967.3 2079.6 C
 58.4116 +1966.8 2077.8 1963.4 2076.3 1963.5 2075.1 C
 58.4117 +1961.5 2075.5 1962 2071.5 1959.6 2072 C
 58.4118 +1959.2 2070 1956.5 2069.3 1955.8 2067.6 C
 58.4119 +1956 2068.4 1955.3 2069.7 1956.5 2069.8 C
 58.4120 +1958.6 2068.9 1958.1 2073.5 1960.1 2072.4 C
 58.4121 +1960.7 2075.9 1964.7 2074.6 1964.2 2078 C
 58.4122 +1967.2 2078.6 1967.9 2081.6 1970.7 2080.6 C
 58.4123 +1970.3 2081.1 1971.5 2081.2 1971.9 2082.3 C
 58.4124 +1967.2 2084.3 1962.9 2087.1 1958.2 2089 C
 58.4125 +1962.9 2087 1967.4 2084.4 1972.1 2082.3 C
 58.4126 +[0 0.2 1 0]  vc
 58.4127 +f 
 58.4128 +S 
 58.4129 +n
 58.4130 +1971.9 2080.1 m
 58.4131 +1971.9 2075.1 1971.9 2070 1971.9 2065 C
 58.4132 +1971.9 2070 1971.9 2075.1 1971.9 2080.1 C
 58.4133 +[0 1 1 0.23]  vc
 58.4134 +f 
 58.4135 +S 
 58.4136 +n
 58.4137 +2010.8 2050.6 m
 58.4138 +2013.2 2049 2010.5 2050.1 2010.5 2051.3 C
 58.4139 +2010.5 2057.7 2010.5 2064.1 2010.5 2070.5 C
 58.4140 +2008.7 2072.4 2006 2073.3 2003.6 2074.4 C
 58.4141 +2016.4 2073.7 2008 2058.4 2010.8 2050.6 C
 58.4142 +[0.4 0.4 0 0]  vc
 58.4143 +f 
 58.4144 +S 
 58.4145 +n
 58.4146 +2006.4 2066.9 m
 58.4147 +2006.4 2061.9 2006.4 2056.8 2006.4 2051.8 C
 58.4148 +2006.4 2056.8 2006.4 2061.9 2006.4 2066.9 C
 58.4149 +[0 1 1 0.23]  vc
 58.4150 +f 
 58.4151 +S 
 58.4152 +n
 58.4153 +1971.9 2060.7 m
 58.4154 +1972.2 2060.3 1971.4 2068.2 1972.4 2061.9 C
 58.4155 +1971.8 2061.6 1972.4 2060.9 1971.9 2060.7 C
 58.4156 +f 
 58.4157 +S 
 58.4158 +n
 58.4159 +vmrs
 58.4160 +1986.5 2055.2 m
 58.4161 +1987.5 2054.3 1986.3 2053.4 1986 2052.8 C
 58.4162 +1983.8 2052.7 1983.6 2050.1 1981.7 2049.6 C
 58.4163 +1981.2 2048.7 1980.8 2047 1980.3 2046.8 C
 58.4164 +1978.5 2047 1978 2044.6 1976.7 2043.9 C
 58.4165 +1974 2044.4 1972 2046.6 1969.2 2047 C
 58.4166 +1969 2047.2 1968.8 2047.5 1968.5 2047.7 C
 58.4167 +1970.6 2049.6 1973.1 2051.3 1974.3 2054.2 C
 58.4168 +1975.7 2054.5 1977 2055.2 1976.4 2057.1 C
 58.4169 +1976.7 2058 1975.5 2058.5 1976 2059.5 C
 58.4170 +1979.2 2058 1983 2056.6 1986.5 2055.2 C
 58.4171 +[0 0.5 0.5 0.2]  vc
 58.4172 +f 
 58.4173 +0.4 w
 58.4174 +2 J
 58.4175 +2 M
 58.4176 +S 
 58.4177 +n
 58.4178 +1970.2 2054.2 m
 58.4179 +1971.5 2055.3 1972.5 2056.8 1972.1 2058.3 C
 58.4180 +1972.8 2056.5 1971.6 2055.6 1970.2 2054.2 C
 58.4181 +[0 1 1 0.23]  vc
 58.4182 +f 
 58.4183 +S 
 58.4184 +n
 58.4185 +1992 2052.5 m
 58.4186 +1992 2053.4 1992.2 2054.4 1991.8 2055.2 C
 58.4187 +1992.2 2054.4 1992 2053.4 1992 2052.5 C
 58.4188 +f 
 58.4189 +S 
 58.4190 +n
 58.4191 +1957.2 2053 m
 58.4192 +1958.1 2052.6 1959 2052.2 1959.9 2051.8 C
 58.4193 +1959 2052.2 1958.1 2052.6 1957.2 2053 C
 58.4194 +f 
 58.4195 +S 
 58.4196 +n
 58.4197 +2006.4 2047.5 m
 58.4198 +2006.8 2047.1 2006 2055 2006.9 2048.7 C
 58.4199 +2006.4 2048.4 2007 2047.7 2006.4 2047.5 C
 58.4200 +f 
 58.4201 +S 
 58.4202 +n
 58.4203 +2004.8 2041 m
 58.4204 +2006.1 2042.1 2007.1 2043.6 2006.7 2045.1 C
 58.4205 +2007.3 2043.3 2006.2 2042.4 2004.8 2041 C
 58.4206 +f 
 58.4207 +S 
 58.4208 +n
 58.4209 +1976 2039.8 m
 58.4210 +1975.6 2039.3 1975.2 2038.4 1975 2037.6 C
 58.4211 +1974.9 2030.4 1975.2 2022.1 1974.8 2015.8 C
 58.4212 +1974.2 2016 1974 2015.3 1973.6 2016 C
 58.4213 +1974.4 2016 1973.5 2016.5 1974 2016.8 C
 58.4214 +1974 2022.9 1974 2030 1974 2035.2 C
 58.4215 +1974.9 2036.4 1974.4 2036.4 1974.3 2037.4 C
 58.4216 +1973.1 2037.7 1972 2037.9 1971.2 2037.2 C
 58.4217 +1970.6 2035.3 1967.3 2033.9 1967.3 2032.6 C
 58.4218 +1965.3 2033 1965.9 2029.1 1963.5 2029.5 C
 58.4219 +1963 2027.6 1960.4 2026.8 1959.6 2025.2 C
 58.4220 +1959.8 2025.9 1959.2 2027.2 1960.4 2027.3 C
 58.4221 +1962.5 2026.4 1961.9 2031 1964 2030 C
 58.4222 +1964.6 2033.4 1968.5 2032.1 1968 2035.5 C
 58.4223 +1971 2036.1 1971.8 2039.1 1974.5 2038.1 C
 58.4224 +1974.2 2038.7 1975.3 2038.7 1975.7 2039.8 C
 58.4225 +1971 2041.8 1966.7 2044.6 1962 2046.5 C
 58.4226 +1966.8 2044.5 1971.3 2041.9 1976 2039.8 C
 58.4227 +[0 0.2 1 0]  vc
 58.4228 +f 
 58.4229 +S 
 58.4230 +n
 58.4231 +1975.7 2037.6 m
 58.4232 +1975.7 2032.6 1975.7 2027.6 1975.7 2022.5 C
 58.4233 +1975.7 2027.6 1975.7 2032.6 1975.7 2037.6 C
 58.4234 +[0 1 1 0.23]  vc
 58.4235 +f 
 58.4236 +S 
 58.4237 +n
 58.4238 +1992 2035.5 m
 58.4239 +1992 2034.2 1992 2032.9 1992 2031.6 C
 58.4240 +1992 2032.9 1992 2034.2 1992 2035.5 C
 58.4241 +f 
 58.4242 +S 
 58.4243 +n
 58.4244 +2015.3 2036 m
 58.4245 +2015.4 2034.1 2013.3 2034 2012.9 2033.3 C
 58.4246 +2011.5 2031 2009.3 2029.4 2007.4 2028 C
 58.4247 +2006.9 2027.1 2006.6 2023.8 2005 2024.9 C
 58.4248 +2004 2024.9 2002.9 2024.9 2001.9 2024.9 C
 58.4249 +2001.4 2026.5 2001 2028.4 2003.8 2028.3 C
 58.4250 +2006.6 2030.4 2008.9 2033.7 2011.2 2036.2 C
 58.4251 +2011.8 2036.4 2012.9 2035.8 2012.9 2036.7 C
 58.4252 +2013 2035.5 2015.3 2037.4 2015.3 2036 C
 58.4253 +[0 0 0 0]  vc
 58.4254 +f 
 58.4255 +S 
 58.4256 +n
 58.4257 +vmrs
 58.4258 +2009.1 2030.4 m
 58.4259 +2009.1 2029 2007.5 2029.4 2006.9 2028.3 C
 58.4260 +2007.2 2027.1 2006.5 2025.5 2005.7 2024.7 C
 58.4261 +2004.6 2025.1 2003.1 2024.9 2001.9 2024.9 C
 58.4262 +2001.8 2026.2 2000.9 2027 2002.4 2028 C
 58.4263 +2004.5 2027.3 2004.9 2029.4 2006.9 2029 C
 58.4264 +2007 2030.2 2007.6 2030.7 2008.4 2031.4 C
 58.4265 +2008.8 2031.5 2009.1 2031.1 2009.1 2030.4 C
 58.4266 +[0 0 0 0.18]  vc
 58.4267 +f 
 58.4268 +0.4 w
 58.4269 +2 J
 58.4270 +2 M
 58.4271 +S 
 58.4272 +n
 58.4273 +2003.8 2029.5 m
 58.4274 +2003 2029.4 2001.9 2029.1 2002.4 2030.4 C
 58.4275 +2003.1 2031.3 2005.2 2030.3 2003.8 2029.5 C
 58.4276 +[0 1 1 0.23]  vc
 58.4277 +f 
 58.4278 +S 
 58.4279 +n
 58.4280 +1999.2 2025.2 m
 58.4281 +1999.1 2025.6 1998 2025.7 1998.8 2026.6 C
 58.4282 +2000.9 2028.5 1999.5 2023.4 1999.2 2025.2 C
 58.4283 +f 
 58.4284 +S 
 58.4285 +n
 58.4286 +2007.6 2024.2 m
 58.4287 +2007.6 2022.9 2008.4 2024.2 2007.6 2022.8 C
 58.4288 +2007.6 2017.5 2007.8 2009.1 2007.4 2003.8 C
 58.4289 +2007.9 2003.7 2008.7 2002.8 2009.1 2002.1 C
 58.4290 +2009.6 2000.8 2008.3 2000.8 2007.9 2000.2 C
 58.4291 +2004.9 2000 2008.9 2001.3 2007.2 2002.1 C
 58.4292 +2006.7 2007.7 2007 2015.1 2006.9 2021.1 C
 58.4293 +2006.7 2022.1 2005.4 2022.8 2006.2 2023.5 C
 58.4294 +2006.6 2023.1 2008 2025.9 2007.6 2024.2 C
 58.4295 +f 
 58.4296 +S 
 58.4297 +n
 58.4298 +1989.9 2023.5 m
 58.4299 +1989.5 2022.6 1991.4 2023.2 1991.8 2023 C
 58.4300 +1992.2 2023.2 1991.9 2023.7 1992.5 2023.5 C
 58.4301 +1991.6 2023.2 1991.6 2022.2 1990.6 2021.8 C
 58.4302 +1990.4 2022.8 1989 2022.8 1988.9 2023.5 C
 58.4303 +1988.5 2023 1988.7 2022.6 1988.7 2023.5 C
 58.4304 +1989.1 2023.5 1990.2 2023.5 1989.9 2023.5 C
 58.4305 +f 
 58.4306 +[0 0.5 0.5 0.2]  vc
 58.4307 +S 
 58.4308 +n
 58.4309 +2003.3 2023.5 m
 58.4310 +2003.1 2023.3 2003.1 2023.2 2003.3 2023 C
 58.4311 +2003.7 2023.1 2003.9 2022.9 2003.8 2022.5 C
 58.4312 +2003.4 2022.2 2001.2 2022.3 2002.4 2023 C
 58.4313 +2002.6 2022.9 2002.7 2023.1 2002.8 2023.2 C
 58.4314 +2000.7 2023.7 2003.9 2023.4 2003.3 2023.5 C
 58.4315 +[0 1 1 0.23]  vc
 58.4316 +f 
 58.4317 +S 
 58.4318 +n
 58.4319 +1986.8 2019.4 m
 58.4320 +1987.8 2019.8 1987.5 2018.6 1987.2 2018 C
 58.4321 +1986.2 2017.8 1987.3 2020.5 1986.3 2019.2 C
 58.4322 +1986.3 2017.7 1986.3 2020.6 1986.3 2021.3 C
 58.4323 +1988.5 2023.1 1985.6 2020.3 1986.8 2019.4 C
 58.4324 +f 
 58.4325 +S 
 58.4326 +n
 58.4327 +1975.7 2018.2 m
 58.4328 +1976.1 2017.8 1975.2 2025.7 1976.2 2019.4 C
 58.4329 +1975.7 2019.2 1976.3 2018.4 1975.7 2018.2 C
 58.4330 +f 
 58.4331 +S 
 58.4332 +n
 58.4333 +1974 2011.7 m
 58.4334 +1975.4 2012.8 1976.4 2014.3 1976 2015.8 C
 58.4335 +1976.6 2014 1975.5 2013.1 1974 2011.7 C
 58.4336 +f 
 58.4337 +S 
 58.4338 +n
 58.4339 +1984.6 2006.7 m
 58.4340 +1984.7 2004.8 1982.6 2004.8 1982.2 2004 C
 58.4341 +1980.8 2001.7 1978.6 2000.1 1976.7 1998.8 C
 58.4342 +1976.1 1997.8 1975.8 1994.5 1974.3 1995.6 C
 58.4343 +1973.3 1995.6 1972.2 1995.6 1971.2 1995.6 C
 58.4344 +1970.7 1997.2 1970.3 1999.1 1973.1 1999 C
 58.4345 +1975.8 2001.2 1978.2 2004.4 1980.5 2006.9 C
 58.4346 +1981.1 2007.1 1982.1 2006.5 1982.2 2007.4 C
 58.4347 +1982.3 2006.2 1984.5 2008.1 1984.6 2006.7 C
 58.4348 +[0 0 0 0]  vc
 58.4349 +f 
 58.4350 +S 
 58.4351 +n
 58.4352 +vmrs
 58.4353 +1978.4 2001.2 m
 58.4354 +1978.4 1999.7 1976.8 2000.1 1976.2 1999 C
 58.4355 +1976.5 1997.8 1975.8 1996.2 1975 1995.4 C
 58.4356 +1973.9 1995.8 1972.4 1995.6 1971.2 1995.6 C
 58.4357 +1971 1997 1970.2 1997.7 1971.6 1998.8 C
 58.4358 +1973.8 1998 1974.2 2000.1 1976.2 1999.7 C
 58.4359 +1976.3 2000.9 1976.9 2001.4 1977.6 2002.1 C
 58.4360 +1978.1 2002.2 1978.4 2001.8 1978.4 2001.2 C
 58.4361 +[0 0 0 0.18]  vc
 58.4362 +f 
 58.4363 +0.4 w
 58.4364 +2 J
 58.4365 +2 M
 58.4366 +S 
 58.4367 +n
 58.4368 +1973.1 2000.2 m
 58.4369 +1972.3 2000.1 1971.2 1999.8 1971.6 2001.2 C
 58.4370 +1972.4 2002 1974.5 2001 1973.1 2000.2 C
 58.4371 +[0 1 1 0.23]  vc
 58.4372 +f 
 58.4373 +S 
 58.4374 +n
 58.4375 +1960.8 1998.5 m
 58.4376 +1961.6 1998.2 1962.6 2000.3 1963.2 2000.9 C
 58.4377 +1962.3 2000.1 1962.2 1998.7 1960.8 1998.5 C
 58.4378 +f 
 58.4379 +S 
 58.4380 +n
 58.4381 +1968.5 1995.9 m
 58.4382 +1968.4 1996.4 1967.3 1996.4 1968 1997.3 C
 58.4383 +1970.1 1999.2 1968.8 1994.1 1968.5 1995.9 C
 58.4384 +f 
 58.4385 +S 
 58.4386 +n
 58.4387 +1976.9 1994.9 m
 58.4388 +1976.9 1993.7 1977.6 1994.9 1976.9 1993.5 C
 58.4389 +1976.9 1988.2 1977.1 1979.8 1976.7 1974.5 C
 58.4390 +1977.2 1974.5 1978 1973.5 1978.4 1972.8 C
 58.4391 +1978.8 1971.5 1977.6 1971.5 1977.2 1970.9 C
 58.4392 +1974.2 1970.7 1978.2 1972 1976.4 1972.8 C
 58.4393 +1976 1978.4 1976.3 1985.8 1976.2 1991.8 C
 58.4394 +1976 1992.8 1974.6 1993.5 1975.5 1994.2 C
 58.4395 +1975.9 1993.8 1977.3 1996.6 1976.9 1994.9 C
 58.4396 +f 
 58.4397 +S 
 58.4398 +n
 58.4399 +1972.6 1994.2 m
 58.4400 +1972.4 1994 1972.4 1993.9 1972.6 1993.7 C
 58.4401 +1973 1993.8 1973.1 1993.7 1973.1 1993.2 C
 58.4402 +1972.7 1992.9 1970.5 1993.1 1971.6 1993.7 C
 58.4403 +1971.9 1993.7 1972 1993.8 1972.1 1994 C
 58.4404 +1970 1994.4 1973.1 1994.1 1972.6 1994.2 C
 58.4405 +f 
 58.4406 +S 
 58.4407 +n
 58.4408 +1948.1 2093.8 m
 58.4409 +1947 2092.7 1945.9 2091.6 1944.8 2090.4 C
 58.4410 +1945.9 2091.6 1947 2092.7 1948.1 2093.8 C
 58.4411 +[0 0.4 1 0]  vc
 58.4412 +f 
 58.4413 +S 
 58.4414 +n
 58.4415 +1953.4 2091.4 m
 58.4416 +1954.8 2090.7 1956.3 2090 1957.7 2089.2 C
 58.4417 +1956.3 2090 1954.8 2090.7 1953.4 2091.4 C
 58.4418 +[0 0.2 1 0]  vc
 58.4419 +f 
 58.4420 +S 
 58.4421 +n
 58.4422 +1954.1 2091.4 m
 58.4423 +1956.6 2089.6 1957.2 2089.6 1954.1 2091.4 C
 58.4424 +[0 0.4 1 0]  vc
 58.4425 +f 
 58.4426 +S 
 58.4427 +n
 58.4428 +1962.3 2087.3 m
 58.4429 +1963.7 2086.6 1965.2 2085.9 1966.6 2085.2 C
 58.4430 +1965.2 2085.9 1963.7 2086.6 1962.3 2087.3 C
 58.4431 +f 
 58.4432 +S 
 58.4433 +n
 58.4434 +vmrs
 58.4435 +1967.1 2084.9 m
 58.4436 +1968.3 2084.4 1969.7 2083.8 1970.9 2083.2 C
 58.4437 +1969.7 2083.8 1968.3 2084.4 1967.1 2084.9 C
 58.4438 +[0 0.4 1 0]  vc
 58.4439 +f 
 58.4440 +0.4 w
 58.4441 +2 J
 58.4442 +2 M
 58.4443 +S 
 58.4444 +n
 58.4445 +1982.7 2080.6 m
 58.4446 +1981.5 2079.5 1980.5 2078.4 1979.3 2077.2 C
 58.4447 +1980.5 2078.4 1981.5 2079.5 1982.7 2080.6 C
 58.4448 +f 
 58.4449 +S 
 58.4450 +n
 58.4451 +1988 2078.2 m
 58.4452 +1989.4 2077.5 1990.8 2076.8 1992.3 2076 C
 58.4453 +1990.8 2076.8 1989.4 2077.5 1988 2078.2 C
 58.4454 +[0 0.2 1 0]  vc
 58.4455 +f 
 58.4456 +S 
 58.4457 +n
 58.4458 +1988.7 2078.2 m
 58.4459 +1991.1 2076.4 1991.8 2076.4 1988.7 2078.2 C
 58.4460 +[0 0.4 1 0]  vc
 58.4461 +f 
 58.4462 +S 
 58.4463 +n
 58.4464 +1976.2 2063.8 m
 58.4465 +1978.6 2062.2 1976 2063.3 1976 2064.5 C
 58.4466 +1976.1 2067.8 1975.5 2071.4 1976.4 2074.4 C
 58.4467 +1975.7 2071.1 1975.9 2067.2 1976.2 2063.8 C
 58.4468 +f 
 58.4469 +S 
 58.4470 +n
 58.4471 +1996.8 2074.1 m
 58.4472 +1998.3 2073.4 1999.7 2072.7 2001.2 2072 C
 58.4473 +1999.7 2072.7 1998.3 2073.4 1996.8 2074.1 C
 58.4474 +f 
 58.4475 +S 
 58.4476 +n
 58.4477 +2001.6 2071.7 m
 58.4478 +2002.9 2071.2 2004.2 2070.6 2005.5 2070 C
 58.4479 +2004.2 2070.6 2002.9 2071.2 2001.6 2071.7 C
 58.4480 +f 
 58.4481 +S 
 58.4482 +n
 58.4483 +1981.5 2060.7 m
 58.4484 +1980.2 2061.2 1978.9 2061.5 1977.9 2062.6 C
 58.4485 +1978.9 2061.5 1980.2 2061.2 1981.5 2060.7 C
 58.4486 +f 
 58.4487 +S 
 58.4488 +n
 58.4489 +1982 2060.4 m
 58.4490 +1982.7 2060.1 1983.6 2059.8 1984.4 2059.5 C
 58.4491 +1983.6 2059.8 1982.7 2060.1 1982 2060.4 C
 58.4492 +f 
 58.4493 +S 
 58.4494 +n
 58.4495 +1952 2051.3 m
 58.4496 +1950.8 2050.2 1949.7 2049.1 1948.6 2048 C
 58.4497 +1949.7 2049.1 1950.8 2050.2 1952 2051.3 C
 58.4498 +f 
 58.4499 +S 
 58.4500 +n
 58.4501 +vmrs
 58.4502 +1977.4 2047.7 m
 58.4503 +1975.8 2047.8 1974.8 2046.1 1974.5 2045.3 C
 58.4504 +1974.9 2044.4 1976 2044.5 1976.7 2044.8 C
 58.4505 +1977.9 2045 1977 2048.4 1979.3 2047.5 C
 58.4506 +1979.9 2047.5 1980.8 2048.6 1979.8 2049.2 C
 58.4507 +1978.2 2050.4 1980.8 2049.5 1980.3 2049.4 C
 58.4508 +1981.4 2049.8 1980.3 2048.4 1980.3 2048 C
 58.4509 +1979.8 2047.5 1979 2046.6 1978.4 2046.5 C
 58.4510 +1977.3 2045.9 1977.2 2043.3 1975.2 2044.6 C
 58.4511 +1974.7 2045.3 1973.6 2045 1973.3 2045.8 C
 58.4512 +1975 2046.3 1975.8 2049.8 1978.1 2049.4 C
 58.4513 +1978.4 2050.9 1978.7 2048.5 1977.9 2049.2 C
 58.4514 +1977.7 2048.7 1977.2 2047.8 1977.4 2047.7 C
 58.4515 +[0 0.5 0.5 0.2]  vc
 58.4516 +f 
 58.4517 +0.4 w
 58.4518 +2 J
 58.4519 +2 M
 58.4520 +S 
 58.4521 +n
 58.4522 +1957.2 2048.9 m
 58.4523 +1958.7 2048.2 1960.1 2047.5 1961.6 2046.8 C
 58.4524 +1960.1 2047.5 1958.7 2048.2 1957.2 2048.9 C
 58.4525 +[0 0.2 1 0]  vc
 58.4526 +f 
 58.4527 +S 
 58.4528 +n
 58.4529 +1958 2048.9 m
 58.4530 +1960.4 2047.1 1961.1 2047.1 1958 2048.9 C
 58.4531 +[0 0.4 1 0]  vc
 58.4532 +f 
 58.4533 +S 
 58.4534 +n
 58.4535 +1966.1 2044.8 m
 58.4536 +1967.6 2044.1 1969 2043.4 1970.4 2042.7 C
 58.4537 +1969 2043.4 1967.6 2044.1 1966.1 2044.8 C
 58.4538 +f 
 58.4539 +S 
 58.4540 +n
 58.4541 +1970.9 2042.4 m
 58.4542 +1972.2 2041.9 1973.5 2041.3 1974.8 2040.8 C
 58.4543 +1973.5 2041.3 1972.2 2041.9 1970.9 2042.4 C
 58.4544 +f 
 58.4545 +S 
 58.4546 +n
 58.4547 +2012 2034.5 m
 58.4548 +2010.4 2034.6 2009.3 2032.9 2009.1 2032.1 C
 58.4549 +2009.4 2031 2010.3 2031.3 2011.2 2031.6 C
 58.4550 +2012.5 2031.8 2011.6 2035.2 2013.9 2034.3 C
 58.4551 +2014.4 2034.3 2015.4 2035.4 2014.4 2036 C
 58.4552 +2012.7 2037.2 2015.3 2036.3 2014.8 2036.2 C
 58.4553 +2015.9 2036.6 2014.8 2035.2 2014.8 2034.8 C
 58.4554 +2014.4 2034.3 2013.6 2033.4 2012.9 2033.3 C
 58.4555 +2011.5 2031 2009.3 2029.4 2007.4 2028 C
 58.4556 +2007.5 2026.5 2007.3 2027.9 2007.2 2028.3 C
 58.4557 +2007.9 2028.8 2008.7 2029.1 2009.3 2030 C
 58.4558 +2009.6 2030.7 2009 2031.9 2008.4 2031.6 C
 58.4559 +2006.7 2031 2007.7 2028 2005 2028.8 C
 58.4560 +2004.8 2028.6 2004.3 2028.2 2003.8 2028.3 C
 58.4561 +2006.6 2030.4 2008.9 2033.7 2011.2 2036.2 C
 58.4562 +2011.8 2036.4 2012.9 2035.8 2012.9 2036.7 C
 58.4563 +2012.7 2036.1 2011.8 2035 2012 2034.5 C
 58.4564 +[0 0.5 0.5 0.2]  vc
 58.4565 +f 
 58.4566 +S 
 58.4567 +n
 58.4568 +1981.2 2005.2 m
 58.4569 +1979.7 2005.3 1978.6 2003.6 1978.4 2002.8 C
 58.4570 +1978.7 2001.8 1979.6 2002.1 1980.5 2002.4 C
 58.4571 +1981.8 2002.5 1980.9 2005.9 1983.2 2005 C
 58.4572 +1983.7 2005.1 1984.7 2006.1 1983.6 2006.7 C
 58.4573 +1982 2007.9 1984.6 2007 1984.1 2006.9 C
 58.4574 +1985.2 2007.3 1984.1 2006 1984.1 2005.5 C
 58.4575 +1983.6 2005 1982.9 2004.1 1982.2 2004 C
 58.4576 +1980.8 2001.7 1978.6 2000.1 1976.7 1998.8 C
 58.4577 +1976.7 1997.2 1976.6 1998.6 1976.4 1999 C
 58.4578 +1977.2 1999.5 1978 1999.8 1978.6 2000.7 C
 58.4579 +1978.8 2001.5 1978.3 2002.7 1977.6 2002.4 C
 58.4580 +1976 2001.8 1977 1998.7 1974.3 1999.5 C
 58.4581 +1974.1 1999.3 1973.6 1998.9 1973.1 1999 C
 58.4582 +1975.8 2001.2 1978.2 2004.4 1980.5 2006.9 C
 58.4583 +1981.1 2007.1 1982.1 2006.5 1982.2 2007.4 C
 58.4584 +1982 2006.8 1981.1 2005.7 1981.2 2005.2 C
 58.4585 +f 
 58.4586 +S 
 58.4587 +n
 58.4588 +1966.8 1976.4 m
 58.4589 +1969.4 1973 1974.4 1974.6 1976.2 1970.4 C
 58.4590 +1972.7 1974 1968 1975.1 1964 1977.4 C
 58.4591 +1960.9 1979.9 1957.1 1981.8 1953.9 1982.7 C
 58.4592 +1958.4 1981.1 1962.6 1978.8 1966.8 1976.4 C
 58.4593 +[0.18 0.18 0 0.78]  vc
 58.4594 +f 
 58.4595 +S 
 58.4596 +n
 58.4597 +1948.4 2093.8 m
 58.4598 +1949.8 2093.1 1951.2 2092.5 1952.7 2091.9 C
 58.4599 +1951.2 2092.5 1949.8 2093.1 1948.4 2093.8 C
 58.4600 +[0 0.2 1 0]  vc
 58.4601 +f 
 58.4602 +S 
 58.4603 +n
 58.4604 +1948.1 2093.6 m
 58.4605 +1947.3 2092.8 1946.5 2091.9 1945.7 2091.2 C
 58.4606 +1946.5 2091.9 1947.3 2092.8 1948.1 2093.6 C
 58.4607 +f 
 58.4608 +S 
 58.4609 +n
 58.4610 +vmrs
 58.4611 +1942.1 2087.8 m
 58.4612 +1943.5 2088.4 1944.3 2089.5 1945.2 2090.7 C
 58.4613 +1944.8 2089.3 1943.3 2088.3 1942.1 2087.8 C
 58.4614 +[0 0.2 1 0]  vc
 58.4615 +f 
 58.4616 +0.4 w
 58.4617 +2 J
 58.4618 +2 M
 58.4619 +S 
 58.4620 +n
 58.4621 +1933.5 2078.4 m
 58.4622 +1933.5 2078 1933.2 2079 1933.7 2079.4 C
 58.4623 +1935 2080.4 1936.2 2081.3 1937.1 2082.8 C
 58.4624 +1936.7 2080.7 1933.7 2080.7 1933.5 2078.4 C
 58.4625 +f 
 58.4626 +S 
 58.4627 +n
 58.4628 +1982.9 2080.6 m
 58.4629 +1984.4 2079.9 1985.8 2079.3 1987.2 2078.7 C
 58.4630 +1985.8 2079.3 1984.4 2079.9 1982.9 2080.6 C
 58.4631 +f 
 58.4632 +S 
 58.4633 +n
 58.4634 +1982.7 2080.4 m
 58.4635 +1981.9 2079.6 1981.1 2078.7 1980.3 2078 C
 58.4636 +1981.1 2078.7 1981.9 2079.6 1982.7 2080.4 C
 58.4637 +f 
 58.4638 +S 
 58.4639 +n
 58.4640 +1977.4 2075.1 m
 58.4641 +1977.9 2075.3 1979.1 2076.4 1979.8 2077.5 C
 58.4642 +1979 2076.8 1978.7 2075.1 1977.4 2075.1 C
 58.4643 +f 
 58.4644 +S 
 58.4645 +n
 58.4646 +1952.2 2051.3 m
 58.4647 +1953.6 2050.7 1955.1 2050.1 1956.5 2049.4 C
 58.4648 +1955.1 2050.1 1953.6 2050.7 1952.2 2051.3 C
 58.4649 +f 
 58.4650 +S 
 58.4651 +n
 58.4652 +1952 2051.1 m
 58.4653 +1951.2 2050.3 1950.3 2049.5 1949.6 2048.7 C
 58.4654 +1950.3 2049.5 1951.2 2050.3 1952 2051.1 C
 58.4655 +f 
 58.4656 +S 
 58.4657 +n
 58.4658 +1946 2045.3 m
 58.4659 +1947.3 2045.9 1948.1 2047 1949.1 2048.2 C
 58.4660 +1948.6 2046.8 1947.1 2045.8 1946 2045.3 C
 58.4661 +f 
 58.4662 +S 
 58.4663 +n
 58.4664 +1937.3 2036 m
 58.4665 +1937.4 2035.5 1937 2036.5 1937.6 2036.9 C
 58.4666 +1938.8 2037.9 1940.1 2038.8 1940.9 2040.3 C
 58.4667 +1940.6 2038.2 1937.6 2038.2 1937.3 2036 C
 58.4668 +f 
 58.4669 +S 
 58.4670 +n
 58.4671 +1935.2 2073.2 m
 58.4672 +1936.4 2069.9 1935.8 2061.8 1935.6 2056.4 C
 58.4673 +1935.8 2055.9 1936.3 2055.7 1936.1 2055.2 C
 58.4674 +1935.7 2054.7 1935 2055 1934.4 2054.9 C
 58.4675 +1934.4 2061.5 1934.4 2068.7 1934.4 2074.6 C
 58.4676 +1935.7 2075.1 1936 2073.7 1935.2 2073.2 C
 58.4677 +[0 0.01 1 0]  vc
 58.4678 +f 
 58.4679 +S 
 58.4680 +n
 58.4681 +vmrs
 58.4682 +1939 2030.7 m
 58.4683 +1940.3 2027.4 1939.7 2019.3 1939.5 2013.9 C
 58.4684 +1939.7 2013.5 1940.1 2013.2 1940 2012.7 C
 58.4685 +1939.5 2012.3 1938.8 2012.5 1938.3 2012.4 C
 58.4686 +1938.3 2019 1938.3 2026.2 1938.3 2032.1 C
 58.4687 +1939.5 2032.7 1939.8 2031.2 1939 2030.7 C
 58.4688 +[0 0.01 1 0]  vc
 58.4689 +f 
 58.4690 +0.4 w
 58.4691 +2 J
 58.4692 +2 M
 58.4693 +S 
 58.4694 +n
 58.4695 +1975.2 2077.2 m
 58.4696 +1975.3 2077.3 1975.4 2077.4 1975.5 2077.5 C
 58.4697 +1974.7 2073.2 1974.9 2067.5 1975.2 2063.6 C
 58.4698 +1975.4 2064 1974.6 2063.9 1974.8 2064.3 C
 58.4699 +1974.9 2069.9 1974.3 2076.5 1975.2 2081.1 C
 58.4700 +1974.9 2079.9 1974.9 2078.4 1975.2 2077.2 C
 58.4701 +[0.92 0.92 0 0.67]  vc
 58.4702 +f 
 58.4703 +S 
 58.4704 +n
 58.4705 +1930.8 2067.4 m
 58.4706 +1931.5 2070.1 1929.6 2072.1 1930.6 2074.6 C
 58.4707 +1931 2072.6 1930.8 2069.8 1930.8 2067.4 C
 58.4708 +f 
 58.4709 +S 
 58.4710 +n
 58.4711 +2010 2050.1 m
 58.4712 +2009.8 2050.5 2009.5 2050.9 2009.3 2051.1 C
 58.4713 +2009.5 2056.7 2008.9 2063.3 2009.8 2067.9 C
 58.4714 +2009.5 2062.1 2009.3 2054.7 2010 2050.1 C
 58.4715 +f 
 58.4716 +S 
 58.4717 +n
 58.4718 +1930.1 2060.9 m
 58.4719 +1929.3 2057.1 1930.7 2054.8 1929.9 2051.3 C
 58.4720 +1930.2 2050.2 1931.1 2049.6 1931.8 2049.2 C
 58.4721 +1931.4 2049.6 1930.4 2049.5 1930.1 2050.1 C
 58.4722 +1928.4 2054.8 1933.4 2063.5 1925.3 2064.3 C
 58.4723 +1927.2 2063.9 1928.5 2062.1 1930.1 2060.9 C
 58.4724 +[0.07 0.06 0 0.58]  vc
 58.4725 +f 
 58.4726 +S 
 58.4727 +n
 58.4728 +1929.6 2061.2 m
 58.4729 +1929.6 2057.6 1929.6 2054.1 1929.6 2050.6 C
 58.4730 +1930 2049.9 1930.5 2049.4 1931.1 2049.2 C
 58.4731 +1930 2048.6 1930.5 2050.2 1929.4 2049.6 C
 58.4732 +1928 2054.4 1932.8 2063 1925.3 2064 C
 58.4733 +1926.9 2063.3 1928.3 2062.4 1929.6 2061.2 C
 58.4734 +[0.4 0.4 0 0]  vc
 58.4735 +f 
 58.4736 +S 
 58.4737 +n
 58.4738 +1930.8 2061.6 m
 58.4739 +1930.5 2058 1931.6 2054 1930.8 2051.3 C
 58.4740 +1930.3 2054.5 1930.9 2058.5 1930.4 2061.9 C
 58.4741 +1930.5 2061.2 1931 2062.2 1930.8 2061.6 C
 58.4742 +[0.92 0.92 0 0.67]  vc
 58.4743 +f 
 58.4744 +S 
 58.4745 +n
 58.4746 +1941.2 2045.1 m
 58.4747 +1939.7 2042.6 1937.3 2041.2 1935.4 2039.3 C
 58.4748 +1934.2 2040 1933.7 2036.4 1934 2039.3 C
 58.4749 +1934.9 2040.1 1936.1 2039.9 1936.8 2040.8 C
 58.4750 +1935.3 2044.2 1942.3 2041.7 1939.5 2046 C
 58.4751 +1937.1 2048.5 1940.5 2045.6 1941.2 2045.1 C
 58.4752 +f 
 58.4753 +S 
 58.4754 +n
 58.4755 +1910 2045.8 m
 58.4756 +1910 2039.4 1910 2033 1910 2026.6 C
 58.4757 +1910 2033 1910 2039.4 1910 2045.8 C
 58.4758 +f 
 58.4759 +S 
 58.4760 +n
 58.4761 +1978.8 2022.3 m
 58.4762 +1979.1 2021.7 1979.4 2020.4 1978.6 2021.6 C
 58.4763 +1978.6 2026.9 1978.6 2033 1978.6 2037.6 C
 58.4764 +1979.2 2037 1979.1 2038.2 1979.1 2038.6 C
 58.4765 +1978.7 2033.6 1978.9 2026.8 1978.8 2022.3 C
 58.4766 +f 
 58.4767 +S 
 58.4768 +n
 58.4769 +vmrs
 58.4770 +2026.1 2041.2 m
 58.4771 +2026.1 2034.8 2026.1 2028.3 2026.1 2021.8 C
 58.4772 +2026.1 2028.5 2026.3 2035.4 2025.9 2042 C
 58.4773 +2024.4 2042.9 2022.9 2044.1 2021.3 2044.8 C
 58.4774 +2023.1 2044 2025.1 2042.8 2026.1 2041.2 C
 58.4775 +[0.07 0.06 0 0.58]  vc
 58.4776 +f 
 58.4777 +0.4 w
 58.4778 +2 J
 58.4779 +2 M
 58.4780 +S 
 58.4781 +n
 58.4782 +2026.4 2021.8 m
 58.4783 +2026.3 2028.5 2026.5 2035.4 2026.1 2042 C
 58.4784 +2025.6 2042.8 2024.7 2042.7 2024.2 2043.4 C
 58.4785 +2024.7 2042.7 2025.5 2042.7 2026.1 2042.2 C
 58.4786 +2026.5 2035.5 2026.3 2027.9 2026.4 2021.8 C
 58.4787 +[0.4 0.4 0 0]  vc
 58.4788 +f 
 58.4789 +S 
 58.4790 +n
 58.4791 +2025.6 2038.4 m
 58.4792 +2025.6 2033 2025.6 2027.6 2025.6 2022.3 C
 58.4793 +2025.6 2027.6 2025.6 2033 2025.6 2038.4 C
 58.4794 +[0.92 0.92 0 0.67]  vc
 58.4795 +f 
 58.4796 +S 
 58.4797 +n
 58.4798 +1934 2023.5 m
 58.4799 +1934 2024.7 1933.8 2026 1934.2 2027.1 C
 58.4800 +1934 2025.5 1934.7 2024.6 1934 2023.5 C
 58.4801 +f 
 58.4802 +S 
 58.4803 +n
 58.4804 +1928.2 2023.5 m
 58.4805 +1928 2024.6 1927.4 2023.1 1926.8 2023.2 C
 58.4806 +1926.2 2021 1921.4 2019.3 1923.2 2018 C
 58.4807 +1922.7 2016.5 1923.2 2019.3 1922.2 2018.2 C
 58.4808 +1924.4 2020.4 1926.2 2023.3 1928.9 2024.9 C
 58.4809 +1927.9 2024.2 1929.8 2023.5 1928.2 2023.5 C
 58.4810 +[0.18 0.18 0 0.78]  vc
 58.4811 +f 
 58.4812 +S 
 58.4813 +n
 58.4814 +1934 2019.2 m
 58.4815 +1932 2019.6 1930.8 2022.6 1928.7 2021.8 C
 58.4816 +1924.5 2016.5 1918.2 2011.8 1914 2006.7 C
 58.4817 +1914 2005.7 1914 2004.6 1914 2003.6 C
 58.4818 +1913.6 2004.3 1913.9 2005.8 1913.8 2006.9 C
 58.4819 +1919 2012.4 1924.1 2016.5 1929.2 2022.3 C
 58.4820 +1931 2021.7 1932.2 2019.8 1934 2019.2 C
 58.4821 +f 
 58.4822 +S 
 58.4823 +n
 58.4824 +1928.7 2024.9 m
 58.4825 +1926.3 2022.7 1924.1 2020.4 1921.7 2018.2 C
 58.4826 +1924.1 2020.4 1926.3 2022.7 1928.7 2024.9 C
 58.4827 +[0.65 0.65 0 0.42]  vc
 58.4828 +f 
 58.4829 +S 
 58.4830 +n
 58.4831 +1914.3 2006.7 m
 58.4832 +1918.7 2011.8 1924.5 2016.4 1928.9 2021.6 C
 58.4833 +1924.2 2016.1 1919 2012.1 1914.3 2006.7 C
 58.4834 +[0.07 0.06 0 0.58]  vc
 58.4835 +f 
 58.4836 +S 
 58.4837 +n
 58.4838 +1924.8 2020.8 m
 58.4839 +1921.2 2016.9 1925.6 2022.5 1926 2021.1 C
 58.4840 +1924.2 2021 1926.7 2019.6 1924.8 2020.8 C
 58.4841 +[0.92 0.92 0 0.67]  vc
 58.4842 +f 
 58.4843 +S 
 58.4844 +n
 58.4845 +1934 2018.4 m
 58.4846 +1933.2 2014.7 1934.5 2012.3 1933.7 2008.8 C
 58.4847 +1934 2007.8 1935 2007.2 1935.6 2006.7 C
 58.4848 +1935.3 2007.1 1934.3 2007 1934 2007.6 C
 58.4849 +1932.2 2012.3 1937.2 2021 1929.2 2021.8 C
 58.4850 +1931.1 2021.4 1932.3 2019.6 1934 2018.4 C
 58.4851 +[0.07 0.06 0 0.58]  vc
 58.4852 +f 
 58.4853 +S 
 58.4854 +n
 58.4855 +vmrs
 58.4856 +1933.5 2018.7 m
 58.4857 +1933.5 2015.1 1933.5 2011.7 1933.5 2008.1 C
 58.4858 +1933.8 2007.4 1934.3 2006.9 1934.9 2006.7 C
 58.4859 +1933.8 2006.1 1934.3 2007.7 1933.2 2007.2 C
 58.4860 +1931.9 2012 1936.7 2020.5 1929.2 2021.6 C
 58.4861 +1930.7 2020.8 1932.2 2019.9 1933.5 2018.7 C
 58.4862 +[0.4 0.4 0 0]  vc
 58.4863 +f 
 58.4864 +0.4 w
 58.4865 +2 J
 58.4866 +2 M
 58.4867 +S 
 58.4868 +n
 58.4869 +1934.7 2019.2 m
 58.4870 +1934.3 2015.6 1935.4 2011.5 1934.7 2008.8 C
 58.4871 +1934.1 2012 1934.7 2016 1934.2 2019.4 C
 58.4872 +1934.4 2018.7 1934.8 2019.8 1934.7 2019.2 C
 58.4873 +[0.92 0.92 0 0.67]  vc
 58.4874 +f 
 58.4875 +S 
 58.4876 +n
 58.4877 +1917.6 2013.6 m
 58.4878 +1917.8 2011.1 1916.8 2014.2 1917.2 2012.2 C
 58.4879 +1916.3 2012.9 1914.8 2011.8 1914.3 2010.8 C
 58.4880 +1914.2 2010.5 1914.4 2010.4 1914.5 2010.3 C
 58.4881 +1913.9 2008.8 1913.9 2011.9 1914.3 2012 C
 58.4882 +1916.3 2012 1917.6 2013.6 1916.7 2015.6 C
 58.4883 +1913.7 2017.4 1919.6 2014.8 1917.6 2013.6 C
 58.4884 +f 
 58.4885 +S 
 58.4886 +n
 58.4887 +1887.2 2015.3 m
 58.4888 +1887.2 2008.9 1887.2 2002.5 1887.2 1996.1 C
 58.4889 +1887.2 2002.5 1887.2 2008.9 1887.2 2015.3 C
 58.4890 +f 
 58.4891 +S 
 58.4892 +n
 58.4893 +1916.7 2014.4 m
 58.4894 +1917 2012.1 1913 2013 1913.8 2010.8 C
 58.4895 +1912.1 2009.8 1910.9 2009.4 1910.7 2007.9 C
 58.4896 +1910.4 2010.6 1913.4 2010.4 1914 2012.4 C
 58.4897 +1914.9 2012.8 1916.6 2012.9 1916.4 2014.4 C
 58.4898 +1916.9 2015.1 1914.5 2016.6 1916.2 2015.8 C
 58.4899 +1916.4 2015.3 1916.7 2015 1916.7 2014.4 C
 58.4900 +[0.65 0.65 0 0.42]  vc
 58.4901 +f 
 58.4902 +S 
 58.4903 +n
 58.4904 +1914 2009.3 m
 58.4905 +1912.8 2010.9 1909.6 2005.3 1911.9 2009.8 C
 58.4906 +1912.3 2009.6 1913.6 2010.2 1914 2009.3 C
 58.4907 +[0.92 0.92 0 0.67]  vc
 58.4908 +f 
 58.4909 +S 
 58.4910 +n
 58.4911 +1951.2 1998.8 m
 58.4912 +1949 1996.4 1951.5 1994 1950.3 1991.8 C
 58.4913 +1949.1 1989.1 1954 1982.7 1948.8 1981.2 C
 58.4914 +1949.2 1981.5 1951 1982.4 1950.8 1983.6 C
 58.4915 +1951.9 1988.6 1947.1 1986.5 1948.1 1990.4 C
 58.4916 +1948.5 1990.3 1948.7 1990.7 1948.6 1991.1 C
 58.4917 +1949 1992.5 1947.3 1991.9 1948.1 1992.5 C
 58.4918 +1947.1 1992.7 1945.7 1993.5 1945.2 1994.7 C
 58.4919 +1944.5 1996.8 1947.7 2000.5 1943.8 2001.4 C
 58.4920 +1943.4 2002 1943.7 2004 1942.4 2004.5 C
 58.4921 +1945.2 2002.2 1948.9 2000.9 1951.2 1998.8 C
 58.4922 +f 
 58.4923 +S 
 58.4924 +n
 58.4925 +1994.9 1993 m
 58.4926 +1995.1 1996.5 1994.5 2000.3 1995.4 2003.6 C
 58.4927 +1994.5 2000.3 1995.1 1996.5 1994.9 1993 C
 58.4928 +f 
 58.4929 +S 
 58.4930 +n
 58.4931 +1913.8 2003.3 m
 58.4932 +1913.8 1996.9 1913.8 1990.5 1913.8 1984.1 C
 58.4933 +1913.8 1990.5 1913.8 1996.9 1913.8 2003.3 C
 58.4934 +f 
 58.4935 +S 
 58.4936 +n
 58.4937 +1941.9 1998 m
 58.4938 +1940.5 1997.3 1940.7 1999.4 1940.7 2000 C
 58.4939 +1942.8 2001.3 1942.6 1998.8 1941.9 1998 C
 58.4940 +[0 0 0 0]  vc
 58.4941 +f 
 58.4942 +S 
 58.4943 +n
 58.4944 +vmrs
 58.4945 +1942.1 1999.2 m
 58.4946 +1942.2 1998.9 1941.8 1998.8 1941.6 1998.5 C
 58.4947 +1940.4 1998 1940.7 1999.7 1940.7 2000 C
 58.4948 +1941.6 2000.3 1942.6 2000.4 1942.1 1999.2 C
 58.4949 +[0.92 0.92 0 0.67]  vc
 58.4950 +f 
 58.4951 +0.4 w
 58.4952 +2 J
 58.4953 +2 M
 58.4954 +S 
 58.4955 +n
 58.4956 +1940 1997.1 m
 58.4957 +1939.8 1996 1939.7 1995.9 1939.2 1995.2 C
 58.4958 +1939.1 1995.3 1938.5 1997.9 1937.8 1996.4 C
 58.4959 +1938 1997.3 1939.4 1998.6 1940 1997.1 C
 58.4960 +f 
 58.4961 +S 
 58.4962 +n
 58.4963 +1911.2 1995.9 m
 58.4964 +1911.2 1991.6 1911.3 1987.2 1911.4 1982.9 C
 58.4965 +1911.3 1987.2 1911.2 1991.6 1911.2 1995.9 C
 58.4966 +f 
 58.4967 +S 
 58.4968 +n
 58.4969 +1947.2 1979.1 m
 58.4970 +1945.1 1978.8 1944.6 1975.7 1942.4 1975 C
 58.4971 +1940.5 1972.6 1942.2 1973.7 1942.4 1975.7 C
 58.4972 +1945.8 1975.5 1944.2 1979.8 1947.6 1979.6 C
 58.4973 +1948.3 1982.3 1948.5 1980 1947.2 1979.1 C
 58.4974 +f 
 58.4975 +S 
 58.4976 +n
 58.4977 +1939.5 1973.3 m
 58.4978 +1940.1 1972.6 1939.8 1974.2 1940.2 1973.1 C
 58.4979 +1939.1 1972.8 1938.8 1968.5 1935.9 1969.7 C
 58.4980 +1937.4 1969.2 1938.5 1970.6 1939 1971.4 C
 58.4981 +1939.2 1972.7 1938.6 1973.9 1939.5 1973.3 C
 58.4982 +f 
 58.4983 +S 
 58.4984 +n
 58.4985 +1975.2 2073.2 m
 58.4986 +1975.2 2070.2 1975.2 2067.2 1975.2 2064.3 C
 58.4987 +1975.2 2067.2 1975.2 2070.2 1975.2 2073.2 C
 58.4988 +[0.18 0.18 0 0.78]  vc
 58.4989 +f 
 58.4990 +S 
 58.4991 +n
 58.4992 +1929.9 2065.7 m
 58.4993 +1928.1 2065.6 1926 2068.8 1924.1 2066.9 C
 58.4994 +1918.1 2060.9 1912.9 2055.7 1907.1 2049.9 C
 58.4995 +1906.7 2047.1 1906.9 2043.9 1906.8 2041 C
 58.4996 +1906.8 2043.9 1906.8 2046.8 1906.8 2049.6 C
 58.4997 +1913.2 2055.5 1918.7 2061.9 1925.1 2067.6 C
 58.4998 +1927.1 2067.9 1928.6 2064.4 1930.1 2066.2 C
 58.4999 +1929.7 2070.3 1929.9 2074.7 1929.9 2078.9 C
 58.5000 +1929.6 2074.4 1930.5 2070.1 1929.9 2065.7 C
 58.5001 +[0.07 0.06 0 0.58]  vc
 58.5002 +f 
 58.5003 +S 
 58.5004 +n
 58.5005 +1930.1 2061.6 m
 58.5006 +1928.1 2062.1 1927 2065.1 1924.8 2064.3 C
 58.5007 +1920.7 2058.9 1914.4 2054.3 1910.2 2049.2 C
 58.5008 +1910.2 2048.1 1910.2 2047.1 1910.2 2046 C
 58.5009 +1909.8 2046.8 1910 2048.3 1910 2049.4 C
 58.5010 +1915.1 2054.9 1920.3 2059 1925.3 2064.8 C
 58.5011 +1927.1 2064.2 1928.4 2062.3 1930.1 2061.6 C
 58.5012 +[0.18 0.18 0 0.78]  vc
 58.5013 +f 
 58.5014 +S 
 58.5015 +n
 58.5016 +1932 2049.9 m
 58.5017 +1932.3 2050.3 1932 2050.4 1932.8 2050.4 C
 58.5018 +1932 2050.4 1932.2 2049.2 1931.3 2049.6 C
 58.5019 +1931.4 2050.5 1930.3 2050.4 1930.4 2051.3 C
 58.5020 +1931.1 2051.1 1930.7 2049.4 1932 2049.9 C
 58.5021 +f 
 58.5022 +S 
 58.5023 +n
 58.5024 +1938.3 2046 m
 58.5025 +1936.3 2046.8 1935.2 2047.2 1934.2 2048.9 C
 58.5026 +1935.3 2047.7 1936.8 2046.2 1938.3 2046 C
 58.5027 +[0.4 0.4 0 0]  vc
 58.5028 +f 
 58.5029 +S 
 58.5030 +n
 58.5031 +vmrs
 58.5032 +1938.3 2047 m
 58.5033 +1937.9 2046.9 1936.6 2047.1 1936.1 2048 C
 58.5034 +1936.5 2047.5 1937.3 2046.7 1938.3 2047 C
 58.5035 +[0.18 0.18 0 0.78]  vc
 58.5036 +f 
 58.5037 +0.4 w
 58.5038 +2 J
 58.5039 +2 M
 58.5040 +S 
 58.5041 +n
 58.5042 +1910.2 2043.2 m
 58.5043 +1910.1 2037.5 1910 2031.8 1910 2026.1 C
 58.5044 +1910 2031.8 1910.1 2037.5 1910.2 2043.2 C
 58.5045 +f 
 58.5046 +S 
 58.5047 +n
 58.5048 +1933.5 2032.1 m
 58.5049 +1933.7 2035.2 1932.8 2035.8 1933.7 2038.6 C
 58.5050 +1933.3 2036.6 1934.6 2018 1933.5 2032.1 C
 58.5051 +f 
 58.5052 +S 
 58.5053 +n
 58.5054 +1907.3 2021.8 m
 58.5055 +1906.6 2025.9 1909.4 2032.6 1903.2 2034 C
 58.5056 +1902.8 2034.1 1902.4 2033.9 1902 2033.8 C
 58.5057 +1897.9 2028.5 1891.6 2023.8 1887.4 2018.7 C
 58.5058 +1887.4 2017.7 1887.4 2016.6 1887.4 2015.6 C
 58.5059 +1887 2016.3 1887.2 2017.8 1887.2 2018.9 C
 58.5060 +1892.3 2024.4 1897.5 2028.5 1902.5 2034.3 C
 58.5061 +1904.3 2033.6 1905.7 2032 1907.3 2030.9 C
 58.5062 +1907.3 2027.9 1907.3 2024.9 1907.3 2021.8 C
 58.5063 +f 
 58.5064 +S 
 58.5065 +n
 58.5066 +1933.7 2023.2 m
 58.5067 +1932 2021.7 1931.1 2024.9 1929.4 2024.9 C
 58.5068 +1931.2 2024.7 1932.4 2021.5 1933.7 2023.2 C
 58.5069 +f 
 58.5070 +S 
 58.5071 +n
 58.5072 +1989.2 2024.4 m
 58.5073 +1987.4 2023.7 1985.8 2022.2 1985.1 2020.4 C
 58.5074 +1984.6 2020.1 1986 2018.9 1985.1 2019.2 C
 58.5075 +1985.6 2020.8 1984.1 2019.4 1984.6 2021.1 C
 58.5076 +1986.3 2022.3 1988.1 2025.3 1989.2 2024.4 C
 58.5077 +f 
 58.5078 +S 
 58.5079 +n
 58.5080 +1904.4 2031.9 m
 58.5081 +1903 2029.7 1905.3 2027.7 1904.2 2025.9 C
 58.5082 +1904.5 2025 1903.7 2023 1904 2021.3 C
 58.5083 +1904 2022.3 1903.2 2022 1902.5 2022 C
 58.5084 +1901.3 2022.3 1902.2 2020.1 1901.6 2019.6 C
 58.5085 +1902.5 2019.8 1902.6 2018.3 1903.5 2018.9 C
 58.5086 +1903.7 2021.8 1905.6 2016.8 1905.6 2020.6 C
 58.5087 +1905.9 2020 1906.3 2020.8 1906.1 2021.1 C
 58.5088 +1905.8 2022.7 1906.7 2020.4 1906.4 2019.9 C
 58.5089 +1906.4 2018.5 1908.2 2017.8 1906.8 2016.5 C
 58.5090 +1906.9 2015.7 1907.7 2017.1 1907.1 2016.3 C
 58.5091 +1908.5 2015.8 1910.3 2015.1 1911.6 2016 C
 58.5092 +1912.2 2016.2 1911.9 2018 1911.6 2018 C
 58.5093 +1914.5 2017.1 1910.4 2013.6 1913.3 2013.4 C
 58.5094 +1912.4 2011.3 1910.5 2011.8 1909.5 2010 C
 58.5095 +1910 2010.5 1909 2010.8 1908.8 2011.2 C
 58.5096 +1907.5 2009.9 1906.1 2011.7 1904.9 2011.5 C
 58.5097 +1904.7 2010.9 1904.3 2010.5 1904.4 2009.8 C
 58.5098 +1905 2010.2 1904.6 2008.6 1905.4 2008.1 C
 58.5099 +1906.6 2007.5 1907.7 2008.4 1908.5 2007.4 C
 58.5100 +1908.9 2008.5 1909.7 2008.1 1909 2007.2 C
 58.5101 +1908.1 2006.5 1905.9 2007.3 1905.4 2007.4 C
 58.5102 +1903.9 2007.3 1905.2 2008.5 1904.2 2008.4 C
 58.5103 +1904.6 2009.9 1902.8 2010.3 1902.3 2010.5 C
 58.5104 +1901.5 2009.9 1900.4 2010 1899.4 2010 C
 58.5105 +1898.6 2011.2 1898.2 2013.4 1896.5 2013.4 C
 58.5106 +1896 2012.9 1894.4 2012.9 1893.6 2012.9 C
 58.5107 +1893.1 2013.9 1892.9 2015.5 1891.5 2016 C
 58.5108 +1890.3 2016.1 1889.2 2014 1888.6 2015.8 C
 58.5109 +1890 2016 1891 2016.9 1892.9 2016.5 C
 58.5110 +1894.1 2017.2 1892.8 2018.3 1893.2 2018.9 C
 58.5111 +1892.6 2018.9 1891.1 2019.8 1890.5 2020.6 C
 58.5112 +1891.1 2023.6 1893.2 2019.8 1893.9 2022.5 C
 58.5113 +1894.1 2023.3 1892.7 2023.6 1893.9 2024 C
 58.5114 +1894.2 2024.3 1897.4 2023.8 1896.5 2026.1 C
 58.5115 +1896 2025.6 1897.4 2028.1 1897.5 2027.1 C
 58.5116 +1898.4 2027.4 1899.3 2027 1899.6 2028.5 C
 58.5117 +1899.5 2028.6 1899.4 2028.8 1899.2 2028.8 C
 58.5118 +1899.3 2029.2 1899.6 2029.8 1900.1 2030.2 C
 58.5119 +1900.4 2029.6 1901 2030 1901.8 2030.2 C
 58.5120 +1903.1 2032.1 1900.4 2031.5 1902.8 2033.1 C
 58.5121 +1903.3 2032.7 1904.5 2032 1904.4 2031.9 C
 58.5122 +[0.21 0.21 0 0]  vc
 58.5123 +f 
 58.5124 +S 
 58.5125 +n
 58.5126 +1909.2 2019.4 m
 58.5127 +1908.8 2020.3 1910.2 2019.8 1909.2 2019.2 C
 58.5128 +1908.3 2019.3 1907.6 2020.2 1907.6 2021.3 C
 58.5129 +1908.5 2021 1907.6 2019 1909.2 2019.4 C
 58.5130 +[0.18 0.18 0 0.78]  vc
 58.5131 +f 
 58.5132 +S 
 58.5133 +n
 58.5134 +1915.5 2015.6 m
 58.5135 +1913.5 2016.3 1912.4 2016.8 1911.4 2018.4 C
 58.5136 +1912.5 2017.2 1914 2015.7 1915.5 2015.6 C
 58.5137 +[0.4 0.4 0 0]  vc
 58.5138 +f 
 58.5139 +S 
 58.5140 +n
 58.5141 +1915.5 2016.5 m
 58.5142 +1915.1 2016.4 1913.8 2016.6 1913.3 2017.5 C
 58.5143 +1913.7 2017 1914.5 2016.2 1915.5 2016.5 C
 58.5144 +[0.18 0.18 0 0.78]  vc
 58.5145 +f 
 58.5146 +S 
 58.5147 +n
 58.5148 +vmrs
 58.5149 +1887.4 2012.7 m
 58.5150 +1887.3 2007 1887.2 2001.3 1887.2 1995.6 C
 58.5151 +1887.2 2001.3 1887.3 2007 1887.4 2012.7 C
 58.5152 +[0.18 0.18 0 0.78]  vc
 58.5153 +f 
 58.5154 +0.4 w
 58.5155 +2 J
 58.5156 +2 M
 58.5157 +S 
 58.5158 +n
 58.5159 +1935.9 2007.4 m
 58.5160 +1936.2 2007.8 1935.8 2007.9 1936.6 2007.9 C
 58.5161 +1935.9 2007.9 1936.1 2006.7 1935.2 2007.2 C
 58.5162 +1935.2 2008.1 1934.1 2007.9 1934.2 2008.8 C
 58.5163 +1935 2008.7 1934.6 2006.9 1935.9 2007.4 C
 58.5164 +f 
 58.5165 +S 
 58.5166 +n
 58.5167 +1942.1 2003.6 m
 58.5168 +1940.1 2004.3 1939.1 2004.8 1938 2006.4 C
 58.5169 +1939.1 2005.2 1940.6 2003.7 1942.1 2003.6 C
 58.5170 +[0.4 0.4 0 0]  vc
 58.5171 +f 
 58.5172 +S 
 58.5173 +n
 58.5174 +1942.1 2004.5 m
 58.5175 +1941.8 2004.4 1940.4 2004.6 1940 2005.5 C
 58.5176 +1940.4 2005 1941.2 2004.2 1942.1 2004.5 C
 58.5177 +[0.18 0.18 0 0.78]  vc
 58.5178 +f 
 58.5179 +S 
 58.5180 +n
 58.5181 +1914 2000.7 m
 58.5182 +1914 1995 1913.9 1989.3 1913.8 1983.6 C
 58.5183 +1913.9 1989.3 1914 1995 1914 2000.7 C
 58.5184 +f 
 58.5185 +S 
 58.5186 +n
 58.5187 +1941.6 1998.3 m
 58.5188 +1943.4 2001.9 1942.4 1996 1940.9 1998.3 C
 58.5189 +1941.2 1998.3 1941.4 1998.3 1941.6 1998.3 C
 58.5190 +f 
 58.5191 +S 
 58.5192 +n
 58.5193 +1954.8 1989.9 m
 58.5194 +1953.9 1989.6 1954.7 1991.6 1953.9 1991.1 C
 58.5195 +1954.5 1993.1 1953.6 1998 1954.6 1993.2 C
 58.5196 +1954 1992.2 1954.7 1990.7 1954.8 1989.9 C
 58.5197 +f 
 58.5198 +S 
 58.5199 +n
 58.5200 +1947.6 1992.5 m
 58.5201 +1946.2 1993.5 1944.9 1993 1944.8 1994.7 C
 58.5202 +1945.5 1994 1947 1992.2 1947.6 1992.5 C
 58.5203 +f 
 58.5204 +S 
 58.5205 +n
 58.5206 +1910.7 1982.2 m
 58.5207 +1910.3 1981.8 1909.7 1982 1909.2 1982 C
 58.5208 +1909.7 1982 1910.3 1981.9 1910.7 1982.2 C
 58.5209 +1911 1987.1 1910 1992.6 1910.7 1997.3 C
 58.5210 +1910.7 1992.3 1910.7 1987.2 1910.7 1982.2 C
 58.5211 +[0.65 0.65 0 0.42]  vc
 58.5212 +f 
 58.5213 +S 
 58.5214 +n
 58.5215 +1910.9 1992.8 m
 58.5216 +1910.9 1991.3 1910.9 1989.7 1910.9 1988.2 C
 58.5217 +1910.9 1989.7 1910.9 1991.3 1910.9 1992.8 C
 58.5218 +[0.18 0.18 0 0.78]  vc
 58.5219 +f 
 58.5220 +S 
 58.5221 +n
 58.5222 +vmrs
 58.5223 +1953.6 1983.6 m
 58.5224 +1954.1 1985.3 1953.2 1988.6 1954.8 1989.4 C
 58.5225 +1954.1 1987.9 1954.4 1985.4 1953.6 1983.6 C
 58.5226 +[0.18 0.18 0 0.78]  vc
 58.5227 +f 
 58.5228 +0.4 w
 58.5229 +2 J
 58.5230 +2 M
 58.5231 +S 
 58.5232 +n
 58.5233 +1910.7 1982 m
 58.5234 +1911.6 1982.9 1911 1984.4 1911.2 1985.6 C
 58.5235 +1911 1984.4 1911.6 1982.9 1910.7 1982 C
 58.5236 +f 
 58.5237 +S 
 58.5238 +n
 58.5239 +1947.2 1979.6 m
 58.5240 +1947.5 1980.6 1948.3 1980.6 1947.4 1979.6 C
 58.5241 +1946.2 1979.4 1945.7 1978.8 1947.2 1979.6 C
 58.5242 +f 
 58.5243 +S 
 58.5244 +n
 58.5245 +1930.4 2061.4 m
 58.5246 +1930.4 2058 1930.4 2053.5 1930.4 2051.1 C
 58.5247 +1930.7 2054.6 1929.8 2057.4 1930.1 2061.2 C
 58.5248 +1929.5 2061.9 1929.7 2061.2 1930.4 2061.4 C
 58.5249 +[0.65 0.65 0 0.42]  vc
 58.5250 +f 
 58.5251 +S 
 58.5252 +n
 58.5253 +1939.5 2044.8 m
 58.5254 +1940 2041.5 1935.2 2044.3 1936.4 2040.8 C
 58.5255 +1934.9 2040.9 1934.1 2039.7 1933.5 2038.6 C
 58.5256 +1933.3 2035.4 1933.2 2040 1934 2040.3 C
 58.5257 +1936.2 2040.6 1936.3 2043.6 1938.5 2043.4 C
 58.5258 +1939.7 2044.2 1939.4 2045.6 1938.3 2046.5 C
 58.5259 +1939.1 2046.6 1939.6 2045.6 1939.5 2044.8 C
 58.5260 +f 
 58.5261 +S 
 58.5262 +n
 58.5263 +1910.4 2045.3 m
 58.5264 +1910.4 2039.5 1910.4 2033.6 1910.4 2027.8 C
 58.5265 +1910.4 2033.6 1910.4 2039.5 1910.4 2045.3 C
 58.5266 +f 
 58.5267 +S 
 58.5268 +n
 58.5269 +1906.8 2030.9 m
 58.5270 +1907.6 2026.8 1905 2020.8 1909 2018.7 C
 58.5271 +1906.5 2018.9 1906.8 2022.4 1906.8 2024.7 C
 58.5272 +1906.4 2028.2 1907.9 2032 1903 2033.8 C
 58.5273 +1902.2 2034 1903.8 2033.4 1904.2 2033.1 C
 58.5274 +1905.1 2032.4 1905.9 2031.5 1906.8 2030.9 C
 58.5275 +[0.07 0.06 0 0.58]  vc
 58.5276 +f 
 58.5277 +S 
 58.5278 +n
 58.5279 +1907.1 2030.7 m
 58.5280 +1907.1 2028.8 1907.1 2027 1907.1 2025.2 C
 58.5281 +1907.1 2027 1907.1 2028.8 1907.1 2030.7 C
 58.5282 +[0.65 0.65 0 0.42]  vc
 58.5283 +f 
 58.5284 +S 
 58.5285 +n
 58.5286 +1932 2023.2 m
 58.5287 +1932.2 2023.6 1931.7 2023.7 1931.6 2024 C
 58.5288 +1932 2023.7 1932.3 2022.8 1933 2023 C
 58.5289 +1933.9 2024.3 1933.3 2026.2 1933.5 2027.8 C
 58.5290 +1933.5 2026.4 1934.9 2022.2 1932 2023.2 C
 58.5291 +f 
 58.5292 +S 
 58.5293 +n
 58.5294 +2026.1 2021.6 m
 58.5295 +2026.1 2020.8 2026.1 2019.9 2026.1 2019.2 C
 58.5296 +2026.1 2019.9 2026.1 2020.8 2026.1 2021.6 C
 58.5297 +f 
 58.5298 +S 
 58.5299 +n
 58.5300 +vmrs
 58.5301 +1934.2 2018.9 m
 58.5302 +1934.2 2015.5 1934.2 2011 1934.2 2008.6 C
 58.5303 +1934.5 2012.1 1933.7 2014.9 1934 2018.7 C
 58.5304 +1933.4 2019.5 1933.5 2018.7 1934.2 2018.9 C
 58.5305 +[0.65 0.65 0 0.42]  vc
 58.5306 +f 
 58.5307 +0.4 w
 58.5308 +2 J
 58.5309 +2 M
 58.5310 +S 
 58.5311 +n
 58.5312 +1887.6 2014.8 m
 58.5313 +1887.6 2009 1887.6 2003.1 1887.6 1997.3 C
 58.5314 +1887.6 2003.1 1887.6 2009 1887.6 2014.8 C
 58.5315 +f 
 58.5316 +S 
 58.5317 +n
 58.5318 +1914.3 2002.8 m
 58.5319 +1914.3 1997 1914.3 1991.1 1914.3 1985.3 C
 58.5320 +1914.3 1991.1 1914.3 1997 1914.3 2002.8 C
 58.5321 +f 
 58.5322 +S 
 58.5323 +n
 58.5324 +1995.4 1992.3 m
 58.5325 +1995.4 1991.5 1995.4 1990.7 1995.4 1989.9 C
 58.5326 +1995.4 1990.7 1995.4 1991.5 1995.4 1992.3 C
 58.5327 +f 
 58.5328 +S 
 58.5329 +n
 58.5330 +1896 1988.4 m
 58.5331 +1896.9 1988 1897.8 1987.7 1898.7 1987.2 C
 58.5332 +1897.8 1987.7 1896.9 1988 1896 1988.4 C
 58.5333 +f 
 58.5334 +S 
 58.5335 +n
 58.5336 +1899.4 1986.8 m
 58.5337 +1900.4 1986.3 1901.3 1985.8 1902.3 1985.3 C
 58.5338 +1901.3 1985.8 1900.4 1986.3 1899.4 1986.8 C
 58.5339 +f 
 58.5340 +S 
 58.5341 +n
 58.5342 +1902.8 1985.1 m
 58.5343 +1905.2 1984 1905.2 1984 1902.8 1985.1 C
 58.5344 +f 
 58.5345 +S 
 58.5346 +n
 58.5347 +1949.1 1983.4 m
 58.5348 +1950.2 1984.4 1947.8 1984.6 1949.3 1985.1 C
 58.5349 +1949.5 1984.4 1949.6 1984.1 1949.1 1983.4 C
 58.5350 +[0.07 0.06 0 0.58]  vc
 58.5351 +f 
 58.5352 +S 
 58.5353 +n
 58.5354 +1906.1 1983.4 m
 58.5355 +1908.6 1982 1908.6 1982 1906.1 1983.4 C
 58.5356 +[0.65 0.65 0 0.42]  vc
 58.5357 +f 
 58.5358 +S 
 58.5359 +n
 58.5360 +1922.7 1976.4 m
 58.5361 +1923.6 1976 1924.4 1975.7 1925.3 1975.2 C
 58.5362 +1924.4 1975.7 1923.6 1976 1922.7 1976.4 C
 58.5363 +f 
 58.5364 +S 
 58.5365 +n
 58.5366 +vmrs
 58.5367 +1926 1974.8 m
 58.5368 +1927 1974.3 1928 1973.8 1928.9 1973.3 C
 58.5369 +1928 1973.8 1927 1974.3 1926 1974.8 C
 58.5370 +[0.65 0.65 0 0.42]  vc
 58.5371 +f 
 58.5372 +0.4 w
 58.5373 +2 J
 58.5374 +2 M
 58.5375 +S 
 58.5376 +n
 58.5377 +1929.4 1973.1 m
 58.5378 +1931.9 1972 1931.9 1972 1929.4 1973.1 C
 58.5379 +f 
 58.5380 +S 
 58.5381 +n
 58.5382 +1932.8 1971.4 m
 58.5383 +1935.3 1970 1935.3 1970 1932.8 1971.4 C
 58.5384 +f 
 58.5385 +S 
 58.5386 +n
 58.5387 +1949.6 2097.2 m
 58.5388 +1951.1 2096.4 1952.6 2095.5 1954.1 2094.8 C
 58.5389 +1952.6 2095.5 1951.1 2096.4 1949.6 2097.2 C
 58.5390 +[0.07 0.06 0 0.58]  vc
 58.5391 +f 
 58.5392 +S 
 58.5393 +n
 58.5394 +1955.1 2094.3 m
 58.5395 +1956.7 2093.5 1958.3 2092.7 1959.9 2091.9 C
 58.5396 +1958.3 2092.7 1956.7 2093.5 1955.1 2094.3 C
 58.5397 +f 
 58.5398 +S 
 58.5399 +n
 58.5400 +1960.4 2091.6 m
 58.5401 +1961.3 2091.2 1962.1 2090.9 1963 2090.4 C
 58.5402 +1962.1 2090.9 1961.3 2091.2 1960.4 2091.6 C
 58.5403 +f 
 58.5404 +S 
 58.5405 +n
 58.5406 +1963.5 2090.2 m
 58.5407 +1964.4 2089.7 1965.2 2089.2 1966.1 2088.8 C
 58.5408 +1965.2 2089.2 1964.4 2089.7 1963.5 2090.2 C
 58.5409 +f 
 58.5410 +S 
 58.5411 +n
 58.5412 +1966.6 2088.5 m
 58.5413 +1969.5 2087.1 1972.4 2085.8 1975.2 2084.4 C
 58.5414 +1972.4 2085.8 1969.5 2087.1 1966.6 2088.5 C
 58.5415 +f 
 58.5416 +S 
 58.5417 +n
 58.5418 +1965.2 2086.1 m
 58.5419 +1965.9 2085.7 1966.8 2085.3 1967.6 2084.9 C
 58.5420 +1966.8 2085.3 1965.9 2085.7 1965.2 2086.1 C
 58.5421 +f 
 58.5422 +S 
 58.5423 +n
 58.5424 +1968.3 2084.7 m
 58.5425 +1969.2 2084.3 1970 2083.9 1970.9 2083.5 C
 58.5426 +1970 2083.9 1969.2 2084.3 1968.3 2084.7 C
 58.5427 +f 
 58.5428 +S 
 58.5429 +n
 58.5430 +vmrs
 58.5431 +1984.1 2084 m
 58.5432 +1985.6 2083.2 1987.2 2082.3 1988.7 2081.6 C
 58.5433 +1987.2 2082.3 1985.6 2083.2 1984.1 2084 C
 58.5434 +[0.07 0.06 0 0.58]  vc
 58.5435 +f 
 58.5436 +0.4 w
 58.5437 +2 J
 58.5438 +2 M
 58.5439 +S 
 58.5440 +n
 58.5441 +1976 2078.7 m
 58.5442 +1978.1 2080.1 1980 2082 1982 2083.7 C
 58.5443 +1980 2081.9 1977.9 2080.3 1976 2078.2 C
 58.5444 +1975.5 2079.9 1975.8 2081.9 1975.7 2083.7 C
 58.5445 +1975.8 2082 1975.5 2080.2 1976 2078.7 C
 58.5446 +f 
 58.5447 +S 
 58.5448 +n
 58.5449 +1989.6 2081.1 m
 58.5450 +1991.3 2080.3 1992.8 2079.5 1994.4 2078.7 C
 58.5451 +1992.8 2079.5 1991.3 2080.3 1989.6 2081.1 C
 58.5452 +f 
 58.5453 +S 
 58.5454 +n
 58.5455 +1933.2 2074.6 m
 58.5456 +1932.4 2076.2 1932.8 2077.5 1933 2078.7 C
 58.5457 +1933 2077.6 1932.9 2074.8 1933.2 2074.6 C
 58.5458 +f 
 58.5459 +S 
 58.5460 +n
 58.5461 +1994.9 2078.4 m
 58.5462 +1995.8 2078 1996.7 2077.7 1997.6 2077.2 C
 58.5463 +1996.7 2077.7 1995.8 2078 1994.9 2078.4 C
 58.5464 +f 
 58.5465 +S 
 58.5466 +n
 58.5467 +1998 2077 m
 58.5468 +1998.9 2076.5 1999.8 2076 2000.7 2075.6 C
 58.5469 +1999.8 2076 1998.9 2076.5 1998 2077 C
 58.5470 +f 
 58.5471 +S 
 58.5472 +n
 58.5473 +2001.2 2075.3 m
 58.5474 +2004 2073.9 2006.9 2072.6 2009.8 2071.2 C
 58.5475 +2006.9 2072.6 2004 2073.9 2001.2 2075.3 C
 58.5476 +f 
 58.5477 +S 
 58.5478 +n
 58.5479 +1980.5 2060.7 m
 58.5480 +1979.9 2060.7 1976.7 2062.8 1975.7 2064.5 C
 58.5481 +1975.7 2067.5 1975.7 2070.5 1975.7 2073.4 C
 58.5482 +1976.3 2068.7 1973.9 2061.6 1980.5 2060.7 C
 58.5483 +f 
 58.5484 +S 
 58.5485 +n
 58.5486 +1999.7 2072.9 m
 58.5487 +2000.5 2072.5 2001.3 2072.1 2002.1 2071.7 C
 58.5488 +2001.3 2072.1 2000.5 2072.5 1999.7 2072.9 C
 58.5489 +f 
 58.5490 +S 
 58.5491 +n
 58.5492 +2002.8 2071.5 m
 58.5493 +2003.7 2071.1 2004.6 2070.7 2005.5 2070.3 C
 58.5494 +2004.6 2070.7 2003.7 2071.1 2002.8 2071.5 C
 58.5495 +f 
 58.5496 +S 
 58.5497 +n
 58.5498 +vmrs
 58.5499 +2015.1 2047.5 m
 58.5500 +2014.4 2047.5 2011.2 2049.6 2010.3 2051.3 C
 58.5501 +2010.3 2057.7 2010.3 2064.1 2010.3 2070.5 C
 58.5502 +2010.3 2063.9 2010.1 2057.1 2010.5 2050.6 C
 58.5503 +2012 2049.3 2013.5 2048.3 2015.1 2047.5 C
 58.5504 +[0.07 0.06 0 0.58]  vc
 58.5505 +f 
 58.5506 +0.4 w
 58.5507 +2 J
 58.5508 +2 M
 58.5509 +S 
 58.5510 +n
 58.5511 +1910.4 2049.2 m
 58.5512 +1914.8 2054.3 1920.7 2058.9 1925.1 2064 C
 58.5513 +1920.4 2058.6 1915.1 2054.6 1910.4 2049.2 C
 58.5514 +f 
 58.5515 +S 
 58.5516 +n
 58.5517 +1988.2 2057.3 m
 58.5518 +1989.1 2056.8 1989.9 2056.2 1990.8 2055.6 C
 58.5519 +1989.9 2056.2 1989.1 2056.8 1988.2 2057.3 C
 58.5520 +f 
 58.5521 +S 
 58.5522 +n
 58.5523 +1991.6 2051.3 m
 58.5524 +1991.6 2046.3 1991.6 2041.2 1991.6 2036.2 C
 58.5525 +1991.6 2041.2 1991.6 2046.3 1991.6 2051.3 C
 58.5526 +f 
 58.5527 +S 
 58.5528 +n
 58.5529 +1935.6 2047.5 m
 58.5530 +1932.9 2051.7 1939.7 2043.8 1935.6 2047.5 C
 58.5531 +f 
 58.5532 +S 
 58.5533 +n
 58.5534 +1938.8 2043.9 m
 58.5535 +1938.1 2043.3 1938.2 2043.7 1937.3 2043.4 C
 58.5536 +1938.7 2043 1938.2 2044.9 1939 2045.3 C
 58.5537 +1938.2 2045.3 1938.7 2046.6 1937.8 2046.5 C
 58.5538 +1939.1 2046.2 1939.1 2044.5 1938.8 2043.9 C
 58.5539 +f 
 58.5540 +S 
 58.5541 +n
 58.5542 +1972.4 2045.6 m
 58.5543 +1973.4 2045 1974.5 2044.4 1975.5 2043.9 C
 58.5544 +1974.5 2044.4 1973.4 2045 1972.4 2045.6 C
 58.5545 +f 
 58.5546 +S 
 58.5547 +n
 58.5548 +1969 2043.6 m
 58.5549 +1969.8 2043.2 1970.6 2042.9 1971.4 2042.4 C
 58.5550 +1970.6 2042.9 1969.8 2043.2 1969 2043.6 C
 58.5551 +f 
 58.5552 +S 
 58.5553 +n
 58.5554 +1972.1 2042.2 m
 58.5555 +1973 2041.8 1973.9 2041.4 1974.8 2041 C
 58.5556 +1973.9 2041.4 1973 2041.8 1972.1 2042.2 C
 58.5557 +f 
 58.5558 +S 
 58.5559 +n
 58.5560 +1906.6 2035 m
 58.5561 +1905 2034.7 1904.8 2036.6 1903.5 2036.9 C
 58.5562 +1904.9 2037 1905.8 2033.4 1907.1 2035.7 C
 58.5563 +1907.1 2037.2 1907.1 2038.6 1907.1 2040 C
 58.5564 +1906.9 2038.4 1907.5 2036.4 1906.6 2035 C
 58.5565 +f 
 58.5566 +S 
 58.5567 +n
 58.5568 +vmrs
 58.5569 +1937.1 2032.1 m
 58.5570 +1936.2 2033.7 1936.6 2035 1936.8 2036.2 C
 58.5571 +1936.8 2035.1 1936.8 2032.4 1937.1 2032.1 C
 58.5572 +[0.07 0.06 0 0.58]  vc
 58.5573 +f 
 58.5574 +0.4 w
 58.5575 +2 J
 58.5576 +2 M
 58.5577 +S 
 58.5578 +n
 58.5579 +1887.6 2018.7 m
 58.5580 +1892 2023.8 1897.9 2028.4 1902.3 2033.6 C
 58.5581 +1897.6 2028.1 1892.3 2024.1 1887.6 2018.7 C
 58.5582 +f 
 58.5583 +S 
 58.5584 +n
 58.5585 +1999.7 2031.4 m
 58.5586 +1998.7 2030.3 1997.6 2029.2 1996.6 2028 C
 58.5587 +1997.6 2029.2 1998.7 2030.3 1999.7 2031.4 C
 58.5588 +f 
 58.5589 +S 
 58.5590 +n
 58.5591 +1912.8 2017 m
 58.5592 +1910.6 2021.1 1913.6 2015.3 1914.5 2016 C
 58.5593 +1914 2016.3 1913.4 2016.7 1912.8 2017 C
 58.5594 +f 
 58.5595 +S 
 58.5596 +n
 58.5597 +1939.5 2005 m
 58.5598 +1936.7 2009.2 1943.6 2001.3 1939.5 2005 C
 58.5599 +f 
 58.5600 +S 
 58.5601 +n
 58.5602 +1942.6 2001.4 m
 58.5603 +1941.9 2000.8 1942 2001.2 1941.2 2000.9 C
 58.5604 +1942.5 2000.6 1942.1 2002.4 1942.8 2002.8 C
 58.5605 +1942 2002.8 1942.5 2004.1 1941.6 2004 C
 58.5606 +1943 2003.7 1942.9 2002.1 1942.6 2001.4 C
 58.5607 +f 
 58.5608 +S 
 58.5609 +n
 58.5610 +2006.2 2000.7 m
 58.5611 +2005.4 2001.5 2004 2002.8 2004 2002.8 C
 58.5612 +2004.5 2002.4 2005.5 2001.4 2006.2 2000.7 C
 58.5613 +f 
 58.5614 +S 
 58.5615 +n
 58.5616 +1998.5 2001.6 m
 58.5617 +1997.7 2002 1996.8 2002.4 1995.9 2002.6 C
 58.5618 +1995.5 1999.3 1995.7 1995.7 1995.6 1992.3 C
 58.5619 +1995.6 1995.7 1995.6 1999.2 1995.6 2002.6 C
 58.5620 +1996.6 2002.4 1997.7 2002.2 1998.5 2001.6 C
 58.5621 +[0.4 0.4 0 0]  vc
 58.5622 +f 
 58.5623 +S 
 58.5624 +n
 58.5625 +1996.1 2002.8 m
 58.5626 +1995.9 2002.8 1995.8 2002.8 1995.6 2002.8 C
 58.5627 +1995.2 1999.5 1995.5 1995.9 1995.4 1992.5 C
 58.5628 +1995.4 1995.9 1995.4 1999.4 1995.4 2002.8 C
 58.5629 +1996.4 2003.1 1998.2 2001.6 1996.1 2002.8 C
 58.5630 +[0.07 0.06 0 0.58]  vc
 58.5631 +f 
 58.5632 +S 
 58.5633 +n
 58.5634 +1969 2002.1 m
 58.5635 +1968 2001 1966.9 1999.9 1965.9 1998.8 C
 58.5636 +1966.9 1999.9 1968 2001 1969 2002.1 C
 58.5637 +f 
 58.5638 +S 
 58.5639 +n
 58.5640 +vmrs
 58.5641 +2000 2001.2 m
 58.5642 +2002.1 2000 2004.1 1998.9 2006.2 1997.8 C
 58.5643 +2004.1 1998.9 2002.1 2000 2000 2001.2 C
 58.5644 +[0.07 0.06 0 0.58]  vc
 58.5645 +f 
 58.5646 +0.4 w
 58.5647 +2 J
 58.5648 +2 M
 58.5649 +S 
 58.5650 +n
 58.5651 +1895.8 1984.8 m
 58.5652 +1898.3 1983.6 1900.8 1982.3 1903.2 1981 C
 58.5653 +1900.8 1982.3 1898.3 1983.6 1895.8 1984.8 C
 58.5654 +f 
 58.5655 +S 
 58.5656 +n
 58.5657 +1905.2 1980.3 m
 58.5658 +1906.4 1979.9 1907.6 1979.5 1908.8 1979.1 C
 58.5659 +1907.6 1979.5 1906.4 1979.9 1905.2 1980.3 C
 58.5660 +f 
 58.5661 +S 
 58.5662 +n
 58.5663 +1964.7 1977.4 m
 58.5664 +1963.8 1977.5 1962.5 1980.2 1960.8 1980 C
 58.5665 +1962.5 1980.2 1963.3 1978 1964.7 1977.4 C
 58.5666 +f 
 58.5667 +S 
 58.5668 +n
 58.5669 +1952 1979.6 m
 58.5670 +1955.2 1979.2 1955.2 1979.2 1952 1979.6 C
 58.5671 +f 
 58.5672 +S 
 58.5673 +n
 58.5674 +1937.8 1966.4 m
 58.5675 +1941.2 1969.5 1946.1 1976.4 1951.5 1979.3 C
 58.5676 +1946.1 1976.7 1942.8 1970.4 1937.8 1966.4 C
 58.5677 +f 
 58.5678 +S 
 58.5679 +n
 58.5680 +1911.9 1978.6 m
 58.5681 +1914.3 1977.4 1916.7 1976.2 1919.1 1975 C
 58.5682 +1916.7 1976.2 1914.3 1977.4 1911.9 1978.6 C
 58.5683 +f 
 58.5684 +S 
 58.5685 +n
 58.5686 +1975.5 1971.4 m
 58.5687 +1974.6 1972.2 1973.3 1973.6 1973.3 1973.6 C
 58.5688 +1973.7 1973.1 1974.8 1972.1 1975.5 1971.4 C
 58.5689 +f 
 58.5690 +S 
 58.5691 +n
 58.5692 +1922.4 1972.8 m
 58.5693 +1924.9 1971.6 1927.4 1970.3 1929.9 1969 C
 58.5694 +1927.4 1970.3 1924.9 1971.6 1922.4 1972.8 C
 58.5695 +f 
 58.5696 +S 
 58.5697 +n
 58.5698 +1969.2 1971.9 m
 58.5699 +1971.1 1970.9 1972.9 1969.8 1974.8 1968.8 C
 58.5700 +1972.9 1969.8 1971.1 1970.9 1969.2 1971.9 C
 58.5701 +f 
 58.5702 +S 
 58.5703 +n
 58.5704 +vmrs
 58.5705 +1931.8 1968.3 m
 58.5706 +1933 1967.9 1934.2 1967.5 1935.4 1967.1 C
 58.5707 +1934.2 1967.5 1933 1967.9 1931.8 1968.3 C
 58.5708 +[0.07 0.06 0 0.58]  vc
 58.5709 +f 
 58.5710 +0.4 w
 58.5711 +2 J
 58.5712 +2 M
 58.5713 +S 
 58.5714 +n
 58.5715 +1940.7 2072.4 m
 58.5716 +1941.5 2072.4 1942.3 2072.3 1943.1 2072.2 C
 58.5717 +1942.3 2072.3 1941.5 2072.4 1940.7 2072.4 C
 58.5718 +[0 0 0 0.18]  vc
 58.5719 +f 
 58.5720 +S 
 58.5721 +n
 58.5722 +1948.6 2069.3 m
 58.5723 +1947 2069.5 1945.7 2068.9 1944.8 2069.8 C
 58.5724 +1945.9 2068.5 1948.4 2070.2 1948.6 2069.3 C
 58.5725 +f 
 58.5726 +S 
 58.5727 +n
 58.5728 +1954.6 2066.4 m
 58.5729 +1954.7 2067.9 1955.6 2067.3 1955.6 2068.8 C
 58.5730 +1955.4 2067.8 1956 2066.6 1954.6 2066.4 C
 58.5731 +f 
 58.5732 +S 
 58.5733 +n
 58.5734 +1929.2 2061.2 m
 58.5735 +1927.8 2062.1 1926.3 2064.1 1924.8 2063.3 C
 58.5736 +1926.3 2064.6 1928 2062 1929.2 2061.2 C
 58.5737 +f 
 58.5738 +S 
 58.5739 +n
 58.5740 +1924.4 2067.4 m
 58.5741 +1918.5 2061.6 1912.7 2055.9 1906.8 2050.1 C
 58.5742 +1912.7 2055.9 1918.5 2061.6 1924.4 2067.4 C
 58.5743 +[0.4 0.4 0 0]  vc
 58.5744 +f 
 58.5745 +S 
 58.5746 +n
 58.5747 +1924.6 2062.8 m
 58.5748 +1923.9 2062.1 1923.2 2061.2 1922.4 2060.4 C
 58.5749 +1923.2 2061.2 1923.9 2062.1 1924.6 2062.8 C
 58.5750 +[0 0 0 0.18]  vc
 58.5751 +f 
 58.5752 +S 
 58.5753 +n
 58.5754 +1919.3 2057.3 m
 58.5755 +1917.5 2055.6 1915.7 2053.8 1913.8 2052 C
 58.5756 +1915.7 2053.8 1917.5 2055.6 1919.3 2057.3 C
 58.5757 +f 
 58.5758 +S 
 58.5759 +n
 58.5760 +1929.2 2055.2 m
 58.5761 +1929.2 2054.2 1929.2 2053.2 1929.2 2052.3 C
 58.5762 +1929.2 2053.2 1929.2 2054.2 1929.2 2055.2 C
 58.5763 +f 
 58.5764 +S 
 58.5765 +n
 58.5766 +1926.3 2049.6 m
 58.5767 +1925.4 2049 1925.4 2050.5 1924.4 2050.4 C
 58.5768 +1925.3 2051.3 1924.5 2051.9 1925.6 2052.5 C
 58.5769 +1926.9 2052.6 1926 2050.6 1926.3 2049.6 C
 58.5770 +f 
 58.5771 +S 
 58.5772 +n
 58.5773 +vmrs
 58.5774 +1911.2 2046.8 m
 58.5775 +1910.1 2048.9 1911.9 2050.1 1913.1 2051.3 C
 58.5776 +1912.1 2049.9 1910.6 2048.8 1911.2 2046.8 C
 58.5777 +[0 0 0 0.18]  vc
 58.5778 +f 
 58.5779 +0.4 w
 58.5780 +2 J
 58.5781 +2 M
 58.5782 +S 
 58.5783 +n
 58.5784 +1934 2048.7 m
 58.5785 +1932.6 2048.7 1930.1 2047.7 1929.6 2049.4 C
 58.5786 +1930.9 2048.6 1933.3 2049 1934 2048.7 C
 58.5787 +f 
 58.5788 +S 
 58.5789 +n
 58.5790 +1980 2048.4 m
 58.5791 +1979.5 2046.8 1976.3 2047.9 1977.2 2045.6 C
 58.5792 +1976.8 2045.1 1976.1 2044.7 1975.2 2044.8 C
 58.5793 +1973.7 2046 1976.3 2046.4 1976.7 2047.5 C
 58.5794 +1977.8 2047.2 1978.2 2050 1979.6 2049.2 C
 58.5795 +1980 2049 1979.6 2048.6 1980 2048.4 C
 58.5796 +f 
 58.5797 +S 
 58.5798 +n
 58.5799 +1938.3 2045.6 m
 58.5800 +1938.2 2044.4 1936.8 2043.8 1935.9 2043.4 C
 58.5801 +1936.4 2044.4 1939.1 2044.3 1937.6 2045.8 C
 58.5802 +1937 2046.1 1935.9 2046.1 1935.9 2046.8 C
 58.5803 +1936.7 2046.3 1937.8 2046.2 1938.3 2045.6 C
 58.5804 +f 
 58.5805 +S 
 58.5806 +n
 58.5807 +1932.5 2040 m
 58.5808 +1932.8 2038.1 1932 2038.9 1932.3 2040.3 C
 58.5809 +1933.1 2040.3 1932.7 2041.7 1933.7 2041.5 C
 58.5810 +1933.1 2041 1932.9 2040.5 1932.5 2040 C
 58.5811 +f 
 58.5812 +S 
 58.5813 +n
 58.5814 +2014.6 2035.2 m
 58.5815 +2014.1 2033.6 2010.9 2034.7 2011.7 2032.4 C
 58.5816 +2011.3 2031.9 2009.4 2030.7 2009.3 2032.1 C
 58.5817 +2009.5 2033.7 2012.9 2033.8 2012.4 2035.7 C
 58.5818 +2013 2036.4 2014.2 2036.5 2014.6 2035.2 C
 58.5819 +f 
 58.5820 +S 
 58.5821 +n
 58.5822 +1906.4 2030.7 m
 58.5823 +1905 2031.6 1903.5 2033.6 1902 2032.8 C
 58.5824 +1903.4 2034 1905.6 2031.4 1906.4 2030.7 C
 58.5825 +f 
 58.5826 +S 
 58.5827 +n
 58.5828 +1901.8 2037.2 m
 58.5829 +1899.5 2034.8 1897.2 2032.5 1894.8 2030.2 C
 58.5830 +1897.2 2032.5 1899.5 2034.8 1901.8 2037.2 C
 58.5831 +[0.4 0.4 0 0]  vc
 58.5832 +f 
 58.5833 +S 
 58.5834 +n
 58.5835 +1901.8 2032.4 m
 58.5836 +1901.1 2031.6 1900.4 2030.7 1899.6 2030 C
 58.5837 +1900.4 2030.7 1901.1 2031.6 1901.8 2032.4 C
 58.5838 +[0 0 0 0.18]  vc
 58.5839 +f 
 58.5840 +S 
 58.5841 +n
 58.5842 +1944.5 2030 m
 58.5843 +1945.3 2029.9 1946.1 2029.8 1946.9 2029.7 C
 58.5844 +1946.1 2029.8 1945.3 2029.9 1944.5 2030 C
 58.5845 +f 
 58.5846 +S 
 58.5847 +n
 58.5848 +vmrs
 58.5849 +1997.8 2027.8 m
 58.5850 +1997.7 2027.9 1997.6 2028.1 1997.3 2028 C
 58.5851 +1997.4 2029.1 1998.5 2029.5 1999.2 2030 C
 58.5852 +2000.1 2029.5 1998.9 2028 1997.8 2027.8 C
 58.5853 +[0 0 0 0.18]  vc
 58.5854 +f 
 58.5855 +0.4 w
 58.5856 +2 J
 58.5857 +2 M
 58.5858 +S 
 58.5859 +n
 58.5860 +1906.4 2029.2 m
 58.5861 +1906.4 2026.6 1906.4 2024 1906.4 2021.3 C
 58.5862 +1906.4 2024 1906.4 2026.6 1906.4 2029.2 C
 58.5863 +f 
 58.5864 +S 
 58.5865 +n
 58.5866 +2006.2 2025.9 m
 58.5867 +2006 2025.9 2005.8 2025.8 2005.7 2025.6 C
 58.5868 +2005.7 2025.5 2005.7 2025.3 2005.7 2025.2 C
 58.5869 +2004.6 2025.8 2002.7 2024.7 2001.9 2026.1 C
 58.5870 +2001.9 2027.9 2007.8 2029.2 2006.2 2025.9 C
 58.5871 +[0 0 0 0]  vc
 58.5872 +f 
 58.5873 +S 
 58.5874 +n
 58.5875 +1952.4 2026.8 m
 58.5876 +1950.9 2027 1949.6 2026.4 1948.6 2027.3 C
 58.5877 +1949.7 2026.1 1952.2 2027.7 1952.4 2026.8 C
 58.5878 +[0 0 0 0.18]  vc
 58.5879 +f 
 58.5880 +S 
 58.5881 +n
 58.5882 +1896.5 2026.8 m
 58.5883 +1894.7 2025.1 1892.9 2023.3 1891 2021.6 C
 58.5884 +1892.9 2023.3 1894.7 2025.1 1896.5 2026.8 C
 58.5885 +f 
 58.5886 +S 
 58.5887 +n
 58.5888 +1958.4 2024 m
 58.5889 +1958.5 2025.5 1959.4 2024.8 1959.4 2026.4 C
 58.5890 +1959.3 2025.3 1959.8 2024.1 1958.4 2024 C
 58.5891 +f 
 58.5892 +S 
 58.5893 +n
 58.5894 +1903.5 2019.2 m
 58.5895 +1902.6 2018.6 1902.6 2020 1901.6 2019.9 C
 58.5896 +1902.5 2020.8 1901.7 2021.4 1902.8 2022 C
 58.5897 +1904.1 2022.2 1903.2 2020.1 1903.5 2019.2 C
 58.5898 +f 
 58.5899 +S 
 58.5900 +n
 58.5901 +1933 2018.7 m
 58.5902 +1931.7 2019.6 1930.1 2021.6 1928.7 2020.8 C
 58.5903 +1930.1 2022.1 1931.8 2019.5 1933 2018.7 C
 58.5904 +f 
 58.5905 +S 
 58.5906 +n
 58.5907 +1888.4 2016.3 m
 58.5908 +1887.3 2018.4 1889.1 2019.6 1890.3 2020.8 C
 58.5909 +1889.3 2019.5 1887.8 2018.3 1888.4 2016.3 C
 58.5910 +f 
 58.5911 +S 
 58.5912 +n
 58.5913 +1928.4 2020.4 m
 58.5914 +1927.7 2019.6 1927 2018.7 1926.3 2018 C
 58.5915 +1927 2018.7 1927.7 2019.6 1928.4 2020.4 C
 58.5916 +f 
 58.5917 +S 
 58.5918 +n
 58.5919 +vmrs
 58.5920 +1911.2 2018.2 m
 58.5921 +1909.8 2018.3 1907.3 2017.2 1906.8 2018.9 C
 58.5922 +1908.1 2018.1 1910.5 2018.6 1911.2 2018.2 C
 58.5923 +[0 0 0 0.18]  vc
 58.5924 +f 
 58.5925 +0.4 w
 58.5926 +2 J
 58.5927 +2 M
 58.5928 +S 
 58.5929 +n
 58.5930 +1915.5 2015.1 m
 58.5931 +1915.4 2013.9 1914 2013.3 1913.1 2012.9 C
 58.5932 +1913.6 2013.9 1916.3 2013.8 1914.8 2015.3 C
 58.5933 +1914.2 2015.6 1913.1 2015.6 1913.1 2016.3 C
 58.5934 +1913.9 2015.9 1915 2015.7 1915.5 2015.1 C
 58.5935 +f 
 58.5936 +S 
 58.5937 +n
 58.5938 +1923.2 2014.8 m
 58.5939 +1921.3 2013.1 1919.5 2011.3 1917.6 2009.6 C
 58.5940 +1919.5 2011.3 1921.3 2013.1 1923.2 2014.8 C
 58.5941 +f 
 58.5942 +S 
 58.5943 +n
 58.5944 +1933 2012.7 m
 58.5945 +1933 2011.7 1933 2010.8 1933 2009.8 C
 58.5946 +1933 2010.8 1933 2011.7 1933 2012.7 C
 58.5947 +f 
 58.5948 +S 
 58.5949 +n
 58.5950 +1909.7 2008.1 m
 58.5951 +1908.9 2009.2 1910.1 2009.9 1910.4 2011 C
 58.5952 +1911.1 2010.7 1908.9 2009.7 1909.7 2008.1 C
 58.5953 +f 
 58.5954 +S 
 58.5955 +n
 58.5956 +1930.1 2007.2 m
 58.5957 +1929.2 2006.6 1929.2 2008 1928.2 2007.9 C
 58.5958 +1929.1 2008.8 1928.4 2009.4 1929.4 2010 C
 58.5959 +1930.7 2010.2 1929.9 2008.1 1930.1 2007.2 C
 58.5960 +f 
 58.5961 +S 
 58.5962 +n
 58.5963 +1915 2004.3 m
 58.5964 +1914 2006.4 1915.7 2007.6 1916.9 2008.8 C
 58.5965 +1915.9 2007.5 1914.4 2006.3 1915 2004.3 C
 58.5966 +f 
 58.5967 +S 
 58.5968 +n
 58.5969 +1937.8 2006.2 m
 58.5970 +1936.4 2006.3 1934 2005.2 1933.5 2006.9 C
 58.5971 +1934.7 2006.1 1937.1 2006.6 1937.8 2006.2 C
 58.5972 +f 
 58.5973 +S 
 58.5974 +n
 58.5975 +1983.9 2006 m
 58.5976 +1983.3 2004.3 1980.2 2005.4 1981 2003.1 C
 58.5977 +1980.6 2002.7 1978.7 2001.5 1978.6 2002.8 C
 58.5978 +1978.8 2004.4 1982.1 2004.5 1981.7 2006.4 C
 58.5979 +1982.3 2007.2 1983.5 2007.2 1983.9 2006 C
 58.5980 +f 
 58.5981 +S 
 58.5982 +n
 58.5983 +1942.1 2003.1 m
 58.5984 +1942 2001.9 1940.6 2001.3 1939.7 2000.9 C
 58.5985 +1940.2 2001.9 1943 2001.8 1941.4 2003.3 C
 58.5986 +1940.9 2003.6 1939.7 2003.6 1939.7 2004.3 C
 58.5987 +1940.5 2003.9 1941.6 2003.7 1942.1 2003.1 C
 58.5988 +f 
 58.5989 +S 
 58.5990 +n
 58.5991 +vmrs
 58.5992 +1967.1 1998.5 m
 58.5993 +1967 1998.6 1966.8 1998.8 1966.6 1998.8 C
 58.5994 +1966.7 1999.8 1967.8 2000.2 1968.5 2000.7 C
 58.5995 +1969.4 2000.2 1968.2 1998.8 1967.1 1998.5 C
 58.5996 +[0 0 0 0.18]  vc
 58.5997 +f 
 58.5998 +0.4 w
 58.5999 +2 J
 58.6000 +2 M
 58.6001 +S 
 58.6002 +n
 58.6003 +1936.4 1997.6 m
 58.6004 +1936.7 1995.6 1935.8 1996.4 1936.1 1997.8 C
 58.6005 +1936.9 1997.9 1936.5 1999.2 1937.6 1999 C
 58.6006 +1937 1998.5 1936.8 1998 1936.4 1997.6 C
 58.6007 +f 
 58.6008 +S 
 58.6009 +n
 58.6010 +1975.5 1996.6 m
 58.6011 +1975.2 1996.7 1975.1 1996.5 1975 1996.4 C
 58.6012 +1975 1996.2 1975 1996.1 1975 1995.9 C
 58.6013 +1973.9 1996.5 1972 1995.5 1971.2 1996.8 C
 58.6014 +1971.2 1998.6 1977 1999.9 1975.5 1996.6 C
 58.6015 +[0 0 0 0]  vc
 58.6016 +f 
 58.6017 +S 
 58.6018 +n
 58.6019 +1949.3 2097.4 m
 58.6020 +1950.3 2096.9 1951.2 2096.4 1952.2 2096 C
 58.6021 +1951.2 2096.4 1950.3 2096.9 1949.3 2097.4 C
 58.6022 +[0.4 0.4 0 0]  vc
 58.6023 +f 
 58.6024 +S 
 58.6025 +n
 58.6026 +1960.8 2091.6 m
 58.6027 +1961.7 2091.2 1962.6 2090.9 1963.5 2090.4 C
 58.6028 +1962.6 2090.9 1961.7 2091.2 1960.8 2091.6 C
 58.6029 +f 
 58.6030 +S 
 58.6031 +n
 58.6032 +1964.4 2090 m
 58.6033 +1965.7 2089.2 1967 2088.5 1968.3 2087.8 C
 58.6034 +1967 2088.5 1965.7 2089.2 1964.4 2090 C
 58.6035 +f 
 58.6036 +S 
 58.6037 +n
 58.6038 +1976 2083.7 m
 58.6039 +1976.3 2082.3 1975.2 2079.1 1976.9 2079.4 C
 58.6040 +1978.8 2080.7 1980.3 2082.9 1982.2 2084.2 C
 58.6041 +1980.6 2083.1 1978.2 2080.2 1976 2078.9 C
 58.6042 +1975.6 2081.2 1977 2084.9 1973.8 2085.4 C
 58.6043 +1972.2 2086.1 1970.7 2087 1969 2087.6 C
 58.6044 +1971.4 2086.5 1974.1 2085.6 1976 2083.7 C
 58.6045 +f 
 58.6046 +S 
 58.6047 +n
 58.6048 +1983.9 2084.2 m
 58.6049 +1984.8 2083.7 1985.8 2083.2 1986.8 2082.8 C
 58.6050 +1985.8 2083.2 1984.8 2083.7 1983.9 2084.2 C
 58.6051 +f 
 58.6052 +S 
 58.6053 +n
 58.6054 +1995.4 2078.4 m
 58.6055 +1996.3 2078 1997.1 2077.7 1998 2077.2 C
 58.6056 +1997.1 2077.7 1996.3 2078 1995.4 2078.4 C
 58.6057 +f 
 58.6058 +S 
 58.6059 +n
 58.6060 +1999 2076.8 m
 58.6061 +2000.3 2076 2001.6 2075.3 2002.8 2074.6 C
 58.6062 +2001.6 2075.3 2000.3 2076 1999 2076.8 C
 58.6063 +f 
 58.6064 +S 
 58.6065 +n
 58.6066 +vmrs
 58.6067 +1929.6 2065.7 m
 58.6068 +1930.1 2065.6 1929.8 2068.6 1929.9 2070 C
 58.6069 +1929.8 2068.6 1930.1 2067 1929.6 2065.7 C
 58.6070 +[0.4 0.4 0 0]  vc
 58.6071 +f 
 58.6072 +0.4 w
 58.6073 +2 J
 58.6074 +2 M
 58.6075 +S 
 58.6076 +n
 58.6077 +1906.6 2049.4 m
 58.6078 +1906.6 2046.7 1906.6 2043.9 1906.6 2041.2 C
 58.6079 +1906.6 2043.9 1906.6 2046.7 1906.6 2049.4 C
 58.6080 +f 
 58.6081 +S 
 58.6082 +n
 58.6083 +2016 2047.5 m
 58.6084 +2014.8 2048 2013.5 2048.3 2012.4 2049.4 C
 58.6085 +2013.5 2048.3 2014.8 2048 2016 2047.5 C
 58.6086 +f 
 58.6087 +S 
 58.6088 +n
 58.6089 +2016.5 2047.2 m
 58.6090 +2017.3 2046.9 2018.1 2046.6 2018.9 2046.3 C
 58.6091 +2018.1 2046.6 2017.3 2046.9 2016.5 2047.2 C
 58.6092 +f 
 58.6093 +S 
 58.6094 +n
 58.6095 +1912.4 2028.5 m
 58.6096 +1911.8 2032.4 1912.4 2037.2 1911.9 2041.2 C
 58.6097 +1911.5 2037.2 1911.7 2032.9 1911.6 2028.8 C
 58.6098 +1911.6 2033.5 1911.6 2038.9 1911.6 2042.9 C
 58.6099 +1912.5 2042.2 1911.6 2043.9 1912.6 2043.6 C
 58.6100 +1912.9 2039.3 1913.1 2033.3 1912.4 2028.5 C
 58.6101 +[0.21 0.21 0 0]  vc
 58.6102 +f 
 58.6103 +S 
 58.6104 +n
 58.6105 +1906.8 2040.8 m
 58.6106 +1906.8 2039 1906.8 2037.2 1906.8 2035.5 C
 58.6107 +1906.8 2037.2 1906.8 2039 1906.8 2040.8 C
 58.6108 +[0.4 0.4 0 0]  vc
 58.6109 +f 
 58.6110 +S 
 58.6111 +n
 58.6112 +1905.9 2035.2 m
 58.6113 +1904.9 2036.4 1903.7 2037.2 1902.3 2037.4 C
 58.6114 +1903.7 2037.2 1904.9 2036.4 1905.9 2035.2 C
 58.6115 +f 
 58.6116 +S 
 58.6117 +n
 58.6118 +1906.1 2031.2 m
 58.6119 +1907 2031.1 1906.4 2028 1906.6 2030.7 C
 58.6120 +1905.5 2032.1 1904 2032.8 1902.5 2033.6 C
 58.6121 +1903.9 2033.2 1905 2032.1 1906.1 2031.2 C
 58.6122 +f 
 58.6123 +S 
 58.6124 +n
 58.6125 +1908.3 2018.7 m
 58.6126 +1905.2 2018.6 1907.1 2023.2 1906.6 2025.4 C
 58.6127 +1906.8 2023 1905.9 2019.5 1908.3 2018.7 C
 58.6128 +f 
 58.6129 +S 
 58.6130 +n
 58.6131 +1889.6 1998 m
 58.6132 +1889 2001.9 1889.6 2006.7 1889.1 2010.8 C
 58.6133 +1888.7 2006.7 1888.9 2002.4 1888.8 1998.3 C
 58.6134 +1888.8 2003 1888.8 2008.4 1888.8 2012.4 C
 58.6135 +1889.7 2011.7 1888.8 2013.4 1889.8 2013.2 C
 58.6136 +1890.1 2008.8 1890.3 2002.8 1889.6 1998 C
 58.6137 +[0.21 0.21 0 0]  vc
 58.6138 +f 
 58.6139 +S 
 58.6140 +n
 58.6141 +vmrs
 58.6142 +1999 2001.4 m
 58.6143 +2001 2000.3 2003 1999.2 2005 1998 C
 58.6144 +2003 1999.2 2001 2000.3 1999 2001.4 C
 58.6145 +[0.4 0.4 0 0]  vc
 58.6146 +f 
 58.6147 +0.4 w
 58.6148 +2 J
 58.6149 +2 M
 58.6150 +S 
 58.6151 +n
 58.6152 +1916.2 1986 m
 58.6153 +1915.7 1989.9 1916.3 1994.7 1915.7 1998.8 C
 58.6154 +1915.3 1994.7 1915.5 1990.4 1915.5 1986.3 C
 58.6155 +1915.5 1991 1915.5 1996.4 1915.5 2000.4 C
 58.6156 +1916.3 1999.7 1915.5 2001.4 1916.4 2001.2 C
 58.6157 +1916.7 1996.8 1917 1990.8 1916.2 1986 C
 58.6158 +[0.21 0.21 0 0]  vc
 58.6159 +f 
 58.6160 +S 
 58.6161 +n
 58.6162 +1886.9 1989.6 m
 58.6163 +1887.8 1989.2 1888.7 1988.9 1889.6 1988.4 C
 58.6164 +1888.7 1988.9 1887.8 1989.2 1886.9 1989.6 C
 58.6165 +[0.4 0.4 0 0]  vc
 58.6166 +f 
 58.6167 +S 
 58.6168 +n
 58.6169 +1892.4 1986.8 m
 58.6170 +1895.1 1985.1 1897.9 1983.6 1900.6 1982 C
 58.6171 +1897.9 1983.6 1895.1 1985.1 1892.4 1986.8 C
 58.6172 +f 
 58.6173 +S 
 58.6174 +n
 58.6175 +1907.3 1979.3 m
 58.6176 +1908.5 1978.9 1909.7 1978.5 1910.9 1978.1 C
 58.6177 +1909.7 1978.5 1908.5 1978.9 1907.3 1979.3 C
 58.6178 +f 
 58.6179 +S 
 58.6180 +n
 58.6181 +1938.5 1966.6 m
 58.6182 +1942.6 1970.1 1945.9 1976.4 1951.7 1979.1 C
 58.6183 +1946.2 1976.1 1943.1 1970.9 1938.5 1966.6 C
 58.6184 +f 
 58.6185 +S 
 58.6186 +n
 58.6187 +1955.1 1978.6 m
 58.6188 +1955.9 1978.2 1956.7 1977.8 1957.5 1977.4 C
 58.6189 +1956.7 1977.8 1955.9 1978.2 1955.1 1978.6 C
 58.6190 +f 
 58.6191 +S 
 58.6192 +n
 58.6193 +1913.6 1977.6 m
 58.6194 +1914.5 1977.2 1915.3 1976.9 1916.2 1976.4 C
 58.6195 +1915.3 1976.9 1914.5 1977.2 1913.6 1977.6 C
 58.6196 +f 
 58.6197 +S 
 58.6198 +n
 58.6199 +1919.1 1974.8 m
 58.6200 +1921.8 1973.1 1924.5 1971.6 1927.2 1970 C
 58.6201 +1924.5 1971.6 1921.8 1973.1 1919.1 1974.8 C
 58.6202 +f 
 58.6203 +S 
 58.6204 +n
 58.6205 +1963.5 1974.5 m
 58.6206 +1964.5 1974 1965.6 1973.4 1966.6 1972.8 C
 58.6207 +1965.6 1973.4 1964.5 1974 1963.5 1974.5 C
 58.6208 +f 
 58.6209 +S 
 58.6210 +n
 58.6211 +vmrs
 58.6212 +1967.8 1972.4 m
 58.6213 +1970 1971.2 1972.1 1970 1974.3 1968.8 C
 58.6214 +1972.1 1970 1970 1971.2 1967.8 1972.4 C
 58.6215 +[0.4 0.4 0 0]  vc
 58.6216 +f 
 58.6217 +0.4 w
 58.6218 +2 J
 58.6219 +2 M
 58.6220 +S 
 58.6221 +n
 58.6222 +1934 1967.3 m
 58.6223 +1935.2 1966.9 1936.4 1966.5 1937.6 1966.1 C
 58.6224 +1936.4 1966.5 1935.2 1966.9 1934 1967.3 C
 58.6225 +f 
 58.6226 +S 
 58.6227 +n
 58.6228 +1928.9 2061.2 m
 58.6229 +1928.9 2059.2 1928.9 2057.3 1928.9 2055.4 C
 58.6230 +1928.9 2057.3 1928.9 2059.2 1928.9 2061.2 C
 58.6231 +[0.21 0.21 0 0]  vc
 58.6232 +f 
 58.6233 +S 
 58.6234 +n
 58.6235 +1917.2 2047 m
 58.6236 +1917.8 2046.5 1919.6 2046.8 1920 2047.2 C
 58.6237 +1920 2046.5 1920.9 2046.8 1921 2046.3 C
 58.6238 +1921.9 2047.3 1921.3 2044.1 1921.5 2044.1 C
 58.6239 +1919.7 2044.8 1915.7 2043.5 1916.2 2046 C
 58.6240 +1916.2 2048.3 1917 2045.9 1917.2 2047 C
 58.6241 +[0 0 0 0]  vc
 58.6242 +f 
 58.6243 +S 
 58.6244 +n
 58.6245 +1922 2044.1 m
 58.6246 +1923.5 2043.2 1927 2045.4 1927.5 2042.9 C
 58.6247 +1927.1 2042.6 1927.3 2040.9 1927.2 2041.5 C
 58.6248 +1924.9 2042.3 1920.9 2040.6 1922 2044.1 C
 58.6249 +f 
 58.6250 +S 
 58.6251 +n
 58.6252 +1934.9 2043.9 m
 58.6253 +1935.2 2043.4 1934.4 2042.7 1934 2042.2 C
 58.6254 +1933.2 2041.8 1932.4 2042.8 1932.8 2043.2 C
 58.6255 +1932.9 2044 1934.3 2043.3 1934.9 2043.9 C
 58.6256 +f 
 58.6257 +S 
 58.6258 +n
 58.6259 +1906.1 2030.7 m
 58.6260 +1906.1 2028.8 1906.1 2027 1906.1 2025.2 C
 58.6261 +1906.1 2027 1906.1 2028.8 1906.1 2030.7 C
 58.6262 +[0.21 0.21 0 0]  vc
 58.6263 +f 
 58.6264 +S 
 58.6265 +n
 58.6266 +1932.8 2018.7 m
 58.6267 +1932.8 2016.8 1932.8 2014.8 1932.8 2012.9 C
 58.6268 +1932.8 2014.8 1932.8 2016.8 1932.8 2018.7 C
 58.6269 +f 
 58.6270 +S 
 58.6271 +n
 58.6272 +1894.4 2016.5 m
 58.6273 +1895 2016 1896.8 2016.3 1897.2 2016.8 C
 58.6274 +1897.2 2016 1898.1 2016.3 1898.2 2015.8 C
 58.6275 +1899.1 2016.8 1898.5 2013.6 1898.7 2013.6 C
 58.6276 +1896.9 2014.4 1892.9 2013 1893.4 2015.6 C
 58.6277 +1893.4 2017.8 1894.2 2015.4 1894.4 2016.5 C
 58.6278 +[0 0 0 0]  vc
 58.6279 +f 
 58.6280 +S 
 58.6281 +n
 58.6282 +1899.2 2013.6 m
 58.6283 +1900.7 2012.7 1904.2 2014.9 1904.7 2012.4 C
 58.6284 +1904.3 2012.1 1904.5 2010.5 1904.4 2011 C
 58.6285 +1902.1 2011.8 1898.1 2010.1 1899.2 2013.6 C
 58.6286 +f 
 58.6287 +S 
 58.6288 +n
 58.6289 +vmrs
 58.6290 +1912.1 2013.4 m
 58.6291 +1912.4 2012.9 1911.6 2012.3 1911.2 2011.7 C
 58.6292 +1910.4 2011.4 1909.6 2012.3 1910 2012.7 C
 58.6293 +1910.1 2013.5 1911.5 2012.9 1912.1 2013.4 C
 58.6294 +[0 0 0 0]  vc
 58.6295 +f 
 58.6296 +0.4 w
 58.6297 +2 J
 58.6298 +2 M
 58.6299 +S 
 58.6300 +n
 58.6301 +1921 2004.5 m
 58.6302 +1921.6 2004 1923.4 2004.3 1923.9 2004.8 C
 58.6303 +1923.8 2004 1924.8 2004.3 1924.8 2003.8 C
 58.6304 +1925.7 2004.8 1925.1 2001.6 1925.3 2001.6 C
 58.6305 +1923.6 2002.4 1919.6 2001 1920 2003.6 C
 58.6306 +1920 2005.8 1920.8 2003.4 1921 2004.5 C
 58.6307 +f 
 58.6308 +S 
 58.6309 +n
 58.6310 +1925.8 2001.6 m
 58.6311 +1927.3 2000.7 1930.8 2002.9 1931.3 2000.4 C
 58.6312 +1930.9 2000.1 1931.1 1998.5 1931.1 1999 C
 58.6313 +1928.7 1999.8 1924.8 1998.1 1925.8 2001.6 C
 58.6314 +f 
 58.6315 +S 
 58.6316 +n
 58.6317 +1938.8 2001.4 m
 58.6318 +1939 2000.9 1938.2 2000.3 1937.8 1999.7 C
 58.6319 +1937.1 1999.4 1936.2 2000.3 1936.6 2000.7 C
 58.6320 +1936.7 2001.5 1938.1 2000.9 1938.8 2001.4 C
 58.6321 +f 
 58.6322 +S 
 58.6323 +n
 58.6324 +1908.6691 2008.1348 m
 58.6325 +1897.82 2010.0477 L
 58.6326 +1894.1735 1989.3671 L
 58.6327 +1905.0226 1987.4542 L
 58.6328 +1908.6691 2008.1348 L
 58.6329 +n
 58.6330 +q
 58.6331 +_bfh
 58.6332 +%%IncludeResource: font Symbol
 58.6333 +_efh
 58.6334 +{
 58.6335 +f0 [19.696045 -3.4729 3.4729 19.696045 0 0] makesetfont
 58.6336 +1895.041763 1994.291153 m
 58.6337 +0 0 32 0 0 (l) ts
 58.6338 +}
 58.6339 +true
 58.6340 +[0 0 0 1]sts
 58.6341 +Q
 58.6342 +1979.2185 1991.7809 m
 58.6343 +1960.6353 1998.5452 L
 58.6344 +1953.4532 1978.8124 L
 58.6345 +1972.0363 1972.0481 L
 58.6346 +1979.2185 1991.7809 L
 58.6347 +n
 58.6348 +q
 58.6349 +_bfh
 58.6350 +%%IncludeResource: font Symbol
 58.6351 +_efh
 58.6352 +{
 58.6353 +f0 [18.793335 -6.84082 6.84021 18.793335 0 0] makesetfont
 58.6354 +1955.163254 1983.510773 m
 58.6355 +0 0 32 0 0 (\256) ts
 58.6356 +}
 58.6357 +true
 58.6358 +[0 0 0 1]sts
 58.6359 +Q
 58.6360 +1952.1544 2066.5423 m
 58.6361 +1938.0739 2069.025 L
 58.6362 +1934.4274 2048.3444 L
 58.6363 +1948.5079 2045.8617 L
 58.6364 +1952.1544 2066.5423 L
 58.6365 +n
 58.6366 +q
 58.6367 +_bfh
 58.6368 +%%IncludeResource: font Symbol
 58.6369 +_efh
 58.6370 +{
 58.6371 +f0 [19.696045 -3.4729 3.4729 19.696045 0 0] makesetfont
 58.6372 +1935.29567 2053.268433 m
 58.6373 +0 0 32 0 0 (") ts
 58.6374 +}
 58.6375 +true
 58.6376 +[0 0 0 1]sts
 58.6377 +Q
 58.6378 +1931.7231 2043.621 m
 58.6379 +1919.3084 2048.14 L
 58.6380 +1910.6898 2024.4607 L
 58.6381 +1923.1046 2019.9417 L
 58.6382 +1931.7231 2043.621 L
 58.6383 +n
 58.6384 +q
 58.6385 +_bfh
 58.6386 +%%IncludeResource: font Symbol
 58.6387 +_efh
 58.6388 +{
 58.6389 +f0 [22.552002 -8.208984 8.208252 22.552002 0 0] makesetfont
 58.6390 +1912.741867 2030.098648 m
 58.6391 +0 0 32 0 0 (=) ts
 58.6392 +}
 58.6393 +true
 58.6394 +[0 0 0 1]sts
 58.6395 +Q
 58.6396 +1944 2024.5 m
 58.6397 +1944 2014 L
 58.6398 +0.8504 w
 58.6399 +0 J
 58.6400 +3.863693 M
 58.6401 +[0 0 0 1]  vc
 58.6402 +false setoverprint
 58.6403 +S 
 58.6404 +n
 58.6405 +1944.25 2019.1673 m
 58.6406 +1952.5 2015.9173 L
 58.6407 +S 
 58.6408 +n
 58.6409 +1931.0787 2124.423 m
 58.6410 +1855.5505 2043.4285 L
 58.6411 +1871.0419 2013.0337 L
 58.6412 +1946.5701 2094.0282 L
 58.6413 +1931.0787 2124.423 L
 58.6414 +n
 58.6415 +q
 58.6416 +_bfh
 58.6417 +%%IncludeResource: font ZapfHumanist601BT-Bold
 58.6418 +_efh
 58.6419 +{
 58.6420 +f1 [22.155762 23.759277 -14.753906 28.947754 0 0] makesetfont
 58.6421 +1867.35347 2020.27063 m
 58.6422 +0 0 32 0 0 (Isabelle) ts
 58.6423 +}
 58.6424 +true
 58.6425 +[0 0 0 1]sts
 58.6426 +Q
 58.6427 +1933.5503 1996.9547 m
 58.6428 +1922.7012 1998.8677 L
 58.6429 +1919.0547 1978.1871 L
 58.6430 +1929.9038 1976.2741 L
 58.6431 +1933.5503 1996.9547 L
 58.6432 +n
 58.6433 +q
 58.6434 +_bfh
 58.6435 +%%IncludeResource: font Symbol
 58.6436 +_efh
 58.6437 +{
 58.6438 +f0 [19.696045 -3.4729 3.4729 19.696045 0 0] makesetfont
 58.6439 +1919.922913 1983.111069 m
 58.6440 +0 0 32 0 0 (b) ts
 58.6441 +}
 58.6442 +true
 58.6443 +[0 0 0 1]sts
 58.6444 +Q
 58.6445 +2006.3221 2025.7184 m
 58.6446 +1993.8573 2027.9162 L
 58.6447 +1990.2108 2007.2356 L
 58.6448 +2002.6756 2005.0378 L
 58.6449 +2006.3221 2025.7184 L
 58.6450 +n
 58.6451 +q
 58.6452 +_bfh
 58.6453 +%%IncludeResource: font Symbol
 58.6454 +_efh
 58.6455 +{
 58.6456 +f0 [19.696045 -3.4729 3.4729 19.696045 0 0] makesetfont
 58.6457 +1991.07901 2012.159653 m
 58.6458 +0 0 32 0 0 (a) ts
 58.6459 +}
 58.6460 +true
 58.6461 +[0 0 0 1]sts
 58.6462 +Q
 58.6463 +vmrs
 58.6464 +2030.0624 2094.056 m
 58.6465 +1956.3187 2120.904 L
 58.6466 +1956.321 2095.3175 L
 58.6467 +2030.0647 2068.4695 L
 58.6468 +2030.0624 2094.056 L
 58.6469 +n
 58.6470 +q
 58.6471 +_bfh
 58.6472 +%%IncludeResource: font ZapfHumanist601BT-Bold
 58.6473 +_efh
 58.6474 +{
 58.6475 +f1 [22.898804 -8.336792 -0.002197 24.368408 0 0] makesetfont
 58.6476 +1956.320496 2101.409561 m
 58.6477 +0 0 32 0 0 (Isar) ts
 58.6478 +}
 58.6479 +true
 58.6480 +[0 0 0 1]sts
 58.6481 +Q
 58.6482 +vmr
 58.6483 +vmr
 58.6484 +end
 58.6485 +%%Trailer
 58.6486 +%%DocumentNeededResources: font Symbol
 58.6487 +%%+ font ZapfHumanist601BT-Bold
 58.6488 +%%DocumentFonts: Symbol
 58.6489 +%%+ ZapfHumanist601BT-Bold
 58.6490 +%%DocumentNeededFonts: Symbol
 58.6491 +%%+ ZapfHumanist601BT-Bold
    59.1 Binary file doc-src/Functions/isabelle_isar.pdf has changed
    60.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    60.2 +++ b/doc-src/Functions/mathpartir.sty	Tue Mar 03 11:00:51 2009 +0100
    60.3 @@ -0,0 +1,421 @@
    60.4 +%  Mathpartir --- Math Paragraph for Typesetting Inference Rules
    60.5 +%
    60.6 +%  Copyright (C) 2001, 2002, 2003, 2004, 2005 Didier Rémy
    60.7 +%
    60.8 +%  Author         : Didier Remy 
    60.9 +%  Version        : 1.2.0
   60.10 +%  Bug Reports    : to author
   60.11 +%  Web Site       : http://pauillac.inria.fr/~remy/latex/
   60.12 +% 
   60.13 +%  Mathpartir is free software; you can redistribute it and/or modify
   60.14 +%  it under the terms of the GNU General Public License as published by
   60.15 +%  the Free Software Foundation; either version 2, or (at your option)
   60.16 +%  any later version.
   60.17 +%  
   60.18 +%  Mathpartir is distributed in the hope that it will be useful,
   60.19 +%  but WITHOUT ANY WARRANTY; without even the implied warranty of
   60.20 +%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   60.21 +%  GNU General Public License for more details 
   60.22 +%  (http://pauillac.inria.fr/~remy/license/GPL).
   60.23 +%
   60.24 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   60.25 +%  File mathpartir.sty (LaTeX macros)
   60.26 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   60.27 +
   60.28 +\NeedsTeXFormat{LaTeX2e}
   60.29 +\ProvidesPackage{mathpartir}
   60.30 +    [2005/12/20 version 1.2.0 Math Paragraph for Typesetting Inference Rules]
   60.31 +
   60.32 +%%
   60.33 +
   60.34 +%% Identification
   60.35 +%% Preliminary declarations
   60.36 +
   60.37 +\RequirePackage {keyval}
   60.38 +
   60.39 +%% Options
   60.40 +%% More declarations
   60.41 +
   60.42 +%% PART I: Typesetting maths in paragraphe mode
   60.43 +
   60.44 +\newdimen \mpr@tmpdim
   60.45 +
   60.46 +% To ensure hevea \hva compatibility, \hva should expands to nothing 
   60.47 +% in mathpar or in inferrule
   60.48 +\let \mpr@hva \empty
   60.49 +
   60.50 +%% normal paragraph parametters, should rather be taken dynamically
   60.51 +\def \mpr@savepar {%
   60.52 +  \edef \MathparNormalpar
   60.53 +     {\noexpand \lineskiplimit \the\lineskiplimit
   60.54 +      \noexpand \lineskip \the\lineskip}%
   60.55 +  }
   60.56 +
   60.57 +\def \mpr@rulelineskip {\lineskiplimit=0.3em\lineskip=0.2em plus 0.1em}
   60.58 +\def \mpr@lesslineskip {\lineskiplimit=0.6em\lineskip=0.5em plus 0.2em}
   60.59 +\def \mpr@lineskip  {\lineskiplimit=1.2em\lineskip=1.2em plus 0.2em}
   60.60 +\let \MathparLineskip \mpr@lineskip
   60.61 +\def \mpr@paroptions {\MathparLineskip}
   60.62 +\let \mpr@prebindings \relax
   60.63 +
   60.64 +\newskip \mpr@andskip \mpr@andskip 2em plus 0.5fil minus 0.5em
   60.65 +
   60.66 +\def \mpr@goodbreakand
   60.67 +   {\hskip -\mpr@andskip  \penalty -1000\hskip \mpr@andskip}
   60.68 +\def \mpr@and {\hskip \mpr@andskip}
   60.69 +\def \mpr@andcr {\penalty 50\mpr@and}
   60.70 +\def \mpr@cr {\penalty -10000\mpr@and}
   60.71 +\def \mpr@eqno #1{\mpr@andcr #1\hskip 0em plus -1fil \penalty 10}
   60.72 +
   60.73 +\def \mpr@bindings {%
   60.74 +  \let \and \mpr@andcr
   60.75 +  \let \par \mpr@andcr
   60.76 +  \let \\\mpr@cr
   60.77 +  \let \eqno \mpr@eqno
   60.78 +  \let \hva \mpr@hva
   60.79 +  } 
   60.80 +\let \MathparBindings \mpr@bindings
   60.81 +
   60.82 +% \@ifundefined {ignorespacesafterend}
   60.83 +%    {\def \ignorespacesafterend {\aftergroup \ignorespaces}
   60.84 +
   60.85 +\newenvironment{mathpar}[1][]
   60.86 +  {$$\mpr@savepar \parskip 0em \hsize \linewidth \centering
   60.87 +     \vbox \bgroup \mpr@prebindings \mpr@paroptions #1\ifmmode $\else
   60.88 +     \noindent $\displaystyle\fi
   60.89 +     \MathparBindings}
   60.90 +  {\unskip \ifmmode $\fi\egroup $$\ignorespacesafterend}
   60.91 +
   60.92 +% \def \math@mathpar #1{\setbox0 \hbox {$\displaystyle #1$}\ifnum
   60.93 +%     \wd0 < \hsize  $$\box0$$\else \bmathpar #1\emathpar \fi}
   60.94 +
   60.95 +%%% HOV BOXES
   60.96 +
   60.97 +\def \mathvbox@ #1{\hbox \bgroup \mpr@normallineskip 
   60.98 +  \vbox \bgroup \tabskip 0em \let \\ \cr
   60.99 +  \halign \bgroup \hfil $##$\hfil\cr #1\crcr \egroup \egroup
  60.100 +  \egroup}
  60.101 +
  60.102 +\def \mathhvbox@ #1{\setbox0 \hbox {\let \\\qquad $#1$}\ifnum \wd0 < \hsize
  60.103 +      \box0\else \mathvbox {#1}\fi}
  60.104 +
  60.105 +
  60.106 +%% Part II -- operations on lists
  60.107 +
  60.108 +\newtoks \mpr@lista
  60.109 +\newtoks \mpr@listb
  60.110 +
  60.111 +\long \def\mpr@cons #1\mpr@to#2{\mpr@lista {\\{#1}}\mpr@listb \expandafter
  60.112 +{#2}\edef #2{\the \mpr@lista \the \mpr@listb}}
  60.113 +
  60.114 +\long \def\mpr@snoc #1\mpr@to#2{\mpr@lista {\\{#1}}\mpr@listb \expandafter
  60.115 +{#2}\edef #2{\the \mpr@listb\the\mpr@lista}}
  60.116 +
  60.117 +\long \def \mpr@concat#1=#2\mpr@to#3{\mpr@lista \expandafter {#2}\mpr@listb
  60.118 +\expandafter {#3}\edef #1{\the \mpr@listb\the\mpr@lista}}
  60.119 +
  60.120 +\def \mpr@head #1\mpr@to #2{\expandafter \mpr@head@ #1\mpr@head@ #1#2}
  60.121 +\long \def \mpr@head@ #1#2\mpr@head@ #3#4{\def #4{#1}\def#3{#2}}
  60.122 +
  60.123 +\def \mpr@flatten #1\mpr@to #2{\expandafter \mpr@flatten@ #1\mpr@flatten@ #1#2}
  60.124 +\long \def \mpr@flatten@ \\#1\\#2\mpr@flatten@ #3#4{\def #4{#1}\def #3{\\#2}}
  60.125 +
  60.126 +\def \mpr@makelist #1\mpr@to #2{\def \mpr@all {#1}%
  60.127 +   \mpr@lista {\\}\mpr@listb \expandafter {\mpr@all}\edef \mpr@all {\the
  60.128 +   \mpr@lista \the \mpr@listb \the \mpr@lista}\let #2\empty 
  60.129 +   \def \mpr@stripof ##1##2\mpr@stripend{\def \mpr@stripped{##2}}\loop
  60.130 +     \mpr@flatten \mpr@all \mpr@to \mpr@one
  60.131 +     \expandafter \mpr@snoc \mpr@one \mpr@to #2\expandafter \mpr@stripof
  60.132 +     \mpr@all \mpr@stripend  
  60.133 +     \ifx \mpr@stripped \empty \let \mpr@isempty 0\else \let \mpr@isempty 1\fi
  60.134 +     \ifx 1\mpr@isempty
  60.135 +   \repeat
  60.136 +}
  60.137 +
  60.138 +\def \mpr@rev #1\mpr@to #2{\let \mpr@tmp \empty
  60.139 +   \def \\##1{\mpr@cons ##1\mpr@to \mpr@tmp}#1\let #2\mpr@tmp}
  60.140 +
  60.141 +%% Part III -- Type inference rules
  60.142 +
  60.143 +\newif \if@premisse
  60.144 +\newbox \mpr@hlist
  60.145 +\newbox \mpr@vlist
  60.146 +\newif \ifmpr@center \mpr@centertrue
  60.147 +\def \mpr@htovlist {%
  60.148 +   \setbox \mpr@hlist
  60.149 +      \hbox {\strut
  60.150 +             \ifmpr@center \hskip -0.5\wd\mpr@hlist\fi
  60.151 +             \unhbox \mpr@hlist}%
  60.152 +   \setbox \mpr@vlist
  60.153 +      \vbox {\if@premisse  \box \mpr@hlist \unvbox \mpr@vlist
  60.154 +             \else \unvbox \mpr@vlist \box \mpr@hlist
  60.155 +             \fi}%
  60.156 +}
  60.157 +% OLD version
  60.158 +% \def \mpr@htovlist {%
  60.159 +%    \setbox \mpr@hlist
  60.160 +%       \hbox {\strut \hskip -0.5\wd\mpr@hlist \unhbox \mpr@hlist}%
  60.161 +%    \setbox \mpr@vlist
  60.162 +%       \vbox {\if@premisse  \box \mpr@hlist \unvbox \mpr@vlist
  60.163 +%              \else \unvbox \mpr@vlist \box \mpr@hlist
  60.164 +%              \fi}%
  60.165 +% }
  60.166 +
  60.167 +\def \mpr@item #1{$\displaystyle #1$}
  60.168 +\def \mpr@sep{2em}
  60.169 +\def \mpr@blank { }
  60.170 +\def \mpr@hovbox #1#2{\hbox
  60.171 +  \bgroup
  60.172 +  \ifx #1T\@premissetrue
  60.173 +  \else \ifx #1B\@premissefalse
  60.174 +  \else
  60.175 +     \PackageError{mathpartir}
  60.176 +       {Premisse orientation should either be T or B}
  60.177 +       {Fatal error in Package}%
  60.178 +  \fi \fi
  60.179 +  \def \@test {#2}\ifx \@test \mpr@blank\else
  60.180 +  \setbox \mpr@hlist \hbox {}%
  60.181 +  \setbox \mpr@vlist \vbox {}%
  60.182 +  \if@premisse \let \snoc \mpr@cons \else \let \snoc \mpr@snoc \fi
  60.183 +  \let \@hvlist \empty \let \@rev \empty
  60.184 +  \mpr@tmpdim 0em
  60.185 +  \expandafter \mpr@makelist #2\mpr@to \mpr@flat
  60.186 +  \if@premisse \mpr@rev \mpr@flat \mpr@to \@rev \else \let \@rev \mpr@flat \fi
  60.187 +  \def \\##1{%
  60.188 +     \def \@test {##1}\ifx \@test \empty
  60.189 +        \mpr@htovlist
  60.190 +        \mpr@tmpdim 0em %%% last bug fix not extensively checked
  60.191 +     \else
  60.192 +      \setbox0 \hbox{\mpr@item {##1}}\relax
  60.193 +      \advance \mpr@tmpdim by \wd0
  60.194 +      %\mpr@tmpdim 1.02\mpr@tmpdim
  60.195 +      \ifnum \mpr@tmpdim < \hsize
  60.196 +         \ifnum \wd\mpr@hlist > 0
  60.197 +           \if@premisse
  60.198 +             \setbox \mpr@hlist 
  60.199 +                \hbox {\unhbox0 \hskip \mpr@sep \unhbox \mpr@hlist}%
  60.200 +           \else
  60.201 +             \setbox \mpr@hlist
  60.202 +                \hbox {\unhbox \mpr@hlist  \hskip \mpr@sep \unhbox0}%
  60.203 +           \fi
  60.204 +         \else 
  60.205 +         \setbox \mpr@hlist \hbox {\unhbox0}%
  60.206 +         \fi
  60.207 +      \else
  60.208 +         \ifnum \wd \mpr@hlist > 0
  60.209 +            \mpr@htovlist 
  60.210 +            \mpr@tmpdim \wd0
  60.211 +         \fi
  60.212 +         \setbox \mpr@hlist \hbox {\unhbox0}%
  60.213 +      \fi
  60.214 +      \advance \mpr@tmpdim by \mpr@sep
  60.215 +   \fi
  60.216 +   }%
  60.217 +   \@rev
  60.218 +   \mpr@htovlist
  60.219 +   \ifmpr@center \hskip \wd\mpr@vlist\fi \box \mpr@vlist
  60.220 +   \fi
  60.221 +   \egroup
  60.222 +}
  60.223 +
  60.224 +%%% INFERENCE RULES
  60.225 +
  60.226 +\@ifundefined{@@over}{%
  60.227 +    \let\@@over\over % fallback if amsmath is not loaded
  60.228 +    \let\@@overwithdelims\overwithdelims
  60.229 +    \let\@@atop\atop \let\@@atopwithdelims\atopwithdelims
  60.230 +    \let\@@above\above \let\@@abovewithdelims\abovewithdelims
  60.231 +  }{}
  60.232 +
  60.233 +%% The default
  60.234 +
  60.235 +\def \mpr@@fraction #1#2{\hbox {\advance \hsize by -0.5em
  60.236 +    $\displaystyle {#1\mpr@over #2}$}}
  60.237 +\let \mpr@fraction \mpr@@fraction
  60.238 +
  60.239 +%% A generic solution to arrow
  60.240 +
  60.241 +\def \mpr@make@fraction #1#2#3#4#5{\hbox {%
  60.242 +     \def \mpr@tail{#1}%
  60.243 +     \def \mpr@body{#2}%
  60.244 +     \def \mpr@head{#3}%
  60.245 +     \setbox1=\hbox{$#4$}\setbox2=\hbox{$#5$}%
  60.246 +     \setbox3=\hbox{$\mkern -3mu\mpr@body\mkern -3mu$}%
  60.247 +     \setbox3=\hbox{$\mkern -3mu \mpr@body\mkern -3mu$}%
  60.248 +     \dimen0=\dp1\advance\dimen0 by \ht3\relax\dp1\dimen0\relax
  60.249 +     \dimen0=\ht2\advance\dimen0 by \dp3\relax\ht2\dimen0\relax
  60.250 +     \setbox0=\hbox {$\box1 \@@atop \box2$}%
  60.251 +     \dimen0=\wd0\box0
  60.252 +     \box0 \hskip -\dimen0\relax
  60.253 +     \hbox to \dimen0 {$%
  60.254 +       \mathrel{\mpr@tail}\joinrel
  60.255 +       \xleaders\hbox{\copy3}\hfil\joinrel\mathrel{\mpr@head}%
  60.256 +     $}}}
  60.257 +
  60.258 +%% Old stuff should be removed in next version
  60.259 +\def \mpr@@reduce #1#2{\hbox
  60.260 +    {$\lower 0.01pt \mpr@@fraction {#1}{#2}\mkern -15mu\rightarrow$}}
  60.261 +\def \mpr@@rewrite #1#2#3{\hbox
  60.262 +    {$\lower 0.01pt \mpr@@fraction {#2}{#3}\mkern -8mu#1$}}
  60.263 +\def \mpr@infercenter #1{\vcenter {\mpr@hovbox{T}{#1}}}
  60.264 +
  60.265 +\def \mpr@empty {}
  60.266 +\def \mpr@inferrule
  60.267 +  {\bgroup
  60.268 +     \ifnum \linewidth<\hsize \hsize \linewidth\fi
  60.269 +     \mpr@rulelineskip
  60.270 +     \let \and \qquad
  60.271 +     \let \hva \mpr@hva
  60.272 +     \let \@rulename \mpr@empty
  60.273 +     \let \@rule@options \mpr@empty
  60.274 +     \let \mpr@over \@@over
  60.275 +     \mpr@inferrule@}
  60.276 +\newcommand {\mpr@inferrule@}[3][]
  60.277 +  {\everymath={\displaystyle}%       
  60.278 +   \def \@test {#2}\ifx \empty \@test
  60.279 +      \setbox0 \hbox {$\vcenter {\mpr@hovbox{B}{#3}}$}%
  60.280 +   \else 
  60.281 +   \def \@test {#3}\ifx \empty \@test
  60.282 +      \setbox0 \hbox {$\vcenter {\mpr@hovbox{T}{#2}}$}%
  60.283 +   \else
  60.284 +   \setbox0 \mpr@fraction {\mpr@hovbox{T}{#2}}{\mpr@hovbox{B}{#3}}%
  60.285 +   \fi \fi
  60.286 +   \def \@test {#1}\ifx \@test\empty \box0
  60.287 +   \else \vbox 
  60.288 +%%% Suggestion de Francois pour les etiquettes longues
  60.289 +%%%   {\hbox to \wd0 {\RefTirName {#1}\hfil}\box0}\fi
  60.290 +      {\hbox {\RefTirName {#1}}\box0}\fi
  60.291 +   \egroup}
  60.292 +
  60.293 +\def \mpr@vdotfil #1{\vbox to #1{\leaders \hbox{$\cdot$} \vfil}}
  60.294 +
  60.295 +% They are two forms
  60.296 +% \inferrule [label]{[premisses}{conclusions}
  60.297 +% or
  60.298 +% \inferrule* [options]{[premisses}{conclusions}
  60.299 +%
  60.300 +% Premisses and conclusions are lists of elements separated by \\
  60.301 +% Each \\ produces a break, attempting horizontal breaks if possible, 
  60.302 +% and  vertical breaks if needed. 
  60.303 +% 
  60.304 +% An empty element obtained by \\\\ produces a vertical break in all cases. 
  60.305 +%
  60.306 +% The former rule is aligned on the fraction bar. 
  60.307 +% The optional label appears on top of the rule
  60.308 +% The second form to be used in a derivation tree is aligned on the last
  60.309 +% line of its conclusion
  60.310 +% 
  60.311 +% The second form can be parameterized, using the key=val interface. The
  60.312 +% folloiwng keys are recognized:
  60.313 +%       
  60.314 +%  width                set the width of the rule to val
  60.315 +%  narrower             set the width of the rule to val\hsize
  60.316 +%  before               execute val at the beginning/left
  60.317 +%  lab                  put a label [Val] on top of the rule
  60.318 +%  lskip                add negative skip on the right
  60.319 +%  left                 put a left label [Val]
  60.320 +%  Left                 put a left label [Val],  ignoring its width 
  60.321 +%  right                put a right label [Val]
  60.322 +%  Right                put a right label [Val], ignoring its width
  60.323 +%  leftskip             skip negative space on the left-hand side
  60.324 +%  rightskip            skip negative space on the right-hand side
  60.325 +%  vdots                lift the rule by val and fill vertical space with dots
  60.326 +%  after                execute val at the end/right
  60.327 +%  
  60.328 +%  Note that most options must come in this order to avoid strange
  60.329 +%  typesetting (in particular  leftskip must preceed left and Left and
  60.330 +%  rightskip must follow Right or right; vdots must come last 
  60.331 +%  or be only followed by rightskip. 
  60.332 +%  
  60.333 +
  60.334 +%% Keys that make sence in all kinds of rules
  60.335 +\def \mprset #1{\setkeys{mprset}{#1}}
  60.336 +\define@key {mprset}{flushleft}[]{\mpr@centerfalse}
  60.337 +\define@key {mprset}{center}[]{\mpr@centertrue}
  60.338 +\define@key {mprset}{rewrite}[]{\let \mpr@fraction \mpr@@rewrite}
  60.339 +\define@key {mprset}{myfraction}[]{\let \mpr@fraction #1}
  60.340 +\define@key {mprset}{fraction}[]{\def \mpr@fraction {\mpr@make@fraction #1}}
  60.341 +
  60.342 +\newbox \mpr@right
  60.343 +\define@key {mpr}{flushleft}[]{\mpr@centerfalse}
  60.344 +\define@key {mpr}{center}[]{\mpr@centertrue}
  60.345 +\define@key {mpr}{rewrite}[]{\let \mpr@fraction \mpr@@rewrite}
  60.346 +\define@key {mpr}{myfraction}[]{\let \mpr@fraction #1}
  60.347 +\define@key {mpr}{fraction}[]{\def \mpr@fraction {\mpr@make@fraction #1}}
  60.348 +\define@key {mpr}{left}{\setbox0 \hbox {$\TirName {#1}\;$}\relax
  60.349 +     \advance \hsize by -\wd0\box0}
  60.350 +\define@key {mpr}{width}{\hsize #1}
  60.351 +\define@key {mpr}{sep}{\def\mpr@sep{#1}}
  60.352 +\define@key {mpr}{before}{#1}
  60.353 +\define@key {mpr}{lab}{\let \RefTirName \TirName \def \mpr@rulename {#1}}
  60.354 +\define@key {mpr}{Lab}{\let \RefTirName \TirName \def \mpr@rulename {#1}}
  60.355 +\define@key {mpr}{narrower}{\hsize #1\hsize}
  60.356 +\define@key {mpr}{leftskip}{\hskip -#1}
  60.357 +\define@key {mpr}{reduce}[]{\let \mpr@fraction \mpr@@reduce}
  60.358 +\define@key {mpr}{rightskip}
  60.359 +  {\setbox \mpr@right \hbox {\unhbox \mpr@right \hskip -#1}}
  60.360 +\define@key {mpr}{LEFT}{\setbox0 \hbox {$#1$}\relax
  60.361 +     \advance \hsize by -\wd0\box0}
  60.362 +\define@key {mpr}{left}{\setbox0 \hbox {$\TirName {#1}\;$}\relax
  60.363 +     \advance \hsize by -\wd0\box0}
  60.364 +\define@key {mpr}{Left}{\llap{$\TirName {#1}\;$}}
  60.365 +\define@key {mpr}{right}
  60.366 +  {\setbox0 \hbox {$\;\TirName {#1}$}\relax \advance \hsize by -\wd0
  60.367 +   \setbox \mpr@right \hbox {\unhbox \mpr@right \unhbox0}}
  60.368 +\define@key {mpr}{RIGHT}
  60.369 +  {\setbox0 \hbox {$#1$}\relax \advance \hsize by -\wd0
  60.370 +   \setbox \mpr@right \hbox {\unhbox \mpr@right \unhbox0}}
  60.371 +\define@key {mpr}{Right}
  60.372 +  {\setbox \mpr@right \hbox {\unhbox \mpr@right \rlap {$\;\TirName {#1}$}}}
  60.373 +\define@key {mpr}{vdots}{\def \mpr@vdots {\@@atop \mpr@vdotfil{#1}}}
  60.374 +\define@key {mpr}{after}{\edef \mpr@after {\mpr@after #1}}
  60.375 +
  60.376 +\newdimen \rule@dimen
  60.377 +\newcommand \mpr@inferstar@ [3][]{\setbox0
  60.378 +  \hbox {\let \mpr@rulename \mpr@empty \let \mpr@vdots \relax
  60.379 +         \setbox \mpr@right \hbox{}%
  60.380 +         $\setkeys{mpr}{#1}%
  60.381 +          \ifx \mpr@rulename \mpr@empty \mpr@inferrule {#2}{#3}\else
  60.382 +          \mpr@inferrule [{\mpr@rulename}]{#2}{#3}\fi
  60.383 +          \box \mpr@right \mpr@vdots$}
  60.384 +  \setbox1 \hbox {\strut}
  60.385 +  \rule@dimen \dp0 \advance \rule@dimen by -\dp1
  60.386 +  \raise \rule@dimen \box0}
  60.387 +
  60.388 +\def \mpr@infer {\@ifnextchar *{\mpr@inferstar}{\mpr@inferrule}}
  60.389 +\newcommand \mpr@err@skipargs[3][]{}
  60.390 +\def \mpr@inferstar*{\ifmmode 
  60.391 +    \let \@do \mpr@inferstar@
  60.392 +  \else 
  60.393 +    \let \@do \mpr@err@skipargs
  60.394 +    \PackageError {mathpartir}
  60.395 +      {\string\inferrule* can only be used in math mode}{}%
  60.396 +  \fi \@do}
  60.397 +
  60.398 +
  60.399 +%%% Exports
  60.400 +
  60.401 +% Envirnonment mathpar
  60.402 +
  60.403 +\let \inferrule \mpr@infer
  60.404 +
  60.405 +% make a short name \infer is not already defined
  60.406 +\@ifundefined {infer}{\let \infer \mpr@infer}{}
  60.407 +
  60.408 +\def \TirNameStyle #1{\small \textsc{#1}}
  60.409 +\def \tir@name #1{\hbox {\small \TirNameStyle{#1}}}
  60.410 +\let \TirName \tir@name
  60.411 +\let \DefTirName \TirName
  60.412 +\let \RefTirName \TirName
  60.413 +
  60.414 +%%% Other Exports
  60.415 +
  60.416 +% \let \listcons \mpr@cons
  60.417 +% \let \listsnoc \mpr@snoc
  60.418 +% \let \listhead \mpr@head
  60.419 +% \let \listmake \mpr@makelist
  60.420 +
  60.421 +
  60.422 +
  60.423 +
  60.424 +\endinput
    61.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    61.2 +++ b/doc-src/Functions/style.sty	Tue Mar 03 11:00:51 2009 +0100
    61.3 @@ -0,0 +1,46 @@
    61.4 +%% toc
    61.5 +\newcommand{\tocentry}[1]{\cleardoublepage\phantomsection\addcontentsline{toc}{chapter}{#1}
    61.6 +\@mkboth{\MakeUppercase{#1}}{\MakeUppercase{#1}}}
    61.7 +
    61.8 +%% references
    61.9 +\newcommand{\secref}[1]{\S\ref{#1}}
   61.10 +\newcommand{\chref}[1]{chapter~\ref{#1}}
   61.11 +\newcommand{\figref}[1]{figure~\ref{#1}}
   61.12 +
   61.13 +%% math
   61.14 +\newcommand{\text}[1]{\mbox{#1}}
   61.15 +\newcommand{\isasymvartheta}{\isamath{\theta}}
   61.16 +\newcommand{\isactrlvec}[1]{\emph{$\overline{#1}$}}
   61.17 +
   61.18 +\setcounter{secnumdepth}{2} \setcounter{tocdepth}{2}
   61.19 +
   61.20 +\pagestyle{headings}
   61.21 +\sloppy
   61.22 +\binperiod
   61.23 +\underscoreon
   61.24 +
   61.25 +\renewcommand{\isadigit}[1]{\isamath{#1}}
   61.26 +
   61.27 +\newenvironment{mldecls}{\par\noindent\begingroup\footnotesize\def\isanewline{\\}\begin{tabular}{l}}{\end{tabular}\smallskip\endgroup}
   61.28 +
   61.29 +\isafoldtag{FIXME}
   61.30 +\isakeeptag{mlref}
   61.31 +\renewcommand{\isatagmlref}{\subsection*{\makebox[0pt][r]{\fbox{\ML}~~}Reference}\begingroup\def\isastyletext{\rm}\small}
   61.32 +\renewcommand{\endisatagmlref}{\endgroup}
   61.33 +
   61.34 +\newcommand{\isasymGUESS}{\isakeyword{guess}}
   61.35 +\newcommand{\isasymOBTAIN}{\isakeyword{obtain}}
   61.36 +\newcommand{\isasymTHEORY}{\isakeyword{theory}}
   61.37 +\newcommand{\isasymUSES}{\isakeyword{uses}}
   61.38 +\newcommand{\isasymEND}{\isakeyword{end}}
   61.39 +\newcommand{\isasymCONSTS}{\isakeyword{consts}}
   61.40 +\newcommand{\isasymDEFS}{\isakeyword{defs}}
   61.41 +\newcommand{\isasymTHEOREM}{\isakeyword{theorem}}
   61.42 +\newcommand{\isasymDEFINITION}{\isakeyword{definition}}
   61.43 +
   61.44 +\isabellestyle{it}
   61.45 +
   61.46 +%%% Local Variables: 
   61.47 +%%% mode: latex
   61.48 +%%% TeX-master: "implementation"
   61.49 +%%% End: 
    62.1 --- a/doc-src/IsarAdvanced/Classes/IsaMakefile	Mon Mar 02 16:58:39 2009 +0100
    62.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    62.3 @@ -1,33 +0,0 @@
    62.4 -
    62.5 -## targets
    62.6 -
    62.7 -default: Thy
    62.8 -images: 
    62.9 -test: Thy
   62.10 -
   62.11 -all: images test
   62.12 -
   62.13 -
   62.14 -## global settings
   62.15 -
   62.16 -SRC = $(ISABELLE_HOME)/src
   62.17 -OUT = $(ISABELLE_OUTPUT)
   62.18 -LOG = $(OUT)/log
   62.19 -
   62.20 -USEDIR = $(ISABELLE_TOOL) usedir -v true -i false -d false -C false -D document
   62.21 -
   62.22 -
   62.23 -## Thy
   62.24 -
   62.25 -THY = $(LOG)/HOL-Thy.gz
   62.26 -
   62.27 -Thy: $(THY)
   62.28 -
   62.29 -$(THY): Thy/ROOT.ML Thy/Setup.thy Thy/Classes.thy
   62.30 -	@$(USEDIR) HOL Thy
   62.31 -
   62.32 -
   62.33 -## clean
   62.34 -
   62.35 -clean:
   62.36 -	@rm -f $(THY)
    63.1 --- a/doc-src/IsarAdvanced/Classes/Makefile	Mon Mar 02 16:58:39 2009 +0100
    63.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    63.3 @@ -1,38 +0,0 @@
    63.4 -#
    63.5 -# $Id$
    63.6 -#
    63.7 -
    63.8 -## targets
    63.9 -
   63.10 -default: dvi
   63.11 -
   63.12 -
   63.13 -## dependencies
   63.14 -
   63.15 -include ../Makefile.in
   63.16 -
   63.17 -NAME = classes
   63.18 -
   63.19 -FILES = $(NAME).tex classes.tex Thy/document/Classes.tex \
   63.20 -  style.sty ../../iman.sty ../../extra.sty ../../isar.sty \
   63.21 -  ../../isabelle.sty ../../isabellesym.sty ../../pdfsetup.sty \
   63.22 -  ../../manual.bib ../../proof.sty
   63.23 -
   63.24 -dvi: $(NAME).dvi
   63.25 -
   63.26 -$(NAME).dvi: $(FILES) isabelle_isar.eps
   63.27 -	$(LATEX) $(NAME)
   63.28 -	$(BIBTEX) $(NAME)
   63.29 -	$(LATEX) $(NAME)
   63.30 -	$(LATEX) $(NAME)
   63.31 -
   63.32 -pdf: $(NAME).pdf
   63.33 -
   63.34 -$(NAME).pdf: $(FILES) isabelle_isar.pdf
   63.35 -	$(PDFLATEX) $(NAME)
   63.36 -	$(BIBTEX) $(NAME)
   63.37 -	$(PDFLATEX) $(NAME)
   63.38 -	$(PDFLATEX) $(NAME)
   63.39 -	$(FIXBOOKMARKS) $(NAME).out
   63.40 -	$(PDFLATEX) $(NAME)
   63.41 -	$(PDFLATEX) $(NAME)
    64.1 --- a/doc-src/IsarAdvanced/Classes/Thy/Classes.thy	Mon Mar 02 16:58:39 2009 +0100
    64.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    64.3 @@ -1,635 +0,0 @@
    64.4 -theory Classes
    64.5 -imports Main Setup
    64.6 -begin
    64.7 -
    64.8 -chapter {* Haskell-style classes with Isabelle/Isar *}
    64.9 -
   64.10 -section {* Introduction *}
   64.11 -
   64.12 -text {*
   64.13 -  Type classes were introduces by Wadler and Blott \cite{wadler89how}
   64.14 -  into the Haskell language, to allow for a reasonable implementation
   64.15 -  of overloading\footnote{throughout this tutorial, we are referring
   64.16 -  to classical Haskell 1.0 type classes, not considering
   64.17 -  later additions in expressiveness}.
   64.18 -  As a canonical example, a polymorphic equality function
   64.19 -  @{text "eq \<Colon> \<alpha> \<Rightarrow> \<alpha> \<Rightarrow> bool"} which is overloaded on different
   64.20 -  types for @{text "\<alpha>"}, which is achieved by splitting introduction
   64.21 -  of the @{text eq} function from its overloaded definitions by means
   64.22 -  of @{text class} and @{text instance} declarations:
   64.23 -
   64.24 -  \begin{quote}
   64.25 -
   64.26 -  \noindent@{text "class eq where"}\footnote{syntax here is a kind of isabellized Haskell} \\
   64.27 -  \hspace*{2ex}@{text "eq \<Colon> \<alpha> \<Rightarrow> \<alpha> \<Rightarrow> bool"}
   64.28 -
   64.29 -  \medskip\noindent@{text "instance nat \<Colon> eq where"} \\
   64.30 -  \hspace*{2ex}@{text "eq 0 0 = True"} \\
   64.31 -  \hspace*{2ex}@{text "eq 0 _ = False"} \\
   64.32 -  \hspace*{2ex}@{text "eq _ 0 = False"} \\
   64.33 -  \hspace*{2ex}@{text "eq (Suc n) (Suc m) = eq n m"}
   64.34 -
   64.35 -  \medskip\noindent@{text "instance (\<alpha>\<Colon>eq, \<beta>\<Colon>eq) pair \<Colon> eq where"} \\
   64.36 -  \hspace*{2ex}@{text "eq (x1, y1) (x2, y2) = eq x1 x2 \<and> eq y1 y2"}
   64.37 -
   64.38 -  \medskip\noindent@{text "class ord extends eq where"} \\
   64.39 -  \hspace*{2ex}@{text "less_eq \<Colon> \<alpha> \<Rightarrow> \<alpha> \<Rightarrow> bool"} \\
   64.40 -  \hspace*{2ex}@{text "less \<Colon> \<alpha> \<Rightarrow> \<alpha> \<Rightarrow> bool"}
   64.41 -
   64.42 -  \end{quote}
   64.43 -
   64.44 -  \noindent Type variables are annotated with (finitely many) classes;
   64.45 -  these annotations are assertions that a particular polymorphic type
   64.46 -  provides definitions for overloaded functions.
   64.47 -
   64.48 -  Indeed, type classes not only allow for simple overloading
   64.49 -  but form a generic calculus, an instance of order-sorted
   64.50 -  algebra \cite{Nipkow-Prehofer:1993,nipkow-sorts93,Wenzel:1997:TPHOL}.
   64.51 -
   64.52 -  From a software engeneering point of view, type classes
   64.53 -  roughly correspond to interfaces in object-oriented languages like Java;
   64.54 -  so, it is naturally desirable that type classes do not only
   64.55 -  provide functions (class parameters) but also state specifications
   64.56 -  implementations must obey.  For example, the @{text "class eq"}
   64.57 -  above could be given the following specification, demanding that
   64.58 -  @{text "class eq"} is an equivalence relation obeying reflexivity,
   64.59 -  symmetry and transitivity:
   64.60 -
   64.61 -  \begin{quote}
   64.62 -
   64.63 -  \noindent@{text "class eq where"} \\
   64.64 -  \hspace*{2ex}@{text "eq \<Colon> \<alpha> \<Rightarrow> \<alpha> \<Rightarrow> bool"} \\
   64.65 -  @{text "satisfying"} \\
   64.66 -  \hspace*{2ex}@{text "refl: eq x x"} \\
   64.67 -  \hspace*{2ex}@{text "sym: eq x y \<longleftrightarrow> eq x y"} \\
   64.68 -  \hspace*{2ex}@{text "trans: eq x y \<and> eq y z \<longrightarrow> eq x z"}
   64.69 -
   64.70 -  \end{quote}
   64.71 -
   64.72 -  \noindent From a theoretic point of view, type classes are lightweight
   64.73 -  modules; Haskell type classes may be emulated by
   64.74 -  SML functors \cite{classes_modules}. 
   64.75 -  Isabelle/Isar offers a discipline of type classes which brings
   64.76 -  all those aspects together:
   64.77 -
   64.78 -  \begin{enumerate}
   64.79 -    \item specifying abstract parameters together with
   64.80 -       corresponding specifications,
   64.81 -    \item instantiating those abstract parameters by a particular
   64.82 -       type
   64.83 -    \item in connection with a ``less ad-hoc'' approach to overloading,
   64.84 -    \item with a direct link to the Isabelle module system
   64.85 -      (aka locales \cite{kammueller-locales}).
   64.86 -  \end{enumerate}
   64.87 -
   64.88 -  \noindent Isar type classes also directly support code generation
   64.89 -  in a Haskell like fashion.
   64.90 -
   64.91 -  This tutorial demonstrates common elements of structured specifications
   64.92 -  and abstract reasoning with type classes by the algebraic hierarchy of
   64.93 -  semigroups, monoids and groups.  Our background theory is that of
   64.94 -  Isabelle/HOL \cite{isa-tutorial}, for which some
   64.95 -  familiarity is assumed.
   64.96 -
   64.97 -  Here we merely present the look-and-feel for end users.
   64.98 -  Internally, those are mapped to more primitive Isabelle concepts.
   64.99 -  See \cite{Haftmann-Wenzel:2006:classes} for more detail.
  64.100 -*}
  64.101 -
  64.102 -section {* A simple algebra example \label{sec:example} *}
  64.103 -
  64.104 -subsection {* Class definition *}
  64.105 -
  64.106 -text {*
  64.107 -  Depending on an arbitrary type @{text "\<alpha>"}, class @{text
  64.108 -  "semigroup"} introduces a binary operator @{text "(\<otimes>)"} that is
  64.109 -  assumed to be associative:
  64.110 -*}
  64.111 -
  64.112 -class %quote semigroup =
  64.113 -  fixes mult :: "\<alpha> \<Rightarrow> \<alpha> \<Rightarrow> \<alpha>"    (infixl "\<otimes>" 70)
  64.114 -  assumes assoc: "(x \<otimes> y) \<otimes> z = x \<otimes> (y \<otimes> z)"
  64.115 -
  64.116 -text {*
  64.117 -  \noindent This @{command class} specification consists of two
  64.118 -  parts: the \qn{operational} part names the class parameter
  64.119 -  (@{element "fixes"}), the \qn{logical} part specifies properties on them
  64.120 -  (@{element "assumes"}).  The local @{element "fixes"} and
  64.121 -  @{element "assumes"} are lifted to the theory toplevel,
  64.122 -  yielding the global
  64.123 -  parameter @{term [source] "mult \<Colon> \<alpha>\<Colon>semigroup \<Rightarrow> \<alpha> \<Rightarrow> \<alpha>"} and the
  64.124 -  global theorem @{fact "semigroup.assoc:"}~@{prop [source] "\<And>x y
  64.125 -  z \<Colon> \<alpha>\<Colon>semigroup. (x \<otimes> y) \<otimes> z = x \<otimes> (y \<otimes> z)"}.
  64.126 -*}
  64.127 -
  64.128 -
  64.129 -subsection {* Class instantiation \label{sec:class_inst} *}
  64.130 -
  64.131 -text {*
  64.132 -  The concrete type @{typ int} is made a @{class semigroup}
  64.133 -  instance by providing a suitable definition for the class parameter
  64.134 -  @{text "(\<otimes>)"} and a proof for the specification of @{fact assoc}.
  64.135 -  This is accomplished by the @{command instantiation} target:
  64.136 -*}
  64.137 -
  64.138 -instantiation %quote int :: semigroup
  64.139 -begin
  64.140 -
  64.141 -definition %quote
  64.142 -  mult_int_def: "i \<otimes> j = i + (j\<Colon>int)"
  64.143 -
  64.144 -instance %quote proof
  64.145 -  fix i j k :: int have "(i + j) + k = i + (j + k)" by simp
  64.146 -  then show "(i \<otimes> j) \<otimes> k = i \<otimes> (j \<otimes> k)"
  64.147 -    unfolding mult_int_def .
  64.148 -qed
  64.149 -
  64.150 -end %quote
  64.151 -
  64.152 -text {*
  64.153 -  \noindent @{command instantiation} allows to define class parameters
  64.154 -  at a particular instance using common specification tools (here,
  64.155 -  @{command definition}).  The concluding @{command instance}
  64.156 -  opens a proof that the given parameters actually conform
  64.157 -  to the class specification.  Note that the first proof step
  64.158 -  is the @{method default} method,
  64.159 -  which for such instance proofs maps to the @{method intro_classes} method.
  64.160 -  This boils down an instance judgement to the relevant primitive
  64.161 -  proof goals and should conveniently always be the first method applied
  64.162 -  in an instantiation proof.
  64.163 -
  64.164 -  From now on, the type-checker will consider @{typ int}
  64.165 -  as a @{class semigroup} automatically, i.e.\ any general results
  64.166 -  are immediately available on concrete instances.
  64.167 -
  64.168 -  \medskip Another instance of @{class semigroup} are the natural numbers:
  64.169 -*}
  64.170 -
  64.171 -instantiation %quote nat :: semigroup
  64.172 -begin
  64.173 -
  64.174 -primrec %quote mult_nat where
  64.175 -  "(0\<Colon>nat) \<otimes> n = n"
  64.176 -  | "Suc m \<otimes> n = Suc (m \<otimes> n)"
  64.177 -
  64.178 -instance %quote proof
  64.179 -  fix m n q :: nat 
  64.180 -  show "m \<otimes> n \<otimes> q = m \<otimes> (n \<otimes> q)"
  64.181 -    by (induct m) auto
  64.182 -qed
  64.183 -
  64.184 -end %quote
  64.185 -
  64.186 -text {*
  64.187 -  \noindent Note the occurence of the name @{text mult_nat}
  64.188 -  in the primrec declaration;  by default, the local name of
  64.189 -  a class operation @{text f} to instantiate on type constructor
  64.190 -  @{text \<kappa>} are mangled as @{text f_\<kappa>}.  In case of uncertainty,
  64.191 -  these names may be inspected using the @{command "print_context"} command
  64.192 -  or the corresponding ProofGeneral button.
  64.193 -*}
  64.194 -
  64.195 -subsection {* Lifting and parametric types *}
  64.196 -
  64.197 -text {*
  64.198 -  Overloaded definitions giving on class instantiation
  64.199 -  may include recursion over the syntactic structure of types.
  64.200 -  As a canonical example, we model product semigroups
  64.201 -  using our simple algebra:
  64.202 -*}
  64.203 -
  64.204 -instantiation %quote * :: (semigroup, semigroup) semigroup
  64.205 -begin
  64.206 -
  64.207 -definition %quote
  64.208 -  mult_prod_def: "p\<^isub>1 \<otimes> p\<^isub>2 = (fst p\<^isub>1 \<otimes> fst p\<^isub>2, snd p\<^isub>1 \<otimes> snd p\<^isub>2)"
  64.209 -
  64.210 -instance %quote proof
  64.211 -  fix p\<^isub>1 p\<^isub>2 p\<^isub>3 :: "\<alpha>\<Colon>semigroup \<times> \<beta>\<Colon>semigroup"
  64.212 -  show "p\<^isub>1 \<otimes> p\<^isub>2 \<otimes> p\<^isub>3 = p\<^isub>1 \<otimes> (p\<^isub>2 \<otimes> p\<^isub>3)"
  64.213 -    unfolding mult_prod_def by (simp add: assoc)
  64.214 -qed      
  64.215 -
  64.216 -end %quote
  64.217 -
  64.218 -text {*
  64.219 -  \noindent Associativity from product semigroups is
  64.220 -  established using
  64.221 -  the definition of @{text "(\<otimes>)"} on products and the hypothetical
  64.222 -  associativity of the type components;  these hypotheses
  64.223 -  are facts due to the @{class semigroup} constraints imposed
  64.224 -  on the type components by the @{command instance} proposition.
  64.225 -  Indeed, this pattern often occurs with parametric types
  64.226 -  and type classes.
  64.227 -*}
  64.228 -
  64.229 -
  64.230 -subsection {* Subclassing *}
  64.231 -
  64.232 -text {*
  64.233 -  We define a subclass @{text monoidl} (a semigroup with a left-hand neutral)
  64.234 -  by extending @{class semigroup}
  64.235 -  with one additional parameter @{text neutral} together
  64.236 -  with its property:
  64.237 -*}
  64.238 -
  64.239 -class %quote monoidl = semigroup +
  64.240 -  fixes neutral :: "\<alpha>" ("\<one>")
  64.241 -  assumes neutl: "\<one> \<otimes> x = x"
  64.242 -
  64.243 -text {*
  64.244 -  \noindent Again, we prove some instances, by
  64.245 -  providing suitable parameter definitions and proofs for the
  64.246 -  additional specifications.  Observe that instantiations
  64.247 -  for types with the same arity may be simultaneous:
  64.248 -*}
  64.249 -
  64.250 -instantiation %quote nat and int :: monoidl
  64.251 -begin
  64.252 -
  64.253 -definition %quote
  64.254 -  neutral_nat_def: "\<one> = (0\<Colon>nat)"
  64.255 -
  64.256 -definition %quote
  64.257 -  neutral_int_def: "\<one> = (0\<Colon>int)"
  64.258 -
  64.259 -instance %quote proof
  64.260 -  fix n :: nat
  64.261 -  show "\<one> \<otimes> n = n"
  64.262 -    unfolding neutral_nat_def by simp
  64.263 -next
  64.264 -  fix k :: int
  64.265 -  show "\<one> \<otimes> k = k"
  64.266 -    unfolding neutral_int_def mult_int_def by simp
  64.267 -qed
  64.268 -
  64.269 -end %quote
  64.270 -
  64.271 -instantiation %quote * :: (monoidl, monoidl) monoidl
  64.272 -begin
  64.273 -
  64.274 -definition %quote
  64.275 -  neutral_prod_def: "\<one> = (\<one>, \<one>)"
  64.276 -
  64.277 -instance %quote proof
  64.278 -  fix p :: "\<alpha>\<Colon>monoidl \<times> \<beta>\<Colon>monoidl"
  64.279 -  show "\<one> \<otimes> p = p"
  64.280 -    unfolding neutral_prod_def mult_prod_def by (simp add: neutl)
  64.281 -qed
  64.282 -
  64.283 -end %quote
  64.284 -
  64.285 -text {*
  64.286 -  \noindent Fully-fledged monoids are modelled by another subclass
  64.287 -  which does not add new parameters but tightens the specification:
  64.288 -*}
  64.289 -
  64.290 -class %quote monoid = monoidl +
  64.291 -  assumes neutr: "x \<otimes> \<one> = x"
  64.292 -
  64.293 -instantiation %quote nat and int :: monoid 
  64.294 -begin
  64.295 -
  64.296 -instance %quote proof
  64.297 -  fix n :: nat
  64.298 -  show "n \<otimes> \<one> = n"
  64.299 -    unfolding neutral_nat_def by (induct n) simp_all
  64.300 -next
  64.301 -  fix k :: int
  64.302 -  show "k \<otimes> \<one> = k"
  64.303 -    unfolding neutral_int_def mult_int_def by simp
  64.304 -qed
  64.305 -
  64.306 -end %quote
  64.307 -
  64.308 -instantiation %quote * :: (monoid, monoid) monoid
  64.309 -begin
  64.310 -
  64.311 -instance %quote proof 
  64.312 -  fix p :: "\<alpha>\<Colon>monoid \<times> \<beta>\<Colon>monoid"
  64.313 -  show "p \<otimes> \<one> = p"
  64.314 -    unfolding neutral_prod_def mult_prod_def by (simp add: neutr)
  64.315 -qed
  64.316 -
  64.317 -end %quote
  64.318 -
  64.319 -text {*
  64.320 -  \noindent To finish our small algebra example, we add a @{text group} class
  64.321 -  with a corresponding instance:
  64.322 -*}
  64.323 -
  64.324 -class %quote group = monoidl +
  64.325 -  fixes inverse :: "\<alpha> \<Rightarrow> \<alpha>"    ("(_\<div>)" [1000] 999)
  64.326 -  assumes invl: "x\<div> \<otimes> x = \<one>"
  64.327 -
  64.328 -instantiation %quote int :: group
  64.329 -begin
  64.330 -
  64.331 -definition %quote
  64.332 -  inverse_int_def: "i\<div> = - (i\<Colon>int)"
  64.333 -
  64.334 -instance %quote proof
  64.335 -  fix i :: int
  64.336 -  have "-i + i = 0" by simp
  64.337 -  then show "i\<div> \<otimes> i = \<one>"
  64.338 -    unfolding mult_int_def neutral_int_def inverse_int_def .
  64.339 -qed
  64.340 -
  64.341 -end %quote
  64.342 -
  64.343 -
  64.344 -section {* Type classes as locales *}
  64.345 -
  64.346 -subsection {* A look behind the scene *}
  64.347 -
  64.348 -text {*
  64.349 -  The example above gives an impression how Isar type classes work
  64.350 -  in practice.  As stated in the introduction, classes also provide
  64.351 -  a link to Isar's locale system.  Indeed, the logical core of a class
  64.352 -  is nothing else than a locale:
  64.353 -*}
  64.354 -
  64.355 -class %quote idem =
  64.356 -  fixes f :: "\<alpha> \<Rightarrow> \<alpha>"
  64.357 -  assumes idem: "f (f x) = f x"
  64.358 -
  64.359 -text {*
  64.360 -  \noindent essentially introduces the locale
  64.361 -*} setup %invisible {* Sign.add_path "foo" *}
  64.362 -
  64.363 -locale %quote idem =
  64.364 -  fixes f :: "\<alpha> \<Rightarrow> \<alpha>"
  64.365 -  assumes idem: "f (f x) = f x"
  64.366 -
  64.367 -text {* \noindent together with corresponding constant(s): *}
  64.368 -
  64.369 -consts %quote f :: "\<alpha> \<Rightarrow> \<alpha>"
  64.370 -
  64.371 -text {*
  64.372 -  \noindent The connection to the type system is done by means
  64.373 -  of a primitive axclass
  64.374 -*} setup %invisible {* Sign.add_path "foo" *}
  64.375 -
  64.376 -axclass %quote idem < type
  64.377 -  idem: "f (f x) = f x" setup %invisible {* Sign.parent_path *}
  64.378 -
  64.379 -text {* \noindent together with a corresponding interpretation: *}
  64.380 -
  64.381 -interpretation %quote idem_class:
  64.382 -  idem "f \<Colon> (\<alpha>\<Colon>idem) \<Rightarrow> \<alpha>"
  64.383 -proof qed (rule idem)
  64.384 -
  64.385 -text {*
  64.386 -  \noindent This gives you at hand the full power of the Isabelle module system;
  64.387 -  conclusions in locale @{text idem} are implicitly propagated
  64.388 -  to class @{text idem}.
  64.389 -*} setup %invisible {* Sign.parent_path *}
  64.390 -
  64.391 -subsection {* Abstract reasoning *}
  64.392 -
  64.393 -text {*
  64.394 -  Isabelle locales enable reasoning at a general level, while results
  64.395 -  are implicitly transferred to all instances.  For example, we can
  64.396 -  now establish the @{text "left_cancel"} lemma for groups, which
  64.397 -  states that the function @{text "(x \<otimes>)"} is injective:
  64.398 -*}
  64.399 -
  64.400 -lemma %quote (in group) left_cancel: "x \<otimes> y = x \<otimes> z \<longleftrightarrow> y = z"
  64.401 -proof
  64.402 -  assume "x \<otimes> y = x \<otimes> z"
  64.403 -  then have "x\<div> \<otimes> (x \<otimes> y) = x\<div> \<otimes> (x \<otimes> z)" by simp
  64.404 -  then have "(x\<div> \<otimes> x) \<otimes> y = (x\<div> \<otimes> x) \<otimes> z" using assoc by simp
  64.405 -  then show "y = z" using neutl and invl by simp
  64.406 -next
  64.407 -  assume "y = z"
  64.408 -  then show "x \<otimes> y = x \<otimes> z" by simp
  64.409 -qed
  64.410 -
  64.411 -text {*
  64.412 -  \noindent Here the \qt{@{keyword "in"} @{class group}} target specification
  64.413 -  indicates that the result is recorded within that context for later
  64.414 -  use.  This local theorem is also lifted to the global one @{fact
  64.415 -  "group.left_cancel:"} @{prop [source] "\<And>x y z \<Colon> \<alpha>\<Colon>group. x \<otimes> y = x \<otimes>
  64.416 -  z \<longleftrightarrow> y = z"}.  Since type @{text "int"} has been made an instance of
  64.417 -  @{text "group"} before, we may refer to that fact as well: @{prop
  64.418 -  [source] "\<And>x y z \<Colon> int. x \<otimes> y = x \<otimes> z \<longleftrightarrow> y = z"}.
  64.419 -*}
  64.420 -
  64.421 -
  64.422 -subsection {* Derived definitions *}
  64.423 -
  64.424 -text {*
  64.425 -  Isabelle locales support a concept of local definitions
  64.426 -  in locales:
  64.427 -*}
  64.428 -
  64.429 -primrec %quote (in monoid) pow_nat :: "nat \<Rightarrow> \<alpha> \<Rightarrow> \<alpha>" where
  64.430 -  "pow_nat 0 x = \<one>"
  64.431 -  | "pow_nat (Suc n) x = x \<otimes> pow_nat n x"
  64.432 -
  64.433 -text {*
  64.434 -  \noindent If the locale @{text group} is also a class, this local
  64.435 -  definition is propagated onto a global definition of
  64.436 -  @{term [source] "pow_nat \<Colon> nat \<Rightarrow> \<alpha>\<Colon>monoid \<Rightarrow> \<alpha>\<Colon>monoid"}
  64.437 -  with corresponding theorems
  64.438 -
  64.439 -  @{thm pow_nat.simps [no_vars]}.
  64.440 -
  64.441 -  \noindent As you can see from this example, for local
  64.442 -  definitions you may use any specification tool
  64.443 -  which works together with locales (e.g. \cite{krauss2006}).
  64.444 -*}
  64.445 -
  64.446 -
  64.447 -subsection {* A functor analogy *}
  64.448 -
  64.449 -text {*
  64.450 -  We introduced Isar classes by analogy to type classes
  64.451 -  functional programming;  if we reconsider this in the
  64.452 -  context of what has been said about type classes and locales,
  64.453 -  we can drive this analogy further by stating that type
  64.454 -  classes essentially correspond to functors which have
  64.455 -  a canonical interpretation as type classes.
  64.456 -  Anyway, there is also the possibility of other interpretations.
  64.457 -  For example, also @{text list}s form a monoid with
  64.458 -  @{text append} and @{term "[]"} as operations, but it
  64.459 -  seems inappropriate to apply to lists
  64.460 -  the same operations as for genuinely algebraic types.
  64.461 -  In such a case, we simply can do a particular interpretation
  64.462 -  of monoids for lists:
  64.463 -*}
  64.464 -
  64.465 -interpretation %quote list_monoid!: monoid append "[]"
  64.466 -  proof qed auto
  64.467 -
  64.468 -text {*
  64.469 -  \noindent This enables us to apply facts on monoids
  64.470 -  to lists, e.g. @{thm list_monoid.neutl [no_vars]}.
  64.471 -
  64.472 -  When using this interpretation pattern, it may also
  64.473 -  be appropriate to map derived definitions accordingly:
  64.474 -*}
  64.475 -
  64.476 -primrec %quote replicate :: "nat \<Rightarrow> \<alpha> list \<Rightarrow> \<alpha> list" where
  64.477 -  "replicate 0 _ = []"
  64.478 -  | "replicate (Suc n) xs = xs @ replicate n xs"
  64.479 -
  64.480 -interpretation %quote list_monoid!: monoid append "[]" where
  64.481 -  "monoid.pow_nat append [] = replicate"
  64.482 -proof -
  64.483 -  interpret monoid append "[]" ..
  64.484 -  show "monoid.pow_nat append [] = replicate"
  64.485 -  proof
  64.486 -    fix n
  64.487 -    show "monoid.pow_nat append [] n = replicate n"
  64.488 -      by (induct n) auto
  64.489 -  qed
  64.490 -qed intro_locales
  64.491 -
  64.492 -
  64.493 -subsection {* Additional subclass relations *}
  64.494 -
  64.495 -text {*
  64.496 -  Any @{text "group"} is also a @{text "monoid"};  this
  64.497 -  can be made explicit by claiming an additional
  64.498 -  subclass relation,
  64.499 -  together with a proof of the logical difference:
  64.500 -*}
  64.501 -
  64.502 -subclass %quote (in group) monoid
  64.503 -proof
  64.504 -  fix x
  64.505 -  from invl have "x\<div> \<otimes> x = \<one>" by simp
  64.506 -  with assoc [symmetric] neutl invl have "x\<div> \<otimes> (x \<otimes> \<one>) = x\<div> \<otimes> x" by simp
  64.507 -  with left_cancel show "x \<otimes> \<one> = x" by simp
  64.508 -qed
  64.509 -
  64.510 -text {*
  64.511 -  \noindent The logical proof is carried out on the locale level.
  64.512 -  Afterwards it is propagated
  64.513 -  to the type system, making @{text group} an instance of
  64.514 -  @{text monoid} by adding an additional edge
  64.515 -  to the graph of subclass relations
  64.516 -  (cf.\ \figref{fig:subclass}).
  64.517 -
  64.518 -  \begin{figure}[htbp]
  64.519 -   \begin{center}
  64.520 -     \small
  64.521 -     \unitlength 0.6mm
  64.522 -     \begin{picture}(40,60)(0,0)
  64.523 -       \put(20,60){\makebox(0,0){@{text semigroup}}}
  64.524 -       \put(20,40){\makebox(0,0){@{text monoidl}}}
  64.525 -       \put(00,20){\makebox(0,0){@{text monoid}}}
  64.526 -       \put(40,00){\makebox(0,0){@{text group}}}
  64.527 -       \put(20,55){\vector(0,-1){10}}
  64.528 -       \put(15,35){\vector(-1,-1){10}}
  64.529 -       \put(25,35){\vector(1,-3){10}}
  64.530 -     \end{picture}
  64.531 -     \hspace{8em}
  64.532 -     \begin{picture}(40,60)(0,0)
  64.533 -       \put(20,60){\makebox(0,0){@{text semigroup}}}
  64.534 -       \put(20,40){\makebox(0,0){@{text monoidl}}}
  64.535 -       \put(00,20){\makebox(0,0){@{text monoid}}}
  64.536 -       \put(40,00){\makebox(0,0){@{text group}}}
  64.537 -       \put(20,55){\vector(0,-1){10}}
  64.538 -       \put(15,35){\vector(-1,-1){10}}
  64.539 -       \put(05,15){\vector(3,-1){30}}
  64.540 -     \end{picture}
  64.541 -     \caption{Subclass relationship of monoids and groups:
  64.542 -        before and after establishing the relationship
  64.543 -        @{text "group \<subseteq> monoid"};  transitive edges are left out.}
  64.544 -     \label{fig:subclass}
  64.545 -   \end{center}
  64.546 -  \end{figure}
  64.547 -7
  64.548 -  For illustration, a derived definition
  64.549 -  in @{text group} which uses @{text pow_nat}:
  64.550 -*}
  64.551 -
  64.552 -definition %quote (in group) pow_int :: "int \<Rightarrow> \<alpha> \<Rightarrow> \<alpha>" where
  64.553 -  "pow_int k x = (if k >= 0
  64.554 -    then pow_nat (nat k) x
  64.555 -    else (pow_nat (nat (- k)) x)\<div>)"
  64.556 -
  64.557 -text {*
  64.558 -  \noindent yields the global definition of
  64.559 -  @{term [source] "pow_int \<Colon> int \<Rightarrow> \<alpha>\<Colon>group \<Rightarrow> \<alpha>\<Colon>group"}
  64.560 -  with the corresponding theorem @{thm pow_int_def [no_vars]}.
  64.561 -*}
  64.562 -
  64.563 -subsection {* A note on syntax *}
  64.564 -
  64.565 -text {*
  64.566 -  As a commodity, class context syntax allows to refer
  64.567 -  to local class operations and their global counterparts
  64.568 -  uniformly;  type inference resolves ambiguities.  For example:
  64.569 -*}
  64.570 -
  64.571 -context %quote semigroup
  64.572 -begin
  64.573 -
  64.574 -term %quote "x \<otimes> y" -- {* example 1 *}
  64.575 -term %quote "(x\<Colon>nat) \<otimes> y" -- {* example 2 *}
  64.576 -
  64.577 -end  %quote
  64.578 -
  64.579 -term %quote "x \<otimes> y" -- {* example 3 *}
  64.580 -
  64.581 -text {*
  64.582 -  \noindent Here in example 1, the term refers to the local class operation
  64.583 -  @{text "mult [\<alpha>]"}, whereas in example 2 the type constraint
  64.584 -  enforces the global class operation @{text "mult [nat]"}.
  64.585 -  In the global context in example 3, the reference is
  64.586 -  to the polymorphic global class operation @{text "mult [?\<alpha> \<Colon> semigroup]"}.
  64.587 -*}
  64.588 -
  64.589 -section {* Further issues *}
  64.590 -
  64.591 -subsection {* Type classes and code generation *}
  64.592 -
  64.593 -text {*
  64.594 -  Turning back to the first motivation for type classes,
  64.595 -  namely overloading, it is obvious that overloading
  64.596 -  stemming from @{command class} statements and
  64.597 -  @{command instantiation}
  64.598 -  targets naturally maps to Haskell type classes.
  64.599 -  The code generator framework \cite{isabelle-codegen} 
  64.600 -  takes this into account.  Concerning target languages
  64.601 -  lacking type classes (e.g.~SML), type classes
  64.602 -  are implemented by explicit dictionary construction.
  64.603 -  As example, let's go back to the power function:
  64.604 -*}
  64.605 -
  64.606 -definition %quote example :: int where
  64.607 -  "example = pow_int 10 (-2)"
  64.608 -
  64.609 -text {*
  64.610 -  \noindent This maps to Haskell as:
  64.611 -*}
  64.612 -
  64.613 -text %quote {*@{code_stmts example (Haskell)}*}
  64.614 -
  64.615 -text {*
  64.616 -  \noindent The whole code in SML with explicit dictionary passing:
  64.617 -*}
  64.618 -
  64.619 -text %quote {*@{code_stmts example (SML)}*}
  64.620 -
  64.621 -subsection {* Inspecting the type class universe *}
  64.622 -
  64.623 -text {*
  64.624 -  To facilitate orientation in complex subclass structures,
  64.625 -  two diagnostics commands are provided:
  64.626 -
  64.627 -  \begin{description}
  64.628 -
  64.629 -    \item[@{command "print_classes"}] print a list of all classes
  64.630 -      together with associated operations etc.
  64.631 -
  64.632 -    \item[@{command "class_deps"}] visualizes the subclass relation
  64.633 -      between all classes as a Hasse diagram.
  64.634 -
  64.635 -  \end{description}
  64.636 -*}
  64.637 -
  64.638 -end
    65.1 --- a/doc-src/IsarAdvanced/Classes/Thy/ROOT.ML	Mon Mar 02 16:58:39 2009 +0100
    65.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    65.3 @@ -1,6 +0,0 @@
    65.4 -
    65.5 -(* $Id$ *)
    65.6 -
    65.7 -no_document use_thy "Setup";
    65.8 -
    65.9 -use_thy "Classes";
    66.1 --- a/doc-src/IsarAdvanced/Classes/Thy/Setup.thy	Mon Mar 02 16:58:39 2009 +0100
    66.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    66.3 @@ -1,34 +0,0 @@
    66.4 -theory Setup
    66.5 -imports Main Code_Integer
    66.6 -uses
    66.7 -  "../../../antiquote_setup"
    66.8 -  "../../../more_antiquote"
    66.9 -begin
   66.10 -
   66.11 -ML {* Code_Target.code_width := 74 *}
   66.12 -
   66.13 -syntax
   66.14 -  "_alpha" :: "type"  ("\<alpha>")
   66.15 -  "_alpha_ofsort" :: "sort \<Rightarrow> type"  ("\<alpha>()\<Colon>_" [0] 1000)
   66.16 -  "_beta" :: "type"  ("\<beta>")
   66.17 -  "_beta_ofsort" :: "sort \<Rightarrow> type"  ("\<beta>()\<Colon>_" [0] 1000)
   66.18 -
   66.19 -parse_ast_translation {*
   66.20 -  let
   66.21 -    fun alpha_ast_tr [] = Syntax.Variable "'a"
   66.22 -      | alpha_ast_tr asts = raise Syntax.AST ("alpha_ast_tr", asts);
   66.23 -    fun alpha_ofsort_ast_tr [ast] =
   66.24 -      Syntax.Appl [Syntax.Constant "_ofsort", Syntax.Variable "'a", ast]
   66.25 -      | alpha_ofsort_ast_tr asts = raise Syntax.AST ("alpha_ast_tr", asts);
   66.26 -    fun beta_ast_tr [] = Syntax.Variable "'b"
   66.27 -      | beta_ast_tr asts = raise Syntax.AST ("beta_ast_tr", asts);
   66.28 -    fun beta_ofsort_ast_tr [ast] =
   66.29 -      Syntax.Appl [Syntax.Constant "_ofsort", Syntax.Variable "'b", ast]
   66.30 -      | beta_ofsort_ast_tr asts = raise Syntax.AST ("beta_ast_tr", asts);
   66.31 -  in [
   66.32 -    ("_alpha", alpha_ast_tr), ("_alpha_ofsort", alpha_ofsort_ast_tr),
   66.33 -    ("_beta", beta_ast_tr), ("_beta_ofsort", beta_ofsort_ast_tr)
   66.34 -  ] end
   66.35 -*}
   66.36 -
   66.37 -end
   66.38 \ No newline at end of file
    67.1 --- a/doc-src/IsarAdvanced/Classes/Thy/document/Classes.tex	Mon Mar 02 16:58:39 2009 +0100
    67.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    67.3 @@ -1,1346 +0,0 @@
    67.4 -%
    67.5 -\begin{isabellebody}%
    67.6 -\def\isabellecontext{Classes}%
    67.7 -%
    67.8 -\isadelimtheory
    67.9 -%
   67.10 -\endisadelimtheory
   67.11 -%
   67.12 -\isatagtheory
   67.13 -\isacommand{theory}\isamarkupfalse%
   67.14 -\ Classes\isanewline
   67.15 -\isakeyword{imports}\ Main\ Setup\isanewline
   67.16 -\isakeyword{begin}%
   67.17 -\endisatagtheory
   67.18 -{\isafoldtheory}%
   67.19 -%
   67.20 -\isadelimtheory
   67.21 -%
   67.22 -\endisadelimtheory
   67.23 -%
   67.24 -\isamarkupchapter{Haskell-style classes with Isabelle/Isar%
   67.25 -}
   67.26 -\isamarkuptrue%
   67.27 -%
   67.28 -\isamarkupsection{Introduction%
   67.29 -}
   67.30 -\isamarkuptrue%
   67.31 -%
   67.32 -\begin{isamarkuptext}%
   67.33 -Type classes were introduces by Wadler and Blott \cite{wadler89how}
   67.34 -  into the Haskell language, to allow for a reasonable implementation
   67.35 -  of overloading\footnote{throughout this tutorial, we are referring
   67.36 -  to classical Haskell 1.0 type classes, not considering
   67.37 -  later additions in expressiveness}.
   67.38 -  As a canonical example, a polymorphic equality function
   67.39 -  \isa{eq\ {\isasymColon}\ {\isasymalpha}\ {\isasymRightarrow}\ {\isasymalpha}\ {\isasymRightarrow}\ bool} which is overloaded on different
   67.40 -  types for \isa{{\isasymalpha}}, which is achieved by splitting introduction
   67.41 -  of the \isa{eq} function from its overloaded definitions by means
   67.42 -  of \isa{class} and \isa{instance} declarations:
   67.43 -
   67.44 -  \begin{quote}
   67.45 -
   67.46 -  \noindent\isa{class\ eq\ where}\footnote{syntax here is a kind of isabellized Haskell} \\
   67.47 -  \hspace*{2ex}\isa{eq\ {\isasymColon}\ {\isasymalpha}\ {\isasymRightarrow}\ {\isasymalpha}\ {\isasymRightarrow}\ bool}
   67.48 -
   67.49 -  \medskip\noindent\isa{instance\ nat\ {\isasymColon}\ eq\ where} \\
   67.50 -  \hspace*{2ex}\isa{eq\ {\isadigit{0}}\ {\isadigit{0}}\ {\isacharequal}\ True} \\
   67.51 -  \hspace*{2ex}\isa{eq\ {\isadigit{0}}\ {\isacharunderscore}\ {\isacharequal}\ False} \\
   67.52 -  \hspace*{2ex}\isa{eq\ {\isacharunderscore}\ {\isadigit{0}}\ {\isacharequal}\ False} \\
   67.53 -  \hspace*{2ex}\isa{eq\ {\isacharparenleft}Suc\ n{\isacharparenright}\ {\isacharparenleft}Suc\ m{\isacharparenright}\ {\isacharequal}\ eq\ n\ m}
   67.54 -
   67.55 -  \medskip\noindent\isa{instance\ {\isacharparenleft}{\isasymalpha}{\isasymColon}eq{\isacharcomma}\ {\isasymbeta}{\isasymColon}eq{\isacharparenright}\ pair\ {\isasymColon}\ eq\ where} \\
   67.56 -  \hspace*{2ex}\isa{eq\ {\isacharparenleft}x{\isadigit{1}}{\isacharcomma}\ y{\isadigit{1}}{\isacharparenright}\ {\isacharparenleft}x{\isadigit{2}}{\isacharcomma}\ y{\isadigit{2}}{\isacharparenright}\ {\isacharequal}\ eq\ x{\isadigit{1}}\ x{\isadigit{2}}\ {\isasymand}\ eq\ y{\isadigit{1}}\ y{\isadigit{2}}}
   67.57 -
   67.58 -  \medskip\noindent\isa{class\ ord\ extends\ eq\ where} \\
   67.59 -  \hspace*{2ex}\isa{less{\isacharunderscore}eq\ {\isasymColon}\ {\isasymalpha}\ {\isasymRightarrow}\ {\isasymalpha}\ {\isasymRightarrow}\ bool} \\
   67.60 -  \hspace*{2ex}\isa{less\ {\isasymColon}\ {\isasymalpha}\ {\isasymRightarrow}\ {\isasymalpha}\ {\isasymRightarrow}\ bool}
   67.61 -
   67.62 -  \end{quote}
   67.63 -
   67.64 -  \noindent Type variables are annotated with (finitely many) classes;
   67.65 -  these annotations are assertions that a particular polymorphic type
   67.66 -  provides definitions for overloaded functions.
   67.67 -
   67.68 -  Indeed, type classes not only allow for simple overloading
   67.69 -  but form a generic calculus, an instance of order-sorted
   67.70 -  algebra \cite{Nipkow-Prehofer:1993,nipkow-sorts93,Wenzel:1997:TPHOL}.
   67.71 -
   67.72 -  From a software engeneering point of view, type classes
   67.73 -  roughly correspond to interfaces in object-oriented languages like Java;
   67.74 -  so, it is naturally desirable that type classes do not only
   67.75 -  provide functions (class parameters) but also state specifications
   67.76 -  implementations must obey.  For example, the \isa{class\ eq}
   67.77 -  above could be given the following specification, demanding that
   67.78 -  \isa{class\ eq} is an equivalence relation obeying reflexivity,
   67.79 -  symmetry and transitivity:
   67.80 -
   67.81 -  \begin{quote}
   67.82 -
   67.83 -  \noindent\isa{class\ eq\ where} \\
   67.84 -  \hspace*{2ex}\isa{eq\ {\isasymColon}\ {\isasymalpha}\ {\isasymRightarrow}\ {\isasymalpha}\ {\isasymRightarrow}\ bool} \\
   67.85 -  \isa{satisfying} \\
   67.86 -  \hspace*{2ex}\isa{refl{\isacharcolon}\ eq\ x\ x} \\
   67.87 -  \hspace*{2ex}\isa{sym{\isacharcolon}\ eq\ x\ y\ {\isasymlongleftrightarrow}\ eq\ x\ y} \\
   67.88 -  \hspace*{2ex}\isa{trans{\isacharcolon}\ eq\ x\ y\ {\isasymand}\ eq\ y\ z\ {\isasymlongrightarrow}\ eq\ x\ z}
   67.89 -
   67.90 -  \end{quote}
   67.91 -
   67.92 -  \noindent From a theoretic point of view, type classes are lightweight
   67.93 -  modules; Haskell type classes may be emulated by
   67.94 -  SML functors \cite{classes_modules}. 
   67.95 -  Isabelle/Isar offers a discipline of type classes which brings
   67.96 -  all those aspects together:
   67.97 -
   67.98 -  \begin{enumerate}
   67.99 -    \item specifying abstract parameters together with
  67.100 -       corresponding specifications,
  67.101 -    \item instantiating those abstract parameters by a particular
  67.102 -       type
  67.103 -    \item in connection with a ``less ad-hoc'' approach to overloading,
  67.104 -    \item with a direct link to the Isabelle module system
  67.105 -      (aka locales \cite{kammueller-locales}).
  67.106 -  \end{enumerate}
  67.107 -
  67.108 -  \noindent Isar type classes also directly support code generation
  67.109 -  in a Haskell like fashion.
  67.110 -
  67.111 -  This tutorial demonstrates common elements of structured specifications
  67.112 -  and abstract reasoning with type classes by the algebraic hierarchy of
  67.113 -  semigroups, monoids and groups.  Our background theory is that of
  67.114 -  Isabelle/HOL \cite{isa-tutorial}, for which some
  67.115 -  familiarity is assumed.
  67.116 -
  67.117 -  Here we merely present the look-and-feel for end users.
  67.118 -  Internally, those are mapped to more primitive Isabelle concepts.
  67.119 -  See \cite{Haftmann-Wenzel:2006:classes} for more detail.%
  67.120 -\end{isamarkuptext}%
  67.121 -\isamarkuptrue%
  67.122 -%
  67.123 -\isamarkupsection{A simple algebra example \label{sec:example}%
  67.124 -}
  67.125 -\isamarkuptrue%
  67.126 -%
  67.127 -\isamarkupsubsection{Class definition%
  67.128 -}
  67.129 -\isamarkuptrue%
  67.130 -%
  67.131 -\begin{isamarkuptext}%
  67.132 -Depending on an arbitrary type \isa{{\isasymalpha}}, class \isa{semigroup} introduces a binary operator \isa{{\isacharparenleft}{\isasymotimes}{\isacharparenright}} that is
  67.133 -  assumed to be associative:%
  67.134 -\end{isamarkuptext}%
  67.135 -\isamarkuptrue%
  67.136 -%
  67.137 -\isadelimquote
  67.138 -%
  67.139 -\endisadelimquote
  67.140 -%
  67.141 -\isatagquote
  67.142 -\isacommand{class}\isamarkupfalse%
  67.143 -\ semigroup\ {\isacharequal}\isanewline
  67.144 -\ \ \isakeyword{fixes}\ mult\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isasymalpha}\ {\isasymRightarrow}\ {\isasymalpha}\ {\isasymRightarrow}\ {\isasymalpha}{\isachardoublequoteclose}\ \ \ \ {\isacharparenleft}\isakeyword{infixl}\ {\isachardoublequoteopen}{\isasymotimes}{\isachardoublequoteclose}\ {\isadigit{7}}{\isadigit{0}}{\isacharparenright}\isanewline
  67.145 -\ \ \isakeyword{assumes}\ assoc{\isacharcolon}\ {\isachardoublequoteopen}{\isacharparenleft}x\ {\isasymotimes}\ y{\isacharparenright}\ {\isasymotimes}\ z\ {\isacharequal}\ x\ {\isasymotimes}\ {\isacharparenleft}y\ {\isasymotimes}\ z{\isacharparenright}{\isachardoublequoteclose}%
  67.146 -\endisatagquote
  67.147 -{\isafoldquote}%
  67.148 -%
  67.149 -\isadelimquote
  67.150 -%
  67.151 -\endisadelimquote
  67.152 -%
  67.153 -\begin{isamarkuptext}%
  67.154 -\noindent This \hyperlink{command.class}{\mbox{\isa{\isacommand{class}}}} specification consists of two
  67.155 -  parts: the \qn{operational} part names the class parameter
  67.156 -  (\hyperlink{element.fixes}{\mbox{\isa{\isakeyword{fixes}}}}), the \qn{logical} part specifies properties on them
  67.157 -  (\hyperlink{element.assumes}{\mbox{\isa{\isakeyword{assumes}}}}).  The local \hyperlink{element.fixes}{\mbox{\isa{\isakeyword{fixes}}}} and
  67.158 -  \hyperlink{element.assumes}{\mbox{\isa{\isakeyword{assumes}}}} are lifted to the theory toplevel,
  67.159 -  yielding the global
  67.160 -  parameter \isa{{\isachardoublequote}mult\ {\isasymColon}\ {\isasymalpha}{\isasymColon}semigroup\ {\isasymRightarrow}\ {\isasymalpha}\ {\isasymRightarrow}\ {\isasymalpha}{\isachardoublequote}} and the
  67.161 -  global theorem \hyperlink{fact.semigroup.assoc:}{\mbox{\isa{semigroup{\isachardot}assoc{\isacharcolon}}}}~\isa{{\isachardoublequote}{\isasymAnd}x\ y\ z\ {\isasymColon}\ {\isasymalpha}{\isasymColon}semigroup{\isachardot}\ {\isacharparenleft}x\ {\isasymotimes}\ y{\isacharparenright}\ {\isasymotimes}\ z\ {\isacharequal}\ x\ {\isasymotimes}\ {\isacharparenleft}y\ {\isasymotimes}\ z{\isacharparenright}{\isachardoublequote}}.%
  67.162 -\end{isamarkuptext}%
  67.163 -\isamarkuptrue%
  67.164 -%
  67.165 -\isamarkupsubsection{Class instantiation \label{sec:class_inst}%
  67.166 -}
  67.167 -\isamarkuptrue%
  67.168 -%
  67.169 -\begin{isamarkuptext}%
  67.170 -The concrete type \isa{int} is made a \isa{semigroup}
  67.171 -  instance by providing a suitable definition for the class parameter
  67.172 -  \isa{{\isacharparenleft}{\isasymotimes}{\isacharparenright}} and a proof for the specification of \hyperlink{fact.assoc}{\mbox{\isa{assoc}}}.
  67.173 -  This is accomplished by the \hyperlink{command.instantiation}{\mbox{\isa{\isacommand{instantiation}}}} target:%
  67.174 -\end{isamarkuptext}%
  67.175 -\isamarkuptrue%
  67.176 -%
  67.177 -\isadelimquote
  67.178 -%
  67.179 -\endisadelimquote
  67.180 -%
  67.181 -\isatagquote
  67.182 -\isacommand{instantiation}\isamarkupfalse%
  67.183 -\ int\ {\isacharcolon}{\isacharcolon}\ semigroup\isanewline
  67.184 -\isakeyword{begin}\isanewline
  67.185 -\isanewline
  67.186 -\isacommand{definition}\isamarkupfalse%
  67.187 -\isanewline
  67.188 -\ \ mult{\isacharunderscore}int{\isacharunderscore}def{\isacharcolon}\ {\isachardoublequoteopen}i\ {\isasymotimes}\ j\ {\isacharequal}\ i\ {\isacharplus}\ {\isacharparenleft}j{\isasymColon}int{\isacharparenright}{\isachardoublequoteclose}\isanewline
  67.189 -\isanewline
  67.190 -\isacommand{instance}\isamarkupfalse%
  67.191 -\ \isacommand{proof}\isamarkupfalse%
  67.192 -\isanewline
  67.193 -\ \ \isacommand{fix}\isamarkupfalse%
  67.194 -\ i\ j\ k\ {\isacharcolon}{\isacharcolon}\ int\ \isacommand{have}\isamarkupfalse%
  67.195 -\ {\isachardoublequoteopen}{\isacharparenleft}i\ {\isacharplus}\ j{\isacharparenright}\ {\isacharplus}\ k\ {\isacharequal}\ i\ {\isacharplus}\ {\isacharparenleft}j\ {\isacharplus}\ k{\isacharparenright}{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
  67.196 -\ simp\isanewline
  67.197 -\ \ \isacommand{then}\isamarkupfalse%
  67.198 -\ \isacommand{show}\isamarkupfalse%
  67.199 -\ {\isachardoublequoteopen}{\isacharparenleft}i\ {\isasymotimes}\ j{\isacharparenright}\ {\isasymotimes}\ k\ {\isacharequal}\ i\ {\isasymotimes}\ {\isacharparenleft}j\ {\isasymotimes}\ k{\isacharparenright}{\isachardoublequoteclose}\isanewline
  67.200 -\ \ \ \ \isacommand{unfolding}\isamarkupfalse%
  67.201 -\ mult{\isacharunderscore}int{\isacharunderscore}def\ \isacommand{{\isachardot}}\isamarkupfalse%
  67.202 -\isanewline
  67.203 -\isacommand{qed}\isamarkupfalse%
  67.204 -\isanewline
  67.205 -\isanewline
  67.206 -\isacommand{end}\isamarkupfalse%
  67.207 -%
  67.208 -\endisatagquote
  67.209 -{\isafoldquote}%
  67.210 -%
  67.211 -\isadelimquote
  67.212 -%
  67.213 -\endisadelimquote
  67.214 -%
  67.215 -\begin{isamarkuptext}%
  67.216 -\noindent \hyperlink{command.instantiation}{\mbox{\isa{\isacommand{instantiation}}}} allows to define class parameters
  67.217 -  at a particular instance using common specification tools (here,
  67.218 -  \hyperlink{command.definition}{\mbox{\isa{\isacommand{definition}}}}).  The concluding \hyperlink{command.instance}{\mbox{\isa{\isacommand{instance}}}}
  67.219 -  opens a proof that the given parameters actually conform
  67.220 -  to the class specification.  Note that the first proof step
  67.221 -  is the \hyperlink{method.default}{\mbox{\isa{default}}} method,
  67.222 -  which for such instance proofs maps to the \hyperlink{method.intro-classes}{\mbox{\isa{intro{\isacharunderscore}classes}}} method.
  67.223 -  This boils down an instance judgement to the relevant primitive
  67.224 -  proof goals and should conveniently always be the first method applied
  67.225 -  in an instantiation proof.
  67.226 -
  67.227 -  From now on, the type-checker will consider \isa{int}
  67.228 -  as a \isa{semigroup} automatically, i.e.\ any general results
  67.229 -  are immediately available on concrete instances.
  67.230 -
  67.231 -  \medskip Another instance of \isa{semigroup} are the natural numbers:%
  67.232 -\end{isamarkuptext}%
  67.233 -\isamarkuptrue%
  67.234 -%
  67.235 -\isadelimquote
  67.236 -%
  67.237 -\endisadelimquote
  67.238 -%
  67.239 -\isatagquote
  67.240 -\isacommand{instantiation}\isamarkupfalse%
  67.241 -\ nat\ {\isacharcolon}{\isacharcolon}\ semigroup\isanewline
  67.242 -\isakeyword{begin}\isanewline
  67.243 -\isanewline
  67.244 -\isacommand{primrec}\isamarkupfalse%
  67.245 -\ mult{\isacharunderscore}nat\ \isakeyword{where}\isanewline
  67.246 -\ \ {\isachardoublequoteopen}{\isacharparenleft}{\isadigit{0}}{\isasymColon}nat{\isacharparenright}\ {\isasymotimes}\ n\ {\isacharequal}\ n{\isachardoublequoteclose}\isanewline
  67.247 -\ \ {\isacharbar}\ {\isachardoublequoteopen}Suc\ m\ {\isasymotimes}\ n\ {\isacharequal}\ Suc\ {\isacharparenleft}m\ {\isasymotimes}\ n{\isacharparenright}{\isachardoublequoteclose}\isanewline
  67.248 -\isanewline
  67.249 -\isacommand{instance}\isamarkupfalse%
  67.250 -\ \isacommand{proof}\isamarkupfalse%
  67.251 -\isanewline
  67.252 -\ \ \isacommand{fix}\isamarkupfalse%
  67.253 -\ m\ n\ q\ {\isacharcolon}{\isacharcolon}\ nat\ \isanewline
  67.254 -\ \ \isacommand{show}\isamarkupfalse%
  67.255 -\ {\isachardoublequoteopen}m\ {\isasymotimes}\ n\ {\isasymotimes}\ q\ {\isacharequal}\ m\ {\isasymotimes}\ {\isacharparenleft}n\ {\isasymotimes}\ q{\isacharparenright}{\isachardoublequoteclose}\isanewline
  67.256 -\ \ \ \ \isacommand{by}\isamarkupfalse%
  67.257 -\ {\isacharparenleft}induct\ m{\isacharparenright}\ auto\isanewline
  67.258 -\isacommand{qed}\isamarkupfalse%
  67.259 -\isanewline
  67.260 -\isanewline
  67.261 -\isacommand{end}\isamarkupfalse%
  67.262 -%
  67.263 -\endisatagquote
  67.264 -{\isafoldquote}%
  67.265 -%
  67.266 -\isadelimquote
  67.267 -%
  67.268 -\endisadelimquote
  67.269 -%
  67.270 -\begin{isamarkuptext}%
  67.271 -\noindent Note the occurence of the name \isa{mult{\isacharunderscore}nat}
  67.272 -  in the primrec declaration;  by default, the local name of
  67.273 -  a class operation \isa{f} to instantiate on type constructor
  67.274 -  \isa{{\isasymkappa}} are mangled as \isa{f{\isacharunderscore}{\isasymkappa}}.  In case of uncertainty,
  67.275 -  these names may be inspected using the \hyperlink{command.print-context}{\mbox{\isa{\isacommand{print{\isacharunderscore}context}}}} command
  67.276 -  or the corresponding ProofGeneral button.%
  67.277 -\end{isamarkuptext}%
  67.278 -\isamarkuptrue%
  67.279 -%
  67.280 -\isamarkupsubsection{Lifting and parametric types%
  67.281 -}
  67.282 -\isamarkuptrue%
  67.283 -%
  67.284 -\begin{isamarkuptext}%
  67.285 -Overloaded definitions giving on class instantiation
  67.286 -  may include recursion over the syntactic structure of types.
  67.287 -  As a canonical example, we model product semigroups
  67.288 -  using our simple algebra:%
  67.289 -\end{isamarkuptext}%
  67.290 -\isamarkuptrue%
  67.291 -%
  67.292 -\isadelimquote
  67.293 -%
  67.294 -\endisadelimquote
  67.295 -%
  67.296 -\isatagquote
  67.297 -\isacommand{instantiation}\isamarkupfalse%
  67.298 -\ {\isacharasterisk}\ {\isacharcolon}{\isacharcolon}\ {\isacharparenleft}semigroup{\isacharcomma}\ semigroup{\isacharparenright}\ semigroup\isanewline
  67.299 -\isakeyword{begin}\isanewline
  67.300 -\isanewline
  67.301 -\isacommand{definition}\isamarkupfalse%
  67.302 -\isanewline
  67.303 -\ \ mult{\isacharunderscore}prod{\isacharunderscore}def{\isacharcolon}\ {\isachardoublequoteopen}p\isactrlisub {\isadigit{1}}\ {\isasymotimes}\ p\isactrlisub {\isadigit{2}}\ {\isacharequal}\ {\isacharparenleft}fst\ p\isactrlisub {\isadigit{1}}\ {\isasymotimes}\ fst\ p\isactrlisub {\isadigit{2}}{\isacharcomma}\ snd\ p\isactrlisub {\isadigit{1}}\ {\isasymotimes}\ snd\ p\isactrlisub {\isadigit{2}}{\isacharparenright}{\isachardoublequoteclose}\isanewline
  67.304 -\isanewline
  67.305 -\isacommand{instance}\isamarkupfalse%
  67.306 -\ \isacommand{proof}\isamarkupfalse%
  67.307 -\isanewline
  67.308 -\ \ \isacommand{fix}\isamarkupfalse%
  67.309 -\ p\isactrlisub {\isadigit{1}}\ p\isactrlisub {\isadigit{2}}\ p\isactrlisub {\isadigit{3}}\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isasymalpha}{\isasymColon}semigroup\ {\isasymtimes}\ {\isasymbeta}{\isasymColon}semigroup{\isachardoublequoteclose}\isanewline
  67.310 -\ \ \isacommand{show}\isamarkupfalse%
  67.311 -\ {\isachardoublequoteopen}p\isactrlisub {\isadigit{1}}\ {\isasymotimes}\ p\isactrlisub {\isadigit{2}}\ {\isasymotimes}\ p\isactrlisub {\isadigit{3}}\ {\isacharequal}\ p\isactrlisub {\isadigit{1}}\ {\isasymotimes}\ {\isacharparenleft}p\isactrlisub {\isadigit{2}}\ {\isasymotimes}\ p\isactrlisub {\isadigit{3}}{\isacharparenright}{\isachardoublequoteclose}\isanewline
  67.312 -\ \ \ \ \isacommand{unfolding}\isamarkupfalse%
  67.313 -\ mult{\isacharunderscore}prod{\isacharunderscore}def\ \isacommand{by}\isamarkupfalse%
  67.314 -\ {\isacharparenleft}simp\ add{\isacharcolon}\ assoc{\isacharparenright}\isanewline
  67.315 -\isacommand{qed}\isamarkupfalse%
  67.316 -\ \ \ \ \ \ \isanewline
  67.317 -\isanewline
  67.318 -\isacommand{end}\isamarkupfalse%
  67.319 -%
  67.320 -\endisatagquote
  67.321 -{\isafoldquote}%
  67.322 -%
  67.323 -\isadelimquote
  67.324 -%
  67.325 -\endisadelimquote
  67.326 -%
  67.327 -\begin{isamarkuptext}%
  67.328 -\noindent Associativity from product semigroups is
  67.329 -  established using
  67.330 -  the definition of \isa{{\isacharparenleft}{\isasymotimes}{\isacharparenright}} on products and the hypothetical
  67.331 -  associativity of the type components;  these hypotheses
  67.332 -  are facts due to the \isa{semigroup} constraints imposed
  67.333 -  on the type components by the \hyperlink{command.instance}{\mbox{\isa{\isacommand{instance}}}} proposition.
  67.334 -  Indeed, this pattern often occurs with parametric types
  67.335 -  and type classes.%
  67.336 -\end{isamarkuptext}%
  67.337 -\isamarkuptrue%
  67.338 -%
  67.339 -\isamarkupsubsection{Subclassing%
  67.340 -}
  67.341 -\isamarkuptrue%
  67.342 -%
  67.343 -\begin{isamarkuptext}%
  67.344 -We define a subclass \isa{monoidl} (a semigroup with a left-hand neutral)
  67.345 -  by extending \isa{semigroup}
  67.346 -  with one additional parameter \isa{neutral} together
  67.347 -  with its property:%
  67.348 -\end{isamarkuptext}%
  67.349 -\isamarkuptrue%
  67.350 -%
  67.351 -\isadelimquote
  67.352 -%
  67.353 -\endisadelimquote
  67.354 -%
  67.355 -\isatagquote
  67.356 -\isacommand{class}\isamarkupfalse%
  67.357 -\ monoidl\ {\isacharequal}\ semigroup\ {\isacharplus}\isanewline
  67.358 -\ \ \isakeyword{fixes}\ neutral\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isasymalpha}{\isachardoublequoteclose}\ {\isacharparenleft}{\isachardoublequoteopen}{\isasymone}{\isachardoublequoteclose}{\isacharparenright}\isanewline
  67.359 -\ \ \isakeyword{assumes}\ neutl{\isacharcolon}\ {\isachardoublequoteopen}{\isasymone}\ {\isasymotimes}\ x\ {\isacharequal}\ x{\isachardoublequoteclose}%
  67.360 -\endisatagquote
  67.361 -{\isafoldquote}%
  67.362 -%
  67.363 -\isadelimquote
  67.364 -%
  67.365 -\endisadelimquote
  67.366 -%
  67.367 -\begin{isamarkuptext}%
  67.368 -\noindent Again, we prove some instances, by
  67.369 -  providing suitable parameter definitions and proofs for the
  67.370 -  additional specifications.  Observe that instantiations
  67.371 -  for types with the same arity may be simultaneous:%
  67.372 -\end{isamarkuptext}%
  67.373 -\isamarkuptrue%
  67.374 -%
  67.375 -\isadelimquote
  67.376 -%
  67.377 -\endisadelimquote
  67.378 -%
  67.379 -\isatagquote
  67.380 -\isacommand{instantiation}\isamarkupfalse%
  67.381 -\ nat\ \isakeyword{and}\ int\ {\isacharcolon}{\isacharcolon}\ monoidl\isanewline
  67.382 -\isakeyword{begin}\isanewline
  67.383 -\isanewline
  67.384 -\isacommand{definition}\isamarkupfalse%
  67.385 -\isanewline
  67.386 -\ \ neutral{\isacharunderscore}nat{\isacharunderscore}def{\isacharcolon}\ {\isachardoublequoteopen}{\isasymone}\ {\isacharequal}\ {\isacharparenleft}{\isadigit{0}}{\isasymColon}nat{\isacharparenright}{\isachardoublequoteclose}\isanewline
  67.387 -\isanewline
  67.388 -\isacommand{definition}\isamarkupfalse%
  67.389 -\isanewline
  67.390 -\ \ neutral{\isacharunderscore}int{\isacharunderscore}def{\isacharcolon}\ {\isachardoublequoteopen}{\isasymone}\ {\isacharequal}\ {\isacharparenleft}{\isadigit{0}}{\isasymColon}int{\isacharparenright}{\isachardoublequoteclose}\isanewline
  67.391 -\isanewline
  67.392 -\isacommand{instance}\isamarkupfalse%
  67.393 -\ \isacommand{proof}\isamarkupfalse%
  67.394 -\isanewline
  67.395 -\ \ \isacommand{fix}\isamarkupfalse%
  67.396 -\ n\ {\isacharcolon}{\isacharcolon}\ nat\isanewline
  67.397 -\ \ \isacommand{show}\isamarkupfalse%
  67.398 -\ {\isachardoublequoteopen}{\isasymone}\ {\isasymotimes}\ n\ {\isacharequal}\ n{\isachardoublequoteclose}\isanewline
  67.399 -\ \ \ \ \isacommand{unfolding}\isamarkupfalse%
  67.400 -\ neutral{\isacharunderscore}nat{\isacharunderscore}def\ \isacommand{by}\isamarkupfalse%
  67.401 -\ simp\isanewline
  67.402 -\isacommand{next}\isamarkupfalse%
  67.403 -\isanewline
  67.404 -\ \ \isacommand{fix}\isamarkupfalse%
  67.405 -\ k\ {\isacharcolon}{\isacharcolon}\ int\isanewline
  67.406 -\ \ \isacommand{show}\isamarkupfalse%
  67.407 -\ {\isachardoublequoteopen}{\isasymone}\ {\isasymotimes}\ k\ {\isacharequal}\ k{\isachardoublequoteclose}\isanewline
  67.408 -\ \ \ \ \isacommand{unfolding}\isamarkupfalse%
  67.409 -\ neutral{\isacharunderscore}int{\isacharunderscore}def\ mult{\isacharunderscore}int{\isacharunderscore}def\ \isacommand{by}\isamarkupfalse%
  67.410 -\ simp\isanewline
  67.411 -\isacommand{qed}\isamarkupfalse%
  67.412 -\isanewline
  67.413 -\isanewline
  67.414 -\isacommand{end}\isamarkupfalse%
  67.415 -\isanewline
  67.416 -\isanewline
  67.417 -\isacommand{instantiation}\isamarkupfalse%
  67.418 -\ {\isacharasterisk}\ {\isacharcolon}{\isacharcolon}\ {\isacharparenleft}monoidl{\isacharcomma}\ monoidl{\isacharparenright}\ monoidl\isanewline
  67.419 -\isakeyword{begin}\isanewline
  67.420 -\isanewline
  67.421 -\isacommand{definition}\isamarkupfalse%
  67.422 -\isanewline
  67.423 -\ \ neutral{\isacharunderscore}prod{\isacharunderscore}def{\isacharcolon}\ {\isachardoublequoteopen}{\isasymone}\ {\isacharequal}\ {\isacharparenleft}{\isasymone}{\isacharcomma}\ {\isasymone}{\isacharparenright}{\isachardoublequoteclose}\isanewline
  67.424 -\isanewline
  67.425 -\isacommand{instance}\isamarkupfalse%
  67.426 -\ \isacommand{proof}\isamarkupfalse%
  67.427 -\isanewline
  67.428 -\ \ \isacommand{fix}\isamarkupfalse%
  67.429 -\ p\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isasymalpha}{\isasymColon}monoidl\ {\isasymtimes}\ {\isasymbeta}{\isasymColon}monoidl{\isachardoublequoteclose}\isanewline
  67.430 -\ \ \isacommand{show}\isamarkupfalse%
  67.431 -\ {\isachardoublequoteopen}{\isasymone}\ {\isasymotimes}\ p\ {\isacharequal}\ p{\isachardoublequoteclose}\isanewline
  67.432 -\ \ \ \ \isacommand{unfolding}\isamarkupfalse%
  67.433 -\ neutral{\isacharunderscore}prod{\isacharunderscore}def\ mult{\isacharunderscore}prod{\isacharunderscore}def\ \isacommand{by}\isamarkupfalse%
  67.434 -\ {\isacharparenleft}simp\ add{\isacharcolon}\ neutl{\isacharparenright}\isanewline
  67.435 -\isacommand{qed}\isamarkupfalse%
  67.436 -\isanewline
  67.437 -\isanewline
  67.438 -\isacommand{end}\isamarkupfalse%
  67.439 -%
  67.440 -\endisatagquote
  67.441 -{\isafoldquote}%
  67.442 -%
  67.443 -\isadelimquote
  67.444 -%
  67.445 -\endisadelimquote
  67.446 -%
  67.447 -\begin{isamarkuptext}%
  67.448 -\noindent Fully-fledged monoids are modelled by another subclass
  67.449 -  which does not add new parameters but tightens the specification:%
  67.450 -\end{isamarkuptext}%
  67.451 -\isamarkuptrue%
  67.452 -%
  67.453 -\isadelimquote
  67.454 -%
  67.455 -\endisadelimquote
  67.456 -%
  67.457 -\isatagquote
  67.458 -\isacommand{class}\isamarkupfalse%
  67.459 -\ monoid\ {\isacharequal}\ monoidl\ {\isacharplus}\isanewline
  67.460 -\ \ \isakeyword{assumes}\ neutr{\isacharcolon}\ {\isachardoublequoteopen}x\ {\isasymotimes}\ {\isasymone}\ {\isacharequal}\ x{\isachardoublequoteclose}\isanewline
  67.461 -\isanewline
  67.462 -\isacommand{instantiation}\isamarkupfalse%
  67.463 -\ nat\ \isakeyword{and}\ int\ {\isacharcolon}{\isacharcolon}\ monoid\ \isanewline
  67.464 -\isakeyword{begin}\isanewline
  67.465 -\isanewline
  67.466 -\isacommand{instance}\isamarkupfalse%
  67.467 -\ \isacommand{proof}\isamarkupfalse%
  67.468 -\isanewline
  67.469 -\ \ \isacommand{fix}\isamarkupfalse%
  67.470 -\ n\ {\isacharcolon}{\isacharcolon}\ nat\isanewline
  67.471 -\ \ \isacommand{show}\isamarkupfalse%
  67.472 -\ {\isachardoublequoteopen}n\ {\isasymotimes}\ {\isasymone}\ {\isacharequal}\ n{\isachardoublequoteclose}\isanewline
  67.473 -\ \ \ \ \isacommand{unfolding}\isamarkupfalse%
  67.474 -\ neutral{\isacharunderscore}nat{\isacharunderscore}def\ \isacommand{by}\isamarkupfalse%
  67.475 -\ {\isacharparenleft}induct\ n{\isacharparenright}\ simp{\isacharunderscore}all\isanewline
  67.476 -\isacommand{next}\isamarkupfalse%
  67.477 -\isanewline
  67.478 -\ \ \isacommand{fix}\isamarkupfalse%
  67.479 -\ k\ {\isacharcolon}{\isacharcolon}\ int\isanewline
  67.480 -\ \ \isacommand{show}\isamarkupfalse%
  67.481 -\ {\isachardoublequoteopen}k\ {\isasymotimes}\ {\isasymone}\ {\isacharequal}\ k{\isachardoublequoteclose}\isanewline
  67.482 -\ \ \ \ \isacommand{unfolding}\isamarkupfalse%
  67.483 -\ neutral{\isacharunderscore}int{\isacharunderscore}def\ mult{\isacharunderscore}int{\isacharunderscore}def\ \isacommand{by}\isamarkupfalse%
  67.484 -\ simp\isanewline
  67.485 -\isacommand{qed}\isamarkupfalse%
  67.486 -\isanewline
  67.487 -\isanewline
  67.488 -\isacommand{end}\isamarkupfalse%
  67.489 -\isanewline
  67.490 -\isanewline
  67.491 -\isacommand{instantiation}\isamarkupfalse%
  67.492 -\ {\isacharasterisk}\ {\isacharcolon}{\isacharcolon}\ {\isacharparenleft}monoid{\isacharcomma}\ monoid{\isacharparenright}\ monoid\isanewline
  67.493 -\isakeyword{begin}\isanewline
  67.494 -\isanewline
  67.495 -\isacommand{instance}\isamarkupfalse%
  67.496 -\ \isacommand{proof}\isamarkupfalse%
  67.497 -\ \isanewline
  67.498 -\ \ \isacommand{fix}\isamarkupfalse%
  67.499 -\ p\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isasymalpha}{\isasymColon}monoid\ {\isasymtimes}\ {\isasymbeta}{\isasymColon}monoid{\isachardoublequoteclose}\isanewline
  67.500 -\ \ \isacommand{show}\isamarkupfalse%
  67.501 -\ {\isachardoublequoteopen}p\ {\isasymotimes}\ {\isasymone}\ {\isacharequal}\ p{\isachardoublequoteclose}\isanewline
  67.502 -\ \ \ \ \isacommand{unfolding}\isamarkupfalse%
  67.503 -\ neutral{\isacharunderscore}prod{\isacharunderscore}def\ mult{\isacharunderscore}prod{\isacharunderscore}def\ \isacommand{by}\isamarkupfalse%
  67.504 -\ {\isacharparenleft}simp\ add{\isacharcolon}\ neutr{\isacharparenright}\isanewline
  67.505 -\isacommand{qed}\isamarkupfalse%
  67.506 -\isanewline
  67.507 -\isanewline
  67.508 -\isacommand{end}\isamarkupfalse%
  67.509 -%
  67.510 -\endisatagquote
  67.511 -{\isafoldquote}%
  67.512 -%
  67.513 -\isadelimquote
  67.514 -%
  67.515 -\endisadelimquote
  67.516 -%
  67.517 -\begin{isamarkuptext}%
  67.518 -\noindent To finish our small algebra example, we add a \isa{group} class
  67.519 -  with a corresponding instance:%
  67.520 -\end{isamarkuptext}%
  67.521 -\isamarkuptrue%
  67.522 -%
  67.523 -\isadelimquote
  67.524 -%
  67.525 -\endisadelimquote
  67.526 -%
  67.527 -\isatagquote
  67.528 -\isacommand{class}\isamarkupfalse%
  67.529 -\ group\ {\isacharequal}\ monoidl\ {\isacharplus}\isanewline
  67.530 -\ \ \isakeyword{fixes}\ inverse\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isasymalpha}\ {\isasymRightarrow}\ {\isasymalpha}{\isachardoublequoteclose}\ \ \ \ {\isacharparenleft}{\isachardoublequoteopen}{\isacharparenleft}{\isacharunderscore}{\isasymdiv}{\isacharparenright}{\isachardoublequoteclose}\ {\isacharbrackleft}{\isadigit{1}}{\isadigit{0}}{\isadigit{0}}{\isadigit{0}}{\isacharbrackright}\ {\isadigit{9}}{\isadigit{9}}{\isadigit{9}}{\isacharparenright}\isanewline
  67.531 -\ \ \isakeyword{assumes}\ invl{\isacharcolon}\ {\isachardoublequoteopen}x{\isasymdiv}\ {\isasymotimes}\ x\ {\isacharequal}\ {\isasymone}{\isachardoublequoteclose}\isanewline
  67.532 -\isanewline
  67.533 -\isacommand{instantiation}\isamarkupfalse%
  67.534 -\ int\ {\isacharcolon}{\isacharcolon}\ group\isanewline
  67.535 -\isakeyword{begin}\isanewline
  67.536 -\isanewline
  67.537 -\isacommand{definition}\isamarkupfalse%
  67.538 -\isanewline
  67.539 -\ \ inverse{\isacharunderscore}int{\isacharunderscore}def{\isacharcolon}\ {\isachardoublequoteopen}i{\isasymdiv}\ {\isacharequal}\ {\isacharminus}\ {\isacharparenleft}i{\isasymColon}int{\isacharparenright}{\isachardoublequoteclose}\isanewline
  67.540 -\isanewline
  67.541 -\isacommand{instance}\isamarkupfalse%
  67.542 -\ \isacommand{proof}\isamarkupfalse%
  67.543 -\isanewline
  67.544 -\ \ \isacommand{fix}\isamarkupfalse%
  67.545 -\ i\ {\isacharcolon}{\isacharcolon}\ int\isanewline
  67.546 -\ \ \isacommand{have}\isamarkupfalse%
  67.547 -\ {\isachardoublequoteopen}{\isacharminus}i\ {\isacharplus}\ i\ {\isacharequal}\ {\isadigit{0}}{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
  67.548 -\ simp\isanewline
  67.549 -\ \ \isacommand{then}\isamarkupfalse%
  67.550 -\ \isacommand{show}\isamarkupfalse%
  67.551 -\ {\isachardoublequoteopen}i{\isasymdiv}\ {\isasymotimes}\ i\ {\isacharequal}\ {\isasymone}{\isachardoublequoteclose}\isanewline
  67.552 -\ \ \ \ \isacommand{unfolding}\isamarkupfalse%
  67.553 -\ mult{\isacharunderscore}int{\isacharunderscore}def\ neutral{\isacharunderscore}int{\isacharunderscore}def\ inverse{\isacharunderscore}int{\isacharunderscore}def\ \isacommand{{\isachardot}}\isamarkupfalse%
  67.554 -\isanewline
  67.555 -\isacommand{qed}\isamarkupfalse%
  67.556 -\isanewline
  67.557 -\isanewline
  67.558 -\isacommand{end}\isamarkupfalse%
  67.559 -%
  67.560 -\endisatagquote
  67.561 -{\isafoldquote}%
  67.562 -%
  67.563 -\isadelimquote
  67.564 -%
  67.565 -\endisadelimquote
  67.566 -%
  67.567 -\isamarkupsection{Type classes as locales%
  67.568 -}
  67.569 -\isamarkuptrue%
  67.570 -%
  67.571 -\isamarkupsubsection{A look behind the scene%
  67.572 -}
  67.573 -\isamarkuptrue%
  67.574 -%
  67.575 -\begin{isamarkuptext}%
  67.576 -The example above gives an impression how Isar type classes work
  67.577 -  in practice.  As stated in the introduction, classes also provide
  67.578 -  a link to Isar's locale system.  Indeed, the logical core of a class
  67.579 -  is nothing else than a locale:%
  67.580 -\end{isamarkuptext}%
  67.581 -\isamarkuptrue%
  67.582 -%
  67.583 -\isadelimquote
  67.584 -%
  67.585 -\endisadelimquote
  67.586 -%
  67.587 -\isatagquote
  67.588 -\isacommand{class}\isamarkupfalse%
  67.589 -\ idem\ {\isacharequal}\isanewline
  67.590 -\ \ \isakeyword{fixes}\ f\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isasymalpha}\ {\isasymRightarrow}\ {\isasymalpha}{\isachardoublequoteclose}\isanewline
  67.591 -\ \ \isakeyword{assumes}\ idem{\isacharcolon}\ {\isachardoublequoteopen}f\ {\isacharparenleft}f\ x{\isacharparenright}\ {\isacharequal}\ f\ x{\isachardoublequoteclose}%
  67.592 -\endisatagquote
  67.593 -{\isafoldquote}%
  67.594 -%
  67.595 -\isadelimquote
  67.596 -%
  67.597 -\endisadelimquote
  67.598 -%
  67.599 -\begin{isamarkuptext}%
  67.600 -\noindent essentially introduces the locale%
  67.601 -\end{isamarkuptext}%
  67.602 -\isamarkuptrue%
  67.603 -%
  67.604 -\isadeliminvisible
  67.605 -\ %
  67.606 -\endisadeliminvisible
  67.607 -%
  67.608 -\isataginvisible
  67.609 -\isacommand{setup}\isamarkupfalse%
  67.610 -\ {\isacharverbatimopen}\ Sign{\isachardot}add{\isacharunderscore}path\ {\isachardoublequote}foo{\isachardoublequote}\ {\isacharverbatimclose}%
  67.611 -\endisataginvisible
  67.612 -{\isafoldinvisible}%
  67.613 -%
  67.614 -\isadeliminvisible
  67.615 -%
  67.616 -\endisadeliminvisible
  67.617 -\isanewline
  67.618 -%
  67.619 -\isadelimquote
  67.620 -\isanewline
  67.621 -%
  67.622 -\endisadelimquote
  67.623 -%
  67.624 -\isatagquote
  67.625 -\isacommand{locale}\isamarkupfalse%
  67.626 -\ idem\ {\isacharequal}\isanewline
  67.627 -\ \ \isakeyword{fixes}\ f\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isasymalpha}\ {\isasymRightarrow}\ {\isasymalpha}{\isachardoublequoteclose}\isanewline
  67.628 -\ \ \isakeyword{assumes}\ idem{\isacharcolon}\ {\isachardoublequoteopen}f\ {\isacharparenleft}f\ x{\isacharparenright}\ {\isacharequal}\ f\ x{\isachardoublequoteclose}%
  67.629 -\endisatagquote
  67.630 -{\isafoldquote}%
  67.631 -%
  67.632 -\isadelimquote
  67.633 -%
  67.634 -\endisadelimquote
  67.635 -%
  67.636 -\begin{isamarkuptext}%
  67.637 -\noindent together with corresponding constant(s):%
  67.638 -\end{isamarkuptext}%
  67.639 -\isamarkuptrue%
  67.640 -%
  67.641 -\isadelimquote
  67.642 -%
  67.643 -\endisadelimquote
  67.644 -%
  67.645 -\isatagquote
  67.646 -\isacommand{consts}\isamarkupfalse%
  67.647 -\ f\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isasymalpha}\ {\isasymRightarrow}\ {\isasymalpha}{\isachardoublequoteclose}%
  67.648 -\endisatagquote
  67.649 -{\isafoldquote}%
  67.650 -%
  67.651 -\isadelimquote
  67.652 -%
  67.653 -\endisadelimquote
  67.654 -%
  67.655 -\begin{isamarkuptext}%
  67.656 -\noindent The connection to the type system is done by means
  67.657 -  of a primitive axclass%
  67.658 -\end{isamarkuptext}%
  67.659 -\isamarkuptrue%
  67.660 -%
  67.661 -\isadeliminvisible
  67.662 -\ %
  67.663 -\endisadeliminvisible
  67.664 -%
  67.665 -\isataginvisible
  67.666 -\isacommand{setup}\isamarkupfalse%
  67.667 -\ {\isacharverbatimopen}\ Sign{\isachardot}add{\isacharunderscore}path\ {\isachardoublequote}foo{\isachardoublequote}\ {\isacharverbatimclose}%
  67.668 -\endisataginvisible
  67.669 -{\isafoldinvisible}%
  67.670 -%
  67.671 -\isadeliminvisible
  67.672 -%
  67.673 -\endisadeliminvisible
  67.674 -\isanewline
  67.675 -%
  67.676 -\isadelimquote
  67.677 -\isanewline
  67.678 -%
  67.679 -\endisadelimquote
  67.680 -%
  67.681 -\isatagquote
  67.682 -\isacommand{axclass}\isamarkupfalse%
  67.683 -\ idem\ {\isacharless}\ type\isanewline
  67.684 -\ \ idem{\isacharcolon}\ {\isachardoublequoteopen}f\ {\isacharparenleft}f\ x{\isacharparenright}\ {\isacharequal}\ f\ x{\isachardoublequoteclose}%
  67.685 -\endisatagquote
  67.686 -{\isafoldquote}%
  67.687 -%
  67.688 -\isadelimquote
  67.689 -%
  67.690 -\endisadelimquote
  67.691 -%
  67.692 -\isadeliminvisible
  67.693 -\ %
  67.694 -\endisadeliminvisible
  67.695 -%
  67.696 -\isataginvisible
  67.697 -\isacommand{setup}\isamarkupfalse%
  67.698 -\ {\isacharverbatimopen}\ Sign{\isachardot}parent{\isacharunderscore}path\ {\isacharverbatimclose}%
  67.699 -\endisataginvisible
  67.700 -{\isafoldinvisible}%
  67.701 -%
  67.702 -\isadeliminvisible
  67.703 -%
  67.704 -\endisadeliminvisible
  67.705 -%
  67.706 -\begin{isamarkuptext}%
  67.707 -\noindent together with a corresponding interpretation:%
  67.708 -\end{isamarkuptext}%
  67.709 -\isamarkuptrue%
  67.710 -%
  67.711 -\isadelimquote
  67.712 -%
  67.713 -\endisadelimquote
  67.714 -%
  67.715 -\isatagquote
  67.716 -\isacommand{interpretation}\isamarkupfalse%
  67.717 -\ idem{\isacharunderscore}class{\isacharcolon}\isanewline
  67.718 -\ \ idem\ {\isachardoublequoteopen}f\ {\isasymColon}\ {\isacharparenleft}{\isasymalpha}{\isasymColon}idem{\isacharparenright}\ {\isasymRightarrow}\ {\isasymalpha}{\isachardoublequoteclose}\isanewline
  67.719 -\isacommand{proof}\isamarkupfalse%
  67.720 -\ \isacommand{qed}\isamarkupfalse%
  67.721 -\ {\isacharparenleft}rule\ idem{\isacharparenright}%
  67.722 -\endisatagquote
  67.723 -{\isafoldquote}%
  67.724 -%
  67.725 -\isadelimquote
  67.726 -%
  67.727 -\endisadelimquote
  67.728 -%
  67.729 -\begin{isamarkuptext}%
  67.730 -\noindent This gives you at hand the full power of the Isabelle module system;
  67.731 -  conclusions in locale \isa{idem} are implicitly propagated
  67.732 -  to class \isa{idem}.%
  67.733 -\end{isamarkuptext}%
  67.734 -\isamarkuptrue%
  67.735 -%
  67.736 -\isadeliminvisible
  67.737 -\ %
  67.738 -\endisadeliminvisible
  67.739 -%
  67.740 -\isataginvisible
  67.741 -\isacommand{setup}\isamarkupfalse%
  67.742 -\ {\isacharverbatimopen}\ Sign{\isachardot}parent{\isacharunderscore}path\ {\isacharverbatimclose}%
  67.743 -\endisataginvisible
  67.744 -{\isafoldinvisible}%
  67.745 -%
  67.746 -\isadeliminvisible
  67.747 -%
  67.748 -\endisadeliminvisible
  67.749 -%
  67.750 -\isamarkupsubsection{Abstract reasoning%
  67.751 -}
  67.752 -\isamarkuptrue%
  67.753 -%
  67.754 -\begin{isamarkuptext}%
  67.755 -Isabelle locales enable reasoning at a general level, while results
  67.756 -  are implicitly transferred to all instances.  For example, we can
  67.757 -  now establish the \isa{left{\isacharunderscore}cancel} lemma for groups, which
  67.758 -  states that the function \isa{{\isacharparenleft}x\ {\isasymotimes}{\isacharparenright}} is injective:%
  67.759 -\end{isamarkuptext}%
  67.760 -\isamarkuptrue%
  67.761 -%
  67.762 -\isadelimquote
  67.763 -%
  67.764 -\endisadelimquote
  67.765 -%
  67.766 -\isatagquote
  67.767 -\isacommand{lemma}\isamarkupfalse%
  67.768 -\ {\isacharparenleft}\isakeyword{in}\ group{\isacharparenright}\ left{\isacharunderscore}cancel{\isacharcolon}\ {\isachardoublequoteopen}x\ {\isasymotimes}\ y\ {\isacharequal}\ x\ {\isasymotimes}\ z\ {\isasymlongleftrightarrow}\ y\ {\isacharequal}\ z{\isachardoublequoteclose}\isanewline
  67.769 -\isacommand{proof}\isamarkupfalse%
  67.770 -\isanewline
  67.771 -\ \ \isacommand{assume}\isamarkupfalse%
  67.772 -\ {\isachardoublequoteopen}x\ {\isasymotimes}\ y\ {\isacharequal}\ x\ {\isasymotimes}\ z{\isachardoublequoteclose}\isanewline
  67.773 -\ \ \isacommand{then}\isamarkupfalse%
  67.774 -\ \isacommand{have}\isamarkupfalse%
  67.775 -\ {\isachardoublequoteopen}x{\isasymdiv}\ {\isasymotimes}\ {\isacharparenleft}x\ {\isasymotimes}\ y{\isacharparenright}\ {\isacharequal}\ x{\isasymdiv}\ {\isasymotimes}\ {\isacharparenleft}x\ {\isasymotimes}\ z{\isacharparenright}{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
  67.776 -\ simp\isanewline
  67.777 -\ \ \isacommand{then}\isamarkupfalse%
  67.778 -\ \isacommand{have}\isamarkupfalse%
  67.779 -\ {\isachardoublequoteopen}{\isacharparenleft}x{\isasymdiv}\ {\isasymotimes}\ x{\isacharparenright}\ {\isasymotimes}\ y\ {\isacharequal}\ {\isacharparenleft}x{\isasymdiv}\ {\isasymotimes}\ x{\isacharparenright}\ {\isasymotimes}\ z{\isachardoublequoteclose}\ \isacommand{using}\isamarkupfalse%
  67.780 -\ assoc\ \isacommand{by}\isamarkupfalse%
  67.781 -\ simp\isanewline
  67.782 -\ \ \isacommand{then}\isamarkupfalse%
  67.783 -\ \isacommand{show}\isamarkupfalse%
  67.784 -\ {\isachardoublequoteopen}y\ {\isacharequal}\ z{\isachardoublequoteclose}\ \isacommand{using}\isamarkupfalse%
  67.785 -\ neutl\ \isakeyword{and}\ invl\ \isacommand{by}\isamarkupfalse%
  67.786 -\ simp\isanewline
  67.787 -\isacommand{next}\isamarkupfalse%
  67.788 -\isanewline
  67.789 -\ \ \isacommand{assume}\isamarkupfalse%
  67.790 -\ {\isachardoublequoteopen}y\ {\isacharequal}\ z{\isachardoublequoteclose}\isanewline
  67.791 -\ \ \isacommand{then}\isamarkupfalse%
  67.792 -\ \isacommand{show}\isamarkupfalse%
  67.793 -\ {\isachardoublequoteopen}x\ {\isasymotimes}\ y\ {\isacharequal}\ x\ {\isasymotimes}\ z{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
  67.794 -\ simp\isanewline
  67.795 -\isacommand{qed}\isamarkupfalse%
  67.796 -%
  67.797 -\endisatagquote
  67.798 -{\isafoldquote}%
  67.799 -%
  67.800 -\isadelimquote
  67.801 -%
  67.802 -\endisadelimquote
  67.803 -%
  67.804 -\begin{isamarkuptext}%
  67.805 -\noindent Here the \qt{\hyperlink{keyword.in}{\mbox{\isa{\isakeyword{in}}}} \isa{group}} target specification
  67.806 -  indicates that the result is recorded within that context for later
  67.807 -  use.  This local theorem is also lifted to the global one \hyperlink{fact.group.left-cancel:}{\mbox{\isa{group{\isachardot}left{\isacharunderscore}cancel{\isacharcolon}}}} \isa{{\isachardoublequote}{\isasymAnd}x\ y\ z\ {\isasymColon}\ {\isasymalpha}{\isasymColon}group{\isachardot}\ x\ {\isasymotimes}\ y\ {\isacharequal}\ x\ {\isasymotimes}\ z\ {\isasymlongleftrightarrow}\ y\ {\isacharequal}\ z{\isachardoublequote}}.  Since type \isa{int} has been made an instance of
  67.808 -  \isa{group} before, we may refer to that fact as well: \isa{{\isachardoublequote}{\isasymAnd}x\ y\ z\ {\isasymColon}\ int{\isachardot}\ x\ {\isasymotimes}\ y\ {\isacharequal}\ x\ {\isasymotimes}\ z\ {\isasymlongleftrightarrow}\ y\ {\isacharequal}\ z{\isachardoublequote}}.%
  67.809 -\end{isamarkuptext}%
  67.810 -\isamarkuptrue%
  67.811 -%
  67.812 -\isamarkupsubsection{Derived definitions%
  67.813 -}
  67.814 -\isamarkuptrue%
  67.815 -%
  67.816 -\begin{isamarkuptext}%
  67.817 -Isabelle locales support a concept of local definitions
  67.818 -  in locales:%
  67.819 -\end{isamarkuptext}%
  67.820 -\isamarkuptrue%
  67.821 -%
  67.822 -\isadelimquote
  67.823 -%
  67.824 -\endisadelimquote
  67.825 -%
  67.826 -\isatagquote
  67.827 -\isacommand{primrec}\isamarkupfalse%
  67.828 -\ {\isacharparenleft}\isakeyword{in}\ monoid{\isacharparenright}\ pow{\isacharunderscore}nat\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ {\isasymalpha}\ {\isasymRightarrow}\ {\isasymalpha}{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  67.829 -\ \ {\isachardoublequoteopen}pow{\isacharunderscore}nat\ {\isadigit{0}}\ x\ {\isacharequal}\ {\isasymone}{\isachardoublequoteclose}\isanewline
  67.830 -\ \ {\isacharbar}\ {\isachardoublequoteopen}pow{\isacharunderscore}nat\ {\isacharparenleft}Suc\ n{\isacharparenright}\ x\ {\isacharequal}\ x\ {\isasymotimes}\ pow{\isacharunderscore}nat\ n\ x{\isachardoublequoteclose}%
  67.831 -\endisatagquote
  67.832 -{\isafoldquote}%
  67.833 -%
  67.834 -\isadelimquote
  67.835 -%
  67.836 -\endisadelimquote
  67.837 -%
  67.838 -\begin{isamarkuptext}%
  67.839 -\noindent If the locale \isa{group} is also a class, this local
  67.840 -  definition is propagated onto a global definition of
  67.841 -  \isa{{\isachardoublequote}pow{\isacharunderscore}nat\ {\isasymColon}\ nat\ {\isasymRightarrow}\ {\isasymalpha}{\isasymColon}monoid\ {\isasymRightarrow}\ {\isasymalpha}{\isasymColon}monoid{\isachardoublequote}}
  67.842 -  with corresponding theorems
  67.843 -
  67.844 -  \isa{pow{\isacharunderscore}nat\ {\isadigit{0}}\ x\ {\isacharequal}\ {\isasymone}\isasep\isanewline%
  67.845 -pow{\isacharunderscore}nat\ {\isacharparenleft}Suc\ n{\isacharparenright}\ x\ {\isacharequal}\ x\ {\isasymotimes}\ pow{\isacharunderscore}nat\ n\ x}.
  67.846 -
  67.847 -  \noindent As you can see from this example, for local
  67.848 -  definitions you may use any specification tool
  67.849 -  which works together with locales (e.g. \cite{krauss2006}).%
  67.850 -\end{isamarkuptext}%
  67.851 -\isamarkuptrue%
  67.852 -%
  67.853 -\isamarkupsubsection{A functor analogy%
  67.854 -}
  67.855 -\isamarkuptrue%
  67.856 -%
  67.857 -\begin{isamarkuptext}%
  67.858 -We introduced Isar classes by analogy to type classes
  67.859 -  functional programming;  if we reconsider this in the
  67.860 -  context of what has been said about type classes and locales,
  67.861 -  we can drive this analogy further by stating that type
  67.862 -  classes essentially correspond to functors which have
  67.863 -  a canonical interpretation as type classes.
  67.864 -  Anyway, there is also the possibility of other interpretations.
  67.865 -  For example, also \isa{list}s form a monoid with
  67.866 -  \isa{append} and \isa{{\isacharbrackleft}{\isacharbrackright}} as operations, but it
  67.867 -  seems inappropriate to apply to lists
  67.868 -  the same operations as for genuinely algebraic types.
  67.869 -  In such a case, we simply can do a particular interpretation
  67.870 -  of monoids for lists:%
  67.871 -\end{isamarkuptext}%
  67.872 -\isamarkuptrue%
  67.873 -%
  67.874 -\isadelimquote
  67.875 -%
  67.876 -\endisadelimquote
  67.877 -%
  67.878 -\isatagquote
  67.879 -\isacommand{interpretation}\isamarkupfalse%
  67.880 -\ list{\isacharunderscore}monoid{\isacharbang}{\isacharcolon}\ monoid\ append\ {\isachardoublequoteopen}{\isacharbrackleft}{\isacharbrackright}{\isachardoublequoteclose}\isanewline
  67.881 -\ \ \isacommand{proof}\isamarkupfalse%
  67.882 -\ \isacommand{qed}\isamarkupfalse%
  67.883 -\ auto%
  67.884 -\endisatagquote
  67.885 -{\isafoldquote}%
  67.886 -%
  67.887 -\isadelimquote
  67.888 -%
  67.889 -\endisadelimquote
  67.890 -%
  67.891 -\begin{isamarkuptext}%
  67.892 -\noindent This enables us to apply facts on monoids
  67.893 -  to lists, e.g. \isa{{\isacharbrackleft}{\isacharbrackright}\ {\isacharat}\ x\ {\isacharequal}\ x}.
  67.894 -
  67.895 -  When using this interpretation pattern, it may also
  67.896 -  be appropriate to map derived definitions accordingly:%
  67.897 -\end{isamarkuptext}%
  67.898 -\isamarkuptrue%
  67.899 -%
  67.900 -\isadelimquote
  67.901 -%
  67.902 -\endisadelimquote
  67.903 -%
  67.904 -\isatagquote
  67.905 -\isacommand{primrec}\isamarkupfalse%
  67.906 -\ replicate\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ {\isasymalpha}\ list\ {\isasymRightarrow}\ {\isasymalpha}\ list{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  67.907 -\ \ {\isachardoublequoteopen}replicate\ {\isadigit{0}}\ {\isacharunderscore}\ {\isacharequal}\ {\isacharbrackleft}{\isacharbrackright}{\isachardoublequoteclose}\isanewline
  67.908 -\ \ {\isacharbar}\ {\isachardoublequoteopen}replicate\ {\isacharparenleft}Suc\ n{\isacharparenright}\ xs\ {\isacharequal}\ xs\ {\isacharat}\ replicate\ n\ xs{\isachardoublequoteclose}\isanewline
  67.909 -\isanewline
  67.910 -\isacommand{interpretation}\isamarkupfalse%
  67.911 -\ list{\isacharunderscore}monoid{\isacharbang}{\isacharcolon}\ monoid\ append\ {\isachardoublequoteopen}{\isacharbrackleft}{\isacharbrackright}{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  67.912 -\ \ {\isachardoublequoteopen}monoid{\isachardot}pow{\isacharunderscore}nat\ append\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharequal}\ replicate{\isachardoublequoteclose}\isanewline
  67.913 -\isacommand{proof}\isamarkupfalse%
  67.914 -\ {\isacharminus}\isanewline
  67.915 -\ \ \isacommand{interpret}\isamarkupfalse%
  67.916 -\ monoid\ append\ {\isachardoublequoteopen}{\isacharbrackleft}{\isacharbrackright}{\isachardoublequoteclose}\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
  67.917 -\isanewline
  67.918 -\ \ \isacommand{show}\isamarkupfalse%
  67.919 -\ {\isachardoublequoteopen}monoid{\isachardot}pow{\isacharunderscore}nat\ append\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharequal}\ replicate{\isachardoublequoteclose}\isanewline
  67.920 -\ \ \isacommand{proof}\isamarkupfalse%
  67.921 -\isanewline
  67.922 -\ \ \ \ \isacommand{fix}\isamarkupfalse%
  67.923 -\ n\isanewline
  67.924 -\ \ \ \ \isacommand{show}\isamarkupfalse%
  67.925 -\ {\isachardoublequoteopen}monoid{\isachardot}pow{\isacharunderscore}nat\ append\ {\isacharbrackleft}{\isacharbrackright}\ n\ {\isacharequal}\ replicate\ n{\isachardoublequoteclose}\isanewline
  67.926 -\ \ \ \ \ \ \isacommand{by}\isamarkupfalse%
  67.927 -\ {\isacharparenleft}induct\ n{\isacharparenright}\ auto\isanewline
  67.928 -\ \ \isacommand{qed}\isamarkupfalse%
  67.929 -\isanewline
  67.930 -\isacommand{qed}\isamarkupfalse%
  67.931 -\ intro{\isacharunderscore}locales%
  67.932 -\endisatagquote
  67.933 -{\isafoldquote}%
  67.934 -%
  67.935 -\isadelimquote
  67.936 -%
  67.937 -\endisadelimquote
  67.938 -%
  67.939 -\isamarkupsubsection{Additional subclass relations%
  67.940 -}
  67.941 -\isamarkuptrue%
  67.942 -%
  67.943 -\begin{isamarkuptext}%
  67.944 -Any \isa{group} is also a \isa{monoid};  this
  67.945 -  can be made explicit by claiming an additional
  67.946 -  subclass relation,
  67.947 -  together with a proof of the logical difference:%
  67.948 -\end{isamarkuptext}%
  67.949 -\isamarkuptrue%
  67.950 -%
  67.951 -\isadelimquote
  67.952 -%
  67.953 -\endisadelimquote
  67.954 -%
  67.955 -\isatagquote
  67.956 -\isacommand{subclass}\isamarkupfalse%
  67.957 -\ {\isacharparenleft}\isakeyword{in}\ group{\isacharparenright}\ monoid\isanewline
  67.958 -\isacommand{proof}\isamarkupfalse%
  67.959 -\isanewline
  67.960 -\ \ \isacommand{fix}\isamarkupfalse%
  67.961 -\ x\isanewline
  67.962 -\ \ \isacommand{from}\isamarkupfalse%
  67.963 -\ invl\ \isacommand{have}\isamarkupfalse%
  67.964 -\ {\isachardoublequoteopen}x{\isasymdiv}\ {\isasymotimes}\ x\ {\isacharequal}\ {\isasymone}{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
  67.965 -\ simp\isanewline
  67.966 -\ \ \isacommand{with}\isamarkupfalse%
  67.967 -\ assoc\ {\isacharbrackleft}symmetric{\isacharbrackright}\ neutl\ invl\ \isacommand{have}\isamarkupfalse%
  67.968 -\ {\isachardoublequoteopen}x{\isasymdiv}\ {\isasymotimes}\ {\isacharparenleft}x\ {\isasymotimes}\ {\isasymone}{\isacharparenright}\ {\isacharequal}\ x{\isasymdiv}\ {\isasymotimes}\ x{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
  67.969 -\ simp\isanewline
  67.970 -\ \ \isacommand{with}\isamarkupfalse%
  67.971 -\ left{\isacharunderscore}cancel\ \isacommand{show}\isamarkupfalse%
  67.972 -\ {\isachardoublequoteopen}x\ {\isasymotimes}\ {\isasymone}\ {\isacharequal}\ x{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
  67.973 -\ simp\isanewline
  67.974 -\isacommand{qed}\isamarkupfalse%
  67.975 -%
  67.976 -\endisatagquote
  67.977 -{\isafoldquote}%
  67.978 -%
  67.979 -\isadelimquote
  67.980 -%
  67.981 -\endisadelimquote
  67.982 -%
  67.983 -\begin{isamarkuptext}%
  67.984 -\noindent The logical proof is carried out on the locale level.
  67.985 -  Afterwards it is propagated
  67.986 -  to the type system, making \isa{group} an instance of
  67.987 -  \isa{monoid} by adding an additional edge
  67.988 -  to the graph of subclass relations
  67.989 -  (cf.\ \figref{fig:subclass}).
  67.990 -
  67.991 -  \begin{figure}[htbp]
  67.992 -   \begin{center}
  67.993 -     \small
  67.994 -     \unitlength 0.6mm
  67.995 -     \begin{picture}(40,60)(0,0)
  67.996 -       \put(20,60){\makebox(0,0){\isa{semigroup}}}
  67.997 -       \put(20,40){\makebox(0,0){\isa{monoidl}}}
  67.998 -       \put(00,20){\makebox(0,0){\isa{monoid}}}
  67.999 -       \put(40,00){\makebox(0,0){\isa{group}}}
 67.1000 -       \put(20,55){\vector(0,-1){10}}
 67.1001 -       \put(15,35){\vector(-1,-1){10}}
 67.1002 -       \put(25,35){\vector(1,-3){10}}
 67.1003 -     \end{picture}
 67.1004 -     \hspace{8em}
 67.1005 -     \begin{picture}(40,60)(0,0)
 67.1006 -       \put(20,60){\makebox(0,0){\isa{semigroup}}}
 67.1007 -       \put(20,40){\makebox(0,0){\isa{monoidl}}}
 67.1008 -       \put(00,20){\makebox(0,0){\isa{monoid}}}
 67.1009 -       \put(40,00){\makebox(0,0){\isa{group}}}
 67.1010 -       \put(20,55){\vector(0,-1){10}}
 67.1011 -       \put(15,35){\vector(-1,-1){10}}
 67.1012 -       \put(05,15){\vector(3,-1){30}}
 67.1013 -     \end{picture}
 67.1014 -     \caption{Subclass relationship of monoids and groups:
 67.1015 -        before and after establishing the relationship
 67.1016 -        \isa{group\ {\isasymsubseteq}\ monoid};  transitive edges left out.}
 67.1017 -     \label{fig:subclass}
 67.1018 -   \end{center}
 67.1019 -  \end{figure}
 67.1020 -7
 67.1021 -  For illustration, a derived definition
 67.1022 -  in \isa{group} which uses \isa{pow{\isacharunderscore}nat}:%
 67.1023 -\end{isamarkuptext}%
 67.1024 -\isamarkuptrue%
 67.1025 -%
 67.1026 -\isadelimquote
 67.1027 -%
 67.1028 -\endisadelimquote
 67.1029 -%
 67.1030 -\isatagquote
 67.1031 -\isacommand{definition}\isamarkupfalse%
 67.1032 -\ {\isacharparenleft}\isakeyword{in}\ group{\isacharparenright}\ pow{\isacharunderscore}int\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}int\ {\isasymRightarrow}\ {\isasymalpha}\ {\isasymRightarrow}\ {\isasymalpha}{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
 67.1033 -\ \ {\isachardoublequoteopen}pow{\isacharunderscore}int\ k\ x\ {\isacharequal}\ {\isacharparenleft}if\ k\ {\isachargreater}{\isacharequal}\ {\isadigit{0}}\isanewline
 67.1034 -\ \ \ \ then\ pow{\isacharunderscore}nat\ {\isacharparenleft}nat\ k{\isacharparenright}\ x\isanewline
 67.1035 -\ \ \ \ else\ {\isacharparenleft}pow{\isacharunderscore}nat\ {\isacharparenleft}nat\ {\isacharparenleft}{\isacharminus}\ k{\isacharparenright}{\isacharparenright}\ x{\isacharparenright}{\isasymdiv}{\isacharparenright}{\isachardoublequoteclose}%
 67.1036 -\endisatagquote
 67.1037 -{\isafoldquote}%
 67.1038 -%
 67.1039 -\isadelimquote
 67.1040 -%
 67.1041 -\endisadelimquote
 67.1042 -%
 67.1043 -\begin{isamarkuptext}%
 67.1044 -\noindent yields the global definition of
 67.1045 -  \isa{{\isachardoublequote}pow{\isacharunderscore}int\ {\isasymColon}\ int\ {\isasymRightarrow}\ {\isasymalpha}{\isasymColon}group\ {\isasymRightarrow}\ {\isasymalpha}{\isasymColon}group{\isachardoublequote}}
 67.1046 -  with the corresponding theorem \isa{pow{\isacharunderscore}int\ k\ x\ {\isacharequal}\ {\isacharparenleft}if\ {\isadigit{0}}\ {\isasymle}\ k\ then\ pow{\isacharunderscore}nat\ {\isacharparenleft}nat\ k{\isacharparenright}\ x\ else\ {\isacharparenleft}pow{\isacharunderscore}nat\ {\isacharparenleft}nat\ {\isacharparenleft}{\isacharminus}\ k{\isacharparenright}{\isacharparenright}\ x{\isacharparenright}{\isasymdiv}{\isacharparenright}}.%
 67.1047 -\end{isamarkuptext}%
 67.1048 -\isamarkuptrue%
 67.1049 -%
 67.1050 -\isamarkupsubsection{A note on syntax%
 67.1051 -}
 67.1052 -\isamarkuptrue%
 67.1053 -%
 67.1054 -\begin{isamarkuptext}%
 67.1055 -As a commodity, class context syntax allows to refer
 67.1056 -  to local class operations and their global counterparts
 67.1057 -  uniformly;  type inference resolves ambiguities.  For example:%
 67.1058 -\end{isamarkuptext}%
 67.1059 -\isamarkuptrue%
 67.1060 -%
 67.1061 -\isadelimquote
 67.1062 -%
 67.1063 -\endisadelimquote
 67.1064 -%
 67.1065 -\isatagquote
 67.1066 -\isacommand{context}\isamarkupfalse%
 67.1067 -\ semigroup\isanewline
 67.1068 -\isakeyword{begin}\isanewline
 67.1069 -\isanewline
 67.1070 -\isacommand{term}\isamarkupfalse%
 67.1071 -\ {\isachardoublequoteopen}x\ {\isasymotimes}\ y{\isachardoublequoteclose}\ %
 67.1072 -\isamarkupcmt{example 1%
 67.1073 -}
 67.1074 -\isanewline
 67.1075 -\isacommand{term}\isamarkupfalse%
 67.1076 -\ {\isachardoublequoteopen}{\isacharparenleft}x{\isasymColon}nat{\isacharparenright}\ {\isasymotimes}\ y{\isachardoublequoteclose}\ %
 67.1077 -\isamarkupcmt{example 2%
 67.1078 -}
 67.1079 -\isanewline
 67.1080 -\isanewline
 67.1081 -\isacommand{end}\isamarkupfalse%
 67.1082 -\isanewline
 67.1083 -\isanewline
 67.1084 -\isacommand{term}\isamarkupfalse%
 67.1085 -\ {\isachardoublequoteopen}x\ {\isasymotimes}\ y{\isachardoublequoteclose}\ %
 67.1086 -\isamarkupcmt{example 3%
 67.1087 -}
 67.1088 -%
 67.1089 -\endisatagquote
 67.1090 -{\isafoldquote}%
 67.1091 -%
 67.1092 -\isadelimquote
 67.1093 -%
 67.1094 -\endisadelimquote
 67.1095 -%
 67.1096 -\begin{isamarkuptext}%
 67.1097 -\noindent Here in example 1, the term refers to the local class operation
 67.1098 -  \isa{mult\ {\isacharbrackleft}{\isasymalpha}{\isacharbrackright}}, whereas in example 2 the type constraint
 67.1099 -  enforces the global class operation \isa{mult\ {\isacharbrackleft}nat{\isacharbrackright}}.
 67.1100 -  In the global context in example 3, the reference is
 67.1101 -  to the polymorphic global class operation \isa{mult\ {\isacharbrackleft}{\isacharquery}{\isasymalpha}\ {\isasymColon}\ semigroup{\isacharbrackright}}.%
 67.1102 -\end{isamarkuptext}%
 67.1103 -\isamarkuptrue%
 67.1104 -%
 67.1105 -\isamarkupsection{Further issues%
 67.1106 -}
 67.1107 -\isamarkuptrue%
 67.1108 -%
 67.1109 -\isamarkupsubsection{Type classes and code generation%
 67.1110 -}
 67.1111 -\isamarkuptrue%
 67.1112 -%
 67.1113 -\begin{isamarkuptext}%
 67.1114 -Turning back to the first motivation for type classes,
 67.1115 -  namely overloading, it is obvious that overloading
 67.1116 -  stemming from \hyperlink{command.class}{\mbox{\isa{\isacommand{class}}}} statements and
 67.1117 -  \hyperlink{command.instantiation}{\mbox{\isa{\isacommand{instantiation}}}}
 67.1118 -  targets naturally maps to Haskell type classes.
 67.1119 -  The code generator framework \cite{isabelle-codegen} 
 67.1120 -  takes this into account.  Concerning target languages
 67.1121 -  lacking type classes (e.g.~SML), type classes
 67.1122 -  are implemented by explicit dictionary construction.
 67.1123 -  As example, let's go back to the power function:%
 67.1124 -\end{isamarkuptext}%
 67.1125 -\isamarkuptrue%
 67.1126 -%
 67.1127 -\isadelimquote
 67.1128 -%
 67.1129 -\endisadelimquote
 67.1130 -%
 67.1131 -\isatagquote
 67.1132 -\isacommand{definition}\isamarkupfalse%
 67.1133 -\ example\ {\isacharcolon}{\isacharcolon}\ int\ \isakeyword{where}\isanewline
 67.1134 -\ \ {\isachardoublequoteopen}example\ {\isacharequal}\ pow{\isacharunderscore}int\ {\isadigit{1}}{\isadigit{0}}\ {\isacharparenleft}{\isacharminus}{\isadigit{2}}{\isacharparenright}{\isachardoublequoteclose}%
 67.1135 -\endisatagquote
 67.1136 -{\isafoldquote}%
 67.1137 -%
 67.1138 -\isadelimquote
 67.1139 -%
 67.1140 -\endisadelimquote
 67.1141 -%
 67.1142 -\begin{isamarkuptext}%
 67.1143 -\noindent This maps to Haskell as:%
 67.1144 -\end{isamarkuptext}%
 67.1145 -\isamarkuptrue%
 67.1146 -%
 67.1147 -\isadelimquote
 67.1148 -%
 67.1149 -\endisadelimquote
 67.1150 -%
 67.1151 -\isatagquote
 67.1152 -%
 67.1153 -\begin{isamarkuptext}%
 67.1154 -\isatypewriter%
 67.1155 -\noindent%
 67.1156 -\hspace*{0pt}module Example where {\char123}\\
 67.1157 -\hspace*{0pt}\\
 67.1158 -\hspace*{0pt}\\
 67.1159 -\hspace*{0pt}data Nat = Zero{\char95}nat | Suc Nat;\\
 67.1160 -\hspace*{0pt}\\
 67.1161 -\hspace*{0pt}nat{\char95}aux ::~Integer -> Nat -> Nat;\\
 67.1162 -\hspace*{0pt}nat{\char95}aux i n = (if i <= 0 then n else nat{\char95}aux (i - 1) (Suc n));\\
 67.1163 -\hspace*{0pt}\\
 67.1164 -\hspace*{0pt}nat ::~Integer -> Nat;\\
 67.1165 -\hspace*{0pt}nat i = nat{\char95}aux i Zero{\char95}nat;\\
 67.1166 -\hspace*{0pt}\\
 67.1167 -\hspace*{0pt}class Semigroup a where {\char123}\\
 67.1168 -\hspace*{0pt} ~mult ::~a -> a -> a;\\
 67.1169 -\hspace*{0pt}{\char125};\\
 67.1170 -\hspace*{0pt}\\
 67.1171 -\hspace*{0pt}class (Semigroup a) => Monoidl a where {\char123}\\
 67.1172 -\hspace*{0pt} ~neutral ::~a;\\
 67.1173 -\hspace*{0pt}{\char125};\\
 67.1174 -\hspace*{0pt}\\
 67.1175 -\hspace*{0pt}class (Monoidl a) => Monoid a where {\char123}\\
 67.1176 -\hspace*{0pt}{\char125};\\
 67.1177 -\hspace*{0pt}\\
 67.1178 -\hspace*{0pt}class (Monoid a) => Group a where {\char123}\\
 67.1179 -\hspace*{0pt} ~inverse ::~a -> a;\\
 67.1180 -\hspace*{0pt}{\char125};\\
 67.1181 -\hspace*{0pt}\\
 67.1182 -\hspace*{0pt}inverse{\char95}int ::~Integer -> Integer;\\
 67.1183 -\hspace*{0pt}inverse{\char95}int i = negate i;\\
 67.1184 -\hspace*{0pt}\\
 67.1185 -\hspace*{0pt}neutral{\char95}int ::~Integer;\\
 67.1186 -\hspace*{0pt}neutral{\char95}int = 0;\\
 67.1187 -\hspace*{0pt}\\
 67.1188 -\hspace*{0pt}mult{\char95}int ::~Integer -> Integer -> Integer;\\
 67.1189 -\hspace*{0pt}mult{\char95}int i j = i + j;\\
 67.1190 -\hspace*{0pt}\\
 67.1191 -\hspace*{0pt}instance Semigroup Integer where {\char123}\\
 67.1192 -\hspace*{0pt} ~mult = mult{\char95}int;\\
 67.1193 -\hspace*{0pt}{\char125};\\
 67.1194 -\hspace*{0pt}\\
 67.1195 -\hspace*{0pt}instance Monoidl Integer where {\char123}\\
 67.1196 -\hspace*{0pt} ~neutral = neutral{\char95}int;\\
 67.1197 -\hspace*{0pt}{\char125};\\
 67.1198 -\hspace*{0pt}\\
 67.1199 -\hspace*{0pt}instance Monoid Integer where {\char123}\\
 67.1200 -\hspace*{0pt}{\char125};\\
 67.1201 -\hspace*{0pt}\\
 67.1202 -\hspace*{0pt}instance Group Integer where {\char123}\\
 67.1203 -\hspace*{0pt} ~inverse = inverse{\char95}int;\\
 67.1204 -\hspace*{0pt}{\char125};\\
 67.1205 -\hspace*{0pt}\\
 67.1206 -\hspace*{0pt}pow{\char95}nat ::~forall a.~(Monoid a) => Nat -> a -> a;\\
 67.1207 -\hspace*{0pt}pow{\char95}nat Zero{\char95}nat x = neutral;\\
 67.1208 -\hspace*{0pt}pow{\char95}nat (Suc n) x = mult x (pow{\char95}nat n x);\\
 67.1209 -\hspace*{0pt}\\
 67.1210 -\hspace*{0pt}pow{\char95}int ::~forall a.~(Group a) => Integer -> a -> a;\\
 67.1211 -\hspace*{0pt}pow{\char95}int k x =\\
 67.1212 -\hspace*{0pt} ~(if 0 <= k then pow{\char95}nat (nat k) x\\
 67.1213 -\hspace*{0pt} ~~~else inverse (pow{\char95}nat (nat (negate k)) x));\\
 67.1214 -\hspace*{0pt}\\
 67.1215 -\hspace*{0pt}example ::~Integer;\\
 67.1216 -\hspace*{0pt}example = pow{\char95}int 10 (-2);\\
 67.1217 -\hspace*{0pt}\\
 67.1218 -\hspace*{0pt}{\char125}%
 67.1219 -\end{isamarkuptext}%
 67.1220 -\isamarkuptrue%
 67.1221 -%
 67.1222 -\endisatagquote
 67.1223 -{\isafoldquote}%
 67.1224 -%
 67.1225 -\isadelimquote
 67.1226 -%
 67.1227 -\endisadelimquote
 67.1228 -%
 67.1229 -\begin{isamarkuptext}%
 67.1230 -\noindent The whole code in SML with explicit dictionary passing:%
 67.1231 -\end{isamarkuptext}%
 67.1232 -\isamarkuptrue%
 67.1233 -%
 67.1234 -\isadelimquote
 67.1235 -%
 67.1236 -\endisadelimquote
 67.1237 -%
 67.1238 -\isatagquote
 67.1239 -%
 67.1240 -\begin{isamarkuptext}%
 67.1241 -\isatypewriter%
 67.1242 -\noindent%
 67.1243 -\hspace*{0pt}structure Example = \\
 67.1244 -\hspace*{0pt}struct\\
 67.1245 -\hspace*{0pt}\\
 67.1246 -\hspace*{0pt}datatype nat = Zero{\char95}nat | Suc of nat;\\
 67.1247 -\hspace*{0pt}\\
 67.1248 -\hspace*{0pt}fun nat{\char95}aux i n =\\
 67.1249 -\hspace*{0pt} ~(if IntInf.<= (i,~(0 :~IntInf.int)) then n\\
 67.1250 -\hspace*{0pt} ~~~else nat{\char95}aux (IntInf.- (i,~(1 :~IntInf.int))) (Suc n));\\
 67.1251 -\hspace*{0pt}\\
 67.1252 -\hspace*{0pt}fun nat i = nat{\char95}aux i Zero{\char95}nat;\\
 67.1253 -\hspace*{0pt}\\
 67.1254 -\hspace*{0pt}type 'a semigroup = {\char123}mult :~'a -> 'a -> 'a{\char125};\\
 67.1255 -\hspace*{0pt}fun mult (A{\char95}:'a semigroup) = {\char35}mult A{\char95};\\
 67.1256 -\hspace*{0pt}\\
 67.1257 -\hspace*{0pt}type 'a monoidl =\\
 67.1258 -\hspace*{0pt} ~{\char123}Classes{\char95}{\char95}semigroup{\char95}monoidl :~'a semigroup,~neutral :~'a{\char125};\\
 67.1259 -\hspace*{0pt}fun semigroup{\char95}monoidl (A{\char95}:'a monoidl) = {\char35}Classes{\char95}{\char95}semigroup{\char95}monoidl A{\char95};\\
 67.1260 -\hspace*{0pt}fun neutral (A{\char95}:'a monoidl) = {\char35}neutral A{\char95};\\
 67.1261 -\hspace*{0pt}\\
 67.1262 -\hspace*{0pt}type 'a monoid = {\char123}Classes{\char95}{\char95}monoidl{\char95}monoid :~'a monoidl{\char125};\\
 67.1263 -\hspace*{0pt}fun monoidl{\char95}monoid (A{\char95}:'a monoid) = {\char35}Classes{\char95}{\char95}monoidl{\char95}monoid A{\char95};\\
 67.1264 -\hspace*{0pt}\\
 67.1265 -\hspace*{0pt}type 'a group = {\char123}Classes{\char95}{\char95}monoid{\char95}group :~'a monoid,~inverse :~'a -> 'a{\char125};\\
 67.1266 -\hspace*{0pt}fun monoid{\char95}group (A{\char95}:'a group) = {\char35}Classes{\char95}{\char95}monoid{\char95}group A{\char95};\\
 67.1267 -\hspace*{0pt}fun inverse (A{\char95}:'a group) = {\char35}inverse A{\char95};\\
 67.1268 -\hspace*{0pt}\\
 67.1269 -\hspace*{0pt}fun inverse{\char95}int i = IntInf.{\char126}~i;\\
 67.1270 -\hspace*{0pt}\\
 67.1271 -\hspace*{0pt}val neutral{\char95}int :~IntInf.int = (0 :~IntInf.int)\\
 67.1272 -\hspace*{0pt}\\
 67.1273 -\hspace*{0pt}fun mult{\char95}int i j = IntInf.+ (i,~j);\\
 67.1274 -\hspace*{0pt}\\
 67.1275 -\hspace*{0pt}val semigroup{\char95}int = {\char123}mult = mult{\char95}int{\char125}~:~IntInf.int semigroup;\\
 67.1276 -\hspace*{0pt}\\
 67.1277 -\hspace*{0pt}val monoidl{\char95}int =\\
 67.1278 -\hspace*{0pt} ~{\char123}Classes{\char95}{\char95}semigroup{\char95}monoidl = semigroup{\char95}int,~neutral = neutral{\char95}int{\char125}~:\\
 67.1279 -\hspace*{0pt} ~IntInf.int monoidl;\\
 67.1280 -\hspace*{0pt}\\
 67.1281 -\hspace*{0pt}val monoid{\char95}int = {\char123}Classes{\char95}{\char95}monoidl{\char95}monoid = monoidl{\char95}int{\char125}~:\\
 67.1282 -\hspace*{0pt} ~IntInf.int monoid;\\
 67.1283 -\hspace*{0pt}\\
 67.1284 -\hspace*{0pt}val group{\char95}int =\\
 67.1285 -\hspace*{0pt} ~{\char123}Classes{\char95}{\char95}monoid{\char95}group = monoid{\char95}int,~inverse = inverse{\char95}int{\char125}~:\\
 67.1286 -\hspace*{0pt} ~IntInf.int group;\\
 67.1287 -\hspace*{0pt}\\
 67.1288 -\hspace*{0pt}fun pow{\char95}nat A{\char95}~Zero{\char95}nat x = neutral (monoidl{\char95}monoid A{\char95})\\
 67.1289 -\hspace*{0pt} ~| pow{\char95}nat A{\char95}~(Suc n) x =\\
 67.1290 -\hspace*{0pt} ~~~mult ((semigroup{\char95}monoidl o monoidl{\char95}monoid) A{\char95}) x (pow{\char95}nat A{\char95}~n x);\\
 67.1291 -\hspace*{0pt}\\
 67.1292 -\hspace*{0pt}fun pow{\char95}int A{\char95}~k x =\\
 67.1293 -\hspace*{0pt} ~(if IntInf.<= ((0 :~IntInf.int),~k)\\
 67.1294 -\hspace*{0pt} ~~~then pow{\char95}nat (monoid{\char95}group A{\char95}) (nat k) x\\
 67.1295 -\hspace*{0pt} ~~~else inverse A{\char95}~(pow{\char95}nat (monoid{\char95}group A{\char95}) (nat (IntInf.{\char126}~k)) x));\\
 67.1296 -\hspace*{0pt}\\
 67.1297 -\hspace*{0pt}val example :~IntInf.int =\\
 67.1298 -\hspace*{0pt} ~pow{\char95}int group{\char95}int (10 :~IntInf.int) ({\char126}2 :~IntInf.int)\\
 67.1299 -\hspace*{0pt}\\
 67.1300 -\hspace*{0pt}end;~(*struct Example*)%
 67.1301 -\end{isamarkuptext}%
 67.1302 -\isamarkuptrue%
 67.1303 -%
 67.1304 -\endisatagquote
 67.1305 -{\isafoldquote}%
 67.1306 -%
 67.1307 -\isadelimquote
 67.1308 -%
 67.1309 -\endisadelimquote
 67.1310 -%
 67.1311 -\isamarkupsubsection{Inspecting the type class universe%
 67.1312 -}
 67.1313 -\isamarkuptrue%
 67.1314 -%
 67.1315 -\begin{isamarkuptext}%
 67.1316 -To facilitate orientation in complex subclass structures,
 67.1317 -  two diagnostics commands are provided:
 67.1318 -
 67.1319 -  \begin{description}
 67.1320 -
 67.1321 -    \item[\hyperlink{command.print-classes}{\mbox{\isa{\isacommand{print{\isacharunderscore}classes}}}}] print a list of all classes
 67.1322 -      together with associated operations etc.
 67.1323 -
 67.1324 -    \item[\hyperlink{command.class-deps}{\mbox{\isa{\isacommand{class{\isacharunderscore}deps}}}}] visualizes the subclass relation
 67.1325 -      between all classes as a Hasse diagram.
 67.1326 -
 67.1327 -  \end{description}%
 67.1328 -\end{isamarkuptext}%
 67.1329 -\isamarkuptrue%
 67.1330 -%
 67.1331 -\isadelimtheory
 67.1332 -%
 67.1333 -\endisadelimtheory
 67.1334 -%
 67.1335 -\isatagtheory
 67.1336 -\isacommand{end}\isamarkupfalse%
 67.1337 -%
 67.1338 -\endisatagtheory
 67.1339 -{\isafoldtheory}%
 67.1340 -%
 67.1341 -\isadelimtheory
 67.1342 -%
 67.1343 -\endisadelimtheory
 67.1344 -\isanewline
 67.1345 -\end{isabellebody}%
 67.1346 -%%% Local Variables:
 67.1347 -%%% mode: latex
 67.1348 -%%% TeX-master: "root"
 67.1349 -%%% End:
    68.1 --- a/doc-src/IsarAdvanced/Classes/classes.tex	Mon Mar 02 16:58:39 2009 +0100
    68.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    68.3 @@ -1,50 +0,0 @@
    68.4 -
    68.5 -\documentclass[12pt,a4paper,fleqn]{report}
    68.6 -\usepackage{latexsym,graphicx}
    68.7 -\usepackage[refpage]{nomencl}
    68.8 -\usepackage{../../iman,../../extra,../../isar,../../proof}
    68.9 -\usepackage{../../isabelle,../../isabellesym}
   68.10 -\usepackage{style}
   68.11 -\usepackage{../../pdfsetup}
   68.12 -
   68.13 -
   68.14 -\hyphenation{Isabelle}
   68.15 -\hyphenation{Isar}
   68.16 -\isadroptag{theory}
   68.17 -
   68.18 -\title{\includegraphics[scale=0.5]{isabelle_isar}
   68.19 -  \\[4ex] Haskell-style type classes with Isabelle/Isar}
   68.20 -\author{\emph{Florian Haftmann}}
   68.21 -
   68.22 -\begin{document}
   68.23 -
   68.24 -\maketitle
   68.25 -
   68.26 -\begin{abstract}
   68.27 -  This tutorial introduces the look-and-feel of Isar type classes
   68.28 -  to the end-user; Isar type classes are a convenient mechanism
   68.29 -  for organizing specifications, overcoming some drawbacks
   68.30 -  of raw axiomatic type classes. Essentially, they combine
   68.31 -  an operational aspect (in the manner of Haskell) with
   68.32 -  a logical aspect, both managed uniformly.
   68.33 -\end{abstract}
   68.34 -
   68.35 -\thispagestyle{empty}\clearpage
   68.36 -
   68.37 -\pagenumbering{roman}
   68.38 -\clearfirst
   68.39 -
   68.40 -\input{Thy/document/Classes.tex}
   68.41 -
   68.42 -\begingroup
   68.43 -\bibliographystyle{plain} \small\raggedright\frenchspacing
   68.44 -\bibliography{../../manual}
   68.45 -\endgroup
   68.46 -
   68.47 -\end{document}
   68.48 -
   68.49 -
   68.50 -%%% Local Variables: 
   68.51 -%%% mode: latex
   68.52 -%%% TeX-master: t
   68.53 -%%% End: 
    69.1 --- a/doc-src/IsarAdvanced/Classes/style.sty	Mon Mar 02 16:58:39 2009 +0100
    69.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    69.3 @@ -1,43 +0,0 @@
    69.4 -
    69.5 -%% toc
    69.6 -\newcommand{\tocentry}[1]{\cleardoublepage\phantomsection\addcontentsline{toc}{chapter}{#1}
    69.7 -\@mkboth{\MakeUppercase{#1}}{\MakeUppercase{#1}}}
    69.8 -
    69.9 -%% references
   69.10 -\newcommand{\secref}[1]{\S\ref{#1}}
   69.11 -\newcommand{\figref}[1]{figure~\ref{#1}}
   69.12 -
   69.13 -%% logical markup
   69.14 -\newcommand{\strong}[1]{{\bfseries {#1}}}
   69.15 -\newcommand{\qn}[1]{\emph{#1}}
   69.16 -
   69.17 -%% typographic conventions
   69.18 -\newcommand{\qt}[1]{``{#1}''}
   69.19 -
   69.20 -%% verbatim text
   69.21 -\newcommand{\isatypewriter}{\fontsize{9pt}{0pt}\tt\renewcommand{\baselinestretch}{1}\setlength{\baselineskip}{9pt}}
   69.22 -
   69.23 -%% quoted segments
   69.24 -\makeatletter
   69.25 -\isakeeptag{quote}
   69.26 -\newenvironment{quotesegment}{\begin{quote}\isa@parindent\parindent\parindent0pt\isa@parskip\parskip\parskip0pt}{\end{quote}}
   69.27 -\renewcommand{\isatagquote}{\begin{quotesegment}}
   69.28 -\renewcommand{\endisatagquote}{\end{quotesegment}}
   69.29 -\makeatother
   69.30 -
   69.31 -%% presentation
   69.32 -\setcounter{secnumdepth}{2} \setcounter{tocdepth}{2}
   69.33 -
   69.34 -\pagestyle{headings}
   69.35 -\binperiod
   69.36 -\underscoreoff
   69.37 -
   69.38 -\renewcommand{\isadigit}[1]{\isamath{#1}}
   69.39 -
   69.40 -\isabellestyle{it}
   69.41 -
   69.42 -
   69.43 -%%% Local Variables: 
   69.44 -%%% mode: latex
   69.45 -%%% TeX-master: "implementation"
   69.46 -%%% End: 
    70.1 --- a/doc-src/IsarAdvanced/Codegen/IsaMakefile	Mon Mar 02 16:58:39 2009 +0100
    70.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    70.3 @@ -1,33 +0,0 @@
    70.4 -
    70.5 -## targets
    70.6 -
    70.7 -default: Thy
    70.8 -images: 
    70.9 -test: Thy
   70.10 -
   70.11 -all: images test
   70.12 -
   70.13 -
   70.14 -## global settings
   70.15 -
   70.16 -SRC = $(ISABELLE_HOME)/src
   70.17 -OUT = $(ISABELLE_OUTPUT)
   70.18 -LOG = $(OUT)/log
   70.19 -
   70.20 -USEDIR = $(ISABELLE_TOOL) usedir -v true -i false -d false -C false -D document
   70.21 -
   70.22 -
   70.23 -## Thy
   70.24 -
   70.25 -THY = $(LOG)/HOL-Thy.gz
   70.26 -
   70.27 -Thy: $(THY)
   70.28 -
   70.29 -$(THY): Thy/ROOT.ML Thy/*.thy ../../antiquote_setup.ML
   70.30 -	@$(USEDIR) HOL Thy
   70.31 -
   70.32 -
   70.33 -## clean
   70.34 -
   70.35 -clean:
   70.36 -	@rm -f $(THY)
    71.1 --- a/doc-src/IsarAdvanced/Codegen/Makefile	Mon Mar 02 16:58:39 2009 +0100
    71.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    71.3 @@ -1,38 +0,0 @@
    71.4 -#
    71.5 -# $Id$
    71.6 -#
    71.7 -
    71.8 -## targets
    71.9 -
   71.10 -default: dvi
   71.11 -
   71.12 -
   71.13 -## dependencies
   71.14 -
   71.15 -include ../Makefile.in
   71.16 -
   71.17 -NAME = codegen
   71.18 -
   71.19 -FILES = $(NAME).tex Thy/document/*.tex \
   71.20 -  style.sty ../../iman.sty ../../extra.sty ../../isar.sty \
   71.21 -  ../../isabelle.sty ../../isabellesym.sty ../../pdfsetup.sty \
   71.22 -  ../../manual.bib ../../proof.sty
   71.23 -
   71.24 -dvi: $(NAME).dvi
   71.25 -
   71.26 -$(NAME).dvi: $(FILES) isabelle_isar.eps codegen_process.ps
   71.27 -	$(LATEX) $(NAME)
   71.28 -	$(BIBTEX) $(NAME)
   71.29 -	$(LATEX) $(NAME)
   71.30 -	$(LATEX) $(NAME)
   71.31 -
   71.32 -pdf: $(NAME).pdf
   71.33 -
   71.34 -$(NAME).pdf: $(FILES) isabelle_isar.pdf codegen_process.pdf
   71.35 -	$(PDFLATEX) $(NAME)
   71.36 -	$(BIBTEX) $(NAME)
   71.37 -	$(PDFLATEX) $(NAME)
   71.38 -	$(PDFLATEX) $(NAME)
   71.39 -	$(FIXBOOKMARKS) $(NAME).out
   71.40 -	$(PDFLATEX) $(NAME)
   71.41 -	$(PDFLATEX) $(NAME)
    72.1 --- a/doc-src/IsarAdvanced/Codegen/Thy/Adaption.thy	Mon Mar 02 16:58:39 2009 +0100
    72.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    72.3 @@ -1,361 +0,0 @@
    72.4 -theory Adaption
    72.5 -imports Setup
    72.6 -begin
    72.7 -
    72.8 -setup %invisible {* Code_Target.extend_target ("\<SML>", ("SML", K I)) *}
    72.9 -
   72.10 -section {* Adaption to target languages \label{sec:adaption} *}
   72.11 -
   72.12 -subsection {* Adapting code generation *}
   72.13 -
   72.14 -text {*
   72.15 -  The aspects of code generation introduced so far have two aspects
   72.16 -  in common:
   72.17 -
   72.18 -  \begin{itemize}
   72.19 -    \item They act uniformly, without reference to a specific
   72.20 -       target language.
   72.21 -    \item They are \emph{safe} in the sense that as long as you trust
   72.22 -       the code generator meta theory and implementation, you cannot
   72.23 -       produce programs that yield results which are not derivable
   72.24 -       in the logic.
   72.25 -  \end{itemize}
   72.26 -
   72.27 -  \noindent In this section we will introduce means to \emph{adapt} the serialiser
   72.28 -  to a specific target language, i.e.~to print program fragments
   72.29 -  in a way which accommodates \qt{already existing} ingredients of
   72.30 -  a target language environment, for three reasons:
   72.31 -
   72.32 -  \begin{itemize}
   72.33 -    \item improving readability and aesthetics of generated code
   72.34 -    \item gaining efficiency
   72.35 -    \item interface with language parts which have no direct counterpart
   72.36 -      in @{text "HOL"} (say, imperative data structures)
   72.37 -  \end{itemize}
   72.38 -
   72.39 -  \noindent Generally, you should avoid using those features yourself
   72.40 -  \emph{at any cost}:
   72.41 -
   72.42 -  \begin{itemize}
   72.43 -    \item The safe configuration methods act uniformly on every target language,
   72.44 -      whereas for adaption you have to treat each target language separate.
   72.45 -    \item Application is extremely tedious since there is no abstraction
   72.46 -      which would allow for a static check, making it easy to produce garbage.
   72.47 -    \item More or less subtle errors can be introduced unconsciously.
   72.48 -  \end{itemize}
   72.49 -
   72.50 -  \noindent However, even if you ought refrain from setting up adaption
   72.51 -  yourself, already the @{text "HOL"} comes with some reasonable default
   72.52 -  adaptions (say, using target language list syntax).  There also some
   72.53 -  common adaption cases which you can setup by importing particular
   72.54 -  library theories.  In order to understand these, we provide some clues here;
   72.55 -  these however are not supposed to replace a careful study of the sources.
   72.56 -*}
   72.57 -
   72.58 -subsection {* The adaption principle *}
   72.59 -
   72.60 -text {*
   72.61 -  The following figure illustrates what \qt{adaption} is conceptually
   72.62 -  supposed to be:
   72.63 -
   72.64 -  \begin{figure}[here]
   72.65 -    \begin{tikzpicture}[scale = 0.5]
   72.66 -      \tikzstyle water=[color = blue, thick]
   72.67 -      \tikzstyle ice=[color = black, very thick, cap = round, join = round, fill = white]
   72.68 -      \tikzstyle process=[color = green, semithick, ->]
   72.69 -      \tikzstyle adaption=[color = red, semithick, ->]
   72.70 -      \tikzstyle target=[color = black]
   72.71 -      \foreach \x in {0, ..., 24}
   72.72 -        \draw[style=water] (\x, 0.25) sin + (0.25, 0.25) cos + (0.25, -0.25) sin
   72.73 -          + (0.25, -0.25) cos + (0.25, 0.25);
   72.74 -      \draw[style=ice] (1, 0) --
   72.75 -        (3, 6) node[above, fill=white] {logic} -- (5, 0) -- cycle;
   72.76 -      \draw[style=ice] (9, 0) --
   72.77 -        (11, 6) node[above, fill=white] {intermediate language} -- (13, 0) -- cycle;
   72.78 -      \draw[style=ice] (15, -6) --
   72.79 -        (19, 6) node[above, fill=white] {target language} -- (23, -6) -- cycle;
   72.80 -      \draw[style=process]
   72.81 -        (3.5, 3) .. controls (7, 5) .. node[fill=white] {translation} (10.5, 3);
   72.82 -      \draw[style=process]
   72.83 -        (11.5, 3) .. controls (15, 5) .. node[fill=white] (serialisation) {serialisation} (18.5, 3);
   72.84 -      \node (adaption) at (11, -2) [style=adaption] {adaption};
   72.85 -      \node at (19, 3) [rotate=90] {generated};
   72.86 -      \node at (19.5, -5) {language};
   72.87 -      \node at (19.5, -3) {library};
   72.88 -      \node (includes) at (19.5, -1) {includes};
   72.89 -      \node (reserved) at (16.5, -3) [rotate=72] {reserved}; % proper 71.57
   72.90 -      \draw[style=process]
   72.91 -        (includes) -- (serialisation);
   72.92 -      \draw[style=process]
   72.93 -        (reserved) -- (serialisation);
   72.94 -      \draw[style=adaption]
   72.95 -        (adaption) -- (serialisation);
   72.96 -      \draw[style=adaption]
   72.97 -        (adaption) -- (includes);
   72.98 -      \draw[style=adaption]
   72.99 -        (adaption) -- (reserved);
  72.100 -    \end{tikzpicture}
  72.101 -    \caption{The adaption principle}
  72.102 -    \label{fig:adaption}
  72.103 -  \end{figure}
  72.104 -
  72.105 -  \noindent In the tame view, code generation acts as broker between
  72.106 -  @{text logic}, @{text "intermediate language"} and
  72.107 -  @{text "target language"} by means of @{text translation} and
  72.108 -  @{text serialisation};  for the latter, the serialiser has to observe
  72.109 -  the structure of the @{text language} itself plus some @{text reserved}
  72.110 -  keywords which have to be avoided for generated code.
  72.111 -  However, if you consider @{text adaption} mechanisms, the code generated
  72.112 -  by the serializer is just the tip of the iceberg:
  72.113 -
  72.114 -  \begin{itemize}
  72.115 -    \item @{text serialisation} can be \emph{parametrised} such that
  72.116 -      logical entities are mapped to target-specific ones
  72.117 -      (e.g. target-specific list syntax,
  72.118 -        see also \secref{sec:adaption_mechanisms})
  72.119 -    \item Such parametrisations can involve references to a
  72.120 -      target-specific standard @{text library} (e.g. using
  72.121 -      the @{text Haskell} @{verbatim Maybe} type instead
  72.122 -      of the @{text HOL} @{type "option"} type);
  72.123 -      if such are used, the corresponding identifiers
  72.124 -      (in our example, @{verbatim Maybe}, @{verbatim Nothing}
  72.125 -      and @{verbatim Just}) also have to be considered @{text reserved}.
  72.126 -    \item Even more, the user can enrich the library of the
  72.127 -      target-language by providing code snippets
  72.128 -      (\qt{@{text "includes"}}) which are prepended to
  72.129 -      any generated code (see \secref{sec:include});  this typically
  72.130 -      also involves further @{text reserved} identifiers.
  72.131 -  \end{itemize}
  72.132 -
  72.133 -  \noindent As figure \ref{fig:adaption} illustrates, all these adaption mechanisms
  72.134 -  have to act consistently;  it is at the discretion of the user
  72.135 -  to take care for this.
  72.136 -*}
  72.137 -
  72.138 -subsection {* Common adaption patterns *}
  72.139 -
  72.140 -text {*
  72.141 -  The @{theory HOL} @{theory Main} theory already provides a code
  72.142 -  generator setup
  72.143 -  which should be suitable for most applications.  Common extensions
  72.144 -  and modifications are available by certain theories of the @{text HOL}
  72.145 -  library; beside being useful in applications, they may serve
  72.146 -  as a tutorial for customising the code generator setup (see below
  72.147 -  \secref{sec:adaption_mechanisms}).
  72.148 -
  72.149 -  \begin{description}
  72.150 -
  72.151 -    \item[@{theory "Code_Integer"}] represents @{text HOL} integers by big
  72.152 -       integer literals in target languages.
  72.153 -    \item[@{theory "Code_Char"}] represents @{text HOL} characters by 
  72.154 -       character literals in target languages.
  72.155 -    \item[@{theory "Code_Char_chr"}] like @{text "Code_Char"},
  72.156 -       but also offers treatment of character codes; includes
  72.157 -       @{theory "Code_Char"}.
  72.158 -    \item[@{theory "Efficient_Nat"}] \label{eff_nat} implements natural numbers by integers,
  72.159 -       which in general will result in higher efficiency; pattern
  72.160 -       matching with @{term "0\<Colon>nat"} / @{const "Suc"}
  72.161 -       is eliminated;  includes @{theory "Code_Integer"}
  72.162 -       and @{theory "Code_Index"}.
  72.163 -    \item[@{theory "Code_Index"}] provides an additional datatype
  72.164 -       @{typ index} which is mapped to target-language built-in integers.
  72.165 -       Useful for code setups which involve e.g. indexing of
  72.166 -       target-language arrays.
  72.167 -    \item[@{theory "Code_Message"}] provides an additional datatype
  72.168 -       @{typ message_string} which is isomorphic to strings;
  72.169 -       @{typ message_string}s are mapped to target-language strings.
  72.170 -       Useful for code setups which involve e.g. printing (error) messages.
  72.171 -
  72.172 -  \end{description}
  72.173 -
  72.174 -  \begin{warn}
  72.175 -    When importing any of these theories, they should form the last
  72.176 -    items in an import list.  Since these theories adapt the
  72.177 -    code generator setup in a non-conservative fashion,
  72.178 -    strange effects may occur otherwise.
  72.179 -  \end{warn}
  72.180 -*}
  72.181 -
  72.182 -
  72.183 -subsection {* Parametrising serialisation \label{sec:adaption_mechanisms} *}
  72.184 -
  72.185 -text {*
  72.186 -  Consider the following function and its corresponding
  72.187 -  SML code:
  72.188 -*}
  72.189 -
  72.190 -primrec %quote in_interval :: "nat \<times> nat \<Rightarrow> nat \<Rightarrow> bool" where
  72.191 -  "in_interval (k, l) n \<longleftrightarrow> k \<le> n \<and> n \<le> l"
  72.192 -(*<*)
  72.193 -code_type %invisible bool
  72.194 -  (SML)
  72.195 -code_const %invisible True and False and "op \<and>" and Not
  72.196 -  (SML and and and)
  72.197 -(*>*)
  72.198 -text %quote {*@{code_stmts in_interval (SML)}*}
  72.199 -
  72.200 -text {*
  72.201 -  \noindent Though this is correct code, it is a little bit unsatisfactory:
  72.202 -  boolean values and operators are materialised as distinguished
  72.203 -  entities with have nothing to do with the SML-built-in notion
  72.204 -  of \qt{bool}.  This results in less readable code;
  72.205 -  additionally, eager evaluation may cause programs to
  72.206 -  loop or break which would perfectly terminate when
  72.207 -  the existing SML @{verbatim "bool"} would be used.  To map
  72.208 -  the HOL @{typ bool} on SML @{verbatim "bool"}, we may use
  72.209 -  \qn{custom serialisations}:
  72.210 -*}
  72.211 -
  72.212 -code_type %quotett bool
  72.213 -  (SML "bool")
  72.214 -code_const %quotett True and False and "op \<and>"
  72.215 -  (SML "true" and "false" and "_ andalso _")
  72.216 -
  72.217 -text {*
  72.218 -  \noindent The @{command code_type} command takes a type constructor
  72.219 -  as arguments together with a list of custom serialisations.
  72.220 -  Each custom serialisation starts with a target language
  72.221 -  identifier followed by an expression, which during
  72.222 -  code serialisation is inserted whenever the type constructor
  72.223 -  would occur.  For constants, @{command code_const} implements
  72.224 -  the corresponding mechanism.  Each ``@{verbatim "_"}'' in
  72.225 -  a serialisation expression is treated as a placeholder
  72.226 -  for the type constructor's (the constant's) arguments.
  72.227 -*}
  72.228 -
  72.229 -text %quote {*@{code_stmts in_interval (SML)}*}
  72.230 -
  72.231 -text {*
  72.232 -  \noindent This still is not perfect: the parentheses
  72.233 -  around the \qt{andalso} expression are superfluous.
  72.234 -  Though the serialiser
  72.235 -  by no means attempts to imitate the rich Isabelle syntax
  72.236 -  framework, it provides some common idioms, notably
  72.237 -  associative infixes with precedences which may be used here:
  72.238 -*}
  72.239 -
  72.240 -code_const %quotett "op \<and>"
  72.241 -  (SML infixl 1 "andalso")
  72.242 -
  72.243 -text %quote {*@{code_stmts in_interval (SML)}*}
  72.244 -
  72.245 -text {*
  72.246 -  \noindent The attentive reader may ask how we assert that no generated
  72.247 -  code will accidentally overwrite.  For this reason the serialiser has
  72.248 -  an internal table of identifiers which have to be avoided to be used
  72.249 -  for new declarations.  Initially, this table typically contains the
  72.250 -  keywords of the target language.  It can be extended manually, thus avoiding
  72.251 -  accidental overwrites, using the @{command "code_reserved"} command:
  72.252 -*}
  72.253 -
  72.254 -code_reserved %quote "\<SML>" bool true false andalso
  72.255 -
  72.256 -text {*
  72.257 -  \noindent Next, we try to map HOL pairs to SML pairs, using the
  72.258 -  infix ``@{verbatim "*"}'' type constructor and parentheses:
  72.259 -*}
  72.260 -(*<*)
  72.261 -code_type %invisible *
  72.262 -  (SML)
  72.263 -code_const %invisible Pair
  72.264 -  (SML)
  72.265 -(*>*)
  72.266 -code_type %quotett *
  72.267 -  (SML infix 2 "*")
  72.268 -code_const %quotett Pair
  72.269 -  (SML "!((_),/ (_))")
  72.270 -
  72.271 -text {*
  72.272 -  \noindent The initial bang ``@{verbatim "!"}'' tells the serialiser
  72.273 -  never to put
  72.274 -  parentheses around the whole expression (they are already present),
  72.275 -  while the parentheses around argument place holders
  72.276 -  tell not to put parentheses around the arguments.
  72.277 -  The slash ``@{verbatim "/"}'' (followed by arbitrary white space)
  72.278 -  inserts a space which may be used as a break if necessary
  72.279 -  during pretty printing.
  72.280 -
  72.281 -  These examples give a glimpse what mechanisms
  72.282 -  custom serialisations provide; however their usage
  72.283 -  requires careful thinking in order not to introduce
  72.284 -  inconsistencies -- or, in other words:
  72.285 -  custom serialisations are completely axiomatic.
  72.286 -
  72.287 -  A further noteworthy details is that any special
  72.288 -  character in a custom serialisation may be quoted
  72.289 -  using ``@{verbatim "'"}''; thus, in
  72.290 -  ``@{verbatim "fn '_ => _"}'' the first
  72.291 -  ``@{verbatim "_"}'' is a proper underscore while the
  72.292 -  second ``@{verbatim "_"}'' is a placeholder.
  72.293 -*}
  72.294 -
  72.295 -
  72.296 -subsection {* @{text Haskell} serialisation *}
  72.297 -
  72.298 -text {*
  72.299 -  For convenience, the default
  72.300 -  @{text HOL} setup for @{text Haskell} maps the @{class eq} class to
  72.301 -  its counterpart in @{text Haskell}, giving custom serialisations
  72.302 -  for the class @{class eq} (by command @{command code_class}) and its operation
  72.303 -  @{const HOL.eq}
  72.304 -*}
  72.305 -
  72.306 -code_class %quotett eq
  72.307 -  (Haskell "Eq")
  72.308 -
  72.309 -code_const %quotett "op ="
  72.310 -  (Haskell infixl 4 "==")
  72.311 -
  72.312 -text {*
  72.313 -  \noindent A problem now occurs whenever a type which
  72.314 -  is an instance of @{class eq} in @{text HOL} is mapped
  72.315 -  on a @{text Haskell}-built-in type which is also an instance
  72.316 -  of @{text Haskell} @{text Eq}:
  72.317 -*}
  72.318 -
  72.319 -typedecl %quote bar
  72.320 -
  72.321 -instantiation %quote bar :: eq
  72.322 -begin
  72.323 -
  72.324 -definition %quote "eq_class.eq (x\<Colon>bar) y \<longleftrightarrow> x = y"
  72.325 -
  72.326 -instance %quote by default (simp add: eq_bar_def)
  72.327 -
  72.328 -end %quote
  72.329 -
  72.330 -code_type %quotett bar
  72.331 -  (Haskell "Integer")
  72.332 -
  72.333 -text {*
  72.334 -  \noindent The code generator would produce
  72.335 -  an additional instance, which of course is rejected by the @{text Haskell}
  72.336 -  compiler.
  72.337 -  To suppress this additional instance, use
  72.338 -  @{text "code_instance"}:
  72.339 -*}
  72.340 -
  72.341 -code_instance %quotett bar :: eq
  72.342 -  (Haskell -)
  72.343 -
  72.344 -
  72.345 -subsection {* Enhancing the target language context \label{sec:include} *}
  72.346 -
  72.347 -text {*
  72.348 -  In rare cases it is necessary to \emph{enrich} the context of a
  72.349 -  target language;  this is accomplished using the @{command "code_include"}
  72.350 -  command:
  72.351 -*}
  72.352 -
  72.353 -code_include %quotett Haskell "Errno"
  72.354 -{*errno i = error ("Error number: " ++ show i)*}
  72.355 -
  72.356 -code_reserved %quotett Haskell Errno
  72.357 -
  72.358 -text {*
  72.359 -  \noindent Such named @{text include}s are then prepended to every generated code.
  72.360 -  Inspect such code in order to find out how @{command "code_include"} behaves
  72.361 -  with respect to a particular target language.
  72.362 -*}
  72.363 -
  72.364 -end
    73.1 --- a/doc-src/IsarAdvanced/Codegen/Thy/Codegen.thy	Mon Mar 02 16:58:39 2009 +0100
    73.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    73.3 @@ -1,2 +0,0 @@
    73.4 -
    73.5 -end
    74.1 --- a/doc-src/IsarAdvanced/Codegen/Thy/Further.thy	Mon Mar 02 16:58:39 2009 +0100
    74.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    74.3 @@ -1,113 +0,0 @@
    74.4 -theory Further
    74.5 -imports Setup
    74.6 -begin
    74.7 -
    74.8 -section {* Further issues \label{sec:further} *}
    74.9 -
   74.10 -subsection {* Further reading *}
   74.11 -
   74.12 -text {*
   74.13 -  Do dive deeper into the issue of code generation, you should visit
   74.14 -  the Isabelle/Isar Reference Manual \cite{isabelle-isar-ref} which
   74.15 -  contains exhaustive syntax diagrams.
   74.16 -*}
   74.17 -
   74.18 -subsection {* Modules *}
   74.19 -
   74.20 -text {*
   74.21 -  When invoking the @{command export_code} command it is possible to leave
   74.22 -  out the @{keyword "module_name"} part;  then code is distributed over
   74.23 -  different modules, where the module name space roughly is induced
   74.24 -  by the @{text Isabelle} theory name space.
   74.25 -
   74.26 -  Then sometimes the awkward situation occurs that dependencies between
   74.27 -  definitions introduce cyclic dependencies between modules, which in the
   74.28 -  @{text Haskell} world leaves you to the mercy of the @{text Haskell} implementation
   74.29 -  you are using,  while for @{text SML}/@{text OCaml} code generation is not possible.
   74.30 -
   74.31 -  A solution is to declare module names explicitly.
   74.32 -  Let use assume the three cyclically dependent
   74.33 -  modules are named \emph{A}, \emph{B} and \emph{C}.
   74.34 -  Then, by stating
   74.35 -*}
   74.36 -
   74.37 -code_modulename %quote SML
   74.38 -  A ABC
   74.39 -  B ABC
   74.40 -  C ABC
   74.41 -
   74.42 -text {*
   74.43 -  we explicitly map all those modules on \emph{ABC},
   74.44 -  resulting in an ad-hoc merge of this three modules
   74.45 -  at serialisation time.
   74.46 -*}
   74.47 -
   74.48 -subsection {* Evaluation oracle *}
   74.49 -
   74.50 -text {*
   74.51 -  Code generation may also be used to \emph{evaluate} expressions
   74.52 -  (using @{text SML} as target language of course).
   74.53 -  For instance, the @{command value} allows to reduce an expression to a
   74.54 -  normal form with respect to the underlying code equations:
   74.55 -*}
   74.56 -
   74.57 -value %quote "42 / (12 :: rat)"
   74.58 -
   74.59 -text {*
   74.60 -  \noindent will display @{term "7 / (2 :: rat)"}.
   74.61 -
   74.62 -  The @{method eval} method tries to reduce a goal by code generation to @{term True}
   74.63 -  and solves it in that case, but fails otherwise:
   74.64 -*}
   74.65 -
   74.66 -lemma %quote "42 / (12 :: rat) = 7 / 2"
   74.67 -  by %quote eval
   74.68 -
   74.69 -text {*
   74.70 -  \noindent The soundness of the @{method eval} method depends crucially 
   74.71 -  on the correctness of the code generator;  this is one of the reasons
   74.72 -  why you should not use adaption (see \secref{sec:adaption}) frivolously.
   74.73 -*}
   74.74 -
   74.75 -subsection {* Code antiquotation *}
   74.76 -
   74.77 -text {*
   74.78 -  In scenarios involving techniques like reflection it is quite common
   74.79 -  that code generated from a theory forms the basis for implementing
   74.80 -  a proof procedure in @{text SML}.  To facilitate interfacing of generated code
   74.81 -  with system code, the code generator provides a @{text code} antiquotation:
   74.82 -*}
   74.83 -
   74.84 -datatype %quote form = T | F | And form form | Or form form
   74.85 -
   74.86 -ML %quote {*
   74.87 -  fun eval_form @{code T} = true
   74.88 -    | eval_form @{code F} = false
   74.89 -    | eval_form (@{code And} (p, q)) =
   74.90 -        eval_form p andalso eval_form q
   74.91 -    | eval_form (@{code Or} (p, q)) =
   74.92 -        eval_form p orelse eval_form q;
   74.93 -*}
   74.94 -
   74.95 -text {*
   74.96 -  \noindent @{text code} takes as argument the name of a constant;  after the
   74.97 -  whole @{text SML} is read, the necessary code is generated transparently
   74.98 -  and the corresponding constant names are inserted.  This technique also
   74.99 -  allows to use pattern matching on constructors stemming from compiled
  74.100 -  @{text datatypes}.
  74.101 -
  74.102 -  For a less simplistic example, theory @{theory Ferrack} is
  74.103 -  a good reference.
  74.104 -*}
  74.105 -
  74.106 -subsection {* Imperative data structures *}
  74.107 -
  74.108 -text {*
  74.109 -  If you consider imperative data structures as inevitable for a specific
  74.110 -  application, you should consider
  74.111 -  \emph{Imperative Functional Programming with Isabelle/HOL}
  74.112 -  (\cite{bulwahn-et-al:2008:imperative});
  74.113 -  the framework described there is available in theory @{theory Imperative_HOL}.
  74.114 -*}
  74.115 -
  74.116 -end
    75.1 --- a/doc-src/IsarAdvanced/Codegen/Thy/Introduction.thy	Mon Mar 02 16:58:39 2009 +0100
    75.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    75.3 @@ -1,206 +0,0 @@
    75.4 -theory Introduction
    75.5 -imports Setup
    75.6 -begin
    75.7 -
    75.8 -chapter {* Code generation from @{text "Isabelle/HOL"} theories *}
    75.9 -
   75.10 -section {* Introduction and Overview *}
   75.11 -
   75.12 -text {*
   75.13 -  This tutorial introduces a generic code generator for the
   75.14 -  @{text Isabelle} system.
   75.15 -  Generic in the sense that the
   75.16 -  \qn{target language} for which code shall ultimately be
   75.17 -  generated is not fixed but may be an arbitrary state-of-the-art
   75.18 -  functional programming language (currently, the implementation
   75.19 -  supports @{text SML} \cite{SML}, @{text OCaml} \cite{OCaml} and @{text Haskell}
   75.20 -  \cite{haskell-revised-report}).
   75.21 -
   75.22 -  Conceptually the code generator framework is part
   75.23 -  of Isabelle's @{theory Pure} meta logic framework; the logic
   75.24 -  @{theory HOL} which is an extension of @{theory Pure}
   75.25 -  already comes with a reasonable framework setup and thus provides
   75.26 -  a good working horse for raising code-generation-driven
   75.27 -  applications.  So, we assume some familiarity and experience
   75.28 -  with the ingredients of the @{theory HOL} distribution theories.
   75.29 -  (see also \cite{isa-tutorial}).
   75.30 -
   75.31 -  The code generator aims to be usable with no further ado
   75.32 -  in most cases while allowing for detailed customisation.
   75.33 -  This manifests in the structure of this tutorial: after a short
   75.34 -  conceptual introduction with an example (\secref{sec:intro}),
   75.35 -  we discuss the generic customisation facilities (\secref{sec:program}).
   75.36 -  A further section (\secref{sec:adaption}) is dedicated to the matter of
   75.37 -  \qn{adaption} to specific target language environments.  After some
   75.38 -  further issues (\secref{sec:further}) we conclude with an overview
   75.39 -  of some ML programming interfaces (\secref{sec:ml}).
   75.40 -
   75.41 -  \begin{warn}
   75.42 -    Ultimately, the code generator which this tutorial deals with
   75.43 -    is supposed to replace the existing code generator
   75.44 -    by Stefan Berghofer \cite{Berghofer-Nipkow:2002}.
   75.45 -    So, for the moment, there are two distinct code generators
   75.46 -    in Isabelle.  In case of ambiguity, we will refer to the framework
   75.47 -    described here as @{text "generic code generator"}, to the
   75.48 -    other as @{text "SML code generator"}.
   75.49 -    Also note that while the framework itself is
   75.50 -    object-logic independent, only @{theory HOL} provides a reasonable
   75.51 -    framework setup.    
   75.52 -  \end{warn}
   75.53 -
   75.54 -*}
   75.55 -
   75.56 -subsection {* Code generation via shallow embedding \label{sec:intro} *}
   75.57 -
   75.58 -text {*
   75.59 -  The key concept for understanding @{text Isabelle}'s code generation is
   75.60 -  \emph{shallow embedding}, i.e.~logical entities like constants, types and
   75.61 -  classes are identified with corresponding concepts in the target language.
   75.62 -
   75.63 -  Inside @{theory HOL}, the @{command datatype} and
   75.64 -  @{command definition}/@{command primrec}/@{command fun} declarations form
   75.65 -  the core of a functional programming language.  The default code generator setup
   75.66 -  allows to turn those into functional programs immediately.
   75.67 -  This means that \qt{naive} code generation can proceed without further ado.
   75.68 -  For example, here a simple \qt{implementation} of amortised queues:
   75.69 -*}
   75.70 -
   75.71 -datatype %quote 'a queue = AQueue "'a list" "'a list"
   75.72 -
   75.73 -definition %quote empty :: "'a queue" where
   75.74 -  "empty = AQueue [] []"
   75.75 -
   75.76 -primrec %quote enqueue :: "'a \<Rightarrow> 'a queue \<Rightarrow> 'a queue" where
   75.77 -  "enqueue x (AQueue xs ys) = AQueue (x # xs) ys"
   75.78 -
   75.79 -fun %quote dequeue :: "'a queue \<Rightarrow> 'a option \<times> 'a queue" where
   75.80 -    "dequeue (AQueue [] []) = (None, AQueue [] [])"
   75.81 -  | "dequeue (AQueue xs (y # ys)) = (Some y, AQueue xs ys)"
   75.82 -  | "dequeue (AQueue xs []) =
   75.83 -      (case rev xs of y # ys \<Rightarrow> (Some y, AQueue [] ys))"
   75.84 -
   75.85 -text {* \noindent Then we can generate code e.g.~for @{text SML} as follows: *}
   75.86 -
   75.87 -export_code %quote empty dequeue enqueue in SML
   75.88 -  module_name Example file "examples/example.ML"
   75.89 -
   75.90 -text {* \noindent resulting in the following code: *}
   75.91 -
   75.92 -text %quote {*@{code_stmts empty enqueue dequeue (SML)}*}
   75.93 -
   75.94 -text {*
   75.95 -  \noindent The @{command export_code} command takes a space-separated list of
   75.96 -  constants for which code shall be generated;  anything else needed for those
   75.97 -  is added implicitly.  Then follows a target language identifier
   75.98 -  (@{text SML}, @{text OCaml} or @{text Haskell}) and a freely chosen module name.
   75.99 -  A file name denotes the destination to store the generated code.  Note that
  75.100 -  the semantics of the destination depends on the target language:  for
  75.101 -  @{text SML} and @{text OCaml} it denotes a \emph{file}, for @{text Haskell}
  75.102 -  it denotes a \emph{directory} where a file named as the module name
  75.103 -  (with extension @{text ".hs"}) is written:
  75.104 -*}
  75.105 -
  75.106 -export_code %quote empty dequeue enqueue in Haskell
  75.107 -  module_name Example file "examples/"
  75.108 -
  75.109 -text {*
  75.110 -  \noindent This is how the corresponding code in @{text Haskell} looks like:
  75.111 -*}
  75.112 -
  75.113 -text %quote {*@{code_stmts empty enqueue dequeue (Haskell)}*}
  75.114 -
  75.115 -text {*
  75.116 -  \noindent This demonstrates the basic usage of the @{command export_code} command;
  75.117 -  for more details see \secref{sec:further}.
  75.118 -*}
  75.119 -
  75.120 -subsection {* Code generator architecture \label{sec:concept} *}
  75.121 -
  75.122 -text {*
  75.123 -  What you have seen so far should be already enough in a lot of cases.  If you
  75.124 -  are content with this, you can quit reading here.  Anyway, in order to customise
  75.125 -  and adapt the code generator, it is inevitable to gain some understanding
  75.126 -  how it works.
  75.127 -
  75.128 -  \begin{figure}[h]
  75.129 -    \begin{tikzpicture}[x = 4.2cm, y = 1cm]
  75.130 -      \tikzstyle entity=[rounded corners, draw, thick, color = black, fill = white];
  75.131 -      \tikzstyle process=[ellipse, draw, thick, color = green, fill = white];
  75.132 -      \tikzstyle process_arrow=[->, semithick, color = green];
  75.133 -      \node (HOL) at (0, 4) [style=entity] {@{text "Isabelle/HOL"} theory};
  75.134 -      \node (eqn) at (2, 2) [style=entity] {code equations};
  75.135 -      \node (iml) at (2, 0) [style=entity] {intermediate language};
  75.136 -      \node (seri) at (1, 0) [style=process] {serialisation};
  75.137 -      \node (SML) at (0, 3) [style=entity] {@{text SML}};
  75.138 -      \node (OCaml) at (0, 2) [style=entity] {@{text OCaml}};
  75.139 -      \node (further) at (0, 1) [style=entity] {@{text "\<dots>"}};
  75.140 -      \node (Haskell) at (0, 0) [style=entity] {@{text Haskell}};
  75.141 -      \draw [style=process_arrow] (HOL) .. controls (2, 4) ..
  75.142 -        node [style=process, near start] {selection}
  75.143 -        node [style=process, near end] {preprocessing}
  75.144 -        (eqn);
  75.145 -      \draw [style=process_arrow] (eqn) -- node (transl) [style=process] {translation} (iml);
  75.146 -      \draw [style=process_arrow] (iml) -- (seri);
  75.147 -      \draw [style=process_arrow] (seri) -- (SML);
  75.148 -      \draw [style=process_arrow] (seri) -- (OCaml);
  75.149 -      \draw [style=process_arrow, dashed] (seri) -- (further);
  75.150 -      \draw [style=process_arrow] (seri) -- (Haskell);
  75.151 -    \end{tikzpicture}
  75.152 -    \caption{Code generator architecture}
  75.153 -    \label{fig:arch}
  75.154 -  \end{figure}
  75.155 -
  75.156 -  The code generator employs a notion of executability
  75.157 -  for three foundational executable ingredients known
  75.158 -  from functional programming:
  75.159 -  \emph{code equations}, \emph{datatypes}, and
  75.160 -  \emph{type classes}.  A code equation as a first approximation
  75.161 -  is a theorem of the form @{text "f t\<^isub>1 t\<^isub>2 \<dots> t\<^isub>n \<equiv> t"}
  75.162 -  (an equation headed by a constant @{text f} with arguments
  75.163 -  @{text "t\<^isub>1 t\<^isub>2 \<dots> t\<^isub>n"} and right hand side @{text t}).
  75.164 -  Code generation aims to turn code equations
  75.165 -  into a functional program.  This is achieved by three major
  75.166 -  components which operate sequentially, i.e. the result of one is
  75.167 -  the input
  75.168 -  of the next in the chain,  see diagram \ref{fig:arch}:
  75.169 -
  75.170 -  \begin{itemize}
  75.171 -
  75.172 -    \item Out of the vast collection of theorems proven in a
  75.173 -      \qn{theory}, a reasonable subset modelling
  75.174 -      code equations is \qn{selected}.
  75.175 -
  75.176 -    \item On those selected theorems, certain
  75.177 -      transformations are carried out
  75.178 -      (\qn{preprocessing}).  Their purpose is to turn theorems
  75.179 -      representing non- or badly executable
  75.180 -      specifications into equivalent but executable counterparts.
  75.181 -      The result is a structured collection of \qn{code theorems}.
  75.182 -
  75.183 -    \item Before the selected code equations are continued with,
  75.184 -      they can be \qn{preprocessed}, i.e. subjected to theorem
  75.185 -      transformations.  This \qn{preprocessor} is an interface which
  75.186 -      allows to apply
  75.187 -      the full expressiveness of ML-based theorem transformations
  75.188 -      to code generation;  motivating examples are shown below, see
  75.189 -      \secref{sec:preproc}.
  75.190 -      The result of the preprocessing step is a structured collection
  75.191 -      of code equations.
  75.192 -
  75.193 -    \item These code equations are \qn{translated} to a program
  75.194 -      in an abstract intermediate language.  Think of it as a kind
  75.195 -      of \qt{Mini-Haskell} with four \qn{statements}: @{text data}
  75.196 -      (for datatypes), @{text fun} (stemming from code equations),
  75.197 -      also @{text class} and @{text inst} (for type classes).
  75.198 -
  75.199 -    \item Finally, the abstract program is \qn{serialised} into concrete
  75.200 -      source code of a target language.
  75.201 -
  75.202 -  \end{itemize}
  75.203 -
  75.204 -  \noindent From these steps, only the two last are carried out outside the logic;  by
  75.205 -  keeping this layer as thin as possible, the amount of code to trust is
  75.206 -  kept to a minimum.
  75.207 -*}
  75.208 -
  75.209 -end
    76.1 --- a/doc-src/IsarAdvanced/Codegen/Thy/ML.thy	Mon Mar 02 16:58:39 2009 +0100
    76.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    76.3 @@ -1,177 +0,0 @@
    76.4 -theory "ML"
    76.5 -imports Setup
    76.6 -begin
    76.7 -
    76.8 -section {* ML system interfaces \label{sec:ml} *}
    76.9 -
   76.10 -text {*
   76.11 -  Since the code generator framework not only aims to provide
   76.12 -  a nice Isar interface but also to form a base for
   76.13 -  code-generation-based applications, here a short
   76.14 -  description of the most important ML interfaces.
   76.15 -*}
   76.16 -
   76.17 -subsection {* Executable theory content: @{text Code} *}
   76.18 -
   76.19 -text {*
   76.20 -  This Pure module implements the core notions of
   76.21 -  executable content of a theory.
   76.22 -*}
   76.23 -
   76.24 -subsubsection {* Managing executable content *}
   76.25 -
   76.26 -text %mlref {*
   76.27 -  \begin{mldecls}
   76.28 -  @{index_ML Code.add_eqn: "thm -> theory -> theory"} \\
   76.29 -  @{index_ML Code.del_eqn: "thm -> theory -> theory"} \\
   76.30 -  @{index_ML Code.add_eqnl: "string * (thm * bool) list lazy -> theory -> theory"} \\
   76.31 -  @{index_ML Code.map_pre: "(simpset -> simpset) -> theory -> theory"} \\
   76.32 -  @{index_ML Code.map_post: "(simpset -> simpset) -> theory -> theory"} \\
   76.33 -  @{index_ML Code.add_functrans: "string * (theory -> (thm * bool) list -> (thm * bool) list option)
   76.34 -    -> theory -> theory"} \\
   76.35 -  @{index_ML Code.del_functrans: "string -> theory -> theory"} \\
   76.36 -  @{index_ML Code.add_datatype: "(string * typ) list -> theory -> theory"} \\
   76.37 -  @{index_ML Code.get_datatype: "theory -> string
   76.38 -    -> (string * sort) list * (string * typ list) list"} \\
   76.39 -  @{index_ML Code.get_datatype_of_constr: "theory -> string -> string option"}
   76.40 -  \end{mldecls}
   76.41 -
   76.42 -  \begin{description}
   76.43 -
   76.44 -  \item @{ML Code.add_eqn}~@{text "thm"}~@{text "thy"} adds function
   76.45 -     theorem @{text "thm"} to executable content.
   76.46 -
   76.47 -  \item @{ML Code.del_eqn}~@{text "thm"}~@{text "thy"} removes function
   76.48 -     theorem @{text "thm"} from executable content, if present.
   76.49 -
   76.50 -  \item @{ML Code.add_eqnl}~@{text "(const, lthms)"}~@{text "thy"} adds
   76.51 -     suspended code equations @{text lthms} for constant
   76.52 -     @{text const} to executable content.
   76.53 -
   76.54 -  \item @{ML Code.map_pre}~@{text "f"}~@{text "thy"} changes
   76.55 -     the preprocessor simpset.
   76.56 -
   76.57 -  \item @{ML Code.add_functrans}~@{text "(name, f)"}~@{text "thy"} adds
   76.58 -     function transformer @{text f} (named @{text name}) to executable content;
   76.59 -     @{text f} is a transformer of the code equations belonging
   76.60 -     to a certain function definition, depending on the
   76.61 -     current theory context.  Returning @{text NONE} indicates that no
   76.62 -     transformation took place;  otherwise, the whole process will be iterated
   76.63 -     with the new code equations.
   76.64 -
   76.65 -  \item @{ML Code.del_functrans}~@{text "name"}~@{text "thy"} removes
   76.66 -     function transformer named @{text name} from executable content.
   76.67 -
   76.68 -  \item @{ML Code.add_datatype}~@{text cs}~@{text thy} adds
   76.69 -     a datatype to executable content, with generation
   76.70 -     set @{text cs}.
   76.71 -
   76.72 -  \item @{ML Code.get_datatype_of_constr}~@{text "thy"}~@{text "const"}
   76.73 -     returns type constructor corresponding to
   76.74 -     constructor @{text const}; returns @{text NONE}
   76.75 -     if @{text const} is no constructor.
   76.76 -
   76.77 -  \end{description}
   76.78 -*}
   76.79 -
   76.80 -subsection {* Auxiliary *}
   76.81 -
   76.82 -text %mlref {*
   76.83 -  \begin{mldecls}
   76.84 -  @{index_ML Code_Unit.read_const: "theory -> string -> string"} \\
   76.85 -  @{index_ML Code_Unit.head_eqn: "theory -> thm -> string * ((string * sort) list * typ)"} \\
   76.86 -  @{index_ML Code_Unit.rewrite_eqn: "simpset -> thm -> thm"} \\
   76.87 -  \end{mldecls}
   76.88 -
   76.89 -  \begin{description}
   76.90 -
   76.91 -  \item @{ML Code_Unit.read_const}~@{text thy}~@{text s}
   76.92 -     reads a constant as a concrete term expression @{text s}.
   76.93 -
   76.94 -  \item @{ML Code_Unit.head_eqn}~@{text thy}~@{text thm}
   76.95 -     extracts the constant and its type from a code equation @{text thm}.
   76.96 -
   76.97 -  \item @{ML Code_Unit.rewrite_eqn}~@{text ss}~@{text thm}
   76.98 -     rewrites a code equation @{text thm} with a simpset @{text ss};
   76.99 -     only arguments and right hand side are rewritten,
  76.100 -     not the head of the code equation.
  76.101 -
  76.102 -  \end{description}
  76.103 -
  76.104 -*}
  76.105 -
  76.106 -subsection {* Implementing code generator applications *}
  76.107 -
  76.108 -text {*
  76.109 -  Implementing code generator applications on top
  76.110 -  of the framework set out so far usually not only
  76.111 -  involves using those primitive interfaces
  76.112 -  but also storing code-dependent data and various
  76.113 -  other things.
  76.114 -*}
  76.115 -
  76.116 -subsubsection {* Data depending on the theory's executable content *}
  76.117 -
  76.118 -text {*
  76.119 -  Due to incrementality of code generation, changes in the
  76.120 -  theory's executable content have to be propagated in a
  76.121 -  certain fashion.  Additionally, such changes may occur
  76.122 -  not only during theory extension but also during theory
  76.123 -  merge, which is a little bit nasty from an implementation
  76.124 -  point of view.  The framework provides a solution
  76.125 -  to this technical challenge by providing a functorial
  76.126 -  data slot @{ML_functor CodeDataFun}; on instantiation
  76.127 -  of this functor, the following types and operations
  76.128 -  are required:
  76.129 -
  76.130 -  \medskip
  76.131 -  \begin{tabular}{l}
  76.132 -  @{text "type T"} \\
  76.133 -  @{text "val empty: T"} \\
  76.134 -  @{text "val purge: theory \<rightarrow> string list option \<rightarrow> T \<rightarrow> T"}
  76.135 -  \end{tabular}
  76.136 -
  76.137 -  \begin{description}
  76.138 -
  76.139 -  \item @{text T} the type of data to store.
  76.140 -
  76.141 -  \item @{text empty} initial (empty) data.
  76.142 -
  76.143 -  \item @{text purge}~@{text thy}~@{text consts} propagates changes in executable content;
  76.144 -    @{text consts} indicates the kind
  76.145 -    of change: @{ML NONE} stands for a fundamental change
  76.146 -    which invalidates any existing code, @{text "SOME consts"}
  76.147 -    hints that executable content for constants @{text consts}
  76.148 -    has changed.
  76.149 -
  76.150 -  \end{description}
  76.151 -
  76.152 -  \noindent An instance of @{ML_functor CodeDataFun} provides the following
  76.153 -  interface:
  76.154 -
  76.155 -  \medskip
  76.156 -  \begin{tabular}{l}
  76.157 -  @{text "get: theory \<rightarrow> T"} \\
  76.158 -  @{text "change: theory \<rightarrow> (T \<rightarrow> T) \<rightarrow> T"} \\
  76.159 -  @{text "change_yield: theory \<rightarrow> (T \<rightarrow> 'a * T) \<rightarrow> 'a * T"}
  76.160 -  \end{tabular}
  76.161 -
  76.162 -  \begin{description}
  76.163 -
  76.164 -  \item @{text get} retrieval of the current data.
  76.165 -
  76.166 -  \item @{text change} update of current data (cached!)
  76.167 -    by giving a continuation.
  76.168 -
  76.169 -  \item @{text change_yield} update with side result.
  76.170 -
  76.171 -  \end{description}
  76.172 -*}
  76.173 -
  76.174 -text {*
  76.175 -  \bigskip
  76.176 -
  76.177 -  \emph{Happy proving, happy hacking!}
  76.178 -*}
  76.179 -
  76.180 -end
    77.1 --- a/doc-src/IsarAdvanced/Codegen/Thy/Program.thy	Mon Mar 02 16:58:39 2009 +0100
    77.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    77.3 @@ -1,534 +0,0 @@
    77.4 -theory Program
    77.5 -imports Introduction
    77.6 -begin
    77.7 -
    77.8 -section {* Turning Theories into Programs \label{sec:program} *}
    77.9 -
   77.10 -subsection {* The @{text "Isabelle/HOL"} default setup *}
   77.11 -
   77.12 -text {*
   77.13 -  We have already seen how by default equations stemming from
   77.14 -  @{command definition}/@{command primrec}/@{command fun}
   77.15 -  statements are used for code generation.  This default behaviour
   77.16 -  can be changed, e.g. by providing different code equations.
   77.17 -  All kinds of customisation shown in this section is \emph{safe}
   77.18 -  in the sense that the user does not have to worry about
   77.19 -  correctness -- all programs generatable that way are partially
   77.20 -  correct.
   77.21 -*}
   77.22 -
   77.23 -subsection {* Selecting code equations *}
   77.24 -
   77.25 -text {*
   77.26 -  Coming back to our introductory example, we
   77.27 -  could provide an alternative code equations for @{const dequeue}
   77.28 -  explicitly:
   77.29 -*}
   77.30 -
   77.31 -lemma %quote [code]:
   77.32 -  "dequeue (AQueue xs []) =
   77.33 -     (if xs = [] then (None, AQueue [] [])
   77.34 -       else dequeue (AQueue [] (rev xs)))"
   77.35 -  "dequeue (AQueue xs (y # ys)) =
   77.36 -     (Some y, AQueue xs ys)"
   77.37 -  by (cases xs, simp_all) (cases "rev xs", simp_all)
   77.38 -
   77.39 -text {*
   77.40 -  \noindent The annotation @{text "[code]"} is an @{text Isar}
   77.41 -  @{text attribute} which states that the given theorems should be
   77.42 -  considered as code equations for a @{text fun} statement --
   77.43 -  the corresponding constant is determined syntactically.  The resulting code:
   77.44 -*}
   77.45 -
   77.46 -text %quote {*@{code_stmts dequeue (consts) dequeue (Haskell)}*}
   77.47 -
   77.48 -text {*
   77.49 -  \noindent You may note that the equality test @{term "xs = []"} has been
   77.50 -  replaced by the predicate @{term "null xs"}.  This is due to the default
   77.51 -  setup in the \qn{preprocessor} to be discussed further below (\secref{sec:preproc}).
   77.52 -
   77.53 -  Changing the default constructor set of datatypes is also
   77.54 -  possible.  See \secref{sec:datatypes} for an example.
   77.55 -
   77.56 -  As told in \secref{sec:concept}, code generation is based
   77.57 -  on a structured collection of code theorems.
   77.58 -  For explorative purpose, this collection
   77.59 -  may be inspected using the @{command code_thms} command:
   77.60 -*}
   77.61 -
   77.62 -code_thms %quote dequeue
   77.63 -
   77.64 -text {*
   77.65 -  \noindent prints a table with \emph{all} code equations
   77.66 -  for @{const dequeue}, including
   77.67 -  \emph{all} code equations those equations depend
   77.68 -  on recursively.
   77.69 -  
   77.70 -  Similarly, the @{command code_deps} command shows a graph
   77.71 -  visualising dependencies between code equations.
   77.72 -*}
   77.73 -
   77.74 -subsection {* @{text class} and @{text instantiation} *}
   77.75 -
   77.76 -text {*
   77.77 -  Concerning type classes and code generation, let us examine an example
   77.78 -  from abstract algebra:
   77.79 -*}
   77.80 -
   77.81 -class %quote semigroup =
   77.82 -  fixes mult :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixl "\<otimes>" 70)
   77.83 -  assumes assoc: "(x \<otimes> y) \<otimes> z = x \<otimes> (y \<otimes> z)"
   77.84 -
   77.85 -class %quote monoid = semigroup +
   77.86 -  fixes neutral :: 'a ("\<one>")
   77.87 -  assumes neutl: "\<one> \<otimes> x = x"
   77.88 -    and neutr: "x \<otimes> \<one> = x"
   77.89 -
   77.90 -instantiation %quote nat :: monoid
   77.91 -begin
   77.92 -
   77.93 -primrec %quote mult_nat where
   77.94 -    "0 \<otimes> n = (0\<Colon>nat)"
   77.95 -  | "Suc m \<otimes> n = n + m \<otimes> n"
   77.96 -
   77.97 -definition %quote neutral_nat where
   77.98 -  "\<one> = Suc 0"
   77.99 -
  77.100 -lemma %quote add_mult_distrib:
  77.101 -  fixes n m q :: nat
  77.102 -  shows "(n + m) \<otimes> q = n \<otimes> q + m \<otimes> q"
  77.103 -  by (induct n) simp_all
  77.104 -
  77.105 -instance %quote proof
  77.106 -  fix m n q :: nat
  77.107 -  show "m \<otimes> n \<otimes> q = m \<otimes> (n \<otimes> q)"
  77.108 -    by (induct m) (simp_all add: add_mult_distrib)
  77.109 -  show "\<one> \<otimes> n = n"
  77.110 -    by (simp add: neutral_nat_def)
  77.111 -  show "m \<otimes> \<one> = m"
  77.112 -    by (induct m) (simp_all add: neutral_nat_def)
  77.113 -qed
  77.114 -
  77.115 -end %quote
  77.116 -
  77.117 -text {*
  77.118 -  \noindent We define the natural operation of the natural numbers
  77.119 -  on monoids:
  77.120 -*}
  77.121 -
  77.122 -primrec %quote (in monoid) pow :: "nat \<Rightarrow> 'a \<Rightarrow> 'a" where
  77.123 -    "pow 0 a = \<one>"
  77.124 -  | "pow (Suc n) a = a \<otimes> pow n a"
  77.125 -
  77.126 -text {*
  77.127 -  \noindent This we use to define the discrete exponentiation function:
  77.128 -*}
  77.129 -
  77.130 -definition %quote bexp :: "nat \<Rightarrow> nat" where
  77.131 -  "bexp n = pow n (Suc (Suc 0))"
  77.132 -
  77.133 -text {*
  77.134 -  \noindent The corresponding code:
  77.135 -*}
  77.136 -
  77.137 -text %quote {*@{code_stmts bexp (Haskell)}*}
  77.138 -
  77.139 -text {*
  77.140 -  \noindent This is a convenient place to show how explicit dictionary construction
  77.141 -  manifests in generated code (here, the same example in @{text SML}):
  77.142 -*}
  77.143 -
  77.144 -text %quote {*@{code_stmts bexp (SML)}*}
  77.145 -
  77.146 -text {*
  77.147 -  \noindent Note the parameters with trailing underscore (@{verbatim "A_"})
  77.148 -    which are the dictionary parameters.
  77.149 -*}
  77.150 -
  77.151 -subsection {* The preprocessor \label{sec:preproc} *}
  77.152 -
  77.153 -text {*
  77.154 -  Before selected function theorems are turned into abstract
  77.155 -  code, a chain of definitional transformation steps is carried
  77.156 -  out: \emph{preprocessing}.  In essence, the preprocessor
  77.157 -  consists of two components: a \emph{simpset} and \emph{function transformers}.
  77.158 -
  77.159 -  The \emph{simpset} allows to employ the full generality of the Isabelle
  77.160 -  simplifier.  Due to the interpretation of theorems
  77.161 -  as code equations, rewrites are applied to the right
  77.162 -  hand side and the arguments of the left hand side of an
  77.163 -  equation, but never to the constant heading the left hand side.
  77.164 -  An important special case are \emph{inline theorems} which may be
  77.165 -  declared and undeclared using the
  77.166 -  \emph{code inline} or \emph{code inline del} attribute respectively.
  77.167 -
  77.168 -  Some common applications:
  77.169 -*}
  77.170 -
  77.171 -text_raw {*
  77.172 -  \begin{itemize}
  77.173 -*}
  77.174 -
  77.175 -text {*
  77.176 -     \item replacing non-executable constructs by executable ones:
  77.177 -*}     
  77.178 -
  77.179 -lemma %quote [code inline]:
  77.180 -  "x \<in> set xs \<longleftrightarrow> x mem xs" by (induct xs) simp_all
  77.181 -
  77.182 -text {*
  77.183 -     \item eliminating superfluous constants:
  77.184 -*}
  77.185 -
  77.186 -lemma %quote [code inline]:
  77.187 -  "1 = Suc 0" by simp
  77.188 -
  77.189 -text {*
  77.190 -     \item replacing executable but inconvenient constructs:
  77.191 -*}
  77.192 -
  77.193 -lemma %quote [code inline]:
  77.194 -  "xs = [] \<longleftrightarrow> List.null xs" by (induct xs) simp_all
  77.195 -
  77.196 -text_raw {*
  77.197 -  \end{itemize}
  77.198 -*}
  77.199 -
  77.200 -text {*
  77.201 -  \noindent \emph{Function transformers} provide a very general interface,
  77.202 -  transforming a list of function theorems to another
  77.203 -  list of function theorems, provided that neither the heading
  77.204 -  constant nor its type change.  The @{term "0\<Colon>nat"} / @{const Suc}
  77.205 -  pattern elimination implemented in
  77.206 -  theory @{text Efficient_Nat} (see \secref{eff_nat}) uses this
  77.207 -  interface.
  77.208 -
  77.209 -  \noindent The current setup of the preprocessor may be inspected using
  77.210 -  the @{command print_codesetup} command.
  77.211 -  @{command code_thms} provides a convenient
  77.212 -  mechanism to inspect the impact of a preprocessor setup
  77.213 -  on code equations.
  77.214 -
  77.215 -  \begin{warn}
  77.216 -    The attribute \emph{code unfold}
  77.217 -    associated with the @{text "SML code generator"} also applies to
  77.218 -    the @{text "generic code generator"}:
  77.219 -    \emph{code unfold} implies \emph{code inline}.
  77.220 -  \end{warn}
  77.221 -*}
  77.222 -
  77.223 -subsection {* Datatypes \label{sec:datatypes} *}
  77.224 -
  77.225 -text {*
  77.226 -  Conceptually, any datatype is spanned by a set of
  77.227 -  \emph{constructors} of type @{text "\<tau> = \<dots> \<Rightarrow> \<kappa> \<alpha>\<^isub>1 \<dots> \<alpha>\<^isub>n"} where @{text
  77.228 -  "{\<alpha>\<^isub>1, \<dots>, \<alpha>\<^isub>n}"} is exactly the set of \emph{all} type variables in
  77.229 -  @{text "\<tau>"}.  The HOL datatype package by default registers any new
  77.230 -  datatype in the table of datatypes, which may be inspected using the
  77.231 -  @{command print_codesetup} command.
  77.232 -
  77.233 -  In some cases, it is appropriate to alter or extend this table.  As
  77.234 -  an example, we will develop an alternative representation of the
  77.235 -  queue example given in \secref{sec:intro}.  The amortised
  77.236 -  representation is convenient for generating code but exposes its
  77.237 -  \qt{implementation} details, which may be cumbersome when proving
  77.238 -  theorems about it.  Therefore, here a simple, straightforward
  77.239 -  representation of queues:
  77.240 -*}
  77.241 -
  77.242 -datatype %quote 'a queue = Queue "'a list"
  77.243 -
  77.244 -definition %quote empty :: "'a queue" where
  77.245 -  "empty = Queue []"
  77.246 -
  77.247 -primrec %quote enqueue :: "'a \<Rightarrow> 'a queue \<Rightarrow> 'a queue" where
  77.248 -  "enqueue x (Queue xs) = Queue (xs @ [x])"
  77.249 -
  77.250 -fun %quote dequeue :: "'a queue \<Rightarrow> 'a option \<times> 'a queue" where
  77.251 -    "dequeue (Queue []) = (None, Queue [])"
  77.252 -  | "dequeue (Queue (x # xs)) = (Some x, Queue xs)"
  77.253 -
  77.254 -text {*
  77.255 -  \noindent This we can use directly for proving;  for executing,
  77.256 -  we provide an alternative characterisation:
  77.257 -*}
  77.258 -
  77.259 -definition %quote AQueue :: "'a list \<Rightarrow> 'a list \<Rightarrow> 'a queue" where
  77.260 -  "AQueue xs ys = Queue (ys @ rev xs)"
  77.261 -
  77.262 -code_datatype %quote AQueue
  77.263 -
  77.264 -text {*
  77.265 -  \noindent Here we define a \qt{constructor} @{const "AQueue"} which
  77.266 -  is defined in terms of @{text "Queue"} and interprets its arguments
  77.267 -  according to what the \emph{content} of an amortised queue is supposed
  77.268 -  to be.  Equipped with this, we are able to prove the following equations
  77.269 -  for our primitive queue operations which \qt{implement} the simple
  77.270 -  queues in an amortised fashion:
  77.271 -*}
  77.272 -
  77.273 -lemma %quote empty_AQueue [code]:
  77.274 -  "empty = AQueue [] []"
  77.275 -  unfolding AQueue_def empty_def by simp
  77.276 -
  77.277 -lemma %quote enqueue_AQueue [code]:
  77.278 -  "enqueue x (AQueue xs ys) = AQueue (x # xs) ys"
  77.279 -  unfolding AQueue_def by simp
  77.280 -
  77.281 -lemma %quote dequeue_AQueue [code]:
  77.282 -  "dequeue (AQueue xs []) =
  77.283 -    (if xs = [] then (None, AQueue [] [])
  77.284 -    else dequeue (AQueue [] (rev xs)))"
  77.285 -  "dequeue (AQueue xs (y # ys)) = (Some y, AQueue xs ys)"
  77.286 -  unfolding AQueue_def by simp_all
  77.287 -
  77.288 -text {*
  77.289 -  \noindent For completeness, we provide a substitute for the
  77.290 -  @{text case} combinator on queues:
  77.291 -*}
  77.292 -
  77.293 -definition %quote
  77.294 -  aqueue_case_def: "aqueue_case = queue_case"
  77.295 -
  77.296 -lemma %quote aqueue_case [code, code inline]:
  77.297 -  "queue_case = aqueue_case"
  77.298 -  unfolding aqueue_case_def ..
  77.299 -
  77.300 -lemma %quote case_AQueue [code]:
  77.301 -  "aqueue_case f (AQueue xs ys) = f (ys @ rev xs)"
  77.302 -  unfolding aqueue_case_def AQueue_def by simp
  77.303 -
  77.304 -text {*
  77.305 -  \noindent The resulting code looks as expected:
  77.306 -*}
  77.307 -
  77.308 -text %quote {*@{code_stmts empty enqueue dequeue (SML)}*}
  77.309 -
  77.310 -text {*
  77.311 -  \noindent From this example, it can be glimpsed that using own
  77.312 -  constructor sets is a little delicate since it changes the set of
  77.313 -  valid patterns for values of that type.  Without going into much
  77.314 -  detail, here some practical hints:
  77.315 -
  77.316 -  \begin{itemize}
  77.317 -
  77.318 -    \item When changing the constructor set for datatypes, take care
  77.319 -      to provide an alternative for the @{text case} combinator
  77.320 -      (e.g.~by replacing it using the preprocessor).
  77.321 -
  77.322 -    \item Values in the target language need not to be normalised --
  77.323 -      different values in the target language may represent the same
  77.324 -      value in the logic.
  77.325 -
  77.326 -    \item Usually, a good methodology to deal with the subtleties of
  77.327 -      pattern matching is to see the type as an abstract type: provide
  77.328 -      a set of operations which operate on the concrete representation
  77.329 -      of the type, and derive further operations by combinations of
  77.330 -      these primitive ones, without relying on a particular
  77.331 -      representation.
  77.332 -
  77.333 -  \end{itemize}
  77.334 -*}
  77.335 -
  77.336 -
  77.337 -subsection {* Equality and wellsortedness *}
  77.338 -
  77.339 -text {*
  77.340 -  Surely you have already noticed how equality is treated
  77.341 -  by the code generator:
  77.342 -*}
  77.343 -
  77.344 -primrec %quote collect_duplicates :: "'a list \<Rightarrow> 'a list \<Rightarrow> 'a list \<Rightarrow> 'a list" where
  77.345 -  "collect_duplicates xs ys [] = xs"
  77.346 -  | "collect_duplicates xs ys (z#zs) = (if z \<in> set xs
  77.347 -      then if z \<in> set ys
  77.348 -        then collect_duplicates xs ys zs
  77.349 -        else collect_duplicates xs (z#ys) zs
  77.350 -      else collect_duplicates (z#xs) (z#ys) zs)"
  77.351 -
  77.352 -text {*
  77.353 -  \noindent The membership test during preprocessing is rewritten,
  77.354 -  resulting in @{const List.member}, which itself
  77.355 -  performs an explicit equality check.
  77.356 -*}
  77.357 -
  77.358 -text %quote {*@{code_stmts collect_duplicates (SML)}*}
  77.359 -
  77.360 -text {*
  77.361 -  \noindent Obviously, polymorphic equality is implemented the Haskell
  77.362 -  way using a type class.  How is this achieved?  HOL introduces
  77.363 -  an explicit class @{class eq} with a corresponding operation
  77.364 -  @{const eq_class.eq} such that @{thm eq [no_vars]}.
  77.365 -  The preprocessing framework does the rest by propagating the
  77.366 -  @{class eq} constraints through all dependent code equations.
  77.367 -  For datatypes, instances of @{class eq} are implicitly derived
  77.368 -  when possible.  For other types, you may instantiate @{text eq}
  77.369 -  manually like any other type class.
  77.370 -
  77.371 -  Though this @{text eq} class is designed to get rarely in
  77.372 -  the way, a subtlety
  77.373 -  enters the stage when definitions of overloaded constants
  77.374 -  are dependent on operational equality.  For example, let
  77.375 -  us define a lexicographic ordering on tuples
  77.376 -  (also see theory @{theory Product_ord}):
  77.377 -*}
  77.378 -
  77.379 -instantiation %quote "*" :: (order, order) order
  77.380 -begin
  77.381 -
  77.382 -definition %quote [code del]:
  77.383 -  "x \<le> y \<longleftrightarrow> fst x < fst y \<or> fst x = fst y \<and> snd x \<le> snd y"
  77.384 -
  77.385 -definition %quote [code del]:
  77.386 -  "x < y \<longleftrightarrow> fst x < fst y \<or> fst x = fst y \<and> snd x < snd y"
  77.387 -
  77.388 -instance %quote proof
  77.389 -qed (auto simp: less_eq_prod_def less_prod_def intro: order_less_trans)
  77.390 -
  77.391 -end %quote
  77.392 -
  77.393 -lemma %quote order_prod [code]:
  77.394 -  "(x1 \<Colon> 'a\<Colon>order, y1 \<Colon> 'b\<Colon>order) < (x2, y2) \<longleftrightarrow>
  77.395 -     x1 < x2 \<or> x1 = x2 \<and> y1 < y2"
  77.396 -  "(x1 \<Colon> 'a\<Colon>order, y1 \<Colon> 'b\<Colon>order) \<le> (x2, y2) \<longleftrightarrow>
  77.397 -     x1 < x2 \<or> x1 = x2 \<and> y1 \<le> y2"
  77.398 -  by (simp_all add: less_prod_def less_eq_prod_def)
  77.399 -
  77.400 -text {*
  77.401 -  \noindent Then code generation will fail.  Why?  The definition
  77.402 -  of @{term "op \<le>"} depends on equality on both arguments,
  77.403 -  which are polymorphic and impose an additional @{class eq}
  77.404 -  class constraint, which the preprocessor does not propagate
  77.405 -  (for technical reasons).
  77.406 -
  77.407 -  The solution is to add @{class eq} explicitly to the first sort arguments in the
  77.408 -  code theorems:
  77.409 -*}
  77.410 -
  77.411 -lemma %quote order_prod_code [code]:
  77.412 -  "(x1 \<Colon> 'a\<Colon>{order, eq}, y1 \<Colon> 'b\<Colon>order) < (x2, y2) \<longleftrightarrow>
  77.413 -     x1 < x2 \<or> x1 = x2 \<and> y1 < y2"
  77.414 -  "(x1 \<Colon> 'a\<Colon>{order, eq}, y1 \<Colon> 'b\<Colon>order) \<le> (x2, y2) \<longleftrightarrow>
  77.415 -     x1 < x2 \<or> x1 = x2 \<and> y1 \<le> y2"
  77.416 -  by (simp_all add: less_prod_def less_eq_prod_def)
  77.417 -
  77.418 -text {*
  77.419 -  \noindent Then code generation succeeds:
  77.420 -*}
  77.421 -
  77.422 -text %quote {*@{code_stmts "op \<le> \<Colon> _ \<times> _ \<Rightarrow> _ \<times> _ \<Rightarrow> bool" (SML)}*}
  77.423 -
  77.424 -text {*
  77.425 -  In some cases, the automatically derived code equations
  77.426 -  for equality on a particular type may not be appropriate.
  77.427 -  As example, watch the following datatype representing
  77.428 -  monomorphic parametric types (where type constructors
  77.429 -  are referred to by natural numbers):
  77.430 -*}
  77.431 -
  77.432 -datatype %quote monotype = Mono nat "monotype list"
  77.433 -(*<*)
  77.434 -lemma monotype_eq:
  77.435 -  "eq_class.eq (Mono tyco1 typargs1) (Mono tyco2 typargs2) \<equiv> 
  77.436 -     eq_class.eq tyco1 tyco2 \<and> eq_class.eq typargs1 typargs2" by (simp add: eq)
  77.437 -(*>*)
  77.438 -
  77.439 -text {*
  77.440 -  \noindent Then code generation for SML would fail with a message
  77.441 -  that the generated code contains illegal mutual dependencies:
  77.442 -  the theorem @{thm monotype_eq [no_vars]} already requires the
  77.443 -  instance @{text "monotype \<Colon> eq"}, which itself requires
  77.444 -  @{thm monotype_eq [no_vars]};  Haskell has no problem with mutually
  77.445 -  recursive @{text instance} and @{text function} definitions,
  77.446 -  but the SML serialiser does not support this.
  77.447 -
  77.448 -  In such cases, you have to provide your own equality equations
  77.449 -  involving auxiliary constants.  In our case,
  77.450 -  @{const [show_types] list_all2} can do the job:
  77.451 -*}
  77.452 -
  77.453 -lemma %quote monotype_eq_list_all2 [code]:
  77.454 -  "eq_class.eq (Mono tyco1 typargs1) (Mono tyco2 typargs2) \<longleftrightarrow>
  77.455 -     eq_class.eq tyco1 tyco2 \<and> list_all2 eq_class.eq typargs1 typargs2"
  77.456 -  by (simp add: eq list_all2_eq [symmetric])
  77.457 -
  77.458 -text {*
  77.459 -  \noindent does not depend on instance @{text "monotype \<Colon> eq"}:
  77.460 -*}
  77.461 -
  77.462 -text %quote {*@{code_stmts "eq_class.eq :: monotype \<Rightarrow> monotype \<Rightarrow> bool" (SML)}*}
  77.463 -
  77.464 -
  77.465 -subsection {* Explicit partiality *}
  77.466 -
  77.467 -text {*
  77.468 -  Partiality usually enters the game by partial patterns, as
  77.469 -  in the following example, again for amortised queues:
  77.470 -*}
  77.471 -
  77.472 -definition %quote strict_dequeue :: "'a queue \<Rightarrow> 'a \<times> 'a queue" where
  77.473 -  "strict_dequeue q = (case dequeue q
  77.474 -    of (Some x, q') \<Rightarrow> (x, q'))"
  77.475 -
  77.476 -lemma %quote strict_dequeue_AQueue [code]:
  77.477 -  "strict_dequeue (AQueue xs (y # ys)) = (y, AQueue xs ys)"
  77.478 -  "strict_dequeue (AQueue xs []) =
  77.479 -    (case rev xs of y # ys \<Rightarrow> (y, AQueue [] ys))"
  77.480 -  by (simp_all add: strict_dequeue_def dequeue_AQueue split: list.splits)
  77.481 -
  77.482 -text {*
  77.483 -  \noindent In the corresponding code, there is no equation
  77.484 -  for the pattern @{term "AQueue [] []"}:
  77.485 -*}
  77.486 -
  77.487 -text %quote {*@{code_stmts strict_dequeue (consts) strict_dequeue (Haskell)}*}
  77.488 -
  77.489 -text {*
  77.490 -  \noindent In some cases it is desirable to have this
  77.491 -  pseudo-\qt{partiality} more explicitly, e.g.~as follows:
  77.492 -*}
  77.493 -
  77.494 -axiomatization %quote empty_queue :: 'a
  77.495 -
  77.496 -definition %quote strict_dequeue' :: "'a queue \<Rightarrow> 'a \<times> 'a queue" where
  77.497 -  "strict_dequeue' q = (case dequeue q of (Some x, q') \<Rightarrow> (x, q') | _ \<Rightarrow> empty_queue)"
  77.498 -
  77.499 -lemma %quote strict_dequeue'_AQueue [code]:
  77.500 -  "strict_dequeue' (AQueue xs []) = (if xs = [] then empty_queue
  77.501 -     else strict_dequeue' (AQueue [] (rev xs)))"
  77.502 -  "strict_dequeue' (AQueue xs (y # ys)) =
  77.503 -     (y, AQueue xs ys)"
  77.504 -  by (simp_all add: strict_dequeue'_def dequeue_AQueue split: list.splits)
  77.505 -
  77.506 -text {*
  77.507 -  Observe that on the right hand side of the definition of @{const
  77.508 -  "strict_dequeue'"} the constant @{const empty_queue} occurs
  77.509 -  which is unspecified.
  77.510 -
  77.511 -  Normally, if constants without any code equations occur in a
  77.512 -  program, the code generator complains (since in most cases this is
  77.513 -  not what the user expects).  But such constants can also be thought
  77.514 -  of as function definitions with no equations which always fail,
  77.515 -  since there is never a successful pattern match on the left hand
  77.516 -  side.  In order to categorise a constant into that category
  77.517 -  explicitly, use @{command "code_abort"}:
  77.518 -*}
  77.519 -
  77.520 -code_abort %quote empty_queue
  77.521 -
  77.522 -text {*
  77.523 -  \noindent Then the code generator will just insert an error or
  77.524 -  exception at the appropriate position:
  77.525 -*}
  77.526 -
  77.527 -text %quote {*@{code_stmts strict_dequeue' (consts) empty_queue strict_dequeue' (Haskell)}*}
  77.528 -
  77.529 -text {*
  77.530 -  \noindent This feature however is rarely needed in practice.
  77.531 -  Note also that the @{text HOL} default setup already declares
  77.532 -  @{const undefined} as @{command "code_abort"}, which is most
  77.533 -  likely to be used in such situations.
  77.534 -*}
  77.535 -
  77.536 -end
  77.537 - 
  77.538 \ No newline at end of file
    78.1 --- a/doc-src/IsarAdvanced/Codegen/Thy/ROOT.ML	Mon Mar 02 16:58:39 2009 +0100
    78.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    78.3 @@ -1,11 +0,0 @@
    78.4 -
    78.5 -(* $Id$ *)
    78.6 -
    78.7 -no_document use_thy "Setup";
    78.8 -no_document use_thys ["Efficient_Nat"];
    78.9 -
   78.10 -use_thy "Introduction";
   78.11 -use_thy "Program";
   78.12 -use_thy "Adaption";
   78.13 -use_thy "Further";
   78.14 -use_thy "ML";
    79.1 --- a/doc-src/IsarAdvanced/Codegen/Thy/Setup.thy	Mon Mar 02 16:58:39 2009 +0100
    79.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    79.3 @@ -1,12 +0,0 @@
    79.4 -theory Setup
    79.5 -imports Complex_Main
    79.6 -uses "../../../antiquote_setup.ML" "../../../more_antiquote.ML"
    79.7 -begin
    79.8 -
    79.9 -ML {* no_document use_thys
   79.10 -  ["Efficient_Nat", "Code_Char_chr", "Product_ord", "~~/src/HOL/Imperative_HOL/Imperative_HOL",
   79.11 -   "~~/src/HOL/Decision_Procs/Ferrack"] *}
   79.12 -
   79.13 -ML_val {* Code_Target.code_width := 74 *}
   79.14 -
   79.15 -end
    80.1 --- a/doc-src/IsarAdvanced/Codegen/Thy/document/Adaption.tex	Mon Mar 02 16:58:39 2009 +0100
    80.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    80.3 @@ -1,679 +0,0 @@
    80.4 -%
    80.5 -\begin{isabellebody}%
    80.6 -\def\isabellecontext{Adaption}%
    80.7 -%
    80.8 -\isadelimtheory
    80.9 -%
   80.10 -\endisadelimtheory
   80.11 -%
   80.12 -\isatagtheory
   80.13 -\isacommand{theory}\isamarkupfalse%
   80.14 -\ Adaption\isanewline
   80.15 -\isakeyword{imports}\ Setup\isanewline
   80.16 -\isakeyword{begin}%
   80.17 -\endisatagtheory
   80.18 -{\isafoldtheory}%
   80.19 -%
   80.20 -\isadelimtheory
   80.21 -\isanewline
   80.22 -%
   80.23 -\endisadelimtheory
   80.24 -%
   80.25 -\isadeliminvisible
   80.26 -\isanewline
   80.27 -%
   80.28 -\endisadeliminvisible
   80.29 -%
   80.30 -\isataginvisible
   80.31 -\isacommand{setup}\isamarkupfalse%
   80.32 -\ {\isacharverbatimopen}\ Code{\isacharunderscore}Target{\isachardot}extend{\isacharunderscore}target\ {\isacharparenleft}{\isachardoublequote}{\isasymSML}{\isachardoublequote}{\isacharcomma}\ {\isacharparenleft}{\isachardoublequote}SML{\isachardoublequote}{\isacharcomma}\ K\ I{\isacharparenright}{\isacharparenright}\ {\isacharverbatimclose}%
   80.33 -\endisataginvisible
   80.34 -{\isafoldinvisible}%
   80.35 -%
   80.36 -\isadeliminvisible
   80.37 -%
   80.38 -\endisadeliminvisible
   80.39 -%
   80.40 -\isamarkupsection{Adaption to target languages \label{sec:adaption}%
   80.41 -}
   80.42 -\isamarkuptrue%
   80.43 -%
   80.44 -\isamarkupsubsection{Adapting code generation%
   80.45 -}
   80.46 -\isamarkuptrue%
   80.47 -%
   80.48 -\begin{isamarkuptext}%
   80.49 -The aspects of code generation introduced so far have two aspects
   80.50 -  in common:
   80.51 -
   80.52 -  \begin{itemize}
   80.53 -    \item They act uniformly, without reference to a specific
   80.54 -       target language.
   80.55 -    \item They are \emph{safe} in the sense that as long as you trust
   80.56 -       the code generator meta theory and implementation, you cannot
   80.57 -       produce programs that yield results which are not derivable
   80.58 -       in the logic.
   80.59 -  \end{itemize}
   80.60 -
   80.61 -  \noindent In this section we will introduce means to \emph{adapt} the serialiser
   80.62 -  to a specific target language, i.e.~to print program fragments
   80.63 -  in a way which accommodates \qt{already existing} ingredients of
   80.64 -  a target language environment, for three reasons:
   80.65 -
   80.66 -  \begin{itemize}
   80.67 -    \item improving readability and aesthetics of generated code
   80.68 -    \item gaining efficiency
   80.69 -    \item interface with language parts which have no direct counterpart
   80.70 -      in \isa{HOL} (say, imperative data structures)
   80.71 -  \end{itemize}
   80.72 -
   80.73 -  \noindent Generally, you should avoid using those features yourself
   80.74 -  \emph{at any cost}:
   80.75 -
   80.76 -  \begin{itemize}
   80.77 -    \item The safe configuration methods act uniformly on every target language,
   80.78 -      whereas for adaption you have to treat each target language separate.
   80.79 -    \item Application is extremely tedious since there is no abstraction
   80.80 -      which would allow for a static check, making it easy to produce garbage.
   80.81 -    \item More or less subtle errors can be introduced unconsciously.
   80.82 -  \end{itemize}
   80.83 -
   80.84 -  \noindent However, even if you ought refrain from setting up adaption
   80.85 -  yourself, already the \isa{HOL} comes with some reasonable default
   80.86 -  adaptions (say, using target language list syntax).  There also some
   80.87 -  common adaption cases which you can setup by importing particular
   80.88 -  library theories.  In order to understand these, we provide some clues here;
   80.89 -  these however are not supposed to replace a careful study of the sources.%
   80.90 -\end{isamarkuptext}%
   80.91 -\isamarkuptrue%
   80.92 -%
   80.93 -\isamarkupsubsection{The adaption principle%
   80.94 -}
   80.95 -\isamarkuptrue%
   80.96 -%
   80.97 -\begin{isamarkuptext}%
   80.98 -The following figure illustrates what \qt{adaption} is conceptually
   80.99 -  supposed to be:
  80.100 -
  80.101 -  \begin{figure}[here]
  80.102 -    \begin{tikzpicture}[scale = 0.5]
  80.103 -      \tikzstyle water=[color = blue, thick]
  80.104 -      \tikzstyle ice=[color = black, very thick, cap = round, join = round, fill = white]
  80.105 -      \tikzstyle process=[color = green, semithick, ->]
  80.106 -      \tikzstyle adaption=[color = red, semithick, ->]
  80.107 -      \tikzstyle target=[color = black]
  80.108 -      \foreach \x in {0, ..., 24}
  80.109 -        \draw[style=water] (\x, 0.25) sin + (0.25, 0.25) cos + (0.25, -0.25) sin
  80.110 -          + (0.25, -0.25) cos + (0.25, 0.25);
  80.111 -      \draw[style=ice] (1, 0) --
  80.112 -        (3, 6) node[above, fill=white] {logic} -- (5, 0) -- cycle;
  80.113 -      \draw[style=ice] (9, 0) --
  80.114 -        (11, 6) node[above, fill=white] {intermediate language} -- (13, 0) -- cycle;
  80.115 -      \draw[style=ice] (15, -6) --
  80.116 -        (19, 6) node[above, fill=white] {target language} -- (23, -6) -- cycle;
  80.117 -      \draw[style=process]
  80.118 -        (3.5, 3) .. controls (7, 5) .. node[fill=white] {translation} (10.5, 3);
  80.119 -      \draw[style=process]
  80.120 -        (11.5, 3) .. controls (15, 5) .. node[fill=white] (serialisation) {serialisation} (18.5, 3);
  80.121 -      \node (adaption) at (11, -2) [style=adaption] {adaption};
  80.122 -      \node at (19, 3) [rotate=90] {generated};
  80.123 -      \node at (19.5, -5) {language};
  80.124 -      \node at (19.5, -3) {library};
  80.125 -      \node (includes) at (19.5, -1) {includes};
  80.126 -      \node (reserved) at (16.5, -3) [rotate=72] {reserved}; % proper 71.57
  80.127 -      \draw[style=process]
  80.128 -        (includes) -- (serialisation);
  80.129 -      \draw[style=process]
  80.130 -        (reserved) -- (serialisation);
  80.131 -      \draw[style=adaption]
  80.132 -        (adaption) -- (serialisation);
  80.133 -      \draw[style=adaption]
  80.134 -        (adaption) -- (includes);
  80.135 -      \draw[style=adaption]
  80.136 -        (adaption) -- (reserved);
  80.137 -    \end{tikzpicture}
  80.138 -    \caption{The adaption principle}
  80.139 -    \label{fig:adaption}
  80.140 -  \end{figure}
  80.141 -
  80.142 -  \noindent In the tame view, code generation acts as broker between
  80.143 -  \isa{logic}, \isa{intermediate\ language} and
  80.144 -  \isa{target\ language} by means of \isa{translation} and
  80.145 -  \isa{serialisation};  for the latter, the serialiser has to observe
  80.146 -  the structure of the \isa{language} itself plus some \isa{reserved}
  80.147 -  keywords which have to be avoided for generated code.
  80.148 -  However, if you consider \isa{adaption} mechanisms, the code generated
  80.149 -  by the serializer is just the tip of the iceberg:
  80.150 -
  80.151 -  \begin{itemize}
  80.152 -    \item \isa{serialisation} can be \emph{parametrised} such that
  80.153 -      logical entities are mapped to target-specific ones
  80.154 -      (e.g. target-specific list syntax,
  80.155 -        see also \secref{sec:adaption_mechanisms})
  80.156 -    \item Such parametrisations can involve references to a
  80.157 -      target-specific standard \isa{library} (e.g. using
  80.158 -      the \isa{Haskell} \verb|Maybe| type instead
  80.159 -      of the \isa{HOL} \isa{option} type);
  80.160 -      if such are used, the corresponding identifiers
  80.161 -      (in our example, \verb|Maybe|, \verb|Nothing|
  80.162 -      and \verb|Just|) also have to be considered \isa{reserved}.
  80.163 -    \item Even more, the user can enrich the library of the
  80.164 -      target-language by providing code snippets
  80.165 -      (\qt{\isa{includes}}) which are prepended to
  80.166 -      any generated code (see \secref{sec:include});  this typically
  80.167 -      also involves further \isa{reserved} identifiers.
  80.168 -  \end{itemize}
  80.169 -
  80.170 -  \noindent As figure \ref{fig:adaption} illustrates, all these adaption mechanisms
  80.171 -  have to act consistently;  it is at the discretion of the user
  80.172 -  to take care for this.%
  80.173 -\end{isamarkuptext}%
  80.174 -\isamarkuptrue%
  80.175 -%
  80.176 -\isamarkupsubsection{Common adaption patterns%
  80.177 -}
  80.178 -\isamarkuptrue%
  80.179 -%
  80.180 -\begin{isamarkuptext}%
  80.181 -The \hyperlink{theory.HOL}{\mbox{\isa{HOL}}} \hyperlink{theory.Main}{\mbox{\isa{Main}}} theory already provides a code
  80.182 -  generator setup
  80.183 -  which should be suitable for most applications.  Common extensions
  80.184 -  and modifications are available by certain theories of the \isa{HOL}
  80.185 -  library; beside being useful in applications, they may serve
  80.186 -  as a tutorial for customising the code generator setup (see below
  80.187 -  \secref{sec:adaption_mechanisms}).
  80.188 -
  80.189 -  \begin{description}
  80.190 -
  80.191 -    \item[\hyperlink{theory.Code-Integer}{\mbox{\isa{Code{\isacharunderscore}Integer}}}] represents \isa{HOL} integers by big
  80.192 -       integer literals in target languages.
  80.193 -    \item[\hyperlink{theory.Code-Char}{\mbox{\isa{Code{\isacharunderscore}Char}}}] represents \isa{HOL} characters by 
  80.194 -       character literals in target languages.
  80.195 -    \item[\hyperlink{theory.Code-Char-chr}{\mbox{\isa{Code{\isacharunderscore}Char{\isacharunderscore}chr}}}] like \isa{Code{\isacharunderscore}Char},
  80.196 -       but also offers treatment of character codes; includes
  80.197 -       \hyperlink{theory.Code-Char}{\mbox{\isa{Code{\isacharunderscore}Char}}}.
  80.198 -    \item[\hyperlink{theory.Efficient-Nat}{\mbox{\isa{Efficient{\isacharunderscore}Nat}}}] \label{eff_nat} implements natural numbers by integers,
  80.199 -       which in general will result in higher efficiency; pattern
  80.200 -       matching with \isa{{\isadigit{0}}} / \isa{Suc}
  80.201 -       is eliminated;  includes \hyperlink{theory.Code-Integer}{\mbox{\isa{Code{\isacharunderscore}Integer}}}
  80.202 -       and \hyperlink{theory.Code-Index}{\mbox{\isa{Code{\isacharunderscore}Index}}}.
  80.203 -    \item[\hyperlink{theory.Code-Index}{\mbox{\isa{Code{\isacharunderscore}Index}}}] provides an additional datatype
  80.204 -       \isa{index} which is mapped to target-language built-in integers.
  80.205 -       Useful for code setups which involve e.g. indexing of
  80.206 -       target-language arrays.
  80.207 -    \item[\hyperlink{theory.Code-Message}{\mbox{\isa{Code{\isacharunderscore}Message}}}] provides an additional datatype
  80.208 -       \isa{message{\isacharunderscore}string} which is isomorphic to strings;
  80.209 -       \isa{message{\isacharunderscore}string}s are mapped to target-language strings.
  80.210 -       Useful for code setups which involve e.g. printing (error) messages.
  80.211 -
  80.212 -  \end{description}
  80.213 -
  80.214 -  \begin{warn}
  80.215 -    When importing any of these theories, they should form the last
  80.216 -    items in an import list.  Since these theories adapt the
  80.217 -    code generator setup in a non-conservative fashion,
  80.218 -    strange effects may occur otherwise.
  80.219 -  \end{warn}%
  80.220 -\end{isamarkuptext}%
  80.221 -\isamarkuptrue%
  80.222 -%
  80.223 -\isamarkupsubsection{Parametrising serialisation \label{sec:adaption_mechanisms}%
  80.224 -}
  80.225 -\isamarkuptrue%
  80.226 -%
  80.227 -\begin{isamarkuptext}%
  80.228 -Consider the following function and its corresponding
  80.229 -  SML code:%
  80.230 -\end{isamarkuptext}%
  80.231 -\isamarkuptrue%
  80.232 -%
  80.233 -\isadelimquote
  80.234 -%
  80.235 -\endisadelimquote
  80.236 -%
  80.237 -\isatagquote
  80.238 -\isacommand{primrec}\isamarkupfalse%
  80.239 -\ in{\isacharunderscore}interval\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymtimes}\ nat\ {\isasymRightarrow}\ nat\ {\isasymRightarrow}\ bool{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  80.240 -\ \ {\isachardoublequoteopen}in{\isacharunderscore}interval\ {\isacharparenleft}k{\isacharcomma}\ l{\isacharparenright}\ n\ {\isasymlongleftrightarrow}\ k\ {\isasymle}\ n\ {\isasymand}\ n\ {\isasymle}\ l{\isachardoublequoteclose}%
  80.241 -\endisatagquote
  80.242 -{\isafoldquote}%
  80.243 -%
  80.244 -\isadelimquote
  80.245 -%
  80.246 -\endisadelimquote
  80.247 -%
  80.248 -\isadeliminvisible
  80.249 -%
  80.250 -\endisadeliminvisible
  80.251 -%
  80.252 -\isataginvisible
  80.253 -%
  80.254 -\endisataginvisible
  80.255 -{\isafoldinvisible}%
  80.256 -%
  80.257 -\isadeliminvisible
  80.258 -%
  80.259 -\endisadeliminvisible
  80.260 -%
  80.261 -\isadelimquote
  80.262 -%
  80.263 -\endisadelimquote
  80.264 -%
  80.265 -\isatagquote
  80.266 -%
  80.267 -\begin{isamarkuptext}%
  80.268 -\isatypewriter%
  80.269 -\noindent%
  80.270 -\hspace*{0pt}structure Example = \\
  80.271 -\hspace*{0pt}struct\\
  80.272 -\hspace*{0pt}\\
  80.273 -\hspace*{0pt}datatype nat = Zero{\char95}nat | Suc of nat;\\
  80.274 -\hspace*{0pt}\\
  80.275 -\hspace*{0pt}datatype boola = True | False;\\
  80.276 -\hspace*{0pt}\\
  80.277 -\hspace*{0pt}fun anda x True = x\\
  80.278 -\hspace*{0pt} ~| anda x False = False\\
  80.279 -\hspace*{0pt} ~| anda True x = x\\
  80.280 -\hspace*{0pt} ~| anda False x = False;\\
  80.281 -\hspace*{0pt}\\
  80.282 -\hspace*{0pt}fun less{\char95}nat m (Suc n) = less{\char95}eq{\char95}nat m n\\
  80.283 -\hspace*{0pt} ~| less{\char95}nat n Zero{\char95}nat = False\\
  80.284 -\hspace*{0pt}and less{\char95}eq{\char95}nat (Suc m) n = less{\char95}nat m n\\
  80.285 -\hspace*{0pt} ~| less{\char95}eq{\char95}nat Zero{\char95}nat n = True;\\
  80.286 -\hspace*{0pt}\\
  80.287 -\hspace*{0pt}fun in{\char95}interval (k,~l) n = anda (less{\char95}eq{\char95}nat k n) (less{\char95}eq{\char95}nat n l);\\
  80.288 -\hspace*{0pt}\\
  80.289 -\hspace*{0pt}end;~(*struct Example*)%
  80.290 -\end{isamarkuptext}%
  80.291 -\isamarkuptrue%
  80.292 -%
  80.293 -\endisatagquote
  80.294 -{\isafoldquote}%
  80.295 -%
  80.296 -\isadelimquote
  80.297 -%
  80.298 -\endisadelimquote
  80.299 -%
  80.300 -\begin{isamarkuptext}%
  80.301 -\noindent Though this is correct code, it is a little bit unsatisfactory:
  80.302 -  boolean values and operators are materialised as distinguished
  80.303 -  entities with have nothing to do with the SML-built-in notion
  80.304 -  of \qt{bool}.  This results in less readable code;
  80.305 -  additionally, eager evaluation may cause programs to
  80.306 -  loop or break which would perfectly terminate when
  80.307 -  the existing SML \verb|bool| would be used.  To map
  80.308 -  the HOL \isa{bool} on SML \verb|bool|, we may use
  80.309 -  \qn{custom serialisations}:%
  80.310 -\end{isamarkuptext}%
  80.311 -\isamarkuptrue%
  80.312 -%
  80.313 -\isadelimquotett
  80.314 -%
  80.315 -\endisadelimquotett
  80.316 -%
  80.317 -\isatagquotett
  80.318 -\isacommand{code{\isacharunderscore}type}\isamarkupfalse%
  80.319 -\ bool\isanewline
  80.320 -\ \ {\isacharparenleft}SML\ {\isachardoublequoteopen}bool{\isachardoublequoteclose}{\isacharparenright}\isanewline
  80.321 -\isacommand{code{\isacharunderscore}const}\isamarkupfalse%
  80.322 -\ True\ \isakeyword{and}\ False\ \isakeyword{and}\ {\isachardoublequoteopen}op\ {\isasymand}{\isachardoublequoteclose}\isanewline
  80.323 -\ \ {\isacharparenleft}SML\ {\isachardoublequoteopen}true{\isachardoublequoteclose}\ \isakeyword{and}\ {\isachardoublequoteopen}false{\isachardoublequoteclose}\ \isakeyword{and}\ {\isachardoublequoteopen}{\isacharunderscore}\ andalso\ {\isacharunderscore}{\isachardoublequoteclose}{\isacharparenright}%
  80.324 -\endisatagquotett
  80.325 -{\isafoldquotett}%
  80.326 -%
  80.327 -\isadelimquotett
  80.328 -%
  80.329 -\endisadelimquotett
  80.330 -%
  80.331 -\begin{isamarkuptext}%
  80.332 -\noindent The \hyperlink{command.code-type}{\mbox{\isa{\isacommand{code{\isacharunderscore}type}}}} command takes a type constructor
  80.333 -  as arguments together with a list of custom serialisations.
  80.334 -  Each custom serialisation starts with a target language
  80.335 -  identifier followed by an expression, which during
  80.336 -  code serialisation is inserted whenever the type constructor
  80.337 -  would occur.  For constants, \hyperlink{command.code-const}{\mbox{\isa{\isacommand{code{\isacharunderscore}const}}}} implements
  80.338 -  the corresponding mechanism.  Each ``\verb|_|'' in
  80.339 -  a serialisation expression is treated as a placeholder
  80.340 -  for the type constructor's (the constant's) arguments.%
  80.341 -\end{isamarkuptext}%
  80.342 -\isamarkuptrue%
  80.343 -%
  80.344 -\isadelimquote
  80.345 -%
  80.346 -\endisadelimquote
  80.347 -%
  80.348 -\isatagquote
  80.349 -%
  80.350 -\begin{isamarkuptext}%
  80.351 -\isatypewriter%
  80.352 -\noindent%
  80.353 -\hspace*{0pt}structure Example = \\
  80.354 -\hspace*{0pt}struct\\
  80.355 -\hspace*{0pt}\\
  80.356 -\hspace*{0pt}datatype nat = Zero{\char95}nat | Suc of nat;\\
  80.357 -\hspace*{0pt}\\
  80.358 -\hspace*{0pt}fun less{\char95}nat m (Suc n) = less{\char95}eq{\char95}nat m n\\
  80.359 -\hspace*{0pt} ~| less{\char95}nat n Zero{\char95}nat = false\\
  80.360 -\hspace*{0pt}and less{\char95}eq{\char95}nat (Suc m) n = less{\char95}nat m n\\
  80.361 -\hspace*{0pt} ~| less{\char95}eq{\char95}nat Zero{\char95}nat n = true;\\
  80.362 -\hspace*{0pt}\\
  80.363 -\hspace*{0pt}fun in{\char95}interval (k,~l) n = (less{\char95}eq{\char95}nat k n) andalso (less{\char95}eq{\char95}nat n l);\\
  80.364 -\hspace*{0pt}\\
  80.365 -\hspace*{0pt}end;~(*struct Example*)%
  80.366 -\end{isamarkuptext}%
  80.367 -\isamarkuptrue%
  80.368 -%
  80.369 -\endisatagquote
  80.370 -{\isafoldquote}%
  80.371 -%
  80.372 -\isadelimquote
  80.373 -%
  80.374 -\endisadelimquote
  80.375 -%
  80.376 -\begin{isamarkuptext}%
  80.377 -\noindent This still is not perfect: the parentheses
  80.378 -  around the \qt{andalso} expression are superfluous.
  80.379 -  Though the serialiser
  80.380 -  by no means attempts to imitate the rich Isabelle syntax
  80.381 -  framework, it provides some common idioms, notably
  80.382 -  associative infixes with precedences which may be used here:%
  80.383 -\end{isamarkuptext}%
  80.384 -\isamarkuptrue%
  80.385 -%
  80.386 -\isadelimquotett
  80.387 -%
  80.388 -\endisadelimquotett
  80.389 -%
  80.390 -\isatagquotett
  80.391 -\isacommand{code{\isacharunderscore}const}\isamarkupfalse%
  80.392 -\ {\isachardoublequoteopen}op\ {\isasymand}{\isachardoublequoteclose}\isanewline
  80.393 -\ \ {\isacharparenleft}SML\ \isakeyword{infixl}\ {\isadigit{1}}\ {\isachardoublequoteopen}andalso{\isachardoublequoteclose}{\isacharparenright}%
  80.394 -\endisatagquotett
  80.395 -{\isafoldquotett}%
  80.396 -%
  80.397 -\isadelimquotett
  80.398 -%
  80.399 -\endisadelimquotett
  80.400 -%
  80.401 -\isadelimquote
  80.402 -%
  80.403 -\endisadelimquote
  80.404 -%
  80.405 -\isatagquote
  80.406 -%
  80.407 -\begin{isamarkuptext}%
  80.408 -\isatypewriter%
  80.409 -\noindent%
  80.410 -\hspace*{0pt}structure Example = \\
  80.411 -\hspace*{0pt}struct\\
  80.412 -\hspace*{0pt}\\
  80.413 -\hspace*{0pt}datatype nat = Zero{\char95}nat | Suc of nat;\\
  80.414 -\hspace*{0pt}\\
  80.415 -\hspace*{0pt}fun less{\char95}nat m (Suc n) = less{\char95}eq{\char95}nat m n\\
  80.416 -\hspace*{0pt} ~| less{\char95}nat n Zero{\char95}nat = false\\
  80.417 -\hspace*{0pt}and less{\char95}eq{\char95}nat (Suc m) n = less{\char95}nat m n\\
  80.418 -\hspace*{0pt} ~| less{\char95}eq{\char95}nat Zero{\char95}nat n = true;\\
  80.419 -\hspace*{0pt}\\
  80.420 -\hspace*{0pt}fun in{\char95}interval (k,~l) n = less{\char95}eq{\char95}nat k n andalso less{\char95}eq{\char95}nat n l;\\
  80.421 -\hspace*{0pt}\\
  80.422 -\hspace*{0pt}end;~(*struct Example*)%
  80.423 -\end{isamarkuptext}%
  80.424 -\isamarkuptrue%
  80.425 -%
  80.426 -\endisatagquote
  80.427 -{\isafoldquote}%
  80.428 -%
  80.429 -\isadelimquote
  80.430 -%
  80.431 -\endisadelimquote
  80.432 -%
  80.433 -\begin{isamarkuptext}%
  80.434 -\noindent The attentive reader may ask how we assert that no generated
  80.435 -  code will accidentally overwrite.  For this reason the serialiser has
  80.436 -  an internal table of identifiers which have to be avoided to be used
  80.437 -  for new declarations.  Initially, this table typically contains the
  80.438 -  keywords of the target language.  It can be extended manually, thus avoiding
  80.439 -  accidental overwrites, using the \hyperlink{command.code-reserved}{\mbox{\isa{\isacommand{code{\isacharunderscore}reserved}}}} command:%
  80.440 -\end{isamarkuptext}%
  80.441 -\isamarkuptrue%
  80.442 -%
  80.443 -\isadelimquote
  80.444 -%
  80.445 -\endisadelimquote
  80.446 -%
  80.447 -\isatagquote
  80.448 -\isacommand{code{\isacharunderscore}reserved}\isamarkupfalse%
  80.449 -\ {\isachardoublequoteopen}{\isasymSML}{\isachardoublequoteclose}\ bool\ true\ false\ andalso%
  80.450 -\endisatagquote
  80.451 -{\isafoldquote}%
  80.452 -%
  80.453 -\isadelimquote
  80.454 -%
  80.455 -\endisadelimquote
  80.456 -%
  80.457 -\begin{isamarkuptext}%
  80.458 -\noindent Next, we try to map HOL pairs to SML pairs, using the
  80.459 -  infix ``\verb|*|'' type constructor and parentheses:%
  80.460 -\end{isamarkuptext}%
  80.461 -\isamarkuptrue%
  80.462 -%
  80.463 -\isadeliminvisible
  80.464 -%
  80.465 -\endisadeliminvisible
  80.466 -%
  80.467 -\isataginvisible
  80.468 -%
  80.469 -\endisataginvisible
  80.470 -{\isafoldinvisible}%
  80.471 -%
  80.472 -\isadeliminvisible
  80.473 -%
  80.474 -\endisadeliminvisible
  80.475 -%
  80.476 -\isadelimquotett
  80.477 -%
  80.478 -\endisadelimquotett
  80.479 -%
  80.480 -\isatagquotett
  80.481 -\isacommand{code{\isacharunderscore}type}\isamarkupfalse%
  80.482 -\ {\isacharasterisk}\isanewline
  80.483 -\ \ {\isacharparenleft}SML\ \isakeyword{infix}\ {\isadigit{2}}\ {\isachardoublequoteopen}{\isacharasterisk}{\isachardoublequoteclose}{\isacharparenright}\isanewline
  80.484 -\isacommand{code{\isacharunderscore}const}\isamarkupfalse%
  80.485 -\ Pair\isanewline
  80.486 -\ \ {\isacharparenleft}SML\ {\isachardoublequoteopen}{\isacharbang}{\isacharparenleft}{\isacharparenleft}{\isacharunderscore}{\isacharparenright}{\isacharcomma}{\isacharslash}\ {\isacharparenleft}{\isacharunderscore}{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}{\isacharparenright}%
  80.487 -\endisatagquotett
  80.488 -{\isafoldquotett}%
  80.489 -%
  80.490 -\isadelimquotett
  80.491 -%
  80.492 -\endisadelimquotett
  80.493 -%
  80.494 -\begin{isamarkuptext}%
  80.495 -\noindent The initial bang ``\verb|!|'' tells the serialiser
  80.496 -  never to put
  80.497 -  parentheses around the whole expression (they are already present),
  80.498 -  while the parentheses around argument place holders
  80.499 -  tell not to put parentheses around the arguments.
  80.500 -  The slash ``\verb|/|'' (followed by arbitrary white space)
  80.501 -  inserts a space which may be used as a break if necessary
  80.502 -  during pretty printing.
  80.503 -
  80.504 -  These examples give a glimpse what mechanisms
  80.505 -  custom serialisations provide; however their usage
  80.506 -  requires careful thinking in order not to introduce
  80.507 -  inconsistencies -- or, in other words:
  80.508 -  custom serialisations are completely axiomatic.
  80.509 -
  80.510 -  A further noteworthy details is that any special
  80.511 -  character in a custom serialisation may be quoted
  80.512 -  using ``\verb|'|''; thus, in
  80.513 -  ``\verb|fn '_ => _|'' the first
  80.514 -  ``\verb|_|'' is a proper underscore while the
  80.515 -  second ``\verb|_|'' is a placeholder.%
  80.516 -\end{isamarkuptext}%
  80.517 -\isamarkuptrue%
  80.518 -%
  80.519 -\isamarkupsubsection{\isa{Haskell} serialisation%
  80.520 -}
  80.521 -\isamarkuptrue%
  80.522 -%
  80.523 -\begin{isamarkuptext}%
  80.524 -For convenience, the default
  80.525 -  \isa{HOL} setup for \isa{Haskell} maps the \isa{eq} class to
  80.526 -  its counterpart in \isa{Haskell}, giving custom serialisations
  80.527 -  for the class \isa{eq} (by command \hyperlink{command.code-class}{\mbox{\isa{\isacommand{code{\isacharunderscore}class}}}}) and its operation
  80.528 -  \isa{eq{\isacharunderscore}class{\isachardot}eq}%
  80.529 -\end{isamarkuptext}%
  80.530 -\isamarkuptrue%
  80.531 -%
  80.532 -\isadelimquotett
  80.533 -%
  80.534 -\endisadelimquotett
  80.535 -%
  80.536 -\isatagquotett
  80.537 -\isacommand{code{\isacharunderscore}class}\isamarkupfalse%
  80.538 -\ eq\isanewline
  80.539 -\ \ {\isacharparenleft}Haskell\ {\isachardoublequoteopen}Eq{\isachardoublequoteclose}{\isacharparenright}\isanewline
  80.540 -\isanewline
  80.541 -\isacommand{code{\isacharunderscore}const}\isamarkupfalse%
  80.542 -\ {\isachardoublequoteopen}op\ {\isacharequal}{\isachardoublequoteclose}\isanewline
  80.543 -\ \ {\isacharparenleft}Haskell\ \isakeyword{infixl}\ {\isadigit{4}}\ {\isachardoublequoteopen}{\isacharequal}{\isacharequal}{\isachardoublequoteclose}{\isacharparenright}%
  80.544 -\endisatagquotett
  80.545 -{\isafoldquotett}%
  80.546 -%
  80.547 -\isadelimquotett
  80.548 -%
  80.549 -\endisadelimquotett
  80.550 -%
  80.551 -\begin{isamarkuptext}%
  80.552 -\noindent A problem now occurs whenever a type which
  80.553 -  is an instance of \isa{eq} in \isa{HOL} is mapped
  80.554 -  on a \isa{Haskell}-built-in type which is also an instance
  80.555 -  of \isa{Haskell} \isa{Eq}:%
  80.556 -\end{isamarkuptext}%
  80.557 -\isamarkuptrue%
  80.558 -%
  80.559 -\isadelimquote
  80.560 -%
  80.561 -\endisadelimquote
  80.562 -%
  80.563 -\isatagquote
  80.564 -\isacommand{typedecl}\isamarkupfalse%
  80.565 -\ bar\isanewline
  80.566 -\isanewline
  80.567 -\isacommand{instantiation}\isamarkupfalse%
  80.568 -\ bar\ {\isacharcolon}{\isacharcolon}\ eq\isanewline
  80.569 -\isakeyword{begin}\isanewline
  80.570 -\isanewline
  80.571 -\isacommand{definition}\isamarkupfalse%
  80.572 -\ {\isachardoublequoteopen}eq{\isacharunderscore}class{\isachardot}eq\ {\isacharparenleft}x{\isasymColon}bar{\isacharparenright}\ y\ {\isasymlongleftrightarrow}\ x\ {\isacharequal}\ y{\isachardoublequoteclose}\isanewline
  80.573 -\isanewline
  80.574 -\isacommand{instance}\isamarkupfalse%
  80.575 -\ \isacommand{by}\isamarkupfalse%
  80.576 -\ default\ {\isacharparenleft}simp\ add{\isacharcolon}\ eq{\isacharunderscore}bar{\isacharunderscore}def{\isacharparenright}\isanewline
  80.577 -\isanewline
  80.578 -\isacommand{end}\isamarkupfalse%
  80.579 -%
  80.580 -\endisatagquote
  80.581 -{\isafoldquote}%
  80.582 -%
  80.583 -\isadelimquote
  80.584 -%
  80.585 -\endisadelimquote
  80.586 -\isanewline
  80.587 -%
  80.588 -\isadelimquotett
  80.589 -\isanewline
  80.590 -%
  80.591 -\endisadelimquotett
  80.592 -%
  80.593 -\isatagquotett
  80.594 -\isacommand{code{\isacharunderscore}type}\isamarkupfalse%
  80.595 -\ bar\isanewline
  80.596 -\ \ {\isacharparenleft}Haskell\ {\isachardoublequoteopen}Integer{\isachardoublequoteclose}{\isacharparenright}%
  80.597 -\endisatagquotett
  80.598 -{\isafoldquotett}%
  80.599 -%
  80.600 -\isadelimquotett
  80.601 -%
  80.602 -\endisadelimquotett
  80.603 -%
  80.604 -\begin{isamarkuptext}%
  80.605 -\noindent The code generator would produce
  80.606 -  an additional instance, which of course is rejected by the \isa{Haskell}
  80.607 -  compiler.
  80.608 -  To suppress this additional instance, use
  80.609 -  \isa{code{\isacharunderscore}instance}:%
  80.610 -\end{isamarkuptext}%
  80.611 -\isamarkuptrue%
  80.612 -%
  80.613 -\isadelimquotett
  80.614 -%
  80.615 -\endisadelimquotett
  80.616 -%
  80.617 -\isatagquotett
  80.618 -\isacommand{code{\isacharunderscore}instance}\isamarkupfalse%
  80.619 -\ bar\ {\isacharcolon}{\isacharcolon}\ eq\isanewline
  80.620 -\ \ {\isacharparenleft}Haskell\ {\isacharminus}{\isacharparenright}%
  80.621 -\endisatagquotett
  80.622 -{\isafoldquotett}%
  80.623 -%
  80.624 -\isadelimquotett
  80.625 -%
  80.626 -\endisadelimquotett
  80.627 -%
  80.628 -\isamarkupsubsection{Enhancing the target language context \label{sec:include}%
  80.629 -}
  80.630 -\isamarkuptrue%
  80.631 -%
  80.632 -\begin{isamarkuptext}%
  80.633 -In rare cases it is necessary to \emph{enrich} the context of a
  80.634 -  target language;  this is accomplished using the \hyperlink{command.code-include}{\mbox{\isa{\isacommand{code{\isacharunderscore}include}}}}
  80.635 -  command:%
  80.636 -\end{isamarkuptext}%
  80.637 -\isamarkuptrue%
  80.638 -%
  80.639 -\isadelimquotett
  80.640 -%
  80.641 -\endisadelimquotett
  80.642 -%
  80.643 -\isatagquotett
  80.644 -\isacommand{code{\isacharunderscore}include}\isamarkupfalse%
  80.645 -\ Haskell\ {\isachardoublequoteopen}Errno{\isachardoublequoteclose}\isanewline
  80.646 -{\isacharverbatimopen}errno\ i\ {\isacharequal}\ error\ {\isacharparenleft}{\isachardoublequote}Error\ number{\isacharcolon}\ {\isachardoublequote}\ {\isacharplus}{\isacharplus}\ show\ i{\isacharparenright}{\isacharverbatimclose}\isanewline
  80.647 -\isanewline
  80.648 -\isacommand{code{\isacharunderscore}reserved}\isamarkupfalse%
  80.649 -\ Haskell\ Errno%
  80.650 -\endisatagquotett
  80.651 -{\isafoldquotett}%
  80.652 -%
  80.653 -\isadelimquotett
  80.654 -%
  80.655 -\endisadelimquotett
  80.656 -%
  80.657 -\begin{isamarkuptext}%
  80.658 -\noindent Such named \isa{include}s are then prepended to every generated code.
  80.659 -  Inspect such code in order to find out how \hyperlink{command.code-include}{\mbox{\isa{\isacommand{code{\isacharunderscore}include}}}} behaves
  80.660 -  with respect to a particular target language.%
  80.661 -\end{isamarkuptext}%
  80.662 -\isamarkuptrue%
  80.663 -%
  80.664 -\isadelimtheory
  80.665 -%
  80.666 -\endisadelimtheory
  80.667 -%
  80.668 -\isatagtheory
  80.669 -\isacommand{end}\isamarkupfalse%
  80.670 -%
  80.671 -\endisatagtheory
  80.672 -{\isafoldtheory}%
  80.673 -%
  80.674 -\isadelimtheory
  80.675 -%
  80.676 -\endisadelimtheory
  80.677 -\isanewline
  80.678 -\end{isabellebody}%
  80.679 -%%% Local Variables:
  80.680 -%%% mode: latex
  80.681 -%%% TeX-master: "root"
  80.682 -%%% End:
    81.1 --- a/doc-src/IsarAdvanced/Codegen/Thy/document/Codegen.tex	Mon Mar 02 16:58:39 2009 +0100
    81.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    81.3 @@ -1,1690 +0,0 @@
    81.4 -%
    81.5 -\begin{isabellebody}%
    81.6 -\def\isabellecontext{Codegen}%
    81.7 -%
    81.8 -\isadelimtheory
    81.9 -\isanewline
   81.10 -\isanewline
   81.11 -%
   81.12 -\endisadelimtheory
   81.13 -%
   81.14 -\isatagtheory
   81.15 -%
   81.16 -\endisatagtheory
   81.17 -{\isafoldtheory}%
   81.18 -%
   81.19 -\isadelimtheory
   81.20 -%
   81.21 -\endisadelimtheory
   81.22 -%
   81.23 -\isadelimML
   81.24 -%
   81.25 -\endisadelimML
   81.26 -%
   81.27 -\isatagML
   81.28 -%
   81.29 -\endisatagML
   81.30 -{\isafoldML}%
   81.31 -%
   81.32 -\isadelimML
   81.33 -%
   81.34 -\endisadelimML
   81.35 -%
   81.36 -\isamarkupchapter{Code generation from Isabelle theories%
   81.37 -}
   81.38 -\isamarkuptrue%
   81.39 -%
   81.40 -\isamarkupsection{Introduction%
   81.41 -}
   81.42 -\isamarkuptrue%
   81.43 -%
   81.44 -\isamarkupsubsection{Motivation%
   81.45 -}
   81.46 -\isamarkuptrue%
   81.47 -%
   81.48 -\begin{isamarkuptext}%
   81.49 -Executing formal specifications as programs is a well-established
   81.50 -  topic in the theorem proving community.  With increasing
   81.51 -  application of theorem proving systems in the area of
   81.52 -  software development and verification, its relevance manifests
   81.53 -  for running test cases and rapid prototyping.  In logical
   81.54 -  calculi like constructive type theory,
   81.55 -  a notion of executability is implicit due to the nature
   81.56 -  of the calculus.  In contrast, specifications in Isabelle
   81.57 -  can be highly non-executable.  In order to bridge
   81.58 -  the gap between logic and executable specifications,
   81.59 -  an explicit non-trivial transformation has to be applied:
   81.60 -  code generation.
   81.61 -
   81.62 -  This tutorial introduces a generic code generator for the
   81.63 -  Isabelle system \cite{isa-tutorial}.
   81.64 -  Generic in the sense that the
   81.65 -  \qn{target language} for which code shall ultimately be
   81.66 -  generated is not fixed but may be an arbitrary state-of-the-art
   81.67 -  functional programming language (currently, the implementation
   81.68 -  supports SML \cite{SML}, OCaml \cite{OCaml} and Haskell
   81.69 -  \cite{haskell-revised-report}).
   81.70 -  We aim to provide a
   81.71 -  versatile environment
   81.72 -  suitable for software development and verification,
   81.73 -  structuring the process
   81.74 -  of code generation into a small set of orthogonal principles
   81.75 -  while achieving a big coverage of application areas
   81.76 -  with maximum flexibility.
   81.77 -
   81.78 -  Conceptually the code generator framework is part
   81.79 -  of Isabelle's \isa{Pure} meta logic; the object logic
   81.80 -  \isa{HOL} which is an extension of \isa{Pure}
   81.81 -  already comes with a reasonable framework setup and thus provides
   81.82 -  a good working horse for raising code-generation-driven
   81.83 -  applications.  So, we assume some familiarity and experience
   81.84 -  with the ingredients of the \isa{HOL} \emph{Main} theory
   81.85 -  (see also \cite{isa-tutorial}).%
   81.86 -\end{isamarkuptext}%
   81.87 -\isamarkuptrue%
   81.88 -%
   81.89 -\isamarkupsubsection{Overview%
   81.90 -}
   81.91 -\isamarkuptrue%
   81.92 -%
   81.93 -\begin{isamarkuptext}%
   81.94 -The code generator aims to be usable with no further ado
   81.95 -  in most cases while allowing for detailed customization.
   81.96 -  This manifests in the structure of this tutorial:
   81.97 -  we start with a generic example \secref{sec:example}
   81.98 -  and introduce code generation concepts \secref{sec:concept}.
   81.99 -  Section
  81.100 -  \secref{sec:basics} explains how to use the framework naively,
  81.101 -  presuming a reasonable default setup.  Then, section
  81.102 -  \secref{sec:advanced} deals with advanced topics,
  81.103 -  introducing further aspects of the code generator framework
  81.104 -  in a motivation-driven manner.  Last, section \secref{sec:ml}
  81.105 -  introduces the framework's internal programming interfaces.
  81.106 -
  81.107 -  \begin{warn}
  81.108 -    Ultimately, the code generator which this tutorial deals with
  81.109 -    is supposed to replace the already established code generator
  81.110 -    by Stefan Berghofer \cite{Berghofer-Nipkow:2002}.
  81.111 -    So, for the moment, there are two distinct code generators
  81.112 -    in Isabelle.
  81.113 -    Also note that while the framework itself is
  81.114 -    object-logic independent, only \isa{HOL} provides a reasonable
  81.115 -    framework setup.    
  81.116 -  \end{warn}%
  81.117 -\end{isamarkuptext}%
  81.118 -\isamarkuptrue%
  81.119 -%
  81.120 -\isamarkupsection{An example: a simple theory of search trees \label{sec:example}%
  81.121 -}
  81.122 -\isamarkuptrue%
  81.123 -%
  81.124 -\begin{isamarkuptext}%
  81.125 -When writing executable specifications using \isa{HOL},
  81.126 -  it is convenient to use
  81.127 -  three existing packages: the datatype package for defining
  81.128 -  datatypes, the function package for (recursive) functions,
  81.129 -  and the class package for overloaded definitions.
  81.130 -
  81.131 -  We develope a small theory of search trees; trees are represented
  81.132 -  as a datatype with key type \isa{{\isacharprime}a} and value type \isa{{\isacharprime}b}:%
  81.133 -\end{isamarkuptext}%
  81.134 -\isamarkuptrue%
  81.135 -\isacommand{datatype}\isamarkupfalse%
  81.136 -\ {\isacharparenleft}{\isacharprime}a{\isacharcomma}\ {\isacharprime}b{\isacharparenright}\ searchtree\ {\isacharequal}\ Leaf\ {\isachardoublequoteopen}{\isacharprime}a{\isasymColon}linorder{\isachardoublequoteclose}\ {\isacharprime}b\isanewline
  81.137 -\ \ {\isacharbar}\ Branch\ {\isachardoublequoteopen}{\isacharparenleft}{\isacharprime}a{\isacharcomma}\ {\isacharprime}b{\isacharparenright}\ searchtree{\isachardoublequoteclose}\ {\isachardoublequoteopen}{\isacharprime}a{\isachardoublequoteclose}\ {\isachardoublequoteopen}{\isacharparenleft}{\isacharprime}a{\isacharcomma}\ {\isacharprime}b{\isacharparenright}\ searchtree{\isachardoublequoteclose}%
  81.138 -\begin{isamarkuptext}%
  81.139 -\noindent Note that we have constrained the type of keys
  81.140 -  to the class of total orders, \isa{linorder}.
  81.141 -
  81.142 -  We define \isa{find} and \isa{update} functions:%
  81.143 -\end{isamarkuptext}%
  81.144 -\isamarkuptrue%
  81.145 -\isacommand{primrec}\isamarkupfalse%
  81.146 -\isanewline
  81.147 -\ \ find\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharparenleft}{\isacharprime}a{\isasymColon}linorder{\isacharcomma}\ {\isacharprime}b{\isacharparenright}\ searchtree\ {\isasymRightarrow}\ {\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}b\ option{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  81.148 -\ \ {\isachardoublequoteopen}find\ {\isacharparenleft}Leaf\ key\ val{\isacharparenright}\ it\ {\isacharequal}\ {\isacharparenleft}if\ it\ {\isacharequal}\ key\ then\ Some\ val\ else\ None{\isacharparenright}{\isachardoublequoteclose}\isanewline
  81.149 -\ \ {\isacharbar}\ {\isachardoublequoteopen}find\ {\isacharparenleft}Branch\ t{\isadigit{1}}\ key\ t{\isadigit{2}}{\isacharparenright}\ it\ {\isacharequal}\ {\isacharparenleft}if\ it\ {\isasymle}\ key\ then\ find\ t{\isadigit{1}}\ it\ else\ find\ t{\isadigit{2}}\ it{\isacharparenright}{\isachardoublequoteclose}\isanewline
  81.150 -\isanewline
  81.151 -\isacommand{fun}\isamarkupfalse%
  81.152 -\isanewline
  81.153 -\ \ update\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a{\isasymColon}linorder\ {\isasymtimes}\ {\isacharprime}b\ {\isasymRightarrow}\ {\isacharparenleft}{\isacharprime}a{\isacharcomma}\ {\isacharprime}b{\isacharparenright}\ searchtree\ {\isasymRightarrow}\ {\isacharparenleft}{\isacharprime}a{\isacharcomma}\ {\isacharprime}b{\isacharparenright}\ searchtree{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  81.154 -\ \ {\isachardoublequoteopen}update\ {\isacharparenleft}it{\isacharcomma}\ entry{\isacharparenright}\ {\isacharparenleft}Leaf\ key\ val{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}\isanewline
  81.155 -\ \ \ \ if\ it\ {\isacharequal}\ key\ then\ Leaf\ key\ entry\isanewline
  81.156 -\ \ \ \ \ \ else\ if\ it\ {\isasymle}\ key\isanewline
  81.157 -\ \ \ \ \ \ then\ Branch\ {\isacharparenleft}Leaf\ it\ entry{\isacharparenright}\ it\ {\isacharparenleft}Leaf\ key\ val{\isacharparenright}\isanewline
  81.158 -\ \ \ \ \ \ else\ Branch\ {\isacharparenleft}Leaf\ key\ val{\isacharparenright}\ it\ {\isacharparenleft}Leaf\ it\ entry{\isacharparenright}\isanewline
  81.159 -\ \ \ {\isacharparenright}{\isachardoublequoteclose}\isanewline
  81.160 -\ \ {\isacharbar}\ {\isachardoublequoteopen}update\ {\isacharparenleft}it{\isacharcomma}\ entry{\isacharparenright}\ {\isacharparenleft}Branch\ t{\isadigit{1}}\ key\ t{\isadigit{2}}{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}\isanewline
  81.161 -\ \ \ \ if\ it\ {\isasymle}\ key\isanewline
  81.162 -\ \ \ \ \ \ then\ {\isacharparenleft}Branch\ {\isacharparenleft}update\ {\isacharparenleft}it{\isacharcomma}\ entry{\isacharparenright}\ t{\isadigit{1}}{\isacharparenright}\ key\ t{\isadigit{2}}{\isacharparenright}\isanewline
  81.163 -\ \ \ \ \ \ else\ {\isacharparenleft}Branch\ t{\isadigit{1}}\ key\ {\isacharparenleft}update\ {\isacharparenleft}it{\isacharcomma}\ entry{\isacharparenright}\ t{\isadigit{2}}{\isacharparenright}{\isacharparenright}\isanewline
  81.164 -\ \ \ {\isacharparenright}{\isachardoublequoteclose}%
  81.165 -\begin{isamarkuptext}%
  81.166 -\noindent For testing purpose, we define a small example
  81.167 -  using natural numbers \isa{nat} (which are a \isa{linorder})
  81.168 -  as keys and list of nats as values:%
  81.169 -\end{isamarkuptext}%
  81.170 -\isamarkuptrue%
  81.171 -\isacommand{definition}\isamarkupfalse%
  81.172 -\isanewline
  81.173 -\ \ example\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharparenleft}nat{\isacharcomma}\ nat\ list{\isacharparenright}\ searchtree{\isachardoublequoteclose}\isanewline
  81.174 -\isakeyword{where}\isanewline
  81.175 -\ \ {\isachardoublequoteopen}example\ {\isacharequal}\ update\ {\isacharparenleft}Suc\ {\isacharparenleft}Suc\ {\isacharparenleft}Suc\ {\isacharparenleft}Suc\ {\isadigit{0}}{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isacharcomma}\ {\isacharbrackleft}Suc\ {\isacharparenleft}Suc\ {\isadigit{0}}{\isacharparenright}{\isacharcomma}\ Suc\ {\isacharparenleft}Suc\ {\isadigit{0}}{\isacharparenright}{\isacharbrackright}{\isacharparenright}\ {\isacharparenleft}update\ {\isacharparenleft}Suc\ {\isacharparenleft}Suc\ {\isacharparenleft}Suc\ {\isadigit{0}}{\isacharparenright}{\isacharparenright}{\isacharcomma}\ {\isacharbrackleft}Suc\ {\isacharparenleft}Suc\ {\isacharparenleft}Suc\ {\isadigit{0}}{\isacharparenright}{\isacharparenright}{\isacharbrackright}{\isacharparenright}\isanewline
  81.176 -\ \ \ \ {\isacharparenleft}update\ {\isacharparenleft}Suc\ {\isacharparenleft}Suc\ {\isadigit{0}}{\isacharparenright}{\isacharcomma}\ {\isacharbrackleft}Suc\ {\isacharparenleft}Suc\ {\isadigit{0}}{\isacharparenright}{\isacharbrackright}{\isacharparenright}\ {\isacharparenleft}Leaf\ {\isacharparenleft}Suc\ {\isadigit{0}}{\isacharparenright}\ {\isacharbrackleft}{\isacharbrackright}{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}%
  81.177 -\begin{isamarkuptext}%
  81.178 -\noindent Then we generate code%
  81.179 -\end{isamarkuptext}%
  81.180 -\isamarkuptrue%
  81.181 -\isacommand{export{\isacharunderscore}code}\isamarkupfalse%
  81.182 -\ example\ \isakeyword{in}\ SML\ \isakeyword{file}\ {\isachardoublequoteopen}examples{\isacharslash}tree{\isachardot}ML{\isachardoublequoteclose}%
  81.183 -\begin{isamarkuptext}%
  81.184 -\noindent which looks like:
  81.185 -  \lstsml{Thy/examples/tree.ML}%
  81.186 -\end{isamarkuptext}%
  81.187 -\isamarkuptrue%
  81.188 -%
  81.189 -\isamarkupsection{Code generation concepts and process \label{sec:concept}%
  81.190 -}
  81.191 -\isamarkuptrue%
  81.192 -%
  81.193 -\begin{isamarkuptext}%
  81.194 -\begin{figure}[h]
  81.195 -  \centering
  81.196 -  \includegraphics[width=0.7\textwidth]{codegen_process}
  81.197 -  \caption{code generator -- processing overview}
  81.198 -  \label{fig:process}
  81.199 -  \end{figure}
  81.200 -
  81.201 -  The code generator employs a notion of executability
  81.202 -  for three foundational executable ingredients known
  81.203 -  from functional programming:
  81.204 -  \emph{defining equations}, \emph{datatypes}, and
  81.205 -  \emph{type classes}. A defining equation as a first approximation
  81.206 -  is a theorem of the form \isa{f\ t\isactrlisub {\isadigit{1}}\ t\isactrlisub {\isadigit{2}}\ {\isasymdots}\ t\isactrlisub n\ {\isasymequiv}\ t}
  81.207 -  (an equation headed by a constant \isa{f} with arguments
  81.208 -  \isa{t\isactrlisub {\isadigit{1}}\ t\isactrlisub {\isadigit{2}}\ {\isasymdots}\ t\isactrlisub n} and right hand side \isa{t}).
  81.209 -  Code generation aims to turn defining equations
  81.210 -  into a functional program by running through
  81.211 -  a process (see figure \ref{fig:process}):
  81.212 -
  81.213 -  \begin{itemize}
  81.214 -
  81.215 -    \item Out of the vast collection of theorems proven in a
  81.216 -      \qn{theory}, a reasonable subset modeling
  81.217 -      defining equations is \qn{selected}.
  81.218 -
  81.219 -    \item On those selected theorems, certain
  81.220 -      transformations are carried out
  81.221 -      (\qn{preprocessing}).  Their purpose is to turn theorems
  81.222 -      representing non- or badly executable
  81.223 -      specifications into equivalent but executable counterparts.
  81.224 -      The result is a structured collection of \qn{code theorems}.
  81.225 -
  81.226 -    \item These \qn{code theorems} then are \qn{translated}
  81.227 -      into an Haskell-like intermediate
  81.228 -      language.
  81.229 -
  81.230 -    \item Finally, out of the intermediate language the final
  81.231 -      code in the desired \qn{target language} is \qn{serialized}.
  81.232 -
  81.233 -  \end{itemize}
  81.234 -
  81.235 -  From these steps, only the two last are carried out
  81.236 -  outside the logic; by keeping this layer as
  81.237 -  thin as possible, the amount of code to trust is
  81.238 -  kept to a minimum.%
  81.239 -\end{isamarkuptext}%
  81.240 -\isamarkuptrue%
  81.241 -%
  81.242 -\isamarkupsection{Basics \label{sec:basics}%
  81.243 -}
  81.244 -\isamarkuptrue%
  81.245 -%
  81.246 -\isamarkupsubsection{Invoking the code generator%
  81.247 -}
  81.248 -\isamarkuptrue%
  81.249 -%
  81.250 -\begin{isamarkuptext}%
  81.251 -Thanks to a reasonable setup of the \isa{HOL} theories, in
  81.252 -  most cases code generation proceeds without further ado:%
  81.253 -\end{isamarkuptext}%
  81.254 -\isamarkuptrue%
  81.255 -\isacommand{primrec}\isamarkupfalse%
  81.256 -\isanewline
  81.257 -\ \ fac\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ nat{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  81.258 -\ \ \ \ {\isachardoublequoteopen}fac\ {\isadigit{0}}\ {\isacharequal}\ {\isadigit{1}}{\isachardoublequoteclose}\isanewline
  81.259 -\ \ {\isacharbar}\ {\isachardoublequoteopen}fac\ {\isacharparenleft}Suc\ n{\isacharparenright}\ {\isacharequal}\ Suc\ n\ {\isacharasterisk}\ fac\ n{\isachardoublequoteclose}%
  81.260 -\begin{isamarkuptext}%
  81.261 -\noindent This executable specification is now turned to SML code:%
  81.262 -\end{isamarkuptext}%
  81.263 -\isamarkuptrue%
  81.264 -\isacommand{export{\isacharunderscore}code}\isamarkupfalse%
  81.265 -\ fac\ \isakeyword{in}\ SML\ \isakeyword{file}\ {\isachardoublequoteopen}examples{\isacharslash}fac{\isachardot}ML{\isachardoublequoteclose}%
  81.266 -\begin{isamarkuptext}%
  81.267 -\noindent  The \isa{{\isasymEXPORTCODE}} command takes a space-separated list of
  81.268 -  constants together with \qn{serialization directives}
  81.269 -  These start with a \qn{target language}
  81.270 -  identifier, followed by a file specification
  81.271 -  where to write the generated code to.
  81.272 -
  81.273 -  Internally, the defining equations for all selected
  81.274 -  constants are taken, including any transitively required
  81.275 -  constants, datatypes and classes, resulting in the following
  81.276 -  code:
  81.277 -
  81.278 -  \lstsml{Thy/examples/fac.ML}
  81.279 -
  81.280 -  The code generator will complain when a required
  81.281 -  ingredient does not provide a executable counterpart,
  81.282 -  e.g.~generating code
  81.283 -  for constants not yielding
  81.284 -  a defining equation (e.g.~the Hilbert choice
  81.285 -  operation \isa{SOME}):%
  81.286 -\end{isamarkuptext}%
  81.287 -\isamarkuptrue%
  81.288 -%
  81.289 -\isadelimML
  81.290 -%
  81.291 -\endisadelimML
  81.292 -%
  81.293 -\isatagML
  81.294 -%
  81.295 -\endisatagML
  81.296 -{\isafoldML}%
  81.297 -%
  81.298 -\isadelimML
  81.299 -%
  81.300 -\endisadelimML
  81.301 -\isacommand{definition}\isamarkupfalse%
  81.302 -\isanewline
  81.303 -\ \ pick{\isacharunderscore}some\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a\ list\ {\isasymRightarrow}\ {\isacharprime}a{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  81.304 -\ \ {\isachardoublequoteopen}pick{\isacharunderscore}some\ xs\ {\isacharequal}\ {\isacharparenleft}SOME\ x{\isachardot}\ x\ {\isasymin}\ set\ xs{\isacharparenright}{\isachardoublequoteclose}%
  81.305 -\isadelimML
  81.306 -%
  81.307 -\endisadelimML
  81.308 -%
  81.309 -\isatagML
  81.310 -%
  81.311 -\endisatagML
  81.312 -{\isafoldML}%
  81.313 -%
  81.314 -\isadelimML
  81.315 -%
  81.316 -\endisadelimML
  81.317 -\isanewline
  81.318 -\isacommand{export{\isacharunderscore}code}\isamarkupfalse%
  81.319 -\ pick{\isacharunderscore}some\ \isakeyword{in}\ SML\ \isakeyword{file}\ {\isachardoublequoteopen}examples{\isacharslash}fail{\isacharunderscore}const{\isachardot}ML{\isachardoublequoteclose}%
  81.320 -\begin{isamarkuptext}%
  81.321 -\noindent will fail.%
  81.322 -\end{isamarkuptext}%
  81.323 -\isamarkuptrue%
  81.324 -%
  81.325 -\isamarkupsubsection{Theorem selection%
  81.326 -}
  81.327 -\isamarkuptrue%
  81.328 -%
  81.329 -\begin{isamarkuptext}%
  81.330 -The list of all defining equations in a theory may be inspected
  81.331 -  using the \isa{{\isasymPRINTCODESETUP}} command:%
  81.332 -\end{isamarkuptext}%
  81.333 -\isamarkuptrue%
  81.334 -\isacommand{print{\isacharunderscore}codesetup}\isamarkupfalse%
  81.335 -%
  81.336 -\begin{isamarkuptext}%
  81.337 -\noindent which displays a table of constant with corresponding
  81.338 -  defining equations (the additional stuff displayed
  81.339 -  shall not bother us for the moment).
  81.340 -
  81.341 -  The typical \isa{HOL} tools are already set up in a way that
  81.342 -  function definitions introduced by \isa{{\isasymDEFINITION}},
  81.343 -  \isa{{\isasymPRIMREC}}, \isa{{\isasymFUN}},
  81.344 -  \isa{{\isasymFUNCTION}}, \isa{{\isasymCONSTDEFS}},
  81.345 -  \isa{{\isasymRECDEF}} are implicitly propagated
  81.346 -  to this defining equation table. Specific theorems may be
  81.347 -  selected using an attribute: \emph{code func}. As example,
  81.348 -  a weight selector function:%
  81.349 -\end{isamarkuptext}%
  81.350 -\isamarkuptrue%
  81.351 -\isacommand{primrec}\isamarkupfalse%
  81.352 -\isanewline
  81.353 -\ \ pick\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharparenleft}nat\ {\isasymtimes}\ {\isacharprime}a{\isacharparenright}\ list\ {\isasymRightarrow}\ nat\ {\isasymRightarrow}\ {\isacharprime}a{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  81.354 -\ \ {\isachardoublequoteopen}pick\ {\isacharparenleft}x{\isacharhash}xs{\isacharparenright}\ n\ {\isacharequal}\ {\isacharparenleft}let\ {\isacharparenleft}k{\isacharcomma}\ v{\isacharparenright}\ {\isacharequal}\ x\ in\isanewline
  81.355 -\ \ \ \ if\ n\ {\isacharless}\ k\ then\ v\ else\ pick\ xs\ {\isacharparenleft}n\ {\isacharminus}\ k{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}%
  81.356 -\begin{isamarkuptext}%
  81.357 -\noindent We want to eliminate the explicit destruction
  81.358 -  of \isa{x} to \isa{{\isacharparenleft}k{\isacharcomma}\ v{\isacharparenright}}:%
  81.359 -\end{isamarkuptext}%
  81.360 -\isamarkuptrue%
  81.361 -\isacommand{lemma}\isamarkupfalse%
  81.362 -\ {\isacharbrackleft}code\ func{\isacharbrackright}{\isacharcolon}\isanewline
  81.363 -\ \ {\isachardoublequoteopen}pick\ {\isacharparenleft}{\isacharparenleft}k{\isacharcomma}\ v{\isacharparenright}{\isacharhash}xs{\isacharparenright}\ n\ {\isacharequal}\ {\isacharparenleft}if\ n\ {\isacharless}\ k\ then\ v\ else\ pick\ xs\ {\isacharparenleft}n\ {\isacharminus}\ k{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}\isanewline
  81.364 -%
  81.365 -\isadelimproof
  81.366 -\ \ %
  81.367 -\endisadelimproof
  81.368 -%
  81.369 -\isatagproof
  81.370 -\isacommand{by}\isamarkupfalse%
  81.371 -\ simp%
  81.372 -\endisatagproof
  81.373 -{\isafoldproof}%
  81.374 -%
  81.375 -\isadelimproof
  81.376 -\isanewline
  81.377 -%
  81.378 -\endisadelimproof
  81.379 -\isanewline
  81.380 -\isacommand{export{\isacharunderscore}code}\isamarkupfalse%
  81.381 -\ pick\ \ \isakeyword{in}\ SML\ \isakeyword{file}\ {\isachardoublequoteopen}examples{\isacharslash}pick{\isadigit{1}}{\isachardot}ML{\isachardoublequoteclose}%
  81.382 -\begin{isamarkuptext}%
  81.383 -\noindent This theorem now is used for generating code:
  81.384 -
  81.385 -  \lstsml{Thy/examples/pick1.ML}
  81.386 -
  81.387 -  \noindent The policy is that \emph{default equations} stemming from
  81.388 -  \isa{{\isasymDEFINITION}},
  81.389 -  \isa{{\isasymPRIMREC}}, \isa{{\isasymFUN}},
  81.390 -  \isa{{\isasymFUNCTION}}, \isa{{\isasymCONSTDEFS}},
  81.391 -  \isa{{\isasymRECDEF}} statements are discarded as soon as an
  81.392 -  equation is explicitly selected by means of \emph{code func}.
  81.393 -  Further applications of \emph{code func} add theorems incrementally,
  81.394 -  but syntactic redundancies are implicitly dropped.  For example,
  81.395 -  using a modified version of the \isa{fac} function
  81.396 -  as defining equation, the then redundant (since
  81.397 -  syntactically subsumed) original defining equations
  81.398 -  are dropped.
  81.399 -
  81.400 -  \begin{warn}
  81.401 -    The attributes \emph{code} and \emph{code del}
  81.402 -    associated with the existing code generator also apply to
  81.403 -    the new one: \emph{code} implies \emph{code func},
  81.404 -    and \emph{code del} implies \emph{code func del}.
  81.405 -  \end{warn}%
  81.406 -\end{isamarkuptext}%
  81.407 -\isamarkuptrue%
  81.408 -%
  81.409 -\isamarkupsubsection{Type classes%
  81.410 -}
  81.411 -\isamarkuptrue%
  81.412 -%
  81.413 -\begin{isamarkuptext}%
  81.414 -Type classes enter the game via the Isar class package.
  81.415 -  For a short introduction how to use it, see \cite{isabelle-classes};
  81.416 -  here we just illustrate its impact on code generation.
  81.417 -
  81.418 -  In a target language, type classes may be represented
  81.419 -  natively (as in the case of Haskell).  For languages
  81.420 -  like SML, they are implemented using \emph{dictionaries}.
  81.421 -  Our following example specifies a class \qt{null},
  81.422 -  assigning to each of its inhabitants a \qt{null} value:%
  81.423 -\end{isamarkuptext}%
  81.424 -\isamarkuptrue%
  81.425 -\isacommand{class}\isamarkupfalse%
  81.426 -\ null\ {\isacharequal}\ type\ {\isacharplus}\isanewline
  81.427 -\ \ \isakeyword{fixes}\ null\ {\isacharcolon}{\isacharcolon}\ {\isacharprime}a\isanewline
  81.428 -\isanewline
  81.429 -\isacommand{primrec}\isamarkupfalse%
  81.430 -\isanewline
  81.431 -\ \ head\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a{\isasymColon}null\ list\ {\isasymRightarrow}\ {\isacharprime}a{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  81.432 -\ \ {\isachardoublequoteopen}head\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharequal}\ null{\isachardoublequoteclose}\isanewline
  81.433 -\ \ {\isacharbar}\ {\isachardoublequoteopen}head\ {\isacharparenleft}x{\isacharhash}xs{\isacharparenright}\ {\isacharequal}\ x{\isachardoublequoteclose}%
  81.434 -\begin{isamarkuptext}%
  81.435 -\noindent  We provide some instances for our \isa{null}:%
  81.436 -\end{isamarkuptext}%
  81.437 -\isamarkuptrue%
  81.438 -\isacommand{instantiation}\isamarkupfalse%
  81.439 -\ option\ \isakeyword{and}\ list\ {\isacharcolon}{\isacharcolon}\ {\isacharparenleft}type{\isacharparenright}\ null\isanewline
  81.440 -\isakeyword{begin}\isanewline
  81.441 -\isanewline
  81.442 -\isacommand{definition}\isamarkupfalse%
  81.443 -\isanewline
  81.444 -\ \ {\isachardoublequoteopen}null\ {\isacharequal}\ None{\isachardoublequoteclose}\isanewline
  81.445 -\isanewline
  81.446 -\isacommand{definition}\isamarkupfalse%
  81.447 -\isanewline
  81.448 -\ \ {\isachardoublequoteopen}null\ {\isacharequal}\ {\isacharbrackleft}{\isacharbrackright}{\isachardoublequoteclose}\isanewline
  81.449 -\isanewline
  81.450 -\isacommand{instance}\isamarkupfalse%
  81.451 -%
  81.452 -\isadelimproof
  81.453 -\ %
  81.454 -\endisadelimproof
  81.455 -%
  81.456 -\isatagproof
  81.457 -\isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
  81.458 -%
  81.459 -\endisatagproof
  81.460 -{\isafoldproof}%
  81.461 -%
  81.462 -\isadelimproof
  81.463 -%
  81.464 -\endisadelimproof
  81.465 -\isanewline
  81.466 -\isanewline
  81.467 -\isacommand{end}\isamarkupfalse%
  81.468 -%
  81.469 -\begin{isamarkuptext}%
  81.470 -\noindent Constructing a dummy example:%
  81.471 -\end{isamarkuptext}%
  81.472 -\isamarkuptrue%
  81.473 -\isacommand{definition}\isamarkupfalse%
  81.474 -\isanewline
  81.475 -\ \ {\isachardoublequoteopen}dummy\ {\isacharequal}\ head\ {\isacharbrackleft}Some\ {\isacharparenleft}Suc\ {\isadigit{0}}{\isacharparenright}{\isacharcomma}\ None{\isacharbrackright}{\isachardoublequoteclose}%
  81.476 -\begin{isamarkuptext}%
  81.477 -Type classes offer a suitable occasion to introduce
  81.478 -  the Haskell serializer.  Its usage is almost the same
  81.479 -  as SML, but, in accordance with conventions
  81.480 -  some Haskell systems enforce, each module ends
  81.481 -  up in a single file. The module hierarchy is reflected in
  81.482 -  the file system, with root directory given as file specification.%
  81.483 -\end{isamarkuptext}%
  81.484 -\isamarkuptrue%
  81.485 -\isacommand{export{\isacharunderscore}code}\isamarkupfalse%
  81.486 -\ dummy\ \isakeyword{in}\ Haskell\ \isakeyword{file}\ {\isachardoublequoteopen}examples{\isacharslash}{\isachardoublequoteclose}%
  81.487 -\begin{isamarkuptext}%
  81.488 -\lsthaskell{Thy/examples/Codegen.hs}
  81.489 -  \noindent (we have left out all other modules).
  81.490 -
  81.491 -  \medskip
  81.492 -
  81.493 -  The whole code in SML with explicit dictionary passing:%
  81.494 -\end{isamarkuptext}%
  81.495 -\isamarkuptrue%
  81.496 -\isacommand{export{\isacharunderscore}code}\isamarkupfalse%
  81.497 -\ dummy\ \isakeyword{in}\ SML\ \isakeyword{file}\ {\isachardoublequoteopen}examples{\isacharslash}class{\isachardot}ML{\isachardoublequoteclose}%
  81.498 -\begin{isamarkuptext}%
  81.499 -\lstsml{Thy/examples/class.ML}
  81.500 -
  81.501 -  \medskip
  81.502 -
  81.503 -  \noindent or in OCaml:%
  81.504 -\end{isamarkuptext}%
  81.505 -\isamarkuptrue%
  81.506 -\isacommand{export{\isacharunderscore}code}\isamarkupfalse%
  81.507 -\ dummy\ \isakeyword{in}\ OCaml\ \isakeyword{file}\ {\isachardoublequoteopen}examples{\isacharslash}class{\isachardot}ocaml{\isachardoublequoteclose}%
  81.508 -\begin{isamarkuptext}%
  81.509 -\lstsml{Thy/examples/class.ocaml}
  81.510 -
  81.511 -  \medskip The explicit association of constants
  81.512 -  to classes can be inspected using the \isa{{\isasymPRINTCLASSES}}
  81.513 -  command.%
  81.514 -\end{isamarkuptext}%
  81.515 -\isamarkuptrue%
  81.516 -%
  81.517 -\isamarkupsection{Recipes and advanced topics \label{sec:advanced}%
  81.518 -}
  81.519 -\isamarkuptrue%
  81.520 -%
  81.521 -\begin{isamarkuptext}%
  81.522 -In this tutorial, we do not attempt to give an exhaustive
  81.523 -  description of the code generator framework; instead,
  81.524 -  we cast a light on advanced topics by introducing
  81.525 -  them together with practically motivated examples.  Concerning
  81.526 -  further reading, see
  81.527 -
  81.528 -  \begin{itemize}
  81.529 -
  81.530 -  \item the Isabelle/Isar Reference Manual \cite{isabelle-isar-ref}
  81.531 -    for exhaustive syntax diagrams.
  81.532 -  \item or \cite{Haftmann-Nipkow:2007:codegen} which deals with foundational issues
  81.533 -    of the code generator framework.
  81.534 -
  81.535 -  \end{itemize}%
  81.536 -\end{isamarkuptext}%
  81.537 -\isamarkuptrue%
  81.538 -%
  81.539 -\isamarkupsubsection{Library theories \label{sec:library}%
  81.540 -}
  81.541 -\isamarkuptrue%
  81.542 -%
  81.543 -\begin{isamarkuptext}%
  81.544 -The \isa{HOL} \isa{Main} theory already provides a code
  81.545 -  generator setup
  81.546 -  which should be suitable for most applications. Common extensions
  81.547 -  and modifications are available by certain theories of the \isa{HOL}
  81.548 -  library; beside being useful in applications, they may serve
  81.549 -  as a tutorial for customizing the code generator setup.
  81.550 -
  81.551 -  \begin{description}
  81.552 -
  81.553 -    \item[\isa{Code{\isacharunderscore}Integer}] represents \isa{HOL} integers by big
  81.554 -       integer literals in target languages.
  81.555 -    \item[\isa{Code{\isacharunderscore}Char}] represents \isa{HOL} characters by 
  81.556 -       character literals in target languages.
  81.557 -    \item[\isa{Code{\isacharunderscore}Char{\isacharunderscore}chr}] like \isa{Code{\isacharunderscore}Char},
  81.558 -       but also offers treatment of character codes; includes
  81.559 -       \isa{Code{\isacharunderscore}Integer}.
  81.560 -    \item[\isa{Efficient{\isacharunderscore}Nat}] \label{eff_nat} implements natural numbers by integers,
  81.561 -       which in general will result in higher efficency; pattern
  81.562 -       matching with \isa{{\isadigit{0}}} / \isa{Suc}
  81.563 -       is eliminated;  includes \isa{Code{\isacharunderscore}Integer}.
  81.564 -    \item[\isa{Code{\isacharunderscore}Index}] provides an additional datatype
  81.565 -       \isa{index} which is mapped to target-language built-in integers.
  81.566 -       Useful for code setups which involve e.g. indexing of
  81.567 -       target-language arrays.
  81.568 -    \item[\isa{Code{\isacharunderscore}Message}] provides an additional datatype
  81.569 -       \isa{message{\isacharunderscore}string} which is isomorphic to strings;
  81.570 -       \isa{message{\isacharunderscore}string}s are mapped to target-language strings.
  81.571 -       Useful for code setups which involve e.g. printing (error) messages.
  81.572 -
  81.573 -  \end{description}
  81.574 -
  81.575 -  \begin{warn}
  81.576 -    When importing any of these theories, they should form the last
  81.577 -    items in an import list.  Since these theories adapt the
  81.578 -    code generator setup in a non-conservative fashion,
  81.579 -    strange effects may occur otherwise.
  81.580 -  \end{warn}%
  81.581 -\end{isamarkuptext}%
  81.582 -\isamarkuptrue%
  81.583 -%
  81.584 -\isamarkupsubsection{Preprocessing%
  81.585 -}
  81.586 -\isamarkuptrue%
  81.587 -%
  81.588 -\begin{isamarkuptext}%
  81.589 -Before selected function theorems are turned into abstract
  81.590 -  code, a chain of definitional transformation steps is carried
  81.591 -  out: \emph{preprocessing}.  In essence, the preprocessor
  81.592 -  consists of two components: a \emph{simpset} and \emph{function transformers}.
  81.593 -
  81.594 -  The \emph{simpset} allows to employ the full generality of the Isabelle
  81.595 -  simplifier.  Due to the interpretation of theorems
  81.596 -  as defining equations, rewrites are applied to the right
  81.597 -  hand side and the arguments of the left hand side of an
  81.598 -  equation, but never to the constant heading the left hand side.
  81.599 -  An important special case are \emph{inline theorems} which may be
  81.600 -  declared an undeclared using the
  81.601 -  \emph{code inline} or \emph{code inline del} attribute respectively.
  81.602 -  Some common applications:%
  81.603 -\end{isamarkuptext}%
  81.604 -\isamarkuptrue%
  81.605 -%
  81.606 -\begin{itemize}
  81.607 -%
  81.608 -\begin{isamarkuptext}%
  81.609 -\item replacing non-executable constructs by executable ones:%
  81.610 -\end{isamarkuptext}%
  81.611 -\isamarkuptrue%
  81.612 -\ \ \isacommand{lemma}\isamarkupfalse%
  81.613 -\ {\isacharbrackleft}code\ inline{\isacharbrackright}{\isacharcolon}\isanewline
  81.614 -\ \ \ \ {\isachardoublequoteopen}x\ {\isasymin}\ set\ xs\ {\isasymlongleftrightarrow}\ x\ mem\ xs{\isachardoublequoteclose}%
  81.615 -\isadelimproof
  81.616 -\ %
  81.617 -\endisadelimproof
  81.618 -%
  81.619 -\isatagproof
  81.620 -\isacommand{by}\isamarkupfalse%
  81.621 -\ {\isacharparenleft}induct\ xs{\isacharparenright}\ simp{\isacharunderscore}all%
  81.622 -\endisatagproof
  81.623 -{\isafoldproof}%
  81.624 -%
  81.625 -\isadelimproof
  81.626 -%
  81.627 -\endisadelimproof
  81.628 -%
  81.629 -\begin{isamarkuptext}%
  81.630 -\item eliminating superfluous constants:%
  81.631 -\end{isamarkuptext}%
  81.632 -\isamarkuptrue%
  81.633 -\ \ \isacommand{lemma}\isamarkupfalse%
  81.634 -\ {\isacharbrackleft}code\ inline{\isacharbrackright}{\isacharcolon}\isanewline
  81.635 -\ \ \ \ {\isachardoublequoteopen}{\isadigit{1}}\ {\isacharequal}\ Suc\ {\isadigit{0}}{\isachardoublequoteclose}%
  81.636 -\isadelimproof
  81.637 -\ %
  81.638 -\endisadelimproof
  81.639 -%
  81.640 -\isatagproof
  81.641 -\isacommand{by}\isamarkupfalse%
  81.642 -\ simp%
  81.643 -\endisatagproof
  81.644 -{\isafoldproof}%
  81.645 -%
  81.646 -\isadelimproof
  81.647 -%
  81.648 -\endisadelimproof
  81.649 -%
  81.650 -\begin{isamarkuptext}%
  81.651 -\item replacing executable but inconvenient constructs:%
  81.652 -\end{isamarkuptext}%
  81.653 -\isamarkuptrue%
  81.654 -\ \ \isacommand{lemma}\isamarkupfalse%
  81.655 -\ {\isacharbrackleft}code\ inline{\isacharbrackright}{\isacharcolon}\isanewline
  81.656 -\ \ \ \ {\isachardoublequoteopen}xs\ {\isacharequal}\ {\isacharbrackleft}{\isacharbrackright}\ {\isasymlongleftrightarrow}\ List{\isachardot}null\ xs{\isachardoublequoteclose}%
  81.657 -\isadelimproof
  81.658 -\ %
  81.659 -\endisadelimproof
  81.660 -%
  81.661 -\isatagproof
  81.662 -\isacommand{by}\isamarkupfalse%
  81.663 -\ {\isacharparenleft}induct\ xs{\isacharparenright}\ simp{\isacharunderscore}all%
  81.664 -\endisatagproof
  81.665 -{\isafoldproof}%
  81.666 -%
  81.667 -\isadelimproof
  81.668 -%
  81.669 -\endisadelimproof
  81.670 -%
  81.671 -\end{itemize}
  81.672 -%
  81.673 -\begin{isamarkuptext}%
  81.674 -\emph{Function transformers} provide a very general interface,
  81.675 -  transforming a list of function theorems to another
  81.676 -  list of function theorems, provided that neither the heading
  81.677 -  constant nor its type change.  The \isa{{\isadigit{0}}} / \isa{Suc}
  81.678 -  pattern elimination implemented in
  81.679 -  theory \isa{Efficient{\isacharunderscore}Nat} (see \secref{eff_nat}) uses this
  81.680 -  interface.
  81.681 -
  81.682 -  \noindent The current setup of the preprocessor may be inspected using
  81.683 -  the \isa{{\isasymPRINTCODESETUP}} command.
  81.684 -
  81.685 -  \begin{warn}
  81.686 -    The attribute \emph{code unfold}
  81.687 -    associated with the existing code generator also applies to
  81.688 -    the new one: \emph{code unfold} implies \emph{code inline}.
  81.689 -  \end{warn}%
  81.690 -\end{isamarkuptext}%
  81.691 -\isamarkuptrue%
  81.692 -%
  81.693 -\isamarkupsubsection{Concerning operational equality%
  81.694 -}
  81.695 -\isamarkuptrue%
  81.696 -%
  81.697 -\begin{isamarkuptext}%
  81.698 -Surely you have already noticed how equality is treated
  81.699 -  by the code generator:%
  81.700 -\end{isamarkuptext}%
  81.701 -\isamarkuptrue%
  81.702 -\isacommand{primrec}\isamarkupfalse%
  81.703 -\isanewline
  81.704 -\ \ collect{\isacharunderscore}duplicates\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a\ list\ {\isasymRightarrow}\ {\isacharprime}a\ list\ {\isasymRightarrow}\ {\isacharprime}a\ list\ {\isasymRightarrow}\ {\isacharprime}a\ list{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  81.705 -\ \ \ \ {\isachardoublequoteopen}collect{\isacharunderscore}duplicates\ xs\ ys\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharequal}\ xs{\isachardoublequoteclose}\isanewline
  81.706 -\ \ {\isacharbar}\ {\isachardoublequoteopen}collect{\isacharunderscore}duplicates\ xs\ ys\ {\isacharparenleft}z{\isacharhash}zs{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}if\ z\ {\isasymin}\ set\ xs\isanewline
  81.707 -\ \ \ \ \ \ then\ if\ z\ {\isasymin}\ set\ ys\isanewline
  81.708 -\ \ \ \ \ \ \ \ then\ collect{\isacharunderscore}duplicates\ xs\ ys\ zs\isanewline
  81.709 -\ \ \ \ \ \ \ \ else\ collect{\isacharunderscore}duplicates\ xs\ {\isacharparenleft}z{\isacharhash}ys{\isacharparenright}\ zs\isanewline
  81.710 -\ \ \ \ \ \ else\ collect{\isacharunderscore}duplicates\ {\isacharparenleft}z{\isacharhash}xs{\isacharparenright}\ {\isacharparenleft}z{\isacharhash}ys{\isacharparenright}\ zs{\isacharparenright}{\isachardoublequoteclose}%
  81.711 -\begin{isamarkuptext}%
  81.712 -The membership test during preprocessing is rewritten,
  81.713 -  resulting in \isa{op\ mem}, which itself
  81.714 -  performs an explicit equality check.%
  81.715 -\end{isamarkuptext}%
  81.716 -\isamarkuptrue%
  81.717 -\isacommand{export{\isacharunderscore}code}\isamarkupfalse%
  81.718 -\ collect{\isacharunderscore}duplicates\ \isakeyword{in}\ SML\ \isakeyword{file}\ {\isachardoublequoteopen}examples{\isacharslash}collect{\isacharunderscore}duplicates{\isachardot}ML{\isachardoublequoteclose}%
  81.719 -\begin{isamarkuptext}%
  81.720 -\lstsml{Thy/examples/collect_duplicates.ML}%
  81.721 -\end{isamarkuptext}%
  81.722 -\isamarkuptrue%
  81.723 -%
  81.724 -\begin{isamarkuptext}%
  81.725 -Obviously, polymorphic equality is implemented the Haskell
  81.726 -  way using a type class.  How is this achieved?  HOL introduces
  81.727 -  an explicit class \isa{eq} with a corresponding operation
  81.728 -  \isa{eq{\isacharunderscore}class{\isachardot}eq} such that \isa{eq{\isacharunderscore}class{\isachardot}eq\ x\ y\ {\isacharequal}\ {\isacharparenleft}x\ {\isacharequal}\ y{\isacharparenright}}.
  81.729 -  The preprocessing framework does the rest.
  81.730 -  For datatypes, instances of \isa{eq} are implicitly derived
  81.731 -  when possible.  For other types, you may instantiate \isa{eq}
  81.732 -  manually like any other type class.
  81.733 -
  81.734 -  Though this \isa{eq} class is designed to get rarely in
  81.735 -  the way, a subtlety
  81.736 -  enters the stage when definitions of overloaded constants
  81.737 -  are dependent on operational equality.  For example, let
  81.738 -  us define a lexicographic ordering on tuples:%
  81.739 -\end{isamarkuptext}%
  81.740 -\isamarkuptrue%
  81.741 -\isacommand{instantiation}\isamarkupfalse%
  81.742 -\ {\isacharasterisk}\ {\isacharcolon}{\isacharcolon}\ {\isacharparenleft}ord{\isacharcomma}\ ord{\isacharparenright}\ ord\isanewline
  81.743 -\isakeyword{begin}\isanewline
  81.744 -\isanewline
  81.745 -\isacommand{definition}\isamarkupfalse%
  81.746 -\isanewline
  81.747 -\ \ {\isacharbrackleft}code\ func\ del{\isacharbrackright}{\isacharcolon}\ {\isachardoublequoteopen}p{\isadigit{1}}\ {\isacharless}\ p{\isadigit{2}}\ {\isasymlongleftrightarrow}\ {\isacharparenleft}let\ {\isacharparenleft}x{\isadigit{1}}{\isacharcomma}\ y{\isadigit{1}}{\isacharparenright}\ {\isacharequal}\ p{\isadigit{1}}{\isacharsemicolon}\ {\isacharparenleft}x{\isadigit{2}}{\isacharcomma}\ y{\isadigit{2}}{\isacharparenright}\ {\isacharequal}\ p{\isadigit{2}}\ in\isanewline
  81.748 -\ \ \ \ x{\isadigit{1}}\ {\isacharless}\ x{\isadigit{2}}\ {\isasymor}\ {\isacharparenleft}x{\isadigit{1}}\ {\isacharequal}\ x{\isadigit{2}}\ {\isasymand}\ y{\isadigit{1}}\ {\isacharless}\ y{\isadigit{2}}{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}\isanewline
  81.749 -\isanewline
  81.750 -\isacommand{definition}\isamarkupfalse%
  81.751 -\isanewline
  81.752 -\ \ {\isacharbrackleft}code\ func\ del{\isacharbrackright}{\isacharcolon}\ {\isachardoublequoteopen}p{\isadigit{1}}\ {\isasymle}\ p{\isadigit{2}}\ {\isasymlongleftrightarrow}\ {\isacharparenleft}let\ {\isacharparenleft}x{\isadigit{1}}{\isacharcomma}\ y{\isadigit{1}}{\isacharparenright}\ {\isacharequal}\ p{\isadigit{1}}{\isacharsemicolon}\ {\isacharparenleft}x{\isadigit{2}}{\isacharcomma}\ y{\isadigit{2}}{\isacharparenright}\ {\isacharequal}\ p{\isadigit{2}}\ in\isanewline
  81.753 -\ \ \ \ x{\isadigit{1}}\ {\isacharless}\ x{\isadigit{2}}\ {\isasymor}\ {\isacharparenleft}x{\isadigit{1}}\ {\isacharequal}\ x{\isadigit{2}}\ {\isasymand}\ y{\isadigit{1}}\ {\isasymle}\ y{\isadigit{2}}{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}\isanewline
  81.754 -\isanewline
  81.755 -\isacommand{instance}\isamarkupfalse%
  81.756 -%
  81.757 -\isadelimproof
  81.758 -\ %
  81.759 -\endisadelimproof
  81.760 -%
  81.761 -\isatagproof
  81.762 -\isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
  81.763 -%
  81.764 -\endisatagproof
  81.765 -{\isafoldproof}%
  81.766 -%
  81.767 -\isadelimproof
  81.768 -%
  81.769 -\endisadelimproof
  81.770 -\isanewline
  81.771 -\isanewline
  81.772 -\isacommand{end}\isamarkupfalse%
  81.773 -\isanewline
  81.774 -\isanewline
  81.775 -\isacommand{lemma}\isamarkupfalse%
  81.776 -\ ord{\isacharunderscore}prod\ {\isacharbrackleft}code\ func{\isacharbrackright}{\isacharcolon}\isanewline
  81.777 -\ \ {\isachardoublequoteopen}{\isacharparenleft}x{\isadigit{1}}\ {\isasymColon}\ {\isacharprime}a{\isasymColon}ord{\isacharcomma}\ y{\isadigit{1}}\ {\isasymColon}\ {\isacharprime}b{\isasymColon}ord{\isacharparenright}\ {\isacharless}\ {\isacharparenleft}x{\isadigit{2}}{\isacharcomma}\ y{\isadigit{2}}{\isacharparenright}\ {\isasymlongleftrightarrow}\ x{\isadigit{1}}\ {\isacharless}\ x{\isadigit{2}}\ {\isasymor}\ {\isacharparenleft}x{\isadigit{1}}\ {\isacharequal}\ x{\isadigit{2}}\ {\isasymand}\ y{\isadigit{1}}\ {\isacharless}\ y{\isadigit{2}}{\isacharparenright}{\isachardoublequoteclose}\isanewline
  81.778 -\ \ {\isachardoublequoteopen}{\isacharparenleft}x{\isadigit{1}}\ {\isasymColon}\ {\isacharprime}a{\isasymColon}ord{\isacharcomma}\ y{\isadigit{1}}\ {\isasymColon}\ {\isacharprime}b{\isasymColon}ord{\isacharparenright}\ {\isasymle}\ {\isacharparenleft}x{\isadigit{2}}{\isacharcomma}\ y{\isadigit{2}}{\isacharparenright}\ {\isasymlongleftrightarrow}\ x{\isadigit{1}}\ {\isacharless}\ x{\isadigit{2}}\ {\isasymor}\ {\isacharparenleft}x{\isadigit{1}}\ {\isacharequal}\ x{\isadigit{2}}\ {\isasymand}\ y{\isadigit{1}}\ {\isasymle}\ y{\isadigit{2}}{\isacharparenright}{\isachardoublequoteclose}\isanewline
  81.779 -%
  81.780 -\isadelimproof
  81.781 -\ \ %
  81.782 -\endisadelimproof
  81.783 -%
  81.784 -\isatagproof
  81.785 -\isacommand{unfolding}\isamarkupfalse%
  81.786 -\ less{\isacharunderscore}prod{\isacharunderscore}def\ less{\isacharunderscore}eq{\isacharunderscore}prod{\isacharunderscore}def\ \isacommand{by}\isamarkupfalse%
  81.787 -\ simp{\isacharunderscore}all%
  81.788 -\endisatagproof
  81.789 -{\isafoldproof}%
  81.790 -%
  81.791 -\isadelimproof
  81.792 -%
  81.793 -\endisadelimproof
  81.794 -%
  81.795 -\begin{isamarkuptext}%
  81.796 -Then code generation will fail.  Why?  The definition
  81.797 -  of \isa{op\ {\isasymle}} depends on equality on both arguments,
  81.798 -  which are polymorphic and impose an additional \isa{eq}
  81.799 -  class constraint, thus violating the type discipline
  81.800 -  for class operations.
  81.801 -
  81.802 -  The solution is to add \isa{eq} explicitly to the first sort arguments in the
  81.803 -  code theorems:%
  81.804 -\end{isamarkuptext}%
  81.805 -\isamarkuptrue%
  81.806 -\isacommand{lemma}\isamarkupfalse%
  81.807 -\ ord{\isacharunderscore}prod{\isacharunderscore}code\ {\isacharbrackleft}code\ func{\isacharbrackright}{\isacharcolon}\isanewline
  81.808 -\ \ {\isachardoublequoteopen}{\isacharparenleft}x{\isadigit{1}}\ {\isasymColon}\ {\isacharprime}a{\isasymColon}{\isacharbraceleft}ord{\isacharcomma}\ eq{\isacharbraceright}{\isacharcomma}\ y{\isadigit{1}}\ {\isasymColon}\ {\isacharprime}b{\isasymColon}ord{\isacharparenright}\ {\isacharless}\ {\isacharparenleft}x{\isadigit{2}}{\isacharcomma}\ y{\isadigit{2}}{\isacharparenright}\ {\isasymlongleftrightarrow}\isanewline
  81.809 -\ \ \ \ x{\isadigit{1}}\ {\isacharless}\ x{\isadigit{2}}\ {\isasymor}\ {\isacharparenleft}x{\isadigit{1}}\ {\isacharequal}\ x{\isadigit{2}}\ {\isasymand}\ y{\isadigit{1}}\ {\isacharless}\ y{\isadigit{2}}{\isacharparenright}{\isachardoublequoteclose}\isanewline
  81.810 -\ \ {\isachardoublequoteopen}{\isacharparenleft}x{\isadigit{1}}\ {\isasymColon}\ {\isacharprime}a{\isasymColon}{\isacharbraceleft}ord{\isacharcomma}\ eq{\isacharbraceright}{\isacharcomma}\ y{\isadigit{1}}\ {\isasymColon}\ {\isacharprime}b{\isasymColon}ord{\isacharparenright}\ {\isasymle}\ {\isacharparenleft}x{\isadigit{2}}{\isacharcomma}\ y{\isadigit{2}}{\isacharparenright}\ {\isasymlongleftrightarrow}\isanewline
  81.811 -\ \ \ \ x{\isadigit{1}}\ {\isacharless}\ x{\isadigit{2}}\ {\isasymor}\ {\isacharparenleft}x{\isadigit{1}}\ {\isacharequal}\ x{\isadigit{2}}\ {\isasymand}\ y{\isadigit{1}}\ {\isasymle}\ y{\isadigit{2}}{\isacharparenright}{\isachardoublequoteclose}\isanewline
  81.812 -%
  81.813 -\isadelimproof
  81.814 -\ \ %
  81.815 -\endisadelimproof
  81.816 -%
  81.817 -\isatagproof
  81.818 -\isacommand{unfolding}\isamarkupfalse%
  81.819 -\ ord{\isacharunderscore}prod\ \isacommand{by}\isamarkupfalse%
  81.820 -\ rule{\isacharplus}%
  81.821 -\endisatagproof
  81.822 -{\isafoldproof}%
  81.823 -%
  81.824 -\isadelimproof
  81.825 -%
  81.826 -\endisadelimproof
  81.827 -%
  81.828 -\begin{isamarkuptext}%
  81.829 -\noindent Then code generation succeeds:%
  81.830 -\end{isamarkuptext}%
  81.831 -\isamarkuptrue%
  81.832 -\isacommand{export{\isacharunderscore}code}\isamarkupfalse%
  81.833 -\ {\isachardoublequoteopen}op\ {\isasymle}\ {\isasymColon}\ {\isacharprime}a{\isasymColon}{\isacharbraceleft}eq{\isacharcomma}\ ord{\isacharbraceright}\ {\isasymtimes}\ {\isacharprime}b{\isasymColon}ord\ {\isasymRightarrow}\ {\isacharprime}a\ {\isasymtimes}\ {\isacharprime}b\ {\isasymRightarrow}\ bool{\isachardoublequoteclose}\isanewline
  81.834 -\ \ \isakeyword{in}\ SML\ \isakeyword{file}\ {\isachardoublequoteopen}examples{\isacharslash}lexicographic{\isachardot}ML{\isachardoublequoteclose}%
  81.835 -\begin{isamarkuptext}%
  81.836 -\lstsml{Thy/examples/lexicographic.ML}%
  81.837 -\end{isamarkuptext}%
  81.838 -\isamarkuptrue%
  81.839 -%
  81.840 -\begin{isamarkuptext}%
  81.841 -In general, code theorems for overloaded constants may have more
  81.842 -  restrictive sort constraints than the underlying instance relation
  81.843 -  between class and type constructor as long as the whole system of
  81.844 -  constraints is coregular; code theorems violating coregularity
  81.845 -  are rejected immediately.  Consequently, it might be necessary
  81.846 -  to delete disturbing theorems in the code theorem table,
  81.847 -  as we have done here with the original definitions \isa{less{\isacharunderscore}prod{\isacharunderscore}def}
  81.848 -  and \isa{less{\isacharunderscore}eq{\isacharunderscore}prod{\isacharunderscore}def}.
  81.849 -
  81.850 -  In some cases, the automatically derived defining equations
  81.851 -  for equality on a particular type may not be appropriate.
  81.852 -  As example, watch the following datatype representing
  81.853 -  monomorphic parametric types (where type constructors
  81.854 -  are referred to by natural numbers):%
  81.855 -\end{isamarkuptext}%
  81.856 -\isamarkuptrue%
  81.857 -\isacommand{datatype}\isamarkupfalse%
  81.858 -\ monotype\ {\isacharequal}\ Mono\ nat\ {\isachardoublequoteopen}monotype\ list{\isachardoublequoteclose}%
  81.859 -\isadelimproof
  81.860 -%
  81.861 -\endisadelimproof
  81.862 -%
  81.863 -\isatagproof
  81.864 -%
  81.865 -\endisatagproof
  81.866 -{\isafoldproof}%
  81.867 -%
  81.868 -\isadelimproof
  81.869 -%
  81.870 -\endisadelimproof
  81.871 -%
  81.872 -\begin{isamarkuptext}%
  81.873 -Then code generation for SML would fail with a message
  81.874 -  that the generated code conains illegal mutual dependencies:
  81.875 -  the theorem \isa{Mono\ tyco{\isadigit{1}}\ typargs{\isadigit{1}}\ {\isacharequal}\ Mono\ tyco{\isadigit{2}}\ typargs{\isadigit{2}}\ {\isasymequiv}\ tyco{\isadigit{1}}\ {\isacharequal}\ tyco{\isadigit{2}}\ {\isasymand}\ typargs{\isadigit{1}}\ {\isacharequal}\ typargs{\isadigit{2}}} already requires the
  81.876 -  instance \isa{monotype\ {\isasymColon}\ eq}, which itself requires
  81.877 -  \isa{Mono\ tyco{\isadigit{1}}\ typargs{\isadigit{1}}\ {\isacharequal}\ Mono\ tyco{\isadigit{2}}\ typargs{\isadigit{2}}\ {\isasymequiv}\ tyco{\isadigit{1}}\ {\isacharequal}\ tyco{\isadigit{2}}\ {\isasymand}\ typargs{\isadigit{1}}\ {\isacharequal}\ typargs{\isadigit{2}}};  Haskell has no problem with mutually
  81.878 -  recursive \isa{instance} and \isa{function} definitions,
  81.879 -  but the SML serializer does not support this.
  81.880 -
  81.881 -  In such cases, you have to provide you own equality equations
  81.882 -  involving auxiliary constants.  In our case,
  81.883 -  \isa{list{\isacharunderscore}all{\isadigit{2}}} can do the job:%
  81.884 -\end{isamarkuptext}%
  81.885 -\isamarkuptrue%
  81.886 -\isacommand{lemma}\isamarkupfalse%
  81.887 -\ monotype{\isacharunderscore}eq{\isacharunderscore}list{\isacharunderscore}all{\isadigit{2}}\ {\isacharbrackleft}code\ func{\isacharbrackright}{\isacharcolon}\isanewline
  81.888 -\ \ {\isachardoublequoteopen}Mono\ tyco{\isadigit{1}}\ typargs{\isadigit{1}}\ {\isacharequal}\ Mono\ tyco{\isadigit{2}}\ typargs{\isadigit{2}}\ {\isasymlongleftrightarrow}\isanewline
  81.889 -\ \ \ \ \ tyco{\isadigit{1}}\ {\isacharequal}\ tyco{\isadigit{2}}\ {\isasymand}\ list{\isacharunderscore}all{\isadigit{2}}\ {\isacharparenleft}op\ {\isacharequal}{\isacharparenright}\ typargs{\isadigit{1}}\ typargs{\isadigit{2}}{\isachardoublequoteclose}\isanewline
  81.890 -%
  81.891 -\isadelimproof
  81.892 -\ \ %
  81.893 -\endisadelimproof
  81.894 -%
  81.895 -\isatagproof
  81.896 -\isacommand{by}\isamarkupfalse%
  81.897 -\ {\isacharparenleft}simp\ add{\isacharcolon}\ list{\isacharunderscore}all{\isadigit{2}}{\isacharunderscore}eq\ {\isacharbrackleft}symmetric{\isacharbrackright}{\isacharparenright}%
  81.898 -\endisatagproof
  81.899 -{\isafoldproof}%
  81.900 -%
  81.901 -\isadelimproof
  81.902 -%
  81.903 -\endisadelimproof
  81.904 -%
  81.905 -\begin{isamarkuptext}%
  81.906 -does not depend on instance \isa{monotype\ {\isasymColon}\ eq}:%
  81.907 -\end{isamarkuptext}%
  81.908 -\isamarkuptrue%
  81.909 -\isacommand{export{\isacharunderscore}code}\isamarkupfalse%
  81.910 -\ {\isachardoublequoteopen}op\ {\isacharequal}\ {\isacharcolon}{\isacharcolon}\ monotype\ {\isasymRightarrow}\ monotype\ {\isasymRightarrow}\ bool{\isachardoublequoteclose}\isanewline
  81.911 -\ \ \isakeyword{in}\ SML\ \isakeyword{file}\ {\isachardoublequoteopen}examples{\isacharslash}monotype{\isachardot}ML{\isachardoublequoteclose}%
  81.912 -\begin{isamarkuptext}%
  81.913 -\lstsml{Thy/examples/monotype.ML}%
  81.914 -\end{isamarkuptext}%
  81.915 -\isamarkuptrue%
  81.916 -%
  81.917 -\isamarkupsubsection{Programs as sets of theorems%
  81.918 -}
  81.919 -\isamarkuptrue%
  81.920 -%
  81.921 -\begin{isamarkuptext}%
  81.922 -As told in \secref{sec:concept}, code generation is based
  81.923 -  on a structured collection of code theorems.
  81.924 -  For explorative purpose, this collection
  81.925 -  may be inspected using the \isa{{\isasymCODETHMS}} command:%
  81.926 -\end{isamarkuptext}%
  81.927 -\isamarkuptrue%
  81.928 -\isacommand{code{\isacharunderscore}thms}\isamarkupfalse%
  81.929 -\ {\isachardoublequoteopen}op\ mod\ {\isacharcolon}{\isacharcolon}\ nat\ {\isasymRightarrow}\ nat\ {\isasymRightarrow}\ nat{\isachardoublequoteclose}%
  81.930 -\begin{isamarkuptext}%
  81.931 -\noindent prints a table with \emph{all} defining equations
  81.932 -  for \isa{op\ mod}, including
  81.933 -  \emph{all} defining equations those equations depend
  81.934 -  on recursivly.  \isa{{\isasymCODETHMS}} provides a convenient
  81.935 -  mechanism to inspect the impact of a preprocessor setup
  81.936 -  on defining equations.
  81.937 -  
  81.938 -  Similarly, the \isa{{\isasymCODEDEPS}} command shows a graph
  81.939 -  visualizing dependencies between defining equations.%
  81.940 -\end{isamarkuptext}%
  81.941 -\isamarkuptrue%
  81.942 -%
  81.943 -\isamarkupsubsection{Constructor sets for datatypes%
  81.944 -}
  81.945 -\isamarkuptrue%
  81.946 -%
  81.947 -\begin{isamarkuptext}%
  81.948 -Conceptually, any datatype is spanned by a set of
  81.949 -  \emph{constructors} of type \isa{{\isasymtau}\ {\isacharequal}\ {\isasymdots}\ {\isasymRightarrow}\ {\isasymkappa}\ {\isasymalpha}\isactrlisub {\isadigit{1}}\ {\isasymdots}\ {\isasymalpha}\isactrlisub n}
  81.950 -  where \isa{{\isacharbraceleft}{\isasymalpha}\isactrlisub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ {\isasymalpha}\isactrlisub n{\isacharbraceright}} is excactly the set of \emph{all}
  81.951 -  type variables in \isa{{\isasymtau}}.  The HOL datatype package
  81.952 -  by default registers any new datatype in the table
  81.953 -  of datatypes, which may be inspected using
  81.954 -  the \isa{{\isasymPRINTCODESETUP}} command.
  81.955 -
  81.956 -  In some cases, it may be convenient to alter or
  81.957 -  extend this table;  as an example, we will develope an alternative
  81.958 -  representation of natural numbers as binary digits, whose
  81.959 -  size does increase logarithmically with its value, not linear
  81.960 -  \footnote{Indeed, the \isa{Efficient{\isacharunderscore}Nat} theory (see \ref{eff_nat})
  81.961 -    does something similar}.  First, the digit representation:%
  81.962 -\end{isamarkuptext}%
  81.963 -\isamarkuptrue%
  81.964 -\isacommand{definition}\isamarkupfalse%
  81.965 -\ Dig{\isadigit{0}}\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ nat{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  81.966 -\ \ {\isachardoublequoteopen}Dig{\isadigit{0}}\ n\ {\isacharequal}\ {\isadigit{2}}\ {\isacharasterisk}\ n{\isachardoublequoteclose}\isanewline
  81.967 -\isanewline
  81.968 -\isacommand{definition}\isamarkupfalse%
  81.969 -\ Dig{\isadigit{1}}\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ nat{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  81.970 -\ \ {\isachardoublequoteopen}Dig{\isadigit{1}}\ n\ {\isacharequal}\ Suc\ {\isacharparenleft}{\isadigit{2}}\ {\isacharasterisk}\ n{\isacharparenright}{\isachardoublequoteclose}%
  81.971 -\begin{isamarkuptext}%
  81.972 -\noindent We will use these two ">digits"< to represent natural numbers
  81.973 -  in binary digits, e.g.:%
  81.974 -\end{isamarkuptext}%
  81.975 -\isamarkuptrue%
  81.976 -\isacommand{lemma}\isamarkupfalse%
  81.977 -\ {\isadigit{4}}{\isadigit{2}}{\isacharcolon}\ {\isachardoublequoteopen}{\isadigit{4}}{\isadigit{2}}\ {\isacharequal}\ Dig{\isadigit{0}}\ {\isacharparenleft}Dig{\isadigit{1}}\ {\isacharparenleft}Dig{\isadigit{0}}\ {\isacharparenleft}Dig{\isadigit{1}}\ {\isacharparenleft}Dig{\isadigit{0}}\ {\isadigit{1}}{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}\isanewline
  81.978 -%
  81.979 -\isadelimproof
  81.980 -\ \ %
  81.981 -\endisadelimproof
  81.982 -%
  81.983 -\isatagproof
  81.984 -\isacommand{by}\isamarkupfalse%
  81.985 -\ {\isacharparenleft}simp\ add{\isacharcolon}\ Dig{\isadigit{0}}{\isacharunderscore}def\ Dig{\isadigit{1}}{\isacharunderscore}def{\isacharparenright}%
  81.986 -\endisatagproof
  81.987 -{\isafoldproof}%
  81.988 -%
  81.989 -\isadelimproof
  81.990 -%
  81.991 -\endisadelimproof
  81.992 -%
  81.993 -\begin{isamarkuptext}%
  81.994 -\noindent Of course we also have to provide proper code equations for
  81.995 -  the operations, e.g. \isa{op\ {\isacharplus}}:%
  81.996 -\end{isamarkuptext}%
  81.997 -\isamarkuptrue%
  81.998 -\isacommand{lemma}\isamarkupfalse%
  81.999 -\ plus{\isacharunderscore}Dig\ {\isacharbrackleft}code\ func{\isacharbrackright}{\isacharcolon}\isanewline
 81.1000 -\ \ {\isachardoublequoteopen}{\isadigit{0}}\ {\isacharplus}\ n\ {\isacharequal}\ n{\isachardoublequoteclose}\isanewline
 81.1001 -\ \ {\isachardoublequoteopen}m\ {\isacharplus}\ {\isadigit{0}}\ {\isacharequal}\ m{\isachardoublequoteclose}\isanewline
 81.1002 -\ \ {\isachardoublequoteopen}{\isadigit{1}}\ {\isacharplus}\ Dig{\isadigit{0}}\ n\ {\isacharequal}\ Dig{\isadigit{1}}\ n{\isachardoublequoteclose}\isanewline
 81.1003 -\ \ {\isachardoublequoteopen}Dig{\isadigit{0}}\ m\ {\isacharplus}\ {\isadigit{1}}\ {\isacharequal}\ Dig{\isadigit{1}}\ m{\isachardoublequoteclose}\isanewline
 81.1004 -\ \ {\isachardoublequoteopen}{\isadigit{1}}\ {\isacharplus}\ Dig{\isadigit{1}}\ n\ {\isacharequal}\ Dig{\isadigit{0}}\ {\isacharparenleft}n\ {\isacharplus}\ {\isadigit{1}}{\isacharparenright}{\isachardoublequoteclose}\isanewline
 81.1005 -\ \ {\isachardoublequoteopen}Dig{\isadigit{1}}\ m\ {\isacharplus}\ {\isadigit{1}}\ {\isacharequal}\ Dig{\isadigit{0}}\ {\isacharparenleft}m\ {\isacharplus}\ {\isadigit{1}}{\isacharparenright}{\isachardoublequoteclose}\isanewline
 81.1006 -\ \ {\isachardoublequoteopen}Dig{\isadigit{0}}\ m\ {\isacharplus}\ Dig{\isadigit{0}}\ n\ {\isacharequal}\ Dig{\isadigit{0}}\ {\isacharparenleft}m\ {\isacharplus}\ n{\isacharparenright}{\isachardoublequoteclose}\isanewline
 81.1007 -\ \ {\isachardoublequoteopen}Dig{\isadigit{0}}\ m\ {\isacharplus}\ Dig{\isadigit{1}}\ n\ {\isacharequal}\ Dig{\isadigit{1}}\ {\isacharparenleft}m\ {\isacharplus}\ n{\isacharparenright}{\isachardoublequoteclose}\isanewline
 81.1008 -\ \ {\isachardoublequoteopen}Dig{\isadigit{1}}\ m\ {\isacharplus}\ Dig{\isadigit{0}}\ n\ {\isacharequal}\ Dig{\isadigit{1}}\ {\isacharparenleft}m\ {\isacharplus}\ n{\isacharparenright}{\isachardoublequoteclose}\isanewline
 81.1009 -\ \ {\isachardoublequoteopen}Dig{\isadigit{1}}\ m\ {\isacharplus}\ Dig{\isadigit{1}}\ n\ {\isacharequal}\ Dig{\isadigit{0}}\ {\isacharparenleft}m\ {\isacharplus}\ n\ {\isacharplus}\ {\isadigit{1}}{\isacharparenright}{\isachardoublequoteclose}\isanewline
 81.1010 -%
 81.1011 -\isadelimproof
 81.1012 -\ \ %
 81.1013 -\endisadelimproof
 81.1014 -%
 81.1015 -\isatagproof
 81.1016 -\isacommand{by}\isamarkupfalse%
 81.1017 -\ {\isacharparenleft}simp{\isacharunderscore}all\ add{\isacharcolon}\ Dig{\isadigit{0}}{\isacharunderscore}def\ Dig{\isadigit{1}}{\isacharunderscore}def{\isacharparenright}%
 81.1018 -\endisatagproof
 81.1019 -{\isafoldproof}%
 81.1020 -%
 81.1021 -\isadelimproof
 81.1022 -%
 81.1023 -\endisadelimproof
 81.1024 -%
 81.1025 -\begin{isamarkuptext}%
 81.1026 -\noindent We then instruct the code generator to view \isa{{\isadigit{0}}},
 81.1027 -  \isa{{\isadigit{1}}}, \isa{Dig{\isadigit{0}}} and \isa{Dig{\isadigit{1}}} as
 81.1028 -  datatype constructors:%
 81.1029 -\end{isamarkuptext}%
 81.1030 -\isamarkuptrue%
 81.1031 -\isacommand{code{\isacharunderscore}datatype}\isamarkupfalse%
 81.1032 -\ {\isachardoublequoteopen}{\isadigit{0}}{\isasymColon}nat{\isachardoublequoteclose}\ {\isachardoublequoteopen}{\isadigit{1}}{\isasymColon}nat{\isachardoublequoteclose}\ Dig{\isadigit{0}}\ Dig{\isadigit{1}}%
 81.1033 -\begin{isamarkuptext}%
 81.1034 -\noindent For the former constructor \isa{Suc}, we provide a code
 81.1035 -  equation and remove some parts of the default code generator setup
 81.1036 -  which are an obstacle here:%
 81.1037 -\end{isamarkuptext}%
 81.1038 -\isamarkuptrue%
 81.1039 -\isacommand{lemma}\isamarkupfalse%
 81.1040 -\ Suc{\isacharunderscore}Dig\ {\isacharbrackleft}code\ func{\isacharbrackright}{\isacharcolon}\isanewline
 81.1041 -\ \ {\isachardoublequoteopen}Suc\ n\ {\isacharequal}\ n\ {\isacharplus}\ {\isadigit{1}}{\isachardoublequoteclose}\isanewline
 81.1042 -%
 81.1043 -\isadelimproof
 81.1044 -\ \ %
 81.1045 -\endisadelimproof
 81.1046 -%
 81.1047 -\isatagproof
 81.1048 -\isacommand{by}\isamarkupfalse%
 81.1049 -\ simp%
 81.1050 -\endisatagproof
 81.1051 -{\isafoldproof}%
 81.1052 -%
 81.1053 -\isadelimproof
 81.1054 -\isanewline
 81.1055 -%
 81.1056 -\endisadelimproof
 81.1057 -\isanewline
 81.1058 -\isacommand{declare}\isamarkupfalse%
 81.1059 -\ One{\isacharunderscore}nat{\isacharunderscore}def\ {\isacharbrackleft}code\ inline\ del{\isacharbrackright}\isanewline
 81.1060 -\isacommand{declare}\isamarkupfalse%
 81.1061 -\ add{\isacharunderscore}Suc{\isacharunderscore}shift\ {\isacharbrackleft}code\ func\ del{\isacharbrackright}%
 81.1062 -\begin{isamarkuptext}%
 81.1063 -\noindent This yields the following code:%
 81.1064 -\end{isamarkuptext}%
 81.1065 -\isamarkuptrue%
 81.1066 -\isacommand{export{\isacharunderscore}code}\isamarkupfalse%
 81.1067 -\ {\isachardoublequoteopen}op\ {\isacharplus}\ {\isasymColon}\ nat\ {\isasymRightarrow}\ nat\ {\isasymRightarrow}\ nat{\isachardoublequoteclose}\ \ \isakeyword{in}\ SML\ \isakeyword{file}\ {\isachardoublequoteopen}examples{\isacharslash}nat{\isacharunderscore}binary{\isachardot}ML{\isachardoublequoteclose}%
 81.1068 -\begin{isamarkuptext}%
 81.1069 -\lstsml{Thy/examples/nat_binary.ML}%
 81.1070 -\end{isamarkuptext}%
 81.1071 -\isamarkuptrue%
 81.1072 -%
 81.1073 -\begin{isamarkuptext}%
 81.1074 -\medskip
 81.1075 -
 81.1076 -  From this example, it can be easily glimpsed that using own constructor sets
 81.1077 -  is a little delicate since it changes the set of valid patterns for values
 81.1078 -  of that type.  Without going into much detail, here some practical hints:
 81.1079 -
 81.1080 -  \begin{itemize}
 81.1081 -    \item When changing the constuctor set for datatypes, take care to
 81.1082 -      provide an alternative for the \isa{case} combinator (e.g. by replacing
 81.1083 -      it using the preprocessor).
 81.1084 -    \item Values in the target language need not to be normalized -- different
 81.1085 -      values in the target language may represent the same value in the
 81.1086 -      logic (e.g. \isa{Dig{\isadigit{1}}\ {\isadigit{0}}\ {\isacharequal}\ {\isadigit{1}}}).
 81.1087 -    \item Usually, a good methodology to deal with the subleties of pattern
 81.1088 -      matching is to see the type as an abstract type: provide a set
 81.1089 -      of operations which operate on the concrete representation of the type,
 81.1090 -      and derive further operations by combinations of these primitive ones,
 81.1091 -      without relying on a particular representation.
 81.1092 -  \end{itemize}%
 81.1093 -\end{isamarkuptext}%
 81.1094 -\isamarkuptrue%
 81.1095 -%
 81.1096 -\isadeliminvisible
 81.1097 -%
 81.1098 -\endisadeliminvisible
 81.1099 -%
 81.1100 -\isataginvisible
 81.1101 -\isacommand{code{\isacharunderscore}datatype}\isamarkupfalse%
 81.1102 -\ {\isachardoublequoteopen}{\isadigit{0}}{\isacharcolon}{\isacharcolon}nat{\isachardoublequoteclose}\ Suc\isanewline
 81.1103 -\isacommand{declare}\isamarkupfalse%
 81.1104 -\ plus{\isacharunderscore}Dig\ {\isacharbrackleft}code\ func\ del{\isacharbrackright}\isanewline
 81.1105 -\isacommand{declare}\isamarkupfalse%
 81.1106 -\ One{\isacharunderscore}nat{\isacharunderscore}def\ {\isacharbrackleft}code\ inline{\isacharbrackright}\isanewline
 81.1107 -\isacommand{declare}\isamarkupfalse%
 81.1108 -\ add{\isacharunderscore}Suc{\isacharunderscore}shift\ {\isacharbrackleft}code\ func{\isacharbrackright}\ \isanewline
 81.1109 -\isacommand{lemma}\isamarkupfalse%
 81.1110 -\ {\isacharbrackleft}code\ func{\isacharbrackright}{\isacharcolon}\ {\isachardoublequoteopen}{\isadigit{0}}\ {\isacharplus}\ n\ {\isacharequal}\ {\isacharparenleft}n\ {\isasymColon}\ nat{\isacharparenright}{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
 81.1111 -\ simp%
 81.1112 -\endisataginvisible
 81.1113 -{\isafoldinvisible}%
 81.1114 -%
 81.1115 -\isadeliminvisible
 81.1116 -%
 81.1117 -\endisadeliminvisible
 81.1118 -%
 81.1119 -\isamarkupsubsection{Customizing serialization%
 81.1120 -}
 81.1121 -\isamarkuptrue%
 81.1122 -%
 81.1123 -\isamarkupsubsubsection{Basics%
 81.1124 -}
 81.1125 -\isamarkuptrue%
 81.1126 -%
 81.1127 -\begin{isamarkuptext}%
 81.1128 -Consider the following function and its corresponding
 81.1129 -  SML code:%
 81.1130 -\end{isamarkuptext}%
 81.1131 -\isamarkuptrue%
 81.1132 -\isacommand{primrec}\isamarkupfalse%
 81.1133 -\isanewline
 81.1134 -\ \ in{\isacharunderscore}interval\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymtimes}\ nat\ {\isasymRightarrow}\ nat\ {\isasymRightarrow}\ bool{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
 81.1135 -\ \ {\isachardoublequoteopen}in{\isacharunderscore}interval\ {\isacharparenleft}k{\isacharcomma}\ l{\isacharparenright}\ n\ {\isasymlongleftrightarrow}\ k\ {\isasymle}\ n\ {\isasymand}\ n\ {\isasymle}\ l{\isachardoublequoteclose}%
 81.1136 -\isadelimtt
 81.1137 -%
 81.1138 -\endisadelimtt
 81.1139 -%
 81.1140 -\isatagtt
 81.1141 -%
 81.1142 -\endisatagtt
 81.1143 -{\isafoldtt}%
 81.1144 -%
 81.1145 -\isadelimtt
 81.1146 -%
 81.1147 -\endisadelimtt
 81.1148 -\isacommand{export{\isacharunderscore}code}\isamarkupfalse%
 81.1149 -\ in{\isacharunderscore}interval\ \isakeyword{in}\ SML\ \isakeyword{file}\ {\isachardoublequoteopen}examples{\isacharslash}bool{\isacharunderscore}literal{\isachardot}ML{\isachardoublequoteclose}%
 81.1150 -\begin{isamarkuptext}%
 81.1151 -\lstsml{Thy/examples/bool_literal.ML}
 81.1152 -
 81.1153 -  \noindent Though this is correct code, it is a little bit unsatisfactory:
 81.1154 -  boolean values and operators are materialized as distinguished
 81.1155 -  entities with have nothing to do with the SML-builtin notion
 81.1156 -  of \qt{bool}.  This results in less readable code;
 81.1157 -  additionally, eager evaluation may cause programs to
 81.1158 -  loop or break which would perfectly terminate when
 81.1159 -  the existing SML \qt{bool} would be used.  To map
 81.1160 -  the HOL \qt{bool} on SML \qt{bool}, we may use
 81.1161 -  \qn{custom serializations}:%
 81.1162 -\end{isamarkuptext}%
 81.1163 -\isamarkuptrue%
 81.1164 -%
 81.1165 -\isadelimtt
 81.1166 -%
 81.1167 -\endisadelimtt
 81.1168 -%
 81.1169 -\isatagtt
 81.1170 -\isacommand{code{\isacharunderscore}type}\isamarkupfalse%
 81.1171 -\ bool\isanewline
 81.1172 -\ \ {\isacharparenleft}SML\ {\isachardoublequoteopen}bool{\isachardoublequoteclose}{\isacharparenright}\isanewline
 81.1173 -\isacommand{code{\isacharunderscore}const}\isamarkupfalse%
 81.1174 -\ True\ \isakeyword{and}\ False\ \isakeyword{and}\ {\isachardoublequoteopen}op\ {\isasymand}{\isachardoublequoteclose}\isanewline
 81.1175 -\ \ {\isacharparenleft}SML\ {\isachardoublequoteopen}true{\isachardoublequoteclose}\ \isakeyword{and}\ {\isachardoublequoteopen}false{\isachardoublequoteclose}\ \isakeyword{and}\ {\isachardoublequoteopen}{\isacharunderscore}\ andalso\ {\isacharunderscore}{\isachardoublequoteclose}{\isacharparenright}%
 81.1176 -\endisatagtt
 81.1177 -{\isafoldtt}%
 81.1178 -%
 81.1179 -\isadelimtt
 81.1180 -%
 81.1181 -\endisadelimtt
 81.1182 -%
 81.1183 -\begin{isamarkuptext}%
 81.1184 -The \isa{{\isasymCODETYPE}} commad takes a type constructor
 81.1185 -  as arguments together with a list of custom serializations.
 81.1186 -  Each custom serialization starts with a target language
 81.1187 -  identifier followed by an expression, which during
 81.1188 -  code serialization is inserted whenever the type constructor
 81.1189 -  would occur.  For constants, \isa{{\isasymCODECONST}} implements
 81.1190 -  the corresponding mechanism.  Each ``\verb|_|'' in
 81.1191 -  a serialization expression is treated as a placeholder
 81.1192 -  for the type constructor's (the constant's) arguments.%
 81.1193 -\end{isamarkuptext}%
 81.1194 -\isamarkuptrue%
 81.1195 -\isacommand{export{\isacharunderscore}code}\isamarkupfalse%
 81.1196 -\ in{\isacharunderscore}interval\ \ \isakeyword{in}\ SML\ \isakeyword{file}\ {\isachardoublequoteopen}examples{\isacharslash}bool{\isacharunderscore}mlbool{\isachardot}ML{\isachardoublequoteclose}%
 81.1197 -\begin{isamarkuptext}%
 81.1198 -\lstsml{Thy/examples/bool_mlbool.ML}
 81.1199 -
 81.1200 -  \noindent This still is not perfect: the parentheses
 81.1201 -  around the \qt{andalso} expression are superfluous.
 81.1202 -  Though the serializer
 81.1203 -  by no means attempts to imitate the rich Isabelle syntax
 81.1204 -  framework, it provides some common idioms, notably
 81.1205 -  associative infixes with precedences which may be used here:%
 81.1206 -\end{isamarkuptext}%
 81.1207 -\isamarkuptrue%
 81.1208 -%
 81.1209 -\isadelimtt
 81.1210 -%
 81.1211 -\endisadelimtt
 81.1212 -%
 81.1213 -\isatagtt
 81.1214 -\isacommand{code{\isacharunderscore}const}\isamarkupfalse%
 81.1215 -\ {\isachardoublequoteopen}op\ {\isasymand}{\isachardoublequoteclose}\isanewline
 81.1216 -\ \ {\isacharparenleft}SML\ \isakeyword{infixl}\ {\isadigit{1}}\ {\isachardoublequoteopen}andalso{\isachardoublequoteclose}{\isacharparenright}%
 81.1217 -\endisatagtt
 81.1218 -{\isafoldtt}%
 81.1219 -%
 81.1220 -\isadelimtt
 81.1221 -%
 81.1222 -\endisadelimtt
 81.1223 -\isanewline
 81.1224 -\isanewline
 81.1225 -\isacommand{export{\isacharunderscore}code}\isamarkupfalse%
 81.1226 -\ in{\isacharunderscore}interval\ \ \isakeyword{in}\ SML\ \isakeyword{file}\ {\isachardoublequoteopen}examples{\isacharslash}bool{\isacharunderscore}infix{\isachardot}ML{\isachardoublequoteclose}%
 81.1227 -\begin{isamarkuptext}%
 81.1228 -\lstsml{Thy/examples/bool_infix.ML}
 81.1229 -
 81.1230 -  \medskip
 81.1231 -
 81.1232 -  Next, we try to map HOL pairs to SML pairs, using the
 81.1233 -  infix ``\verb|*|'' type constructor and parentheses:%
 81.1234 -\end{isamarkuptext}%
 81.1235 -\isamarkuptrue%
 81.1236 -%
 81.1237 -\isadelimtt
 81.1238 -%
 81.1239 -\endisadelimtt
 81.1240 -%
 81.1241 -\isatagtt
 81.1242 -\isacommand{code{\isacharunderscore}type}\isamarkupfalse%
 81.1243 -\ {\isacharasterisk}\isanewline
 81.1244 -\ \ {\isacharparenleft}SML\ \isakeyword{infix}\ {\isadigit{2}}\ {\isachardoublequoteopen}{\isacharasterisk}{\isachardoublequoteclose}{\isacharparenright}\isanewline
 81.1245 -\isacommand{code{\isacharunderscore}const}\isamarkupfalse%
 81.1246 -\ Pair\isanewline
 81.1247 -\ \ {\isacharparenleft}SML\ {\isachardoublequoteopen}{\isacharbang}{\isacharparenleft}{\isacharparenleft}{\isacharunderscore}{\isacharparenright}{\isacharcomma}{\isacharslash}\ {\isacharparenleft}{\isacharunderscore}{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}{\isacharparenright}%
 81.1248 -\endisatagtt
 81.1249 -{\isafoldtt}%
 81.1250 -%
 81.1251 -\isadelimtt
 81.1252 -%
 81.1253 -\endisadelimtt
 81.1254 -%
 81.1255 -\begin{isamarkuptext}%
 81.1256 -The initial bang ``\verb|!|'' tells the serializer to never put
 81.1257 -  parentheses around the whole expression (they are already present),
 81.1258 -  while the parentheses around argument place holders
 81.1259 -  tell not to put parentheses around the arguments.
 81.1260 -  The slash ``\verb|/|'' (followed by arbitrary white space)
 81.1261 -  inserts a space which may be used as a break if necessary
 81.1262 -  during pretty printing.
 81.1263 -
 81.1264 -  These examples give a glimpse what mechanisms
 81.1265 -  custom serializations provide; however their usage
 81.1266 -  requires careful thinking in order not to introduce
 81.1267 -  inconsistencies -- or, in other words:
 81.1268 -  custom serializations are completely axiomatic.
 81.1269 -
 81.1270 -  A further noteworthy details is that any special
 81.1271 -  character in a custom serialization may be quoted
 81.1272 -  using ``\verb|'|''; thus, in
 81.1273 -  ``\verb|fn '_ => _|'' the first
 81.1274 -  ``\verb|_|'' is a proper underscore while the
 81.1275 -  second ``\verb|_|'' is a placeholder.
 81.1276 -
 81.1277 -  The HOL theories provide further
 81.1278 -  examples for custom serializations.%
 81.1279 -\end{isamarkuptext}%
 81.1280 -\isamarkuptrue%
 81.1281 -%
 81.1282 -\isamarkupsubsubsection{Haskell serialization%
 81.1283 -}
 81.1284 -\isamarkuptrue%
 81.1285 -%
 81.1286 -\begin{isamarkuptext}%
 81.1287 -For convenience, the default
 81.1288 -  HOL setup for Haskell maps the \isa{eq} class to
 81.1289 -  its counterpart in Haskell, giving custom serializations
 81.1290 -  for the class (\isa{{\isasymCODECLASS}}) and its operation:%
 81.1291 -\end{isamarkuptext}%
 81.1292 -\isamarkuptrue%
 81.1293 -%
 81.1294 -\isadelimtt
 81.1295 -%
 81.1296 -\endisadelimtt
 81.1297 -%
 81.1298 -\isatagtt
 81.1299 -\isacommand{code{\isacharunderscore}class}\isamarkupfalse%
 81.1300 -\ eq\isanewline
 81.1301 -\ \ {\isacharparenleft}Haskell\ {\isachardoublequoteopen}Eq{\isachardoublequoteclose}\ \isakeyword{where}\ {\isachardoublequoteopen}op\ {\isacharequal}{\isachardoublequoteclose}\ {\isasymequiv}\ {\isachardoublequoteopen}{\isacharparenleft}{\isacharequal}{\isacharequal}{\isacharparenright}{\isachardoublequoteclose}{\isacharparenright}\isanewline
 81.1302 -\isanewline
 81.1303 -\isacommand{code{\isacharunderscore}const}\isamarkupfalse%
 81.1304 -\ {\isachardoublequoteopen}op\ {\isacharequal}{\isachardoublequoteclose}\isanewline
 81.1305 -\ \ {\isacharparenleft}Haskell\ \isakeyword{infixl}\ {\isadigit{4}}\ {\isachardoublequoteopen}{\isacharequal}{\isacharequal}{\isachardoublequoteclose}{\isacharparenright}%
 81.1306 -\endisatagtt
 81.1307 -{\isafoldtt}%
 81.1308 -%
 81.1309 -\isadelimtt
 81.1310 -%
 81.1311 -\endisadelimtt
 81.1312 -%
 81.1313 -\begin{isamarkuptext}%
 81.1314 -A problem now occurs whenever a type which
 81.1315 -  is an instance of \isa{eq} in HOL is mapped
 81.1316 -  on a Haskell-builtin type which is also an instance
 81.1317 -  of Haskell \isa{Eq}:%
 81.1318 -\end{isamarkuptext}%
 81.1319 -\isamarkuptrue%
 81.1320 -\isacommand{typedecl}\isamarkupfalse%
 81.1321 -\ bar\isanewline
 81.1322 -\isanewline
 81.1323 -\isacommand{instantiation}\isamarkupfalse%
 81.1324 -\ bar\ {\isacharcolon}{\isacharcolon}\ eq\isanewline
 81.1325 -\isakeyword{begin}\isanewline
 81.1326 -\isanewline
 81.1327 -\isacommand{definition}\isamarkupfalse%
 81.1328 -\ {\isachardoublequoteopen}eq{\isacharunderscore}class{\isachardot}eq\ {\isacharparenleft}x{\isasymColon}bar{\isacharparenright}\ y\ {\isasymlongleftrightarrow}\ x\ {\isacharequal}\ y{\isachardoublequoteclose}\isanewline
 81.1329 -\isanewline
 81.1330 -\isacommand{instance}\isamarkupfalse%
 81.1331 -%
 81.1332 -\isadelimproof
 81.1333 -\ %
 81.1334 -\endisadelimproof
 81.1335 -%
 81.1336 -\isatagproof
 81.1337 -\isacommand{by}\isamarkupfalse%
 81.1338 -\ default\ {\isacharparenleft}simp\ add{\isacharcolon}\ eq{\isacharunderscore}bar{\isacharunderscore}def{\isacharparenright}%
 81.1339 -\endisatagproof
 81.1340 -{\isafoldproof}%
 81.1341 -%
 81.1342 -\isadelimproof
 81.1343 -%
 81.1344 -\endisadelimproof
 81.1345 -\isanewline
 81.1346 -\isanewline
 81.1347 -\isacommand{end}\isamarkupfalse%
 81.1348 -\isanewline
 81.1349 -%
 81.1350 -\isadelimtt
 81.1351 -\isanewline
 81.1352 -%
 81.1353 -\endisadelimtt
 81.1354 -%
 81.1355 -\isatagtt
 81.1356 -\isacommand{code{\isacharunderscore}type}\isamarkupfalse%
 81.1357 -\ bar\isanewline
 81.1358 -\ \ {\isacharparenleft}Haskell\ {\isachardoublequoteopen}Integer{\isachardoublequoteclose}{\isacharparenright}%
 81.1359 -\endisatagtt
 81.1360 -{\isafoldtt}%
 81.1361 -%
 81.1362 -\isadelimtt
 81.1363 -%
 81.1364 -\endisadelimtt
 81.1365 -%
 81.1366 -\begin{isamarkuptext}%
 81.1367 -The code generator would produce
 81.1368 -  an additional instance, which of course is rejected.
 81.1369 -  To suppress this additional instance, use
 81.1370 -  \isa{{\isasymCODEINSTANCE}}:%
 81.1371 -\end{isamarkuptext}%
 81.1372 -\isamarkuptrue%
 81.1373 -%
 81.1374 -\isadelimtt
 81.1375 -%
 81.1376 -\endisadelimtt
 81.1377 -%
 81.1378 -\isatagtt
 81.1379 -\isacommand{code{\isacharunderscore}instance}\isamarkupfalse%
 81.1380 -\ bar\ {\isacharcolon}{\isacharcolon}\ eq\isanewline
 81.1381 -\ \ {\isacharparenleft}Haskell\ {\isacharminus}{\isacharparenright}%
 81.1382 -\endisatagtt
 81.1383 -{\isafoldtt}%
 81.1384 -%
 81.1385 -\isadelimtt
 81.1386 -%
 81.1387 -\endisadelimtt
 81.1388 -%
 81.1389 -\isamarkupsubsubsection{Pretty printing%
 81.1390 -}
 81.1391 -\isamarkuptrue%
 81.1392 -%
 81.1393 -\begin{isamarkuptext}%
 81.1394 -The serializer provides ML interfaces to set up
 81.1395 -  pretty serializations for expressions like lists, numerals
 81.1396 -  and characters;  these are
 81.1397 -  monolithic stubs and should only be used with the
 81.1398 -  theories introduced in \secref{sec:library}.%
 81.1399 -\end{isamarkuptext}%
 81.1400 -\isamarkuptrue%
 81.1401 -%
 81.1402 -\isamarkupsubsection{Cyclic module dependencies%
 81.1403 -}
 81.1404 -\isamarkuptrue%
 81.1405 -%
 81.1406 -\begin{isamarkuptext}%
 81.1407 -Sometimes the awkward situation occurs that dependencies
 81.1408 -  between definitions introduce cyclic dependencies
 81.1409 -  between modules, which in the Haskell world leaves
 81.1410 -  you to the mercy of the Haskell implementation you are using,
 81.1411 -  while for SML code generation is not possible.
 81.1412 -
 81.1413 -  A solution is to declare module names explicitly.
 81.1414 -  Let use assume the three cyclically dependent
 81.1415 -  modules are named \emph{A}, \emph{B} and \emph{C}.
 81.1416 -  Then, by stating%
 81.1417 -\end{isamarkuptext}%
 81.1418 -\isamarkuptrue%
 81.1419 -\isacommand{code{\isacharunderscore}modulename}\isamarkupfalse%
 81.1420 -\ SML\isanewline
 81.1421 -\ \ A\ ABC\isanewline
 81.1422 -\ \ B\ ABC\isanewline
 81.1423 -\ \ C\ ABC%
 81.1424 -\begin{isamarkuptext}%
 81.1425 -we explicitly map all those modules on \emph{ABC},
 81.1426 -  resulting in an ad-hoc merge of this three modules
 81.1427 -  at serialization time.%
 81.1428 -\end{isamarkuptext}%
 81.1429 -\isamarkuptrue%
 81.1430 -%
 81.1431 -\isamarkupsubsection{Incremental code generation%
 81.1432 -}
 81.1433 -\isamarkuptrue%
 81.1434 -%
 81.1435 -\begin{isamarkuptext}%
 81.1436 -Code generation is \emph{incremental}: theorems
 81.1437 -  and abstract intermediate code are cached and extended on demand.
 81.1438 -  The cache may be partially or fully dropped if the underlying
 81.1439 -  executable content of the theory changes.
 81.1440 -  Implementation of caching is supposed to transparently
 81.1441 -  hid away the details from the user.  Anyway, caching
 81.1442 -  reaches the surface by using a slightly more general form
 81.1443 -  of the \isa{{\isasymCODETHMS}}, \isa{{\isasymCODEDEPS}}
 81.1444 -  and \isa{{\isasymEXPORTCODE}} commands: the list of constants
 81.1445 -  may be omitted.  Then, all constants with code theorems
 81.1446 -  in the current cache are referred to.%
 81.1447 -\end{isamarkuptext}%
 81.1448 -\isamarkuptrue%
 81.1449 -%
 81.1450 -\isamarkupsection{ML interfaces \label{sec:ml}%
 81.1451 -}
 81.1452 -\isamarkuptrue%
 81.1453 -%
 81.1454 -\begin{isamarkuptext}%
 81.1455 -Since the code generator framework not only aims to provide
 81.1456 -  a nice Isar interface but also to form a base for
 81.1457 -  code-generation-based applications, here a short
 81.1458 -  description of the most important ML interfaces.%
 81.1459 -\end{isamarkuptext}%
 81.1460 -\isamarkuptrue%
 81.1461 -%
 81.1462 -\isamarkupsubsection{Executable theory content: \isa{Code}%
 81.1463 -}
 81.1464 -\isamarkuptrue%
 81.1465 -%
 81.1466 -\begin{isamarkuptext}%
 81.1467 -This Pure module implements the core notions of
 81.1468 -  executable content of a theory.%
 81.1469 -\end{isamarkuptext}%
 81.1470 -\isamarkuptrue%
 81.1471 -%
 81.1472 -\isamarkupsubsubsection{Managing executable content%
 81.1473 -}
 81.1474 -\isamarkuptrue%
 81.1475 -%
 81.1476 -\isadelimmlref
 81.1477 -%
 81.1478 -\endisadelimmlref
 81.1479 -%
 81.1480 -\isatagmlref
 81.1481 -%
 81.1482 -\begin{isamarkuptext}%
 81.1483 -\begin{mldecls}
 81.1484 -  \indexml{Code.add\_func}\verb|Code.add_func: thm -> theory -> theory| \\
 81.1485 -  \indexml{Code.del\_func}\verb|Code.del_func: thm -> theory -> theory| \\
 81.1486 -  \indexml{Code.add\_funcl}\verb|Code.add_funcl: string * thm list Susp.T -> theory -> theory| \\
 81.1487 -  \indexml{Code.map\_pre}\verb|Code.map_pre: (MetaSimplifier.simpset -> MetaSimplifier.simpset) -> theory -> theory| \\
 81.1488 -  \indexml{Code.map\_post}\verb|Code.map_post: (MetaSimplifier.simpset -> MetaSimplifier.simpset) -> theory -> theory| \\
 81.1489 -  \indexml{Code.add\_functrans}\verb|Code.add_functrans: string * (theory -> thm list -> thm list option)|\isasep\isanewline%
 81.1490 -\verb|    -> theory -> theory| \\
 81.1491 -  \indexml{Code.del\_functrans}\verb|Code.del_functrans: string -> theory -> theory| \\
 81.1492 -  \indexml{Code.add\_datatype}\verb|Code.add_datatype: (string * typ) list -> theory -> theory| \\
 81.1493 -  \indexml{Code.get\_datatype}\verb|Code.get_datatype: theory -> string|\isasep\isanewline%
 81.1494 -\verb|    -> (string * sort) list * (string * typ list) list| \\
 81.1495 -  \indexml{Code.get\_datatype\_of\_constr}\verb|Code.get_datatype_of_constr: theory -> string -> string option|
 81.1496 -  \end{mldecls}
 81.1497 -
 81.1498 -  \begin{description}
 81.1499 -
 81.1500 -  \item \verb|Code.add_func|~\isa{thm}~\isa{thy} adds function
 81.1501 -     theorem \isa{thm} to executable content.
 81.1502 -
 81.1503 -  \item \verb|Code.del_func|~\isa{thm}~\isa{thy} removes function
 81.1504 -     theorem \isa{thm} from executable content, if present.
 81.1505 -
 81.1506 -  \item \verb|Code.add_funcl|~\isa{{\isacharparenleft}const{\isacharcomma}\ lthms{\isacharparenright}}~\isa{thy} adds
 81.1507 -     suspended defining equations \isa{lthms} for constant
 81.1508 -     \isa{const} to executable content.
 81.1509 -
 81.1510 -  \item \verb|Code.map_pre|~\isa{f}~\isa{thy} changes
 81.1511 -     the preprocessor simpset.
 81.1512 -
 81.1513 -  \item \verb|Code.add_functrans|~\isa{{\isacharparenleft}name{\isacharcomma}\ f{\isacharparenright}}~\isa{thy} adds
 81.1514 -     function transformer \isa{f} (named \isa{name}) to executable content;
 81.1515 -     \isa{f} is a transformer of the defining equations belonging
 81.1516 -     to a certain function definition, depending on the
 81.1517 -     current theory context.  Returning \isa{NONE} indicates that no
 81.1518 -     transformation took place;  otherwise, the whole process will be iterated
 81.1519 -     with the new defining equations.
 81.1520 -
 81.1521 -  \item \verb|Code.del_functrans|~\isa{name}~\isa{thy} removes
 81.1522 -     function transformer named \isa{name} from executable content.
 81.1523 -
 81.1524 -  \item \verb|Code.add_datatype|~\isa{cs}~\isa{thy} adds
 81.1525 -     a datatype to executable content, with generation
 81.1526 -     set \isa{cs}.
 81.1527 -
 81.1528 -  \item \verb|Code.get_datatype_of_constr|~\isa{thy}~\isa{const}
 81.1529 -     returns type constructor corresponding to
 81.1530 -     constructor \isa{const}; returns \isa{NONE}
 81.1531 -     if \isa{const} is no constructor.
 81.1532 -
 81.1533 -  \end{description}%
 81.1534 -\end{isamarkuptext}%
 81.1535 -\isamarkuptrue%
 81.1536 -%
 81.1537 -\endisatagmlref
 81.1538 -{\isafoldmlref}%
 81.1539 -%
 81.1540 -\isadelimmlref
 81.1541 -%
 81.1542 -\endisadelimmlref
 81.1543 -%
 81.1544 -\isamarkupsubsection{Auxiliary%
 81.1545 -}
 81.1546 -\isamarkuptrue%
 81.1547 -%
 81.1548 -\isadelimmlref
 81.1549 -%
 81.1550 -\endisadelimmlref
 81.1551 -%
 81.1552 -\isatagmlref
 81.1553 -%
 81.1554 -\begin{isamarkuptext}%
 81.1555 -\begin{mldecls}
 81.1556 -  \indexml{Code\_Unit.read\_const}\verb|Code_Unit.read_const: theory -> string -> string| \\
 81.1557 -  \indexml{Code\_Unit.head\_func}\verb|Code_Unit.head_func: thm -> string * ((string * sort) list * typ)| \\
 81.1558 -  \indexml{Code\_Unit.rewrite\_func}\verb|Code_Unit.rewrite_func: MetaSimplifier.simpset -> thm -> thm| \\
 81.1559 -  \end{mldecls}
 81.1560 -
 81.1561 -  \begin{description}
 81.1562 -
 81.1563 -  \item \verb|Code_Unit.read_const|~\isa{thy}~\isa{s}
 81.1564 -     reads a constant as a concrete term expression \isa{s}.
 81.1565 -
 81.1566 -  \item \verb|Code_Unit.head_func|~\isa{thm}
 81.1567 -     extracts the constant and its type from a defining equation \isa{thm}.
 81.1568 -
 81.1569 -  \item \verb|Code_Unit.rewrite_func|~\isa{ss}~\isa{thm}
 81.1570 -     rewrites a defining equation \isa{thm} with a simpset \isa{ss};
 81.1571 -     only arguments and right hand side are rewritten,
 81.1572 -     not the head of the defining equation.
 81.1573 -
 81.1574 -  \end{description}%
 81.1575 -\end{isamarkuptext}%
 81.1576 -\isamarkuptrue%
 81.1577 -%
 81.1578 -\endisatagmlref
 81.1579 -{\isafoldmlref}%
 81.1580 -%
 81.1581 -\isadelimmlref
 81.1582 -%
 81.1583 -\endisadelimmlref
 81.1584 -%
 81.1585 -\isamarkupsubsection{Implementing code generator applications%
 81.1586 -}
 81.1587 -\isamarkuptrue%
 81.1588 -%
 81.1589 -\begin{isamarkuptext}%
 81.1590 -Implementing code generator applications on top
 81.1591 -  of the framework set out so far usually not only
 81.1592 -  involves using those primitive interfaces
 81.1593 -  but also storing code-dependent data and various
 81.1594 -  other things.
 81.1595 -
 81.1596 -  \begin{warn}
 81.1597 -    Some interfaces discussed here have not reached
 81.1598 -    a final state yet.
 81.1599 -    Changes likely to occur in future.
 81.1600 -  \end{warn}%
 81.1601 -\end{isamarkuptext}%
 81.1602 -\isamarkuptrue%
 81.1603 -%
 81.1604 -\isamarkupsubsubsection{Data depending on the theory's executable content%
 81.1605 -}
 81.1606 -\isamarkuptrue%
 81.1607 -%
 81.1608 -\begin{isamarkuptext}%
 81.1609 -Due to incrementality of code generation, changes in the
 81.1610 -  theory's executable content have to be propagated in a
 81.1611 -  certain fashion.  Additionally, such changes may occur
 81.1612 -  not only during theory extension but also during theory
 81.1613 -  merge, which is a little bit nasty from an implementation
 81.1614 -  point of view.  The framework provides a solution
 81.1615 -  to this technical challenge by providing a functorial
 81.1616 -  data slot \verb|CodeDataFun|; on instantiation
 81.1617 -  of this functor, the following types and operations
 81.1618 -  are required:
 81.1619 -
 81.1620 -  \medskip
 81.1621 -  \begin{tabular}{l}
 81.1622 -  \isa{type\ T} \\
 81.1623 -  \isa{val\ empty{\isacharcolon}\ T} \\
 81.1624 -  \isa{val\ merge{\isacharcolon}\ Pretty{\isachardot}pp\ {\isasymrightarrow}\ T\ {\isacharasterisk}\ T\ {\isasymrightarrow}\ T} \\
 81.1625 -  \isa{val\ purge{\isacharcolon}\ theory\ option\ {\isasymrightarrow}\ CodeUnit{\isachardot}const\ list\ option\ {\isasymrightarrow}\ T\ {\isasymrightarrow}\ T}
 81.1626 -  \end{tabular}
 81.1627 -
 81.1628 -  \begin{description}
 81.1629 -
 81.1630 -  \item \isa{T} the type of data to store.
 81.1631 -
 81.1632 -  \item \isa{empty} initial (empty) data.
 81.1633 -
 81.1634 -  \item \isa{merge} merging two data slots.
 81.1635 -
 81.1636 -  \item \isa{purge}~\isa{thy}~\isa{consts} propagates changes in executable content;
 81.1637 -    if possible, the current theory context is handed over
 81.1638 -    as argument \isa{thy} (if there is no current theory context (e.g.~during
 81.1639 -    theory merge, \verb|NONE|); \isa{consts} indicates the kind
 81.1640 -    of change: \verb|NONE| stands for a fundamental change
 81.1641 -    which invalidates any existing code, \isa{SOME\ consts}
 81.1642 -    hints that executable content for constants \isa{consts}
 81.1643 -    has changed.
 81.1644 -
 81.1645 -  \end{description}
 81.1646 -
 81.1647 -  An instance of \verb|CodeDataFun| provides the following
 81.1648 -  interface:
 81.1649 -
 81.1650 -  \medskip
 81.1651 -  \begin{tabular}{l}
 81.1652 -  \isa{get{\isacharcolon}\ theory\ {\isasymrightarrow}\ T} \\
 81.1653 -  \isa{change{\isacharcolon}\ theory\ {\isasymrightarrow}\ {\isacharparenleft}T\ {\isasymrightarrow}\ T{\isacharparenright}\ {\isasymrightarrow}\ T} \\
 81.1654 -  \isa{change{\isacharunderscore}yield{\isacharcolon}\ theory\ {\isasymrightarrow}\ {\isacharparenleft}T\ {\isasymrightarrow}\ {\isacharprime}a\ {\isacharasterisk}\ T{\isacharparenright}\ {\isasymrightarrow}\ {\isacharprime}a\ {\isacharasterisk}\ T}
 81.1655 -  \end{tabular}
 81.1656 -
 81.1657 -  \begin{description}
 81.1658 -
 81.1659 -  \item \isa{get} retrieval of the current data.
 81.1660 -
 81.1661 -  \item \isa{change} update of current data (cached!)
 81.1662 -    by giving a continuation.
 81.1663 -
 81.1664 -  \item \isa{change{\isacharunderscore}yield} update with side result.
 81.1665 -
 81.1666 -  \end{description}%
 81.1667 -\end{isamarkuptext}%
 81.1668 -\isamarkuptrue%
 81.1669 -%
 81.1670 -\begin{isamarkuptext}%
 81.1671 -\emph{Happy proving, happy hacking!}%
 81.1672 -\end{isamarkuptext}%
 81.1673 -\isamarkuptrue%
 81.1674 -%
 81.1675 -\isadelimtheory
 81.1676 -%
 81.1677 -\endisadelimtheory
 81.1678 -%
 81.1679 -\isatagtheory
 81.1680 -\isacommand{end}\isamarkupfalse%
 81.1681 -%
 81.1682 -\endisatagtheory
 81.1683 -{\isafoldtheory}%
 81.1684 -%
 81.1685 -\isadelimtheory
 81.1686 -%
 81.1687 -\endisadelimtheory
 81.1688 -\isanewline
 81.1689 -\end{isabellebody}%
 81.1690 -%%% Local Variables:
 81.1691 -%%% mode: latex
 81.1692 -%%% TeX-master: "root"
 81.1693 -%%% End:
    82.1 --- a/doc-src/IsarAdvanced/Codegen/Thy/document/Further.tex	Mon Mar 02 16:58:39 2009 +0100
    82.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    82.3 @@ -1,234 +0,0 @@
    82.4 -%
    82.5 -\begin{isabellebody}%
    82.6 -\def\isabellecontext{Further}%
    82.7 -%
    82.8 -\isadelimtheory
    82.9 -%
   82.10 -\endisadelimtheory
   82.11 -%
   82.12 -\isatagtheory
   82.13 -\isacommand{theory}\isamarkupfalse%
   82.14 -\ Further\isanewline
   82.15 -\isakeyword{imports}\ Setup\isanewline
   82.16 -\isakeyword{begin}%
   82.17 -\endisatagtheory
   82.18 -{\isafoldtheory}%
   82.19 -%
   82.20 -\isadelimtheory
   82.21 -%
   82.22 -\endisadelimtheory
   82.23 -%
   82.24 -\isamarkupsection{Further issues \label{sec:further}%
   82.25 -}
   82.26 -\isamarkuptrue%
   82.27 -%
   82.28 -\isamarkupsubsection{Further reading%
   82.29 -}
   82.30 -\isamarkuptrue%
   82.31 -%
   82.32 -\begin{isamarkuptext}%
   82.33 -Do dive deeper into the issue of code generation, you should visit
   82.34 -  the Isabelle/Isar Reference Manual \cite{isabelle-isar-ref} which
   82.35 -  contains exhaustive syntax diagrams.%
   82.36 -\end{isamarkuptext}%
   82.37 -\isamarkuptrue%
   82.38 -%
   82.39 -\isamarkupsubsection{Modules%
   82.40 -}
   82.41 -\isamarkuptrue%
   82.42 -%
   82.43 -\begin{isamarkuptext}%
   82.44 -When invoking the \hyperlink{command.export-code}{\mbox{\isa{\isacommand{export{\isacharunderscore}code}}}} command it is possible to leave
   82.45 -  out the \hyperlink{keyword.module-name}{\mbox{\isa{\isakeyword{module{\isacharunderscore}name}}}} part;  then code is distributed over
   82.46 -  different modules, where the module name space roughly is induced
   82.47 -  by the \isa{Isabelle} theory name space.
   82.48 -
   82.49 -  Then sometimes the awkward situation occurs that dependencies between
   82.50 -  definitions introduce cyclic dependencies between modules, which in the
   82.51 -  \isa{Haskell} world leaves you to the mercy of the \isa{Haskell} implementation
   82.52 -  you are using,  while for \isa{SML}/\isa{OCaml} code generation is not possible.
   82.53 -
   82.54 -  A solution is to declare module names explicitly.
   82.55 -  Let use assume the three cyclically dependent
   82.56 -  modules are named \emph{A}, \emph{B} and \emph{C}.
   82.57 -  Then, by stating%
   82.58 -\end{isamarkuptext}%
   82.59 -\isamarkuptrue%
   82.60 -%
   82.61 -\isadelimquote
   82.62 -%
   82.63 -\endisadelimquote
   82.64 -%
   82.65 -\isatagquote
   82.66 -\isacommand{code{\isacharunderscore}modulename}\isamarkupfalse%
   82.67 -\ SML\isanewline
   82.68 -\ \ A\ ABC\isanewline
   82.69 -\ \ B\ ABC\isanewline
   82.70 -\ \ C\ ABC%
   82.71 -\endisatagquote
   82.72 -{\isafoldquote}%
   82.73 -%
   82.74 -\isadelimquote
   82.75 -%
   82.76 -\endisadelimquote
   82.77 -%
   82.78 -\begin{isamarkuptext}%
   82.79 -we explicitly map all those modules on \emph{ABC},
   82.80 -  resulting in an ad-hoc merge of this three modules
   82.81 -  at serialisation time.%
   82.82 -\end{isamarkuptext}%
   82.83 -\isamarkuptrue%
   82.84 -%
   82.85 -\isamarkupsubsection{Evaluation oracle%
   82.86 -}
   82.87 -\isamarkuptrue%
   82.88 -%
   82.89 -\begin{isamarkuptext}%
   82.90 -Code generation may also be used to \emph{evaluate} expressions
   82.91 -  (using \isa{SML} as target language of course).
   82.92 -  For instance, the \hyperlink{command.value}{\mbox{\isa{\isacommand{value}}}} allows to reduce an expression to a
   82.93 -  normal form with respect to the underlying code equations:%
   82.94 -\end{isamarkuptext}%
   82.95 -\isamarkuptrue%
   82.96 -%
   82.97 -\isadelimquote
   82.98 -%
   82.99 -\endisadelimquote
  82.100 -%
  82.101 -\isatagquote
  82.102 -\isacommand{value}\isamarkupfalse%
  82.103 -\ {\isachardoublequoteopen}{\isadigit{4}}{\isadigit{2}}\ {\isacharslash}\ {\isacharparenleft}{\isadigit{1}}{\isadigit{2}}\ {\isacharcolon}{\isacharcolon}\ rat{\isacharparenright}{\isachardoublequoteclose}%
  82.104 -\endisatagquote
  82.105 -{\isafoldquote}%
  82.106 -%
  82.107 -\isadelimquote
  82.108 -%
  82.109 -\endisadelimquote
  82.110 -%
  82.111 -\begin{isamarkuptext}%
  82.112 -\noindent will display \isa{{\isadigit{7}}\ {\isacharslash}\ {\isadigit{2}}}.
  82.113 -
  82.114 -  The \hyperlink{method.eval}{\mbox{\isa{eval}}} method tries to reduce a goal by code generation to \isa{True}
  82.115 -  and solves it in that case, but fails otherwise:%
  82.116 -\end{isamarkuptext}%
  82.117 -\isamarkuptrue%
  82.118 -%
  82.119 -\isadelimquote
  82.120 -%
  82.121 -\endisadelimquote
  82.122 -%
  82.123 -\isatagquote
  82.124 -\isacommand{lemma}\isamarkupfalse%
  82.125 -\ {\isachardoublequoteopen}{\isadigit{4}}{\isadigit{2}}\ {\isacharslash}\ {\isacharparenleft}{\isadigit{1}}{\isadigit{2}}\ {\isacharcolon}{\isacharcolon}\ rat{\isacharparenright}\ {\isacharequal}\ {\isadigit{7}}\ {\isacharslash}\ {\isadigit{2}}{\isachardoublequoteclose}\isanewline
  82.126 -\ \ \isacommand{by}\isamarkupfalse%
  82.127 -\ eval%
  82.128 -\endisatagquote
  82.129 -{\isafoldquote}%
  82.130 -%
  82.131 -\isadelimquote
  82.132 -%
  82.133 -\endisadelimquote
  82.134 -%
  82.135 -\begin{isamarkuptext}%
  82.136 -\noindent The soundness of the \hyperlink{method.eval}{\mbox{\isa{eval}}} method depends crucially 
  82.137 -  on the correctness of the code generator;  this is one of the reasons
  82.138 -  why you should not use adaption (see \secref{sec:adaption}) frivolously.%
  82.139 -\end{isamarkuptext}%
  82.140 -\isamarkuptrue%
  82.141 -%
  82.142 -\isamarkupsubsection{Code antiquotation%
  82.143 -}
  82.144 -\isamarkuptrue%
  82.145 -%
  82.146 -\begin{isamarkuptext}%
  82.147 -In scenarios involving techniques like reflection it is quite common
  82.148 -  that code generated from a theory forms the basis for implementing
  82.149 -  a proof procedure in \isa{SML}.  To facilitate interfacing of generated code
  82.150 -  with system code, the code generator provides a \isa{code} antiquotation:%
  82.151 -\end{isamarkuptext}%
  82.152 -\isamarkuptrue%
  82.153 -%
  82.154 -\isadelimquote
  82.155 -%
  82.156 -\endisadelimquote
  82.157 -%
  82.158 -\isatagquote
  82.159 -\isacommand{datatype}\isamarkupfalse%
  82.160 -\ form\ {\isacharequal}\ T\ {\isacharbar}\ F\ {\isacharbar}\ And\ form\ form\ {\isacharbar}\ Or\ form\ form\isanewline
  82.161 -\isanewline
  82.162 -\isacommand{ML}\isamarkupfalse%
  82.163 -\ {\isacharverbatimopen}\isanewline
  82.164 -\ \ fun\ eval{\isacharunderscore}form\ %
  82.165 -\isaantiq
  82.166 -code\ T%
  82.167 -\endisaantiq
  82.168 -\ {\isacharequal}\ true\isanewline
  82.169 -\ \ \ \ {\isacharbar}\ eval{\isacharunderscore}form\ %
  82.170 -\isaantiq
  82.171 -code\ F%
  82.172 -\endisaantiq
  82.173 -\ {\isacharequal}\ false\isanewline
  82.174 -\ \ \ \ {\isacharbar}\ eval{\isacharunderscore}form\ {\isacharparenleft}%
  82.175 -\isaantiq
  82.176 -code\ And%
  82.177 -\endisaantiq
  82.178 -\ {\isacharparenleft}p{\isacharcomma}\ q{\isacharparenright}{\isacharparenright}\ {\isacharequal}\isanewline
  82.179 -\ \ \ \ \ \ \ \ eval{\isacharunderscore}form\ p\ andalso\ eval{\isacharunderscore}form\ q\isanewline
  82.180 -\ \ \ \ {\isacharbar}\ eval{\isacharunderscore}form\ {\isacharparenleft}%
  82.181 -\isaantiq
  82.182 -code\ Or%
  82.183 -\endisaantiq
  82.184 -\ {\isacharparenleft}p{\isacharcomma}\ q{\isacharparenright}{\isacharparenright}\ {\isacharequal}\isanewline
  82.185 -\ \ \ \ \ \ \ \ eval{\isacharunderscore}form\ p\ orelse\ eval{\isacharunderscore}form\ q{\isacharsemicolon}\isanewline
  82.186 -{\isacharverbatimclose}%
  82.187 -\endisatagquote
  82.188 -{\isafoldquote}%
  82.189 -%
  82.190 -\isadelimquote
  82.191 -%
  82.192 -\endisadelimquote
  82.193 -%
  82.194 -\begin{isamarkuptext}%
  82.195 -\noindent \isa{code} takes as argument the name of a constant;  after the
  82.196 -  whole \isa{SML} is read, the necessary code is generated transparently
  82.197 -  and the corresponding constant names are inserted.  This technique also
  82.198 -  allows to use pattern matching on constructors stemming from compiled
  82.199 -  \isa{datatypes}.
  82.200 -
  82.201 -  For a less simplistic example, theory \hyperlink{theory.Ferrack}{\mbox{\isa{Ferrack}}} is
  82.202 -  a good reference.%
  82.203 -\end{isamarkuptext}%
  82.204 -\isamarkuptrue%
  82.205 -%
  82.206 -\isamarkupsubsection{Imperative data structures%
  82.207 -}
  82.208 -\isamarkuptrue%
  82.209 -%
  82.210 -\begin{isamarkuptext}%
  82.211 -If you consider imperative data structures as inevitable for a specific
  82.212 -  application, you should consider
  82.213 -  \emph{Imperative Functional Programming with Isabelle/HOL}
  82.214 -  (\cite{bulwahn-et-al:2008:imperative});
  82.215 -  the framework described there is available in theory \hyperlink{theory.Imperative-HOL}{\mbox{\isa{Imperative{\isacharunderscore}HOL}}}.%
  82.216 -\end{isamarkuptext}%
  82.217 -\isamarkuptrue%
  82.218 -%
  82.219 -\isadelimtheory
  82.220 -%
  82.221 -\endisadelimtheory
  82.222 -%
  82.223 -\isatagtheory
  82.224 -\isacommand{end}\isamarkupfalse%
  82.225 -%
  82.226 -\endisatagtheory
  82.227 -{\isafoldtheory}%
  82.228 -%
  82.229 -\isadelimtheory
  82.230 -%
  82.231 -\endisadelimtheory
  82.232 -\isanewline
  82.233 -\end{isabellebody}%
  82.234 -%%% Local Variables:
  82.235 -%%% mode: latex
  82.236 -%%% TeX-master: "root"
  82.237 -%%% End:
    83.1 --- a/doc-src/IsarAdvanced/Codegen/Thy/document/Introduction.tex	Mon Mar 02 16:58:39 2009 +0100
    83.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    83.3 @@ -1,390 +0,0 @@
    83.4 -%
    83.5 -\begin{isabellebody}%
    83.6 -\def\isabellecontext{Introduction}%
    83.7 -%
    83.8 -\isadelimtheory
    83.9 -%
   83.10 -\endisadelimtheory
   83.11 -%
   83.12 -\isatagtheory
   83.13 -\isacommand{theory}\isamarkupfalse%
   83.14 -\ Introduction\isanewline
   83.15 -\isakeyword{imports}\ Setup\isanewline
   83.16 -\isakeyword{begin}%
   83.17 -\endisatagtheory
   83.18 -{\isafoldtheory}%
   83.19 -%
   83.20 -\isadelimtheory
   83.21 -%
   83.22 -\endisadelimtheory
   83.23 -%
   83.24 -\isamarkupchapter{Code generation from \isa{Isabelle{\isacharslash}HOL} theories%
   83.25 -}
   83.26 -\isamarkuptrue%
   83.27 -%
   83.28 -\isamarkupsection{Introduction and Overview%
   83.29 -}
   83.30 -\isamarkuptrue%
   83.31 -%
   83.32 -\begin{isamarkuptext}%
   83.33 -This tutorial introduces a generic code generator for the
   83.34 -  \isa{Isabelle} system.
   83.35 -  Generic in the sense that the
   83.36 -  \qn{target language} for which code shall ultimately be
   83.37 -  generated is not fixed but may be an arbitrary state-of-the-art
   83.38 -  functional programming language (currently, the implementation
   83.39 -  supports \isa{SML} \cite{SML}, \isa{OCaml} \cite{OCaml} and \isa{Haskell}
   83.40 -  \cite{haskell-revised-report}).
   83.41 -
   83.42 -  Conceptually the code generator framework is part
   83.43 -  of Isabelle's \hyperlink{theory.Pure}{\mbox{\isa{Pure}}} meta logic framework; the logic
   83.44 -  \hyperlink{theory.HOL}{\mbox{\isa{HOL}}} which is an extension of \hyperlink{theory.Pure}{\mbox{\isa{Pure}}}
   83.45 -  already comes with a reasonable framework setup and thus provides
   83.46 -  a good working horse for raising code-generation-driven
   83.47 -  applications.  So, we assume some familiarity and experience
   83.48 -  with the ingredients of the \hyperlink{theory.HOL}{\mbox{\isa{HOL}}} distribution theories.
   83.49 -  (see also \cite{isa-tutorial}).
   83.50 -
   83.51 -  The code generator aims to be usable with no further ado
   83.52 -  in most cases while allowing for detailed customisation.
   83.53 -  This manifests in the structure of this tutorial: after a short
   83.54 -  conceptual introduction with an example (\secref{sec:intro}),
   83.55 -  we discuss the generic customisation facilities (\secref{sec:program}).
   83.56 -  A further section (\secref{sec:adaption}) is dedicated to the matter of
   83.57 -  \qn{adaption} to specific target language environments.  After some
   83.58 -  further issues (\secref{sec:further}) we conclude with an overview
   83.59 -  of some ML programming interfaces (\secref{sec:ml}).
   83.60 -
   83.61 -  \begin{warn}
   83.62 -    Ultimately, the code generator which this tutorial deals with
   83.63 -    is supposed to replace the existing code generator
   83.64 -    by Stefan Berghofer \cite{Berghofer-Nipkow:2002}.
   83.65 -    So, for the moment, there are two distinct code generators
   83.66 -    in Isabelle.  In case of ambiguity, we will refer to the framework
   83.67 -    described here as \isa{generic\ code\ generator}, to the
   83.68 -    other as \isa{SML\ code\ generator}.
   83.69 -    Also note that while the framework itself is
   83.70 -    object-logic independent, only \hyperlink{theory.HOL}{\mbox{\isa{HOL}}} provides a reasonable
   83.71 -    framework setup.    
   83.72 -  \end{warn}%
   83.73 -\end{isamarkuptext}%
   83.74 -\isamarkuptrue%
   83.75 -%
   83.76 -\isamarkupsubsection{Code generation via shallow embedding \label{sec:intro}%
   83.77 -}
   83.78 -\isamarkuptrue%
   83.79 -%
   83.80 -\begin{isamarkuptext}%
   83.81 -The key concept for understanding \isa{Isabelle}'s code generation is
   83.82 -  \emph{shallow embedding}, i.e.~logical entities like constants, types and
   83.83 -  classes are identified with corresponding concepts in the target language.
   83.84 -
   83.85 -  Inside \hyperlink{theory.HOL}{\mbox{\isa{HOL}}}, the \hyperlink{command.datatype}{\mbox{\isa{\isacommand{datatype}}}} and
   83.86 -  \hyperlink{command.definition}{\mbox{\isa{\isacommand{definition}}}}/\hyperlink{command.primrec}{\mbox{\isa{\isacommand{primrec}}}}/\hyperlink{command.fun}{\mbox{\isa{\isacommand{fun}}}} declarations form
   83.87 -  the core of a functional programming language.  The default code generator setup
   83.88 -  allows to turn those into functional programs immediately.
   83.89 -  This means that \qt{naive} code generation can proceed without further ado.
   83.90 -  For example, here a simple \qt{implementation} of amortised queues:%
   83.91 -\end{isamarkuptext}%
   83.92 -\isamarkuptrue%
   83.93 -%
   83.94 -\isadelimquote
   83.95 -%
   83.96 -\endisadelimquote
   83.97 -%
   83.98 -\isatagquote
   83.99 -\isacommand{datatype}\isamarkupfalse%
  83.100 -\ {\isacharprime}a\ queue\ {\isacharequal}\ AQueue\ {\isachardoublequoteopen}{\isacharprime}a\ list{\isachardoublequoteclose}\ {\isachardoublequoteopen}{\isacharprime}a\ list{\isachardoublequoteclose}\isanewline
  83.101 -\isanewline
  83.102 -\isacommand{definition}\isamarkupfalse%
  83.103 -\ empty\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a\ queue{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  83.104 -\ \ {\isachardoublequoteopen}empty\ {\isacharequal}\ AQueue\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharbrackleft}{\isacharbrackright}{\isachardoublequoteclose}\isanewline
  83.105 -\isanewline
  83.106 -\isacommand{primrec}\isamarkupfalse%
  83.107 -\ enqueue\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a\ queue\ {\isasymRightarrow}\ {\isacharprime}a\ queue{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  83.108 -\ \ {\isachardoublequoteopen}enqueue\ x\ {\isacharparenleft}AQueue\ xs\ ys{\isacharparenright}\ {\isacharequal}\ AQueue\ {\isacharparenleft}x\ {\isacharhash}\ xs{\isacharparenright}\ ys{\isachardoublequoteclose}\isanewline
  83.109 -\isanewline
  83.110 -\isacommand{fun}\isamarkupfalse%
  83.111 -\ dequeue\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a\ queue\ {\isasymRightarrow}\ {\isacharprime}a\ option\ {\isasymtimes}\ {\isacharprime}a\ queue{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  83.112 -\ \ \ \ {\isachardoublequoteopen}dequeue\ {\isacharparenleft}AQueue\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharbrackleft}{\isacharbrackright}{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}None{\isacharcomma}\ AQueue\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharbrackleft}{\isacharbrackright}{\isacharparenright}{\isachardoublequoteclose}\isanewline
  83.113 -\ \ {\isacharbar}\ {\isachardoublequoteopen}dequeue\ {\isacharparenleft}AQueue\ xs\ {\isacharparenleft}y\ {\isacharhash}\ ys{\isacharparenright}{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}Some\ y{\isacharcomma}\ AQueue\ xs\ ys{\isacharparenright}{\isachardoublequoteclose}\isanewline
  83.114 -\ \ {\isacharbar}\ {\isachardoublequoteopen}dequeue\ {\isacharparenleft}AQueue\ xs\ {\isacharbrackleft}{\isacharbrackright}{\isacharparenright}\ {\isacharequal}\isanewline
  83.115 -\ \ \ \ \ \ {\isacharparenleft}case\ rev\ xs\ of\ y\ {\isacharhash}\ ys\ {\isasymRightarrow}\ {\isacharparenleft}Some\ y{\isacharcomma}\ AQueue\ {\isacharbrackleft}{\isacharbrackright}\ ys{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}%
  83.116 -\endisatagquote
  83.117 -{\isafoldquote}%
  83.118 -%
  83.119 -\isadelimquote
  83.120 -%
  83.121 -\endisadelimquote
  83.122 -%
  83.123 -\begin{isamarkuptext}%
  83.124 -\noindent Then we can generate code e.g.~for \isa{SML} as follows:%
  83.125 -\end{isamarkuptext}%
  83.126 -\isamarkuptrue%
  83.127 -%
  83.128 -\isadelimquote
  83.129 -%
  83.130 -\endisadelimquote
  83.131 -%
  83.132 -\isatagquote
  83.133 -\isacommand{export{\isacharunderscore}code}\isamarkupfalse%
  83.134 -\ empty\ dequeue\ enqueue\ \isakeyword{in}\ SML\isanewline
  83.135 -\ \ \isakeyword{module{\isacharunderscore}name}\ Example\ \isakeyword{file}\ {\isachardoublequoteopen}examples{\isacharslash}example{\isachardot}ML{\isachardoublequoteclose}%
  83.136 -\endisatagquote
  83.137 -{\isafoldquote}%
  83.138 -%
  83.139 -\isadelimquote
  83.140 -%
  83.141 -\endisadelimquote
  83.142 -%
  83.143 -\begin{isamarkuptext}%
  83.144 -\noindent resulting in the following code:%
  83.145 -\end{isamarkuptext}%
  83.146 -\isamarkuptrue%
  83.147 -%
  83.148 -\isadelimquote
  83.149 -%
  83.150 -\endisadelimquote
  83.151 -%
  83.152 -\isatagquote
  83.153 -%
  83.154 -\begin{isamarkuptext}%
  83.155 -\isatypewriter%
  83.156 -\noindent%
  83.157 -\hspace*{0pt}structure Example = \\
  83.158 -\hspace*{0pt}struct\\
  83.159 -\hspace*{0pt}\\
  83.160 -\hspace*{0pt}fun foldl f a [] = a\\
  83.161 -\hspace*{0pt} ~| foldl f a (x ::~xs) = foldl f (f a x) xs;\\
  83.162 -\hspace*{0pt}\\
  83.163 -\hspace*{0pt}fun rev xs = foldl (fn xsa => fn x => x ::~xsa) [] xs;\\
  83.164 -\hspace*{0pt}\\
  83.165 -\hspace*{0pt}fun list{\char95}case f1 f2 (a ::~lista) = f2 a lista\\
  83.166 -\hspace*{0pt} ~| list{\char95}case f1 f2 [] = f1;\\
  83.167 -\hspace*{0pt}\\
  83.168 -\hspace*{0pt}datatype 'a queue = AQueue of 'a list * 'a list;\\
  83.169 -\hspace*{0pt}\\
  83.170 -\hspace*{0pt}val empty :~'a queue = AQueue ([],~[])\\
  83.171 -\hspace*{0pt}\\
  83.172 -\hspace*{0pt}fun dequeue (AQueue ([],~[])) = (NONE,~AQueue ([],~[]))\\
  83.173 -\hspace*{0pt} ~| dequeue (AQueue (xs,~y ::~ys)) = (SOME y,~AQueue (xs,~ys))\\
  83.174 -\hspace*{0pt} ~| dequeue (AQueue (v ::~va,~[])) =\\
  83.175 -\hspace*{0pt} ~~~let\\
  83.176 -\hspace*{0pt} ~~~~~val y ::~ys = rev (v ::~va);\\
  83.177 -\hspace*{0pt} ~~~in\\
  83.178 -\hspace*{0pt} ~~~~~(SOME y,~AQueue ([],~ys))\\
  83.179 -\hspace*{0pt} ~~~end;\\
  83.180 -\hspace*{0pt}\\
  83.181 -\hspace*{0pt}fun enqueue x (AQueue (xs,~ys)) = AQueue (x ::~xs,~ys);\\
  83.182 -\hspace*{0pt}\\
  83.183 -\hspace*{0pt}end;~(*struct Example*)%
  83.184 -\end{isamarkuptext}%
  83.185 -\isamarkuptrue%
  83.186 -%
  83.187 -\endisatagquote
  83.188 -{\isafoldquote}%
  83.189 -%
  83.190 -\isadelimquote
  83.191 -%
  83.192 -\endisadelimquote
  83.193 -%
  83.194 -\begin{isamarkuptext}%
  83.195 -\noindent The \hyperlink{command.export-code}{\mbox{\isa{\isacommand{export{\isacharunderscore}code}}}} command takes a space-separated list of
  83.196 -  constants for which code shall be generated;  anything else needed for those
  83.197 -  is added implicitly.  Then follows a target language identifier
  83.198 -  (\isa{SML}, \isa{OCaml} or \isa{Haskell}) and a freely chosen module name.
  83.199 -  A file name denotes the destination to store the generated code.  Note that
  83.200 -  the semantics of the destination depends on the target language:  for
  83.201 -  \isa{SML} and \isa{OCaml} it denotes a \emph{file}, for \isa{Haskell}
  83.202 -  it denotes a \emph{directory} where a file named as the module name
  83.203 -  (with extension \isa{{\isachardot}hs}) is written:%
  83.204 -\end{isamarkuptext}%
  83.205 -\isamarkuptrue%
  83.206 -%
  83.207 -\isadelimquote
  83.208 -%
  83.209 -\endisadelimquote
  83.210 -%
  83.211 -\isatagquote
  83.212 -\isacommand{export{\isacharunderscore}code}\isamarkupfalse%
  83.213 -\ empty\ dequeue\ enqueue\ \isakeyword{in}\ Haskell\isanewline
  83.214 -\ \ \isakeyword{module{\isacharunderscore}name}\ Example\ \isakeyword{file}\ {\isachardoublequoteopen}examples{\isacharslash}{\isachardoublequoteclose}%
  83.215 -\endisatagquote
  83.216 -{\isafoldquote}%
  83.217 -%
  83.218 -\isadelimquote
  83.219 -%
  83.220 -\endisadelimquote
  83.221 -%
  83.222 -\begin{isamarkuptext}%
  83.223 -\noindent This is how the corresponding code in \isa{Haskell} looks like:%
  83.224 -\end{isamarkuptext}%
  83.225 -\isamarkuptrue%
  83.226 -%
  83.227 -\isadelimquote
  83.228 -%
  83.229 -\endisadelimquote
  83.230 -%
  83.231 -\isatagquote
  83.232 -%
  83.233 -\begin{isamarkuptext}%
  83.234 -\isatypewriter%
  83.235 -\noindent%
  83.236 -\hspace*{0pt}module Example where {\char123}\\
  83.237 -\hspace*{0pt}\\
  83.238 -\hspace*{0pt}\\
  83.239 -\hspace*{0pt}foldla ::~forall a b.~(a -> b -> a) -> a -> [b] -> a;\\
  83.240 -\hspace*{0pt}foldla f a [] = a;\\
  83.241 -\hspace*{0pt}foldla f a (x :~xs) = foldla f (f a x) xs;\\
  83.242 -\hspace*{0pt}\\
  83.243 -\hspace*{0pt}rev ::~forall a.~[a] -> [a];\\
  83.244 -\hspace*{0pt}rev xs = foldla ({\char92}~xsa x -> x :~xsa) [] xs;\\
  83.245 -\hspace*{0pt}\\
  83.246 -\hspace*{0pt}list{\char95}case ::~forall t a.~t -> (a -> [a] -> t) -> [a] -> t;\\
  83.247 -\hspace*{0pt}list{\char95}case f1 f2 (a :~list) = f2 a list;\\
  83.248 -\hspace*{0pt}list{\char95}case f1 f2 [] = f1;\\
  83.249 -\hspace*{0pt}\\
  83.250 -\hspace*{0pt}data Queue a = AQueue [a] [a];\\
  83.251 -\hspace*{0pt}\\
  83.252 -\hspace*{0pt}empty ::~forall a.~Queue a;\\
  83.253 -\hspace*{0pt}empty = AQueue [] [];\\
  83.254 -\hspace*{0pt}\\
  83.255 -\hspace*{0pt}dequeue ::~forall a.~Queue a -> (Maybe a,~Queue a);\\
  83.256 -\hspace*{0pt}dequeue (AQueue [] []) = (Nothing,~AQueue [] []);\\
  83.257 -\hspace*{0pt}dequeue (AQueue xs (y :~ys)) = (Just y,~AQueue xs ys);\\
  83.258 -\hspace*{0pt}dequeue (AQueue (v :~va) []) =\\
  83.259 -\hspace*{0pt} ~let {\char123}\\
  83.260 -\hspace*{0pt} ~~~(y :~ys) = rev (v :~va);\\
  83.261 -\hspace*{0pt} ~{\char125}~in (Just y,~AQueue [] ys);\\
  83.262 -\hspace*{0pt}\\
  83.263 -\hspace*{0pt}enqueue ::~forall a.~a -> Queue a -> Queue a;\\
  83.264 -\hspace*{0pt}enqueue x (AQueue xs ys) = AQueue (x :~xs) ys;\\
  83.265 -\hspace*{0pt}\\
  83.266 -\hspace*{0pt}{\char125}%
  83.267 -\end{isamarkuptext}%
  83.268 -\isamarkuptrue%
  83.269 -%
  83.270 -\endisatagquote
  83.271 -{\isafoldquote}%
  83.272 -%
  83.273 -\isadelimquote
  83.274 -%
  83.275 -\endisadelimquote
  83.276 -%
  83.277 -\begin{isamarkuptext}%
  83.278 -\noindent This demonstrates the basic usage of the \hyperlink{command.export-code}{\mbox{\isa{\isacommand{export{\isacharunderscore}code}}}} command;
  83.279 -  for more details see \secref{sec:further}.%
  83.280 -\end{isamarkuptext}%
  83.281 -\isamarkuptrue%
  83.282 -%
  83.283 -\isamarkupsubsection{Code generator architecture \label{sec:concept}%
  83.284 -}
  83.285 -\isamarkuptrue%
  83.286 -%
  83.287 -\begin{isamarkuptext}%
  83.288 -What you have seen so far should be already enough in a lot of cases.  If you
  83.289 -  are content with this, you can quit reading here.  Anyway, in order to customise
  83.290 -  and adapt the code generator, it is inevitable to gain some understanding
  83.291 -  how it works.
  83.292 -
  83.293 -  \begin{figure}[h]
  83.294 -    \begin{tikzpicture}[x = 4.2cm, y = 1cm]
  83.295 -      \tikzstyle entity=[rounded corners, draw, thick, color = black, fill = white];
  83.296 -      \tikzstyle process=[ellipse, draw, thick, color = green, fill = white];
  83.297 -      \tikzstyle process_arrow=[->, semithick, color = green];
  83.298 -      \node (HOL) at (0, 4) [style=entity] {\isa{Isabelle{\isacharslash}HOL} theory};
  83.299 -      \node (eqn) at (2, 2) [style=entity] {code equations};
  83.300 -      \node (iml) at (2, 0) [style=entity] {intermediate language};
  83.301 -      \node (seri) at (1, 0) [style=process] {serialisation};
  83.302 -      \node (SML) at (0, 3) [style=entity] {\isa{SML}};
  83.303 -      \node (OCaml) at (0, 2) [style=entity] {\isa{OCaml}};
  83.304 -      \node (further) at (0, 1) [style=entity] {\isa{{\isasymdots}}};
  83.305 -      \node (Haskell) at (0, 0) [style=entity] {\isa{Haskell}};
  83.306 -      \draw [style=process_arrow] (HOL) .. controls (2, 4) ..
  83.307 -        node [style=process, near start] {selection}
  83.308 -        node [style=process, near end] {preprocessing}
  83.309 -        (eqn);
  83.310 -      \draw [style=process_arrow] (eqn) -- node (transl) [style=process] {translation} (iml);
  83.311 -      \draw [style=process_arrow] (iml) -- (seri);
  83.312 -      \draw [style=process_arrow] (seri) -- (SML);
  83.313 -      \draw [style=process_arrow] (seri) -- (OCaml);
  83.314 -      \draw [style=process_arrow, dashed] (seri) -- (further);
  83.315 -      \draw [style=process_arrow] (seri) -- (Haskell);
  83.316 -    \end{tikzpicture}
  83.317 -    \caption{Code generator architecture}
  83.318 -    \label{fig:arch}
  83.319 -  \end{figure}
  83.320 -
  83.321 -  The code generator employs a notion of executability
  83.322 -  for three foundational executable ingredients known
  83.323 -  from functional programming:
  83.324 -  \emph{code equations}, \emph{datatypes}, and
  83.325 -  \emph{type classes}.  A code equation as a first approximation
  83.326 -  is a theorem of the form \isa{f\ t\isactrlisub {\isadigit{1}}\ t\isactrlisub {\isadigit{2}}\ {\isasymdots}\ t\isactrlisub n\ {\isasymequiv}\ t}
  83.327 -  (an equation headed by a constant \isa{f} with arguments
  83.328 -  \isa{t\isactrlisub {\isadigit{1}}\ t\isactrlisub {\isadigit{2}}\ {\isasymdots}\ t\isactrlisub n} and right hand side \isa{t}).
  83.329 -  Code generation aims to turn code equations
  83.330 -  into a functional program.  This is achieved by three major
  83.331 -  components which operate sequentially, i.e. the result of one is
  83.332 -  the input
  83.333 -  of the next in the chain,  see diagram \ref{fig:arch}:
  83.334 -
  83.335 -  \begin{itemize}
  83.336 -
  83.337 -    \item Out of the vast collection of theorems proven in a
  83.338 -      \qn{theory}, a reasonable subset modelling
  83.339 -      code equations is \qn{selected}.
  83.340 -
  83.341 -    \item On those selected theorems, certain
  83.342 -      transformations are carried out
  83.343 -      (\qn{preprocessing}).  Their purpose is to turn theorems
  83.344 -      representing non- or badly executable
  83.345 -      specifications into equivalent but executable counterparts.
  83.346 -      The result is a structured collection of \qn{code theorems}.
  83.347 -
  83.348 -    \item Before the selected code equations are continued with,
  83.349 -      they can be \qn{preprocessed}, i.e. subjected to theorem
  83.350 -      transformations.  This \qn{preprocessor} is an interface which
  83.351 -      allows to apply
  83.352 -      the full expressiveness of ML-based theorem transformations
  83.353 -      to code generation;  motivating examples are shown below, see
  83.354 -      \secref{sec:preproc}.
  83.355 -      The result of the preprocessing step is a structured collection
  83.356 -      of code equations.
  83.357 -
  83.358 -    \item These code equations are \qn{translated} to a program
  83.359 -      in an abstract intermediate language.  Think of it as a kind
  83.360 -      of \qt{Mini-Haskell} with four \qn{statements}: \isa{data}
  83.361 -      (for datatypes), \isa{fun} (stemming from code equations),
  83.362 -      also \isa{class} and \isa{inst} (for type classes).
  83.363 -
  83.364 -    \item Finally, the abstract program is \qn{serialised} into concrete
  83.365 -      source code of a target language.
  83.366 -
  83.367 -  \end{itemize}
  83.368 -
  83.369 -  \noindent From these steps, only the two last are carried out outside the logic;  by
  83.370 -  keeping this layer as thin as possible, the amount of code to trust is
  83.371 -  kept to a minimum.%
  83.372 -\end{isamarkuptext}%
  83.373 -\isamarkuptrue%
  83.374 -%
  83.375 -\isadelimtheory
  83.376 -%
  83.377 -\endisadelimtheory
  83.378 -%
  83.379 -\isatagtheory
  83.380 -\isacommand{end}\isamarkupfalse%
  83.381 -%
  83.382 -\endisatagtheory
  83.383 -{\isafoldtheory}%
  83.384 -%
  83.385 -\isadelimtheory
  83.386 -%
  83.387 -\endisadelimtheory
  83.388 -\isanewline
  83.389 -\end{isabellebody}%
  83.390 -%%% Local Variables:
  83.391 -%%% mode: latex
  83.392 -%%% TeX-master: "root"
  83.393 -%%% End:
    84.1 --- a/doc-src/IsarAdvanced/Codegen/Thy/document/ML.tex	Mon Mar 02 16:58:39 2009 +0100
    84.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    84.3 @@ -1,255 +0,0 @@
    84.4 -%
    84.5 -\begin{isabellebody}%
    84.6 -\def\isabellecontext{ML}%
    84.7 -%
    84.8 -\isadelimtheory
    84.9 -%
   84.10 -\endisadelimtheory
   84.11 -%
   84.12 -\isatagtheory
   84.13 -\isacommand{theory}\isamarkupfalse%
   84.14 -\ {\isachardoublequoteopen}ML{\isachardoublequoteclose}\isanewline
   84.15 -\isakeyword{imports}\ Setup\isanewline
   84.16 -\isakeyword{begin}%
   84.17 -\endisatagtheory
   84.18 -{\isafoldtheory}%
   84.19 -%
   84.20 -\isadelimtheory
   84.21 -%
   84.22 -\endisadelimtheory
   84.23 -%
   84.24 -\isamarkupsection{ML system interfaces \label{sec:ml}%
   84.25 -}
   84.26 -\isamarkuptrue%
   84.27 -%
   84.28 -\begin{isamarkuptext}%
   84.29 -Since the code generator framework not only aims to provide
   84.30 -  a nice Isar interface but also to form a base for
   84.31 -  code-generation-based applications, here a short
   84.32 -  description of the most important ML interfaces.%
   84.33 -\end{isamarkuptext}%
   84.34 -\isamarkuptrue%
   84.35 -%
   84.36 -\isamarkupsubsection{Executable theory content: \isa{Code}%
   84.37 -}
   84.38 -\isamarkuptrue%
   84.39 -%
   84.40 -\begin{isamarkuptext}%
   84.41 -This Pure module implements the core notions of
   84.42 -  executable content of a theory.%
   84.43 -\end{isamarkuptext}%
   84.44 -\isamarkuptrue%
   84.45 -%
   84.46 -\isamarkupsubsubsection{Managing executable content%
   84.47 -}
   84.48 -\isamarkuptrue%
   84.49 -%
   84.50 -\isadelimmlref
   84.51 -%
   84.52 -\endisadelimmlref
   84.53 -%
   84.54 -\isatagmlref
   84.55 -%
   84.56 -\begin{isamarkuptext}%
   84.57 -\begin{mldecls}
   84.58 -  \indexdef{}{ML}{Code.add\_eqn}\verb|Code.add_eqn: thm -> theory -> theory| \\
   84.59 -  \indexdef{}{ML}{Code.del\_eqn}\verb|Code.del_eqn: thm -> theory -> theory| \\
   84.60 -  \indexdef{}{ML}{Code.add\_eqnl}\verb|Code.add_eqnl: string * (thm * bool) list lazy -> theory -> theory| \\
   84.61 -  \indexdef{}{ML}{Code.map\_pre}\verb|Code.map_pre: (simpset -> simpset) -> theory -> theory| \\
   84.62 -  \indexdef{}{ML}{Code.map\_post}\verb|Code.map_post: (simpset -> simpset) -> theory -> theory| \\
   84.63 -  \indexdef{}{ML}{Code.add\_functrans}\verb|Code.add_functrans: string * (theory -> (thm * bool) list -> (thm * bool) list option)|\isasep\isanewline%
   84.64 -\verb|    -> theory -> theory| \\
   84.65 -  \indexdef{}{ML}{Code.del\_functrans}\verb|Code.del_functrans: string -> theory -> theory| \\
   84.66 -  \indexdef{}{ML}{Code.add\_datatype}\verb|Code.add_datatype: (string * typ) list -> theory -> theory| \\
   84.67 -  \indexdef{}{ML}{Code.get\_datatype}\verb|Code.get_datatype: theory -> string|\isasep\isanewline%
   84.68 -\verb|    -> (string * sort) list * (string * typ list) list| \\
   84.69 -  \indexdef{}{ML}{Code.get\_datatype\_of\_constr}\verb|Code.get_datatype_of_constr: theory -> string -> string option|
   84.70 -  \end{mldecls}
   84.71 -
   84.72 -  \begin{description}
   84.73 -
   84.74 -  \item \verb|Code.add_eqn|~\isa{thm}~\isa{thy} adds function
   84.75 -     theorem \isa{thm} to executable content.
   84.76 -
   84.77 -  \item \verb|Code.del_eqn|~\isa{thm}~\isa{thy} removes function
   84.78 -     theorem \isa{thm} from executable content, if present.
   84.79 -
   84.80 -  \item \verb|Code.add_eqnl|~\isa{{\isacharparenleft}const{\isacharcomma}\ lthms{\isacharparenright}}~\isa{thy} adds
   84.81 -     suspended code equations \isa{lthms} for constant
   84.82 -     \isa{const} to executable content.
   84.83 -
   84.84 -  \item \verb|Code.map_pre|~\isa{f}~\isa{thy} changes
   84.85 -     the preprocessor simpset.
   84.86 -
   84.87 -  \item \verb|Code.add_functrans|~\isa{{\isacharparenleft}name{\isacharcomma}\ f{\isacharparenright}}~\isa{thy} adds
   84.88 -     function transformer \isa{f} (named \isa{name}) to executable content;
   84.89 -     \isa{f} is a transformer of the code equations belonging
   84.90 -     to a certain function definition, depending on the
   84.91 -     current theory context.  Returning \isa{NONE} indicates that no
   84.92 -     transformation took place;  otherwise, the whole process will be iterated
   84.93 -     with the new code equations.
   84.94 -
   84.95 -  \item \verb|Code.del_functrans|~\isa{name}~\isa{thy} removes
   84.96 -     function transformer named \isa{name} from executable content.
   84.97 -
   84.98 -  \item \verb|Code.add_datatype|~\isa{cs}~\isa{thy} adds
   84.99 -     a datatype to executable content, with generation
  84.100 -     set \isa{cs}.
  84.101 -
  84.102 -  \item \verb|Code.get_datatype_of_constr|~\isa{thy}~\isa{const}
  84.103 -     returns type constructor corresponding to
  84.104 -     constructor \isa{const}; returns \isa{NONE}
  84.105 -     if \isa{const} is no constructor.
  84.106 -
  84.107 -  \end{description}%
  84.108 -\end{isamarkuptext}%
  84.109 -\isamarkuptrue%
  84.110 -%
  84.111 -\endisatagmlref
  84.112 -{\isafoldmlref}%
  84.113 -%
  84.114 -\isadelimmlref
  84.115 -%
  84.116 -\endisadelimmlref
  84.117 -%
  84.118 -\isamarkupsubsection{Auxiliary%
  84.119 -}
  84.120 -\isamarkuptrue%
  84.121 -%
  84.122 -\isadelimmlref
  84.123 -%
  84.124 -\endisadelimmlref
  84.125 -%
  84.126 -\isatagmlref
  84.127 -%
  84.128 -\begin{isamarkuptext}%
  84.129 -\begin{mldecls}
  84.130 -  \indexdef{}{ML}{Code\_Unit.read\_const}\verb|Code_Unit.read_const: theory -> string -> string| \\
  84.131 -  \indexdef{}{ML}{Code\_Unit.head\_eqn}\verb|Code_Unit.head_eqn: theory -> thm -> string * ((string * sort) list * typ)| \\
  84.132 -  \indexdef{}{ML}{Code\_Unit.rewrite\_eqn}\verb|Code_Unit.rewrite_eqn: simpset -> thm -> thm| \\
  84.133 -  \end{mldecls}
  84.134 -
  84.135 -  \begin{description}
  84.136 -
  84.137 -  \item \verb|Code_Unit.read_const|~\isa{thy}~\isa{s}
  84.138 -     reads a constant as a concrete term expression \isa{s}.
  84.139 -
  84.140 -  \item \verb|Code_Unit.head_eqn|~\isa{thy}~\isa{thm}
  84.141 -     extracts the constant and its type from a code equation \isa{thm}.
  84.142 -
  84.143 -  \item \verb|Code_Unit.rewrite_eqn|~\isa{ss}~\isa{thm}
  84.144 -     rewrites a code equation \isa{thm} with a simpset \isa{ss};
  84.145 -     only arguments and right hand side are rewritten,
  84.146 -     not the head of the code equation.
  84.147 -
  84.148 -  \end{description}%
  84.149 -\end{isamarkuptext}%
  84.150 -\isamarkuptrue%
  84.151 -%
  84.152 -\endisatagmlref
  84.153 -{\isafoldmlref}%
  84.154 -%
  84.155 -\isadelimmlref
  84.156 -%
  84.157 -\endisadelimmlref
  84.158 -%
  84.159 -\isamarkupsubsection{Implementing code generator applications%
  84.160 -}
  84.161 -\isamarkuptrue%
  84.162 -%
  84.163 -\begin{isamarkuptext}%
  84.164 -Implementing code generator applications on top
  84.165 -  of the framework set out so far usually not only
  84.166 -  involves using those primitive interfaces
  84.167 -  but also storing code-dependent data and various
  84.168 -  other things.%
  84.169 -\end{isamarkuptext}%
  84.170 -\isamarkuptrue%
  84.171 -%
  84.172 -\isamarkupsubsubsection{Data depending on the theory's executable content%
  84.173 -}
  84.174 -\isamarkuptrue%
  84.175 -%
  84.176 -\begin{isamarkuptext}%
  84.177 -Due to incrementality of code generation, changes in the
  84.178 -  theory's executable content have to be propagated in a
  84.179 -  certain fashion.  Additionally, such changes may occur
  84.180 -  not only during theory extension but also during theory
  84.181 -  merge, which is a little bit nasty from an implementation
  84.182 -  point of view.  The framework provides a solution
  84.183 -  to this technical challenge by providing a functorial
  84.184 -  data slot \verb|CodeDataFun|; on instantiation
  84.185 -  of this functor, the following types and operations
  84.186 -  are required:
  84.187 -
  84.188 -  \medskip
  84.189 -  \begin{tabular}{l}
  84.190 -  \isa{type\ T} \\
  84.191 -  \isa{val\ empty{\isacharcolon}\ T} \\
  84.192 -  \isa{val\ purge{\isacharcolon}\ theory\ {\isasymrightarrow}\ string\ list\ option\ {\isasymrightarrow}\ T\ {\isasymrightarrow}\ T}
  84.193 -  \end{tabular}
  84.194 -
  84.195 -  \begin{description}
  84.196 -
  84.197 -  \item \isa{T} the type of data to store.
  84.198 -
  84.199 -  \item \isa{empty} initial (empty) data.
  84.200 -
  84.201 -  \item \isa{purge}~\isa{thy}~\isa{consts} propagates changes in executable content;
  84.202 -    \isa{consts} indicates the kind
  84.203 -    of change: \verb|NONE| stands for a fundamental change
  84.204 -    which invalidates any existing code, \isa{SOME\ consts}
  84.205 -    hints that executable content for constants \isa{consts}
  84.206 -    has changed.
  84.207 -
  84.208 -  \end{description}
  84.209 -
  84.210 -  \noindent An instance of \verb|CodeDataFun| provides the following
  84.211 -  interface:
  84.212 -
  84.213 -  \medskip
  84.214 -  \begin{tabular}{l}
  84.215 -  \isa{get{\isacharcolon}\ theory\ {\isasymrightarrow}\ T} \\
  84.216 -  \isa{change{\isacharcolon}\ theory\ {\isasymrightarrow}\ {\isacharparenleft}T\ {\isasymrightarrow}\ T{\isacharparenright}\ {\isasymrightarrow}\ T} \\
  84.217 -  \isa{change{\isacharunderscore}yield{\isacharcolon}\ theory\ {\isasymrightarrow}\ {\isacharparenleft}T\ {\isasymrightarrow}\ {\isacharprime}a\ {\isacharasterisk}\ T{\isacharparenright}\ {\isasymrightarrow}\ {\isacharprime}a\ {\isacharasterisk}\ T}
  84.218 -  \end{tabular}
  84.219 -
  84.220 -  \begin{description}
  84.221 -
  84.222 -  \item \isa{get} retrieval of the current data.
  84.223 -
  84.224 -  \item \isa{change} update of current data (cached!)
  84.225 -    by giving a continuation.
  84.226 -
  84.227 -  \item \isa{change{\isacharunderscore}yield} update with side result.
  84.228 -
  84.229 -  \end{description}%
  84.230 -\end{isamarkuptext}%
  84.231 -\isamarkuptrue%
  84.232 -%
  84.233 -\begin{isamarkuptext}%
  84.234 -\bigskip
  84.235 -
  84.236 -  \emph{Happy proving, happy hacking!}%
  84.237 -\end{isamarkuptext}%
  84.238 -\isamarkuptrue%
  84.239 -%
  84.240 -\isadelimtheory
  84.241 -%
  84.242 -\endisadelimtheory
  84.243 -%
  84.244 -\isatagtheory
  84.245 -\isacommand{end}\isamarkupfalse%
  84.246 -%
  84.247 -\endisatagtheory
  84.248 -{\isafoldtheory}%
  84.249 -%
  84.250 -\isadelimtheory
  84.251 -%
  84.252 -\endisadelimtheory
  84.253 -\isanewline
  84.254 -\end{isabellebody}%
  84.255 -%%% Local Variables:
  84.256 -%%% mode: latex
  84.257 -%%% TeX-master: "root"
  84.258 -%%% End:
    85.1 --- a/doc-src/IsarAdvanced/Codegen/Thy/document/Program.tex	Mon Mar 02 16:58:39 2009 +0100
    85.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    85.3 @@ -1,1250 +0,0 @@
    85.4 -%
    85.5 -\begin{isabellebody}%
    85.6 -\def\isabellecontext{Program}%
    85.7 -%
    85.8 -\isadelimtheory
    85.9 -%
   85.10 -\endisadelimtheory
   85.11 -%
   85.12 -\isatagtheory
   85.13 -\isacommand{theory}\isamarkupfalse%
   85.14 -\ Program\isanewline
   85.15 -\isakeyword{imports}\ Introduction\isanewline
   85.16 -\isakeyword{begin}%
   85.17 -\endisatagtheory
   85.18 -{\isafoldtheory}%
   85.19 -%
   85.20 -\isadelimtheory
   85.21 -%
   85.22 -\endisadelimtheory
   85.23 -%
   85.24 -\isamarkupsection{Turning Theories into Programs \label{sec:program}%
   85.25 -}
   85.26 -\isamarkuptrue%
   85.27 -%
   85.28 -\isamarkupsubsection{The \isa{Isabelle{\isacharslash}HOL} default setup%
   85.29 -}
   85.30 -\isamarkuptrue%
   85.31 -%
   85.32 -\begin{isamarkuptext}%
   85.33 -We have already seen how by default equations stemming from
   85.34 -  \hyperlink{command.definition}{\mbox{\isa{\isacommand{definition}}}}/\hyperlink{command.primrec}{\mbox{\isa{\isacommand{primrec}}}}/\hyperlink{command.fun}{\mbox{\isa{\isacommand{fun}}}}
   85.35 -  statements are used for code generation.  This default behaviour
   85.36 -  can be changed, e.g. by providing different code equations.
   85.37 -  All kinds of customisation shown in this section is \emph{safe}
   85.38 -  in the sense that the user does not have to worry about
   85.39 -  correctness -- all programs generatable that way are partially
   85.40 -  correct.%
   85.41 -\end{isamarkuptext}%
   85.42 -\isamarkuptrue%
   85.43 -%
   85.44 -\isamarkupsubsection{Selecting code equations%
   85.45 -}
   85.46 -\isamarkuptrue%
   85.47 -%
   85.48 -\begin{isamarkuptext}%
   85.49 -Coming back to our introductory example, we
   85.50 -  could provide an alternative code equations for \isa{dequeue}
   85.51 -  explicitly:%
   85.52 -\end{isamarkuptext}%
   85.53 -\isamarkuptrue%
   85.54 -%
   85.55 -\isadelimquote
   85.56 -%
   85.57 -\endisadelimquote
   85.58 -%
   85.59 -\isatagquote
   85.60 -\isacommand{lemma}\isamarkupfalse%
   85.61 -\ {\isacharbrackleft}code{\isacharbrackright}{\isacharcolon}\isanewline
   85.62 -\ \ {\isachardoublequoteopen}dequeue\ {\isacharparenleft}AQueue\ xs\ {\isacharbrackleft}{\isacharbrackright}{\isacharparenright}\ {\isacharequal}\isanewline
   85.63 -\ \ \ \ \ {\isacharparenleft}if\ xs\ {\isacharequal}\ {\isacharbrackleft}{\isacharbrackright}\ then\ {\isacharparenleft}None{\isacharcomma}\ AQueue\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharbrackleft}{\isacharbrackright}{\isacharparenright}\isanewline
   85.64 -\ \ \ \ \ \ \ else\ dequeue\ {\isacharparenleft}AQueue\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharparenleft}rev\ xs{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}\isanewline
   85.65 -\ \ {\isachardoublequoteopen}dequeue\ {\isacharparenleft}AQueue\ xs\ {\isacharparenleft}y\ {\isacharhash}\ ys{\isacharparenright}{\isacharparenright}\ {\isacharequal}\isanewline
   85.66 -\ \ \ \ \ {\isacharparenleft}Some\ y{\isacharcomma}\ AQueue\ xs\ ys{\isacharparenright}{\isachardoublequoteclose}\isanewline
   85.67 -\ \ \isacommand{by}\isamarkupfalse%
   85.68 -\ {\isacharparenleft}cases\ xs{\isacharcomma}\ simp{\isacharunderscore}all{\isacharparenright}\ {\isacharparenleft}cases\ {\isachardoublequoteopen}rev\ xs{\isachardoublequoteclose}{\isacharcomma}\ simp{\isacharunderscore}all{\isacharparenright}%
   85.69 -\endisatagquote
   85.70 -{\isafoldquote}%
   85.71 -%
   85.72 -\isadelimquote
   85.73 -%
   85.74 -\endisadelimquote
   85.75 -%
   85.76 -\begin{isamarkuptext}%
   85.77 -\noindent The annotation \isa{{\isacharbrackleft}code{\isacharbrackright}} is an \isa{Isar}
   85.78 -  \isa{attribute} which states that the given theorems should be
   85.79 -  considered as code equations for a \isa{fun} statement --
   85.80 -  the corresponding constant is determined syntactically.  The resulting code:%
   85.81 -\end{isamarkuptext}%
   85.82 -\isamarkuptrue%
   85.83 -%
   85.84 -\isadelimquote
   85.85 -%
   85.86 -\endisadelimquote
   85.87 -%
   85.88 -\isatagquote
   85.89 -%
   85.90 -\begin{isamarkuptext}%
   85.91 -\isatypewriter%
   85.92 -\noindent%
   85.93 -\hspace*{0pt}dequeue ::~forall a.~Queue a -> (Maybe a,~Queue a);\\
   85.94 -\hspace*{0pt}dequeue (AQueue xs (y :~ys)) = (Just y,~AQueue xs ys);\\
   85.95 -\hspace*{0pt}dequeue (AQueue xs []) =\\
   85.96 -\hspace*{0pt} ~(if nulla xs then (Nothing,~AQueue [] [])\\
   85.97 -\hspace*{0pt} ~~~else dequeue (AQueue [] (rev xs)));%
   85.98 -\end{isamarkuptext}%
   85.99 -\isamarkuptrue%
  85.100 -%
  85.101 -\endisatagquote
  85.102 -{\isafoldquote}%
  85.103 -%
  85.104 -\isadelimquote
  85.105 -%
  85.106 -\endisadelimquote
  85.107 -%
  85.108 -\begin{isamarkuptext}%
  85.109 -\noindent You may note that the equality test \isa{xs\ {\isacharequal}\ {\isacharbrackleft}{\isacharbrackright}} has been
  85.110 -  replaced by the predicate \isa{null\ xs}.  This is due to the default
  85.111 -  setup in the \qn{preprocessor} to be discussed further below (\secref{sec:preproc}).
  85.112 -
  85.113 -  Changing the default constructor set of datatypes is also
  85.114 -  possible.  See \secref{sec:datatypes} for an example.
  85.115 -
  85.116 -  As told in \secref{sec:concept}, code generation is based
  85.117 -  on a structured collection of code theorems.
  85.118 -  For explorative purpose, this collection
  85.119 -  may be inspected using the \hyperlink{command.code-thms}{\mbox{\isa{\isacommand{code{\isacharunderscore}thms}}}} command:%
  85.120 -\end{isamarkuptext}%
  85.121 -\isamarkuptrue%
  85.122 -%
  85.123 -\isadelimquote
  85.124 -%
  85.125 -\endisadelimquote
  85.126 -%
  85.127 -\isatagquote
  85.128 -\isacommand{code{\isacharunderscore}thms}\isamarkupfalse%
  85.129 -\ dequeue%
  85.130 -\endisatagquote
  85.131 -{\isafoldquote}%
  85.132 -%
  85.133 -\isadelimquote
  85.134 -%
  85.135 -\endisadelimquote
  85.136 -%
  85.137 -\begin{isamarkuptext}%
  85.138 -\noindent prints a table with \emph{all} code equations
  85.139 -  for \isa{dequeue}, including
  85.140 -  \emph{all} code equations those equations depend
  85.141 -  on recursively.
  85.142 -  
  85.143 -  Similarly, the \hyperlink{command.code-deps}{\mbox{\isa{\isacommand{code{\isacharunderscore}deps}}}} command shows a graph
  85.144 -  visualising dependencies between code equations.%
  85.145 -\end{isamarkuptext}%
  85.146 -\isamarkuptrue%
  85.147 -%
  85.148 -\isamarkupsubsection{\isa{class} and \isa{instantiation}%
  85.149 -}
  85.150 -\isamarkuptrue%
  85.151 -%
  85.152 -\begin{isamarkuptext}%
  85.153 -Concerning type classes and code generation, let us examine an example
  85.154 -  from abstract algebra:%
  85.155 -\end{isamarkuptext}%
  85.156 -\isamarkuptrue%
  85.157 -%
  85.158 -\isadelimquote
  85.159 -%
  85.160 -\endisadelimquote
  85.161 -%
  85.162 -\isatagquote
  85.163 -\isacommand{class}\isamarkupfalse%
  85.164 -\ semigroup\ {\isacharequal}\isanewline
  85.165 -\ \ \isakeyword{fixes}\ mult\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a{\isachardoublequoteclose}\ {\isacharparenleft}\isakeyword{infixl}\ {\isachardoublequoteopen}{\isasymotimes}{\isachardoublequoteclose}\ {\isadigit{7}}{\isadigit{0}}{\isacharparenright}\isanewline
  85.166 -\ \ \isakeyword{assumes}\ assoc{\isacharcolon}\ {\isachardoublequoteopen}{\isacharparenleft}x\ {\isasymotimes}\ y{\isacharparenright}\ {\isasymotimes}\ z\ {\isacharequal}\ x\ {\isasymotimes}\ {\isacharparenleft}y\ {\isasymotimes}\ z{\isacharparenright}{\isachardoublequoteclose}\isanewline
  85.167 -\isanewline
  85.168 -\isacommand{class}\isamarkupfalse%
  85.169 -\ monoid\ {\isacharequal}\ semigroup\ {\isacharplus}\isanewline
  85.170 -\ \ \isakeyword{fixes}\ neutral\ {\isacharcolon}{\isacharcolon}\ {\isacharprime}a\ {\isacharparenleft}{\isachardoublequoteopen}{\isasymone}{\isachardoublequoteclose}{\isacharparenright}\isanewline
  85.171 -\ \ \isakeyword{assumes}\ neutl{\isacharcolon}\ {\isachardoublequoteopen}{\isasymone}\ {\isasymotimes}\ x\ {\isacharequal}\ x{\isachardoublequoteclose}\isanewline
  85.172 -\ \ \ \ \isakeyword{and}\ neutr{\isacharcolon}\ {\isachardoublequoteopen}x\ {\isasymotimes}\ {\isasymone}\ {\isacharequal}\ x{\isachardoublequoteclose}\isanewline
  85.173 -\isanewline
  85.174 -\isacommand{instantiation}\isamarkupfalse%
  85.175 -\ nat\ {\isacharcolon}{\isacharcolon}\ monoid\isanewline
  85.176 -\isakeyword{begin}\isanewline
  85.177 -\isanewline
  85.178 -\isacommand{primrec}\isamarkupfalse%
  85.179 -\ mult{\isacharunderscore}nat\ \isakeyword{where}\isanewline
  85.180 -\ \ \ \ {\isachardoublequoteopen}{\isadigit{0}}\ {\isasymotimes}\ n\ {\isacharequal}\ {\isacharparenleft}{\isadigit{0}}{\isasymColon}nat{\isacharparenright}{\isachardoublequoteclose}\isanewline
  85.181 -\ \ {\isacharbar}\ {\isachardoublequoteopen}Suc\ m\ {\isasymotimes}\ n\ {\isacharequal}\ n\ {\isacharplus}\ m\ {\isasymotimes}\ n{\isachardoublequoteclose}\isanewline
  85.182 -\isanewline
  85.183 -\isacommand{definition}\isamarkupfalse%
  85.184 -\ neutral{\isacharunderscore}nat\ \isakeyword{where}\isanewline
  85.185 -\ \ {\isachardoublequoteopen}{\isasymone}\ {\isacharequal}\ Suc\ {\isadigit{0}}{\isachardoublequoteclose}\isanewline
  85.186 -\isanewline
  85.187 -\isacommand{lemma}\isamarkupfalse%
  85.188 -\ add{\isacharunderscore}mult{\isacharunderscore}distrib{\isacharcolon}\isanewline
  85.189 -\ \ \isakeyword{fixes}\ n\ m\ q\ {\isacharcolon}{\isacharcolon}\ nat\isanewline
  85.190 -\ \ \isakeyword{shows}\ {\isachardoublequoteopen}{\isacharparenleft}n\ {\isacharplus}\ m{\isacharparenright}\ {\isasymotimes}\ q\ {\isacharequal}\ n\ {\isasymotimes}\ q\ {\isacharplus}\ m\ {\isasymotimes}\ q{\isachardoublequoteclose}\isanewline
  85.191 -\ \ \isacommand{by}\isamarkupfalse%
  85.192 -\ {\isacharparenleft}induct\ n{\isacharparenright}\ simp{\isacharunderscore}all\isanewline
  85.193 -\isanewline
  85.194 -\isacommand{instance}\isamarkupfalse%
  85.195 -\ \isacommand{proof}\isamarkupfalse%
  85.196 -\isanewline
  85.197 -\ \ \isacommand{fix}\isamarkupfalse%
  85.198 -\ m\ n\ q\ {\isacharcolon}{\isacharcolon}\ nat\isanewline
  85.199 -\ \ \isacommand{show}\isamarkupfalse%
  85.200 -\ {\isachardoublequoteopen}m\ {\isasymotimes}\ n\ {\isasymotimes}\ q\ {\isacharequal}\ m\ {\isasymotimes}\ {\isacharparenleft}n\ {\isasymotimes}\ q{\isacharparenright}{\isachardoublequoteclose}\isanewline
  85.201 -\ \ \ \ \isacommand{by}\isamarkupfalse%
  85.202 -\ {\isacharparenleft}induct\ m{\isacharparenright}\ {\isacharparenleft}simp{\isacharunderscore}all\ add{\isacharcolon}\ add{\isacharunderscore}mult{\isacharunderscore}distrib{\isacharparenright}\isanewline
  85.203 -\ \ \isacommand{show}\isamarkupfalse%
  85.204 -\ {\isachardoublequoteopen}{\isasymone}\ {\isasymotimes}\ n\ {\isacharequal}\ n{\isachardoublequoteclose}\isanewline
  85.205 -\ \ \ \ \isacommand{by}\isamarkupfalse%
  85.206 -\ {\isacharparenleft}simp\ add{\isacharcolon}\ neutral{\isacharunderscore}nat{\isacharunderscore}def{\isacharparenright}\isanewline
  85.207 -\ \ \isacommand{show}\isamarkupfalse%
  85.208 -\ {\isachardoublequoteopen}m\ {\isasymotimes}\ {\isasymone}\ {\isacharequal}\ m{\isachardoublequoteclose}\isanewline
  85.209 -\ \ \ \ \isacommand{by}\isamarkupfalse%
  85.210 -\ {\isacharparenleft}induct\ m{\isacharparenright}\ {\isacharparenleft}simp{\isacharunderscore}all\ add{\isacharcolon}\ neutral{\isacharunderscore}nat{\isacharunderscore}def{\isacharparenright}\isanewline
  85.211 -\isacommand{qed}\isamarkupfalse%
  85.212 -\isanewline
  85.213 -\isanewline
  85.214 -\isacommand{end}\isamarkupfalse%
  85.215 -%
  85.216 -\endisatagquote
  85.217 -{\isafoldquote}%
  85.218 -%
  85.219 -\isadelimquote
  85.220 -%
  85.221 -\endisadelimquote
  85.222 -%
  85.223 -\begin{isamarkuptext}%
  85.224 -\noindent We define the natural operation of the natural numbers
  85.225 -  on monoids:%
  85.226 -\end{isamarkuptext}%
  85.227 -\isamarkuptrue%
  85.228 -%
  85.229 -\isadelimquote
  85.230 -%
  85.231 -\endisadelimquote
  85.232 -%
  85.233 -\isatagquote
  85.234 -\isacommand{primrec}\isamarkupfalse%
  85.235 -\ {\isacharparenleft}\isakeyword{in}\ monoid{\isacharparenright}\ pow\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ {\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  85.236 -\ \ \ \ {\isachardoublequoteopen}pow\ {\isadigit{0}}\ a\ {\isacharequal}\ {\isasymone}{\isachardoublequoteclose}\isanewline
  85.237 -\ \ {\isacharbar}\ {\isachardoublequoteopen}pow\ {\isacharparenleft}Suc\ n{\isacharparenright}\ a\ {\isacharequal}\ a\ {\isasymotimes}\ pow\ n\ a{\isachardoublequoteclose}%
  85.238 -\endisatagquote
  85.239 -{\isafoldquote}%
  85.240 -%
  85.241 -\isadelimquote
  85.242 -%
  85.243 -\endisadelimquote
  85.244 -%
  85.245 -\begin{isamarkuptext}%
  85.246 -\noindent This we use to define the discrete exponentiation function:%
  85.247 -\end{isamarkuptext}%
  85.248 -\isamarkuptrue%
  85.249 -%
  85.250 -\isadelimquote
  85.251 -%
  85.252 -\endisadelimquote
  85.253 -%
  85.254 -\isatagquote
  85.255 -\isacommand{definition}\isamarkupfalse%
  85.256 -\ bexp\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ nat{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  85.257 -\ \ {\isachardoublequoteopen}bexp\ n\ {\isacharequal}\ pow\ n\ {\isacharparenleft}Suc\ {\isacharparenleft}Suc\ {\isadigit{0}}{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}%
  85.258 -\endisatagquote
  85.259 -{\isafoldquote}%
  85.260 -%
  85.261 -\isadelimquote
  85.262 -%
  85.263 -\endisadelimquote
  85.264 -%
  85.265 -\begin{isamarkuptext}%
  85.266 -\noindent The corresponding code:%
  85.267 -\end{isamarkuptext}%
  85.268 -\isamarkuptrue%
  85.269 -%
  85.270 -\isadelimquote
  85.271 -%
  85.272 -\endisadelimquote
  85.273 -%
  85.274 -\isatagquote
  85.275 -%
  85.276 -\begin{isamarkuptext}%
  85.277 -\isatypewriter%
  85.278 -\noindent%
  85.279 -\hspace*{0pt}module Example where {\char123}\\
  85.280 -\hspace*{0pt}\\
  85.281 -\hspace*{0pt}\\
  85.282 -\hspace*{0pt}data Nat = Zero{\char95}nat | Suc Nat;\\
  85.283 -\hspace*{0pt}\\
  85.284 -\hspace*{0pt}class Semigroup a where {\char123}\\
  85.285 -\hspace*{0pt} ~mult ::~a -> a -> a;\\
  85.286 -\hspace*{0pt}{\char125};\\
  85.287 -\hspace*{0pt}\\
  85.288 -\hspace*{0pt}class (Semigroup a) => Monoid a where {\char123}\\
  85.289 -\hspace*{0pt} ~neutral ::~a;\\
  85.290 -\hspace*{0pt}{\char125};\\
  85.291 -\hspace*{0pt}\\
  85.292 -\hspace*{0pt}pow ::~forall a.~(Monoid a) => Nat -> a -> a;\\
  85.293 -\hspace*{0pt}pow Zero{\char95}nat a = neutral;\\
  85.294 -\hspace*{0pt}pow (Suc n) a = mult a (pow n a);\\
  85.295 -\hspace*{0pt}\\
  85.296 -\hspace*{0pt}plus{\char95}nat ::~Nat -> Nat -> Nat;\\
  85.297 -\hspace*{0pt}plus{\char95}nat (Suc m) n = plus{\char95}nat m (Suc n);\\
  85.298 -\hspace*{0pt}plus{\char95}nat Zero{\char95}nat n = n;\\
  85.299 -\hspace*{0pt}\\
  85.300 -\hspace*{0pt}neutral{\char95}nat ::~Nat;\\
  85.301 -\hspace*{0pt}neutral{\char95}nat = Suc Zero{\char95}nat;\\
  85.302 -\hspace*{0pt}\\
  85.303 -\hspace*{0pt}mult{\char95}nat ::~Nat -> Nat -> Nat;\\
  85.304 -\hspace*{0pt}mult{\char95}nat Zero{\char95}nat n = Zero{\char95}nat;\\
  85.305 -\hspace*{0pt}mult{\char95}nat (Suc m) n = plus{\char95}nat n (mult{\char95}nat m n);\\
  85.306 -\hspace*{0pt}\\
  85.307 -\hspace*{0pt}instance Semigroup Nat where {\char123}\\
  85.308 -\hspace*{0pt} ~mult = mult{\char95}nat;\\
  85.309 -\hspace*{0pt}{\char125};\\
  85.310 -\hspace*{0pt}\\
  85.311 -\hspace*{0pt}instance Monoid Nat where {\char123}\\
  85.312 -\hspace*{0pt} ~neutral = neutral{\char95}nat;\\
  85.313 -\hspace*{0pt}{\char125};\\
  85.314 -\hspace*{0pt}\\
  85.315 -\hspace*{0pt}bexp ::~Nat -> Nat;\\
  85.316 -\hspace*{0pt}bexp n = pow n (Suc (Suc Zero{\char95}nat));\\
  85.317 -\hspace*{0pt}\\
  85.318 -\hspace*{0pt}{\char125}%
  85.319 -\end{isamarkuptext}%
  85.320 -\isamarkuptrue%
  85.321 -%
  85.322 -\endisatagquote
  85.323 -{\isafoldquote}%
  85.324 -%
  85.325 -\isadelimquote
  85.326 -%
  85.327 -\endisadelimquote
  85.328 -%
  85.329 -\begin{isamarkuptext}%
  85.330 -\noindent This is a convenient place to show how explicit dictionary construction
  85.331 -  manifests in generated code (here, the same example in \isa{SML}):%
  85.332 -\end{isamarkuptext}%
  85.333 -\isamarkuptrue%
  85.334 -%
  85.335 -\isadelimquote
  85.336 -%
  85.337 -\endisadelimquote
  85.338 -%
  85.339 -\isatagquote
  85.340 -%
  85.341 -\begin{isamarkuptext}%
  85.342 -\isatypewriter%
  85.343 -\noindent%
  85.344 -\hspace*{0pt}structure Example = \\
  85.345 -\hspace*{0pt}struct\\
  85.346 -\hspace*{0pt}\\
  85.347 -\hspace*{0pt}datatype nat = Zero{\char95}nat | Suc of nat;\\
  85.348 -\hspace*{0pt}\\
  85.349 -\hspace*{0pt}type 'a semigroup = {\char123}mult :~'a -> 'a -> 'a{\char125};\\
  85.350 -\hspace*{0pt}fun mult (A{\char95}:'a semigroup) = {\char35}mult A{\char95};\\
  85.351 -\hspace*{0pt}\\
  85.352 -\hspace*{0pt}type 'a monoid = {\char123}Program{\char95}{\char95}semigroup{\char95}monoid :~'a semigroup,~neutral :~'a{\char125};\\
  85.353 -\hspace*{0pt}fun semigroup{\char95}monoid (A{\char95}:'a monoid) = {\char35}Program{\char95}{\char95}semigroup{\char95}monoid A{\char95};\\
  85.354 -\hspace*{0pt}fun neutral (A{\char95}:'a monoid) = {\char35}neutral A{\char95};\\
  85.355 -\hspace*{0pt}\\
  85.356 -\hspace*{0pt}fun pow A{\char95}~Zero{\char95}nat a = neutral A{\char95}\\
  85.357 -\hspace*{0pt} ~| pow A{\char95}~(Suc n) a = mult (semigroup{\char95}monoid A{\char95}) a (pow A{\char95}~n a);\\
  85.358 -\hspace*{0pt}\\
  85.359 -\hspace*{0pt}fun plus{\char95}nat (Suc m) n = plus{\char95}nat m (Suc n)\\
  85.360 -\hspace*{0pt} ~| plus{\char95}nat Zero{\char95}nat n = n;\\
  85.361 -\hspace*{0pt}\\
  85.362 -\hspace*{0pt}val neutral{\char95}nat :~nat = Suc Zero{\char95}nat\\
  85.363 -\hspace*{0pt}\\
  85.364 -\hspace*{0pt}fun mult{\char95}nat Zero{\char95}nat n = Zero{\char95}nat\\
  85.365 -\hspace*{0pt} ~| mult{\char95}nat (Suc m) n = plus{\char95}nat n (mult{\char95}nat m n);\\
  85.366 -\hspace*{0pt}\\
  85.367 -\hspace*{0pt}val semigroup{\char95}nat = {\char123}mult = mult{\char95}nat{\char125}~:~nat semigroup;\\
  85.368 -\hspace*{0pt}\\
  85.369 -\hspace*{0pt}val monoid{\char95}nat =\\
  85.370 -\hspace*{0pt} ~{\char123}Program{\char95}{\char95}semigroup{\char95}monoid = semigroup{\char95}nat,~neutral = neutral{\char95}nat{\char125}~:\\
  85.371 -\hspace*{0pt} ~nat monoid;\\
  85.372 -\hspace*{0pt}\\
  85.373 -\hspace*{0pt}fun bexp n = pow monoid{\char95}nat n (Suc (Suc Zero{\char95}nat));\\
  85.374 -\hspace*{0pt}\\
  85.375 -\hspace*{0pt}end;~(*struct Example*)%
  85.376 -\end{isamarkuptext}%
  85.377 -\isamarkuptrue%
  85.378 -%
  85.379 -\endisatagquote
  85.380 -{\isafoldquote}%
  85.381 -%
  85.382 -\isadelimquote
  85.383 -%
  85.384 -\endisadelimquote
  85.385 -%
  85.386 -\begin{isamarkuptext}%
  85.387 -\noindent Note the parameters with trailing underscore (\verb|A_|)
  85.388 -    which are the dictionary parameters.%
  85.389 -\end{isamarkuptext}%
  85.390 -\isamarkuptrue%
  85.391 -%
  85.392 -\isamarkupsubsection{The preprocessor \label{sec:preproc}%
  85.393 -}
  85.394 -\isamarkuptrue%
  85.395 -%
  85.396 -\begin{isamarkuptext}%
  85.397 -Before selected function theorems are turned into abstract
  85.398 -  code, a chain of definitional transformation steps is carried
  85.399 -  out: \emph{preprocessing}.  In essence, the preprocessor
  85.400 -  consists of two components: a \emph{simpset} and \emph{function transformers}.
  85.401 -
  85.402 -  The \emph{simpset} allows to employ the full generality of the Isabelle
  85.403 -  simplifier.  Due to the interpretation of theorems
  85.404 -  as code equations, rewrites are applied to the right
  85.405 -  hand side and the arguments of the left hand side of an
  85.406 -  equation, but never to the constant heading the left hand side.
  85.407 -  An important special case are \emph{inline theorems} which may be
  85.408 -  declared and undeclared using the
  85.409 -  \emph{code inline} or \emph{code inline del} attribute respectively.
  85.410 -
  85.411 -  Some common applications:%
  85.412 -\end{isamarkuptext}%
  85.413 -\isamarkuptrue%
  85.414 -%
  85.415 -\begin{itemize}
  85.416 -%
  85.417 -\begin{isamarkuptext}%
  85.418 -\item replacing non-executable constructs by executable ones:%
  85.419 -\end{isamarkuptext}%
  85.420 -\isamarkuptrue%
  85.421 -%
  85.422 -\isadelimquote
  85.423 -%
  85.424 -\endisadelimquote
  85.425 -%
  85.426 -\isatagquote
  85.427 -\isacommand{lemma}\isamarkupfalse%
  85.428 -\ {\isacharbrackleft}code\ inline{\isacharbrackright}{\isacharcolon}\isanewline
  85.429 -\ \ {\isachardoublequoteopen}x\ {\isasymin}\ set\ xs\ {\isasymlongleftrightarrow}\ x\ mem\ xs{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
  85.430 -\ {\isacharparenleft}induct\ xs{\isacharparenright}\ simp{\isacharunderscore}all%
  85.431 -\endisatagquote
  85.432 -{\isafoldquote}%
  85.433 -%
  85.434 -\isadelimquote
  85.435 -%
  85.436 -\endisadelimquote
  85.437 -%
  85.438 -\begin{isamarkuptext}%
  85.439 -\item eliminating superfluous constants:%
  85.440 -\end{isamarkuptext}%
  85.441 -\isamarkuptrue%
  85.442 -%
  85.443 -\isadelimquote
  85.444 -%
  85.445 -\endisadelimquote
  85.446 -%
  85.447 -\isatagquote
  85.448 -\isacommand{lemma}\isamarkupfalse%
  85.449 -\ {\isacharbrackleft}code\ inline{\isacharbrackright}{\isacharcolon}\isanewline
  85.450 -\ \ {\isachardoublequoteopen}{\isadigit{1}}\ {\isacharequal}\ Suc\ {\isadigit{0}}{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
  85.451 -\ simp%
  85.452 -\endisatagquote
  85.453 -{\isafoldquote}%
  85.454 -%
  85.455 -\isadelimquote
  85.456 -%
  85.457 -\endisadelimquote
  85.458 -%
  85.459 -\begin{isamarkuptext}%
  85.460 -\item replacing executable but inconvenient constructs:%
  85.461 -\end{isamarkuptext}%
  85.462 -\isamarkuptrue%
  85.463 -%
  85.464 -\isadelimquote
  85.465 -%
  85.466 -\endisadelimquote
  85.467 -%
  85.468 -\isatagquote
  85.469 -\isacommand{lemma}\isamarkupfalse%
  85.470 -\ {\isacharbrackleft}code\ inline{\isacharbrackright}{\isacharcolon}\isanewline
  85.471 -\ \ {\isachardoublequoteopen}xs\ {\isacharequal}\ {\isacharbrackleft}{\isacharbrackright}\ {\isasymlongleftrightarrow}\ List{\isachardot}null\ xs{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
  85.472 -\ {\isacharparenleft}induct\ xs{\isacharparenright}\ simp{\isacharunderscore}all%
  85.473 -\endisatagquote
  85.474 -{\isafoldquote}%
  85.475 -%
  85.476 -\isadelimquote
  85.477 -%
  85.478 -\endisadelimquote
  85.479 -%
  85.480 -\end{itemize}
  85.481 -%
  85.482 -\begin{isamarkuptext}%
  85.483 -\noindent \emph{Function transformers} provide a very general interface,
  85.484 -  transforming a list of function theorems to another
  85.485 -  list of function theorems, provided that neither the heading
  85.486 -  constant nor its type change.  The \isa{{\isadigit{0}}} / \isa{Suc}
  85.487 -  pattern elimination implemented in
  85.488 -  theory \isa{Efficient{\isacharunderscore}Nat} (see \secref{eff_nat}) uses this
  85.489 -  interface.
  85.490 -
  85.491 -  \noindent The current setup of the preprocessor may be inspected using
  85.492 -  the \hyperlink{command.print-codesetup}{\mbox{\isa{\isacommand{print{\isacharunderscore}codesetup}}}} command.
  85.493 -  \hyperlink{command.code-thms}{\mbox{\isa{\isacommand{code{\isacharunderscore}thms}}}} provides a convenient
  85.494 -  mechanism to inspect the impact of a preprocessor setup
  85.495 -  on code equations.
  85.496 -
  85.497 -  \begin{warn}
  85.498 -    The attribute \emph{code unfold}
  85.499 -    associated with the \isa{SML\ code\ generator} also applies to
  85.500 -    the \isa{generic\ code\ generator}:
  85.501 -    \emph{code unfold} implies \emph{code inline}.
  85.502 -  \end{warn}%
  85.503 -\end{isamarkuptext}%
  85.504 -\isamarkuptrue%
  85.505 -%
  85.506 -\isamarkupsubsection{Datatypes \label{sec:datatypes}%
  85.507 -}
  85.508 -\isamarkuptrue%
  85.509 -%
  85.510 -\begin{isamarkuptext}%
  85.511 -Conceptually, any datatype is spanned by a set of
  85.512 -  \emph{constructors} of type \isa{{\isasymtau}\ {\isacharequal}\ {\isasymdots}\ {\isasymRightarrow}\ {\isasymkappa}\ {\isasymalpha}\isactrlisub {\isadigit{1}}\ {\isasymdots}\ {\isasymalpha}\isactrlisub n} where \isa{{\isacharbraceleft}{\isasymalpha}\isactrlisub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ {\isasymalpha}\isactrlisub n{\isacharbraceright}} is exactly the set of \emph{all} type variables in
  85.513 -  \isa{{\isasymtau}}.  The HOL datatype package by default registers any new
  85.514 -  datatype in the table of datatypes, which may be inspected using the
  85.515 -  \hyperlink{command.print-codesetup}{\mbox{\isa{\isacommand{print{\isacharunderscore}codesetup}}}} command.
  85.516 -
  85.517 -  In some cases, it is appropriate to alter or extend this table.  As
  85.518 -  an example, we will develop an alternative representation of the
  85.519 -  queue example given in \secref{sec:intro}.  The amortised
  85.520 -  representation is convenient for generating code but exposes its
  85.521 -  \qt{implementation} details, which may be cumbersome when proving
  85.522 -  theorems about it.  Therefore, here a simple, straightforward
  85.523 -  representation of queues:%
  85.524 -\end{isamarkuptext}%
  85.525 -\isamarkuptrue%
  85.526 -%
  85.527 -\isadelimquote
  85.528 -%
  85.529 -\endisadelimquote
  85.530 -%
  85.531 -\isatagquote
  85.532 -\isacommand{datatype}\isamarkupfalse%
  85.533 -\ {\isacharprime}a\ queue\ {\isacharequal}\ Queue\ {\isachardoublequoteopen}{\isacharprime}a\ list{\isachardoublequoteclose}\isanewline
  85.534 -\isanewline
  85.535 -\isacommand{definition}\isamarkupfalse%
  85.536 -\ empty\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a\ queue{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  85.537 -\ \ {\isachardoublequoteopen}empty\ {\isacharequal}\ Queue\ {\isacharbrackleft}{\isacharbrackright}{\isachardoublequoteclose}\isanewline
  85.538 -\isanewline
  85.539 -\isacommand{primrec}\isamarkupfalse%
  85.540 -\ enqueue\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a\ queue\ {\isasymRightarrow}\ {\isacharprime}a\ queue{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  85.541 -\ \ {\isachardoublequoteopen}enqueue\ x\ {\isacharparenleft}Queue\ xs{\isacharparenright}\ {\isacharequal}\ Queue\ {\isacharparenleft}xs\ {\isacharat}\ {\isacharbrackleft}x{\isacharbrackright}{\isacharparenright}{\isachardoublequoteclose}\isanewline
  85.542 -\isanewline
  85.543 -\isacommand{fun}\isamarkupfalse%
  85.544 -\ dequeue\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a\ queue\ {\isasymRightarrow}\ {\isacharprime}a\ option\ {\isasymtimes}\ {\isacharprime}a\ queue{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  85.545 -\ \ \ \ {\isachardoublequoteopen}dequeue\ {\isacharparenleft}Queue\ {\isacharbrackleft}{\isacharbrackright}{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}None{\isacharcomma}\ Queue\ {\isacharbrackleft}{\isacharbrackright}{\isacharparenright}{\isachardoublequoteclose}\isanewline
  85.546 -\ \ {\isacharbar}\ {\isachardoublequoteopen}dequeue\ {\isacharparenleft}Queue\ {\isacharparenleft}x\ {\isacharhash}\ xs{\isacharparenright}{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}Some\ x{\isacharcomma}\ Queue\ xs{\isacharparenright}{\isachardoublequoteclose}%
  85.547 -\endisatagquote
  85.548 -{\isafoldquote}%
  85.549 -%
  85.550 -\isadelimquote
  85.551 -%
  85.552 -\endisadelimquote
  85.553 -%
  85.554 -\begin{isamarkuptext}%
  85.555 -\noindent This we can use directly for proving;  for executing,
  85.556 -  we provide an alternative characterisation:%
  85.557 -\end{isamarkuptext}%
  85.558 -\isamarkuptrue%
  85.559 -%
  85.560 -\isadelimquote
  85.561 -%
  85.562 -\endisadelimquote
  85.563 -%
  85.564 -\isatagquote
  85.565 -\isacommand{definition}\isamarkupfalse%
  85.566 -\ AQueue\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a\ list\ {\isasymRightarrow}\ {\isacharprime}a\ list\ {\isasymRightarrow}\ {\isacharprime}a\ queue{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  85.567 -\ \ {\isachardoublequoteopen}AQueue\ xs\ ys\ {\isacharequal}\ Queue\ {\isacharparenleft}ys\ {\isacharat}\ rev\ xs{\isacharparenright}{\isachardoublequoteclose}\isanewline
  85.568 -\isanewline
  85.569 -\isacommand{code{\isacharunderscore}datatype}\isamarkupfalse%
  85.570 -\ AQueue%
  85.571 -\endisatagquote
  85.572 -{\isafoldquote}%
  85.573 -%
  85.574 -\isadelimquote
  85.575 -%
  85.576 -\endisadelimquote
  85.577 -%
  85.578 -\begin{isamarkuptext}%
  85.579 -\noindent Here we define a \qt{constructor} \isa{Program{\isachardot}AQueue} which
  85.580 -  is defined in terms of \isa{Queue} and interprets its arguments
  85.581 -  according to what the \emph{content} of an amortised queue is supposed
  85.582 -  to be.  Equipped with this, we are able to prove the following equations
  85.583 -  for our primitive queue operations which \qt{implement} the simple
  85.584 -  queues in an amortised fashion:%
  85.585 -\end{isamarkuptext}%
  85.586 -\isamarkuptrue%
  85.587 -%
  85.588 -\isadelimquote
  85.589 -%
  85.590 -\endisadelimquote
  85.591 -%
  85.592 -\isatagquote
  85.593 -\isacommand{lemma}\isamarkupfalse%
  85.594 -\ empty{\isacharunderscore}AQueue\ {\isacharbrackleft}code{\isacharbrackright}{\isacharcolon}\isanewline
  85.595 -\ \ {\isachardoublequoteopen}empty\ {\isacharequal}\ AQueue\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharbrackleft}{\isacharbrackright}{\isachardoublequoteclose}\isanewline
  85.596 -\ \ \isacommand{unfolding}\isamarkupfalse%
  85.597 -\ AQueue{\isacharunderscore}def\ empty{\isacharunderscore}def\ \isacommand{by}\isamarkupfalse%
  85.598 -\ simp\isanewline
  85.599 -\isanewline
  85.600 -\isacommand{lemma}\isamarkupfalse%
  85.601 -\ enqueue{\isacharunderscore}AQueue\ {\isacharbrackleft}code{\isacharbrackright}{\isacharcolon}\isanewline
  85.602 -\ \ {\isachardoublequoteopen}enqueue\ x\ {\isacharparenleft}AQueue\ xs\ ys{\isacharparenright}\ {\isacharequal}\ AQueue\ {\isacharparenleft}x\ {\isacharhash}\ xs{\isacharparenright}\ ys{\isachardoublequoteclose}\isanewline
  85.603 -\ \ \isacommand{unfolding}\isamarkupfalse%
  85.604 -\ AQueue{\isacharunderscore}def\ \isacommand{by}\isamarkupfalse%
  85.605 -\ simp\isanewline
  85.606 -\isanewline
  85.607 -\isacommand{lemma}\isamarkupfalse%
  85.608 -\ dequeue{\isacharunderscore}AQueue\ {\isacharbrackleft}code{\isacharbrackright}{\isacharcolon}\isanewline
  85.609 -\ \ {\isachardoublequoteopen}dequeue\ {\isacharparenleft}AQueue\ xs\ {\isacharbrackleft}{\isacharbrackright}{\isacharparenright}\ {\isacharequal}\isanewline
  85.610 -\ \ \ \ {\isacharparenleft}if\ xs\ {\isacharequal}\ {\isacharbrackleft}{\isacharbrackright}\ then\ {\isacharparenleft}None{\isacharcomma}\ AQueue\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharbrackleft}{\isacharbrackright}{\isacharparenright}\isanewline
  85.611 -\ \ \ \ else\ dequeue\ {\isacharparenleft}AQueue\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharparenleft}rev\ xs{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}\isanewline
  85.612 -\ \ {\isachardoublequoteopen}dequeue\ {\isacharparenleft}AQueue\ xs\ {\isacharparenleft}y\ {\isacharhash}\ ys{\isacharparenright}{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}Some\ y{\isacharcomma}\ AQueue\ xs\ ys{\isacharparenright}{\isachardoublequoteclose}\isanewline
  85.613 -\ \ \isacommand{unfolding}\isamarkupfalse%
  85.614 -\ AQueue{\isacharunderscore}def\ \isacommand{by}\isamarkupfalse%
  85.615 -\ simp{\isacharunderscore}all%
  85.616 -\endisatagquote
  85.617 -{\isafoldquote}%
  85.618 -%
  85.619 -\isadelimquote
  85.620 -%
  85.621 -\endisadelimquote
  85.622 -%
  85.623 -\begin{isamarkuptext}%
  85.624 -\noindent For completeness, we provide a substitute for the
  85.625 -  \isa{case} combinator on queues:%
  85.626 -\end{isamarkuptext}%
  85.627 -\isamarkuptrue%
  85.628 -%
  85.629 -\isadelimquote
  85.630 -%
  85.631 -\endisadelimquote
  85.632 -%
  85.633 -\isatagquote
  85.634 -\isacommand{definition}\isamarkupfalse%
  85.635 -\isanewline
  85.636 -\ \ aqueue{\isacharunderscore}case{\isacharunderscore}def{\isacharcolon}\ {\isachardoublequoteopen}aqueue{\isacharunderscore}case\ {\isacharequal}\ queue{\isacharunderscore}case{\isachardoublequoteclose}\isanewline
  85.637 -\isanewline
  85.638 -\isacommand{lemma}\isamarkupfalse%
  85.639 -\ aqueue{\isacharunderscore}case\ {\isacharbrackleft}code{\isacharcomma}\ code\ inline{\isacharbrackright}{\isacharcolon}\isanewline
  85.640 -\ \ {\isachardoublequoteopen}queue{\isacharunderscore}case\ {\isacharequal}\ aqueue{\isacharunderscore}case{\isachardoublequoteclose}\isanewline
  85.641 -\ \ \isacommand{unfolding}\isamarkupfalse%
  85.642 -\ aqueue{\isacharunderscore}case{\isacharunderscore}def\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
  85.643 -\isanewline
  85.644 -\isanewline
  85.645 -\isacommand{lemma}\isamarkupfalse%
  85.646 -\ case{\isacharunderscore}AQueue\ {\isacharbrackleft}code{\isacharbrackright}{\isacharcolon}\isanewline
  85.647 -\ \ {\isachardoublequoteopen}aqueue{\isacharunderscore}case\ f\ {\isacharparenleft}AQueue\ xs\ ys{\isacharparenright}\ {\isacharequal}\ f\ {\isacharparenleft}ys\ {\isacharat}\ rev\ xs{\isacharparenright}{\isachardoublequoteclose}\isanewline
  85.648 -\ \ \isacommand{unfolding}\isamarkupfalse%
  85.649 -\ aqueue{\isacharunderscore}case{\isacharunderscore}def\ AQueue{\isacharunderscore}def\ \isacommand{by}\isamarkupfalse%
  85.650 -\ simp%
  85.651 -\endisatagquote
  85.652 -{\isafoldquote}%
  85.653 -%
  85.654 -\isadelimquote
  85.655 -%
  85.656 -\endisadelimquote
  85.657 -%
  85.658 -\begin{isamarkuptext}%
  85.659 -\noindent The resulting code looks as expected:%
  85.660 -\end{isamarkuptext}%
  85.661 -\isamarkuptrue%
  85.662 -%
  85.663 -\isadelimquote
  85.664 -%
  85.665 -\endisadelimquote
  85.666 -%
  85.667 -\isatagquote
  85.668 -%
  85.669 -\begin{isamarkuptext}%
  85.670 -\isatypewriter%
  85.671 -\noindent%
  85.672 -\hspace*{0pt}structure Example = \\
  85.673 -\hspace*{0pt}struct\\
  85.674 -\hspace*{0pt}\\
  85.675 -\hspace*{0pt}fun foldl f a [] = a\\
  85.676 -\hspace*{0pt} ~| foldl f a (x ::~xs) = foldl f (f a x) xs;\\
  85.677 -\hspace*{0pt}\\
  85.678 -\hspace*{0pt}fun rev xs = foldl (fn xsa => fn x => x ::~xsa) [] xs;\\
  85.679 -\hspace*{0pt}\\
  85.680 -\hspace*{0pt}fun null [] = true\\
  85.681 -\hspace*{0pt} ~| null (x ::~xs) = false;\\
  85.682 -\hspace*{0pt}\\
  85.683 -\hspace*{0pt}datatype 'a queue = AQueue of 'a list * 'a list;\\
  85.684 -\hspace*{0pt}\\
  85.685 -\hspace*{0pt}val empty :~'a queue = AQueue ([],~[])\\
  85.686 -\hspace*{0pt}\\
  85.687 -\hspace*{0pt}fun dequeue (AQueue (xs,~y ::~ys)) = (SOME y,~AQueue (xs,~ys))\\
  85.688 -\hspace*{0pt} ~| dequeue (AQueue (xs,~[])) =\\
  85.689 -\hspace*{0pt} ~~~(if null xs then (NONE,~AQueue ([],~[]))\\
  85.690 -\hspace*{0pt} ~~~~~else dequeue (AQueue ([],~rev xs)));\\
  85.691 -\hspace*{0pt}\\
  85.692 -\hspace*{0pt}fun enqueue x (AQueue (xs,~ys)) = AQueue (x ::~xs,~ys);\\
  85.693 -\hspace*{0pt}\\
  85.694 -\hspace*{0pt}end;~(*struct Example*)%
  85.695 -\end{isamarkuptext}%
  85.696 -\isamarkuptrue%
  85.697 -%
  85.698 -\endisatagquote
  85.699 -{\isafoldquote}%
  85.700 -%
  85.701 -\isadelimquote
  85.702 -%
  85.703 -\endisadelimquote
  85.704 -%
  85.705 -\begin{isamarkuptext}%
  85.706 -\noindent From this example, it can be glimpsed that using own
  85.707 -  constructor sets is a little delicate since it changes the set of
  85.708 -  valid patterns for values of that type.  Without going into much
  85.709 -  detail, here some practical hints:
  85.710 -
  85.711 -  \begin{itemize}
  85.712 -
  85.713 -    \item When changing the constructor set for datatypes, take care
  85.714 -      to provide an alternative for the \isa{case} combinator
  85.715 -      (e.g.~by replacing it using the preprocessor).
  85.716 -
  85.717 -    \item Values in the target language need not to be normalised --
  85.718 -      different values in the target language may represent the same
  85.719 -      value in the logic.
  85.720 -
  85.721 -    \item Usually, a good methodology to deal with the subtleties of
  85.722 -      pattern matching is to see the type as an abstract type: provide
  85.723 -      a set of operations which operate on the concrete representation
  85.724 -      of the type, and derive further operations by combinations of
  85.725 -      these primitive ones, without relying on a particular
  85.726 -      representation.
  85.727 -
  85.728 -  \end{itemize}%
  85.729 -\end{isamarkuptext}%
  85.730 -\isamarkuptrue%
  85.731 -%
  85.732 -\isamarkupsubsection{Equality and wellsortedness%
  85.733 -}
  85.734 -\isamarkuptrue%
  85.735 -%
  85.736 -\begin{isamarkuptext}%
  85.737 -Surely you have already noticed how equality is treated
  85.738 -  by the code generator:%
  85.739 -\end{isamarkuptext}%
  85.740 -\isamarkuptrue%
  85.741 -%
  85.742 -\isadelimquote
  85.743 -%
  85.744 -\endisadelimquote
  85.745 -%
  85.746 -\isatagquote
  85.747 -\isacommand{primrec}\isamarkupfalse%
  85.748 -\ collect{\isacharunderscore}duplicates\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a\ list\ {\isasymRightarrow}\ {\isacharprime}a\ list\ {\isasymRightarrow}\ {\isacharprime}a\ list\ {\isasymRightarrow}\ {\isacharprime}a\ list{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
  85.749 -\ \ {\isachardoublequoteopen}collect{\isacharunderscore}duplicates\ xs\ ys\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharequal}\ xs{\isachardoublequoteclose}\isanewline
  85.750 -\ \ {\isacharbar}\ {\isachardoublequoteopen}collect{\isacharunderscore}duplicates\ xs\ ys\ {\isacharparenleft}z{\isacharhash}zs{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}if\ z\ {\isasymin}\ set\ xs\isanewline
  85.751 -\ \ \ \ \ \ then\ if\ z\ {\isasymin}\ set\ ys\isanewline
  85.752 -\ \ \ \ \ \ \ \ then\ collect{\isacharunderscore}duplicates\ xs\ ys\ zs\isanewline
  85.753 -\ \ \ \ \ \ \ \ else\ collect{\isacharunderscore}duplicates\ xs\ {\isacharparenleft}z{\isacharhash}ys{\isacharparenright}\ zs\isanewline
  85.754 -\ \ \ \ \ \ else\ collect{\isacharunderscore}duplicates\ {\isacharparenleft}z{\isacharhash}xs{\isacharparenright}\ {\isacharparenleft}z{\isacharhash}ys{\isacharparenright}\ zs{\isacharparenright}{\isachardoublequoteclose}%
  85.755 -\endisatagquote
  85.756 -{\isafoldquote}%
  85.757 -%
  85.758 -\isadelimquote
  85.759 -%
  85.760 -\endisadelimquote
  85.761 -%
  85.762 -\begin{isamarkuptext}%
  85.763 -\noindent The membership test during preprocessing is rewritten,
  85.764 -  resulting in \isa{op\ mem}, which itself
  85.765 -  performs an explicit equality check.%
  85.766 -\end{isamarkuptext}%
  85.767 -\isamarkuptrue%
  85.768 -%
  85.769 -\isadelimquote
  85.770 -%
  85.771 -\endisadelimquote
  85.772 -%
  85.773 -\isatagquote
  85.774 -%
  85.775 -\begin{isamarkuptext}%
  85.776 -\isatypewriter%
  85.777 -\noindent%
  85.778 -\hspace*{0pt}structure Example = \\
  85.779 -\hspace*{0pt}struct\\
  85.780 -\hspace*{0pt}\\
  85.781 -\hspace*{0pt}type 'a eq = {\char123}eq :~'a -> 'a -> bool{\char125};\\
  85.782 -\hspace*{0pt}fun eq (A{\char95}:'a eq) = {\char35}eq A{\char95};\\
  85.783 -\hspace*{0pt}\\
  85.784 -\hspace*{0pt}fun eqop A{\char95}~a b = eq A{\char95}~a b;\\
  85.785 -\hspace*{0pt}\\
  85.786 -\hspace*{0pt}fun member A{\char95}~x [] = false\\
  85.787 -\hspace*{0pt} ~| member A{\char95}~x (y ::~ys) = eqop A{\char95}~x y orelse member A{\char95}~x ys;\\
  85.788 -\hspace*{0pt}\\
  85.789 -\hspace*{0pt}fun collect{\char95}duplicates A{\char95}~xs ys [] = xs\\
  85.790 -\hspace*{0pt} ~| collect{\char95}duplicates A{\char95}~xs ys (z ::~zs) =\\
  85.791 -\hspace*{0pt} ~~~(if member A{\char95}~z xs\\
  85.792 -\hspace*{0pt} ~~~~~then (if member A{\char95}~z ys then collect{\char95}duplicates A{\char95}~xs ys zs\\
  85.793 -\hspace*{0pt} ~~~~~~~~~~~~else collect{\char95}duplicates A{\char95}~xs (z ::~ys) zs)\\
  85.794 -\hspace*{0pt} ~~~~~else collect{\char95}duplicates A{\char95}~(z ::~xs) (z ::~ys) zs);\\
  85.795 -\hspace*{0pt}\\
  85.796 -\hspace*{0pt}end;~(*struct Example*)%
  85.797 -\end{isamarkuptext}%
  85.798 -\isamarkuptrue%
  85.799 -%
  85.800 -\endisatagquote
  85.801 -{\isafoldquote}%
  85.802 -%
  85.803 -\isadelimquote
  85.804 -%
  85.805 -\endisadelimquote
  85.806 -%
  85.807 -\begin{isamarkuptext}%
  85.808 -\noindent Obviously, polymorphic equality is implemented the Haskell
  85.809 -  way using a type class.  How is this achieved?  HOL introduces
  85.810 -  an explicit class \isa{eq} with a corresponding operation
  85.811 -  \isa{eq{\isacharunderscore}class{\isachardot}eq} such that \isa{eq{\isacharunderscore}class{\isachardot}eq\ {\isacharequal}\ op\ {\isacharequal}}.
  85.812 -  The preprocessing framework does the rest by propagating the
  85.813 -  \isa{eq} constraints through all dependent code equations.
  85.814 -  For datatypes, instances of \isa{eq} are implicitly derived
  85.815 -  when possible.  For other types, you may instantiate \isa{eq}
  85.816 -  manually like any other type class.
  85.817 -
  85.818 -  Though this \isa{eq} class is designed to get rarely in
  85.819 -  the way, a subtlety
  85.820 -  enters the stage when definitions of overloaded constants
  85.821 -  are dependent on operational equality.  For example, let
  85.822 -  us define a lexicographic ordering on tuples
  85.823 -  (also see theory \hyperlink{theory.Product-ord}{\mbox{\isa{Product{\isacharunderscore}ord}}}):%
  85.824 -\end{isamarkuptext}%
  85.825 -\isamarkuptrue%
  85.826 -%
  85.827 -\isadelimquote
  85.828 -%
  85.829 -\endisadelimquote
  85.830 -%
  85.831 -\isatagquote
  85.832 -\isacommand{instantiation}\isamarkupfalse%
  85.833 -\ {\isachardoublequoteopen}{\isacharasterisk}{\isachardoublequoteclose}\ {\isacharcolon}{\isacharcolon}\ {\isacharparenleft}order{\isacharcomma}\ order{\isacharparenright}\ order\isanewline
  85.834 -\isakeyword{begin}\isanewline
  85.835 -\isanewline
  85.836 -\isacommand{definition}\isamarkupfalse%
  85.837 -\ {\isacharbrackleft}code\ del{\isacharbrackright}{\isacharcolon}\isanewline
  85.838 -\ \ {\isachardoublequoteopen}x\ {\isasymle}\ y\ {\isasymlongleftrightarrow}\ fst\ x\ {\isacharless}\ fst\ y\ {\isasymor}\ fst\ x\ {\isacharequal}\ fst\ y\ {\isasymand}\ snd\ x\ {\isasymle}\ snd\ y{\isachardoublequoteclose}\isanewline
  85.839 -\isanewline
  85.840 -\isacommand{definition}\isamarkupfalse%
  85.841 -\ {\isacharbrackleft}code\ del{\isacharbrackright}{\isacharcolon}\isanewline
  85.842 -\ \ {\isachardoublequoteopen}x\ {\isacharless}\ y\ {\isasymlongleftrightarrow}\ fst\ x\ {\isacharless}\ fst\ y\ {\isasymor}\ fst\ x\ {\isacharequal}\ fst\ y\ {\isasymand}\ snd\ x\ {\isacharless}\ snd\ y{\isachardoublequoteclose}\isanewline
  85.843 -\isanewline
  85.844 -\isacommand{instance}\isamarkupfalse%
  85.845 -\ \isacommand{proof}\isamarkupfalse%
  85.846 -\isanewline
  85.847 -\isacommand{qed}\isamarkupfalse%
  85.848 -\ {\isacharparenleft}auto\ simp{\isacharcolon}\ less{\isacharunderscore}eq{\isacharunderscore}prod{\isacharunderscore}def\ less{\isacharunderscore}prod{\isacharunderscore}def\ intro{\isacharcolon}\ order{\isacharunderscore}less{\isacharunderscore}trans{\isacharparenright}\isanewline
  85.849 -\isanewline
  85.850 -\isacommand{end}\isamarkupfalse%
  85.851 -\isanewline
  85.852 -\isanewline
  85.853 -\isacommand{lemma}\isamarkupfalse%
  85.854 -\ order{\isacharunderscore}prod\ {\isacharbrackleft}code{\isacharbrackright}{\isacharcolon}\isanewline
  85.855 -\ \ {\isachardoublequoteopen}{\isacharparenleft}x{\isadigit{1}}\ {\isasymColon}\ {\isacharprime}a{\isasymColon}order{\isacharcomma}\ y{\isadigit{1}}\ {\isasymColon}\ {\isacharprime}b{\isasymColon}order{\isacharparenright}\ {\isacharless}\ {\isacharparenleft}x{\isadigit{2}}{\isacharcomma}\ y{\isadigit{2}}{\isacharparenright}\ {\isasymlongleftrightarrow}\isanewline
  85.856 -\ \ \ \ \ x{\isadigit{1}}\ {\isacharless}\ x{\isadigit{2}}\ {\isasymor}\ x{\isadigit{1}}\ {\isacharequal}\ x{\isadigit{2}}\ {\isasymand}\ y{\isadigit{1}}\ {\isacharless}\ y{\isadigit{2}}{\isachardoublequoteclose}\isanewline
  85.857 -\ \ {\isachardoublequoteopen}{\isacharparenleft}x{\isadigit{1}}\ {\isasymColon}\ {\isacharprime}a{\isasymColon}order{\isacharcomma}\ y{\isadigit{1}}\ {\isasymColon}\ {\isacharprime}b{\isasymColon}order{\isacharparenright}\ {\isasymle}\ {\isacharparenleft}x{\isadigit{2}}{\isacharcomma}\ y{\isadigit{2}}{\isacharparenright}\ {\isasymlongleftrightarrow}\isanewline
  85.858 -\ \ \ \ \ x{\isadigit{1}}\ {\isacharless}\ x{\isadigit{2}}\ {\isasymor}\ x{\isadigit{1}}\ {\isacharequal}\ x{\isadigit{2}}\ {\isasymand}\ y{\isadigit{1}}\ {\isasymle}\ y{\isadigit{2}}{\isachardoublequoteclose}\isanewline
  85.859 -\ \ \isacommand{by}\isamarkupfalse%
  85.860 -\ {\isacharparenleft}simp{\isacharunderscore}all\ add{\isacharcolon}\ less{\isacharunderscore}prod{\isacharunderscore}def\ less{\isacharunderscore}eq{\isacharunderscore}prod{\isacharunderscore}def{\isacharparenright}%
  85.861 -\endisatagquote
  85.862 -{\isafoldquote}%
  85.863 -%
  85.864 -\isadelimquote
  85.865 -%
  85.866 -\endisadelimquote
  85.867 -%
  85.868 -\begin{isamarkuptext}%
  85.869 -\noindent Then code generation will fail.  Why?  The definition
  85.870 -  of \isa{op\ {\isasymle}} depends on equality on both arguments,
  85.871 -  which are polymorphic and impose an additional \isa{eq}
  85.872 -  class constraint, which the preprocessor does not propagate
  85.873 -  (for technical reasons).
  85.874 -
  85.875 -  The solution is to add \isa{eq} explicitly to the first sort arguments in the
  85.876 -  code theorems:%
  85.877 -\end{isamarkuptext}%
  85.878 -\isamarkuptrue%
  85.879 -%
  85.880 -\isadelimquote
  85.881 -%
  85.882 -\endisadelimquote
  85.883 -%
  85.884 -\isatagquote
  85.885 -\isacommand{lemma}\isamarkupfalse%
  85.886 -\ order{\isacharunderscore}prod{\isacharunderscore}code\ {\isacharbrackleft}code{\isacharbrackright}{\isacharcolon}\isanewline
  85.887 -\ \ {\isachardoublequoteopen}{\isacharparenleft}x{\isadigit{1}}\ {\isasymColon}\ {\isacharprime}a{\isasymColon}{\isacharbraceleft}order{\isacharcomma}\ eq{\isacharbraceright}{\isacharcomma}\ y{\isadigit{1}}\ {\isasymColon}\ {\isacharprime}b{\isasymColon}order{\isacharparenright}\ {\isacharless}\ {\isacharparenleft}x{\isadigit{2}}{\isacharcomma}\ y{\isadigit{2}}{\isacharparenright}\ {\isasymlongleftrightarrow}\isanewline
  85.888 -\ \ \ \ \ x{\isadigit{1}}\ {\isacharless}\ x{\isadigit{2}}\ {\isasymor}\ x{\isadigit{1}}\ {\isacharequal}\ x{\isadigit{2}}\ {\isasymand}\ y{\isadigit{1}}\ {\isacharless}\ y{\isadigit{2}}{\isachardoublequoteclose}\isanewline
  85.889 -\ \ {\isachardoublequoteopen}{\isacharparenleft}x{\isadigit{1}}\ {\isasymColon}\ {\isacharprime}a{\isasymColon}{\isacharbraceleft}order{\isacharcomma}\ eq{\isacharbraceright}{\isacharcomma}\ y{\isadigit{1}}\ {\isasymColon}\ {\isacharprime}b{\isasymColon}order{\isacharparenright}\ {\isasymle}\ {\isacharparenleft}x{\isadigit{2}}{\isacharcomma}\ y{\isadigit{2}}{\isacharparenright}\ {\isasymlongleftrightarrow}\isanewline
  85.890 -\ \ \ \ \ x{\isadigit{1}}\ {\isacharless}\ x{\isadigit{2}}\ {\isasymor}\ x{\isadigit{1}}\ {\isacharequal}\ x{\isadigit{2}}\ {\isasymand}\ y{\isadigit{1}}\ {\isasymle}\ y{\isadigit{2}}{\isachardoublequoteclose}\isanewline
  85.891 -\ \ \isacommand{by}\isamarkupfalse%
  85.892 -\ {\isacharparenleft}simp{\isacharunderscore}all\ add{\isacharcolon}\ less{\isacharunderscore}prod{\isacharunderscore}def\ less{\isacharunderscore}eq{\isacharunderscore}prod{\isacharunderscore}def{\isacharparenright}%
  85.893 -\endisatagquote
  85.894 -{\isafoldquote}%
  85.895 -%
  85.896 -\isadelimquote
  85.897 -%
  85.898 -\endisadelimquote
  85.899 -%
  85.900 -\begin{isamarkuptext}%
  85.901 -\noindent Then code generation succeeds:%
  85.902 -\end{isamarkuptext}%
  85.903 -\isamarkuptrue%
  85.904 -%
  85.905 -\isadelimquote
  85.906 -%
  85.907 -\endisadelimquote
  85.908 -%
  85.909 -\isatagquote
  85.910 -%
  85.911 -\begin{isamarkuptext}%
  85.912 -\isatypewriter%
  85.913 -\noindent%
  85.914 -\hspace*{0pt}structure Example = \\
  85.915 -\hspace*{0pt}struct\\
  85.916 -\hspace*{0pt}\\
  85.917 -\hspace*{0pt}type 'a eq = {\char123}eq :~'a -> 'a -> bool{\char125};\\
  85.918 -\hspace*{0pt}fun eq (A{\char95}:'a eq) = {\char35}eq A{\char95};\\
  85.919 -\hspace*{0pt}\\
  85.920 -\hspace*{0pt}type 'a ord = {\char123}less{\char95}eq :~'a -> 'a -> bool,~less :~'a -> 'a -> bool{\char125};\\
  85.921 -\hspace*{0pt}fun less{\char95}eq (A{\char95}:'a ord) = {\char35}less{\char95}eq A{\char95};\\
  85.922 -\hspace*{0pt}fun less (A{\char95}:'a ord) = {\char35}less A{\char95};\\
  85.923 -\hspace*{0pt}\\
  85.924 -\hspace*{0pt}fun eqop A{\char95}~a b = eq A{\char95}~a b;\\
  85.925 -\hspace*{0pt}\\
  85.926 -\hspace*{0pt}type 'a preorder = {\char123}Orderings{\char95}{\char95}ord{\char95}preorder :~'a ord{\char125};\\
  85.927 -\hspace*{0pt}fun ord{\char95}preorder (A{\char95}:'a preorder) = {\char35}Orderings{\char95}{\char95}ord{\char95}preorder A{\char95};\\
  85.928 -\hspace*{0pt}\\
  85.929 -\hspace*{0pt}type 'a order = {\char123}Orderings{\char95}{\char95}preorder{\char95}order :~'a preorder{\char125};\\
  85.930 -\hspace*{0pt}fun preorder{\char95}order (A{\char95}:'a order) = {\char35}Orderings{\char95}{\char95}preorder{\char95}order A{\char95};\\
  85.931 -\hspace*{0pt}\\
  85.932 -\hspace*{0pt}fun less{\char95}eqa (A1{\char95},~A2{\char95}) B{\char95}~(x1,~y1) (x2,~y2) =\\
  85.933 -\hspace*{0pt} ~less ((ord{\char95}preorder o preorder{\char95}order) A2{\char95}) x1 x2 orelse\\
  85.934 -\hspace*{0pt} ~~~eqop A1{\char95}~x1 x2 andalso\\
  85.935 -\hspace*{0pt} ~~~~~less{\char95}eq ((ord{\char95}preorder o preorder{\char95}order) B{\char95}) y1 y2\\
  85.936 -\hspace*{0pt} ~| less{\char95}eqa (A1{\char95},~A2{\char95}) B{\char95}~(x1,~y1) (x2,~y2) =\\
  85.937 -\hspace*{0pt} ~~~less ((ord{\char95}preorder o preorder{\char95}order) A2{\char95}) x1 x2 orelse\\
  85.938 -\hspace*{0pt} ~~~~~eqop A1{\char95}~x1 x2 andalso\\
  85.939 -\hspace*{0pt} ~~~~~~~less{\char95}eq ((ord{\char95}preorder o preorder{\char95}order) B{\char95}) y1 y2;\\
  85.940 -\hspace*{0pt}\\
  85.941 -\hspace*{0pt}end;~(*struct Example*)%
  85.942 -\end{isamarkuptext}%
  85.943 -\isamarkuptrue%
  85.944 -%
  85.945 -\endisatagquote
  85.946 -{\isafoldquote}%
  85.947 -%
  85.948 -\isadelimquote
  85.949 -%
  85.950 -\endisadelimquote
  85.951 -%
  85.952 -\begin{isamarkuptext}%
  85.953 -In some cases, the automatically derived code equations
  85.954 -  for equality on a particular type may not be appropriate.
  85.955 -  As example, watch the following datatype representing
  85.956 -  monomorphic parametric types (where type constructors
  85.957 -  are referred to by natural numbers):%
  85.958 -\end{isamarkuptext}%
  85.959 -\isamarkuptrue%
  85.960 -%
  85.961 -\isadelimquote
  85.962 -%
  85.963 -\endisadelimquote
  85.964 -%
  85.965 -\isatagquote
  85.966 -\isacommand{datatype}\isamarkupfalse%
  85.967 -\ monotype\ {\isacharequal}\ Mono\ nat\ {\isachardoublequoteopen}monotype\ list{\isachardoublequoteclose}%
  85.968 -\endisatagquote
  85.969 -{\isafoldquote}%
  85.970 -%
  85.971 -\isadelimquote
  85.972 -%
  85.973 -\endisadelimquote
  85.974 -%
  85.975 -\isadelimproof
  85.976 -%
  85.977 -\endisadelimproof
  85.978 -%
  85.979 -\isatagproof
  85.980 -%
  85.981 -\endisatagproof
  85.982 -{\isafoldproof}%
  85.983 -%
  85.984 -\isadelimproof
  85.985 -%
  85.986 -\endisadelimproof
  85.987 -%
  85.988 -\begin{isamarkuptext}%
  85.989 -\noindent Then code generation for SML would fail with a message
  85.990 -  that the generated code contains illegal mutual dependencies:
  85.991 -  the theorem \isa{eq{\isacharunderscore}class{\isachardot}eq\ {\isacharparenleft}Mono\ tyco{\isadigit{1}}\ typargs{\isadigit{1}}{\isacharparenright}\ {\isacharparenleft}Mono\ tyco{\isadigit{2}}\ typargs{\isadigit{2}}{\isacharparenright}\ {\isasymequiv}\ eq{\isacharunderscore}class{\isachardot}eq\ tyco{\isadigit{1}}\ tyco{\isadigit{2}}\ {\isasymand}\ eq{\isacharunderscore}class{\isachardot}eq\ typargs{\isadigit{1}}\ typargs{\isadigit{2}}} already requires the
  85.992 -  instance \isa{monotype\ {\isasymColon}\ eq}, which itself requires
  85.993 -  \isa{eq{\isacharunderscore}class{\isachardot}eq\ {\isacharparenleft}Mono\ tyco{\isadigit{1}}\ typargs{\isadigit{1}}{\isacharparenright}\ {\isacharparenleft}Mono\ tyco{\isadigit{2}}\ typargs{\isadigit{2}}{\isacharparenright}\ {\isasymequiv}\ eq{\isacharunderscore}class{\isachardot}eq\ tyco{\isadigit{1}}\ tyco{\isadigit{2}}\ {\isasymand}\ eq{\isacharunderscore}class{\isachardot}eq\ typargs{\isadigit{1}}\ typargs{\isadigit{2}}};  Haskell has no problem with mutually
  85.994 -  recursive \isa{instance} and \isa{function} definitions,
  85.995 -  but the SML serialiser does not support this.
  85.996 -
  85.997 -  In such cases, you have to provide your own equality equations
  85.998 -  involving auxiliary constants.  In our case,
  85.999 -  \isa{list{\isacharunderscore}all{\isadigit{2}}} can do the job:%
 85.1000 -\end{isamarkuptext}%
 85.1001 -\isamarkuptrue%
 85.1002 -%
 85.1003 -\isadelimquote
 85.1004 -%
 85.1005 -\endisadelimquote
 85.1006 -%
 85.1007 -\isatagquote
 85.1008 -\isacommand{lemma}\isamarkupfalse%
 85.1009 -\ monotype{\isacharunderscore}eq{\isacharunderscore}list{\isacharunderscore}all{\isadigit{2}}\ {\isacharbrackleft}code{\isacharbrackright}{\isacharcolon}\isanewline
 85.1010 -\ \ {\isachardoublequoteopen}eq{\isacharunderscore}class{\isachardot}eq\ {\isacharparenleft}Mono\ tyco{\isadigit{1}}\ typargs{\isadigit{1}}{\isacharparenright}\ {\isacharparenleft}Mono\ tyco{\isadigit{2}}\ typargs{\isadigit{2}}{\isacharparenright}\ {\isasymlongleftrightarrow}\isanewline
 85.1011 -\ \ \ \ \ eq{\isacharunderscore}class{\isachardot}eq\ tyco{\isadigit{1}}\ tyco{\isadigit{2}}\ {\isasymand}\ list{\isacharunderscore}all{\isadigit{2}}\ eq{\isacharunderscore}class{\isachardot}eq\ typargs{\isadigit{1}}\ typargs{\isadigit{2}}{\isachardoublequoteclose}\isanewline
 85.1012 -\ \ \isacommand{by}\isamarkupfalse%
 85.1013 -\ {\isacharparenleft}simp\ add{\isacharcolon}\ eq\ list{\isacharunderscore}all{\isadigit{2}}{\isacharunderscore}eq\ {\isacharbrackleft}symmetric{\isacharbrackright}{\isacharparenright}%
 85.1014 -\endisatagquote
 85.1015 -{\isafoldquote}%
 85.1016 -%
 85.1017 -\isadelimquote
 85.1018 -%
 85.1019 -\endisadelimquote
 85.1020 -%
 85.1021 -\begin{isamarkuptext}%
 85.1022 -\noindent does not depend on instance \isa{monotype\ {\isasymColon}\ eq}:%
 85.1023 -\end{isamarkuptext}%
 85.1024 -\isamarkuptrue%
 85.1025 -%
 85.1026 -\isadelimquote
 85.1027 -%
 85.1028 -\endisadelimquote
 85.1029 -%
 85.1030 -\isatagquote
 85.1031 -%
 85.1032 -\begin{isamarkuptext}%
 85.1033 -\isatypewriter%
 85.1034 -\noindent%
 85.1035 -\hspace*{0pt}structure Example = \\
 85.1036 -\hspace*{0pt}struct\\
 85.1037 -\hspace*{0pt}\\
 85.1038 -\hspace*{0pt}datatype nat = Zero{\char95}nat | Suc of nat;\\
 85.1039 -\hspace*{0pt}\\
 85.1040 -\hspace*{0pt}fun null [] = true\\
 85.1041 -\hspace*{0pt} ~| null (x ::~xs) = false;\\
 85.1042 -\hspace*{0pt}\\
 85.1043 -\hspace*{0pt}fun eq{\char95}nat (Suc a) Zero{\char95}nat = false\\
 85.1044 -\hspace*{0pt} ~| eq{\char95}nat Zero{\char95}nat (Suc a) = false\\
 85.1045 -\hspace*{0pt} ~| eq{\char95}nat (Suc nat) (Suc nat') = eq{\char95}nat nat nat'\\
 85.1046 -\hspace*{0pt} ~| eq{\char95}nat Zero{\char95}nat Zero{\char95}nat = true;\\
 85.1047 -\hspace*{0pt}\\
 85.1048 -\hspace*{0pt}datatype monotype = Mono of nat * monotype list;\\
 85.1049 -\hspace*{0pt}\\
 85.1050 -\hspace*{0pt}fun list{\char95}all2 p (x ::~xs) (y ::~ys) = p x y andalso list{\char95}all2 p xs ys\\
 85.1051 -\hspace*{0pt} ~| list{\char95}all2 p xs [] = null xs\\
 85.1052 -\hspace*{0pt} ~| list{\char95}all2 p [] ys = null ys;\\
 85.1053 -\hspace*{0pt}\\
 85.1054 -\hspace*{0pt}fun eq{\char95}monotype (Mono (tyco1,~typargs1)) (Mono (tyco2,~typargs2)) =\\
 85.1055 -\hspace*{0pt} ~eq{\char95}nat tyco1 tyco2 andalso list{\char95}all2 eq{\char95}monotype typargs1 typargs2;\\
 85.1056 -\hspace*{0pt}\\
 85.1057 -\hspace*{0pt}end;~(*struct Example*)%
 85.1058 -\end{isamarkuptext}%
 85.1059 -\isamarkuptrue%
 85.1060 -%
 85.1061 -\endisatagquote
 85.1062 -{\isafoldquote}%
 85.1063 -%
 85.1064 -\isadelimquote
 85.1065 -%
 85.1066 -\endisadelimquote
 85.1067 -%
 85.1068 -\isamarkupsubsection{Explicit partiality%
 85.1069 -}
 85.1070 -\isamarkuptrue%
 85.1071 -%
 85.1072 -\begin{isamarkuptext}%
 85.1073 -Partiality usually enters the game by partial patterns, as
 85.1074 -  in the following example, again for amortised queues:%
 85.1075 -\end{isamarkuptext}%
 85.1076 -\isamarkuptrue%
 85.1077 -%
 85.1078 -\isadelimquote
 85.1079 -%
 85.1080 -\endisadelimquote
 85.1081 -%
 85.1082 -\isatagquote
 85.1083 -\isacommand{definition}\isamarkupfalse%
 85.1084 -\ strict{\isacharunderscore}dequeue\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a\ queue\ {\isasymRightarrow}\ {\isacharprime}a\ {\isasymtimes}\ {\isacharprime}a\ queue{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
 85.1085 -\ \ {\isachardoublequoteopen}strict{\isacharunderscore}dequeue\ q\ {\isacharequal}\ {\isacharparenleft}case\ dequeue\ q\isanewline
 85.1086 -\ \ \ \ of\ {\isacharparenleft}Some\ x{\isacharcomma}\ q{\isacharprime}{\isacharparenright}\ {\isasymRightarrow}\ {\isacharparenleft}x{\isacharcomma}\ q{\isacharprime}{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}\isanewline
 85.1087 -\isanewline
 85.1088 -\isacommand{lemma}\isamarkupfalse%
 85.1089 -\ strict{\isacharunderscore}dequeue{\isacharunderscore}AQueue\ {\isacharbrackleft}code{\isacharbrackright}{\isacharcolon}\isanewline
 85.1090 -\ \ {\isachardoublequoteopen}strict{\isacharunderscore}dequeue\ {\isacharparenleft}AQueue\ xs\ {\isacharparenleft}y\ {\isacharhash}\ ys{\isacharparenright}{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}y{\isacharcomma}\ AQueue\ xs\ ys{\isacharparenright}{\isachardoublequoteclose}\isanewline
 85.1091 -\ \ {\isachardoublequoteopen}strict{\isacharunderscore}dequeue\ {\isacharparenleft}AQueue\ xs\ {\isacharbrackleft}{\isacharbrackright}{\isacharparenright}\ {\isacharequal}\isanewline
 85.1092 -\ \ \ \ {\isacharparenleft}case\ rev\ xs\ of\ y\ {\isacharhash}\ ys\ {\isasymRightarrow}\ {\isacharparenleft}y{\isacharcomma}\ AQueue\ {\isacharbrackleft}{\isacharbrackright}\ ys{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}\isanewline
 85.1093 -\ \ \isacommand{by}\isamarkupfalse%
 85.1094 -\ {\isacharparenleft}simp{\isacharunderscore}all\ add{\isacharcolon}\ strict{\isacharunderscore}dequeue{\isacharunderscore}def\ dequeue{\isacharunderscore}AQueue\ split{\isacharcolon}\ list{\isachardot}splits{\isacharparenright}%
 85.1095 -\endisatagquote
 85.1096 -{\isafoldquote}%
 85.1097 -%
 85.1098 -\isadelimquote
 85.1099 -%
 85.1100 -\endisadelimquote
 85.1101 -%
 85.1102 -\begin{isamarkuptext}%
 85.1103 -\noindent In the corresponding code, there is no equation
 85.1104 -  for the pattern \isa{Program{\isachardot}AQueue\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharbrackleft}{\isacharbrackright}}:%
 85.1105 -\end{isamarkuptext}%
 85.1106 -\isamarkuptrue%
 85.1107 -%
 85.1108 -\isadelimquote
 85.1109 -%
 85.1110 -\endisadelimquote
 85.1111 -%
 85.1112 -\isatagquote
 85.1113 -%
 85.1114 -\begin{isamarkuptext}%
 85.1115 -\isatypewriter%
 85.1116 -\noindent%
 85.1117 -\hspace*{0pt}strict{\char95}dequeue ::~forall a.~Queue a -> (a,~Queue a);\\
 85.1118 -\hspace*{0pt}strict{\char95}dequeue (AQueue xs []) =\\
 85.1119 -\hspace*{0pt} ~let {\char123}\\
 85.1120 -\hspace*{0pt} ~~~(y :~ys) = rev xs;\\
 85.1121 -\hspace*{0pt} ~{\char125}~in (y,~AQueue [] ys);\\
 85.1122 -\hspace*{0pt}strict{\char95}dequeue (AQueue xs (y :~ys)) = (y,~AQueue xs ys);%
 85.1123 -\end{isamarkuptext}%
 85.1124 -\isamarkuptrue%
 85.1125 -%
 85.1126 -\endisatagquote
 85.1127 -{\isafoldquote}%
 85.1128 -%
 85.1129 -\isadelimquote
 85.1130 -%
 85.1131 -\endisadelimquote
 85.1132 -%
 85.1133 -\begin{isamarkuptext}%
 85.1134 -\noindent In some cases it is desirable to have this
 85.1135 -  pseudo-\qt{partiality} more explicitly, e.g.~as follows:%
 85.1136 -\end{isamarkuptext}%
 85.1137 -\isamarkuptrue%
 85.1138 -%
 85.1139 -\isadelimquote
 85.1140 -%
 85.1141 -\endisadelimquote
 85.1142 -%
 85.1143 -\isatagquote
 85.1144 -\isacommand{axiomatization}\isamarkupfalse%
 85.1145 -\ empty{\isacharunderscore}queue\ {\isacharcolon}{\isacharcolon}\ {\isacharprime}a\isanewline
 85.1146 -\isanewline
 85.1147 -\isacommand{definition}\isamarkupfalse%
 85.1148 -\ strict{\isacharunderscore}dequeue{\isacharprime}\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a\ queue\ {\isasymRightarrow}\ {\isacharprime}a\ {\isasymtimes}\ {\isacharprime}a\ queue{\isachardoublequoteclose}\ \isakeyword{where}\isanewline
 85.1149 -\ \ {\isachardoublequoteopen}strict{\isacharunderscore}dequeue{\isacharprime}\ q\ {\isacharequal}\ {\isacharparenleft}case\ dequeue\ q\ of\ {\isacharparenleft}Some\ x{\isacharcomma}\ q{\isacharprime}{\isacharparenright}\ {\isasymRightarrow}\ {\isacharparenleft}x{\isacharcomma}\ q{\isacharprime}{\isacharparenright}\ {\isacharbar}\ {\isacharunderscore}\ {\isasymRightarrow}\ empty{\isacharunderscore}queue{\isacharparenright}{\isachardoublequoteclose}\isanewline
 85.1150 -\isanewline
 85.1151 -\isacommand{lemma}\isamarkupfalse%
 85.1152 -\ strict{\isacharunderscore}dequeue{\isacharprime}{\isacharunderscore}AQueue\ {\isacharbrackleft}code{\isacharbrackright}{\isacharcolon}\isanewline
 85.1153 -\ \ {\isachardoublequoteopen}strict{\isacharunderscore}dequeue{\isacharprime}\ {\isacharparenleft}AQueue\ xs\ {\isacharbrackleft}{\isacharbrackright}{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}if\ xs\ {\isacharequal}\ {\isacharbrackleft}{\isacharbrackright}\ then\ empty{\isacharunderscore}queue\isanewline
 85.1154 -\ \ \ \ \ else\ strict{\isacharunderscore}dequeue{\isacharprime}\ {\isacharparenleft}AQueue\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharparenleft}rev\ xs{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}\isanewline
 85.1155 -\ \ {\isachardoublequoteopen}strict{\isacharunderscore}dequeue{\isacharprime}\ {\isacharparenleft}AQueue\ xs\ {\isacharparenleft}y\ {\isacharhash}\ ys{\isacharparenright}{\isacharparenright}\ {\isacharequal}\isanewline
 85.1156 -\ \ \ \ \ {\isacharparenleft}y{\isacharcomma}\ AQueue\ xs\ ys{\isacharparenright}{\isachardoublequoteclose}\isanewline
 85.1157 -\ \ \isacommand{by}\isamarkupfalse%
 85.1158 -\ {\isacharparenleft}simp{\isacharunderscore}all\ add{\isacharcolon}\ strict{\isacharunderscore}dequeue{\isacharprime}{\isacharunderscore}def\ dequeue{\isacharunderscore}AQueue\ split{\isacharcolon}\ list{\isachardot}splits{\isacharparenright}%
 85.1159 -\endisatagquote
 85.1160 -{\isafoldquote}%
 85.1161 -%
 85.1162 -\isadelimquote
 85.1163 -%
 85.1164 -\endisadelimquote
 85.1165 -%
 85.1166 -\begin{isamarkuptext}%
 85.1167 -Observe that on the right hand side of the definition of \isa{strict{\isacharunderscore}dequeue{\isacharprime}} the constant \isa{empty{\isacharunderscore}queue} occurs
 85.1168 -  which is unspecified.
 85.1169 -
 85.1170 -  Normally, if constants without any code equations occur in a
 85.1171 -  program, the code generator complains (since in most cases this is
 85.1172 -  not what the user expects).  But such constants can also be thought
 85.1173 -  of as function definitions with no equations which always fail,
 85.1174 -  since there is never a successful pattern match on the left hand
 85.1175 -  side.  In order to categorise a constant into that category
 85.1176 -  explicitly, use \hyperlink{command.code-abort}{\mbox{\isa{\isacommand{code{\isacharunderscore}abort}}}}:%
 85.1177 -\end{isamarkuptext}%
 85.1178 -\isamarkuptrue%
 85.1179 -%
 85.1180 -\isadelimquote
 85.1181 -%
 85.1182 -\endisadelimquote
 85.1183 -%
 85.1184 -\isatagquote
 85.1185 -\isacommand{code{\isacharunderscore}abort}\isamarkupfalse%
 85.1186 -\ empty{\isacharunderscore}queue%
 85.1187 -\endisatagquote
 85.1188 -{\isafoldquote}%
 85.1189 -%
 85.1190 -\isadelimquote
 85.1191 -%
 85.1192 -\endisadelimquote
 85.1193 -%
 85.1194 -\begin{isamarkuptext}%
 85.1195 -\noindent Then the code generator will just insert an error or
 85.1196 -  exception at the appropriate position:%
 85.1197 -\end{isamarkuptext}%
 85.1198 -\isamarkuptrue%
 85.1199 -%
 85.1200 -\isadelimquote
 85.1201 -%
 85.1202 -\endisadelimquote
 85.1203 -%
 85.1204 -\isatagquote
 85.1205 -%
 85.1206 -\begin{isamarkuptext}%
 85.1207 -\isatypewriter%
 85.1208 -\noindent%
 85.1209 -\hspace*{0pt}empty{\char95}queue ::~forall a.~a;\\
 85.1210 -\hspace*{0pt}empty{\char95}queue = error {\char34}empty{\char95}queue{\char34};\\
 85.1211 -\hspace*{0pt}\\
 85.1212 -\hspace*{0pt}strict{\char95}dequeue' ::~forall a.~Queue a -> (a,~Queue a);\\
 85.1213 -\hspace*{0pt}strict{\char95}dequeue' (AQueue xs (y :~ys)) = (y,~AQueue xs ys);\\
 85.1214 -\hspace*{0pt}strict{\char95}dequeue' (AQueue xs []) =\\
 85.1215 -\hspace*{0pt} ~(if nulla xs then empty{\char95}queue\\
 85.1216 -\hspace*{0pt} ~~~else strict{\char95}dequeue' (AQueue [] (rev xs)));%
 85.1217 -\end{isamarkuptext}%
 85.1218 -\isamarkuptrue%
 85.1219 -%
 85.1220 -\endisatagquote
 85.1221 -{\isafoldquote}%
 85.1222 -%
 85.1223 -\isadelimquote
 85.1224 -%
 85.1225 -\endisadelimquote
 85.1226 -%
 85.1227 -\begin{isamarkuptext}%
 85.1228 -\noindent This feature however is rarely needed in practice.
 85.1229 -  Note also that the \isa{HOL} default setup already declares
 85.1230 -  \isa{undefined} as \hyperlink{command.code-abort}{\mbox{\isa{\isacommand{code{\isacharunderscore}abort}}}}, which is most
 85.1231 -  likely to be used in such situations.%
 85.1232 -\end{isamarkuptext}%
 85.1233 -\isamarkuptrue%
 85.1234 -%
 85.1235 -\isadelimtheory
 85.1236 -%
 85.1237 -\endisadelimtheory
 85.1238 -%
 85.1239 -\isatagtheory
 85.1240 -\isacommand{end}\isamarkupfalse%
 85.1241 -%
 85.1242 -\endisatagtheory
 85.1243 -{\isafoldtheory}%
 85.1244 -%
 85.1245 -\isadelimtheory
 85.1246 -%
 85.1247 -\endisadelimtheory
 85.1248 -\isanewline
 85.1249 -\ \end{isabellebody}%
 85.1250 -%%% Local Variables:
 85.1251 -%%% mode: latex
 85.1252 -%%% TeX-master: "root"
 85.1253 -%%% End:
    86.1 --- a/doc-src/IsarAdvanced/Codegen/Thy/examples/Codegen.hs	Mon Mar 02 16:58:39 2009 +0100
    86.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    86.3 @@ -1,23 +0,0 @@
    86.4 -module Codegen where {
    86.5 -
    86.6 -import qualified Nat;
    86.7 -
    86.8 -class Null a where {
    86.9 -  nulla :: a;
   86.10 -};
   86.11 -
   86.12 -heada :: forall a. (Codegen.Null a) => [a] -> a;
   86.13 -heada (x : xs) = x;
   86.14 -heada [] = Codegen.nulla;
   86.15 -
   86.16 -null_option :: forall a. Maybe a;
   86.17 -null_option = Nothing;
   86.18 -
   86.19 -instance Codegen.Null (Maybe a) where {
   86.20 -  nulla = Codegen.null_option;
   86.21 -};
   86.22 -
   86.23 -dummy :: Maybe Nat.Nat;
   86.24 -dummy = Codegen.heada [Just (Nat.Suc Nat.Zero_nat), Nothing];
   86.25 -
   86.26 -}
    87.1 --- a/doc-src/IsarAdvanced/Codegen/Thy/examples/Example.hs	Mon Mar 02 16:58:39 2009 +0100
    87.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    87.3 @@ -1,33 +0,0 @@
    87.4 -{-# OPTIONS_GHC -fglasgow-exts #-}
    87.5 -
    87.6 -module Example where {
    87.7 -
    87.8 -
    87.9 -foldla :: forall a b. (a -> b -> a) -> a -> [b] -> a;
   87.10 -foldla f a [] = a;
   87.11 -foldla f a (x : xs) = foldla f (f a x) xs;
   87.12 -
   87.13 -rev :: forall a. [a] -> [a];
   87.14 -rev xs = foldla (\ xsa x -> x : xsa) [] xs;
   87.15 -
   87.16 -list_case :: forall t a. t -> (a -> [a] -> t) -> [a] -> t;
   87.17 -list_case f1 f2 (a : list) = f2 a list;
   87.18 -list_case f1 f2 [] = f1;
   87.19 -
   87.20 -data Queue a = AQueue [a] [a];
   87.21 -
   87.22 -empty :: forall a. Queue a;
   87.23 -empty = AQueue [] [];
   87.24 -
   87.25 -dequeue :: forall a. Queue a -> (Maybe a, Queue a);
   87.26 -dequeue (AQueue [] []) = (Nothing, AQueue [] []);
   87.27 -dequeue (AQueue xs (y : ys)) = (Just y, AQueue xs ys);
   87.28 -dequeue (AQueue (v : va) []) =
   87.29 -  let {
   87.30 -    (y : ys) = rev (v : va);
   87.31 -  } in (Just y, AQueue [] ys);
   87.32 -
   87.33 -enqueue :: forall a. a -> Queue a -> Queue a;
   87.34 -enqueue x (AQueue xs ys) = AQueue (x : xs) ys;
   87.35 -
   87.36 -}
    88.1 --- a/doc-src/IsarAdvanced/Codegen/Thy/examples/arbitrary.ML	Mon Mar 02 16:58:39 2009 +0100
    88.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    88.3 @@ -1,9 +0,0 @@
    88.4 -structure Codegen = 
    88.5 -struct
    88.6 -
    88.7 -val arbitrary_option : 'a option = NONE;
    88.8 -
    88.9 -fun dummy_option [] = arbitrary_option
   88.10 -  | dummy_option (x :: xs) = SOME x;
   88.11 -
   88.12 -end; (*struct Codegen*)
    89.1 --- a/doc-src/IsarAdvanced/Codegen/Thy/examples/bool_infix.ML	Mon Mar 02 16:58:39 2009 +0100
    89.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    89.3 @@ -1,19 +0,0 @@
    89.4 -structure Nat = 
    89.5 -struct
    89.6 -
    89.7 -datatype nat = Suc of nat | Zero_nat;
    89.8 -
    89.9 -fun less_nat m (Suc n) = less_eq_nat m n
   89.10 -  | less_nat n Zero_nat = false
   89.11 -and less_eq_nat (Suc m) n = less_nat m n
   89.12 -  | less_eq_nat Zero_nat n = true;
   89.13 -
   89.14 -end; (*struct Nat*)
   89.15 -
   89.16 -structure Codegen = 
   89.17 -struct
   89.18 -
   89.19 -fun in_interval (k, l) n =
   89.20 -  Nat.less_eq_nat k n andalso Nat.less_eq_nat n l;
   89.21 -
   89.22 -end; (*struct Codegen*)
    90.1 --- a/doc-src/IsarAdvanced/Codegen/Thy/examples/bool_literal.ML	Mon Mar 02 16:58:39 2009 +0100
    90.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    90.3 @@ -1,31 +0,0 @@
    90.4 -structure HOL = 
    90.5 -struct
    90.6 -
    90.7 -datatype boola = False | True;
    90.8 -
    90.9 -fun anda x True = x
   90.10 -  | anda x False = False
   90.11 -  | anda True x = x
   90.12 -  | anda False x = False;
   90.13 -
   90.14 -end; (*struct HOL*)
   90.15 -
   90.16 -structure Nat = 
   90.17 -struct
   90.18 -
   90.19 -datatype nat = Suc of nat | Zero_nat;
   90.20 -
   90.21 -fun less_nat m (Suc n) = less_eq_nat m n
   90.22 -  | less_nat n Zero_nat = HOL.False
   90.23 -and less_eq_nat (Suc m) n = less_nat m n
   90.24 -  | less_eq_nat Zero_nat n = HOL.True;
   90.25 -
   90.26 -end; (*struct Nat*)
   90.27 -
   90.28 -structure Codegen = 
   90.29 -struct
   90.30 -
   90.31 -fun in_interval (k, l) n =
   90.32 -  HOL.anda (Nat.less_eq_nat k n) (Nat.less_eq_nat n l);
   90.33 -
   90.34 -end; (*struct Codegen*)
    91.1 --- a/doc-src/IsarAdvanced/Codegen/Thy/examples/bool_mlbool.ML	Mon Mar 02 16:58:39 2009 +0100
    91.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    91.3 @@ -1,19 +0,0 @@
    91.4 -structure Nat = 
    91.5 -struct
    91.6 -
    91.7 -datatype nat = Suc of nat | Zero_nat;
    91.8 -
    91.9 -fun less_nat m (Suc n) = less_eq_nat m n
   91.10 -  | less_nat n Zero_nat = false
   91.11 -and less_eq_nat (Suc m) n = less_nat m n
   91.12 -  | less_eq_nat Zero_nat n = true;
   91.13 -
   91.14 -end; (*struct Nat*)
   91.15 -
   91.16 -structure Codegen = 
   91.17 -struct
   91.18 -
   91.19 -fun in_interval (k, l) n =
   91.20 -  (Nat.less_eq_nat k n) andalso (Nat.less_eq_nat n l);
   91.21 -
   91.22 -end; (*struct Codegen*)
    92.1 --- a/doc-src/IsarAdvanced/Codegen/Thy/examples/class.ML	Mon Mar 02 16:58:39 2009 +0100
    92.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    92.3 @@ -1,24 +0,0 @@
    92.4 -structure Nat = 
    92.5 -struct
    92.6 -
    92.7 -datatype nat = Suc of nat | Zero_nat;
    92.8 -
    92.9 -end; (*struct Nat*)
   92.10 -
   92.11 -structure Codegen = 
   92.12 -struct
   92.13 -
   92.14 -type 'a null = {null : 'a};
   92.15 -fun null (A_:'a null) = #null A_;
   92.16 -
   92.17 -fun head A_ (x :: xs) = x
   92.18 -  | head A_ [] = null A_;
   92.19 -
   92.20 -val null_option : 'a option = NONE;
   92.21 -
   92.22 -fun null_optiona () = {null = null_option} : ('a option) null;
   92.23 -
   92.24 -val dummy : Nat.nat option =
   92.25 -  head (null_optiona ()) [SOME (Nat.Suc Nat.Zero_nat), NONE];
   92.26 -
   92.27 -end; (*struct Codegen*)
    93.1 --- a/doc-src/IsarAdvanced/Codegen/Thy/examples/class.ocaml	Mon Mar 02 16:58:39 2009 +0100
    93.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    93.3 @@ -1,24 +0,0 @@
    93.4 -module Nat = 
    93.5 -struct
    93.6 -
    93.7 -type nat = Suc of nat | Zero_nat;;
    93.8 -
    93.9 -end;; (*struct Nat*)
   93.10 -
   93.11 -module Codegen = 
   93.12 -struct
   93.13 -
   93.14 -type 'a null = {null : 'a};;
   93.15 -let null _A = _A.null;;
   93.16 -
   93.17 -let rec head _A = function x :: xs -> x
   93.18 -                  | [] -> null _A;;
   93.19 -
   93.20 -let rec null_option = None;;
   93.21 -
   93.22 -let null_optiona () = ({null = null_option} : ('a option) null);;
   93.23 -
   93.24 -let rec dummy
   93.25 -  = head (null_optiona ()) [Some (Nat.Suc Nat.Zero_nat); None];;
   93.26 -
   93.27 -end;; (*struct Codegen*)
    94.1 --- a/doc-src/IsarAdvanced/Codegen/Thy/examples/collect_duplicates.ML	Mon Mar 02 16:58:39 2009 +0100
    94.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    94.3 @@ -1,30 +0,0 @@
    94.4 -structure HOL = 
    94.5 -struct
    94.6 -
    94.7 -type 'a eq = {eq : 'a -> 'a -> bool};
    94.8 -fun eq (A_:'a eq) = #eq A_;
    94.9 -
   94.10 -fun eqop A_ a = eq A_ a;
   94.11 -
   94.12 -end; (*struct HOL*)
   94.13 -
   94.14 -structure List = 
   94.15 -struct
   94.16 -
   94.17 -fun member A_ x (y :: ys) =
   94.18 -  (if HOL.eqop A_ y x then true else member A_ x ys)
   94.19 -  | member A_ x [] = false;
   94.20 -
   94.21 -end; (*struct List*)
   94.22 -
   94.23 -structure Codegen = 
   94.24 -struct
   94.25 -
   94.26 -fun collect_duplicates A_ xs ys (z :: zs) =
   94.27 -  (if List.member A_ z xs
   94.28 -    then (if List.member A_ z ys then collect_duplicates A_ xs ys zs
   94.29 -           else collect_duplicates A_ xs (z :: ys) zs)
   94.30 -    else collect_duplicates A_ (z :: xs) (z :: ys) zs)
   94.31 -  | collect_duplicates A_ xs ys [] = xs;
   94.32 -
   94.33 -end; (*struct Codegen*)
    95.1 --- a/doc-src/IsarAdvanced/Codegen/Thy/examples/dirty_set.ML	Mon Mar 02 16:58:39 2009 +0100
    95.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    95.3 @@ -1,102 +0,0 @@
    95.4 -structure ROOT = 
    95.5 -struct
    95.6 -
    95.7 -structure Nat = 
    95.8 -struct
    95.9 -
   95.10 -datatype nat = Zero_nat | Suc of nat;
   95.11 -
   95.12 -end; (*struct Nat*)
   95.13 -
   95.14 -structure Integer = 
   95.15 -struct
   95.16 -
   95.17 -datatype bit = B0 | B1;
   95.18 -
   95.19 -datatype int = Pls | Min | Bit of int * bit | Number_of_int of int;
   95.20 -
   95.21 -fun pred (Bit (k, B0)) = Bit (pred k, B1)
   95.22 -  | pred (Bit (k, B1)) = Bit (k, B0)
   95.23 -  | pred Min = Bit (Min, B0)
   95.24 -  | pred Pls = Min;
   95.25 -
   95.26 -fun uminus_int (Number_of_int w) = Number_of_int (uminus_int w)
   95.27 -  | uminus_int (Bit (k, B0)) = Bit (uminus_int k, B0)
   95.28 -  | uminus_int (Bit (k, B1)) = Bit (pred (uminus_int k), B1)
   95.29 -  | uminus_int Min = Bit (Pls, B1)
   95.30 -  | uminus_int Pls = Pls;
   95.31 -
   95.32 -fun succ (Bit (k, B0)) = Bit (k, B1)
   95.33 -  | succ (Bit (k, B1)) = Bit (succ k, B0)
   95.34 -  | succ Min = Pls
   95.35 -  | succ Pls = Bit (Pls, B1);
   95.36 -
   95.37 -fun plus_int (Number_of_int v) (Number_of_int w) =
   95.38 -  Number_of_int (plus_int v w)
   95.39 -  | plus_int k Min = pred k
   95.40 -  | plus_int k Pls = k
   95.41 -  | plus_int (Bit (k, B1)) (Bit (l, B1)) = Bit (plus_int k (succ l), B0)
   95.42 -  | plus_int (Bit (k, B1)) (Bit (l, B0)) = Bit (plus_int k l, B1)
   95.43 -  | plus_int (Bit (k, B0)) (Bit (l, b)) = Bit (plus_int k l, b)
   95.44 -  | plus_int Min k = pred k
   95.45 -  | plus_int Pls k = k;
   95.46 -
   95.47 -fun minus_int (Number_of_int v) (Number_of_int w) =
   95.48 -  Number_of_int (plus_int v (uminus_int w))
   95.49 -  | minus_int z w = plus_int z (uminus_int w);
   95.50 -
   95.51 -fun less_eq_int (Number_of_int k) (Number_of_int l) = less_eq_int k l
   95.52 -  | less_eq_int (Bit (k1, B1)) (Bit (k2, B0)) = less_int k1 k2
   95.53 -  | less_eq_int (Bit (k1, v)) (Bit (k2, B1)) = less_eq_int k1 k2
   95.54 -  | less_eq_int (Bit (k1, B0)) (Bit (k2, v)) = less_eq_int k1 k2
   95.55 -  | less_eq_int (Bit (k, v)) Min = less_eq_int k Min
   95.56 -  | less_eq_int (Bit (k, B1)) Pls = less_int k Pls
   95.57 -  | less_eq_int (Bit (k, B0)) Pls = less_eq_int k Pls
   95.58 -  | less_eq_int Min (Bit (k, B1)) = less_eq_int Min k
   95.59 -  | less_eq_int Min (Bit (k, B0)) = less_int Min k
   95.60 -  | less_eq_int Min Min = true
   95.61 -  | less_eq_int Min Pls = true
   95.62 -  | less_eq_int Pls (Bit (k, v)) = less_eq_int Pls k
   95.63 -  | less_eq_int Pls Min = false
   95.64 -  | less_eq_int Pls Pls = true
   95.65 -and less_int (Number_of_int k) (Number_of_int l) = less_int k l
   95.66 -  | less_int (Bit (k1, B0)) (Bit (k2, B1)) = less_eq_int k1 k2
   95.67 -  | less_int (Bit (k1, B1)) (Bit (k2, v)) = less_int k1 k2
   95.68 -  | less_int (Bit (k1, v)) (Bit (k2, B0)) = less_int k1 k2
   95.69 -  | less_int (Bit (k, B1)) Min = less_int k Min
   95.70 -  | less_int (Bit (k, B0)) Min = less_eq_int k Min
   95.71 -  | less_int (Bit (k, v)) Pls = less_int k Pls
   95.72 -  | less_int Min (Bit (k, v)) = less_int Min k
   95.73 -  | less_int Min Min = false
   95.74 -  | less_int Min Pls = true
   95.75 -  | less_int Pls (Bit (k, B1)) = less_eq_int Pls k
   95.76 -  | less_int Pls (Bit (k, B0)) = less_int Pls k
   95.77 -  | less_int Pls Min = false
   95.78 -  | less_int Pls Pls = false;
   95.79 -
   95.80 -fun nat_aux n i =
   95.81 -  (if less_eq_int i (Number_of_int Pls) then n
   95.82 -    else nat_aux (Nat.Suc n)
   95.83 -           (minus_int i (Number_of_int (Bit (Pls, B1)))));
   95.84 -
   95.85 -fun nat i = nat_aux Nat.Zero_nat i;
   95.86 -
   95.87 -end; (*struct Integer*)
   95.88 -
   95.89 -structure Codegen = 
   95.90 -struct
   95.91 -
   95.92 -val dummy_set : (Nat.nat -> Nat.nat) list = Nat.Suc :: [];
   95.93 -
   95.94 -val foobar_set : Nat.nat list =
   95.95 -  Nat.Zero_nat ::
   95.96 -    (Nat.Suc Nat.Zero_nat ::
   95.97 -      (Integer.nat
   95.98 -         (Integer.Number_of_int
   95.99 -           (Integer.Bit
  95.100 -             (Integer.Bit (Integer.Pls, Integer.B1), Integer.B0)))
  95.101 -        :: []));
  95.102 -
  95.103 -end; (*struct Codegen*)
  95.104 -
  95.105 -end; (*struct ROOT*)
    96.1 --- a/doc-src/IsarAdvanced/Codegen/Thy/examples/example.ML	Mon Mar 02 16:58:39 2009 +0100
    96.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    96.3 @@ -1,27 +0,0 @@
    96.4 -structure Example = 
    96.5 -struct
    96.6 -
    96.7 -fun foldl f a [] = a
    96.8 -  | foldl f a (x :: xs) = foldl f (f a x) xs;
    96.9 -
   96.10 -fun rev xs = foldl (fn xsa => fn x => x :: xsa) [] xs;
   96.11 -
   96.12 -fun list_case f1 f2 (a :: lista) = f2 a lista
   96.13 -  | list_case f1 f2 [] = f1;
   96.14 -
   96.15 -datatype 'a queue = AQueue of 'a list * 'a list;
   96.16 -
   96.17 -val empty : 'a queue = AQueue ([], [])
   96.18 -
   96.19 -fun dequeue (AQueue ([], [])) = (NONE, AQueue ([], []))
   96.20 -  | dequeue (AQueue (xs, y :: ys)) = (SOME y, AQueue (xs, ys))
   96.21 -  | dequeue (AQueue (v :: va, [])) =
   96.22 -    let
   96.23 -      val y :: ys = rev (v :: va);
   96.24 -    in
   96.25 -      (SOME y, AQueue ([], ys))
   96.26 -    end;
   96.27 -
   96.28 -fun enqueue x (AQueue (xs, ys)) = AQueue (x :: xs, ys);
   96.29 -
   96.30 -end; (*struct Example*)
    97.1 --- a/doc-src/IsarAdvanced/Codegen/Thy/examples/fac.ML	Mon Mar 02 16:58:39 2009 +0100
    97.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    97.3 @@ -1,22 +0,0 @@
    97.4 -structure Nat = 
    97.5 -struct
    97.6 -
    97.7 -datatype nat = Suc of nat | Zero_nat;
    97.8 -
    97.9 -val one_nat : nat = Suc Zero_nat;
   97.10 -
   97.11 -fun plus_nat (Suc m) n = plus_nat m (Suc n)
   97.12 -  | plus_nat Zero_nat n = n;
   97.13 -
   97.14 -fun times_nat (Suc m) n = plus_nat n (times_nat m n)
   97.15 -  | times_nat Zero_nat n = Zero_nat;
   97.16 -
   97.17 -end; (*struct Nat*)
   97.18 -
   97.19 -structure Codegen = 
   97.20 -struct
   97.21 -
   97.22 -fun fac (Nat.Suc n) = Nat.times_nat (Nat.Suc n) (fac n)
   97.23 -  | fac Nat.Zero_nat = Nat.one_nat;
   97.24 -
   97.25 -end; (*struct Codegen*)
    98.1 --- a/doc-src/IsarAdvanced/Codegen/Thy/examples/integers.ML	Mon Mar 02 16:58:39 2009 +0100
    98.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    98.3 @@ -1,59 +0,0 @@
    98.4 -structure ROOT = 
    98.5 -struct
    98.6 -
    98.7 -structure Integer = 
    98.8 -struct
    98.9 -
   98.10 -datatype bit = B0 | B1;
   98.11 -
   98.12 -datatype int = Pls | Min | Bit of int * bit | Number_of_int of int;
   98.13 -
   98.14 -fun pred (Bit (k, B0)) = Bit (pred k, B1)
   98.15 -  | pred (Bit (k, B1)) = Bit (k, B0)
   98.16 -  | pred Min = Bit (Min, B0)
   98.17 -  | pred Pls = Min;
   98.18 -
   98.19 -fun succ (Bit (k, B0)) = Bit (k, B1)
   98.20 -  | succ (Bit (k, B1)) = Bit (succ k, B0)
   98.21 -  | succ Min = Pls
   98.22 -  | succ Pls = Bit (Pls, B1);
   98.23 -
   98.24 -fun plus_int (Number_of_int v) (Number_of_int w) =
   98.25 -  Number_of_int (plus_int v w)
   98.26 -  | plus_int k Min = pred k
   98.27 -  | plus_int k Pls = k
   98.28 -  | plus_int (Bit (k, B1)) (Bit (l, B1)) = Bit (plus_int k (succ l), B0)
   98.29 -  | plus_int (Bit (k, B1)) (Bit (l, B0)) = Bit (plus_int k l, B1)
   98.30 -  | plus_int (Bit (k, B0)) (Bit (l, b)) = Bit (plus_int k l, b)
   98.31 -  | plus_int Min k = pred k
   98.32 -  | plus_int Pls k = k;
   98.33 -
   98.34 -fun uminus_int (Number_of_int w) = Number_of_int (uminus_int w)
   98.35 -  | uminus_int (Bit (k, B0)) = Bit (uminus_int k, B0)
   98.36 -  | uminus_int (Bit (k, B1)) = Bit (pred (uminus_int k), B1)
   98.37 -  | uminus_int Min = Bit (Pls, B1)
   98.38 -  | uminus_int Pls = Pls;
   98.39 -
   98.40 -fun times_int (Number_of_int v) (Number_of_int w) =
   98.41 -  Number_of_int (times_int v w)
   98.42 -  | times_int (Bit (k, B0)) l = Bit (times_int k l, B0)
   98.43 -  | times_int (Bit (k, B1)) l = plus_int (Bit (times_int k l, B0)) l
   98.44 -  | times_int Min k = uminus_int k
   98.45 -  | times_int Pls w = Pls;
   98.46 -
   98.47 -end; (*struct Integer*)
   98.48 -
   98.49 -structure Codegen = 
   98.50 -struct
   98.51 -
   98.52 -fun double_inc k =
   98.53 -  Integer.plus_int
   98.54 -    (Integer.times_int
   98.55 -      (Integer.Number_of_int
   98.56 -        (Integer.Bit (Integer.Bit (Integer.Pls, Integer.B1), Integer.B0)))
   98.57 -      k)
   98.58 -    (Integer.Number_of_int (Integer.Bit (Integer.Pls, Integer.B1)));
   98.59 -
   98.60 -end; (*struct Codegen*)
   98.61 -
   98.62 -end; (*struct ROOT*)
    99.1 --- a/doc-src/IsarAdvanced/Codegen/Thy/examples/lexicographic.ML	Mon Mar 02 16:58:39 2009 +0100
    99.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    99.3 @@ -1,19 +0,0 @@
    99.4 -structure HOL = 
    99.5 -struct
    99.6 -
    99.7 -type 'a eq = {eq : 'a -> 'a -> bool};
    99.8 -fun eq (A_:'a eq) = #eq A_;
    99.9 -
   99.10 -type 'a ord = {less_eq : 'a -> 'a -> bool, less : 'a -> 'a -> bool};
   99.11 -fun less_eq (A_:'a ord) = #less_eq A_;
   99.12 -fun less (A_:'a ord) = #less A_;
   99.13 -
   99.14 -end; (*struct HOL*)
   99.15 -
   99.16 -structure Codegen = 
   99.17 -struct
   99.18 -
   99.19 -fun less_eq (A1_, A2_) B_ (x1, y1) (x2, y2) =
   99.20 -  HOL.less A2_ x1 x2 orelse HOL.eq A1_ x1 x2 andalso HOL.less_eq B_ y1 y2;
   99.21 -
   99.22 -end; (*struct Codegen*)
   100.1 --- a/doc-src/IsarAdvanced/Codegen/Thy/examples/lookup.ML	Mon Mar 02 16:58:39 2009 +0100
   100.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   100.3 @@ -1,13 +0,0 @@
   100.4 -structure ROOT = 
   100.5 -struct
   100.6 -
   100.7 -structure Codegen = 
   100.8 -struct
   100.9 -
  100.10 -fun lookup ((k, v) :: xs) l =
  100.11 -  (if ((k : string) = l) then SOME v else lookup xs l)
  100.12 -  | lookup [] l = NONE;
  100.13 -
  100.14 -end; (*struct Codegen*)
  100.15 -
  100.16 -end; (*struct ROOT*)
   101.1 --- a/doc-src/IsarAdvanced/Codegen/Thy/examples/monotype.ML	Mon Mar 02 16:58:39 2009 +0100
   101.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   101.3 @@ -1,34 +0,0 @@
   101.4 -structure Nat = 
   101.5 -struct
   101.6 -
   101.7 -datatype nat = Suc of nat | Zero_nat;
   101.8 -
   101.9 -fun eq_nat (Suc a) Zero_nat = false
  101.10 -  | eq_nat Zero_nat (Suc a) = false
  101.11 -  | eq_nat (Suc nat) (Suc nat') = eq_nat nat nat'
  101.12 -  | eq_nat Zero_nat Zero_nat = true;
  101.13 -
  101.14 -end; (*struct Nat*)
  101.15 -
  101.16 -structure List = 
  101.17 -struct
  101.18 -
  101.19 -fun null (x :: xs) = false
  101.20 -  | null [] = true;
  101.21 -
  101.22 -fun list_all2 p (x :: xs) (y :: ys) = p x y andalso list_all2 p xs ys
  101.23 -  | list_all2 p xs [] = null xs
  101.24 -  | list_all2 p [] ys = null ys;
  101.25 -
  101.26 -end; (*struct List*)
  101.27 -
  101.28 -structure Codegen = 
  101.29 -struct
  101.30 -
  101.31 -datatype monotype = Mono of Nat.nat * monotype list;
  101.32 -
  101.33 -fun eq_monotype (Mono (tyco1, typargs1)) (Mono (tyco2, typargs2)) =
  101.34 -  Nat.eq_nat tyco1 tyco2 andalso
  101.35 -    List.list_all2 eq_monotype typargs1 typargs2;
  101.36 -
  101.37 -end; (*struct Codegen*)
   102.1 --- a/doc-src/IsarAdvanced/Codegen/Thy/examples/nat_binary.ML	Mon Mar 02 16:58:39 2009 +0100
   102.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   102.3 @@ -1,17 +0,0 @@
   102.4 -structure Nat = 
   102.5 -struct
   102.6 -
   102.7 -datatype nat = Dig1 of nat | Dig0 of nat | One_nat | Zero_nat;
   102.8 -
   102.9 -fun plus_nat (Dig1 m) (Dig1 n) = Dig0 (plus_nat (plus_nat m n) One_nat)
  102.10 -  | plus_nat (Dig1 m) (Dig0 n) = Dig1 (plus_nat m n)
  102.11 -  | plus_nat (Dig0 m) (Dig1 n) = Dig1 (plus_nat m n)
  102.12 -  | plus_nat (Dig0 m) (Dig0 n) = Dig0 (plus_nat m n)
  102.13 -  | plus_nat (Dig1 m) One_nat = Dig0 (plus_nat m One_nat)
  102.14 -  | plus_nat One_nat (Dig1 n) = Dig0 (plus_nat n One_nat)
  102.15 -  | plus_nat (Dig0 m) One_nat = Dig1 m
  102.16 -  | plus_nat One_nat (Dig0 n) = Dig1 n
  102.17 -  | plus_nat m Zero_nat = m
  102.18 -  | plus_nat Zero_nat n = n;
  102.19 -
  102.20 -end; (*struct Nat*)
   103.1 --- a/doc-src/IsarAdvanced/Codegen/Thy/examples/pick1.ML	Mon Mar 02 16:58:39 2009 +0100
   103.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   103.3 @@ -1,44 +0,0 @@
   103.4 -structure HOL = 
   103.5 -struct
   103.6 -
   103.7 -fun leta s f = f s;
   103.8 -
   103.9 -end; (*struct HOL*)
  103.10 -
  103.11 -structure Nat = 
  103.12 -struct
  103.13 -
  103.14 -datatype nat = Suc of nat | Zero_nat;
  103.15 -
  103.16 -fun less_nat m (Suc n) = less_eq_nat m n
  103.17 -  | less_nat n Zero_nat = false
  103.18 -and less_eq_nat (Suc m) n = less_nat m n
  103.19 -  | less_eq_nat Zero_nat n = true;
  103.20 -
  103.21 -fun minus_nat (Suc m) (Suc n) = minus_nat m n
  103.22 -  | minus_nat Zero_nat n = Zero_nat
  103.23 -  | minus_nat m Zero_nat = m;
  103.24 -
  103.25 -end; (*struct Nat*)
  103.26 -
  103.27 -structure Product_Type = 
  103.28 -struct
  103.29 -
  103.30 -fun split f (a, b) = f a b;
  103.31 -
  103.32 -end; (*struct Product_Type*)
  103.33 -
  103.34 -structure Codegen = 
  103.35 -struct
  103.36 -
  103.37 -fun pick ((k, v) :: xs) n =
  103.38 -  (if Nat.less_nat n k then v else pick xs (Nat.minus_nat n k))
  103.39 -  | pick (x :: xs) n =
  103.40 -    let
  103.41 -      val a = x;
  103.42 -      val (k, v) = a;
  103.43 -    in
  103.44 -      (if Nat.less_nat n k then v else pick xs (Nat.minus_nat n k))
  103.45 -    end;
  103.46 -
  103.47 -end; (*struct Codegen*)
   104.1 --- a/doc-src/IsarAdvanced/Codegen/Thy/examples/tree.ML	Mon Mar 02 16:58:39 2009 +0100
   104.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   104.3 @@ -1,95 +0,0 @@
   104.4 -structure HOL = 
   104.5 -struct
   104.6 -
   104.7 -type 'a eq = {eq : 'a -> 'a -> bool};
   104.8 -fun eq (A_:'a eq) = #eq A_;
   104.9 -
  104.10 -type 'a ord = {less_eq : 'a -> 'a -> bool, less : 'a -> 'a -> bool};
  104.11 -fun less_eq (A_:'a ord) = #less_eq A_;
  104.12 -fun less (A_:'a ord) = #less A_;
  104.13 -
  104.14 -fun eqop A_ a = eq A_ a;
  104.15 -
  104.16 -end; (*struct HOL*)
  104.17 -
  104.18 -structure Orderings = 
  104.19 -struct
  104.20 -
  104.21 -type 'a preorder = {Orderings__ord_preorder : 'a HOL.ord};
  104.22 -fun ord_preorder (A_:'a preorder) = #Orderings__ord_preorder A_;
  104.23 -
  104.24 -type 'a order = {Orderings__preorder_order : 'a preorder};
  104.25 -fun preorder_order (A_:'a order) = #Orderings__preorder_order A_;
  104.26 -
  104.27 -type 'a linorder = {Orderings__order_linorder : 'a order};
  104.28 -fun order_linorder (A_:'a linorder) = #Orderings__order_linorder A_;
  104.29 -
  104.30 -end; (*struct Orderings*)
  104.31 -
  104.32 -structure Nat = 
  104.33 -struct
  104.34 -
  104.35 -datatype nat = Suc of nat | Zero_nat;
  104.36 -
  104.37 -fun eq_nat (Suc a) Zero_nat = false
  104.38 -  | eq_nat Zero_nat (Suc a) = false
  104.39 -  | eq_nat (Suc nat) (Suc nat') = eq_nat nat nat'
  104.40 -  | eq_nat Zero_nat Zero_nat = true;
  104.41 -
  104.42 -val eq_nata = {eq = eq_nat} : nat HOL.eq;
  104.43 -
  104.44 -fun less_nat m (Suc n) = less_eq_nat m n
  104.45 -  | less_nat n Zero_nat = false
  104.46 -and less_eq_nat (Suc m) n = less_nat m n
  104.47 -  | less_eq_nat Zero_nat n = true;
  104.48 -
  104.49 -val ord_nat = {less_eq = less_eq_nat, less = less_nat} : nat HOL.ord;
  104.50 -
  104.51 -val preorder_nat = {Orderings__ord_preorder = ord_nat} :
  104.52 -  nat Orderings.preorder;
  104.53 -
  104.54 -val order_nat = {Orderings__preorder_order = preorder_nat} :
  104.55 -  nat Orderings.order;
  104.56 -
  104.57 -val linorder_nat = {Orderings__order_linorder = order_nat} :
  104.58 -  nat Orderings.linorder;
  104.59 -
  104.60 -end; (*struct Nat*)
  104.61 -
  104.62 -structure Codegen = 
  104.63 -struct
  104.64 -
  104.65 -datatype ('a, 'b) searchtree =
  104.66 -  Branch of ('a, 'b) searchtree * 'a * ('a, 'b) searchtree |
  104.67 -  Leaf of 'a * 'b;
  104.68 -
  104.69 -fun update (A1_, A2_) (it, entry) (Leaf (key, vala)) =
  104.70 -  (if HOL.eqop A1_ it key then Leaf (key, entry)
  104.71 -    else (if HOL.less_eq
  104.72 -               ((Orderings.ord_preorder o Orderings.preorder_order o
  104.73 -                  Orderings.order_linorder)
  104.74 -                 A2_)
  104.75 -               it key
  104.76 -           then Branch (Leaf (it, entry), it, Leaf (key, vala))
  104.77 -           else Branch (Leaf (key, vala), it, Leaf (it, entry))))
  104.78 -  | update (A1_, A2_) (it, entry) (Branch (t1, key, t2)) =
  104.79 -    (if HOL.less_eq
  104.80 -          ((Orderings.ord_preorder o Orderings.preorder_order o
  104.81 -             Orderings.order_linorder)
  104.82 -            A2_)
  104.83 -          it key
  104.84 -      then Branch (update (A1_, A2_) (it, entry) t1, key, t2)
  104.85 -      else Branch (t1, key, update (A1_, A2_) (it, entry) t2));
  104.86 -
  104.87 -val example : (Nat.nat, (Nat.nat list)) searchtree =
  104.88 -  update (Nat.eq_nata, Nat.linorder_nat)
  104.89 -    (Nat.Suc (Nat.Suc (Nat.Suc (Nat.Suc Nat.Zero_nat))),
  104.90 -      [Nat.Suc (Nat.Suc Nat.Zero_nat), Nat.Suc (Nat.Suc Nat.Zero_nat)])
  104.91 -    (update (Nat.eq_nata, Nat.linorder_nat)
  104.92 -      (Nat.Suc (Nat.Suc (Nat.Suc Nat.Zero_nat)),
  104.93 -        [Nat.Suc (Nat.Suc (Nat.Suc Nat.Zero_nat))])
  104.94 -      (update (Nat.eq_nata, Nat.linorder_nat)
  104.95 -        (Nat.Suc (Nat.Suc Nat.Zero_nat), [Nat.Suc (Nat.Suc Nat.Zero_nat)])
  104.96 -        (Leaf (Nat.Suc Nat.Zero_nat, []))));
  104.97 -
  104.98 -end; (*struct Codegen*)
   105.1 --- a/doc-src/IsarAdvanced/Codegen/codegen.tex	Mon Mar 02 16:58:39 2009 +0100
   105.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   105.3 @@ -1,53 +0,0 @@
   105.4 -
   105.5 -\documentclass[12pt,a4paper,fleqn]{report}
   105.6 -\usepackage{latexsym,graphicx}
   105.7 -\usepackage[refpage]{nomencl}
   105.8 -\usepackage{../../iman,../../extra,../../isar,../../proof}
   105.9 -\usepackage{../../isabelle,../../isabellesym}
  105.10 -\usepackage{style}
  105.11 -\usepackage{pgf}
  105.12 -\usepackage{pgflibraryshapes}
  105.13 -\usepackage{tikz}
  105.14 -\usepackage{../../pdfsetup}
  105.15 -
  105.16 -\hyphenation{Isabelle}
  105.17 -\hyphenation{Isar}
  105.18 -\isadroptag{theory}
  105.19 -
  105.20 -\title{\includegraphics[scale=0.5]{isabelle_isar}
  105.21 -  \\[4ex] Code generation from Isabelle/HOL theories}
  105.22 -\author{\emph{Florian Haftmann}}
  105.23 -
  105.24 -\begin{document}
  105.25 -
  105.26 -\maketitle
  105.27 -
  105.28 -\begin{abstract}
  105.29 -  This tutorial gives an introduction to a generic code generator framework in Isabelle
  105.30 -  for generating executable code in functional programming languages from logical
  105.31 -  specifications in Isabelle/HOL.
  105.32 -\end{abstract}
  105.33 -
  105.34 -\thispagestyle{empty}\clearpage
  105.35 -
  105.36 -\pagenumbering{roman}
  105.37 -\clearfirst
  105.38 -
  105.39 -\input{Thy/document/Introduction.tex}
  105.40 -\input{Thy/document/Program.tex}
  105.41 -\input{Thy/document/Adaption.tex}
  105.42 -\input{Thy/document/Further.tex}
  105.43 -\input{Thy/document/ML.tex}
  105.44 -
  105.45 -\begingroup
  105.46 -\bibliographystyle{plain} \small\raggedright\frenchspacing
  105.47 -\bibliography{../../manual}
  105.48 -\endgroup
  105.49 -
  105.50 -\end{document}
  105.51 -
  105.52 -
  105.53 -%%% Local Variables: 
  105.54 -%%% mode: latex
  105.55 -%%% TeX-master: t
  105.56 -%%% End: 
   106.1 Binary file doc-src/IsarAdvanced/Codegen/codegen_process.pdf has changed
   107.1 --- a/doc-src/IsarAdvanced/Codegen/codegen_process.ps	Mon Mar 02 16:58:39 2009 +0100
   107.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   107.3 @@ -1,586 +0,0 @@
   107.4 -%!PS-Adobe-2.0
   107.5 -%%Creator: dot version 2.2 (Mon Sep 12 23:33:36 UTC 2005)
   107.6 -%%For: (haftmann) Florian Haftmann
   107.7 -%%Title: _anonymous_0
   107.8 -%%Pages: (atend)
   107.9 -%%BoundingBox: 35 35 451 291
  107.10 -%%EndComments
  107.11 -save
  107.12 -%%BeginProlog
  107.13 -/DotDict 200 dict def
  107.14 -DotDict begin
  107.15 -
  107.16 -/setupLatin1 {
  107.17 -mark
  107.18 -/EncodingVector 256 array def
  107.19 - EncodingVector 0
  107.20 -
  107.21 -ISOLatin1Encoding 0 255 getinterval putinterval
  107.22 -
  107.23 -EncodingVector
  107.24 -  dup 306 /AE
  107.25 -  dup 301 /Aacute
  107.26 -  dup 302 /Acircumflex
  107.27 -  dup 304 /Adieresis
  107.28 -  dup 300 /Agrave
  107.29 -  dup 305 /Aring
  107.30 -  dup 303 /Atilde
  107.31 -  dup 307 /Ccedilla
  107.32 -  dup 311 /Eacute
  107.33 -  dup 312 /Ecircumflex
  107.34 -  dup 313 /Edieresis
  107.35 -  dup 310 /Egrave
  107.36 -  dup 315 /Iacute
  107.37 -  dup 316 /Icircumflex
  107.38 -  dup 317 /Idieresis
  107.39 -  dup 314 /Igrave
  107.40 -  dup 334 /Udieresis
  107.41 -  dup 335 /Yacute
  107.42 -  dup 376 /thorn
  107.43 -  dup 337 /germandbls
  107.44 -  dup 341 /aacute
  107.45 -  dup 342 /acircumflex
  107.46 -  dup 344 /adieresis
  107.47 -  dup 346 /ae
  107.48 -  dup 340 /agrave
  107.49 -  dup 345 /aring
  107.50 -  dup 347 /ccedilla
  107.51 -  dup 351 /eacute
  107.52 -  dup 352 /ecircumflex
  107.53 -  dup 353 /edieresis
  107.54 -  dup 350 /egrave
  107.55 -  dup 355 /iacute
  107.56 -  dup 356 /icircumflex
  107.57 -  dup 357 /idieresis
  107.58 -  dup 354 /igrave
  107.59 -  dup 360 /dcroat
  107.60 -  dup 361 /ntilde
  107.61 -  dup 363 /oacute
  107.62 -  dup 364 /ocircumflex
  107.63 -  dup 366 /odieresis
  107.64 -  dup 362 /ograve
  107.65 -  dup 365 /otilde
  107.66 -  dup 370 /oslash
  107.67 -  dup 372 /uacute
  107.68 -  dup 373 /ucircumflex
  107.69 -  dup 374 /udieresis
  107.70 -  dup 371 /ugrave
  107.71 -  dup 375 /yacute
  107.72 -  dup 377 /ydieresis  
  107.73 -
  107.74 -% Set up ISO Latin 1 character encoding
  107.75 -/starnetISO {
  107.76 -        dup dup findfont dup length dict begin
  107.77 -        { 1 index /FID ne { def }{ pop pop } ifelse
  107.78 -        } forall
  107.79 -        /Encoding EncodingVector def
  107.80 -        currentdict end definefont
  107.81 -} def
  107.82 -/Times-Roman starnetISO def
  107.83 -/Times-Italic starnetISO def
  107.84 -/Times-Bold starnetISO def
  107.85 -/Times-BoldItalic starnetISO def
  107.86 -/Helvetica starnetISO def
  107.87 -/Helvetica-Oblique starnetISO def
  107.88 -/Helvetica-Bold starnetISO def
  107.89 -/Helvetica-BoldOblique starnetISO def
  107.90 -/Courier starnetISO def
  107.91 -/Courier-Oblique starnetISO def
  107.92 -/Courier-Bold starnetISO def
  107.93 -/Courier-BoldOblique starnetISO def
  107.94 -cleartomark
  107.95 -} bind def
  107.96 -
  107.97 -%%BeginResource: procset graphviz 0 0
  107.98 -/coord-font-family /Times-Roman def
  107.99 -/default-font-family /Times-Roman def
 107.100 -/coordfont coord-font-family findfont 8 scalefont def
 107.101 -
 107.102 -/InvScaleFactor 1.0 def
 107.103 -/set_scale {
 107.104 -	dup 1 exch div /InvScaleFactor exch def
 107.105 -	dup scale
 107.106 -} bind def
 107.107 -
 107.108 -% styles
 107.109 -/solid { [] 0 setdash } bind def
 107.110 -/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
 107.111 -/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
 107.112 -/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
 107.113 -/bold { 2 setlinewidth } bind def
 107.114 -/filled { } bind def
 107.115 -/unfilled { } bind def
 107.116 -/rounded { } bind def
 107.117 -/diagonals { } bind def
 107.118 -
 107.119 -% hooks for setting color 
 107.120 -/nodecolor { sethsbcolor } bind def
 107.121 -/edgecolor { sethsbcolor } bind def
 107.122 -/graphcolor { sethsbcolor } bind def
 107.123 -/nopcolor {pop pop pop} bind def
 107.124 -
 107.125 -/beginpage {	% i j npages
 107.126 -	/npages exch def
 107.127 -	/j exch def
 107.128 -	/i exch def
 107.129 -	/str 10 string def
 107.130 -	npages 1 gt {
 107.131 -		gsave
 107.132 -			coordfont setfont
 107.133 -			0 0 moveto
 107.134 -			(\() show i str cvs show (,) show j str cvs show (\)) show
 107.135 -		grestore
 107.136 -	} if
 107.137 -} bind def
 107.138 -
 107.139 -/set_font {
 107.140 -	findfont exch
 107.141 -	scalefont setfont
 107.142 -} def
 107.143 -
 107.144 -% draw aligned label in bounding box aligned to current point
 107.145 -/alignedtext {			% width adj text
 107.146 -	/text exch def
 107.147 -	/adj exch def
 107.148 -	/width exch def
 107.149 -	gsave
 107.150 -		width 0 gt {
 107.151 -			text stringwidth pop adj mul 0 rmoveto
 107.152 -		} if
 107.153 -		[] 0 setdash
 107.154 -		text show
 107.155 -	grestore
 107.156 -} def
 107.157 -
 107.158 -/boxprim {				% xcorner ycorner xsize ysize
 107.159 -		4 2 roll
 107.160 -		moveto
 107.161 -		2 copy
 107.162 -		exch 0 rlineto
 107.163 -		0 exch rlineto
 107.164 -		pop neg 0 rlineto
 107.165 -		closepath
 107.166 -} bind def
 107.167 -
 107.168 -/ellipse_path {
 107.169 -	/ry exch def
 107.170 -	/rx exch def
 107.171 -	/y exch def
 107.172 -	/x exch def
 107.173 -	matrix currentmatrix
 107.174 -	newpath
 107.175 -	x y translate
 107.176 -	rx ry scale
 107.177 -	0 0 1 0 360 arc
 107.178 -	setmatrix
 107.179 -} bind def
 107.180 -
 107.181 -/endpage { showpage } bind def
 107.182 -/showpage { } def
 107.183 -
 107.184 -/layercolorseq
 107.185 -	[	% layer color sequence - darkest to lightest
 107.186 -		[0 0 0]
 107.187 -		[.2 .8 .8]
 107.188 -		[.4 .8 .8]
 107.189 -		[.6 .8 .8]
 107.190 -		[.8 .8 .8]
 107.191 -	]
 107.192 -def
 107.193 -
 107.194 -/layerlen layercolorseq length def
 107.195 -
 107.196 -/setlayer {/maxlayer exch def /curlayer exch def
 107.197 -	layercolorseq curlayer 1 sub layerlen mod get
 107.198 -	aload pop sethsbcolor
 107.199 -	/nodecolor {nopcolor} def
 107.200 -	/edgecolor {nopcolor} def
 107.201 -	/graphcolor {nopcolor} def
 107.202 -} bind def
 107.203 -
 107.204 -/onlayer { curlayer ne {invis} if } def
 107.205 -
 107.206 -/onlayers {
 107.207 -	/myupper exch def
 107.208 -	/mylower exch def
 107.209 -	curlayer mylower lt
 107.210 -	curlayer myupper gt
 107.211 -	or
 107.212 -	{invis} if
 107.213 -} def
 107.214 -
 107.215 -/curlayer 0 def
 107.216 -
 107.217 -%%EndResource
 107.218 -%%EndProlog
 107.219 -%%BeginSetup
 107.220 -14 default-font-family set_font
 107.221 -1 setmiterlimit
 107.222 -% /arrowlength 10 def
 107.223 -% /arrowwidth 5 def
 107.224 -
 107.225 -% make sure pdfmark is harmless for PS-interpreters other than Distiller
 107.226 -/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
 107.227 -% make '<<' and '>>' safe on PS Level 1 devices
 107.228 -/languagelevel where {pop languagelevel}{1} ifelse
 107.229 -2 lt {
 107.230 -    userdict (<<) cvn ([) cvn load put
 107.231 -    userdict (>>) cvn ([) cvn load put
 107.232 -} if
 107.233 -
 107.234 -%%EndSetup
 107.235 -%%Page: 1 1
 107.236 -%%PageBoundingBox: 36 36 451 291
 107.237 -%%PageOrientation: Portrait
 107.238 -gsave
 107.239 -35 35 416 256 boxprim clip newpath
 107.240 -36 36 translate
 107.241 -0 0 1 beginpage
 107.242 -0 0 translate 0 rotate
 107.243 -[ /CropBox [36 36 451 291] /PAGES pdfmark
 107.244 -0.000 0.000 0.000 graphcolor
 107.245 -14.00 /Times-Roman set_font
 107.246 -
 107.247 -%	theory
 107.248 -gsave 10 dict begin
 107.249 -newpath 93 254 moveto
 107.250 -1 254 lineto
 107.251 -1 214 lineto
 107.252 -93 214 lineto
 107.253 -closepath
 107.254 -stroke
 107.255 -gsave 10 dict begin
 107.256 -8 237 moveto
 107.257 -(Isabelle/HOL)
 107.258 -[4.56 5.52 6.24 6.96 6.24 3.84 3.84 6.24 3.84 10.08 10.08 8.64]
 107.259 -xshow
 107.260 -16 221 moveto
 107.261 -(Isar theory)
 107.262 -[4.56 5.52 6.24 4.56 3.6 4.08 6.96 6.24 6.96 4.8 6.96]
 107.263 -xshow
 107.264 -end grestore
 107.265 -end grestore
 107.266 -
 107.267 -%	selection
 107.268 -gsave 10 dict begin
 107.269 -183 234 38 18 ellipse_path
 107.270 -stroke
 107.271 -gsave 10 dict begin
 107.272 -158 229 moveto
 107.273 -(selection)
 107.274 -[5.52 6.24 3.84 6.24 6.24 3.84 3.84 6.96 6.96]
 107.275 -xshow
 107.276 -end grestore
 107.277 -end grestore
 107.278 -
 107.279 -%	theory -> selection
 107.280 -newpath 94 234 moveto
 107.281 -107 234 121 234 135 234 curveto
 107.282 -stroke
 107.283 -gsave 10 dict begin
 107.284 -solid
 107.285 -1 setlinewidth
 107.286 -0.000 0.000 0.000 edgecolor
 107.287 -newpath 135 238 moveto
 107.288 -145 234 lineto
 107.289 -135 231 lineto
 107.290 -closepath
 107.291 -fill
 107.292 -0.000 0.000 0.000 edgecolor
 107.293 -newpath 135 238 moveto
 107.294 -145 234 lineto
 107.295 -135 231 lineto
 107.296 -closepath
 107.297 -stroke
 107.298 -end grestore
 107.299 -
 107.300 -%	sml
 107.301 -gsave 10 dict begin
 107.302 -newpath 74 144 moveto
 107.303 -20 144 lineto
 107.304 -20 108 lineto
 107.305 -74 108 lineto
 107.306 -closepath
 107.307 -stroke
 107.308 -gsave 10 dict begin
 107.309 -32 121 moveto
 107.310 -(SML)
 107.311 -[7.68 12.48 8.64]
 107.312 -xshow
 107.313 -end grestore
 107.314 -end grestore
 107.315 -
 107.316 -%	other
 107.317 -gsave 10 dict begin
 107.318 -gsave 10 dict begin
 107.319 -41 67 moveto
 107.320 -(...)
 107.321 -[3.6 3.6 3.6]
 107.322 -xshow
 107.323 -end grestore
 107.324 -end grestore
 107.325 -
 107.326 -%	haskell
 107.327 -gsave 10 dict begin
 107.328 -newpath 77 36 moveto
 107.329 -17 36 lineto
 107.330 -17 0 lineto
 107.331 -77 0 lineto
 107.332 -closepath
 107.333 -stroke
 107.334 -gsave 10 dict begin
 107.335 -25 13 moveto
 107.336 -(Haskell)
 107.337 -[10.08 6.24 5.52 6.72 6.24 3.84 3.84]
 107.338 -xshow
 107.339 -end grestore
 107.340 -end grestore
 107.341 -
 107.342 -%	preprocessing
 107.343 -gsave 10 dict begin
 107.344 -183 180 52 18 ellipse_path
 107.345 -stroke
 107.346 -gsave 10 dict begin
 107.347 -143 175 moveto
 107.348 -(preprocessing)
 107.349 -[6.96 4.56 6.24 6.96 4.56 6.96 6.24 6.24 5.52 5.52 3.84 6.96 6.96]
 107.350 -xshow
 107.351 -end grestore
 107.352 -end grestore
 107.353 -
 107.354 -%	selection -> preprocessing
 107.355 -newpath 183 216 moveto
 107.356 -183 213 183 211 183 208 curveto
 107.357 -stroke
 107.358 -gsave 10 dict begin
 107.359 -solid
 107.360 -1 setlinewidth
 107.361 -0.000 0.000 0.000 edgecolor
 107.362 -newpath 187 208 moveto
 107.363 -183 198 lineto
 107.364 -180 208 lineto
 107.365 -closepath
 107.366 -fill
 107.367 -0.000 0.000 0.000 edgecolor
 107.368 -newpath 187 208 moveto
 107.369 -183 198 lineto
 107.370 -180 208 lineto
 107.371 -closepath
 107.372 -stroke
 107.373 -end grestore
 107.374 -
 107.375 -%	def_eqn
 107.376 -gsave 10 dict begin
 107.377 -newpath 403 198 moveto
 107.378 -283 198 lineto
 107.379 -283 162 lineto
 107.380 -403 162 lineto
 107.381 -closepath
 107.382 -stroke
 107.383 -gsave 10 dict begin
 107.384 -291 175 moveto
 107.385 -(defining equations)
 107.386 -[6.96 6.24 4.8 3.84 6.96 3.84 6.96 6.96 3.6 6.24 6.72 6.96 6.24 3.84 3.84 6.96 6.96 5.52]
 107.387 -xshow
 107.388 -end grestore
 107.389 -end grestore
 107.390 -
 107.391 -%	preprocessing -> def_eqn
 107.392 -newpath 236 180 moveto
 107.393 -248 180 260 180 273 180 curveto
 107.394 -stroke
 107.395 -gsave 10 dict begin
 107.396 -solid
 107.397 -1 setlinewidth
 107.398 -0.000 0.000 0.000 edgecolor
 107.399 -newpath 273 184 moveto
 107.400 -283 180 lineto
 107.401 -273 177 lineto
 107.402 -closepath
 107.403 -fill
 107.404 -0.000 0.000 0.000 edgecolor
 107.405 -newpath 273 184 moveto
 107.406 -283 180 lineto
 107.407 -273 177 lineto
 107.408 -closepath
 107.409 -stroke
 107.410 -end grestore
 107.411 -
 107.412 -%	serialization
 107.413 -gsave 10 dict begin
 107.414 -183 72 47 18 ellipse_path
 107.415 -stroke
 107.416 -gsave 10 dict begin
 107.417 -148 67 moveto
 107.418 -(serialization)
 107.419 -[5.52 6.24 4.8 3.84 6.24 3.84 3.84 6.24 6.24 3.84 3.84 6.96 6.96]
 107.420 -xshow
 107.421 -end grestore
 107.422 -end grestore
 107.423 -
 107.424 -%	serialization -> sml
 107.425 -newpath 150 85 moveto
 107.426 -129 93 104 103 83 111 curveto
 107.427 -stroke
 107.428 -gsave 10 dict begin
 107.429 -solid
 107.430 -1 setlinewidth
 107.431 -0.000 0.000 0.000 edgecolor
 107.432 -newpath 82 108 moveto
 107.433 -74 115 lineto
 107.434 -85 114 lineto
 107.435 -closepath
 107.436 -fill
 107.437 -0.000 0.000 0.000 edgecolor
 107.438 -newpath 82 108 moveto
 107.439 -74 115 lineto
 107.440 -85 114 lineto
 107.441 -closepath
 107.442 -stroke
 107.443 -end grestore
 107.444 -
 107.445 -%	serialization -> other
 107.446 -gsave 10 dict begin
 107.447 -dotted
 107.448 -newpath 135 72 moveto
 107.449 -119 72 100 72 84 72 curveto
 107.450 -stroke
 107.451 -gsave 10 dict begin
 107.452 -solid
 107.453 -1 setlinewidth
 107.454 -0.000 0.000 0.000 edgecolor
 107.455 -newpath 84 69 moveto
 107.456 -74 72 lineto
 107.457 -84 76 lineto
 107.458 -closepath
 107.459 -fill
 107.460 -0.000 0.000 0.000 edgecolor
 107.461 -newpath 84 69 moveto
 107.462 -74 72 lineto
 107.463 -84 76 lineto
 107.464 -closepath
 107.465 -stroke
 107.466 -end grestore
 107.467 -end grestore
 107.468 -
 107.469 -%	serialization -> haskell
 107.470 -newpath 150 59 moveto
 107.471 -131 51 107 42 86 34 curveto
 107.472 -stroke
 107.473 -gsave 10 dict begin
 107.474 -solid
 107.475 -1 setlinewidth
 107.476 -0.000 0.000 0.000 edgecolor
 107.477 -newpath 88 31 moveto
 107.478 -77 30 lineto
 107.479 -85 37 lineto
 107.480 -closepath
 107.481 -fill
 107.482 -0.000 0.000 0.000 edgecolor
 107.483 -newpath 88 31 moveto
 107.484 -77 30 lineto
 107.485 -85 37 lineto
 107.486 -closepath
 107.487 -stroke
 107.488 -end grestore
 107.489 -
 107.490 -%	translation
 107.491 -gsave 10 dict begin
 107.492 -343 126 43 18 ellipse_path
 107.493 -stroke
 107.494 -gsave 10 dict begin
 107.495 -313 121 moveto
 107.496 -(translation)
 107.497 -[3.84 4.56 6.24 6.96 5.52 3.84 6.24 3.84 3.84 6.96 6.96]
 107.498 -xshow
 107.499 -end grestore
 107.500 -end grestore
 107.501 -
 107.502 -%	def_eqn -> translation
 107.503 -newpath 343 162 moveto
 107.504 -343 159 343 157 343 154 curveto
 107.505 -stroke
 107.506 -gsave 10 dict begin
 107.507 -solid
 107.508 -1 setlinewidth
 107.509 -0.000 0.000 0.000 edgecolor
 107.510 -newpath 347 154 moveto
 107.511 -343 144 lineto
 107.512 -340 154 lineto
 107.513 -closepath
 107.514 -fill
 107.515 -0.000 0.000 0.000 edgecolor
 107.516 -newpath 347 154 moveto
 107.517 -343 144 lineto
 107.518 -340 154 lineto
 107.519 -closepath
 107.520 -stroke
 107.521 -end grestore
 107.522 -
 107.523 -%	iml
 107.524 -gsave 10 dict begin
 107.525 -newpath 413 90 moveto
 107.526 -273 90 lineto
 107.527 -273 54 lineto
 107.528 -413 54 lineto
 107.529 -closepath
 107.530 -stroke
 107.531 -gsave 10 dict begin
 107.532 -280 67 moveto
 107.533 -(intermediate language)
 107.534 -[3.84 6.96 3.84 6.24 4.8 10.8 6.24 6.96 3.84 6.24 3.84 6.24 3.6 3.84 6.24 6.96 6.96 6.96 6.24 6.72 6.24]
 107.535 -xshow
 107.536 -end grestore
 107.537 -end grestore
 107.538 -
 107.539 -%	translation -> iml
 107.540 -newpath 343 108 moveto
 107.541 -343 105 343 103 343 100 curveto
 107.542 -stroke
 107.543 -gsave 10 dict begin
 107.544 -solid
 107.545 -1 setlinewidth
 107.546 -0.000 0.000 0.000 edgecolor
 107.547 -newpath 347 100 moveto
 107.548 -343 90 lineto
 107.549 -340 100 lineto
 107.550 -closepath
 107.551 -fill
 107.552 -0.000 0.000 0.000 edgecolor
 107.553 -newpath 347 100 moveto
 107.554 -343 90 lineto
 107.555 -340 100 lineto
 107.556 -closepath
 107.557 -stroke
 107.558 -end grestore
 107.559 -
 107.560 -%	iml -> serialization
 107.561 -newpath 272 72 moveto
 107.562 -262 72 251 72 241 72 curveto
 107.563 -stroke
 107.564 -gsave 10 dict begin
 107.565 -solid
 107.566 -1 setlinewidth
 107.567 -0.000 0.000 0.000 edgecolor
 107.568 -newpath 241 69 moveto
 107.569 -231 72 lineto
 107.570 -241 76 lineto
 107.571 -closepath
 107.572 -fill
 107.573 -0.000 0.000 0.000 edgecolor
 107.574 -newpath 241 69 moveto
 107.575 -231 72 lineto
 107.576 -241 76 lineto
 107.577 -closepath
 107.578 -stroke
 107.579 -end grestore
 107.580 -endpage
 107.581 -showpage
 107.582 -grestore
 107.583 -%%PageTrailer
 107.584 -%%EndPage: 1
 107.585 -%%Trailer
 107.586 -%%Pages: 1
 107.587 -end
 107.588 -restore
 107.589 -%%EOF
   108.1 --- a/doc-src/IsarAdvanced/Codegen/style.sty	Mon Mar 02 16:58:39 2009 +0100
   108.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   108.3 @@ -1,56 +0,0 @@
   108.4 -
   108.5 -%% toc
   108.6 -\newcommand{\tocentry}[1]{\cleardoublepage\phantomsection\addcontentsline{toc}{chapter}{#1}
   108.7 -\@mkboth{\MakeUppercase{#1}}{\MakeUppercase{#1}}}
   108.8 -
   108.9 -%% references
  108.10 -\newcommand{\secref}[1]{\S\ref{#1}}
  108.11 -
  108.12 -%% logical markup
  108.13 -\newcommand{\strong}[1]{{\bfseries {#1}}}
  108.14 -\newcommand{\qn}[1]{\emph{#1}}
  108.15 -
  108.16 -%% typographic conventions
  108.17 -\newcommand{\qt}[1]{``{#1}''}
  108.18 -
  108.19 -%% verbatim text
  108.20 -\newcommand{\isatypewriter}{\fontsize{9pt}{0pt}\tt\renewcommand{\baselinestretch}{1}\setlength{\baselineskip}{9pt}}
  108.21 -
  108.22 -%% quoted segments
  108.23 -\makeatletter
  108.24 -\isakeeptag{quote}
  108.25 -\newenvironment{quotesegment}{\begin{quote}\isa@parindent\parindent\parindent0pt\isa@parskip\parskip\parskip0pt}{\end{quote}}
  108.26 -\renewcommand{\isatagquote}{\begin{quotesegment}}
  108.27 -\renewcommand{\endisatagquote}{\end{quotesegment}}
  108.28 -\makeatother
  108.29 -
  108.30 -\isakeeptag{quotett}
  108.31 -\renewcommand{\isatagquotett}{\begin{quotesegment}\isabellestyle{tt}\isastyle}
  108.32 -\renewcommand{\endisatagquotett}{\end{quotesegment}\isabellestyle{it}\isastyle}
  108.33 -
  108.34 -%% a trick
  108.35 -\newcommand{\isasymSML}{SML}
  108.36 -
  108.37 -%% presentation
  108.38 -\setcounter{secnumdepth}{2} \setcounter{tocdepth}{2}
  108.39 -
  108.40 -\pagestyle{headings}
  108.41 -\binperiod
  108.42 -\underscoreoff
  108.43 -
  108.44 -\renewcommand{\isadigit}[1]{\isamath{#1}}
  108.45 -
  108.46 -%% ml reference
  108.47 -\newenvironment{mldecls}{\par\noindent\begingroup\footnotesize\def\isanewline{\\}\begin{tabular}{l}}{\end{tabular}\smallskip\endgroup}
  108.48 -
  108.49 -\isakeeptag{mlref}
  108.50 -\renewcommand{\isatagmlref}{\subsection*{\makebox[0pt][r]{\fbox{\ML}~~}Reference}\begingroup\def\isastyletext{\rm}\small}
  108.51 -\renewcommand{\endisatagmlref}{\endgroup}
  108.52 -
  108.53 -\isabellestyle{it}
  108.54 -
  108.55 -
  108.56 -%%% Local Variables: 
  108.57 -%%% mode: latex
  108.58 -%%% TeX-master: "implementation"
  108.59 -%%% End: 
   109.1 --- a/doc-src/IsarAdvanced/Functions/IsaMakefile	Mon Mar 02 16:58:39 2009 +0100
   109.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   109.3 @@ -1,33 +0,0 @@
   109.4 -
   109.5 -## targets
   109.6 -
   109.7 -default: Thy
   109.8 -images: 
   109.9 -test: Thy
  109.10 -
  109.11 -all: images test
  109.12 -
  109.13 -
  109.14 -## global settings
  109.15 -
  109.16 -SRC = $(ISABELLE_HOME)/src
  109.17 -OUT = $(ISABELLE_OUTPUT)
  109.18 -LOG = $(OUT)/log
  109.19 -
  109.20 -USEDIR = $(ISABELLE_TOOL) usedir -v true -i false -d false -C false -D document
  109.21 -
  109.22 -
  109.23 -## Thy
  109.24 -
  109.25 -THY = $(LOG)/HOL-Thy.gz
  109.26 -
  109.27 -Thy: $(THY)
  109.28 -
  109.29 -$(THY): Thy/ROOT.ML Thy/Functions.thy
  109.30 -	@$(USEDIR) HOL Thy
  109.31 -
  109.32 -
  109.33 -## clean
  109.34 -
  109.35 -clean:
  109.36 -	@rm -f $(THY)
   110.1 --- a/doc-src/IsarAdvanced/Functions/Makefile	Mon Mar 02 16:58:39 2009 +0100
   110.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   110.3 @@ -1,38 +0,0 @@
   110.4 -#
   110.5 -# $Id$
   110.6 -#
   110.7 -
   110.8 -## targets
   110.9 -
  110.10 -default: dvi
  110.11 -
  110.12 -
  110.13 -## dependencies
  110.14 -
  110.15 -include ../Makefile.in
  110.16 -
  110.17 -NAME = functions
  110.18 -
  110.19 -FILES = $(NAME).tex Thy/document/Functions.tex intro.tex conclusion.tex \
  110.20 -  style.sty ../../iman.sty ../../extra.sty ../../isar.sty \
  110.21 -  ../../isabelle.sty ../../isabellesym.sty ../../pdfsetup.sty \
  110.22 -  ../../manual.bib ../../proof.sty
  110.23 -
  110.24 -dvi: $(NAME).dvi
  110.25 -
  110.26 -$(NAME).dvi: $(FILES) isabelle_isar.eps
  110.27 -	$(LATEX) $(NAME)
  110.28 -	$(BIBTEX) $(NAME)
  110.29 -	$(LATEX) $(NAME)
  110.30 -	$(LATEX) $(NAME)
  110.31 -
  110.32 -pdf: $(NAME).pdf
  110.33 -
  110.34 -$(NAME).pdf: $(FILES) isabelle_isar.pdf
  110.35 -	$(PDFLATEX) $(NAME)
  110.36 -	$(BIBTEX) $(NAME)
  110.37 -	$(PDFLATEX) $(NAME)
  110.38 -	$(PDFLATEX) $(NAME)
  110.39 -	$(FIXBOOKMARKS) $(NAME).out
  110.40 -	$(PDFLATEX) $(NAME)
  110.41 -	$(PDFLATEX) $(NAME)
   111.1 --- a/doc-src/IsarAdvanced/Functions/Thy/Functions.thy	Mon Mar 02 16:58:39 2009 +0100
   111.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   111.3 @@ -1,1264 +0,0 @@
   111.4 -(*  Title:      doc-src/IsarAdvanced/Functions/Thy/Fundefs.thy
   111.5 -    Author:     Alexander Krauss, TU Muenchen
   111.6 -
   111.7 -Tutorial for function definitions with the new "function" package.
   111.8 -*)
   111.9 -
  111.10 -theory Functions
  111.11 -imports Main
  111.12 -begin
  111.13 -
  111.14 -section {* Function Definitions for Dummies *}
  111.15 -
  111.16 -text {*
  111.17 -  In most cases, defining a recursive function is just as simple as other definitions:
  111.18 -*}
  111.19 -
  111.20 -fun fib :: "nat \<Rightarrow> nat"
  111.21 -where
  111.22 -  "fib 0 = 1"
  111.23 -| "fib (Suc 0) = 1"
  111.24 -| "fib (Suc (Suc n)) = fib n + fib (Suc n)"
  111.25 -
  111.26 -text {*
  111.27 -  The syntax is rather self-explanatory: We introduce a function by
  111.28 -  giving its name, its type, 
  111.29 -  and a set of defining recursive equations.
  111.30 -  If we leave out the type, the most general type will be
  111.31 -  inferred, which can sometimes lead to surprises: Since both @{term
  111.32 -  "1::nat"} and @{text "+"} are overloaded, we would end up
  111.33 -  with @{text "fib :: nat \<Rightarrow> 'a::{one,plus}"}.
  111.34 -*}
  111.35 -
  111.36 -text {*
  111.37 -  The function always terminates, since its argument gets smaller in
  111.38 -  every recursive call. 
  111.39 -  Since HOL is a logic of total functions, termination is a
  111.40 -  fundamental requirement to prevent inconsistencies\footnote{From the
  111.41 -  \qt{definition} @{text "f(n) = f(n) + 1"} we could prove 
  111.42 -  @{text "0 = 1"} by subtracting @{text "f(n)"} on both sides.}.
  111.43 -  Isabelle tries to prove termination automatically when a definition
  111.44 -  is made. In \S\ref{termination}, we will look at cases where this
  111.45 -  fails and see what to do then.
  111.46 -*}
  111.47 -
  111.48 -subsection {* Pattern matching *}
  111.49 -
  111.50 -text {* \label{patmatch}
  111.51 -  Like in functional programming, we can use pattern matching to
  111.52 -  define functions. At the moment we will only consider \emph{constructor
  111.53 -  patterns}, which only consist of datatype constructors and
  111.54 -  variables. Furthermore, patterns must be linear, i.e.\ all variables
  111.55 -  on the left hand side of an equation must be distinct. In
  111.56 -  \S\ref{genpats} we discuss more general pattern matching.
  111.57 -
  111.58 -  If patterns overlap, the order of the equations is taken into
  111.59 -  account. The following function inserts a fixed element between any
  111.60 -  two elements of a list:
  111.61 -*}
  111.62 -
  111.63 -fun sep :: "'a \<Rightarrow> 'a list \<Rightarrow> 'a list"
  111.64 -where
  111.65 -  "sep a (x#y#xs) = x # a # sep a (y # xs)"
  111.66 -| "sep a xs       = xs"
  111.67 -
  111.68 -text {* 
  111.69 -  Overlapping patterns are interpreted as \qt{increments} to what is
  111.70 -  already there: The second equation is only meant for the cases where
  111.71 -  the first one does not match. Consequently, Isabelle replaces it
  111.72 -  internally by the remaining cases, making the patterns disjoint:
  111.73 -*}
  111.74 -
  111.75 -thm sep.simps
  111.76 -
  111.77 -text {* @{thm [display] sep.simps[no_vars]} *}
  111.78 -
  111.79 -text {* 
  111.80 -  \noindent The equations from function definitions are automatically used in
  111.81 -  simplification:
  111.82 -*}
  111.83 -
  111.84 -lemma "sep 0 [1, 2, 3] = [1, 0, 2, 0, 3]"
  111.85 -by simp
  111.86 -
  111.87 -subsection {* Induction *}
  111.88 -
  111.89 -text {*
  111.90 -
  111.91 -  Isabelle provides customized induction rules for recursive
  111.92 -  functions. These rules follow the recursive structure of the
  111.93 -  definition. Here is the rule @{text sep.induct} arising from the
  111.94 -  above definition of @{const sep}:
  111.95 -
  111.96 -  @{thm [display] sep.induct}
  111.97 -  
  111.98 -  We have a step case for list with at least two elements, and two
  111.99 -  base cases for the zero- and the one-element list. Here is a simple
 111.100 -  proof about @{const sep} and @{const map}
 111.101 -*}
 111.102 -
 111.103 -lemma "map f (sep x ys) = sep (f x) (map f ys)"
 111.104 -apply (induct x ys rule: sep.induct)
 111.105 -
 111.106 -txt {*
 111.107 -  We get three cases, like in the definition.
 111.108 -
 111.109 -  @{subgoals [display]}
 111.110 -*}
 111.111 -
 111.112 -apply auto 
 111.113 -done
 111.114 -text {*
 111.115 -
 111.116 -  With the \cmd{fun} command, you can define about 80\% of the
 111.117 -  functions that occur in practice. The rest of this tutorial explains
 111.118 -  the remaining 20\%.
 111.119 -*}
 111.120 -
 111.121 -
 111.122 -section {* fun vs.\ function *}
 111.123 -
 111.124 -text {* 
 111.125 -  The \cmd{fun} command provides a
 111.126 -  convenient shorthand notation for simple function definitions. In
 111.127 -  this mode, Isabelle tries to solve all the necessary proof obligations
 111.128 -  automatically. If any proof fails, the definition is
 111.129 -  rejected. This can either mean that the definition is indeed faulty,
 111.130 -  or that the default proof procedures are just not smart enough (or
 111.131 -  rather: not designed) to handle the definition.
 111.132 -
 111.133 -  By expanding the abbreviation to the more verbose \cmd{function} command, these proof obligations become visible and can be analyzed or
 111.134 -  solved manually. The expansion from \cmd{fun} to \cmd{function} is as follows:
 111.135 -
 111.136 -\end{isamarkuptext}
 111.137 -
 111.138 -
 111.139 -\[\left[\;\begin{minipage}{0.25\textwidth}\vspace{6pt}
 111.140 -\cmd{fun} @{text "f :: \<tau>"}\\%
 111.141 -\cmd{where}\\%
 111.142 -\hspace*{2ex}{\it equations}\\%
 111.143 -\hspace*{2ex}\vdots\vspace*{6pt}
 111.144 -\end{minipage}\right]
 111.145 -\quad\equiv\quad
 111.146 -\left[\;\begin{minipage}{0.48\textwidth}\vspace{6pt}
 111.147 -\cmd{function} @{text "("}\cmd{sequential}@{text ") f :: \<tau>"}\\%
 111.148 -\cmd{where}\\%
 111.149 -\hspace*{2ex}{\it equations}\\%
 111.150 -\hspace*{2ex}\vdots\\%
 111.151 -\cmd{by} @{text "pat_completeness auto"}\\%
 111.152 -\cmd{termination by} @{text "lexicographic_order"}\vspace{6pt}
 111.153 -\end{minipage}
 111.154 -\right]\]
 111.155 -
 111.156 -\begin{isamarkuptext}
 111.157 -  \vspace*{1em}
 111.158 -  \noindent Some details have now become explicit:
 111.159 -
 111.160 -  \begin{enumerate}
 111.161 -  \item The \cmd{sequential} option enables the preprocessing of
 111.162 -  pattern overlaps which we already saw. Without this option, the equations
 111.163 -  must already be disjoint and complete. The automatic completion only
 111.164 -  works with constructor patterns.
 111.165 -
 111.166 -  \item A function definition produces a proof obligation which
 111.167 -  expresses completeness and compatibility of patterns (we talk about
 111.168 -  this later). The combination of the methods @{text "pat_completeness"} and
 111.169 -  @{text "auto"} is used to solve this proof obligation.
 111.170 -
 111.171 -  \item A termination proof follows the definition, started by the
 111.172 -  \cmd{termination} command. This will be explained in \S\ref{termination}.
 111.173 - \end{enumerate}
 111.174 -  Whenever a \cmd{fun} command fails, it is usually a good idea to
 111.175 -  expand the syntax to the more verbose \cmd{function} form, to see
 111.176 -  what is actually going on.
 111.177 - *}
 111.178 -
 111.179 -
 111.180 -section {* Termination *}
 111.181 -
 111.182 -text {*\label{termination}
 111.183 -  The method @{text "lexicographic_order"} is the default method for
 111.184 -  termination proofs. It can prove termination of a
 111.185 -  certain class of functions by searching for a suitable lexicographic
 111.186 -  combination of size measures. Of course, not all functions have such
 111.187 -  a simple termination argument. For them, we can specify the termination
 111.188 -  relation manually.
 111.189 -*}
 111.190 -
 111.191 -subsection {* The {\tt relation} method *}
 111.192 -text{*
 111.193 -  Consider the following function, which sums up natural numbers up to
 111.194 -  @{text "N"}, using a counter @{text "i"}:
 111.195 -*}
 111.196 -
 111.197 -function sum :: "nat \<Rightarrow> nat \<Rightarrow> nat"
 111.198 -where
 111.199 -  "sum i N = (if i > N then 0 else i + sum (Suc i) N)"
 111.200 -by pat_completeness auto
 111.201 -
 111.202 -text {*
 111.203 -  \noindent The @{text "lexicographic_order"} method fails on this example, because none of the
 111.204 -  arguments decreases in the recursive call, with respect to the standard size ordering.
 111.205 -  To prove termination manually, we must provide a custom wellfounded relation.
 111.206 -
 111.207 -  The termination argument for @{text "sum"} is based on the fact that
 111.208 -  the \emph{difference} between @{text "i"} and @{text "N"} gets
 111.209 -  smaller in every step, and that the recursion stops when @{text "i"}
 111.210 -  is greater than @{text "N"}. Phrased differently, the expression 
 111.211 -  @{text "N + 1 - i"} always decreases.
 111.212 -
 111.213 -  We can use this expression as a measure function suitable to prove termination.
 111.214 -*}
 111.215 -
 111.216 -termination sum
 111.217 -apply (relation "measure (\<lambda>(i,N). N + 1 - i)")
 111.218 -
 111.219 -txt {*
 111.220 -  The \cmd{termination} command sets up the termination goal for the
 111.221 -  specified function @{text "sum"}. If the function name is omitted, it
 111.222 -  implicitly refers to the last function definition.
 111.223 -
 111.224 -  The @{text relation} method takes a relation of
 111.225 -  type @{typ "('a \<times> 'a) set"}, where @{typ "'a"} is the argument type of
 111.226 -  the function. If the function has multiple curried arguments, then
 111.227 -  these are packed together into a tuple, as it happened in the above
 111.228 -  example.
 111.229 -
 111.230 -  The predefined function @{term[source] "measure :: ('a \<Rightarrow> nat) \<Rightarrow> ('a \<times> 'a) set"} constructs a
 111.231 -  wellfounded relation from a mapping into the natural numbers (a
 111.232 -  \emph{measure function}). 
 111.233 -
 111.234 -  After the invocation of @{text "relation"}, we must prove that (a)
 111.235 -  the relation we supplied is wellfounded, and (b) that the arguments
 111.236 -  of recursive calls indeed decrease with respect to the
 111.237 -  relation:
 111.238 -
 111.239 -  @{subgoals[display,indent=0]}
 111.240 -
 111.241 -  These goals are all solved by @{text "auto"}:
 111.242 -*}
 111.243 -
 111.244 -apply auto
 111.245 -done
 111.246 -
 111.247 -text {*
 111.248 -  Let us complicate the function a little, by adding some more
 111.249 -  recursive calls: 
 111.250 -*}
 111.251 -
 111.252 -function foo :: "nat \<Rightarrow> nat \<Rightarrow> nat"
 111.253 -where
 111.254 -  "foo i N = (if i > N 
 111.255 -              then (if N = 0 then 0 else foo 0 (N - 1))
 111.256 -              else i + foo (Suc i) N)"
 111.257 -by pat_completeness auto
 111.258 -
 111.259 -text {*
 111.260 -  When @{text "i"} has reached @{text "N"}, it starts at zero again
 111.261 -  and @{text "N"} is decremented.
 111.262 -  This corresponds to a nested
 111.263 -  loop where one index counts up and the other down. Termination can
 111.264 -  be proved using a lexicographic combination of two measures, namely
 111.265 -  the value of @{text "N"} and the above difference. The @{const
 111.266 -  "measures"} combinator generalizes @{text "measure"} by taking a
 111.267 -  list of measure functions.  
 111.268 -*}
 111.269 -
 111.270 -termination 
 111.271 -by (relation "measures [\<lambda>(i, N). N, \<lambda>(i,N). N + 1 - i]") auto
 111.272 -
 111.273 -subsection {* How @{text "lexicographic_order"} works *}
 111.274 -
 111.275 -(*fun fails :: "nat \<Rightarrow> nat list \<Rightarrow> nat"
 111.276 -where
 111.277 -  "fails a [] = a"
 111.278 -| "fails a (x#xs) = fails (x + a) (x # xs)"
 111.279 -*)
 111.280 -
 111.281 -text {*
 111.282 -  To see how the automatic termination proofs work, let's look at an
 111.283 -  example where it fails\footnote{For a detailed discussion of the
 111.284 -  termination prover, see \cite{bulwahnKN07}}:
 111.285 -
 111.286 -\end{isamarkuptext}  
 111.287 -\cmd{fun} @{text "fails :: \"nat \<Rightarrow> nat list \<Rightarrow> nat\""}\\%
 111.288 -\cmd{where}\\%
 111.289 -\hspace*{2ex}@{text "\"fails a [] = a\""}\\%
 111.290 -|\hspace*{1.5ex}@{text "\"fails a (x#xs) = fails (x + a) (x#xs)\""}\\
 111.291 -\begin{isamarkuptext}
 111.292 -
 111.293 -\noindent Isabelle responds with the following error:
 111.294 -
 111.295 -\begin{isabelle}
 111.296 -*** Unfinished subgoals:\newline
 111.297 -*** (a, 1, <):\newline
 111.298 -*** \ 1.~@{text "\<And>x. x = 0"}\newline
 111.299 -*** (a, 1, <=):\newline
 111.300 -*** \ 1.~False\newline
 111.301 -*** (a, 2, <):\newline
 111.302 -*** \ 1.~False\newline
 111.303 -*** Calls:\newline
 111.304 -*** a) @{text "(a, x # xs) -->> (x + a, x # xs)"}\newline
 111.305 -*** Measures:\newline
 111.306 -*** 1) @{text "\<lambda>x. size (fst x)"}\newline
 111.307 -*** 2) @{text "\<lambda>x. size (snd x)"}\newline
 111.308 -*** Result matrix:\newline
 111.309 -*** \ \ \ \ 1\ \ 2  \newline
 111.310 -*** a:  ?   <= \newline
 111.311 -*** Could not find lexicographic termination order.\newline
 111.312 -*** At command "fun".\newline
 111.313 -\end{isabelle}
 111.314 -*}
 111.315 -
 111.316 -
 111.317 -text {*
 111.318 -  The key to this error message is the matrix at the bottom. The rows
 111.319 -  of that matrix correspond to the different recursive calls (In our
 111.320 -  case, there is just one). The columns are the function's arguments 
 111.321 -  (expressed through different measure functions, which map the
 111.322 -  argument tuple to a natural number). 
 111.323 -
 111.324 -  The contents of the matrix summarize what is known about argument
 111.325 -  descents: The second argument has a weak descent (@{text "<="}) at the
 111.326 -  recursive call, and for the first argument nothing could be proved,
 111.327 -  which is expressed by @{text "?"}. In general, there are the values
 111.328 -  @{text "<"}, @{text "<="} and @{text "?"}.
 111.329 -
 111.330 -  For the failed proof attempts, the unfinished subgoals are also
 111.331 -  printed. Looking at these will often point to a missing lemma.
 111.332 -
 111.333 -%  As a more real example, here is quicksort:
 111.334 -*}
 111.335 -(*
 111.336 -function qs :: "nat list \<Rightarrow> nat list"
 111.337 -where
 111.338 -  "qs [] = []"
 111.339 -| "qs (x#xs) = qs [y\<in>xs. y < x] @ x # qs [y\<in>xs. y \<ge> x]"
 111.340 -by pat_completeness auto
 111.341 -
 111.342 -termination apply lexicographic_order
 111.343 -
 111.344 -text {* If we try @{text "lexicographic_order"} method, we get the
 111.345 -  following error *}
 111.346 -termination by (lexicographic_order simp:l2)
 111.347 -
 111.348 -lemma l: "x \<le> y \<Longrightarrow> x < Suc y" by arith
 111.349 -
 111.350 -function 
 111.351 -
 111.352 -*)
 111.353 -
 111.354 -section {* Mutual Recursion *}
 111.355 -
 111.356 -text {*
 111.357 -  If two or more functions call one another mutually, they have to be defined
 111.358 -  in one step. Here are @{text "even"} and @{text "odd"}:
 111.359 -*}
 111.360 -
 111.361 -function even :: "nat \<Rightarrow> bool"
 111.362 -    and odd  :: "nat \<Rightarrow> bool"
 111.363 -where
 111.364 -  "even 0 = True"
 111.365 -| "odd 0 = False"
 111.366 -| "even (Suc n) = odd n"
 111.367 -| "odd (Suc n) = even n"
 111.368 -by pat_completeness auto
 111.369 -
 111.370 -text {*
 111.371 -  To eliminate the mutual dependencies, Isabelle internally
 111.372 -  creates a single function operating on the sum
 111.373 -  type @{typ "nat + nat"}. Then, @{const even} and @{const odd} are
 111.374 -  defined as projections. Consequently, termination has to be proved
 111.375 -  simultaneously for both functions, by specifying a measure on the
 111.376 -  sum type: 
 111.377 -*}
 111.378 -
 111.379 -termination 
 111.380 -by (relation "measure (\<lambda>x. case x of Inl n \<Rightarrow> n | Inr n \<Rightarrow> n)") auto
 111.381 -
 111.382 -text {* 
 111.383 -  We could also have used @{text lexicographic_order}, which
 111.384 -  supports mutual recursive termination proofs to a certain extent.
 111.385 -*}
 111.386 -
 111.387 -subsection {* Induction for mutual recursion *}
 111.388 -
 111.389 -text {*
 111.390 -
 111.391 -  When functions are mutually recursive, proving properties about them
 111.392 -  generally requires simultaneous induction. The induction rule @{text "even_odd.induct"}
 111.393 -  generated from the above definition reflects this.
 111.394 -
 111.395 -  Let us prove something about @{const even} and @{const odd}:
 111.396 -*}
 111.397 -
 111.398 -lemma even_odd_mod2:
 111.399 -  "even n = (n mod 2 = 0)"
 111.400 -  "odd n = (n mod 2 = 1)"
 111.401 -
 111.402 -txt {* 
 111.403 -  We apply simultaneous induction, specifying the induction variable
 111.404 -  for both goals, separated by \cmd{and}:  *}
 111.405 -
 111.406 -apply (induct n and n rule: even_odd.induct)
 111.407 -
 111.408 -txt {* 
 111.409 -  We get four subgoals, which correspond to the clauses in the
 111.410 -  definition of @{const even} and @{const odd}:
 111.411 -  @{subgoals[display,indent=0]}
 111.412 -  Simplification solves the first two goals, leaving us with two
 111.413 -  statements about the @{text "mod"} operation to prove:
 111.414 -*}
 111.415 -
 111.416 -apply simp_all
 111.417 -
 111.418 -txt {* 
 111.419 -  @{subgoals[display,indent=0]} 
 111.420 -
 111.421 -  \noindent These can be handled by Isabelle's arithmetic decision procedures.
 111.422 -  
 111.423 -*}
 111.424 -
 111.425 -apply arith
 111.426 -apply arith
 111.427 -done
 111.428 -
 111.429 -text {*
 111.430 -  In proofs like this, the simultaneous induction is really essential:
 111.431 -  Even if we are just interested in one of the results, the other
 111.432 -  one is necessary to strengthen the induction hypothesis. If we leave
 111.433 -  out the statement about @{const odd} and just write @{term True} instead,
 111.434 -  the same proof fails:
 111.435 -*}
 111.436 -
 111.437 -lemma failed_attempt:
 111.438 -  "even n = (n mod 2 = 0)"
 111.439 -  "True"
 111.440 -apply (induct n rule: even_odd.induct)
 111.441 -
 111.442 -txt {*
 111.443 -  \noindent Now the third subgoal is a dead end, since we have no
 111.444 -  useful induction hypothesis available:
 111.445 -
 111.446 -  @{subgoals[display,indent=0]} 
 111.447 -*}
 111.448 -
 111.449 -oops
 111.450 -
 111.451 -section {* General pattern matching *}
 111.452 -text{*\label{genpats} *}
 111.453 -
 111.454 -subsection {* Avoiding automatic pattern splitting *}
 111.455 -
 111.456 -text {*
 111.457 -
 111.458 -  Up to now, we used pattern matching only on datatypes, and the
 111.459 -  patterns were always disjoint and complete, and if they weren't,
 111.460 -  they were made disjoint automatically like in the definition of
 111.461 -  @{const "sep"} in \S\ref{patmatch}.
 111.462 -
 111.463 -  This automatic splitting can significantly increase the number of
 111.464 -  equations involved, and this is not always desirable. The following
 111.465 -  example shows the problem:
 111.466 -  
 111.467 -  Suppose we are modeling incomplete knowledge about the world by a
 111.468 -  three-valued datatype, which has values @{term "T"}, @{term "F"}
 111.469 -  and @{term "X"} for true, false and uncertain propositions, respectively. 
 111.470 -*}
 111.471 -
 111.472 -datatype P3 = T | F | X
 111.473 -
 111.474 -text {* \noindent Then the conjunction of such values can be defined as follows: *}
 111.475 -
 111.476 -fun And :: "P3 \<Rightarrow> P3 \<Rightarrow> P3"
 111.477 -where
 111.478 -  "And T p = p"
 111.479 -| "And p T = p"
 111.480 -| "And p F = F"
 111.481 -| "And F p = F"
 111.482 -| "And X X = X"
 111.483 -
 111.484 -
 111.485 -text {* 
 111.486 -  This definition is useful, because the equations can directly be used
 111.487 -  as simplification rules. But the patterns overlap: For example,
 111.488 -  the expression @{term "And T T"} is matched by both the first and
 111.489 -  the second equation. By default, Isabelle makes the patterns disjoint by
 111.490 -  splitting them up, producing instances:
 111.491 -*}
 111.492 -
 111.493 -thm And.simps
 111.494 -
 111.495 -text {*
 111.496 -  @{thm[indent=4] And.simps}
 111.497 -  
 111.498 -  \vspace*{1em}
 111.499 -  \noindent There are several problems with this:
 111.500 -
 111.501 -  \begin{enumerate}
 111.502 -  \item If the datatype has many constructors, there can be an
 111.503 -  explosion of equations. For @{const "And"}, we get seven instead of
 111.504 -  five equations, which can be tolerated, but this is just a small
 111.505 -  example.
 111.506 -
 111.507 -  \item Since splitting makes the equations \qt{less general}, they
 111.508 -  do not always match in rewriting. While the term @{term "And x F"}
 111.509 -  can be simplified to @{term "F"} with the original equations, a
 111.510 -  (manual) case split on @{term "x"} is now necessary.
 111.511 -
 111.512 -  \item The splitting also concerns the induction rule @{text
 111.513 -  "And.induct"}. Instead of five premises it now has seven, which
 111.514 -  means that our induction proofs will have more cases.
 111.515 -
 111.516 -  \item In general, it increases clarity if we get the same definition
 111.517 -  back which we put in.
 111.518 -  \end{enumerate}
 111.519 -
 111.520 -  If we do not want the automatic splitting, we can switch it off by
 111.521 -  leaving out the \cmd{sequential} option. However, we will have to
 111.522 -  prove that our pattern matching is consistent\footnote{This prevents
 111.523 -  us from defining something like @{term "f x = True"} and @{term "f x
 111.524 -  = False"} simultaneously.}:
 111.525 -*}
 111.526 -
 111.527 -function And2 :: "P3 \<Rightarrow> P3 \<Rightarrow> P3"
 111.528 -where
 111.529 -  "And2 T p = p"
 111.530 -| "And2 p T = p"
 111.531 -| "And2 p F = F"
 111.532 -| "And2 F p = F"
 111.533 -| "And2 X X = X"
 111.534 -
 111.535 -txt {*
 111.536 -  \noindent Now let's look at the proof obligations generated by a
 111.537 -  function definition. In this case, they are:
 111.538 -
 111.539 -  @{subgoals[display,indent=0]}\vspace{-1.2em}\hspace{3cm}\vdots\vspace{1.2em}
 111.540 -
 111.541 -  The first subgoal expresses the completeness of the patterns. It has
 111.542 -  the form of an elimination rule and states that every @{term x} of
 111.543 -  the function's input type must match at least one of the patterns\footnote{Completeness could
 111.544 -  be equivalently stated as a disjunction of existential statements: 
 111.545 -@{term "(\<exists>p. x = (T, p)) \<or> (\<exists>p. x = (p, T)) \<or> (\<exists>p. x = (p, F)) \<or>
 111.546 -  (\<exists>p. x = (F, p)) \<or> (x = (X, X))"}, and you can use the method @{text atomize_elim} to get that form instead.}. If the patterns just involve
 111.547 -  datatypes, we can solve it with the @{text "pat_completeness"}
 111.548 -  method:
 111.549 -*}
 111.550 -
 111.551 -apply pat_completeness
 111.552 -
 111.553 -txt {*
 111.554 -  The remaining subgoals express \emph{pattern compatibility}. We do
 111.555 -  allow that an input value matches multiple patterns, but in this
 111.556 -  case, the result (i.e.~the right hand sides of the equations) must
 111.557 -  also be equal. For each pair of two patterns, there is one such
 111.558 -  subgoal. Usually this needs injectivity of the constructors, which
 111.559 -  is used automatically by @{text "auto"}.
 111.560 -*}
 111.561 -
 111.562 -by auto
 111.563 -
 111.564 -
 111.565 -subsection {* Non-constructor patterns *}
 111.566 -
 111.567 -text {*
 111.568 -  Most of Isabelle's basic types take the form of inductive datatypes,
 111.569 -  and usually pattern matching works on the constructors of such types. 
 111.570 -  However, this need not be always the case, and the \cmd{function}
 111.571 -  command handles other kind of patterns, too.
 111.572 -
 111.573 -  One well-known instance of non-constructor patterns are
 111.574 -  so-called \emph{$n+k$-patterns}, which are a little controversial in
 111.575 -  the functional programming world. Here is the initial fibonacci
 111.576 -  example with $n+k$-patterns:
 111.577 -*}
 111.578 -
 111.579 -function fib2 :: "nat \<Rightarrow> nat"
 111.580 -where
 111.581 -  "fib2 0 = 1"
 111.582 -| "fib2 1 = 1"
 111.583 -| "fib2 (n + 2) = fib2 n + fib2 (Suc n)"
 111.584 -
 111.585 -(*<*)ML_val "goals_limit := 1"(*>*)
 111.586 -txt {*
 111.587 -  This kind of matching is again justified by the proof of pattern
 111.588 -  completeness and compatibility. 
 111.589 -  The proof obligation for pattern completeness states that every natural number is
 111.590 -  either @{term "0::nat"}, @{term "1::nat"} or @{term "n +
 111.591 -  (2::nat)"}:
 111.592 -
 111.593 -  @{subgoals[display,indent=0]}
 111.594 -
 111.595 -  This is an arithmetic triviality, but unfortunately the
 111.596 -  @{text arith} method cannot handle this specific form of an
 111.597 -  elimination rule. However, we can use the method @{text
 111.598 -  "atomize_elim"} to do an ad-hoc conversion to a disjunction of
 111.599 -  existentials, which can then be solved by the arithmetic decision procedure.
 111.600 -  Pattern compatibility and termination are automatic as usual.
 111.601 -*}
 111.602 -(*<*)ML_val "goals_limit := 10"(*>*)
 111.603 -apply atomize_elim
 111.604 -apply arith
 111.605 -apply auto
 111.606 -done
 111.607 -termination by lexicographic_order
 111.608 -text {*
 111.609 -  We can stretch the notion of pattern matching even more. The
 111.610 -  following function is not a sensible functional program, but a
 111.611 -  perfectly valid mathematical definition:
 111.612 -*}
 111.613 -
 111.614 -function ev :: "nat \<Rightarrow> bool"
 111.615 -where
 111.616 -  "ev (2 * n) = True"
 111.617 -| "ev (2 * n + 1) = False"
 111.618 -apply atomize_elim
 111.619 -by arith+
 111.620 -termination by (relation "{}") simp
 111.621 -
 111.622 -text {*
 111.623 -  This general notion of pattern matching gives you a certain freedom
 111.624 -  in writing down specifications. However, as always, such freedom should
 111.625 -  be used with care:
 111.626 -
 111.627 -  If we leave the area of constructor
 111.628 -  patterns, we have effectively departed from the world of functional
 111.629 -  programming. This means that it is no longer possible to use the
 111.630 -  code generator, and expect it to generate ML code for our
 111.631 -  definitions. Also, such a specification might not work very well together with
 111.632 -  simplification. Your mileage may vary.
 111.633 -*}
 111.634 -
 111.635 -
 111.636 -subsection {* Conditional equations *}
 111.637 -
 111.638 -text {* 
 111.639 -  The function package also supports conditional equations, which are
 111.640 -  similar to guards in a language like Haskell. Here is Euclid's
 111.641 -  algorithm written with conditional patterns\footnote{Note that the
 111.642 -  patterns are also overlapping in the base case}:
 111.643 -*}
 111.644 -
 111.645 -function gcd :: "nat \<Rightarrow> nat \<Rightarrow> nat"
 111.646 -where
 111.647 -  "gcd x 0 = x"
 111.648 -| "gcd 0 y = y"
 111.649 -| "x < y \<Longrightarrow> gcd (Suc x) (Suc y) = gcd (Suc x) (y - x)"
 111.650 -| "\<not> x < y \<Longrightarrow> gcd (Suc x) (Suc y) = gcd (x - y) (Suc y)"
 111.651 -by (atomize_elim, auto, arith)
 111.652 -termination by lexicographic_order
 111.653 -
 111.654 -text {*
 111.655 -  By now, you can probably guess what the proof obligations for the
 111.656 -  pattern completeness and compatibility look like. 
 111.657 -
 111.658 -  Again, functions with conditional patterns are not supported by the
 111.659 -  code generator.
 111.660 -*}
 111.661 -
 111.662 -
 111.663 -subsection {* Pattern matching on strings *}
 111.664 -
 111.665 -text {*
 111.666 -  As strings (as lists of characters) are normal datatypes, pattern
 111.667 -  matching on them is possible, but somewhat problematic. Consider the
 111.668 -  following definition:
 111.669 -
 111.670 -\end{isamarkuptext}
 111.671 -\noindent\cmd{fun} @{text "check :: \"string \<Rightarrow> bool\""}\\%
 111.672 -\cmd{where}\\%
 111.673 -\hspace*{2ex}@{text "\"check (''good'') = True\""}\\%
 111.674 -@{text "| \"check s = False\""}
 111.675 -\begin{isamarkuptext}
 111.676 -
 111.677 -  \noindent An invocation of the above \cmd{fun} command does not
 111.678 -  terminate. What is the problem? Strings are lists of characters, and
 111.679 -  characters are a datatype with a lot of constructors. Splitting the
 111.680 -  catch-all pattern thus leads to an explosion of cases, which cannot
 111.681 -  be handled by Isabelle.
 111.682 -
 111.683 -  There are two things we can do here. Either we write an explicit
 111.684 -  @{text "if"} on the right hand side, or we can use conditional patterns:
 111.685 -*}
 111.686 -
 111.687 -function check :: "string \<Rightarrow> bool"
 111.688 -where
 111.689 -  "check (''good'') = True"
 111.690 -| "s \<noteq> ''good'' \<Longrightarrow> check s = False"
 111.691 -by auto
 111.692 -
 111.693 -
 111.694 -section {* Partiality *}
 111.695 -
 111.696 -text {* 
 111.697 -  In HOL, all functions are total. A function @{term "f"} applied to
 111.698 -  @{term "x"} always has the value @{term "f x"}, and there is no notion
 111.699 -  of undefinedness. 
 111.700 -  This is why we have to do termination
 111.701 -  proofs when defining functions: The proof justifies that the
 111.702 -  function can be defined by wellfounded recursion.
 111.703 -
 111.704 -  However, the \cmd{function} package does support partiality to a
 111.705 -  certain extent. Let's look at the following function which looks
 111.706 -  for a zero of a given function f. 
 111.707 -*}
 111.708 -
 111.709 -function (*<*)(domintros, tailrec)(*>*)findzero :: "(nat \<Rightarrow> nat) \<Rightarrow> nat \<Rightarrow> nat"
 111.710 -where
 111.711 -  "findzero f n = (if f n = 0 then n else findzero f (Suc n))"
 111.712 -by pat_completeness auto
 111.713 -(*<*)declare findzero.simps[simp del](*>*)
 111.714 -
 111.715 -text {*
 111.716 -  \noindent Clearly, any attempt of a termination proof must fail. And without
 111.717 -  that, we do not get the usual rules @{text "findzero.simps"} and 
 111.718 -  @{text "findzero.induct"}. So what was the definition good for at all?
 111.719 -*}
 111.720 -
 111.721 -subsection {* Domain predicates *}
 111.722 -
 111.723 -text {*
 111.724 -  The trick is that Isabelle has not only defined the function @{const findzero}, but also
 111.725 -  a predicate @{term "findzero_dom"} that characterizes the values where the function
 111.726 -  terminates: the \emph{domain} of the function. If we treat a
 111.727 -  partial function just as a total function with an additional domain
 111.728 -  predicate, we can derive simplification and
 111.729 -  induction rules as we do for total functions. They are guarded
 111.730 -  by domain conditions and are called @{text psimps} and @{text
 111.731 -  pinduct}: 
 111.732 -*}
 111.733 -
 111.734 -text {*
 111.735 -  \noindent\begin{minipage}{0.79\textwidth}@{thm[display,margin=85] findzero.psimps}\end{minipage}
 111.736 -  \hfill(@{text "findzero.psimps"})
 111.737 -  \vspace{1em}
 111.738 -
 111.739 -  \noindent\begin{minipage}{0.79\textwidth}@{thm[display,margin=85] findzero.pinduct}\end{minipage}
 111.740 -  \hfill(@{text "findzero.pinduct"})
 111.741 -*}
 111.742 -
 111.743 -text {*
 111.744 -  Remember that all we
 111.745 -  are doing here is use some tricks to make a total function appear
 111.746 -  as if it was partial. We can still write the term @{term "findzero
 111.747 -  (\<lambda>x. 1) 0"} and like any other term of type @{typ nat} it is equal
 111.748 -  to some natural number, although we might not be able to find out
 111.749 -  which one. The function is \emph{underdefined}.
 111.750 -
 111.751 -  But it is defined enough to prove something interesting about it. We
 111.752 -  can prove that if @{term "findzero f n"}
 111.753 -  terminates, it indeed returns a zero of @{term f}:
 111.754 -*}
 111.755 -
 111.756 -lemma findzero_zero: "findzero_dom (f, n) \<Longrightarrow> f (findzero f n) = 0"
 111.757 -
 111.758 -txt {* \noindent We apply induction as usual, but using the partial induction
 111.759 -  rule: *}
 111.760 -
 111.761 -apply (induct f n rule: findzero.pinduct)
 111.762 -
 111.763 -txt {* \noindent This gives the following subgoals:
 111.764 -
 111.765 -  @{subgoals[display,indent=0]}
 111.766 -
 111.767 -  \noindent The hypothesis in our lemma was used to satisfy the first premise in
 111.768 -  the induction rule. However, we also get @{term
 111.769 -  "findzero_dom (f, n)"} as a local assumption in the induction step. This
 111.770 -  allows to unfold @{term "findzero f n"} using the @{text psimps}
 111.771 -  rule, and the rest is trivial. Since the @{text psimps} rules carry the
 111.772 -  @{text "[simp]"} attribute by default, we just need a single step:
 111.773 - *}
 111.774 -apply simp
 111.775 -done
 111.776 -
 111.777 -text {*
 111.778 -  Proofs about partial functions are often not harder than for total
 111.779 -  functions. Fig.~\ref{findzero_isar} shows a slightly more
 111.780 -  complicated proof written in Isar. It is verbose enough to show how
 111.781 -  partiality comes into play: From the partial induction, we get an
 111.782 -  additional domain condition hypothesis. Observe how this condition
 111.783 -  is applied when calls to @{term findzero} are unfolded.
 111.784 -*}
 111.785 -
 111.786 -text_raw {*
 111.787 -\begin{figure}
 111.788 -\hrule\vspace{6pt}
 111.789 -\begin{minipage}{0.8\textwidth}
 111.790 -\isabellestyle{it}
 111.791 -\isastyle\isamarkuptrue
 111.792 -*}
 111.793 -lemma "\<lbrakk>findzero_dom (f, n); x \<in> {n ..< findzero f n}\<rbrakk> \<Longrightarrow> f x \<noteq> 0"
 111.794 -proof (induct rule: findzero.pinduct)
 111.795 -  fix f n assume dom: "findzero_dom (f, n)"
 111.796 -               and IH: "\<lbrakk>f n \<noteq> 0; x \<in> {Suc n ..< findzero f (Suc n)}\<rbrakk> \<Longrightarrow> f x \<noteq> 0"
 111.797 -               and x_range: "x \<in> {n ..< findzero f n}"
 111.798 -  have "f n \<noteq> 0"
 111.799 -  proof 
 111.800 -    assume "f n = 0"
 111.801 -    with dom have "findzero f n = n" by simp
 111.802 -    with x_range show False by auto
 111.803 -  qed
 111.804 -  
 111.805 -  from x_range have "x = n \<or> x \<in> {Suc n ..< findzero f n}" by auto
 111.806 -  thus "f x \<noteq> 0"
 111.807 -  proof
 111.808 -    assume "x = n"
 111.809 -    with `f n \<noteq> 0` show ?thesis by simp
 111.810 -  next
 111.811 -    assume "x \<in> {Suc n ..< findzero f n}"
 111.812 -    with dom and `f n \<noteq> 0` have "x \<in> {Suc n ..< findzero f (Suc n)}" by simp
 111.813 -    with IH and `f n \<noteq> 0`
 111.814 -    show ?thesis by simp
 111.815 -  qed
 111.816 -qed
 111.817 -text_raw {*
 111.818 -\isamarkupfalse\isabellestyle{tt}
 111.819 -\end{minipage}\vspace{6pt}\hrule
 111.820 -\caption{A proof about a partial function}\label{findzero_isar}
 111.821 -\end{figure}
 111.822 -*}
 111.823 -
 111.824 -subsection {* Partial termination proofs *}
 111.825 -
 111.826 -text {*
 111.827 -  Now that we have proved some interesting properties about our
 111.828 -  function, we should turn to the domain predicate and see if it is
 111.829 -  actually true for some values. Otherwise we would have just proved
 111.830 -  lemmas with @{term False} as a premise.
 111.831 -
 111.832 -  Essentially, we need some introduction rules for @{text
 111.833 -  findzero_dom}. The function package can prove such domain
 111.834 -  introduction rules automatically. But since they are not used very
 111.835 -  often (they are almost never needed if the function is total), this
 111.836 -  functionality is disabled by default for efficiency reasons. So we have to go
 111.837 -  back and ask for them explicitly by passing the @{text
 111.838 -  "(domintros)"} option to the function package:
 111.839 -
 111.840 -\vspace{1ex}
 111.841 -\noindent\cmd{function} @{text "(domintros) findzero :: \"(nat \<Rightarrow> nat) \<Rightarrow> nat \<Rightarrow> nat\""}\\%
 111.842 -\cmd{where}\isanewline%
 111.843 -\ \ \ldots\\
 111.844 -
 111.845 -  \noindent Now the package has proved an introduction rule for @{text findzero_dom}:
 111.846 -*}
 111.847 -
 111.848 -thm findzero.domintros
 111.849 -
 111.850 -text {*
 111.851 -  @{thm[display] findzero.domintros}
 111.852 -
 111.853 -  Domain introduction rules allow to show that a given value lies in the
 111.854 -  domain of a function, if the arguments of all recursive calls
 111.855 -  are in the domain as well. They allow to do a \qt{single step} in a
 111.856 -  termination proof. Usually, you want to combine them with a suitable
 111.857 -  induction principle.
 111.858 -
 111.859 -  Since our function increases its argument at recursive calls, we
 111.860 -  need an induction principle which works \qt{backwards}. We will use
 111.861 -  @{text inc_induct}, which allows to do induction from a fixed number
 111.862 -  \qt{downwards}:
 111.863 -
 111.864 -  \begin{center}@{thm inc_induct}\hfill(@{text "inc_induct"})\end{center}
 111.865 -
 111.866 -  Figure \ref{findzero_term} gives a detailed Isar proof of the fact
 111.867 -  that @{text findzero} terminates if there is a zero which is greater
 111.868 -  or equal to @{term n}. First we derive two useful rules which will
 111.869 -  solve the base case and the step case of the induction. The
 111.870 -  induction is then straightforward, except for the unusual induction
 111.871 -  principle.
 111.872 -
 111.873 -*}
 111.874 -
 111.875 -text_raw {*
 111.876 -\begin{figure}
 111.877 -\hrule\vspace{6pt}
 111.878 -\begin{minipage}{0.8\textwidth}
 111.879 -\isabellestyle{it}
 111.880 -\isastyle\isamarkuptrue
 111.881 -*}
 111.882 -lemma findzero_termination:
 111.883 -  assumes "x \<ge> n" and "f x = 0"
 111.884 -  shows "findzero_dom (f, n)"
 111.885 -proof - 
 111.886 -  have base: "findzero_dom (f, x)"
 111.887 -    by (rule findzero.domintros) (simp add:`f x = 0`)
 111.888 -
 111.889 -  have step: "\<And>i. findzero_dom (f, Suc i) 
 111.890 -    \<Longrightarrow> findzero_dom (f, i)"
 111.891 -    by (rule findzero.domintros) simp
 111.892 -
 111.893 -  from `x \<ge> n` show ?thesis
 111.894 -  proof (induct rule:inc_induct)
 111.895 -    show "findzero_dom (f, x)" by (rule base)
 111.896 -  next
 111.897 -    fix i assume "findzero_dom (f, Suc i)"
 111.898 -    thus "findzero_dom (f, i)" by (rule step)
 111.899 -  qed
 111.900 -qed      
 111.901 -text_raw {*
 111.902 -\isamarkupfalse\isabellestyle{tt}
 111.903 -\end{minipage}\vspace{6pt}\hrule
 111.904 -\caption{Termination proof for @{text findzero}}\label{findzero_term}
 111.905 -\end{figure}
 111.906 -*}
 111.907 -      
 111.908 -text {*
 111.909 -  Again, the proof given in Fig.~\ref{findzero_term} has a lot of
 111.910 -  detail in order to explain the principles. Using more automation, we
 111.911 -  can also have a short proof:
 111.912 -*}
 111.913 -
 111.914 -lemma findzero_termination_short:
 111.915 -  assumes zero: "x >= n" 
 111.916 -  assumes [simp]: "f x = 0"
 111.917 -  shows "findzero_dom (f, n)"
 111.918 -using zero
 111.919 -by (induct rule:inc_induct) (auto intro: findzero.domintros)
 111.920 -    
 111.921 -text {*
 111.922 -  \noindent It is simple to combine the partial correctness result with the
 111.923 -  termination lemma:
 111.924 -*}
 111.925 -
 111.926 -lemma findzero_total_correctness:
 111.927 -  "f x = 0 \<Longrightarrow> f (findzero f 0) = 0"
 111.928 -by (blast intro: findzero_zero findzero_termination)
 111.929 -
 111.930 -subsection {* Definition of the domain predicate *}
 111.931 -
 111.932 -text {*
 111.933 -  Sometimes it is useful to know what the definition of the domain
 111.934 -  predicate looks like. Actually, @{text findzero_dom} is just an
 111.935 -  abbreviation:
 111.936 -
 111.937 -  @{abbrev[display] findzero_dom}
 111.938 -
 111.939 -  The domain predicate is the \emph{accessible part} of a relation @{const
 111.940 -  findzero_rel}, which was also created internally by the function
 111.941 -  package. @{const findzero_rel} is just a normal
 111.942 -  inductive predicate, so we can inspect its definition by
 111.943 -  looking at the introduction rules @{text findzero_rel.intros}.
 111.944 -  In our case there is just a single rule:
 111.945 -
 111.946 -  @{thm[display] findzero_rel.intros}
 111.947 -
 111.948 -  The predicate @{const findzero_rel}
 111.949 -  describes the \emph{recursion relation} of the function
 111.950 -  definition. The recursion relation is a binary relation on
 111.951 -  the arguments of the function that relates each argument to its
 111.952 -  recursive calls. In general, there is one introduction rule for each
 111.953 -  recursive call.
 111.954 -
 111.955 -  The predicate @{term "accp findzero_rel"} is the accessible part of
 111.956 -  that relation. An argument belongs to the accessible part, if it can
 111.957 -  be reached in a finite number of steps (cf.~its definition in @{text
 111.958 -  "Wellfounded.thy"}).
 111.959 -
 111.960 -  Since the domain predicate is just an abbreviation, you can use
 111.961 -  lemmas for @{const accp} and @{const findzero_rel} directly. Some
 111.962 -  lemmas which are occasionally useful are @{text accpI}, @{text
 111.963 -  accp_downward}, and of course the introduction and elimination rules
 111.964 -  for the recursion relation @{text "findzero.intros"} and @{text "findzero.cases"}.
 111.965 -*}
 111.966 -
 111.967 -(*lemma findzero_nicer_domintros:
 111.968 -  "f x = 0 \<Longrightarrow> findzero_dom (f, x)"
 111.969 -  "findzero_dom (f, Suc x) \<Longrightarrow> findzero_dom (f, x)"
 111.970 -by (rule accpI, erule findzero_rel.cases, auto)+
 111.971 -*)
 111.972 -  
 111.973 -subsection {* A Useful Special Case: Tail recursion *}
 111.974 -
 111.975 -text {*
 111.976 -  The domain predicate is our trick that allows us to model partiality
 111.977 -  in a world of total functions. The downside of this is that we have
 111.978 -  to carry it around all the time. The termination proof above allowed
 111.979 -  us to replace the abstract @{term "findzero_dom (f, n)"} by the more
 111.980 -  concrete @{term "(x \<ge> n \<and> f x = (0::nat))"}, but the condition is still
 111.981 -  there and can only be discharged for special cases.
 111.982 -  In particular, the domain predicate guards the unfolding of our
 111.983 -  function, since it is there as a condition in the @{text psimp}
 111.984 -  rules. 
 111.985 -
 111.986 -  Now there is an important special case: We can actually get rid
 111.987 -  of the condition in the simplification rules, \emph{if the function
 111.988 -  is tail-recursive}. The reason is that for all tail-recursive
 111.989 -  equations there is a total function satisfying them, even if they
 111.990 -  are non-terminating. 
 111.991 -
 111.992 -%  A function is tail recursive, if each call to the function is either
 111.993 -%  equal
 111.994 -%
 111.995 -%  So the outer form of the 
 111.996 -%
 111.997 -%if it can be written in the following
 111.998 -%  form:
 111.999 -%  {term[display] "f x = (if COND x then BASE x else f (LOOP x))"}
111.1000 -
111.1001 -
111.1002 -  The function package internally does the right construction and can
111.1003 -  derive the unconditional simp rules, if we ask it to do so. Luckily,
111.1004 -  our @{const "findzero"} function is tail-recursive, so we can just go
111.1005 -  back and add another option to the \cmd{function} command:
111.1006 -
111.1007 -\vspace{1ex}
111.1008 -\noindent\cmd{function} @{text "(domintros, tailrec) findzero :: \"(nat \<Rightarrow> nat) \<Rightarrow> nat \<Rightarrow> nat\""}\\%
111.1009 -\cmd{where}\isanewline%
111.1010 -\ \ \ldots\\%
111.1011 -
111.1012 -  
111.1013 -  \noindent Now, we actually get unconditional simplification rules, even
111.1014 -  though the function is partial:
111.1015 -*}
111.1016 -
111.1017 -thm findzero.simps
111.1018 -
111.1019 -text {*
111.1020 -  @{thm[display] findzero.simps}
111.1021 -
111.1022 -  \noindent Of course these would make the simplifier loop, so we better remove
111.1023 -  them from the simpset:
111.1024 -*}
111.1025 -
111.1026 -declare findzero.simps[simp del]
111.1027 -
111.1028 -text {* 
111.1029 -  Getting rid of the domain conditions in the simplification rules is
111.1030 -  not only useful because it simplifies proofs. It is also required in
111.1031 -  order to use Isabelle's code generator to generate ML code
111.1032 -  from a function definition.
111.1033 -  Since the code generator only works with equations, it cannot be
111.1034 -  used with @{text "psimp"} rules. Thus, in order to generate code for
111.1035 -  partial functions, they must be defined as a tail recursion.
111.1036 -  Luckily, many functions have a relatively natural tail recursive
111.1037 -  definition.
111.1038 -*}
111.1039 -
111.1040 -section {* Nested recursion *}
111.1041 -
111.1042 -text {*
111.1043 -  Recursive calls which are nested in one another frequently cause
111.1044 -  complications, since their termination proof can depend on a partial
111.1045 -  correctness property of the function itself. 
111.1046 -
111.1047 -  As a small example, we define the \qt{nested zero} function:
111.1048 -*}
111.1049 -
111.1050 -function nz :: "nat \<Rightarrow> nat"
111.1051 -where
111.1052 -  "nz 0 = 0"
111.1053 -| "nz (Suc n) = nz (nz n)"
111.1054 -by pat_completeness auto
111.1055 -
111.1056 -text {*
111.1057 -  If we attempt to prove termination using the identity measure on
111.1058 -  naturals, this fails:
111.1059 -*}
111.1060 -
111.1061 -termination
111.1062 -  apply (relation "measure (\<lambda>n. n)")
111.1063 -  apply auto
111.1064 -
111.1065 -txt {*
111.1066 -  We get stuck with the subgoal
111.1067 -
111.1068 -  @{subgoals[display]}
111.1069 -
111.1070 -  Of course this statement is true, since we know that @{const nz} is
111.1071 -  the zero function. And in fact we have no problem proving this
111.1072 -  property by induction.
111.1073 -*}
111.1074 -(*<*)oops(*>*)
111.1075 -lemma nz_is_zero: "nz_dom n \<Longrightarrow> nz n = 0"
111.1076 -  by (induct rule:nz.pinduct) auto
111.1077 -
111.1078 -text {*
111.1079 -  We formulate this as a partial correctness lemma with the condition
111.1080 -  @{term "nz_dom n"}. This allows us to prove it with the @{text
111.1081 -  pinduct} rule before we have proved termination. With this lemma,
111.1082 -  the termination proof works as expected:
111.1083 -*}
111.1084 -
111.1085 -termination
111.1086 -  by (relation "measure (\<lambda>n. n)") (auto simp: nz_is_zero)
111.1087 -
111.1088 -text {*
111.1089 -  As a general strategy, one should prove the statements needed for
111.1090 -  termination as a partial property first. Then they can be used to do
111.1091 -  the termination proof. This also works for less trivial
111.1092 -  examples. Figure \ref{f91} defines the 91-function, a well-known
111.1093 -  challenge problem due to John McCarthy, and proves its termination.
111.1094 -*}
111.1095 -
111.1096 -text_raw {*
111.1097 -\begin{figure}
111.1098 -\hrule\vspace{6pt}
111.1099 -\begin{minipage}{0.8\textwidth}
111.1100 -\isabellestyle{it}
111.1101 -\isastyle\isamarkuptrue
111.1102 -*}
111.1103 -
111.1104 -function f91 :: "nat \<Rightarrow> nat"
111.1105 -where
111.1106 -  "f91 n = (if 100 < n then n - 10 else f91 (f91 (n + 11)))"
111.1107 -by pat_completeness auto
111.1108 -
111.1109 -lemma f91_estimate: 
111.1110 -  assumes trm: "f91_dom n" 
111.1111 -  shows "n < f91 n + 11"
111.1112 -using trm by induct auto
111.1113 -
111.1114 -termination
111.1115 -proof
111.1116 -  let ?R = "measure (\<lambda>x. 101 - x)"
111.1117 -  show "wf ?R" ..
111.1118 -
111.1119 -  fix n :: nat assume "\<not> 100 < n" -- "Assumptions for both calls"
111.1120 -
111.1121 -  thus "(n + 11, n) \<in> ?R" by simp -- "Inner call"
111.1122 -
111.1123 -  assume inner_trm: "f91_dom (n + 11)" -- "Outer call"
111.1124 -  with f91_estimate have "n + 11 < f91 (n + 11) + 11" .
111.1125 -  with `\<not> 100 < n` show "(f91 (n + 11), n) \<in> ?R" by simp
111.1126 -qed
111.1127 -
111.1128 -text_raw {*
111.1129 -\isamarkupfalse\isabellestyle{tt}
111.1130 -\end{minipage}
111.1131 -\vspace{6pt}\hrule
111.1132 -\caption{McCarthy's 91-function}\label{f91}
111.1133 -\end{figure}
111.1134 -*}
111.1135 -
111.1136 -
111.1137 -section {* Higher-Order Recursion *}
111.1138 -
111.1139 -text {*
111.1140 -  Higher-order recursion occurs when recursive calls
111.1141 -  are passed as arguments to higher-order combinators such as @{const
111.1142 -  map}, @{term filter} etc.
111.1143 -  As an example, imagine a datatype of n-ary trees:
111.1144 -*}
111.1145 -
111.1146 -datatype 'a tree = 
111.1147 -  Leaf 'a 
111.1148 -| Branch "'a tree list"
111.1149 -
111.1150 -
111.1151 -text {* \noindent We can define a function which swaps the left and right subtrees recursively, using the 
111.1152 -  list functions @{const rev} and @{const map}: *}
111.1153 -
111.1154 -fun mirror :: "'a tree \<Rightarrow> 'a tree"
111.1155 -where
111.1156 -  "mirror (Leaf n) = Leaf n"
111.1157 -| "mirror (Branch l) = Branch (rev (map mirror l))"
111.1158 -
111.1159 -text {*
111.1160 -  Although the definition is accepted without problems, let us look at the termination proof:
111.1161 -*}
111.1162 -
111.1163 -termination proof
111.1164 -  txt {*
111.1165 -
111.1166 -  As usual, we have to give a wellfounded relation, such that the
111.1167 -  arguments of the recursive calls get smaller. But what exactly are
111.1168 -  the arguments of the recursive calls when mirror is given as an
111.1169 -  argument to @{const map}? Isabelle gives us the
111.1170 -  subgoals
111.1171 -
111.1172 -  @{subgoals[display,indent=0]} 
111.1173 -
111.1174 -  So the system seems to know that @{const map} only
111.1175 -  applies the recursive call @{term "mirror"} to elements
111.1176 -  of @{term "l"}, which is essential for the termination proof.
111.1177 -
111.1178 -  This knowledge about @{const map} is encoded in so-called congruence rules,
111.1179 -  which are special theorems known to the \cmd{function} command. The
111.1180 -  rule for @{const map} is
111.1181 -
111.1182 -  @{thm[display] map_cong}
111.1183 -
111.1184 -  You can read this in the following way: Two applications of @{const
111.1185 -  map} are equal, if the list arguments are equal and the functions
111.1186 -  coincide on the elements of the list. This means that for the value 
111.1187 -  @{term "map f l"} we only have to know how @{term f} behaves on
111.1188 -  the elements of @{term l}.
111.1189 -
111.1190 -  Usually, one such congruence rule is
111.1191 -  needed for each higher-order construct that is used when defining
111.1192 -  new functions. In fact, even basic functions like @{const
111.1193 -  If} and @{const Let} are handled by this mechanism. The congruence
111.1194 -  rule for @{const If} states that the @{text then} branch is only
111.1195 -  relevant if the condition is true, and the @{text else} branch only if it
111.1196 -  is false:
111.1197 -
111.1198 -  @{thm[display] if_cong}
111.1199 -  
111.1200 -  Congruence rules can be added to the
111.1201 -  function package by giving them the @{term fundef_cong} attribute.
111.1202 -
111.1203 -  The constructs that are predefined in Isabelle, usually
111.1204 -  come with the respective congruence rules.
111.1205 -  But if you define your own higher-order functions, you may have to
111.1206 -  state and prove the required congruence rules yourself, if you want to use your
111.1207 -  functions in recursive definitions. 
111.1208 -*}
111.1209 -(*<*)oops(*>*)
111.1210 -
111.1211 -subsection {* Congruence Rules and Evaluation Order *}
111.1212 -
111.1213 -text {* 
111.1214 -  Higher order logic differs from functional programming languages in
111.1215 -  that it has no built-in notion of evaluation order. A program is
111.1216 -  just a set of equations, and it is not specified how they must be
111.1217 -  evaluated. 
111.1218 -
111.1219 -  However for the purpose of function definition, we must talk about
111.1220 -  evaluation order implicitly, when we reason about termination.
111.1221 -  Congruence rules express that a certain evaluation order is
111.1222 -  consistent with the logical definition. 
111.1223 -
111.1224 -  Consider the following function.
111.1225 -*}
111.1226 -
111.1227 -function f :: "nat \<Rightarrow> bool"
111.1228 -where
111.1229 -  "f n = (n = 0 \<or> f (n - 1))"
111.1230 -(*<*)by pat_completeness auto(*>*)
111.1231 -
111.1232 -text {*
111.1233 -  For this definition, the termination proof fails. The default configuration
111.1234 -  specifies no congruence rule for disjunction. We have to add a
111.1235 -  congruence rule that specifies left-to-right evaluation order:
111.1236 -
111.1237 -  \vspace{1ex}
111.1238 -  \noindent @{thm disj_cong}\hfill(@{text "disj_cong"})
111.1239 -  \vspace{1ex}
111.1240 -
111.1241 -  Now the definition works without problems. Note how the termination
111.1242 -  proof depends on the extra condition that we get from the congruence
111.1243 -  rule.
111.1244 -
111.1245 -  However, as evaluation is not a hard-wired concept, we
111.1246 -  could just turn everything around by declaring a different
111.1247 -  congruence rule. Then we can make the reverse definition:
111.1248 -*}
111.1249 -
111.1250 -lemma disj_cong2[fundef_cong]: 
111.1251 -  "(\<not> Q' \<Longrightarrow> P = P') \<Longrightarrow> (Q = Q') \<Longrightarrow> (P \<or> Q) = (P' \<or> Q')"
111.1252 -  by blast
111.1253 -
111.1254 -fun f' :: "nat \<Rightarrow> bool"
111.1255 -where
111.1256 -  "f' n = (f' (n - 1) \<or> n = 0)"
111.1257 -
111.1258 -text {*
111.1259 -  \noindent These examples show that, in general, there is no \qt{best} set of
111.1260 -  congruence rules.
111.1261 -
111.1262 -  However, such tweaking should rarely be necessary in
111.1263 -  practice, as most of the time, the default set of congruence rules
111.1264 -  works well.
111.1265 -*}
111.1266 -
111.1267 -end
   112.1 --- a/doc-src/IsarAdvanced/Functions/Thy/ROOT.ML	Mon Mar 02 16:58:39 2009 +0100
   112.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   112.3 @@ -1,4 +0,0 @@
   112.4 -
   112.5 -(* $Id$ *)
   112.6 -
   112.7 -use_thy "Functions";
   113.1 --- a/doc-src/IsarAdvanced/Functions/Thy/document/Functions.tex	Mon Mar 02 16:58:39 2009 +0100
   113.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   113.3 @@ -1,1985 +0,0 @@
   113.4 -%
   113.5 -\begin{isabellebody}%
   113.6 -\def\isabellecontext{Functions}%
   113.7 -%
   113.8 -\isadelimtheory
   113.9 -\isanewline
  113.10 -\isanewline
  113.11 -%
  113.12 -\endisadelimtheory
  113.13 -%
  113.14 -\isatagtheory
  113.15 -\isacommand{theory}\isamarkupfalse%
  113.16 -\ Functions\isanewline
  113.17 -\isakeyword{imports}\ Main\isanewline
  113.18 -\isakeyword{begin}%
  113.19 -\endisatagtheory
  113.20 -{\isafoldtheory}%
  113.21 -%
  113.22 -\isadelimtheory
  113.23 -%
  113.24 -\endisadelimtheory
  113.25 -%
  113.26 -\isamarkupsection{Function Definitions for Dummies%
  113.27 -}
  113.28 -\isamarkuptrue%
  113.29 -%
  113.30 -\begin{isamarkuptext}%
  113.31 -In most cases, defining a recursive function is just as simple as other definitions:%
  113.32 -\end{isamarkuptext}%
  113.33 -\isamarkuptrue%
  113.34 -\isacommand{fun}\isamarkupfalse%
  113.35 -\ fib\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ nat{\isachardoublequoteclose}\isanewline
  113.36 -\isakeyword{where}\isanewline
  113.37 -\ \ {\isachardoublequoteopen}fib\ {\isadigit{0}}\ {\isacharequal}\ {\isadigit{1}}{\isachardoublequoteclose}\isanewline
  113.38 -{\isacharbar}\ {\isachardoublequoteopen}fib\ {\isacharparenleft}Suc\ {\isadigit{0}}{\isacharparenright}\ {\isacharequal}\ {\isadigit{1}}{\isachardoublequoteclose}\isanewline
  113.39 -{\isacharbar}\ {\isachardoublequoteopen}fib\ {\isacharparenleft}Suc\ {\isacharparenleft}Suc\ n{\isacharparenright}{\isacharparenright}\ {\isacharequal}\ fib\ n\ {\isacharplus}\ fib\ {\isacharparenleft}Suc\ n{\isacharparenright}{\isachardoublequoteclose}%
  113.40 -\begin{isamarkuptext}%
  113.41 -The syntax is rather self-explanatory: We introduce a function by
  113.42 -  giving its name, its type, 
  113.43 -  and a set of defining recursive equations.
  113.44 -  If we leave out the type, the most general type will be
  113.45 -  inferred, which can sometimes lead to surprises: Since both \isa{{\isadigit{1}}} and \isa{{\isacharplus}} are overloaded, we would end up
  113.46 -  with \isa{fib\ {\isacharcolon}{\isacharcolon}\ nat\ {\isasymRightarrow}\ {\isacharprime}a{\isacharcolon}{\isacharcolon}{\isacharbraceleft}one{\isacharcomma}plus{\isacharbraceright}}.%
  113.47 -\end{isamarkuptext}%
  113.48 -\isamarkuptrue%
  113.49 -%
  113.50 -\begin{isamarkuptext}%
  113.51 -The function always terminates, since its argument gets smaller in
  113.52 -  every recursive call. 
  113.53 -  Since HOL is a logic of total functions, termination is a
  113.54 -  fundamental requirement to prevent inconsistencies\footnote{From the
  113.55 -  \qt{definition} \isa{f{\isacharparenleft}n{\isacharparenright}\ {\isacharequal}\ f{\isacharparenleft}n{\isacharparenright}\ {\isacharplus}\ {\isadigit{1}}} we could prove 
  113.56 -  \isa{{\isadigit{0}}\ {\isacharequal}\ {\isadigit{1}}} by subtracting \isa{f{\isacharparenleft}n{\isacharparenright}} on both sides.}.
  113.57 -  Isabelle tries to prove termination automatically when a definition
  113.58 -  is made. In \S\ref{termination}, we will look at cases where this
  113.59 -  fails and see what to do then.%
  113.60 -\end{isamarkuptext}%
  113.61 -\isamarkuptrue%
  113.62 -%
  113.63 -\isamarkupsubsection{Pattern matching%
  113.64 -}
  113.65 -\isamarkuptrue%
  113.66 -%
  113.67 -\begin{isamarkuptext}%
  113.68 -\label{patmatch}
  113.69 -  Like in functional programming, we can use pattern matching to
  113.70 -  define functions. At the moment we will only consider \emph{constructor
  113.71 -  patterns}, which only consist of datatype constructors and
  113.72 -  variables. Furthermore, patterns must be linear, i.e.\ all variables
  113.73 -  on the left hand side of an equation must be distinct. In
  113.74 -  \S\ref{genpats} we discuss more general pattern matching.
  113.75 -
  113.76 -  If patterns overlap, the order of the equations is taken into
  113.77 -  account. The following function inserts a fixed element between any
  113.78 -  two elements of a list:%
  113.79 -\end{isamarkuptext}%
  113.80 -\isamarkuptrue%
  113.81 -\isacommand{fun}\isamarkupfalse%
  113.82 -\ sep\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a\ list\ {\isasymRightarrow}\ {\isacharprime}a\ list{\isachardoublequoteclose}\isanewline
  113.83 -\isakeyword{where}\isanewline
  113.84 -\ \ {\isachardoublequoteopen}sep\ a\ {\isacharparenleft}x{\isacharhash}y{\isacharhash}xs{\isacharparenright}\ {\isacharequal}\ x\ {\isacharhash}\ a\ {\isacharhash}\ sep\ a\ {\isacharparenleft}y\ {\isacharhash}\ xs{\isacharparenright}{\isachardoublequoteclose}\isanewline
  113.85 -{\isacharbar}\ {\isachardoublequoteopen}sep\ a\ xs\ \ \ \ \ \ \ {\isacharequal}\ xs{\isachardoublequoteclose}%
  113.86 -\begin{isamarkuptext}%
  113.87 -Overlapping patterns are interpreted as \qt{increments} to what is
  113.88 -  already there: The second equation is only meant for the cases where
  113.89 -  the first one does not match. Consequently, Isabelle replaces it
  113.90 -  internally by the remaining cases, making the patterns disjoint:%
  113.91 -\end{isamarkuptext}%
  113.92 -\isamarkuptrue%
  113.93 -\isacommand{thm}\isamarkupfalse%
  113.94 -\ sep{\isachardot}simps%
  113.95 -\begin{isamarkuptext}%
  113.96 -\begin{isabelle}%
  113.97 -sep\ a\ {\isacharparenleft}x\ {\isacharhash}\ y\ {\isacharhash}\ xs{\isacharparenright}\ {\isacharequal}\ x\ {\isacharhash}\ a\ {\isacharhash}\ sep\ a\ {\isacharparenleft}y\ {\isacharhash}\ xs{\isacharparenright}\isasep\isanewline%
  113.98 -sep\ a\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharequal}\ {\isacharbrackleft}{\isacharbrackright}\isasep\isanewline%
  113.99 -sep\ a\ {\isacharbrackleft}v{\isacharbrackright}\ {\isacharequal}\ {\isacharbrackleft}v{\isacharbrackright}%
 113.100 -\end{isabelle}%
 113.101 -\end{isamarkuptext}%
 113.102 -\isamarkuptrue%
 113.103 -%
 113.104 -\begin{isamarkuptext}%
 113.105 -\noindent The equations from function definitions are automatically used in
 113.106 -  simplification:%
 113.107 -\end{isamarkuptext}%
 113.108 -\isamarkuptrue%
 113.109 -\isacommand{lemma}\isamarkupfalse%
 113.110 -\ {\isachardoublequoteopen}sep\ {\isadigit{0}}\ {\isacharbrackleft}{\isadigit{1}}{\isacharcomma}\ {\isadigit{2}}{\isacharcomma}\ {\isadigit{3}}{\isacharbrackright}\ {\isacharequal}\ {\isacharbrackleft}{\isadigit{1}}{\isacharcomma}\ {\isadigit{0}}{\isacharcomma}\ {\isadigit{2}}{\isacharcomma}\ {\isadigit{0}}{\isacharcomma}\ {\isadigit{3}}{\isacharbrackright}{\isachardoublequoteclose}\isanewline
 113.111 -%
 113.112 -\isadelimproof
 113.113 -%
 113.114 -\endisadelimproof
 113.115 -%
 113.116 -\isatagproof
 113.117 -\isacommand{by}\isamarkupfalse%
 113.118 -\ simp%
 113.119 -\endisatagproof
 113.120 -{\isafoldproof}%
 113.121 -%
 113.122 -\isadelimproof
 113.123 -%
 113.124 -\endisadelimproof
 113.125 -%
 113.126 -\isamarkupsubsection{Induction%
 113.127 -}
 113.128 -\isamarkuptrue%
 113.129 -%
 113.130 -\begin{isamarkuptext}%
 113.131 -Isabelle provides customized induction rules for recursive
 113.132 -  functions. These rules follow the recursive structure of the
 113.133 -  definition. Here is the rule \isa{sep{\isachardot}induct} arising from the
 113.134 -  above definition of \isa{sep}:
 113.135 -
 113.136 -  \begin{isabelle}%
 113.137 -{\isasymlbrakk}{\isasymAnd}a\ x\ y\ xs{\isachardot}\ {\isacharquery}P\ a\ {\isacharparenleft}y\ {\isacharhash}\ xs{\isacharparenright}\ {\isasymLongrightarrow}\ {\isacharquery}P\ a\ {\isacharparenleft}x\ {\isacharhash}\ y\ {\isacharhash}\ xs{\isacharparenright}{\isacharsemicolon}\ {\isasymAnd}a{\isachardot}\ {\isacharquery}P\ a\ {\isacharbrackleft}{\isacharbrackright}{\isacharsemicolon}\ {\isasymAnd}a\ v{\isachardot}\ {\isacharquery}P\ a\ {\isacharbrackleft}v{\isacharbrackright}{\isasymrbrakk}\isanewline
 113.138 -{\isasymLongrightarrow}\ {\isacharquery}P\ {\isacharquery}a{\isadigit{0}}{\isachardot}{\isadigit{0}}\ {\isacharquery}a{\isadigit{1}}{\isachardot}{\isadigit{0}}%
 113.139 -\end{isabelle}
 113.140 -  
 113.141 -  We have a step case for list with at least two elements, and two
 113.142 -  base cases for the zero- and the one-element list. Here is a simple
 113.143 -  proof about \isa{sep} and \isa{map}%
 113.144 -\end{isamarkuptext}%
 113.145 -\isamarkuptrue%
 113.146 -\isacommand{lemma}\isamarkupfalse%
 113.147 -\ {\isachardoublequoteopen}map\ f\ {\isacharparenleft}sep\ x\ ys{\isacharparenright}\ {\isacharequal}\ sep\ {\isacharparenleft}f\ x{\isacharparenright}\ {\isacharparenleft}map\ f\ ys{\isacharparenright}{\isachardoublequoteclose}\isanewline
 113.148 -%
 113.149 -\isadelimproof
 113.150 -%
 113.151 -\endisadelimproof
 113.152 -%
 113.153 -\isatagproof
 113.154 -\isacommand{apply}\isamarkupfalse%
 113.155 -\ {\isacharparenleft}induct\ x\ ys\ rule{\isacharcolon}\ sep{\isachardot}induct{\isacharparenright}%
 113.156 -\begin{isamarkuptxt}%
 113.157 -We get three cases, like in the definition.
 113.158 -
 113.159 -  \begin{isabelle}%
 113.160 -\ {\isadigit{1}}{\isachardot}\ {\isasymAnd}a\ x\ y\ xs{\isachardot}\isanewline
 113.161 -\isaindent{\ {\isadigit{1}}{\isachardot}\ \ \ \ }map\ f\ {\isacharparenleft}sep\ a\ {\isacharparenleft}y\ {\isacharhash}\ xs{\isacharparenright}{\isacharparenright}\ {\isacharequal}\ sep\ {\isacharparenleft}f\ a{\isacharparenright}\ {\isacharparenleft}map\ f\ {\isacharparenleft}y\ {\isacharhash}\ xs{\isacharparenright}{\isacharparenright}\ {\isasymLongrightarrow}\isanewline
 113.162 -\isaindent{\ {\isadigit{1}}{\isachardot}\ \ \ \ }map\ f\ {\isacharparenleft}sep\ a\ {\isacharparenleft}x\ {\isacharhash}\ y\ {\isacharhash}\ xs{\isacharparenright}{\isacharparenright}\ {\isacharequal}\ sep\ {\isacharparenleft}f\ a{\isacharparenright}\ {\isacharparenleft}map\ f\ {\isacharparenleft}x\ {\isacharhash}\ y\ {\isacharhash}\ xs{\isacharparenright}{\isacharparenright}\isanewline
 113.163 -\ {\isadigit{2}}{\isachardot}\ {\isasymAnd}a{\isachardot}\ map\ f\ {\isacharparenleft}sep\ a\ {\isacharbrackleft}{\isacharbrackright}{\isacharparenright}\ {\isacharequal}\ sep\ {\isacharparenleft}f\ a{\isacharparenright}\ {\isacharparenleft}map\ f\ {\isacharbrackleft}{\isacharbrackright}{\isacharparenright}\isanewline
 113.164 -\ {\isadigit{3}}{\isachardot}\ {\isasymAnd}a\ v{\isachardot}\ map\ f\ {\isacharparenleft}sep\ a\ {\isacharbrackleft}v{\isacharbrackright}{\isacharparenright}\ {\isacharequal}\ sep\ {\isacharparenleft}f\ a{\isacharparenright}\ {\isacharparenleft}map\ f\ {\isacharbrackleft}v{\isacharbrackright}{\isacharparenright}%
 113.165 -\end{isabelle}%
 113.166 -\end{isamarkuptxt}%
 113.167 -\isamarkuptrue%
 113.168 -\isacommand{apply}\isamarkupfalse%
 113.169 -\ auto\ \isanewline
 113.170 -\isacommand{done}\isamarkupfalse%
 113.171 -%
 113.172 -\endisatagproof
 113.173 -{\isafoldproof}%
 113.174 -%
 113.175 -\isadelimproof
 113.176 -%
 113.177 -\endisadelimproof
 113.178 -%
 113.179 -\begin{isamarkuptext}%
 113.180 -With the \cmd{fun} command, you can define about 80\% of the
 113.181 -  functions that occur in practice. The rest of this tutorial explains
 113.182 -  the remaining 20\%.%
 113.183 -\end{isamarkuptext}%
 113.184 -\isamarkuptrue%
 113.185 -%
 113.186 -\isamarkupsection{fun vs.\ function%
 113.187 -}
 113.188 -\isamarkuptrue%
 113.189 -%
 113.190 -\begin{isamarkuptext}%
 113.191 -The \cmd{fun} command provides a
 113.192 -  convenient shorthand notation for simple function definitions. In
 113.193 -  this mode, Isabelle tries to solve all the necessary proof obligations
 113.194 -  automatically. If any proof fails, the definition is
 113.195 -  rejected. This can either mean that the definition is indeed faulty,
 113.196 -  or that the default proof procedures are just not smart enough (or
 113.197 -  rather: not designed) to handle the definition.
 113.198 -
 113.199 -  By expanding the abbreviation to the more verbose \cmd{function} command, these proof obligations become visible and can be analyzed or
 113.200 -  solved manually. The expansion from \cmd{fun} to \cmd{function} is as follows:
 113.201 -
 113.202 -\end{isamarkuptext}
 113.203 -
 113.204 -
 113.205 -\[\left[\;\begin{minipage}{0.25\textwidth}\vspace{6pt}
 113.206 -\cmd{fun} \isa{f\ {\isacharcolon}{\isacharcolon}\ {\isasymtau}}\\%
 113.207 -\cmd{where}\\%
 113.208 -\hspace*{2ex}{\it equations}\\%
 113.209 -\hspace*{2ex}\vdots\vspace*{6pt}
 113.210 -\end{minipage}\right]
 113.211 -\quad\equiv\quad
 113.212 -\left[\;\begin{minipage}{0.48\textwidth}\vspace{6pt}
 113.213 -\cmd{function} \isa{{\isacharparenleft}}\cmd{sequential}\isa{{\isacharparenright}\ f\ {\isacharcolon}{\isacharcolon}\ {\isasymtau}}\\%
 113.214 -\cmd{where}\\%
 113.215 -\hspace*{2ex}{\it equations}\\%
 113.216 -\hspace*{2ex}\vdots\\%
 113.217 -\cmd{by} \isa{pat{\isacharunderscore}completeness\ auto}\\%
 113.218 -\cmd{termination by} \isa{lexicographic{\isacharunderscore}order}\vspace{6pt}
 113.219 -\end{minipage}
 113.220 -\right]\]
 113.221 -
 113.222 -\begin{isamarkuptext}
 113.223 -  \vspace*{1em}
 113.224 -  \noindent Some details have now become explicit:
 113.225 -
 113.226 -  \begin{enumerate}
 113.227 -  \item The \cmd{sequential} option enables the preprocessing of
 113.228 -  pattern overlaps which we already saw. Without this option, the equations
 113.229 -  must already be disjoint and complete. The automatic completion only
 113.230 -  works with constructor patterns.
 113.231 -
 113.232 -  \item A function definition produces a proof obligation which
 113.233 -  expresses completeness and compatibility of patterns (we talk about
 113.234 -  this later). The combination of the methods \isa{pat{\isacharunderscore}completeness} and
 113.235 -  \isa{auto} is used to solve this proof obligation.
 113.236 -
 113.237 -  \item A termination proof follows the definition, started by the
 113.238 -  \cmd{termination} command. This will be explained in \S\ref{termination}.
 113.239 - \end{enumerate}
 113.240 -  Whenever a \cmd{fun} command fails, it is usually a good idea to
 113.241 -  expand the syntax to the more verbose \cmd{function} form, to see
 113.242 -  what is actually going on.%
 113.243 -\end{isamarkuptext}%
 113.244 -\isamarkuptrue%
 113.245 -%
 113.246 -\isamarkupsection{Termination%
 113.247 -}
 113.248 -\isamarkuptrue%
 113.249 -%
 113.250 -\begin{isamarkuptext}%
 113.251 -\label{termination}
 113.252 -  The method \isa{lexicographic{\isacharunderscore}order} is the default method for
 113.253 -  termination proofs. It can prove termination of a
 113.254 -  certain class of functions by searching for a suitable lexicographic
 113.255 -  combination of size measures. Of course, not all functions have such
 113.256 -  a simple termination argument. For them, we can specify the termination
 113.257 -  relation manually.%
 113.258 -\end{isamarkuptext}%
 113.259 -\isamarkuptrue%
 113.260 -%
 113.261 -\isamarkupsubsection{The {\tt relation} method%
 113.262 -}
 113.263 -\isamarkuptrue%
 113.264 -%
 113.265 -\begin{isamarkuptext}%
 113.266 -Consider the following function, which sums up natural numbers up to
 113.267 -  \isa{N}, using a counter \isa{i}:%
 113.268 -\end{isamarkuptext}%
 113.269 -\isamarkuptrue%
 113.270 -\isacommand{function}\isamarkupfalse%
 113.271 -\ sum\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ nat\ {\isasymRightarrow}\ nat{\isachardoublequoteclose}\isanewline
 113.272 -\isakeyword{where}\isanewline
 113.273 -\ \ {\isachardoublequoteopen}sum\ i\ N\ {\isacharequal}\ {\isacharparenleft}if\ i\ {\isachargreater}\ N\ then\ {\isadigit{0}}\ else\ i\ {\isacharplus}\ sum\ {\isacharparenleft}Suc\ i{\isacharparenright}\ N{\isacharparenright}{\isachardoublequoteclose}\isanewline
 113.274 -%
 113.275 -\isadelimproof
 113.276 -%
 113.277 -\endisadelimproof
 113.278 -%
 113.279 -\isatagproof
 113.280 -\isacommand{by}\isamarkupfalse%
 113.281 -\ pat{\isacharunderscore}completeness\ auto%
 113.282 -\endisatagproof
 113.283 -{\isafoldproof}%
 113.284 -%
 113.285 -\isadelimproof
 113.286 -%
 113.287 -\endisadelimproof
 113.288 -%
 113.289 -\begin{isamarkuptext}%
 113.290 -\noindent The \isa{lexicographic{\isacharunderscore}order} method fails on this example, because none of the
 113.291 -  arguments decreases in the recursive call, with respect to the standard size ordering.
 113.292 -  To prove termination manually, we must provide a custom wellfounded relation.
 113.293 -
 113.294 -  The termination argument for \isa{sum} is based on the fact that
 113.295 -  the \emph{difference} between \isa{i} and \isa{N} gets
 113.296 -  smaller in every step, and that the recursion stops when \isa{i}
 113.297 -  is greater than \isa{N}. Phrased differently, the expression 
 113.298 -  \isa{N\ {\isacharplus}\ {\isadigit{1}}\ {\isacharminus}\ i} always decreases.
 113.299 -
 113.300 -  We can use this expression as a measure function suitable to prove termination.%
 113.301 -\end{isamarkuptext}%
 113.302 -\isamarkuptrue%
 113.303 -\isacommand{termination}\isamarkupfalse%
 113.304 -\ sum\isanewline
 113.305 -%
 113.306 -\isadelimproof
 113.307 -%
 113.308 -\endisadelimproof
 113.309 -%
 113.310 -\isatagproof
 113.311 -\isacommand{apply}\isamarkupfalse%
 113.312 -\ {\isacharparenleft}relation\ {\isachardoublequoteopen}measure\ {\isacharparenleft}{\isasymlambda}{\isacharparenleft}i{\isacharcomma}N{\isacharparenright}{\isachardot}\ N\ {\isacharplus}\ {\isadigit{1}}\ {\isacharminus}\ i{\isacharparenright}{\isachardoublequoteclose}{\isacharparenright}%
 113.313 -\begin{isamarkuptxt}%
 113.314 -The \cmd{termination} command sets up the termination goal for the
 113.315 -  specified function \isa{sum}. If the function name is omitted, it
 113.316 -  implicitly refers to the last function definition.
 113.317 -
 113.318 -  The \isa{relation} method takes a relation of
 113.319 -  type \isa{{\isacharparenleft}{\isacharprime}a\ {\isasymtimes}\ {\isacharprime}a{\isacharparenright}\ set}, where \isa{{\isacharprime}a} is the argument type of
 113.320 -  the function. If the function has multiple curried arguments, then
 113.321 -  these are packed together into a tuple, as it happened in the above
 113.322 -  example.
 113.323 -
 113.324 -  The predefined function \isa{{\isachardoublequote}measure\ {\isacharcolon}{\isacharcolon}\ {\isacharparenleft}{\isacharprime}a\ {\isasymRightarrow}\ nat{\isacharparenright}\ {\isasymRightarrow}\ {\isacharparenleft}{\isacharprime}a\ {\isasymtimes}\ {\isacharprime}a{\isacharparenright}\ set{\isachardoublequote}} constructs a
 113.325 -  wellfounded relation from a mapping into the natural numbers (a
 113.326 -  \emph{measure function}). 
 113.327 -
 113.328 -  After the invocation of \isa{relation}, we must prove that (a)
 113.329 -  the relation we supplied is wellfounded, and (b) that the arguments
 113.330 -  of recursive calls indeed decrease with respect to the
 113.331 -  relation:
 113.332 -
 113.333 -  \begin{isabelle}%
 113.334 -\ {\isadigit{1}}{\isachardot}\ wf\ {\isacharparenleft}measure\ {\isacharparenleft}{\isasymlambda}{\isacharparenleft}i{\isacharcomma}\ N{\isacharparenright}{\isachardot}\ N\ {\isacharplus}\ {\isadigit{1}}\ {\isacharminus}\ i{\isacharparenright}{\isacharparenright}\isanewline
 113.335 -\ {\isadigit{2}}{\isachardot}\ {\isasymAnd}i\ N{\isachardot}\ {\isasymnot}\ N\ {\isacharless}\ i\ {\isasymLongrightarrow}\ {\isacharparenleft}{\isacharparenleft}Suc\ i{\isacharcomma}\ N{\isacharparenright}{\isacharcomma}\ i{\isacharcomma}\ N{\isacharparenright}\ {\isasymin}\ measure\ {\isacharparenleft}{\isasymlambda}{\isacharparenleft}i{\isacharcomma}\ N{\isacharparenright}{\isachardot}\ N\ {\isacharplus}\ {\isadigit{1}}\ {\isacharminus}\ i{\isacharparenright}%
 113.336 -\end{isabelle}
 113.337 -
 113.338 -  These goals are all solved by \isa{auto}:%
 113.339 -\end{isamarkuptxt}%
 113.340 -\isamarkuptrue%
 113.341 -\isacommand{apply}\isamarkupfalse%
 113.342 -\ auto\isanewline
 113.343 -\isacommand{done}\isamarkupfalse%
 113.344 -%
 113.345 -\endisatagproof
 113.346 -{\isafoldproof}%
 113.347 -%
 113.348 -\isadelimproof
 113.349 -%
 113.350 -\endisadelimproof
 113.351 -%
 113.352 -\begin{isamarkuptext}%
 113.353 -Let us complicate the function a little, by adding some more
 113.354 -  recursive calls:%
 113.355 -\end{isamarkuptext}%
 113.356 -\isamarkuptrue%
 113.357 -\isacommand{function}\isamarkupfalse%
 113.358 -\ foo\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ nat\ {\isasymRightarrow}\ nat{\isachardoublequoteclose}\isanewline
 113.359 -\isakeyword{where}\isanewline
 113.360 -\ \ {\isachardoublequoteopen}foo\ i\ N\ {\isacharequal}\ {\isacharparenleft}if\ i\ {\isachargreater}\ N\ \isanewline
 113.361 -\ \ \ \ \ \ \ \ \ \ \ \ \ \ then\ {\isacharparenleft}if\ N\ {\isacharequal}\ {\isadigit{0}}\ then\ {\isadigit{0}}\ else\ foo\ {\isadigit{0}}\ {\isacharparenleft}N\ {\isacharminus}\ {\isadigit{1}}{\isacharparenright}{\isacharparenright}\isanewline
 113.362 -\ \ \ \ \ \ \ \ \ \ \ \ \ \ else\ i\ {\isacharplus}\ foo\ {\isacharparenleft}Suc\ i{\isacharparenright}\ N{\isacharparenright}{\isachardoublequoteclose}\isanewline
 113.363 -%
 113.364 -\isadelimproof
 113.365 -%
 113.366 -\endisadelimproof
 113.367 -%
 113.368 -\isatagproof
 113.369 -\isacommand{by}\isamarkupfalse%
 113.370 -\ pat{\isacharunderscore}completeness\ auto%
 113.371 -\endisatagproof
 113.372 -{\isafoldproof}%
 113.373 -%
 113.374 -\isadelimproof
 113.375 -%
 113.376 -\endisadelimproof
 113.377 -%
 113.378 -\begin{isamarkuptext}%
 113.379 -When \isa{i} has reached \isa{N}, it starts at zero again
 113.380 -  and \isa{N} is decremented.
 113.381 -  This corresponds to a nested
 113.382 -  loop where one index counts up and the other down. Termination can
 113.383 -  be proved using a lexicographic combination of two measures, namely
 113.384 -  the value of \isa{N} and the above difference. The \isa{measures} combinator generalizes \isa{measure} by taking a
 113.385 -  list of measure functions.%
 113.386 -\end{isamarkuptext}%
 113.387 -\isamarkuptrue%
 113.388 -\isacommand{termination}\isamarkupfalse%
 113.389 -\ \isanewline
 113.390 -%
 113.391 -\isadelimproof
 113.392 -%
 113.393 -\endisadelimproof
 113.394 -%
 113.395 -\isatagproof
 113.396 -\isacommand{by}\isamarkupfalse%
 113.397 -\ {\isacharparenleft}relation\ {\isachardoublequoteopen}measures\ {\isacharbrackleft}{\isasymlambda}{\isacharparenleft}i{\isacharcomma}\ N{\isacharparenright}{\isachardot}\ N{\isacharcomma}\ {\isasymlambda}{\isacharparenleft}i{\isacharcomma}N{\isacharparenright}{\isachardot}\ N\ {\isacharplus}\ {\isadigit{1}}\ {\isacharminus}\ i{\isacharbrackright}{\isachardoublequoteclose}{\isacharparenright}\ auto%
 113.398 -\endisatagproof
 113.399 -{\isafoldproof}%
 113.400 -%
 113.401 -\isadelimproof
 113.402 -%
 113.403 -\endisadelimproof
 113.404 -%
 113.405 -\isamarkupsubsection{How \isa{lexicographic{\isacharunderscore}order} works%
 113.406 -}
 113.407 -\isamarkuptrue%
 113.408 -%
 113.409 -\begin{isamarkuptext}%
 113.410 -To see how the automatic termination proofs work, let's look at an
 113.411 -  example where it fails\footnote{For a detailed discussion of the
 113.412 -  termination prover, see \cite{bulwahnKN07}}:
 113.413 -
 113.414 -\end{isamarkuptext}  
 113.415 -\cmd{fun} \isa{fails\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequote}nat\ {\isasymRightarrow}\ nat\ list\ {\isasymRightarrow}\ nat{\isachardoublequote}}\\%
 113.416 -\cmd{where}\\%
 113.417 -\hspace*{2ex}\isa{{\isachardoublequote}fails\ a\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharequal}\ a{\isachardoublequote}}\\%
 113.418 -|\hspace*{1.5ex}\isa{{\isachardoublequote}fails\ a\ {\isacharparenleft}x{\isacharhash}xs{\isacharparenright}\ {\isacharequal}\ fails\ {\isacharparenleft}x\ {\isacharplus}\ a{\isacharparenright}\ {\isacharparenleft}x{\isacharhash}xs{\isacharparenright}{\isachardoublequote}}\\
 113.419 -\begin{isamarkuptext}
 113.420 -
 113.421 -\noindent Isabelle responds with the following error:
 113.422 -
 113.423 -\begin{isabelle}
 113.424 -*** Unfinished subgoals:\newline
 113.425 -*** (a, 1, <):\newline
 113.426 -*** \ 1.~\isa{{\isasymAnd}x{\isachardot}\ x\ {\isacharequal}\ {\isadigit{0}}}\newline
 113.427 -*** (a, 1, <=):\newline
 113.428 -*** \ 1.~False\newline
 113.429 -*** (a, 2, <):\newline
 113.430 -*** \ 1.~False\newline
 113.431 -*** Calls:\newline
 113.432 -*** a) \isa{{\isacharparenleft}a{\isacharcomma}\ x\ {\isacharhash}\ xs{\isacharparenright}\ {\isacharminus}{\isacharminus}{\isachargreater}{\isachargreater}\ {\isacharparenleft}x\ {\isacharplus}\ a{\isacharcomma}\ x\ {\isacharhash}\ xs{\isacharparenright}}\newline
 113.433 -*** Measures:\newline
 113.434 -*** 1) \isa{{\isasymlambda}x{\isachardot}\ size\ {\isacharparenleft}fst\ x{\isacharparenright}}\newline
 113.435 -*** 2) \isa{{\isasymlambda}x{\isachardot}\ size\ {\isacharparenleft}snd\ x{\isacharparenright}}\newline
 113.436 -*** Result matrix:\newline
 113.437 -*** \ \ \ \ 1\ \ 2  \newline
 113.438 -*** a:  ?   <= \newline
 113.439 -*** Could not find lexicographic termination order.\newline
 113.440 -*** At command "fun".\newline
 113.441 -\end{isabelle}%
 113.442 -\end{isamarkuptext}%
 113.443 -\isamarkuptrue%
 113.444 -%
 113.445 -\begin{isamarkuptext}%
 113.446 -The key to this error message is the matrix at the bottom. The rows
 113.447 -  of that matrix correspond to the different recursive calls (In our
 113.448 -  case, there is just one). The columns are the function's arguments 
 113.449 -  (expressed through different measure functions, which map the
 113.450 -  argument tuple to a natural number). 
 113.451 -
 113.452 -  The contents of the matrix summarize what is known about argument
 113.453 -  descents: The second argument has a weak descent (\isa{{\isacharless}{\isacharequal}}) at the
 113.454 -  recursive call, and for the first argument nothing could be proved,
 113.455 -  which is expressed by \isa{{\isacharquery}}. In general, there are the values
 113.456 -  \isa{{\isacharless}}, \isa{{\isacharless}{\isacharequal}} and \isa{{\isacharquery}}.
 113.457 -
 113.458 -  For the failed proof attempts, the unfinished subgoals are also
 113.459 -  printed. Looking at these will often point to a missing lemma.
 113.460 -
 113.461 -%  As a more real example, here is quicksort:%
 113.462 -\end{isamarkuptext}%
 113.463 -\isamarkuptrue%
 113.464 -%
 113.465 -\isamarkupsection{Mutual Recursion%
 113.466 -}
 113.467 -\isamarkuptrue%
 113.468 -%
 113.469 -\begin{isamarkuptext}%
 113.470 -If two or more functions call one another mutually, they have to be defined
 113.471 -  in one step. Here are \isa{even} and \isa{odd}:%
 113.472 -\end{isamarkuptext}%
 113.473 -\isamarkuptrue%
 113.474 -\isacommand{function}\isamarkupfalse%
 113.475 -\ even\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ bool{\isachardoublequoteclose}\isanewline
 113.476 -\ \ \ \ \isakeyword{and}\ odd\ \ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ bool{\isachardoublequoteclose}\isanewline
 113.477 -\isakeyword{where}\isanewline
 113.478 -\ \ {\isachardoublequoteopen}even\ {\isadigit{0}}\ {\isacharequal}\ True{\isachardoublequoteclose}\isanewline
 113.479 -{\isacharbar}\ {\isachardoublequoteopen}odd\ {\isadigit{0}}\ {\isacharequal}\ False{\isachardoublequoteclose}\isanewline
 113.480 -{\isacharbar}\ {\isachardoublequoteopen}even\ {\isacharparenleft}Suc\ n{\isacharparenright}\ {\isacharequal}\ odd\ n{\isachardoublequoteclose}\isanewline
 113.481 -{\isacharbar}\ {\isachardoublequoteopen}odd\ {\isacharparenleft}Suc\ n{\isacharparenright}\ {\isacharequal}\ even\ n{\isachardoublequoteclose}\isanewline
 113.482 -%
 113.483 -\isadelimproof
 113.484 -%
 113.485 -\endisadelimproof
 113.486 -%
 113.487 -\isatagproof
 113.488 -\isacommand{by}\isamarkupfalse%
 113.489 -\ pat{\isacharunderscore}completeness\ auto%
 113.490 -\endisatagproof
 113.491 -{\isafoldproof}%
 113.492 -%
 113.493 -\isadelimproof
 113.494 -%
 113.495 -\endisadelimproof
 113.496 -%
 113.497 -\begin{isamarkuptext}%
 113.498 -To eliminate the mutual dependencies, Isabelle internally
 113.499 -  creates a single function operating on the sum
 113.500 -  type \isa{nat\ {\isacharplus}\ nat}. Then, \isa{even} and \isa{odd} are
 113.501 -  defined as projections. Consequently, termination has to be proved
 113.502 -  simultaneously for both functions, by specifying a measure on the
 113.503 -  sum type:%
 113.504 -\end{isamarkuptext}%
 113.505 -\isamarkuptrue%
 113.506 -\isacommand{termination}\isamarkupfalse%
 113.507 -\ \isanewline
 113.508 -%
 113.509 -\isadelimproof
 113.510 -%
 113.511 -\endisadelimproof
 113.512 -%
 113.513 -\isatagproof
 113.514 -\isacommand{by}\isamarkupfalse%
 113.515 -\ {\isacharparenleft}relation\ {\isachardoublequoteopen}measure\ {\isacharparenleft}{\isasymlambda}x{\isachardot}\ case\ x\ of\ Inl\ n\ {\isasymRightarrow}\ n\ {\isacharbar}\ Inr\ n\ {\isasymRightarrow}\ n{\isacharparenright}{\isachardoublequoteclose}{\isacharparenright}\ auto%
 113.516 -\endisatagproof
 113.517 -{\isafoldproof}%
 113.518 -%
 113.519 -\isadelimproof
 113.520 -%
 113.521 -\endisadelimproof
 113.522 -%
 113.523 -\begin{isamarkuptext}%
 113.524 -We could also have used \isa{lexicographic{\isacharunderscore}order}, which
 113.525 -  supports mutual recursive termination proofs to a certain extent.%
 113.526 -\end{isamarkuptext}%
 113.527 -\isamarkuptrue%
 113.528 -%
 113.529 -\isamarkupsubsection{Induction for mutual recursion%
 113.530 -}
 113.531 -\isamarkuptrue%
 113.532 -%
 113.533 -\begin{isamarkuptext}%
 113.534 -When functions are mutually recursive, proving properties about them
 113.535 -  generally requires simultaneous induction. The induction rule \isa{even{\isacharunderscore}odd{\isachardot}induct}
 113.536 -  generated from the above definition reflects this.
 113.537 -
 113.538 -  Let us prove something about \isa{even} and \isa{odd}:%
 113.539 -\end{isamarkuptext}%
 113.540 -\isamarkuptrue%
 113.541 -\isacommand{lemma}\isamarkupfalse%
 113.542 -\ even{\isacharunderscore}odd{\isacharunderscore}mod{\isadigit{2}}{\isacharcolon}\isanewline
 113.543 -\ \ {\isachardoublequoteopen}even\ n\ {\isacharequal}\ {\isacharparenleft}n\ mod\ {\isadigit{2}}\ {\isacharequal}\ {\isadigit{0}}{\isacharparenright}{\isachardoublequoteclose}\isanewline
 113.544 -\ \ {\isachardoublequoteopen}odd\ n\ {\isacharequal}\ {\isacharparenleft}n\ mod\ {\isadigit{2}}\ {\isacharequal}\ {\isadigit{1}}{\isacharparenright}{\isachardoublequoteclose}%
 113.545 -\isadelimproof
 113.546 -%
 113.547 -\endisadelimproof
 113.548 -%
 113.549 -\isatagproof
 113.550 -%
 113.551 -\begin{isamarkuptxt}%
 113.552 -We apply simultaneous induction, specifying the induction variable
 113.553 -  for both goals, separated by \cmd{and}:%
 113.554 -\end{isamarkuptxt}%
 113.555 -\isamarkuptrue%
 113.556 -\isacommand{apply}\isamarkupfalse%
 113.557 -\ {\isacharparenleft}induct\ n\ \isakeyword{and}\ n\ rule{\isacharcolon}\ even{\isacharunderscore}odd{\isachardot}induct{\isacharparenright}%
 113.558 -\begin{isamarkuptxt}%
 113.559 -We get four subgoals, which correspond to the clauses in the
 113.560 -  definition of \isa{even} and \isa{odd}:
 113.561 -  \begin{isabelle}%
 113.562 -\ {\isadigit{1}}{\isachardot}\ even\ {\isadigit{0}}\ {\isacharequal}\ {\isacharparenleft}{\isadigit{0}}\ mod\ {\isadigit{2}}\ {\isacharequal}\ {\isadigit{0}}{\isacharparenright}\isanewline
 113.563 -\ {\isadigit{2}}{\isachardot}\ odd\ {\isadigit{0}}\ {\isacharequal}\ {\isacharparenleft}{\isadigit{0}}\ mod\ {\isadigit{2}}\ {\isacharequal}\ {\isadigit{1}}{\isacharparenright}\isanewline
 113.564 -\ {\isadigit{3}}{\isachardot}\ {\isasymAnd}n{\isachardot}\ odd\ n\ {\isacharequal}\ {\isacharparenleft}n\ mod\ {\isadigit{2}}\ {\isacharequal}\ {\isadigit{1}}{\isacharparenright}\ {\isasymLongrightarrow}\ even\ {\isacharparenleft}Suc\ n{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}Suc\ n\ mod\ {\isadigit{2}}\ {\isacharequal}\ {\isadigit{0}}{\isacharparenright}\isanewline
 113.565 -\ {\isadigit{4}}{\isachardot}\ {\isasymAnd}n{\isachardot}\ even\ n\ {\isacharequal}\ {\isacharparenleft}n\ mod\ {\isadigit{2}}\ {\isacharequal}\ {\isadigit{0}}{\isacharparenright}\ {\isasymLongrightarrow}\ odd\ {\isacharparenleft}Suc\ n{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}Suc\ n\ mod\ {\isadigit{2}}\ {\isacharequal}\ {\isadigit{1}}{\isacharparenright}%
 113.566 -\end{isabelle}
 113.567 -  Simplification solves the first two goals, leaving us with two
 113.568 -  statements about the \isa{mod} operation to prove:%
 113.569 -\end{isamarkuptxt}%
 113.570 -\isamarkuptrue%
 113.571 -\isacommand{apply}\isamarkupfalse%
 113.572 -\ simp{\isacharunderscore}all%
 113.573 -\begin{isamarkuptxt}%
 113.574 -\begin{isabelle}%
 113.575 -\ {\isadigit{1}}{\isachardot}\ {\isasymAnd}n{\isachardot}\ odd\ n\ {\isacharequal}\ {\isacharparenleft}n\ mod\ {\isadigit{2}}\ {\isacharequal}\ Suc\ {\isadigit{0}}{\isacharparenright}\ {\isasymLongrightarrow}\ {\isacharparenleft}n\ mod\ {\isadigit{2}}\ {\isacharequal}\ Suc\ {\isadigit{0}}{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}Suc\ n\ mod\ {\isadigit{2}}\ {\isacharequal}\ {\isadigit{0}}{\isacharparenright}\isanewline
 113.576 -\ {\isadigit{2}}{\isachardot}\ {\isasymAnd}n{\isachardot}\ even\ n\ {\isacharequal}\ {\isacharparenleft}n\ mod\ {\isadigit{2}}\ {\isacharequal}\ {\isadigit{0}}{\isacharparenright}\ {\isasymLongrightarrow}\ {\isacharparenleft}n\ mod\ {\isadigit{2}}\ {\isacharequal}\ {\isadigit{0}}{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}Suc\ n\ mod\ {\isadigit{2}}\ {\isacharequal}\ Suc\ {\isadigit{0}}{\isacharparenright}%
 113.577 -\end{isabelle} 
 113.578 -
 113.579 -  \noindent These can be handled by Isabelle's arithmetic decision procedures.%
 113.580 -\end{isamarkuptxt}%
 113.581 -\isamarkuptrue%
 113.582 -\isacommand{apply}\isamarkupfalse%
 113.583 -\ arith\isanewline
 113.584 -\isacommand{apply}\isamarkupfalse%
 113.585 -\ arith\isanewline
 113.586 -\isacommand{done}\isamarkupfalse%
 113.587 -%
 113.588 -\endisatagproof
 113.589 -{\isafoldproof}%
 113.590 -%
 113.591 -\isadelimproof
 113.592 -%
 113.593 -\endisadelimproof
 113.594 -%
 113.595 -\begin{isamarkuptext}%
 113.596 -In proofs like this, the simultaneous induction is really essential:
 113.597 -  Even if we are just interested in one of the results, the other
 113.598 -  one is necessary to strengthen the induction hypothesis. If we leave
 113.599 -  out the statement about \isa{odd} and just write \isa{True} instead,
 113.600 -  the same proof fails:%
 113.601 -\end{isamarkuptext}%
 113.602 -\isamarkuptrue%
 113.603 -\isacommand{lemma}\isamarkupfalse%
 113.604 -\ failed{\isacharunderscore}attempt{\isacharcolon}\isanewline
 113.605 -\ \ {\isachardoublequoteopen}even\ n\ {\isacharequal}\ {\isacharparenleft}n\ mod\ {\isadigit{2}}\ {\isacharequal}\ {\isadigit{0}}{\isacharparenright}{\isachardoublequoteclose}\isanewline
 113.606 -\ \ {\isachardoublequoteopen}True{\isachardoublequoteclose}\isanewline
 113.607 -%
 113.608 -\isadelimproof
 113.609 -%
 113.610 -\endisadelimproof
 113.611 -%
 113.612 -\isatagproof
 113.613 -\isacommand{apply}\isamarkupfalse%
 113.614 -\ {\isacharparenleft}induct\ n\ rule{\isacharcolon}\ even{\isacharunderscore}odd{\isachardot}induct{\isacharparenright}%
 113.615 -\begin{isamarkuptxt}%
 113.616 -\noindent Now the third subgoal is a dead end, since we have no
 113.617 -  useful induction hypothesis available:
 113.618 -
 113.619 -  \begin{isabelle}%
 113.620 -\ {\isadigit{1}}{\isachardot}\ even\ {\isadigit{0}}\ {\isacharequal}\ {\isacharparenleft}{\isadigit{0}}\ mod\ {\isadigit{2}}\ {\isacharequal}\ {\isadigit{0}}{\isacharparenright}\isanewline
 113.621 -\ {\isadigit{2}}{\isachardot}\ True\isanewline
 113.622 -\ {\isadigit{3}}{\isachardot}\ {\isasymAnd}n{\isachardot}\ True\ {\isasymLongrightarrow}\ even\ {\isacharparenleft}Suc\ n{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}Suc\ n\ mod\ {\isadigit{2}}\ {\isacharequal}\ {\isadigit{0}}{\isacharparenright}\isanewline
 113.623 -\ {\isadigit{4}}{\isachardot}\ {\isasymAnd}n{\isachardot}\ even\ n\ {\isacharequal}\ {\isacharparenleft}n\ mod\ {\isadigit{2}}\ {\isacharequal}\ {\isadigit{0}}{\isacharparenright}\ {\isasymLongrightarrow}\ True%
 113.624 -\end{isabelle}%
 113.625 -\end{isamarkuptxt}%
 113.626 -\isamarkuptrue%
 113.627 -\isacommand{oops}\isamarkupfalse%
 113.628 -%
 113.629 -\endisatagproof
 113.630 -{\isafoldproof}%
 113.631 -%
 113.632 -\isadelimproof
 113.633 -%
 113.634 -\endisadelimproof
 113.635 -%
 113.636 -\isamarkupsection{General pattern matching%
 113.637 -}
 113.638 -\isamarkuptrue%
 113.639 -%
 113.640 -\begin{isamarkuptext}%
 113.641 -\label{genpats}%
 113.642 -\end{isamarkuptext}%
 113.643 -\isamarkuptrue%
 113.644 -%
 113.645 -\isamarkupsubsection{Avoiding automatic pattern splitting%
 113.646 -}
 113.647 -\isamarkuptrue%
 113.648 -%
 113.649 -\begin{isamarkuptext}%
 113.650 -Up to now, we used pattern matching only on datatypes, and the
 113.651 -  patterns were always disjoint and complete, and if they weren't,
 113.652 -  they were made disjoint automatically like in the definition of
 113.653 -  \isa{sep} in \S\ref{patmatch}.
 113.654 -
 113.655 -  This automatic splitting can significantly increase the number of
 113.656 -  equations involved, and this is not always desirable. The following
 113.657 -  example shows the problem:
 113.658 -  
 113.659 -  Suppose we are modeling incomplete knowledge about the world by a
 113.660 -  three-valued datatype, which has values \isa{T}, \isa{F}
 113.661 -  and \isa{X} for true, false and uncertain propositions, respectively.%
 113.662 -\end{isamarkuptext}%
 113.663 -\isamarkuptrue%
 113.664 -\isacommand{datatype}\isamarkupfalse%
 113.665 -\ P{\isadigit{3}}\ {\isacharequal}\ T\ {\isacharbar}\ F\ {\isacharbar}\ X%
 113.666 -\begin{isamarkuptext}%
 113.667 -\noindent Then the conjunction of such values can be defined as follows:%
 113.668 -\end{isamarkuptext}%
 113.669 -\isamarkuptrue%
 113.670 -\isacommand{fun}\isamarkupfalse%
 113.671 -\ And\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}P{\isadigit{3}}\ {\isasymRightarrow}\ P{\isadigit{3}}\ {\isasymRightarrow}\ P{\isadigit{3}}{\isachardoublequoteclose}\isanewline
 113.672 -\isakeyword{where}\isanewline
 113.673 -\ \ {\isachardoublequoteopen}And\ T\ p\ {\isacharequal}\ p{\isachardoublequoteclose}\isanewline
 113.674 -{\isacharbar}\ {\isachardoublequoteopen}And\ p\ T\ {\isacharequal}\ p{\isachardoublequoteclose}\isanewline
 113.675 -{\isacharbar}\ {\isachardoublequoteopen}And\ p\ F\ {\isacharequal}\ F{\isachardoublequoteclose}\isanewline
 113.676 -{\isacharbar}\ {\isachardoublequoteopen}And\ F\ p\ {\isacharequal}\ F{\isachardoublequoteclose}\isanewline
 113.677 -{\isacharbar}\ {\isachardoublequoteopen}And\ X\ X\ {\isacharequal}\ X{\isachardoublequoteclose}%
 113.678 -\begin{isamarkuptext}%
 113.679 -This definition is useful, because the equations can directly be used
 113.680 -  as simplification rules. But the patterns overlap: For example,
 113.681 -  the expression \isa{And\ T\ T} is matched by both the first and
 113.682 -  the second equation. By default, Isabelle makes the patterns disjoint by
 113.683 -  splitting them up, producing instances:%
 113.684 -\end{isamarkuptext}%
 113.685 -\isamarkuptrue%
 113.686 -\isacommand{thm}\isamarkupfalse%
 113.687 -\ And{\isachardot}simps%
 113.688 -\begin{isamarkuptext}%
 113.689 -\isa{And\ T\ {\isacharquery}p\ {\isacharequal}\ {\isacharquery}p\isasep\isanewline%
 113.690 -And\ F\ T\ {\isacharequal}\ F\isasep\isanewline%
 113.691 -And\ X\ T\ {\isacharequal}\ X\isasep\isanewline%
 113.692 -And\ F\ F\ {\isacharequal}\ F\isasep\isanewline%
 113.693 -And\ X\ F\ {\isacharequal}\ F\isasep\isanewline%
 113.694 -And\ F\ X\ {\isacharequal}\ F\isasep\isanewline%
 113.695 -And\ X\ X\ {\isacharequal}\ X}
 113.696 -  
 113.697 -  \vspace*{1em}
 113.698 -  \noindent There are several problems with this:
 113.699 -
 113.700 -  \begin{enumerate}
 113.701 -  \item If the datatype has many constructors, there can be an
 113.702 -  explosion of equations. For \isa{And}, we get seven instead of
 113.703 -  five equations, which can be tolerated, but this is just a small
 113.704 -  example.
 113.705 -
 113.706 -  \item Since splitting makes the equations \qt{less general}, they
 113.707 -  do not always match in rewriting. While the term \isa{And\ x\ F}
 113.708 -  can be simplified to \isa{F} with the original equations, a
 113.709 -  (manual) case split on \isa{x} is now necessary.
 113.710 -
 113.711 -  \item The splitting also concerns the induction rule \isa{And{\isachardot}induct}. Instead of five premises it now has seven, which
 113.712 -  means that our induction proofs will have more cases.
 113.713 -
 113.714 -  \item In general, it increases clarity if we get the same definition
 113.715 -  back which we put in.
 113.716 -  \end{enumerate}
 113.717 -
 113.718 -  If we do not want the automatic splitting, we can switch it off by
 113.719 -  leaving out the \cmd{sequential} option. However, we will have to
 113.720 -  prove that our pattern matching is consistent\footnote{This prevents
 113.721 -  us from defining something like \isa{f\ x\ {\isacharequal}\ True} and \isa{f\ x\ {\isacharequal}\ False} simultaneously.}:%
 113.722 -\end{isamarkuptext}%
 113.723 -\isamarkuptrue%
 113.724 -\isacommand{function}\isamarkupfalse%
 113.725 -\ And{\isadigit{2}}\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}P{\isadigit{3}}\ {\isasymRightarrow}\ P{\isadigit{3}}\ {\isasymRightarrow}\ P{\isadigit{3}}{\isachardoublequoteclose}\isanewline
 113.726 -\isakeyword{where}\isanewline
 113.727 -\ \ {\isachardoublequoteopen}And{\isadigit{2}}\ T\ p\ {\isacharequal}\ p{\isachardoublequoteclose}\isanewline
 113.728 -{\isacharbar}\ {\isachardoublequoteopen}And{\isadigit{2}}\ p\ T\ {\isacharequal}\ p{\isachardoublequoteclose}\isanewline
 113.729 -{\isacharbar}\ {\isachardoublequoteopen}And{\isadigit{2}}\ p\ F\ {\isacharequal}\ F{\isachardoublequoteclose}\isanewline
 113.730 -{\isacharbar}\ {\isachardoublequoteopen}And{\isadigit{2}}\ F\ p\ {\isacharequal}\ F{\isachardoublequoteclose}\isanewline
 113.731 -{\isacharbar}\ {\isachardoublequoteopen}And{\isadigit{2}}\ X\ X\ {\isacharequal}\ X{\isachardoublequoteclose}%
 113.732 -\isadelimproof
 113.733 -%
 113.734 -\endisadelimproof
 113.735 -%
 113.736 -\isatagproof
 113.737 -%
 113.738 -\begin{isamarkuptxt}%
 113.739 -\noindent Now let's look at the proof obligations generated by a
 113.740 -  function definition. In this case, they are:
 113.741 -
 113.742 -  \begin{isabelle}%
 113.743 -\ {\isadigit{1}}{\isachardot}\ {\isasymAnd}P\ x{\isachardot}\ {\isasymlbrakk}{\isasymAnd}p{\isachardot}\ x\ {\isacharequal}\ {\isacharparenleft}T{\isacharcomma}\ p{\isacharparenright}\ {\isasymLongrightarrow}\ P{\isacharsemicolon}\ {\isasymAnd}p{\isachardot}\ x\ {\isacharequal}\ {\isacharparenleft}p{\isacharcomma}\ T{\isacharparenright}\ {\isasymLongrightarrow}\ P{\isacharsemicolon}\ {\isasymAnd}p{\isachardot}\ x\ {\isacharequal}\ {\isacharparenleft}p{\isacharcomma}\ F{\isacharparenright}\ {\isasymLongrightarrow}\ P{\isacharsemicolon}\isanewline
 113.744 -\isaindent{\ {\isadigit{1}}{\isachardot}\ {\isasymAnd}P\ x{\isachardot}\ \ }{\isasymAnd}p{\isachardot}\ x\ {\isacharequal}\ {\isacharparenleft}F{\isacharcomma}\ p{\isacharparenright}\ {\isasymLongrightarrow}\ P{\isacharsemicolon}\ x\ {\isacharequal}\ {\isacharparenleft}X{\isacharcomma}\ X{\isacharparenright}\ {\isasymLongrightarrow}\ P{\isasymrbrakk}\isanewline
 113.745 -\isaindent{\ {\isadigit{1}}{\isachardot}\ {\isasymAnd}P\ x{\isachardot}\ }{\isasymLongrightarrow}\ P\isanewline
 113.746 -\ {\isadigit{2}}{\isachardot}\ {\isasymAnd}p\ pa{\isachardot}\ {\isacharparenleft}T{\isacharcomma}\ p{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}T{\isacharcomma}\ pa{\isacharparenright}\ {\isasymLongrightarrow}\ p\ {\isacharequal}\ pa\isanewline
 113.747 -\ {\isadigit{3}}{\isachardot}\ {\isasymAnd}p\ pa{\isachardot}\ {\isacharparenleft}T{\isacharcomma}\ p{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}pa{\isacharcomma}\ T{\isacharparenright}\ {\isasymLongrightarrow}\ p\ {\isacharequal}\ pa\isanewline
 113.748 -\ {\isadigit{4}}{\isachardot}\ {\isasymAnd}p\ pa{\isachardot}\ {\isacharparenleft}T{\isacharcomma}\ p{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}pa{\isacharcomma}\ F{\isacharparenright}\ {\isasymLongrightarrow}\ p\ {\isacharequal}\ F\isanewline
 113.749 -\ {\isadigit{5}}{\isachardot}\ {\isasymAnd}p\ pa{\isachardot}\ {\isacharparenleft}T{\isacharcomma}\ p{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}F{\isacharcomma}\ pa{\isacharparenright}\ {\isasymLongrightarrow}\ p\ {\isacharequal}\ F\isanewline
 113.750 -\ {\isadigit{6}}{\isachardot}\ {\isasymAnd}p{\isachardot}\ {\isacharparenleft}T{\isacharcomma}\ p{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}X{\isacharcomma}\ X{\isacharparenright}\ {\isasymLongrightarrow}\ p\ {\isacharequal}\ X\isanewline
 113.751 -\ {\isadigit{7}}{\isachardot}\ {\isasymAnd}p\ pa{\isachardot}\ {\isacharparenleft}p{\isacharcomma}\ T{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}pa{\isacharcomma}\ T{\isacharparenright}\ {\isasymLongrightarrow}\ p\ {\isacharequal}\ pa\isanewline
 113.752 -\ {\isadigit{8}}{\isachardot}\ {\isasymAnd}p\ pa{\isachardot}\ {\isacharparenleft}p{\isacharcomma}\ T{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}pa{\isacharcomma}\ F{\isacharparenright}\ {\isasymLongrightarrow}\ p\ {\isacharequal}\ F\isanewline
 113.753 -\ {\isadigit{9}}{\isachardot}\ {\isasymAnd}p\ pa{\isachardot}\ {\isacharparenleft}p{\isacharcomma}\ T{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}F{\isacharcomma}\ pa{\isacharparenright}\ {\isasymLongrightarrow}\ p\ {\isacharequal}\ F\isanewline
 113.754 -\ {\isadigit{1}}{\isadigit{0}}{\isachardot}\ {\isasymAnd}p{\isachardot}\ {\isacharparenleft}p{\isacharcomma}\ T{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}X{\isacharcomma}\ X{\isacharparenright}\ {\isasymLongrightarrow}\ p\ {\isacharequal}\ X%
 113.755 -\end{isabelle}\vspace{-1.2em}\hspace{3cm}\vdots\vspace{1.2em}
 113.756 -
 113.757 -  The first subgoal expresses the completeness of the patterns. It has
 113.758 -  the form of an elimination rule and states that every \isa{x} of
 113.759 -  the function's input type must match at least one of the patterns\footnote{Completeness could
 113.760 -  be equivalently stated as a disjunction of existential statements: 
 113.761 -\isa{{\isacharparenleft}{\isasymexists}p{\isachardot}\ x\ {\isacharequal}\ {\isacharparenleft}T{\isacharcomma}\ p{\isacharparenright}{\isacharparenright}\ {\isasymor}\ {\isacharparenleft}{\isasymexists}p{\isachardot}\ x\ {\isacharequal}\ {\isacharparenleft}p{\isacharcomma}\ T{\isacharparenright}{\isacharparenright}\ {\isasymor}\ {\isacharparenleft}{\isasymexists}p{\isachardot}\ x\ {\isacharequal}\ {\isacharparenleft}p{\isacharcomma}\ F{\isacharparenright}{\isacharparenright}\ {\isasymor}\ {\isacharparenleft}{\isasymexists}p{\isachardot}\ x\ {\isacharequal}\ {\isacharparenleft}F{\isacharcomma}\ p{\isacharparenright}{\isacharparenright}\ {\isasymor}\ x\ {\isacharequal}\ {\isacharparenleft}X{\isacharcomma}\ X{\isacharparenright}}, and you can use the method \isa{atomize{\isacharunderscore}elim} to get that form instead.}. If the patterns just involve
 113.762 -  datatypes, we can solve it with the \isa{pat{\isacharunderscore}completeness}
 113.763 -  method:%
 113.764 -\end{isamarkuptxt}%
 113.765 -\isamarkuptrue%
 113.766 -\isacommand{apply}\isamarkupfalse%
 113.767 -\ pat{\isacharunderscore}completeness%
 113.768 -\begin{isamarkuptxt}%
 113.769 -The remaining subgoals express \emph{pattern compatibility}. We do
 113.770 -  allow that an input value matches multiple patterns, but in this
 113.771 -  case, the result (i.e.~the right hand sides of the equations) must
 113.772 -  also be equal. For each pair of two patterns, there is one such
 113.773 -  subgoal. Usually this needs injectivity of the constructors, which
 113.774 -  is used automatically by \isa{auto}.%
 113.775 -\end{isamarkuptxt}%
 113.776 -\isamarkuptrue%
 113.777 -\isacommand{by}\isamarkupfalse%
 113.778 -\ auto%
 113.779 -\endisatagproof
 113.780 -{\isafoldproof}%
 113.781 -%
 113.782 -\isadelimproof
 113.783 -%
 113.784 -\endisadelimproof
 113.785 -%
 113.786 -\isamarkupsubsection{Non-constructor patterns%
 113.787 -}
 113.788 -\isamarkuptrue%
 113.789 -%
 113.790 -\begin{isamarkuptext}%
 113.791 -Most of Isabelle's basic types take the form of inductive datatypes,
 113.792 -  and usually pattern matching works on the constructors of such types. 
 113.793 -  However, this need not be always the case, and the \cmd{function}
 113.794 -  command handles other kind of patterns, too.
 113.795 -
 113.796 -  One well-known instance of non-constructor patterns are
 113.797 -  so-called \emph{$n+k$-patterns}, which are a little controversial in
 113.798 -  the functional programming world. Here is the initial fibonacci
 113.799 -  example with $n+k$-patterns:%
 113.800 -\end{isamarkuptext}%
 113.801 -\isamarkuptrue%
 113.802 -\isacommand{function}\isamarkupfalse%
 113.803 -\ fib{\isadigit{2}}\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ nat{\isachardoublequoteclose}\isanewline
 113.804 -\isakeyword{where}\isanewline
 113.805 -\ \ {\isachardoublequoteopen}fib{\isadigit{2}}\ {\isadigit{0}}\ {\isacharequal}\ {\isadigit{1}}{\isachardoublequoteclose}\isanewline
 113.806 -{\isacharbar}\ {\isachardoublequoteopen}fib{\isadigit{2}}\ {\isadigit{1}}\ {\isacharequal}\ {\isadigit{1}}{\isachardoublequoteclose}\isanewline
 113.807 -{\isacharbar}\ {\isachardoublequoteopen}fib{\isadigit{2}}\ {\isacharparenleft}n\ {\isacharplus}\ {\isadigit{2}}{\isacharparenright}\ {\isacharequal}\ fib{\isadigit{2}}\ n\ {\isacharplus}\ fib{\isadigit{2}}\ {\isacharparenleft}Suc\ n{\isacharparenright}{\isachardoublequoteclose}\isanewline
 113.808 -%
 113.809 -\isadelimML
 113.810 -%
 113.811 -\endisadelimML
 113.812 -%
 113.813 -\isatagML
 113.814 -%
 113.815 -\endisatagML
 113.816 -{\isafoldML}%
 113.817 -%
 113.818 -\isadelimML
 113.819 -%
 113.820 -\endisadelimML
 113.821 -%
 113.822 -\isadelimproof
 113.823 -%
 113.824 -\endisadelimproof
 113.825 -%
 113.826 -\isatagproof
 113.827 -%
 113.828 -\begin{isamarkuptxt}%
 113.829 -This kind of matching is again justified by the proof of pattern
 113.830 -  completeness and compatibility. 
 113.831 -  The proof obligation for pattern completeness states that every natural number is
 113.832 -  either \isa{{\isadigit{0}}}, \isa{{\isadigit{1}}} or \isa{n\ {\isacharplus}\ {\isadigit{2}}}:
 113.833 -
 113.834 -  \begin{isabelle}%
 113.835 -\ {\isadigit{1}}{\isachardot}\ {\isasymAnd}P\ x{\isachardot}\ {\isasymlbrakk}x\ {\isacharequal}\ {\isadigit{0}}\ {\isasymLongrightarrow}\ P{\isacharsemicolon}\ x\ {\isacharequal}\ {\isadigit{1}}\ {\isasymLongrightarrow}\ P{\isacharsemicolon}\ {\isasymAnd}n{\isachardot}\ x\ {\isacharequal}\ n\ {\isacharplus}\ {\isadigit{2}}\ {\isasymLongrightarrow}\ P{\isasymrbrakk}\ {\isasymLongrightarrow}\ P\isanewline
 113.836 -\ {\isadigit{2}}{\isachardot}\ {\isadigit{0}}\ {\isacharequal}\ {\isadigit{0}}\ {\isasymLongrightarrow}\ {\isadigit{1}}\ {\isacharequal}\ {\isadigit{1}}\isanewline
 113.837 -\ {\isadigit{3}}{\isachardot}\ {\isadigit{0}}\ {\isacharequal}\ {\isadigit{1}}\ {\isasymLongrightarrow}\ {\isadigit{1}}\ {\isacharequal}\ {\isadigit{1}}\isanewline
 113.838 -\ {\isadigit{4}}{\isachardot}\ {\isasymAnd}n{\isachardot}\ {\isadigit{0}}\ {\isacharequal}\ n\ {\isacharplus}\ {\isadigit{2}}\ {\isasymLongrightarrow}\ {\isadigit{1}}\ {\isacharequal}\ fib{\isadigit{2}}{\isacharunderscore}sumC\ n\ {\isacharplus}\ fib{\isadigit{2}}{\isacharunderscore}sumC\ {\isacharparenleft}Suc\ n{\isacharparenright}\isanewline
 113.839 -\ {\isadigit{5}}{\isachardot}\ {\isadigit{1}}\ {\isacharequal}\ {\isadigit{1}}\ {\isasymLongrightarrow}\ {\isadigit{1}}\ {\isacharequal}\ {\isadigit{1}}\isanewline
 113.840 -\ {\isadigit{6}}{\isachardot}\ {\isasymAnd}n{\isachardot}\ {\isadigit{1}}\ {\isacharequal}\ n\ {\isacharplus}\ {\isadigit{2}}\ {\isasymLongrightarrow}\ {\isadigit{1}}\ {\isacharequal}\ fib{\isadigit{2}}{\isacharunderscore}sumC\ n\ {\isacharplus}\ fib{\isadigit{2}}{\isacharunderscore}sumC\ {\isacharparenleft}Suc\ n{\isacharparenright}\isanewline
 113.841 -\ {\isadigit{7}}{\isachardot}\ {\isasymAnd}n\ na{\isachardot}\isanewline
 113.842 -\isaindent{\ {\isadigit{7}}{\isachardot}\ \ \ \ }n\ {\isacharplus}\ {\isadigit{2}}\ {\isacharequal}\ na\ {\isacharplus}\ {\isadigit{2}}\ {\isasymLongrightarrow}\isanewline
 113.843 -\isaindent{\ {\isadigit{7}}{\isachardot}\ \ \ \ }fib{\isadigit{2}}{\isacharunderscore}sumC\ n\ {\isacharplus}\ fib{\isadigit{2}}{\isacharunderscore}sumC\ {\isacharparenleft}Suc\ n{\isacharparenright}\ {\isacharequal}\ fib{\isadigit{2}}{\isacharunderscore}sumC\ na\ {\isacharplus}\ fib{\isadigit{2}}{\isacharunderscore}sumC\ {\isacharparenleft}Suc\ na{\isacharparenright}%
 113.844 -\end{isabelle}
 113.845 -
 113.846 -  This is an arithmetic triviality, but unfortunately the
 113.847 -  \isa{arith} method cannot handle this specific form of an
 113.848 -  elimination rule. However, we can use the method \isa{atomize{\isacharunderscore}elim} to do an ad-hoc conversion to a disjunction of
 113.849 -  existentials, which can then be solved by the arithmetic decision procedure.
 113.850 -  Pattern compatibility and termination are automatic as usual.%
 113.851 -\end{isamarkuptxt}%
 113.852 -\isamarkuptrue%
 113.853 -%
 113.854 -\endisatagproof
 113.855 -{\isafoldproof}%
 113.856 -%
 113.857 -\isadelimproof
 113.858 -%
 113.859 -\endisadelimproof
 113.860 -%
 113.861 -\isadelimML
 113.862 -%
 113.863 -\endisadelimML
 113.864 -%
 113.865 -\isatagML
 113.866 -%
 113.867 -\endisatagML
 113.868 -{\isafoldML}%
 113.869 -%
 113.870 -\isadelimML
 113.871 -%
 113.872 -\endisadelimML
 113.873 -%
 113.874 -\isadelimproof
 113.875 -%
 113.876 -\endisadelimproof
 113.877 -%
 113.878 -\isatagproof
 113.879 -\isacommand{apply}\isamarkupfalse%
 113.880 -\ atomize{\isacharunderscore}elim\isanewline
 113.881 -\isacommand{apply}\isamarkupfalse%
 113.882 -\ arith\isanewline
 113.883 -\isacommand{apply}\isamarkupfalse%
 113.884 -\ auto\isanewline
 113.885 -\isacommand{done}\isamarkupfalse%
 113.886 -%
 113.887 -\endisatagproof
 113.888 -{\isafoldproof}%
 113.889 -%
 113.890 -\isadelimproof
 113.891 -%
 113.892 -\endisadelimproof
 113.893 -\isanewline
 113.894 -\isacommand{termination}\isamarkupfalse%
 113.895 -%
 113.896 -\isadelimproof
 113.897 -\ %
 113.898 -\endisadelimproof
 113.899 -%
 113.900 -\isatagproof
 113.901 -\isacommand{by}\isamarkupfalse%
 113.902 -\ lexicographic{\isacharunderscore}order%
 113.903 -\endisatagproof
 113.904 -{\isafoldproof}%
 113.905 -%
 113.906 -\isadelimproof
 113.907 -%
 113.908 -\endisadelimproof
 113.909 -%
 113.910 -\begin{isamarkuptext}%
 113.911 -We can stretch the notion of pattern matching even more. The
 113.912 -  following function is not a sensible functional program, but a
 113.913 -  perfectly valid mathematical definition:%
 113.914 -\end{isamarkuptext}%
 113.915 -\isamarkuptrue%
 113.916 -\isacommand{function}\isamarkupfalse%
 113.917 -\ ev\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ bool{\isachardoublequoteclose}\isanewline
 113.918 -\isakeyword{where}\isanewline
 113.919 -\ \ {\isachardoublequoteopen}ev\ {\isacharparenleft}{\isadigit{2}}\ {\isacharasterisk}\ n{\isacharparenright}\ {\isacharequal}\ True{\isachardoublequoteclose}\isanewline
 113.920 -{\isacharbar}\ {\isachardoublequoteopen}ev\ {\isacharparenleft}{\isadigit{2}}\ {\isacharasterisk}\ n\ {\isacharplus}\ {\isadigit{1}}{\isacharparenright}\ {\isacharequal}\ False{\isachardoublequoteclose}\isanewline
 113.921 -%
 113.922 -\isadelimproof
 113.923 -%
 113.924 -\endisadelimproof
 113.925 -%
 113.926 -\isatagproof
 113.927 -\isacommand{apply}\isamarkupfalse%
 113.928 -\ atomize{\isacharunderscore}elim\isanewline
 113.929 -\isacommand{by}\isamarkupfalse%
 113.930 -\ arith{\isacharplus}%
 113.931 -\endisatagproof
 113.932 -{\isafoldproof}%
 113.933 -%
 113.934 -\isadelimproof
 113.935 -\isanewline
 113.936 -%
 113.937 -\endisadelimproof
 113.938 -\isacommand{termination}\isamarkupfalse%
 113.939 -%
 113.940 -\isadelimproof
 113.941 -\ %
 113.942 -\endisadelimproof
 113.943 -%
 113.944 -\isatagproof
 113.945 -\isacommand{by}\isamarkupfalse%
 113.946 -\ {\isacharparenleft}relation\ {\isachardoublequoteopen}{\isacharbraceleft}{\isacharbraceright}{\isachardoublequoteclose}{\isacharparenright}\ simp%
 113.947 -\endisatagproof
 113.948 -{\isafoldproof}%
 113.949 -%
 113.950 -\isadelimproof
 113.951 -%
 113.952 -\endisadelimproof
 113.953 -%
 113.954 -\begin{isamarkuptext}%
 113.955 -This general notion of pattern matching gives you a certain freedom
 113.956 -  in writing down specifications. However, as always, such freedom should
 113.957 -  be used with care:
 113.958 -
 113.959 -  If we leave the area of constructor
 113.960 -  patterns, we have effectively departed from the world of functional
 113.961 -  programming. This means that it is no longer possible to use the
 113.962 -  code generator, and expect it to generate ML code for our
 113.963 -  definitions. Also, such a specification might not work very well together with
 113.964 -  simplification. Your mileage may vary.%
 113.965 -\end{isamarkuptext}%
 113.966 -\isamarkuptrue%
 113.967 -%
 113.968 -\isamarkupsubsection{Conditional equations%
 113.969 -}
 113.970 -\isamarkuptrue%
 113.971 -%
 113.972 -\begin{isamarkuptext}%
 113.973 -The function package also supports conditional equations, which are
 113.974 -  similar to guards in a language like Haskell. Here is Euclid's
 113.975 -  algorithm written with conditional patterns\footnote{Note that the
 113.976 -  patterns are also overlapping in the base case}:%
 113.977 -\end{isamarkuptext}%
 113.978 -\isamarkuptrue%
 113.979 -\isacommand{function}\isamarkupfalse%
 113.980 -\ gcd\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ nat\ {\isasymRightarrow}\ nat{\isachardoublequoteclose}\isanewline
 113.981 -\isakeyword{where}\isanewline
 113.982 -\ \ {\isachardoublequoteopen}gcd\ x\ {\isadigit{0}}\ {\isacharequal}\ x{\isachardoublequoteclose}\isanewline
 113.983 -{\isacharbar}\ {\isachardoublequoteopen}gcd\ {\isadigit{0}}\ y\ {\isacharequal}\ y{\isachardoublequoteclose}\isanewline
 113.984 -{\isacharbar}\ {\isachardoublequoteopen}x\ {\isacharless}\ y\ {\isasymLongrightarrow}\ gcd\ {\isacharparenleft}Suc\ x{\isacharparenright}\ {\isacharparenleft}Suc\ y{\isacharparenright}\ {\isacharequal}\ gcd\ {\isacharparenleft}Suc\ x{\isacharparenright}\ {\isacharparenleft}y\ {\isacharminus}\ x{\isacharparenright}{\isachardoublequoteclose}\isanewline
 113.985 -{\isacharbar}\ {\isachardoublequoteopen}{\isasymnot}\ x\ {\isacharless}\ y\ {\isasymLongrightarrow}\ gcd\ {\isacharparenleft}Suc\ x{\isacharparenright}\ {\isacharparenleft}Suc\ y{\isacharparenright}\ {\isacharequal}\ gcd\ {\isacharparenleft}x\ {\isacharminus}\ y{\isacharparenright}\ {\isacharparenleft}Suc\ y{\isacharparenright}{\isachardoublequoteclose}\isanewline
 113.986 -%
 113.987 -\isadelimproof
 113.988 -%
 113.989 -\endisadelimproof
 113.990 -%
 113.991 -\isatagproof
 113.992 -\isacommand{by}\isamarkupfalse%
 113.993 -\ {\isacharparenleft}atomize{\isacharunderscore}elim{\isacharcomma}\ auto{\isacharcomma}\ arith{\isacharparenright}%
 113.994 -\endisatagproof
 113.995 -{\isafoldproof}%
 113.996 -%
 113.997 -\isadelimproof
 113.998 -\isanewline
 113.999 -%
113.1000 -\endisadelimproof
113.1001 -\isacommand{termination}\isamarkupfalse%
113.1002 -%
113.1003 -\isadelimproof
113.1004 -\ %
113.1005 -\endisadelimproof
113.1006 -%
113.1007 -\isatagproof
113.1008 -\isacommand{by}\isamarkupfalse%
113.1009 -\ lexicographic{\isacharunderscore}order%
113.1010 -\endisatagproof
113.1011 -{\isafoldproof}%
113.1012 -%
113.1013 -\isadelimproof
113.1014 -%
113.1015 -\endisadelimproof
113.1016 -%
113.1017 -\begin{isamarkuptext}%
113.1018 -By now, you can probably guess what the proof obligations for the
113.1019 -  pattern completeness and compatibility look like. 
113.1020 -
113.1021 -  Again, functions with conditional patterns are not supported by the
113.1022 -  code generator.%
113.1023 -\end{isamarkuptext}%
113.1024 -\isamarkuptrue%
113.1025 -%
113.1026 -\isamarkupsubsection{Pattern matching on strings%
113.1027 -}
113.1028 -\isamarkuptrue%
113.1029 -%
113.1030 -\begin{isamarkuptext}%
113.1031 -As strings (as lists of characters) are normal datatypes, pattern
113.1032 -  matching on them is possible, but somewhat problematic. Consider the
113.1033 -  following definition:
113.1034 -
113.1035 -\end{isamarkuptext}
113.1036 -\noindent\cmd{fun} \isa{check\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequote}string\ {\isasymRightarrow}\ bool{\isachardoublequote}}\\%
113.1037 -\cmd{where}\\%
113.1038 -\hspace*{2ex}\isa{{\isachardoublequote}check\ {\isacharparenleft}{\isacharprime}{\isacharprime}good{\isacharprime}{\isacharprime}{\isacharparenright}\ {\isacharequal}\ True{\isachardoublequote}}\\%
113.1039 -\isa{{\isacharbar}\ {\isachardoublequote}check\ s\ {\isacharequal}\ False{\isachardoublequote}}
113.1040 -\begin{isamarkuptext}
113.1041 -
113.1042 -  \noindent An invocation of the above \cmd{fun} command does not
113.1043 -  terminate. What is the problem? Strings are lists of characters, and
113.1044 -  characters are a datatype with a lot of constructors. Splitting the
113.1045 -  catch-all pattern thus leads to an explosion of cases, which cannot
113.1046 -  be handled by Isabelle.
113.1047 -
113.1048 -  There are two things we can do here. Either we write an explicit
113.1049 -  \isa{if} on the right hand side, or we can use conditional patterns:%
113.1050 -\end{isamarkuptext}%
113.1051 -\isamarkuptrue%
113.1052 -\isacommand{function}\isamarkupfalse%
113.1053 -\ check\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}string\ {\isasymRightarrow}\ bool{\isachardoublequoteclose}\isanewline
113.1054 -\isakeyword{where}\isanewline
113.1055 -\ \ {\isachardoublequoteopen}check\ {\isacharparenleft}{\isacharprime}{\isacharprime}good{\isacharprime}{\isacharprime}{\isacharparenright}\ {\isacharequal}\ True{\isachardoublequoteclose}\isanewline
113.1056 -{\isacharbar}\ {\isachardoublequoteopen}s\ {\isasymnoteq}\ {\isacharprime}{\isacharprime}good{\isacharprime}{\isacharprime}\ {\isasymLongrightarrow}\ check\ s\ {\isacharequal}\ False{\isachardoublequoteclose}\isanewline
113.1057 -%
113.1058 -\isadelimproof
113.1059 -%
113.1060 -\endisadelimproof
113.1061 -%
113.1062 -\isatagproof
113.1063 -\isacommand{by}\isamarkupfalse%
113.1064 -\ auto%
113.1065 -\endisatagproof
113.1066 -{\isafoldproof}%
113.1067 -%
113.1068 -\isadelimproof
113.1069 -%
113.1070 -\endisadelimproof
113.1071 -%
113.1072 -\isamarkupsection{Partiality%
113.1073 -}
113.1074 -\isamarkuptrue%
113.1075 -%
113.1076 -\begin{isamarkuptext}%
113.1077 -In HOL, all functions are total. A function \isa{f} applied to
113.1078 -  \isa{x} always has the value \isa{f\ x}, and there is no notion
113.1079 -  of undefinedness. 
113.1080 -  This is why we have to do termination
113.1081 -  proofs when defining functions: The proof justifies that the
113.1082 -  function can be defined by wellfounded recursion.
113.1083 -
113.1084 -  However, the \cmd{function} package does support partiality to a
113.1085 -  certain extent. Let's look at the following function which looks
113.1086 -  for a zero of a given function f.%
113.1087 -\end{isamarkuptext}%
113.1088 -\isamarkuptrue%
113.1089 -\isacommand{function}\isamarkupfalse%
113.1090 -\ findzero\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharparenleft}nat\ {\isasymRightarrow}\ nat{\isacharparenright}\ {\isasymRightarrow}\ nat\ {\isasymRightarrow}\ nat{\isachardoublequoteclose}\isanewline
113.1091 -\isakeyword{where}\isanewline
113.1092 -\ \ {\isachardoublequoteopen}findzero\ f\ n\ {\isacharequal}\ {\isacharparenleft}if\ f\ n\ {\isacharequal}\ {\isadigit{0}}\ then\ n\ else\ findzero\ f\ {\isacharparenleft}Suc\ n{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}\isanewline
113.1093 -%
113.1094 -\isadelimproof
113.1095 -%
113.1096 -\endisadelimproof
113.1097 -%
113.1098 -\isatagproof
113.1099 -\isacommand{by}\isamarkupfalse%
113.1100 -\ pat{\isacharunderscore}completeness\ auto%
113.1101 -\endisatagproof
113.1102 -{\isafoldproof}%
113.1103 -%
113.1104 -\isadelimproof
113.1105 -%
113.1106 -\endisadelimproof
113.1107 -%
113.1108 -\begin{isamarkuptext}%
113.1109 -\noindent Clearly, any attempt of a termination proof must fail. And without
113.1110 -  that, we do not get the usual rules \isa{findzero{\isachardot}simps} and 
113.1111 -  \isa{findzero{\isachardot}induct}. So what was the definition good for at all?%
113.1112 -\end{isamarkuptext}%
113.1113 -\isamarkuptrue%
113.1114 -%
113.1115 -\isamarkupsubsection{Domain predicates%
113.1116 -}
113.1117 -\isamarkuptrue%
113.1118 -%
113.1119 -\begin{isamarkuptext}%
113.1120 -The trick is that Isabelle has not only defined the function \isa{findzero}, but also
113.1121 -  a predicate \isa{findzero{\isacharunderscore}dom} that characterizes the values where the function
113.1122 -  terminates: the \emph{domain} of the function. If we treat a
113.1123 -  partial function just as a total function with an additional domain
113.1124 -  predicate, we can derive simplification and
113.1125 -  induction rules as we do for total functions. They are guarded
113.1126 -  by domain conditions and are called \isa{psimps} and \isa{pinduct}:%
113.1127 -\end{isamarkuptext}%
113.1128 -\isamarkuptrue%
113.1129 -%
113.1130 -\begin{isamarkuptext}%
113.1131 -\noindent\begin{minipage}{0.79\textwidth}\begin{isabelle}%
113.1132 -findzero{\isacharunderscore}dom\ {\isacharparenleft}{\isacharquery}f{\isacharcomma}\ {\isacharquery}n{\isacharparenright}\ {\isasymLongrightarrow}\isanewline
113.1133 -findzero\ {\isacharquery}f\ {\isacharquery}n\ {\isacharequal}\ {\isacharparenleft}if\ {\isacharquery}f\ {\isacharquery}n\ {\isacharequal}\ {\isadigit{0}}\ then\ {\isacharquery}n\ else\ findzero\ {\isacharquery}f\ {\isacharparenleft}Suc\ {\isacharquery}n{\isacharparenright}{\isacharparenright}%
113.1134 -\end{isabelle}\end{minipage}
113.1135 -  \hfill(\isa{findzero{\isachardot}psimps})
113.1136 -  \vspace{1em}
113.1137 -
113.1138 -  \noindent\begin{minipage}{0.79\textwidth}\begin{isabelle}%
113.1139 -{\isasymlbrakk}findzero{\isacharunderscore}dom\ {\isacharparenleft}{\isacharquery}a{\isadigit{0}}{\isachardot}{\isadigit{0}}{\isacharcomma}\ {\isacharquery}a{\isadigit{1}}{\isachardot}{\isadigit{0}}{\isacharparenright}{\isacharsemicolon}\isanewline
113.1140 -\isaindent{\ }{\isasymAnd}f\ n{\isachardot}\ {\isasymlbrakk}findzero{\isacharunderscore}dom\ {\isacharparenleft}f{\isacharcomma}\ n{\isacharparenright}{\isacharsemicolon}\ f\ n\ {\isasymnoteq}\ {\isadigit{0}}\ {\isasymLongrightarrow}\ {\isacharquery}P\ f\ {\isacharparenleft}Suc\ n{\isacharparenright}{\isasymrbrakk}\ {\isasymLongrightarrow}\ {\isacharquery}P\ f\ n{\isasymrbrakk}\isanewline
113.1141 -{\isasymLongrightarrow}\ {\isacharquery}P\ {\isacharquery}a{\isadigit{0}}{\isachardot}{\isadigit{0}}\ {\isacharquery}a{\isadigit{1}}{\isachardot}{\isadigit{0}}%
113.1142 -\end{isabelle}\end{minipage}
113.1143 -  \hfill(\isa{findzero{\isachardot}pinduct})%
113.1144 -\end{isamarkuptext}%
113.1145 -\isamarkuptrue%
113.1146 -%
113.1147 -\begin{isamarkuptext}%
113.1148 -Remember that all we
113.1149 -  are doing here is use some tricks to make a total function appear
113.1150 -  as if it was partial. We can still write the term \isa{findzero\ {\isacharparenleft}{\isasymlambda}x{\isachardot}\ {\isadigit{1}}{\isacharparenright}\ {\isadigit{0}}} and like any other term of type \isa{nat} it is equal
113.1151 -  to some natural number, although we might not be able to find out
113.1152 -  which one. The function is \emph{underdefined}.
113.1153 -
113.1154 -  But it is defined enough to prove something interesting about it. We
113.1155 -  can prove that if \isa{findzero\ f\ n}
113.1156 -  terminates, it indeed returns a zero of \isa{f}:%
113.1157 -\end{isamarkuptext}%
113.1158 -\isamarkuptrue%
113.1159 -\isacommand{lemma}\isamarkupfalse%
113.1160 -\ findzero{\isacharunderscore}zero{\isacharcolon}\ {\isachardoublequoteopen}findzero{\isacharunderscore}dom\ {\isacharparenleft}f{\isacharcomma}\ n{\isacharparenright}\ {\isasymLongrightarrow}\ f\ {\isacharparenleft}findzero\ f\ n{\isacharparenright}\ {\isacharequal}\ {\isadigit{0}}{\isachardoublequoteclose}%
113.1161 -\isadelimproof
113.1162 -%
113.1163 -\endisadelimproof
113.1164 -%
113.1165 -\isatagproof
113.1166 -%
113.1167 -\begin{isamarkuptxt}%
113.1168 -\noindent We apply induction as usual, but using the partial induction
113.1169 -  rule:%
113.1170 -\end{isamarkuptxt}%
113.1171 -\isamarkuptrue%
113.1172 -\isacommand{apply}\isamarkupfalse%
113.1173 -\ {\isacharparenleft}induct\ f\ n\ rule{\isacharcolon}\ findzero{\isachardot}pinduct{\isacharparenright}%
113.1174 -\begin{isamarkuptxt}%
113.1175 -\noindent This gives the following subgoals:
113.1176 -
113.1177 -  \begin{isabelle}%
113.1178 -\ {\isadigit{1}}{\isachardot}\ {\isasymAnd}f\ n{\isachardot}\ {\isasymlbrakk}findzero{\isacharunderscore}dom\ {\isacharparenleft}f{\isacharcomma}\ n{\isacharparenright}{\isacharsemicolon}\ f\ n\ {\isasymnoteq}\ {\isadigit{0}}\ {\isasymLongrightarrow}\ f\ {\isacharparenleft}findzero\ f\ {\isacharparenleft}Suc\ n{\isacharparenright}{\isacharparenright}\ {\isacharequal}\ {\isadigit{0}}{\isasymrbrakk}\isanewline
113.1179 -\isaindent{\ {\isadigit{1}}{\isachardot}\ {\isasymAnd}f\ n{\isachardot}\ }{\isasymLongrightarrow}\ f\ {\isacharparenleft}findzero\ f\ n{\isacharparenright}\ {\isacharequal}\ {\isadigit{0}}%
113.1180 -\end{isabelle}
113.1181 -
113.1182 -  \noindent The hypothesis in our lemma was used to satisfy the first premise in
113.1183 -  the induction rule. However, we also get \isa{findzero{\isacharunderscore}dom\ {\isacharparenleft}f{\isacharcomma}\ n{\isacharparenright}} as a local assumption in the induction step. This
113.1184 -  allows to unfold \isa{findzero\ f\ n} using the \isa{psimps}
113.1185 -  rule, and the rest is trivial. Since the \isa{psimps} rules carry the
113.1186 -  \isa{{\isacharbrackleft}simp{\isacharbrackright}} attribute by default, we just need a single step:%
113.1187 -\end{isamarkuptxt}%
113.1188 -\isamarkuptrue%
113.1189 -\isacommand{apply}\isamarkupfalse%
113.1190 -\ simp\isanewline
113.1191 -\isacommand{done}\isamarkupfalse%
113.1192 -%
113.1193 -\endisatagproof
113.1194 -{\isafoldproof}%
113.1195 -%
113.1196 -\isadelimproof
113.1197 -%
113.1198 -\endisadelimproof
113.1199 -%
113.1200 -\begin{isamarkuptext}%
113.1201 -Proofs about partial functions are often not harder than for total
113.1202 -  functions. Fig.~\ref{findzero_isar} shows a slightly more
113.1203 -  complicated proof written in Isar. It is verbose enough to show how
113.1204 -  partiality comes into play: From the partial induction, we get an
113.1205 -  additional domain condition hypothesis. Observe how this condition
113.1206 -  is applied when calls to \isa{findzero} are unfolded.%
113.1207 -\end{isamarkuptext}%
113.1208 -\isamarkuptrue%
113.1209 -%
113.1210 -\begin{figure}
113.1211 -\hrule\vspace{6pt}
113.1212 -\begin{minipage}{0.8\textwidth}
113.1213 -\isabellestyle{it}
113.1214 -\isastyle\isamarkuptrue
113.1215 -\isacommand{lemma}\isamarkupfalse%
113.1216 -\ {\isachardoublequoteopen}{\isasymlbrakk}findzero{\isacharunderscore}dom\ {\isacharparenleft}f{\isacharcomma}\ n{\isacharparenright}{\isacharsemicolon}\ x\ {\isasymin}\ {\isacharbraceleft}n\ {\isachardot}{\isachardot}{\isacharless}\ findzero\ f\ n{\isacharbraceright}{\isasymrbrakk}\ {\isasymLongrightarrow}\ f\ x\ {\isasymnoteq}\ {\isadigit{0}}{\isachardoublequoteclose}\isanewline
113.1217 -%
113.1218 -\isadelimproof
113.1219 -%
113.1220 -\endisadelimproof
113.1221 -%
113.1222 -\isatagproof
113.1223 -\isacommand{proof}\isamarkupfalse%
113.1224 -\ {\isacharparenleft}induct\ rule{\isacharcolon}\ findzero{\isachardot}pinduct{\isacharparenright}\isanewline
113.1225 -\ \ \isacommand{fix}\isamarkupfalse%
113.1226 -\ f\ n\ \isacommand{assume}\isamarkupfalse%
113.1227 -\ dom{\isacharcolon}\ {\isachardoublequoteopen}findzero{\isacharunderscore}dom\ {\isacharparenleft}f{\isacharcomma}\ n{\isacharparenright}{\isachardoublequoteclose}\isanewline
113.1228 -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \isakeyword{and}\ IH{\isacharcolon}\ {\isachardoublequoteopen}{\isasymlbrakk}f\ n\ {\isasymnoteq}\ {\isadigit{0}}{\isacharsemicolon}\ x\ {\isasymin}\ {\isacharbraceleft}Suc\ n\ {\isachardot}{\isachardot}{\isacharless}\ findzero\ f\ {\isacharparenleft}Suc\ n{\isacharparenright}{\isacharbraceright}{\isasymrbrakk}\ {\isasymLongrightarrow}\ f\ x\ {\isasymnoteq}\ {\isadigit{0}}{\isachardoublequoteclose}\isanewline
113.1229 -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \isakeyword{and}\ x{\isacharunderscore}range{\isacharcolon}\ {\isachardoublequoteopen}x\ {\isasymin}\ {\isacharbraceleft}n\ {\isachardot}{\isachardot}{\isacharless}\ findzero\ f\ n{\isacharbraceright}{\isachardoublequoteclose}\isanewline
113.1230 -\ \ \isacommand{have}\isamarkupfalse%
113.1231 -\ {\isachardoublequoteopen}f\ n\ {\isasymnoteq}\ {\isadigit{0}}{\isachardoublequoteclose}\isanewline
113.1232 -\ \ \isacommand{proof}\isamarkupfalse%
113.1233 -\ \isanewline
113.1234 -\ \ \ \ \isacommand{assume}\isamarkupfalse%
113.1235 -\ {\isachardoublequoteopen}f\ n\ {\isacharequal}\ {\isadigit{0}}{\isachardoublequoteclose}\isanewline
113.1236 -\ \ \ \ \isacommand{with}\isamarkupfalse%
113.1237 -\ dom\ \isacommand{have}\isamarkupfalse%
113.1238 -\ {\isachardoublequoteopen}findzero\ f\ n\ {\isacharequal}\ n{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
113.1239 -\ simp\isanewline
113.1240 -\ \ \ \ \isacommand{with}\isamarkupfalse%
113.1241 -\ x{\isacharunderscore}range\ \isacommand{show}\isamarkupfalse%
113.1242 -\ False\ \isacommand{by}\isamarkupfalse%
113.1243 -\ auto\isanewline
113.1244 -\ \ \isacommand{qed}\isamarkupfalse%
113.1245 -\isanewline
113.1246 -\ \ \isanewline
113.1247 -\ \ \isacommand{from}\isamarkupfalse%
113.1248 -\ x{\isacharunderscore}range\ \isacommand{have}\isamarkupfalse%
113.1249 -\ {\isachardoublequoteopen}x\ {\isacharequal}\ n\ {\isasymor}\ x\ {\isasymin}\ {\isacharbraceleft}Suc\ n\ {\isachardot}{\isachardot}{\isacharless}\ findzero\ f\ n{\isacharbraceright}{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
113.1250 -\ auto\isanewline
113.1251 -\ \ \isacommand{thus}\isamarkupfalse%
113.1252 -\ {\isachardoublequoteopen}f\ x\ {\isasymnoteq}\ {\isadigit{0}}{\isachardoublequoteclose}\isanewline
113.1253 -\ \ \isacommand{proof}\isamarkupfalse%
113.1254 -\isanewline
113.1255 -\ \ \ \ \isacommand{assume}\isamarkupfalse%
113.1256 -\ {\isachardoublequoteopen}x\ {\isacharequal}\ n{\isachardoublequoteclose}\isanewline
113.1257 -\ \ \ \ \isacommand{with}\isamarkupfalse%
113.1258 -\ {\isacharbackquoteopen}f\ n\ {\isasymnoteq}\ {\isadigit{0}}{\isacharbackquoteclose}\ \isacommand{show}\isamarkupfalse%
113.1259 -\ {\isacharquery}thesis\ \isacommand{by}\isamarkupfalse%
113.1260 -\ simp\isanewline
113.1261 -\ \ \isacommand{next}\isamarkupfalse%
113.1262 -\isanewline
113.1263 -\ \ \ \ \isacommand{assume}\isamarkupfalse%
113.1264 -\ {\isachardoublequoteopen}x\ {\isasymin}\ {\isacharbraceleft}Suc\ n\ {\isachardot}{\isachardot}{\isacharless}\ findzero\ f\ n{\isacharbraceright}{\isachardoublequoteclose}\isanewline
113.1265 -\ \ \ \ \isacommand{with}\isamarkupfalse%
113.1266 -\ dom\ \isakeyword{and}\ {\isacharbackquoteopen}f\ n\ {\isasymnoteq}\ {\isadigit{0}}{\isacharbackquoteclose}\ \isacommand{have}\isamarkupfalse%
113.1267 -\ {\isachardoublequoteopen}x\ {\isasymin}\ {\isacharbraceleft}Suc\ n\ {\isachardot}{\isachardot}{\isacharless}\ findzero\ f\ {\isacharparenleft}Suc\ n{\isacharparenright}{\isacharbraceright}{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
113.1268 -\ simp\isanewline
113.1269 -\ \ \ \ \isacommand{with}\isamarkupfalse%
113.1270 -\ IH\ \isakeyword{and}\ {\isacharbackquoteopen}f\ n\ {\isasymnoteq}\ {\isadigit{0}}{\isacharbackquoteclose}\isanewline
113.1271 -\ \ \ \ \isacommand{show}\isamarkupfalse%
113.1272 -\ {\isacharquery}thesis\ \isacommand{by}\isamarkupfalse%
113.1273 -\ simp\isanewline
113.1274 -\ \ \isacommand{qed}\isamarkupfalse%
113.1275 -\isanewline
113.1276 -\isacommand{qed}\isamarkupfalse%
113.1277 -%
113.1278 -\endisatagproof
113.1279 -{\isafoldproof}%
113.1280 -%
113.1281 -\isadelimproof
113.1282 -%
113.1283 -\endisadelimproof
113.1284 -%
113.1285 -\isamarkupfalse\isabellestyle{tt}
113.1286 -\end{minipage}\vspace{6pt}\hrule
113.1287 -\caption{A proof about a partial function}\label{findzero_isar}
113.1288 -\end{figure}
113.1289 -%
113.1290 -\isamarkupsubsection{Partial termination proofs%
113.1291 -}
113.1292 -\isamarkuptrue%
113.1293 -%
113.1294 -\begin{isamarkuptext}%
113.1295 -Now that we have proved some interesting properties about our
113.1296 -  function, we should turn to the domain predicate and see if it is
113.1297 -  actually true for some values. Otherwise we would have just proved
113.1298 -  lemmas with \isa{False} as a premise.
113.1299 -
113.1300 -  Essentially, we need some introduction rules for \isa{findzero{\isacharunderscore}dom}. The function package can prove such domain
113.1301 -  introduction rules automatically. But since they are not used very
113.1302 -  often (they are almost never needed if the function is total), this
113.1303 -  functionality is disabled by default for efficiency reasons. So we have to go
113.1304 -  back and ask for them explicitly by passing the \isa{{\isacharparenleft}domintros{\isacharparenright}} option to the function package:
113.1305 -
113.1306 -\vspace{1ex}
113.1307 -\noindent\cmd{function} \isa{{\isacharparenleft}domintros{\isacharparenright}\ findzero\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequote}{\isacharparenleft}nat\ {\isasymRightarrow}\ nat{\isacharparenright}\ {\isasymRightarrow}\ nat\ {\isasymRightarrow}\ nat{\isachardoublequote}}\\%
113.1308 -\cmd{where}\isanewline%
113.1309 -\ \ \ldots\\
113.1310 -
113.1311 -  \noindent Now the package has proved an introduction rule for \isa{findzero{\isacharunderscore}dom}:%
113.1312 -\end{isamarkuptext}%
113.1313 -\isamarkuptrue%
113.1314 -\isacommand{thm}\isamarkupfalse%
113.1315 -\ findzero{\isachardot}domintros%
113.1316 -\begin{isamarkuptext}%
113.1317 -\begin{isabelle}%
113.1318 -{\isacharparenleft}{\isadigit{0}}\ {\isacharless}\ {\isacharquery}f\ {\isacharquery}n\ {\isasymLongrightarrow}\ findzero{\isacharunderscore}dom\ {\isacharparenleft}{\isacharquery}f{\isacharcomma}\ Suc\ {\isacharquery}n{\isacharparenright}{\isacharparenright}\ {\isasymLongrightarrow}\ findzero{\isacharunderscore}dom\ {\isacharparenleft}{\isacharquery}f{\isacharcomma}\ {\isacharquery}n{\isacharparenright}%
113.1319 -\end{isabelle}
113.1320 -
113.1321 -  Domain introduction rules allow to show that a given value lies in the
113.1322 -  domain of a function, if the arguments of all recursive calls
113.1323 -  are in the domain as well. They allow to do a \qt{single step} in a
113.1324 -  termination proof. Usually, you want to combine them with a suitable
113.1325 -  induction principle.
113.1326 -
113.1327 -  Since our function increases its argument at recursive calls, we
113.1328 -  need an induction principle which works \qt{backwards}. We will use
113.1329 -  \isa{inc{\isacharunderscore}induct}, which allows to do induction from a fixed number
113.1330 -  \qt{downwards}:
113.1331 -
113.1332 -  \begin{center}\isa{{\isasymlbrakk}{\isacharquery}i\ {\isasymle}\ {\isacharquery}j{\isacharsemicolon}\ {\isacharquery}P\ {\isacharquery}j{\isacharsemicolon}\ {\isasymAnd}i{\isachardot}\ {\isasymlbrakk}i\ {\isacharless}\ {\isacharquery}j{\isacharsemicolon}\ {\isacharquery}P\ {\isacharparenleft}Suc\ i{\isacharparenright}{\isasymrbrakk}\ {\isasymLongrightarrow}\ {\isacharquery}P\ i{\isasymrbrakk}\ {\isasymLongrightarrow}\ {\isacharquery}P\ {\isacharquery}i}\hfill(\isa{inc{\isacharunderscore}induct})\end{center}
113.1333 -
113.1334 -  Figure \ref{findzero_term} gives a detailed Isar proof of the fact
113.1335 -  that \isa{findzero} terminates if there is a zero which is greater
113.1336 -  or equal to \isa{n}. First we derive two useful rules which will
113.1337 -  solve the base case and the step case of the induction. The
113.1338 -  induction is then straightforward, except for the unusual induction
113.1339 -  principle.%
113.1340 -\end{isamarkuptext}%
113.1341 -\isamarkuptrue%
113.1342 -%
113.1343 -\begin{figure}
113.1344 -\hrule\vspace{6pt}
113.1345 -\begin{minipage}{0.8\textwidth}
113.1346 -\isabellestyle{it}
113.1347 -\isastyle\isamarkuptrue
113.1348 -\isacommand{lemma}\isamarkupfalse%
113.1349 -\ findzero{\isacharunderscore}termination{\isacharcolon}\isanewline
113.1350 -\ \ \isakeyword{assumes}\ {\isachardoublequoteopen}x\ {\isasymge}\ n{\isachardoublequoteclose}\ \isakeyword{and}\ {\isachardoublequoteopen}f\ x\ {\isacharequal}\ {\isadigit{0}}{\isachardoublequoteclose}\isanewline
113.1351 -\ \ \isakeyword{shows}\ {\isachardoublequoteopen}findzero{\isacharunderscore}dom\ {\isacharparenleft}f{\isacharcomma}\ n{\isacharparenright}{\isachardoublequoteclose}\isanewline
113.1352 -%
113.1353 -\isadelimproof
113.1354 -%
113.1355 -\endisadelimproof
113.1356 -%
113.1357 -\isatagproof
113.1358 -\isacommand{proof}\isamarkupfalse%
113.1359 -\ {\isacharminus}\ \isanewline
113.1360 -\ \ \isacommand{have}\isamarkupfalse%
113.1361 -\ base{\isacharcolon}\ {\isachardoublequoteopen}findzero{\isacharunderscore}dom\ {\isacharparenleft}f{\isacharcomma}\ x{\isacharparenright}{\isachardoublequoteclose}\isanewline
113.1362 -\ \ \ \ \isacommand{by}\isamarkupfalse%
113.1363 -\ {\isacharparenleft}rule\ findzero{\isachardot}domintros{\isacharparenright}\ {\isacharparenleft}simp\ add{\isacharcolon}{\isacharbackquoteopen}f\ x\ {\isacharequal}\ {\isadigit{0}}{\isacharbackquoteclose}{\isacharparenright}\isanewline
113.1364 -\isanewline
113.1365 -\ \ \isacommand{have}\isamarkupfalse%
113.1366 -\ step{\isacharcolon}\ {\isachardoublequoteopen}{\isasymAnd}i{\isachardot}\ findzero{\isacharunderscore}dom\ {\isacharparenleft}f{\isacharcomma}\ Suc\ i{\isacharparenright}\ \isanewline
113.1367 -\ \ \ \ {\isasymLongrightarrow}\ findzero{\isacharunderscore}dom\ {\isacharparenleft}f{\isacharcomma}\ i{\isacharparenright}{\isachardoublequoteclose}\isanewline
113.1368 -\ \ \ \ \isacommand{by}\isamarkupfalse%
113.1369 -\ {\isacharparenleft}rule\ findzero{\isachardot}domintros{\isacharparenright}\ simp\isanewline
113.1370 -\isanewline
113.1371 -\ \ \isacommand{from}\isamarkupfalse%
113.1372 -\ {\isacharbackquoteopen}x\ {\isasymge}\ n{\isacharbackquoteclose}\ \isacommand{show}\isamarkupfalse%
113.1373 -\ {\isacharquery}thesis\isanewline
113.1374 -\ \ \isacommand{proof}\isamarkupfalse%
113.1375 -\ {\isacharparenleft}induct\ rule{\isacharcolon}inc{\isacharunderscore}induct{\isacharparenright}\isanewline
113.1376 -\ \ \ \ \isacommand{show}\isamarkupfalse%
113.1377 -\ {\isachardoublequoteopen}findzero{\isacharunderscore}dom\ {\isacharparenleft}f{\isacharcomma}\ x{\isacharparenright}{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
113.1378 -\ {\isacharparenleft}rule\ base{\isacharparenright}\isanewline
113.1379 -\ \ \isacommand{next}\isamarkupfalse%
113.1380 -\isanewline
113.1381 -\ \ \ \ \isacommand{fix}\isamarkupfalse%
113.1382 -\ i\ \isacommand{assume}\isamarkupfalse%
113.1383 -\ {\isachardoublequoteopen}findzero{\isacharunderscore}dom\ {\isacharparenleft}f{\isacharcomma}\ Suc\ i{\isacharparenright}{\isachardoublequoteclose}\isanewline
113.1384 -\ \ \ \ \isacommand{thus}\isamarkupfalse%
113.1385 -\ {\isachardoublequoteopen}findzero{\isacharunderscore}dom\ {\isacharparenleft}f{\isacharcomma}\ i{\isacharparenright}{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
113.1386 -\ {\isacharparenleft}rule\ step{\isacharparenright}\isanewline
113.1387 -\ \ \isacommand{qed}\isamarkupfalse%
113.1388 -\isanewline
113.1389 -\isacommand{qed}\isamarkupfalse%
113.1390 -%
113.1391 -\endisatagproof
113.1392 -{\isafoldproof}%
113.1393 -%
113.1394 -\isadelimproof
113.1395 -%
113.1396 -\endisadelimproof
113.1397 -%
113.1398 -\isamarkupfalse\isabellestyle{tt}
113.1399 -\end{minipage}\vspace{6pt}\hrule
113.1400 -\caption{Termination proof for \isa{findzero}}\label{findzero_term}
113.1401 -\end{figure}
113.1402 -%
113.1403 -\begin{isamarkuptext}%
113.1404 -Again, the proof given in Fig.~\ref{findzero_term} has a lot of
113.1405 -  detail in order to explain the principles. Using more automation, we
113.1406 -  can also have a short proof:%
113.1407 -\end{isamarkuptext}%
113.1408 -\isamarkuptrue%
113.1409 -\isacommand{lemma}\isamarkupfalse%
113.1410 -\ findzero{\isacharunderscore}termination{\isacharunderscore}short{\isacharcolon}\isanewline
113.1411 -\ \ \isakeyword{assumes}\ zero{\isacharcolon}\ {\isachardoublequoteopen}x\ {\isachargreater}{\isacharequal}\ n{\isachardoublequoteclose}\ \isanewline
113.1412 -\ \ \isakeyword{assumes}\ {\isacharbrackleft}simp{\isacharbrackright}{\isacharcolon}\ {\isachardoublequoteopen}f\ x\ {\isacharequal}\ {\isadigit{0}}{\isachardoublequoteclose}\isanewline
113.1413 -\ \ \isakeyword{shows}\ {\isachardoublequoteopen}findzero{\isacharunderscore}dom\ {\isacharparenleft}f{\isacharcomma}\ n{\isacharparenright}{\isachardoublequoteclose}\isanewline
113.1414 -%
113.1415 -\isadelimproof
113.1416 -%
113.1417 -\endisadelimproof
113.1418 -%
113.1419 -\isatagproof
113.1420 -\isacommand{using}\isamarkupfalse%
113.1421 -\ zero\isanewline
113.1422 -\isacommand{by}\isamarkupfalse%
113.1423 -\ {\isacharparenleft}induct\ rule{\isacharcolon}inc{\isacharunderscore}induct{\isacharparenright}\ {\isacharparenleft}auto\ intro{\isacharcolon}\ findzero{\isachardot}domintros{\isacharparenright}%
113.1424 -\endisatagproof
113.1425 -{\isafoldproof}%
113.1426 -%
113.1427 -\isadelimproof
113.1428 -%
113.1429 -\endisadelimproof
113.1430 -%
113.1431 -\begin{isamarkuptext}%
113.1432 -\noindent It is simple to combine the partial correctness result with the
113.1433 -  termination lemma:%
113.1434 -\end{isamarkuptext}%
113.1435 -\isamarkuptrue%
113.1436 -\isacommand{lemma}\isamarkupfalse%
113.1437 -\ findzero{\isacharunderscore}total{\isacharunderscore}correctness{\isacharcolon}\isanewline
113.1438 -\ \ {\isachardoublequoteopen}f\ x\ {\isacharequal}\ {\isadigit{0}}\ {\isasymLongrightarrow}\ f\ {\isacharparenleft}findzero\ f\ {\isadigit{0}}{\isacharparenright}\ {\isacharequal}\ {\isadigit{0}}{\isachardoublequoteclose}\isanewline
113.1439 -%
113.1440 -\isadelimproof
113.1441 -%
113.1442 -\endisadelimproof
113.1443 -%
113.1444 -\isatagproof
113.1445 -\isacommand{by}\isamarkupfalse%
113.1446 -\ {\isacharparenleft}blast\ intro{\isacharcolon}\ findzero{\isacharunderscore}zero\ findzero{\isacharunderscore}termination{\isacharparenright}%
113.1447 -\endisatagproof
113.1448 -{\isafoldproof}%
113.1449 -%
113.1450 -\isadelimproof
113.1451 -%
113.1452 -\endisadelimproof
113.1453 -%
113.1454 -\isamarkupsubsection{Definition of the domain predicate%
113.1455 -}
113.1456 -\isamarkuptrue%
113.1457 -%
113.1458 -\begin{isamarkuptext}%
113.1459 -Sometimes it is useful to know what the definition of the domain
113.1460 -  predicate looks like. Actually, \isa{findzero{\isacharunderscore}dom} is just an
113.1461 -  abbreviation:
113.1462 -
113.1463 -  \begin{isabelle}%
113.1464 -findzero{\isacharunderscore}dom\ {\isasymequiv}\ accp\ findzero{\isacharunderscore}rel%
113.1465 -\end{isabelle}
113.1466 -
113.1467 -  The domain predicate is the \emph{accessible part} of a relation \isa{findzero{\isacharunderscore}rel}, which was also created internally by the function
113.1468 -  package. \isa{findzero{\isacharunderscore}rel} is just a normal
113.1469 -  inductive predicate, so we can inspect its definition by
113.1470 -  looking at the introduction rules \isa{findzero{\isacharunderscore}rel{\isachardot}intros}.
113.1471 -  In our case there is just a single rule:
113.1472 -
113.1473 -  \begin{isabelle}%
113.1474 -{\isacharquery}f\ {\isacharquery}n\ {\isasymnoteq}\ {\isadigit{0}}\ {\isasymLongrightarrow}\ findzero{\isacharunderscore}rel\ {\isacharparenleft}{\isacharquery}f{\isacharcomma}\ Suc\ {\isacharquery}n{\isacharparenright}\ {\isacharparenleft}{\isacharquery}f{\isacharcomma}\ {\isacharquery}n{\isacharparenright}%
113.1475 -\end{isabelle}
113.1476 -
113.1477 -  The predicate \isa{findzero{\isacharunderscore}rel}
113.1478 -  describes the \emph{recursion relation} of the function
113.1479 -  definition. The recursion relation is a binary relation on
113.1480 -  the arguments of the function that relates each argument to its
113.1481 -  recursive calls. In general, there is one introduction rule for each
113.1482 -  recursive call.
113.1483 -
113.1484 -  The predicate \isa{findzero{\isacharunderscore}dom} is the accessible part of
113.1485 -  that relation. An argument belongs to the accessible part, if it can
113.1486 -  be reached in a finite number of steps (cf.~its definition in \isa{Wellfounded{\isachardot}thy}).
113.1487 -
113.1488 -  Since the domain predicate is just an abbreviation, you can use
113.1489 -  lemmas for \isa{accp} and \isa{findzero{\isacharunderscore}rel} directly. Some
113.1490 -  lemmas which are occasionally useful are \isa{accpI}, \isa{accp{\isacharunderscore}downward}, and of course the introduction and elimination rules
113.1491 -  for the recursion relation \isa{findzero{\isachardot}intros} and \isa{findzero{\isachardot}cases}.%
113.1492 -\end{isamarkuptext}%
113.1493 -\isamarkuptrue%
113.1494 -%
113.1495 -\isamarkupsubsection{A Useful Special Case: Tail recursion%
113.1496 -}
113.1497 -\isamarkuptrue%
113.1498 -%
113.1499 -\begin{isamarkuptext}%
113.1500 -The domain predicate is our trick that allows us to model partiality
113.1501 -  in a world of total functions. The downside of this is that we have
113.1502 -  to carry it around all the time. The termination proof above allowed
113.1503 -  us to replace the abstract \isa{findzero{\isacharunderscore}dom\ {\isacharparenleft}f{\isacharcomma}\ n{\isacharparenright}} by the more
113.1504 -  concrete \isa{n\ {\isasymle}\ x\ {\isasymand}\ f\ x\ {\isacharequal}\ {\isadigit{0}}}, but the condition is still
113.1505 -  there and can only be discharged for special cases.
113.1506 -  In particular, the domain predicate guards the unfolding of our
113.1507 -  function, since it is there as a condition in the \isa{psimp}
113.1508 -  rules. 
113.1509 -
113.1510 -  Now there is an important special case: We can actually get rid
113.1511 -  of the condition in the simplification rules, \emph{if the function
113.1512 -  is tail-recursive}. The reason is that for all tail-recursive
113.1513 -  equations there is a total function satisfying them, even if they
113.1514 -  are non-terminating. 
113.1515 -
113.1516 -%  A function is tail recursive, if each call to the function is either
113.1517 -%  equal
113.1518 -%
113.1519 -%  So the outer form of the 
113.1520 -%
113.1521 -%if it can be written in the following
113.1522 -%  form:
113.1523 -%  {term[display] "f x = (if COND x then BASE x else f (LOOP x))"}
113.1524 -
113.1525 -
113.1526 -  The function package internally does the right construction and can
113.1527 -  derive the unconditional simp rules, if we ask it to do so. Luckily,
113.1528 -  our \isa{findzero} function is tail-recursive, so we can just go
113.1529 -  back and add another option to the \cmd{function} command:
113.1530 -
113.1531 -\vspace{1ex}
113.1532 -\noindent\cmd{function} \isa{{\isacharparenleft}domintros{\isacharcomma}\ tailrec{\isacharparenright}\ findzero\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequote}{\isacharparenleft}nat\ {\isasymRightarrow}\ nat{\isacharparenright}\ {\isasymRightarrow}\ nat\ {\isasymRightarrow}\ nat{\isachardoublequote}}\\%
113.1533 -\cmd{where}\isanewline%
113.1534 -\ \ \ldots\\%
113.1535 -
113.1536 -  
113.1537 -  \noindent Now, we actually get unconditional simplification rules, even
113.1538 -  though the function is partial:%
113.1539 -\end{isamarkuptext}%
113.1540 -\isamarkuptrue%
113.1541 -\isacommand{thm}\isamarkupfalse%
113.1542 -\ findzero{\isachardot}simps%
113.1543 -\begin{isamarkuptext}%
113.1544 -\begin{isabelle}%
113.1545 -findzero\ {\isacharquery}f\ {\isacharquery}n\ {\isacharequal}\ {\isacharparenleft}if\ {\isacharquery}f\ {\isacharquery}n\ {\isacharequal}\ {\isadigit{0}}\ then\ {\isacharquery}n\ else\ findzero\ {\isacharquery}f\ {\isacharparenleft}Suc\ {\isacharquery}n{\isacharparenright}{\isacharparenright}%
113.1546 -\end{isabelle}
113.1547 -
113.1548 -  \noindent Of course these would make the simplifier loop, so we better remove
113.1549 -  them from the simpset:%
113.1550 -\end{isamarkuptext}%
113.1551 -\isamarkuptrue%
113.1552 -\isacommand{declare}\isamarkupfalse%
113.1553 -\ findzero{\isachardot}simps{\isacharbrackleft}simp\ del{\isacharbrackright}%
113.1554 -\begin{isamarkuptext}%
113.1555 -Getting rid of the domain conditions in the simplification rules is
113.1556 -  not only useful because it simplifies proofs. It is also required in
113.1557 -  order to use Isabelle's code generator to generate ML code
113.1558 -  from a function definition.
113.1559 -  Since the code generator only works with equations, it cannot be
113.1560 -  used with \isa{psimp} rules. Thus, in order to generate code for
113.1561 -  partial functions, they must be defined as a tail recursion.
113.1562 -  Luckily, many functions have a relatively natural tail recursive
113.1563 -  definition.%
113.1564 -\end{isamarkuptext}%
113.1565 -\isamarkuptrue%
113.1566 -%
113.1567 -\isamarkupsection{Nested recursion%
113.1568 -}
113.1569 -\isamarkuptrue%
113.1570 -%
113.1571 -\begin{isamarkuptext}%
113.1572 -Recursive calls which are nested in one another frequently cause
113.1573 -  complications, since their termination proof can depend on a partial
113.1574 -  correctness property of the function itself. 
113.1575 -
113.1576 -  As a small example, we define the \qt{nested zero} function:%
113.1577 -\end{isamarkuptext}%
113.1578 -\isamarkuptrue%
113.1579 -\isacommand{function}\isamarkupfalse%
113.1580 -\ nz\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ nat{\isachardoublequoteclose}\isanewline
113.1581 -\isakeyword{where}\isanewline
113.1582 -\ \ {\isachardoublequoteopen}nz\ {\isadigit{0}}\ {\isacharequal}\ {\isadigit{0}}{\isachardoublequoteclose}\isanewline
113.1583 -{\isacharbar}\ {\isachardoublequoteopen}nz\ {\isacharparenleft}Suc\ n{\isacharparenright}\ {\isacharequal}\ nz\ {\isacharparenleft}nz\ n{\isacharparenright}{\isachardoublequoteclose}\isanewline
113.1584 -%
113.1585 -\isadelimproof
113.1586 -%
113.1587 -\endisadelimproof
113.1588 -%
113.1589 -\isatagproof
113.1590 -\isacommand{by}\isamarkupfalse%
113.1591 -\ pat{\isacharunderscore}completeness\ auto%
113.1592 -\endisatagproof
113.1593 -{\isafoldproof}%
113.1594 -%
113.1595 -\isadelimproof
113.1596 -%
113.1597 -\endisadelimproof
113.1598 -%
113.1599 -\begin{isamarkuptext}%
113.1600 -If we attempt to prove termination using the identity measure on
113.1601 -  naturals, this fails:%
113.1602 -\end{isamarkuptext}%
113.1603 -\isamarkuptrue%
113.1604 -\isacommand{termination}\isamarkupfalse%
113.1605 -\isanewline
113.1606 -%
113.1607 -\isadelimproof
113.1608 -\ \ %
113.1609 -\endisadelimproof
113.1610 -%
113.1611 -\isatagproof
113.1612 -\isacommand{apply}\isamarkupfalse%
113.1613 -\ {\isacharparenleft}relation\ {\isachardoublequoteopen}measure\ {\isacharparenleft}{\isasymlambda}n{\isachardot}\ n{\isacharparenright}{\isachardoublequoteclose}{\isacharparenright}\isanewline
113.1614 -\ \ \isacommand{apply}\isamarkupfalse%
113.1615 -\ auto%
113.1616 -\begin{isamarkuptxt}%
113.1617 -We get stuck with the subgoal
113.1618 -
113.1619 -  \begin{isabelle}%
113.1620 -\ {\isadigit{1}}{\isachardot}\ {\isasymAnd}n{\isachardot}\ nz{\isacharunderscore}dom\ n\ {\isasymLongrightarrow}\ nz\ n\ {\isacharless}\ Suc\ n%
113.1621 -\end{isabelle}
113.1622 -
113.1623 -  Of course this statement is true, since we know that \isa{nz} is
113.1624 -  the zero function. And in fact we have no problem proving this
113.1625 -  property by induction.%
113.1626 -\end{isamarkuptxt}%
113.1627 -\isamarkuptrue%
113.1628 -%
113.1629 -\endisatagproof
113.1630 -{\isafoldproof}%
113.1631 -%
113.1632 -\isadelimproof
113.1633 -%
113.1634 -\endisadelimproof
113.1635 -\isacommand{lemma}\isamarkupfalse%
113.1636 -\ nz{\isacharunderscore}is{\isacharunderscore}zero{\isacharcolon}\ {\isachardoublequoteopen}nz{\isacharunderscore}dom\ n\ {\isasymLongrightarrow}\ nz\ n\ {\isacharequal}\ {\isadigit{0}}{\isachardoublequoteclose}\isanewline
113.1637 -%
113.1638 -\isadelimproof
113.1639 -\ \ %
113.1640 -\endisadelimproof
113.1641 -%
113.1642 -\isatagproof
113.1643 -\isacommand{by}\isamarkupfalse%
113.1644 -\ {\isacharparenleft}induct\ rule{\isacharcolon}nz{\isachardot}pinduct{\isacharparenright}\ auto%
113.1645 -\endisatagproof
113.1646 -{\isafoldproof}%
113.1647 -%
113.1648 -\isadelimproof
113.1649 -%
113.1650 -\endisadelimproof
113.1651 -%
113.1652 -\begin{isamarkuptext}%
113.1653 -We formulate this as a partial correctness lemma with the condition
113.1654 -  \isa{nz{\isacharunderscore}dom\ n}. This allows us to prove it with the \isa{pinduct} rule before we have proved termination. With this lemma,
113.1655 -  the termination proof works as expected:%
113.1656 -\end{isamarkuptext}%
113.1657 -\isamarkuptrue%
113.1658 -\isacommand{termination}\isamarkupfalse%
113.1659 -\isanewline
113.1660 -%
113.1661 -\isadelimproof
113.1662 -\ \ %
113.1663 -\endisadelimproof
113.1664 -%
113.1665 -\isatagproof
113.1666 -\isacommand{by}\isamarkupfalse%
113.1667 -\ {\isacharparenleft}relation\ {\isachardoublequoteopen}measure\ {\isacharparenleft}{\isasymlambda}n{\isachardot}\ n{\isacharparenright}{\isachardoublequoteclose}{\isacharparenright}\ {\isacharparenleft}auto\ simp{\isacharcolon}\ nz{\isacharunderscore}is{\isacharunderscore}zero{\isacharparenright}%
113.1668 -\endisatagproof
113.1669 -{\isafoldproof}%
113.1670 -%
113.1671 -\isadelimproof
113.1672 -%
113.1673 -\endisadelimproof
113.1674 -%
113.1675 -\begin{isamarkuptext}%
113.1676 -As a general strategy, one should prove the statements needed for
113.1677 -  termination as a partial property first. Then they can be used to do
113.1678 -  the termination proof. This also works for less trivial
113.1679 -  examples. Figure \ref{f91} defines the 91-function, a well-known
113.1680 -  challenge problem due to John McCarthy, and proves its termination.%
113.1681 -\end{isamarkuptext}%
113.1682 -\isamarkuptrue%
113.1683 -%
113.1684 -\begin{figure}
113.1685 -\hrule\vspace{6pt}
113.1686 -\begin{minipage}{0.8\textwidth}
113.1687 -\isabellestyle{it}
113.1688 -\isastyle\isamarkuptrue
113.1689 -\isacommand{function}\isamarkupfalse%
113.1690 -\ f{\isadigit{9}}{\isadigit{1}}\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ nat{\isachardoublequoteclose}\isanewline
113.1691 -\isakeyword{where}\isanewline
113.1692 -\ \ {\isachardoublequoteopen}f{\isadigit{9}}{\isadigit{1}}\ n\ {\isacharequal}\ {\isacharparenleft}if\ {\isadigit{1}}{\isadigit{0}}{\isadigit{0}}\ {\isacharless}\ n\ then\ n\ {\isacharminus}\ {\isadigit{1}}{\isadigit{0}}\ else\ f{\isadigit{9}}{\isadigit{1}}\ {\isacharparenleft}f{\isadigit{9}}{\isadigit{1}}\ {\isacharparenleft}n\ {\isacharplus}\ {\isadigit{1}}{\isadigit{1}}{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}\isanewline
113.1693 -%
113.1694 -\isadelimproof
113.1695 -%
113.1696 -\endisadelimproof
113.1697 -%
113.1698 -\isatagproof
113.1699 -\isacommand{by}\isamarkupfalse%
113.1700 -\ pat{\isacharunderscore}completeness\ auto%
113.1701 -\endisatagproof
113.1702 -{\isafoldproof}%
113.1703 -%
113.1704 -\isadelimproof
113.1705 -\isanewline
113.1706 -%
113.1707 -\endisadelimproof
113.1708 -\isanewline
113.1709 -\isacommand{lemma}\isamarkupfalse%
113.1710 -\ f{\isadigit{9}}{\isadigit{1}}{\isacharunderscore}estimate{\isacharcolon}\ \isanewline
113.1711 -\ \ \isakeyword{assumes}\ trm{\isacharcolon}\ {\isachardoublequoteopen}f{\isadigit{9}}{\isadigit{1}}{\isacharunderscore}dom\ n{\isachardoublequoteclose}\ \isanewline
113.1712 -\ \ \isakeyword{shows}\ {\isachardoublequoteopen}n\ {\isacharless}\ f{\isadigit{9}}{\isadigit{1}}\ n\ {\isacharplus}\ {\isadigit{1}}{\isadigit{1}}{\isachardoublequoteclose}\isanewline
113.1713 -%
113.1714 -\isadelimproof
113.1715 -%
113.1716 -\endisadelimproof
113.1717 -%
113.1718 -\isatagproof
113.1719 -\isacommand{using}\isamarkupfalse%
113.1720 -\ trm\ \isacommand{by}\isamarkupfalse%
113.1721 -\ induct\ auto%
113.1722 -\endisatagproof
113.1723 -{\isafoldproof}%
113.1724 -%
113.1725 -\isadelimproof
113.1726 -\isanewline
113.1727 -%
113.1728 -\endisadelimproof
113.1729 -\isanewline
113.1730 -\isacommand{termination}\isamarkupfalse%
113.1731 -\isanewline
113.1732 -%
113.1733 -\isadelimproof
113.1734 -%
113.1735 -\endisadelimproof
113.1736 -%
113.1737 -\isatagproof
113.1738 -\isacommand{proof}\isamarkupfalse%
113.1739 -\isanewline
113.1740 -\ \ \isacommand{let}\isamarkupfalse%
113.1741 -\ {\isacharquery}R\ {\isacharequal}\ {\isachardoublequoteopen}measure\ {\isacharparenleft}{\isasymlambda}x{\isachardot}\ {\isadigit{1}}{\isadigit{0}}{\isadigit{1}}\ {\isacharminus}\ x{\isacharparenright}{\isachardoublequoteclose}\isanewline
113.1742 -\ \ \isacommand{show}\isamarkupfalse%
113.1743 -\ {\isachardoublequoteopen}wf\ {\isacharquery}R{\isachardoublequoteclose}\ \isacommand{{\isachardot}{\isachardot}}\isamarkupfalse%
113.1744 -\isanewline
113.1745 -\isanewline
113.1746 -\ \ \isacommand{fix}\isamarkupfalse%
113.1747 -\ n\ {\isacharcolon}{\isacharcolon}\ nat\ \isacommand{assume}\isamarkupfalse%
113.1748 -\ {\isachardoublequoteopen}{\isasymnot}\ {\isadigit{1}}{\isadigit{0}}{\isadigit{0}}\ {\isacharless}\ n{\isachardoublequoteclose}\ %
113.1749 -\isamarkupcmt{Assumptions for both calls%
113.1750 -}
113.1751 -\isanewline
113.1752 -\isanewline
113.1753 -\ \ \isacommand{thus}\isamarkupfalse%
113.1754 -\ {\isachardoublequoteopen}{\isacharparenleft}n\ {\isacharplus}\ {\isadigit{1}}{\isadigit{1}}{\isacharcomma}\ n{\isacharparenright}\ {\isasymin}\ {\isacharquery}R{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
113.1755 -\ simp\ %
113.1756 -\isamarkupcmt{Inner call%
113.1757 -}
113.1758 -\isanewline
113.1759 -\isanewline
113.1760 -\ \ \isacommand{assume}\isamarkupfalse%
113.1761 -\ inner{\isacharunderscore}trm{\isacharcolon}\ {\isachardoublequoteopen}f{\isadigit{9}}{\isadigit{1}}{\isacharunderscore}dom\ {\isacharparenleft}n\ {\isacharplus}\ {\isadigit{1}}{\isadigit{1}}{\isacharparenright}{\isachardoublequoteclose}\ %
113.1762 -\isamarkupcmt{Outer call%
113.1763 -}
113.1764 -\isanewline
113.1765 -\ \ \isacommand{with}\isamarkupfalse%
113.1766 -\ f{\isadigit{9}}{\isadigit{1}}{\isacharunderscore}estimate\ \isacommand{have}\isamarkupfalse%
113.1767 -\ {\isachardoublequoteopen}n\ {\isacharplus}\ {\isadigit{1}}{\isadigit{1}}\ {\isacharless}\ f{\isadigit{9}}{\isadigit{1}}\ {\isacharparenleft}n\ {\isacharplus}\ {\isadigit{1}}{\isadigit{1}}{\isacharparenright}\ {\isacharplus}\ {\isadigit{1}}{\isadigit{1}}{\isachardoublequoteclose}\ \isacommand{{\isachardot}}\isamarkupfalse%
113.1768 -\isanewline
113.1769 -\ \ \isacommand{with}\isamarkupfalse%
113.1770 -\ {\isacharbackquoteopen}{\isasymnot}\ {\isadigit{1}}{\isadigit{0}}{\isadigit{0}}\ {\isacharless}\ n{\isacharbackquoteclose}\ \isacommand{show}\isamarkupfalse%
113.1771 -\ {\isachardoublequoteopen}{\isacharparenleft}f{\isadigit{9}}{\isadigit{1}}\ {\isacharparenleft}n\ {\isacharplus}\ {\isadigit{1}}{\isadigit{1}}{\isacharparenright}{\isacharcomma}\ n{\isacharparenright}\ {\isasymin}\ {\isacharquery}R{\isachardoublequoteclose}\ \isacommand{by}\isamarkupfalse%
113.1772 -\ simp\isanewline
113.1773 -\isacommand{qed}\isamarkupfalse%
113.1774 -%
113.1775 -\endisatagproof
113.1776 -{\isafoldproof}%
113.1777 -%
113.1778 -\isadelimproof
113.1779 -%
113.1780 -\endisadelimproof
113.1781 -%
113.1782 -\isamarkupfalse\isabellestyle{tt}
113.1783 -\end{minipage}
113.1784 -\vspace{6pt}\hrule
113.1785 -\caption{McCarthy's 91-function}\label{f91}
113.1786 -\end{figure}
113.1787 -%
113.1788 -\isamarkupsection{Higher-Order Recursion%
113.1789 -}
113.1790 -\isamarkuptrue%
113.1791 -%
113.1792 -\begin{isamarkuptext}%
113.1793 -Higher-order recursion occurs when recursive calls
113.1794 -  are passed as arguments to higher-order combinators such as \isa{map}, \isa{filter} etc.
113.1795 -  As an example, imagine a datatype of n-ary trees:%
113.1796 -\end{isamarkuptext}%
113.1797 -\isamarkuptrue%
113.1798 -\isacommand{datatype}\isamarkupfalse%
113.1799 -\ {\isacharprime}a\ tree\ {\isacharequal}\ \isanewline
113.1800 -\ \ Leaf\ {\isacharprime}a\ \isanewline
113.1801 -{\isacharbar}\ Branch\ {\isachardoublequoteopen}{\isacharprime}a\ tree\ list{\isachardoublequoteclose}%
113.1802 -\begin{isamarkuptext}%
113.1803 -\noindent We can define a function which swaps the left and right subtrees recursively, using the 
113.1804 -  list functions \isa{rev} and \isa{map}:%
113.1805 -\end{isamarkuptext}%
113.1806 -\isamarkuptrue%
113.1807 -\isacommand{fun}\isamarkupfalse%
113.1808 -\ mirror\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}{\isacharprime}a\ tree\ {\isasymRightarrow}\ {\isacharprime}a\ tree{\isachardoublequoteclose}\isanewline
113.1809 -\isakeyword{where}\isanewline
113.1810 -\ \ {\isachardoublequoteopen}mirror\ {\isacharparenleft}Leaf\ n{\isacharparenright}\ {\isacharequal}\ Leaf\ n{\isachardoublequoteclose}\isanewline
113.1811 -{\isacharbar}\ {\isachardoublequoteopen}mirror\ {\isacharparenleft}Branch\ l{\isacharparenright}\ {\isacharequal}\ Branch\ {\isacharparenleft}rev\ {\isacharparenleft}map\ mirror\ l{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}%
113.1812 -\begin{isamarkuptext}%
113.1813 -Although the definition is accepted without problems, let us look at the termination proof:%
113.1814 -\end{isamarkuptext}%
113.1815 -\isamarkuptrue%
113.1816 -\isacommand{termination}\isamarkupfalse%
113.1817 -%
113.1818 -\isadelimproof
113.1819 -\ %
113.1820 -\endisadelimproof
113.1821 -%
113.1822 -\isatagproof
113.1823 -\isacommand{proof}\isamarkupfalse%
113.1824 -%
113.1825 -\begin{isamarkuptxt}%
113.1826 -As usual, we have to give a wellfounded relation, such that the
113.1827 -  arguments of the recursive calls get smaller. But what exactly are
113.1828 -  the arguments of the recursive calls when mirror is given as an
113.1829 -  argument to \isa{map}? Isabelle gives us the
113.1830 -  subgoals
113.1831 -
113.1832 -  \begin{isabelle}%
113.1833 -\ {\isadigit{1}}{\isachardot}\ wf\ {\isacharquery}R\isanewline
113.1834 -\ {\isadigit{2}}{\isachardot}\ {\isasymAnd}l\ x{\isachardot}\ x\ {\isasymin}\ set\ l\ {\isasymLongrightarrow}\ {\isacharparenleft}x{\isacharcomma}\ Branch\ l{\isacharparenright}\ {\isasymin}\ {\isacharquery}R%
113.1835 -\end{isabelle} 
113.1836 -
113.1837 -  So the system seems to know that \isa{map} only
113.1838 -  applies the recursive call \isa{mirror} to elements
113.1839 -  of \isa{l}, which is essential for the termination proof.
113.1840 -
113.1841 -  This knowledge about \isa{map} is encoded in so-called congruence rules,
113.1842 -  which are special theorems known to the \cmd{function} command. The
113.1843 -  rule for \isa{map} is
113.1844 -
113.1845 -  \begin{isabelle}%
113.1846 -{\isasymlbrakk}{\isacharquery}xs\ {\isacharequal}\ {\isacharquery}ys{\isacharsemicolon}\ {\isasymAnd}x{\isachardot}\ x\ {\isasymin}\ set\ {\isacharquery}ys\ {\isasymLongrightarrow}\ {\isacharquery}f\ x\ {\isacharequal}\ {\isacharquery}g\ x{\isasymrbrakk}\ {\isasymLongrightarrow}\ map\ {\isacharquery}f\ {\isacharquery}xs\ {\isacharequal}\ map\ {\isacharquery}g\ {\isacharquery}ys%
113.1847 -\end{isabelle}
113.1848 -
113.1849 -  You can read this in the following way: Two applications of \isa{map} are equal, if the list arguments are equal and the functions
113.1850 -  coincide on the elements of the list. This means that for the value 
113.1851 -  \isa{map\ f\ l} we only have to know how \isa{f} behaves on
113.1852 -  the elements of \isa{l}.
113.1853 -
113.1854 -  Usually, one such congruence rule is
113.1855 -  needed for each higher-order construct that is used when defining
113.1856 -  new functions. In fact, even basic functions like \isa{If} and \isa{Let} are handled by this mechanism. The congruence
113.1857 -  rule for \isa{If} states that the \isa{then} branch is only
113.1858 -  relevant if the condition is true, and the \isa{else} branch only if it
113.1859 -  is false:
113.1860 -
113.1861 -  \begin{isabelle}%
113.1862 -{\isasymlbrakk}{\isacharquery}b\ {\isacharequal}\ {\isacharquery}c{\isacharsemicolon}\ {\isacharquery}c\ {\isasymLongrightarrow}\ {\isacharquery}x\ {\isacharequal}\ {\isacharquery}u{\isacharsemicolon}\ {\isasymnot}\ {\isacharquery}c\ {\isasymLongrightarrow}\ {\isacharquery}y\ {\isacharequal}\ {\isacharquery}v{\isasymrbrakk}\isanewline
113.1863 -{\isasymLongrightarrow}\ {\isacharparenleft}if\ {\isacharquery}b\ then\ {\isacharquery}x\ else\ {\isacharquery}y{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}if\ {\isacharquery}c\ then\ {\isacharquery}u\ else\ {\isacharquery}v{\isacharparenright}%
113.1864 -\end{isabelle}
113.1865 -  
113.1866 -  Congruence rules can be added to the
113.1867 -  function package by giving them the \isa{fundef{\isacharunderscore}cong} attribute.
113.1868 -
113.1869 -  The constructs that are predefined in Isabelle, usually
113.1870 -  come with the respective congruence rules.
113.1871 -  But if you define your own higher-order functions, you may have to
113.1872 -  state and prove the required congruence rules yourself, if you want to use your
113.1873 -  functions in recursive definitions.%
113.1874 -\end{isamarkuptxt}%
113.1875 -\isamarkuptrue%
113.1876 -%
113.1877 -\endisatagproof
113.1878 -{\isafoldproof}%
113.1879 -%
113.1880 -\isadelimproof
113.1881 -%
113.1882 -\endisadelimproof
113.1883 -%
113.1884 -\isamarkupsubsection{Congruence Rules and Evaluation Order%
113.1885 -}
113.1886 -\isamarkuptrue%
113.1887 -%
113.1888 -\begin{isamarkuptext}%
113.1889 -Higher order logic differs from functional programming languages in
113.1890 -  that it has no built-in notion of evaluation order. A program is
113.1891 -  just a set of equations, and it is not specified how they must be
113.1892 -  evaluated. 
113.1893 -
113.1894 -  However for the purpose of function definition, we must talk about
113.1895 -  evaluation order implicitly, when we reason about termination.
113.1896 -  Congruence rules express that a certain evaluation order is
113.1897 -  consistent with the logical definition. 
113.1898 -
113.1899 -  Consider the following function.%
113.1900 -\end{isamarkuptext}%
113.1901 -\isamarkuptrue%
113.1902 -\isacommand{function}\isamarkupfalse%
113.1903 -\ f\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ bool{\isachardoublequoteclose}\isanewline
113.1904 -\isakeyword{where}\isanewline
113.1905 -\ \ {\isachardoublequoteopen}f\ n\ {\isacharequal}\ {\isacharparenleft}n\ {\isacharequal}\ {\isadigit{0}}\ {\isasymor}\ f\ {\isacharparenleft}n\ {\isacharminus}\ {\isadigit{1}}{\isacharparenright}{\isacharparenright}{\isachardoublequoteclose}%
113.1906 -\isadelimproof
113.1907 -%
113.1908 -\endisadelimproof
113.1909 -%
113.1910 -\isatagproof
113.1911 -%
113.1912 -\endisatagproof
113.1913 -{\isafoldproof}%
113.1914 -%
113.1915 -\isadelimproof
113.1916 -%
113.1917 -\endisadelimproof
113.1918 -%
113.1919 -\begin{isamarkuptext}%
113.1920 -For this definition, the termination proof fails. The default configuration
113.1921 -  specifies no congruence rule for disjunction. We have to add a
113.1922 -  congruence rule that specifies left-to-right evaluation order:
113.1923 -
113.1924 -  \vspace{1ex}
113.1925 -  \noindent \isa{{\isasymlbrakk}{\isacharquery}P\ {\isacharequal}\ {\isacharquery}P{\isacharprime}{\isacharsemicolon}\ {\isasymnot}\ {\isacharquery}P{\isacharprime}\ {\isasymLongrightarrow}\ {\isacharquery}Q\ {\isacharequal}\ {\isacharquery}Q{\isacharprime}{\isasymrbrakk}\ {\isasymLongrightarrow}\ {\isacharparenleft}{\isacharquery}P\ {\isasymor}\ {\isacharquery}Q{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}{\isacharquery}P{\isacharprime}\ {\isasymor}\ {\isacharquery}Q{\isacharprime}{\isacharparenright}}\hfill(\isa{disj{\isacharunderscore}cong})
113.1926 -  \vspace{1ex}
113.1927 -
113.1928 -  Now the definition works without problems. Note how the termination
113.1929 -  proof depends on the extra condition that we get from the congruence
113.1930 -  rule.
113.1931 -
113.1932 -  However, as evaluation is not a hard-wired concept, we
113.1933 -  could just turn everything around by declaring a different
113.1934 -  congruence rule. Then we can make the reverse definition:%
113.1935 -\end{isamarkuptext}%
113.1936 -\isamarkuptrue%
113.1937 -\isacommand{lemma}\isamarkupfalse%
113.1938 -\ disj{\isacharunderscore}cong{\isadigit{2}}{\isacharbrackleft}fundef{\isacharunderscore}cong{\isacharbrackright}{\isacharcolon}\ \isanewline
113.1939 -\ \ {\isachardoublequoteopen}{\isacharparenleft}{\isasymnot}\ Q{\isacharprime}\ {\isasymLongrightarrow}\ P\ {\isacharequal}\ P{\isacharprime}{\isacharparenright}\ {\isasymLongrightarrow}\ {\isacharparenleft}Q\ {\isacharequal}\ Q{\isacharprime}{\isacharparenright}\ {\isasymLongrightarrow}\ {\isacharparenleft}P\ {\isasymor}\ Q{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}P{\isacharprime}\ {\isasymor}\ Q{\isacharprime}{\isacharparenright}{\isachardoublequoteclose}\isanewline
113.1940 -%
113.1941 -\isadelimproof
113.1942 -\ \ %
113.1943 -\endisadelimproof
113.1944 -%
113.1945 -\isatagproof
113.1946 -\isacommand{by}\isamarkupfalse%
113.1947 -\ blast%
113.1948 -\endisatagproof
113.1949 -{\isafoldproof}%
113.1950 -%
113.1951 -\isadelimproof
113.1952 -\isanewline
113.1953 -%
113.1954 -\endisadelimproof
113.1955 -\isanewline
113.1956 -\isacommand{fun}\isamarkupfalse%
113.1957 -\ f{\isacharprime}\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequoteopen}nat\ {\isasymRightarrow}\ bool{\isachardoublequoteclose}\isanewline
113.1958 -\isakeyword{where}\isanewline
113.1959 -\ \ {\isachardoublequoteopen}f{\isacharprime}\ n\ {\isacharequal}\ {\isacharparenleft}f{\isacharprime}\ {\isacharparenleft}n\ {\isacharminus}\ {\isadigit{1}}{\isacharparenright}\ {\isasymor}\ n\ {\isacharequal}\ {\isadigit{0}}{\isacharparenright}{\isachardoublequoteclose}%
113.1960 -\begin{isamarkuptext}%
113.1961 -\noindent These examples show that, in general, there is no \qt{best} set of
113.1962 -  congruence rules.
113.1963 -
113.1964 -  However, such tweaking should rarely be necessary in
113.1965 -  practice, as most of the time, the default set of congruence rules
113.1966 -  works well.%
113.1967 -\end{isamarkuptext}%
113.1968 -\isamarkuptrue%
113.1969 -%
113.1970 -\isadelimtheory
113.1971 -%
113.1972 -\endisadelimtheory
113.1973 -%
113.1974 -\isatagtheory
113.1975 -\isacommand{end}\isamarkupfalse%
113.1976 -%
113.1977 -\endisatagtheory
113.1978 -{\isafoldtheory}%
113.1979 -%
113.1980 -\isadelimtheory
113.1981 -%
113.1982 -\endisadelimtheory
113.1983 -\isanewline
113.1984 -\end{isabellebody}%
113.1985 -%%% Local Variables:
113.1986 -%%% mode: latex
113.1987 -%%% TeX-master: "root"
113.1988 -%%% End:
   114.1 --- a/doc-src/IsarAdvanced/Functions/Thy/document/session.tex	Mon Mar 02 16:58:39 2009 +0100
   114.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   114.3 @@ -1,6 +0,0 @@
   114.4 -\input{Functions.tex}
   114.5 -
   114.6 -%%% Local Variables:
   114.7 -%%% mode: latex
   114.8 -%%% TeX-master: "root"
   114.9 -%%% End:
   115.1 --- a/doc-src/IsarAdvanced/Functions/conclusion.tex	Mon Mar 02 16:58:39 2009 +0100
   115.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   115.3 @@ -1,7 +0,0 @@
   115.4 -\section{Conclusion}
   115.5 -
   115.6 -\fixme{}
   115.7 -
   115.8 -
   115.9 -
  115.10 -
   116.1 --- a/doc-src/IsarAdvanced/Functions/functions.tex	Mon Mar 02 16:58:39 2009 +0100
   116.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   116.3 @@ -1,91 +0,0 @@
   116.4 -
   116.5 -\documentclass[a4paper,fleqn]{article}
   116.6 -
   116.7 -\usepackage{latexsym,graphicx}
   116.8 -\usepackage[refpage]{nomencl}
   116.9 -\usepackage{../../iman,../../extra,../../isar,../../proof}
  116.10 -\usepackage{../../isabelle,../../isabellesym}
  116.11 -\usepackage{style}
  116.12 -\usepackage{mathpartir}
  116.13 -\usepackage{amsthm}
  116.14 -\usepackage{../../pdfsetup}
  116.15 -
  116.16 -\newcommand{\cmd}[1]{\isacommand{#1}}
  116.17 -
  116.18 -\newcommand{\isasymINFIX}{\cmd{infix}}
  116.19 -\newcommand{\isasymLOCALE}{\cmd{locale}}
  116.20 -\newcommand{\isasymINCLUDES}{\cmd{includes}}
  116.21 -\newcommand{\isasymDATATYPE}{\cmd{datatype}}
  116.22 -\newcommand{\isasymAXCLASS}{\cmd{axclass}}
  116.23 -\newcommand{\isasymDEFINES}{\cmd{defines}}
  116.24 -\newcommand{\isasymNOTES}{\cmd{notes}}
  116.25 -\newcommand{\isasymCLASS}{\cmd{class}}
  116.26 -\newcommand{\isasymINSTANCE}{\cmd{instance}}
  116.27 -\newcommand{\isasymLEMMA}{\cmd{lemma}}
  116.28 -\newcommand{\isasymPROOF}{\cmd{proof}}
  116.29 -\newcommand{\isasymQED}{\cmd{qed}}
  116.30 -\newcommand{\isasymFIX}{\cmd{fix}}
  116.31 -\newcommand{\isasymASSUME}{\cmd{assume}}
  116.32 -\newcommand{\isasymSHOW}{\cmd{show}}
  116.33 -\newcommand{\isasymNOTE}{\cmd{note}}
  116.34 -\newcommand{\isasymCODEGEN}{\cmd{code\_gen}}
  116.35 -\newcommand{\isasymPRINTCODETHMS}{\cmd{print\_codethms}}
  116.36 -\newcommand{\isasymFUN}{\cmd{fun}}
  116.37 -\newcommand{\isasymFUNCTION}{\cmd{function}}
  116.38 -\newcommand{\isasymPRIMREC}{\cmd{primrec}}
  116.39 -\newcommand{\isasymRECDEF}{\cmd{recdef}}
  116.40 -
  116.41 -\newcommand{\qt}[1]{``#1''}
  116.42 -\newcommand{\qtt}[1]{"{}{#1}"{}}
  116.43 -\newcommand{\qn}[1]{\emph{#1}}
  116.44 -\newcommand{\strong}[1]{{\bfseries #1}}
  116.45 -\newcommand{\fixme}[1][!]{\strong{FIXME: #1}}
  116.46 -
  116.47 -\newtheorem{exercise}{Exercise}{\bf}{\itshape}
  116.48 -%\newtheorem*{thmstar}{Theorem}{\bf}{\itshape}
  116.49 -
  116.50 -\hyphenation{Isabelle}
  116.51 -\hyphenation{Isar}
  116.52 -
  116.53 -\isadroptag{theory}
  116.54 -\title{Defining Recursive Functions in Isabelle/HOL}
  116.55 -\author{Alexander Krauss}
  116.56 -
  116.57 -\isabellestyle{tt}
  116.58 -\renewcommand{\isastyletxt}{\isastyletext}% use same formatting for txt and text
  116.59 -
  116.60 -\begin{document}
  116.61 -
  116.62 -\date{\ \\}
  116.63 -\maketitle
  116.64 -
  116.65 -\begin{abstract}
  116.66 -  This tutorial describes the use of the new \emph{function} package,
  116.67 -	which provides general recursive function definitions for Isabelle/HOL.
  116.68 -	We start with very simple examples and then gradually move on to more
  116.69 -	advanced topics such as manual termination proofs, nested recursion,
  116.70 -	partiality, tail recursion and congruence rules.
  116.71 -\end{abstract}
  116.72 -
  116.73 -%\thispagestyle{empty}\clearpage
  116.74 -
  116.75 -%\pagenumbering{roman}
  116.76 -%\clearfirst
  116.77 -
  116.78 -\input{intro.tex}
  116.79 -\input{Thy/document/Functions.tex}
  116.80 -%\input{conclusion.tex}
  116.81 -
  116.82 -\begingroup
  116.83 -%\tocentry{\bibname}
  116.84 -\bibliographystyle{plain} \small\raggedright\frenchspacing
  116.85 -\bibliography{../../manual}
  116.86 -\endgroup
  116.87 -
  116.88 -\end{document}
  116.89 -
  116.90 -
  116.91 -%%% Local Variables: 
  116.92 -%%% mode: latex
  116.93 -%%% TeX-master: t
  116.94 -%%% End: 
   117.1 --- a/doc-src/IsarAdvanced/Functions/intro.tex	Mon Mar 02 16:58:39 2009 +0100
   117.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   117.3 @@ -1,55 +0,0 @@
   117.4 -\section{Introduction}
   117.5 -
   117.6 -Starting from Isabelle 2007, new facilities for recursive
   117.7 -function definitions~\cite{krauss2006} are available. They provide
   117.8 -better support for general recursive definitions than previous
   117.9 -packages.  But despite all tool support, function definitions can
  117.10 -sometimes be a difficult thing. 
  117.11 -
  117.12 -This tutorial is an example-guided introduction to the practical use
  117.13 -of the package and related tools. It should help you get started with
  117.14 -defining functions quickly. For the more difficult definitions we will
  117.15 -discuss what problems can arise, and how they can be solved.
  117.16 -
  117.17 -We assume that you have mastered the fundamentals of Isabelle/HOL
  117.18 -and are able to write basic specifications and proofs. To start out
  117.19 -with Isabelle in general, consult the Isabelle/HOL tutorial
  117.20 -\cite{isa-tutorial}.
  117.21 -
  117.22 -
  117.23 -
  117.24 -\paragraph{Structure of this tutorial.}
  117.25 -Section 2 introduces the syntax and basic operation of the \cmd{fun}
  117.26 -command, which provides full automation with reasonable default
  117.27 -behavior.  The impatient reader can stop after that
  117.28 -section, and consult the remaining sections only when needed.
  117.29 -Section 3 introduces the more verbose \cmd{function} command which
  117.30 -gives fine-grained control. This form should be used
  117.31 -whenever the short form fails.
  117.32 -After that we discuss more specialized issues:
  117.33 -termination, mutual, nested and higher-order recursion, partiality, pattern matching
  117.34 -and others.
  117.35 -
  117.36 -
  117.37 -\paragraph{Some background.}
  117.38 -Following the LCF tradition, the package is realized as a definitional
  117.39 -extension: Recursive definitions are internally transformed into a
  117.40 -non-recursive form, such that the function can be defined using
  117.41 -standard definition facilities. Then the recursive specification is
  117.42 -derived from the primitive definition.  This is a complex task, but it
  117.43 -is fully automated and mostly transparent to the user. Definitional
  117.44 -extensions are valuable because they are conservative by construction:
  117.45 -The \qt{new} concept of general wellfounded recursion is completely reduced
  117.46 -to existing principles.
  117.47 -
  117.48 -
  117.49 -
  117.50 -
  117.51 -The new \cmd{function} command, and its short form \cmd{fun} have mostly
  117.52 -replaced the traditional \cmd{recdef} command \cite{slind-tfl}. They solve
  117.53 -a few of technical issues around \cmd{recdef}, and allow definitions
  117.54 -which were not previously possible.
  117.55 -
  117.56 -
  117.57 -
  117.58 -
   118.1 --- a/doc-src/IsarAdvanced/Functions/isabelle_isar.eps	Mon Mar 02 16:58:39 2009 +0100
   118.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   118.3 @@ -1,6488 +0,0 @@
   118.4 -%!PS-Adobe-2.0 EPSF-1.2
   118.5 -%%Title: isabelle_any
   118.6 -%%Creator: FreeHand 5.5
   118.7 -%%CreationDate: 24.09.1998 21:04 Uhr
   118.8 -%%BoundingBox: 0 0 202 178
   118.9 -%%FHPathName:MacSystem:Home:Markus:TUM:Isabelle Logo:export:isabelle_any
  118.10 -%ALDOriginalFile:MacSystem:Home:Markus:TUM:Isabelle Logo:export:isabelle_any
  118.11 -%ALDBoundingBox: -153 -386 442 456
  118.12 -%%FHPageNum:1
  118.13 -%%DocumentSuppliedResources: procset Altsys_header 4 0
  118.14 -%%ColorUsage: Color
  118.15 -%%DocumentProcessColors: Cyan Magenta Yellow Black
  118.16 -%%DocumentNeededResources: font Symbol
  118.17 -%%+ font ZapfHumanist601BT-Bold
  118.18 -%%DocumentFonts: Symbol
  118.19 -%%+ ZapfHumanist601BT-Bold
  118.20 -%%DocumentNeededFonts: Symbol
  118.21 -%%+ ZapfHumanist601BT-Bold
  118.22 -%%EndComments
  118.23 -%!PS-AdobeFont-1.0: ZapfHumanist601BT-Bold 003.001
  118.24 -%%CreationDate: Mon Jun 22 16:09:28 1992
  118.25 -%%VMusage: 35200 38400   
  118.26 -% Bitstream Type 1 Font Program
  118.27 -% Copyright 1990-1992 as an unpublished work by Bitstream Inc., Cambridge, MA.
  118.28 -% All rights reserved.
  118.29 -% Confidential and proprietary to Bitstream Inc.
  118.30 -% U.S. GOVERNMENT RESTRICTED RIGHTS
  118.31 -% This software typeface product is provided with RESTRICTED RIGHTS. Use,
  118.32 -% duplication or disclosure by the Government is subject to restrictions
  118.33 -% as set forth in the license agreement and in FAR 52.227-19 (c) (2) (May, 1987),
  118.34 -% when applicable, or the applicable provisions of the DOD FAR supplement
  118.35 -% 252.227-7013 subdivision (a) (15) (April, 1988) or subdivision (a) (17)
  118.36 -% (April, 1988).  Contractor/manufacturer is Bitstream Inc.,
  118.37 -% 215 First Street, Cambridge, MA 02142.
  118.38 -% Bitstream is a registered trademark of Bitstream Inc.
  118.39 -11 dict begin
  118.40 -/FontInfo 9 dict dup begin
  118.41 -  /version (003.001) readonly def
  118.42 -  /Notice (Copyright 1990-1992 as an unpublished work by Bitstream Inc.  All rights reserved.  Confidential.) readonly def
  118.43 -  /FullName (Zapf Humanist 601 Bold) readonly def
  118.44 -  /FamilyName (Zapf Humanist 601) readonly def
  118.45 -  /Weight (Bold) readonly def
  118.46 -  /ItalicAngle 0 def
  118.47 -  /isFixedPitch false def
  118.48 -  /UnderlinePosition -136 def
  118.49 -  /UnderlineThickness 85 def
  118.50 -end readonly def
  118.51 -/FontName /ZapfHumanist601BT-Bold def
  118.52 -/PaintType 0 def
  118.53 -/FontType 1 def
  118.54 -/FontMatrix [0.001 0 0 0.001 0 0] readonly def
  118.55 -/Encoding StandardEncoding def
  118.56 -/FontBBox {-167 -275 1170 962} readonly def
  118.57 -/UniqueID 15530396 def
  118.58 -currentdict end
  118.59 -currentfile eexec
  118.60 -a2951840838a4133839ca9d22e2b99f2b61c767cd675080aacfcb24e19cd
  118.61 -1336739bb64994c56737090b4cec92c9945ff0745ef7ffc61bb0a9a3b849
  118.62 -e7e98740e56c0b5af787559cc6956ab31e33cf8553d55c0b0e818ef5ec6b
  118.63 -f48162eac42e7380ca921dae1c82b38fd6bcf2001abb5d001a56157094cf
  118.64 -e27d8f4eac9693e88372d20358b47e0c3876558ebf757a1fbc5c1cddf62b
  118.65 -3c57bf727ef1c4879422c142a084d1c7462ac293e097fabe3a3ecfcd8271
  118.66 -f259833bac7912707218ec9a3063bf7385e02d8c1058ac06df00b33b8c01
  118.67 -8768b278010eb4dd58c7ba59321899741cb7215d8a55bee8d3398c887f02
  118.68 -e1f4869387f89141de693fcb429c7884c22dcdeddcaa62b7f5060249dfab
  118.69 -cfc351201f7d188b6ed68a228abda4d33b3d269ac09cde172bc045e67449
  118.70 -c0f25d224efbe8c9f9d2968a01edbfb039123c365ed0db58ad38aabe015b
  118.71 -8881191dd23092f6d53d5c1cd68ebd038e098d32cb24b433b7d5d89c28ee
  118.72 -05ea0b6070bb785a2974b5a160ee4cf8b6d8c73445d36720af0530441cd9
  118.73 -61bc0c367f1af1ec1c5ab7255ddda153c1868aba58cd5b44835535d85326
  118.74 -5d7fed5ff7118adb5d5b76cc3b72e5ff27e21eb857261b3afb7688fca12d
  118.75 -1663b0d8bdc1dd47a84b65b47d3e76d3b8fa8b319f17e1bb22b45a7482fd
  118.76 -f9ad1b6129e09ae47f15cd2447484cd2d64f59ab0f2f876c81e7d87ccdf9
  118.77 -005aa8fc093d02db51a075d571e925f2d309a1c535a1e59d34215c6cd33e
  118.78 -3c38997b4956461f376399901a8d0943dca6a335baac93fc8482c0659f04
  118.79 -329c6f040b35828ea6dd1bd1858f2a9be4ef77731b5b75a1c536c6bc9479
  118.80 -0821e5d88f6e2981835dbfd65ec254ebcf2cf49c917d121cd3bbb476a12b
  118.81 -69c15f17d9c17bb15ad1e7d31d2afcf58c8f0ad526d68615a0f1ac3b1d1c
  118.82 -d3beafeea3cf56c8f8a66367c70df9159f0b1b3157ccfd010045c4718e0e
  118.83 -625c0891e85790c9b97b85517c74c9d55eaca31a01cddc64898bf0eeadf3
  118.84 -53391a185e507dcb0a6f52661a56357ac818dfc740a540aadf02f4e7a79d
  118.85 -8008a77cd30abde337025b01217d6a68c306abe145b7260c3478fa5f366f
  118.86 -b2d37259ead8a8ec2db2f09ae0eb3a682d27b0d73a60935f80254c24426a
  118.87 -003a87a29a4370cbf1b2ef1e19ad8466ec725fd5b463d06011a5e0da2258
  118.88 -ff6c1483c4532bc21f2ed9b99b929b2800ddefc1a98d12ba085adc210bac
  118.89 -e0274b69e24d16af015a51ca73edf779a7534a887aa780337ad966839881
  118.90 -edc22ba72038aa1a96a6deba24ad676795da711b92f8cf5f54cb4322ec04
  118.91 -40ef9e15b11e3005f3ff69376ecb29bb66e8fc1b685f2b05fb162fcb35aa
  118.92 -d7eb2a8ec39b97ab1ff05ef02f8dbbc12085a5cd252cc4010fab7f63dfd5
  118.93 -7fa1be86f724d37db5faef17ae8e8e537444e8e9db917b270344183473af
  118.94 -7f47d5703a160d8ef1e772438620d3336b2fbcf6433612e4b5e64fae0329
  118.95 -8a3c4010c17d93f13ba66d549c69dd58c7d26ddc90285fed831918563a16
  118.96 -2a7ac2511e2f18c9eb3df905a9dcba65a31cc1c39f07458abb11b4c60346
  118.97 -aea19070e126982f1dde336e79be0ecd69a8afbe2493d064d4d2ff38788b
  118.98 -b3038125961302db9761403c3b8019ec641e107425002205a77ae2ae0f4f
  118.99 -7550d623dd03f0ec0199f42a9a8b89514e2e21baca9b3c8c96ca48cbf9dc
 118.100 -ee6d6241d713e014b49e83ad85e62a6b2f70b58e4cc72d41ea6fcbdd3b5c
 118.101 -890c8af0d24200658773b1628c6cc9aaaabb08865ee4c7ff2c513ad7aa23
 118.102 -155a321213fa94731683a3e282a0e60aa3c87aade3da231465bdd9097f2c
 118.103 -89a1af8e5b9649143f2d9482546501ea97e8bea2f5d5eea97d4f19bb6835
 118.104 -3138d3babb2461c08d537491aaede1f23d734c6f099eb5bef6e2ffaaf138
 118.105 -e5ab71b8b41599091037e440127a4eaedf208c20c8a2fc62eadab191d1ab
 118.106 -4d5531f826aa6b9fff2797a7f54673e0a3fae09a93a0dfafb8b11d60dc69
 118.107 -5acf9b7e1a47c31d0b5a0b85b7b50cddff5ac831651d9c7469c2139c7a89
 118.108 -7d2f868f36c65156921803eccfdbdd1618595ab6d2a9230ef523a1b5ee51
 118.109 -f2a0d200fc0e94aff7f546593ff2a3eb865d129895af01b8ab6e4616fe20
 118.110 -9123b6e2b7e0817adc3cdb78ae8b0b1d75f2986ebd8fb24c4de92ac9e8c3
 118.111 -6afa520636bcad2e6a03d11c268d97fa578561f6e7523e042c4cc73a0eac
 118.112 -7a841907450e83d8e7a8de4db5085f6e8b25dc85b59e018380f4b9523a7f
 118.113 -02cbeec989f0221b7681ec427519062b429dcd8fc2e4f81173519f88e2e4
 118.114 -3798b90a84060920f6ae789afd6a9182e7fec87cd2d4235d37a65c3f3bcc
 118.115 -c742c89cbe5f3e2ba6c4f40ebba162e12569d20684cc167685285a087e7a
 118.116 -0a995fe1939bf25c09553512ba2cf77ef21d2ef8da1c73ba6e5826f4099e
 118.117 -27d8bc7b3545fc592b75228e70127c15a382774357457cd4586d80dc0bd6
 118.118 -065aee32acfd5c0523303cece85a3dbf46853b917618c0330146f527c15b
 118.119 -dbb9f6526964368b2b8593eed1551dad75659565d54c6a0a52da7a8e366f
 118.120 -dd009ef853491c0fb995e19933cba1dbdc8902721c3ea6017ffdd5851cb8
 118.121 -3c8bada46075ac121afe13a70e87529e40693157adcc999ed4657e017adf
 118.122 -f7dbac4bc0d204f204c6f47b769aaf714f9ec1d25226f24d0a1b53e28ac5
 118.123 -374ab99755852c1431b2486df5fd637e2005a25303345a1c95a15a1189ba
 118.124 -f6f6883de1ad46d48427b137c2003d210ab2b2f5680f2633939f289d7553
 118.125 -eb943adf8127f1c3ee7d6453b5566393700ad74ab86eb9a89f8b0380af55
 118.126 -6b62f51b7dbd0c5dcc9a9fb658944d7ad5845d58dedc2d38200d0ef7cb0f
 118.127 -76041dc104ef3ab89c1dc2f6a75635d48051c8a7dd9f5e60253a53957ec8
 118.128 -9d1266566d7ed20d79dfc2807b397d7cf056bdaccdb72528a88aa4987682
 118.129 -c909b2fe1e35a71c2f29e89a2bf32173967e79610367ce4574ba6a1cc031
 118.130 -cfb176fc0313f74f91a866ef9954b95b29caf917a6b919586f54d23cb7ce
 118.131 -23305886ae7760ebd6263df0d3c511ac7afc361df78bc2621f66d3268b99
 118.132 -078fa59124f0eb9476496c938eb4584e87455dc6f2faa999e938460b31c6
 118.133 -28021c652acfa12d4556aa4302bbcd043e60389480b796c3fc0b2e51b81e
 118.134 -c2afa4a34335318a1c5a842dcaa120df414acba2e79ab5cc61c99e98108c
 118.135 -5cb907a96b30d731131782f9df79aabfc16a20ace8852d047497982e11c8
 118.136 -26321addf679de8a96a2d18743f6f2c3b2bc397370b10ad273fcfb76b48b
 118.137 -9dad27cf89ca2c370149cd48ab956e9bbce01cbf8e1f0c661b99cf19b36e
 118.138 -87b6165dd85ae3f3674525e17d85971093e110520d17f2d6253611e35ec9
 118.139 -e17000e48e2926454c1e8eb4098e0115b49536f2c33505eb5e574f7a414b
 118.140 -e176398c5ddf6d846ea5ddf2a5e94c0422e0115c57a8c9e56bf8ba962c82
 118.141 -698c96bd6138baaca7347e44352cc62df4eeba364954ad921a5a43280980
 118.142 -264df4a7fb29d005423179f7bd1d98b4280d62ce23c927551f1ffc2b8f17
 118.143 -0a9c23656c0c91b640cdcfdbd88089ffb28d3ac68bad25dbbed82c083696
 118.144 -1f9f86a6183cc1061ffdb32279796569d05b31c946955402d0be1fb9f2bf
 118.145 -304d1ad8e1e357be49e6e2ee67f7f1e7bc699d46a5f7853fe659ba2e1930
 118.146 -0d3e3ea658b9862701dcab08fdd23bf1d751777f25efbe9e02d12b5612b3
 118.147 -c3fc2275190346b94ec4024e4ade08e54d75c0b4c48f4956b9182e8ce997
 118.148 -74b54da4a9318c099d89f1ce3b6803a95f48b9fb8b845372be25e54478e8
 118.149 -49e4707ea03a36e134efa661e4e6250d89649ae074cfd9d6b9e2071c1099
 118.150 -3b8a5a5ebc3e1cb228c97565aef7f254e3f90af8a3dd281c83792755719d
 118.151 -c6a5b3bab4aa6be5afe9624050eee8dfb13b018f4088c932cd48ace38dfe
 118.152 -b1b4218dba8f7fada6628076acf1b54db0c95d4fb12232f1fa9d1ba848f9
 118.153 -fe80c65b75d6946c00fe78839142c5302707d9269b24565dbcc551aca060
 118.154 -b4d0f99b961dd3cc795a982063ac42e9fc81fc98add42744a9f92e74b00d
 118.155 -637ee4606ea2099b6c763493c3159f8e52a90dafca682010c0e92bc9038a
 118.156 -10abb066c75c8d97f7ad6fb1a37136e52cf2093c4fa485fe12adad10e4d0
 118.157 -83b78b023628ddc5326cbf8392516027a9f3de4945f93488e4a1997efd2a
 118.158 -22c2c136dbac1bdb829e082beac48cdd06dcb17bacf09451c7b636bd49a8
 118.159 -fc60cb1d2292250bea78e1dd276725ab4c526b66ddabf4e1b2bf0a2571df
 118.160 -2490df70735f5da321fac74fe4fab54444e53dace9832cff38a70c58104a
 118.161 -4f0c0545dcf7a1a9ecb54e0e32d6d8195d30b2c98a567741fcf325a4ddeb
 118.162 -244a1a35676e246ddc835fac13b569f35f22ec93191eca3efbe17ff9a950
 118.163 -d08f863710b2bbecec969068c498eb2338b68f3fc3f5447449fe4de2b065
 118.164 -e068ecd9255d369b2bb6c4b0b7423774bed69294758aca2bdb1a8d5bf618
 118.165 -d3fa09462f7838e8a79b7a53bebe6dacb0a1561eaa074bc6f069f6a06fb2
 118.166 -c4a5cb13e2172bce9be659a82665da5cded73da84322bb16aa6e19ac1958
 118.167 -7515cb5d2b65e65e803f76700ce5efd3df7fe4ed431fae0e8e286b1d5056
 118.168 -a0d18df926b2be7a93c503ab903abd4788680a6201fdc299f2cb5d6a9b6e
 118.169 -2048109c8d1fb633a54128938594b2cce86a7e0185e7d59e6536584039ec
 118.170 -9e30ff7be6ddba9fdba82de7415fdc47de84d97afb1aa3ba495bd91dee9d
 118.171 -f3b21ee1164987dd8510925087cd0919f1085cba6e4dd3c7384d26667f94
 118.172 -ad7f736a60d8bd76dfaa4b53c23536fc309ff2317c48ee0107ff2ca4d1b3
 118.173 -f78c5a27b901c931128bdb636094ef0cd543a5b62b7dbe10ed83aed5780c
 118.174 -a16067a4a7e8b7c5bf8a8e822149bc1b5bcdabe13a7f6aa6eaeff24a42f4
 118.175 -a58a2b70f545103540169137fda9abb589f734b6776cb50402d6123ce802
 118.176 -10dce05e3697a98c9411cf60a02c278c91e03d540b936cd00c668960e357
 118.177 -1aeaf4d94cfb496b259ec0d8fdba9199fb46634ff177bc8d310ea1314eef
 118.178 -d46c927a981c58e88743ed4e07d80fe841edee812e3053412bf2e710146c
 118.179 -b25dec8ea70c38bb1f6e4db3c2e8ba521963c1584eeb60ea1e9555058f13
 118.180 -e98307c13cbd15c26b611f543149b1ddf88dd6296ae703f58daeb67f1b03
 118.181 -ab5b24c72d5770cb9d8ed242c4faaad1dd940ada00e98ff3a61799d13355
 118.182 -aba916910aa9a6e5ee8af438d0ba8235346fcd139b9d2cb7db7bd3f298a3
 118.183 -94ff0aff3b9042f32a004e042c346a5ea35917f229848a9c5a32909b0090
 118.184 -4aa715640277a6ada99f8b2927fda22899ff1347f42bac73e2bd4bbf3945
 118.185 -55fd7dd30d5c6dadf5c259fdb2455d8c607de1c5da588e20159f18e4e8da
 118.186 -b714e532d888a0386c52c2b85964251af003ac9d10c0c8b9b3465e1dde48
 118.187 -2e74a29e17a7cf6c9a43b5af1646f0b8508f98e9a1279ec3908073d89dcb
 118.188 -aa093e8dd1004c1ecccce0803095b0069d4be7a1eb14b02efc37d137dfe3
 118.189 -f0190bc9628069abc257f45d0e050e60c7f5281277937dd986fcd5b94a2b
 118.190 -845a1a75addd74a142800f18ef408c08a2c2ad16a93298f148c0ae7d2990
 118.191 -ded147f92f053809a60d4f992a227167aad5b5eb2bbe8a4a77dc77a08b72
 118.192 -6acb34422e2532eec7e274e4a42d71ee584f5f3df5a3a5b379974ede73ab
 118.193 -5f1b0a2dbfcc8cfac4747ca26eb6030dc2f85a104b754432977850c093b9
 118.194 -97ed90af711b544ff682e7b1eac82b2b7b44014b09c17ecf084c994a095d
 118.195 -9eeef5391305caf093b62ac9916f982a436d521fcf4d75c5b8e4d92266fd
 118.196 -e99a58aa39d7693ecd1796b8851761d64bbca39a6d5a0b4533ae47123327
 118.197 -f98d0ad0e8b36625cc3647b55459552906d8a1d5766845ffac101980efcf
 118.198 -79657e365510be5db557cefef21193ca3cf3dad175ee2e7ae91d174fdc06
 118.199 -2ff5c51ffe2f021122e96df042019d3a1883e662537ec1b69c11fbb6e750
 118.200 -0132eabf5803c816153ecbff60ca3b3b39708c26cb1751afb2e65d8e5f4a
 118.201 -c4397a88fb1f112672fcdd24e4ba545c5b2a7968c17b62f8e2530a8acbff
 118.202 -cfca82c64b7abcab84e2c4a0a7ced67b15669301fe9ff2c756e70ff7ce33
 118.203 -497be6acc4ac5617e1f043bd8a87416299a39bf17fc31c02d72d75fdc2a1
 118.204 -e60669fa4d5e4a49d9afea2f53f4626680e9c0dfca223529efa415c4343a
 118.205 -b6067aa800c484457ea050eaaa5d3fafeedd0eec72f327e02c6b3912b5a8
 118.206 -c404de4839c9c4a99da42681cde43316606a34c7d2f02269de1aab776857
 118.207 -e668f35946af4d618d36d444bdc02b1f63ea25b6260b4fb606ac8575b5c9
 118.208 -782a5de4037350d5753b1537537ccb008c454eeb264e6cd4727c999e240e
 118.209 -0ac89e95a896b67d54910a3531345f64198ad394b5ceb52881f1dd9e6beb
 118.210 -95862dc188d45b3e46aacb5fe40097947dab9bc3c1ee46bfc9b1b3ed6167
 118.211 -efd0d65ceb043d7b24c1456676e4baa47b1209a315f199bb3a91f4374cd9
 118.212 -cc0b40d3f09f19f8dd8a46915eee55eeeeb3c7b8f437106ee491ef0f4ff9
 118.213 -2c5c6f779e0fbe7bd5293964bb645ca362b106abeb773571d9ae83b786a3
 118.214 -d5a4ea3ea970daadc46cc5e6037f76fd20e0fffc47cf4e7af9522b91f96b
 118.215 -3297720fd45d9bc2200622ad2ca9445556c8a8202b1991bc63da360d021d
 118.216 -55be2528e043f803e08da99b91ab9cfc5e65b2655d78206b4aecd445a7b0
 118.217 -1caa0d06b0a55e8f04b70b60b04a860c8e1ab439f4910051e3f7441b47c7
 118.218 -8aa3ab8519f181a9e833f3242fa58d02ed76bf0031f71f9def8484ecced8
 118.219 -b6e41aca56176b6b32a2443d12492c8a0f5ba8a3e227219dfd1dd23fcb48
 118.220 -fcfd255dbbf3e198874e607399db8d8498e719f00e9ed8bdd96c88817606
 118.221 -357a0063c23854e64ad4e59ddd5060845b2c4cddd00c40081458f8ee02c7
 118.222 -303c11747bd104440046bf2d09794fca2c4beb23ed1b66d9ccb9a4dd57ad
 118.223 -a24943461ecc00704c916bdc621bfddb17913dfb0f3513b65f3ab015786a
 118.224 -caa51ee9546bc8ddf87e2e104137e35ddf8f8d23724e9a53824169bc7cfa
 118.225 -99562656e6f1c888d4dbff0b269c5d1e733e5f212d91297610201eb43249
 118.226 -35e336dd0052738db2d64f3e89429903bb5c1810009cf766e9a06223dd2f
 118.227 -219b706394a121dc029af55c6ada9052af59682ef7c51e121cf16f0319ac
 118.228 -0aa9512ef900c548d673fe361da19052808797e958209072e145d46ec8cc
 118.229 -a89fafd76630eff30ae979973bdf0f8c9e469d8edd3b1c93731c72f976b7
 118.230 -d81142bc15c376403f967affaa5f482efd57c6f91970729d16db851f0ed3
 118.231 -ea7d82f409307b5b436886c1beda94a1fa3ab1b60686f6574c844fb2c0b3
 118.232 -a07174dc4f27b4fed2f8bd4d5436be4b343e5efdf0400d235bd910255341
 118.233 -a20770804a26f8437e9bce6da8e9f8258a343c7aee291f1510be306ae67a
 118.234 -ab1d7696453530c02fd153bbe49dbf62baad6146029cbd1656cdb76c952c
 118.235 -b93edfee76fe33832930be59636bb947e8ad285f20f663cccf484fba97d6
 118.236 -7446c7b6c6f5857428bb1737d9ae801df75d9cb4d7bd59ef7a4cbadde928
 118.237 -38f15d232005585d2e40483d2d3e08cc8f398bb43afedb84343c3ba3835d
 118.238 -0ba82a86dce859cf655f85e63e41365e0dbefcf511b9a27a2b6e66b2ad3a
 118.239 -c657902842287a317e46ceaa93b5088f09d53a65815b44538af90ad3b06b
 118.240 -4e5e2dc509f02e30a01e05201c67d4d39582bbe64e20b669f5fd787909a3
 118.241 -30fc50a95b31426bbb57a4fbf9feacdc31f98bcf50da7e50c2bfc169c6fd
 118.242 -ccf213cdb878653bcea372968ea6e31fd30dd55434cc91c0af22179ce669
 118.243 -a05493f195e12432c6173ae2ac3c94fb83f38210014a9f969ea2b44e99f5
 118.244 -e5a7317e848d429ad62167a4fc5001149676c0c28cdf59b8d1c5a582f516
 118.245 -3eee855312777fee6dacbf993f5c058f355dbde6552dc960d336eee445dd
 118.246 -11d53fd21b745d1e5ec317efbbef25e070d0a36797a6081c356ac2328e64
 118.247 -e5c55fbc81dc75d9c1575548ece74b8307eef485aa8e28859a2e0435c831
 118.248 -23a600efb323c362fe9f02407a5411c41a69566cd50add324b63ab939980
 118.249 -b9d7a929ae4887163cfa7acbfc9fabaab8987a1f6906b9881491cd055b94
 118.250 -485c968479dbb05b34ed0cd6844729a692978c6928c3392e33e8324ded88
 118.251 -814cacdac8128e1425c0091a13558100d7cdbed5992795d94d39c32f32dc
 118.252 -621ab6f3b75187a66741f61d6a9c91d791b1cfc3d0e94d4a76302e0c3f2e
 118.253 -cbdc51f14f3251aa5c8bb989f0e13ee500b7b7f2f1e52ca970ad8a7b4b99
 118.254 -57e93126254297380d67179deb8ff1e99d5cdf7a35c5bb9fa7b402e63234
 118.255 -78640344e1f10c378ad23c5cd1aa18e1e0b308db70d3a624a455f8e291a2
 118.256 -ee102ad10776208c2d546cb76d89ca8103a8b95f8acc2d2bdc9791324915
 118.257 -6c9e05429091071f0c5b76d82c8d1c8a69d840fd460922cd2090624bc218
 118.258 -0c9391005926a25042a55e322060807363462e1cdeab309033124ba3a884
 118.259 -1db13f39edae04ec52cde9dbde64ddda1ad805141d4230ec76bd81fd98d7
 118.260 -0d90fa1aaa26ea551bf687ddd6cdcf3de5a446b266c68434f07d9c0b382d
 118.261 -5816c4e22f22cc03ff78064c6dffb12315c6bcbbf5dc510f5aaabf23471a
 118.262 -234efceeb4aa2f9af9ea787c014c5587ef162fc5b35e8f4c23b168c6e247
 118.263 -41d33dcc11d2a56d3ba9d8eed6e79aebf9f0faf1a3aeb89d792d69041f0b
 118.264 -b8fadfc0aa090effc6ae5e2f13cdbf54b5bed69b039eef2627769613b6f1
 118.265 -aefe9b66747fe8feaf7455796740f411a770d4a1764f0483719584880f45
 118.266 -430e38d3af184145892a08b2add234a3f3ee4ccfc9f6995c02392adafccd
 118.267 -722f366d748cfe9373fbf5f878ed47e9d221fd156bb28369df9e7d2b79da
 118.268 -76120d135ebaf36cff93beb7e313c2b2de7477176fc19609a1b906c995cd
 118.269 -defef08899265b6b8aefb44da1aadefd1c523dce5ca1b84c0c652b3009fd
 118.270 -057789892d4d31764f181754b2e0a62c465587585509989a219711a5e4e2
 118.271 -5b3b340ca8fdd3f04fef204b1b722b2f6c2ccb00c3cf1a94ba9bdfbfeda9
 118.272 -e2a062c6f1ced3b8aae5dae32ade1fca1001f98d0ad0e8b36625cc3647b5
 118.273 -5459552906d8a788eb8bc734ccb65fe9582c71df94fd95d22c5323de235c
 118.274 -28220fb9a2ccb37362174d8cd5922c9e5a87b51d0668555100a33e33750e
 118.275 -f1f795cbed962494a994be7ce8cf71fc58ff4204551b1615ed27cf088171
 118.276 -fd000b72462b67935961e7c6c3a05bfd67b9ba094ea2c16fdf486da912e1
 118.277 -e97bfd1c17934535e551cede20c001b5d2adb2be4cbad7d6ba0bdeae4b1a
 118.278 -a739f90293e67ecbdeea4d35825e092697fb05b215083e3f3d6be260790e
 118.279 -2a175fd44eb1c4c16759504827a6eb58a838c4d65fec6eef108495577019
 118.280 -15740cac164111892e8d1cc447cd208e243a89ab847d8ebf4fb98bff49e7
 118.281 -a3453facf3b0e8cb67590f390173ddba68324531d2e426aed152e12301d7
 118.282 -538c1f3c0048a9cc00c009a1a9138460082123209c1e007266fbf236eb72
 118.283 -21f87d4ca38a0b699e84ca230ffb5095f90a6528bf2a9118f95ac9ab8d2d
 118.284 -ed9eed9b8b27be894b717469758c8d94fa89acc64f530f432d0e5f16c922
 118.285 -36d6a63410f099c9e909450fd731d698ef658d8ffc1de14817b850814f68
 118.286 -1a4a9be5cc7a71c381974c249f0b209bfdc2e97f9540c96f57bb4d283622
 118.287 -00969b82011315289e6a025b137030a0af3b4b42b00fed7cec49df43c59e
 118.288 -3b2495a036dd1b17a8e6adae63bfbbd48807c44b5bbf71813355e1b0e58e
 118.289 -22b6fb88005fc55565be49c17244901b73ef02fc4eb7669be5af22d89c0d
 118.290 -dff0fc6821d810d13e5821d48d4a71d7e463d5b60bc279d0dcf5f8da3a95
 118.291 -905b56d6f2be95e6d4243b1048e3b662e62401ffaa3bc3f5f90b0854b8a3
 118.292 -8c38039f61fcb359b06bbb7d59e3b39a295dccd6db9a8b83a6f64ef8dc94
 118.293 -a77123dd164cfd1c46f1ee51aa19c3d6e7db92a298d10159f2b5eff2caf9
 118.294 -dc93a6d267fb65bd900d6adf0c6be598050b6d3a9b3a322ab3c9e880d774
 118.295 -1f58016ff97e5f606b5dbd72ba99252c669209bb556dd5be84fdd7c1ce92
 118.296 -8a3b3d3aab8d37e6b740227563bb4d60f6bb04052356e1a48d2079feca44
 118.297 -7ea17fd06f208426d045dee660d1d6460455f8d20dbc5ae64550bbdf60d7
 118.298 -27d96cc9afef842a8c8c78ea2257e6c6d0d207c80cfe399e8874c693274e
 118.299 -d2c2022d303ca50a70624b07434fb85040a76a823f446c7454dab4f9c05f
 118.300 -10274eb5ba164aa3649d1bc90694316ba5cb3e7df4442e777124cff7ebef
 118.301 -53df2320a0c441ab61666493cb43da46d5711c21699de85bc74359444da2
 118.302 -e3e397d4c16234f81531505b621aa242a6698886f82b447104b1f1062f60
 118.303 -b5c87cea9151bb3c627bfa4532b06fd147c556ed8d61ae30a8719dfb8705
 118.304 -f8a6c74368381403640cc57026d3790c49e2bbd1c0e48285ec6ba44de678
 118.305 -e3a1394d659c412f09644b83ee1a333a1f51ad8deb4e6d77b3b226ac2c4f
 118.306 -fe653411a7976ae7c4a3cb7df309788da6b483f8a7bab4a6990db74362f5
 118.307 -bc41d545a320389b2599fd726e426ed9fa2916ece67b058f6a269544e517
 118.308 -128bda38d117f402409d0d8f8c88ed509aa2ba882e0c579b45af4be80770
 118.309 -22d7269684eaf0f9afc3054316da6611e3fd260d67fb6fe52c9ade5dda24
 118.310 -a0050a819ed21342aac9d25194778beb3145f56a66980f620998923521ea
 118.311 -3f957b6ed0c5470734af9f416a16427dd03eff9a0e023452097d4ef936d5
 118.312 -49a90823cef6de340a1ee02a52851b310cbcf41ae274947a62f9d1d8702a
 118.313 -669023e3caf967204a340694b45fecbda4bf9552f6bdc62d43b3b2c3d571
 118.314 -9983c182453e22ee34241ab908e667115f7988174684cd70084aefc55caa
 118.315 -f5352a88e9dac45d1ea0e032af61fe9a9118a3931b2050fc6db66ab96a39
 118.316 -74353b597f34dfd9f72150de23285eda5e555a607d198c291965a7233715
 118.317 -3f4946a57af0b440ff8567b01a6f46c6d32fea5f8bf57d89dccbab7da882
 118.318 -ee6c9260e89443b1d7db099477492bd0468850df3db668d741123e7ebe3d
 118.319 -c21748ab4c5cbeb5de33b8963aecafe76bba0c4f6ed8e8263a116ed85e58
 118.320 -fb71ec4ab0071301be7c7d3afd5fa6ad46c0232807bb7fe129e44bfd16e9
 118.321 -fd0c8bb5e7cdd86a78b5fb0669093c22eda9151d85b6f58a9c8ead3727c0
 118.322 -09850bd31a8b4a873d0a506240bb2aeccb8dcb6369532f21d9b967aa8443
 118.323 -fd6d77cb2d65c4678a5fad188db85940f0a187aa1031dcf5b8e0d0cbfb6d
 118.324 -b3b96fedec5b249b7a69de9b42dfa605bd622de7a220cce9b66e9f3394d6
 118.325 -13487dc5e82c1e619079cd057b1e19ac05ebdfd7c8bf01c6c66fab49e0b6
 118.326 -613df9e42beae2f7b9407a2bff8896d8035cea0fd5c11bc5889cb3d90876
 118.327 -61766138d2625f42d0244adca65d1bc73989328c0eea0b97c7c766285ab3
 118.328 -351ce2b183f774488a8806c33178090a3808f0ce5e339b87cf7add933301
 118.329 -ca486742831ca751f0626864ce13172829a8419af5c78794a0eaa17b5bcd
 118.330 -fcb684f7d4bb7af15deb432e44dc7dedf56eb8bea08b46f1e8123a49a349
 118.331 -a7cbccf833a528f5e22d2d463040e09b91e543a2f33077b3e7b9ecc64f14
 118.332 -306186cdae1fc317a6ced7e9b4d51a10bbbcf2fadff876b4d9082e3f4aef
 118.333 -dfef230e4232572f4fa33a6e065f6895aa2ea96c5659cb579b023179f0fe
 118.334 -de7ba64bbd9362a7b2b8c4eaec254915629e81d01c839096339b99bc9e25
 118.335 -84536955feaa52fa20666f65bafd9b2e69c3e8c15d24fa407e7d881679b1
 118.336 -789a0e2a695d13553c92c0214c9b7562cd6a9a3d77c8b0c2196cef76dc51
 118.337 -d855c1dac37f96eae4cc7bf07e17dc7c08333d7af33c8b2965ea1f23446b
 118.338 -3c96c52b30ea628ad572694d145b58a606f90b278290297aa372cff56b6f
 118.339 -56f4aad6612eb7c7bd07db4f7d1a70d8044d16d0b5c1605ee02a852ffdb4
 118.340 -450147b3f9b87d72dc431b34fcdc899462dcc1b6bb6ab1758b6a589e91e5
 118.341 -8f5196251d00133b43749b7a11fb67a22664c5e38e336dbdeb5509c2d9d6
 118.342 -2642c07275949df0e2db59314ae0fb34641fc171d3fe1289f919136d853c
 118.343 -d9048ee9db50c699c49e27a8df199590bbc65b23b55bb387eed0c73f2db5
 118.344 -1cb091f8c22af83103f214199e371f7de1df23f757817200be30610004df
 118.345 -81fe8ed6eba79e856fca21a126ca326ad2f313c16e15754663ad6a065e08
 118.346 -4050ff005fc899d6e233691b918a093b5f1ffda8839ab23ae66b1bb7b953
 118.347 -0a7f896ec55de6fb9faf1b49656ff2e57488cd7f1c44114c75f9d571461f
 118.348 -767a6040ffa14e9fb43096f164d60ca530d7cca76d526d1999ac1b52a793
 118.349 -28651112a65db1f2564ecf90ea6bf2c9ecf515640719c3fb5e36cfc58591
 118.350 -e227793f39b9d3a9025cb10f324a95c29c488724aa74812366ff0b118fc7
 118.351 -19f9fd0f202a040be47ec99b46b4dfc3d2a17902a5779c8d52b27231a1bb
 118.352 -5cd794c838daddc3e6824ca8297ba669a818c239b389400faf17aa04b802
 118.353 -f763029edb9784dfdc42f223e6496a938e613463bf9bbbd59d63300a9ad7
 118.354 -4e71865cac4b4e81a5864388c3886e70799c8989188341f7d17cb514cd99
 118.355 -3b211883f171ec6402cc361885f4f4b110757bb3e52941a94bfaebb2faa0
 118.356 -3e32eb72e25e31abdde82c2a9015478afa0f434ae3f8b97a4bef598d6eda
 118.357 -44ffe1915c26ee0e8339d2d45a6a080550f538ded5542c8b96ca2f596979
 118.358 -8bb6223e460e857516ab5a3323136ee8fc4b0556a7c39d0cf7acb45e48be
 118.359 -4ae9db325e4750b73289e36a61b301795bdb2ca2a8b933be1c09fd0cd2cb
 118.360 -8677df171d36ef1519a2269b21e4103b2ee151c513df3e10b2a216d6fb22
 118.361 -18bf2005fa7e0f0563ad96661a7f55e1b5b991f8ca285651b2683c6a7c9d
 118.362 -2d1941374989b06f2e9b42a6af60193dc758dd8e9fcfc7c1aa06eab47e81
 118.363 -bd79660666defac0c6b9e484df9c17a61ce7a61ef73150e8cd406af6da17
 118.364 -4d9c2392cc420eddda40f975ffbeacad8ce1b4e14bee29ba8552ff03376f
 118.365 -c034784b38dc1d0ab7bc53943d2545b03d39797af8d58d6dffce56a353d9
 118.366 -bebc833f04db321ca8642bbb7fcc63ed2349ffa08a33a5d0d78f4fd2c5ea
 118.367 -4258e4671e362036f1f67fcef9d878ae2c203fd9c05200c59cc98633e65a
 118.368 -99d912ec51d6f74500d5358b70e799a6817f59adfc43365d7bba1fd6766c
 118.369 -5c8e76248daf3f01e7a8950fe875d657397797a45e7f99a92887300b6806
 118.370 -b86db61e03c4c09d6cf507800aeead874a94e6f665746752937214302045
 118.371 -0b19cfa8db69230517183a03a16e5503882ea1e419c333d3e3b73cef6762
 118.372 -873ac06bec34c3f736494483442619f5bbadd86f128a5a40b854051893ea
 118.373 -8d31dd6656777ad4ac2572d17c6fb21385b053495d1270e65d78334a4115
 118.374 -2787ea89b86f97e72718905a11e9c5664837701a3c1c65ccaf26aebe8dab
 118.375 -c1207d5da2079c37883d9235708f370203b3b2a8ec3a5bb35fab93dae115
 118.376 -aef626dc44b67ca56fac18caf1c22e6fbab93564829a75776630b9c42513
 118.377 -721ca0fbb0b402f4d1db8f701d2b29fa60162feaa8a167eb3113c6f57036
 118.378 -e8361357913eb24dd38dc6d3bf4c3176a07ffc75cecf8e5940a310f79a8e
 118.379 -f590844383d631796ade04a91144d073a9413cff34fb454f1fd75cfbe5e6
 118.380 -525c3bd36ddab80138f6c19aad7417d47df1f1e0fc958fb190a8205b5321
 118.381 -7c43a4dcb0599be404473d6faebe7240dc402a0e0caa21b56a601b154524
 118.382 -f44988e5074c71ae8e1948bb2a2ce72fc24cf3b1813cf7408a6b097aff22
 118.383 -f9d285134d09b7053464259531eb7b270cd5f39f81bbf41a36420f61e5f6
 118.384 -b429036bbf20e27af1a437becd74c5bbc25ee2519402454fc94d430636e1
 118.385 -736fe65a643d9b9d21c9a54eac5a8fed51ff60a47b85a0e9423e330e00cf
 118.386 -220c23e056d20aec2fca3e6bc7a61a8366eb940c9bc99fb90e8704e27655
 118.387 -20335a983eccc7e20b13745c4b4f30a842f1ba64745718c152697c688c73
 118.388 -6cffcf5cc8eb5756201560413117a45ad3d264291cd51404f98448d31474
 118.389 -d47d17d201def12867ba679f0e2605de8f3e8135ed0234890cffa68848f0
 118.390 -6de427741b34c2ea654251ae8450a152538eb806ace3ecfe86d8c4a137ec
 118.391 -c98c6d6cbdc191a5f8f5b5972c70b4896960037b6d4c7c63586a52d5eb59
 118.392 -47af8c192eb980d0801fa670bb1d08740819f9da1dd9e153010bf9580a1d
 118.393 -0925d8327ea1b88db8d934f40266ddf93e5ea137f267847d826cd7999b33
 118.394 -c795d0ac05abe2ec1770dd98eea67912f1939118defc9b379e237d6477bc
 118.395 -91ad08e0046b0836fafa1272b0213dce990c90815f5b30d0eb103ac9539c
 118.396 -2f7bd2280264cd95b4be84cbc5139a7628ed211905dcb92cbc3180ac9e6b
 118.397 -b9ecc3cb08608b2395827d5729781dea49d328ba0c1b4cf2cec9f6bbc822
 118.398 -1f2bbbb9d88f9e7682b9ecc06b9705faa8a90a51678183db1e24cc2c4307
 118.399 -e16b3c20f08f179ec69df7a8c4261427f5886f9179c493bf2d0ef36640d7
 118.400 -79925585724aba69df6d1b4f0bd2a356eedfd74a88bea667b102420c2300
 118.401 -ec420e99b9ce8be1472b617e1255a7f43a0b52f11657f1a4dbb624a24886
 118.402 -9604fe2062b98f5787d010723e520a4f42a0c3943e151ee627f3d5db90e0
 118.403 -7747e1a88a53c4784c8d2b042b9c23c9e436d7d88343171161a364cd8961
 118.404 -37a19582a00d774ef01c7c3fc9e9c7be5074c858d2bacd707a6a4f322027
 118.405 -137d6ca0421ed9f9c7e7229e867678e5272cfc7156a419e893404ad7dabf
 118.406 -a5d8b6fd0787cb4fe1a901c34dd931f1b64f0c470ff807005fb66350d0ea
 118.407 -eb84ebef2c2399cd14a4454ea5004bddd99988b39c4134b92121ec77faee
 118.408 -55cc716eecc58b594b39c41dcab308efa4458ed71943ec5805dcd0194ddc
 118.409 -1ba04a5d3d42d07ac62a907ea25cd2a7e77aba470324d41dc1a3fe088388
 118.410 -787b3312f472cb4f23a414fa5f7c7a0cc5d121d7642b5b3f0cf7ca2173af
 118.411 -3f878f374938251feb3ce5ddd2d7703fc79a130978ac516daf70ae903799
 118.412 -28bea3a4296f48725d578d2e8fb0f932e398404fa8a242024bc011c0ae81
 118.413 -7b92bb104712253a5d89c543a744332069e33ca08bd133211d233ef799f2
 118.414 -fed6a20a9073021e505def8b79e1279dacc062cfd4dddc2e8e0a7fda5dd6
 118.415 -bb5a745f99cccb7ec1df532308da3da0f236c74639c280ea649b2f7ec27d
 118.416 -24221470b642567f3b2e1cd0b3ffa65c5ac986b557aa9b444bf470380435
 118.417 -abae9b51c6da7ff753810ca7938d8a1c47d2b41fafd236cb5998f3ef365e
 118.418 -1f700bb257679ba3a82e235a3e97a667a6ad94412839c96dcd49dd86ccbb
 118.419 -6df8ad01756b311e9fd57ccd2eb2f19f035e214804e2b77769319a5389c2
 118.420 -35f3ca2a73c616c9ef0984abcba167d7d652b330c68f4f6378aba69628b4
 118.421 -2d59eaa2a7e4c782f6eb96f6758d17d35650b15cb5de9bf973b3b6f67c1d
 118.422 -f3285be8322fc2b44359640a3ba5d6d7b96142583a00a9a0ef84fbf14046
 118.423 -09ad55b2aefe8c5c8f58ed21623bf765f81dbb6cca6d2a51fb7730a14839
 118.424 -392cad6b47f5e03448350ab36a37d9ff2b9dab69be5196511072b10cc91f
 118.425 -2e6b5160b2b1bd112e6c02d14063a9bb46977b0d4bc79b921fd942f916c9
 118.426 -c5708e0d133c8309de2f6ee0b1afc996c889c36de20fbbbfd32878f477cd
 118.427 -7735c7c3fa59e9c46e654ea20b4381d9f6c6431082e6918d532bcd539284
 118.428 -af0333a783c9e7fd4fa1e4da5ce8fea2ea4037644a24532d65fa5c1ee982
 118.429 -89e4b9abaf71a35d308a9b8c337f70babc5fc8dbb0327143707ca5b675c5
 118.430 -2d3cf09f7a4f667fcda03d8c82d157e661517787ce6bfb35ea772de13c66
 118.431 -2bd24b74ff9ab0fbcf6635d8e06b54b5b3125d17ae13d175cb7922338ec8
 118.432 -9d1159fea2110995ce48f7d2b094f06d11d59b3a64a44a83d48c78855e47
 118.433 -21243e82d9858401b094a236fa0a90d61863931c30d13b9bf33a35ac0d11
 118.434 -a999f2b4dfba6fc187f8c235a5217d777a5a97112e7db6a8a4b06b07d9c9
 118.435 -f41820e233c8b58b9e47ac56ad1ddcc0b35dd03976bc776c6ac3692ec0ca
 118.436 -f8c75ea7825bc84156468ca7b269d890ec9d4a365b0b31d2f6530185d5e0
 118.437 -2acc3ce14eea55ebb5667067825a8682e135d23c78863d32065ddcf1a755
 118.438 -e0de6dea7220d1a28416b96db40b1e9f159aeb070c9a9515f301f162b0cf
 118.439 -e32c6c89287de6e2b40458e3393826189a10af8517ff5a10c41c9d05d999
 118.440 -aa9305a2ee8e7fe46076bc9c5722ee0a140a144ae383e84a8abe70af5d29
 118.441 -96a0a896cd499caa0ed7867e7c3aac563763216e7769d12218b584d853ec
 118.442 -01db93ca22d0c8d6b286b20b6b26d6ef19f2cebe7030ecaa68d069fac7a0
 118.443 -09d61770b5e8f83024a99142f59d88297cb8d093992c3c6c11b043b151e8
 118.444 -20df640407d8bc829bfc196bf2901e63c6f16102d03ffb7c54a7a560f5f9
 118.445 -5cf8379f4a2eccdcb604bd553e6157b4381940d1b3c768dbfbf2618812f5
 118.446 -7fbe744b3d8ad680dd9223d8bf2412ecbb614d05b485e3b4669d22b417f5
 118.447 -02cce2d705c208b15fa83b5be77ccfc1c840f385a58ae49fbe6ab4e53912
 118.448 -473630e0cfecefab95ebc632a2b10a2103bfe801ca0302542080cfb4cf4d
 118.449 -4c241b1a6c8d28114516e3f1bf39dc02db73e6d9a797279acfd79b02a71b
 118.450 -ae34860dd0e11b18954129f8dd57c039bb7063a4c92f0f6a1e25f4ae59d6
 118.451 -6c1cc6b73a79d6a56f7f2a8a64d571caa8a760f4f485d770d000ddf393ba
 118.452 -784bb27b781c47678dd78ae9b5d5e8b57d163c42c7a55e4aae22061686bf
 118.453 -aebcede728ff2f65e75955585208c176d100912836b5200a79062d4f09b1
 118.454 -ba9465b0e937e289160ec543a4cedbbe0cdb5ecfbb4838138ee9e1ac757d
 118.455 -3c5f04fb6b510b389e2f521759e403bfc8ec6bd79e2d40bdd81901c10dd7
 118.456 -4620acaac9108940daf03af23f09d3c8b785db562b05e597056406557857
 118.457 -e96fc8bea53c2c2ccd0ea6572abb0acacfe29e737173d665ab6dc2995f60
 118.458 -807aaa4073a183aed23c26c67eb137c937999fafc63b66a021125e4ee5c1
 118.459 -a745ad1fff2bd828dcef392052965ce0e9af7a2c88d730fef69da91083fd
 118.460 -83d9fe9f73d42a8dbdcaba85b0fa93b210dbf49cdcbf5d4b69e07375fab1
 118.461 -a39038cc51f66f0b10eebe0cc61f697f7025d9755830b2d65f1ad0db91ef
 118.462 -ebbfb578053de329935bb28d6ed6c12f748a2f70458990f04d56c35557e3
 118.463 -8bc5d2e5de7f52bcf00c3bcce091aaa8852d53ac686f8f407baf3f7c8968
 118.464 -69f3b62f44a5e2291aff9d30d7b5c663658a41add74562dbb0f1062f564a
 118.465 -9b907846291700151de04c1a55cb945eaa2e7a709218ec56d1becce1c0b7
 118.466 -dc41d5f016ae8080c3b07311590a0def35337fc3c844c0ccd04926be9fec
 118.467 -509b1255ef12f368d20601b1ac8c68b0a935f987a21de0f8191604e921ea
 118.468 -0c04b00dc188fd73499852dbcccd4119ef799472b353be7f7dcc904ddfdb
 118.469 -920839f3d4a13bb1796f2dc886f31217845f8d7a543aabbc720311fd0e6d
 118.470 -a31ad3daa06d5e7e6270a34304f35ef170a7abe733428e96b0522fddbb5d
 118.471 -eb35aacec147067fe066c9ef145246fa3d444d176c274b91fddb8a7bd7ff
 118.472 -7cc7693c25895bf931eb321dc9d79f662a17691f9bd1662fecbcecf6d1f9
 118.473 -cd8ddcda56d19811f05fa48bcb492feb355b0ec7c04d6046549c56f7799c
 118.474 -2cd0d9dade8809de7d510702e525ad9cc82c41b4fb36218e3d72e905c507
 118.475 -159076a9c0e4a008ccca17bd594c69f5eee656426f865fc1988d677b72ce
 118.476 -b710b29a0aa8f8337552ae30e93bf7c6e5d013555872dba4737dc5f08c0f
 118.477 -efd428c66fc8da675373f13f89102688977e18e14dedd7f3b676256b0263
 118.478 -b66b013617d9a026794b0d6040c23c5506a98530249633a6beec46117c96
 118.479 -ec036eaf6439e25b8e57754af5ebaaf9b57880ad4fc93f002fb03e9fda21
 118.480 -df4acb78296b0c49a5a852c134c3b10755177a0dbd6c54ea7a2b9bdac62b
 118.481 -5d7f3da649df856478e4baf97899e0f891a96536c283f5c81200c51c6ab6
 118.482 -77285450c7f7e96836b6da5660f6cb76782ddfc64b6fc348ebc3ba4a46f7
 118.483 -19176296d8c5a31132b3fa7d935a5d777c1dc84d669d564cb4fd689a38ce
 118.484 -680d0b3b130caea0be43864826d0d154019fd0d865f1c389cd367cb5248e
 118.485 -24640eb6f66603e50581f6fb5aca6cfec1d6dbf4196da10a5e1ebb14e4ca
 118.486 -0251c4c8412cc1673d6e7a9666b04b090567efa0b830d2362fd384cb0303
 118.487 -8a40290597bdaffe429bb89fb66b9dfcfa92f39d92a8baba7266d144ac04
 118.488 -f069093ebb3fcea961ba4497d3628ad207e0c8c4fac0e5f3f2a663a8d05d
 118.489 -b6dc33b890ae13d84dce64b495d24cc749b121659373ca31cee09bff2e9e
 118.490 -e5b62e89d5faa4482a75f341dd172500a54b98fc108a69a3ea94db696513
 118.491 -d4c7691e0095ed3900cd4489ab008b5460b34ae8dedf3721c60de7086605
 118.492 -6c391137cf23255c565bf11403bdeecf8bf39ad5e4317a4bb37003b2e7c1
 118.493 -400c3b8ed7f63719bddf07908dc2decdb0f68e8ef722851c4420303f6de1
 118.494 -b5efc9b2598732fd1f2cbe45a504bd7fbfdafeade3add7274a1e875aba3c
 118.495 -4e0abfc6444944b79f95b5009560818f7a0599e5bab4405378fadfe084f1
 118.496 -653e5a0166714047e8bd4e4cb116596d8089bae9147ec1d62cd94491af75
 118.497 -a1743d58bafa11b63b447c954a8d7fe11d39d969feac8fa93c614f97807d
 118.498 -ac62cb7a84a974a0fa555a2e3f0ef662706efcb828ef72e2ea83b29e212d
 118.499 -f89ffecabcb08dbb7119203c4c5db823bf4e8b698b763fbd4d21e57940d9
 118.500 -1754959d21f3f649d856ac6615eac692ebcbac555f772eb6ba3cece5ebfb
 118.501 -cfcc2f3d8dcad7edc697df93aef762cd47cc3ba9e2cdd10940be676efe7a
 118.502 -a3749170edb47b7562805e3f8bd978b18057c9110ff8d19b466ea238af32
 118.503 -993e2d3021745b238021f824d887d2e01a7ff12fc6f084b35292f4864579
 118.504 -406c0f61d0ac7cdf7e4770b424e2ccc22353e6c82bf8ff172973df267ded
 118.505 -bdaabc2a742beea02e35b9b253f98de9ca131f802deee2905ca1a6dc4608
 118.506 -19a59b4a4265c723007d0215fc8ac2a91ec5f86cd6aac1e370a297103c3a
 118.507 -3cff58c7ae201cbaaa8a12c93e95e73974f9abcd678451b1db02ebb2e10c
 118.508 -c5abfa573a2ea4219fd1851765649318bb556b728d432ec05a86e9894aad
 118.509 -9cdca63d08642655801bb37f28b6e11b958e8e800c8d521ca4aa045fe9ab
 118.510 -ac02dc015d18b1901d519181ef60227170a07f3328a6d5fe4c5aedb35fc1
 118.511 -3dbe86564a9b1dd4c7ec648880360cdd1742ed4ac409450f1d9681cb5e46
 118.512 -5edd1de2a2c7f8ed63436f98e849504ae71bb872683ae107ad5df3ca0b47
 118.513 -a5b79513e02d7c540257d465ae4521cb3449d79c931e2ce8c5b0a0a4ac88
 118.514 -cef7b9e5f92bf721ad51682d6b6f6c14747f78eaac1891fe29aed4eaf177
 118.515 -e3d2fc655ae889c0c30a3575a76c52e95db2f6a4d8ffee9518391954b92d
 118.516 -39dae4e97c4022031f8ab390b66ada6dc9ab2de4d1dddf26ac4032981a69
 118.517 -08f73d34b4849ae28832cddc0dcd116a47d9262b0f93c24fbfdf8a78e6ae
 118.518 -ae3357f3fb89530854257a9db773a1acf5271fc4ca04a06b46dbe661ca11
 118.519 -9f45e0080cd129e1a7c23a33f1c48af960761b117d9d91fa5a0ed3e47865
 118.520 -b774a322f7dddfda2960b91fa7ba20c8f9eb213251299ae328b28ef54b0f
 118.521 -55fd54f8047c555e4045cbd70964e1c953e471408e4f25fe8ca7009bfe44
 118.522 -0244b1e30dff518ea7ce5078027baba4e07ecf0ebecb497b4bd88f1ff72e
 118.523 -b261f6dffec0ed895e237b5608d31ef479e8c9ae9003039a5fe67252ee39
 118.524 -774e1501100c0fcf154f5c5c81c70539e03118ab91f4ce247f6132d46346
 118.525 -bbbb126c09d7459c1977e6e367a0c83d14edf7dea081e5f795a7c831fd1b
 118.526 -325b33674ec9c2b68029a0e600746329ea2e1b9bdd5cb2b140468e53c108
 118.527 -8e8f2567425443f8146ec37101fa4dfccb0e032fff6cdfd76382463551b1
 118.528 -ae8ca6cbff0e34a3f75ad400a9573217f8cbb00a6d59ff46e48421e97091
 118.529 -cb17f53f20ebeb89609ea55ed6ba4101f2f3ceccbc7ade21202439ef91d8
 118.530 -a9a783c22de7e6601b50c4342e094d0eff223494489fa92150425da1b432
 118.531 -908423fb3f41e0b115ec1ba592a4f920d15610b9fb33f9912aba67912d05
 118.532 -1ee00a13282c1909a3a56c4ed06f2f4d1739dc296b7492aad0446f87a416
 118.533 -c6db4d42b504dec3a6756f3d0845ab2d2e151aa5fde12b31a9c3b5ae1cc9
 118.534 -d97192bc048f00dead66940004281c4d5a92c20b1f77795cb4f98b8eaa7c
 118.535 -be16f9b9d4a34a1a53e0a0deadb4fb4b20d9e8064d3412ea8d2ebd259b8f
 118.536 -2f04bf4bf11a5ab7883c99943d762549c3d5866bb6ed85a0e862eafbcfc7
 118.537 -03bf4b77cecc0d65bce4df33e0d65456397f231f8cbf66672457cf539817
 118.538 -6aa5292fae24695009e55904a04588659a3a23fa11989b925705ab45f954
 118.539 -6f862b0e176fddf75b70d9ef7389f750becbffae25d58a1252cc04a79e13
 118.540 -fbb6a666fd87cec5562c3e14fd78ad05be28ff3871d6fceff5aa8965bb65
 118.541 -67ec76d105a6348e915b27767f5010011e80e0e2f9c34742a4eeba369e66
 118.542 -8faf086a45ac9bcdd76c758db01a78602412a4244c759ece0b963d9ea58b
 118.543 -0efbf4376bf115288803a54cfcf78584c8af80da2a3324096463e3898285
 118.544 -57de6c6354444b12a74d5e66053f6907c48522cae9e93bccdb4632131add
 118.545 -52eb374213888125de71994c31dba481b70b2e4c1f10b865d58ef09fc9dd
 118.546 -2ca7f69bd2855895256caa5dd6bf7d4d8b341d677c56ca08fd7ba37485b1
 118.547 -444af8be0dcdb233a512088936ab4d7fc8c03139df396b7408747b142782
 118.548 -d9406db0dcd31368d2f23ddef61b0da3c0704e9049ccf7f904548c3ca963
 118.549 -76eadf1ccf77f94c157f5b84f74b0c43466134876a90c5fdc2c53af70c3f
 118.550 -f5c2d13cb665fed9016454bac1a629361c8ea62f4b2399233e8587db6e75
 118.551 -a9cde3530f20a68ec155d275a4aa6f63aa5cd115244643b54911c954feca
 118.552 -d57be2a6c40f1bac38e393969617b066f7d94e8b18dd80fccd0168d4a385
 118.553 -f2f1489d1dd41b68d47e5ec66ec568333d1f584e3dca90f1367a990630d0
 118.554 -14355be7dc45378aa111c319838edd441f15e125f928e044640f25ffdcc5
 118.555 -c116c3f6ce0d4d3195187b22200808366eca9b508ec45e664e562186efec
 118.556 -a97b22835d384758849605a01973cd9ffc1657b124950c9d9fa3e18b1a20
 118.557 -7156c4f96f08b87824373c2865845d17a0dda71b1d69f5331c5676d0648b
 118.558 -ca80a7958a2aa034d7e1e9fafead9248e6e64f9ec327c60ae4f724e1fb95
 118.559 -8a71e82ac3842768b27b506b5982311557432dc3f270ae6eab23a42fef70
 118.560 -dd0d407a02cbadeb7b8b74a2523cf46a5f61e52b053c2007f75ae053a96d
 118.561 -e00646662d027d93f950e516cddff40501c76cd0d7cf76c66b7bcd1998d2
 118.562 -7a19f52635c8e27511324aabbb641dd524d11d48a946937b7fa0d89a5dbc
 118.563 -4b582d921811b3fd84c2a432dacb67d684a77ac08845e078e2417c7d9e08
 118.564 -bd555c5265024aeb55fef4579b46f8c5e79770432c5349d5a65a47ce9338
 118.565 -e1b599328bb1dff2a838f732852f3debf4bb9b828f9274d03d7cf813b123
 118.566 -687c5e78a26310d87870bfcb0a76bf32aa20e46f6b2826912e562f503aed
 118.567 -11e427b7765cd2a68da2ec0609259ff14f57c07963d075e96f8bd2eab9a0
 118.568 -dc32714dd8905f2627c6d6f33563436bda2d7fa9a976f88947b84c72f454
 118.569 -bf0b66ca84470375d2ff252b4a2df52ab613d0c8ef0465ff1d809ca82025
 118.570 -c2122a8f44c56ebfa25690bf6a05675ebb8634ddfd24c3734fe8cb32d6d6
 118.571 -c69c72a4951cb959175770b4286d383e7a3f158450945c8a2ccf7e54fb19
 118.572 -aa8d2d98a07f0c55f834f2728d89f82a598269750115a02287c4d415cdaa
 118.573 -14e1d9e7032684002f90603c0108dd26b40fb569bb21cc63d0da7e9e1873
 118.574 -9df0a9c85bc340d2b0940860d95571dc244628c59bab449f057e409e58ca
 118.575 -cc3369f4baa8e53c6765a55620e78341dae06e5cdf2fa5e5ba58634b29ee
 118.576 -ddfee7f78672e55f18a7debbc30862f278f83f4cc123ab591371f548fbf9
 118.577 -bd24b3453b9b57051c2e67edff2104f3a05a9f0cb7efd81c1b1b0a2bbe95
 118.578 -21854902526e5d4fa1b3be270811b972e8726623410cec7911c07f871428
 118.579 -1caaead97c503714eaadb14ae5923f020093722df1b9d9c055d7d5f95af2
 118.580 -a9fbc5ab6f6c2bd655f685534d7dc5fbb5ebded6ccdcf369bd83c644dc62
 118.581 -84c2810495888e9d8f464a42228cdc231d5b561c6b210bc493fc1e7bfd66
 118.582 -5a6c4055a6a629f571f4f05c15cb2104b4f9d0bd1b1f0ab8252da384eeae
 118.583 -f5fd5c663ad7a2c29f65a48a30ed8de196f9eb8ea314c6e86989298146a5
 118.584 -589f76f12664c8d008228b33144679d16ff564453b5e4e9f813191b6c99e
 118.585 -2680e20a410949ac30691b1428a255b6185b7e3802e8511192e73c376f3d
 118.586 -eb807ad2727fbb4b27538b3213da0746231b1c1b595a958466155835c537
 118.587 -e0df4a0ef272d4c3f7f2ef011daed38bc58bb0fd7458e48060db98971bd4
 118.588 -b24bc7bd0de92573a1c7a80a5fa2b34fbe50271dabeb83aaa4235cb7f63d
 118.589 -6a6b399360df8b1235e4e9ab59698930044a98d5e083b5f5a5772309b390
 118.590 -9e1ff2a252734b32fee3940f0e1ba61f54dd1d3f6ff0d57c9ae75a302d14
 118.591 -b9dd9034279aaca80b6bd05c74bf3d968305a5046910871223a3ef8c77d8
 118.592 -25d7e6d3d2809e76064c473d1cd7c05666040b6eba647e34588f49fd70a0
 118.593 -3c937933a2272c938d2fd3aa8149f215bb48f3bb45090bcb9a6ace393a44
 118.594 -f1a9bda2ad09a5f566b2e8887880afa45a603a63ffe7c188e3eae926a903
 118.595 -4f1803368e773f42c7391dff1b9ce8599161515c549aca46aebae7db23ec
 118.596 -8f09db0e0f590aab75e8eb890df354b37cd886bdc230369783a4f22ab51e
 118.597 -0f623738681b0d3f0099c925b93bbb56411205d63f6c05647b3e460ab354
 118.598 -1bf98c59f7f6c2ea8f29d8fe08df254d8a16aab686baf6856c4fed3ec96b
 118.599 -0328738183dbc1eebb2a3d301b0390ed8bd128bd8e7801c89941485c3c86
 118.600 -22b5f223cb07dca74f0e8643240044e8c376abbd8c82ff98c6dba9b6d244
 118.601 -5b6cf4189d63c6acd6e45f07485a0fa55eff370da7e71c26469740a68627
 118.602 -a3c297d2bf215121fb67815b7b9403aecca10d21e59fabcbe38f5ca66e7b
 118.603 -551b22e28f2d1fd7303d15a42c45bf54b40ef7fc93060ae5164e54f91c55
 118.604 -20bd303a98d0667a02a900813b260c0343021ac01872fd62cb6abebc7ad3
 118.605 -a4456805159839ca4a3e35db586221169ded66f852e8974e3815d4d7659f
 118.606 -6a9bb93585aaf264f06cb6da6a26e51683945224158ea69719b8e4e36eb1
 118.607 -01333aac974db8f84b051724cf245fe7a4c86582b5dbb9a5d9318180e33b
 118.608 -8d92c22c44b0d18f8ca34dfa4ee9693c1a26fedece01635fc5eac1fefa81
 118.609 -32458254ad46dfdfd2be12a1e7f32f3728f286f1d5d4394424a073696b65
 118.610 -e3c459aee9310752231fa703faf35e11796c4eeef698f4109ca8c46ee322
 118.611 -5dc2e3e04fa787188e583321f8410b68b9624ff60679d3f25c13e5ea7506
 118.612 -a3ce8d0bebb99d9a959ad92d8cf909988d9250b310629903d6bfcad4581a
 118.613 -504b91b2c91889987f36d6fd0be1d0ee5aac00aa0cb48d78a1f7a64a777f
 118.614 -089573ba79452efcc31c8258fb317369feb0d7ccd48cf13da6d1ccb59a4a
 118.615 -48ea0b398e590c1169113fed81639e13e96aa268d99cfdb7aee977fbe85f
 118.616 -f784853a06642b5521ae0a7f610c9739af31ba7a5157ebbbad999e23794a
 118.617 -d2cf25af987dc85dfa29639957cf28e7f2b7671188045130a6e2785f8d8e
 118.618 -30e91f0f68c1cc9f2de902952730003e816e4f5703db7a97b4c566f80547
 118.619 -42fa77be563ef681a4513b9a68b2b0956551c74545cc9883428dfa72fd5c
 118.620 -4eee93256b26bc86ea34f7427cb0c0cc22c0cc343f739c6c0c46d0923675
 118.621 -5e04d70587426ef875f8c89ff8492ea23e4e4d763b84a6437a440e69eb70
 118.622 -65ab6d8cf5f8444a844e6ef3d158b451d121daea2d0e2b423eea24254226
 118.623 -7eff1b4224c4e80af2a7becac1649e4bbef09f39415e9b1e3750d7ac47a1
 118.624 -068a4f5ce30840b00574eb4e683e3ec25f6e690feeb0d354568efbc354ba
 118.625 -813ca1400734a67693af127b0f636d58b83e91548f98e3d87da7fd7cdebf
 118.626 -f3ecb4b9272d1c83d4980170378d32f1d98b87c440881af9ec052510982a
 118.627 -0c02ba6743bdc7691a44bae5e044c25304c1a2525cf2c0694494a2e9aa34
 118.628 -f36af43ab288807ffa4bd418ad51d98c75f2b2f01abfd834d3305682b6b8
 118.629 -62ef69d05962aac485bb4f560583a5dbb74e967eaf6d299160753ec32249
 118.630 -bb1d9851d5441cb0c624208e69dc876cd8841a66976b5d7f9c99be68363b
 118.631 -8112d33d971f2c4f2a1feca88ba1a794ddb725c5e2e2c248082231059aef
 118.632 -729bb5fee5006ab8809f63e162fc0743c047c7984a9e6333b433fa143d73
 118.633 -72d4a74fe37314508e04f54dc7a1445e2d6178ec9c041d0cd4fda5cae830
 118.634 -4b16feb21f3222261c293a8b058dc708405c1a97ff34eee4ca69ff4e1ee2
 118.635 -a03380d52297574e3aa50c8afb826fc94a14e8caa9ba89d6e92913be9e07
 118.636 -bf7ae011e6bd142d8952d9c2304735e875d1ddcf82fa9fc0c6449df2acf0
 118.637 -d5f6cff6d21ef6b2d29022ed79c4226c97f163284f2311cf34d5b0524a1a
 118.638 -a446645b9d05554f8b49075075f0734b3d1ea31410759c174fcc7305d2c1
 118.639 -d7128781043cba326251a3375784a506cf32d6a11a4876f85ffa2606fbdf
 118.640 -27dd16d64b2108d808e33c409dd33f6e0c6079e47e7196016f261e824fba
 118.641 -b0e4f91a189747053e648ad2d942ece8f582f052668b63a23a2fae4c75a5
 118.642 -180db7811aac654270ec6e341126e3561429f1d41fe7ba3f1de9f8bbb8d9
 118.643 -fc5cebdef869376a2e42dcaa578c0807835e58d75c39f91a83d5c1eb86a1
 118.644 -b0f7aab991f65eef030f212d38d10b1913bff71717c06c78d9a1be136f21
 118.645 -4be157ba11ba309326c55c23ae8512646751fb82ae200c06bd2e644bed38
 118.646 -c7cee826cb587ee8ff378b7fdc00ec316bd4a9c24e2c250cb3d64f8ecbb8
 118.647 -7f4d81626d7f1e4491908bf17c48c84bb1736693eb4d0fe634484cdd590f
 118.648 -a40ae94d44f348ba683a43004b487f047745fcdfdee2e913328a11a99530
 118.649 -9bd117e0e5be4fb25d176d59dc2b1842418141190ed9ae1f33e5354cacfd
 118.650 -a5e4bc186119e1461bcd98517e675276ddf0296d3b3cef617dfa36b4759c
 118.651 -944fd721e1bf63d45cea90b5817a40d153a2f779e03487cad3c1375425ac
 118.652 -8cbabf7f754d16cabe45c65f1be4441908e0969d5a5111c931e724537dea
 118.653 -7cd3fbfec9b2f7d3efa747bf586e9218c3106c49276b89fa28f770fa0644
 118.654 -fe1f3fe3adf07f59c755a5b39a2ac1d6f23c256a293bf3b31b6b9cf4c622
 118.655 -b188d6e7401c038657c78bfde9ba09f508f1bbe3ed79793772cfc928c4da
 118.656 -519f7dbf3ff7074284437d2de8d7b7c78829642d924abacf353119e9088d
 118.657 -14739935a23667c432806085c3af71ffb7c5fe6b4412b9b1044c1e62ee0a
 118.658 -a5ce7e0322bc65a8c7d874270d84136526e52d0c7f9f93199c6bb7301216
 118.659 -a19bebcef3c5633f21d012b448d367157ad928e21f8e471e46982bc46a7f
 118.660 -df1bf816a86dc62657c4ebf286134b327ce363ab6a66634eaa2a42e99034
 118.661 -069fe1302febf06959eab8e7304da4d94a83ac1650a02c38c1c4b7e65c43
 118.662 -e3a6fb0213e57ac49e58721a4f36996069caedefeb48f1a59303459d5873
 118.663 -f3bedcdb9d00c1cf31130c27b60928f210e1aa5e1c8e04b86d2049f31265
 118.664 -9198fa646c53afa9058eb8ceb41bda65f415c79ac92af5790b176de1d300
 118.665 -f1c06b782d584f458dbd07d32c427d894f84215a8e7819e295ee98d976d5
 118.666 -644f11920ff2f49cb1075c3bb42b9fe4b561362902f11a75669b7e7c4475
 118.667 -b65f1ae48834cd67816eb63b58cda2f50bc22eeb0cc965569b476bedded1
 118.668 -2701668f609393659b266bb0e37bb27afc90bca271366e34754383363592
 118.669 -0f9a3b508aabfe8deef585b07a992460c592a150b325b1e50e4214a2f483
 118.670 -e9dfc826c54b488493a96eaa37276f5a9666f0a5388fe388263d2c0cf614
 118.671 -c6cd01571da4389f01fcdbd0ade1c435d64c5921b5bf7dbebd5268100a03
 118.672 -1e1abb8cbd83873089a9e08cf80276c7e30d2bb40280278c29fa818eb079
 118.673 -87623b1cfe13e0b01e27be0a8320b69b5afee820f4705202158b7f3059b3
 118.674 -655bc28a754d088fde23d43d6a9389da8bc1cf3e8ea1a6f4328c196e655e
 118.675 -42184444d8c0614c7167c91a492c24c8357794c61f5e47cdaf4b38004a5c
 118.676 -8fceaa8151e929328bce1b8f67b22034f3f75e4d105283337c3d460e7d99
 118.677 -89920c43f5e1449c74ad6ab5ea029cc6e497ea60068451c4ef2132fb87ae
 118.678 -049077a156c868b768df4a4c475a532e2a22d999931c64f8bcc18f51d25f
 118.679 -0f94fbd3e9e6c094f78da062f80c4aa2b86fa572cc469e629deb4ba0c553
 118.680 -55e8422b562ed2f694d0e8e5540144e30841d7593b255edd4a61dd345d5a
 118.681 -00e411d2c50d64782a3ebedf945fc31c00d2fe4ca800f5aeeaf12ab399db
 118.682 -956362e979bd7ef0787188e43835e5389ac444d13204af6bf1875622f175
 118.683 -09f32015c28729cfa3b3cca90308eefaf260e3fd9df10f3e76786b8bc0eb
 118.684 -a30e8cd33689aabc55e3ce387cdb89a30573495852a48009cb58a0fd34bd
 118.685 -da911159ccacc94698ffb94c5f45f15ecc9e82365174cefbe746f95eee44
 118.686 -7a33b4d823487e203478eeb2d8c4bc7b743427778249c56e48fe17d0a501
 118.687 -7b693509ddfe1f42bdef97aedcc26ceffa9357dd985cdf2c70bbfc987354
 118.688 -6f0aa7df227ec42f9ca2482f58809e3f9650444568c54d3520bd0a7301ef
 118.689 -48bfebef1fc4332b5ca851fd786c1ece136fe9e575b69393b5aec2611903
 118.690 -fae6e7a5046e2ff350becb8700f209b1131044afd32fed1bc1297b6a2f29
 118.691 -6ec3b87f170e92aabacc8867360e4dbce9ea29f0c1df981f6cecc8986767
 118.692 -0ccfb4c9faeaad7ca9029b8ff0129fec4a040f80ead041b3bc8af7526675
 118.693 -ed9e13204e64d76440a097d77c535d34165bfe9ffcade530abcc75ae224e
 118.694 -890d5c110004e218bd827a02ac7340e18bf3684c43e664e0a37d5fd4fd1c
 118.695 -4d4489d25a99d542c16e06685652cfa3567da4eb0cb517be1482939da0cd
 118.696 -d0ea3519ad1e51bd9dc7b9077375a8cd3b5de9888697e853bacddbbdd1a3
 118.697 -0e442e1d6f2d652046821813d0cc0e8f16c97cdd32daf239f5b2b65ef620
 118.698 -46f6e9821b2e2ec539302747795fa746318514d38bdf0d0e490c00e114d5
 118.699 -03e7fc9a8fb83b14337a5bb4d640b52630f5450bb3bfcf7cecfbb1ef5192
 118.700 -ae401265450db197bcfa07315ff95a809bc5fb4249e3a728a817f2580ae3
 118.701 -50d8d6577f79c883ab4a3119d9ab98219aed0d1e826023a66da814396058
 118.702 -d95e52d9af8bdbcb0454721f27855b686d13bdb473f650c9865f3e04f08d
 118.703 -b10f5256a3e59bcf16b12a84bb7ef3b370647cdad5929b722a05f5b3669e
 118.704 -14c232bb82fcb9c1dd8155ff4515f4e83c895cafb86754e896f38e5f3beb
 118.705 -5d29f1bd99cb8a09c5e50f412f6d8a773b79021ab2c4831aa663c5defc4d
 118.706 -553616874dd5bd8b75c7a2af7d029aab5a72528fbc4b5ee3d30d523412c9
 118.707 -60b432434017c4cd68b2062d28f307fc287e11663511d1a6b52143afac0d
 118.708 -ce0f7ba3f326fb707fb8d2c985dd60090e6664f2344e098a7a1a6448026a
 118.709 -2ee651e8141cd7786b6543f512e4c31d25dcaf6652b1eb52706300b771cc
 118.710 -0c49295067befc044ea46341927123ad4b7d094784bda7fa7b568853d0b6
 118.711 -1e4cc39e1abcc9479f91a2501009ae34ef7d5ff56205cf5288503591cc55
 118.712 -c48abcc78daa4804549562afc713a4c11152e6e4331619b2e474a25ffb62
 118.713 -7c46112fa4259f07871f8d6882e9a7ec62d20a86a0c502815d0a8f3f5ce7
 118.714 -cb4a6a74b6db8e17d54bc919b82c7c729cc05b98855b9d8a0fabd8a9bdfd
 118.715 -4333f395607631f57c0473be0fb290c4f40a7aa6ac49208570ffa1d0f849
 118.716 -d4871ebcf9ef6f5106301cf54ff8cc9918d6de74d519fccba58bb1c21543
 118.717 -f3bca9f43c211b2e5c233ff6dff2c9b56d3f656f6070d13dfd0be04653e4
 118.718 -98c670770e01c07b731ca0e2eb56e608828fedaf1a31087f2d43cb4c0074
 118.719 -e576769b0830577c86ad5de48ee216df02d7c4e4ec231afd8e76c608fc9d
 118.720 -06cc86f38cf4d839e0a0829902f56cf2f86f08b975a6bdd0642d6b4c78e2
 118.721 -57cf9a4f52646a952f6a220c36c91db7f44c7f44bddf33328ea8cc01827b
 118.722 -5f2d79e3ee6c514a4f8597a847ef5f32c6400736e6ade28faa7bc6e9c6ba
 118.723 -e4bbff236fa6dd2b0ed23fc77f92649feba149f82488260b0bea2a4fe1f4
 118.724 -65d96d8c51719e5e10d4c17d1b67e700aac36b1ed55c93b4b2604e72f51e
 118.725 -b30fbf5b64c6fcaaef764639ebd789f82ed354712c7f9fcd1df257e14c0e
 118.726 -8fd59a0eddab684bb1b4176d79b22ad2605bf534e4b8fac2272fbdeaf210
 118.727 -0424a2c5cc65f8dd5faa13313dd926128ed466046ee94bd3eb41f3ea5505
 118.728 -5a70603a2ae1981bfae8e77d850fc5a5bf1bacb3df9b7cbce68ce7979fad
 118.729 -a73c2900526b68236c6d37197b0c521c5b1cf5cbbc89238586eceb99818e
 118.730 -aa47ca94ff615233575fe83d0d50d734351e0363030a12300f7b20450946
 118.731 -17bb209c346ac1d35402b617d6260fce04ce8b3231ab5c05af30b0f3ccb3
 118.732 -3616d3df334c8d963279537563222dfbb705c3e14616ad01927f952e6364
 118.733 -4c4b7fa44ac97616c1521facd066aa33b2296dc03682eb6a3b9dd8e5bf62
 118.734 -53f10667ecb07bbd50553f1b211067f5cf098b64b84d94ba9ad8b146dc9e
 118.735 -8e9be06bc14cfe0945e22fd819856d6996e857c0bb5f292defeb493589f4
 118.736 -515700753885d61eee1b8c19e6e94fe2302c07933f949d6bf119d207fb04
 118.737 -dae7bcff7578bf33d77e29611c7cf03b2df12c242827ec4c4e5b5343ca3e
 118.738 -4f7f38ed337583e30dedd78a082f41d60cbad55d59dbba11af1bd296ed6f
 118.739 -e31d2e10d3a8b5ea698e656ff97755a47ddd862d23309e2e6ed3e3e111c0
 118.740 -2c3a713d782fe301dbaff0a4225f932576622d1cbae40d20f46958298d01
 118.741 -783851c894f2712bfc4736d3802e548a704878e2d139348671fb96d0ddbb
 118.742 -f56d9349172caef0dfed4b84d867116d91063dcdf9ec401dfe8abb269ee6
 118.743 -0d646bd12e0752313e2ddc272d9f4aeb9d940987596ab623f9198765cec4
 118.744 -62f7b6c540c9a70c9a872bd28ea62e056560b61ec51fc68eafe008f20760
 118.745 -246e06374ae5a6bd2577217700507978811ec29985ab644e474e41e8a105
 118.746 -295fa67ae05e0739e8c7fbc51104522934942f53e1e1df1ec2a66f0a74b5
 118.747 -9885cf2c2fad1cab3e2b609f126ac8b7350d5408a7df9ed5c27a10ef6505
 118.748 -6f0d877cd7bb902977ba93e6e8520d2d018560ec8143876ad0dcb95b173d
 118.749 -af72c0d413bbb5541f14faa57eedb3ac2430e36911d2f486d9ebf9cb6745
 118.750 -2ccc763e1e46e7a4b8373e06082176a6c66d045e18f90b4b2ad15802f6ef
 118.751 -cf2130cdc627601ecc19887784b6de7fb6a193bc3d057ace29f74199acae
 118.752 -69526ba6f7a2c669593f9d0849f12e37201c32c88384e4548a6718cbb2ab
 118.753 -714ccc917d93b865ac7d7d4dbd13979843f4f5c1f8b937ef12fcdc9aff50
 118.754 -f09d2625f4367ee70a98772a273d8919952102aa03297e3cbcd876da5abd
 118.755 -2ceb162b8fe1d9a22ff694495528c09a8819fbfb6946ab205d4b2424f6d5
 118.756 -6fa1c704065cb64fb2aa0fdf291fd5e7daa38667e6d8e889be7f4c453da0
 118.757 -59c492cd25fcf4a03a6995897145273a66cd6ba999138bc8e2aa7d080f9d
 118.758 -231497ed28a9a27b6b0d4785bfaee46fee71b26d6839f2549a14e7ab7347
 118.759 -0b6cf368d2d49e74c78d93477828e4582589cb447d795181d3f13dd8ad52
 118.760 -3c750df8f19b3260c17a6598b406472a7204dd26c5988911ce9884de9a1d
 118.761 -ce33d834becb1dc80efb07f32d3ed6c2a484c5d53746071576c3f67f25ff
 118.762 -1558986fe2dc2265b4fff79c07e3f4c6c0ce8319e04c14728ed722cf214f
 118.763 -65066148bc817753dfdcc0950bf80dc515002e1a92e7d8936e9b3aa9635a
 118.764 -a6d512c68aebc79a62a6bd17a411bba7684e1f06be9bc3d1aca25d50c8bd
 118.765 -1d75597194cf87c9ffe04ff28bea91b5b9521fd356ed9e036466137586ee
 118.766 -f0a8795486438d0d9707cb2854f12963929edac394c562235ca71376d938
 118.767 -e4e1518668180b857d75318bc22e9f0683749047e7649f9e20b35204b6ee
 118.768 -60c0d47bebf53179a083f0b4cad5b3327a3faf2cf03753e3e46c05773629
 118.769 -7e9bb305f603369cbb568350b2b5c6d23a35c551e0ab28b082e321ef4ed0
 118.770 -e2704d35c75b4750af782160c2f2e9aab0e14e541e95b64ebedd66db2c12
 118.771 -a8935a60177cab634e20a8871a3a72f4b21c3a34d9dac37176a321c2ce3e
 118.772 -e828d140c8445117e7fe4738000c30ffae8e2a48bd618cc8813e38fa0f86
 118.773 -92ca634d1e56010987483aa0f08980d91528df3d370ac724acb238e141ab
 118.774 -595dcb3da7a769de170edd5763078d1084e2ebefadf8a50a816b50722617
 118.775 -c9539dbd68d9062b015639708dd900aecf4f15adb36339c05a9aec7403ed
 118.776 -771f9f28c60e52bda3ba6902e06334036c1dfd66d35ed00e3fc0bebf55da
 118.777 -416093b5cf512217c47f905ccc91fad879d63dd1380519a02025ddf15d70
 118.778 -eaa1bd8cb6be67608fbc5c94796bd09ba35933f64c5e72a26db1ae40ef49
 118.779 -af5e972fa44660588292b67ac670bf046cb1f5a7a0d73ffd6df862744786
 118.780 -4a56393b0f1b4cfcfa362c74634713093161b29c94a2526b7138aa92fdde
 118.781 -b37a8c1f30a6b3837d9500b340515f0412e681f5bf36e7869fa157df18e5
 118.782 -c79df3e6aca924d7b7dd2e0d5b87682d7ea6913b26397ac180fb75fabc1b
 118.783 -8e156ed542b9d8c83079bccd141c187f90d72694de4f6d08520d11cd454b
 118.784 -bd3c2e6d259694fda0c8decc724bdd650163b7f6ce1181590c06de4c0dd8
 118.785 -536aba318cabf54782c919e07c2ffa1034143175d05deddfcd7dce6c86a9
 118.786 -ec9bf6a4437da474aac2dbce2c91aedc20043f179d5c9120f3dfb1cf6906
 118.787 -c27f2ec68cd75035c283e1672ea90d953a23a1515c420b81c3270fa06573
 118.788 -4d003eca1bb71a2dacdab67e44f47c266c2ea1776648b62bc110671e6eca
 118.789 -4546d3c72c8acd956e10452c32532ed51bf3d0518467fa829efd9c896e8e
 118.790 -1e5c7ff6da0b51e872e403470affc95f25e1d2b9b59ddb0472705e14fdc8
 118.791 -fc2af16527188508be10d098372cd7eb7d62a85c8d8dd1d0f55ae3ccd0a6
 118.792 -5dd6bf776dc187bf4de409d5db3fcc5a6d852848a251f4fb4e01dac5e9b9
 118.793 -587fa8c46ce03689709008b34dfb3dc105def80a1b515abcbe06e73fdf7e
 118.794 -7136e40cc922fe9a9da1726747e84427f288d934747b6c587490734906b8
 118.795 -a91144ac82a57957cffab561714e1ff5148a39499dfc8cc96bf5d87ced17
 118.796 -825e8f80cd943d9a73945fb8bc51cf1f9cb39c605491c1bb8f1c4139974a
 118.797 -59471ead310d041b1ca1ecd5e9f92007cd8243cb3fb1ec5256444699a9fc
 118.798 -ed6cb31eaf0912c16fa480a1cb4a8f4a9cb6a4d9a9903d1e2f674286032b
 118.799 -489b8a23ac4719fe435a9fa2d79abdbaba740e69d5ed611421b1aefcd06a
 118.800 -362ddbb7b79aac41e3e90657afc0b87a6e8c57ceef70a628efe19f568634
 118.801 -50f47b5c6d95870039caa3d07a54e58df064bb5f59dbe9b9a2c7c84d7e0f
 118.802 -32386309560a0efa2cbfa27f861b208b2df4a062ffe2c59c057296aaf5c2
 118.803 -0f48ffc9ff0692f8cfbd6fc6ed1f3a14537ba40d7267e6b5f69c997a949b
 118.804 -26577a9a99db3f53167355c4967dabd522292ddaca3c537bcf303ce76add
 118.805 -eb99f6664227a94d6a698dd5a5d40008349376067d057e28e55972264502
 118.806 -e035b1f5e33d7b3aeae016f9be50f2aa09aa138d15d7af3c1ccb805f2d5b
 118.807 -cd4e9b2b5c288b2af4a25abf0a9093749377c9e8232ba1af17962f85064a
 118.808 -23b0a13f11acbb471cc700f9f1b588f72cb63d3d1a95a93502ef74ed212a
 118.809 -c452f1a84619bbdf61a1dc79c0d9ba29c7f19b400f682cf66f7705849314
 118.810 -f5c8bbf973f2c53bdb060932156bf2c9cd8d36cf6271075500b0e3e6ad49
 118.811 -958af46a9dc950f4c29f1ab5dc0a85924f7ffef259f778459c80118b1eb1
 118.812 -ed29208d1145b21b19d62f755de4972c57a09b3decb0a8096ab025fe6b9d
 118.813 -be49ae35394f0ea40d3693980f97f712b27f0e28d8a549acbf1da63518d0
 118.814 -374941effacf63ac3de0523cfac0dcaeb690de5836741fe58917c7ecffc1
 118.815 -95e7b560a3e763aa70fc883751bd60ea0a0f893d8e9fe75a66c67e202c24
 118.816 -84f66708ae74413c0101fe0b5003be20881345d917203b582a247e6c74a8
 118.817 -1d0479f317aba7b9dbbc0a92e91c51fbe8775a44c57699acc9da84ad60fb
 118.818 -9629929d1edabbd70b4ef9887ce4ec2469f154fada42de54240cf3302364
 118.819 -7c492ba17e6936a4d85e0751df0945463368a803fb40d8ded22abe118250
 118.820 -86cfff1878abe5b100bc08b991cda6fdfd579332360f0c3374842edce6ed
 118.821 -e43649d6702f34668a29bf387e647f96d78f33395e8d4b3521cb4fb0956d
 118.822 -12c924c16eee798cde68e319a358cc3524c753177d976d4e14a2e0cb72a4
 118.823 -80cd87bfb842060b1266568af298bbec58a717c577be73ad808e004348f1
 118.824 -6aead32a3d57457376ab57197534d6e469ed24474a83618f3ce21df515a1
 118.825 -22918f4b62c642de0c8a62315ebe02bcfc529c5b8f7c127085c2d819e29a
 118.826 -f44be20fa077ee01a8d427bbe3d97a9d2bafd77f17835279bf135900aee5
 118.827 -9bc49582b18d468bf93e47ce0bdd627775264ebe9e4172839a444f928580
 118.828 -8c95895b7e23592b2dcd41ee82e966c26aa2143e3057161511796e980998
 118.829 -1f2e4ef5868b3bf4576e3546e6407e35cdf14654bcefa7557d09407545a2
 118.830 -38173080b4771ea52054736677a8d9749a2b22b46b24fbff93c55aa2274b
 118.831 -8c7ddbd751bcaf1df00ccbe1f24a80622aff192fd6db2238db941ec44ae0
 118.832 -dd73f6b2f80d89bd0aa30c038583deba14913d38a7b61b54522755e251b2
 118.833 -aeca62033a39ec1143b2b960f9cb87f748428bec3243b8164f07d5ff72eb
 118.834 -f2ef69347bb933241c2401a96ba5ffa3f9ad060c41f4e6bf7280af65293a
 118.835 -bbae49d723dbc4be61d7e13f7a5931a697e7f2c6582dff416341ccf5a24e
 118.836 -9a53686a1e13bbe0bb480c19a4e72a5e477bd29f39dce1a17f63f1e8c696
 118.837 -d5f8855cefdbf7ce681c7d6ac46798ca9bbdc01f9ad78ce26011ee4b0a55
 118.838 -786bb41995e509058610650d4858836fcedfe72b42e1d8ba4d607e7ddbbe
 118.839 -3b0222919c85de3cd428fed182f37f0d38e254378c56358e258f8e336126
 118.840 -9b1f1acd7f387686e8022326a6bbc1511ed3684e2d2fc9b4e53e83e127e7
 118.841 -84da13550e593bbad1c87493f27b60240852e7fa24392fbf3f478f411047
 118.842 -3f00a8fdb6dcb8aae629dc7f055d85341d119f7f6951ae612ffa7df82111
 118.843 -d1ca48306a57a922cf4c3106f0b5e87efba6815f6de4294c7a0394087067
 118.844 -677889d22a3fd86b0796200300d2716445078027fe0c0b05c86ac80d2095
 118.845 -ae874324ee6ea3553bcb92fc1522a6d1524f6fa22b71598fbce784a10b5b
 118.846 -61e50307ef4409ffb7b38f27800f2185140ed08fc4ab396050b068025a9d
 118.847 -e4bddcad201e72ed9b41c4ffd4cee743c9c2345b95c5071442defc8ba5fa
 118.848 -9c63c56e209df41d10d93135a8080f7cccacf67e0b0ddb3e0a31df32b83f
 118.849 -290b3c536e9949973cdc80aa5c8a4feee20290a95f68e59f54050192de42
 118.850 -f27464ee374e4d2451ee8708933b970402c90ca3070843a449d7c3146347
 118.851 -1efa666a60fd5cbf55a47e4a3c5c318fc1af944d58d32690a2c7eeef09b2
 118.852 -d94721896e1e3e76e44a8efd524ed5d6f5eb9da093d277441546c6828745
 118.853 -ad71b6c13f653dd631bc6fc55d0eb4648b7bd9c0eddb13222542f2b6e8d8
 118.854 -b80bfab4365f4199a41ac690979285d917de79359a183e6fc254b63e6408
 118.855 -6d33e3c029f472f40742a99f92999f302f79994ffd615f1a848194cb56c7
 118.856 -12146850f5e400303bf5bcd4e5fdccd1fe2edf5352d525cb15d8327f45a2
 118.857 -6e3ac276dc8780c65724d28dc6bf9c7c985840070c35e32859168890d599
 118.858 -a884dc2a90194cc2e9cc6a20c6c0ee11b20adf3aff01db48eb8dba7b0c81
 118.859 -7fc10cf5a66e8171a2823a4cd22f0e80c82011ae56dd895ae2d3ebe84ff3
 118.860 -d521c31453e0909cb9b1cf0b030eb6b7059ec38038cae12d0e1cc4b5b3bf
 118.861 -e6c821faac9b8792441e2612aa1ee9318b71f9966d7d3a64abe349be68b1
 118.862 -744de7b212f6be73a0e1eb2fa30850acc3d9562f989cb2d4fbfbcd5d3ef7
 118.863 -ba55717da1cabf197b06ee4d8650e968518b6103fbe68fcd5aab70bdd21d
 118.864 -66f09f96208db67c1b345672486657295a39a7fd689b2c9216c6b46a29dd
 118.865 -1283bdba295dfa839a45b86c14f553ff903a6f7a962f035ce90c241f7cde
 118.866 -13bab01d8b94d89abdf5288288a5b32879f0532148c188d42233613b7a1a
 118.867 -7f68e98e63b44af842b924167da2ab0cab8c470a1696a92a19e190a8e84b
 118.868 -1d307b824506e72e68377107166c9c6b6dc0eed258e71e2c6c7d3e63d921
 118.869 -39690865d3f347c95070cd9691a025825421be84bd571802c85e2c83ba53
 118.870 -841223435a9ced5dead103b470a4c6ae9efcc8b53331c61d0e1e6d3246cd
 118.871 -aa1b0da347685121196a07e97d21b10ad34e7031d95c1bafa37b4141bf33
 118.872 -a6be401129dcd64086885f4b5f1b25bce75a4cc8be60af35479509e64044
 118.873 -d49c8a0c286e4158a5f346ef5fe93a6d4b0a9372233c7434a7a6f9e7ea21
 118.874 -30c0b4b9f62e3a74cc5d2916ebdaa51a1ef81fceb6cf221e70002a8a3106
 118.875 -bfbccc2d1809dde18e9607fcaac008fabb72e8c50244507f4013c5a268a3
 118.876 -6135ead9cc25362c37aa9511589f18d812e6039490f9c599f44e88754ac1
 118.877 -4f6c1841d570efde27958c7f1b2c68772584e1d12fea252e3a6ec3b051a7
 118.878 -6faebbf6f5101978e24a9ca927c02065e8e49150a55c64dd30757e8a33d5
 118.879 -2a788437a9181efb47414dbc22fdeda203d4122137bd045611f68314e12d
 118.880 -1d6a5ec270c8919562c03e3af7b0e0deceeddbdaf3eab8fb5632e44dc1e8
 118.881 -d46e2396b0236a46659164e33709415e7b347f7f7b87a9224a189ddf5178
 118.882 -2cf66c9d385470a51efc88696176f6d3ac3b7b95fa074c981194e22981f5
 118.883 -1d925f980393b7102f1f836b12855149ef1a20d2949371ddba037b53a389
 118.884 -7617c257bbdfcd74bc51c2b40f8addfe1b5f8bc45aa4d953c0d1d5f4091c
 118.885 -6af796af6513c820499969593bfd22f8c6dcde1d2ee2c0ceebb5bd6a1ce4
 118.886 -5fa61094e932b380cee381f4485e39b4b1797f2a7d8d90bcbf89b9cb1006
 118.887 -2d50fff083743bf318157caac1c0179c87c03a2857fc002979e7cc97feda
 118.888 -966b09ceb761d3f55cf07637256c6aa8b8e5cb6aa9739452a330afbe7082
 118.889 -975ee39fad5e8106e8ee05771157e92d99003533d922ccc37add065b6236
 118.890 -7613d039741f99edc77c230fe8d1baba720a185186662376b947bbe1a686
 118.891 -4b42c61ebe1abd40d890751ab8945c629de3b6d2a49809dc693f9e397097
 118.892 -cf1e568c258081242460af2de0ca44b7ba2734573967b3bdec0e5e64598c
 118.893 -cbf41e630d821491504f414d9b54a3100dd5105a141cf61bd3ec41b67368
 118.894 -c8cd366c543754ee800ffee3d19c9cd0d408cc772da10e4d8134964b0a61
 118.895 -232e2dfbeacd0fdee12792504bb327a2e1fc44127f8577ca51d380a760b3
 118.896 -740e6be46455cbf3917b90f0dfeadaa25d5d9f66cda43ebf9f75e0191a06
 118.897 -25ba29666bbe8678822a453d4e876bad4a6b0d4b6cf98feb60339c9eba2a
 118.898 -dce4ef7faba428422c503d0210dcf8d884ca9f5094aab9f3b1a2238b569f
 118.899 -444748902907cb0d9d7ca33fccdd0cd29bc68e44f7bca5092be6272bc949
 118.900 -baae5af92c302bb21f91b6ea8463265680f7c16f45d8ff35392a10eab87e
 118.901 -296f3af4478032b5b021db8510deb617941130d45c46fb3647d94b162fe2
 118.902 -2738766fb6d76a06ab6803818b27c5ff4205ba668f95b5ec5ce4ce6da545
 118.903 -c13ff56f417a4e0b3b8554a1e2a985a167e168adc8c4db28a601a80ab451
 118.904 -91bf32acfd8d25c39c2f17fb3bca1296d3d160f25b43b4d6b94f20ffe012
 118.905 -b779339b12860dfc897b366e3d400e756f4f9f4d2c86fb9d94c11ebd1450
 118.906 -eaf720056e2c39529331bdcb104d113b42c94af2c6a5035750b7ae7fdcba
 118.907 -b6116d74bc07a11d4357ecf73d99221dad5cba4a7136425c2a3ac0e092fd
 118.908 -606a4ab722195e3b7fdfb5a5e3ccbb85fc701c42bec43b54e964dff3fa04
 118.909 -193043eead7681cedae9cce6919949ea60ef5630c4b9263c8f98b4bc74a1
 118.910 -63ccf3d0a0bc1deff39b800ac90bd734dda7ecdc73169ad77e129887db80
 118.911 -7a253f8807a422eda8a16c9ee9bb8fc0942634bfe035dac9f7e36d09844e
 118.912 -39477c043399db4d07b3617da9d6eee76d0fde9201da98b906050748b68d
 118.913 -8c944ace3c96e90a3c2b63eae27b9152cb7274fa336866d71b65a57f1bc2
 118.914 -bb1f482a67f3993dcb3ff24abb0223f9a026c81b2b33127a1dad8929dec7
 118.915 -5d46bdd790eb1addd771c5c3965a2f514d3a128117a44560cc10a729bade
 118.916 -4e6c86de7c09a39602235c803902e34f5c176b18e127d71a011dd9a3a61e
 118.917 -ebfaa4a4e2a5651be6f4067e5e09bb4f3514d67c2129e4d3ea9568661138
 118.918 -1e45af07bd84f883c70577a986416747f3bd8d1bf86d3d7b07e8a350899d
 118.919 -3c2dae237bd5ece45faba7a0ba30fcda7b7eec9fbeaa5a94620686d1e403
 118.920 -1cd2512e8d89451c7bd8eb432c8862023d66f3f9fcec0d47598e2df59525
 118.921 -d673a5ff493d458748cd6341f161a0a3e8996ca5b496508578fe4f653924
 118.922 -2ae28bf4b7397c02b726fd5f9d8b898938bb668a546be6e42865f4f030d9
 118.923 -5faa289eb24f7b8e249b224a95a2245605d67417a489626df7417855b8d3
 118.924 -1c0043cadd2b461d32e1b39ccf409757c37b68f84e752bde6b5bbb847bf1
 118.925 -57ea3434802def983d6ce5ceb3e9fbc4911b5484e99bb94dc3f383e50672
 118.926 -0e85a91ed378e352838cf02921ee0ea94be01b5a60f9b1f58fcc1b4f527e
 118.927 -43725de9b9dadc3ef462fa279bd7138095d4cff2a0563039f71e383430dc
 118.928 -f628dc9611b2e3db08fb2da1d5383dc1a3c784e1e64541fde1d9d7f42505
 118.929 -de96d3d0a401099fc2879af0293b0eeb143b78cc221f670c0479bc150047
 118.930 -0cacb9a282e334e428b527acdfbfc56e6aec8d4d60745c1dc000011b6248
 118.931 -d9ab4a17dca7cc74e17d33c0641710b02cb1edb0addc6be214b17e9f845b
 118.932 -2d9c8bf03c19e131e00f91f2a393b5f2ae7c3d4ae9021c4d7891d84d5067
 118.933 -377ce92836e42eacd7e540824f7ac95360ce116d41d17a50748748971c82
 118.934 -27f089a22ee0d21940de854f737547b73c7517addd9bdaab425a6c2908f6
 118.935 -87dd990d6cba4d84308bdd4c4435a6480ecfa1a14daabd4d8e2398178e48
 118.936 -de28b84f7ce4b61d2e6e64fe043c29a941f6de7621ee6f6d8b506221df05
 118.937 -db238b8fe4323cb5f259d4d3d9c94d4ae1ca37d6c34345489c0284171346
 118.938 -e9830e2e3c6c167238a7ffe0989d3eac870cd44102cae139469b9d909b5a
 118.939 -9c34792f693ac94ecd35d2277080e30a2d24b50391b6f2a3d3b6c81f7ed1
 118.940 -a7b218903e7fed7a63269e27d793a2e0b40320ebf447c71f36d40dee002d
 118.941 -7257f43c8add31edf2c571123e46fdb413e007cc89e99b6f98d77ab38bff
 118.942 -cf140f787e45ffb2c7cc4ddbb59a4e32dfc36e2875f204ac851d757c1236
 118.943 -12deb31324ea4c201d27fdab46e9f3988ad2bcfb8e9cfa8c487831a9b0c6
 118.944 -60b20fb66b4c77f52359ac96f3b3d189aa0571c1c53db06ddb10f08882db
 118.945 -0b1e93e9478d4c75626c5fbdbc6044c4d82684b310ab2af144d12bf36f1a
 118.946 -c0bf6249d1da9ab319453594cb19d0e93c4e047fb49229c0cce76d0cece4
 118.947 -2e76fabd2425382afe707db032cf617b046a59a2fc1bb3838d98fd5c8053
 118.948 -ecb918bc14762e4ca45027623988f434ff4cb08bc9bff5d7de21940e3e03
 118.949 -1ee042d9c30662aa76f96213fb5a92047af60f320e4660eadd1ec19d0086
 118.950 -072f2202af5f219725f81882f10d1e065a8035a9946d0ca0e48a5e7dcf61
 118.951 -0283b834eda01e7d94b3453830daade2aa6c947989b290c02ade0d7b2620
 118.952 -813ad177ed82813b6a985d5c0a2d42419bda763d409da085936e33c817ae
 118.953 -68e5467eddc30be172de855a0f7f5c527555b3f4d942401b450f08273b1e
 118.954 -c5b5352fdb8562a71f276284cf7c27537e628f94bcbffe8d669ea2645752
 118.955 -60830f1e65e83a2204cec393f6d92d4f61f317471b4b93039d298ca2cc94
 118.956 -eeada0140823a2bcd1573e732e7b4bde7368f2ecca5961ad547f554ae989
 118.957 -98d87b7e5d07a85c382bcea1693a697224f41eb8b406bc6a0c3eddfe8b5c
 118.958 -f25b11c3e4bd91ea7d6274cd6b3ee7b8f18cc3fd502a324c645568dce9e0
 118.959 -d43caa61f7306fd5488fcfc439d85f8160ebf0ac90fc541f9c74d35d7833
 118.960 -09309807a639477bb038200738342e50136dc64baa7cc1b879c61f7e1b90
 118.961 -e1f2bd4f6e54c4dc97b8e4adeb102979203a31fe26a7f58c609915a95abc
 118.962 -4acc263179423f8ab16b04272d5592fc536f29a45cbcdbe15890f119ca9f
 118.963 -c7a52eef41dfa5c4fed087eef8e698ba738e300bd58f2a1a10da1198c1f9
 118.964 -b60e2032f8384a86aa84027df21cb87977528e3bb9bea1e3a6879c56402e
 118.965 -a29063afc6ac0194f4944433f9a5872cf0a2a741382d7f3c0ca7817d5d7c
 118.966 -4b8bf53af0f18b1eb54480519cebb61d983157e039b13025e7980eb36f54
 118.967 -3451bbb84e470ffd0f98eba80c74f238729dd6278294388a2e06de68a719
 118.968 -47b6d478c85f124d14aaa835620e49b7f5a4f21347302c0f0864f7ebaeec
 118.969 -d0831c36187cbe9c848736764a31056d2cef27c07cca00033dcddca9a2f3
 118.970 -b9ebf28e67257b69cd38bc23c711b6a2f6e4dda9bf5a19da275e6a8d683c
 118.971 -723bfbb95a90a344a6f421f0b67ae84c74652288b0597e4c86c28f73808a
 118.972 -77455f2948e8df634c2d14f221626b019033f9230c9167982cca9ae6dc37
 118.973 -aecbcb49fd9fc1dbf2d11bba7187888721bc42a7f47c23e07d2fc5a7a91c
 118.974 -0dfe255a7f9d17e69af1618502a6b90b1dd748c7eaca1e1ebe8b861b04ff
 118.975 -e5f628f47eb4e7e65311037d7a5713d7cc3552dc85f452ba74c4f12aecd0
 118.976 -d72892c940c3325640d62fe3bbbc71361dce6d54766e1fb99dedcb2d19d2
 118.977 -fa6fa21f9116e03952ebbef659816a62db51a9b5b3916ff818518774ccd6
 118.978 -79d44100d7236f211f36fa80a4cbafb3db76ba1e7e7f12082b0140eed2cb
 118.979 -5e793e24501715c6c170ad4f856a4bf16bb10210025156e635264d3cf18b
 118.980 -1fc1e8cd2fcfdc2ab1a24af9087975bfcf6fb703fb36e288e58d0d2ffc98
 118.981 -bb4318001d931ad6161dcdf8984e6690e0f6bb07af81bf07445f8f57b355
 118.982 -6b960d24e7cd152708489e4d953ab6a155a757e002ead97585e6c5333d7e
 118.983 -5aaab2731f047f3490432e0ebf3d0d628eefa8c1f665b9c86aabb0706639
 118.984 -5bc372e16378f0d9b439c98e7bf87be73e934995d58e4e70d3ae9a5b54c8
 118.985 -87a19f2826a772c39d41805c642354d9bec75b065f148f7c1e435dabbeaf
 118.986 -e4a5744e3f2894a928121ab069bffa3218a106a9dbb83971353a7c7a5616
 118.987 -d9da66fbb908173f9b07aadcbd4d112cc353e7b70476046ce5a92e86eaff
 118.988 -4eec40acc840005f51f55c9f5874216851e9cf3fa431d95d3032e779e356
 118.989 -4bdce33966a3a798b170a06c4cc9f73700224c858c36bbf2d0326c337ce9
 118.990 -46f69c19a84187fa50afc5b36010f9a7612e3a25e846d49bb907af9505e7
 118.991 -d8c78748d7dcb501bbb3d6603e829deee3784f2f3ca583d3738d6d2ecfb8
 118.992 -eaa887103606211a3c1b5cd74a3e0e96fb57da91baebaecd3669661e7b1d
 118.993 -579ba41928a40a7028acff6cd409e601d23ff66ff2c8acb12e535360d727
 118.994 -60d2e988d801930e0e9443d60dcb9f378fa75d58d73e6a3b6e5b26407c82
 118.995 -67d50ad97787f8a9b91765e41552283cb67e43e59bf71cf08b9755c8ce47
 118.996 -0cf374832c72d1e9702b55bcfc8b5a4e966d5072fb2a72a2108574c58601
 118.997 -03082ac8c4bba3e7eeb34d6b13181365a0fbd4e0aa25ffded22008d76f67
 118.998 -d44c3e29741961dbe7cbaae1622a9d2c8bca23056d2a609581d5b5e3d697
 118.999 -08d7e369b48b08fa69660e0ce3157c24f8d6e59bf2f564ce495d0fca4741
118.1000 -c3a58ec9f924986399480ee547ad1853288e994940bd1d0a2d2519797bf2
118.1001 -8f345e1bb9cbf6997dae764e69c64534e7f9dd98f86b5710ff8b500e1c4d
118.1002 -f509da50c64e213ebdf91978553a5d90908eb554f09b8fc2748c9c405903
118.1003 -e7bfbf0ea7e84254fb6735f09bf865244238e5fed85336c995bc3a3b9948
118.1004 -947a6eb95db4cd1b64c0fccf82d247a2202e9e7eef5a550557625a0192bc
118.1005 -8bcc9e461e52833f6b8729ccd957d5c4b6e07016e864fc02b792c7400ace
118.1006 -d0a8f43c755f87bba6e5c6e1022416e5454cb34a19865d951f7aea527760
118.1007 -53658cbf306ead832244f3062c39a0a121a1157a8e47008163c5bfc88197
118.1008 -be16e9a1ba26a035a16dd38cc28dffb666dd4ba7356c66b7bced9e26e905
118.1009 -4ce25f6d36607d8f5dda1e21ac96a815bb2989f01130ba1aca9aade554fe
118.1010 -effdfef5d6b0d2a01aad92f599f6a12e121010ae6acc6f150f19e7305271
118.1011 -97da761b07530ca19b84b119e5edca1fad18462143b8913d6b3f6864b713
118.1012 -7a93bb9e1bc29c09d660704e8d8292c61072ebfe35c354a2342b2458a353
118.1013 -31d043874380d439388e46688a53bcfe01bc190ef1a6b5dec9d40aafe822
118.1014 -261b28bf3e2d76f3dc4302506ce3387b4aa2a51cd4ba1faa2ed1fd7df664
118.1015 -6772fe9f83d253451eeb0448b444b8ca80cc7cb653c2d1eaa0de6f2b1c72
118.1016 -47e6d24ae72e620e200aff83a557a1aa7a0ce0a9cfbbeae03c31d8cbf1d8
118.1017 -20b53b688ed2ffbd83418d743ee31e3d62216ac7be6c12bc1917548cf670
118.1018 -d69fd2e78d9f7786ada0ea30a6f6d9fbd1f1406337151ffa1d3d40afbe03
118.1019 -728fd1aa2fa8a4f075796b9de9586b71218b4356fb52daa01d3c18cb75ae
118.1020 -d4d33fc809dcb6e3dcf7aee408a0cef21353d76ed480bf522fdfe86e0e0a
118.1021 -b7d097defcb793057f0ce98ea4989a9b6787b14029a4bf10315a2557149a
118.1022 -fe9c91e7d825f7518b343fb556f0177a8f6ca08fbda9913d52997511590e
118.1023 -b9942c9813b4cf4d4aae4919401f2fc11fef0620eb5c40532cdb22d5fad6
118.1024 -919a3a710de6c40d54993b5386636499c866938e33bc703a99c73adc228d
118.1025 -95cac73ff4f4a275c04d0d787b62c6a184dacc4024d23f593e7721be232e
118.1026 -9882fb738160e52ab905f0ce2c76ae6ff2c8bbe118a1acdb3b464178cf01
118.1027 -94bc6a50df1090e9221be11e49f254b06c3236a31569b947ad041d1c6b55
118.1028 -bfdec3c18c791ace0fe2a59504eef64a4eec4b5c8dd38b092745e0d5ad29
118.1029 -276bf02c419c546627672a5764a4904635bff86fd0781d36fbdf13485229
118.1030 -71f355de2b0ad250052f50ad70f61afc870ac7a816561d3232b73360d4ab
118.1031 -2727b2fd045f254c782bb3f1f49d94c6d625047071b7e32da5c6d21a86de
118.1032 -9283fd632074430772bfbd85e0c9ccab1dec16bbc049c3e223bec1b65c8a
118.1033 -9e98cf58b30a74f74f1a842dc91e30c023498e280ac55edd58f4cc731d81
118.1034 -e443d9b9efdf5fea63c9f357320e01b8740eedaeef2495cd02eb2f338b3e
118.1035 -674fb074cc497d7b1937b188da857c2c230e9a931cbc00c85a7a36fa80b4
118.1036 -56588e1bbabbe4ef429a6aef9bd4eb89c5752421bd049aa13f4dcf9b51ce
118.1037 -2503e90bc118fac78a25d187353d6f5d496cd6130b337666f49619cea985
118.1038 -dfbeb7e49c67c1e0f0f8e9ec8ba14624ed0982dcbb69415e4b3c8ddba140
118.1039 -397eb1fc1ddd36c94c374f018873ba41109e45afa51f0e691157d5958c06
118.1040 -26fbc0903ae25e47ee372389cf65472a3e4d9769550bdc42c0b72f9a297c
118.1041 -d5d3c16ec67e06036e740ab664abc9f10b9499269b73ad3678daf4474329
118.1042 -c2c7252c1f0df1e3b5e8f198dfef8325cb1e7e8057897a3d7fb5bb5858e0
118.1043 -cfc0c115bbd7362d8e8ee41862af6eeda681cabbb06f72ebd2ae0b0be45b
118.1044 -a9e1be83f1da30687a655e5d148fcc17d9f53b760810a565f6d2f4cd5da3
118.1045 -5434116edef756adb4d3df544a1de593be988f2bb8d36c34deaac7d9dc15
118.1046 -cba49764f1e03aa09fe21fcd7c74e3d6487ebe219569e019f10dd163046b
118.1047 -c1a3cb2bcbaa8558197cb2c18709a998b4efa8ab8c9a71d2ccf942c17662
118.1048 -1b88dee6b424165d6ce10ac48375e760983818e0085276b1674dd41042e1
118.1049 -a01a8de111c903f74834199b3230bd475d92c6226ef74eb1daaec3475a6a
118.1050 -fcb47644a17c7e390ee3b16bef1c1ca6c55eddc44fbefbdde525921b3047
118.1051 -0d76817bd8ac724739a8e743eb09cf78e88adad527d4f115b8a32ed4898f
118.1052 -45bab3eb802b8168aec061e3ecdb026c056fb9efe7e2df48bd516ccb12ce
118.1053 -00de08ed8be4ee0c41f40f4c8f64483e0ade90a78d6d4fe9203fe0b97c60
118.1054 -3b2f8882bc15a212453c691c52d00fae8a3a26934ff8acf68d4352eef75a
118.1055 -0b10d938e55b7333dda2db0296a69e9775bf82b1aa6d684fd9080fc1c11f
118.1056 -ab4369c7a95a9504063db900a6e345bf6dd99be041230b2e60cc86b8c345
118.1057 -1d84a9c2cb4ab6d74d63dd43dc26eb6b384f5222796d4083dcc3e1651548
118.1058 -d9469f09a33b213a33ac52a6a2e23802d8f8a75c01a607940daab0051410
118.1059 -73a88130bc192f303616adb113c0051b65e12086cb319c0a5323fa7def40
118.1060 -402f5f87a3b2c2cf0e92789985f6775ac2743e1ffe2d0668291059740d45
118.1061 -43bae7a2897e5e658592bf5a72966097742e0702deecb0cb12499eab701d
118.1062 -34ba37a08346217a415e44297a181bbf3744f0a49230ad6f030e11462be9
118.1063 -afc2ae14e0587bc02311b48b8e2122c28cdf14414f3680fa52dbbb63b17f
118.1064 -6ebe4a1204f3c5d6150cbf89a8023890383153838d4dde77d4c8b1b78823
118.1065 -8918c564d3babfe58eeb154307dd1997f5ab7105426e35c279008b2677e4
118.1066 -695c60f956b348799c04b734338018fc27f7de7ad9d73468fdbc5283bd14
118.1067 -c066ddad9a3562f16baae15d72d7bfcb409e1c874e9db1a8cde233b282b9
118.1068 -6e76e9c08d85ddfbd3cce7e64104d0b0e95291bd91f405ff82f41601ee20
118.1069 -8471e613fbbee67f269e4e954c36d1d18ca9880b7cc2b08fc990978efdc5
118.1070 -1d157deefedaa765c1e26ee125d4a2514a41a3b95e9151a824532d7d6486
118.1071 -35ad622718fe71219a697e94c2e64f26424cbb767acdef5cda70e179cd29
118.1072 -b7e318d1c6d3ad26fd5fdcbf2fc221301cc1f10f5ed86b40a1a6bcc01c90
118.1073 -eafd65183e75609610637b99fea57885efe76437df02a2ffc21223d039b5
118.1074 -74955d9a54ff41980eddaa8768c5ad883a0c9150877392b990d63c6805db
118.1075 -7b8d6ab1358cbedaedb6feadb0ee4fb8f9c1ca03a3e755a74227a8930bb7
118.1076 -2ea0a00b48fc626fa14d7d48624aedc31c556f44e982f3ccbde7ee735f73
118.1077 -629ab1b65bcbcf0a3586a920477e8c960219802fcb1bc3a179032b324f8d
118.1078 -c424899b38275886cb5bc771f26a0880767d49cc23426a40a4b6ff8fe48f
118.1079 -d747565fc537565f6d7fd08706accc60f5fbcb45bc785f45ee9b0812366f
118.1080 -ae71b23ec43f3549c8224d78baf18719f05108d5741e681457ead8abc050
118.1081 -462481771a8dc6cfeb98956e163981a98c59ab44d90e9c3a946c453b5071
118.1082 -db0c769f7fb5144c7ab0c9ef1a6db1addcde1d4ae1daee1b4035af256a04
118.1083 -df53926c7a2dcdb94caaf12f986e20929ba4e396f3aa7c93a7abaef1294f
118.1084 -5f13a0dd3c3aaa8fb38da3e15daa32163b7437af683b4f5e64cb14aebbde
118.1085 -8c69ed2e8cdbfb213fc8129af29ca2c06c8f85a5038d688d1fa5d1b54ebe
118.1086 -4dea81a49ce24131f8e6702e7aa4e2cba078d5dd373f894ccb275f49c690
118.1087 -1dc772e1d2f5fb3fe15dbfffac62c87110162074eb72ae4e5e446bf7e650
118.1088 -a554178d0d64d3c07f330f0d99e99f2239cb1597f2e5f443854cdb0f5fab
118.1089 -b28fe62f22e7f3419d017980f325351bb04f8f3c3dc57fee03cc029bd29b
118.1090 -202308d5a800ed2d500d41ace8e54e2557bf25b627883beb8118d800eb94
118.1091 -f4253f855168f7fc8a2d29c5fcb76bb90a6c4e345722b8991a854047f46e
118.1092 -4e97336be85470b6be2b9ba573dbc4967ddcdbfc3b6fc35b0c7f3f2f570c
118.1093 -55dc3fee6d80bc6f46cc7e4d86a0b86f6fa61d062e213d9e442db63fbf11
118.1094 -d03165b44572096995ed342893bb672f6bb55ff8fed944667995f0f89a48
118.1095 -a904c47420f32afd14129c6e2bedffce1f07ea69d550b6909bb5beb4aa08
118.1096 -b0b44f35e018ba5206fdb4df0228462c1fdbb95a429e53eb27bb1b0490db
118.1097 -f07202c3608d0f4ce08570e3d6aa3d4581c569b57bd8c1ea0e4ed3fc5497
118.1098 -e316ecec06e6be582d9170d426f6d22d8c7287b8219945c124941ca8812b
118.1099 -e97efd9105eb6999edc0665016633b3b48820df736125b7c76c9f3a67d93
118.1100 -8a2a0a6b743fd42aebc46a0249be459f16811ac9eba7b63bad7c2e88f175
118.1101 -0eff8da5faaab5659824f9d19b3225aad2ac17c52c523414d3031d08a926
118.1102 -30abf474fe02a32b44d3b7d9fe0c19aec16ca6d018b71d9d395ffaea0788
118.1103 -0d4501d7cdf0f7077a2d63303d09083080d67f1f714a1b271dab9fc9866e
118.1104 -4b0571a171eec8a4e351ba2d02438cd108a33b1106acaad0ccdb051061ea
118.1105 -7f40543748115f29debfb4be4b42cae8762d62114ec6f8ef68c478a8e05d
118.1106 -ecfa18b0368428efec9eafb2353f95e3d71e1636b9d9f94a77e692843255
118.1107 -698576dce13b2b858d2d15ee47cdba3ed08d64b77ab46dd29bba6aac2106
118.1108 -ab847de378cccdaf35c64e50840248915f4fc110992c493cb1b9cd0b483f
118.1109 -0f1abf5e9b018210b477fea28234ffbe5e0bbe01338e0842a89f1e00a0ca
118.1110 -7cdde0b2d7c324d5e17d8d3415ccad703507497ac95360ce660b656e5f66
118.1111 -72a2f50761f3d02ccdc1d5692d7797699b8e2147cfd4817c81a432ff6a5f
118.1112 -39cc54927fa146cbed56a55f85f123c0a94b7553a8819b329d9dd122c502
118.1113 -94e3f6314d5117db89ae7597c4691b6c542979a1ca3d26a8e23d3eb698c7
118.1114 -1841651e08ec771cfb974d6613f2143872c739b62796bd0a45172530793c
118.1115 -28d93a65b59f79c245248d2c09428657a35b0c0e367bf7a4a4f0425b3f4b
118.1116 -485d9f402e164328a4b963f456829a39035c00283d2e4fcb71a42da6d42a
118.1117 -d46cb751287de34e6519c60bb3f1a6ba91f7bfa21dca96ee712af5681701
118.1118 -18ece8a0535d9ba1dd4bd835e004a2f38c5ba43c9b30d17045e5649fbbac
118.1119 -188922e442182d4bdafaefb39e00106a5a7765f3d67850471e3629e526af
118.1120 -8691f935b57bd38465665204a214fef1006ea37dc0781073ced5fc042781
118.1121 -93650393c3cadfddedcc5550ed483bb6355f54600e9758e647f9c9711f1b
118.1122 -e7df05d0e50a698615307c18f6d4886f50188011ba499d03831185915f3f
118.1123 -77c4b9ce708d78423b110776aaaf90396be0381616d1e9b0c1dcf68b6396
118.1124 -82399da2a7323bf42ae5347599ef4ae9e5c135522c5ecb87e201853eb899
118.1125 -db60d24acad17d6b7c2c7ea4dc221f3cb6d6caacd1ac0822ea3242ad9b4d
118.1126 -d15116c3874e3012fad26074a23b3cc7e25d67ef349811dbc6b87b53377f
118.1127 -0cf972040a037ecb91e3406a9bac68c9cab9be9a6bb28e93e3275b177cd5
118.1128 -0b66935cbe8dd3d6a8365625db936b2cfc87d4d6e7322df3dbe6ccda2421
118.1129 -a5e5372566f626a5e9d8bc66959e443286f8eb4bcfdeb6c49a799f1efa69
118.1130 -63260d0ea2d51260baba9207fb246da927fc4c89e9c4dd5848fd4ef6f81a
118.1131 -cd836f5f06ff0fe135cafd7ab512af55a57727dd05a5fe1f7c3c7bbe8ea7
118.1132 -e6680fcb3bbbee1cf2e2c0bba20185f00e2dc3afd42f22de472cdb3eaa5a
118.1133 -ddf8c6fb3682eea5548c51ddca25ca615221127b4438ea535ab3089c9ed9
118.1134 -b971f35245cf831d9461a5da9d57bc4e5606d26535a7414cef6aee2a7b95
118.1135 -bf2276044818ee0f3b0a16532934b8b745d8137b42ec2b28fae7d55fc02c
118.1136 -9ccfa4e0055f8a4be96e1e235c01b8b6ad509b832a3e90161e0a449934e7
118.1137 -4be973c939b31cbc19dad4c58e9be89d242f0ce200548cdd4fa2081ab3f8
118.1138 -e01f358d5db24b7a50eb2096d833378921f561f132cd7988708ee10cffb6
118.1139 -2256201801c667e176b1dfaecde9756d725bef093457805e16f550e8a7de
118.1140 -87ecd46e5b09646b73ee74f890a36867636911e4cda2c46a40e7d57cf297
118.1141 -9696046614c85b1a47ba55c60544ebd3ad7d750d003bda56dd7eed8c4702
118.1142 -f8b319aaeef9d3cdc59b3e63ee93c6e1e857af273eb90909ecf36ef4c276
118.1143 -895c78aa762e5376c5c542f854fba864ebce56e4b0207091139f053c2c08
118.1144 -3b7ddcd0a9909b52100002bc3f8c47bcb19e7a9cb58b1ac03fee95e81195
118.1145 -072d3aa7c8079632725f63425a3550a947834d29ac9a26d0774e90248e18
118.1146 -996731fd9aa53ab62b40ce557d98e874b763d9d629a173f0c7babfc00ae7
118.1147 -82daef5f00cf3608ebeef403dbbc19e16a1d160b889f4a10359d9eacc19d
118.1148 -7b5f126b31720dce7fc35ec861dfa56ea23fa18423ff4e8fe6e53fc6ba16
118.1149 -b95a2b5dec00f614e4f835281ee0b4bf549e7e882689e0b445dd46fc40c9
118.1150 -090e5575fa2c34b02a51ad0bccf6a7bb83ca3b929285e5e9fd054b72c47b
118.1151 -733a66c5abda526b18b2e49d0746e067e63b948a45eab2f4221c5b62ae21
118.1152 -a5d9d7cd8aa9eeb49588891d22c56b14b55ceb6488f02b73ab3b7f6c5555
118.1153 -b75452594658255e4cd58ac4815f2e1bc3888c6777f62aac2f0a57d416c3
118.1154 -765c991f0f9a33d888aeb2d527b482c042ee23783a04a73ad13dfc590a52
118.1155 -f3116f8296cacc7ab29b7d87e7864561a5d0a12bde2d36ee697064f41d1b
118.1156 -ca6ef2f801caab5295d19bf4c02b10c19f73b44635ba48a0806b967d7dfc
118.1157 -ce9a4850171a78532cb30020c0d66b3b1e7c75eaa7894904c181a022e8bc
118.1158 -9b2b8ef1202f3c7d36bcab4742d4a4761bb55b64da0d99685d319f5da8fa
118.1159 -132be6c0483f50e2657ae8af1e28f969440d6ed43eb00e95fd9e1cd490a4
118.1160 -8646f6d008598751f7a41b43fbec7770fe591012b6b0c4ae18775ccc7db5
118.1161 -de0ded2dd53e82c89648d46f0d0cc5d3ac5aa104239608d512a4353b9547
118.1162 -04fe6eb7e73d718323cf9d748b8ec5da01ec9358267de12cc22b05ef0312
118.1163 -e4b6ac5dbb6d06d7f2d911f20d527f504d62547aef136834b3695df8044c
118.1164 -383b6145e824d3931a602f081d9d656f84987a1ef121772f1f5b37a116bb
118.1165 -d2e77d4ccda01411545d24e15ce595db4cd62ee876b8754df0b85b44e011
118.1166 -b82d76ce45795e6c2c58be8690b734a8880a074f303a70da4a1b086a6de6
118.1167 -56c02cc7a4c25258eff18cb0fd868214bb46f972e26509f868d065b3cb14
118.1168 -1c316898cf22293391bd7051ac3a6927aada952a8fd0658ce63357c07f34
118.1169 -acbf8c99a5537da0023e901f0eb5547e1b466b7d982c8c539798b76ee2a2
118.1170 -252437a81a37c3b63f625172d682eeed0b795860b2755f020ef52a138353
118.1171 -003c61be2052cdd7d73b2cdcd26b127660a7b22fc51a6a2f6034f37e3e46
118.1172 -c1d7f83f8b28c7c965993abba1d358362833580d9c63fa85d4cb949f97de
118.1173 -579fb6807b95a58b78f596db50055947dd0d0e597d9687083e9bc0266e86
118.1174 -90b884b27f4094d8fb82ffdbaac4d580340a9ef8aa242be87e54b601af19
118.1175 -87a48d267c04e371ae77163ebd0de3f5297b1060442ecdeac38334844e38
118.1176 -0f294d4be73935fd8a38de7fba6d082c3d9156d7e88f2cfff0459377cbb6
118.1177 -041f37a7e05010753b98e0b67d5827aa312129bb3c3bd883c12323756406
118.1178 -d555720da8a0bb30edcfa760c01ecc2ba3b15fecccf5a10e9f358822e0ff
118.1179 -b64178fce2ea6a1105bfb72df0e4bc499b207ae26b8ea960de48e7ee7010
118.1180 -b4e671dff795e4cdc5b43e81b1604d224f0616ae311f1208859c502c1a10
118.1181 -940e7b9cd11be728bd3a0c8005ae23aea32c1b642812198a6f1aed32cb75
118.1182 -97152b1340dd35ada1b81051e393d38f3740fa9523df6a83b8ca7dbceb33
118.1183 -6e299b54cd998d4dfef804733c76156585e42b7284cbcc4047ba6b290efc
118.1184 -aa60953e98cd2b4bc2893857fa6a339f820142a52ccab0df09a2709df550
118.1185 -f22e5921cbca408e7998cc1cccb8adf6d8f8b71e6685ae59d290fa33f5cd
118.1186 -664d73e434237424060f634262f04e9a71a977556e93b692ddc3aad26d92
118.1187 -97dde71e4def64932151ad572af6e681082e9944ddbec6e7a8bdfd534233
118.1188 -9ca3106ca1ccc80eab14f1655978b137fad8f399df7cbfa2d7d3d9675e0e
118.1189 -9afec37369a8ede2c93145ab3f42a375926946680c215fa16bf7416fc892
118.1190 -bacd806cd424b9f85b47802c4336918f7486af2a03bf0d39b10169d35494
118.1191 -419cb1ab7b8f407897f70c18303e91563b497d70b7181ede6aa0c3efe089
118.1192 -ca6135b34dd1019b298e3677f8da61f864a67023c31eaa716c40cf3d397f
118.1193 -9a1209564c9ec759c37028079661d2a56374203c78b023ec61340bce5d96
118.1194 -e477a4f77e5c0db7c0d1257b4bbbc6f889b17e6eaab045b8adef6f931e4d
118.1195 -0795583d60a6b7002cf61639c6f930671f3b8ac05a1c4e002f4bfc50d8b2
118.1196 -3029fc4dce1b602cc3a5533336271bccc226559ffb127e3a562f92f89824
118.1197 -552b9a70466d5a3c74ae515a222b109d490f26e8fc2d9d72bc8af6d1dcc7
118.1198 -80463c7af81993bac2ce4aece9d95ab736b1dc73e32d1237bc8ec2b52513
118.1199 -36dbabb4ecc7ceb5d18b02043281eb9a3bfdf19bc4853c9b1722ef1cdcf4
118.1200 -fcec534923db2e2653dc48545a9850c0ac2e4594abc9f7d18a0bcf2fadfb
118.1201 -bf085d465a4d10528312f5d790eb9511ca01061c0d94136b99a043bcf278
118.1202 -c18223b1e0f1cc062b32b79e28dec2dc59a0aaa4b5f3506923c83e6a87fa
118.1203 -08a1d941bb644c994491cf7f3b0e2ccf6c8a8ba89376f76dfdb592374f93
118.1204 -528e78e31e0b18719346b9f1486f652638e3120687774030444674cb0778
118.1205 -96385c41f6566819652d825dd58f9a4308ff79b45d7828dcbfebc406e40a
118.1206 -c46e866cb0e3e97d6ce7fcac19a9d0fe39bbde66c5f0cf775eb3b1e6d7e1
118.1207 -1f67e7edb3d5c4facc85c916bf13322b56a0414ca27d145cb740fa2c37cd
118.1208 -8c142d9301f1ac3704cf6a8e93973a07fde5a331cf0cbb370c7ba555de61
118.1209 -18a6cea0ecb2c0e37152390cc57e2e4fb3791ddbc383ee26b6f4006d0d68
118.1210 -4880888011020f856a9de47f45440f127cf27ccaea7d40a3869d39ec7dec
118.1211 -ebc06382d294717644b6118354e15544fd4c6d88df9245c9a83b30e6ce09
118.1212 -e2498dd1df488a019b179cb859889e6ad2838f749e3b038b280ebc8d5c3a
118.1213 -b03e8f15751214691edf0f86281e612d7ec0773c8a5d2b433266402df62f
118.1214 -fcc06879ca196aaf1fc73a5f01ac46b44d6cbe7743ae9a862c20445ae2be
118.1215 -1544f413d010280cc2941900bf3c42ec088cb21b44a915bb810e7666b545
118.1216 -5324465c5943eedcef0c09128a995f431382e2062f5e39f4338c8eba1bca
118.1217 -e553cb60bb8f3e5038ac8073398c49f06dc734b18afa7921ea0d455e6e73
118.1218 -db8ad9f77fb5ba6c28af6b4f18cbe46cf842c82d6c960be1520a5fd929df
118.1219 -ac7e00ede976fb2be0a07f659079a421fca693de89ce9b8fcb42b0176d9d
118.1220 -f3ddd58f921e13e216933d27b49d175b423751c451be7618eaab054d3b8c
118.1221 -23e8dd6fd60182d61e9b5c86b3b764a29a62f913ee7524d8cb33737d7224
118.1222 -d95dc4bb8c2ad6397604a0ffecc8865adcb540e5da1cd769077838515118
118.1223 -ebc9f0b988545c1881dd2e7a8fd73e11bd7ae9085fb4d45526b23a346b0f
118.1224 -e4281ee3d588106db5f7c386c488d8f2f4dd02d4c08e74c1034f987a44e5
118.1225 -d39fd07538de57a42987ce290fb2f6557e8b5cbcaec168f5780927226415
118.1226 -1e11e3667d33b36a793aa53e9e2d1102c9eb30cb3ba0ebac953e0227fe4a
118.1227 -3d3c0eb57e4390c3d35db0c41946e45be2830a1ae33fa25cf2c7c9cb4550
118.1228 -ce9ff6c6e3d628fc7284daa6241604c90dde6339b7f7e7df3733416cdac8
118.1229 -e5291357e4983d74d3582a490438a7fdb0af97001a31990b1de68e6adb48
118.1230 -917daa387e647f9f13312db57310c7dedc2a2ea80800b4f4bbaa99c6b7b2
118.1231 -7ac8345cb659489307e2565ebfd17774642c9ae5d3c18068dc35170c7d58
118.1232 -4cf4173f1baf98137fa249c81f3347e1dadd6b1ba0f50c3b64c1eab183a0
118.1233 -937b0f7278eff101e5267fa6480da7d602844416490c2c2c7eb0d44ac8f4
118.1234 -75cfd611db5ec268db07c0b3608825c3e12834a2b2efaf5e2723c5199c42
118.1235 -6011cf22e64e4c0d31d563f321097935ea0c6fcbf5acd3748d90079f6ab8
118.1236 -687288dc55df29fe7958f566b27b73e2ea30747247f7a2b2add0602c7d64
118.1237 -d23f52e7c96748e6a54ee8c4629b2aab8882169653f0ba7f05236bf14364
118.1238 -244720f3259cbed73a318b29e4a9305deb65a2c9dec8a9d0f9a9f6fae541
118.1239 -83e0f4b9a9a567057a1794945168dc23cec25d1c02ea9242c9fb6d8fc11e
118.1240 -e8874bd80a5226373ae87cea91853d0625c777ceb1f5a6f3debcf2f75a61
118.1241 -460c7b4067f568ecd01f62901ade8bf8fbc5db9c6720420496f0cb48a002
118.1242 -99870773c2e7b12e83987a5d0290d9bbf589ac889bf7d4334a5147187a7f
118.1243 -71008f216ce917ca4cfba5347078f354897fd87ac48af6a6c62711d2eb3a
118.1244 -5882bf3b32c0f1bfda976f850c9dcb97170e78c229a27fd5e292d161ece9
118.1245 -a8c47a223cbdc28e24f79f6429c72b5752a08f917feda941582c36d9acb5
118.1246 -748c86072858d053170fdbf708971a0bd5a8d8034ec769cb72ea88eb5cd7
118.1247 -49f35be6ee5e9b5df6021926cae9dac3f5ec2b33680b12e95fd4ecbf28eb
118.1248 -a0503c10c6f2be6c7c47e9d66a0fae6038441c50e6447892f4aaf0a25ccd
118.1249 -952c2e8b201bb479099f16fc4903993ac18d4667c84c124685ae7648a826
118.1250 -6bc1701cc600964fdcc01258a72104a0e5e9996b34c2691a66fa20f48d7c
118.1251 -2522333dfdabf3785f37dd9b021e8ee29fa10f76f43d5f935996cbf9d98d
118.1252 -92d0a84ce65613f7c4a5052f4c408bf10679fc28a4a9ff848d9e0c4976bb
118.1253 -dfdfb78bb934cd72434db596cb49e199f386a0bda69449ce2e11e3a4f53d
118.1254 -be134c6d7fe452a0927cf6a9a15b2406f8bd354adcde0ce136378baa565f
118.1255 -b9c51a03b1fbe1e166a1f92af26bd9f072250aaa6596a236ba2d5a200c90
118.1256 -a760ca050421abc78223b2e8b2eea958ab23084fa1947574e846e48aeb12
118.1257 -26cebb8b5a92089e9ea771557599e2fff44d75bcf600e76ae7289ba98cf3
118.1258 -98208c5104562834f568ebd62801b988b0a9fdf132b6564566103b3d2d8e
118.1259 -6a099b7fbad8a13b8cd7f6729bb6651fc1019e66c4bd6ff27410bd5cdae7
118.1260 -4010bd68b066bffdb4fd5e3dd9cf7e1a1353f7a4c5157e3ad508f4ca0259
118.1261 -9761b7cdd6a81b3560b8765be3b0432fe4c25dcb4001b00c7fa62874f681
118.1262 -ed22127dc3974605a05be8d8fcf9701f859ffce4dc598091891ab7596ac3
118.1263 -4cd851ecfd2dbbaa2f99dac376f7bb40703fd0700d7499a7c24726bdc9bb
118.1264 -3b88c6a82e52686c1ee945d8825092bc81848a08722ac5a1d24353f95ec8
118.1265 -18f3fa487d9600318091b0ae9874b42bb3cb683a2518b18cc1bd86c6e5e8
118.1266 -3d37c14ef4fe0c77b03a3314995b1e7c1066b98c4375bd1fc5fadee1b024
118.1267 -7ece4f95a0f59978d543910deb2e5761632c74c508269c4e4b9e315bda02
118.1268 -975dc771fc30c8164b9df9172a4e571d8ca578cd2aaeaa0dd083e74cdc2e
118.1269 -d938b984b96d76a64b8c5fd12e63220bbac41e5bcd5ccb6b84bdbf6a02d5
118.1270 -934ac50c654c0853209a6758bcdf560e53566d78987484bb6672ebe93f22
118.1271 -dcba14e3acc132a2d9ae837adde04d8b16
118.1272 -0000000000000000000000000000000000000000000000000000000000000000
118.1273 -0000000000000000000000000000000000000000000000000000000000000000
118.1274 -0000000000000000000000000000000000000000000000000000000000000000
118.1275 -0000000000000000000000000000000000000000000000000000000000000000
118.1276 -0000000000000000000000000000000000000000000000000000000000000000
118.1277 -0000000000000000000000000000000000000000000000000000000000000000
118.1278 -0000000000000000000000000000000000000000000000000000000000000000
118.1279 -0000000000000000000000000000000000000000000000000000000000000000
118.1280 -cleartomark
118.1281 -%%BeginResource: procset Altsys_header 4 0
118.1282 -userdict begin /AltsysDict 245 dict def end
118.1283 -AltsysDict begin
118.1284 -/bdf{bind def}bind def
118.1285 -/xdf{exch def}bdf
118.1286 -/defed{where{pop true}{false}ifelse}bdf
118.1287 -/ndf{1 index where{pop pop pop}{dup xcheck{bind}if def}ifelse}bdf
118.1288 -/d{setdash}bdf
118.1289 -/h{closepath}bdf
118.1290 -/H{}bdf
118.1291 -/J{setlinecap}bdf
118.1292 -/j{setlinejoin}bdf
118.1293 -/M{setmiterlimit}bdf
118.1294 -/n{newpath}bdf
118.1295 -/N{newpath}bdf
118.1296 -/q{gsave}bdf
118.1297 -/Q{grestore}bdf
118.1298 -/w{setlinewidth}bdf
118.1299 -/sepdef{
118.1300 - dup where not
118.1301 - {
118.1302 -AltsysSepDict
118.1303 - }
118.1304 - if 
118.1305 - 3 1 roll exch put
118.1306 -}bdf
118.1307 -/st{settransfer}bdf
118.1308 -/colorimage defed /_rci xdf
118.1309 -/_NXLevel2 defed { 
118.1310 - _NXLevel2 not {   
118.1311 -/colorimage where {
118.1312 -userdict eq {
118.1313 -/_rci false def 
118.1314 -} if
118.1315 -} if
118.1316 - } if
118.1317 -} if
118.1318 -/md defed{ 
118.1319 - md type /dicttype eq {  
118.1320 -/colorimage where { 
118.1321 -md eq { 
118.1322 -/_rci false def 
118.1323 -}if
118.1324 -}if
118.1325 -/settransfer where {
118.1326 -md eq {
118.1327 -/st systemdict /settransfer get def
118.1328 -}if
118.1329 -}if
118.1330 - }if 
118.1331 -}if
118.1332 -/setstrokeadjust defed
118.1333 -{
118.1334 - true setstrokeadjust
118.1335 - /C{curveto}bdf
118.1336 - /L{lineto}bdf
118.1337 - /m{moveto}bdf
118.1338 -}
118.1339 -{
118.1340 - /dr{transform .25 sub round .25 add 
118.1341 -exch .25 sub round .25 add exch itransform}bdf
118.1342 - /C{dr curveto}bdf
118.1343 - /L{dr lineto}bdf
118.1344 - /m{dr moveto}bdf
118.1345 - /setstrokeadjust{pop}bdf 
118.1346 -}ifelse
118.1347 -/rectstroke defed /xt xdf
118.1348 -xt {/yt save def} if
118.1349 -/privrectpath { 
118.1350 - 4 -2 roll m
118.1351 - dtransform round exch round exch idtransform 
118.1352 - 2 copy 0 lt exch 0 lt xor
118.1353 - {dup 0 exch rlineto exch 0 rlineto neg 0 exch rlineto}
118.1354 - {exch dup 0 rlineto exch 0 exch rlineto neg 0 rlineto}
118.1355 - ifelse
118.1356 - closepath
118.1357 -}bdf
118.1358 -/rectclip{newpath privrectpath clip newpath}def
118.1359 -/rectfill{gsave newpath privrectpath fill grestore}def
118.1360 -/rectstroke{gsave newpath privrectpath stroke grestore}def
118.1361 -xt {yt restore} if
118.1362 -/_fonthacksave false def
118.1363 -/currentpacking defed 
118.1364 -{
118.1365 - /_bfh {/_fonthacksave currentpacking def false setpacking} bdf
118.1366 - /_efh {_fonthacksave setpacking} bdf
118.1367 -}
118.1368 -{
118.1369 - /_bfh {} bdf
118.1370 - /_efh {} bdf
118.1371 -}ifelse
118.1372 -/packedarray{array astore readonly}ndf
118.1373 -/` 
118.1374 -{ 
118.1375 - false setoverprint  
118.1376 - 
118.1377 - 
118.1378 - /-save0- save def
118.1379 - 5 index concat
118.1380 - pop
118.1381 - storerect left bottom width height rectclip
118.1382 - pop
118.1383 - 
118.1384 - /dict_count countdictstack def
118.1385 - /op_count count 1 sub def
118.1386 - userdict begin
118.1387 - 
118.1388 - /showpage {} def
118.1389 - 
118.1390 - 0 setgray 0 setlinecap 1 setlinewidth
118.1391 - 0 setlinejoin 10 setmiterlimit [] 0 setdash newpath
118.1392 - 
118.1393 -} bdf
118.1394 -/currentpacking defed{true setpacking}if
118.1395 -/min{2 copy gt{exch}if pop}bdf
118.1396 -/max{2 copy lt{exch}if pop}bdf
118.1397 -/xformfont { currentfont exch makefont setfont } bdf
118.1398 -/fhnumcolors 1 
118.1399 - statusdict begin
118.1400 -/processcolors defed 
118.1401 -{
118.1402 -pop processcolors
118.1403 -}
118.1404 -{
118.1405 -/deviceinfo defed {
118.1406 -deviceinfo /Colors known {
118.1407 -pop deviceinfo /Colors get
118.1408 -} if
118.1409 -} if
118.1410 -} ifelse
118.1411 - end 
118.1412 -def
118.1413 -/printerRes 
118.1414 - gsave
118.1415 - matrix defaultmatrix setmatrix
118.1416 - 72 72 dtransform
118.1417 - abs exch abs
118.1418 - max
118.1419 - grestore
118.1420 - def
118.1421 -/graycalcs
118.1422 -[
118.1423 - {Angle Frequency}   
118.1424 - {GrayAngle GrayFrequency} 
118.1425 - {0 Width Height matrix defaultmatrix idtransform 
118.1426 -dup mul exch dup mul add sqrt 72 exch div} 
118.1427 - {0 GrayWidth GrayHeight matrix defaultmatrix idtransform 
118.1428 -dup mul exch dup mul add sqrt 72 exch div} 
118.1429 -] def
118.1430 -/calcgraysteps {
118.1431 - forcemaxsteps
118.1432 - {
118.1433 -maxsteps
118.1434 - }
118.1435 - {
118.1436 -/currenthalftone defed
118.1437 -{currenthalftone /dicttype eq}{false}ifelse
118.1438 -{
118.1439 -currenthalftone begin
118.1440 -HalftoneType 4 le
118.1441 -{graycalcs HalftoneType 1 sub get exec}
118.1442 -{
118.1443 -HalftoneType 5 eq
118.1444 -{
118.1445 -Default begin
118.1446 -{graycalcs HalftoneType 1 sub get exec}
118.1447 -end
118.1448 -}
118.1449 -{0 60} 
118.1450 -ifelse
118.1451 -}
118.1452 -ifelse
118.1453 -end
118.1454 -}
118.1455 -{
118.1456 -currentscreen pop exch 
118.1457 -}
118.1458 -ifelse
118.1459 - 
118.1460 -printerRes 300 max exch div exch 
118.1461 -2 copy 
118.1462 -sin mul round dup mul 
118.1463 -3 1 roll 
118.1464 -cos mul round dup mul 
118.1465 -add 1 add 
118.1466 -dup maxsteps gt {pop maxsteps} if 
118.1467 - }
118.1468 - ifelse
118.1469 -} bdf
118.1470 -/nextrelease defed { 
118.1471 - /languagelevel defed not {    
118.1472 -/framebuffer defed { 
118.1473 -0 40 string framebuffer 9 1 roll 8 {pop} repeat
118.1474 -dup 516 eq exch 520 eq or
118.1475 -{
118.1476 -/fhnumcolors 3 def
118.1477 -/currentscreen {60 0 {pop pop 1}}bdf
118.1478 -/calcgraysteps {maxsteps} bdf
118.1479 -}if
118.1480 -}if
118.1481 - }if
118.1482 -}if
118.1483 -fhnumcolors 1 ne {
118.1484 - /calcgraysteps {maxsteps} bdf
118.1485 -} if
118.1486 -/currentpagedevice defed {
118.1487 - 
118.1488 - 
118.1489 - currentpagedevice /PreRenderingEnhance known
118.1490 - {
118.1491 -currentpagedevice /PreRenderingEnhance get
118.1492 -{
118.1493 -/calcgraysteps 
118.1494 -{
118.1495 -forcemaxsteps 
118.1496 -{maxsteps}
118.1497 -{256 maxsteps min}
118.1498 -ifelse
118.1499 -} def
118.1500 -} if
118.1501 - } if
118.1502 -} if
118.1503 -/gradfrequency 144 def
118.1504 -printerRes 1000 lt {
118.1505 - /gradfrequency 72 def
118.1506 -} if
118.1507 -/adjnumsteps {
118.1508 - 
118.1509 - dup dtransform abs exch abs max  
118.1510 - 
118.1511 - printerRes div       
118.1512 - 
118.1513 - gradfrequency mul      
118.1514 - round        
118.1515 - 5 max       
118.1516 - min        
118.1517 -}bdf
118.1518 -/goodsep {
118.1519 - spots exch get 4 get dup sepname eq exch (_vc_Registration) eq or
118.1520 -}bdf
118.1521 -/BeginGradation defed
118.1522 -{/bb{BeginGradation}bdf}
118.1523 -{/bb{}bdf}
118.1524 -ifelse
118.1525 -/EndGradation defed
118.1526 -{/eb{EndGradation}bdf}
118.1527 -{/eb{}bdf}
118.1528 -ifelse
118.1529 -/bottom -0 def 
118.1530 -/delta -0 def 
118.1531 -/frac -0 def 
118.1532 -/height -0 def 
118.1533 -/left -0 def 
118.1534 -/numsteps1 -0 def 
118.1535 -/radius -0 def 
118.1536 -/right -0 def 
118.1537 -/top -0 def 
118.1538 -/width -0 def 
118.1539 -/xt -0 def 
118.1540 -/yt -0 def 
118.1541 -/df currentflat def 
118.1542 -/tempstr 1 string def 
118.1543 -/clipflatness currentflat def 
118.1544 -/inverted? 
118.1545 - 0 currenttransfer exec .5 ge def
118.1546 -/tc1 [0 0 0 1] def 
118.1547 -/tc2 [0 0 0 1] def 
118.1548 -/storerect{/top xdf /right xdf /bottom xdf /left xdf 
118.1549 -/width right left sub def /height top bottom sub def}bdf
118.1550 -/concatprocs{
118.1551 - systemdict /packedarray known 
118.1552 - {dup type /packedarraytype eq 2 index type /packedarraytype eq or}{false}ifelse
118.1553 - { 
118.1554 -/proc2 exch cvlit def /proc1 exch cvlit def
118.1555 -proc1 aload pop proc2 aload pop
118.1556 -proc1 length proc2 length add packedarray cvx
118.1557 - }
118.1558 - { 
118.1559 -/proc2 exch cvlit def /proc1 exch cvlit def
118.1560 -/newproc proc1 length proc2 length add array def
118.1561 -newproc 0 proc1 putinterval newproc proc1 length proc2 putinterval
118.1562 -newproc cvx
118.1563 - }ifelse
118.1564 -}bdf
118.1565 -/i{dup 0 eq
118.1566 - {pop df dup} 
118.1567 - {dup} ifelse 
118.1568 - /clipflatness xdf setflat
118.1569 -}bdf
118.1570 -version cvr 38.0 le
118.1571 -{/setrgbcolor{
118.1572 -currenttransfer exec 3 1 roll
118.1573 -currenttransfer exec 3 1 roll
118.1574 -currenttransfer exec 3 1 roll
118.1575 -setrgbcolor}bdf}if
118.1576 -/vms {/vmsv save def} bdf
118.1577 -/vmr {vmsv restore} bdf
118.1578 -/vmrs{vmsv restore /vmsv save def}bdf
118.1579 -/eomode{ 
118.1580 - {/filler /eofill load def /clipper /eoclip load def}
118.1581 - {/filler /fill load def /clipper /clip load def}
118.1582 - ifelse
118.1583 -}bdf
118.1584 -/normtaper{}bdf
118.1585 -/logtaper{9 mul 1 add log}bdf
118.1586 -/CD{
118.1587 - /NF exch def 
118.1588 - {    
118.1589 -exch dup 
118.1590 -/FID ne 1 index/UniqueID ne and
118.1591 -{exch NF 3 1 roll put}
118.1592 -{pop pop}
118.1593 -ifelse
118.1594 - }forall 
118.1595 - NF
118.1596 -}bdf
118.1597 -/MN{
118.1598 - 1 index length   
118.1599 - /Len exch def 
118.1600 - dup length Len add  
118.1601 - string dup    
118.1602 - Len     
118.1603 - 4 -1 roll    
118.1604 - putinterval   
118.1605 - dup     
118.1606 - 0      
118.1607 - 4 -1 roll   
118.1608 - putinterval   
118.1609 -}bdf
118.1610 -/RC{4 -1 roll /ourvec xdf 256 string cvs(|______)anchorsearch
118.1611 - {1 index MN cvn/NewN exch def cvn
118.1612 - findfont dup maxlength dict CD dup/FontName NewN put dup
118.1613 - /Encoding ourvec put NewN exch definefont pop}{pop}ifelse}bdf
118.1614 -/RF{ 
118.1615 - dup      
118.1616 - FontDirectory exch   
118.1617 - known     
118.1618 - {pop 3 -1 roll pop}  
118.1619 - {RC}
118.1620 - ifelse
118.1621 -}bdf
118.1622 -/FF{dup 256 string cvs(|______)exch MN cvn dup FontDirectory exch known
118.1623 - {exch pop findfont 3 -1 roll pop}
118.1624 - {pop dup findfont dup maxlength dict CD dup dup
118.1625 - /Encoding exch /Encoding get 256 array copy 7 -1 roll 
118.1626 - {3 -1 roll dup 4 -2 roll put}forall put definefont}
118.1627 - ifelse}bdf
118.1628 -/RFJ{ 
118.1629 - dup      
118.1630 - FontDirectory exch   
118.1631 - known     
118.1632 - {pop 3 -1 roll pop  
118.1633 - FontDirectory /Ryumin-Light-83pv-RKSJ-H known 
118.1634 - {pop pop /Ryumin-Light-83pv-RKSJ-H dup}if  
118.1635 - }      
118.1636 - {RC}
118.1637 - ifelse
118.1638 -}bdf
118.1639 -/FFJ{dup 256 string cvs(|______)exch MN cvn dup FontDirectory exch known
118.1640 - {exch pop findfont 3 -1 roll pop}
118.1641 - {pop
118.1642 -dup FontDirectory exch known not 
118.1643 - {FontDirectory /Ryumin-Light-83pv-RKSJ-H known 
118.1644 -{pop /Ryumin-Light-83pv-RKSJ-H}if 
118.1645 - }if            
118.1646 - dup findfont dup maxlength dict CD dup dup
118.1647 - /Encoding exch /Encoding get 256 array copy 7 -1 roll 
118.1648 - {3 -1 roll dup 4 -2 roll put}forall put definefont}
118.1649 - ifelse}bdf
118.1650 -/fps{
118.1651 - currentflat   
118.1652 - exch     
118.1653 - dup 0 le{pop 1}if 
118.1654 - {
118.1655 -dup setflat 3 index stopped
118.1656 -{1.3 mul dup 3 index gt{pop setflat pop pop stop}if} 
118.1657 -{exit} 
118.1658 -ifelse
118.1659 - }loop 
118.1660 - pop setflat pop pop
118.1661 -}bdf
118.1662 -/fp{100 currentflat fps}bdf
118.1663 -/clipper{clip}bdf 
118.1664 -/W{/clipper load 100 clipflatness dup setflat fps}bdf
118.1665 -userdict begin /BDFontDict 29 dict def end
118.1666 -BDFontDict begin
118.1667 -/bu{}def
118.1668 -/bn{}def
118.1669 -/setTxMode{av 70 ge{pop}if pop}def
118.1670 -/gm{m}def
118.1671 -/show{pop}def
118.1672 -/gr{pop}def
118.1673 -/fnt{pop pop pop}def
118.1674 -/fs{pop}def
118.1675 -/fz{pop}def
118.1676 -/lin{pop pop}def
118.1677 -/:M {pop pop} def
118.1678 -/sf {pop} def
118.1679 -/S {pop} def
118.1680 -/@b {pop pop pop pop pop pop pop pop} def
118.1681 -/_bdsave /save load def
118.1682 -/_bdrestore /restore load def
118.1683 -/save { dup /fontsave eq {null} {_bdsave} ifelse } def
118.1684 -/restore { dup null eq { pop } { _bdrestore } ifelse } def
118.1685 -/fontsave null def
118.1686 -end
118.1687 -/MacVec 256 array def 
118.1688 -MacVec 0 /Helvetica findfont
118.1689 -/Encoding get 0 128 getinterval putinterval
118.1690 -MacVec 127 /DEL put MacVec 16#27 /quotesingle put MacVec 16#60 /grave put
118.1691 -/NUL/SOH/STX/ETX/EOT/ENQ/ACK/BEL/BS/HT/LF/VT/FF/CR/SO/SI
118.1692 -/DLE/DC1/DC2/DC3/DC4/NAK/SYN/ETB/CAN/EM/SUB/ESC/FS/GS/RS/US
118.1693 -MacVec 0 32 getinterval astore pop
118.1694 -/Adieresis/Aring/Ccedilla/Eacute/Ntilde/Odieresis/Udieresis/aacute
118.1695 -/agrave/acircumflex/adieresis/atilde/aring/ccedilla/eacute/egrave
118.1696 -/ecircumflex/edieresis/iacute/igrave/icircumflex/idieresis/ntilde/oacute
118.1697 -/ograve/ocircumflex/odieresis/otilde/uacute/ugrave/ucircumflex/udieresis
118.1698 -/dagger/degree/cent/sterling/section/bullet/paragraph/germandbls
118.1699 -/registered/copyright/trademark/acute/dieresis/notequal/AE/Oslash
118.1700 -/infinity/plusminus/lessequal/greaterequal/yen/mu/partialdiff/summation
118.1701 -/product/pi/integral/ordfeminine/ordmasculine/Omega/ae/oslash 
118.1702 -/questiondown/exclamdown/logicalnot/radical/florin/approxequal/Delta/guillemotleft
118.1703 -/guillemotright/ellipsis/nbspace/Agrave/Atilde/Otilde/OE/oe
118.1704 -/endash/emdash/quotedblleft/quotedblright/quoteleft/quoteright/divide/lozenge
118.1705 -/ydieresis/Ydieresis/fraction/currency/guilsinglleft/guilsinglright/fi/fl
118.1706 -/daggerdbl/periodcentered/quotesinglbase/quotedblbase
118.1707 -/perthousand/Acircumflex/Ecircumflex/Aacute
118.1708 -/Edieresis/Egrave/Iacute/Icircumflex/Idieresis/Igrave/Oacute/Ocircumflex
118.1709 -/apple/Ograve/Uacute/Ucircumflex/Ugrave/dotlessi/circumflex/tilde
118.1710 -/macron/breve/dotaccent/ring/cedilla/hungarumlaut/ogonek/caron
118.1711 -MacVec 128 128 getinterval astore pop
118.1712 -end %. AltsysDict
118.1713 -%%EndResource
118.1714 -%%EndProlog
118.1715 -%%BeginSetup
118.1716 -AltsysDict begin
118.1717 -_bfh
118.1718 -%%IncludeResource: font Symbol
118.1719 -_efh
118.1720 -0 dict dup begin
118.1721 -end 
118.1722 -/f0 /Symbol FF def
118.1723 -_bfh
118.1724 -%%IncludeResource: font ZapfHumanist601BT-Bold
118.1725 -_efh
118.1726 -0 dict dup begin
118.1727 -end 
118.1728 -/f1 /ZapfHumanist601BT-Bold FF def
118.1729 -end %. AltsysDict
118.1730 -%%EndSetup
118.1731 -AltsysDict begin 
118.1732 -/onlyk4{false}ndf
118.1733 -/ccmyk{dup 5 -1 roll sub 0 max exch}ndf
118.1734 -/cmyk2gray{
118.1735 - 4 -1 roll 0.3 mul 4 -1 roll 0.59 mul 4 -1 roll 0.11 mul
118.1736 - add add add 1 min neg 1 add
118.1737 -}bdf
118.1738 -/setcmykcolor{1 exch sub ccmyk ccmyk ccmyk pop setrgbcolor}ndf
118.1739 -/maxcolor { 
118.1740 - max max max  
118.1741 -} ndf
118.1742 -/maxspot {
118.1743 - pop
118.1744 -} ndf
118.1745 -/setcmykcoloroverprint{4{dup -1 eq{pop 0}if 4 1 roll}repeat setcmykcolor}ndf
118.1746 -/findcmykcustomcolor{5 packedarray}ndf
118.1747 -/setcustomcolor{exch aload pop pop 4{4 index mul 4 1 roll}repeat setcmykcolor pop}ndf
118.1748 -/setseparationgray{setgray}ndf
118.1749 -/setoverprint{pop}ndf 
118.1750 -/currentoverprint false ndf
118.1751 -/cmykbufs2gray{
118.1752 - 0 1 2 index length 1 sub
118.1753 - { 
118.1754 -4 index 1 index get 0.3 mul 
118.1755 -4 index 2 index get 0.59 mul 
118.1756 -4 index 3 index get 0.11 mul 
118.1757 -4 index 4 index get 
118.1758 -add add add cvi 255 min
118.1759 -255 exch sub
118.1760 -2 index 3 1 roll put
118.1761 - }for
118.1762 - 4 1 roll pop pop pop
118.1763 -}bdf
118.1764 -/colorimage{
118.1765 - pop pop
118.1766 - [
118.1767 -5 -1 roll/exec cvx 
118.1768 -6 -1 roll/exec cvx 
118.1769 -7 -1 roll/exec cvx 
118.1770 -8 -1 roll/exec cvx
118.1771 -/cmykbufs2gray cvx
118.1772 - ]cvx 
118.1773 - image
118.1774 -}
118.1775 -%. version 47.1 on Linotronic of Postscript defines colorimage incorrectly (rgb model only)
118.1776 -version cvr 47.1 le 
118.1777 -statusdict /product get (Lino) anchorsearch{pop pop true}{pop false}ifelse
118.1778 -and{userdict begin bdf end}{ndf}ifelse
118.1779 -fhnumcolors 1 ne {/yt save def} if
118.1780 -/customcolorimage{
118.1781 - aload pop
118.1782 - (_vc_Registration) eq 
118.1783 - {
118.1784 -pop pop pop pop separationimage
118.1785 - }
118.1786 - {
118.1787 -/ik xdf /iy xdf /im xdf /ic xdf
118.1788 -ic im iy ik cmyk2gray /xt xdf
118.1789 -currenttransfer
118.1790 -{dup 1.0 exch sub xt mul add}concatprocs
118.1791 -st 
118.1792 -image
118.1793 - }
118.1794 - ifelse
118.1795 -}ndf
118.1796 -fhnumcolors 1 ne {yt restore} if
118.1797 -fhnumcolors 3 ne {/yt save def} if
118.1798 -/customcolorimage{
118.1799 - aload pop 
118.1800 - (_vc_Registration) eq 
118.1801 - {
118.1802 -pop pop pop pop separationimage
118.1803 - }
118.1804 - {
118.1805 -/ik xdf /iy xdf /im xdf /ic xdf
118.1806 -1.0 dup ic ik add min sub 
118.1807 -1.0 dup im ik add min sub 
118.1808 -1.0 dup iy ik add min sub 
118.1809 -/ic xdf /iy xdf /im xdf
118.1810 -currentcolortransfer
118.1811 -4 1 roll 
118.1812 -{dup 1.0 exch sub ic mul add}concatprocs 4 1 roll 
118.1813 -{dup 1.0 exch sub iy mul add}concatprocs 4 1 roll 
118.1814 -{dup 1.0 exch sub im mul add}concatprocs 4 1 roll 
118.1815 -setcolortransfer
118.1816 -{/dummy xdf dummy}concatprocs{dummy}{dummy}true 3 colorimage
118.1817 - }
118.1818 - ifelse
118.1819 -}ndf
118.1820 -fhnumcolors 3 ne {yt restore} if
118.1821 -fhnumcolors 4 ne {/yt save def} if
118.1822 -/customcolorimage{
118.1823 - aload pop
118.1824 - (_vc_Registration) eq 
118.1825 - {
118.1826 -pop pop pop pop separationimage
118.1827 - }
118.1828 - {
118.1829 -/ik xdf /iy xdf /im xdf /ic xdf
118.1830 -currentcolortransfer
118.1831 -{1.0 exch sub ik mul ik sub 1 add}concatprocs 4 1 roll
118.1832 -{1.0 exch sub iy mul iy sub 1 add}concatprocs 4 1 roll
118.1833 -{1.0 exch sub im mul im sub 1 add}concatprocs 4 1 roll
118.1834 -{1.0 exch sub ic mul ic sub 1 add}concatprocs 4 1 roll
118.1835 -setcolortransfer
118.1836 -{/dummy xdf dummy}concatprocs{dummy}{dummy}{dummy}
118.1837 -true 4 colorimage
118.1838 - }
118.1839 - ifelse
118.1840 -}ndf
118.1841 -fhnumcolors 4 ne {yt restore} if
118.1842 -/separationimage{image}ndf
118.1843 -/newcmykcustomcolor{6 packedarray}ndf
118.1844 -/inkoverprint false ndf
118.1845 -/setinkoverprint{pop}ndf 
118.1846 -/setspotcolor { 
118.1847 - spots exch get
118.1848 - dup 4 get (_vc_Registration) eq
118.1849 - {pop 1 exch sub setseparationgray}
118.1850 - {0 5 getinterval exch setcustomcolor}
118.1851 - ifelse
118.1852 -}ndf
118.1853 -/currentcolortransfer{currenttransfer dup dup dup}ndf
118.1854 -/setcolortransfer{st pop pop pop}ndf
118.1855 -/fas{}ndf
118.1856 -/sas{}ndf
118.1857 -/fhsetspreadsize{pop}ndf
118.1858 -/filler{fill}bdf 
118.1859 -/F{gsave {filler}fp grestore}bdf
118.1860 -/f{closepath F}bdf
118.1861 -/S{gsave {stroke}fp grestore}bdf
118.1862 -/s{closepath S}bdf
118.1863 -/bc4 [0 0 0 0] def 
118.1864 -/_lfp4 {
118.1865 - /iosv inkoverprint def
118.1866 - /cosv currentoverprint def
118.1867 - /yt xdf       
118.1868 - /xt xdf       
118.1869 - /ang xdf      
118.1870 - storerect
118.1871 - /taperfcn xdf
118.1872 - /k2 xdf /y2 xdf /m2 xdf /c2 xdf
118.1873 - /k1 xdf /y1 xdf /m1 xdf /c1 xdf
118.1874 - c1 c2 sub abs
118.1875 - m1 m2 sub abs
118.1876 - y1 y2 sub abs
118.1877 - k1 k2 sub abs
118.1878 - maxcolor      
118.1879 - calcgraysteps mul abs round  
118.1880 - height abs adjnumsteps   
118.1881 - dup 2 lt {pop 1} if    
118.1882 - 1 sub /numsteps1 xdf
118.1883 - currentflat mark    
118.1884 - currentflat clipflatness  
118.1885 - /delta top bottom sub numsteps1 1 add div def 
118.1886 - /right right left sub def  
118.1887 - /botsv top delta sub def  
118.1888 - {
118.1889 -{
118.1890 -W
118.1891 -xt yt translate 
118.1892 -ang rotate
118.1893 -xt neg yt neg translate 
118.1894 -dup setflat 
118.1895 -/bottom botsv def
118.1896 -0 1 numsteps1 
118.1897 -{
118.1898 -numsteps1 dup 0 eq {pop 0.5 } { div } ifelse 
118.1899 -taperfcn /frac xdf
118.1900 -bc4 0 c2 c1 sub frac mul c1 add put
118.1901 -bc4 1 m2 m1 sub frac mul m1 add put
118.1902 -bc4 2 y2 y1 sub frac mul y1 add put
118.1903 -bc4 3 k2 k1 sub frac mul k1 add put
118.1904 -bc4 vc
118.1905 -1 index setflat 
118.1906 -{ 
118.1907 -mark {newpath left bottom right delta rectfill}stopped
118.1908 -{cleartomark exch 1.3 mul dup setflat exch 2 copy gt{stop}if}
118.1909 -{cleartomark exit}ifelse
118.1910 -}loop
118.1911 -/bottom bottom delta sub def
118.1912 -}for
118.1913 -}
118.1914 -gsave stopped grestore
118.1915 -{exch pop 2 index exch 1.3 mul dup 100 gt{cleartomark setflat stop}if}
118.1916 -{exit}ifelse
118.1917 - }loop
118.1918 - cleartomark setflat
118.1919 - iosv setinkoverprint
118.1920 - cosv setoverprint
118.1921 -}bdf
118.1922 -/bcs [0 0] def 
118.1923 -/_lfs4 {
118.1924 - /iosv inkoverprint def
118.1925 - /cosv currentoverprint def
118.1926 - /yt xdf       
118.1927 - /xt xdf       
118.1928 - /ang xdf      
118.1929 - storerect
118.1930 - /taperfcn xdf
118.1931 - /tint2 xdf      
118.1932 - /tint1 xdf      
118.1933 - bcs exch 1 exch put    
118.1934 - tint1 tint2 sub abs    
118.1935 - bcs 1 get maxspot    
118.1936 - calcgraysteps mul abs round  
118.1937 - height abs adjnumsteps   
118.1938 - dup 2 lt {pop 2} if    
118.1939 - 1 sub /numsteps1 xdf
118.1940 - currentflat mark    
118.1941 - currentflat clipflatness  
118.1942 - /delta top bottom sub numsteps1 1 add div def 
118.1943 - /right right left sub def  
118.1944 - /botsv top delta sub def  
118.1945 - {
118.1946 -{
118.1947 -W
118.1948 -xt yt translate 
118.1949 -ang rotate
118.1950 -xt neg yt neg translate 
118.1951 -dup setflat 
118.1952 -/bottom botsv def
118.1953 -0 1 numsteps1 
118.1954 -{
118.1955 -numsteps1 div taperfcn /frac xdf
118.1956 -bcs 0
118.1957 -1.0 tint2 tint1 sub frac mul tint1 add sub
118.1958 -put bcs vc
118.1959 -1 index setflat 
118.1960 -{ 
118.1961 -mark {newpath left bottom right delta rectfill}stopped
118.1962 -{cleartomark exch 1.3 mul dup setflat exch 2 copy gt{stop}if}
118.1963 -{cleartomark exit}ifelse
118.1964 -}loop
118.1965 -/bottom bottom delta sub def
118.1966 -}for
118.1967 -}
118.1968 -gsave stopped grestore
118.1969 -{exch pop 2 index exch 1.3 mul dup 100 gt{cleartomark setflat stop}if}
118.1970 -{exit}ifelse
118.1971 - }loop
118.1972 - cleartomark setflat
118.1973 - iosv setinkoverprint
118.1974 - cosv setoverprint
118.1975 -}bdf
118.1976 -/_rfs4 {
118.1977 - /iosv inkoverprint def
118.1978 - /cosv currentoverprint def
118.1979 - /tint2 xdf      
118.1980 - /tint1 xdf      
118.1981 - bcs exch 1 exch put    
118.1982 - /radius xdf      
118.1983 - /yt xdf       
118.1984 - /xt xdf       
118.1985 - tint1 tint2 sub abs    
118.1986 - bcs 1 get maxspot    
118.1987 - calcgraysteps mul abs round  
118.1988 - radius abs adjnumsteps   
118.1989 - dup 2 lt {pop 2} if    
118.1990 - 1 sub /numsteps1 xdf
118.1991 - radius numsteps1 div 2 div /halfstep xdf 
118.1992 - currentflat mark    
118.1993 - currentflat clipflatness  
118.1994 - {
118.1995 -{
118.1996 -dup setflat 
118.1997 -W 
118.1998 -0 1 numsteps1 
118.1999 -{
118.2000 -dup /radindex xdf
118.2001 -numsteps1 div /frac xdf
118.2002 -bcs 0
118.2003 -tint2 tint1 sub frac mul tint1 add
118.2004 -put bcs vc
118.2005 -1 index setflat 
118.2006 -{ 
118.2007 -newpath mark xt yt radius 1 frac sub mul halfstep add 0 360
118.2008 -{ arc
118.2009 -radindex numsteps1 ne 
118.2010 -{
118.2011 -xt yt 
118.2012 -radindex 1 add numsteps1 
118.2013 -div 1 exch sub 
118.2014 -radius mul halfstep add
118.2015 -dup xt add yt moveto 
118.2016 -360 0 arcn 
118.2017 -} if
118.2018 -fill
118.2019 -}stopped
118.2020 -{cleartomark exch 1.3 mul dup setflat exch 2 copy gt{stop}if}
118.2021 -{cleartomark exit}ifelse
118.2022 -}loop
118.2023 -}for
118.2024 -}
118.2025 -gsave stopped grestore
118.2026 -{exch pop 2 index exch 1.3 mul dup 100 gt{cleartomark setflat stop}if}
118.2027 -{exit}ifelse
118.2028 - }loop
118.2029 - cleartomark setflat
118.2030 - iosv setinkoverprint
118.2031 - cosv setoverprint
118.2032 -}bdf
118.2033 -/_rfp4 {
118.2034 - /iosv inkoverprint def
118.2035 - /cosv currentoverprint def
118.2036 - /k2 xdf /y2 xdf /m2 xdf /c2 xdf
118.2037 - /k1 xdf /y1 xdf /m1 xdf /c1 xdf
118.2038 - /radius xdf      
118.2039 - /yt xdf       
118.2040 - /xt xdf       
118.2041 - c1 c2 sub abs
118.2042 - m1 m2 sub abs
118.2043 - y1 y2 sub abs
118.2044 - k1 k2 sub abs
118.2045 - maxcolor      
118.2046 - calcgraysteps mul abs round  
118.2047 - radius abs adjnumsteps   
118.2048 - dup 2 lt {pop 1} if    
118.2049 - 1 sub /numsteps1 xdf
118.2050 - radius numsteps1 dup 0 eq {pop} {div} ifelse 
118.2051 - 2 div /halfstep xdf 
118.2052 - currentflat mark    
118.2053 - currentflat clipflatness  
118.2054 - {
118.2055 -{
118.2056 -dup setflat 
118.2057 -W 
118.2058 -0 1 numsteps1 
118.2059 -{
118.2060 -dup /radindex xdf
118.2061 -numsteps1 dup 0 eq {pop 0.5 } { div } ifelse 
118.2062 -/frac xdf
118.2063 -bc4 0 c2 c1 sub frac mul c1 add put
118.2064 -bc4 1 m2 m1 sub frac mul m1 add put
118.2065 -bc4 2 y2 y1 sub frac mul y1 add put
118.2066 -bc4 3 k2 k1 sub frac mul k1 add put
118.2067 -bc4 vc
118.2068 -1 index setflat 
118.2069 -{ 
118.2070 -newpath mark xt yt radius 1 frac sub mul halfstep add 0 360
118.2071 -{ arc
118.2072 -radindex numsteps1 ne 
118.2073 -{
118.2074 -xt yt 
118.2075 -radindex 1 add 
118.2076 -numsteps1 dup 0 eq {pop} {div} ifelse 
118.2077 -1 exch sub 
118.2078 -radius mul halfstep add
118.2079 -dup xt add yt moveto 
118.2080 -360 0 arcn 
118.2081 -} if
118.2082 -fill
118.2083 -}stopped
118.2084 -{cleartomark exch 1.3 mul dup setflat exch 2 copy gt{stop}if}
118.2085 -{cleartomark exit}ifelse
118.2086 -}loop
118.2087 -}for
118.2088 -}
118.2089 -gsave stopped grestore
118.2090 -{exch pop 2 index exch 1.3 mul dup 100 gt{cleartomark setflat stop}if}
118.2091 -{exit}ifelse
118.2092 - }loop
118.2093 - cleartomark setflat
118.2094 - iosv setinkoverprint
118.2095 - cosv setoverprint
118.2096 -}bdf
118.2097 -/lfp4{_lfp4}ndf
118.2098 -/lfs4{_lfs4}ndf
118.2099 -/rfs4{_rfs4}ndf
118.2100 -/rfp4{_rfp4}ndf
118.2101 -/cvc [0 0 0 1] def 
118.2102 -/vc{
118.2103 - AltsysDict /cvc 2 index put 
118.2104 - aload length 4 eq
118.2105 - {setcmykcolor}
118.2106 - {setspotcolor}
118.2107 - ifelse
118.2108 -}bdf 
118.2109 -/origmtx matrix currentmatrix def
118.2110 -/ImMatrix matrix currentmatrix def
118.2111 -0 setseparationgray
118.2112 -/imgr {1692 1570.1102 2287.2756 2412 } def 
118.2113 -/bleed 0 def 
118.2114 -/clpr {1692 1570.1102 2287.2756 2412 } def 
118.2115 -/xs 1 def 
118.2116 -/ys 1 def 
118.2117 -/botx 0 def 
118.2118 -/overlap 0 def 
118.2119 -/wdist 18 def 
118.2120 -0 2 mul fhsetspreadsize 
118.2121 -0 0 ne {/df 0 def /clipflatness 0 def} if 
118.2122 -/maxsteps 256 def 
118.2123 -/forcemaxsteps false def 
118.2124 -vms
118.2125 --1845 -1956 translate
118.2126 -/currentpacking defed{false setpacking}if 
118.2127 -/spots[
118.2128 -1 0 0 0 (Process Cyan) false newcmykcustomcolor
118.2129 -0 1 0 0 (Process Magenta) false newcmykcustomcolor
118.2130 -0 0 1 0 (Process Yellow) false newcmykcustomcolor
118.2131 -0 0 0 1 (Process Black) false newcmykcustomcolor
118.2132 -]def
118.2133 -/textopf false def
118.2134 -/curtextmtx{}def
118.2135 -/otw .25 def
118.2136 -/msf{dup/curtextmtx xdf makefont setfont}bdf
118.2137 -/makesetfont/msf load def
118.2138 -/curtextheight{.707104 .707104 curtextmtx dtransform
118.2139 - dup mul exch dup mul add sqrt}bdf
118.2140 -/ta2{ 
118.2141 -tempstr 2 index gsave exec grestore 
118.2142 -cwidth cheight rmoveto 
118.2143 -4 index eq{5 index 5 index rmoveto}if 
118.2144 -2 index 2 index rmoveto 
118.2145 -}bdf
118.2146 -/ta{exch systemdict/cshow known
118.2147 -{{/cheight xdf/cwidth xdf tempstr 0 2 index put ta2}exch cshow} 
118.2148 -{{tempstr 0 2 index put tempstr stringwidth/cheight xdf/cwidth xdf ta2}forall} 
118.2149 -ifelse 6{pop}repeat}bdf
118.2150 -/sts{/textopf currentoverprint def vc setoverprint
118.2151 -/ts{awidthshow}def exec textopf setoverprint}bdf
118.2152 -/stol{/xt currentlinewidth def 
118.2153 - setlinewidth vc newpath 
118.2154 - /ts{{false charpath stroke}ta}def exec 
118.2155 - xt setlinewidth}bdf 
118.2156 - 
118.2157 -/strk{/textopf currentoverprint def vc setoverprint
118.2158 - /ts{{false charpath stroke}ta}def exec 
118.2159 - textopf setoverprint
118.2160 - }bdf 
118.2161 -n
118.2162 -[] 0 d
118.2163 -3.863708 M
118.2164 -1 w
118.2165 -0 j
118.2166 -0 J
118.2167 -false setoverprint
118.2168 -0 i
118.2169 -false eomode
118.2170 -[0 0 0 1] vc
118.2171 -vms
118.2172 -%white border -- disabled
118.2173 -%1845.2293 2127.8588 m
118.2174 -%2045.9437 2127.8588 L
118.2175 -%2045.9437 1956.1412 L
118.2176 -%1845.2293 1956.1412 L
118.2177 -%1845.2293 2127.8588 L
118.2178 -%0.1417 w
118.2179 -%2 J
118.2180 -%2 M
118.2181 -%[0 0 0 0]  vc
118.2182 -%s 
118.2183 -n
118.2184 -1950.8 2097.2 m
118.2185 -1958.8 2092.5 1967.3 2089 1975.5 2084.9 C
118.2186 -1976.7 2083.5 1976.1 2081.5 1976.7 2079.9 C
118.2187 -1979.6 2081.1 1981.6 2086.8 1985.3 2084 C
118.2188 -1993.4 2079.3 2001.8 2075.8 2010 2071.7 C
118.2189 -2010.5 2071.5 2010.5 2071.1 2010.8 2070.8 C
118.2190 -2011.2 2064.3 2010.9 2057.5 2011 2050.8 C
118.2191 -2015.8 2046.9 2022.2 2046.2 2026.6 2041.7 C
118.2192 -2026.5 2032.5 2026.8 2022.9 2026.4 2014.1 C
118.2193 -2020.4 2008.3 2015 2002.4 2008.8 1997.1 C
118.2194 -2003.8 1996.8 2000.7 2001.2 1996.1 2002.1 C
118.2195 -1995.2 1996.4 1996.9 1990.5 1995.6 1984.8 C
118.2196 -1989.9 1979 1984.5 1973.9 1978.8 1967.8 C
118.2197 -1977.7 1968.6 1976 1967.6 1974.5 1968.3 C
118.2198 -1967.4 1972.5 1960.1 1976.1 1952.7 1979.3 C
118.2199 -1946.8 1976.3 1943.4 1970.7 1938.5 1966.1 C
118.2200 -1933.9 1966.5 1929.4 1968.8 1925.1 1970.7 C
118.2201 -1917.2 1978.2 1906 1977.9 1897.2 1983.4 C
118.2202 -1893.2 1985.6 1889.4 1988.6 1885 1990.1 C
118.2203 -1884.6 1990.6 1883.9 1991 1883.8 1991.6 C
118.2204 -1883.7 2000.4 1884 2009.9 1883.6 2018.9 C
118.2205 -1887.7 2024 1893.2 2028.8 1898 2033.8 C
118.2206 -1899.1 2035.5 1900.9 2036.8 1902.5 2037.9 C
118.2207 -1903.9 2037.3 1905.2 2036.6 1906.4 2035.5 C
118.2208 -1906.3 2039.7 1906.5 2044.6 1906.1 2048.9 C
118.2209 -1906.3 2049.6 1906.7 2050.2 1907.1 2050.8 C
118.2210 -1913.4 2056 1918.5 2062.7 1924.8 2068.1 C
118.2211 -1926.6 2067.9 1928 2066.9 1929.4 2066 C
118.2212 -1930.2 2071 1927.7 2077.1 1930.6 2081.6 C
118.2213 -1936.6 2086.9 1941.5 2092.9 1947.9 2097.9 C
118.2214 -1949 2098.1 1949.9 2097.5 1950.8 2097.2 C
118.2215 -[0 0 0 0.18]  vc
118.2216 -f 
118.2217 -0.4 w
118.2218 -S 
118.2219 -n
118.2220 -1975.2 2084.7 m
118.2221 -1976.6 2083.4 1975.7 2081.1 1976 2079.4 C
118.2222 -1979.3 2079.5 1980.9 2086.2 1984.8 2084 C
118.2223 -1992.9 2078.9 2001.7 2075.6 2010 2071.2 C
118.2224 -2011 2064.6 2010.2 2057.3 2010.8 2050.6 C
118.2225 -2015.4 2046.9 2021.1 2045.9 2025.9 2042.4 C
118.2226 -2026.5 2033.2 2026.8 2022.9 2025.6 2013.9 C
118.2227 -2020.5 2008.1 2014.5 2003.1 2009.3 1997.6 C
118.2228 -2004.1 1996.7 2000.7 2001.6 1995.9 2002.6 C
118.2229 -1995.2 1996.7 1996.3 1990.2 1994.9 1984.6 C
118.2230 -1989.8 1978.7 1983.6 1973.7 1978.4 1968 C
118.2231 -1977.3 1969.3 1976 1967.6 1974.8 1968.5 C
118.2232 -1967.7 1972.7 1960.4 1976.3 1952.9 1979.6 C
118.2233 -1946.5 1976.9 1943.1 1970.5 1937.8 1966.1 C
118.2234 -1928.3 1968.2 1920.6 1974.8 1911.6 1978.4 C
118.2235 -1901.9 1979.7 1893.9 1986.6 1885 1990.6 C
118.2236 -1884.3 1991 1884.3 1991.7 1884 1992.3 C
118.2237 -1884.5 2001 1884.2 2011 1884.3 2019.9 C
118.2238 -1890.9 2025.3 1895.9 2031.9 1902.3 2037.4 C
118.2239 -1904.2 2037.9 1905.6 2034.2 1906.8 2035.7 C
118.2240 -1907.4 2040.9 1905.7 2046.1 1907.3 2050.8 C
118.2241 -1913.6 2056.2 1919.2 2062.6 1925.1 2067.9 C
118.2242 -1926.9 2067.8 1928 2066.3 1929.6 2065.7 C
118.2243 -1929.9 2070.5 1929.2 2076 1930.1 2080.8 C
118.2244 -1936.5 2086.1 1941.6 2092.8 1948.4 2097.6 C
118.2245 -1957.3 2093.3 1966.2 2088.8 1975.2 2084.7 C
118.2246 -[0 0 0 0]  vc
118.2247 -f 
118.2248 -S 
118.2249 -n
118.2250 -1954.8 2093.8 m
118.2251 -1961.6 2090.5 1968.2 2087 1975 2084 C
118.2252 -1975 2082.8 1975.6 2080.9 1974.8 2080.6 C
118.2253 -1974.3 2075.2 1974.6 2069.6 1974.5 2064 C
118.2254 -1977.5 2059.7 1984.5 2060 1988.9 2056.4 C
118.2255 -1989.5 2055.5 1990.5 2055.3 1990.8 2054.4 C
118.2256 -1991.1 2045.7 1991.4 2036.1 1990.6 2027.8 C
118.2257 -1990.7 2026.6 1992 2027.3 1992.8 2027.1 C
118.2258 -1997 2032.4 2002.6 2037.8 2007.6 2042.2 C
118.2259 -2008.7 2042.3 2007.8 2040.6 2007.4 2040 C
118.2260 -2002.3 2035.6 1997.5 2030 1992.8 2025.2 C
118.2261 -1991.6 2024.7 1990.8 2024.9 1990.1 2025.4 C
118.2262 -1989.4 2024.9 1988.1 2025.2 1987.2 2024.4 C
118.2263 -1987.1 2025.8 1988.3 2026.5 1989.4 2026.8 C
118.2264 -1989.4 2026.6 1989.3 2026.2 1989.6 2026.1 C
118.2265 -1989.9 2026.2 1989.9 2026.6 1989.9 2026.8 C
118.2266 -1989.8 2026.6 1990 2026.5 1990.1 2026.4 C
118.2267 -1990.2 2027 1991.1 2028.3 1990.1 2028 C
118.2268 -1989.9 2037.9 1990.5 2044.1 1989.6 2054.2 C
118.2269 -1985.9 2058 1979.7 2057.4 1976 2061.2 C
118.2270 -1974.5 2061.6 1975.2 2059.9 1974.5 2059.5 C
118.2271 -1973.9 2058 1975.6 2057.8 1975 2056.6 C
118.2272 -1974.5 2057.1 1974.6 2055.3 1973.6 2055.9 C
118.2273 -1971.9 2059.3 1974.7 2062.1 1973.1 2065.5 C
118.2274 -1973.1 2071.2 1972.9 2077 1973.3 2082.5 C
118.2275 -1967.7 2085.6 1962 2088 1956.3 2090.7 C
118.2276 -1953.9 2092.4 1951 2093 1948.6 2094.8 C
118.2277 -1943.7 2089.9 1937.9 2084.3 1933 2079.6 C
118.2278 -1931.3 2076.1 1933.2 2071.3 1932.3 2067.2 C
118.2279 -1931.3 2062.9 1933.3 2060.6 1932 2057.6 C
118.2280 -1932.7 2056.5 1930.9 2053.3 1933.2 2051.8 C
118.2281 -1936.8 2050.1 1940.1 2046.9 1944 2046.8 C
118.2282 -1946.3 2049.7 1949.3 2051.9 1952 2054.4 C
118.2283 -1954.5 2054.2 1956.4 2052.3 1958.7 2051.3 C
118.2284 -1960.8 2050 1963.2 2049 1965.6 2048.4 C
118.2285 -1968.3 2050.8 1970.7 2054.3 1973.6 2055.4 C
118.2286 -1973 2052.2 1969.7 2050.4 1967.6 2048.2 C
118.2287 -1967.1 2046.7 1968.8 2046.6 1969.5 2045.8 C
118.2288 -1972.8 2043.3 1980.6 2043.4 1979.3 2038.4 C
118.2289 -1979.4 2038.6 1979.2 2038.7 1979.1 2038.8 C
118.2290 -1978.7 2038.6 1978.9 2038.1 1978.8 2037.6 C
118.2291 -1978.9 2037.9 1978.7 2038 1978.6 2038.1 C
118.2292 -1978.2 2032.7 1978.4 2027.1 1978.4 2021.6 C
118.2293 -1979.3 2021.1 1980 2020.2 1981.5 2020.1 C
118.2294 -1983.5 2020.5 1984 2021.8 1985.1 2023.5 C
118.2295 -1985.7 2024 1987.4 2023.7 1986 2022.8 C
118.2296 -1984.7 2021.7 1983.3 2020.8 1983.9 2018.7 C
118.2297 -1987.2 2015.9 1993 2015.4 1994.9 2011.5 C
118.2298 -1992.2 2004.9 1999.3 2005.2 2002.1 2002.4 C
118.2299 -2005.9 2002.7 2004.8 1997.4 2009.1 1999 C
118.2300 -2011 1999.3 2010 2002.9 2012.7 2002.4 C
118.2301 -2010.2 2000.7 2009.4 1996.1 2005.5 1998.5 C
118.2302 -2002.1 2000.3 1999 2002.5 1995.4 2003.8 C
118.2303 -1995.2 2003.6 1994.9 2003.3 1994.7 2003.1 C
118.2304 -1994.3 1997 1995.6 1991.1 1994.4 1985.3 C
118.2305 -1994.3 1986 1993.8 1985 1994 1985.6 C
118.2306 -1993.8 1995.4 1994.4 2001.6 1993.5 2011.7 C
118.2307 -1989.7 2015.5 1983.6 2014.9 1979.8 2018.7 C
118.2308 -1978.3 2019.1 1979.1 2017.4 1978.4 2017 C
118.2309 -1977.8 2015.5 1979.4 2015.3 1978.8 2014.1 C
118.2310 -1978.4 2014.6 1978.5 2012.8 1977.4 2013.4 C
118.2311 -1975.8 2016.8 1978.5 2019.6 1976.9 2023 C
118.2312 -1977 2028.7 1976.7 2034.5 1977.2 2040 C
118.2313 -1971.6 2043.1 1965.8 2045.6 1960.1 2048.2 C
118.2314 -1957.7 2049.9 1954.8 2050.5 1952.4 2052.3 C
118.2315 -1947.6 2047.4 1941.8 2041.8 1936.8 2037.2 C
118.2316 -1935.2 2033.6 1937.1 2028.8 1936.1 2024.7 C
118.2317 -1935.1 2020.4 1937.1 2018.1 1935.9 2015.1 C
118.2318 -1936.5 2014.1 1934.7 2010.8 1937.1 2009.3 C
118.2319 -1944.4 2004.8 1952 2000.9 1959.9 1997.8 C
118.2320 -1963.9 1997 1963.9 2001.9 1966.8 2003.3 C
118.2321 -1970.3 2006.9 1973.7 2009.9 1976.9 2012.9 C
118.2322 -1977.9 2013 1977.1 2011.4 1976.7 2010.8 C
118.2323 -1971.6 2006.3 1966.8 2000.7 1962 1995.9 C
118.2324 -1960 1995.2 1960.1 1996.6 1958.2 1995.6 C
118.2325 -1957 1997 1955.1 1998.8 1953.2 1998 C
118.2326 -1951.7 1994.5 1954.1 1993.4 1952.9 1991.1 C
118.2327 -1952.1 1990.5 1953.3 1990.2 1953.2 1989.6 C
118.2328 -1954.2 1986.8 1950.9 1981.4 1954.4 1981.2 C
118.2329 -1954.7 1981.6 1954.7 1981.7 1955.1 1982 C
118.2330 -1961.9 1979.1 1967.6 1975 1974.3 1971.6 C
118.2331 -1974.7 1969.8 1976.7 1969.5 1978.4 1969.7 C
118.2332 -1980.3 1970 1979.3 1973.6 1982 1973.1 C
118.2333 -1975.8 1962.2 1968 1975.8 1960.8 1976.7 C
118.2334 -1956.9 1977.4 1953.3 1982.4 1949.1 1978.8 C
118.2335 -1946 1975.8 1941.2 1971 1939.5 1969.2 C
118.2336 -1938.5 1968.6 1938.9 1967.4 1937.8 1966.8 C
118.2337 -1928.7 1969.4 1920.6 1974.5 1912.4 1979.1 C
118.2338 -1904 1980 1896.6 1985 1889.3 1989.4 C
118.2339 -1887.9 1990.4 1885.1 1990.3 1885 1992.5 C
118.2340 -1885.4 2000.6 1885.2 2012.9 1885.2 2019.9 C
118.2341 -1886.1 2022 1889.7 2019.5 1888.4 2022.8 C
118.2342 -1889 2023.3 1889.8 2024.4 1890.3 2024 C
118.2343 -1891.2 2023.5 1891.8 2028.2 1893.4 2026.6 C
118.2344 -1894.2 2026.3 1893.9 2027.3 1894.4 2027.6 C
118.2345 -1893.4 2027.6 1894.7 2028.3 1894.1 2028.5 C
118.2346 -1894.4 2029.6 1896 2030 1896 2029.2 C
118.2347 -1896.2 2029 1896.3 2029 1896.5 2029.2 C
118.2348 -1896.8 2029.8 1897.3 2030 1897 2030.7 C
118.2349 -1896.5 2030.7 1896.9 2031.5 1897.2 2031.6 C
118.2350 -1898.3 2034 1899.5 2030.6 1899.6 2033.3 C
118.2351 -1898.5 2033 1899.6 2034.4 1900.1 2034.8 C
118.2352 -1901.3 2035.8 1903.2 2034.6 1902.5 2036.7 C
118.2353 -1904.4 2036.9 1906.1 2032.2 1907.6 2035.5 C
118.2354 -1907.5 2040.1 1907.7 2044.9 1907.3 2049.4 C
118.2355 -1908 2050.2 1908.3 2051.4 1909.5 2051.6 C
118.2356 -1910.1 2051.1 1911.6 2051.1 1911.4 2052.3 C
118.2357 -1909.7 2052.8 1912.4 2054 1912.6 2054.7 C
118.2358 -1913.4 2055.2 1913 2053.7 1913.6 2054.4 C
118.2359 -1913.6 2054.5 1913.6 2055.3 1913.6 2054.7 C
118.2360 -1913.7 2054.4 1913.9 2054.4 1914 2054.7 C
118.2361 -1914 2054.9 1914.1 2055.3 1913.8 2055.4 C
118.2362 -1913.7 2056 1915.2 2057.6 1916 2057.6 C
118.2363 -1915.9 2057.3 1916.1 2057.2 1916.2 2057.1 C
118.2364 -1917 2056.8 1916.7 2057.7 1917.2 2058 C
118.2365 -1917 2058.3 1916.7 2058.3 1916.4 2058.3 C
118.2366 -1917.1 2059 1917.3 2060.1 1918.4 2060.4 C
118.2367 -1918.1 2059.2 1919.1 2060.6 1919.1 2059.5 C
118.2368 -1919 2060.6 1920.6 2060.1 1919.8 2061.2 C
118.2369 -1919.6 2061.2 1919.3 2061.2 1919.1 2061.2 C
118.2370 -1919.6 2061.9 1921.4 2064.2 1921.5 2062.6 C
118.2371 -1922.4 2062.1 1921.6 2063.9 1922.2 2064.3 C
118.2372 -1922.9 2067.3 1926.1 2064.3 1925.6 2067.2 C
118.2373 -1927.2 2066.8 1928.4 2064.6 1930.1 2065.2 C
118.2374 -1931.8 2067.8 1931 2071.8 1930.8 2074.8 C
118.2375 -1930.6 2076.4 1930.1 2078.6 1930.6 2080.4 C
118.2376 -1936.6 2085.4 1941.8 2091.6 1948.1 2096.9 C
118.2377 -1950.7 2096.7 1952.6 2094.8 1954.8 2093.8 C
118.2378 -[0 0.33 0.33 0.99]  vc
118.2379 -f 
118.2380 -S 
118.2381 -n
118.2382 -1989.4 2080.6 m
118.2383 -1996.1 2077.3 2002.7 2073.8 2009.6 2070.8 C
118.2384 -2009.6 2069.6 2010.2 2067.7 2009.3 2067.4 C
118.2385 -2008.9 2062 2009.1 2056.4 2009.1 2050.8 C
118.2386 -2012.3 2046.6 2019 2046.6 2023.5 2043.2 C
118.2387 -2024 2042.3 2025.1 2042.1 2025.4 2041.2 C
118.2388 -2025.3 2032.7 2025.6 2023.1 2025.2 2014.6 C
118.2389 -2025 2015.3 2024.6 2014.2 2024.7 2014.8 C
118.2390 -2024.5 2024.7 2025.1 2030.9 2024.2 2041 C
118.2391 -2020.4 2044.8 2014.3 2044.2 2010.5 2048 C
118.2392 -2009 2048.4 2009.8 2046.7 2009.1 2046.3 C
118.2393 -2008.5 2044.8 2010.2 2044.6 2009.6 2043.4 C
118.2394 -2009.1 2043.9 2009.2 2042.1 2008.1 2042.7 C
118.2395 -2006.5 2046.1 2009.3 2048.9 2007.6 2052.3 C
118.2396 -2007.7 2058 2007.5 2063.8 2007.9 2069.3 C
118.2397 -2002.3 2072.4 1996.5 2074.8 1990.8 2077.5 C
118.2398 -1988.4 2079.2 1985.6 2079.8 1983.2 2081.6 C
118.2399 -1980.5 2079 1977.9 2076.5 1975.5 2074.1 C
118.2400 -1975.5 2075.1 1975.5 2076.2 1975.5 2077.2 C
118.2401 -1977.8 2079.3 1980.3 2081.6 1982.7 2083.7 C
118.2402 -1985.3 2083.5 1987.1 2081.6 1989.4 2080.6 C
118.2403 -f 
118.2404 -S 
118.2405 -n
118.2406 -1930.1 2079.9 m
118.2407 -1931.1 2075.6 1929.2 2071.1 1930.8 2067.2 C
118.2408 -1930.3 2066.3 1930.1 2064.6 1928.7 2065.5 C
118.2409 -1927.7 2066.4 1926.5 2067 1925.3 2067.4 C
118.2410 -1924.5 2066.9 1925.6 2065.7 1924.4 2066 C
118.2411 -1924.2 2067.2 1923.6 2065.5 1923.2 2065.7 C
118.2412 -1922.3 2063.6 1917.8 2062.1 1919.6 2060.4 C
118.2413 -1919.3 2060.5 1919.2 2060.3 1919.1 2060.2 C
118.2414 -1919.7 2060.9 1918.2 2061 1917.6 2060.2 C
118.2415 -1917 2059.6 1916.1 2058.8 1916.4 2058 C
118.2416 -1915.5 2058 1917.4 2057.1 1915.7 2057.8 C
118.2417 -1914.8 2057.1 1913.4 2056.2 1913.3 2054.9 C
118.2418 -1913.1 2055.4 1911.3 2054.3 1910.9 2053.2 C
118.2419 -1910.7 2052.9 1910.2 2052.5 1910.7 2052.3 C
118.2420 -1911.1 2052.5 1910.9 2052 1910.9 2051.8 C
118.2421 -1910.5 2051.2 1909.9 2052.6 1909.2 2051.8 C
118.2422 -1908.2 2051.4 1907.8 2050.2 1907.1 2049.4 C
118.2423 -1907.5 2044.8 1907.3 2040 1907.3 2035.2 C
118.2424 -1905.3 2033 1902.8 2039.3 1902.3 2035.7 C
118.2425 -1899.6 2036 1898.4 2032.5 1896.3 2030.7 C
118.2426 -1895.7 2030.1 1897.5 2030 1896.3 2029.7 C
118.2427 -1896.3 2030.6 1895 2029.7 1894.4 2029.2 C
118.2428 -1892.9 2028.1 1894.2 2027.4 1893.6 2027.1 C
118.2429 -1892.1 2027.9 1891.7 2025.6 1890.8 2024.9 C
118.2430 -1891.1 2024.6 1889.1 2024.3 1888.4 2023 C
118.2431 -1887.5 2022.6 1888.2 2021.9 1888.1 2021.3 C
118.2432 -1886.7 2022 1885.2 2020.4 1884.8 2019.2 C
118.2433 -1884.8 2010 1884.6 2000.2 1885 1991.8 C
118.2434 -1886.9 1989.6 1889.9 1989.3 1892.2 1987.5 C
118.2435 -1898.3 1982.7 1905.6 1980.1 1912.8 1978.6 C
118.2436 -1921 1974.2 1928.8 1968.9 1937.8 1966.6 C
118.2437 -1939.8 1968.3 1938.8 1968.3 1940.4 1970 C
118.2438 -1945.4 1972.5 1947.6 1981.5 1954.6 1979.3 C
118.2439 -1952.3 1981 1950.4 1978.4 1948.6 1977.9 C
118.2440 -1945.1 1973.9 1941.1 1970.6 1938 1966.6 C
118.2441 -1928.4 1968.5 1920.6 1974.8 1911.9 1978.8 C
118.2442 -1907.1 1979.2 1902.6 1981.7 1898.2 1983.6 C
118.2443 -1893.9 1986 1889.9 1989 1885.5 1990.8 C
118.2444 -1884.9 1991.2 1884.8 1991.8 1884.5 1992.3 C
118.2445 -1884.9 2001.3 1884.7 2011.1 1884.8 2019.6 C
118.2446 -1890.6 2025 1896.5 2031.2 1902.3 2036.9 C
118.2447 -1904.6 2037.6 1905 2033 1907.3 2035.5 C
118.2448 -1907.2 2040.2 1907 2044.8 1907.1 2049.6 C
118.2449 -1913.6 2055.3 1918.4 2061.5 1925.1 2067.4 C
118.2450 -1927.3 2068.2 1929.6 2062.5 1930.6 2066.9 C
118.2451 -1929.7 2070.7 1930.3 2076 1930.1 2080.1 C
118.2452 -1935.6 2085.7 1941.9 2090.7 1947.2 2096.7 C
118.2453 -1942.2 2091.1 1935.5 2085.2 1930.1 2079.9 C
118.2454 -[0.18 0.18 0 0.78]  vc
118.2455 -f 
118.2456 -S 
118.2457 -n
118.2458 -1930.8 2061.9 m
118.2459 -1930.3 2057.8 1931.8 2053.4 1931.1 2050.4 C
118.2460 -1931.3 2050.3 1931.7 2050.5 1931.6 2050.1 C
118.2461 -1933 2051.1 1934.4 2049.5 1935.9 2048.7 C
118.2462 -1937 2046.5 1939.5 2047.1 1941.2 2045.1 C
118.2463 -1939.7 2042.6 1937.3 2041.2 1935.4 2039.3 C
118.2464 -1934 2039.7 1934.5 2038.1 1933.7 2037.6 C
118.2465 -1934 2033.3 1933.1 2027.9 1934.4 2024.4 C
118.2466 -1934.3 2023.8 1933.9 2022.8 1933 2022.8 C
118.2467 -1931.6 2023.1 1930.5 2024.4 1929.2 2024.9 C
118.2468 -1928.4 2024.5 1929.8 2023.5 1928.7 2023.5 C
118.2469 -1927.7 2024.1 1926.2 2022.6 1925.6 2021.6 C
118.2470 -1926.9 2021.6 1924.8 2020.6 1925.6 2020.4 C
118.2471 -1924.7 2021.7 1923.9 2019.6 1923.2 2019.2 C
118.2472 -1923.3 2018.3 1923.8 2018.1 1923.2 2018 C
118.2473 -1922.9 2017.8 1922.9 2017.5 1922.9 2017.2 C
118.2474 -1922.8 2018.3 1921.3 2017.3 1920.3 2018 C
118.2475 -1916.6 2019.7 1913 2022.1 1910 2024.7 C
118.2476 -1910 2032.9 1910 2041.2 1910 2049.4 C
118.2477 -1915.4 2055.2 1920 2058.7 1925.3 2064.8 C
118.2478 -1927.2 2064 1929 2061.4 1930.8 2061.9 C
118.2479 -[0 0 0 0]  vc
118.2480 -f 
118.2481 -S 
118.2482 -n
118.2483 -1907.6 2030.4 m
118.2484 -1907.5 2027.1 1906.4 2021.7 1908.5 2019.9 C
118.2485 -1908.8 2020.1 1908.9 2019 1909.2 2019.6 C
118.2486 -1910 2019.6 1912 2019.2 1913.1 2018.2 C
118.2487 -1913.7 2016.5 1920.2 2015.7 1917.4 2012.7 C
118.2488 -1918.2 2011.2 1917 2013.8 1917.2 2012 C
118.2489 -1916.9 2012.3 1916 2012.4 1915.2 2012 C
118.2490 -1912.5 2010.5 1916.6 2008.8 1913.6 2009.6 C
118.2491 -1912.6 2009.2 1911.1 2009 1910.9 2007.6 C
118.2492 -1911 1999.2 1911.8 1989.8 1911.2 1982.2 C
118.2493 -1910.1 1981.1 1908.8 1982.2 1907.6 1982.2 C
118.2494 -1900.8 1986.5 1893.2 1988.8 1887.2 1994.2 C
118.2495 -1887.2 2002.4 1887.2 2010.7 1887.2 2018.9 C
118.2496 -1892.6 2024.7 1897.2 2028.2 1902.5 2034.3 C
118.2497 -1904.3 2033.3 1906.2 2032.1 1907.6 2030.4 C
118.2498 -f 
118.2499 -S 
118.2500 -n
118.2501 -1910.7 2025.4 m
118.2502 -1912.7 2022.4 1916.7 2020.8 1919.8 2018.9 C
118.2503 -1920.2 2018.7 1920.6 2018.6 1921 2018.4 C
118.2504 -1925 2020 1927.4 2028.5 1932 2024.2 C
118.2505 -1932.3 2025 1932.5 2023.7 1932.8 2024.4 C
118.2506 -1932.8 2028 1932.8 2031.5 1932.8 2035 C
118.2507 -1931.9 2033.9 1932.5 2036.3 1932.3 2036.9 C
118.2508 -1933.2 2036.4 1932.5 2038.5 1933 2038.4 C
118.2509 -1933.1 2040.5 1935.6 2042.2 1936.6 2043.2 C
118.2510 -1936.2 2042.4 1935.1 2040.8 1933.7 2040.3 C
118.2511 -1932.2 2034.4 1933.8 2029.8 1933 2023.2 C
118.2512 -1931.1 2024.9 1928.4 2026.4 1926.5 2023.5 C
118.2513 -1925.1 2021.6 1923 2019.8 1921.5 2018.2 C
118.2514 -1917.8 2018.9 1915.2 2022.5 1911.6 2023.5 C
118.2515 -1910.8 2023.8 1911.2 2024.7 1910.4 2025.2 C
118.2516 -1910.9 2031.8 1910.6 2039.1 1910.7 2045.6 C
118.2517 -1910.1 2048 1910.7 2045.9 1911.2 2044.8 C
118.2518 -1910.6 2038.5 1911.2 2031.8 1910.7 2025.4 C
118.2519 -[0.07 0.06 0 0.58]  vc
118.2520 -f 
118.2521 -S 
118.2522 -n
118.2523 -1910.7 2048.9 m
118.2524 -1910.3 2047.4 1911.3 2046.5 1911.6 2045.3 C
118.2525 -1912.9 2045.3 1913.9 2047.1 1915.2 2045.8 C
118.2526 -1915.2 2044.9 1916.6 2043.3 1917.2 2042.9 C
118.2527 -1918.7 2042.9 1919.4 2044.4 1920.5 2043.2 C
118.2528 -1921.2 2042.2 1921.4 2040.9 1922.4 2040.3 C
118.2529 -1924.5 2040.3 1925.7 2040.9 1926.8 2039.6 C
118.2530 -1927.1 2037.9 1926.8 2038.1 1927.7 2037.6 C
118.2531 -1929 2037.5 1930.4 2037 1931.6 2037.2 C
118.2532 -1932.3 2038.2 1933.1 2038.7 1932.8 2040.3 C
118.2533 -1935 2041.8 1935.9 2043.8 1938.5 2044.8 C
118.2534 -1938.6 2045 1938.3 2045.5 1938.8 2045.3 C
118.2535 -1939.1 2042.9 1935.4 2044.2 1935.4 2042.2 C
118.2536 -1932.1 2040.8 1932.8 2037.2 1932 2034.8 C
118.2537 -1932.3 2034 1932.7 2035.4 1932.5 2034.8 C
118.2538 -1931.3 2031.8 1935.5 2020.1 1928.9 2025.9 C
118.2539 -1924.6 2024.7 1922.6 2014.5 1917.4 2020.4 C
118.2540 -1915.5 2022.8 1912 2022.6 1910.9 2025.4 C
118.2541 -1911.5 2031.9 1910.9 2038.8 1911.4 2045.3 C
118.2542 -1911.1 2046.5 1910 2047.4 1910.4 2048.9 C
118.2543 -1915.1 2054.4 1920.4 2058.3 1925.1 2063.8 C
118.2544 -1920.8 2058.6 1914.9 2054.3 1910.7 2048.9 C
118.2545 -[0.4 0.4 0 0]  vc
118.2546 -f 
118.2547 -S 
118.2548 -n
118.2549 -1934.7 2031.9 m
118.2550 -1934.6 2030.7 1934.9 2029.5 1934.4 2028.5 C
118.2551 -1934 2029.5 1934.3 2031.2 1934.2 2032.6 C
118.2552 -1933.8 2031.7 1934.9 2031.6 1934.7 2031.9 C
118.2553 -[0.92 0.92 0 0.67]  vc
118.2554 -f 
118.2555 -S 
118.2556 -n
118.2557 -vmrs
118.2558 -1934.7 2019.4 m
118.2559 -1934.1 2015.3 1935.6 2010.9 1934.9 2007.9 C
118.2560 -1935.1 2007.8 1935.6 2008.1 1935.4 2007.6 C
118.2561 -1936.8 2008.6 1938.2 2007 1939.7 2006.2 C
118.2562 -1940.1 2004.3 1942.7 2005 1943.6 2003.8 C
118.2563 -1945.1 2000.3 1954 2000.8 1950 1996.6 C
118.2564 -1952.1 1993.3 1948.2 1989.2 1951.2 1985.6 C
118.2565 -1953 1981.4 1948.4 1982.3 1947.9 1979.8 C
118.2566 -1945.4 1979.6 1945.1 1975.5 1942.4 1975 C
118.2567 -1942.4 1972.3 1938 1973.6 1938.5 1970.4 C
118.2568 -1937.4 1969 1935.6 1970.1 1934.2 1970.2 C
118.2569 -1927.5 1974.5 1919.8 1976.8 1913.8 1982.2 C
118.2570 -1913.8 1990.4 1913.8 1998.7 1913.8 2006.9 C
118.2571 -1919.3 2012.7 1923.8 2016.2 1929.2 2022.3 C
118.2572 -1931.1 2021.6 1932.8 2018.9 1934.7 2019.4 C
118.2573 -[0 0 0 0]  vc
118.2574 -f 
118.2575 -0.4 w
118.2576 -2 J
118.2577 -2 M
118.2578 -S 
118.2579 -n
118.2580 -2024.2 2038.1 m
118.2581 -2024.1 2029.3 2024.4 2021.7 2024.7 2014.4 C
118.2582 -2024.4 2013.6 2020.6 2013.4 2021.3 2011.2 C
118.2583 -2020.5 2010.3 2018.4 2010.6 2018.9 2008.6 C
118.2584 -2019 2008.8 2018.8 2009 2018.7 2009.1 C
118.2585 -2018.2 2006.7 2015.2 2007.9 2015.3 2005.5 C
118.2586 -2014.7 2004.8 2012.4 2005.1 2013.2 2003.6 C
118.2587 -2012.3 2004.2 2012.8 2002.4 2012.7 2002.6 C
118.2588 -2009.4 2003.3 2011.2 1998.6 2008.4 1999.2 C
118.2589 -2007 1999.1 2006.1 1999.4 2005.7 2000.4 C
118.2590 -2006.9 1998.5 2007.7 2000.5 2009.3 2000.2 C
118.2591 -2009.2 2003.7 2012.4 2002.1 2012.9 2005.2 C
118.2592 -2015.9 2005.6 2015.2 2008.6 2017.7 2008.8 C
118.2593 -2018.4 2009.6 2018.3 2011.4 2019.6 2011 C
118.2594 -2021.1 2011.7 2021.4 2014.8 2023.7 2015.1 C
118.2595 -2023.7 2023.5 2023.9 2031.6 2023.5 2040.5 C
118.2596 -2021.8 2041.7 2020.7 2043.6 2018.4 2043.9 C
118.2597 -2020.8 2042.7 2025.5 2041.8 2024.2 2038.1 C
118.2598 -[0 0.87 0.91 0.83]  vc
118.2599 -f 
118.2600 -S 
118.2601 -n
118.2602 -2023.5 2040 m
118.2603 -2023.5 2031.1 2023.5 2023.4 2023.5 2015.1 C
118.2604 -2020.2 2015 2021.8 2010.3 2018.4 2011 C
118.2605 -2018.6 2007.5 2014.7 2009.3 2014.8 2006.4 C
118.2606 -2011.8 2006.3 2012.2 2002.3 2009.8 2002.4 C
118.2607 -2009.7 2001.5 2009.2 2000.1 2008.4 2000.2 C
118.2608 -2008.7 2000.9 2009.7 2001.2 2009.3 2002.4 C
118.2609 -2008.4 2004.2 2007.5 2003.1 2007.9 2005.5 C
118.2610 -2007.9 2010.8 2007.7 2018.7 2008.1 2023.2 C
118.2611 -2009 2024.3 2007.3 2023.4 2007.9 2024 C
118.2612 -2007.7 2024.6 2007.3 2026.3 2008.6 2027.1 C
118.2613 -2009.7 2026.8 2010 2027.6 2010.5 2028 C
118.2614 -2010.5 2028.2 2010.5 2029.1 2010.5 2028.5 C
118.2615 -2011.5 2028 2010.5 2030 2011.5 2030 C
118.2616 -2014.2 2029.7 2012.9 2032.2 2014.8 2032.6 C
118.2617 -2015.1 2033.6 2015.3 2033 2016 2033.3 C
118.2618 -2017 2033.9 2016.6 2035.4 2017.2 2036.2 C
118.2619 -2018.7 2036.4 2019.2 2039 2021.3 2038.4 C
118.2620 -2021.6 2035.4 2019.7 2029.5 2021.1 2027.3 C
118.2621 -2020.9 2023.5 2021.5 2018.5 2020.6 2016 C
118.2622 -2020.9 2013.9 2021.5 2015.4 2022.3 2014.4 C
118.2623 -2022.2 2015.1 2023.3 2014.8 2023.2 2015.6 C
118.2624 -2022.7 2019.8 2023.3 2024.3 2022.8 2028.5 C
118.2625 -2022.3 2028.2 2022.6 2027.6 2022.5 2027.1 C
118.2626 -2022.5 2027.8 2022.5 2029.2 2022.5 2029.2 C
118.2627 -2022.6 2029.2 2022.7 2029.1 2022.8 2029 C
118.2628 -2023.9 2032.8 2022.6 2037 2023 2040.8 C
118.2629 -2022.3 2041.2 2021.6 2041.5 2021.1 2042.2 C
118.2630 -2022 2041.2 2022.9 2041.4 2023.5 2040 C
118.2631 -[0 1 1 0.23]  vc
118.2632 -f 
118.2633 -S 
118.2634 -n
118.2635 -2009.1 1997.8 m
118.2636 -2003.8 1997.7 2000.1 2002.4 1995.4 2003.1 C
118.2637 -1995 1999.5 1995.2 1995 1995.2 1992 C
118.2638 -1995.2 1995.8 1995 1999.7 1995.4 2003.3 C
118.2639 -2000.3 2002.2 2003.8 1997.9 2009.1 1997.8 C
118.2640 -2012.3 2001.2 2015.6 2004.8 2018.7 2008.1 C
118.2641 -2021.6 2011.2 2027.5 2013.9 2025.9 2019.9 C
118.2642 -2026.1 2017.9 2025.6 2016.2 2025.4 2014.4 C
118.2643 -2020.2 2008.4 2014 2003.6 2009.1 1997.8 C
118.2644 -[0.18 0.18 0 0.78]  vc
118.2645 -f 
118.2646 -S 
118.2647 -n
118.2648 -2009.3 1997.8 m
118.2649 -2008.7 1997.4 2007.9 1997.6 2007.2 1997.6 C
118.2650 -2007.9 1997.6 2008.9 1997.4 2009.6 1997.8 C
118.2651 -2014.7 2003.6 2020.8 2008.8 2025.9 2014.8 C
118.2652 -2025.8 2017.7 2026.1 2014.8 2025.6 2014.1 C
118.2653 -2020.4 2008.8 2014.8 2003.3 2009.3 1997.8 C
118.2654 -[0.07 0.06 0 0.58]  vc
118.2655 -f 
118.2656 -S 
118.2657 -n
118.2658 -2009.6 1997.6 m
118.2659 -2009 1997.1 2008.1 1997.4 2007.4 1997.3 C
118.2660 -2008.1 1997.4 2009 1997.1 2009.6 1997.6 C
118.2661 -2014.8 2003.7 2021.1 2008.3 2025.9 2014.4 C
118.2662 -2021.1 2008.3 2014.7 2003.5 2009.6 1997.6 C
118.2663 -[0.4 0.4 0 0]  vc
118.2664 -f 
118.2665 -S 
118.2666 -n
118.2667 -2021.8 2011.5 m
118.2668 -2021.9 2012.2 2022.3 2013.5 2023.7 2013.6 C
118.2669 -2023.4 2012.7 2022.8 2011.8 2021.8 2011.5 C
118.2670 -[0 0.33 0.33 0.99]  vc
118.2671 -f 
118.2672 -S 
118.2673 -n
118.2674 -2021.1 2042 m
118.2675 -2022.1 2041.1 2020.9 2040.2 2020.6 2039.6 C
118.2676 -2018.4 2039.5 2018.1 2036.9 2016.3 2036.4 C
118.2677 -2015.8 2035.5 2015.3 2033.8 2014.8 2033.6 C
118.2678 -2012.4 2033.8 2013 2030.4 2010.5 2030.2 C
118.2679 -2009.6 2028.9 2009.6 2028.3 2008.4 2028 C
118.2680 -2006.9 2026.7 2007.5 2024.3 2006 2023.2 C
118.2681 -2006.6 2023.2 2005.7 2023.3 2005.7 2023 C
118.2682 -2006.4 2022.5 2006.3 2021.1 2006.7 2020.6 C
118.2683 -2006.6 2015 2006.9 2009 2006.4 2003.8 C
118.2684 -2006.9 2002.5 2007.6 2001.1 2006.9 2000.7 C
118.2685 -2004.6 2003.6 2003 2002.9 2000.2 2004.3 C
118.2686 -1999.3 2005.8 1997.9 2006.3 1996.1 2006.7 C
118.2687 -1995.7 2008.9 1996 2011.1 1995.9 2012.9 C
118.2688 -1993.4 2015.1 1990.5 2016.2 1987.7 2017.7 C
118.2689 -1987.1 2019.3 1991.1 2019.4 1990.4 2021.3 C
118.2690 -1990.5 2021.5 1991.9 2022.3 1992 2023 C
118.2691 -1994.8 2024.4 1996.2 2027.5 1998.5 2030 C
118.2692 -2002.4 2033 2005.2 2037.2 2008.8 2041 C
118.2693 -2010.2 2041.3 2011.6 2042 2011 2043.9 C
118.2694 -2011.2 2044.8 2010.1 2045.3 2010.5 2046.3 C
118.2695 -2013.8 2044.8 2017.5 2043.4 2021.1 2042 C
118.2696 -[0 0.5 0.5 0.2]  vc
118.2697 -f 
118.2698 -S 
118.2699 -n
118.2700 -2019.4 2008.8 m
118.2701 -2018.9 2009.2 2019.3 2009.9 2019.6 2010.3 C
118.2702 -2022.2 2011.5 2020.3 2009.1 2019.4 2008.8 C
118.2703 -[0 0.33 0.33 0.99]  vc
118.2704 -f 
118.2705 -S 
118.2706 -n
118.2707 -2018 2007.4 m
118.2708 -2015.7 2006.7 2015.3 2003.6 2012.9 2002.8 C
118.2709 -2013.5 2003.7 2013.5 2005.1 2015.6 2005.2 C
118.2710 -2016.4 2006.1 2015.7 2007.7 2018 2007.4 C
118.2711 -f 
118.2712 -S 
118.2713 -n
118.2714 -vmrs
118.2715 -1993.5 2008.8 m
118.2716 -1993.4 2000 1993.7 1992.5 1994 1985.1 C
118.2717 -1993.7 1984.3 1989.9 1984.1 1990.6 1982 C
118.2718 -1989.8 1981.1 1987.7 1981.4 1988.2 1979.3 C
118.2719 -1988.3 1979.6 1988.1 1979.7 1988 1979.8 C
118.2720 -1987.5 1977.5 1984.5 1978.6 1984.6 1976.2 C
118.2721 -1983.9 1975.5 1981.7 1975.8 1982.4 1974.3 C
118.2722 -1981.6 1974.9 1982.1 1973.1 1982 1973.3 C
118.2723 -1979 1973.7 1980 1968.8 1976.9 1969.7 C
118.2724 -1975.9 1969.8 1975.3 1970.3 1975 1971.2 C
118.2725 -1976.2 1969.2 1977 1971.2 1978.6 1970.9 C
118.2726 -1978.5 1974.4 1981.7 1972.8 1982.2 1976 C
118.2727 -1985.2 1976.3 1984.5 1979.3 1987 1979.6 C
118.2728 -1987.7 1980.3 1987.5 1982.1 1988.9 1981.7 C
118.2729 -1990.4 1982.4 1990.7 1985.5 1993 1985.8 C
118.2730 -1992.9 1994.3 1993.2 2002.3 1992.8 2011.2 C
118.2731 -1991.1 2012.4 1990 2014.4 1987.7 2014.6 C
118.2732 -1990.1 2013.4 1994.7 2012.6 1993.5 2008.8 C
118.2733 -[0 0.87 0.91 0.83]  vc
118.2734 -f 
118.2735 -0.4 w
118.2736 -2 J
118.2737 -2 M
118.2738 -S 
118.2739 -n
118.2740 -1992.8 2010.8 m
118.2741 -1992.8 2001.8 1992.8 1994.1 1992.8 1985.8 C
118.2742 -1989.5 1985.7 1991.1 1981.1 1987.7 1981.7 C
118.2743 -1987.9 1978.2 1983.9 1980 1984.1 1977.2 C
118.2744 -1981.1 1977 1981.5 1973 1979.1 1973.1 C
118.2745 -1979 1972.2 1978.5 1970.9 1977.6 1970.9 C
118.2746 -1977.9 1971.6 1979 1971.9 1978.6 1973.1 C
118.2747 -1977.6 1974.9 1976.8 1973.9 1977.2 1976.2 C
118.2748 -1977.2 1981.5 1977 1989.4 1977.4 1994 C
118.2749 -1978.3 1995 1976.6 1994.1 1977.2 1994.7 C
118.2750 -1977 1995.3 1976.6 1997 1977.9 1997.8 C
118.2751 -1979 1997.5 1979.3 1998.3 1979.8 1998.8 C
118.2752 -1979.8 1998.9 1979.8 1999.8 1979.8 1999.2 C
118.2753 -1980.8 1998.7 1979.7 2000.7 1980.8 2000.7 C
118.2754 -1983.5 2000.4 1982.1 2003 1984.1 2003.3 C
118.2755 -1984.4 2004.3 1984.5 2003.7 1985.3 2004 C
118.2756 -1986.3 2004.6 1985.9 2006.1 1986.5 2006.9 C
118.2757 -1988 2007.1 1988.4 2009.7 1990.6 2009.1 C
118.2758 -1990.9 2006.1 1989 2000.2 1990.4 1998 C
118.2759 -1990.2 1994.3 1990.8 1989.2 1989.9 1986.8 C
118.2760 -1990.2 1984.7 1990.8 1986.2 1991.6 1985.1 C
118.2761 -1991.5 1985.9 1992.6 1985.5 1992.5 1986.3 C
118.2762 -1992 1990.5 1992.6 1995 1992 1999.2 C
118.2763 -1991.6 1998.9 1991.9 1998.3 1991.8 1997.8 C
118.2764 -1991.8 1998.5 1991.8 2000 1991.8 2000 C
118.2765 -1991.9 1999.9 1992 1999.8 1992 1999.7 C
118.2766 -1993.2 2003.5 1991.9 2007.7 1992.3 2011.5 C
118.2767 -1991.6 2012 1990.9 2012.2 1990.4 2012.9 C
118.2768 -1991.3 2011.9 1992.2 2012.1 1992.8 2010.8 C
118.2769 -[0 1 1 0.23]  vc
118.2770 -f 
118.2771 -S 
118.2772 -n
118.2773 -1978.4 1968.5 m
118.2774 -1977 1969.2 1975.8 1968.2 1974.5 1969 C
118.2775 -1968.3 1973 1961.6 1976 1955.1 1979.1 C
118.2776 -1962 1975.9 1968.8 1972.5 1975.5 1968.8 C
118.2777 -1976.5 1968.8 1977.6 1968.8 1978.6 1968.8 C
118.2778 -1981.7 1972.1 1984.8 1975.7 1988 1978.8 C
118.2779 -1990.9 1981.9 1996.8 1984.6 1995.2 1990.6 C
118.2780 -1995.3 1988.6 1994.9 1986.9 1994.7 1985.1 C
118.2781 -1989.5 1979.1 1983.3 1974.3 1978.4 1968.5 C
118.2782 -[0.18 0.18 0 0.78]  vc
118.2783 -f 
118.2784 -S 
118.2785 -n
118.2786 -1978.4 1968.3 m
118.2787 -1977.9 1968.7 1977.1 1968.5 1976.4 1968.5 C
118.2788 -1977.3 1968.8 1978.1 1967.9 1978.8 1968.5 C
118.2789 -1984 1974.3 1990.1 1979.5 1995.2 1985.6 C
118.2790 -1995.1 1988.4 1995.3 1985.6 1994.9 1984.8 C
118.2791 -1989.5 1979.4 1983.9 1973.8 1978.4 1968.3 C
118.2792 -[0.07 0.06 0 0.58]  vc
118.2793 -f 
118.2794 -S 
118.2795 -n
118.2796 -1978.6 1968 m
118.2797 -1977.9 1968 1977.4 1968.6 1978.4 1968 C
118.2798 -1983.9 1973.9 1990.1 1979.1 1995.2 1985.1 C
118.2799 -1990.2 1979 1983.8 1974.1 1978.6 1968 C
118.2800 -[0.4 0.4 0 0]  vc
118.2801 -f 
118.2802 -S 
118.2803 -n
118.2804 -1991.1 1982.2 m
118.2805 -1991.2 1982.9 1991.6 1984.2 1993 1984.4 C
118.2806 -1992.6 1983.5 1992.1 1982.5 1991.1 1982.2 C
118.2807 -[0 0.33 0.33 0.99]  vc
118.2808 -f 
118.2809 -S 
118.2810 -n
118.2811 -1990.4 2012.7 m
118.2812 -1991.4 2011.8 1990.2 2010.9 1989.9 2010.3 C
118.2813 -1987.7 2010.2 1987.4 2007.6 1985.6 2007.2 C
118.2814 -1985.1 2006.2 1984.6 2004.5 1984.1 2004.3 C
118.2815 -1981.7 2004.5 1982.3 2001.2 1979.8 2000.9 C
118.2816 -1978.8 1999.6 1978.8 1999.1 1977.6 1998.8 C
118.2817 -1976.1 1997.4 1976.7 1995 1975.2 1994 C
118.2818 -1975.8 1994 1975 1994 1975 1993.7 C
118.2819 -1975.7 1993.2 1975.6 1991.8 1976 1991.3 C
118.2820 -1975.9 1985.7 1976.1 1979.7 1975.7 1974.5 C
118.2821 -1976.2 1973.3 1976.9 1971.8 1976.2 1971.4 C
118.2822 -1973.9 1974.3 1972.2 1973.6 1969.5 1975 C
118.2823 -1967.9 1977.5 1963.8 1977.1 1961.8 1980 C
118.2824 -1959 1980 1957.6 1983 1954.8 1982.9 C
118.2825 -1953.8 1984.2 1954.8 1985.7 1955.1 1987.2 C
118.2826 -1956.2 1989.5 1959.7 1990.1 1959.9 1991.8 C
118.2827 -1965.9 1998 1971.8 2005.2 1978.1 2011.7 C
118.2828 -1979.5 2012 1980.9 2012.7 1980.3 2014.6 C
118.2829 -1980.5 2015.6 1979.4 2016 1979.8 2017 C
118.2830 -1983 2015.6 1986.8 2014.1 1990.4 2012.7 C
118.2831 -[0 0.5 0.5 0.2]  vc
118.2832 -f 
118.2833 -S 
118.2834 -n
118.2835 -1988.7 1979.6 m
118.2836 -1988.2 1979.9 1988.6 1980.6 1988.9 1981 C
118.2837 -1991.4 1982.2 1989.6 1979.9 1988.7 1979.6 C
118.2838 -[0 0.33 0.33 0.99]  vc
118.2839 -f 
118.2840 -S 
118.2841 -n
118.2842 -1987.2 1978.1 m
118.2843 -1985 1977.5 1984.6 1974.3 1982.2 1973.6 C
118.2844 -1982.7 1974.5 1982.8 1975.8 1984.8 1976 C
118.2845 -1985.7 1976.9 1985 1978.4 1987.2 1978.1 C
118.2846 -f 
118.2847 -S 
118.2848 -n
118.2849 -1975.5 2084 m
118.2850 -1975.5 2082 1975.3 2080 1975.7 2078.2 C
118.2851 -1978.8 2079 1980.9 2085.5 1984.8 2083.5 C
118.2852 -1993 2078.7 2001.6 2075 2010 2070.8 C
118.2853 -2010.1 2064 2009.9 2057.2 2010.3 2050.6 C
118.2854 -2014.8 2046.2 2020.9 2045.7 2025.6 2042 C
118.2855 -2026.1 2035.1 2025.8 2028 2025.9 2021.1 C
118.2856 -2025.8 2027.8 2026.1 2034.6 2025.6 2041.2 C
118.2857 -2022.2 2044.9 2017.6 2046.8 2012.9 2048 C
118.2858 -2012.5 2049.5 2010.4 2049.4 2009.8 2051.1 C
118.2859 -2009.9 2057.6 2009.6 2064.2 2010 2070.5 C
118.2860 -2001.2 2075.4 1992 2079.1 1983.2 2084 C
118.2861 -1980.3 2082.3 1977.8 2079.2 1975.2 2077.5 C
118.2862 -1974.9 2079.9 1977.2 2084.6 1973.3 2085.2 C
118.2863 -1964.7 2088.6 1956.8 2093.7 1948.1 2097.2 C
118.2864 -1949 2097.3 1949.6 2096.9 1950.3 2096.7 C
118.2865 -1958.4 2091.9 1967.1 2088.2 1975.5 2084 C
118.2866 -[0.18 0.18 0 0.78]  vc
118.2867 -f 
118.2868 -S 
118.2869 -n
118.2870 -vmrs
118.2871 -1948.6 2094.5 m
118.2872 -1950.2 2093.7 1951.8 2092.9 1953.4 2092.1 C
118.2873 -1951.8 2092.9 1950.2 2093.7 1948.6 2094.5 C
118.2874 -[0 0.87 0.91 0.83]  vc
118.2875 -f 
118.2876 -0.4 w
118.2877 -2 J
118.2878 -2 M
118.2879 -S 
118.2880 -n
118.2881 -1971.6 2082.3 m
118.2882 -1971.6 2081.9 1970.7 2081.1 1970.9 2081.3 C
118.2883 -1970.7 2081.6 1970.6 2081.6 1970.4 2081.3 C
118.2884 -1970.8 2080.1 1968.7 2081.7 1968.3 2080.8 C
118.2885 -1966.6 2080.9 1966.7 2078 1964.2 2078.2 C
118.2886 -1964.8 2075 1960.1 2075.8 1960.1 2072.9 C
118.2887 -1958 2072.3 1957.5 2069.3 1955.3 2069.3 C
118.2888 -1953.9 2070.9 1948.8 2067.8 1950 2072 C
118.2889 -1949 2074 1943.2 2070.6 1944 2074.8 C
118.2890 -1942.2 2076.6 1937.6 2073.9 1938 2078.2 C
118.2891 -1936.7 2078.6 1935 2078.6 1933.7 2078.2 C
118.2892 -1933.5 2080 1936.8 2080.7 1937.3 2082.8 C
118.2893 -1939.9 2083.5 1940.6 2086.4 1942.6 2088 C
118.2894 -1945.2 2089.2 1946 2091.3 1948.4 2093.6 C
118.2895 -1956 2089.5 1963.9 2086.1 1971.6 2082.3 C
118.2896 -[0 0.01 1 0]  vc
118.2897 -f 
118.2898 -S 
118.2899 -n
118.2900 -1958.2 2089.7 m
118.2901 -1956.4 2090 1955.6 2091.3 1953.9 2091.9 C
118.2902 -1955.6 2091.9 1956.5 2089.7 1958.2 2089.7 C
118.2903 -[0 0.87 0.91 0.83]  vc
118.2904 -f 
118.2905 -S 
118.2906 -n
118.2907 -1929.9 2080.4 m
118.2908 -1929.5 2077.3 1929.7 2073.9 1929.6 2070.8 C
118.2909 -1929.8 2074.1 1929.2 2077.8 1930.1 2080.8 C
118.2910 -1935.8 2085.9 1941.4 2091.3 1946.9 2096.9 C
118.2911 -1941.2 2091 1935.7 2086 1929.9 2080.4 C
118.2912 -[0.4 0.4 0 0]  vc
118.2913 -f 
118.2914 -S 
118.2915 -n
118.2916 -1930.1 2080.4 m
118.2917 -1935.8 2086 1941.5 2090.7 1946.9 2096.7 C
118.2918 -1941.5 2090.9 1935.7 2085.8 1930.1 2080.4 C
118.2919 -[0.07 0.06 0 0.58]  vc
118.2920 -f 
118.2921 -S 
118.2922 -n
118.2923 -1940.9 2087.1 m
118.2924 -1941.7 2088 1944.8 2090.6 1943.6 2089.2 C
118.2925 -1942.5 2089 1941.6 2087.7 1940.9 2087.1 C
118.2926 -[0 0.87 0.91 0.83]  vc
118.2927 -f 
118.2928 -S 
118.2929 -n
118.2930 -1972.8 2082.8 m
118.2931 -1973 2075.3 1972.4 2066.9 1973.3 2059.5 C
118.2932 -1972.5 2058.9 1972.8 2057.3 1973.1 2056.4 C
118.2933 -1974.8 2055.2 1973.4 2055.5 1972.4 2055.4 C
118.2934 -1970.1 2053.2 1967.9 2050.9 1965.6 2048.7 C
118.2935 -1960.9 2049.9 1956.9 2052.7 1952.4 2054.7 C
118.2936 -1949.3 2052.5 1946.3 2049.5 1943.6 2046.8 C
118.2937 -1939.9 2047.7 1936.8 2050.1 1933.5 2051.8 C
118.2938 -1930.9 2054.9 1933.5 2056.2 1932.3 2059.7 C
118.2939 -1933.2 2059.7 1932.2 2060.5 1932.5 2060.2 C
118.2940 -1933.2 2062.5 1931.6 2064.6 1932.5 2067.4 C
118.2941 -1932.9 2069.7 1932.7 2072.2 1932.8 2074.6 C
118.2942 -1933.6 2070.6 1932.2 2066.3 1933 2062.6 C
118.2943 -1934.4 2058.2 1929.8 2053.5 1935.2 2051.1 C
118.2944 -1937.7 2049.7 1940.2 2048 1942.8 2046.8 C
118.2945 -1945.9 2049.2 1948.8 2052 1951.7 2054.7 C
118.2946 -1952.7 2054.7 1953.6 2054.6 1954.4 2054.2 C
118.2947 -1958.1 2052.5 1961.7 2049.3 1965.9 2049.2 C
118.2948 -1968.2 2052.8 1975.2 2055 1972.6 2060.9 C
118.2949 -1973.3 2062.4 1972.2 2065.2 1972.6 2067.6 C
118.2950 -1972.7 2072.6 1972.4 2077.7 1972.8 2082.5 C
118.2951 -1968.1 2084.9 1963.5 2087.5 1958.7 2089.5 C
118.2952 -1963.5 2087.4 1968.2 2085 1972.8 2082.8 C
118.2953 -f 
118.2954 -S 
118.2955 -n
118.2956 -1935.2 2081.1 m
118.2957 -1936.8 2083.4 1938.6 2084.6 1940.4 2086.6 C
118.2958 -1938.8 2084.4 1936.7 2083.4 1935.2 2081.1 C
118.2959 -f 
118.2960 -S 
118.2961 -n
118.2962 -1983.2 2081.3 m
118.2963 -1984.8 2080.5 1986.3 2079.7 1988 2078.9 C
118.2964 -1986.3 2079.7 1984.8 2080.5 1983.2 2081.3 C
118.2965 -f 
118.2966 -S 
118.2967 -n
118.2968 -2006.2 2069.1 m
118.2969 -2006.2 2068.7 2005.2 2067.9 2005.5 2068.1 C
118.2970 -2005.3 2068.4 2005.2 2068.4 2005 2068.1 C
118.2971 -2005.4 2066.9 2003.3 2068.5 2002.8 2067.6 C
118.2972 -2001.2 2067.7 2001.2 2064.8 1998.8 2065 C
118.2973 -1999.4 2061.8 1994.7 2062.6 1994.7 2059.7 C
118.2974 -1992.4 2059.5 1992.4 2055.8 1990.1 2056.8 C
118.2975 -1985.9 2059.5 1981.1 2061 1976.9 2063.8 C
118.2976 -1977.2 2067.6 1974.9 2074.2 1978.8 2075.8 C
118.2977 -1979.6 2077.8 1981.7 2078.4 1982.9 2080.4 C
118.2978 -1990.6 2076.3 1998.5 2072.9 2006.2 2069.1 C
118.2979 -[0 0.01 1 0]  vc
118.2980 -f 
118.2981 -S 
118.2982 -n
118.2983 -vmrs
118.2984 -1992.8 2076.5 m
118.2985 -1991 2076.8 1990.2 2078.1 1988.4 2078.7 C
118.2986 -1990.2 2078.7 1991 2076.5 1992.8 2076.5 C
118.2987 -[0 0.87 0.91 0.83]  vc
118.2988 -f 
118.2989 -0.4 w
118.2990 -2 J
118.2991 -2 M
118.2992 -S 
118.2993 -n
118.2994 -1975.5 2073.4 m
118.2995 -1976.1 2069.7 1973.9 2064.6 1977.4 2062.4 C
118.2996 -1973.9 2064.5 1976.1 2069.9 1975.5 2073.6 C
118.2997 -1976 2074.8 1979.3 2077.4 1978.1 2076 C
118.2998 -1977 2075.7 1975.8 2074.5 1975.5 2073.4 C
118.2999 -f 
118.3000 -S 
118.3001 -n
118.3002 -2007.4 2069.6 m
118.3003 -2007.6 2062.1 2007 2053.7 2007.9 2046.3 C
118.3004 -2007.1 2045.7 2007.3 2044.1 2007.6 2043.2 C
118.3005 -2009.4 2042 2007.9 2042.3 2006.9 2042.2 C
118.3006 -2002.2 2037.4 1996.7 2032.4 1992.5 2027.3 C
118.3007 -1992 2027.3 1991.6 2027.3 1991.1 2027.3 C
118.3008 -1991.4 2035.6 1991.4 2045.6 1991.1 2054.4 C
118.3009 -1990.5 2055.5 1988.4 2056.6 1990.6 2055.4 C
118.3010 -1991.6 2055.4 1991.6 2054.1 1991.6 2053.2 C
118.3011 -1990.8 2044.7 1991.9 2035.4 1991.6 2027.6 C
118.3012 -1991.8 2027.6 1992 2027.6 1992.3 2027.6 C
118.3013 -1997 2032.8 2002.5 2037.7 2007.2 2042.9 C
118.3014 -2007.3 2044.8 2006.7 2047.4 2007.6 2048.4 C
118.3015 -2006.9 2055.1 2007.1 2062.5 2007.4 2069.3 C
118.3016 -2002.7 2071.7 1998.1 2074.3 1993.2 2076.3 C
118.3017 -1998 2074.2 2002.7 2071.8 2007.4 2069.6 C
118.3018 -f 
118.3019 -S 
118.3020 -n
118.3021 -2006.7 2069.1 m
118.3022 -2006.3 2068.6 2005.9 2067.7 2005.7 2066.9 C
118.3023 -2005.7 2059.7 2005.9 2051.4 2005.5 2045.1 C
118.3024 -2004.9 2045.3 2004.7 2044.5 2004.3 2045.3 C
118.3025 -2005.1 2045.3 2004.2 2045.8 2004.8 2046 C
118.3026 -2004.8 2052.2 2004.8 2059.2 2004.8 2064.5 C
118.3027 -2005.7 2065.7 2005.1 2065.7 2005 2066.7 C
118.3028 -2003.8 2067 2002.7 2067.2 2001.9 2066.4 C
118.3029 -2001.3 2064.6 1998 2063.1 1998 2061.9 C
118.3030 -1996.1 2062.3 1996.6 2058.3 1994.2 2058.8 C
118.3031 -1992.6 2057.7 1992.7 2054.8 1989.9 2056.6 C
118.3032 -1985.6 2059.3 1980.9 2060.8 1976.7 2063.6 C
118.3033 -1976 2066.9 1976 2071.2 1976.7 2074.6 C
118.3034 -1977.6 2070.8 1973.1 2062.1 1980.5 2061.2 C
118.3035 -1984.3 2060.3 1987.5 2058.2 1990.8 2056.4 C
118.3036 -1991.7 2056.8 1992.9 2057.2 1993.5 2059.2 C
118.3037 -1994.3 2058.6 1994.4 2060.6 1994.7 2059.2 C
118.3038 -1995.3 2062.7 1999.2 2061.4 1998.8 2064.8 C
118.3039 -2001.8 2065.4 2002.5 2068.4 2005.2 2067.4 C
118.3040 -2004.9 2067.9 2006 2068 2006.4 2069.1 C
118.3041 -2001.8 2071.1 1997.4 2073.9 1992.8 2075.8 C
118.3042 -1997.5 2073.8 2002 2071.2 2006.7 2069.1 C
118.3043 -[0 0.2 1 0]  vc
118.3044 -f 
118.3045 -S 
118.3046 -n
118.3047 -1988.7 2056.6 m
118.3048 -1985.1 2058.7 1981.1 2060.1 1977.6 2061.9 C
118.3049 -1981.3 2060.5 1985.6 2058.1 1988.7 2056.6 C
118.3050 -[0 0.87 0.91 0.83]  vc
118.3051 -f 
118.3052 -S 
118.3053 -n
118.3054 -1977.9 2059.5 m
118.3055 -1975.7 2064.5 1973.7 2054.7 1975.2 2060.9 C
118.3056 -1976 2060.6 1977.6 2059.7 1977.9 2059.5 C
118.3057 -f 
118.3058 -S 
118.3059 -n
118.3060 -1989.6 2051.3 m
118.3061 -1990.1 2042.3 1989.8 2036.6 1989.9 2028 C
118.3062 -1989.8 2027 1990.8 2028.3 1990.1 2027.3 C
118.3063 -1988.9 2026.7 1986.7 2026.9 1986.8 2024.7 C
118.3064 -1987.4 2023 1985.9 2024.6 1985.1 2023.7 C
118.3065 -1984.1 2021.4 1982.5 2020.5 1980.3 2020.6 C
118.3066 -1979.9 2020.8 1979.5 2021.1 1979.3 2021.6 C
118.3067 -1979.7 2025.8 1978.4 2033 1979.6 2038.1 C
118.3068 -1983.7 2042.9 1968.8 2044.6 1978.8 2042.7 C
118.3069 -1979.3 2042.3 1979.6 2041.9 1980 2041.5 C
118.3070 -1980 2034.8 1980 2027 1980 2021.6 C
118.3071 -1981.3 2020.5 1981.7 2021.5 1982.9 2021.8 C
118.3072 -1983.6 2024.7 1986.1 2023.8 1986.8 2026.4 C
118.3073 -1987.1 2027.7 1988.6 2027.1 1989.2 2028.3 C
118.3074 -1989.1 2036.7 1989.3 2044.8 1988.9 2053.7 C
118.3075 -1987.2 2054.9 1986.2 2056.8 1983.9 2057.1 C
118.3076 -1986.3 2055.9 1990.9 2055 1989.6 2051.3 C
118.3077 -f 
118.3078 -S 
118.3079 -n
118.3080 -1971.6 2078.9 m
118.3081 -1971.4 2070.5 1972.1 2062.2 1971.6 2055.9 C
118.3082 -1969.9 2053.7 1967.6 2051.7 1965.6 2049.6 C
118.3083 -1961.4 2050.4 1957.6 2053.6 1953.4 2055.2 C
118.3084 -1949.8 2055.6 1948.2 2051.2 1945.5 2049.6 C
118.3085 -1945.1 2048.8 1944.5 2047.9 1943.6 2047.5 C
118.3086 -1940.1 2047.8 1937.3 2051 1934 2052.3 C
118.3087 -1933.7 2052.6 1933.7 2053 1933.2 2053.2 C
118.3088 -1933.7 2060.8 1933.4 2067.2 1933.5 2074.6 C
118.3089 -1933.8 2068.1 1934 2060.9 1933.2 2054 C
118.3090 -1935.3 2050.9 1939.3 2049.6 1942.4 2047.5 C
118.3091 -1942.8 2047.5 1943.4 2047.4 1943.8 2047.7 C
118.3092 -1947.1 2050.2 1950.3 2057.9 1955.3 2054.4 C
118.3093 -1955.4 2054.4 1955.5 2054.3 1955.6 2054.2 C
118.3094 -1955.9 2057.6 1956.1 2061.8 1955.3 2064.8 C
118.3095 -1955.4 2064.3 1955.1 2063.8 1955.6 2063.6 C
118.3096 -1956 2066.6 1955.3 2068.7 1958.7 2069.8 C
118.3097 -1959.2 2071.7 1961.4 2071.7 1962 2074.1 C
118.3098 -1964.4 2074.2 1964 2077.7 1967.3 2078.4 C
118.3099 -1967 2079.7 1968.1 2079.9 1969 2080.1 C
118.3100 -1971.1 2079.9 1970 2079.2 1970.4 2078 C
118.3101 -1969.5 2077.2 1970.3 2075.9 1969.7 2075.1 C
118.3102 -1970.1 2069.8 1970.1 2063.6 1969.7 2058.8 C
118.3103 -1969.2 2058.5 1970 2058.1 1970.2 2057.8 C
118.3104 -1970.4 2058.3 1971.2 2057.7 1971.4 2058.3 C
118.3105 -1971.5 2065.3 1971.2 2073.6 1971.6 2081.1 C
118.3106 -1974.1 2081.4 1969.8 2084.3 1972.4 2082.5 C
118.3107 -1971.9 2081.4 1971.6 2080.2 1971.6 2078.9 C
118.3108 -[0 0.4 1 0]  vc
118.3109 -f 
118.3110 -S 
118.3111 -n
118.3112 -1952.4 2052 m
118.3113 -1954.1 2051.3 1955.6 2050.4 1957.2 2049.6 C
118.3114 -1955.6 2050.4 1954.1 2051.3 1952.4 2052 C
118.3115 -[0 0.87 0.91 0.83]  vc
118.3116 -f 
118.3117 -S 
118.3118 -n
118.3119 -1975.5 2039.8 m
118.3120 -1975.5 2039.4 1974.5 2038.7 1974.8 2038.8 C
118.3121 -1974.6 2039.1 1974.5 2039.1 1974.3 2038.8 C
118.3122 -1974.6 2037.6 1972.5 2039.3 1972.1 2038.4 C
118.3123 -1970.4 2038.4 1970.5 2035.5 1968 2035.7 C
118.3124 -1968.6 2032.5 1964 2033.3 1964 2030.4 C
118.3125 -1961.9 2029.8 1961.4 2026.8 1959.2 2026.8 C
118.3126 -1957.7 2028.5 1952.6 2025.3 1953.9 2029.5 C
118.3127 -1952.9 2031.5 1947 2028.2 1947.9 2032.4 C
118.3128 -1946 2034.2 1941.5 2031.5 1941.9 2035.7 C
118.3129 -1940.6 2036.1 1938.9 2036.1 1937.6 2035.7 C
118.3130 -1937.3 2037.5 1940.7 2038.2 1941.2 2040.3 C
118.3131 -1943.7 2041.1 1944.4 2043.9 1946.4 2045.6 C
118.3132 -1949.1 2046.7 1949.9 2048.8 1952.2 2051.1 C
118.3133 -1959.9 2047.1 1967.7 2043.6 1975.5 2039.8 C
118.3134 -[0 0.01 1 0]  vc
118.3135 -f 
118.3136 -S 
118.3137 -n
118.3138 -vmrs
118.3139 -1962 2047.2 m
118.3140 -1960.2 2047.5 1959.5 2048.9 1957.7 2049.4 C
118.3141 -1959.5 2049.5 1960.3 2047.2 1962 2047.2 C
118.3142 -[0 0.87 0.91 0.83]  vc
118.3143 -f 
118.3144 -0.4 w
118.3145 -2 J
118.3146 -2 M
118.3147 -S 
118.3148 -n
118.3149 -2012.4 2046.3 m
118.3150 -2010.3 2051.3 2008.3 2041.5 2009.8 2047.7 C
118.3151 -2010.5 2047.4 2012.2 2046.5 2012.4 2046.3 C
118.3152 -f 
118.3153 -S 
118.3154 -n
118.3155 -1944.8 2044.6 m
118.3156 -1945.5 2045.6 1948.6 2048.1 1947.4 2046.8 C
118.3157 -1946.3 2046.5 1945.5 2045.2 1944.8 2044.6 C
118.3158 -f 
118.3159 -S 
118.3160 -n
118.3161 -1987.2 2054.9 m
118.3162 -1983.7 2057.3 1979.6 2058 1976 2060.2 C
118.3163 -1974.7 2058.2 1977.2 2055.8 1974.3 2054.9 C
118.3164 -1973.1 2052 1970.4 2050.2 1968 2048 C
118.3165 -1968 2047.7 1968 2047.4 1968.3 2047.2 C
118.3166 -1969.5 2046.1 1983 2040.8 1972.4 2044.8 C
118.3167 -1971.2 2046.6 1967.9 2046 1968 2048.2 C
118.3168 -1970.5 2050.7 1973.8 2052.6 1974.3 2055.6 C
118.3169 -1975.1 2055 1975.7 2056.7 1975.7 2057.1 C
118.3170 -1975.7 2058.2 1974.8 2059.3 1975.5 2060.4 C
118.3171 -1979.3 2058.2 1983.9 2057.7 1987.2 2054.9 C
118.3172 -[0.18 0.18 0 0.78]  vc
118.3173 -f 
118.3174 -S 
118.3175 -n
118.3176 -1967.8 2047.5 m
118.3177 -1968.5 2047 1969.1 2046.5 1969.7 2046 C
118.3178 -1969.1 2046.5 1968.5 2047 1967.8 2047.5 C
118.3179 -[0 0.87 0.91 0.83]  vc
118.3180 -f 
118.3181 -S 
118.3182 -n
118.3183 -1976.7 2040.3 m
118.3184 -1976.9 2032.8 1976.3 2024.4 1977.2 2017 C
118.3185 -1976.4 2016.5 1976.6 2014.8 1976.9 2013.9 C
118.3186 -1978.7 2012.7 1977.2 2013 1976.2 2012.9 C
118.3187 -1971.5 2008.1 1965.9 2003.1 1961.8 1998 C
118.3188 -1960.9 1998 1960.1 1998 1959.2 1998 C
118.3189 -1951.5 2001.1 1944.3 2005.5 1937.1 2009.6 C
118.3190 -1935 2012.9 1937 2013.6 1936.1 2017.2 C
118.3191 -1937.1 2017.2 1936 2018 1936.4 2017.7 C
118.3192 -1937 2020.1 1935.5 2022.1 1936.4 2024.9 C
118.3193 -1936.8 2027.2 1936.5 2029.7 1936.6 2032.1 C
118.3194 -1937.4 2028.2 1936 2023.8 1936.8 2020.1 C
118.3195 -1938.3 2015.7 1933.6 2011 1939 2008.6 C
118.3196 -1945.9 2004.5 1953.1 2000.3 1960.6 1998.3 C
118.3197 -1960.9 1998.3 1961.3 1998.3 1961.6 1998.3 C
118.3198 -1966.2 2003.5 1971.8 2008.4 1976.4 2013.6 C
118.3199 -1976.6 2015.5 1976 2018.1 1976.9 2019.2 C
118.3200 -1976.1 2025.8 1976.4 2033.2 1976.7 2040 C
118.3201 -1971.9 2042.4 1967.4 2045 1962.5 2047 C
118.3202 -1967.3 2044.9 1972 2042.6 1976.7 2040.3 C
118.3203 -f 
118.3204 -S 
118.3205 -n
118.3206 -1939 2038.6 m
118.3207 -1940.6 2040.9 1942.5 2042.1 1944.3 2044.1 C
118.3208 -1942.7 2041.9 1940.6 2040.9 1939 2038.6 C
118.3209 -f 
118.3210 -S 
118.3211 -n
118.3212 -2006.2 2065.7 m
118.3213 -2006 2057.3 2006.7 2049 2006.2 2042.7 C
118.3214 -2002.1 2038.4 1997.7 2033.4 1993 2030 C
118.3215 -1992.9 2029.3 1992.5 2028.6 1992 2028.3 C
118.3216 -1992.1 2036.6 1991.9 2046.2 1992.3 2054.9 C
118.3217 -1990.8 2056.2 1989 2056.7 1987.5 2058 C
118.3218 -1988.7 2057.7 1990.7 2054.4 1993 2056.4 C
118.3219 -1993.4 2058.8 1996 2058.2 1996.6 2060.9 C
118.3220 -1999 2061 1998.5 2064.5 2001.9 2065.2 C
118.3221 -2001.5 2066.5 2002.7 2066.7 2003.6 2066.9 C
118.3222 -2005.7 2066.7 2004.6 2066 2005 2064.8 C
118.3223 -2004 2064 2004.8 2062.7 2004.3 2061.9 C
118.3224 -2004.6 2056.6 2004.6 2050.4 2004.3 2045.6 C
118.3225 -2003.7 2045.3 2004.6 2044.9 2004.8 2044.6 C
118.3226 -2005 2045.1 2005.7 2044.5 2006 2045.1 C
118.3227 -2006 2052.1 2005.8 2060.4 2006.2 2067.9 C
118.3228 -2008.7 2068.2 2004.4 2071.1 2006.9 2069.3 C
118.3229 -2006.4 2068.2 2006.2 2067 2006.2 2065.7 C
118.3230 -[0 0.4 1 0]  vc
118.3231 -f 
118.3232 -S 
118.3233 -n
118.3234 -2021.8 2041.7 m
118.3235 -2018.3 2044.1 2014.1 2044.8 2010.5 2047 C
118.3236 -2009.3 2045 2011.7 2042.6 2008.8 2041.7 C
118.3237 -2004.3 2035.1 1997.6 2030.9 1993 2024.4 C
118.3238 -1992.1 2024 1991.5 2024.3 1990.8 2024 C
118.3239 -1993.2 2023.9 1995.3 2027.1 1996.8 2029 C
118.3240 -2000.4 2032.6 2004.9 2036.9 2008.4 2040.8 C
118.3241 -2008.2 2043.1 2011.4 2042.8 2009.8 2045.8 C
118.3242 -2009.8 2046.3 2009.7 2046.9 2010 2047.2 C
118.3243 -2013.8 2045 2018.5 2044.5 2021.8 2041.7 C
118.3244 -[0.18 0.18 0 0.78]  vc
118.3245 -f 
118.3246 -S 
118.3247 -n
118.3248 -2001.6 2034 m
118.3249 -2000.7 2033.1 1999.9 2032.3 1999 2031.4 C
118.3250 -1999.9 2032.3 2000.7 2033.1 2001.6 2034 C
118.3251 -[0 0.87 0.91 0.83]  vc
118.3252 -f 
118.3253 -S 
118.3254 -n
118.3255 -vmrs
118.3256 -1989.4 2024.4 m
118.3257 -1989.5 2025.4 1988.6 2024.3 1988.9 2024.7 C
118.3258 -1990.5 2025.8 1990.7 2024.2 1992.8 2024.9 C
118.3259 -1993.8 2025.9 1995 2027.1 1995.9 2028 C
118.3260 -1994.3 2026 1991.9 2023.4 1989.4 2024.4 C
118.3261 -[0 0.87 0.91 0.83]  vc
118.3262 -f 
118.3263 -0.4 w
118.3264 -2 J
118.3265 -2 M
118.3266 -S 
118.3267 -n
118.3268 -1984.8 2019.9 m
118.3269 -1984.6 2018.6 1986.3 2017.2 1987.7 2016.8 C
118.3270 -1987.2 2017.5 1982.9 2017.9 1984.4 2020.6 C
118.3271 -1984.1 2019.9 1984.9 2020 1984.8 2019.9 C
118.3272 -f 
118.3273 -S 
118.3274 -n
118.3275 -1981.7 2017 m
118.3276 -1979.6 2022 1977.6 2012.3 1979.1 2018.4 C
118.3277 -1979.8 2018.1 1981.5 2017.2 1981.7 2017 C
118.3278 -f 
118.3279 -S 
118.3280 -n
118.3281 -1884.3 2019.2 m
118.3282 -1884.7 2010.5 1884.5 2000.6 1884.5 1991.8 C
118.3283 -1886.6 1989.3 1889.9 1988.9 1892.4 1987 C
118.3284 -1890.8 1988.7 1886 1989.1 1884.3 1992.3 C
118.3285 -1884.7 2001 1884.5 2011.3 1884.5 2019.9 C
118.3286 -1891 2025.1 1895.7 2031.5 1902 2036.9 C
118.3287 -1896.1 2031 1890 2024.9 1884.3 2019.2 C
118.3288 -[0.07 0.06 0 0.58]  vc
118.3289 -f 
118.3290 -S 
118.3291 -n
118.3292 -1884 2019.4 m
118.3293 -1884.5 2010.6 1884.2 2000.4 1884.3 1991.8 C
118.3294 -1884.8 1990.4 1887.8 1989 1884.8 1990.8 C
118.3295 -1884.3 1991.3 1884.3 1992 1884 1992.5 C
118.3296 -1884.5 2001.2 1884.2 2011.1 1884.3 2019.9 C
118.3297 -1887.9 2023.1 1891.1 2026.4 1894.4 2030 C
118.3298 -1891.7 2026.1 1887.1 2022.9 1884 2019.4 C
118.3299 -[0.4 0.4 0 0]  vc
118.3300 -f 
118.3301 -S 
118.3302 -n
118.3303 -1885 2011.7 m
118.3304 -1885 2006.9 1885 2001.9 1885 1997.1 C
118.3305 -1885 2001.9 1885 2006.9 1885 2011.7 C
118.3306 -[0 0.87 0.91 0.83]  vc
118.3307 -f 
118.3308 -S 
118.3309 -n
118.3310 -1975.5 2036.4 m
118.3311 -1975.2 2028 1976 2019.7 1975.5 2013.4 C
118.3312 -1971.1 2008.5 1965.6 2003.6 1961.6 1999 C
118.3313 -1958.8 1998 1956 2000 1953.6 2001.2 C
118.3314 -1948.2 2004.7 1941.9 2006.5 1937.1 2010.8 C
118.3315 -1937.5 2018.3 1937.3 2024.7 1937.3 2032.1 C
118.3316 -1937.6 2025.6 1937.9 2018.4 1937.1 2011.5 C
118.3317 -1937.3 2011 1937.6 2010.5 1937.8 2010 C
118.3318 -1944.6 2005.7 1951.9 2002.3 1959.2 1999 C
118.3319 -1960.1 1998.5 1960.1 1999.8 1960.4 2000.4 C
118.3320 -1959.7 2006.9 1959.7 2014.2 1959.4 2021.1 C
118.3321 -1959 2021.1 1959.2 2021.9 1959.2 2022.3 C
118.3322 -1959.2 2021.9 1959 2021.3 1959.4 2021.1 C
118.3323 -1959.8 2024.1 1959.2 2026.2 1962.5 2027.3 C
118.3324 -1963 2029.2 1965.3 2029.2 1965.9 2031.6 C
118.3325 -1968.3 2031.8 1967.8 2035.2 1971.2 2036 C
118.3326 -1970.8 2037.2 1971.9 2037.5 1972.8 2037.6 C
118.3327 -1974.9 2037.4 1973.9 2036.7 1974.3 2035.5 C
118.3328 -1973.3 2034.7 1974.1 2033.4 1973.6 2032.6 C
118.3329 -1973.9 2027.3 1973.9 2021.1 1973.6 2016.3 C
118.3330 -1973 2016 1973.9 2015.6 1974 2015.3 C
118.3331 -1974.3 2015.9 1975 2015.3 1975.2 2015.8 C
118.3332 -1975.3 2022.8 1975.1 2031.2 1975.5 2038.6 C
118.3333 -1977.9 2039 1973.7 2041.8 1976.2 2040 C
118.3334 -1975.7 2039 1975.5 2037.8 1975.5 2036.4 C
118.3335 -[0 0.4 1 0]  vc
118.3336 -f 
118.3337 -S 
118.3338 -n
118.3339 -1991.1 2012.4 m
118.3340 -1987.5 2014.8 1983.4 2015.6 1979.8 2017.7 C
118.3341 -1978.5 2015.7 1981 2013.3 1978.1 2012.4 C
118.3342 -1973.6 2005.8 1966.8 2001.6 1962.3 1995.2 C
118.3343 -1961.4 1994.7 1960.8 1995 1960.1 1994.7 C
118.3344 -1962.5 1994.6 1964.6 1997.8 1966.1 1999.7 C
118.3345 -1969.7 2003.3 1974.2 2007.6 1977.6 2011.5 C
118.3346 -1977.5 2013.8 1980.6 2013.5 1979.1 2016.5 C
118.3347 -1979.1 2017 1979 2017.6 1979.3 2018 C
118.3348 -1983.1 2015.7 1987.8 2015.2 1991.1 2012.4 C
118.3349 -[0.18 0.18 0 0.78]  vc
118.3350 -f 
118.3351 -S 
118.3352 -n
118.3353 -1970.9 2004.8 m
118.3354 -1970 2003.9 1969.2 2003 1968.3 2002.1 C
118.3355 -1969.2 2003 1970 2003.9 1970.9 2004.8 C
118.3356 -[0 0.87 0.91 0.83]  vc
118.3357 -f 
118.3358 -S 
118.3359 -n
118.3360 -1887.9 1994.9 m
118.3361 -1888.5 1992.3 1891.4 1992.2 1893.2 1990.8 C
118.3362 -1898.4 1987.5 1904 1984.8 1909.5 1982.2 C
118.3363 -1909.7 1982.7 1910.3 1982.1 1910.4 1982.7 C
118.3364 -1909.5 1990.5 1910.1 1996.4 1910 2004.5 C
118.3365 -1909.1 2003.4 1909.7 2005.8 1909.5 2006.4 C
118.3366 -1910.4 2006 1909.7 2008 1910.2 2007.9 C
118.3367 -1911.3 2010.6 1912.5 2012.6 1915.7 2013.4 C
118.3368 -1915.8 2013.7 1915.5 2014.4 1916 2014.4 C
118.3369 -1916.3 2015 1915.4 2016 1915.2 2016 C
118.3370 -1916.1 2015.5 1916.5 2014.5 1916 2013.6 C
118.3371 -1913.4 2013.3 1913.1 2010.5 1910.9 2009.8 C
118.3372 -1910.7 2008.8 1910.4 2007.9 1910.2 2006.9 C
118.3373 -1911.1 1998.8 1909.4 1990.7 1910.7 1982.4 C
118.3374 -1910 1982.1 1908.9 1982.1 1908.3 1982.4 C
118.3375 -1901.9 1986.1 1895 1988.7 1888.8 1993 C
118.3376 -1888 1993.4 1888.4 1994.3 1887.6 1994.7 C
118.3377 -1888.1 2001.3 1887.8 2008.6 1887.9 2015.1 C
118.3378 -1887.3 2017.5 1887.9 2015.4 1888.4 2014.4 C
118.3379 -1887.8 2008 1888.4 2001.3 1887.9 1994.9 C
118.3380 -[0.07 0.06 0 0.58]  vc
118.3381 -f 
118.3382 -S 
118.3383 -n
118.3384 -vmrs
118.3385 -1887.9 2018.4 m
118.3386 -1887.5 2016.9 1888.5 2016 1888.8 2014.8 C
118.3387 -1890.1 2014.8 1891.1 2016.6 1892.4 2015.3 C
118.3388 -1892.4 2014.4 1893.8 2012.9 1894.4 2012.4 C
118.3389 -1895.9 2012.4 1896.6 2013.9 1897.7 2012.7 C
118.3390 -1898.4 2011.7 1898.6 2010.4 1899.6 2009.8 C
118.3391 -1901.7 2009.9 1902.9 2010.4 1904 2009.1 C
118.3392 -1904.3 2007.4 1904 2007.6 1904.9 2007.2 C
118.3393 -1906.2 2007 1907.6 2006.5 1908.8 2006.7 C
118.3394 -1910.6 2008.2 1909.8 2011.5 1912.6 2012 C
118.3395 -1912.4 2013 1913.8 2012.7 1914 2013.2 C
118.3396 -1911.5 2011.1 1909.1 2007.9 1909.2 2004.3 C
118.3397 -1909.5 2003.5 1909.9 2004.9 1909.7 2004.3 C
118.3398 -1909.9 1996.2 1909.3 1990.5 1910.2 1982.7 C
118.3399 -1909.5 1982.6 1909.5 1982.6 1908.8 1982.7 C
118.3400 -1903.1 1985.7 1897 1987.9 1891.7 1992 C
118.3401 -1890.5 1993 1888.2 1992.9 1888.1 1994.9 C
118.3402 -1888.7 2001.4 1888.1 2008.4 1888.6 2014.8 C
118.3403 -1888.3 2016 1887.2 2016.9 1887.6 2018.4 C
118.3404 -1892.3 2023.9 1897.6 2027.9 1902.3 2033.3 C
118.3405 -1898 2028.2 1892.1 2023.8 1887.9 2018.4 C
118.3406 -[0.4 0.4 0 0]  vc
118.3407 -f 
118.3408 -0.4 w
118.3409 -2 J
118.3410 -2 M
118.3411 -S 
118.3412 -n
118.3413 -1910.9 1995.2 m
118.3414 -1910.4 1999.8 1911 2003.3 1910.9 2008.1 C
118.3415 -1910.9 2003.8 1910.9 1999.2 1910.9 1995.2 C
118.3416 -[0.18 0.18 0 0.78]  vc
118.3417 -f 
118.3418 -S 
118.3419 -n
118.3420 -1911.2 2004.3 m
118.3421 -1911.2 2001.9 1911.2 1999.7 1911.2 1997.3 C
118.3422 -1911.2 1999.7 1911.2 2001.9 1911.2 2004.3 C
118.3423 -[0 0.87 0.91 0.83]  vc
118.3424 -f 
118.3425 -S 
118.3426 -n
118.3427 -1958.7 1995.2 m
118.3428 -1959 1995.6 1956.2 1995 1956.5 1996.8 C
118.3429 -1955.8 1997.6 1954.2 1998.5 1953.6 1997.3 C
118.3430 -1953.6 1990.8 1954.9 1989.6 1953.4 1983.9 C
118.3431 -1953.4 1983.3 1953.3 1982.1 1954.4 1982 C
118.3432 -1955.5 1982.6 1956.5 1981.3 1957.5 1981 C
118.3433 -1956.3 1981.8 1954.7 1982.6 1953.9 1981.5 C
118.3434 -1951.4 1983 1954.7 1988.8 1952.9 1990.6 C
118.3435 -1953.8 1990.6 1953.2 1992.7 1953.4 1993.7 C
118.3436 -1953.8 1994.5 1952.3 1996.1 1953.2 1997.8 C
118.3437 -1956.3 1999.4 1957.5 1994 1959.9 1995.6 C
118.3438 -1962 1994.4 1963.7 1997.7 1965.2 1998.8 C
118.3439 -1963.5 1996.7 1961.2 1994.1 1958.7 1995.2 C
118.3440 -f 
118.3441 -S 
118.3442 -n
118.3443 -1945 2000.7 m
118.3444 -1945.4 1998.7 1945.4 1997.9 1945 1995.9 C
118.3445 -1944.5 1995.3 1944.2 1992.6 1945.7 1993.2 C
118.3446 -1946 1992.2 1948.7 1992.5 1948.4 1990.6 C
118.3447 -1947.5 1990.3 1948.1 1988.7 1947.9 1988.2 C
118.3448 -1948.9 1987.8 1950.5 1986.8 1950.5 1984.6 C
118.3449 -1951.5 1980.9 1946.7 1983 1947.2 1979.8 C
118.3450 -1944.5 1979.9 1945.2 1976.6 1943.1 1976.7 C
118.3451 -1941.8 1975.7 1942.1 1972.7 1939.2 1973.8 C
118.3452 -1938.2 1974.6 1939.3 1971.6 1938.3 1970.9 C
118.3453 -1938.8 1969.2 1933.4 1970.3 1937.3 1970 C
118.3454 -1939.4 1971.2 1937.2 1973 1937.6 1974.3 C
118.3455 -1937.2 1976.3 1937.1 1981.2 1937.8 1984.1 C
118.3456 -1938.8 1982.3 1937.9 1976.6 1938.5 1973.1 C
118.3457 -1938.9 1975 1938.5 1976.4 1939.7 1977.2 C
118.3458 -1939.5 1983.5 1938.9 1991.3 1940.2 1997.3 C
118.3459 -1939.4 1999.1 1938.6 1997.1 1937.8 1997.1 C
118.3460 -1937.4 1996.7 1937.6 1996.1 1937.6 1995.6 C
118.3461 -1936.5 1998.5 1940.1 1998.4 1940.9 2000.7 C
118.3462 -1942.1 2000.4 1943.2 2001.3 1943.1 2002.4 C
118.3463 -1943.6 2003.1 1941.1 2004.6 1942.8 2003.8 C
118.3464 -1943.9 2002.5 1942.6 2000.6 1945 2000.7 C
118.3465 -[0.65 0.65 0 0.42]  vc
118.3466 -f 
118.3467 -S 
118.3468 -n
118.3469 -1914.5 2006.4 m
118.3470 -1914.1 2004.9 1915.2 2004 1915.5 2002.8 C
118.3471 -1916.7 2002.8 1917.8 2004.6 1919.1 2003.3 C
118.3472 -1919 2002.4 1920.4 2000.9 1921 2000.4 C
118.3473 -1922.5 2000.4 1923.2 2001.9 1924.4 2000.7 C
118.3474 -1925 1999.7 1925.3 1998.4 1926.3 1997.8 C
118.3475 -1928.4 1997.9 1929.5 1998.4 1930.6 1997.1 C
118.3476 -1930.9 1995.4 1930.7 1995.6 1931.6 1995.2 C
118.3477 -1932.8 1995 1934.3 1994.5 1935.4 1994.7 C
118.3478 -1936.1 1995.8 1936.9 1996.2 1936.6 1997.8 C
118.3479 -1938.9 1999.4 1939.7 2001.3 1942.4 2002.4 C
118.3480 -1942.4 2002.5 1942.2 2003 1942.6 2002.8 C
118.3481 -1942.9 2000.4 1939.2 2001.8 1939.2 1999.7 C
118.3482 -1936.2 1998.6 1937 1995.3 1935.9 1993.5 C
118.3483 -1937.1 1986.5 1935.2 1977.9 1937.6 1971.2 C
118.3484 -1937.6 1970.3 1936.6 1971 1936.4 1970.4 C
118.3485 -1930.2 1973.4 1924 1976 1918.4 1980 C
118.3486 -1917.2 1981 1914.9 1980.9 1914.8 1982.9 C
118.3487 -1915.3 1989.4 1914.7 1996.4 1915.2 2002.8 C
118.3488 -1914.9 2004 1913.9 2004.9 1914.3 2006.4 C
118.3489 -1919 2011.9 1924.2 2015.9 1928.9 2021.3 C
118.3490 -1924.6 2016.2 1918.7 2011.8 1914.5 2006.4 C
118.3491 -[0.4 0.4 0 0]  vc
118.3492 -f 
118.3493 -S 
118.3494 -n
118.3495 -1914.5 1982.9 m
118.3496 -1915.1 1980.3 1918 1980.2 1919.8 1978.8 C
118.3497 -1925 1975.5 1930.6 1972.8 1936.1 1970.2 C
118.3498 -1939.4 1970.6 1936.1 1974.2 1936.6 1976.4 C
118.3499 -1936.5 1981.9 1936.8 1987.5 1936.4 1992.8 C
118.3500 -1935.9 1992.8 1936.2 1993.5 1936.1 1994 C
118.3501 -1937.1 1993.6 1936.2 1995.9 1936.8 1995.9 C
118.3502 -1937 1998 1939.5 1999.7 1940.4 2000.7 C
118.3503 -1940.1 1998.6 1935 1997.2 1937.6 1993.7 C
118.3504 -1938.3 1985.7 1935.9 1976.8 1937.8 1970.7 C
118.3505 -1936.9 1969.8 1935.4 1970.3 1934.4 1970.7 C
118.3506 -1928.3 1974.4 1921.4 1976.7 1915.5 1981 C
118.3507 -1914.6 1981.4 1915.1 1982.3 1914.3 1982.7 C
118.3508 -1914.7 1989.3 1914.5 1996.6 1914.5 2003.1 C
118.3509 -1913.9 2005.5 1914.5 2003.4 1915 2002.4 C
118.3510 -1914.5 1996 1915.1 1989.3 1914.5 1982.9 C
118.3511 -[0.07 0.06 0 0.58]  vc
118.3512 -f 
118.3513 -S 
118.3514 -n
118.3515 -1939.2 1994.9 m
118.3516 -1939.3 1995 1939.4 1995.1 1939.5 1995.2 C
118.3517 -1939.1 1989 1939.3 1981.6 1939 1976.7 C
118.3518 -1938.6 1976.3 1938.6 1974.6 1938.5 1973.3 C
118.3519 -1938.7 1976.1 1938.1 1979.4 1939 1981.7 C
118.3520 -1937.3 1986 1937.7 1991.6 1938 1996.4 C
118.3521 -1937.3 1994.3 1939.6 1996.2 1939.2 1994.9 C
118.3522 -[0.18 0.18 0 0.78]  vc
118.3523 -f 
118.3524 -S 
118.3525 -n
118.3526 -1938.3 1988.4 m
118.3527 -1938.5 1990.5 1937.9 1994.1 1938.8 1994.7 C
118.3528 -1937.9 1992.6 1939 1990.6 1938.3 1988.4 C
118.3529 -[0 0.87 0.91 0.83]  vc
118.3530 -f 
118.3531 -S 
118.3532 -n
118.3533 -1938.8 1985.8 m
118.3534 -1938.5 1985.9 1938.4 1985.7 1938.3 1985.6 C
118.3535 -1938.4 1986.2 1938 1989.5 1938.8 1987.2 C
118.3536 -1938.8 1986.8 1938.8 1986.3 1938.8 1985.8 C
118.3537 -f 
118.3538 -S 
118.3539 -n
118.3540 -vmrs
118.3541 -1972.8 2062.1 m
118.3542 -1971.9 2061 1972.5 2059.4 1972.4 2058 C
118.3543 -1972.2 2063.8 1971.9 2073.7 1972.4 2081.3 C
118.3544 -1972.5 2074.9 1971.9 2067.9 1972.8 2062.1 C
118.3545 -[0 1 1 0.36]  vc
118.3546 -f 
118.3547 -0.4 w
118.3548 -2 J
118.3549 -2 M
118.3550 -S 
118.3551 -n
118.3552 -1940.2 2071.7 m
118.3553 -1941.3 2072 1943.1 2072.3 1944 2071.5 C
118.3554 -1943.6 2069.9 1945.2 2069.1 1946 2068.8 C
118.3555 -1950 2071.1 1948.7 2065.9 1951.7 2066.2 C
118.3556 -1953.5 2063.9 1956.9 2069.4 1955.6 2063.8 C
118.3557 -1955.5 2064.2 1955.7 2064.8 1955.3 2065 C
118.3558 -1954.3 2063.7 1956.2 2063.6 1955.6 2062.1 C
118.3559 -1954.5 2060 1958.3 2050.3 1952.2 2055.6 C
118.3560 -1949.1 2053.8 1946 2051 1943.8 2048 C
118.3561 -1940.3 2048 1937.5 2051.3 1934.2 2052.5 C
118.3562 -1933.1 2054.6 1934.4 2057.3 1934 2060 C
118.3563 -1934 2065.1 1934 2069.7 1934 2074.6 C
118.3564 -1934.4 2069 1934.1 2061.5 1934.2 2054.9 C
118.3565 -1934.6 2054.5 1935.3 2054.7 1935.9 2054.7 C
118.3566 -1937 2055.3 1935.9 2056.1 1935.9 2056.8 C
118.3567 -1936.5 2063 1935.6 2070.5 1935.9 2074.6 C
118.3568 -1936.7 2074.4 1937.3 2075.2 1938 2074.6 C
118.3569 -1937.9 2073.6 1939.1 2072.1 1940.2 2071.7 C
118.3570 -[0 0.2 1 0]  vc
118.3571 -f 
118.3572 -S 
118.3573 -n
118.3574 -1933.2 2074.1 m
118.3575 -1933.2 2071.5 1933.2 2069 1933.2 2066.4 C
118.3576 -1933.2 2069 1933.2 2071.5 1933.2 2074.1 C
118.3577 -[0 1 1 0.36]  vc
118.3578 -f 
118.3579 -S 
118.3580 -n
118.3581 -2007.4 2048.9 m
118.3582 -2006.5 2047.8 2007.1 2046.2 2006.9 2044.8 C
118.3583 -2006.7 2050.6 2006.5 2060.5 2006.9 2068.1 C
118.3584 -2007.1 2061.7 2006.5 2054.7 2007.4 2048.9 C
118.3585 -f 
118.3586 -S 
118.3587 -n
118.3588 -1927.2 2062.4 m
118.3589 -1925.8 2060.1 1928.1 2058.2 1927 2056.4 C
118.3590 -1927.3 2055.5 1926.5 2053.5 1926.8 2051.8 C
118.3591 -1926.8 2052.8 1926 2052.5 1925.3 2052.5 C
118.3592 -1924.1 2052.8 1925 2050.5 1924.4 2050.1 C
118.3593 -1925.3 2050.2 1925.4 2048.8 1926.3 2049.4 C
118.3594 -1926.5 2052.3 1928.4 2047.2 1928.4 2051.1 C
118.3595 -1928.9 2050.5 1929 2051.4 1928.9 2051.8 C
118.3596 -1928.9 2052 1928.9 2052.3 1928.9 2052.5 C
118.3597 -1929.4 2051.4 1928.9 2049 1930.1 2048.2 C
118.3598 -1928.9 2047.1 1930.5 2047.1 1930.4 2046.5 C
118.3599 -1931.9 2046.2 1933.1 2046.1 1934.7 2046.5 C
118.3600 -1934.6 2046.9 1935.2 2047.9 1934.4 2048.4 C
118.3601 -1936.9 2048.1 1933.6 2043.8 1935.9 2043.9 C
118.3602 -1935.7 2043.9 1934.8 2041.3 1933.2 2041.7 C
118.3603 -1932.5 2041.6 1932.4 2039.6 1932.3 2041 C
118.3604 -1930.8 2042.6 1929 2040.6 1927.7 2042 C
118.3605 -1927.5 2041.4 1927.1 2040.9 1927.2 2040.3 C
118.3606 -1927.8 2040.6 1927.4 2039.1 1928.2 2038.6 C
118.3607 -1929.4 2038 1930.5 2038.8 1931.3 2037.9 C
118.3608 -1931.7 2039 1932.5 2038.6 1931.8 2037.6 C
118.3609 -1930.9 2037 1928.7 2037.8 1928.2 2037.9 C
118.3610 -1926.7 2037.8 1928 2039 1927 2038.8 C
118.3611 -1927.4 2040.4 1925.6 2040.8 1925.1 2041 C
118.3612 -1924.3 2040.4 1923.2 2040.5 1922.2 2040.5 C
118.3613 -1921.4 2041.7 1921 2043.9 1919.3 2043.9 C
118.3614 -1918.8 2043.4 1917.2 2043.3 1916.4 2043.4 C
118.3615 -1915.9 2044.4 1915.7 2046 1914.3 2046.5 C
118.3616 -1913.1 2046.6 1912 2044.5 1911.4 2046.3 C
118.3617 -1912.8 2046.5 1913.8 2047.4 1915.7 2047 C
118.3618 -1916.9 2047.7 1915.6 2048.8 1916 2049.4 C
118.3619 -1915.4 2049.3 1913.9 2050.3 1913.3 2051.1 C
118.3620 -1913.9 2054.1 1916 2050.2 1916.7 2053 C
118.3621 -1916.9 2053.8 1915.5 2054.1 1916.7 2054.4 C
118.3622 -1917 2054.7 1920.2 2054.3 1919.3 2056.6 C
118.3623 -1918.8 2056.1 1920.2 2058.6 1920.3 2057.6 C
118.3624 -1921.2 2057.9 1922.1 2057.5 1922.4 2059 C
118.3625 -1922.3 2059.1 1922.2 2059.3 1922 2059.2 C
118.3626 -1922.1 2059.7 1922.4 2060.3 1922.9 2060.7 C
118.3627 -1923.2 2060.1 1923.8 2060.4 1924.6 2060.7 C
118.3628 -1925.9 2062.6 1923.2 2062 1925.6 2063.6 C
118.3629 -1926.1 2063.1 1927.3 2062.5 1927.2 2062.4 C
118.3630 -[0.21 0.21 0 0]  vc
118.3631 -f 
118.3632 -S 
118.3633 -n
118.3634 -1933.2 2063.3 m
118.3635 -1933.2 2060.7 1933.2 2058.2 1933.2 2055.6 C
118.3636 -1933.2 2058.2 1933.2 2060.7 1933.2 2063.3 C
118.3637 -[0 1 1 0.36]  vc
118.3638 -f 
118.3639 -S 
118.3640 -n
118.3641 -1965.2 2049.2 m
118.3642 -1967.1 2050.1 1969.9 2053.7 1972.1 2056.4 C
118.3643 -1970.5 2054 1967.6 2051.3 1965.2 2049.2 C
118.3644 -f 
118.3645 -S 
118.3646 -n
118.3647 -1991.8 2034.8 m
118.3648 -1991.7 2041.5 1992 2048.5 1991.6 2055.2 C
118.3649 -1990.5 2056.4 1991.9 2054.9 1991.8 2054.4 C
118.3650 -1991.8 2047.9 1991.8 2041.3 1991.8 2034.8 C
118.3651 -f 
118.3652 -S 
118.3653 -n
118.3654 -1988.9 2053.2 m
118.3655 -1988.9 2044.3 1988.9 2036.6 1988.9 2028.3 C
118.3656 -1985.7 2028.2 1987.2 2023.5 1983.9 2024.2 C
118.3657 -1983.9 2022.4 1982 2021.6 1981 2021.3 C
118.3658 -1980.6 2021.1 1980.6 2021.7 1980.3 2021.6 C
118.3659 -1980.3 2027 1980.3 2034.8 1980.3 2041.5 C
118.3660 -1979.3 2043.2 1977.6 2043 1976.2 2043.6 C
118.3661 -1977.1 2043.8 1978.5 2043.2 1978.8 2044.1 C
118.3662 -1978.5 2045.3 1979.9 2045.3 1980.3 2045.8 C
118.3663 -1980.5 2046.8 1980.7 2046.2 1981.5 2046.5 C
118.3664 -1982.4 2047.1 1982 2048.6 1982.7 2049.4 C
118.3665 -1984.2 2049.6 1984.6 2052.2 1986.8 2051.6 C
118.3666 -1987.1 2048.6 1985.1 2042.7 1986.5 2040.5 C
118.3667 -1986.3 2036.7 1986.9 2031.7 1986 2029.2 C
118.3668 -1986.3 2027.1 1986.9 2028.6 1987.7 2027.6 C
118.3669 -1987.7 2028.3 1988.7 2028 1988.7 2028.8 C
118.3670 -1988.1 2033 1988.7 2037.5 1988.2 2041.7 C
118.3671 -1987.8 2041.4 1988 2040.8 1988 2040.3 C
118.3672 -1988 2041 1988 2042.4 1988 2042.4 C
118.3673 -1988 2042.4 1988.1 2042.3 1988.2 2042.2 C
118.3674 -1989.3 2046 1988 2050.2 1988.4 2054 C
118.3675 -1987.8 2054.4 1987.1 2054.7 1986.5 2055.4 C
118.3676 -1987.4 2054.4 1988.4 2054.6 1988.9 2053.2 C
118.3677 -[0 1 1 0.23]  vc
118.3678 -f 
118.3679 -S 
118.3680 -n
118.3681 -1950.8 2054.4 m
118.3682 -1949.7 2053.4 1948.7 2052.3 1947.6 2051.3 C
118.3683 -1948.7 2052.3 1949.7 2053.4 1950.8 2054.4 C
118.3684 -[0 1 1 0.36]  vc
118.3685 -f 
118.3686 -S 
118.3687 -n
118.3688 -vmrs
118.3689 -2006.7 2043.2 m
118.3690 -2004.5 2040.8 2002.4 2038.4 2000.2 2036 C
118.3691 -2002.4 2038.4 2004.5 2040.8 2006.7 2043.2 C
118.3692 -[0 1 1 0.36]  vc
118.3693 -f 
118.3694 -0.4 w
118.3695 -2 J
118.3696 -2 M
118.3697 -S 
118.3698 -n
118.3699 -1976.7 2019.6 m
118.3700 -1975.8 2018.6 1976.4 2016.9 1976.2 2015.6 C
118.3701 -1976 2021.3 1975.8 2031.2 1976.2 2038.8 C
118.3702 -1976.4 2032.4 1975.8 2025.5 1976.7 2019.6 C
118.3703 -f 
118.3704 -S 
118.3705 -n
118.3706 -1988.4 2053.5 m
118.3707 -1988.6 2049.2 1988.1 2042.8 1988 2040 C
118.3708 -1988.4 2040.4 1988.1 2041 1988.2 2041.5 C
118.3709 -1988.3 2037.2 1988 2032.7 1988.4 2028.5 C
118.3710 -1987.6 2027.1 1987.2 2028.6 1986.8 2028 C
118.3711 -1985.9 2028.5 1986.5 2029.7 1986.3 2030.4 C
118.3712 -1986.9 2029.8 1986.6 2031 1987 2031.2 C
118.3713 -1987.4 2039.6 1985 2043 1987.2 2050.4 C
118.3714 -1987.2 2051.6 1985.9 2052.3 1984.6 2051.3 C
118.3715 -1981.9 2049.7 1982.9 2047 1980.3 2046.5 C
118.3716 -1980.3 2045.2 1978.1 2046.2 1978.6 2043.9 C
118.3717 -1975.6 2043.3 1979.3 2045.6 1979.6 2046.5 C
118.3718 -1980.8 2046.6 1981.5 2048.5 1982.2 2049.9 C
118.3719 -1983.7 2050.8 1984.8 2052.8 1986.5 2053 C
118.3720 -1986.7 2053.5 1987.5 2054.1 1987 2054.7 C
118.3721 -1987.4 2053.9 1988.3 2054.3 1988.4 2053.5 C
118.3722 -[0 1 1 0.23]  vc
118.3723 -f 
118.3724 -S 
118.3725 -n
118.3726 -1988 2038.1 m
118.3727 -1988 2036.7 1988 2035.4 1988 2034 C
118.3728 -1988 2035.4 1988 2036.7 1988 2038.1 C
118.3729 -[0 1 1 0.36]  vc
118.3730 -f 
118.3731 -S 
118.3732 -n
118.3733 -1999.7 2035.7 m
118.3734 -1997.6 2033.5 1995.4 2031.2 1993.2 2029 C
118.3735 -1995.4 2031.2 1997.6 2033.5 1999.7 2035.7 C
118.3736 -f 
118.3737 -S 
118.3738 -n
118.3739 -1944 2029.2 m
118.3740 -1945.2 2029.5 1946.9 2029.8 1947.9 2029 C
118.3741 -1947.4 2027.4 1949 2026.7 1949.8 2026.4 C
118.3742 -1953.9 2028.6 1952.6 2023.4 1955.6 2023.7 C
118.3743 -1957.4 2021.4 1960.7 2027 1959.4 2021.3 C
118.3744 -1959.3 2021.7 1959.6 2022.3 1959.2 2022.5 C
118.3745 -1958.1 2021.2 1960.1 2021.1 1959.4 2019.6 C
118.3746 -1959.1 2012.7 1959.9 2005.1 1959.6 1999.2 C
118.3747 -1955.3 2000.1 1951.3 2003.1 1947.2 2005 C
118.3748 -1943.9 2006 1941.2 2008.7 1938 2010 C
118.3749 -1936.9 2012.1 1938.2 2014.8 1937.8 2017.5 C
118.3750 -1937.8 2022.6 1937.8 2027.3 1937.8 2032.1 C
118.3751 -1938.2 2026.5 1938 2019 1938 2012.4 C
118.3752 -1938.5 2012 1939.2 2012.3 1939.7 2012.2 C
118.3753 -1940.8 2012.8 1939.7 2013.6 1939.7 2014.4 C
118.3754 -1940.4 2020.5 1939.4 2028 1939.7 2032.1 C
118.3755 -1940.6 2031.9 1941.2 2032.7 1941.9 2032.1 C
118.3756 -1941.7 2031.2 1943 2029.7 1944 2029.2 C
118.3757 -[0 0.2 1 0]  vc
118.3758 -f 
118.3759 -S 
118.3760 -n
118.3761 -1937.1 2031.6 m
118.3762 -1937.1 2029.1 1937.1 2026.5 1937.1 2024 C
118.3763 -1937.1 2026.5 1937.1 2029.1 1937.1 2031.6 C
118.3764 -[0 1 1 0.36]  vc
118.3765 -f 
118.3766 -S 
118.3767 -n
118.3768 -1991.8 2028 m
118.3769 -1992.5 2027.8 1993.2 2029.9 1994 2030.2 C
118.3770 -1992.9 2029.6 1993.1 2028.1 1991.8 2028 C
118.3771 -[0 1 1 0.23]  vc
118.3772 -f 
118.3773 -S 
118.3774 -n
118.3775 -1991.8 2027.8 m
118.3776 -1992.4 2027.6 1992.6 2028.3 1993 2028.5 C
118.3777 -1992.6 2028.2 1992.2 2027.6 1991.6 2027.8 C
118.3778 -1991.6 2028.5 1991.6 2029.1 1991.6 2029.7 C
118.3779 -1991.6 2029.1 1991.4 2028.3 1991.8 2027.8 C
118.3780 -[0 1 1 0.36]  vc
118.3781 -f 
118.3782 -S 
118.3783 -n
118.3784 -1985.8 2025.4 m
118.3785 -1985.3 2025.2 1984.8 2024.7 1984.1 2024.9 C
118.3786 -1983.3 2025.3 1983.6 2027.3 1983.9 2027.6 C
118.3787 -1985 2028 1986.9 2026.9 1985.8 2025.4 C
118.3788 -[0 1 1 0.23]  vc
118.3789 -f 
118.3790 -S 
118.3791 -n
118.3792 -vmrs
118.3793 -1993.5 2024.4 m
118.3794 -1992.4 2023.7 1991.3 2022.9 1990.1 2023.2 C
118.3795 -1990.7 2023.7 1989.8 2023.8 1989.4 2023.7 C
118.3796 -1989.1 2023.7 1988.6 2023.9 1988.4 2023.5 C
118.3797 -1988.5 2023.2 1988.3 2022.7 1988.7 2022.5 C
118.3798 -1989 2022.6 1988.9 2023 1988.9 2023.2 C
118.3799 -1989.1 2022.8 1990.4 2022.3 1990.6 2021.3 C
118.3800 -1990.4 2021.8 1990 2021.3 1990.1 2021.1 C
118.3801 -1990.1 2020.9 1990.1 2020.1 1990.1 2020.6 C
118.3802 -1989.9 2021.1 1989.5 2020.6 1989.6 2020.4 C
118.3803 -1989.6 2019.8 1988.7 2019.6 1988.2 2019.2 C
118.3804 -1987.5 2018.7 1987.7 2020.2 1987 2019.4 C
118.3805 -1987.5 2020.4 1986 2021.1 1987.5 2021.8 C
118.3806 -1986.8 2023.1 1986.6 2021.1 1986 2021.1 C
118.3807 -1986.1 2020.1 1985.9 2019 1986.3 2018.2 C
118.3808 -1986.7 2018.4 1986.5 2019 1986.5 2019.4 C
118.3809 -1986.5 2018.7 1986.4 2017.8 1987.2 2017.7 C
118.3810 -1986.5 2017.2 1985.5 2019.3 1985.3 2020.4 C
118.3811 -1986.2 2022 1987.3 2023.5 1989.2 2024.2 C
118.3812 -1990.8 2024.3 1991.6 2022.9 1993.2 2024.4 C
118.3813 -1993.8 2025.4 1995 2026.6 1995.9 2027.1 C
118.3814 -1995 2026.5 1994.1 2025.5 1993.5 2024.4 C
118.3815 -[0 1 1 0.36]  vc
118.3816 -f 
118.3817 -0.4 w
118.3818 -2 J
118.3819 -2 M
118.3820 -[0 0.5 0.5 0.2]  vc
118.3821 -S 
118.3822 -n
118.3823 -2023 2040.3 m
118.3824 -2023.2 2036 2022.7 2029.6 2022.5 2026.8 C
118.3825 -2022.9 2027.2 2022.7 2027.8 2022.8 2028.3 C
118.3826 -2022.8 2024 2022.6 2019.5 2023 2015.3 C
118.3827 -2022.2 2013.9 2021.7 2015.4 2021.3 2014.8 C
118.3828 -2020.4 2015.3 2021 2016.5 2020.8 2017.2 C
118.3829 -2021.4 2016.6 2021.1 2017.8 2021.6 2018 C
118.3830 -2022 2026.4 2019.6 2029.8 2021.8 2037.2 C
118.3831 -2021.7 2038.4 2020.5 2039.1 2019.2 2038.1 C
118.3832 -2016.5 2036.5 2017.5 2033.8 2014.8 2033.3 C
118.3833 -2014.9 2032 2012.6 2033 2013.2 2030.7 C
118.3834 -2011.9 2030.8 2011.2 2030.1 2010.8 2029.2 C
118.3835 -2010.8 2029.1 2010.8 2028.2 2010.8 2028.8 C
118.3836 -2010 2028.8 2010.4 2026.5 2008.6 2027.3 C
118.3837 -2007.9 2026.6 2007.3 2025.9 2007.9 2027.1 C
118.3838 -2009.7 2028 2010 2030.1 2012.2 2030.9 C
118.3839 -2012.9 2032.1 2013.7 2033.6 2015.1 2033.6 C
118.3840 -2015.7 2035.1 2016.9 2036.7 2018.4 2038.4 C
118.3841 -2019.8 2039.3 2022 2039.4 2021.6 2041.5 C
118.3842 -2021.9 2040.7 2022.9 2041.1 2023 2040.3 C
118.3843 -[0 1 1 0.23]  vc
118.3844 -f 
118.3845 -S 
118.3846 -n
118.3847 -2022.5 2024.9 m
118.3848 -2022.5 2023.5 2022.5 2022.2 2022.5 2020.8 C
118.3849 -2022.5 2022.2 2022.5 2023.5 2022.5 2024.9 C
118.3850 -[0 1 1 0.36]  vc
118.3851 -f 
118.3852 -S 
118.3853 -n
118.3854 -1983.2 2022.8 m
118.3855 -1982.4 2022.5 1982.1 2021.6 1981.2 2022.3 C
118.3856 -1981.1 2022.9 1980.5 2024 1981 2024.2 C
118.3857 -1981.8 2024.6 1982.9 2024.4 1983.2 2022.8 C
118.3858 -[0 1 1 0.23]  vc
118.3859 -f 
118.3860 -S 
118.3861 -n
118.3862 -1931.1 2019.9 m
118.3863 -1929.6 2017.7 1932 2015.7 1930.8 2013.9 C
118.3864 -1931.1 2013 1930.3 2011 1930.6 2009.3 C
118.3865 -1930.6 2010.3 1929.8 2010 1929.2 2010 C
118.3866 -1928 2010.3 1928.8 2008.1 1928.2 2007.6 C
118.3867 -1929.1 2007.8 1929.3 2006.3 1930.1 2006.9 C
118.3868 -1930.3 2009.8 1932.2 2004.8 1932.3 2008.6 C
118.3869 -1932.7 2008 1932.8 2009 1932.8 2009.3 C
118.3870 -1932.8 2009.6 1932.8 2009.8 1932.8 2010 C
118.3871 -1933.2 2009 1932.7 2006.6 1934 2005.7 C
118.3872 -1932.7 2004.6 1934.3 2004.6 1934.2 2004 C
118.3873 -1935.8 2003.7 1937 2003.6 1938.5 2004 C
118.3874 -1938.5 2004.5 1939.1 2005.4 1938.3 2006 C
118.3875 -1940.7 2005.7 1937.4 2001.3 1939.7 2001.4 C
118.3876 -1939.5 2001.4 1938.6 1998.8 1937.1 1999.2 C
118.3877 -1936.3 1999.1 1936.2 1997.1 1936.1 1998.5 C
118.3878 -1934.7 2000.1 1932.9 1998.2 1931.6 1999.5 C
118.3879 -1931.3 1998.9 1930.9 1998.5 1931.1 1997.8 C
118.3880 -1931.6 1998.2 1931.3 1996.6 1932 1996.1 C
118.3881 -1933.2 1995.5 1934.3 1996.4 1935.2 1995.4 C
118.3882 -1935.5 1996.5 1936.3 1996.1 1935.6 1995.2 C
118.3883 -1934.7 1994.5 1932.5 1995.3 1932 1995.4 C
118.3884 -1930.5 1995.3 1931.9 1996.5 1930.8 1996.4 C
118.3885 -1931.2 1997.9 1929.5 1998.3 1928.9 1998.5 C
118.3886 -1928.1 1997.9 1927.1 1998 1926 1998 C
118.3887 -1925.3 1999.2 1924.8 2001.4 1923.2 2001.4 C
118.3888 -1922.6 2000.9 1921 2000.9 1920.3 2000.9 C
118.3889 -1919.7 2001.9 1919.6 2003.5 1918.1 2004 C
118.3890 -1916.9 2004.1 1915.8 2002 1915.2 2003.8 C
118.3891 -1916.7 2004 1917.6 2004.9 1919.6 2004.5 C
118.3892 -1920.7 2005.2 1919.4 2006.3 1919.8 2006.9 C
118.3893 -1919.2 2006.9 1917.7 2007.8 1917.2 2008.6 C
118.3894 -1917.8 2011.6 1919.8 2007.8 1920.5 2010.5 C
118.3895 -1920.8 2011.3 1919.3 2011.6 1920.5 2012 C
118.3896 -1920.8 2012.3 1924 2011.8 1923.2 2014.1 C
118.3897 -1922.6 2013.6 1924.1 2016.1 1924.1 2015.1 C
118.3898 -1925.1 2015.4 1925.9 2015 1926.3 2016.5 C
118.3899 -1926.2 2016.6 1926 2016.8 1925.8 2016.8 C
118.3900 -1925.9 2017.2 1926.2 2017.8 1926.8 2018.2 C
118.3901 -1927.1 2017.6 1927.7 2018 1928.4 2018.2 C
118.3902 -1929.7 2020.1 1927.1 2019.5 1929.4 2021.1 C
118.3903 -1929.9 2020.7 1931.1 2020 1931.1 2019.9 C
118.3904 -[0.21 0.21 0 0]  vc
118.3905 -f 
118.3906 -S 
118.3907 -n
118.3908 -1937.1 2020.8 m
118.3909 -1937.1 2018.3 1937.1 2015.7 1937.1 2013.2 C
118.3910 -1937.1 2015.7 1937.1 2018.3 1937.1 2020.8 C
118.3911 -[0 1 1 0.36]  vc
118.3912 -f 
118.3913 -S 
118.3914 -n
118.3915 -2020.4 2012.2 m
118.3916 -2019.8 2012 2019.3 2011.5 2018.7 2011.7 C
118.3917 -2017.9 2012.1 2018.1 2014.1 2018.4 2014.4 C
118.3918 -2019.6 2014.8 2021.4 2013.7 2020.4 2012.2 C
118.3919 -[0 1 1 0.23]  vc
118.3920 -f 
118.3921 -S 
118.3922 -n
118.3923 -1976 2013.9 m
118.3924 -1973.8 2011.5 1971.6 2009.1 1969.5 2006.7 C
118.3925 -1971.6 2009.1 1973.8 2011.5 1976 2013.9 C
118.3926 -[0 1 1 0.36]  vc
118.3927 -f 
118.3928 -S 
118.3929 -n
118.3930 -1995.4 2012.7 m
118.3931 -1996.1 2010.3 1993.8 2006.2 1997.3 2005.7 C
118.3932 -1998.9 2005.4 2000 2003.7 2001.4 2003.1 C
118.3933 -2003.9 2003.1 2005.3 2001.3 2006.9 1999.7 C
118.3934 -2004.5 2003.5 2000 2002.2 1997.6 2005.7 C
118.3935 -1996.5 2005.9 1994.8 2006.1 1995.2 2007.6 C
118.3936 -1995.7 2009.4 1995.2 2011.6 1994.7 2012.9 C
118.3937 -1992 2015.8 1987.8 2015.7 1985.3 2018.7 C
118.3938 -1988.3 2016.3 1992.3 2015.3 1995.4 2012.7 C
118.3939 -[0.18 0.18 0 0.78]  vc
118.3940 -f 
118.3941 -S 
118.3942 -n
118.3943 -1995.6 2012.4 m
118.3944 -1995.6 2011.2 1995.6 2010 1995.6 2008.8 C
118.3945 -1995.6 2010 1995.6 2011.2 1995.6 2012.4 C
118.3946 -[0 1 1 0.36]  vc
118.3947 -f 
118.3948 -S 
118.3949 -n
118.3950 -vmrs
118.3951 -2017.7 2009.6 m
118.3952 -2016.9 2009.3 2016.7 2008.4 2015.8 2009.1 C
118.3953 -2014.2 2010.6 2016 2010.6 2016.5 2011.5 C
118.3954 -2017.2 2010.9 2018.1 2010.8 2017.7 2009.6 C
118.3955 -[0 1 1 0.23]  vc
118.3956 -f 
118.3957 -0.4 w
118.3958 -2 J
118.3959 -2 M
118.3960 -S 
118.3961 -n
118.3962 -2014.4 2006.4 m
118.3963 -2013.5 2006.8 2012.1 2005.6 2012 2006.7 C
118.3964 -2013 2007.3 2011.9 2009.2 2012.9 2008.4 C
118.3965 -2014.2 2008.3 2014.6 2007.8 2014.4 2006.4 C
118.3966 -f 
118.3967 -S 
118.3968 -n
118.3969 -1969 2006.4 m
118.3970 -1966.5 2003.8 1964 2001.2 1961.6 1998.5 C
118.3971 -1964 2001.2 1966.5 2003.8 1969 2006.4 C
118.3972 -[0 1 1 0.36]  vc
118.3973 -f 
118.3974 -S 
118.3975 -n
118.3976 -2012 2005.2 m
118.3977 -2012.2 2004.2 2011.4 2003.3 2010.3 2003.3 C
118.3978 -2009 2003.6 2010 2004.7 2009.6 2004.8 C
118.3979 -2009.3 2005.7 2011.4 2006.7 2012 2005.2 C
118.3980 -[0 1 1 0.23]  vc
118.3981 -f 
118.3982 -S 
118.3983 -n
118.3984 -1962.8 1995.2 m
118.3985 -1961.7 1994.4 1960.6 1993.7 1959.4 1994 C
118.3986 -1959.5 1994.9 1957.5 1994.1 1956.8 1994.7 C
118.3987 -1955.9 1995.5 1956.7 1997 1955.1 1997.3 C
118.3988 -1956.9 1996.7 1956.8 1994 1959.2 1994.7 C
118.3989 -1961.1 1991 1968.9 2003.2 1962.8 1995.2 C
118.3990 -[0 1 1 0.36]  vc
118.3991 -f 
118.3992 -S 
118.3993 -n
118.3994 -1954.6 1995.6 m
118.3995 -1955.9 1994.7 1955.1 1989.8 1955.3 1988 C
118.3996 -1954.5 1988.3 1954.9 1986.6 1954.4 1986 C
118.3997 -1955.7 1989.2 1953.9 1991.1 1954.8 1994.2 C
118.3998 -1954.5 1995.9 1953.5 1995.3 1953.9 1997.3 C
118.3999 -1955.3 1998.3 1953.2 1995.5 1954.6 1995.6 C
118.4000 -f 
118.4001 -S 
118.4002 -n
118.4003 -1992.3 2011 m
118.4004 -1992.5 2006.7 1992 2000.3 1991.8 1997.6 C
118.4005 -1992.2 1997.9 1992 1998.5 1992 1999 C
118.4006 -1992.1 1994.7 1991.9 1990.2 1992.3 1986 C
118.4007 -1991.4 1984.6 1991 1986.1 1990.6 1985.6 C
118.4008 -1989.7 1986 1990.3 1987.2 1990.1 1988 C
118.4009 -1990.7 1987.4 1990.4 1988.5 1990.8 1988.7 C
118.4010 -1991.3 1997.1 1988.9 2000.6 1991.1 2007.9 C
118.4011 -1991 2009.1 1989.8 2009.9 1988.4 2008.8 C
118.4012 -1985.7 2007.2 1986.8 2004.5 1984.1 2004 C
118.4013 -1984.2 2002.7 1981.9 2003.7 1982.4 2001.4 C
118.4014 -1981.2 2001.5 1980.5 2000.8 1980 2000 C
118.4015 -1980 1999.8 1980 1998.9 1980 1999.5 C
118.4016 -1979.3 1999.5 1979.7 1997.2 1977.9 1998 C
118.4017 -1977.2 1997.3 1976.6 1996.7 1977.2 1997.8 C
118.4018 -1979 1998.7 1979.3 2000.8 1981.5 2001.6 C
118.4019 -1982.2 2002.8 1983 2004.3 1984.4 2004.3 C
118.4020 -1985 2005.8 1986.2 2007.5 1987.7 2009.1 C
118.4021 -1989 2010 1991.3 2010.2 1990.8 2012.2 C
118.4022 -1991.2 2011.4 1992.2 2011.8 1992.3 2011 C
118.4023 -[0 1 1 0.23]  vc
118.4024 -f 
118.4025 -S 
118.4026 -n
118.4027 -1991.8 1995.6 m
118.4028 -1991.8 1994.3 1991.8 1992.9 1991.8 1991.6 C
118.4029 -1991.8 1992.9 1991.8 1994.3 1991.8 1995.6 C
118.4030 -[0 1 1 0.36]  vc
118.4031 -f 
118.4032 -S 
118.4033 -n
118.4034 -1959.2 1994.2 m
118.4035 -1958.8 1993.3 1960.7 1993.9 1961.1 1993.7 C
118.4036 -1961.5 1993.9 1961.2 1994.4 1961.8 1994.2 C
118.4037 -1960.9 1994 1960.8 1992.9 1959.9 1992.5 C
118.4038 -1959.6 1993.5 1958.3 1993.5 1958.2 1994.2 C
118.4039 -1958.1 1994.1 1958 1994 1958 1994 C
118.4040 -1957.2 1994.9 1958 1993.4 1956.8 1993 C
118.4041 -1955.6 1992.5 1956 1991 1956.3 1989.9 C
118.4042 -1956.5 1989.8 1956.6 1990 1956.8 1990.1 C
118.4043 -1957.1 1989 1956 1989.1 1955.8 1988.2 C
118.4044 -1955.1 1990.4 1956.2 1995 1954.8 1995.9 C
118.4045 -1954.1 1995.5 1954.5 1996.5 1954.4 1997.1 C
118.4046 -1955 1996.8 1954.8 1997.4 1955.6 1996.8 C
118.4047 -1956 1996 1956.3 1993.2 1958.7 1994.2 C
118.4048 -1958.9 1994.2 1959.7 1994.2 1959.2 1994.2 C
118.4049 -[0 1 1 0.23]  vc
118.4050 -f 
118.4051 -S 
118.4052 -n
118.4053 -1958.2 1994 m
118.4054 -1958.4 1993.5 1959.7 1993.1 1959.9 1992 C
118.4055 -1959.7 1992.5 1959.3 1992 1959.4 1991.8 C
118.4056 -1959.4 1991.6 1959.4 1990.8 1959.4 1991.3 C
118.4057 -1959.2 1991.8 1958.8 1991.3 1958.9 1991.1 C
118.4058 -1958.9 1990.5 1958 1990.3 1957.5 1989.9 C
118.4059 -1956.8 1989.5 1956.9 1991 1956.3 1990.1 C
118.4060 -1956.7 1991 1955.4 1992.1 1956.5 1992.3 C
118.4061 -1956.8 1993.5 1958.3 1992.9 1957.2 1994 C
118.4062 -1957.8 1994.3 1958.1 1992.4 1958.2 1994 C
118.4063 -[0 0.5 0.5 0.2]  vc
118.4064 -f 
118.4065 -S 
118.4066 -n
118.4067 -vmrs
118.4068 -1954.4 1982.7 m
118.4069 -1956.1 1982.7 1954.1 1982.5 1953.9 1982.9 C
118.4070 -1953.9 1983.7 1953.7 1984.7 1954.1 1985.3 C
118.4071 -1954.4 1984.2 1953.6 1983.6 1954.4 1982.7 C
118.4072 -[0 1 1 0.36]  vc
118.4073 -f 
118.4074 -0.4 w
118.4075 -2 J
118.4076 -2 M
118.4077 -S 
118.4078 -n
118.4079 -1989.6 1982.9 m
118.4080 -1989.1 1982.7 1988.6 1982.3 1988 1982.4 C
118.4081 -1987.2 1982.8 1987.4 1984.8 1987.7 1985.1 C
118.4082 -1988.9 1985.6 1990.7 1984.4 1989.6 1982.9 C
118.4083 -[0 1 1 0.23]  vc
118.4084 -f 
118.4085 -S 
118.4086 -n
118.4087 -1987 1980.3 m
118.4088 -1986.2 1980 1986 1979.1 1985.1 1979.8 C
118.4089 -1983.5 1981.4 1985.3 1981.4 1985.8 1982.2 C
118.4090 -1986.5 1981.7 1987.4 1981.5 1987 1980.3 C
118.4091 -f 
118.4092 -S 
118.4093 -n
118.4094 -1983.6 1977.2 m
118.4095 -1982.7 1977.5 1981.4 1976.3 1981.2 1977.4 C
118.4096 -1982.3 1978 1981.2 1979.9 1982.2 1979.1 C
118.4097 -1983.5 1979 1983.9 1978.5 1983.6 1977.2 C
118.4098 -f 
118.4099 -S 
118.4100 -n
118.4101 -1981.2 1976 m
118.4102 -1981.5 1974.9 1980.6 1974 1979.6 1974 C
118.4103 -1978.3 1974.3 1979.3 1975.4 1978.8 1975.5 C
118.4104 -1978.6 1976.4 1980.7 1977.4 1981.2 1976 C
118.4105 -f 
118.4106 -S 
118.4107 -n
118.4108 -1972.1 2082.3 m
118.4109 -1971.8 2081.8 1971.3 2080.9 1971.2 2080.1 C
118.4110 -1971.1 2072.9 1971.3 2064.6 1970.9 2058.3 C
118.4111 -1970.3 2058.5 1970.1 2057.7 1969.7 2058.5 C
118.4112 -1970.6 2058.5 1969.7 2059 1970.2 2059.2 C
118.4113 -1970.2 2065.4 1970.2 2072.4 1970.2 2077.7 C
118.4114 -1971.1 2078.9 1970.6 2078.9 1970.4 2079.9 C
118.4115 -1969.2 2080.2 1968.2 2080.4 1967.3 2079.6 C
118.4116 -1966.8 2077.8 1963.4 2076.3 1963.5 2075.1 C
118.4117 -1961.5 2075.5 1962 2071.5 1959.6 2072 C
118.4118 -1959.2 2070 1956.5 2069.3 1955.8 2067.6 C
118.4119 -1956 2068.4 1955.3 2069.7 1956.5 2069.8 C
118.4120 -1958.6 2068.9 1958.1 2073.5 1960.1 2072.4 C
118.4121 -1960.7 2075.9 1964.7 2074.6 1964.2 2078 C
118.4122 -1967.2 2078.6 1967.9 2081.6 1970.7 2080.6 C
118.4123 -1970.3 2081.1 1971.5 2081.2 1971.9 2082.3 C
118.4124 -1967.2 2084.3 1962.9 2087.1 1958.2 2089 C
118.4125 -1962.9 2087 1967.4 2084.4 1972.1 2082.3 C
118.4126 -[0 0.2 1 0]  vc
118.4127 -f 
118.4128 -S 
118.4129 -n
118.4130 -1971.9 2080.1 m
118.4131 -1971.9 2075.1 1971.9 2070 1971.9 2065 C
118.4132 -1971.9 2070 1971.9 2075.1 1971.9 2080.1 C
118.4133 -[0 1 1 0.23]  vc
118.4134 -f 
118.4135 -S 
118.4136 -n
118.4137 -2010.8 2050.6 m
118.4138 -2013.2 2049 2010.5 2050.1 2010.5 2051.3 C
118.4139 -2010.5 2057.7 2010.5 2064.1 2010.5 2070.5 C
118.4140 -2008.7 2072.4 2006 2073.3 2003.6 2074.4 C
118.4141 -2016.4 2073.7 2008 2058.4 2010.8 2050.6 C
118.4142 -[0.4 0.4 0 0]  vc
118.4143 -f 
118.4144 -S 
118.4145 -n
118.4146 -2006.4 2066.9 m
118.4147 -2006.4 2061.9 2006.4 2056.8 2006.4 2051.8 C
118.4148 -2006.4 2056.8 2006.4 2061.9 2006.4 2066.9 C
118.4149 -[0 1 1 0.23]  vc
118.4150 -f 
118.4151 -S 
118.4152 -n
118.4153 -1971.9 2060.7 m
118.4154 -1972.2 2060.3 1971.4 2068.2 1972.4 2061.9 C
118.4155 -1971.8 2061.6 1972.4 2060.9 1971.9 2060.7 C
118.4156 -f 
118.4157 -S 
118.4158 -n
118.4159 -vmrs
118.4160 -1986.5 2055.2 m
118.4161 -1987.5 2054.3 1986.3 2053.4 1986 2052.8 C
118.4162 -1983.8 2052.7 1983.6 2050.1 1981.7 2049.6 C
118.4163 -1981.2 2048.7 1980.8 2047 1980.3 2046.8 C
118.4164 -1978.5 2047 1978 2044.6 1976.7 2043.9 C
118.4165 -1974 2044.4 1972 2046.6 1969.2 2047 C
118.4166 -1969 2047.2 1968.8 2047.5 1968.5 2047.7 C
118.4167 -1970.6 2049.6 1973.1 2051.3 1974.3 2054.2 C
118.4168 -1975.7 2054.5 1977 2055.2 1976.4 2057.1 C
118.4169 -1976.7 2058 1975.5 2058.5 1976 2059.5 C
118.4170 -1979.2 2058 1983 2056.6 1986.5 2055.2 C
118.4171 -[0 0.5 0.5 0.2]  vc
118.4172 -f 
118.4173 -0.4 w
118.4174 -2 J
118.4175 -2 M
118.4176 -S 
118.4177 -n
118.4178 -1970.2 2054.2 m
118.4179 -1971.5 2055.3 1972.5 2056.8 1972.1 2058.3 C
118.4180 -1972.8 2056.5 1971.6 2055.6 1970.2 2054.2 C
118.4181 -[0 1 1 0.23]  vc
118.4182 -f 
118.4183 -S 
118.4184 -n
118.4185 -1992 2052.5 m
118.4186 -1992 2053.4 1992.2 2054.4 1991.8 2055.2 C
118.4187 -1992.2 2054.4 1992 2053.4 1992 2052.5 C
118.4188 -f 
118.4189 -S 
118.4190 -n
118.4191 -1957.2 2053 m
118.4192 -1958.1 2052.6 1959 2052.2 1959.9 2051.8 C
118.4193 -1959 2052.2 1958.1 2052.6 1957.2 2053 C
118.4194 -f 
118.4195 -S 
118.4196 -n
118.4197 -2006.4 2047.5 m
118.4198 -2006.8 2047.1 2006 2055 2006.9 2048.7 C
118.4199 -2006.4 2048.4 2007 2047.7 2006.4 2047.5 C
118.4200 -f 
118.4201 -S 
118.4202 -n
118.4203 -2004.8 2041 m
118.4204 -2006.1 2042.1 2007.1 2043.6 2006.7 2045.1 C
118.4205 -2007.3 2043.3 2006.2 2042.4 2004.8 2041 C
118.4206 -f 
118.4207 -S 
118.4208 -n
118.4209 -1976 2039.8 m
118.4210 -1975.6 2039.3 1975.2 2038.4 1975 2037.6 C
118.4211 -1974.9 2030.4 1975.2 2022.1 1974.8 2015.8 C
118.4212 -1974.2 2016 1974 2015.3 1973.6 2016 C
118.4213 -1974.4 2016 1973.5 2016.5 1974 2016.8 C
118.4214 -1974 2022.9 1974 2030 1974 2035.2 C
118.4215 -1974.9 2036.4 1974.4 2036.4 1974.3 2037.4 C
118.4216 -1973.1 2037.7 1972 2037.9 1971.2 2037.2 C
118.4217 -1970.6 2035.3 1967.3 2033.9 1967.3 2032.6 C
118.4218 -1965.3 2033 1965.9 2029.1 1963.5 2029.5 C
118.4219 -1963 2027.6 1960.4 2026.8 1959.6 2025.2 C
118.4220 -1959.8 2025.9 1959.2 2027.2 1960.4 2027.3 C
118.4221 -1962.5 2026.4 1961.9 2031 1964 2030 C
118.4222 -1964.6 2033.4 1968.5 2032.1 1968 2035.5 C
118.4223 -1971 2036.1 1971.8 2039.1 1974.5 2038.1 C
118.4224 -1974.2 2038.7 1975.3 2038.7 1975.7 2039.8 C
118.4225 -1971 2041.8 1966.7 2044.6 1962 2046.5 C
118.4226 -1966.8 2044.5 1971.3 2041.9 1976 2039.8 C
118.4227 -[0 0.2 1 0]  vc
118.4228 -f 
118.4229 -S 
118.4230 -n
118.4231 -1975.7 2037.6 m
118.4232 -1975.7 2032.6 1975.7 2027.6 1975.7 2022.5 C
118.4233 -1975.7 2027.6 1975.7 2032.6 1975.7 2037.6 C
118.4234 -[0 1 1 0.23]  vc
118.4235 -f 
118.4236 -S 
118.4237 -n
118.4238 -1992 2035.5 m
118.4239 -1992 2034.2 1992 2032.9 1992 2031.6 C
118.4240 -1992 2032.9 1992 2034.2 1992 2035.5 C
118.4241 -f 
118.4242 -S 
118.4243 -n
118.4244 -2015.3 2036 m
118.4245 -2015.4 2034.1 2013.3 2034 2012.9 2033.3 C
118.4246 -2011.5 2031 2009.3 2029.4 2007.4 2028 C
118.4247 -2006.9 2027.1 2006.6 2023.8 2005 2024.9 C
118.4248 -2004 2024.9 2002.9 2024.9 2001.9 2024.9 C
118.4249 -2001.4 2026.5 2001 2028.4 2003.8 2028.3 C
118.4250 -2006.6 2030.4 2008.9 2033.7 2011.2 2036.2 C
118.4251 -2011.8 2036.4 2012.9 2035.8 2012.9 2036.7 C
118.4252 -2013 2035.5 2015.3 2037.4 2015.3 2036 C
118.4253 -[0 0 0 0]  vc
118.4254 -f 
118.4255 -S 
118.4256 -n
118.4257 -vmrs
118.4258 -2009.1 2030.4 m
118.4259 -2009.1 2029 2007.5 2029.4 2006.9 2028.3 C
118.4260 -2007.2 2027.1 2006.5 2025.5 2005.7 2024.7 C
118.4261 -2004.6 2025.1 2003.1 2024.9 2001.9 2024.9 C
118.4262 -2001.8 2026.2 2000.9 2027 2002.4 2028 C
118.4263 -2004.5 2027.3 2004.9 2029.4 2006.9 2029 C
118.4264 -2007 2030.2 2007.6 2030.7 2008.4 2031.4 C
118.4265 -2008.8 2031.5 2009.1 2031.1 2009.1 2030.4 C
118.4266 -[0 0 0 0.18]  vc
118.4267 -f 
118.4268 -0.4 w
118.4269 -2 J
118.4270 -2 M
118.4271 -S 
118.4272 -n
118.4273 -2003.8 2029.5 m
118.4274 -2003 2029.4 2001.9 2029.1 2002.4 2030.4 C
118.4275 -2003.1 2031.3 2005.2 2030.3 2003.8 2029.5 C
118.4276 -[0 1 1 0.23]  vc
118.4277 -f 
118.4278 -S 
118.4279 -n
118.4280 -1999.2 2025.2 m
118.4281 -1999.1 2025.6 1998 2025.7 1998.8 2026.6 C
118.4282 -2000.9 2028.5 1999.5 2023.4 1999.2 2025.2 C
118.4283 -f 
118.4284 -S 
118.4285 -n
118.4286 -2007.6 2024.2 m
118.4287 -2007.6 2022.9 2008.4 2024.2 2007.6 2022.8 C
118.4288 -2007.6 2017.5 2007.8 2009.1 2007.4 2003.8 C
118.4289 -2007.9 2003.7 2008.7 2002.8 2009.1 2002.1 C
118.4290 -2009.6 2000.8 2008.3 2000.8 2007.9 2000.2 C
118.4291 -2004.9 2000 2008.9 2001.3 2007.2 2002.1 C
118.4292 -2006.7 2007.7 2007 2015.1 2006.9 2021.1 C
118.4293 -2006.7 2022.1 2005.4 2022.8 2006.2 2023.5 C
118.4294 -2006.6 2023.1 2008 2025.9 2007.6 2024.2 C
118.4295 -f 
118.4296 -S 
118.4297 -n
118.4298 -1989.9 2023.5 m
118.4299 -1989.5 2022.6 1991.4 2023.2 1991.8 2023 C
118.4300 -1992.2 2023.2 1991.9 2023.7 1992.5 2023.5 C
118.4301 -1991.6 2023.2 1991.6 2022.2 1990.6 2021.8 C
118.4302 -1990.4 2022.8 1989 2022.8 1988.9 2023.5 C
118.4303 -1988.5 2023 1988.7 2022.6 1988.7 2023.5 C
118.4304 -1989.1 2023.5 1990.2 2023.5 1989.9 2023.5 C
118.4305 -f 
118.4306 -[0 0.5 0.5 0.2]  vc
118.4307 -S 
118.4308 -n
118.4309 -2003.3 2023.5 m
118.4310 -2003.1 2023.3 2003.1 2023.2 2003.3 2023 C
118.4311 -2003.7 2023.1 2003.9 2022.9 2003.8 2022.5 C
118.4312 -2003.4 2022.2 2001.2 2022.3 2002.4 2023 C
118.4313 -2002.6 2022.9 2002.7 2023.1 2002.8 2023.2 C
118.4314 -2000.7 2023.7 2003.9 2023.4 2003.3 2023.5 C
118.4315 -[0 1 1 0.23]  vc
118.4316 -f 
118.4317 -S 
118.4318 -n
118.4319 -1986.8 2019.4 m
118.4320 -1987.8 2019.8 1987.5 2018.6 1987.2 2018 C
118.4321 -1986.2 2017.8 1987.3 2020.5 1986.3 2019.2 C
118.4322 -1986.3 2017.7 1986.3 2020.6 1986.3 2021.3 C
118.4323 -1988.5 2023.1 1985.6 2020.3 1986.8 2019.4 C
118.4324 -f 
118.4325 -S 
118.4326 -n
118.4327 -1975.7 2018.2 m
118.4328 -1976.1 2017.8 1975.2 2025.7 1976.2 2019.4 C
118.4329 -1975.7 2019.2 1976.3 2018.4 1975.7 2018.2 C
118.4330 -f 
118.4331 -S 
118.4332 -n
118.4333 -1974 2011.7 m
118.4334 -1975.4 2012.8 1976.4 2014.3 1976 2015.8 C
118.4335 -1976.6 2014 1975.5 2013.1 1974 2011.7 C
118.4336 -f 
118.4337 -S 
118.4338 -n
118.4339 -1984.6 2006.7 m
118.4340 -1984.7 2004.8 1982.6 2004.8 1982.2 2004 C
118.4341 -1980.8 2001.7 1978.6 2000.1 1976.7 1998.8 C
118.4342 -1976.1 1997.8 1975.8 1994.5 1974.3 1995.6 C
118.4343 -1973.3 1995.6 1972.2 1995.6 1971.2 1995.6 C
118.4344 -1970.7 1997.2 1970.3 1999.1 1973.1 1999 C
118.4345 -1975.8 2001.2 1978.2 2004.4 1980.5 2006.9 C
118.4346 -1981.1 2007.1 1982.1 2006.5 1982.2 2007.4 C
118.4347 -1982.3 2006.2 1984.5 2008.1 1984.6 2006.7 C
118.4348 -[0 0 0 0]  vc
118.4349 -f 
118.4350 -S 
118.4351 -n
118.4352 -vmrs
118.4353 -1978.4 2001.2 m
118.4354 -1978.4 1999.7 1976.8 2000.1 1976.2 1999 C
118.4355 -1976.5 1997.8 1975.8 1996.2 1975 1995.4 C
118.4356 -1973.9 1995.8 1972.4 1995.6 1971.2 1995.6 C
118.4357 -1971 1997 1970.2 1997.7 1971.6 1998.8 C
118.4358 -1973.8 1998 1974.2 2000.1 1976.2 1999.7 C
118.4359 -1976.3 2000.9 1976.9 2001.4 1977.6 2002.1 C
118.4360 -1978.1 2002.2 1978.4 2001.8 1978.4 2001.2 C
118.4361 -[0 0 0 0.18]  vc
118.4362 -f 
118.4363 -0.4 w
118.4364 -2 J
118.4365 -2 M
118.4366 -S 
118.4367 -n
118.4368 -1973.1 2000.2 m
118.4369 -1972.3 2000.1 1971.2 1999.8 1971.6 2001.2 C
118.4370 -1972.4 2002 1974.5 2001 1973.1 2000.2 C
118.4371 -[0 1 1 0.23]  vc
118.4372 -f 
118.4373 -S 
118.4374 -n
118.4375 -1960.8 1998.5 m
118.4376 -1961.6 1998.2 1962.6 2000.3 1963.2 2000.9 C
118.4377 -1962.3 2000.1 1962.2 1998.7 1960.8 1998.5 C
118.4378 -f 
118.4379 -S 
118.4380 -n
118.4381 -1968.5 1995.9 m
118.4382 -1968.4 1996.4 1967.3 1996.4 1968 1997.3 C
118.4383 -1970.1 1999.2 1968.8 1994.1 1968.5 1995.9 C
118.4384 -f 
118.4385 -S 
118.4386 -n
118.4387 -1976.9 1994.9 m
118.4388 -1976.9 1993.7 1977.6 1994.9 1976.9 1993.5 C
118.4389 -1976.9 1988.2 1977.1 1979.8 1976.7 1974.5 C
118.4390 -1977.2 1974.5 1978 1973.5 1978.4 1972.8 C
118.4391 -1978.8 1971.5 1977.6 1971.5 1977.2 1970.9 C
118.4392 -1974.2 1970.7 1978.2 1972 1976.4 1972.8 C
118.4393 -1976 1978.4 1976.3 1985.8 1976.2 1991.8 C
118.4394 -1976 1992.8 1974.6 1993.5 1975.5 1994.2 C
118.4395 -1975.9 1993.8 1977.3 1996.6 1976.9 1994.9 C
118.4396 -f 
118.4397 -S 
118.4398 -n
118.4399 -1972.6 1994.2 m
118.4400 -1972.4 1994 1972.4 1993.9 1972.6 1993.7 C
118.4401 -1973 1993.8 1973.1 1993.7 1973.1 1993.2 C
118.4402 -1972.7 1992.9 1970.5 1993.1 1971.6 1993.7 C
118.4403 -1971.9 1993.7 1972 1993.8 1972.1 1994 C
118.4404 -1970 1994.4 1973.1 1994.1 1972.6 1994.2 C
118.4405 -f 
118.4406 -S 
118.4407 -n
118.4408 -1948.1 2093.8 m
118.4409 -1947 2092.7 1945.9 2091.6 1944.8 2090.4 C
118.4410 -1945.9 2091.6 1947 2092.7 1948.1 2093.8 C
118.4411 -[0 0.4 1 0]  vc
118.4412 -f 
118.4413 -S 
118.4414 -n
118.4415 -1953.4 2091.4 m
118.4416 -1954.8 2090.7 1956.3 2090 1957.7 2089.2 C
118.4417 -1956.3 2090 1954.8 2090.7 1953.4 2091.4 C
118.4418 -[0 0.2 1 0]  vc
118.4419 -f 
118.4420 -S 
118.4421 -n
118.4422 -1954.1 2091.4 m
118.4423 -1956.6 2089.6 1957.2 2089.6 1954.1 2091.4 C
118.4424 -[0 0.4 1 0]  vc
118.4425 -f 
118.4426 -S 
118.4427 -n
118.4428 -1962.3 2087.3 m
118.4429 -1963.7 2086.6 1965.2 2085.9 1966.6 2085.2 C
118.4430 -1965.2 2085.9 1963.7 2086.6 1962.3 2087.3 C
118.4431 -f 
118.4432 -S 
118.4433 -n
118.4434 -vmrs
118.4435 -1967.1 2084.9 m
118.4436 -1968.3 2084.4 1969.7 2083.8 1970.9 2083.2 C
118.4437 -1969.7 2083.8 1968.3 2084.4 1967.1 2084.9 C
118.4438 -[0 0.4 1 0]  vc
118.4439 -f 
118.4440 -0.4 w
118.4441 -2 J
118.4442 -2 M
118.4443 -S 
118.4444 -n
118.4445 -1982.7 2080.6 m
118.4446 -1981.5 2079.5 1980.5 2078.4 1979.3 2077.2 C
118.4447 -1980.5 2078.4 1981.5 2079.5 1982.7 2080.6 C
118.4448 -f 
118.4449 -S 
118.4450 -n
118.4451 -1988 2078.2 m
118.4452 -1989.4 2077.5 1990.8 2076.8 1992.3 2076 C
118.4453 -1990.8 2076.8 1989.4 2077.5 1988 2078.2 C
118.4454 -[0 0.2 1 0]  vc
118.4455 -f 
118.4456 -S 
118.4457 -n
118.4458 -1988.7 2078.2 m
118.4459 -1991.1 2076.4 1991.8 2076.4 1988.7 2078.2 C
118.4460 -[0 0.4 1 0]  vc
118.4461 -f 
118.4462 -S 
118.4463 -n
118.4464 -1976.2 2063.8 m
118.4465 -1978.6 2062.2 1976 2063.3 1976 2064.5 C
118.4466 -1976.1 2067.8 1975.5 2071.4 1976.4 2074.4 C
118.4467 -1975.7 2071.1 1975.9 2067.2 1976.2 2063.8 C
118.4468 -f 
118.4469 -S 
118.4470 -n
118.4471 -1996.8 2074.1 m
118.4472 -1998.3 2073.4 1999.7 2072.7 2001.2 2072 C
118.4473 -1999.7 2072.7 1998.3 2073.4 1996.8 2074.1 C
118.4474 -f 
118.4475 -S 
118.4476 -n
118.4477 -2001.6 2071.7 m
118.4478 -2002.9 2071.2 2004.2 2070.6 2005.5 2070 C
118.4479 -2004.2 2070.6 2002.9 2071.2 2001.6 2071.7 C
118.4480 -f 
118.4481 -S 
118.4482 -n
118.4483 -1981.5 2060.7 m
118.4484 -1980.2 2061.2 1978.9 2061.5 1977.9 2062.6 C
118.4485 -1978.9 2061.5 1980.2 2061.2 1981.5 2060.7 C
118.4486 -f 
118.4487 -S 
118.4488 -n
118.4489 -1982 2060.4 m
118.4490 -1982.7 2060.1 1983.6 2059.8 1984.4 2059.5 C
118.4491 -1983.6 2059.8 1982.7 2060.1 1982 2060.4 C
118.4492 -f 
118.4493 -S 
118.4494 -n
118.4495 -1952 2051.3 m
118.4496 -1950.8 2050.2 1949.7 2049.1 1948.6 2048 C
118.4497 -1949.7 2049.1 1950.8 2050.2 1952 2051.3 C
118.4498 -f 
118.4499 -S 
118.4500 -n
118.4501 -vmrs
118.4502 -1977.4 2047.7 m
118.4503 -1975.8 2047.8 1974.8 2046.1 1974.5 2045.3 C
118.4504 -1974.9 2044.4 1976 2044.5 1976.7 2044.8 C
118.4505 -1977.9 2045 1977 2048.4 1979.3 2047.5 C
118.4506 -1979.9 2047.5 1980.8 2048.6 1979.8 2049.2 C
118.4507 -1978.2 2050.4 1980.8 2049.5 1980.3 2049.4 C
118.4508 -1981.4 2049.8 1980.3 2048.4 1980.3 2048 C
118.4509 -1979.8 2047.5 1979 2046.6 1978.4 2046.5 C
118.4510 -1977.3 2045.9 1977.2 2043.3 1975.2 2044.6 C
118.4511 -1974.7 2045.3 1973.6 2045 1973.3 2045.8 C
118.4512 -1975 2046.3 1975.8 2049.8 1978.1 2049.4 C
118.4513 -1978.4 2050.9 1978.7 2048.5 1977.9 2049.2 C
118.4514 -1977.7 2048.7 1977.2 2047.8 1977.4 2047.7 C
118.4515 -[0 0.5 0.5 0.2]  vc
118.4516 -f 
118.4517 -0.4 w
118.4518 -2 J
118.4519 -2 M
118.4520 -S 
118.4521 -n
118.4522 -1957.2 2048.9 m
118.4523 -1958.7 2048.2 1960.1 2047.5 1961.6 2046.8 C
118.4524 -1960.1 2047.5 1958.7 2048.2 1957.2 2048.9 C
118.4525 -[0 0.2 1 0]  vc
118.4526 -f 
118.4527 -S 
118.4528 -n
118.4529 -1958 2048.9 m
118.4530 -1960.4 2047.1 1961.1 2047.1 1958 2048.9 C
118.4531 -[0 0.4 1 0]  vc
118.4532 -f 
118.4533 -S 
118.4534 -n
118.4535 -1966.1 2044.8 m
118.4536 -1967.6 2044.1 1969 2043.4 1970.4 2042.7 C
118.4537 -1969 2043.4 1967.6 2044.1 1966.1 2044.8 C
118.4538 -f 
118.4539 -S 
118.4540 -n
118.4541 -1970.9 2042.4 m
118.4542 -1972.2 2041.9 1973.5 2041.3 1974.8 2040.8 C
118.4543 -1973.5 2041.3 1972.2 2041.9 1970.9 2042.4 C
118.4544 -f 
118.4545 -S 
118.4546 -n
118.4547 -2012 2034.5 m
118.4548 -2010.4 2034.6 2009.3 2032.9 2009.1 2032.1 C
118.4549 -2009.4 2031 2010.3 2031.3 2011.2 2031.6 C
118.4550 -2012.5 2031.8 2011.6 2035.2 2013.9 2034.3 C
118.4551 -2014.4 2034.3 2015.4 2035.4 2014.4 2036 C
118.4552 -2012.7 2037.2 2015.3 2036.3 2014.8 2036.2 C
118.4553 -2015.9 2036.6 2014.8 2035.2 2014.8 2034.8 C
118.4554 -2014.4 2034.3 2013.6 2033.4 2012.9 2033.3 C
118.4555 -2011.5 2031 2009.3 2029.4 2007.4 2028 C
118.4556 -2007.5 2026.5 2007.3 2027.9 2007.2 2028.3 C
118.4557 -2007.9 2028.8 2008.7 2029.1 2009.3 2030 C
118.4558 -2009.6 2030.7 2009 2031.9 2008.4 2031.6 C
118.4559 -2006.7 2031 2007.7 2028 2005 2028.8 C
118.4560 -2004.8 2028.6 2004.3 2028.2 2003.8 2028.3 C
118.4561 -2006.6 2030.4 2008.9 2033.7 2011.2 2036.2 C
118.4562 -2011.8 2036.4 2012.9 2035.8 2012.9 2036.7 C
118.4563 -2012.7 2036.1 2011.8 2035 2012 2034.5 C
118.4564 -[0 0.5 0.5 0.2]  vc
118.4565 -f 
118.4566 -S 
118.4567 -n
118.4568 -1981.2 2005.2 m
118.4569 -1979.7 2005.3 1978.6 2003.6 1978.4 2002.8 C
118.4570 -1978.7 2001.8 1979.6 2002.1 1980.5 2002.4 C
118.4571 -1981.8 2002.5 1980.9 2005.9 1983.2 2005 C
118.4572 -1983.7 2005.1 1984.7 2006.1 1983.6 2006.7 C
118.4573 -1982 2007.9 1984.6 2007 1984.1 2006.9 C
118.4574 -1985.2 2007.3 1984.1 2006 1984.1 2005.5 C
118.4575 -1983.6 2005 1982.9 2004.1 1982.2 2004 C
118.4576 -1980.8 2001.7 1978.6 2000.1 1976.7 1998.8 C
118.4577 -1976.7 1997.2 1976.6 1998.6 1976.4 1999 C
118.4578 -1977.2 1999.5 1978 1999.8 1978.6 2000.7 C
118.4579 -1978.8 2001.5 1978.3 2002.7 1977.6 2002.4 C
118.4580 -1976 2001.8 1977 1998.7 1974.3 1999.5 C
118.4581 -1974.1 1999.3 1973.6 1998.9 1973.1 1999 C
118.4582 -1975.8 2001.2 1978.2 2004.4 1980.5 2006.9 C
118.4583 -1981.1 2007.1 1982.1 2006.5 1982.2 2007.4 C
118.4584 -1982 2006.8 1981.1 2005.7 1981.2 2005.2 C
118.4585 -f 
118.4586 -S 
118.4587 -n
118.4588 -1966.8 1976.4 m
118.4589 -1969.4 1973 1974.4 1974.6 1976.2 1970.4 C
118.4590 -1972.7 1974 1968 1975.1 1964 1977.4 C
118.4591 -1960.9 1979.9 1957.1 1981.8 1953.9 1982.7 C
118.4592 -1958.4 1981.1 1962.6 1978.8 1966.8 1976.4 C
118.4593 -[0.18 0.18 0 0.78]  vc
118.4594 -f 
118.4595 -S 
118.4596 -n
118.4597 -1948.4 2093.8 m
118.4598 -1949.8 2093.1 1951.2 2092.5 1952.7 2091.9 C
118.4599 -1951.2 2092.5 1949.8 2093.1 1948.4 2093.8 C
118.4600 -[0 0.2 1 0]  vc
118.4601 -f 
118.4602 -S 
118.4603 -n
118.4604 -1948.1 2093.6 m
118.4605 -1947.3 2092.8 1946.5 2091.9 1945.7 2091.2 C
118.4606 -1946.5 2091.9 1947.3 2092.8 1948.1 2093.6 C
118.4607 -f 
118.4608 -S 
118.4609 -n
118.4610 -vmrs
118.4611 -1942.1 2087.8 m
118.4612 -1943.5 2088.4 1944.3 2089.5 1945.2 2090.7 C
118.4613 -1944.8 2089.3 1943.3 2088.3 1942.1 2087.8 C
118.4614 -[0 0.2 1 0]  vc
118.4615 -f 
118.4616 -0.4 w
118.4617 -2 J
118.4618 -2 M
118.4619 -S 
118.4620 -n
118.4621 -1933.5 2078.4 m
118.4622 -1933.5 2078 1933.2 2079 1933.7 2079.4 C
118.4623 -1935 2080.4 1936.2 2081.3 1937.1 2082.8 C
118.4624 -1936.7 2080.7 1933.7 2080.7 1933.5 2078.4 C
118.4625 -f 
118.4626 -S 
118.4627 -n
118.4628 -1982.9 2080.6 m
118.4629 -1984.4 2079.9 1985.8 2079.3 1987.2 2078.7 C
118.4630 -1985.8 2079.3 1984.4 2079.9 1982.9 2080.6 C
118.4631 -f 
118.4632 -S 
118.4633 -n
118.4634 -1982.7 2080.4 m
118.4635 -1981.9 2079.6 1981.1 2078.7 1980.3 2078 C
118.4636 -1981.1 2078.7 1981.9 2079.6 1982.7 2080.4 C
118.4637 -f 
118.4638 -S 
118.4639 -n
118.4640 -1977.4 2075.1 m
118.4641 -1977.9 2075.3 1979.1 2076.4 1979.8 2077.5 C
118.4642 -1979 2076.8 1978.7 2075.1 1977.4 2075.1 C
118.4643 -f 
118.4644 -S 
118.4645 -n
118.4646 -1952.2 2051.3 m
118.4647 -1953.6 2050.7 1955.1 2050.1 1956.5 2049.4 C
118.4648 -1955.1 2050.1 1953.6 2050.7 1952.2 2051.3 C
118.4649 -f 
118.4650 -S 
118.4651 -n
118.4652 -1952 2051.1 m
118.4653 -1951.2 2050.3 1950.3 2049.5 1949.6 2048.7 C
118.4654 -1950.3 2049.5 1951.2 2050.3 1952 2051.1 C
118.4655 -f 
118.4656 -S 
118.4657 -n
118.4658 -1946 2045.3 m
118.4659 -1947.3 2045.9 1948.1 2047 1949.1 2048.2 C
118.4660 -1948.6 2046.8 1947.1 2045.8 1946 2045.3 C
118.4661 -f 
118.4662 -S 
118.4663 -n
118.4664 -1937.3 2036 m
118.4665 -1937.4 2035.5 1937 2036.5 1937.6 2036.9 C
118.4666 -1938.8 2037.9 1940.1 2038.8 1940.9 2040.3 C
118.4667 -1940.6 2038.2 1937.6 2038.2 1937.3 2036 C
118.4668 -f 
118.4669 -S 
118.4670 -n
118.4671 -1935.2 2073.2 m
118.4672 -1936.4 2069.9 1935.8 2061.8 1935.6 2056.4 C
118.4673 -1935.8 2055.9 1936.3 2055.7 1936.1 2055.2 C
118.4674 -1935.7 2054.7 1935 2055 1934.4 2054.9 C
118.4675 -1934.4 2061.5 1934.4 2068.7 1934.4 2074.6 C
118.4676 -1935.7 2075.1 1936 2073.7 1935.2 2073.2 C
118.4677 -[0 0.01 1 0]  vc
118.4678 -f 
118.4679 -S 
118.4680 -n
118.4681 -vmrs
118.4682 -1939 2030.7 m
118.4683 -1940.3 2027.4 1939.7 2019.3 1939.5 2013.9 C
118.4684 -1939.7 2013.5 1940.1 2013.2 1940 2012.7 C
118.4685 -1939.5 2012.3 1938.8 2012.5 1938.3 2012.4 C
118.4686 -1938.3 2019 1938.3 2026.2 1938.3 2032.1 C
118.4687 -1939.5 2032.7 1939.8 2031.2 1939 2030.7 C
118.4688 -[0 0.01 1 0]  vc
118.4689 -f 
118.4690 -0.4 w
118.4691 -2 J
118.4692 -2 M
118.4693 -S 
118.4694 -n
118.4695 -1975.2 2077.2 m
118.4696 -1975.3 2077.3 1975.4 2077.4 1975.5 2077.5 C
118.4697 -1974.7 2073.2 1974.9 2067.5 1975.2 2063.6 C
118.4698 -1975.4 2064 1974.6 2063.9 1974.8 2064.3 C
118.4699 -1974.9 2069.9 1974.3 2076.5 1975.2 2081.1 C
118.4700 -1974.9 2079.9 1974.9 2078.4 1975.2 2077.2 C
118.4701 -[0.92 0.92 0 0.67]  vc
118.4702 -f 
118.4703 -S 
118.4704 -n
118.4705 -1930.8 2067.4 m
118.4706 -1931.5 2070.1 1929.6 2072.1 1930.6 2074.6 C
118.4707 -1931 2072.6 1930.8 2069.8 1930.8 2067.4 C
118.4708 -f 
118.4709 -S 
118.4710 -n
118.4711 -2010 2050.1 m
118.4712 -2009.8 2050.5 2009.5 2050.9 2009.3 2051.1 C
118.4713 -2009.5 2056.7 2008.9 2063.3 2009.8 2067.9 C
118.4714 -2009.5 2062.1 2009.3 2054.7 2010 2050.1 C
118.4715 -f 
118.4716 -S 
118.4717 -n
118.4718 -1930.1 2060.9 m
118.4719 -1929.3 2057.1 1930.7 2054.8 1929.9 2051.3 C
118.4720 -1930.2 2050.2 1931.1 2049.6 1931.8 2049.2 C
118.4721 -1931.4 2049.6 1930.4 2049.5 1930.1 2050.1 C
118.4722 -1928.4 2054.8 1933.4 2063.5 1925.3 2064.3 C
118.4723 -1927.2 2063.9 1928.5 2062.1 1930.1 2060.9 C
118.4724 -[0.07 0.06 0 0.58]  vc
118.4725 -f 
118.4726 -S 
118.4727 -n
118.4728 -1929.6 2061.2 m
118.4729 -1929.6 2057.6 1929.6 2054.1 1929.6 2050.6 C
118.4730 -1930 2049.9 1930.5 2049.4 1931.1 2049.2 C
118.4731 -1930 2048.6 1930.5 2050.2 1929.4 2049.6 C
118.4732 -1928 2054.4 1932.8 2063 1925.3 2064 C
118.4733 -1926.9 2063.3 1928.3 2062.4 1929.6 2061.2 C
118.4734 -[0.4 0.4 0 0]  vc
118.4735 -f 
118.4736 -S 
118.4737 -n
118.4738 -1930.8 2061.6 m
118.4739 -1930.5 2058 1931.6 2054 1930.8 2051.3 C
118.4740 -1930.3 2054.5 1930.9 2058.5 1930.4 2061.9 C
118.4741 -1930.5 2061.2 1931 2062.2 1930.8 2061.6 C
118.4742 -[0.92 0.92 0 0.67]  vc
118.4743 -f 
118.4744 -S 
118.4745 -n
118.4746 -1941.2 2045.1 m
118.4747 -1939.7 2042.6 1937.3 2041.2 1935.4 2039.3 C
118.4748 -1934.2 2040 1933.7 2036.4 1934 2039.3 C
118.4749 -1934.9 2040.1 1936.1 2039.9 1936.8 2040.8 C
118.4750 -1935.3 2044.2 1942.3 2041.7 1939.5 2046 C
118.4751 -1937.1 2048.5 1940.5 2045.6 1941.2 2045.1 C
118.4752 -f 
118.4753 -S 
118.4754 -n
118.4755 -1910 2045.8 m
118.4756 -1910 2039.4 1910 2033 1910 2026.6 C
118.4757 -1910 2033 1910 2039.4 1910 2045.8 C
118.4758 -f 
118.4759 -S 
118.4760 -n
118.4761 -1978.8 2022.3 m
118.4762 -1979.1 2021.7 1979.4 2020.4 1978.6 2021.6 C
118.4763 -1978.6 2026.9 1978.6 2033 1978.6 2037.6 C
118.4764 -1979.2 2037 1979.1 2038.2 1979.1 2038.6 C
118.4765 -1978.7 2033.6 1978.9 2026.8 1978.8 2022.3 C
118.4766 -f 
118.4767 -S 
118.4768 -n
118.4769 -vmrs
118.4770 -2026.1 2041.2 m
118.4771 -2026.1 2034.8 2026.1 2028.3 2026.1 2021.8 C
118.4772 -2026.1 2028.5 2026.3 2035.4 2025.9 2042 C
118.4773 -2024.4 2042.9 2022.9 2044.1 2021.3 2044.8 C
118.4774 -2023.1 2044 2025.1 2042.8 2026.1 2041.2 C
118.4775 -[0.07 0.06 0 0.58]  vc
118.4776 -f 
118.4777 -0.4 w
118.4778 -2 J
118.4779 -2 M
118.4780 -S 
118.4781 -n
118.4782 -2026.4 2021.8 m
118.4783 -2026.3 2028.5 2026.5 2035.4 2026.1 2042 C
118.4784 -2025.6 2042.8 2024.7 2042.7 2024.2 2043.4 C
118.4785 -2024.7 2042.7 2025.5 2042.7 2026.1 2042.2 C
118.4786 -2026.5 2035.5 2026.3 2027.9 2026.4 2021.8 C
118.4787 -[0.4 0.4 0 0]  vc
118.4788 -f 
118.4789 -S 
118.4790 -n
118.4791 -2025.6 2038.4 m
118.4792 -2025.6 2033 2025.6 2027.6 2025.6 2022.3 C
118.4793 -2025.6 2027.6 2025.6 2033 2025.6 2038.4 C
118.4794 -[0.92 0.92 0 0.67]  vc
118.4795 -f 
118.4796 -S 
118.4797 -n
118.4798 -1934 2023.5 m
118.4799 -1934 2024.7 1933.8 2026 1934.2 2027.1 C
118.4800 -1934 2025.5 1934.7 2024.6 1934 2023.5 C
118.4801 -f 
118.4802 -S 
118.4803 -n
118.4804 -1928.2 2023.5 m
118.4805 -1928 2024.6 1927.4 2023.1 1926.8 2023.2 C
118.4806 -1926.2 2021 1921.4 2019.3 1923.2 2018 C
118.4807 -1922.7 2016.5 1923.2 2019.3 1922.2 2018.2 C
118.4808 -1924.4 2020.4 1926.2 2023.3 1928.9 2024.9 C
118.4809 -1927.9 2024.2 1929.8 2023.5 1928.2 2023.5 C
118.4810 -[0.18 0.18 0 0.78]  vc
118.4811 -f 
118.4812 -S 
118.4813 -n
118.4814 -1934 2019.2 m
118.4815 -1932 2019.6 1930.8 2022.6 1928.7 2021.8 C
118.4816 -1924.5 2016.5 1918.2 2011.8 1914 2006.7 C
118.4817 -1914 2005.7 1914 2004.6 1914 2003.6 C
118.4818 -1913.6 2004.3 1913.9 2005.8 1913.8 2006.9 C
118.4819 -1919 2012.4 1924.1 2016.5 1929.2 2022.3 C
118.4820 -1931 2021.7 1932.2 2019.8 1934 2019.2 C
118.4821 -f 
118.4822 -S 
118.4823 -n
118.4824 -1928.7 2024.9 m
118.4825 -1926.3 2022.7 1924.1 2020.4 1921.7 2018.2 C
118.4826 -1924.1 2020.4 1926.3 2022.7 1928.7 2024.9 C
118.4827 -[0.65 0.65 0 0.42]  vc
118.4828 -f 
118.4829 -S 
118.4830 -n
118.4831 -1914.3 2006.7 m
118.4832 -1918.7 2011.8 1924.5 2016.4 1928.9 2021.6 C
118.4833 -1924.2 2016.1 1919 2012.1 1914.3 2006.7 C
118.4834 -[0.07 0.06 0 0.58]  vc
118.4835 -f 
118.4836 -S 
118.4837 -n
118.4838 -1924.8 2020.8 m
118.4839 -1921.2 2016.9 1925.6 2022.5 1926 2021.1 C
118.4840 -1924.2 2021 1926.7 2019.6 1924.8 2020.8 C
118.4841 -[0.92 0.92 0 0.67]  vc
118.4842 -f 
118.4843 -S 
118.4844 -n
118.4845 -1934 2018.4 m
118.4846 -1933.2 2014.7 1934.5 2012.3 1933.7 2008.8 C
118.4847 -1934 2007.8 1935 2007.2 1935.6 2006.7 C
118.4848 -1935.3 2007.1 1934.3 2007 1934 2007.6 C
118.4849 -1932.2 2012.3 1937.2 2021 1929.2 2021.8 C
118.4850 -1931.1 2021.4 1932.3 2019.6 1934 2018.4 C
118.4851 -[0.07 0.06 0 0.58]  vc
118.4852 -f 
118.4853 -S 
118.4854 -n
118.4855 -vmrs
118.4856 -1933.5 2018.7 m
118.4857 -1933.5 2015.1 1933.5 2011.7 1933.5 2008.1 C
118.4858 -1933.8 2007.4 1934.3 2006.9 1934.9 2006.7 C
118.4859 -1933.8 2006.1 1934.3 2007.7 1933.2 2007.2 C
118.4860 -1931.9 2012 1936.7 2020.5 1929.2 2021.6 C
118.4861 -1930.7 2020.8 1932.2 2019.9 1933.5 2018.7 C
118.4862 -[0.4 0.4 0 0]  vc
118.4863 -f 
118.4864 -0.4 w
118.4865 -2 J
118.4866 -2 M
118.4867 -S 
118.4868 -n
118.4869 -1934.7 2019.2 m
118.4870 -1934.3 2015.6 1935.4 2011.5 1934.7 2008.8 C
118.4871 -1934.1 2012 1934.7 2016 1934.2 2019.4 C
118.4872 -1934.4 2018.7 1934.8 2019.8 1934.7 2019.2 C
118.4873 -[0.92 0.92 0 0.67]  vc
118.4874 -f 
118.4875 -S 
118.4876 -n
118.4877 -1917.6 2013.6 m
118.4878 -1917.8 2011.1 1916.8 2014.2 1917.2 2012.2 C
118.4879 -1916.3 2012.9 1914.8 2011.8 1914.3 2010.8 C
118.4880 -1914.2 2010.5 1914.4 2010.4 1914.5 2010.3 C
118.4881 -1913.9 2008.8 1913.9 2011.9 1914.3 2012 C
118.4882 -1916.3 2012 1917.6 2013.6 1916.7 2015.6 C
118.4883 -1913.7 2017.4 1919.6 2014.8 1917.6 2013.6 C
118.4884 -f 
118.4885 -S 
118.4886 -n
118.4887 -1887.2 2015.3 m
118.4888 -1887.2 2008.9 1887.2 2002.5 1887.2 1996.1 C
118.4889 -1887.2 2002.5 1887.2 2008.9 1887.2 2015.3 C
118.4890 -f 
118.4891 -S 
118.4892 -n
118.4893 -1916.7 2014.4 m
118.4894 -1917 2012.1 1913 2013 1913.8 2010.8 C
118.4895 -1912.1 2009.8 1910.9 2009.4 1910.7 2007.9 C
118.4896 -1910.4 2010.6 1913.4 2010.4 1914 2012.4 C
118.4897 -1914.9 2012.8 1916.6 2012.9 1916.4 2014.4 C
118.4898 -1916.9 2015.1 1914.5 2016.6 1916.2 2015.8 C
118.4899 -1916.4 2015.3 1916.7 2015 1916.7 2014.4 C
118.4900 -[0.65 0.65 0 0.42]  vc
118.4901 -f 
118.4902 -S 
118.4903 -n
118.4904 -1914 2009.3 m
118.4905 -1912.8 2010.9 1909.6 2005.3 1911.9 2009.8 C
118.4906 -1912.3 2009.6 1913.6 2010.2 1914 2009.3 C
118.4907 -[0.92 0.92 0 0.67]  vc
118.4908 -f 
118.4909 -S 
118.4910 -n
118.4911 -1951.2 1998.8 m
118.4912 -1949 1996.4 1951.5 1994 1950.3 1991.8 C
118.4913 -1949.1 1989.1 1954 1982.7 1948.8 1981.2 C
118.4914 -1949.2 1981.5 1951 1982.4 1950.8 1983.6 C
118.4915 -1951.9 1988.6 1947.1 1986.5 1948.1 1990.4 C
118.4916 -1948.5 1990.3 1948.7 1990.7 1948.6 1991.1 C
118.4917 -1949 1992.5 1947.3 1991.9 1948.1 1992.5 C
118.4918 -1947.1 1992.7 1945.7 1993.5 1945.2 1994.7 C
118.4919 -1944.5 1996.8 1947.7 2000.5 1943.8 2001.4 C
118.4920 -1943.4 2002 1943.7 2004 1942.4 2004.5 C
118.4921 -1945.2 2002.2 1948.9 2000.9 1951.2 1998.8 C
118.4922 -f 
118.4923 -S 
118.4924 -n
118.4925 -1994.9 1993 m
118.4926 -1995.1 1996.5 1994.5 2000.3 1995.4 2003.6 C
118.4927 -1994.5 2000.3 1995.1 1996.5 1994.9 1993 C
118.4928 -f 
118.4929 -S 
118.4930 -n
118.4931 -1913.8 2003.3 m
118.4932 -1913.8 1996.9 1913.8 1990.5 1913.8 1984.1 C
118.4933 -1913.8 1990.5 1913.8 1996.9 1913.8 2003.3 C
118.4934 -f 
118.4935 -S 
118.4936 -n
118.4937 -1941.9 1998 m
118.4938 -1940.5 1997.3 1940.7 1999.4 1940.7 2000 C
118.4939 -1942.8 2001.3 1942.6 1998.8 1941.9 1998 C
118.4940 -[0 0 0 0]  vc
118.4941 -f 
118.4942 -S 
118.4943 -n
118.4944 -vmrs
118.4945 -1942.1 1999.2 m
118.4946 -1942.2 1998.9 1941.8 1998.8 1941.6 1998.5 C
118.4947 -1940.4 1998 1940.7 1999.7 1940.7 2000 C
118.4948 -1941.6 2000.3 1942.6 2000.4 1942.1 1999.2 C
118.4949 -[0.92 0.92 0 0.67]  vc
118.4950 -f 
118.4951 -0.4 w
118.4952 -2 J
118.4953 -2 M
118.4954 -S 
118.4955 -n
118.4956 -1940 1997.1 m
118.4957 -1939.8 1996 1939.7 1995.9 1939.2 1995.2 C
118.4958 -1939.1 1995.3 1938.5 1997.9 1937.8 1996.4 C
118.4959 -1938 1997.3 1939.4 1998.6 1940 1997.1 C
118.4960 -f 
118.4961 -S 
118.4962 -n
118.4963 -1911.2 1995.9 m
118.4964 -1911.2 1991.6 1911.3 1987.2 1911.4 1982.9 C
118.4965 -1911.3 1987.2 1911.2 1991.6 1911.2 1995.9 C
118.4966 -f 
118.4967 -S 
118.4968 -n
118.4969 -1947.2 1979.1 m
118.4970 -1945.1 1978.8 1944.6 1975.7 1942.4 1975 C
118.4971 -1940.5 1972.6 1942.2 1973.7 1942.4 1975.7 C
118.4972 -1945.8 1975.5 1944.2 1979.8 1947.6 1979.6 C
118.4973 -1948.3 1982.3 1948.5 1980 1947.2 1979.1 C
118.4974 -f 
118.4975 -S 
118.4976 -n
118.4977 -1939.5 1973.3 m
118.4978 -1940.1 1972.6 1939.8 1974.2 1940.2 1973.1 C
118.4979 -1939.1 1972.8 1938.8 1968.5 1935.9 1969.7 C
118.4980 -1937.4 1969.2 1938.5 1970.6 1939 1971.4 C
118.4981 -1939.2 1972.7 1938.6 1973.9 1939.5 1973.3 C
118.4982 -f 
118.4983 -S 
118.4984 -n
118.4985 -1975.2 2073.2 m
118.4986 -1975.2 2070.2 1975.2 2067.2 1975.2 2064.3 C
118.4987 -1975.2 2067.2 1975.2 2070.2 1975.2 2073.2 C
118.4988 -[0.18 0.18 0 0.78]  vc
118.4989 -f 
118.4990 -S 
118.4991 -n
118.4992 -1929.9 2065.7 m
118.4993 -1928.1 2065.6 1926 2068.8 1924.1 2066.9 C
118.4994 -1918.1 2060.9 1912.9 2055.7 1907.1 2049.9 C
118.4995 -1906.7 2047.1 1906.9 2043.9 1906.8 2041 C
118.4996 -1906.8 2043.9 1906.8 2046.8 1906.8 2049.6 C
118.4997 -1913.2 2055.5 1918.7 2061.9 1925.1 2067.6 C
118.4998 -1927.1 2067.9 1928.6 2064.4 1930.1 2066.2 C
118.4999 -1929.7 2070.3 1929.9 2074.7 1929.9 2078.9 C
118.5000 -1929.6 2074.4 1930.5 2070.1 1929.9 2065.7 C
118.5001 -[0.07 0.06 0 0.58]  vc
118.5002 -f 
118.5003 -S 
118.5004 -n
118.5005 -1930.1 2061.6 m
118.5006 -1928.1 2062.1 1927 2065.1 1924.8 2064.3 C
118.5007 -1920.7 2058.9 1914.4 2054.3 1910.2 2049.2 C
118.5008 -1910.2 2048.1 1910.2 2047.1 1910.2 2046 C
118.5009 -1909.8 2046.8 1910 2048.3 1910 2049.4 C
118.5010 -1915.1 2054.9 1920.3 2059 1925.3 2064.8 C
118.5011 -1927.1 2064.2 1928.4 2062.3 1930.1 2061.6 C
118.5012 -[0.18 0.18 0 0.78]  vc
118.5013 -f 
118.5014 -S 
118.5015 -n
118.5016 -1932 2049.9 m
118.5017 -1932.3 2050.3 1932 2050.4 1932.8 2050.4 C
118.5018 -1932 2050.4 1932.2 2049.2 1931.3 2049.6 C
118.5019 -1931.4 2050.5 1930.3 2050.4 1930.4 2051.3 C
118.5020 -1931.1 2051.1 1930.7 2049.4 1932 2049.9 C
118.5021 -f 
118.5022 -S 
118.5023 -n
118.5024 -1938.3 2046 m
118.5025 -1936.3 2046.8 1935.2 2047.2 1934.2 2048.9 C
118.5026 -1935.3 2047.7 1936.8 2046.2 1938.3 2046 C
118.5027 -[0.4 0.4 0 0]  vc
118.5028 -f 
118.5029 -S 
118.5030 -n
118.5031 -vmrs
118.5032 -1938.3 2047 m
118.5033 -1937.9 2046.9 1936.6 2047.1 1936.1 2048 C
118.5034 -1936.5 2047.5 1937.3 2046.7 1938.3 2047 C
118.5035 -[0.18 0.18 0 0.78]  vc
118.5036 -f 
118.5037 -0.4 w
118.5038 -2 J
118.5039 -2 M
118.5040 -S 
118.5041 -n
118.5042 -1910.2 2043.2 m
118.5043 -1910.1 2037.5 1910 2031.8 1910 2026.1 C
118.5044 -1910 2031.8 1910.1 2037.5 1910.2 2043.2 C
118.5045 -f 
118.5046 -S 
118.5047 -n
118.5048 -1933.5 2032.1 m
118.5049 -1933.7 2035.2 1932.8 2035.8 1933.7 2038.6 C
118.5050 -1933.3 2036.6 1934.6 2018 1933.5 2032.1 C
118.5051 -f 
118.5052 -S 
118.5053 -n
118.5054 -1907.3 2021.8 m
118.5055 -1906.6 2025.9 1909.4 2032.6 1903.2 2034 C
118.5056 -1902.8 2034.1 1902.4 2033.9 1902 2033.8 C
118.5057 -1897.9 2028.5 1891.6 2023.8 1887.4 2018.7 C
118.5058 -1887.4 2017.7 1887.4 2016.6 1887.4 2015.6 C
118.5059 -1887 2016.3 1887.2 2017.8 1887.2 2018.9 C
118.5060 -1892.3 2024.4 1897.5 2028.5 1902.5 2034.3 C
118.5061 -1904.3 2033.6 1905.7 2032 1907.3 2030.9 C
118.5062 -1907.3 2027.9 1907.3 2024.9 1907.3 2021.8 C
118.5063 -f 
118.5064 -S 
118.5065 -n
118.5066 -1933.7 2023.2 m
118.5067 -1932 2021.7 1931.1 2024.9 1929.4 2024.9 C
118.5068 -1931.2 2024.7 1932.4 2021.5 1933.7 2023.2 C
118.5069 -f 
118.5070 -S 
118.5071 -n
118.5072 -1989.2 2024.4 m
118.5073 -1987.4 2023.7 1985.8 2022.2 1985.1 2020.4 C
118.5074 -1984.6 2020.1 1986 2018.9 1985.1 2019.2 C
118.5075 -1985.6 2020.8 1984.1 2019.4 1984.6 2021.1 C
118.5076 -1986.3 2022.3 1988.1 2025.3 1989.2 2024.4 C
118.5077 -f 
118.5078 -S 
118.5079 -n
118.5080 -1904.4 2031.9 m
118.5081 -1903 2029.7 1905.3 2027.7 1904.2 2025.9 C
118.5082 -1904.5 2025 1903.7 2023 1904 2021.3 C
118.5083 -1904 2022.3 1903.2 2022 1902.5 2022 C
118.5084 -1901.3 2022.3 1902.2 2020.1 1901.6 2019.6 C
118.5085 -1902.5 2019.8 1902.6 2018.3 1903.5 2018.9 C
118.5086 -1903.7 2021.8 1905.6 2016.8 1905.6 2020.6 C
118.5087 -1905.9 2020 1906.3 2020.8 1906.1 2021.1 C
118.5088 -1905.8 2022.7 1906.7 2020.4 1906.4 2019.9 C
118.5089 -1906.4 2018.5 1908.2 2017.8 1906.8 2016.5 C
118.5090 -1906.9 2015.7 1907.7 2017.1 1907.1 2016.3 C
118.5091 -1908.5 2015.8 1910.3 2015.1 1911.6 2016 C
118.5092 -1912.2 2016.2 1911.9 2018 1911.6 2018 C
118.5093 -1914.5 2017.1 1910.4 2013.6 1913.3 2013.4 C
118.5094 -1912.4 2011.3 1910.5 2011.8 1909.5 2010 C
118.5095 -1910 2010.5 1909 2010.8 1908.8 2011.2 C
118.5096 -1907.5 2009.9 1906.1 2011.7 1904.9 2011.5 C
118.5097 -1904.7 2010.9 1904.3 2010.5 1904.4 2009.8 C
118.5098 -1905 2010.2 1904.6 2008.6 1905.4 2008.1 C
118.5099 -1906.6 2007.5 1907.7 2008.4 1908.5 2007.4 C
118.5100 -1908.9 2008.5 1909.7 2008.1 1909 2007.2 C
118.5101 -1908.1 2006.5 1905.9 2007.3 1905.4 2007.4 C
118.5102 -1903.9 2007.3 1905.2 2008.5 1904.2 2008.4 C
118.5103 -1904.6 2009.9 1902.8 2010.3 1902.3 2010.5 C
118.5104 -1901.5 2009.9 1900.4 2010 1899.4 2010 C
118.5105 -1898.6 2011.2 1898.2 2013.4 1896.5 2013.4 C
118.5106 -1896 2012.9 1894.4 2012.9 1893.6 2012.9 C
118.5107 -1893.1 2013.9 1892.9 2015.5 1891.5 2016 C
118.5108 -1890.3 2016.1 1889.2 2014 1888.6 2015.8 C
118.5109 -1890 2016 1891 2016.9 1892.9 2016.5 C
118.5110 -1894.1 2017.2 1892.8 2018.3 1893.2 2018.9 C
118.5111 -1892.6 2018.9 1891.1 2019.8 1890.5 2020.6 C
118.5112 -1891.1 2023.6 1893.2 2019.8 1893.9 2022.5 C
118.5113 -1894.1 2023.3 1892.7 2023.6 1893.9 2024 C
118.5114 -1894.2 2024.3 1897.4 2023.8 1896.5 2026.1 C
118.5115 -1896 2025.6 1897.4 2028.1 1897.5 2027.1 C
118.5116 -1898.4 2027.4 1899.3 2027 1899.6 2028.5 C
118.5117 -1899.5 2028.6 1899.4 2028.8 1899.2 2028.8 C
118.5118 -1899.3 2029.2 1899.6 2029.8 1900.1 2030.2 C
118.5119 -1900.4 2029.6 1901 2030 1901.8 2030.2 C
118.5120 -1903.1 2032.1 1900.4 2031.5 1902.8 2033.1 C
118.5121 -1903.3 2032.7 1904.5 2032 1904.4 2031.9 C
118.5122 -[0.21 0.21 0 0]  vc
118.5123 -f 
118.5124 -S 
118.5125 -n
118.5126 -1909.2 2019.4 m
118.5127 -1908.8 2020.3 1910.2 2019.8 1909.2 2019.2 C
118.5128 -1908.3 2019.3 1907.6 2020.2 1907.6 2021.3 C
118.5129 -1908.5 2021 1907.6 2019 1909.2 2019.4 C
118.5130 -[0.18 0.18 0 0.78]  vc
118.5131 -f 
118.5132 -S 
118.5133 -n
118.5134 -1915.5 2015.6 m
118.5135 -1913.5 2016.3 1912.4 2016.8 1911.4 2018.4 C
118.5136 -1912.5 2017.2 1914 2015.7 1915.5 2015.6 C
118.5137 -[0.4 0.4 0 0]  vc
118.5138 -f 
118.5139 -S 
118.5140 -n
118.5141 -1915.5 2016.5 m
118.5142 -1915.1 2016.4 1913.8 2016.6 1913.3 2017.5 C
118.5143 -1913.7 2017 1914.5 2016.2 1915.5 2016.5 C
118.5144 -[0.18 0.18 0 0.78]  vc
118.5145 -f 
118.5146 -S 
118.5147 -n
118.5148 -vmrs
118.5149 -1887.4 2012.7 m
118.5150 -1887.3 2007 1887.2 2001.3 1887.2 1995.6 C
118.5151 -1887.2 2001.3 1887.3 2007 1887.4 2012.7 C
118.5152 -[0.18 0.18 0 0.78]  vc
118.5153 -f 
118.5154 -0.4 w
118.5155 -2 J
118.5156 -2 M
118.5157 -S 
118.5158 -n
118.5159 -1935.9 2007.4 m
118.5160 -1936.2 2007.8 1935.8 2007.9 1936.6 2007.9 C
118.5161 -1935.9 2007.9 1936.1 2006.7 1935.2 2007.2 C
118.5162 -1935.2 2008.1 1934.1 2007.9 1934.2 2008.8 C
118.5163 -1935 2008.7 1934.6 2006.9 1935.9 2007.4 C
118.5164 -f 
118.5165 -S 
118.5166 -n
118.5167 -1942.1 2003.6 m
118.5168 -1940.1 2004.3 1939.1 2004.8 1938 2006.4 C
118.5169 -1939.1 2005.2 1940.6 2003.7 1942.1 2003.6 C
118.5170 -[0.4 0.4 0 0]  vc
118.5171 -f 
118.5172 -S 
118.5173 -n
118.5174 -1942.1 2004.5 m
118.5175 -1941.8 2004.4 1940.4 2004.6 1940 2005.5 C
118.5176 -1940.4 2005 1941.2 2004.2 1942.1 2004.5 C
118.5177 -[0.18 0.18 0 0.78]  vc
118.5178 -f 
118.5179 -S 
118.5180 -n
118.5181 -1914 2000.7 m
118.5182 -1914 1995 1913.9 1989.3 1913.8 1983.6 C
118.5183 -1913.9 1989.3 1914 1995 1914 2000.7 C
118.5184 -f 
118.5185 -S 
118.5186 -n
118.5187 -1941.6 1998.3 m
118.5188 -1943.4 2001.9 1942.4 1996 1940.9 1998.3 C
118.5189 -1941.2 1998.3 1941.4 1998.3 1941.6 1998.3 C
118.5190 -f 
118.5191 -S 
118.5192 -n
118.5193 -1954.8 1989.9 m
118.5194 -1953.9 1989.6 1954.7 1991.6 1953.9 1991.1 C
118.5195 -1954.5 1993.1 1953.6 1998 1954.6 1993.2 C
118.5196 -1954 1992.2 1954.7 1990.7 1954.8 1989.9 C
118.5197 -f 
118.5198 -S 
118.5199 -n
118.5200 -1947.6 1992.5 m
118.5201 -1946.2 1993.5 1944.9 1993 1944.8 1994.7 C
118.5202 -1945.5 1994 1947 1992.2 1947.6 1992.5 C
118.5203 -f 
118.5204 -S 
118.5205 -n
118.5206 -1910.7 1982.2 m
118.5207 -1910.3 1981.8 1909.7 1982 1909.2 1982 C
118.5208 -1909.7 1982 1910.3 1981.9 1910.7 1982.2 C
118.5209 -1911 1987.1 1910 1992.6 1910.7 1997.3 C
118.5210 -1910.7 1992.3 1910.7 1987.2 1910.7 1982.2 C
118.5211 -[0.65 0.65 0 0.42]  vc
118.5212 -f 
118.5213 -S 
118.5214 -n
118.5215 -1910.9 1992.8 m
118.5216 -1910.9 1991.3 1910.9 1989.7 1910.9 1988.2 C
118.5217 -1910.9 1989.7 1910.9 1991.3 1910.9 1992.8 C
118.5218 -[0.18 0.18 0 0.78]  vc
118.5219 -f 
118.5220 -S 
118.5221 -n
118.5222 -vmrs
118.5223 -1953.6 1983.6 m
118.5224 -1954.1 1985.3 1953.2 1988.6 1954.8 1989.4 C
118.5225 -1954.1 1987.9 1954.4 1985.4 1953.6 1983.6 C
118.5226 -[0.18 0.18 0 0.78]  vc
118.5227 -f 
118.5228 -0.4 w
118.5229 -2 J
118.5230 -2 M
118.5231 -S 
118.5232 -n
118.5233 -1910.7 1982 m
118.5234 -1911.6 1982.9 1911 1984.4 1911.2 1985.6 C
118.5235 -1911 1984.4 1911.6 1982.9 1910.7 1982 C
118.5236 -f 
118.5237 -S 
118.5238 -n
118.5239 -1947.2 1979.6 m
118.5240 -1947.5 1980.6 1948.3 1980.6 1947.4 1979.6 C
118.5241 -1946.2 1979.4 1945.7 1978.8 1947.2 1979.6 C
118.5242 -f 
118.5243 -S 
118.5244 -n
118.5245 -1930.4 2061.4 m
118.5246 -1930.4 2058 1930.4 2053.5 1930.4 2051.1 C
118.5247 -1930.7 2054.6 1929.8 2057.4 1930.1 2061.2 C
118.5248 -1929.5 2061.9 1929.7 2061.2 1930.4 2061.4 C
118.5249 -[0.65 0.65 0 0.42]  vc
118.5250 -f 
118.5251 -S 
118.5252 -n
118.5253 -1939.5 2044.8 m
118.5254 -1940 2041.5 1935.2 2044.3 1936.4 2040.8 C
118.5255 -1934.9 2040.9 1934.1 2039.7 1933.5 2038.6 C
118.5256 -1933.3 2035.4 1933.2 2040 1934 2040.3 C
118.5257 -1936.2 2040.6 1936.3 2043.6 1938.5 2043.4 C
118.5258 -1939.7 2044.2 1939.4 2045.6 1938.3 2046.5 C
118.5259 -1939.1 2046.6 1939.6 2045.6 1939.5 2044.8 C
118.5260 -f 
118.5261 -S 
118.5262 -n
118.5263 -1910.4 2045.3 m
118.5264 -1910.4 2039.5 1910.4 2033.6 1910.4 2027.8 C
118.5265 -1910.4 2033.6 1910.4 2039.5 1910.4 2045.3 C
118.5266 -f 
118.5267 -S 
118.5268 -n
118.5269 -1906.8 2030.9 m
118.5270 -1907.6 2026.8 1905 2020.8 1909 2018.7 C
118.5271 -1906.5 2018.9 1906.8 2022.4 1906.8 2024.7 C
118.5272 -1906.4 2028.2 1907.9 2032 1903 2033.8 C
118.5273 -1902.2 2034 1903.8 2033.4 1904.2 2033.1 C
118.5274 -1905.1 2032.4 1905.9 2031.5 1906.8 2030.9 C
118.5275 -[0.07 0.06 0 0.58]  vc
118.5276 -f 
118.5277 -S 
118.5278 -n
118.5279 -1907.1 2030.7 m
118.5280 -1907.1 2028.8 1907.1 2027 1907.1 2025.2 C
118.5281 -1907.1 2027 1907.1 2028.8 1907.1 2030.7 C
118.5282 -[0.65 0.65 0 0.42]  vc
118.5283 -f 
118.5284 -S 
118.5285 -n
118.5286 -1932 2023.2 m
118.5287 -1932.2 2023.6 1931.7 2023.7 1931.6 2024 C
118.5288 -1932 2023.7 1932.3 2022.8 1933 2023 C
118.5289 -1933.9 2024.3 1933.3 2026.2 1933.5 2027.8 C
118.5290 -1933.5 2026.4 1934.9 2022.2 1932 2023.2 C
118.5291 -f 
118.5292 -S 
118.5293 -n
118.5294 -2026.1 2021.6 m
118.5295 -2026.1 2020.8 2026.1 2019.9 2026.1 2019.2 C
118.5296 -2026.1 2019.9 2026.1 2020.8 2026.1 2021.6 C
118.5297 -f 
118.5298 -S 
118.5299 -n
118.5300 -vmrs
118.5301 -1934.2 2018.9 m
118.5302 -1934.2 2015.5 1934.2 2011 1934.2 2008.6 C
118.5303 -1934.5 2012.1 1933.7 2014.9 1934 2018.7 C
118.5304 -1933.4 2019.5 1933.5 2018.7 1934.2 2018.9 C
118.5305 -[0.65 0.65 0 0.42]  vc
118.5306 -f 
118.5307 -0.4 w
118.5308 -2 J
118.5309 -2 M
118.5310 -S 
118.5311 -n
118.5312 -1887.6 2014.8 m
118.5313 -1887.6 2009 1887.6 2003.1 1887.6 1997.3 C
118.5314 -1887.6 2003.1 1887.6 2009 1887.6 2014.8 C
118.5315 -f 
118.5316 -S 
118.5317 -n
118.5318 -1914.3 2002.8 m
118.5319 -1914.3 1997 1914.3 1991.1 1914.3 1985.3 C
118.5320 -1914.3 1991.1 1914.3 1997 1914.3 2002.8 C
118.5321 -f 
118.5322 -S 
118.5323 -n
118.5324 -1995.4 1992.3 m
118.5325 -1995.4 1991.5 1995.4 1990.7 1995.4 1989.9 C
118.5326 -1995.4 1990.7 1995.4 1991.5 1995.4 1992.3 C
118.5327 -f 
118.5328 -S 
118.5329 -n
118.5330 -1896 1988.4 m
118.5331 -1896.9 1988 1897.8 1987.7 1898.7 1987.2 C
118.5332 -1897.8 1987.7 1896.9 1988 1896 1988.4 C
118.5333 -f 
118.5334 -S 
118.5335 -n
118.5336 -1899.4 1986.8 m
118.5337 -1900.4 1986.3 1901.3 1985.8 1902.3 1985.3 C
118.5338 -1901.3 1985.8 1900.4 1986.3 1899.4 1986.8 C
118.5339 -f 
118.5340 -S 
118.5341 -n
118.5342 -1902.8 1985.1 m
118.5343 -1905.2 1984 1905.2 1984 1902.8 1985.1 C
118.5344 -f 
118.5345 -S 
118.5346 -n
118.5347 -1949.1 1983.4 m
118.5348 -1950.2 1984.4 1947.8 1984.6 1949.3 1985.1 C
118.5349 -1949.5 1984.4 1949.6 1984.1 1949.1 1983.4 C
118.5350 -[0.07 0.06 0 0.58]  vc
118.5351 -f 
118.5352 -S 
118.5353 -n
118.5354 -1906.1 1983.4 m
118.5355 -1908.6 1982 1908.6 1982 1906.1 1983.4 C
118.5356 -[0.65 0.65 0 0.42]  vc
118.5357 -f 
118.5358 -S 
118.5359 -n
118.5360 -1922.7 1976.4 m
118.5361 -1923.6 1976 1924.4 1975.7 1925.3 1975.2 C
118.5362 -1924.4 1975.7 1923.6 1976 1922.7 1976.4 C
118.5363 -f 
118.5364 -S 
118.5365 -n
118.5366 -vmrs
118.5367 -1926 1974.8 m
118.5368 -1927 1974.3 1928 1973.8 1928.9 1973.3 C
118.5369 -1928 1973.8 1927 1974.3 1926 1974.8 C
118.5370 -[0.65 0.65 0 0.42]  vc
118.5371 -f 
118.5372 -0.4 w
118.5373 -2 J
118.5374 -2 M
118.5375 -S 
118.5376 -n
118.5377 -1929.4 1973.1 m
118.5378 -1931.9 1972 1931.9 1972 1929.4 1973.1 C
118.5379 -f 
118.5380 -S 
118.5381 -n
118.5382 -1932.8 1971.4 m
118.5383 -1935.3 1970 1935.3 1970 1932.8 1971.4 C
118.5384 -f 
118.5385 -S 
118.5386 -n
118.5387 -1949.6 2097.2 m
118.5388 -1951.1 2096.4 1952.6 2095.5 1954.1 2094.8 C
118.5389 -1952.6 2095.5 1951.1 2096.4 1949.6 2097.2 C
118.5390 -[0.07 0.06 0 0.58]  vc
118.5391 -f 
118.5392 -S 
118.5393 -n
118.5394 -1955.1 2094.3 m
118.5395 -1956.7 2093.5 1958.3 2092.7 1959.9 2091.9 C
118.5396 -1958.3 2092.7 1956.7 2093.5 1955.1 2094.3 C
118.5397 -f 
118.5398 -S 
118.5399 -n
118.5400 -1960.4 2091.6 m
118.5401 -1961.3 2091.2 1962.1 2090.9 1963 2090.4 C
118.5402 -1962.1 2090.9 1961.3 2091.2 1960.4 2091.6 C
118.5403 -f 
118.5404 -S 
118.5405 -n
118.5406 -1963.5 2090.2 m
118.5407 -1964.4 2089.7 1965.2 2089.2 1966.1 2088.8 C
118.5408 -1965.2 2089.2 1964.4 2089.7 1963.5 2090.2 C
118.5409 -f 
118.5410 -S 
118.5411 -n
118.5412 -1966.6 2088.5 m
118.5413 -1969.5 2087.1 1972.4 2085.8 1975.2 2084.4 C
118.5414 -1972.4 2085.8 1969.5 2087.1 1966.6 2088.5 C
118.5415 -f 
118.5416 -S 
118.5417 -n
118.5418 -1965.2 2086.1 m
118.5419 -1965.9 2085.7 1966.8 2085.3 1967.6 2084.9 C
118.5420 -1966.8 2085.3 1965.9 2085.7 1965.2 2086.1 C
118.5421 -f 
118.5422 -S 
118.5423 -n
118.5424 -1968.3 2084.7 m
118.5425 -1969.2 2084.3 1970 2083.9 1970.9 2083.5 C
118.5426 -1970 2083.9 1969.2 2084.3 1968.3 2084.7 C
118.5427 -f 
118.5428 -S 
118.5429 -n
118.5430 -vmrs
118.5431 -1984.1 2084 m
118.5432 -1985.6 2083.2 1987.2 2082.3 1988.7 2081.6 C
118.5433 -1987.2 2082.3 1985.6 2083.2 1984.1 2084 C
118.5434 -[0.07 0.06 0 0.58]  vc
118.5435 -f 
118.5436 -0.4 w
118.5437 -2 J
118.5438 -2 M
118.5439 -S 
118.5440 -n
118.5441 -1976 2078.7 m
118.5442 -1978.1 2080.1 1980 2082 1982 2083.7 C
118.5443 -1980 2081.9 1977.9 2080.3 1976 2078.2 C
118.5444 -1975.5 2079.9 1975.8 2081.9 1975.7 2083.7 C
118.5445 -1975.8 2082 1975.5 2080.2 1976 2078.7 C
118.5446 -f 
118.5447 -S 
118.5448 -n
118.5449 -1989.6 2081.1 m
118.5450 -1991.3 2080.3 1992.8 2079.5 1994.4 2078.7 C
118.5451 -1992.8 2079.5 1991.3 2080.3 1989.6 2081.1 C
118.5452 -f 
118.5453 -S 
118.5454 -n
118.5455 -1933.2 2074.6 m
118.5456 -1932.4 2076.2 1932.8 2077.5 1933 2078.7 C
118.5457 -1933 2077.6 1932.9 2074.8 1933.2 2074.6 C
118.5458 -f 
118.5459 -S 
118.5460 -n
118.5461 -1994.9 2078.4 m
118.5462 -1995.8 2078 1996.7 2077.7 1997.6 2077.2 C
118.5463 -1996.7 2077.7 1995.8 2078 1994.9 2078.4 C
118.5464 -f 
118.5465 -S 
118.5466 -n
118.5467 -1998 2077 m
118.5468 -1998.9 2076.5 1999.8 2076 2000.7 2075.6 C
118.5469 -1999.8 2076 1998.9 2076.5 1998 2077 C
118.5470 -f 
118.5471 -S 
118.5472 -n
118.5473 -2001.2 2075.3 m
118.5474 -2004 2073.9 2006.9 2072.6 2009.8 2071.2 C
118.5475 -2006.9 2072.6 2004 2073.9 2001.2 2075.3 C
118.5476 -f 
118.5477 -S 
118.5478 -n
118.5479 -1980.5 2060.7 m
118.5480 -1979.9 2060.7 1976.7 2062.8 1975.7 2064.5 C
118.5481 -1975.7 2067.5 1975.7 2070.5 1975.7 2073.4 C
118.5482 -1976.3 2068.7 1973.9 2061.6 1980.5 2060.7 C
118.5483 -f 
118.5484 -S 
118.5485 -n
118.5486 -1999.7 2072.9 m
118.5487 -2000.5 2072.5 2001.3 2072.1 2002.1 2071.7 C
118.5488 -2001.3 2072.1 2000.5 2072.5 1999.7 2072.9 C
118.5489 -f 
118.5490 -S 
118.5491 -n
118.5492 -2002.8 2071.5 m
118.5493 -2003.7 2071.1 2004.6 2070.7 2005.5 2070.3 C
118.5494 -2004.6 2070.7 2003.7 2071.1 2002.8 2071.5 C
118.5495 -f 
118.5496 -S 
118.5497 -n
118.5498 -vmrs
118.5499 -2015.1 2047.5 m
118.5500 -2014.4 2047.5 2011.2 2049.6 2010.3 2051.3 C
118.5501 -2010.3 2057.7 2010.3 2064.1 2010.3 2070.5 C
118.5502 -2010.3 2063.9 2010.1 2057.1 2010.5 2050.6 C
118.5503 -2012 2049.3 2013.5 2048.3 2015.1 2047.5 C
118.5504 -[0.07 0.06 0 0.58]  vc
118.5505 -f 
118.5506 -0.4 w
118.5507 -2 J
118.5508 -2 M
118.5509 -S 
118.5510 -n
118.5511 -1910.4 2049.2 m
118.5512 -1914.8 2054.3 1920.7 2058.9 1925.1 2064 C
118.5513 -1920.4 2058.6 1915.1 2054.6 1910.4 2049.2 C
118.5514 -f 
118.5515 -S 
118.5516 -n
118.5517 -1988.2 2057.3 m
118.5518 -1989.1 2056.8 1989.9 2056.2 1990.8 2055.6 C
118.5519 -1989.9 2056.2 1989.1 2056.8 1988.2 2057.3 C
118.5520 -f 
118.5521 -S 
118.5522 -n
118.5523 -1991.6 2051.3 m
118.5524 -1991.6 2046.3 1991.6 2041.2 1991.6 2036.2 C
118.5525 -1991.6 2041.2 1991.6 2046.3 1991.6 2051.3 C
118.5526 -f 
118.5527 -S 
118.5528 -n
118.5529 -1935.6 2047.5 m
118.5530 -1932.9 2051.7 1939.7 2043.8 1935.6 2047.5 C
118.5531 -f 
118.5532 -S 
118.5533 -n
118.5534 -1938.8 2043.9 m
118.5535 -1938.1 2043.3 1938.2 2043.7 1937.3 2043.4 C
118.5536 -1938.7 2043 1938.2 2044.9 1939 2045.3 C
118.5537 -1938.2 2045.3 1938.7 2046.6 1937.8 2046.5 C
118.5538 -1939.1 2046.2 1939.1 2044.5 1938.8 2043.9 C
118.5539 -f 
118.5540 -S 
118.5541 -n
118.5542 -1972.4 2045.6 m
118.5543 -1973.4 2045 1974.5 2044.4 1975.5 2043.9 C
118.5544 -1974.5 2044.4 1973.4 2045 1972.4 2045.6 C
118.5545 -f 
118.5546 -S 
118.5547 -n
118.5548 -1969 2043.6 m
118.5549 -1969.8 2043.2 1970.6 2042.9 1971.4 2042.4 C
118.5550 -1970.6 2042.9 1969.8 2043.2 1969 2043.6 C
118.5551 -f 
118.5552 -S 
118.5553 -n
118.5554 -1972.1 2042.2 m
118.5555 -1973 2041.8 1973.9 2041.4 1974.8 2041 C
118.5556 -1973.9 2041.4 1973 2041.8 1972.1 2042.2 C
118.5557 -f 
118.5558 -S 
118.5559 -n
118.5560 -1906.6 2035 m
118.5561 -1905 2034.7 1904.8 2036.6 1903.5 2036.9 C
118.5562 -1904.9 2037 1905.8 2033.4 1907.1 2035.7 C
118.5563 -1907.1 2037.2 1907.1 2038.6 1907.1 2040 C
118.5564 -1906.9 2038.4 1907.5 2036.4 1906.6 2035 C
118.5565 -f 
118.5566 -S 
118.5567 -n
118.5568 -vmrs
118.5569 -1937.1 2032.1 m
118.5570 -1936.2 2033.7 1936.6 2035 1936.8 2036.2 C
118.5571 -1936.8 2035.1 1936.8 2032.4 1937.1 2032.1 C
118.5572 -[0.07 0.06 0 0.58]  vc
118.5573 -f 
118.5574 -0.4 w
118.5575 -2 J
118.5576 -2 M
118.5577 -S 
118.5578 -n
118.5579 -1887.6 2018.7 m
118.5580 -1892 2023.8 1897.9 2028.4 1902.3 2033.6 C
118.5581 -1897.6 2028.1 1892.3 2024.1 1887.6 2018.7 C
118.5582 -f 
118.5583 -S 
118.5584 -n
118.5585 -1999.7 2031.4 m
118.5586 -1998.7 2030.3 1997.6 2029.2 1996.6 2028 C
118.5587 -1997.6 2029.2 1998.7 2030.3 1999.7 2031.4 C
118.5588 -f 
118.5589 -S 
118.5590 -n
118.5591 -1912.8 2017 m
118.5592 -1910.6 2021.1 1913.6 2015.3 1914.5 2016 C
118.5593 -1914 2016.3 1913.4 2016.7 1912.8 2017 C
118.5594 -f 
118.5595 -S 
118.5596 -n
118.5597 -1939.5 2005 m
118.5598 -1936.7 2009.2 1943.6 2001.3 1939.5 2005 C
118.5599 -f 
118.5600 -S 
118.5601 -n
118.5602 -1942.6 2001.4 m
118.5603 -1941.9 2000.8 1942 2001.2 1941.2 2000.9 C
118.5604 -1942.5 2000.6 1942.1 2002.4 1942.8 2002.8 C
118.5605 -1942 2002.8 1942.5 2004.1 1941.6 2004 C
118.5606 -1943 2003.7 1942.9 2002.1 1942.6 2001.4 C
118.5607 -f 
118.5608 -S 
118.5609 -n
118.5610 -2006.2 2000.7 m
118.5611 -2005.4 2001.5 2004 2002.8 2004 2002.8 C
118.5612 -2004.5 2002.4 2005.5 2001.4 2006.2 2000.7 C
118.5613 -f 
118.5614 -S 
118.5615 -n
118.5616 -1998.5 2001.6 m
118.5617 -1997.7 2002 1996.8 2002.4 1995.9 2002.6 C
118.5618 -1995.5 1999.3 1995.7 1995.7 1995.6 1992.3 C
118.5619 -1995.6 1995.7 1995.6 1999.2 1995.6 2002.6 C
118.5620 -1996.6 2002.4 1997.7 2002.2 1998.5 2001.6 C
118.5621 -[0.4 0.4 0 0]  vc
118.5622 -f 
118.5623 -S 
118.5624 -n
118.5625 -1996.1 2002.8 m
118.5626 -1995.9 2002.8 1995.8 2002.8 1995.6 2002.8 C
118.5627 -1995.2 1999.5 1995.5 1995.9 1995.4 1992.5 C
118.5628 -1995.4 1995.9 1995.4 1999.4 1995.4 2002.8 C
118.5629 -1996.4 2003.1 1998.2 2001.6 1996.1 2002.8 C
118.5630 -[0.07 0.06 0 0.58]  vc
118.5631 -f 
118.5632 -S 
118.5633 -n
118.5634 -1969 2002.1 m
118.5635 -1968 2001 1966.9 1999.9 1965.9 1998.8 C
118.5636 -1966.9 1999.9 1968 2001 1969 2002.1 C
118.5637 -f 
118.5638 -S 
118.5639 -n
118.5640 -vmrs
118.5641 -2000 2001.2 m
118.5642 -2002.1 2000 2004.1 1998.9 2006.2 1997.8 C
118.5643 -2004.1 1998.9 2002.1 2000 2000 2001.2 C
118.5644 -[0.07 0.06 0 0.58]  vc
118.5645 -f 
118.5646 -0.4 w
118.5647 -2 J
118.5648 -2 M
118.5649 -S 
118.5650 -n
118.5651 -1895.8 1984.8 m
118.5652 -1898.3 1983.6 1900.8 1982.3 1903.2 1981 C
118.5653 -1900.8 1982.3 1898.3 1983.6 1895.8 1984.8 C
118.5654 -f 
118.5655 -S 
118.5656 -n
118.5657 -1905.2 1980.3 m
118.5658 -1906.4 1979.9 1907.6 1979.5 1908.8 1979.1 C
118.5659 -1907.6 1979.5 1906.4 1979.9 1905.2 1980.3 C
118.5660 -f 
118.5661 -S 
118.5662 -n
118.5663 -1964.7 1977.4 m
118.5664 -1963.8 1977.5 1962.5 1980.2 1960.8 1980 C
118.5665 -1962.5 1980.2 1963.3 1978 1964.7 1977.4 C
118.5666 -f 
118.5667 -S 
118.5668 -n
118.5669 -1952 1979.6 m
118.5670 -1955.2 1979.2 1955.2 1979.2 1952 1979.6 C
118.5671 -f 
118.5672 -S 
118.5673 -n
118.5674 -1937.8 1966.4 m
118.5675 -1941.2 1969.5 1946.1 1976.4 1951.5 1979.3 C
118.5676 -1946.1 1976.7 1942.8 1970.4 1937.8 1966.4 C
118.5677 -f 
118.5678 -S 
118.5679 -n
118.5680 -1911.9 1978.6 m
118.5681 -1914.3 1977.4 1916.7 1976.2 1919.1 1975 C
118.5682 -1916.7 1976.2 1914.3 1977.4 1911.9 1978.6 C
118.5683 -f 
118.5684 -S 
118.5685 -n
118.5686 -1975.5 1971.4 m
118.5687 -1974.6 1972.2 1973.3 1973.6 1973.3 1973.6 C
118.5688 -1973.7 1973.1 1974.8 1972.1 1975.5 1971.4 C
118.5689 -f 
118.5690 -S 
118.5691 -n
118.5692 -1922.4 1972.8 m
118.5693 -1924.9 1971.6 1927.4 1970.3 1929.9 1969 C
118.5694 -1927.4 1970.3 1924.9 1971.6 1922.4 1972.8 C
118.5695 -f 
118.5696 -S 
118.5697 -n
118.5698 -1969.2 1971.9 m
118.5699 -1971.1 1970.9 1972.9 1969.8 1974.8 1968.8 C
118.5700 -1972.9 1969.8 1971.1 1970.9 1969.2 1971.9 C
118.5701 -f 
118.5702 -S 
118.5703 -n
118.5704 -vmrs
118.5705 -1931.8 1968.3 m
118.5706 -1933 1967.9 1934.2 1967.5 1935.4 1967.1 C
118.5707 -1934.2 1967.5 1933 1967.9 1931.8 1968.3 C
118.5708 -[0.07 0.06 0 0.58]  vc
118.5709 -f 
118.5710 -0.4 w
118.5711 -2 J
118.5712 -2 M
118.5713 -S 
118.5714 -n
118.5715 -1940.7 2072.4 m
118.5716 -1941.5 2072.4 1942.3 2072.3 1943.1 2072.2 C
118.5717 -1942.3 2072.3 1941.5 2072.4 1940.7 2072.4 C
118.5718 -[0 0 0 0.18]  vc
118.5719 -f 
118.5720 -S 
118.5721 -n
118.5722 -1948.6 2069.3 m
118.5723 -1947 2069.5 1945.7 2068.9 1944.8 2069.8 C
118.5724 -1945.9 2068.5 1948.4 2070.2 1948.6 2069.3 C
118.5725 -f 
118.5726 -S 
118.5727 -n
118.5728 -1954.6 2066.4 m
118.5729 -1954.7 2067.9 1955.6 2067.3 1955.6 2068.8 C
118.5730 -1955.4 2067.8 1956 2066.6 1954.6 2066.4 C
118.5731 -f 
118.5732 -S 
118.5733 -n
118.5734 -1929.2 2061.2 m
118.5735 -1927.8 2062.1 1926.3 2064.1 1924.8 2063.3 C
118.5736 -1926.3 2064.6 1928 2062 1929.2 2061.2 C
118.5737 -f 
118.5738 -S 
118.5739 -n
118.5740 -1924.4 2067.4 m
118.5741 -1918.5 2061.6 1912.7 2055.9 1906.8 2050.1 C
118.5742 -1912.7 2055.9 1918.5 2061.6 1924.4 2067.4 C
118.5743 -[0.4 0.4 0 0]  vc
118.5744 -f 
118.5745 -S 
118.5746 -n
118.5747 -1924.6 2062.8 m
118.5748 -1923.9 2062.1 1923.2 2061.2 1922.4 2060.4 C
118.5749 -1923.2 2061.2 1923.9 2062.1 1924.6 2062.8 C
118.5750 -[0 0 0 0.18]  vc
118.5751 -f 
118.5752 -S 
118.5753 -n
118.5754 -1919.3 2057.3 m
118.5755 -1917.5 2055.6 1915.7 2053.8 1913.8 2052 C
118.5756 -1915.7 2053.8 1917.5 2055.6 1919.3 2057.3 C
118.5757 -f 
118.5758 -S 
118.5759 -n
118.5760 -1929.2 2055.2 m
118.5761 -1929.2 2054.2 1929.2 2053.2 1929.2 2052.3 C
118.5762 -1929.2 2053.2 1929.2 2054.2 1929.2 2055.2 C
118.5763 -f 
118.5764 -S 
118.5765 -n
118.5766 -1926.3 2049.6 m
118.5767 -1925.4 2049 1925.4 2050.5 1924.4 2050.4 C
118.5768 -1925.3 2051.3 1924.5 2051.9 1925.6 2052.5 C
118.5769 -1926.9 2052.6 1926 2050.6 1926.3 2049.6 C
118.5770 -f 
118.5771 -S 
118.5772 -n
118.5773 -vmrs
118.5774 -1911.2 2046.8 m
118.5775 -1910.1 2048.9 1911.9 2050.1 1913.1 2051.3 C
118.5776 -1912.1 2049.9 1910.6 2048.8 1911.2 2046.8 C
118.5777 -[0 0 0 0.18]  vc
118.5778 -f 
118.5779 -0.4 w
118.5780 -2 J
118.5781 -2 M
118.5782 -S 
118.5783 -n
118.5784 -1934 2048.7 m
118.5785 -1932.6 2048.7 1930.1 2047.7 1929.6 2049.4 C
118.5786 -1930.9 2048.6 1933.3 2049 1934 2048.7 C
118.5787 -f 
118.5788 -S 
118.5789 -n
118.5790 -1980 2048.4 m
118.5791 -1979.5 2046.8 1976.3 2047.9 1977.2 2045.6 C
118.5792 -1976.8 2045.1 1976.1 2044.7 1975.2 2044.8 C
118.5793 -1973.7 2046 1976.3 2046.4 1976.7 2047.5 C
118.5794 -1977.8 2047.2 1978.2 2050 1979.6 2049.2 C
118.5795 -1980 2049 1979.6 2048.6 1980 2048.4 C
118.5796 -f 
118.5797 -S 
118.5798 -n
118.5799 -1938.3 2045.6 m
118.5800 -1938.2 2044.4 1936.8 2043.8 1935.9 2043.4 C
118.5801 -1936.4 2044.4 1939.1 2044.3 1937.6 2045.8 C
118.5802 -1937 2046.1 1935.9 2046.1 1935.9 2046.8 C
118.5803 -1936.7 2046.3 1937.8 2046.2 1938.3 2045.6 C
118.5804 -f 
118.5805 -S 
118.5806 -n
118.5807 -1932.5 2040 m
118.5808 -1932.8 2038.1 1932 2038.9 1932.3 2040.3 C
118.5809 -1933.1 2040.3 1932.7 2041.7 1933.7 2041.5 C
118.5810 -1933.1 2041 1932.9 2040.5 1932.5 2040 C
118.5811 -f 
118.5812 -S 
118.5813 -n
118.5814 -2014.6 2035.2 m
118.5815 -2014.1 2033.6 2010.9 2034.7 2011.7 2032.4 C
118.5816 -2011.3 2031.9 2009.4 2030.7 2009.3 2032.1 C
118.5817 -2009.5 2033.7 2012.9 2033.8 2012.4 2035.7 C
118.5818 -2013 2036.4 2014.2 2036.5 2014.6 2035.2 C
118.5819 -f 
118.5820 -S 
118.5821 -n
118.5822 -1906.4 2030.7 m
118.5823 -1905 2031.6 1903.5 2033.6 1902 2032.8 C
118.5824 -1903.4 2034 1905.6 2031.4 1906.4 2030.7 C
118.5825 -f 
118.5826 -S 
118.5827 -n
118.5828 -1901.8 2037.2 m
118.5829 -1899.5 2034.8 1897.2 2032.5 1894.8 2030.2 C
118.5830 -1897.2 2032.5 1899.5 2034.8 1901.8 2037.2 C
118.5831 -[0.4 0.4 0 0]  vc
118.5832 -f 
118.5833 -S 
118.5834 -n
118.5835 -1901.8 2032.4 m
118.5836 -1901.1 2031.6 1900.4 2030.7 1899.6 2030 C
118.5837 -1900.4 2030.7 1901.1 2031.6 1901.8 2032.4 C
118.5838 -[0 0 0 0.18]  vc
118.5839 -f 
118.5840 -S 
118.5841 -n
118.5842 -1944.5 2030 m
118.5843 -1945.3 2029.9 1946.1 2029.8 1946.9 2029.7 C
118.5844 -1946.1 2029.8 1945.3 2029.9 1944.5 2030 C
118.5845 -f 
118.5846 -S 
118.5847 -n
118.5848 -vmrs
118.5849 -1997.8 2027.8 m
118.5850 -1997.7 2027.9 1997.6 2028.1 1997.3 2028 C
118.5851 -1997.4 2029.1 1998.5 2029.5 1999.2 2030 C
118.5852 -2000.1 2029.5 1998.9 2028 1997.8 2027.8 C
118.5853 -[0 0 0 0.18]  vc
118.5854 -f 
118.5855 -0.4 w
118.5856 -2 J
118.5857 -2 M
118.5858 -S 
118.5859 -n
118.5860 -1906.4 2029.2 m
118.5861 -1906.4 2026.6 1906.4 2024 1906.4 2021.3 C
118.5862 -1906.4 2024 1906.4 2026.6 1906.4 2029.2 C
118.5863 -f 
118.5864 -S 
118.5865 -n
118.5866 -2006.2 2025.9 m
118.5867 -2006 2025.9 2005.8 2025.8 2005.7 2025.6 C
118.5868 -2005.7 2025.5 2005.7 2025.3 2005.7 2025.2 C
118.5869 -2004.6 2025.8 2002.7 2024.7 2001.9 2026.1 C
118.5870 -2001.9 2027.9 2007.8 2029.2 2006.2 2025.9 C
118.5871 -[0 0 0 0]  vc
118.5872 -f 
118.5873 -S 
118.5874 -n
118.5875 -1952.4 2026.8 m
118.5876 -1950.9 2027 1949.6 2026.4 1948.6 2027.3 C
118.5877 -1949.7 2026.1 1952.2 2027.7 1952.4 2026.8 C
118.5878 -[0 0 0 0.18]  vc
118.5879 -f 
118.5880 -S 
118.5881 -n
118.5882 -1896.5 2026.8 m
118.5883 -1894.7 2025.1 1892.9 2023.3 1891 2021.6 C
118.5884 -1892.9 2023.3 1894.7 2025.1 1896.5 2026.8 C
118.5885 -f 
118.5886 -S 
118.5887 -n
118.5888 -1958.4 2024 m
118.5889 -1958.5 2025.5 1959.4 2024.8 1959.4 2026.4 C
118.5890 -1959.3 2025.3 1959.8 2024.1 1958.4 2024 C
118.5891 -f 
118.5892 -S 
118.5893 -n
118.5894 -1903.5 2019.2 m
118.5895 -1902.6 2018.6 1902.6 2020 1901.6 2019.9 C
118.5896 -1902.5 2020.8 1901.7 2021.4 1902.8 2022 C
118.5897 -1904.1 2022.2 1903.2 2020.1 1903.5 2019.2 C
118.5898 -f 
118.5899 -S 
118.5900 -n
118.5901 -1933 2018.7 m
118.5902 -1931.7 2019.6 1930.1 2021.6 1928.7 2020.8 C
118.5903 -1930.1 2022.1 1931.8 2019.5 1933 2018.7 C
118.5904 -f 
118.5905 -S 
118.5906 -n
118.5907 -1888.4 2016.3 m
118.5908 -1887.3 2018.4 1889.1 2019.6 1890.3 2020.8 C
118.5909 -1889.3 2019.5 1887.8 2018.3 1888.4 2016.3 C
118.5910 -f 
118.5911 -S 
118.5912 -n
118.5913 -1928.4 2020.4 m
118.5914 -1927.7 2019.6 1927 2018.7 1926.3 2018 C
118.5915 -1927 2018.7 1927.7 2019.6 1928.4 2020.4 C
118.5916 -f 
118.5917 -S 
118.5918 -n
118.5919 -vmrs
118.5920 -1911.2 2018.2 m
118.5921 -1909.8 2018.3 1907.3 2017.2 1906.8 2018.9 C
118.5922 -1908.1 2018.1 1910.5 2018.6 1911.2 2018.2 C
118.5923 -[0 0 0 0.18]  vc
118.5924 -f 
118.5925 -0.4 w
118.5926 -2 J
118.5927 -2 M
118.5928 -S 
118.5929 -n
118.5930 -1915.5 2015.1 m
118.5931 -1915.4 2013.9 1914 2013.3 1913.1 2012.9 C
118.5932 -1913.6 2013.9 1916.3 2013.8 1914.8 2015.3 C
118.5933 -1914.2 2015.6 1913.1 2015.6 1913.1 2016.3 C
118.5934 -1913.9 2015.9 1915 2015.7 1915.5 2015.1 C
118.5935 -f 
118.5936 -S 
118.5937 -n
118.5938 -1923.2 2014.8 m
118.5939 -1921.3 2013.1 1919.5 2011.3 1917.6 2009.6 C
118.5940 -1919.5 2011.3 1921.3 2013.1 1923.2 2014.8 C
118.5941 -f 
118.5942 -S 
118.5943 -n
118.5944 -1933 2012.7 m
118.5945 -1933 2011.7 1933 2010.8 1933 2009.8 C
118.5946 -1933 2010.8 1933 2011.7 1933 2012.7 C
118.5947 -f 
118.5948 -S 
118.5949 -n
118.5950 -1909.7 2008.1 m
118.5951 -1908.9 2009.2 1910.1 2009.9 1910.4 2011 C
118.5952 -1911.1 2010.7 1908.9 2009.7 1909.7 2008.1 C
118.5953 -f 
118.5954 -S 
118.5955 -n
118.5956 -1930.1 2007.2 m
118.5957 -1929.2 2006.6 1929.2 2008 1928.2 2007.9 C
118.5958 -1929.1 2008.8 1928.4 2009.4 1929.4 2010 C
118.5959 -1930.7 2010.2 1929.9 2008.1 1930.1 2007.2 C
118.5960 -f 
118.5961 -S 
118.5962 -n
118.5963 -1915 2004.3 m
118.5964 -1914 2006.4 1915.7 2007.6 1916.9 2008.8 C
118.5965 -1915.9 2007.5 1914.4 2006.3 1915 2004.3 C
118.5966 -f 
118.5967 -S 
118.5968 -n
118.5969 -1937.8 2006.2 m
118.5970 -1936.4 2006.3 1934 2005.2 1933.5 2006.9 C
118.5971 -1934.7 2006.1 1937.1 2006.6 1937.8 2006.2 C
118.5972 -f 
118.5973 -S 
118.5974 -n
118.5975 -1983.9 2006 m
118.5976 -1983.3 2004.3 1980.2 2005.4 1981 2003.1 C
118.5977 -1980.6 2002.7 1978.7 2001.5 1978.6 2002.8 C
118.5978 -1978.8 2004.4 1982.1 2004.5 1981.7 2006.4 C
118.5979 -1982.3 2007.2 1983.5 2007.2 1983.9 2006 C
118.5980 -f 
118.5981 -S 
118.5982 -n
118.5983 -1942.1 2003.1 m
118.5984 -1942 2001.9 1940.6 2001.3 1939.7 2000.9 C
118.5985 -1940.2 2001.9 1943 2001.8 1941.4 2003.3 C
118.5986 -1940.9 2003.6 1939.7 2003.6 1939.7 2004.3 C
118.5987 -1940.5 2003.9 1941.6 2003.7 1942.1 2003.1 C
118.5988 -f 
118.5989 -S 
118.5990 -n
118.5991 -vmrs
118.5992 -1967.1 1998.5 m
118.5993 -1967 1998.6 1966.8 1998.8 1966.6 1998.8 C
118.5994 -1966.7 1999.8 1967.8 2000.2 1968.5 2000.7 C
118.5995 -1969.4 2000.2 1968.2 1998.8 1967.1 1998.5 C
118.5996 -[0 0 0 0.18]  vc
118.5997 -f 
118.5998 -0.4 w
118.5999 -2 J
118.6000 -2 M
118.6001 -S 
118.6002 -n
118.6003 -1936.4 1997.6 m
118.6004 -1936.7 1995.6 1935.8 1996.4 1936.1 1997.8 C
118.6005 -1936.9 1997.9 1936.5 1999.2 1937.6 1999 C
118.6006 -1937 1998.5 1936.8 1998 1936.4 1997.6 C
118.6007 -f 
118.6008 -S 
118.6009 -n
118.6010 -1975.5 1996.6 m
118.6011 -1975.2 1996.7 1975.1 1996.5 1975 1996.4 C
118.6012 -1975 1996.2 1975 1996.1 1975 1995.9 C
118.6013 -1973.9 1996.5 1972 1995.5 1971.2 1996.8 C
118.6014 -1971.2 1998.6 1977 1999.9 1975.5 1996.6 C
118.6015 -[0 0 0 0]  vc
118.6016 -f 
118.6017 -S 
118.6018 -n
118.6019 -1949.3 2097.4 m
118.6020 -1950.3 2096.9 1951.2 2096.4 1952.2 2096 C
118.6021 -1951.2 2096.4 1950.3 2096.9 1949.3 2097.4 C
118.6022 -[0.4 0.4 0 0]  vc
118.6023 -f 
118.6024 -S 
118.6025 -n
118.6026 -1960.8 2091.6 m
118.6027 -1961.7 2091.2 1962.6 2090.9 1963.5 2090.4 C
118.6028 -1962.6 2090.9 1961.7 2091.2 1960.8 2091.6 C
118.6029 -f 
118.6030 -S 
118.6031 -n
118.6032 -1964.4 2090 m
118.6033 -1965.7 2089.2 1967 2088.5 1968.3 2087.8 C
118.6034 -1967 2088.5 1965.7 2089.2 1964.4 2090 C
118.6035 -f 
118.6036 -S 
118.6037 -n
118.6038 -1976 2083.7 m
118.6039 -1976.3 2082.3 1975.2 2079.1 1976.9 2079.4 C
118.6040 -1978.8 2080.7 1980.3 2082.9 1982.2 2084.2 C
118.6041 -1980.6 2083.1 1978.2 2080.2 1976 2078.9 C
118.6042 -1975.6 2081.2 1977 2084.9 1973.8 2085.4 C
118.6043 -1972.2 2086.1 1970.7 2087 1969 2087.6 C
118.6044 -1971.4 2086.5 1974.1 2085.6 1976 2083.7 C
118.6045 -f 
118.6046 -S 
118.6047 -n
118.6048 -1983.9 2084.2 m
118.6049 -1984.8 2083.7 1985.8 2083.2 1986.8 2082.8 C
118.6050 -1985.8 2083.2 1984.8 2083.7 1983.9 2084.2 C
118.6051 -f 
118.6052 -S 
118.6053 -n
118.6054 -1995.4 2078.4 m
118.6055 -1996.3 2078 1997.1 2077.7 1998 2077.2 C
118.6056 -1997.1 2077.7 1996.3 2078 1995.4 2078.4 C
118.6057 -f 
118.6058 -S 
118.6059 -n
118.6060 -1999 2076.8 m
118.6061 -2000.3 2076 2001.6 2075.3 2002.8 2074.6 C
118.6062 -2001.6 2075.3 2000.3 2076 1999 2076.8 C
118.6063 -f 
118.6064 -S 
118.6065 -n
118.6066 -vmrs
118.6067 -1929.6 2065.7 m
118.6068 -1930.1 2065.6 1929.8 2068.6 1929.9 2070 C
118.6069 -1929.8 2068.6 1930.1 2067 1929.6 2065.7 C
118.6070 -[0.4 0.4 0 0]  vc
118.6071 -f 
118.6072 -0.4 w
118.6073 -2 J
118.6074 -2 M
118.6075 -S 
118.6076 -n
118.6077 -1906.6 2049.4 m
118.6078 -1906.6 2046.7 1906.6 2043.9 1906.6 2041.2 C
118.6079 -1906.6 2043.9 1906.6 2046.7 1906.6 2049.4 C
118.6080 -f 
118.6081 -S 
118.6082 -n
118.6083 -2016 2047.5 m
118.6084 -2014.8 2048 2013.5 2048.3 2012.4 2049.4 C
118.6085 -2013.5 2048.3 2014.8 2048 2016 2047.5 C
118.6086 -f 
118.6087 -S 
118.6088 -n
118.6089 -2016.5 2047.2 m
118.6090 -2017.3 2046.9 2018.1 2046.6 2018.9 2046.3 C
118.6091 -2018.1 2046.6 2017.3 2046.9 2016.5 2047.2 C
118.6092 -f 
118.6093 -S 
118.6094 -n
118.6095 -1912.4 2028.5 m
118.6096 -1911.8 2032.4 1912.4 2037.2 1911.9 2041.2 C
118.6097 -1911.5 2037.2 1911.7 2032.9 1911.6 2028.8 C
118.6098 -1911.6 2033.5 1911.6 2038.9 1911.6 2042.9 C
118.6099 -1912.5 2042.2 1911.6 2043.9 1912.6 2043.6 C
118.6100 -1912.9 2039.3 1913.1 2033.3 1912.4 2028.5 C
118.6101 -[0.21 0.21 0 0]  vc
118.6102 -f 
118.6103 -S 
118.6104 -n
118.6105 -1906.8 2040.8 m
118.6106 -1906.8 2039 1906.8 2037.2 1906.8 2035.5 C
118.6107 -1906.8 2037.2 1906.8 2039 1906.8 2040.8 C
118.6108 -[0.4 0.4 0 0]  vc
118.6109 -f 
118.6110 -S 
118.6111 -n
118.6112 -1905.9 2035.2 m
118.6113 -1904.9 2036.4 1903.7 2037.2 1902.3 2037.4 C
118.6114 -1903.7 2037.2 1904.9 2036.4 1905.9 2035.2 C
118.6115 -f 
118.6116 -S 
118.6117 -n
118.6118 -1906.1 2031.2 m
118.6119 -1907 2031.1 1906.4 2028 1906.6 2030.7 C
118.6120 -1905.5 2032.1 1904 2032.8 1902.5 2033.6 C
118.6121 -1903.9 2033.2 1905 2032.1 1906.1 2031.2 C
118.6122 -f 
118.6123 -S 
118.6124 -n
118.6125 -1908.3 2018.7 m
118.6126 -1905.2 2018.6 1907.1 2023.2 1906.6 2025.4 C
118.6127 -1906.8 2023 1905.9 2019.5 1908.3 2018.7 C
118.6128 -f 
118.6129 -S 
118.6130 -n
118.6131 -1889.6 1998 m
118.6132 -1889 2001.9 1889.6 2006.7 1889.1 2010.8 C
118.6133 -1888.7 2006.7 1888.9 2002.4 1888.8 1998.3 C
118.6134 -1888.8 2003 1888.8 2008.4 1888.8 2012.4 C
118.6135 -1889.7 2011.7 1888.8 2013.4 1889.8 2013.2 C
118.6136 -1890.1 2008.8 1890.3 2002.8 1889.6 1998 C
118.6137 -[0.21 0.21 0 0]  vc
118.6138 -f 
118.6139 -S 
118.6140 -n
118.6141 -vmrs
118.6142 -1999 2001.4 m
118.6143 -2001 2000.3 2003 1999.2 2005 1998 C
118.6144 -2003 1999.2 2001 2000.3 1999 2001.4 C
118.6145 -[0.4 0.4 0 0]  vc
118.6146 -f 
118.6147 -0.4 w
118.6148 -2 J
118.6149 -2 M
118.6150 -S 
118.6151 -n
118.6152 -1916.2 1986 m
118.6153 -1915.7 1989.9 1916.3 1994.7 1915.7 1998.8 C
118.6154 -1915.3 1994.7 1915.5 1990.4 1915.5 1986.3 C
118.6155 -1915.5 1991 1915.5 1996.4 1915.5 2000.4 C
118.6156 -1916.3 1999.7 1915.5 2001.4 1916.4 2001.2 C
118.6157 -1916.7 1996.8 1917 1990.8 1916.2 1986 C
118.6158 -[0.21 0.21 0 0]  vc
118.6159 -f 
118.6160 -S 
118.6161 -n
118.6162 -1886.9 1989.6 m
118.6163 -1887.8 1989.2 1888.7 1988.9 1889.6 1988.4 C
118.6164 -1888.7 1988.9 1887.8 1989.2 1886.9 1989.6 C
118.6165 -[0.4 0.4 0 0]  vc
118.6166 -f 
118.6167 -S 
118.6168 -n
118.6169 -1892.4 1986.8 m
118.6170 -1895.1 1985.1 1897.9 1983.6 1900.6 1982 C
118.6171 -1897.9 1983.6 1895.1 1985.1 1892.4 1986.8 C
118.6172 -f 
118.6173 -S 
118.6174 -n
118.6175 -1907.3 1979.3 m
118.6176 -1908.5 1978.9 1909.7 1978.5 1910.9 1978.1 C
118.6177 -1909.7 1978.5 1908.5 1978.9 1907.3 1979.3 C
118.6178 -f 
118.6179 -S 
118.6180 -n
118.6181 -1938.5 1966.6 m
118.6182 -1942.6 1970.1 1945.9 1976.4 1951.7 1979.1 C
118.6183 -1946.2 1976.1 1943.1 1970.9 1938.5 1966.6 C
118.6184 -f 
118.6185 -S 
118.6186 -n
118.6187 -1955.1 1978.6 m
118.6188 -1955.9 1978.2 1956.7 1977.8 1957.5 1977.4 C
118.6189 -1956.7 1977.8 1955.9 1978.2 1955.1 1978.6 C
118.6190 -f 
118.6191 -S 
118.6192 -n
118.6193 -1913.6 1977.6 m
118.6194 -1914.5 1977.2 1915.3 1976.9 1916.2 1976.4 C
118.6195 -1915.3 1976.9 1914.5 1977.2 1913.6 1977.6 C
118.6196 -f 
118.6197 -S 
118.6198 -n
118.6199 -1919.1 1974.8 m
118.6200 -1921.8 1973.1 1924.5 1971.6 1927.2 1970 C
118.6201 -1924.5 1971.6 1921.8 1973.1 1919.1 1974.8 C
118.6202 -f 
118.6203 -S 
118.6204 -n
118.6205 -1963.5 1974.5 m
118.6206 -1964.5 1974 1965.6 1973.4 1966.6 1972.8 C
118.6207 -1965.6 1973.4 1964.5 1974 1963.5 1974.5 C
118.6208 -f 
118.6209 -S 
118.6210 -n
118.6211 -vmrs
118.6212 -1967.8 1972.4 m
118.6213 -1970 1971.2 1972.1 1970 1974.3 1968.8 C
118.6214 -1972.1 1970 1970 1971.2 1967.8 1972.4 C
118.6215 -[0.4 0.4 0 0]  vc
118.6216 -f 
118.6217 -0.4 w
118.6218 -2 J
118.6219 -2 M
118.6220 -S 
118.6221 -n
118.6222 -1934 1967.3 m
118.6223 -1935.2 1966.9 1936.4 1966.5 1937.6 1966.1 C
118.6224 -1936.4 1966.5 1935.2 1966.9 1934 1967.3 C
118.6225 -f 
118.6226 -S 
118.6227 -n
118.6228 -1928.9 2061.2 m
118.6229 -1928.9 2059.2 1928.9 2057.3 1928.9 2055.4 C
118.6230 -1928.9 2057.3 1928.9 2059.2 1928.9 2061.2 C
118.6231 -[0.21 0.21 0 0]  vc
118.6232 -f 
118.6233 -S 
118.6234 -n
118.6235 -1917.2 2047 m
118.6236 -1917.8 2046.5 1919.6 2046.8 1920 2047.2 C
118.6237 -1920 2046.5 1920.9 2046.8 1921 2046.3 C
118.6238 -1921.9 2047.3 1921.3 2044.1 1921.5 2044.1 C
118.6239 -1919.7 2044.8 1915.7 2043.5 1916.2 2046 C
118.6240 -1916.2 2048.3 1917 2045.9 1917.2 2047 C
118.6241 -[0 0 0 0]  vc
118.6242 -f 
118.6243 -S 
118.6244 -n
118.6245 -1922 2044.1 m
118.6246 -1923.5 2043.2 1927 2045.4 1927.5 2042.9 C
118.6247 -1927.1 2042.6 1927.3 2040.9 1927.2 2041.5 C
118.6248 -1924.9 2042.3 1920.9 2040.6 1922 2044.1 C
118.6249 -f 
118.6250 -S 
118.6251 -n
118.6252 -1934.9 2043.9 m
118.6253 -1935.2 2043.4 1934.4 2042.7 1934 2042.2 C
118.6254 -1933.2 2041.8 1932.4 2042.8 1932.8 2043.2 C
118.6255 -1932.9 2044 1934.3 2043.3 1934.9 2043.9 C
118.6256 -f 
118.6257 -S 
118.6258 -n
118.6259 -1906.1 2030.7 m
118.6260 -1906.1 2028.8 1906.1 2027 1906.1 2025.2 C
118.6261 -1906.1 2027 1906.1 2028.8 1906.1 2030.7 C
118.6262 -[0.21 0.21 0 0]  vc
118.6263 -f 
118.6264 -S 
118.6265 -n
118.6266 -1932.8 2018.7 m
118.6267 -1932.8 2016.8 1932.8 2014.8 1932.8 2012.9 C
118.6268 -1932.8 2014.8 1932.8 2016.8 1932.8 2018.7 C
118.6269 -f 
118.6270 -S 
118.6271 -n
118.6272 -1894.4 2016.5 m
118.6273 -1895 2016 1896.8 2016.3 1897.2 2016.8 C
118.6274 -1897.2 2016 1898.1 2016.3 1898.2 2015.8 C
118.6275 -1899.1 2016.8 1898.5 2013.6 1898.7 2013.6 C
118.6276 -1896.9 2014.4 1892.9 2013 1893.4 2015.6 C
118.6277 -1893.4 2017.8 1894.2 2015.4 1894.4 2016.5 C
118.6278 -[0 0 0 0]  vc
118.6279 -f 
118.6280 -S 
118.6281 -n
118.6282 -1899.2 2013.6 m
118.6283 -1900.7 2012.7 1904.2 2014.9 1904.7 2012.4 C
118.6284 -1904.3 2012.1 1904.5 2010.5 1904.4 2011 C
118.6285 -1902.1 2011.8 1898.1 2010.1 1899.2 2013.6 C
118.6286 -f 
118.6287 -S 
118.6288 -n
118.6289 -vmrs
118.6290 -1912.1 2013.4 m
118.6291 -1912.4 2012.9 1911.6 2012.3 1911.2 2011.7 C
118.6292 -1910.4 2011.4 1909.6 2012.3 1910 2012.7 C
118.6293 -1910.1 2013.5 1911.5 2012.9 1912.1 2013.4 C
118.6294 -[0 0 0 0]  vc
118.6295 -f 
118.6296 -0.4 w
118.6297 -2 J
118.6298 -2 M
118.6299 -S 
118.6300 -n
118.6301 -1921 2004.5 m
118.6302 -1921.6 2004 1923.4 2004.3 1923.9 2004.8 C
118.6303 -1923.8 2004 1924.8 2004.3 1924.8 2003.8 C
118.6304 -1925.7 2004.8 1925.1 2001.6 1925.3 2001.6 C
118.6305 -1923.6 2002.4 1919.6 2001 1920 2003.6 C
118.6306 -1920 2005.8 1920.8 2003.4 1921 2004.5 C
118.6307 -f 
118.6308 -S 
118.6309 -n
118.6310 -1925.8 2001.6 m
118.6311 -1927.3 2000.7 1930.8 2002.9 1931.3 2000.4 C
118.6312 -1930.9 2000.1 1931.1 1998.5 1931.1 1999 C
118.6313 -1928.7 1999.8 1924.8 1998.1 1925.8 2001.6 C
118.6314 -f 
118.6315 -S 
118.6316 -n
118.6317 -1938.8 2001.4 m
118.6318 -1939 2000.9 1938.2 2000.3 1937.8 1999.7 C
118.6319 -1937.1 1999.4 1936.2 2000.3 1936.6 2000.7 C
118.6320 -1936.7 2001.5 1938.1 2000.9 1938.8 2001.4 C
118.6321 -f 
118.6322 -S 
118.6323 -n
118.6324 -1908.6691 2008.1348 m
118.6325 -1897.82 2010.0477 L
118.6326 -1894.1735 1989.3671 L
118.6327 -1905.0226 1987.4542 L
118.6328 -1908.6691 2008.1348 L
118.6329 -n
118.6330 -q
118.6331 -_bfh
118.6332 -%%IncludeResource: font Symbol
118.6333 -_efh
118.6334 -{
118.6335 -f0 [19.696045 -3.4729 3.4729 19.696045 0 0] makesetfont
118.6336 -1895.041763 1994.291153 m
118.6337 -0 0 32 0 0 (l) ts
118.6338 -}
118.6339 -true
118.6340 -[0 0 0 1]sts
118.6341 -Q
118.6342 -1979.2185 1991.7809 m
118.6343 -1960.6353 1998.5452 L
118.6344 -1953.4532 1978.8124 L
118.6345 -1972.0363 1972.0481 L
118.6346 -1979.2185 1991.7809 L
118.6347 -n
118.6348 -q
118.6349 -_bfh
118.6350 -%%IncludeResource: font Symbol
118.6351 -_efh
118.6352 -{
118.6353 -f0 [18.793335 -6.84082 6.84021 18.793335 0 0] makesetfont
118.6354 -1955.163254 1983.510773 m
118.6355 -0 0 32 0 0 (\256) ts
118.6356 -}
118.6357 -true
118.6358 -[0 0 0 1]sts
118.6359 -Q
118.6360 -1952.1544 2066.5423 m
118.6361 -1938.0739 2069.025 L
118.6362 -1934.4274 2048.3444 L
118.6363 -1948.5079 2045.8617 L
118.6364 -1952.1544 2066.5423 L
118.6365 -n
118.6366 -q
118.6367 -_bfh
118.6368 -%%IncludeResource: font Symbol
118.6369 -_efh
118.6370 -{
118.6371 -f0 [19.696045 -3.4729 3.4729 19.696045 0 0] makesetfont
118.6372 -1935.29567 2053.268433 m
118.6373 -0 0 32 0 0 (") ts
118.6374 -}
118.6375 -true
118.6376 -[0 0 0 1]sts
118.6377 -Q
118.6378 -1931.7231 2043.621 m
118.6379 -1919.3084 2048.14 L
118.6380 -1910.6898 2024.4607 L
118.6381 -1923.1046 2019.9417 L
118.6382 -1931.7231 2043.621 L
118.6383 -n
118.6384 -q
118.6385 -_bfh
118.6386 -%%IncludeResource: font Symbol
118.6387 -_efh
118.6388 -{
118.6389 -f0 [22.552002 -8.208984 8.208252 22.552002 0 0] makesetfont
118.6390 -1912.741867 2030.098648 m
118.6391 -0 0 32 0 0 (=) ts
118.6392 -}
118.6393 -true
118.6394 -[0 0 0 1]sts
118.6395 -Q
118.6396 -1944 2024.5 m
118.6397 -1944 2014 L
118.6398 -0.8504 w
118.6399 -0 J
118.6400 -3.863693 M
118.6401 -[0 0 0 1]  vc
118.6402 -false setoverprint
118.6403 -S 
118.6404 -n
118.6405 -1944.25 2019.1673 m
118.6406 -1952.5 2015.9173 L
118.6407 -S 
118.6408 -n
118.6409 -1931.0787 2124.423 m
118.6410 -1855.5505 2043.4285 L
118.6411 -1871.0419 2013.0337 L
118.6412 -1946.5701 2094.0282 L
118.6413 -1931.0787 2124.423 L
118.6414 -n
118.6415 -q
118.6416 -_bfh
118.6417 -%%IncludeResource: font ZapfHumanist601BT-Bold
118.6418 -_efh
118.6419 -{
118.6420 -f1 [22.155762 23.759277 -14.753906 28.947754 0 0] makesetfont
118.6421 -1867.35347 2020.27063 m
118.6422 -0 0 32 0 0 (Isabelle) ts
118.6423 -}
118.6424 -true
118.6425 -[0 0 0 1]sts
118.6426 -Q
118.6427 -1933.5503 1996.9547 m
118.6428 -1922.7012 1998.8677 L
118.6429 -1919.0547 1978.1871 L
118.6430 -1929.9038 1976.2741 L
118.6431 -1933.5503 1996.9547 L
118.6432 -n
118.6433 -q
118.6434 -_bfh
118.6435 -%%IncludeResource: font Symbol
118.6436 -_efh
118.6437 -{
118.6438 -f0 [19.696045 -3.4729 3.4729 19.696045 0 0] makesetfont
118.6439 -1919.922913 1983.111069 m
118.6440 -0 0 32 0 0 (b) ts
118.6441 -}
118.6442 -true
118.6443 -[0 0 0 1]sts
118.6444 -Q
118.6445 -2006.3221 2025.7184 m
118.6446 -1993.8573 2027.9162 L
118.6447 -1990.2108 2007.2356 L
118.6448 -2002.6756 2005.0378 L
118.6449 -2006.3221 2025.7184 L
118.6450 -n
118.6451 -q
118.6452 -_bfh
118.6453 -%%IncludeResource: font Symbol
118.6454 -_efh
118.6455 -{
118.6456 -f0 [19.696045 -3.4729 3.4729 19.696045 0 0] makesetfont
118.6457 -1991.07901 2012.159653 m
118.6458 -0 0 32 0 0 (a) ts
118.6459 -}
118.6460 -true
118.6461 -[0 0 0 1]sts
118.6462 -Q
118.6463 -vmrs
118.6464 -2030.0624 2094.056 m
118.6465 -1956.3187 2120.904 L
118.6466 -1956.321 2095.3175 L
118.6467 -2030.0647 2068.4695 L
118.6468 -2030.0624 2094.056 L
118.6469 -n
118.6470 -q
118.6471 -_bfh
118.6472 -%%IncludeResource: font ZapfHumanist601BT-Bold
118.6473 -_efh
118.6474 -{
118.6475 -f1 [22.898804 -8.336792 -0.002197 24.368408 0 0] makesetfont
118.6476 -1956.320496 2101.409561 m
118.6477 -0 0 32 0 0 (Isar) ts
118.6478 -}
118.6479 -true
118.6480 -[0 0 0 1]sts
118.6481 -Q
118.6482 -vmr
118.6483 -vmr
118.6484 -end
118.6485 -%%Trailer
118.6486 -%%DocumentNeededResources: font Symbol
118.6487 -%%+ font ZapfHumanist601BT-Bold
118.6488 -%%DocumentFonts: Symbol
118.6489 -%%+ ZapfHumanist601BT-Bold
118.6490 -%%DocumentNeededFonts: Symbol
118.6491 -%%+ ZapfHumanist601BT-Bold
   119.1 Binary file doc-src/IsarAdvanced/Functions/isabelle_isar.pdf has changed
   120.1 --- a/doc-src/IsarAdvanced/Functions/mathpartir.sty	Mon Mar 02 16:58:39 2009 +0100
   120.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   120.3 @@ -1,421 +0,0 @@
   120.4 -%  Mathpartir --- Math Paragraph for Typesetting Inference Rules
   120.5 -%
   120.6 -%  Copyright (C) 2001, 2002, 2003, 2004, 2005 Didier Rémy
   120.7 -%
   120.8 -%  Author         : Didier Remy 
   120.9 -%  Version        : 1.2.0
  120.10 -%  Bug Reports    : to author
  120.11 -%  Web Site       : http://pauillac.inria.fr/~remy/latex/
  120.12 -% 
  120.13 -%  Mathpartir is free software; you can redistribute it and/or modify
  120.14 -%  it under the terms of the GNU General Public License as published by
  120.15 -%  the Free Software Foundation; either version 2, or (at your option)
  120.16 -%  any later version.
  120.17 -%  
  120.18 -%  Mathpartir is distributed in the hope that it will be useful,
  120.19 -%  but WITHOUT ANY WARRANTY; without even the implied warranty of
  120.20 -%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  120.21 -%  GNU General Public License for more details 
  120.22 -%  (http://pauillac.inria.fr/~remy/license/GPL).
  120.23 -%
  120.24 -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  120.25 -%  File mathpartir.sty (LaTeX macros)
  120.26 -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  120.27 -
  120.28 -\NeedsTeXFormat{LaTeX2e}
  120.29 -\ProvidesPackage{mathpartir}
  120.30 -    [2005/12/20 version 1.2.0 Math Paragraph for Typesetting Inference Rules]
  120.31 -
  120.32 -%%
  120.33 -
  120.34 -%% Identification
  120.35 -%% Preliminary declarations
  120.36 -
  120.37 -\RequirePackage {keyval}
  120.38 -
  120.39 -%% Options
  120.40 -%% More declarations
  120.41 -
  120.42 -%% PART I: Typesetting maths in paragraphe mode
  120.43 -
  120.44 -\newdimen \mpr@tmpdim
  120.45 -
  120.46 -% To ensure hevea \hva compatibility, \hva should expands to nothing 
  120.47 -% in mathpar or in inferrule
  120.48 -\let \mpr@hva \empty
  120.49 -
  120.50 -%% normal paragraph parametters, should rather be taken dynamically
  120.51 -\def \mpr@savepar {%
  120.52 -  \edef \MathparNormalpar
  120.53 -     {\noexpand \lineskiplimit \the\lineskiplimit
  120.54 -      \noexpand \lineskip \the\lineskip}%
  120.55 -  }
  120.56 -
  120.57 -\def \mpr@rulelineskip {\lineskiplimit=0.3em\lineskip=0.2em plus 0.1em}
  120.58 -\def \mpr@lesslineskip {\lineskiplimit=0.6em\lineskip=0.5em plus 0.2em}
  120.59 -\def \mpr@lineskip  {\lineskiplimit=1.2em\lineskip=1.2em plus 0.2em}
  120.60 -\let \MathparLineskip \mpr@lineskip
  120.61 -\def \mpr@paroptions {\MathparLineskip}
  120.62 -\let \mpr@prebindings \relax
  120.63 -
  120.64 -\newskip \mpr@andskip \mpr@andskip 2em plus 0.5fil minus 0.5em
  120.65 -
  120.66 -\def \mpr@goodbreakand
  120.67 -   {\hskip -\mpr@andskip  \penalty -1000\hskip \mpr@andskip}
  120.68 -\def \mpr@and {\hskip \mpr@andskip}
  120.69 -\def \mpr@andcr {\penalty 50\mpr@and}
  120.70 -\def \mpr@cr {\penalty -10000\mpr@and}
  120.71 -\def \mpr@eqno #1{\mpr@andcr #1\hskip 0em plus -1fil \penalty 10}
  120.72 -
  120.73 -\def \mpr@bindings {%
  120.74 -  \let \and \mpr@andcr
  120.75 -  \let \par \mpr@andcr
  120.76 -  \let \\\mpr@cr
  120.77 -  \let \eqno \mpr@eqno
  120.78 -  \let \hva \mpr@hva
  120.79 -  } 
  120.80 -\let \MathparBindings \mpr@bindings
  120.81 -
  120.82 -% \@ifundefined {ignorespacesafterend}
  120.83 -%    {\def \ignorespacesafterend {\aftergroup \ignorespaces}
  120.84 -
  120.85 -\newenvironment{mathpar}[1][]
  120.86 -  {$$\mpr@savepar \parskip 0em \hsize \linewidth \centering
  120.87 -     \vbox \bgroup \mpr@prebindings \mpr@paroptions #1\ifmmode $\else
  120.88 -     \noindent $\displaystyle\fi
  120.89 -     \MathparBindings}
  120.90 -  {\unskip \ifmmode $\fi\egroup $$\ignorespacesafterend}
  120.91 -
  120.92 -% \def \math@mathpar #1{\setbox0 \hbox {$\displaystyle #1$}\ifnum
  120.93 -%     \wd0 < \hsize  $$\box0$$\else \bmathpar #1\emathpar \fi}
  120.94 -
  120.95 -%%% HOV BOXES
  120.96 -
  120.97 -\def \mathvbox@ #1{\hbox \bgroup \mpr@normallineskip 
  120.98 -  \vbox \bgroup \tabskip 0em \let \\ \cr
  120.99 -  \halign \bgroup \hfil $##$\hfil\cr #1\crcr \egroup \egroup
 120.100 -  \egroup}
 120.101 -
 120.102 -\def \mathhvbox@ #1{\setbox0 \hbox {\let \\\qquad $#1$}\ifnum \wd0 < \hsize
 120.103 -      \box0\else \mathvbox {#1}\fi}
 120.104 -
 120.105 -
 120.106 -%% Part II -- operations on lists
 120.107 -
 120.108 -\newtoks \mpr@lista
 120.109 -\newtoks \mpr@listb
 120.110 -
 120.111 -\long \def\mpr@cons #1\mpr@to#2{\mpr@lista {\\{#1}}\mpr@listb \expandafter
 120.112 -{#2}\edef #2{\the \mpr@lista \the \mpr@listb}}
 120.113 -
 120.114 -\long \def\mpr@snoc #1\mpr@to#2{\mpr@lista {\\{#1}}\mpr@listb \expandafter
 120.115 -{#2}\edef #2{\the \mpr@listb\the\mpr@lista}}
 120.116 -
 120.117 -\long \def \mpr@concat#1=#2\mpr@to#3{\mpr@lista \expandafter {#2}\mpr@listb
 120.118 -\expandafter {#3}\edef #1{\the \mpr@listb\the\mpr@lista}}
 120.119 -
 120.120 -\def \mpr@head #1\mpr@to #2{\expandafter \mpr@head@ #1\mpr@head@ #1#2}
 120.121 -\long \def \mpr@head@ #1#2\mpr@head@ #3#4{\def #4{#1}\def#3{#2}}
 120.122 -
 120.123 -\def \mpr@flatten #1\mpr@to #2{\expandafter \mpr@flatten@ #1\mpr@flatten@ #1#2}
 120.124 -\long \def \mpr@flatten@ \\#1\\#2\mpr@flatten@ #3#4{\def #4{#1}\def #3{\\#2}}
 120.125 -
 120.126 -\def \mpr@makelist #1\mpr@to #2{\def \mpr@all {#1}%
 120.127 -   \mpr@lista {\\}\mpr@listb \expandafter {\mpr@all}\edef \mpr@all {\the
 120.128 -   \mpr@lista \the \mpr@listb \the \mpr@lista}\let #2\empty 
 120.129 -   \def \mpr@stripof ##1##2\mpr@stripend{\def \mpr@stripped{##2}}\loop
 120.130 -     \mpr@flatten \mpr@all \mpr@to \mpr@one
 120.131 -     \expandafter \mpr@snoc \mpr@one \mpr@to #2\expandafter \mpr@stripof
 120.132 -     \mpr@all \mpr@stripend  
 120.133 -     \ifx \mpr@stripped \empty \let \mpr@isempty 0\else \let \mpr@isempty 1\fi
 120.134 -     \ifx 1\mpr@isempty
 120.135 -   \repeat
 120.136 -}
 120.137 -
 120.138 -\def \mpr@rev #1\mpr@to #2{\let \mpr@tmp \empty
 120.139 -   \def \\##1{\mpr@cons ##1\mpr@to \mpr@tmp}#1\let #2\mpr@tmp}
 120.140 -
 120.141 -%% Part III -- Type inference rules
 120.142 -
 120.143 -\newif \if@premisse
 120.144 -\newbox \mpr@hlist
 120.145 -\newbox \mpr@vlist
 120.146 -\newif \ifmpr@center \mpr@centertrue
 120.147 -\def \mpr@htovlist {%
 120.148 -   \setbox \mpr@hlist
 120.149 -      \hbox {\strut
 120.150 -             \ifmpr@center \hskip -0.5\wd\mpr@hlist\fi
 120.151 -             \unhbox \mpr@hlist}%
 120.152 -   \setbox \mpr@vlist
 120.153 -      \vbox {\if@premisse  \box \mpr@hlist \unvbox \mpr@vlist
 120.154 -             \else \unvbox \mpr@vlist \box \mpr@hlist
 120.155 -             \fi}%
 120.156 -}
 120.157 -% OLD version
 120.158 -% \def \mpr@htovlist {%
 120.159 -%    \setbox \mpr@hlist
 120.160 -%       \hbox {\strut \hskip -0.5\wd\mpr@hlist \unhbox \mpr@hlist}%
 120.161 -%    \setbox \mpr@vlist
 120.162 -%       \vbox {\if@premisse  \box \mpr@hlist \unvbox \mpr@vlist
 120.163 -%              \else \unvbox \mpr@vlist \box \mpr@hlist
 120.164 -%              \fi}%
 120.165 -% }
 120.166 -
 120.167 -\def \mpr@item #1{$\displaystyle #1$}
 120.168 -\def \mpr@sep{2em}
 120.169 -\def \mpr@blank { }
 120.170 -\def \mpr@hovbox #1#2{\hbox
 120.171 -  \bgroup
 120.172 -  \ifx #1T\@premissetrue
 120.173 -  \else \ifx #1B\@premissefalse
 120.174 -  \else
 120.175 -     \PackageError{mathpartir}
 120.176 -       {Premisse orientation should either be T or B}
 120.177 -       {Fatal error in Package}%
 120.178 -  \fi \fi
 120.179 -  \def \@test {#2}\ifx \@test \mpr@blank\else
 120.180 -  \setbox \mpr@hlist \hbox {}%
 120.181 -  \setbox \mpr@vlist \vbox {}%
 120.182 -  \if@premisse \let \snoc \mpr@cons \else \let \snoc \mpr@snoc \fi
 120.183 -  \let \@hvlist \empty \let \@rev \empty
 120.184 -  \mpr@tmpdim 0em
 120.185 -  \expandafter \mpr@makelist #2\mpr@to \mpr@flat
 120.186 -  \if@premisse \mpr@rev \mpr@flat \mpr@to \@rev \else \let \@rev \mpr@flat \fi
 120.187 -  \def \\##1{%
 120.188 -     \def \@test {##1}\ifx \@test \empty
 120.189 -        \mpr@htovlist
 120.190 -        \mpr@tmpdim 0em %%% last bug fix not extensively checked
 120.191 -     \else
 120.192 -      \setbox0 \hbox{\mpr@item {##1}}\relax
 120.193 -      \advance \mpr@tmpdim by \wd0
 120.194 -      %\mpr@tmpdim 1.02\mpr@tmpdim
 120.195 -      \ifnum \mpr@tmpdim < \hsize
 120.196 -         \ifnum \wd\mpr@hlist > 0
 120.197 -           \if@premisse
 120.198 -             \setbox \mpr@hlist 
 120.199 -                \hbox {\unhbox0 \hskip \mpr@sep \unhbox \mpr@hlist}%
 120.200 -           \else
 120.201 -             \setbox \mpr@hlist
 120.202 -                \hbox {\unhbox \mpr@hlist  \hskip \mpr@sep \unhbox0}%
 120.203 -           \fi
 120.204 -         \else 
 120.205 -         \setbox \mpr@hlist \hbox {\unhbox0}%
 120.206 -         \fi
 120.207 -      \else
 120.208 -         \ifnum \wd \mpr@hlist > 0
 120.209 -            \mpr@htovlist 
 120.210 -            \mpr@tmpdim \wd0
 120.211 -         \fi
 120.212 -         \setbox \mpr@hlist \hbox {\unhbox0}%
 120.213 -      \fi
 120.214 -      \advance \mpr@tmpdim by \mpr@sep
 120.215 -   \fi
 120.216 -   }%
 120.217 -   \@rev
 120.218 -   \mpr@htovlist
 120.219 -   \ifmpr@center \hskip \wd\mpr@vlist\fi \box \mpr@vlist
 120.220 -   \fi
 120.221 -   \egroup
 120.222 -}
 120.223 -
 120.224 -%%% INFERENCE RULES
 120.225 -
 120.226 -\@ifundefined{@@over}{%
 120.227 -    \let\@@over\over % fallback if amsmath is not loaded
 120.228 -    \let\@@overwithdelims\overwithdelims
 120.229 -    \let\@@atop\atop \let\@@atopwithdelims\atopwithdelims
 120.230 -    \let\@@above\above \let\@@abovewithdelims\abovewithdelims
 120.231 -  }{}
 120.232 -
 120.233 -%% The default
 120.234 -
 120.235 -\def \mpr@@fraction #1#2{\hbox {\advance \hsize by -0.5em
 120.236 -    $\displaystyle {#1\mpr@over #2}$}}
 120.237 -\let \mpr@fraction \mpr@@fraction
 120.238 -
 120.239 -%% A generic solution to arrow
 120.240 -
 120.241 -\def \mpr@make@fraction #1#2#3#4#5{\hbox {%
 120.242 -     \def \mpr@tail{#1}%
 120.243 -     \def \mpr@body{#2}%
 120.244 -     \def \mpr@head{#3}%
 120.245 -     \setbox1=\hbox{$#4$}\setbox2=\hbox{$#5$}%
 120.246 -     \setbox3=\hbox{$\mkern -3mu\mpr@body\mkern -3mu$}%
 120.247 -     \setbox3=\hbox{$\mkern -3mu \mpr@body\mkern -3mu$}%
 120.248 -     \dimen0=\dp1\advance\dimen0 by \ht3\relax\dp1\dimen0\relax
 120.249 -     \dimen0=\ht2\advance\dimen0 by \dp3\relax\ht2\dimen0\relax
 120.250 -     \setbox0=\hbox {$\box1 \@@atop \box2$}%
 120.251 -     \dimen0=\wd0\box0
 120.252 -     \box0 \hskip -\dimen0\relax
 120.253 -     \hbox to \dimen0 {$%
 120.254 -       \mathrel{\mpr@tail}\joinrel
 120.255 -       \xleaders\hbox{\copy3}\hfil\joinrel\mathrel{\mpr@head}%
 120.256 -     $}}}
 120.257 -
 120.258 -%% Old stuff should be removed in next version
 120.259 -\def \mpr@@reduce #1#2{\hbox
 120.260 -    {$\lower 0.01pt \mpr@@fraction {#1}{#2}\mkern -15mu\rightarrow$}}
 120.261 -\def \mpr@@rewrite #1#2#3{\hbox
 120.262 -    {$\lower 0.01pt \mpr@@fraction {#2}{#3}\mkern -8mu#1$}}
 120.263 -\def \mpr@infercenter #1{\vcenter {\mpr@hovbox{T}{#1}}}
 120.264 -
 120.265 -\def \mpr@empty {}
 120.266 -\def \mpr@inferrule
 120.267 -  {\bgroup
 120.268 -     \ifnum \linewidth<\hsize \hsize \linewidth\fi
 120.269 -     \mpr@rulelineskip
 120.270 -     \let \and \qquad
 120.271 -     \let \hva \mpr@hva
 120.272 -     \let \@rulename \mpr@empty
 120.273 -     \let \@rule@options \mpr@empty
 120.274 -     \let \mpr@over \@@over
 120.275 -     \mpr@inferrule@}
 120.276 -\newcommand {\mpr@inferrule@}[3][]
 120.277 -  {\everymath={\displaystyle}%       
 120.278 -   \def \@test {#2}\ifx \empty \@test
 120.279 -      \setbox0 \hbox {$\vcenter {\mpr@hovbox{B}{#3}}$}%
 120.280 -   \else 
 120.281 -   \def \@test {#3}\ifx \empty \@test
 120.282 -      \setbox0 \hbox {$\vcenter {\mpr@hovbox{T}{#2}}$}%
 120.283 -   \else
 120.284 -   \setbox0 \mpr@fraction {\mpr@hovbox{T}{#2}}{\mpr@hovbox{B}{#3}}%
 120.285 -   \fi \fi
 120.286 -   \def \@test {#1}\ifx \@test\empty \box0
 120.287 -   \else \vbox 
 120.288 -%%% Suggestion de Francois pour les etiquettes longues
 120.289 -%%%   {\hbox to \wd0 {\RefTirName {#1}\hfil}\box0}\fi
 120.290 -      {\hbox {\RefTirName {#1}}\box0}\fi
 120.291 -   \egroup}
 120.292 -
 120.293 -\def \mpr@vdotfil #1{\vbox to #1{\leaders \hbox{$\cdot$} \vfil}}
 120.294 -
 120.295 -% They are two forms
 120.296 -% \inferrule [label]{[premisses}{conclusions}
 120.297 -% or
 120.298 -% \inferrule* [options]{[premisses}{conclusions}
 120.299 -%
 120.300 -% Premisses and conclusions are lists of elements separated by \\
 120.301 -% Each \\ produces a break, attempting horizontal breaks if possible, 
 120.302 -% and  vertical breaks if needed. 
 120.303 -% 
 120.304 -% An empty element obtained by \\\\ produces a vertical break in all cases. 
 120.305 -%
 120.306 -% The former rule is aligned on the fraction bar. 
 120.307 -% The optional label appears on top of the rule
 120.308 -% The second form to be used in a derivation tree is aligned on the last
 120.309 -% line of its conclusion
 120.310 -% 
 120.311 -% The second form can be parameterized, using the key=val interface. The
 120.312 -% folloiwng keys are recognized:
 120.313 -%       
 120.314 -%  width                set the width of the rule to val
 120.315 -%  narrower             set the width of the rule to val\hsize
 120.316 -%  before               execute val at the beginning/left
 120.317 -%  lab                  put a label [Val] on top of the rule
 120.318 -%  lskip                add negative skip on the right
 120.319 -%  left                 put a left label [Val]
 120.320 -%  Left                 put a left label [Val],  ignoring its width 
 120.321 -%  right                put a right label [Val]
 120.322 -%  Right                put a right label [Val], ignoring its width
 120.323 -%  leftskip             skip negative space on the left-hand side
 120.324 -%  rightskip            skip negative space on the right-hand side
 120.325 -%  vdots                lift the rule by val and fill vertical space with dots
 120.326 -%  after                execute val at the end/right
 120.327 -%  
 120.328 -%  Note that most options must come in this order to avoid strange
 120.329 -%  typesetting (in particular  leftskip must preceed left and Left and
 120.330 -%  rightskip must follow Right or right; vdots must come last 
 120.331 -%  or be only followed by rightskip. 
 120.332 -%  
 120.333 -
 120.334 -%% Keys that make sence in all kinds of rules
 120.335 -\def \mprset #1{\setkeys{mprset}{#1}}
 120.336 -\define@key {mprset}{flushleft}[]{\mpr@centerfalse}
 120.337 -\define@key {mprset}{center}[]{\mpr@centertrue}
 120.338 -\define@key {mprset}{rewrite}[]{\let \mpr@fraction \mpr@@rewrite}
 120.339 -\define@key {mprset}{myfraction}[]{\let \mpr@fraction #1}
 120.340 -\define@key {mprset}{fraction}[]{\def \mpr@fraction {\mpr@make@fraction #1}}
 120.341 -
 120.342 -\newbox \mpr@right
 120.343 -\define@key {mpr}{flushleft}[]{\mpr@centerfalse}
 120.344 -\define@key {mpr}{center}[]{\mpr@centertrue}
 120.345 -\define@key {mpr}{rewrite}[]{\let \mpr@fraction \mpr@@rewrite}
 120.346 -\define@key {mpr}{myfraction}[]{\let \mpr@fraction #1}
 120.347 -\define@key {mpr}{fraction}[]{\def \mpr@fraction {\mpr@make@fraction #1}}
 120.348 -\define@key {mpr}{left}{\setbox0 \hbox {$\TirName {#1}\;$}\relax
 120.349 -     \advance \hsize by -\wd0\box0}
 120.350 -\define@key {mpr}{width}{\hsize #1}
 120.351 -\define@key {mpr}{sep}{\def\mpr@sep{#1}}
 120.352 -\define@key {mpr}{before}{#1}
 120.353 -\define@key {mpr}{lab}{\let \RefTirName \TirName \def \mpr@rulename {#1}}
 120.354 -\define@key {mpr}{Lab}{\let \RefTirName \TirName \def \mpr@rulename {#1}}
 120.355 -\define@key {mpr}{narrower}{\hsize #1\hsize}
 120.356 -\define@key {mpr}{leftskip}{\hskip -#1}
 120.357 -\define@key {mpr}{reduce}[]{\let \mpr@fraction \mpr@@reduce}
 120.358 -\define@key {mpr}{rightskip}
 120.359 -  {\setbox \mpr@right \hbox {\unhbox \mpr@right \hskip -#1}}
 120.360 -\define@key {mpr}{LEFT}{\setbox0 \hbox {$#1$}\relax
 120.361 -     \advance \hsize by -\wd0\box0}
 120.362 -\define@key {mpr}{left}{\setbox0 \hbox {$\TirName {#1}\;$}\relax
 120.363 -     \advance \hsize by -\wd0\box0}
 120.364 -\define@key {mpr}{Left}{\llap{$\TirName {#1}\;$}}
 120.365 -\define@key {mpr}{right}
 120.366 -  {\setbox0 \hbox {$\;\TirName {#1}$}\relax \advance \hsize by -\wd0
 120.367 -   \setbox \mpr@right \hbox {\unhbox \mpr@right \unhbox0}}
 120.368 -\define@key {mpr}{RIGHT}
 120.369 -  {\setbox0 \hbox {$#1$}\relax \advance \hsize by -\wd0
 120.370 -   \setbox \mpr@right \hbox {\unhbox \mpr@right \unhbox0}}
 120.371 -\define@key {mpr}{Right}
 120.372 -  {\setbox \mpr@right \hbox {\unhbox \mpr@right \rlap {$\;\TirName {#1}$}}}
 120.373 -\define@key {mpr}{vdots}{\def \mpr@vdots {\@@atop \mpr@vdotfil{#1}}}
 120.374 -\define@key {mpr}{after}{\edef \mpr@after {\mpr@after #1}}
 120.375 -
 120.376 -\newdimen \rule@dimen
 120.377 -\newcommand \mpr@inferstar@ [3][]{\setbox0
 120.378 -  \hbox {\let \mpr@rulename \mpr@empty \let \mpr@vdots \relax
 120.379 -         \setbox \mpr@right \hbox{}%
 120.380 -         $\setkeys{mpr}{#1}%
 120.381 -          \ifx \mpr@rulename \mpr@empty \mpr@inferrule {#2}{#3}\else
 120.382 -          \mpr@inferrule [{\mpr@rulename}]{#2}{#3}\fi
 120.383 -          \box \mpr@right \mpr@vdots$}
 120.384 -  \setbox1 \hbox {\strut}
 120.385 -  \rule@dimen \dp0 \advance \rule@dimen by -\dp1
 120.386 -  \raise \rule@dimen \box0}
 120.387 -
 120.388 -\def \mpr@infer {\@ifnextchar *{\mpr@inferstar}{\mpr@inferrule}}
 120.389 -\newcommand \mpr@err@skipargs[3][]{}
 120.390 -\def \mpr@inferstar*{\ifmmode 
 120.391 -    \let \@do \mpr@inferstar@
 120.392 -  \else 
 120.393 -    \let \@do \mpr@err@skipargs
 120.394 -    \PackageError {mathpartir}
 120.395 -      {\string\inferrule* can only be used in math mode}{}%
 120.396 -  \fi \@do}
 120.397 -
 120.398 -
 120.399 -%%% Exports
 120.400 -
 120.401 -% Envirnonment mathpar
 120.402 -
 120.403 -\let \inferrule \mpr@infer
 120.404 -
 120.405 -% make a short name \infer is not already defined
 120.406 -\@ifundefined {infer}{\let \infer \mpr@infer}{}
 120.407 -
 120.408 -\def \TirNameStyle #1{\small \textsc{#1}}
 120.409 -\def \tir@name #1{\hbox {\small \TirNameStyle{#1}}}
 120.410 -\let \TirName \tir@name
 120.411 -\let \DefTirName \TirName
 120.412 -\let \RefTirName \TirName
 120.413 -
 120.414 -%%% Other Exports
 120.415 -
 120.416 -% \let \listcons \mpr@cons
 120.417 -% \let \listsnoc \mpr@snoc
 120.418 -% \let \listhead \mpr@head
 120.419 -% \let \listmake \mpr@makelist
 120.420 -
 120.421 -
 120.422 -
 120.423 -
 120.424 -\endinput
   121.1 --- a/doc-src/IsarAdvanced/Functions/style.sty	Mon Mar 02 16:58:39 2009 +0100
   121.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   121.3 @@ -1,46 +0,0 @@
   121.4 -%% toc
   121.5 -\newcommand{\tocentry}[1]{\cleardoublepage\phantomsection\addcontentsline{toc}{chapter}{#1}
   121.6 -\@mkboth{\MakeUppercase{#1}}{\MakeUppercase{#1}}}
   121.7 -
   121.8 -%% references
   121.9 -\newcommand{\secref}[1]{\S\ref{#1}}
  121.10 -\newcommand{\chref}[1]{chapter~\ref{#1}}
  121.11 -\newcommand{\figref}[1]{figure~\ref{#1}}
  121.12 -
  121.13 -%% math
  121.14 -\newcommand{\text}[1]{\mbox{#1}}
  121.15 -\newcommand{\isasymvartheta}{\isamath{\theta}}
  121.16 -\newcommand{\isactrlvec}[1]{\emph{$\overline{#1}$}}
  121.17 -
  121.18 -\setcounter{secnumdepth}{2} \setcounter{tocdepth}{2}
  121.19 -
  121.20 -\pagestyle{headings}
  121.21 -\sloppy
  121.22 -\binperiod
  121.23 -\underscoreon
  121.24 -
  121.25 -\renewcommand{\isadigit}[1]{\isamath{#1}}
  121.26 -
  121.27 -\newenvironment{mldecls}{\par\noindent\begingroup\footnotesize\def\isanewline{\\}\begin{tabular}{l}}{\end{tabular}\smallskip\endgroup}
  121.28 -
  121.29 -\isafoldtag{FIXME}
  121.30 -\isakeeptag{mlref}
  121.31 -\renewcommand{\isatagmlref}{\subsection*{\makebox[0pt][r]{\fbox{\ML}~~}Reference}\begingroup\def\isastyletext{\rm}\small}
  121.32 -\renewcommand{\endisatagmlref}{\endgroup}
  121.33 -
  121.34 -\newcommand{\isasymGUESS}{\isakeyword{guess}}
  121.35 -\newcommand{\isasymOBTAIN}{\isakeyword{obtain}}
  121.36 -\newcommand{\isasymTHEORY}{\isakeyword{theory}}
  121.37 -\newcommand{\isasymUSES}{\isakeyword{uses}}
  121.38 -\newcommand{\isasymEND}{\isakeyword{end}}
  121.39 -\newcommand{\isasymCONSTS}{\isakeyword{consts}}
  121.40 -\newcommand{\isasymDEFS}{\isakeyword{defs}}
  121.41 -\newcommand{\isasymTHEOREM}{\isakeyword{theorem}}
  121.42 -\newcommand{\isasymDEFINITION}{\isakeyword{definition}}
  121.43 -
  121.44 -\isabellestyle{it}
  121.45 -
  121.46 -%%% Local Variables: 
  121.47 -%%% mode: latex
  121.48 -%%% TeX-master: "implementation"
  121.49 -%%% End: 
   122.1 --- a/doc-src/IsarAdvanced/Makefile.in	Mon Mar 02 16:58:39 2009 +0100
   122.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   122.3 @@ -1,13 +0,0 @@
   122.4 -# $Id$
   122.5 -#
   122.6 -
   122.7 -include ../../Makefile.in
   122.8 -
   122.9 -SEDINDEX = ../../sedindex
  122.10 -FIXBOOKMARKS = perl -pi ../../fixbookmarks.pl
  122.11 -
  122.12 -isabelle_isar.eps:
  122.13 -	test -r isabelle_isar.eps || ln -s ../../gfx/isabelle_isar.eps .
  122.14 -
  122.15 -isabelle_isar.pdf:
  122.16 -	test -r isabelle_isar.pdf || ln -s ../../gfx/isabelle_isar.pdf .