diff --git a/books/bookvol10.3.pamphlet b/books/bookvol10.3.pamphlet
index 69bab0a..4a12546 100644
--- a/books/bookvol10.3.pamphlet
+++ b/books/bookvol10.3.pamphlet
@@ -910,6 +910,18 @@ AlgebraicNumber(): Exports == Implementation where
 
 @
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain ANON AnonymousFunction}
+\pagehead{AnonymousFunction}{ANON}
+\pagepic{ps/v103anonymousfunction.ps}{ANON}{1.00}
+<<domain ANON AnonymousFunction>>=
+)abbrev domain ANON AnonymousFunction
+++ Description:
+++ This domain implements anonymous functions
+AnonymousFunction():SetCategory == add
+  coerce(x:%):OutputForm == x pretend OutputForm
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \section{domain ANTISYM AntiSymm}
 \pagehead{AntiSymm}{ANTISYM}
 \pagepic{ps/v103antisymm.ps}{ANTISYM}{1.00}
@@ -16069,6 +16081,111 @@ DifferentialSparseMultivariatePolynomial(R, S, V):
 
 @
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain DIRPROD DirectProduct}
+\pagehead{DirectProduct}{DIRPROD}
+\pagepic{ps/v103directproduct.ps}{DIRPROD}{1.00}
+<<domain DIRPROD DirectProduct>>=
+)abbrev domain DIRPROD DirectProduct
+++ Author:
+++ Date Created:
+++ Date Last Updated:
+++ Basic Functions:
+++ Related Constructors: Vector, IndexedVector
+++ Also See: OrderedDirectProduct
+++ AMS Classifications:
+++ Keywords:
+++ References:
+++ Description:
+++   This type represents the finite direct or cartesian product of an
+++ underlying component type. This contrasts with simple vectors in that
+++ the members can be viewed as having constant length. Thus many
+++ categorical properties can by lifted from the underlying component type.
+++ Component extraction operations are provided but no updating operations.
+++ Thus new direct product elements can either be created by converting
+++ vector elements using the \spadfun{directProduct} function
+++ or by taking appropriate linear combinations of basis vectors provided
+++ by the \spad{unitVector} operation.
+ 
+DirectProduct(dim:NonNegativeInteger, R:Type):
+  DirectProductCategory(dim, R) == Vector R add
+ 
+      Rep := Vector R
+ 
+      coerce(z:%):Vector(R)        == copy(z)$Rep pretend Vector(R)
+      coerce(r:R):%                == new(dim, r)$Rep
+ 
+      parts x == VEC2LIST(x)$Lisp
+ 
+      directProduct z ==
+        size?(z, dim) => copy(z)$Rep
+        error "Not of the correct length"
+ 
+ 
+      if R has SetCategory then
+        same?: % -> Boolean
+        same? z == every?(#1 = z(minIndex z), z)
+ 
+        x = y == _and/[qelt(x,i)$Rep = qelt(y,i)$Rep for i in 1..dim]
+ 
+        retract(z:%):R ==
+          same? z => z(minIndex z)
+          error "Not retractable"
+ 
+        retractIfCan(z:%):Union(R, "failed") ==
+          same? z => z(minIndex z)
+          "failed"
+ 
+ 
+      if R has AbelianSemiGroup then
+        u:% + v:% == map(_+ , u, v)$Rep
+ 
+      if R has AbelianMonoid then
+        0 == zero(dim)$Vector(R) pretend %
+ 
+      if R has Monoid then
+        1 == new(dim, 1)$Vector(R) pretend %
+        u:% * r:R       == map(#1 * r, u)
+        r:R * u:%       == map(r * #1, u)
+        x:% * y:% == [x.i * y.i for i in 1..dim]$Vector(R) pretend %
+ 
+      if R has CancellationAbelianMonoid then
+        subtractIfCan(u:%, v:%):Union(%,"failed") ==
+          w := new(dim,0)$Vector(R)
+          for i in 1..dim repeat
+            (c := subtractIfCan(qelt(u, i)$Rep, qelt(v,i)$Rep)) case "failed" =>
+                    return "failed"
+            qsetelt_!(w, i, c::R)$Rep
+          w pretend %
+ 
+      if R has Ring then
+ 
+        u:% * v:%                    == map(_* , u, v)$Rep
+ 
+        recip z ==
+          w := new(dim,0)$Vector(R)
+          for i in minIndex w .. maxIndex w repeat
+            (u := recip qelt(z, i)) case "failed" => return "failed"
+            qsetelt_!(w, i, u::R)
+          w pretend %
+ 
+        unitVector i ==
+          v:= new(dim,0)$Vector(R)
+          v.i := 1
+          v pretend %
+ 
+      if R has OrderedSet then
+        x < y ==
+          for i in 1..dim repeat
+             qelt(x,i) < qelt(y,i) => return true
+             qelt(x,i) > qelt(y,i) => return false
+          false
+
+      if R has OrderedAbelianMonoidSup then sup(x, y) == map(sup, x, y)
+ 
+--)bo $noSubsumption := false
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \section{domain DPMM DirectProductMatrixModule}
 \pagehead{DirectProductMatrixModule}{DPMM}
 \pagepic{ps/v103directproductmatrixmodule.ps}{DPMM}{1.00}
@@ -19321,6 +19438,135 @@ EuclideanModularRing(S,R,Mod,reduction:(R,Mod) -> R,
 
 @
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain EXIT Exit}
+<<Exit.input>>=
+-- void.spad.pamphlet Exit.input
+)spool Exit.output
+)set message test on
+)set message auto off
+)clear all
+--S 1
+n := 0
+--R 
+--R
+--R   (1)  0
+--R                                                     Type: NonNegativeInteger
+--E 1
+
+--S 2
+gasp(): Exit ==
+  free n
+  n := n + 1
+  error "Oh no!"
+--R 
+--R   Function declaration gasp : () -> Exit has been added to workspace.
+--R                                                                   Type: Void
+--E 2
+
+--S 3
+half(k) ==
+  if odd? k then gasp()
+  else k quo 2
+--R 
+--R                                                                   Type: Void
+--E 3
+
+--S 4
+half 4
+--R 
+--R   Compiling function gasp with type () -> Exit 
+--R   Compiling function half with type PositiveInteger -> Integer 
+--R
+--R   (4)  2
+--R                                                        Type: PositiveInteger
+--E 4
+
+--S 5
+half 3
+--R 
+--R 
+--RDaly Bug
+--R   Error signalled from user code in function gasp: 
+--R      Oh no!
+--E 5
+
+--S 6
+n
+--R 
+--R
+--R   (5)  1
+--R                                                     Type: NonNegativeInteger
+--E 6
+)spool
+)lisp (bye)
+@
+<<Exit.help>>=
+====================================================================
+Exit examples
+====================================================================
+
+A function that does not return directly to its caller has Exit as its
+return type.  The operation error is an example of one which does not
+return to its caller.  Instead, it causes a return to top-level.
+
+  n := 0
+
+The function gasp is given return type Exit since it is guaranteed
+never to return a value to its caller.
+
+  gasp(): Exit ==
+    free n
+    n := n + 1
+    error "Oh no!"
+ 
+The return type of half is determined by resolving the types of the
+two branches of the if.
+
+  half(k) ==
+    if odd? k then gasp()
+    else k quo 2
+
+Because gasp has the return type Exit, the type of if in half is
+resolved to be Integer.
+
+  half 4
+
+  half 3
+
+  n
+
+See Also:
+o )show Exit
+o $AXIOM/doc/src/algebra/void.spad.dvi
+
+@
+\pagehead{Exit}{EXIT}
+\pagepic{ps/v103exit.ps}{EXIT}{1.00}
+<<domain EXIT Exit>>=
+)abbrev domain EXIT Exit
+++ Author: Stephen M. Watt
+++ Date Created: 1986
+++ Date Last Updated: May 30, 1991
+++ Basic Operations: 
+++ Related Domains: ErrorFunctions, ResolveLatticeCompletion, Void
+++ Also See:
+++ AMS Classifications:
+++ Keywords: exit, throw, error, non-local return
+++ Examples:
+++ References:
+++ Description:
+++   A function which does not return directly to its caller should
+++   have Exit as its return type.
+++
+++   Note: It is convenient to have a formal \spad{coerce} into each type from
+++   type Exit. This allows, for example, errors to be raised in 
+++   one half of a type-balanced \spad{if}.
+Exit: SetCategory == add
+        coerce(n:%) == error "Cannot use an Exit value."
+        n1 = n2     == error "Cannot use an Exit value."
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \section{domain EXPEXPAN ExponentialExpansion}
 \pagehead{ExponentialExpansion}{EXPEXPAN}
 \pagepic{ps/v103exponentialexpansion.ps}{EXPEXPAN}{1.00}
@@ -29299,6 +29545,111 @@ FreeModule(R:Ring,S:OrderedSet):
 
 @
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain FM1 FreeModule1}
+\pagehead{FreeModule1}{FM1}
+\pagepic{ps/v103freemodule1.ps}{FM1}{1.00}
+<<domain FM1 FreeModule1>>=
+)abbrev domain FM1 FreeModule1
+++ Author: Michel Petitot petitot@lifl.fr
+++ Date Created: 91
+++ Date Last Updated: 7 Juillet 92
+++ Fix History: compilation v 2.1 le 13 dec 98
+++ Basic Functions:
+++ Related Constructors:
+++ Also See:
+++ AMS Classifications:
+++ Keywords:
+++ References:
+++ Description:
+++   This domain implements linear combinations
+++   of elements from the domain \spad{S} with coefficients
+++   in the domain \spad{R} where \spad{S} is an ordered set
+++   and \spad{R} is a ring (which may be non-commutative).
+++   This domain is used by domains of non-commutative algebra such as:
+++       \spadtype{XDistributedPolynomial},
+++       \spadtype{XRecursivePolynomial}.
+++   Author: Michel Petitot (petitot@lifl.fr)
+
+FreeModule1(R:Ring,S:OrderedSet): FMcat == FMdef where
+  EX ==> OutputForm
+  TERM ==> Record(k:S,c:R)
+
+  FMcat == FreeModuleCat(R,S) with
+    "*":(S,R) -> %
+      ++ \spad{s*r} returns the product \spad{r*s}
+      ++ used by \spadtype{XRecursivePolynomial} 
+  FMdef == FreeModule(R,S) add
+    -- representation
+      Rep := List TERM  
+
+    -- declarations
+      lt: List TERM 
+      x : %
+      r : R
+      s : S
+
+    -- define
+      numberOfMonomials p ==
+         # (p::Rep)
+
+      ListOfTerms(x) == x:List TERM 
+
+      leadingTerm x == x.first
+      leadingMonomial x == x.first.k
+      coefficients x == [t.c for t in x]
+      monomials x == [ monom (t.k, t.c) for t in x]
+
+      retractIfCan x ==
+         numberOfMonomials(x) ^= 1 => "failed"
+         x.first.c = 1 => x.first.k
+         "failed"
+
+      coerce(s:S):% == [[s,1$R]]
+      retract x ==
+         (rr := retractIfCan x) case "failed" => error "FM1.retract impossible"
+         rr :: S
+
+      if R has noZeroDivisors then
+         r * x  ==
+             r = 0 => 0
+             [[u.k,r * u.c]$TERM for u in x]
+         x * r  == 
+             r = 0 => 0
+             [[u.k,u.c * r]$TERM for u in x]
+       else
+         r * x  ==
+             r = 0 => 0
+             [[u.k,a] for u in x | not (a:=r*u.c)= 0$R]
+         x * r  ==
+             r = 0 => 0
+             [[u.k,a] for u in x | not (a:=u.c*r)= 0$R]
+
+      r * s ==
+        r = 0 => 0
+        [[s,r]$TERM]
+
+      s * r ==
+        r = 0 => 0
+        [[s,r]$TERM]
+
+      monom(b,r):% == [[b,r]$TERM] 
+
+      outTerm(r:R, s:S):EX ==
+            r=1  => s::EX
+            r::EX * s::EX
+
+      coerce(a:%):EX ==
+            empty? a => (0$R)::EX
+            reduce(_+, reverse_! [outTerm(t.c, t.k) for t in a])$List(EX)
+
+      coefficient(x,s) ==
+         null x => 0$R
+         x.first.k > s => coefficient(rest x,s)
+         x.first.k = s => x.first.c
+         0$R
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \section{domain FMONOID FreeMonoid}
 \pagehead{FreeMonoid}{FMONOID}
 \pagepic{ps/v103freemonoid.ps}{FMONOID}{1.00}
@@ -30270,6 +30621,24 @@ FullPartialFractionExpansion(F, UP): Exports == Implementation where
 
 @
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain FUNCTION FunctionCalled}
+\pagehead{FunctionCalled}{FUNCTION}
+\pagepic{ps/v103functioncalled.ps}{FUNCTION}{1.00}
+<<domain FUNCTION FunctionCalled>>=
+)abbrev domain FUNCTION FunctionCalled
+++ Description:
+++ This domain implements named functions
+FunctionCalled(f:Symbol): SetCategory with 
+	name: % -> Symbol 
+		++ name(x) returns the symbol
+  == add
+   name r                 == f
+   coerce(r:%):OutputForm == f::OutputForm
+   x = y                  == true
+   latex(x:%):String      == latex f
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \chapter{Chapter G}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \section{domain GDMP GeneralDistributedMultivariatePolynomial}
@@ -31558,6 +31927,416 @@ GeneralUnivariatePowerSeries(Coef,var,cen): Exports == Implementation where
 
 @
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain GRIMAGE GraphImage}
+\pagehead{GraphImage}{GRIMAGE}
+\pagepic{ps/v103graphimage.ps}{GRIMAGE}{1.00}
+<<domain GRIMAGE GraphImage>>=
+)abbrev domain GRIMAGE GraphImage
+++ Author: Jim Wen
+++ Date Created: 27 April 1989
+++ Date Last Updated: 1995 September 20, Mike Richardson (MGR)
+++ Basic Operations: 
+++ Related Constructors:
+++ Also See:
+++ AMS Classifications:
+++ Keywords: 
+++ References:
+++ Description: TwoDimensionalGraph creates virtual two dimensional graphs 
+++ (to be displayed on TwoDimensionalViewports).
+GraphImage (): Exports == Implementation where
+
+  VIEW    ==> VIEWPORTSERVER$Lisp
+  sendI   ==> SOCK_-SEND_-INT
+  sendSF  ==> SOCK_-SEND_-FLOAT
+  sendSTR ==> SOCK_-SEND_-STRING
+  getI    ==> SOCK_-GET_-INT
+  getSF   ==> SOCK_-GET_-FLOAT
+
+  typeGRAPH  ==> 2
+  typeVIEW2D ==> 3
+
+  makeGRAPH  ==> (-1)$SingleInteger
+  makeVIEW2D ==> (-1)$SingleInteger
+ 
+  I   ==> Integer
+  PI  ==> PositiveInteger
+  NNI ==> NonNegativeInteger
+  SF  ==> DoubleFloat
+  F   ==> Float
+  L   ==> List
+  P   ==> Point(SF)
+  V   ==> Vector
+  SEG ==> Segment
+  RANGESF   ==> L SEG SF
+  RANGEF    ==> L SEG F
+  UNITSF   ==> L SF
+  UNITF    ==> L F
+  PAL ==> Palette
+  E   ==> OutputForm
+  DROP ==> DrawOption
+  PP ==> PointPackage(SF)
+  COORDSYS ==> CoordinateSystems(SF)
+
+  Exports ==> SetCategory with
+    graphImage      :  ()                                        -> $
+      ++ graphImage() returns an empty graph with 0 point lists 
+      ++ of the domain \spadtype{GraphImage}.  A graph image contains
+      ++ the graph data component of a two dimensional viewport.
+    makeGraphImage  :  $                                         -> $ 
+      ++ makeGraphImage(gi) takes the given graph, \spad{gi} of the
+      ++ domain \spadtype{GraphImage}, and sends it's data to the
+      ++ viewport manager where it waits to be included in a two-dimensional
+      ++ viewport window.  \spad{gi} cannot be an empty graph, and it's
+      ++ elements must have been created using the \spadfun{point} or
+      ++ \spadfun{component} functions, not by a previous
+      ++ \spadfun{makeGraphImage}.
+    makeGraphImage  :  (L L P)                                   -> $
+      ++ makeGraphImage(llp) returns a graph of the domain 
+      ++ \spadtype{GraphImage} which is composed of the points and 
+      ++ lines from the list of lists of points, \spad{llp}, with 
+      ++ default point size and default point and line colours. The graph
+      ++ data is then sent to the viewport manager where it waits to be
+      ++ included in a two-dimensional viewport window.
+    makeGraphImage  :  (L L P,L PAL,L PAL,L PI)                  -> $ 
+      ++ makeGraphImage(llp,lpal1,lpal2,lp) returns a graph of the
+      ++ domain \spadtype{GraphImage} which is composed of the points
+      ++ and lines from the list of lists of points, \spad{llp}, whose
+      ++ point colors are indicated by the list of palette colors,
+      ++ \spad{lpal1}, and whose lines are colored according to the list
+      ++ of palette colors, \spad{lpal2}.  The paramater lp is a list of
+      ++ integers which denote the size of the data points.  The graph
+      ++ data is then sent to the viewport manager where it waits to be
+      ++ included in a two-dimensional viewport window.
+    makeGraphImage  :  (L L P,L PAL,L PAL,L PI,L DROP)           -> $
+      ++ makeGraphImage(llp,lpal1,lpal2,lp,lopt) returns a graph of
+      ++ the domain \spadtype{GraphImage} which is composed of the 
+      ++ points and lines from the list of lists of points, \spad{llp},
+      ++ whose point colors are indicated by the list of palette colors,
+      ++ \spad{lpal1}, and whose lines are colored according to the list
+      ++ of palette colors, \spad{lpal2}.  The paramater lp is a list of
+      ++ integers which denote the size of the data points, and \spad{lopt}
+      ++ is the list of draw command options.  The graph data is then sent
+      ++ to the viewport manager where it waits to be included in a 
+      ++ two-dimensional viewport window.
+    pointLists      :  $                                         -> L L P
+      ++ pointLists(gi) returns the list of lists of points which compose
+      ++ the given graph, \spad{gi}, of the domain \spadtype{GraphImage}.
+    key             :  $                                         -> I
+      ++ key(gi) returns the process ID of the given graph, \spad{gi},
+      ++ of the domain \spadtype{GraphImage}.
+    ranges          :  $                                         -> RANGEF
+      ++ ranges(gi) returns the list of ranges of the point components from
+      ++ the indicated graph, \spad{gi}, of the domain \spadtype{GraphImage}.
+    ranges          :  ($,RANGEF)                                -> RANGEF
+      ++ ranges(gi,lr) modifies the list of ranges for the given graph,
+      ++ \spad{gi} of the domain \spadtype{GraphImage}, to be that of the
+      ++ list of range segments, \spad{lr}, and returns the new range list
+      ++ for \spad{gi}. 
+    units           :  $                                         -> UNITF
+      ++ units(gi) returns the list of unit increments for the x and y
+      ++ axes of the indicated graph, \spad{gi}, of the domain
+      ++ \spadtype{GraphImage}.
+    units           :  ($,UNITF)                                 -> UNITF
+      ++ units(gi,lu) modifies the list of unit increments for the x and y
+      ++ axes of the given graph, \spad{gi} of the domain
+      ++ \spadtype{GraphImage}, to be that of the list of unit increments,
+      ++ \spad{lu}, and returns the new list of units for \spad{gi}. 
+    component       :  ($,L P,PAL,PAL,PI)                        -> Void
+      ++ component(gi,lp,pal1,pal2,p) sets the components of the
+      ++ graph, \spad{gi} of the domain \spadtype{GraphImage}, to the
+      ++ values given.  The point list for \spad{gi} is set to the list
+      ++ \spad{lp}, the color of the points in \spad{lp} is set to
+      ++ the palette color \spad{pal1}, the color of the lines which
+      ++ connect the points \spad{lp} is set to the palette color
+      ++ \spad{pal2}, and the size of the points in \spad{lp} is given
+      ++ by the integer p.
+    component       :  ($,P)                                     -> Void
+      ++ component(gi,pt) modifies the graph \spad{gi} of the domain
+      ++ \spadtype{GraphImage} to contain one point component, \spad{pt}
+      ++ whose point color, line color and point size are determined by
+      ++ the default functions \spadfun{pointColorDefault},
+      ++ \spadfun{lineColorDefault}, and \spadfun{pointSizeDefault}.
+    component       :  ($,P,PAL,PAL,PI)                          -> Void
+      ++ component(gi,pt,pal1,pal2,ps) modifies the graph \spad{gi} of
+      ++ the domain \spadtype{GraphImage} to contain one point component,
+      ++ \spad{pt} whose point color is set to the palette color \spad{pal1},
+      ++ line color is set to the palette color \spad{pal2}, and point
+      ++ size is set to the positive integer \spad{ps}.
+    appendPoint     :  ($,P)                                     -> Void
+      ++ appendPoint(gi,pt) appends the point \spad{pt} to the end
+      ++ of the list of points component for the graph, \spad{gi}, which is
+      ++ of the domain \spadtype{GraphImage}.
+    point           :  ($,P,PAL)                                 -> Void
+      ++ point(gi,pt,pal) modifies the graph \spad{gi} of the domain
+      ++ \spadtype{GraphImage} to contain one point component, \spad{pt}
+      ++ whose point color is set to be the palette color \spad{pal}, and
+      ++ whose line color and point size are determined by the default
+      ++ functions \spadfun{lineColorDefault} and \spadfun{pointSizeDefault}.
+    coerce          :  L L P                                     -> $
+      ++ coerce(llp)
+      ++ component(gi,pt) creates and returns a graph of the domain
+      ++ \spadtype{GraphImage} which is composed of the list of list
+      ++ of points given by \spad{llp}, and whose point colors, line colors
+      ++ and point sizes are determined by the default functions 
+      ++ \spadfun{pointColorDefault}, \spadfun{lineColorDefault}, and
+      ++ \spadfun{pointSizeDefault}.  The graph data is then sent to the 
+      ++ viewport manager where it waits to be included in a two-dimensional
+      ++ viewport window.
+    coerce          :  $                                         -> E
+      ++ coerce(gi) returns the indicated graph, \spad{gi}, of domain
+      ++ \spadtype{GraphImage} as output of the domain \spadtype{OutputForm}.
+    putColorInfo    : (L L P,L PAL)                              -> L L P
+      ++ putColorInfo(llp,lpal) takes a list of list of points, \spad{llp},
+      ++ and returns the points with their hue and shade components
+      ++ set according to the list of palette colors, \spad{lpal}.
+    figureUnits : L L P                       -> UNITSF
+
+  Implementation ==> add
+    import Color()
+    import Palette()
+    import ViewDefaultsPackage()
+    import PlotTools()
+    import DrawOptionFunctions0
+    import P
+    import PP
+    import COORDSYS
+
+    Rep := Record(key: I, rangesField: RANGESF, unitsField: UNITSF, _
+       llPoints: L L P, pointColors: L PAL, lineColors: L PAL, pointSizes: L PI, _
+       optionsField: L DROP)
+
+--%Internal Functions
+
+    graph       : RANGEF                          -> $
+    scaleStep   : SF                          -> SF
+    makeGraph   :  $                          -> $
+
+
+    numberCheck(nums:Point SF):Void ==
+      for i in minIndex(nums)..maxIndex(nums) repeat
+        COMPLEXP(nums.(i::PositiveInteger))$Lisp =>
+          error "An unexpected complex number was encountered in the calculations."
+           
+
+    doOptions(g:Rep):Void ==    
+      lr : RANGEF := ranges(g.optionsField,ranges g)
+      if (#lr > 1$I) then
+        g.rangesField := [segment(convert(lo(lr.1))@SF,convert(hi(lr.1))@SF)$(Segment(SF)), 
+                           segment(convert(lo(lr.2))@SF,convert(hi(lr.2))@SF)$(Segment(SF))]
+      else
+        g.rangesField := []
+      lu : UNITF := units(g.optionsField,units g)
+      if (#lu > 1$I) then
+        g.unitsField := [convert(lu.1)@SF,convert(lu.2)@SF]
+      else
+        g.unitsField := []
+    -- etc - graphimage specific stuff...
+
+    putColorInfo(llp,listOfPalettes) ==
+      llp2 : L L P := []
+      for lp in llp for pal in listOfPalettes repeat
+        lp2 : L P := []
+        daHue   := (hue(hue pal))::SF
+        daShade := (shade pal)::SF
+        for p in lp repeat
+          if (d := dimension p) < 3 then
+            p := extend(p,[daHue,daShade])
+          else
+            p.3 := daHue
+            d < 4 => p := extend(p,[daShade])
+            p.4 := daShade
+          lp2 := cons(p,lp2)
+        llp2 := cons(reverse_! lp2,llp2)
+      reverse_! llp2
+
+    graph demRanges ==
+      null demRanges =>  [ 0, [], [], [], [], [], [], [] ]
+      demRangesSF : RANGESF := _
+        [ segment(convert(lo demRanges.1)@SF,convert(hi demRanges.1)@SF)$(Segment(SF)), _
+          segment(convert(lo demRanges.1)@SF,convert(hi demRanges.1)@SF)$(Segment(SF)) ]
+      [ 0, demRangesSF, [], [], [], [], [], [] ]
+
+    scaleStep(range) ==                        -- MGR
+      
+      adjust:NNI
+      tryStep:SF
+      scaleDown:SF
+      numerals:String
+      adjust := 0
+      while range < 100.0::SF repeat
+        adjust := adjust + 1
+        range := range * 10.0::SF -- might as well take big steps
+      tryStep := range/10.0::SF
+      numerals := string(((retract(ceiling(tryStep)$SF)$SF)@I))$String
+      scaleDown := (10@I **$I (((#(numerals)@I) - 1$I) pretend PI))::SF
+      scaleDown*ceiling(tryStep/scaleDown - 0.5::SF)/((10 **$I adjust)::SF)
+
+    figureUnits(listOfListsOfPoints) ==
+        -- figure out the min/max and divide by 10 for unit markers
+      xMin := xMax := xCoord first first listOfListsOfPoints
+      yMin := yMax := yCoord first first listOfListsOfPoints
+      if xMin ~= xMin then xMin:=max()
+      if xMax ~= xMax then xMax:=min()
+      if yMin ~= yMin then yMin:=max()
+      if yMax ~= yMax then yMax:=min()
+      for pL in listOfListsOfPoints repeat
+        for p in pL repeat
+          if ((px := (xCoord p)) < xMin) then
+            xMin := px
+          if px > xMax then
+            xMax := px
+          if ((py := (yCoord p)) < yMin) then
+            yMin := py
+          if py > yMax then
+            yMax := py
+      if xMin = xMax then
+        xMin := xMin - convert(0.5)$Float
+        xMax := xMax + convert(0.5)$Float
+      if yMin = yMax then
+        yMin := yMin - convert(0.5)$Float
+        yMax := yMax + convert(0.5)$Float
+      [scaleStep(xMax-xMin),scaleStep(yMax-yMin)]
+
+    plotLists(graf:Rep,listOfListsOfPoints:L L P,listOfPointColors:L PAL,listOfLineColors:L PAL,listOfPointSizes:L PI):$ ==
+      givenLen := #listOfListsOfPoints
+        -- take out point lists that are actually empty
+      listOfListsOfPoints := [ l for l in listOfListsOfPoints | ^null l ]
+      if (null listOfListsOfPoints) then
+        error "GraphImage was given a list that contained no valid point lists"
+      if ((len := #listOfListsOfPoints) ^= givenLen) then
+        sayBrightly(["   Warning: Ignoring pointless point list"::E]$List(E))$Lisp
+      graf.llPoints := listOfListsOfPoints
+        -- do point colors
+      if ((givenLen := #listOfPointColors) > len) then
+         -- pad or discard elements if given list has length different from the point list
+        graf.pointColors := concat(listOfPointColors,
+            new((len - givenLen)::NonNegativeInteger + 1, pointColorDefault()))
+      else graf.pointColors := first(listOfPointColors, len)
+        -- do line colors
+      if ((givenLen := #listOfLineColors) > len) then
+        graf.lineColors := concat(listOfLineColors,
+             new((len - givenLen)::NonNegativeInteger + 1, lineColorDefault()))
+      else graf.lineColors := first(listOfLineColors, len)
+        -- do point sizes
+      if ((givenLen := #listOfPointSizes) > len) then
+        graf.pointSizes := concat(listOfPointSizes,
+             new((len - givenLen)::NonNegativeInteger + 1, pointSizeDefault()))
+      else graf.pointSizes := first(listOfPointSizes, len)
+      graf
+
+    makeGraph graf ==
+      doOptions(graf)
+      (s := #(graf.llPoints)) = 0 =>
+        error "You are trying to make a graph with no points"
+      key graf ^= 0 => 
+        error "You are trying to draw over an existing graph"
+      transform := coord(graf.optionsField,cartesian$COORDSYS)$DrawOptionFunctions0 
+      graf.llPoints:= putColorInfo(graf.llPoints,graf.pointColors)
+      if null(ranges graf) then  -- figure out best ranges for points
+        graf.rangesField := calcRanges(graf.llPoints)  --::V SEG SF
+      if null(units graf) then  -- figure out best ranges for points
+        graf.unitsField := figureUnits(graf.llPoints)  --::V SEG SF
+      sayBrightly(["   Graph data being transmitted to the viewport manager..."::E]$List(E))$Lisp
+      sendI(VIEW,typeGRAPH)$Lisp
+      sendI(VIEW,makeGRAPH)$Lisp
+      tonto := (graf.rangesField)::RANGESF
+      sendSF(VIEW,lo(first tonto))$Lisp
+      sendSF(VIEW,hi(first tonto))$Lisp
+      sendSF(VIEW,lo(second tonto))$Lisp
+      sendSF(VIEW,hi(second tonto))$Lisp
+      sendSF(VIEW,first (graf.unitsField))$Lisp
+      sendSF(VIEW,second (graf.unitsField))$Lisp
+      sendI(VIEW,s)$Lisp     -- how many lists of points are being sent
+      for aList in graf.llPoints for pColor in graf.pointColors for lColor in graf.lineColors for s in graf.pointSizes repeat
+        sendI(VIEW,#aList)$Lisp  -- how many points in this list
+        for p in aList repeat
+          aPoint := transform p
+          sendSF(VIEW,xCoord aPoint)$Lisp
+          sendSF(VIEW,yCoord aPoint)$Lisp
+          sendSF(VIEW,hue(p)$PP)$Lisp  -- ?use aPoint as well...?
+          sendSF(VIEW,shade(p)$PP)$Lisp
+        hueShade := hue hue pColor + shade pColor * numberOfHues() 
+        sendI(VIEW,hueShade)$Lisp
+        hueShade := (hue hue lColor -1)*5 + shade lColor
+        sendI(VIEW,hueShade)$Lisp
+        sendI(VIEW,s)$Lisp
+      graf.key := getI(VIEW)$Lisp
+      graf        
+
+
+--%Exported Functions
+    makeGraphImage(graf:$)    == makeGraph graf
+    key graf                  == graf.key
+    pointLists graf           == graf.llPoints
+    ranges graf                == 
+      null graf.rangesField => []
+      [segment(convert(lo graf.rangesField.1)@F,convert(hi graf.rangesField.1)@F), _
+       segment(convert(lo graf.rangesField.2)@F,convert(hi graf.rangesField.2)@F)]
+    ranges(graf,rangesList)     == 
+      graf.rangesField := 
+        [segment(convert(lo rangesList.1)@SF,convert(hi rangesList.1)@SF), _
+         segment(convert(lo rangesList.2)@SF,convert(hi rangesList.2)@SF)]
+      rangesList
+    units graf                == 
+      null(graf.unitsField) => []
+      [convert(graf.unitsField.1)@F,convert(graf.unitsField.2)@F]
+    units (graf,unitsToBe)    == 
+      graf.unitsField := [convert(unitsToBe.1)@SF,convert(unitsToBe.2)@SF]
+      unitsToBe
+    graphImage                == graph []
+
+    makeGraphImage(llp) ==
+      makeGraphImage(llp,
+        [pointColorDefault() for i in 1..(l:=#llp)],
+	 [lineColorDefault() for i in 1..l], 
+          [pointSizeDefault() for i in 1..l])
+
+    makeGraphImage(llp,lpc,llc,lps) ==
+      makeGraphImage(llp,lpc,llc,lps,[])
+
+    makeGraphImage(llp,lpc,llc,lps,opts) ==
+      graf := graph(ranges(opts,[]))
+      graf.optionsField := opts
+      graf := plotLists(graf,llp,lpc,llc,lps)
+      transform := coord(graf.optionsField,cartesian$COORDSYS)$DrawOptionFunctions0
+      for aList in graf.llPoints repeat
+        for p in aList repeat
+          aPoint := transform p
+          numberCheck aPoint
+      makeGraph graf
+
+    component (graf:$,ListOfPoints:L P,PointColor:PAL,LineColor:PAL,PointSize:PI) ==
+      graf.llPoints    := append(graf.llPoints,[ListOfPoints])
+      graf.pointColors := append(graf.pointColors,[PointColor])
+      graf.lineColors  := append(graf.lineColors,[LineColor])
+      graf.pointSizes  := append(graf.pointSizes,[PointSize])     
+
+    component (graf,aPoint) ==
+      component(graf,aPoint,pointColorDefault(),lineColorDefault(),pointSizeDefault())
+
+    component (graf:$,aPoint:P,PointColor:PAL,LineColor:PAL,PointSize:PI) ==
+      component (graf,[aPoint],PointColor,LineColor,PointSize)
+
+    appendPoint (graf,aPoint) ==
+      num : I  := #(graf.llPoints) - 1
+      num < 0 => error "No point lists to append to!"
+      (graf.llPoints.num) := append((graf.llPoints.num),[aPoint])
+
+    point (graf,aPoint,PointColor) ==
+      component(graf,aPoint,PointColor,lineColorDefault(),pointSizeDefault())
+
+    coerce (llp : L L P) : $ ==
+      makeGraphImage(llp,
+          [pointColorDefault() for i in 1..(l:=#llp)],
+		[lineColorDefault() for i in 1..l], 
+                     [pointSizeDefault() for i in 1..l])
+
+    coerce (graf : $) : E ==
+      hconcat( ["Graph with " :: E,(p := # pointLists graf) :: E, 
+         (p=1 => " point list"; " point lists") :: E])
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \chapter{Chapter H}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \section{domain HASHTBL HashTable}
@@ -33864,6 +34643,29 @@ IndexedTwoDimensionalArray(R,mnRow,mnCol):Exports == Implementation where
 
 @
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain IVECTOR IndexedVector}
+\pagehead{IndexedVector}{IVECTOR}
+\pagepic{ps/v103indexedvector.ps}{IVECTOR}{1.00}
+<<domain IVECTOR IndexedVector>>=
+)abbrev domain IVECTOR IndexedVector
+++ Author:
+++ Date Created:
+++ Date Last Updated:
+++ Basic Functions:
+++ Related Constructors: Vector, DirectProduct
+++ Also See:
+++ AMS Classifications:
+++ Keywords:
+++ References:
+++ Description:
+++   This type represents vector like objects with varying lengths
+++ and a user-specified initial index.
+ 
+IndexedVector(R:Type, mn:Integer):
+  VectorCategory R == IndexedOneDimensionalArray(R, mn)
+ 
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \section{domain ITUPLE InfiniteTuple}
 \pagehead{InfiniteTuple}{ITUPLE}
 \pagepic{ps/v103infinitetuple.ps}{ITUPLE}{1.00}
@@ -38807,6 +39609,962 @@ Library(): TableAggregate(String, Any) with
 
 @
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain LEXP LieExponentials}
+<<LieExponentials.input>>=
+-- xlpoly.spad.pamphlet LieExponentials.input
+)spool LieExponentials.output
+)set message test on
+)set message auto off
+)clear all
+--S 1 of 13
+a: Symbol := 'a
+--R 
+--R
+--R   (1)  a
+--R                                                                 Type: Symbol
+--E 1
+
+--S 2 of 13
+b: Symbol := 'b
+--R 
+--R
+--R   (2)  b
+--R                                                                 Type: Symbol
+--E 2
+
+--S 3 of 13
+coef := Fraction(Integer) 
+--R 
+--R
+--R   (3)  Fraction Integer
+--R                                                                 Type: Domain
+--E 3
+
+--S 4 of 13
+group := LieExponentials(Symbol, coef, 3)
+--R 
+--R
+--R   (4)  LieExponentials(Symbol,Fraction Integer,3)
+--R                                                                 Type: Domain
+--E 4
+
+--S 5 of 13
+lpoly := LiePolynomial(Symbol, coef)
+--R 
+--R
+--R   (5)  LiePolynomial(Symbol,Fraction Integer)
+--R                                                                 Type: Domain
+--E 5
+
+--S 6 of 13
+poly := XPBWPolynomial(Symbol, coef)
+--R 
+--R
+--R   (6)  XPBWPolynomial(Symbol,Fraction Integer)
+--R                                                                 Type: Domain
+--E 6
+
+--S 7 of 13
+ea := exp(a::lpoly)$group
+--R 
+--R
+--R         [a]
+--R   (7)  e
+--R                             Type: LieExponentials(Symbol,Fraction Integer,3)
+--E 7
+
+--S 8 of 13
+eb := exp(b::lpoly)$group
+--R 
+--R
+--R         [b]
+--R   (8)  e
+--R                             Type: LieExponentials(Symbol,Fraction Integer,3)
+--E 8
+
+--S 9 of 13
+g: group := ea*eb
+--R 
+--R
+--R             1     2        1   2
+--R             - [a b ]       - [a b]
+--R         [b] 2        [a b] 2       [a]
+--R   (9)  e   e        e     e       e
+--R                             Type: LieExponentials(Symbol,Fraction Integer,3)
+--E 9
+
+--S 10 of 13
+g :: poly
+--R 
+--R
+--R   (10)
+--R                     1                           1          1
+--R     1 + [a] + [b] + - [a][a] + [a b] + [b][a] + - [b][b] + - [a][a][a]
+--R                     2                           2          6
+--R   + 
+--R     1   2                1     2    1                        1
+--R     - [a b] + [a b][a] + - [a b ] + - [b][a][a] + [b][a b] + - [b][b][a]
+--R     2                    2          2                        2
+--R   + 
+--R     1
+--R     - [b][b][b]
+--R     6
+--R                                Type: XPBWPolynomial(Symbol,Fraction Integer)
+--E 10
+
+--S 11 of 13
+log(g)$group
+--R 
+--R
+--R                     1          1   2      1     2
+--R   (11)  [a] + [b] + - [a b] + -- [a b] + -- [a b ]
+--R                     2         12         12
+--R                                 Type: LiePolynomial(Symbol,Fraction Integer)
+--E 11
+
+--S 12 of 13
+g1: group := inv(g)
+--R 
+--R
+--R          - [b] - [a]
+--R   (12)  e     e
+--R                             Type: LieExponentials(Symbol,Fraction Integer,3)
+--E 12
+
+--S 13 of 13
+g*g1
+--R 
+--R
+--R   (13)  1
+--R                             Type: LieExponentials(Symbol,Fraction Integer,3)
+--E 13
+)spool
+)lisp (bye)
+@
+<<LieExponentials.help>>=
+====================================================================
+LieExponentials examples
+====================================================================
+
+  a: Symbol := 'a
+    a
+                         Type: Symbol
+
+  b: Symbol := 'b
+    b
+                         Type: Symbol
+
+====================================================================
+Declarations of domains
+====================================================================
+
+  coef := Fraction(Integer) 
+    Fraction Integer
+                         Type: Domain
+
+  group := LieExponentials(Symbol, coef, 3)
+    LieExponentials(Symbol,Fraction Integer,3)
+                         Type: Domain
+
+  lpoly := LiePolynomial(Symbol, coef)
+    LiePolynomial(Symbol,Fraction Integer)
+                         Type: Domain
+
+  poly := XPBWPolynomial(Symbol, coef)
+    XPBWPolynomial(Symbol,Fraction Integer)
+                         Type: Domain
+
+====================================================================
+Calculations
+====================================================================
+
+  ea := exp(a::lpoly)$group
+     [a]
+    e
+                         Type: LieExponentials(Symbol,Fraction Integer,3)
+
+  eb := exp(b::lpoly)$group
+     [b]
+    e
+                         Type: LieExponentials(Symbol,Fraction Integer,3)
+
+  g: group := ea*eb
+         1     2        1   2
+         - [a b ]       - [a b]
+     [b] 2        [a b] 2       [a]
+    e   e        e     e       e
+                         Type: LieExponentials(Symbol,Fraction Integer,3)
+
+  g :: poly
+                     1                           1          1
+     1 + [a] + [b] + - [a][a] + [a b] + [b][a] + - [b][b] + - [a][a][a]
+                     2                           2          6
+   + 
+     1   2                1     2    1                        1
+     - [a b] + [a b][a] + - [a b ] + - [b][a][a] + [b][a b] + - [b][b][a]
+     2                    2          2                        2
+   + 
+     1
+     - [b][b][b]
+     6
+                        Type: XPBWPolynomial(Symbol,Fraction Integer)
+
+  log(g)$group
+                1          1   2      1     2
+    [a] + [b] + - [a b] + -- [a b] + -- [a b ]
+                2         12         12
+                        Type: LiePolynomial(Symbol,Fraction Integer)
+
+  g1: group := inv(g)
+     - [b] - [a]
+    e     e
+                        Type: LieExponentials(Symbol,Fraction Integer,3)
+
+  g*g1
+    1
+                        Type: LieExponentials(Symbol,Fraction Integer,3)
+
+See Also:
+o )show LieExponentials
+o $AXIOM/doc/src/algebra/xlpoly.spad.dvi
+
+@
+\pagehead{LieExponentials}{LEXP}
+\pagepic{ps/v103lieexponentials.ps}{LEXP}{1.00}
+<<domain LEXP LieExponentials>>=
+)abbrev domain LEXP LieExponentials
+++ Author: Michel Petitot (petitot@lifl.fr).
+++ Date Created: 91
+++ Date Last Updated: 7 Juillet 92
+++ Fix History: compilation v 2.1 le 13 dec 98
+++ Basic Functions:
+++ Related Constructors:
+++ Also See:
+++ AMS Classifications:
+++ Keywords:
+++ References:
+++ Description:
+++ Management of the Lie Group associated with a
+++ free nilpotent Lie algebra. Every Lie bracket with 
+++ length greater than \axiom{Order} are
+++ assumed to be null.
+++ The implementation inherits from the \spadtype{XPBWPolynomial}
+++ domain constructor: Lyndon
+++ coordinates are exponential coordinates 
+++ of the second kind. \newline Author: Michel Petitot (petitot@lifl.fr).
+
+LieExponentials(VarSet, R, Order): XDPcat == XDPdef where
+
+  EX     ==> OutputForm
+  PI     ==> PositiveInteger
+  NNI    ==> NonNegativeInteger
+  I      ==> Integer
+  RN     ==> Fraction(I)
+  R      : Join(CommutativeRing, Module RN)
+  Order  : PI 
+  VarSet : OrderedSet
+  LWORD  ==> LyndonWord(VarSet)
+  LWORDS ==> List LWORD
+  BASIS  ==> PoincareBirkhoffWittLyndonBasis(VarSet)
+  TERM   ==> Record(k:BASIS, c:R)
+  LTERMS ==> List(TERM)
+  LPOLY  ==> LiePolynomial(VarSet,R)  
+  XDPOLY ==> XDistributedPolynomial(VarSet,R)
+  PBWPOLY==> XPBWPolynomial(VarSet, R)
+  TERM1  ==> Record(k:LWORD, c:R)
+  EQ     ==> Equation(R)
+
+  XDPcat == Group with
+    exp         : LPOLY -> $
+      ++ \axiom{exp(p)} returns the exponential of \axiom{p}.
+    log         : $ -> LPOLY
+      ++ \axiom{log(p)} returns the logarithm of \axiom{p}.
+    ListOfTerms : $ -> LTERMS
+      ++ \axiom{ListOfTerms(p)} returns the internal representation of \axiom{p}.
+    coerce      : $ -> XDPOLY
+      ++ \axiom{coerce(g)} returns the internal representation of \axiom{g}.
+    coerce      : $ -> PBWPOLY
+      ++ \axiom{coerce(g)} returns the internal representation of \axiom{g}.
+    mirror      : $ -> $
+      ++ \axiom{mirror(g)} is the mirror of the internal representation of \axiom{g}.
+    varList     : $ -> List VarSet
+      ++ \axiom{varList(g)} returns the list of variables of \axiom{g}. 
+    LyndonBasis : List VarSet -> List LPOLY
+      ++ \axiom{LyndonBasis(lv)} returns the Lyndon basis of the nilpotent free
+      ++ Lie algebra.
+    LyndonCoordinates: $ -> List TERM1
+      ++ \axiom{LyndonCoordinates(g)} returns the exponential coordinates of \axiom{g}.
+    identification: ($,$) -> List EQ
+      ++ \axiom{identification(g,h)} returns the list of equations \axiom{g_i = h_i},
+      ++ where \axiom{g_i} (resp. \axiom{h_i}) are exponential coordinates 
+      ++ of \axiom{g} (resp. \axiom{h}). 
+
+  XDPdef == PBWPOLY add
+
+    -- Representation
+       Rep := PBWPOLY 
+
+    -- local functions
+       compareTerm1s: (TERM1, TERM1) -> Boolean
+       out: TERM1 -> EX
+       ident: (List TERM1, List TERM1) -> List EQ
+
+    -- functions locales
+       ident(l1, l2) ==
+         import(TERM1)
+         null l1 => [equation(0$R,t.c)$EQ for t in l2]
+         null l2 => [equation(t.c, 0$R)$EQ for t in l1]        
+         u1 : LWORD := l1.first.k; c1 :R := l1.first.c
+         u2 : LWORD := l2.first.k; c2 :R := l2.first.c
+         u1 = u2 =>
+            r: R := c1 - c2
+            r = 0 => ident(rest l1, rest l2) 
+            cons(equation(c1,c2)$EQ , ident(rest l1, rest l2))
+         lexico(u1, u2)$LWORD =>
+            cons(equation(0$R,c2)$EQ , ident(l1, rest l2))
+         cons(equation(c1,0$R)$EQ , ident(rest l1, l2))
+
+       -- ordre lexico decroissant
+       compareTerm1s(u:TERM1, v:TERM1):Boolean == lexico(v.k, u.k)$LWORD
+
+       out(t:TERM1):EX ==
+         t.c =$R 1 => char("e")$Character :: EX ** t.k ::EX
+         char("e")$Character :: EX ** (t.c::EX * t.k::EX)
+ 
+    -- definitions
+       identification(x,y) ==
+          l1: List TERM1 := LyndonCoordinates x
+          l2: List TERM1 := LyndonCoordinates y
+          ident(l1, l2)
+ 
+       LyndonCoordinates x ==
+         lt: List TERM1 := [[l::LWORD, t.c]$TERM1 for t in ListOfTerms x | _
+                             (l := retractIfCan(t.k)$BASIS) case LWORD ] 
+         lt := sort(compareTerm1s,lt)
+
+       x:$ * y:$ == product(x::Rep, y::Rep, Order::I::NNI)$Rep
+
+       exp p == exp(p::Rep , Order::I::NNI)$Rep
+
+       log p == LiePolyIfCan(log(p,Order::I::NNI))$Rep :: LPOLY
+
+       coerce(p:$):EX ==
+          p = 1$$ => 1$R :: EX
+          lt : List TERM1 := LyndonCoordinates p 
+          reduce(_*, [out t for t in lt])$List(EX)
+
+
+       LyndonBasis(lv) == 
+         [LiePoly(l)$LPOLY for l in LyndonWordsList(lv,Order)$LWORD]
+
+       coerce(p:$):PBWPOLY == p::Rep
+
+       inv x ==
+         x = 1 => 1
+         lt:LTERMS := ListOfTerms mirror x
+         lt:= [[t.k, (odd? length(t.k)$BASIS => - t.c; t.c)]$TERM for t in lt ]
+         lt pretend $
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain LPOLY LiePolynomial}
+<<LiePolynomial.input>>=
+-- xlpoly.spad.pamphlet LiePolynomial.input
+)spool LiePolynomial.output
+)set message test on
+)set message auto off
+)clear all
+--S 1 of 28
+RN := Fraction Integer
+--R 
+--R
+--R   (1)  Fraction Integer
+--R                                                                 Type: Domain
+--E 1
+
+--S 2 of 28
+Lpoly := LiePolynomial(Symbol,RN)
+--R 
+--R
+--R   (2)  LiePolynomial(Symbol,Fraction Integer)
+--R                                                                 Type: Domain
+--E 2
+
+--S 3 of 28
+Dpoly := XDPOLY(Symbol,RN)
+--R 
+--R
+--R   (3)  XDistributedPolynomial(Symbol,Fraction Integer)
+--R                                                                 Type: Domain
+--E 3
+
+--S 4 of 28
+Lword := LyndonWord Symbol
+--R 
+--R
+--R   (4)  LyndonWord Symbol
+--R                                                                 Type: Domain
+--E 4
+
+--S 5 of 28
+a:Symbol := 'a
+--R 
+--R
+--R   (5)  a
+--R                                                                 Type: Symbol
+--E 5
+
+--S 6 of 28
+b:Symbol := 'b 
+--R 
+--R
+--R   (6)  b
+--R                                                                 Type: Symbol
+--E 6
+
+--S 7 of 28
+c:Symbol := 'c
+--R 
+--R
+--R   (7)  c
+--R                                                                 Type: Symbol
+--E 7
+
+--S 8 of 28
+aa: Lpoly := a 
+--R 
+--R
+--R   (8)  [a]
+--R                                 Type: LiePolynomial(Symbol,Fraction Integer)
+--E 8
+
+--S 9 of 28
+bb: Lpoly := b
+--R 
+--R
+--R   (9)  [b]
+--R                                 Type: LiePolynomial(Symbol,Fraction Integer)
+--E 9
+
+--S 10 of 28
+cc: Lpoly := c
+--R 
+--R
+--R   (10)  [c]
+--R                                 Type: LiePolynomial(Symbol,Fraction Integer)
+--E 10
+
+--S 11 of 28
+p : Lpoly := [aa,bb]
+--R 
+--R
+--R   (11)  [a b]
+--R                                 Type: LiePolynomial(Symbol,Fraction Integer)
+--E 11
+
+--S 12 of 28
+q : Lpoly := [p,bb]
+--R 
+--R
+--R             2
+--R   (12)  [a b ]
+--R                                 Type: LiePolynomial(Symbol,Fraction Integer)
+--E 12
+
+--S 13 of 28
+liste : List Lword := LyndonWordsList([a,b], 4)
+--R 
+--R
+--R                          2       2    3     2 2      3
+--R   (13)  [[a],[b],[a b],[a b],[a b ],[a b],[a b ],[a b ]]
+--R                                                 Type: List LyndonWord Symbol
+--E 13
+
+--S 14 of 28
+r: Lpoly := p + q + 3*LiePoly(liste.4)$Lpoly
+--R 
+--R
+--R                    2         2
+--R   (14)  [a b] + 3[a b] + [a b ]
+--R                                 Type: LiePolynomial(Symbol,Fraction Integer)
+--E 14
+
+--S 15 of 28
+s:Lpoly := [p,r]
+--R 
+--R
+--R              2                 2
+--R   (15)  - 3[a b a b] + [a b a b ]
+--R                                 Type: LiePolynomial(Symbol,Fraction Integer)
+--E 15
+
+--S 16 of 28
+t:Lpoly  := s  + 2*LiePoly(liste.3) - 5*LiePoly(liste.5)
+--R 
+--R
+--R                       2       2                 2
+--R   (16)  2[a b] - 5[a b ] - 3[a b a b] + [a b a b ]
+--R                                 Type: LiePolynomial(Symbol,Fraction Integer)
+--E 16
+
+--S 17 of 28
+degree t
+--R 
+--R
+--R   (17)  5
+--R                                                        Type: PositiveInteger
+--E 17
+
+--S 18 of 28
+mirror t
+--R 
+--R
+--R                         2       2                 2
+--R   (18)  - 2[a b] - 5[a b ] - 3[a b a b] + [a b a b ]
+--R                                 Type: LiePolynomial(Symbol,Fraction Integer)
+--E 18
+
+--S 19 of 28
+Jacobi(p: Lpoly, q: Lpoly, r: Lpoly): Lpoly == _
+   [ [p,q]$Lpoly, r] + [ [q,r]$Lpoly, p] + [ [r,p]$Lpoly, q]  
+--R 
+--R   Function declaration Jacobi : (LiePolynomial(Symbol,Fraction Integer
+--R      ),LiePolynomial(Symbol,Fraction Integer),LiePolynomial(Symbol,
+--R      Fraction Integer)) -> LiePolynomial(Symbol,Fraction Integer) has 
+--R      been added to workspace.
+--R                                                                   Type: Void
+--E 19
+
+--S 20 of 28
+test: Lpoly := Jacobi(a,b,b)
+--R 
+--R   Compiling function Jacobi with type (LiePolynomial(Symbol,Fraction 
+--R      Integer),LiePolynomial(Symbol,Fraction Integer),LiePolynomial(
+--R      Symbol,Fraction Integer)) -> LiePolynomial(Symbol,Fraction 
+--R      Integer) 
+--R
+--R   (20)  0
+--R                                 Type: LiePolynomial(Symbol,Fraction Integer)
+--E 20
+
+--S 21 of 28
+test: Lpoly := Jacobi(p,q,r)
+--R 
+--R
+--R   (21)  0
+--R                                 Type: LiePolynomial(Symbol,Fraction Integer)
+--E 21
+
+--S 22 of 28
+test: Lpoly := Jacobi(r,s,t)
+--R 
+--R
+--R   (22)  0
+--R                                 Type: LiePolynomial(Symbol,Fraction Integer)
+--E 22
+
+--S 23 of 28
+eval(p, a, p)$Lpoly
+--R 
+--R
+--R             2
+--R   (23)  [a b ]
+--R                                 Type: LiePolynomial(Symbol,Fraction Integer)
+--E 23
+
+--S 24 of 28
+eval(p, [a,b], [2*bb, 3*aa])$Lpoly
+--R 
+--R
+--R   (24)  - 6[a b]
+--R                                 Type: LiePolynomial(Symbol,Fraction Integer)
+--E 24
+
+--S 25 of 28
+r: Lpoly := [p,c]
+--R 
+--R
+--R   (25)  [a b c] + [a c b]
+--R                                 Type: LiePolynomial(Symbol,Fraction Integer)
+--E 25
+
+--S 26 of 28
+r1: Lpoly := eval(r, [a,b,c], [bb, cc, aa])$Lpoly 
+--R 
+--R
+--R   (26)  - [a b c]
+--R                                 Type: LiePolynomial(Symbol,Fraction Integer)
+--E 26
+
+--S 27 of 28
+r2: Lpoly := eval(r, [a,b,c], [cc, aa, bb])$Lpoly 
+--R 
+--R
+--R   (27)  - [a c b]
+--R                                 Type: LiePolynomial(Symbol,Fraction Integer)
+--E 27
+
+--S 28 of 28
+r + r1 + r2
+--R 
+--R
+--R   (28)  0
+--R                                 Type: LiePolynomial(Symbol,Fraction Integer)
+--E 28
+)spool
+ 
+)lisp (bye)
+@
+<<LiePolynomial.help>>=
+====================================================================
+LiePolynomial examples
+====================================================================
+
+====================================================================
+Declaration of domains
+====================================================================
+
+  RN := Fraction Integer
+    Fraction Integer
+                     Type: Domain
+
+  Lpoly := LiePolynomial(Symbol,RN)
+    LiePolynomial(Symbol,Fraction Integer)
+                     Type: Domain
+
+  Dpoly := XDPOLY(Symbol,RN)
+    XDistributedPolynomial(Symbol,Fraction Integer)
+                     Type: Domain
+
+  Lword := LyndonWord Symbol
+    LyndonWord Symbol
+                     Type: Domain
+
+====================================================================
+Initialisation
+====================================================================
+
+  a:Symbol := 'a
+    a
+                     Type: Symbol
+
+  b:Symbol := 'b 
+    b
+                     Type: Symbol
+
+  c:Symbol := 'c
+    c
+                     Type: Symbol
+
+  aa: Lpoly := a 
+    [a]
+                     Type: LiePolynomial(Symbol,Fraction Integer)
+
+  bb: Lpoly := b
+    [b]
+                     Type: LiePolynomial(Symbol,Fraction Integer)
+
+  cc: Lpoly := c
+    [c]
+                     Type: LiePolynomial(Symbol,Fraction Integer)
+
+  p : Lpoly := [aa,bb]
+    [a b]
+                     Type: LiePolynomial(Symbol,Fraction Integer)
+
+  q : Lpoly := [p,bb]
+        2
+    [a b ]
+                     Type: LiePolynomial(Symbol,Fraction Integer)
+
+All the Lyndon words of order 4
+
+  liste : List Lword := LyndonWordsList([a,b], 4)
+                     2       2    3     2 2      3
+    [[a],[b],[a b],[a b],[a b ],[a b],[a b ],[a b ]]
+                     Type: List LyndonWord Symbol
+
+  r: Lpoly := p + q + 3*LiePoly(liste.4)$Lpoly
+               2         2
+    [a b] + 3[a b] + [a b ]
+                     Type: LiePolynomial(Symbol,Fraction Integer)
+
+  s:Lpoly := [p,r]
+         2                 2
+    - 3[a b a b] + [a b a b ]
+                     Type: LiePolynomial(Symbol,Fraction Integer)
+
+  t:Lpoly  := s  + 2*LiePoly(liste.3) - 5*LiePoly(liste.5)
+                  2       2                 2
+    2[a b] - 5[a b ] - 3[a b a b] + [a b a b ]
+                     Type: LiePolynomial(Symbol,Fraction Integer)
+
+  degree t
+    5
+                     Type: PositiveInteger
+
+  mirror t
+                    2       2                 2
+    - 2[a b] - 5[a b ] - 3[a b a b] + [a b a b ]
+                     Type: LiePolynomial(Symbol,Fraction Integer)
+
+====================================================================
+Jacobi Relation
+====================================================================
+
+ Jacobi(p: Lpoly, q: Lpoly, r: Lpoly): Lpoly == _
+   [ [p,q]\$Lpoly, r] + [ [q,r]\$Lpoly, p] + [ [r,p]\$Lpoly, q]  
+                    Type: Void
+
+====================================================================
+Tests
+====================================================================
+
+  test: Lpoly := Jacobi(a,b,b)
+    0
+                    Type: LiePolynomial(Symbol,Fraction Integer)
+
+  test: Lpoly := Jacobi(p,q,r)
+    0
+                    Type: LiePolynomial(Symbol,Fraction Integer)
+
+  test: Lpoly := Jacobi(r,s,t)
+    0
+                    Type: LiePolynomial(Symbol,Fraction Integer)
+
+====================================================================
+Evaluation
+====================================================================
+
+  eval(p, a, p)$Lpoly
+        2
+    [a b ]
+                    Type: LiePolynomial(Symbol,Fraction Integer)
+
+  eval(p, [a,b], [2*bb, 3*aa])$Lpoly
+    - 6[a b]
+                    Type: LiePolynomial(Symbol,Fraction Integer)
+
+  r: Lpoly := [p,c]
+    [a b c] + [a c b]
+                    Type: LiePolynomial(Symbol,Fraction Integer)
+
+  r1: Lpoly := eval(r, [a,b,c], [bb, cc, aa])$Lpoly 
+    - [a b c]
+                    Type: LiePolynomial(Symbol,Fraction Integer)
+
+  r2: Lpoly := eval(r, [a,b,c], [cc, aa, bb])$Lpoly 
+    - [a c b]
+                    Type: LiePolynomial(Symbol,Fraction Integer)
+
+  r + r1 + r2
+    0
+                    Type: LiePolynomial(Symbol,Fraction Integer)
+
+See Also:
+o )help LyndonWord
+o )help XDistributedPolynomial
+o )show LiePolynomial
+o $AXIOM/doc/src/algebra/xlpoly.spad.dvi 
+
+@
+\pagehead{LiePolynomial}{LPOLY}
+\pagepic{ps/v103liepolynomial.ps}{LPOLY}{1.00}
+<<domain LPOLY LiePolynomial>>=
+)abbrev domain LPOLY LiePolynomial
+++ Author: Michel Petitot (petitot@lifl.fr).
+++ Date Created: 91
+++ Date Last Updated: 7 Juillet 92
+++ Fix History: compilation v 2.1 le 13 dec 98
+++ Basic Functions:
+++ Related Constructors:
+++ Also See:
+++ AMS Classifications:
+++ Keywords:
+++ References:Free Lie Algebras by C. Reutenauer (Oxford science publications). 
+++ Description:
+++ This type supports Lie polynomials in Lyndon basis
+++ see Free Lie Algebras by C. Reutenauer 
+++ (Oxford science publications). \newline Author: Michel Petitot (petitot@lifl.fr).
+
+LiePolynomial(VarSet:OrderedSet, R:CommutativeRing) : Public == Private where
+   MAGMA   ==> Magma(VarSet)
+   LWORD   ==> LyndonWord(VarSet)
+   WORD    ==> OrderedFreeMonoid(VarSet)
+   XDPOLY  ==> XDistributedPolynomial(VarSet,R)
+   XRPOLY  ==> XRecursivePolynomial(VarSet,R)
+   NNI     ==> NonNegativeInteger
+   RN      ==> Fraction Integer
+   EX      ==> OutputForm
+   TERM    ==> Record(k: LWORD, c: R)
+
+   Public == Join(FreeLieAlgebra(VarSet,R), FreeModuleCat(R,LWORD)) with
+      LiePolyIfCan: XDPOLY -> Union($, "failed")
+        ++ \axiom{LiePolyIfCan(p)} returns \axiom{p} in Lyndon basis
+        ++ if \axiom{p} is a Lie polynomial, otherwise \axiom{"failed"}
+        ++ is returned.
+      construct: (LWORD, LWORD) -> $
+        ++ \axiom{construct(x,y)} returns the Lie bracket \axiom{[x,y]}.
+      construct: (LWORD, $) -> $
+        ++ \axiom{construct(x,y)} returns the Lie bracket \axiom{[x,y]}.
+      construct: ($, LWORD) -> $     
+        ++ \axiom{construct(x,y)} returns the Lie bracket \axiom{[x,y]}.
+
+   Private ==  FreeModule1(R, LWORD) add       
+        import(TERM)
+
+      --representation
+        Rep :=  List TERM
+
+      -- fonctions locales
+        cr1 : (LWORD, $    ) -> $
+        cr2 : ($, LWORD    ) -> $
+        crw : (LWORD, LWORD) -> $     -- crochet de 2 mots de Lyndon
+        DPoly: LWORD -> XDPOLY
+        lquo1: (XRPOLY , LWORD) -> XRPOLY
+        lyndon: (LWORD, LWORD) -> $
+        makeLyndon: (LWORD, LWORD) -> LWORD
+        rquo1: (XRPOLY , LWORD) -> XRPOLY
+        RPoly: LWORD -> XRPOLY
+        eval1: (LWORD, VarSet, $) -> $                     -- 08/03/98
+        eval2: (LWORD, List VarSet, List $) -> $           -- 08/03/98
+
+
+      -- Evaluation
+        eval1(lw,v,nv) ==                                  -- 08/03/98
+          not member?(v, varList(lw)$LWORD) => LiePoly lw
+          (s := retractIfCan(lw)$LWORD) case VarSet => 
+             if (s::VarSet) = v then nv else LiePoly lw 
+          l: LWORD := left lw
+          r: LWORD := right lw
+          construct(eval1(l,v,nv), eval1(r,v,nv))
+
+        eval2(lw,lv,lnv) ==                                -- 08/03/98
+          p: Integer
+          (s := retractIfCan(lw)$LWORD) case VarSet =>
+             p := position(s::VarSet, lv)$List(VarSet) 
+             if p=0 then lw::$ else elt(lnv,p)$List($)
+          l: LWORD := left lw
+          r: LWORD := right lw
+          construct(eval2(l,lv,lnv), eval2(r,lv,lnv))
+
+        eval(p:$, v: VarSet, nv: $): $ ==                  -- 08/03/98
+          +/ [t.c * eval1(t.k, v, nv) for t in p]
+
+        eval(p:$, lv: List(VarSet), lnv: List($)): $ ==    -- 08/03/98
+          +/ [t.c * eval2(t.k, lv, lnv) for t in p]
+
+        lquo1(p,lw) ==
+          constant? p => 0$XRPOLY
+          retractable? lw => lquo(p, retract lw)$XRPOLY
+          lquo1(lquo1(p, left lw),right lw) - lquo1(lquo1(p, right lw),left lw)  
+        rquo1(p,lw) ==
+          constant? p => 0$XRPOLY
+          retractable? lw => rquo(p, retract lw)$XRPOLY
+          rquo1(rquo1(p, left lw),right lw) - rquo1(rquo1(p, right lw),left lw)
+
+        coef(p, lp) == coef(p, lp::XRPOLY)$XRPOLY
+
+        lquo(p, lp) ==
+          lp = 0 => 0$XRPOLY
+          +/ [t.c * lquo1(p,t.k) for t in lp]
+ 
+        rquo(p, lp) ==
+          lp = 0 => 0$XRPOLY
+          +/ [t.c * rquo1(p,t.k) for t in lp] 
+
+        LiePolyIfCan p ==         -- inefficace a cause de la rep. de XDPOLY
+           not quasiRegular? p => "failed"
+           p1: XDPOLY := p ; r:$ := 0
+           while p1 ^= 0 repeat
+             t: Record(k:WORD, c:R) := mindegTerm p1
+             w: WORD := t.k; coef:R := t.c
+             (l := lyndonIfCan(w)$LWORD) case "failed" => return "failed"
+             lp:$ := coef * LiePoly(l::LWORD)
+             r := r + lp 
+             p1 := p1 - lp::XDPOLY 
+           r
+ 
+      --definitions locales
+        makeLyndon(u,v) == (u::MAGMA * v::MAGMA) pretend LWORD
+ 
+        crw(u,v) ==               -- u et v sont des mots de Lyndon
+          u = v => 0
+          lexico(u,v) => lyndon(u,v)
+          - lyndon (v,u)
+
+        lyndon(u,v) ==            -- u et v sont des mots de Lyndon tq u < v
+          retractable? u => monom(makeLyndon(u,v),1)
+          u1: LWORD := left u
+          u2: LWORD := right u
+          lexico(u2,v) => cr1(u1, lyndon(u2,v)) + cr2(lyndon(u1,v), u2)
+          monom(makeLyndon(u,v),1)
+           
+        cr1 (l, p) ==
+            +/[t.c * crw(l, t.k) for t in p]
+
+        cr2 (p, l) ==
+            +/[t.c * crw(t.k, l) for t in p]
+
+        DPoly w ==
+           retractable? w => retract(w) :: XDPOLY 
+           l:XDPOLY := DPoly left w
+           r:XDPOLY := DPoly right w
+           l*r - r*l
+
+        RPoly w ==
+           retractable? w => retract(w) :: XRPOLY 
+           l:XRPOLY := RPoly left w
+           r:XRPOLY := RPoly right w
+           l*r - r*l 
+    
+      -- definitions
+
+        coerce(v:VarSet) == monom(v::LWORD , 1)
+
+        construct(x:$ , y:$):$ ==
+            +/[t.c * cr1(t.k, y) for t in x]
+
+        construct(l:LWORD , p:$):$ == cr1(l,p) 
+        construct(p:$ , l:LWORD):$ == cr2(p,l)
+        construct(u:LWORD , v:LWORD):$ == crw(u,v)
+
+        coerce(p:$):XDPOLY ==
+            +/ [t.c * DPoly(t.k) for t in p]
+
+        coerce(p:$):XRPOLY ==
+            +/ [t.c * RPoly(t.k) for t in p]
+
+        LiePoly(l) == monom(l,1)
+
+        varList p ==
+          le : List VarSet := "setUnion"/[varList(t.k)$LWORD for t in p]
+          sort(le)$List(VarSet)
+
+        mirror p ==
+          [[t.k, (odd? length t.k => t.c; -t.c)]$TERM for t in p]
+
+        trunc(p, n) ==
+          degree(p) > n => trunc( reductum p , n)
+          p
+
+        degree p == 
+          null p => 0
+          length( p.first.k)$LWORD
+
+      --  ListOfTerms p == p pretend List TERM
+        
+--        coerce(x) : EX ==
+--           null x => (0$R) :: EX
+--           le : List EX := nil
+--           for rec in x repeat
+--             rec.c = 1$R => le := cons(rec.k :: EX, le)
+--             le := cons(mkBinary("*"::EX,  rec.c :: EX, rec.k :: EX), le)
+--           1 = #le => first le
+--           mkNary("+" :: EX,le)
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \section{domain LSQM LieSquareMatrix}
 \pagehead{LieSquareMatrix}{LSQM}
 \pagepic{ps/v103liesquarematrix.ps}{LSQM}{1.00}
@@ -41518,6 +43276,510 @@ Localize(M:Module R,
 
 @
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain LWORD LyndonWord}
+<<LyndonWord.input>>=
+-- xlpoly.spad.pamphlet LyndonWord.input
+)spool LyndonWord.output
+)set message test on
+)set message auto off
+)clear all
+--S 1 of 22
+a:Symbol :='a
+--R 
+--R
+--R   (1)  a
+--R                                                                 Type: Symbol
+--E 1
+
+--S 2 of 22
+b:Symbol :='b
+--R 
+--R
+--R   (2)  b
+--R                                                                 Type: Symbol
+--E 2
+
+--S 3 of 22
+c:Symbol :='c
+--R 
+--R
+--R   (3)  c
+--R                                                                 Type: Symbol
+--E 3
+
+--S 4 of 22
+lword:= LyndonWord(Symbol)
+--R 
+--R
+--R   (4)  LyndonWord Symbol
+--R                                                                 Type: Domain
+--E 4
+
+--S 5 of 22
+magma := Magma(Symbol)
+--R 
+--R
+--R   (5)  Magma Symbol
+--R                                                                 Type: Domain
+--E 5
+
+--S 6 of 22
+word := OrderedFreeMonoid(Symbol)
+--R 
+--R
+--R   (6)  OrderedFreeMonoid Symbol
+--R                                                                 Type: Domain
+--E 6
+
+--S 7 of 22
+LyndonWordsList1([a,b,c],3)$lword
+--R 
+--R
+--R   (7)
+--R   [[[a],[b],[c]], [[a b],[a c],[b c]],
+--R       2     2       2                      2    2       2
+--R    [[a b],[a c],[a b ],[a b c],[a c b],[a c ],[b c],[b c ]]]
+--R                             Type: OneDimensionalArray List LyndonWord Symbol
+--E 7
+
+--S 8 of 22
+LyndonWordsList([a,b,c],3)$lword
+--R 
+--R
+--R   (8)
+--R                                          2      2        2
+--R   [[a], [b], [c], [a b], [a c], [b c], [a b], [a c], [a b ], [a b c], [a c b],
+--R        2     2        2
+--R    [a c ], [b c], [b c ]]
+--R                                                 Type: List LyndonWord Symbol
+--E 8
+
+--S 9 of 22
+lw := LyndonWordsList([a,b],5)$lword
+--R 
+--R
+--R   (9)
+--R                       2        2     3      2 2       3     4      3 2
+--R   [[a], [b], [a b], [a b], [a b ], [a b], [a b ], [a b ], [a b], [a b ],
+--R      2          2 3           2       4
+--R    [a b a b], [a b ], [a b a b ], [a b ]]
+--R                                                 Type: List LyndonWord Symbol
+--E 9
+
+--S 10 of 22
+w1 : word := lw.4 :: word
+--R 
+--R
+--R          2
+--R   (10)  a b
+--R                                               Type: OrderedFreeMonoid Symbol
+--E 10
+
+--S 11 of 22
+w2 : word := lw.5 :: word
+--R 
+--R
+--R            2
+--R   (11)  a b
+--R                                               Type: OrderedFreeMonoid Symbol
+--E 11
+
+--S 12 of 22
+factor(a::word)$lword
+--R 
+--R
+--R   (12)  [[a]]
+--R                                                 Type: List LyndonWord Symbol
+--E 12
+
+--S 13 of 22
+factor(w1*w2)$lword
+--R 
+--R
+--R            2     2
+--R   (13)  [[a b a b ]]
+--R                                                 Type: List LyndonWord Symbol
+--E 13
+
+--S 14 of 22
+factor(w2*w2)$lword
+--R 
+--R
+--R              2      2
+--R   (14)  [[a b ],[a b ]]
+--R                                                 Type: List LyndonWord Symbol
+--E 14
+
+--S 15 of 22
+factor(w2*w1)$lword
+--R 
+--R
+--R              2    2
+--R   (15)  [[a b ],[a b]]
+--R                                                 Type: List LyndonWord Symbol
+--E 15
+
+--S 16 of 22
+lyndon?(w1)$lword
+--R 
+--R
+--R   (16)  true
+--R                                                                Type: Boolean
+--E 16
+
+--S 17 of 22
+lyndon?(w1*w2)$lword
+--R 
+--R
+--R   (17)  true
+--R                                                                Type: Boolean
+--E 17
+
+--S 18 of 22
+lyndon?(w2*w1)$lword
+--R 
+--R
+--R   (18)  false
+--R                                                                Type: Boolean
+--E 18
+
+--S 19 of 22
+lyndonIfCan(w1)$lword
+--R 
+--R
+--R           2
+--R   (19)  [a b]
+--R                                           Type: Union(LyndonWord Symbol,...)
+--E 19
+
+--S 20 of 22
+lyndonIfCan(w2*w1)$lword
+--R 
+--R
+--R   (20)  "failed"
+--R                                                    Type: Union("failed",...)
+--E 20
+
+--S 21 of 22
+lyndon(w1)$lword
+--R 
+--R
+--R           2
+--R   (21)  [a b]
+--R                                                      Type: LyndonWord Symbol
+--E 21
+
+--S 22 of 22
+lyndon(w1*w2)$lword
+--R 
+--R
+--R           2     2
+--R   (22)  [a b a b ]
+--R                                                      Type: LyndonWord Symbol
+--E 22
+)spool
+)lisp (bye)
+@
+<<LyndonWord.help>>=
+====================================================================
+LyndonWord examples
+====================================================================
+
+A function f in [0,1] is called acyclic if C(F) consists of n
+different objects. The canonical representative of the orbit of an
+acyclic function is usually called a Lyndon Word. If f is acyclic,
+then all elements in the orbit C(f) are acyclic as well, and we call
+C(f) an acyclic orbit.
+
+====================================================================
+Initialisations
+====================================================================
+
+  a:Symbol :='a
+    a
+                            Type: Symbol
+
+  b:Symbol :='b
+    b
+                            Type: Symbol
+
+  c:Symbol :='c
+    c
+                            Type: Symbol
+
+  lword:= LyndonWord(Symbol)
+    LyndonWord Symbol
+                            Type: Domain
+
+  magma := Magma(Symbol)
+    Magma Symbol
+                            Type: Domain
+
+  word := OrderedFreeMonoid(Symbol)
+    OrderedFreeMonoid Symbol
+                            Type: Domain
+
+All Lyndon words of with a, b, c to order 3
+
+  LyndonWordsList1([a,b,c],3)$lword
+   [[[a],[b],[c]], [[a b],[a c],[b c]],
+       2     2       2                      2    2       2
+    [[a b],[a c],[a b ],[a b c],[a c b],[a c ],[b c],[b c ]]]
+                            Type: OneDimensionalArray List LyndonWord Symbol
+
+All Lyndon words of with a, b, c to order 3 in flat list
+
+  LyndonWordsList([a,b,c],3)$lword
+                                          2      2        2
+   [[a], [b], [c], [a b], [a c], [b c], [a b], [a c], [a b ], [a b c], [a c b],
+        2     2        2
+    [a c ], [b c], [b c ]]
+                            Type: List LyndonWord Symbol
+
+All Lyndon words of with a, b to order 5
+
+  lw := LyndonWordsList([a,b],5)$lword
+                       2        2     3      2 2       3     4      3 2
+   [[a], [b], [a b], [a b], [a b ], [a b], [a b ], [a b ], [a b], [a b ],
+      2          2 3           2       4
+    [a b a b], [a b ], [a b a b ], [a b ]]
+                            Type: List LyndonWord Symbol
+
+  w1 : word := lw.4 :: word
+     2
+    a b
+                             Type: OrderedFreeMonoid Symbol
+
+  w2 : word := lw.5 :: word
+       2
+    a b
+                             Type: OrderedFreeMonoid Symbol
+
+Let's try factoring
+
+  factor(a::word)$lword
+    [[a]]
+                             Type: List LyndonWord Symbol
+
+  factor(w1*w2)$lword
+       2     2
+    [[a b a b ]]
+                             Type: List LyndonWord Symbol
+
+  factor(w2*w2)$lword
+         2      2
+    [[a b ],[a b ]]
+                             Type: List LyndonWord Symbol
+
+  factor(w2*w1)$lword
+         2    2
+    [[a b ],[a b]]
+                             Type: List LyndonWord Symbol
+
+====================================================================
+Checks and coercions
+====================================================================
+
+  lyndon?(w1)$lword
+    true
+                             Type: Boolean
+
+  lyndon?(w1*w2)$lword
+    true
+                             Type: Boolean
+
+  lyndon?(w2*w1)$lword
+    false
+                             Type: Boolean
+
+  lyndonIfCan(w1)$lword
+      2
+    [a b]
+                             Type: Union(LyndonWord Symbol,...)
+
+  lyndonIfCan(w2*w1)$lword
+    "failed"
+                             Type: Union("failed",...)
+
+  lyndon(w1)$lword
+      2
+    [a b]
+                             Type: LyndonWord Symbol
+
+  lyndon(w1*w2)$lword
+      2     2
+    [a b a b ]
+                             Type: LyndonWord Symbol
+
+See Also:
+o )show LyndonWord
+o $AXIOM/doc/src/algebra/xlpoly.spad.dvi
+
+@
+\pagehead{LyndonWord}{LWORD}
+\pagepic{ps/v103lyndonword.ps}{LWORD}{1.00}
+<<domain LWORD LyndonWord>>=
+)abbrev domain LWORD LyndonWord
+++ Author: Michel Petitot (petitot@lifl.fr).
+++ Date Created: 91
+++ Date Last Updated: 7 Juillet 92
+++ Fix History: compilation v 2.1 le 13 dec 98
+++ Basic Functions:
+++ Related Constructors:
+++ Also See:
+++ AMS Classifications:
+++ Keywords:
+++ References: Free Lie Algebras by C. Reutenauer (Oxford science publications).
+++ Description:
+++ Lyndon words over arbitrary (ordered) symbols:
+++ see Free Lie Algebras by C. Reutenauer (Oxford science publications).
+++ A Lyndon word is a word which is smaller than any of its right factors
+++ w.r.t. the pure lexicographical ordering.
+++ If \axiom{a} and \axiom{b} are two Lyndon words such that \axiom{a < b}
+++ holds w.r.t lexicographical ordering then \axiom{a*b} is a Lyndon word.
+++ Parenthesized Lyndon words can be generated from symbols by using the following
+++ rule: \axiom{[[a,b],c]} is a Lyndon word iff \axiom{a*b < c <= b} holds.
+++ Lyndon words are internally represented by binary trees using the
+++ \spadtype{Magma} domain constructor.
+++ Two ordering are provided: lexicographic and 
+++ length-lexicographic. \newline 
+++ Author : Michel Petitot (petitot@lifl.fr).
+
+LyndonWord(VarSet:OrderedSet):Public == Private where
+   OFMON ==> OrderedFreeMonoid(VarSet)
+   PI    ==> PositiveInteger
+   NNI   ==> NonNegativeInteger
+   I     ==> Integer
+   OF    ==> OutputForm
+   ARRAY1==> OneDimensionalArray
+
+   Public == Join(OrderedSet,RetractableTo VarSet) with
+      retractable?  : $ -> Boolean
+        ++ \axiom{retractable?(x)} tests if \axiom{x} is a tree with only one entry.
+      left          : $ -> $
+        ++ \axiom{left(x)} returns left subtree of \axiom{x} or
+        ++ error if \axiomOpFrom{retractable?}{LyndonWord}(\axiom{x}) is true.
+      right  :  $ -> $
+        ++ \axiom{right(x)} returns right subtree of \axiom{x} or
+        ++ error if \axiomOpFrom{retractable?}{LyndonWord}(\axiom{x}) is true.
+      length :  $ -> PI
+        ++ \axiom{length(x)} returns the number of entries in \axiom{x}.
+      lexico :  ($,$) -> Boolean 
+        ++ \axiom{lexico(x,y)} returns \axiom{true} iff  \axiom{x} is smaller than 
+        ++ \axiom{y} w.r.t. the lexicographical ordering induced by \axiom{VarSet}. 
+      coerce :  $ -> OFMON
+        ++ \axiom{coerce(x)} returns the element of \axiomType{OrderedFreeMonoid}(VarSet) 
+        ++ corresponding to \axiom{x}.
+      coerce :  $ -> Magma VarSet
+        ++ \axiom{coerce(x)} returns the element of \axiomType{Magma}(VarSet)
+        ++ corresponding to \axiom{x}.
+      factor :  OFMON -> List $  
+        ++ \axiom{factor(x)} returns the decreasing factorization into Lyndon words. 
+      lyndon?:  OFMON -> Boolean
+        ++ \axiom{lyndon?(w)} test if \axiom{w} is a Lyndon word.
+      lyndon :  OFMON -> $
+        ++ \axiom{lyndon(w)} convert \axiom{w} into a Lyndon word, 
+        ++ error if \axiom{w} is not a Lyndon word.
+      lyndonIfCan : OFMON -> Union($, "failed")
+        ++ \axiom{lyndonIfCan(w)} convert \axiom{w} into a Lyndon word.
+      varList     : $ -> List VarSet
+        ++ \axiom{varList(x)} returns the list of distinct entries of \axiom{x}.
+      LyndonWordsList1: (List VarSet, PI)  -> ARRAY1 List $
+        ++ \axiom{LyndonWordsList1(vl, n)} returns an array of lists of Lyndon
+        ++ words over the alphabet \axiom{vl}, up to order \axiom{n}.
+      LyndonWordsList : (List VarSet, PI)  -> List $
+        ++ \axiom{LyndonWordsList(vl, n)} returns the list of Lyndon
+        ++ words over the alphabet \axiom{vl}, up to order \axiom{n}.
+
+   Private == Magma(VarSet) add
+     -- Representation
+       Rep:= Magma(VarSet)
+
+     -- Fonctions locales
+       LetterList : OFMON -> List VarSet
+       factor1    : (List $, $, List $) -> List $
+
+     -- Definitions
+       lyndon? w ==
+         w = 1$OFMON => false
+         f: OFMON := rest w
+         while f ^= 1$OFMON repeat
+           not lexico(w,f) => return false
+           f := rest f
+         true
+
+       lyndonIfCan w ==
+         l: List $ := factor w
+         # l = 1 => first l
+         "failed"
+
+       lyndon w ==
+         l: List $ := factor w
+         # l = 1 => first l
+         error "This word is not a Lyndon word"
+
+       LetterList w ==
+         w = 1 => []
+         cons(first w , LetterList rest w)
+
+       factor1 (gauche, x, droite) == 
+         g: List $ := gauche; d: List $ := droite
+         while not null g repeat             ++ (l in g or l=x) et u in d 
+           lexico(  g.first , x ) =>         ++  => right(l) >= u 
+              x  := g.first *$Rep x          -- crochetage
+              null(d) => g := rest g
+              g := cons( x, rest g)          -- mouvement a droite
+              x  := first d
+              d := rest d
+           d := cons( x , d)                 -- mouvement a gauche
+           x  := first g
+           g := rest g
+         return cons(x, d)
+
+       factor w ==
+         w = 1 => []
+         l : List $ := reverse [ u::$ for u in LetterList w]
+         factor1( rest l, first l , [] )
+      
+       x < y ==                     -- lexicographique par longueur
+         lx,ly: PI
+         lx:= length x ; ly:= length y
+         lx = ly => lexico(x,y)
+         lx < ly
+ 
+       coerce(x:$):OF == bracket(x::OFMON::OF)
+       coerce(x:$):Magma VarSet == x::Rep
+
+       LyndonWordsList1 (vl,n) ==    -- a ameliorer !!!!!!!!!!!
+            null vl => error "empty list"
+            base: ARRAY1 List $ := new(n::I::NNI ,[])
+           
+           -- mots de longueur 1
+            lbase1:List $ := [w::$ for w in sort(vl)]
+            base.1 := lbase1
+
+           -- calcul des mots de longueur ll
+            for ll in 2..n:I  repeat 
+               lbase1 := []   
+               for a in base(1) repeat              -- lettre + mot
+                  for b in base(ll-1) repeat
+                     if lexico(a,b) then lbase1:=cons(a*b,lbase1)
+
+               for i in 2..ll-1 repeat              -- mot + mot
+                 for a in base(i) repeat             
+                   for b in base(ll-i) repeat
+                     if lexico(a,b) and (lexico(b,right a) or b = right a ) 
+                     then lbase1:=cons(a*b,lbase1)
+ 
+               base(ll):= sort_!(lexico, lbase1)
+            return base
+           
+       LyndonWordsList (vl,n) ==
+           v:ARRAY1 List $ := LyndonWordsList1(vl,n)
+           "append"/ [v.i for i in 1..n] 
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \chapter{Chapter M}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \section{domain MCMPLX MachineComplex}
@@ -41943,6 +44205,450 @@ MachineInteger(): Exports == Implementation where
 
 @
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain MAGMA Magma}
+<<Magma.input>>=
+-- xlpoly.spad.pamphlet Magma.input
+)spool Magma.output
+)set message test on
+)set message auto off
+)clear all
+--S 1
+x:Symbol :='x
+--R 
+--R
+--R   (1)  x
+--R                                                                 Type: Symbol
+--E 1
+
+--S 2
+y:Symbol :='y
+--R 
+--R
+--R   (2)  y
+--R                                                                 Type: Symbol
+--E 2
+
+--S 3
+z:Symbol :='z
+--R 
+--R
+--R   (3)  z
+--R                                                                 Type: Symbol
+--E 3
+
+--S 4
+word := OrderedFreeMonoid(Symbol)
+--R 
+--R
+--R   (4)  OrderedFreeMonoid Symbol
+--R                                                                 Type: Domain
+--E 4
+
+--S 5
+tree := Magma(Symbol)
+--R 
+--R
+--R   (5)  Magma Symbol
+--R                                                                 Type: Domain
+--E 5
+
+--S 6
+a:tree := x*x 
+--R 
+--R
+--R   (6)  [x,x]
+--R                                                           Type: Magma Symbol
+--E 6
+
+--S 7
+b:tree := y*y
+--R 
+--R
+--R   (7)  [y,y]
+--R                                                           Type: Magma Symbol
+--E 7
+
+--S 8
+c:tree := a*b
+--R 
+--R
+--R   (8)  [[x,x],[y,y]]
+--R                                                           Type: Magma Symbol
+--E 8
+
+--S 9
+left c
+--R 
+--R
+--R   (9)  [x,x]
+--R                                                           Type: Magma Symbol
+--E 9
+
+--S 10
+right c
+--R 
+--R
+--R   (10)  [y,y]
+--R                                                           Type: Magma Symbol
+--E 10
+
+--S 11
+length c
+--R 
+--R
+--R   (11)  4
+--R                                                        Type: PositiveInteger
+--E 11
+
+--S 12
+c::word
+--R 
+--R
+--R          2 2
+--R   (12)  x y
+--R                                               Type: OrderedFreeMonoid Symbol
+--E 12
+
+--S 13
+a < b
+--R 
+--R
+--R   (13)  true
+--R                                                                Type: Boolean
+--E 13
+
+--S 14
+a < c
+--R 
+--R
+--R   (14)  true
+--R                                                                Type: Boolean
+--E 14
+
+--S 15
+b < c
+--R 
+--R
+--R   (15)  true
+--R                                                                Type: Boolean
+--E 15
+
+--S 16
+first c
+--R 
+--R
+--R   (16)  x
+--R                                                                 Type: Symbol
+--E 16
+
+--S 17
+rest c
+--R 
+--R
+--R   (17)  [x,[y,y]]
+--R                                                           Type: Magma Symbol
+--E 17
+
+--S 18
+rest rest c
+--R 
+--R
+--R   (18)  [y,y]
+--R                                                           Type: Magma Symbol
+--E 18
+
+--S 19
+ax:tree := a*x
+--R 
+--R
+--R   (19)  [[x,x],x]
+--R                                                           Type: Magma Symbol
+--E 19
+
+--S 20
+xa:tree := x*a
+--R 
+--R
+--R   (20)  [x,[x,x]]
+--R                                                           Type: Magma Symbol
+--E 20
+
+--S 21
+xa < ax
+--R 
+--R
+--R   (21)  true
+--R                                                                Type: Boolean
+--E 21
+
+--S 22
+lexico(xa,ax)
+--R 
+--R
+--R   (22)  false
+--R                                                                Type: Boolean
+--E 22
+)spool
+)lisp (bye)
+@
+<<Magma.help>>=
+====================================================================
+Magma examples
+====================================================================
+
+Initialisations
+
+  x:Symbol :='x
+    x
+                         Type: Symbol
+
+  y:Symbol :='y
+    y
+                         Type: Symbol
+
+  z:Symbol :='z
+    z
+                         Type: Symbol
+
+  word := OrderedFreeMonoid(Symbol)
+    OrderedFreeMonoid Symbol
+                         Type: Domain
+
+  tree := Magma(Symbol)
+    Magma Symbol
+                         Type: Domain
+
+Let's make some trees
+
+  a:tree := x*x 
+    [x,x]
+                         Type: Magma Symbol
+
+  b:tree := y*y
+    [y,y]
+                         Type: Magma Symbol
+
+  c:tree := a*b
+    [[x,x],[y,y]]
+                         Type: Magma Symbol
+
+Query the trees
+
+  left c
+    [x,x]
+                         Type: Magma Symbol
+
+  right c
+    [y,y]
+                         Type: Magma Symbol
+
+  length c
+    4
+                         Type: PositiveInteger
+
+Coerce to the monoid
+
+  c::word
+     2 2
+    x y
+                         Type: OrderedFreeMonoid Symbol
+
+Check ordering
+
+  a < b
+    true
+                         Type: Boolean
+
+  a < c
+    true
+                         Type: Boolean
+
+  b < c
+    true
+                         Type: Boolean
+
+Navigate the tree
+
+  first c
+    x
+                         Type: Symbol
+
+  rest c
+    [x,[y,y]]
+                         Type: Magma Symbol
+
+  rest rest c
+    [y,y]
+                         Type: Magma Symbol
+
+Check ordering
+
+  ax:tree := a*x
+    [[x,x],x]
+                         Type: Magma Symbol
+
+  xa:tree := x*a
+    [x,[x,x]]
+                         Type: Magma Symbol
+
+  xa < ax
+    true
+                         Type: Boolean
+
+  lexico(xa,ax)
+    false
+                         Type: Boolean
+
+See Also:
+o )show Magma
+o $AXIOM/doc/src/algebra/xlpoly.spad.dvi
+
+@
+\pagehead{Magma}{MAGMA}
+\pagepic{ps/v103magma.ps}{MAGMA}{1.00}
+<<domain MAGMA Magma>>=
+)abbrev domain MAGMA Magma
+++ Author: Michel Petitot (petitot@lifl.fr).
+++ Date Created: 91
+++ Date Last Updated: 7 Juillet 92
+++ Fix History: compilation v 2.1 le 13 dec 98
+++ Basic Functions:
+++ Related Constructors:
+++ Also See:
+++ AMS Classifications:
+++ Keywords:
+++ References:
+++ Description:
+++ This type is the basic representation of 
+++ parenthesized words (binary trees over arbitrary symbols)
+++ useful in \spadtype{LiePolynomial}. \newline Author: Michel Petitot (petitot@lifl.fr).
+
+Magma(VarSet:OrderedSet):Public == Private where
+   WORD ==> OrderedFreeMonoid(VarSet)
+   EX   ==> OutputForm
+
+   Public == Join(OrderedSet,RetractableTo VarSet) with
+      "*"           : ($,$) -> $
+        ++ \axiom{x*y} returns the tree \axiom{[x,y]}.
+      coerce        : $ -> WORD
+        ++ \axiom{coerce(x)} returns the element of \axiomType{OrderedFreeMonoid}(VarSet) 
+        ++ corresponding to \axiom{x} by removing parentheses.
+      first         : $ -> VarSet
+        ++ \axiom{first(x)} returns the first entry of the tree \axiom{x}.
+      left          : $ -> $
+        ++ \axiom{left(x)} returns left subtree of \axiom{x} or
+        ++ error if \axiomOpFrom{retractable?}{Magma}(\axiom{x}) is true.
+      length        : $ -> PositiveInteger
+        ++ \axiom{length(x)} returns the number of entries in \axiom{x}.
+      lexico        : ($,$) -> Boolean
+        ++ \axiom{lexico(x,y)} returns \axiom{true} iff  \axiom{x} is smaller than 
+        ++ \axiom{y} w.r.t. the lexicographical ordering induced by \axiom{VarSet}. 
+        ++ N.B. This operation does not take into account the tree structure of
+        ++ its arguments. Thus this is not a total ordering.
+      mirror        : $ -> $
+        ++ \axiom{mirror(x)} returns the reversed word of \axiom{x}. 
+        ++ That is \axiom{x} itself if \axiomOpFrom{retractable?}{Magma}(\axiom{x}) is true and
+        ++ \axiom{mirror(z) * mirror(y)} if \axiom{x} is \axiom{y*z}.
+      rest          : $ -> $
+        ++ \axiom{rest(x)} return \axiom{x} without the first entry or 
+        ++ error if \axiomOpFrom{retractable?}{Magma}(\axiom{x}) is true.
+      retractable?  : $ -> Boolean
+        ++ \axiom{retractable?(x)} tests if \axiom{x} is a tree with only one entry.
+      right         : $ -> $
+        ++ \axiom{right(x)} returns right subtree of \axiom{x} or 
+        ++ error if \axiomOpFrom{retractable?}{Magma}(\axiom{x}) is true.
+      varList       : $ -> List VarSet
+        ++ \axiom{varList(x)} returns the list of distinct entries of \axiom{x}.
+
+   Private == add
+    -- representation
+      VWORD := Record(left:$ ,right:$)
+      Rep:= Union(VarSet,VWORD)  
+
+      recursif: ($,$) -> Boolean
+
+    -- define
+      x:$ = y:$ ==
+        x case VarSet => 
+           y case VarSet => x::VarSet = y::VarSet
+           false
+        y case VWORD => x::VWORD = y::VWORD
+        false
+ 
+      varList x == 
+        x case VarSet => [x::VarSet]
+        lv: List VarSet := setUnion(varList x.left, varList x.right)
+        sort_!(lv)
+
+      left x == 
+        x case VarSet => error "x has only one entry"
+        x.left
+
+      right x == 
+        x case VarSet => error "x has only one entry"
+        x.right
+      retractable? x == (x case VarSet)
+
+      retract x ==
+         x case VarSet => x::VarSet
+         error "Not retractable"
+
+      retractIfCan x == (retractable? x => x::VarSet ; "failed")
+      coerce(l:VarSet):$  == l
+
+      mirror x ==
+        x case VarSet => x
+        [mirror x.right, mirror x.left]$VWORD
+
+      coerce(x:$): WORD ==
+        x case VarSet => x::VarSet::WORD
+        x.left::WORD * x.right::WORD
+
+      coerce(x:$):EX ==
+         x case VarSet => x::VarSet::EX
+         bracket [x.left::EX, x.right::EX]
+
+      x * y == [x,y]$VWORD
+
+      first x ==
+         x case VarSet => x::VarSet
+         first x.left
+
+      rest x ==
+         x case VarSet => error "rest$Magma: inexistant rest"
+         lx:$ := x.left
+         lx case VarSet => x.right
+         [rest lx , x.right]$VWORD
+
+      length x ==
+         x case VarSet => 1
+         length(x.left) + length(x.right)
+
+      recursif(x,y) ==    
+         x case VarSet => 
+            y case VarSet => x::VarSet < y::VarSet
+            true
+         y case VarSet => false
+         x.left =  y.left =>  x.right <  y.right
+         x.left < y.left
+
+      lexico(x,y) ==      	-- peut etre amelioree !!!!!!!!!!!
+         x case VarSet => 
+            y case VarSet => x::VarSet < y::VarSet
+            x::VarSet <= first y
+         y case VarSet => first x < retract y
+         fx:VarSet := first x ; fy:VarSet := first y 
+         fx = fy => lexico(rest x , rest y)
+         fx < fy 
+
+      x < y ==                 	-- recursif par longueur
+         lx,ly: PositiveInteger
+         lx:= length x ; ly:= length y
+         lx = ly => recursif(x,y)
+         lx < ly 
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \section{domain MKCHSET MakeCachableSet}
 \pagehead{MakeCachableSet}{MKCHSET}
 \pagepic{ps/v103makecachableset.ps}{MKCHSET}{1.00}
@@ -47632,6 +50338,291 @@ OrderedDirectProduct(dim:NonNegativeInteger,
 
 @
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain OFMONOID OrderedFreeMonoid}
+\pagehead{OrderedFreeMonoid}{OFMONOID}
+\pagepic{ps/v103orderedfreemonoid.ps}{OFMONOID}{1.00}
+<<domain OFMONOID OrderedFreeMonoid>>=
+)abbrev domain OFMONOID OrderedFreeMonoid
+++ Author: Michel Petitot petitot@lifl.fr
+++ Date Created: 91
+++ Date Last Updated: 7 Juillet 92
+++ Fix History: compilation v 2.1 le 13 dec 98
+++ Basic Functions:
+++ Related Constructors:
+++ Also See:
+++ AMS Classifications:
+++ Keywords:
+++ References:
+++ Description:
+++    The free monoid on a set \spad{S} is the monoid of finite products of
+++ the form \spad{reduce(*,[si ** ni])} where the si's are in S, and the ni's
+++ are non-negative integers. The multiplication is not commutative.
+++ For two elements \spad{x} and \spad{y} the relation \spad{x < y}
+++ holds if either \spad{length(x) < length(y)} holds or if these lengths
+++ are equal and if \spad{x} is smaller than \spad{y} w.r.t. the lexicographical
+++ ordering induced by \spad{S}.
+++ This domain inherits implementation from \spadtype{FreeMonoid}.
+++ Author: Michel Petitot (petitot@lifl.fr)
+
+OrderedFreeMonoid(S: OrderedSet): OFMcategory == OFMdefinition where
+    NNI ==> NonNegativeInteger
+    REC ==> Record(gen:S, exp:NNI)
+ 
+    OFMcategory == Join(OrderedMonoid, RetractableTo S) with
+        "*":    (S, %) -> %
+          ++ \spad{s * x} returns the product of \spad{x} by \spad{s} on the left.
+        "*":    (%, S) -> %
+          ++ \spad{x * s} returns the product of \spad{x} by \spad{s} on the right.
+        "**":   (S, NNI) -> %
+          ++ \spad{s ** n} returns the product of \spad{s} by itself \spad{n} times.
+        first: % -> S
+          ++ \spad{first(x)} returns the first letter of \spad{x}.
+        rest:  % -> %
+          ++ \spad{rest(x)} returns \spad{x} except the first letter.
+        mirror: % -> %
+          ++ \spad{mirror(x)} returns the reversed word of \spad{x}.
+        lexico: (%,%) -> Boolean
+          ++ \spad{lexico(x,y)} returns \spad{true} iff \spad{x} is smaller than \spad{y}
+          ++ w.r.t. the pure lexicographical ordering induced by \spad{S}.
+        hclf:   (%, %) -> %
+          ++ \spad{hclf(x, y)} returns the highest common left factor 
+          ++ of \spad{x} and \spad{y},
+          ++ that is the largest \spad{d} such that \spad{x = d a} and \spad{y = d b}.
+        hcrf:   (%, %) -> %
+          ++ \spad{hcrf(x, y)} returns the highest common right 
+          ++ factor of \spad{x} and \spad{y},
+          ++ that is the largest \spad{d} such that \spad{x = a d} and \spad{y = b d}.
+        lquo:   (%, %) -> Union(%, "failed")
+          ++ \spad{lquo(x, y)} returns the exact left quotient of \spad{x}
+          ++  by \spad{y} that is \spad{q} such that \spad{x = y * q},
+          ++ "failed" if \spad{x} is not of the form \spad{y * q}.
+        rquo:   (%, %) -> Union(%, "failed")
+          ++ \spad{rquo(x, y)} returns the exact right quotient of \spad{x} 
+          ++ by \spad{y} that is \spad{q} such that \spad{x = q * y},
+          ++ "failed" if \spad{x} is not of the form \spad{q * y}.
+        lquo:   (%, S) -> Union(%, "failed")
+          ++ \spad{lquo(x, s)} returns the exact left quotient of \spad{x} 
+          ++ by \spad{s}. 
+        rquo:   (%, S) -> Union(%, "failed")
+          ++ \spad{rquo(x, s)} returns the exact right quotient 
+          ++ of \spad{x} by \spad{s}.
+        "div":   (%, %) -> Union(Record(lm: %, rm: %), "failed")
+          ++ \spad{x div y} returns the left and right exact quotients of
+          ++ \spad{x} by \spad{y}, that is \spad{[l, r]} such that \spad{x = l * y * r}.
+          ++ "failed" is returned iff \spad{x} is not of the form \spad{l * y * r}.
+        overlap: (%, %) -> Record(lm: %, mm: %, rm: %)
+          ++ \spad{overlap(x, y)} returns \spad{[l, m, r]} such that
+          ++ \spad{x = l * m} and \spad{y = m * r} hold and such that 
+          ++ \spad{l} and \spad{r} have no overlap,
+          ++ that is \spad{overlap(l, r) = [l, 1, r]}.
+        size:   % -> NNI
+          ++ \spad{size(x)} returns the number of monomials in \spad{x}.
+        nthExpon:  (%, Integer) -> NNI
+          ++ \spad{nthExpon(x, n)} returns the exponent of the 
+          ++ \spad{n-th} monomial of \spad{x}.
+        nthFactor: (%, Integer) -> S
+          ++ \spad{nthFactor(x, n)} returns the factor of the \spad{n-th} 
+          ++ monomial of \spad{x}.
+        factors: % -> List REC
+          ++ \spad{factors(a1\^e1,...,an\^en)} returns \spad{[[a1, e1],...,[an, en]]}.
+        length: % -> NNI
+          ++ \spad{length(x)} returns the length of \spad{x}.
+        varList: % -> List S
+          ++ \spad{varList(x)} returns the list of variables of \spad{x}.
+
+    OFMdefinition == FreeMonoid(S) add
+        Rep := ListMonoidOps(S, NNI, 1)
+        
+      -- definitions
+        lquo(w:%, l:S) == 
+          x: List REC := listOfMonoms(w)$Rep
+          null x        => "failed"
+          fx: REC := first x
+          fx.gen ^= l  => "failed"
+          fx.exp = 1   => makeMulti rest(x)
+          makeMulti [[fx.gen, (fx.exp - 1)::NNI ]$REC, :rest x]
+       
+        rquo(w:%, l:S) ==
+          u:% := reverse w
+          (r := lquo (u,l)) case "failed" => "failed"
+          reverse_! (r::%)
+
+        length x == reduce("+" ,[f.exp for f in listOfMonoms x], 0)
+
+        varList x ==
+          le: List S := [t.gen for t in listOfMonoms x]
+          sort_! removeDuplicates(le)
+ 
+        first w ==
+          x: List REC := listOfMonoms w
+          null x => error "empty word !!!"
+          x.first.gen
+
+        rest w ==
+          x: List REC := listOfMonoms w
+          null x => error "empty word !!!"
+          fx: REC := first x
+          fx.exp = 1 => makeMulti rest x
+          makeMulti [[fx.gen , (fx.exp - 1)::NNI ]$REC , :rest x]
+
+        lexico(a,b) ==         --  ordre lexicographique
+            la := listOfMonoms a
+            lb := listOfMonoms b
+            while (not null la) and (not null lb) repeat
+                la.first.gen > lb.first.gen => return false
+                la.first.gen < lb.first.gen => return true
+                if la.first.exp = lb.first.exp then
+                    la:=rest la
+                    lb:=rest lb
+                else if la.first.exp > lb.first.exp then
+                    la:=concat([la.first.gen,
+                           (la.first.exp - lb.first.exp)::NNI], rest lb)
+                    lb:=rest lb
+                else
+                    lb:=concat([lb.first.gen,
+                             (lb.first.exp-la.first.exp)::NNI], rest la)
+                    la:=rest la
+            empty? la and not empty? lb
+
+
+        a < b ==               --  ordre lexicographique par longueur
+            la:NNI := length a; lb:NNI := length b
+            la = lb =>  lexico(a,b)
+            la < lb 
+
+        mirror x == reverse(x)$Rep
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain OVAR OrderedVariableList}
+<<OrderedVariableList.input>>=
+-- variable.spad.pamphlet OrderedVariableList.input
+)spool OrderedVariableList.output
+)set message test on
+)set message auto off
+)clear all
+--S 1
+ls:List Symbol:=['x,'a,'z]
+--R 
+--R
+--R   (1)  [x,a,z]
+--R                                                            Type: List Symbol
+--E 1
+
+--S 2
+Z:=OVAR ls
+--R 
+--R
+--R   (2)  OrderedVariableList [x,a,z]
+--R                                                                 Type: Domain
+--E 2
+
+--S 3
+size()$Z
+--R 
+--R
+--R   (3)  3
+--R                                                     Type: NonNegativeInteger
+--E 3
+
+--S 4
+lv:=[index(i::PI)$Z for i in 1..size()$Z]
+--R 
+--I   Compiling function G1408 with type Integer -> Boolean 
+--I   Compiling function G1572 with type NonNegativeInteger -> Boolean 
+--R
+--R   (4)  [x,a,z]
+--R                                       Type: List OrderedVariableList [x,a,z]
+--E 4
+
+--S 5
+sorted?(>,lv)
+--R 
+--R
+--R   (5)  true
+--R                                                                Type: Boolean
+--E 5
+)spool
+)lisp (bye)
+@
+<<OrderedVariableList.help>>=
+====================================================================
+OrderedVariableList examples
+====================================================================
+
+The domain OrderedVariableList provides symbols which are restricted
+to a particular list and have a definite ordering. Those two features
+are specified by a List Symbol object that is the argument to the
+domain.
+
+This is a sample ordering of three symbols.
+
+  ls:List Symbol:=['x,'a,'z]
+    [x,a,z]
+                                Type: List Symbol
+
+Let's build the domain
+
+  Z:=OVAR ls
+    OrderedVariableList [x,a,z]
+                                Type: Domain
+
+How many variables does it have?
+
+  size()$Z
+    3
+                                Type: NonNegativeInteger
+
+They are (in the imposed order)
+
+  lv:=[index(i::PI)$Z for i in 1..size()$Z]
+    [x,a,z]
+                                Type: List OrderedVariableList [x,a,z]
+
+Check that the ordering is right
+
+  sorted?(>,lv)
+    true
+                                Type: Boolean
+
+See Also:
+o )show OrderedVariableList
+o $AXIOM/doc/src/algebra/variable.spad.dvi
+
+@
+\pagehead{OrderedVariableList}{OVAR}
+\pagepic{ps/v103orderedvariablelist.ps}{OVAR}{1.00}
+<<domain OVAR OrderedVariableList>>=
+)abbrev domain OVAR OrderedVariableList
+++ Description:
+++ This domain implements ordered variables
+OrderedVariableList(VariableList:List Symbol):
+  Join(OrderedFinite, ConvertibleTo Symbol, ConvertibleTo InputForm,
+       ConvertibleTo Pattern Float, ConvertibleTo Pattern Integer) with
+         variable: Symbol -> Union(%,"failed")
+		++ variable(s) returns a member of the variable set or failed
+    == add
+       VariableList := removeDuplicates VariableList
+       Rep := PositiveInteger
+       s1,s2:%
+       convert(s1):Symbol == VariableList.((s1::Rep)::PositiveInteger)
+       coerce(s1):OutputForm == (convert(s1)@Symbol)::OutputForm
+       convert(s1):InputForm == convert(convert(s1)@Symbol)
+       convert(s1):Pattern(Integer) == convert(convert(s1)@Symbol)
+       convert(s1):Pattern(Float) == convert(convert(s1)@Symbol)
+       index i   == i::%
+       lookup j  == j :: Rep
+       size ()   == #VariableList
+       variable(exp:Symbol) ==
+            for i in 1.. for exp2 in VariableList repeat
+                if exp=exp2 then return i::PositiveInteger::%
+            "failed"
+       s1 < s2 == s2 <$Rep s1
+       s1 = s2 == s1 =$Rep s2
+       latex(x:%):String      == latex(convert(x)@Symbol)
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \section{domain ODPOL OrderlyDifferentialPolynomial}
 See also:\\
 \refto{OrderlyDifferentialVariable}{ODVAR}
@@ -48416,6 +51407,49 @@ OrdinaryDifferentialRing(Kernels,R,var): DRcategory == DRcapsule where
 
 @
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain OWP OrdinaryWeightedPolynomials}
+\pagehead{OrdinaryWeightedPolynomials}{OWP}
+\pagepic{ps/v103ordinaryweightedpolynomials.ps}{OWP}{1.00}
+<<domain OWP OrdinaryWeightedPolynomials>>=
+)abbrev domain OWP OrdinaryWeightedPolynomials
+++ Author: James Davenport
+++ Date Created:  17 April 1992
+++ Date Last Updated: 12 July 1992
+++ Basic Functions: Ring, changeWeightLevel
+++ Related Constructors: WeightedPolynomials
+++ Also See: PolynomialRing
+++ AMS classifications:
+++ Keywords:
+++ References:
+++ Description:
+++ This domain represents truncated weighted polynomials over the
+++ "Polynomial" type. The variables must be
+++ specified, as must the weights.
+++ The representation is sparse
+++ in the sense that only non-zero terms are represented.
+
+OrdinaryWeightedPolynomials(R:Ring,
+                             vl:List Symbol, wl:List NonNegativeInteger,
+                              wtlevel:NonNegativeInteger):
+       Ring with
+         if R has CommutativeRing then Algebra(R)
+         coerce: $ -> Polynomial(R)
+	         ++ coerce(p) converts back into a Polynomial(R), ignoring weights
+         coerce: Polynomial(R) -> $
+      	 	++ coerce(p) coerces a Polynomial(R) into Weighted form,
+         	++ applying weights and ignoring terms
+         if R has Field then "/": ($,$) -> Union($,"failed")
+	         ++ x/y division (only works if minimum weight
+       		 ++ of divisor is zero, and if R is a Field)
+         changeWeightLevel: NonNegativeInteger -> Void
+	         ++ changeWeightLevel(n) This changes the weight level to the new value given:
+         	 ++ NB: previously calculated terms are not affected
+    == WeightedPolynomials(R,Symbol,IndexedExponents(Symbol),
+                           Polynomial(R),
+                            vl,wl,wtlevel)
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \section{domain OSI OrdSetInts}
 \pagehead{OrdSetInts}{OSI}
 \pagepic{ps/v103ordsetints.ps}{OSI}{1.00}
@@ -54494,6 +57528,120 @@ Plot3D(): Exports == Implementation where
 
 @
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain PBWLB PoincareBirkhoffWittLyndonBasis}
+\pagehead{PoincareBirkhoffWittLyndonBasis}{PBWLB}
+\pagepic{ps/v103poincarebirkhoffwittlyndonbasis.ps}{PBWLB}{1.00}
+<<domain PBWLB PoincareBirkhoffWittLyndonBasis>>=
+)abbrev domain PBWLB PoincareBirkhoffWittLyndonBasis
+++ Author: Michel Petitot (petitot@lifl.fr).
+++ Date Created: 91
+++ Date Last Updated: 7 Juillet 92
+++ Fix History: compilation v 2.1 le 13 dec 98
+++ Basic Functions:
+++ Related Constructors:
+++ Also See:
+++ AMS Classifications:
+++ Keywords:
+++ References:
+++ Description:
+++ This domain provides the internal representation
+++ of polynomials in non-commutative variables written
+++ over the Poincare-Birkhoff-Witt basis.
+++ See the \spadtype{XPBWPolynomial} domain constructor.
+++ See Free Lie Algebras by C. Reutenauer 
+++ (Oxford science publications). \newline Author: Michel Petitot (petitot@lifl.fr).
+
+PoincareBirkhoffWittLyndonBasis(VarSet: OrderedSet): Public == Private where
+   WORD    ==> OrderedFreeMonoid(VarSet)
+   LWORD   ==> LyndonWord(VarSet)
+   LWORDS  ==> List(LWORD)
+   PI      ==> PositiveInteger
+   NNI     ==> NonNegativeInteger
+   EX      ==> OutputForm
+
+   Public == Join(OrderedSet, RetractableTo LWORD) with
+      1: constant -> %
+         ++ \spad{1} returns the empty list.
+      coerce       : $ -> WORD
+         ++ \spad{coerce([l1]*[l2]*...[ln])} returns the word \spad{l1*l2*...*ln},
+         ++ where \spad{[l_i]} is the backeted form of the Lyndon word \spad{l_i}.
+      coerce       : VarSet -> $
+         ++ \spad{coerce(v)} return \spad{v}
+      first        : $ -> LWORD
+         ++ \spad{first([l1]*[l2]*...[ln])} returns the Lyndon word \spad{l1}.
+      length       : $ -> NNI
+         ++ \spad{length([l1]*[l2]*...[ln])} returns the length of the word \spad{l1*l2*...*ln}.
+      ListOfTerms  : $ -> LWORDS
+         ++ \spad{ListOfTerms([l1]*[l2]*...[ln])} returns the list of words \spad{l1, l2, .... ln}.
+      rest         : $ -> $
+         ++ \spad{rest([l1]*[l2]*...[ln])} returns the list \spad{l2, .... ln}.
+      retractable? : $ -> Boolean
+         ++ \spad{retractable?([l1]*[l2]*...[ln])} returns true iff \spad{n}  equals \spad{1}.
+      varList      : $ -> List VarSet
+         ++ \spad{varList([l1]*[l2]*...[ln])} returns the list of
+         ++ variables in the word \spad{l1*l2*...*ln}.
+   
+   Private == add
+
+    -- Representation
+     Rep := LWORDS
+
+    -- Locales
+     recursif: ($,$) -> Boolean
+
+    -- Define
+     1 == nil
+
+     x = y == x =$Rep y
+
+     varList x ==
+        null x => nil
+        le: List VarSet := "setUnion"/ [varList$LWORD l for l in x]
+
+     first x == first(x)$Rep
+     rest x == rest(x)$Rep
+
+     coerce(v: VarSet):$ == [ v::LWORD ]
+     coerce(l: LWORD):$ == [l]
+     ListOfTerms(x:$):LWORDS == x pretend LWORDS      
+
+     coerce(x:$):WORD ==
+       null x => 1
+       x.first :: WORD *$WORD coerce(x.rest)
+
+     coerce(x:$):EX ==
+       null x => outputForm(1$Integer)$EX
+       reduce(_* ,[l :: EX for l in x])$List(EX)
+
+     retractable? x == 
+       null x => false
+       null x.rest
+
+     retract x == 
+        #x ^= 1 => error "cannot convert to Lyndon word"
+        x.first
+
+     retractIfCan x ==
+        retractable? x => x.first
+        "failed"
+      
+     length x ==
+        n: Integer := +/[ length l for l in x]
+        n::NNI
+
+     recursif(x, y) ==
+       null y => false
+       null x => true
+       x.first = y.first => recursif(rest(x), rest(y))
+       lexico(x.first, y.first)
+
+     x < y == 
+       lx: NNI := length x; ly: NNI := length y 
+       lx = ly => recursif(x,y)
+       lx < ly
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \section{domain POINT Point}
 \pagehead{Point}{POINT}
 \pagepic{ps/v103point.ps}{POINT}{1.00}
@@ -59368,6 +62516,44 @@ Reference(S:Type): Type with
 
 @
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain RGCHAIN RegularChain}
+\pagehead{RegularChain}{RGCHAIN}
+\pagepic{ps/v103regularchain.ps}{RGCHAIN}{1.00}
+<<domain RGCHAIN RegularChain>>=
+)abbrev domain RGCHAIN RegularChain
+++ Author: Marc Moreno Maza
+++ Date Created: 01/1999
+++ Date Last Updated: 23/01/1999
+++ Description: 
+++   A domain for regular chains (i.e. regular triangular sets) over
+++   a Gcd-Domain and with a fix list of variables.
+++   This is just a front-end for the \spadtype{RegularTriangularSet}
+++   domain constructor.
+++ Version: 1.
+
+RegularChain(R,ls): Exports == Implementation where
+  R : GcdDomain
+  ls: List Symbol
+  V ==> OrderedVariableList ls
+  E ==> IndexedExponents V
+  P ==> NewSparseMultivariatePolynomial(R,V)
+  TS ==> RegularTriangularSet(R,E,V,P)
+
+  Exports ==  RegularTriangularSetCategory(R,E,V,P) with
+     zeroSetSplit: (List P, Boolean, Boolean) -> List $
+       ++ \spad{zeroSetSplit(lp,clos?,info?)} returns a list \spad{lts} of regular
+       ++ chains such that the union of the closures of their regular zero sets
+       ++ equals the affine variety associated with \spad{lp}. Moreover, 
+       ++ if \spad{clos?} is \spad{false} then the union of the regular zero 
+       ++ set of the \spad{ts} (for \spad{ts} in \spad{lts}) equals this variety.
+       ++ If \spad{info?} is \spad{true} then some information is 
+       ++ displayed during the computations. See 
+       ++ \axiomOpFrom{zeroSetSplit}{RegularTriangularSet}.
+
+  Implementation == RegularTriangularSet(R,E,V,P) 
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \section{domain REGSET RegularTriangularSet}
 Several domain constructors implement regular triangular sets (or regular
 chains). Among them {\bf RegularTriangularSet} and 
@@ -62637,6 +65823,24 @@ RoutinesTable(): E == I where
 
 @
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain RULECOLD RuleCalled}
+\pagehead{RuleCalled}{RULECOLD}
+\pagepic{ps/v103rulecalled.ps}{RULECOLD}{1.00}
+<<domain RULECOLD RuleCalled>>=
+)abbrev domain RULECOLD RuleCalled
+++ Description:
+++ This domain implements named rules 
+RuleCalled(f:Symbol): SetCategory with 
+	name: % -> Symbol 
+		++ name(x) returns the symbol
+ == add
+  name r                 == f
+  coerce(r:%):OutputForm == f::OutputForm
+  x = y                  == true
+  latex(x:%):String      == latex f
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \section{domain RULESET Ruleset}
 \pagehead{Ruleset}{RULESET}
 \pagepic{ps/v103ruleset.ps}{RULESET}{1.00}
@@ -73796,6 +77000,957 @@ ThreeDimensionalMatrix(R) : Exports == Implementation where
 
 @
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain VIEW3D ThreeDimensionalViewport}
+\pagehead{ThreeDimensionalViewport}{VIEW3D}
+\pagepic{ps/v103threedimensionalviewport.ps}{VIEW3D}{1.00}
+<<domain VIEW3D ThreeDimensionalViewport>>=
+)abbrev domain VIEW3D ThreeDimensionalViewport
+++ Author: Jim Wen
+++ Date Created: 28 April 1989
+++ Date Last Updated: 2 November 1991, Jim Wen
+++ Basic Operations:
+++ Related Constructors:
+++ Also See:
+++ AMS Classifications:
+++ Keywords: 
+++ References:
+++ Description: ThreeDimensionalViewport creates viewports to display graphs
+VIEW    ==> VIEWPORTSERVER$Lisp
+sendI   ==> SOCK_-SEND_-INT
+sendSF  ==> SOCK_-SEND_-FLOAT
+sendSTR ==> SOCK_-SEND_-STRING
+getI    ==> SOCK_-GET_-INT
+getSF   ==> SOCK_-GET_-FLOAT
+
+typeVIEW3D   ==> 1$I
+typeVIEWTube ==> 4
+
+makeVIEW3D ==> (-1)$SingleInteger
+
+ThreeDimensionalViewport(): Exports == Implementation where
+  I   ==> Integer
+  PI  ==> PositiveInteger
+  NNI ==> NonNegativeInteger
+  XY  ==> Record( X:I, Y:I )
+  XYP ==> Record( X:PI, Y:PI )
+  XYNN ==> Record( X:NNI, Y:NNI )
+  SF  ==> DoubleFloat
+  F   ==> Float
+  L   ==> List
+  Pt ==> ColoredThreeDimensionalPoint
+  SEG ==> Segment
+  S   ==> String
+  E   ==> OutputForm
+  PLOT3D ==> Plot3D
+  TUBE   ==> TubePlot
+  V   ==> Record( theta:SF, phi:SF, scale:SF, scaleX:SF, scaleY:SF, scaleZ:SF, deltaX:SF, deltaY:SF )
+  H   ==> Record( hueOffset:I, hueNumber:I)
+  FLAG   ==> Record( showCP:I, style:I, axesOn:I, diagonalsOn:I, outlineRenderOn:I, showRegionField:I )
+  FR  ==> Record( fn:Fn2, fc: FnU, xmin:SF, xmax:SF, ymin:SF, ymax:SF, xnum:I, ynum:I )
+  FParamR ==> Record( theTube:TUBE )
+  LR  ==> Record( lightX:SF, lightY:SF, lightZ:SF, lightTheta:SF, lightPhi:SF , translucence:SF)
+  UFR ==> Union(FR,FParamR,"undefined")
+  PR  ==> Record( perspectiveField:I, eyeDistance:SF, hitherPlane:SF)
+  VR  ==> Record( clipXMin:SF, clipXMax:SF, clipYMin:SF, clipYMax:SF, clipZMin:SF, clipZMax:SF, clipRegionField:I, clipSurfaceField:I)
+  C   ==> Color()
+  B   ==> Boolean
+  POINT ==> Point(SF)
+  SUBSPACE ==> SubSpace(3,SF)
+  SPACE3 ==> ThreeSpace(SF)
+  DROP ==> DrawOption
+  COORDSYS ==> CoordinateSystems(SF)
+
+    -- the below macros correspond to the ones in include/actions.h
+  ROTATE       ==> 0$I  -- rotate      in actions.h
+  ZOOM         ==> 1$I  -- zoom        in actions.h
+  TRANSLATE    ==> 2    -- translate   in actions.h
+  rendered     ==> 3    -- render      in actions.h
+  hideControl  ==> 4
+  closeAll     ==> 5
+  axesOnOff    ==> 6
+  opaque       ==> 7    -- opaqueMesh  in action.h
+  contour      ==> 24
+  RESET        ==> 8
+  wireMesh     ==> 9    -- transparent in actions.h
+  region3D     ==> 12
+  smooth       ==> 22
+  diagOnOff    ==> 26      
+  outlineOnOff ==> 13      
+  zoomx        ==> 14
+  zoomy        ==> 15
+  zoomz        ==> 16
+  perspectiveOnOff ==> 27  
+  clipRegionOnOff ==> 66   
+  clipSurfaceOnOff ==> 67  
+
+  SPADBUTTONPRESS ==> 100
+  COLORDEF        ==> 101
+  MOVE            ==> 102
+  RESIZE          ==> 103
+  TITLE           ==> 104
+  lightDef        ==> 108
+  translucenceDef ==> 109
+  writeView       ==> 110
+  eyeDistanceData ==> 111
+  modifyPOINT     ==> 114
+--  printViewport   ==> 115
+  hitherPlaneData ==> 116
+  queryVIEWPOINT  ==> 117
+  changeVIEWPOINT ==> 118
+
+  noControl ==> 0$I
+
+  yes       ==> 1$I
+  no        ==> 0$I
+
+  EYED      ==> 500::SF  -- see draw.h, should be the same(?) as clipOffset
+  HITHER    ==> (-250)::SF   -- see process.h in view3D/ (not yet passed to viewman)
+
+  openTube  ==> 1$I
+  closedTube ==> 0$I
+
+  fun2Var3D  ==> "   Three Dimensional Viewport: Function of Two Variables"
+  para1Var3D ==> "   Three Dimensional Viewport: Parametric Curve of One Variable"
+  undef3D    ==> "   Three Dimensional Viewport: No function defined for this viewport yet"
+
+  Exports ==> SetCategory with  
+    viewThetaDefault      : ()                                       -> F
+      ++ viewThetaDefault() returns the current default longitudinal
+      ++ view angle in radians.
+    viewThetaDefault      : F                                        -> F
+      ++ viewThetaDefault(t) sets the current default longitudinal
+      ++ view angle in radians to the value t and returns t.
+    viewPhiDefault        : ()                                       -> F
+      ++ viewPhiDefault() returns the current default latitudinal
+      ++ view angle in radians.
+    viewPhiDefault        : F                                        -> F
+      ++ viewPhiDefault(p) sets the current default latitudinal
+      ++ view angle in radians to the value p and returns p.
+    viewZoomDefault       : ()                                       -> F
+      ++ viewZoomDefault() returns the current default graph scaling
+      ++ value.
+    viewZoomDefault       : F                                        -> F
+      ++ viewZoomDefault(s) sets the current default graph scaling
+      ++ value to s and returns s.
+    viewDeltaXDefault     : ()                                       -> F
+      ++ viewDeltaXDefault() returns the current default horizontal
+      ++ offset from the center of the viewport window.
+    viewDeltaXDefault     : F                                        -> F
+      ++ viewDeltaXDefault(dx) sets the current default horizontal
+      ++ offset from the center of the viewport window to be \spad{dx}
+      ++ and returns \spad{dx}.
+    viewDeltaYDefault     : ()                                       -> F
+      ++ viewDeltaYDefault() returns the current default vertical
+      ++ offset from the center of the viewport window.
+    viewDeltaYDefault     : F                                        -> F
+      ++ viewDeltaYDefault(dy) sets the current default vertical
+      ++ offset from the center of the viewport window to be \spad{dy}
+      ++ and returns \spad{dy}.
+    viewport3D            : ()                                       -> %
+      ++ viewport3D() returns an undefined three-dimensional viewport
+      ++ of the domain \spadtype{ThreeDimensionalViewport} whose
+      ++ contents are empty.
+    makeViewport3D        : %                                        -> %
+      ++ makeViewport3D(v) takes the given three-dimensional viewport,
+      ++ v, of the domain \spadtype{ThreeDimensionalViewport} and
+      ++ displays a viewport window on the screen which contains 
+      ++ the contents of v.
+    makeViewport3D        : (SPACE3,S)                               -> %
+      ++ makeViewport3D(sp,s) takes the given space, \spad{sp} which is
+      ++ of the domain \spadtype{ThreeSpace} and displays a viewport
+      ++ window on the screen which contains the contents of \spad{sp},
+      ++ and whose title is given by s.
+    makeViewport3D        : (SPACE3,L DROP)                          -> %
+      ++ makeViewport3D(sp,lopt) takes the given space, \spad{sp} which is
+      ++ of the domain \spadtype{ThreeSpace} and displays a viewport
+      ++ window on the screen which contains the contents of \spad{sp},
+      ++ and whose draw options are indicated by the list \spad{lopt}, which
+      ++ is a list of options from the domain \spad{DrawOption}.
+    subspace              : %                                        -> SPACE3
+      ++ subspace(v) returns the contents of the viewport v, which is
+      ++ of the domain \spadtype{ThreeDimensionalViewport}, as a subspace
+      ++ of the domain \spad{ThreeSpace}.
+    subspace              : (%,SPACE3)                               -> %
+      ++ subspace(v,sp) places the contents of the viewport v, which is
+      ++ of the domain \spadtype{ThreeDimensionalViewport}, in the subspace
+      ++ \spad{sp}, which is of the domain \spad{ThreeSpace}.
+    modifyPointData       : (%,NNI,POINT)                            -> Void
+      ++ modifyPointData(v,ind,pt) takes the viewport, v, which is of the
+      ++ domain \spadtype{ThreeDimensionalViewport}, and places the data
+      ++ point, \spad{pt} into the list of points database of v at the index
+      ++ location given by \spad{ind}.
+    options               : %                                        -> L DROP
+      ++ options(v) takes the viewport, v, which is of the domain
+      ++ \spadtype{ThreeDimensionalViewport} and returns a list of all
+      ++ the draw options from the domain \spad{DrawOption} which are
+      ++ being used by v.
+    options               : (%,L DROP)                               -> %
+      ++ options(v,lopt) takes the viewport, v, which is of the domain
+      ++ \spadtype{ThreeDimensionalViewport} and sets the draw options
+      ++ being used by v to those indicated in the list, \spad{lopt},
+      ++ which is a list of options from the domain \spad{DrawOption}.
+    move                  : (%,NNI,NNI)                              -> Void
+      ++ move(v,x,y) displays the three-dimensional viewport, v, which
+      ++ is of domain \spadtype{ThreeDimensionalViewport}, with the upper
+      ++ left-hand corner of the viewport window at the screen 
+      ++ coordinate position x, y.
+    resize                : (%,PI,PI)                                -> Void
+      ++ resize(v,w,h) displays the three-dimensional viewport, v, which
+      ++ is of domain \spadtype{ThreeDimensionalViewport}, with a width
+      ++ of w and a height of h, keeping the upper left-hand corner
+      ++ position unchanged.
+    title                 : (%,S)                                    -> Void
+      ++ title(v,s) changes the title which is shown in the three-dimensional 
+      ++ viewport window, v of domain \spadtype{ThreeDimensionalViewport}.
+    dimensions            : (%,NNI,NNI,PI,PI)                        -> Void
+      ++ dimensions(v,x,y,width,height) sets the position of the
+      ++ upper left-hand corner of the three-dimensional viewport, v,
+      ++ which is of domain \spadtype{ThreeDimensionalViewport}, to
+      ++ the window coordinate x, y, and sets the dimensions of the
+      ++ window to that of \spad{width}, \spad{height}.  The new
+      ++ dimensions are not displayed until the function
+      ++ \spadfun{makeViewport3D} is executed again for v.
+    viewpoint             : (%,F,F,F,F,F)                            -> Void
+      ++ viewpoint(v,th,phi,s,dx,dy) sets the longitudinal view angle
+      ++ to \spad{th} radians, the latitudinal view angle to \spad{phi}
+      ++ radians, the scale factor to \spad{s}, the horizontal viewport 
+      ++ offset to \spad{dx}, and the vertical viewport offset to \spad{dy}
+      ++ for the viewport v, which is of the domain
+      ++ \spadtype{ThreeDimensionalViewport}.  The new viewpoint position
+      ++ is not displayed until the function \spadfun{makeViewport3D} is
+      ++ executed again for v.
+    viewpoint             : (%)					    -> V
+      ++ viewpoint(v) returns the current viewpoint setting of the given
+      ++ viewport, v.  This function is useful in the situation where the
+      ++ user has created a viewport, proceeded to interact with it via
+      ++ the control panel and desires to save the values of the viewpoint
+      ++ as the default settings for another viewport to be created using
+      ++ the system.
+    viewpoint		  : (%,V)				     -> Void
+      ++ viewpoint(v,viewpt) sets the viewpoint for the viewport.  The
+      ++ viewport record consists of the latitudal and longitudal angles,
+      ++ the zoom factor, the X, Y, and Z scales, and the X and Y displacements.
+    viewpoint             : (%,I,I,F,F,F)                            -> Void
+      ++ viewpoint(v,th,phi,s,dx,dy) sets the longitudinal view angle
+      ++ to \spad{th} degrees, the latitudinal view angle to \spad{phi}
+      ++ degrees, the scale factor to \spad{s}, the horizontal viewport 
+      ++ offset to \spad{dx}, and the vertical viewport offset to \spad{dy}
+      ++ for the viewport v, which is of the domain
+      ++ \spadtype{ThreeDimensionalViewport}.  The new viewpoint position
+      ++ is not displayed until the function \spadfun{makeViewport3D} is
+      ++ executed again for v.
+    viewpoint             : (%,F,F)                                  -> Void
+      ++ viewpoint(v,th,phi) sets the longitudinal view angle to \spad{th}
+      ++ radians and the latitudinal view angle to \spad{phi} radians
+      ++ for the viewport v, which is of the domain
+      ++ \spadtype{ThreeDimensionalViewport}.  The new viewpoint position
+      ++ is not displayed until the function \spadfun{makeViewport3D} is
+      ++ executed again for v.
+    viewpoint             : (%,F,F,F)                                -> Void
+      ++ viewpoint(v,rotx,roty,rotz) sets the rotation about the x-axis
+      ++ to be \spad{rotx} radians, sets the rotation about the y-axis
+      ++ to be \spad{roty} radians, and sets the rotation about the z-axis
+      ++ to be \spad{rotz} radians, for the viewport v, which is of the
+      ++ domain \spadtype{ThreeDimensionalViewport} and displays v with
+      ++ the new view position.
+    controlPanel          : (%,S)                                    -> Void
+      ++ controlPanel(v,s) displays the control panel of the given
+      ++ three-dimensional viewport, v, which is of domain
+      ++ \spadtype{ThreeDimensionalViewport}, if s is "on", or hides
+      ++ the control panel if s is "off".
+    axes                  : (%,S)                                    -> Void
+      ++ axes(v,s) displays the axes of the given three-dimensional
+      ++ viewport, v, which is of domain \spadtype{ThreeDimensionalViewport},
+      ++ if s is "on", or does not display the axes if s is "off".
+    diagonals             : (%,S)                                    -> Void
+      ++ diagonals(v,s) displays the diagonals of the polygon outline
+      ++ showing a triangularized surface instead of a quadrilateral
+      ++ surface outline, for the given three-dimensional viewport v
+      ++ which is of domain \spadtype{ThreeDimensionalViewport}, if s is 
+      ++ "on", or does not display the diagonals if s is "off".
+    outlineRender         : (%,S)                                    -> Void
+      ++ outlineRender(v,s) displays the polygon outline showing either
+      ++ triangularized surface or a quadrilateral surface outline depending
+      ++ on the whether the \spadfun{diagonals} function has been set, for
+      ++ the given three-dimensional viewport v which is of domain
+      ++ \spadtype{ThreeDimensionalViewport}, if s is "on", or does not
+      ++ display the polygon outline if s is "off".
+    drawStyle             : (%,S)                                    -> Void
+      ++ drawStyle(v,s) displays the surface for the given three-dimensional
+      ++ viewport v which is of domain \spadtype{ThreeDimensionalViewport}
+      ++ in the style of drawing indicated by s.  If s is not a valid
+      ++ drawing style the style is wireframe by default.  Possible
+      ++ styles are \spad{"shade"}, \spad{"solid"} or \spad{"opaque"},
+      ++ \spad{"smooth"}, and \spad{"wireMesh"}.
+    rotate                : (%,F,F)                                  -> Void
+      ++ rotate(v,th,phi) rotates the graph to the longitudinal view angle
+      ++ \spad{th} radians and the latitudinal view angle \spad{phi} radians
+      ++ for the viewport v, which is of the domain
+      ++ \spadtype{ThreeDimensionalViewport}.
+    rotate                : (%,I,I)                                  -> Void
+      ++ rotate(v,th,phi) rotates the graph to the longitudinal view angle
+      ++ \spad{th} degrees and the latitudinal view angle \spad{phi} degrees
+      ++ for the viewport v, which is of the domain
+      ++ \spadtype{ThreeDimensionalViewport}.  The new rotation position
+      ++ is not displayed until the function \spadfun{makeViewport3D} is
+      ++ executed again for v.
+    zoom                  : (%,F)                                    -> Void
+      ++ zoom(v,s) sets the graph scaling factor to s, for the viewport v,
+      ++ which is of the domain \spadtype{ThreeDimensionalViewport}.
+    zoom                  : (%,F,F,F)                                -> Void
+      ++ zoom(v,sx,sy,sz) sets the graph scaling factors for the x-coordinate
+      ++ axis to \spad{sx}, the y-coordinate axis to \spad{sy} and the
+      ++ z-coordinate axis to \spad{sz} for the viewport v, which is of
+      ++ the domain \spadtype{ThreeDimensionalViewport}.
+    translate             : (%,F,F)                                  -> Void
+      ++ translate(v,dx,dy) sets the horizontal viewport offset to \spad{dx}
+      ++ and the vertical viewport offset to \spad{dy}, for the viewport v,
+      ++ which is of the domain \spadtype{ThreeDimensionalViewport}.
+    perspective           : (%,S)                                    -> Void
+      ++ perspective(v,s) displays the graph in perspective if s is "on",
+      ++ or does not display perspective if s is "off" for the given
+      ++ three-dimensional viewport, v, which is of domain
+      ++ \spadtype{ThreeDimensionalViewport}.
+    eyeDistance           : (%,F)                                    -> Void
+      ++ eyeDistance(v,d) sets the distance of the observer from the center
+      ++ of the graph to d, for the viewport v, which is of the domain
+      ++ \spadtype{ThreeDimensionalViewport}.
+    hitherPlane           : (%,F)                                    -> Void
+      ++ hitherPlane(v,h) sets the hither clipping plane of the graph to h,
+      ++ for the viewport v, which is of the domain
+      ++ \spadtype{ThreeDimensionalViewport}.
+    showRegion            : (%,S)                                    -> Void
+      ++ showRegion(v,s) displays the bounding box of the given 
+      ++ three-dimensional viewport, v, which is of domain
+      ++ \spadtype{ThreeDimensionalViewport}, if s is "on", or does not
+      ++ display the box if s is "off".
+    showClipRegion        : (%,S)                                    -> Void
+      ++ showClipRegion(v,s) displays the clipping region of the given 
+      ++ three-dimensional viewport, v, which is of domain
+      ++ \spadtype{ThreeDimensionalViewport}, if s is "on", or does not
+      ++ display the region if s is "off".
+    clipSurface           : (%,S)                                    -> Void
+      ++ clipSurface(v,s) displays the graph with the specified
+      ++ clipping region removed if s is "on", or displays the graph
+      ++ without clipping implemented if s is "off", for the given 
+      ++ three-dimensional viewport, v, which is of domain
+      ++ \spadtype{ThreeDimensionalViewport}.
+    lighting              : (%,F,F,F)                                -> Void
+      ++ lighting(v,x,y,z) sets the position of the light source to
+      ++ the coordinates x, y, and z and displays the graph for the given 
+      ++ three-dimensional viewport, v, which is of domain
+      ++ \spadtype{ThreeDimensionalViewport}.
+    intensity             : (%,F)                                    -> Void
+      ++ intensity(v,i) sets the intensity of the light source to i, for
+      ++ the given three-dimensional viewport, v, which is of domain
+      ++ \spadtype{ThreeDimensionalViewport}.
+    reset                 :  %                                       -> Void
+      ++ reset(v) sets the current state of the graph characteristics
+      ++ of the given three-dimensional viewport, v, which is of domain
+      ++ \spadtype{ThreeDimensionalViewport}, back to their initial settings.
+    colorDef              : (%,C,C)                                  -> Void
+      ++ colorDef(v,c1,c2) sets the range of colors along the colormap so
+      ++ that the lower end of the colormap is defined by \spad{c1} and the
+      ++ top end of the colormap is defined by \spad{c2}, for the given
+      ++ three-dimensional viewport, v, which is of domain
+      ++ \spadtype{ThreeDimensionalViewport}.
+    write                 : (%,S)                                    -> S
+      ++ write(v,s) takes the given three-dimensional viewport, v, which
+      ++ is of domain \spadtype{ThreeDimensionalViewport}, and creates
+      ++ a directory indicated by s, which contains the graph data
+      ++ file for v.
+    write                 : (%,S,S)                                  -> S
+      ++ write(v,s,f) takes the given three-dimensional viewport, v, which
+      ++ is of domain \spadtype{ThreeDimensionalViewport}, and creates
+      ++ a directory indicated by s, which contains the graph data
+      ++ file for v and an optional file type f.
+    write                 : (%,S,L S)                                -> S
+      ++ write(v,s,lf) takes the given three-dimensional viewport, v, which
+      ++ is of domain \spadtype{ThreeDimensionalViewport}, and creates
+      ++ a directory indicated by s, which contains the graph data
+      ++ file for v and the optional file types indicated by the list lf.
+    close                 :  %                                       -> Void
+      ++ close(v) closes the viewport window of the given
+      ++ three-dimensional viewport, v, which is of domain
+      ++ \spadtype{ThreeDimensionalViewport}, and terminates the
+      ++ corresponding process ID.
+    key                   :  %                                       -> I
+      ++ key(v) returns the process ID number of the given three-dimensional
+      ++ viewport, v, which is of domain \spadtype{ThreeDimensionalViewport}.
+--    print                 :  %                                       -> Void
+
+  Implementation ==> add
+    import Color()
+    import ViewDefaultsPackage()
+    import Plot3D()
+    import TubePlot()
+    import POINT
+    import PointPackage(SF)
+    import SubSpaceComponentProperty()
+    import SPACE3
+    import MeshCreationRoutinesForThreeDimensions()
+    import DrawOptionFunctions0
+    import COORDSYS
+    import Set(PositiveInteger)
+
+    Rep := Record (key:I, fun:I, _
+                   title:S, moveTo:XYNN, size:XYP, viewpoint:V, colors:H, flags:FLAG, _
+                   lighting:LR, perspective:PR, volume:VR, _
+                   space3D:SPACE3, _
+                   optionsField:L DROP)
+
+    degrees := pi()$F / 180.0
+    degreesSF := pi()$SF / 180
+    defaultTheta  : Reference(SF) := ref(convert(pi()$F/4.0)@SF)
+    defaultPhi    : Reference(SF) := ref(convert(-pi()$F/4.0)@SF)
+    defaultZoom   : Reference(SF) := ref(convert(1.2)@SF)
+    defaultDeltaX : Reference(SF) := ref 0
+    defaultDeltaY : Reference(SF) := ref 0
+
+
+--%Local Functions
+    checkViewport (viewport:%):B ==
+        -- checks to see if this viewport still exists
+        -- by sending the key to the viewport manager and
+        -- waiting for its reply after it checks it against
+        -- the viewports in its list. a -1 means it doesn't
+        -- exist.
+      sendI(VIEW,viewport.key)$Lisp
+      i := getI(VIEW)$Lisp
+      (i < 0$I) => 
+        viewport.key := 0$I
+        error "This viewport has already been closed!"
+      true
+    
+    arcsinTemp(x:SF):SF ==
+      -- the asin function doesn't exist in the SF domain currently
+      x >= 1  => (pi()$SF / 2)  -- to avoid floating point error from SF (ie 1.0 -> 1.00001)
+      x <= -1 => 3 * pi()$SF / 2
+      convert(asin(convert(x)@Float)$Float)@SF
+
+    arctanTemp(x:SF):SF == convert(atan(convert(x)@Float)$Float)@SF
+
+    doOptions(v:Rep):Void ==    
+      v.title := title(v.optionsField,"AXIOM3D")
+      st:S := style(v.optionsField,"wireMesh")
+      if (st = "shade" or st = "render") then
+        v.flags.style := rendered
+      else if (st = "solid" or st = "opaque") then
+        v.flags.style := opaque
+      else if (st = "contour") then
+        v.flags.style := contour      
+      else if (st = "smooth") then
+        v.flags.style := smooth
+      else v.flags.style := wireMesh
+      v.viewpoint := viewpoint(v.optionsField,
+        [deref defaultTheta,deref defaultPhi,deref defaultZoom, _
+          1$SF,1$SF,1$SF,deref defaultDeltaX, deref defaultDeltaY])
+        -- etc - 3D specific stuff...
+
+--%Exported Functions : Default Settings
+    viewport3D() ==
+      [0,typeVIEW3D,"AXIOM3D",[viewPosDefault().1,viewPosDefault().2], _
+       [viewSizeDefault().1,viewSizeDefault().2], _
+        [deref defaultTheta,deref defaultPhi,deref defaultZoom, _
+          1$SF,1$SF,1$SF,deref defaultDeltaX, deref defaultDeltaY], [0,27], _
+            [noControl,wireMesh,yes,no,no,no], [0$SF,0$SF,1$SF,0$SF,0$SF,1$SF], _
+              [yes, EYED, HITHER], [0$SF,1$SF,0$SF,1$SF,0$SF,1$SF,no,yes], _
+                create3Space()$SPACE3, [] ]
+
+    subspace viewport ==
+      viewport.space3D
+
+    subspace(viewport,space) ==
+      viewport.space3D := space
+      viewport
+
+    options viewport ==
+      viewport.optionsField
+
+    options(viewport,opts) ==
+      viewport.optionsField := opts
+      viewport
+
+    makeViewport3D(space:SPACE3,Title:S):% ==
+      v := viewport3D()
+      v.space3D := space
+      v.optionsField := [title(Title)]
+      makeViewport3D v
+
+    makeViewport3D(space:SPACE3,opts:L DROP):% ==
+      v := viewport3D()
+      v.space3D := space
+      v.optionsField := opts
+      makeViewport3D v
+
+    makeViewport3D viewport ==
+      doOptions viewport --local function to extract and assign optional arguments for 3D viewports
+      sayBrightly(["   Transmitting data..."::E]$List(E))$Lisp
+      transform := coord(viewport.optionsField,cartesian$COORDSYS)$DrawOptionFunctions0
+      check(viewport.space3D)
+      lpts := lp(viewport.space3D) 
+      lllipts  := lllip(viewport.space3D)
+      llprops := llprop(viewport.space3D)
+      lprops  := lprop(viewport.space3D)
+        -- check for dimensionality of points
+        -- if they are all 4D points, then everything is okay
+        -- if they are all 3D points, then pad an extra constant
+        -- coordinate for color
+        -- if they have varying dimensionalities, give an error
+      s := brace()$Set(PI)
+      for pt in lpts repeat
+        insert_!(dimension pt,s)
+      #s > 1 => error "All points should have the same dimension"
+      (n := first parts s) < 3 => error "Dimension of points should be greater than 2"
+      sendI(VIEW,viewport.fun)$Lisp
+      sendI(VIEW,makeVIEW3D)$Lisp
+      sendSTR(VIEW,viewport.title)$Lisp
+      sendSF(VIEW,viewport.viewpoint.deltaX)$Lisp
+      sendSF(VIEW,viewport.viewpoint.deltaY)$Lisp
+      sendSF(VIEW,viewport.viewpoint.scale)$Lisp
+      sendSF(VIEW,viewport.viewpoint.scaleX)$Lisp
+      sendSF(VIEW,viewport.viewpoint.scaleY)$Lisp
+      sendSF(VIEW,viewport.viewpoint.scaleZ)$Lisp
+      sendSF(VIEW,viewport.viewpoint.theta)$Lisp
+      sendSF(VIEW,viewport.viewpoint.phi)$Lisp
+      sendI(VIEW,viewport.moveTo.X)$Lisp
+      sendI(VIEW,viewport.moveTo.Y)$Lisp
+      sendI(VIEW,viewport.size.X)$Lisp
+      sendI(VIEW,viewport.size.Y)$Lisp
+      sendI(VIEW,viewport.flags.showCP)$Lisp
+      sendI(VIEW,viewport.flags.style)$Lisp
+      sendI(VIEW,viewport.flags.axesOn)$Lisp
+      sendI(VIEW,viewport.flags.diagonalsOn)$Lisp
+      sendI(VIEW,viewport.flags.outlineRenderOn)$Lisp
+      sendI(VIEW,viewport.flags.showRegionField)$Lisp  -- add to make3D.c
+      sendI(VIEW,viewport.volume.clipRegionField)$Lisp  -- add to make3D.c
+      sendI(VIEW,viewport.volume.clipSurfaceField)$Lisp  -- add to make3D.c
+      sendI(VIEW,viewport.colors.hueOffset)$Lisp
+      sendI(VIEW,viewport.colors.hueNumber)$Lisp
+      sendSF(VIEW,viewport.lighting.lightX)$Lisp
+      sendSF(VIEW,viewport.lighting.lightY)$Lisp
+      sendSF(VIEW,viewport.lighting.lightZ)$Lisp
+      sendSF(VIEW,viewport.lighting.translucence)$Lisp
+      sendI(VIEW,viewport.perspective.perspectiveField)$Lisp
+      sendSF(VIEW,viewport.perspective.eyeDistance)$Lisp
+        -- new, crazy points domain stuff
+          -- first, send the point data list
+      sendI(VIEW,#lpts)$Lisp
+      for pt in lpts repeat
+        aPoint := transform pt
+        sendSF(VIEW,xCoord aPoint)$Lisp
+        sendSF(VIEW,yCoord aPoint)$Lisp
+        sendSF(VIEW,zCoord aPoint)$Lisp
+        n = 3 => sendSF(VIEW,zCoord aPoint)$Lisp
+        sendSF(VIEW,color aPoint)$Lisp  -- change to c
+          -- now, send the 3d subspace structure
+      sendI(VIEW,#lllipts)$Lisp
+      for allipts in lllipts for oneprop in lprops for onelprops in llprops repeat
+           -- the following is false for f(x,y) and user-defined for [x(t),y(t),z(t)]
+           -- this is temporary - until the generalized points stuff gets put in
+        sendI(VIEW,(closed? oneprop => yes; no))$Lisp
+        sendI(VIEW,(solid? oneprop => yes; no))$Lisp
+        sendI(VIEW,#allipts)$Lisp
+        for alipts in allipts for tinyprop in onelprops repeat
+           -- the following is false for f(x,y) and true for [x(t),y(t),z(t)]
+           -- this is temporary -- until the generalized points stuff gets put in
+          sendI(VIEW,(closed? tinyprop => yes;no))$Lisp
+          sendI(VIEW,(solid? tinyprop => yes;no))$Lisp
+          sendI(VIEW,#alipts)$Lisp
+          for oneIndexedPoint in alipts repeat
+            sendI(VIEW,oneIndexedPoint)$Lisp 
+      viewport.key := getI(VIEW)$Lisp
+      viewport
+         -- the key (now set to 0) should be what the viewport returns
+
+    viewThetaDefault    == convert(defaultTheta())@F
+    viewThetaDefault  t == 
+      defaultTheta() := convert(t)@SF
+      t
+    viewPhiDefault      == convert(defaultPhi())@F
+    viewPhiDefault    t == 
+      defaultPhi() := convert(t)@SF
+      t
+    viewZoomDefault     == convert(defaultZoom())@F
+    viewZoomDefault   t == 
+      defaultZoom() := convert(t)@SF
+      t
+    viewDeltaXDefault   == convert(defaultDeltaX())@F
+    viewDeltaXDefault t == 
+      defaultDeltaX() := convert(t)@SF
+      t
+    viewDeltaYDefault   == convert(defaultDeltaY())@F
+    viewDeltaYDefault t == 
+      defaultDeltaY() := convert(t)@SF
+      t
+
+--Exported Functions: Available features for 3D viewports
+    lighting(viewport,Xlight,Ylight,Zlight) ==
+      viewport.lighting.lightX := convert(Xlight)@SF
+      viewport.lighting.lightY := convert(Ylight)@SF
+      viewport.lighting.lightZ := convert(Zlight)@SF
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW3D)$Lisp
+        sendI(VIEW,lightDef)$Lisp
+        checkViewport viewport =>
+          sendSF(VIEW,viewport.lighting.lightX)$Lisp
+          sendSF(VIEW,viewport.lighting.lightY)$Lisp
+          sendSF(VIEW,viewport.lighting.lightZ)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+
+    axes (viewport,onOff) ==
+      if onOff = "on" then viewport.flags.axesOn := yes
+      else viewport.flags.axesOn := no
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW3D)$Lisp
+        sendI(VIEW,axesOnOff)$Lisp
+        checkViewport viewport =>
+          sendI(VIEW,viewport.flags.axesOn)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+
+    diagonals (viewport,onOff) ==
+      if onOff = "on" then viewport.flags.diagonalsOn := yes
+      else viewport.flags.diagonalsOn := no
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW3D)$Lisp
+        sendI(VIEW,diagOnOff)$Lisp
+        checkViewport viewport =>
+          sendI(VIEW,viewport.flags.diagonalsOn)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+
+    outlineRender (viewport,onOff) ==
+      if onOff = "on" then viewport.flags.outlineRenderOn := yes
+      else viewport.flags.outlineRenderOn := no
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW3D)$Lisp
+        sendI(VIEW,outlineOnOff)$Lisp
+        checkViewport viewport =>
+          sendI(VIEW,viewport.flags.outlineRenderOn)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+
+    controlPanel (viewport,onOff) ==
+      if onOff = "on" then viewport.flags.showCP := yes
+      else viewport.flags.showCP := no
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW3D)$Lisp
+        sendI(VIEW,hideControl)$Lisp
+        checkViewport viewport =>
+          sendI(VIEW,viewport.flags.showCP)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+
+    drawStyle (viewport,how) ==
+      if (how = "shade") then                    -- render
+        viewport.flags.style := rendered
+      else if (how = "solid") then               -- opaque
+        viewport.flags.style := opaque
+      else if (how = "contour") then             -- contour
+        viewport.flags.style := contour
+      else if (how = "smooth") then              -- smooth
+        viewport.flags.style := smooth
+      else viewport.flags.style := wireMesh
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW3D)$Lisp
+        sendI(VIEW,viewport.flags.style)$Lisp
+        checkViewport viewport =>
+          getI(VIEW)$Lisp          -- acknowledge
+
+    reset viewport ==
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW3D)$Lisp
+        sendI(VIEW,SPADBUTTONPRESS)$Lisp
+        checkViewport viewport =>
+          sendI(VIEW,RESET)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+
+    close viewport ==
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW3D)$Lisp
+        sendI(VIEW,closeAll)$Lisp
+        checkViewport viewport =>
+          getI(VIEW)$Lisp          -- acknowledge
+          viewport.key := 0$I
+
+    viewpoint (viewport:%):V ==
+      (key(viewport) ^= 0$I) =>
+	sendI(VIEW,typeVIEW3D)$Lisp
+	sendI(VIEW,queryVIEWPOINT)$Lisp
+	checkViewport viewport =>
+	  deltaX_sf : SF := getSF(VIEW)$Lisp
+	  deltaY_sf : SF := getSF(VIEW)$Lisp
+	  scale_sf  : SF := getSF(VIEW)$Lisp
+	  scaleX_sf : SF := getSF(VIEW)$Lisp
+	  scaleY_sf : SF := getSF(VIEW)$Lisp
+	  scaleZ_sf : SF := getSF(VIEW)$Lisp
+	  theta_sf  : SF := getSF(VIEW)$Lisp
+	  phi_sf    : SF := getSF(VIEW)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+	  viewport.viewpoint := 
+	    [ theta_sf, phi_sf, scale_sf, scaleX_sf, scaleY_sf, scaleZ_sf, 
+	      deltaX_sf, deltaY_sf ]
+        viewport.viewpoint
+
+    viewpoint (viewport:%, viewpt:V):Void ==
+      viewport.viewpoint := viewpt
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW3D)$Lisp
+        sendI(VIEW,changeVIEWPOINT)$Lisp
+        checkViewport viewport =>
+          sendSF(VIEW,viewport.viewpoint.deltaX)$Lisp
+          sendSF(VIEW,viewport.viewpoint.deltaY)$Lisp
+          sendSF(VIEW,viewport.viewpoint.scale)$Lisp
+          sendSF(VIEW,viewport.viewpoint.scaleX)$Lisp
+          sendSF(VIEW,viewport.viewpoint.scaleY)$Lisp
+          sendSF(VIEW,viewport.viewpoint.scaleZ)$Lisp
+          sendSF(VIEW,viewport.viewpoint.theta)$Lisp
+          sendSF(VIEW,viewport.viewpoint.phi)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+
+
+    viewpoint (viewport:%,Theta:F,Phi:F,Scale:F,DeltaX:F,DeltaY:F):Void ==
+      viewport.viewpoint := 
+        [convert(Theta)@SF,convert(Phi)@SF,convert(Scale)@SF,1$SF,1$SF,1$SF,convert(DeltaX)@SF,convert(DeltaY)@SF]
+
+    viewpoint (viewport:%,Theta:I,Phi:I,Scale:F,DeltaX:F,DeltaY:F):Void ==
+      viewport.viewpoint := [convert(Theta)@SF * degreesSF,convert(Phi)@SF * degreesSF,
+        convert(Scale)@SF,1$SF,1$SF,1$SF,convert(DeltaX)@SF,convert(DeltaY)@SF]
+
+    viewpoint (viewport:%,Theta:F,Phi:F):Void ==
+      viewport.viewpoint.theta := convert(Theta)@SF * degreesSF
+      viewport.viewpoint.phi   := convert(Phi)@SF * degreesSF
+
+    viewpoint (viewport:%,X:F,Y:F,Z:F):Void ==
+      Theta : F
+      Phi : F
+      if (X=0$F) and (Y=0$F) then
+        Theta := 0$F
+        if (Z>=0$F) then
+          Phi := 0$F
+        else 
+          Phi := 180.0
+      else
+        Theta := asin(Y/(R := sqrt(X*X+Y*Y)))
+        if (Z=0$F) then
+          Phi := 90.0
+        else
+          Phi := atan(Z/R)
+      rotate(viewport, Theta * degrees, Phi * degrees)
+    
+    title (viewport,Title) == 
+      viewport.title := Title
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW3D)$Lisp
+        sendI(VIEW,TITLE)$Lisp
+        checkViewport viewport =>
+          sendSTR(VIEW,Title)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+
+    colorDef (viewport,HueOffset,HueNumber) ==
+      viewport.colors := [h := (hue HueOffset),(hue HueNumber) - h]
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW3D)$Lisp
+        sendI(VIEW,COLORDEF)$Lisp
+        checkViewport viewport =>
+          sendI(VIEW,hue HueOffset)$Lisp
+          sendI(VIEW,hue HueNumber)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+
+    dimensions (viewport,ViewX,ViewY,ViewWidth,ViewHeight) ==
+      viewport.moveTo := [ViewX,ViewY]
+      viewport.size   := [ViewWidth,ViewHeight]
+
+    move(viewport,xLoc,yLoc) ==
+      viewport.moveTo := [xLoc,yLoc]
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW3D)$Lisp
+        sendI(VIEW,MOVE)$Lisp
+        checkViewport viewport =>
+          sendI(VIEW,xLoc)$Lisp
+          sendI(VIEW,yLoc)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+
+    resize(viewport,xSize,ySize) ==
+      viewport.size := [xSize,ySize]
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW3D)$Lisp
+        sendI(VIEW,RESIZE)$Lisp
+        checkViewport viewport =>
+          sendI(VIEW,xSize)$Lisp
+          sendI(VIEW,ySize)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+ 
+    coerce viewport ==
+      (key(viewport) = 0$I) =>
+        hconcat
+          ["Closed or Undefined ThreeDimensionalViewport: "::E,
+           (viewport.title)::E]
+      hconcat ["ThreeDimensionalViewport: "::E, (viewport.title)::E]
+
+    key viewport == viewport.key
+
+    rotate(viewport:%,Theta:I,Phi:I) ==
+      rotate(viewport,Theta::F * degrees,Phi::F * degrees) 
+
+    rotate(viewport:%,Theta:F,Phi:F) ==
+      viewport.viewpoint.theta := convert(Theta)@SF
+      viewport.viewpoint.phi   := convert(Phi)@SF
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW3D)$Lisp
+        sendI(VIEW,ROTATE)$Lisp
+        checkViewport viewport =>
+          sendSF(VIEW,viewport.viewpoint.theta)$Lisp
+          sendSF(VIEW,viewport.viewpoint.phi)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+
+    zoom(viewport:%,Scale:F) ==
+      viewport.viewpoint.scale := convert(Scale)@SF
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW3D)$Lisp
+        sendI(VIEW,ZOOM)$Lisp
+        checkViewport viewport =>
+          sendSF(VIEW,viewport.viewpoint.scale)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+
+    zoom(viewport:%,ScaleX:F,ScaleY:F,ScaleZ:F) ==
+      viewport.viewpoint.scaleX := convert(ScaleX)@SF
+      viewport.viewpoint.scaleY := convert(ScaleY)@SF
+      viewport.viewpoint.scaleZ := convert(ScaleZ)@SF
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW3D)$Lisp
+        sendI(VIEW,zoomx)$Lisp
+        checkViewport viewport =>
+          sendSF(VIEW,viewport.viewpoint.scaleX)$Lisp
+          sendSF(VIEW,viewport.viewpoint.scaleY)$Lisp
+          sendSF(VIEW,viewport.viewpoint.scaleZ)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+
+    translate(viewport,DeltaX,DeltaY) ==
+      viewport.viewpoint.deltaX := convert(DeltaX)@SF
+      viewport.viewpoint.deltaY := convert(DeltaY)@SF
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW3D)$Lisp
+        sendI(VIEW,TRANSLATE)$Lisp
+        checkViewport viewport =>
+          sendSF(VIEW,viewport.viewpoint.deltaX)$Lisp
+          sendSF(VIEW,viewport.viewpoint.deltaY)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+
+    intensity(viewport,Amount) ==
+      if (Amount < 0$F) or (Amount > 1$F) then
+        error "The intensity must be a value between 0 and 1, inclusively."
+      viewport.lighting.translucence := convert(Amount)@SF
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW3D)$Lisp
+        sendI(VIEW,translucenceDef)$Lisp
+        checkViewport viewport =>
+          sendSF(VIEW,viewport.lighting.translucence)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+
+    write(viewport:%,Filename:S,aThingToWrite:S) ==
+      write(viewport,Filename,[aThingToWrite])
+    
+    write(viewport,Filename) ==
+      write(viewport,Filename,viewWriteDefault())
+
+    write(viewport:%,Filename:S,thingsToWrite:L S) ==
+      stringToSend : S := ""
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW3D)$Lisp
+        sendI(VIEW,writeView)$Lisp
+        checkViewport viewport =>
+          sendSTR(VIEW,Filename)$Lisp
+          m := minIndex(avail := viewWriteAvailable())
+          for aTypeOfFile in thingsToWrite repeat
+            if (writeTypeInt:= position(upperCase aTypeOfFile,avail)-m) < 0 then
+              sayBrightly(["  > "::E,(concat(aTypeOfFile, _
+                " is not a valid file type for writing a 3D viewport"))::E]$List(E))$Lisp
+            else
+              sendI(VIEW,writeTypeInt+(1$I))$Lisp
+          sendI(VIEW,0$I)$Lisp     -- no more types of things to write
+          getI(VIEW)$Lisp          -- acknowledge
+          Filename
+
+    perspective (viewport,onOff) ==
+      if onOff = "on" then viewport.perspective.perspectiveField := yes
+      else viewport.perspective.perspectiveField := no
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW3D)$Lisp
+        sendI(VIEW,perspectiveOnOff)$Lisp
+        checkViewport viewport =>
+          sendI(VIEW,viewport.perspective.perspectiveField)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+
+    showRegion (viewport,onOff) ==
+      if onOff = "on" then viewport.flags.showRegionField := yes
+      else viewport.flags.showRegionField := no
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW3D)$Lisp
+        sendI(VIEW,region3D)$Lisp
+        checkViewport viewport =>
+          sendI(VIEW,viewport.flags.showRegionField)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+
+    showClipRegion (viewport,onOff) ==
+      if onOff = "on" then viewport.volume.clipRegionField := yes
+      else viewport.volume.clipRegionField := no
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW3D)$Lisp
+        sendI(VIEW,clipRegionOnOff)$Lisp
+        checkViewport viewport =>
+          sendI(VIEW,viewport.volume.clipRegionField)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+
+    clipSurface (viewport,onOff) ==
+      if onOff = "on" then viewport.volume.clipSurfaceField := yes
+      else viewport.volume.clipSurfaceField := no
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW3D)$Lisp
+        sendI(VIEW,clipSurfaceOnOff)$Lisp
+        checkViewport viewport =>
+          sendI(VIEW,viewport.volume.clipSurfaceField)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+
+    eyeDistance(viewport:%,EyeDistance:F) ==
+      viewport.perspective.eyeDistance := convert(EyeDistance)@SF
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW3D)$Lisp
+        sendI(VIEW,eyeDistanceData)$Lisp
+        checkViewport viewport =>
+          sendSF(VIEW,viewport.perspective.eyeDistance)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+
+    hitherPlane(viewport:%,HitherPlane:F) ==
+      viewport.perspective.hitherPlane := convert(HitherPlane)@SF
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW3D)$Lisp
+        sendI(VIEW,hitherPlaneData)$Lisp
+        checkViewport viewport =>
+          sendSF(VIEW,viewport.perspective.hitherPlane)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+
+    modifyPointData(viewport,anIndex,aPoint) ==
+      (n := dimension aPoint) < 3 => error "The point should have dimension of at least 3"
+      viewport.space3D := modifyPointData(viewport.space3D,anIndex,aPoint)
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW3D)$Lisp
+        sendI(VIEW,modifyPOINT)$Lisp
+        checkViewport viewport =>
+          sendI(VIEW,anIndex)$Lisp
+          sendSF(VIEW,xCoord aPoint)$Lisp
+          sendSF(VIEW,yCoord aPoint)$Lisp
+          sendSF(VIEW,zCoord aPoint)$Lisp
+          if (n = 3) then sendSF(VIEW,convert(0.5)@SF)$Lisp
+          else sendSF(VIEW,color aPoint)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+
+--    print viewport ==
+--      (key(viewport) ^= 0$I) =>
+--        sendI(VIEW,typeVIEW3D)$Lisp
+--        sendI(VIEW,printViewport)$Lisp
+--        checkViewport viewport =>
+--          getI(VIEW)$Lisp          -- acknowledge
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \section{domain SPACE3 ThreeSpace}
 \pagehead{ThreeSpace}{SPACE3}
 \pagepic{ps/v103threespace.ps}{SPACE3}{1.00}
@@ -75087,6 +79242,895 @@ TwoDimensionalArray(R):Exports == Implementation where
 
 @
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain VIEW2D TwoDimensionalViewport}
+<<TwoDimensionalViewport.help>>=
+====================================================================
+TwoDimensionalViewport examples
+====================================================================
+
+We want to graph x^3 * (a+b*x) on the interval x=-1..1
+so we clear out the workspace
+
+We assign values to the constants
+  a:=0.5
+    0.5
+                              Type: Float
+  b:=0.5
+    0.5
+                              Type: Float
+
+We draw the first case of the graph
+
+  y1:=draw(x^3*(a+b*x),x=-1..1,title=="2.2.10 explicit")
+    TwoDimensionalViewport: "2.2.10 explicit"
+                              Type: TwoDimensionalViewport
+
+We fetch the graph of the first object
+
+  g1:=getGraph(y1,1)
+    Graph with 1 point list
+                              Type: GraphImage
+
+We extract its points
+
+  pointLists g1
+   [
+     [[-1.,0.,1.,3.], [-0.95833333333333337,-1.8336166570216028E-2,1.,3.],
+      [-0.91666666666666674,-3.2093942901234518E-2,1.,3.],
+      [-0.87500000000000011,-4.18701171875E-2,1.,3.],
+      [-0.83333333333333348,-4.8225308641975301E-2,1.,3.],
+      [-0.79166666666666685,-5.1683967496141986E-2,1.,3.],
+      [-0.75000000000000022,-5.2734375E-2,1.,3.],
+      [-0.70833333333333359,-5.1828643422067916E-2,1.,3.],
+      [-0.66666666666666696,-4.9382716049382741E-2,1.,3.],
+      [-0.62500000000000033,-4.5776367187500042E-2,1.,3.],
+      [-0.5833333333333337,-4.1353202160493867E-2,1.,3.],
+      [-0.54166666666666707,-3.6420657310956832E-2,1.,3.],
+      [-0.50000000000000044,-3.1250000000000056E-2,1.,3.],
+      [-0.45833333333333376,-2.6076328607253136E-2,1.,3.],
+      [-0.41666666666666707,-2.1098572530864244E-2,1.,3.],
+      [-0.37500000000000039,-1.6479492187500042E-2,1.,3.],
+      [-0.3333333333333337,-1.2345679012345713E-2,1.,3.],
+      [-0.29166666666666702,-8.7875554591049648E-3,1.,3.],
+      [-0.25000000000000033,-5.8593750000000208E-3,1.,3.],
+      [-0.20833333333333368,-3.5792221257716214E-3,1.,3.],
+      [-0.16666666666666702,-1.9290123456790237E-3,1.,3.],
+      [-0.12500000000000036,-8.5449218750000705E-4,1.,3.],
+      [-8.3333333333333703E-2,-2.6523919753086765E-4,1.,3.],
+      [-4.1666666666667039E-2,-3.4661940586420673E-5,1.,3.],
+      [-3.7470027081099033E-16,-2.6304013894372334E-47,1.,3.],
+      [4.166666666666629E-2,3.7676022376542178E-5,1.,3.],
+      [8.3333333333332954E-2,3.1346450617283515E-4,1.,3.],
+      [0.12499999999999961,1.0986328124999894E-3,1.,3.],
+      [0.16666666666666627,2.7006172839505972E-3,1.,3.],
+      [0.20833333333333293,5.463023244598731E-3,1.,3.],
+      [0.24999999999999958,9.765624999999948E-3,1.,3.],
+      [0.29166666666666624,1.6024365837191284E-2,1.,3.],
+      [0.33333333333333293,2.469135802469126E-2,1.,3.],
+      [0.37499999999999961,3.6254882812499882E-2,1.,3.],
+      [0.4166666666666663,5.1239390432098617E-2,1.,3.],
+      [0.45833333333333298,7.0205500096450435E-2,1.,3.],
+      [0.49999999999999967,9.3749999999999792E-2,1.,3.],
+      [0.5416666666666663,0.12250584731867258,1.,3.],
+      [0.58333333333333293,0.15714216820987617,1.,3.],
+      [0.62499999999999956,0.1983642578124995,1.,3.],
+      [0.66666666666666619,0.24691358024691298,1.,3.],
+      [0.70833333333333282,0.30356776861496837,1.,3.],
+      [0.74999999999999944,0.369140624999999,1.,3.],
+      [0.79166666666666607,0.44448212046681984,1.,3.],
+      [0.8333333333333327,0.530478395061727,1.,3.],
+      [0.87499999999999933,0.62805175781249845,1.,3.],
+      [0.91666666666666596,0.73816068672839308,1.,3.],
+      [0.95833333333333259,0.86179982880015205,1.,3.], [1.,1.,1.,3.]]
+     ]
+                        Type: List List Point DoubleFloat
+
+Now we create a second graph with a changed parameter
+
+  b:=1.0
+    1.0
+                        Type: Float
+
+We draw it
+
+  y2:=draw(x^3*(a+b*x),x=-1..1)
+    TwoDimensionalViewport: "AXIOM2D"
+                        Type: TwoDimensionalViewport
+
+We fetch this new graph
+
+  g2:=getGraph(y2,1)
+    Graph with 1 point list
+                       Type: GraphImage
+
+We get the points from this graph
+
+  pointLists g2
+   [
+     [[-1.,0.5,1.,3.], [-0.95833333333333337,0.40339566454475323,1.,3.],
+      [-0.91666666666666674,0.32093942901234584,1.,3.],
+      [-0.87500000000000011,0.25122070312500017,1.,3.],
+      [-0.83333333333333348,0.19290123456790137,1.,3.],
+      [-0.79166666666666685,0.14471510898919768,1.,3.],
+      [-0.75000000000000022,0.10546875000000019,1.,3.],
+      [-0.70833333333333359,7.404091917438288E-2,1.,3.],
+      [-0.66666666666666696,4.938271604938288E-2,1.,3.],
+      [-0.62500000000000033,3.0517578125000125E-2,1.,3.],
+      [-0.5833333333333337,1.6541280864197649E-2,1.,3.],
+      [-0.54166666666666707,6.6219376929013279E-3,1.,3.],
+      [-0.50000000000000044,5.5511151231257827E-17,1.,3.],
+      [-0.45833333333333376,-4.011742862654287E-3,1.,3.],
+      [-0.41666666666666707,-6.0281635802469057E-3,1.,3.],
+      [-0.37500000000000039,-6.5917968750000035E-3,1.,3.],
+      [-0.3333333333333337,-6.1728395061728461E-3,1.,3.],
+      [-0.29166666666666702,-5.1691502700617377E-3,1.,3.],
+      [-0.25000000000000033,-3.9062500000000104E-3,1.,3.],
+      [-0.20833333333333368,-2.6373215663580349E-3,1.,3.],
+      [-0.16666666666666702,-1.543209876543218E-3,1.,3.],
+      [-0.12500000000000036,-7.3242187500000564E-4,1.,3.],
+      [-8.3333333333333703E-2,-2.4112654320987957E-4,1.,3.],
+      [-4.1666666666667039E-2,-3.315489969135889E-5,1.,3.],
+      [-3.7470027081099033E-16,-2.6304013894372324E-47,1.,3.],
+      [4.166666666666629E-2,3.9183063271603852E-5,1.,3.],
+      [8.3333333333332954E-2,3.3757716049382237E-4,1.,3.],
+      [0.12499999999999961,1.2207031249999879E-3,1.,3.],
+      [0.16666666666666627,3.0864197530863957E-3,1.,3.],
+      [0.20833333333333293,6.4049238040123045E-3,1.,3.],
+      [0.24999999999999958,1.1718749999999934E-2,1.,3.],
+      [0.29166666666666624,1.9642771026234473E-2,1.,3.],
+      [0.33333333333333293,3.0864197530864071E-2,1.,3.],
+      [0.37499999999999961,4.6142578124999847E-2,1.,3.],
+      [0.4166666666666663,6.6309799382715848E-2,1.,3.],
+      [0.45833333333333298,9.2270085841049135E-2,1.,3.],
+      [0.49999999999999967,0.12499999999999971,1.,3.],
+      [0.5416666666666663,0.16554844232253049,1.,3.],
+      [0.58333333333333293,0.21503665123456736,1.,3.],
+      [0.62499999999999956,0.27465820312499928,1.,3.],
+      [0.66666666666666619,0.3456790123456781,1.,3.],
+      [0.70833333333333282,0.42943733121141858,1.,3.],
+      [0.74999999999999944,0.52734374999999845,1.,3.],
+      [0.79166666666666607,0.64088119695215873,1.,3.],
+      [0.8333333333333327,0.77160493827160281,1.,3.],
+      [0.87499999999999933,0.92114257812499756,1.,3.],
+      [0.91666666666666596,1.0911940586419722,1.,3.],
+      [0.95833333333333259,1.2835316599151199,1.,3.], [1.,1.5,1.,3.]]
+     ]
+                           Type: List List Point DoubleFloat
+
+and we put these points, g2 onto the first graph y1 as graph 2
+
+  putGraph(y1,g2,2)
+                           Type: Void
+
+And now we do the whole sequence again
+
+  b:=2.0
+    2.0
+                           Type: Float
+
+  y3:=draw(x^3*(a+b*x),x=-1..1)
+    TwoDimensionalViewport: "AXIOM2D"
+                          Type: TwoDimensionalViewport
+
+  g3:=getGraph(y3,1)
+    Graph with 1 point list
+                          Type: GraphImage
+
+  pointLists g3
+   [
+     [[-1.,1.5,1.,3.], [-0.95833333333333337,1.2468593267746917,1.,3.],
+      [-0.91666666666666674,1.0270061728395066,1.,3.],
+      [-0.87500000000000011,0.83740234375000044,1.,3.],
+      [-0.83333333333333348,0.67515432098765471,1.,3.],
+      [-0.79166666666666685,0.53751326195987703,1.,3.],
+      [-0.75000000000000022,0.42187500000000056,1.,3.],
+      [-0.70833333333333359,0.32578004436728447,1.,3.],
+      [-0.66666666666666696,0.24691358024691412,1.,3.],
+      [-0.62500000000000033,0.18310546875000044,1.,3.],
+      [-0.5833333333333337,0.1323302469135807,1.,3.],
+      [-0.54166666666666707,9.2707127700617648E-2,1.,3.],
+      [-0.50000000000000044,6.2500000000000278E-2,1.,3.],
+      [-0.45833333333333376,4.0117428626543411E-2,1.,3.],
+      [-0.41666666666666707,2.4112654320987775E-2,1.,3.],
+      [-0.37500000000000039,1.3183593750000073E-2,1.,3.],
+      [-0.3333333333333337,6.1728395061728877E-3,1.,3.],
+      [-0.29166666666666702,2.0676601080247183E-3,1.,3.],
+      [-0.25000000000000033,1.0408340855860843E-17,1.,3.],
+      [-0.20833333333333368,-7.5352044753086191E-4,1.,3.],
+      [-0.16666666666666702,-7.7160493827160663E-4,1.,3.],
+      [-0.12500000000000036,-4.8828125000000282E-4,1.,3.],
+      [-8.3333333333333703E-2,-1.9290123456790339E-4,1.,3.],
+      [-4.1666666666667039E-2,-3.0140817901235325E-5,1.,3.],
+      [-3.7470027081099033E-16,-2.6304013894372305E-47,1.,3.],
+      [4.166666666666629E-2,4.21971450617272E-5,1.,3.],
+      [8.3333333333332954E-2,3.8580246913579681E-4,1.,3.],
+      [0.12499999999999961,1.4648437499999848E-3,1.,3.],
+      [0.16666666666666627,3.8580246913579933E-3,1.,3.],
+      [0.20833333333333293,8.2887249228394497E-3,1.,3.],
+      [0.24999999999999958,1.562499999999991E-2,1.,3.],
+      [0.29166666666666624,2.6879581404320851E-2,1.,3.],
+      [0.33333333333333293,4.3209876543209694E-2,1.,3.],
+      [0.37499999999999961,6.5917968749999764E-2,1.,3.],
+      [0.4166666666666663,9.6450617283950296E-2,1.,3.],
+      [0.45833333333333298,0.13639925733024652,1.,3.],
+      [0.49999999999999967,0.18749999999999956,1.,3.],
+      [0.5416666666666663,0.25163363233024633,1.,3.],
+      [0.58333333333333293,0.33082561728394977,1.,3.],
+      [0.62499999999999956,0.42724609374999883,1.,3.],
+      [0.66666666666666619,0.5432098765432084,1.,3.],
+      [0.70833333333333282,0.68117645640431912,1.,3.],
+      [0.74999999999999944,0.84374999999999756,1.,3.],
+      [0.79166666666666607,1.0336793499228365,1.,3.],
+      [0.8333333333333327,1.2538580246913544,1.,3.],
+      [0.87499999999999933,1.507324218749996,1.,3.],
+      [0.91666666666666596,1.7972608024691306,1.,3.],
+      [0.95833333333333259,2.1269953221450555,1.,3.], [1.,2.5,1.,3.]]
+     ]
+                        Type: List List Point DoubleFloat
+
+and put the third graphs points g3 onto the first graph y1 as graph 3
+
+  putGraph(y1,g3,3)
+                        Type: Void
+
+Finally we show the combined result
+
+  vp:=makeViewport2D(y1)
+    TwoDimensionalViewport: "2.2.10 explicit"
+                        Type: TwoDimensionalViewport
+
+See Also:
+o )show TwoDimensionalViewport
+o $AXIOM/doc/src/algebra/view2d.spad.dvi
+
+@
+\pagehead{TwoDimensionalViewport}{VIEW2D}
+\pagepic{ps/v103twodimensionalviewport.ps}{VIEW2D}{1.00}
+<<domain VIEW2D TwoDimensionalViewport>>=
+)abbrev domain VIEW2D TwoDimensionalViewport
+++ Author: Jim Wen
+++ Date Created: 28 April 1989
+++ Date Last Updated: 29 October 1991, Jon Steinbach
+++ Basic Operations:
+++ Related Constructors:
+++ Also See:
+++ AMS Classifications:
+++ Keywords: 
+++ References:
+++ Description: TwoDimensionalViewport creates viewports to display graphs.
+TwoDimensionalViewport ():Exports == Implementation where
+
+  VIEW    ==> VIEWPORTSERVER$Lisp
+  sendI   ==> SOCK_-SEND_-INT
+  sendSF  ==> SOCK_-SEND_-FLOAT
+  sendSTR ==> SOCK_-SEND_-STRING
+  getI    ==> SOCK_-GET_-INT
+  getSF   ==> SOCK_-GET_-FLOAT
+
+  typeGRAPH  ==> 2
+  typeVIEW2D ==> 3
+
+  makeGRAPH  ==> (-1)$SingleInteger
+  makeVIEW2D ==> (-1)$SingleInteger
+ 
+  I    ==> Integer
+  PI   ==> PositiveInteger
+  NNI  ==> NonNegativeInteger
+  XY   ==> Record( X:I, Y:I )
+  XYP  ==> Record( X:PI, Y:PI )
+  XYNN ==> Record( X:NNI, Y:NNI )
+  F    ==> Float
+  SF   ==> DoubleFloat
+  STR  ==> String
+  L    ==> List
+  V    ==> Vector
+  E    ==> OutputForm
+  FLAG ==> Record( showCP:I )
+  PAL  ==> Palette()
+  B    ==> Boolean
+  G    ==> GraphImage
+  GS   ==> Record( scaleX:SF, scaleY:SF, deltaX:SF, deltaY:SF, _
+                  points:I, connect:I, spline:I, _
+                  axes:I, axesColor:PAL, units:I, unitsColor:PAL, _
+                  showing:I)
+  GU   ==> Union(G,"undefined")
+  DROP ==> DrawOption
+  POINT ==> Point(SF)
+
+  TRANSLATE2D     ==> 0$I
+  SCALE2D         ==> 1$I
+  pointsOnOff     ==> 2
+  connectOnOff    ==> 3
+  spline2D        ==> 4   -- used for controlling regions, now
+  reset2D         ==> 5
+  hideControl2D   ==> 6
+  closeAll2D      ==> 7
+  axesOnOff2D     ==> 8
+  unitsOnOff2D    ==> 9
+
+  SPADBUTTONPRESS ==> 100
+  MOVE            ==> 102
+  RESIZE          ==> 103
+  TITLE           ==> 104
+  showing2D       ==> 105  -- as defined in include/actions.h
+  putGraph2D      ==> 106
+  writeView       ==> 110
+  axesColor2D     ==> 112
+  unitsColor2D    ==> 113
+  getPickedPTS    ==> 119
+
+  graphStart      ==> 13   -- as defined in include/actions.h
+
+  noControl ==> 0$I
+
+  yes       ==> 1$I
+  no        ==> 0$I
+
+  maxGRAPHS ==> 9::I   -- should be the same as maxGraphs in include/view2d.h
+
+  fileTypeDefs ==> ["PIXMAP"]    -- see include/write.h for things to include
+
+  Exports ==> SetCategory with
+    getPickedPoints : $ -> L POINT
+      ++ getPickedPoints(x) 
+      ++ returns a list of small floats for the points the
+      ++ user interactively picked on the viewport
+      ++ for full integration into the system, some design
+      ++ issues need to be addressed: e.g. how to go through
+      ++ the GraphImage interface, how to default to graphs, etc.
+    viewport2D     : ()                                     -> $
+      ++ viewport2D() returns an undefined two-dimensional viewport
+      ++ of the domain \spadtype{TwoDimensionalViewport} whose
+      ++ contents are empty.
+    makeViewport2D : $                                      -> $
+      ++ makeViewport2D(v) takes the given two-dimensional viewport,
+      ++ v, of the domain \spadtype{TwoDimensionalViewport} and
+      ++ displays a viewport window on the screen which contains
+      ++ the contents of v.
+    options        : $                                      -> L DROP
+      ++ options(v) takes the given two-dimensional viewport, v, of the
+      ++ domain \spadtype{TwoDimensionalViewport} and returns a list
+      ++ containing the draw options from the domain \spadtype{DrawOption}
+      ++ for v.
+    options        : ($,L DROP)                             -> $
+      ++ options(v,lopt) takes the given two-dimensional viewport, v,
+      ++ of the domain \spadtype{TwoDimensionalViewport} and returns
+      ++ v with it's draw options modified to be those which are indicated
+      ++ in the given list, \spad{lopt} of domain \spadtype{DrawOption}.
+    makeViewport2D : (G,L DROP)                             -> $
+      ++ makeViewport2D(gi,lopt) creates and displays a viewport window
+      ++ of the domain \spadtype{TwoDimensionalViewport} whose graph
+      ++ field is assigned to be the given graph, \spad{gi}, of domain
+      ++ \spadtype{GraphImage}, and whose options field is set to be
+      ++ the list of options, \spad{lopt} of domain \spadtype{DrawOption}.
+    graphState     : ($,PI,SF,SF,SF,SF,I,I,I,I,PAL,I,PAL,I) -> Void
+      ++ graphState(v,num,sX,sY,dX,dY,pts,lns,box,axes,axesC,un,unC,cP)
+      ++ sets the state of the characteristics for the graph indicated
+      ++ by \spad{num} in the given two-dimensional viewport v, of domain
+      ++ \spadtype{TwoDimensionalViewport}, to the values given as
+      ++ parameters.  The scaling of the graph in the x and y component
+      ++ directions is set to be \spad{sX} and \spad{sY}; the window
+      ++ translation in the x and y component directions is set to be
+      ++ \spad{dX} and \spad{dY}; The graph points, lines, bounding box,
+      ++ axes, or units will be shown in the viewport if their given
+      ++ parameters \spad{pts}, \spad{lns}, \spad{box}, \spad{axes} or
+      ++ \spad{un} are set to be \spad{1}, but will not be shown if they
+      ++ are set to \spad{0}.  The color of the axes and the color of the
+      ++ units are indicated by the palette colors \spad{axesC} and
+      ++ \spad{unC} respectively.  To display the control panel when
+      ++ the viewport window is displayed, set \spad{cP} to \spad{1},
+      ++ otherwise set it to \spad{0}.
+    graphStates    : $                                      -> V GS
+      ++ graphStates(v) returns and shows a listing of a record containing
+      ++ the current state of the characteristics of each of the ten graph
+      ++ records in the given two-dimensional viewport, v, which is of
+      ++ domain \spadtype{TwoDimensionalViewport}.
+    graphs         : $                                      -> V GU
+      ++ graphs(v) returns a vector, or list, which is a union of all
+      ++ the graphs, of the domain \spadtype{GraphImage}, which are
+      ++ allocated for the two-dimensional viewport, v, of domain
+      ++ \spadtype{TwoDimensionalViewport}.  Those graphs which have
+      ++ no data are labeled "undefined", otherwise their contents
+      ++ are shown.
+    title          : ($,STR)                                -> Void
+      ++ title(v,s) changes the title which is shown in the two-dimensional 
+      ++ viewport window, v of domain \spadtype{TwoDimensionalViewport}.
+    putGraph       : ($,G,PI)                               -> Void
+      ++ putGraph(v,gi,n) sets the graph field indicated by n, of the
+      ++ indicated two-dimensional viewport, v, which is of domain
+      ++ \spadtype{TwoDimensionalViewport}, to be the graph, \spad{gi}
+      ++ of domain \spadtype{GraphImage}.  The contents of viewport, v,
+      ++ will contain \spad{gi} when the function \spadfun{makeViewport2D}
+      ++ is called to create the an updated viewport v.
+    getGraph       : ($,PI)                                 -> G
+      ++ getGraph(v,n) returns the graph which is of the domain
+      ++ \spadtype{GraphImage} which is located in graph field n
+      ++ of the given two-dimensional viewport, v, which is of the
+      ++ domain \spadtype{TwoDimensionalViewport}.
+    axes           : ($,PI,STR)                             -> Void
+      ++ axes(v,n,s) displays the axes of the graph in field n of
+      ++ the given two-dimensional viewport, v, which is of domain
+      ++ \spadtype{TwoDimensionalViewport}, if s is "on", or does
+      ++ not display the axes if s is "off".
+    axes           : ($,PI,PAL)                             -> Void
+      ++ axes(v,n,c) displays the axes of the graph in field n of
+      ++ the given two-dimensional viewport, v, which is of domain
+      ++ \spadtype{TwoDimensionalViewport}, with the axes color set to
+      ++ the given palette color c.
+    units          : ($,PI,STR)                             -> Void
+      ++ units(v,n,s) displays the units of the graph in field n of
+      ++ the given two-dimensional viewport, v, which is of domain
+      ++ \spadtype{TwoDimensionalViewport}, if s is "on", or does
+      ++ not display the units if s is "off".
+    units          : ($,PI,PAL)                             -> Void
+      ++ units(v,n,c) displays the units of the graph in field n of
+      ++ the given two-dimensional viewport, v, which is of domain
+      ++ \spadtype{TwoDimensionalViewport}, with the units color set to
+      ++ the given palette color c.
+    points         : ($,PI,STR)                             -> Void
+      ++ points(v,n,s) displays the points of the graph in field n of
+      ++ the given two-dimensional viewport, v, which is of domain
+      ++ \spadtype{TwoDimensionalViewport}, if s is "on", or does
+      ++ not display the points if s is "off".
+    region         : ($,PI,STR)                             -> Void
+      ++ region(v,n,s) displays the bounding box of the graph in
+      ++ field n of the given two-dimensional viewport, v, which is
+      ++ of domain \spadtype{TwoDimensionalViewport}, if s is "on",
+      ++ or does not display the bounding box if s is "off".
+    connect        : ($,PI,STR)                             -> Void
+      ++ connect(v,n,s) displays the lines connecting the graph
+      ++ points in field n of the given two-dimensional viewport, v,
+      ++ which is of domain \spadtype{TwoDimensionalViewport}, if s
+      ++ is "on", or does not display the lines if s is "off".
+    controlPanel   : ($,STR)                                -> Void
+      ++ controlPanel(v,s) displays the control panel of the given
+      ++ two-dimensional viewport, v, which is of domain
+      ++ \spadtype{TwoDimensionalViewport}, if s is "on", or hides
+      ++ the control panel if s is "off".
+    close          : $                                      -> Void
+      ++ close(v) closes the viewport window of the given
+      ++ two-dimensional viewport, v, which is of domain
+      ++ \spadtype{TwoDimensionalViewport}, and terminates the
+      ++ corresponding process ID.
+    dimensions     : ($,NNI,NNI,PI,PI)                      -> Void
+      ++ dimensions(v,x,y,width,height) sets the position of the
+      ++ upper left-hand corner of the two-dimensional viewport, v,
+      ++ which is of domain \spadtype{TwoDimensionalViewport}, to
+      ++ the window coordinate x, y, and sets the dimensions of the
+      ++ window to that of \spad{width}, \spad{height}.  The new
+      ++ dimensions are not displayed until the function
+      ++ \spadfun{makeViewport2D} is executed again for v.
+    scale          : ($,PI,F,F)                             -> Void
+      ++ scale(v,n,sx,sy) displays the graph in field n of the given
+      ++ two-dimensional viewport, v, which is of domain
+      ++ \spadtype{TwoDimensionalViewport}, scaled by the factor \spad{sx}
+      ++ in the x-coordinate direction and by the factor \spad{sy} in
+      ++ the y-coordinate direction.
+    translate      : ($,PI,F,F)                             -> Void
+      ++ translate(v,n,dx,dy) displays the graph in field n of the given
+      ++ two-dimensional viewport, v, which is of domain
+      ++ \spadtype{TwoDimensionalViewport}, translated by \spad{dx} in
+      ++ the x-coordinate direction from the center of the viewport, and
+      ++ by \spad{dy} in the y-coordinate direction from the center.
+      ++ Setting \spad{dx} and \spad{dy} to \spad{0} places the center
+      ++ of the graph at the center of the viewport.
+    show           : ($,PI,STR)                             -> Void
+      ++ show(v,n,s) displays the graph in field n of the given
+      ++ two-dimensional viewport, v, which is of domain
+      ++ \spadtype{TwoDimensionalViewport}, if s is "on", or does not
+      ++ display the graph if s is "off".
+    move           : ($,NNI,NNI)                            -> Void  
+      ++ move(v,x,y) displays the two-dimensional viewport, v, which
+      ++ is of domain \spadtype{TwoDimensionalViewport}, with the upper
+      ++ left-hand corner of the viewport window at the screen 
+      ++ coordinate position x, y.
+    update         :($,G,PI)                               -> Void
+      ++ update(v,gr,n) drops the graph \spad{gr} in slot \spad{n} 
+      ++ of viewport \spad{v}. The graph gr must have been 
+      ++ transmitted already and acquired an integer key.
+    resize         : ($,PI,PI)                              -> Void  
+      ++ resize(v,w,h) displays the two-dimensional viewport, v, which
+      ++ is of domain \spadtype{TwoDimensionalViewport}, with a width
+      ++ of w and a height of h, keeping the upper left-hand corner
+      ++ position unchanged.
+    write          : ($,STR)                                -> STR
+      ++ write(v,s) takes the given two-dimensional viewport, v, which
+      ++ is of domain \spadtype{TwoDimensionalViewport}, and creates
+      ++ a directory indicated by s, which contains the graph data
+      ++ files for v.
+    write          : ($,STR,STR)                            -> STR
+      ++ write(v,s,f) takes the given two-dimensional viewport, v, which
+      ++ is of domain \spadtype{TwoDimensionalViewport}, and creates
+      ++ a directory indicated by s, which contains the graph data
+      ++ files for v and an optional file type f.
+    write          : ($,STR,L STR)                          -> STR
+      ++ write(v,s,lf) takes the given two-dimensional viewport, v, which
+      ++ is of domain \spadtype{TwoDimensionalViewport}, and creates
+      ++ a directory indicated by s, which contains the graph data
+      ++ files for v and the optional file types indicated by the list lf.
+    reset          :  $                                     -> Void
+      ++ reset(v) sets the current state of the graph characteristics
+      ++ of the given two-dimensional viewport, v, which is of domain
+      ++ \spadtype{TwoDimensionalViewport}, back to their initial settings.
+    key            :  $                                     -> I
+      ++ key(v) returns the process ID number of the given two-dimensional
+      ++ viewport, v, which is of domain \spadtype{TwoDimensionalViewport}.
+    coerce         :  $                                     -> E
+      ++ coerce(v) returns the given two-dimensional viewport, v, which
+      ++ is of domain \spadtype{TwoDimensionalViewport} as output of
+      ++ the domain \spadtype{OutputForm}.
+
+  Implementation ==> add
+
+    import GraphImage()
+    import Color()
+    import Palette()
+    import ViewDefaultsPackage()
+    import DrawOptionFunctions0
+    import POINT
+
+    Rep := Record (key:I, graphsField:V GU, graphStatesField:V GS, _
+                   title:STR, moveTo:XYNN, size:XYP, flags:FLAG, optionsField:L DROP)
+
+    defaultGS : GS := [convert(0.9)@SF, convert(0.9)@SF, 0$SF, 0$SF, _
+                      yes, yes, no, _
+                      yes, axesColorDefault(), no, unitsColorDefault(), _
+                      yes]
+
+
+     --% Local Functions
+    checkViewport (viewport:$):B ==
+        -- checks to see if this viewport still exists
+        -- by sending the key to the viewport manager and
+        -- waiting for its reply after it checks it against
+        -- the viewports in its list. a -1 means it doesn't
+        -- exist.
+      sendI(VIEW,viewport.key)$Lisp
+      i := getI(VIEW)$Lisp
+      (i < 0$I) => 
+        viewport.key := 0$I
+        error "This viewport has already been closed!"
+      true
+
+    doOptions(v:Rep):Void ==    
+      v.title := title(v.optionsField,"AXIOM2D")
+      -- etc - 2D specific stuff...
+
+     --% Exported Functions
+
+    options viewport ==
+      viewport.optionsField
+
+    options(viewport,opts) ==
+      viewport.optionsField := opts
+      viewport
+
+    putGraph (viewport,aGraph,which) ==
+      if ((which > maxGRAPHS) or (which < 1)) then
+        error "Trying to put a graph with a negative index or too big an index"
+      viewport.graphsField.which := aGraph
+
+    getGraph (viewport,which) ==
+      if ((which > maxGRAPHS) or (which < 1)) then
+        error "Trying to get a graph with a negative index or too big an index"
+      viewport.graphsField.which case "undefined" =>
+        error "Graph is undefined!"
+      viewport.graphsField.which::GraphImage
+
+
+    graphStates viewport  == viewport.graphStatesField
+    graphs viewport       == viewport.graphsField
+    key viewport          == viewport.key
+
+    dimensions(viewport,ViewX,ViewY,ViewWidth,ViewHeight) ==
+      viewport.moveTo := [ViewX,ViewY]
+      viewport.size   := [ViewWidth,ViewHeight]
+
+    move(viewport,xLoc,yLoc) ==
+      viewport.moveTo := [xLoc,yLoc]
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW2D)$Lisp
+        sendI(VIEW,MOVE)$Lisp
+        checkViewport viewport =>
+          sendI(VIEW,xLoc)$Lisp
+          sendI(VIEW,yLoc)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+
+    update(viewport,graph,slot) ==
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW2D)$Lisp
+        sendI(VIEW,putGraph2D)$Lisp
+        checkViewport viewport =>
+          sendI(VIEW,key graph)$Lisp
+          sendI(VIEW,slot)$Lisp
+          getI(VIEW)$Lisp -- acknowledge 
+
+    resize(viewport,xSize,ySize) ==
+      viewport.size := [xSize,ySize]
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW2D)$Lisp
+        sendI(VIEW,RESIZE)$Lisp
+        checkViewport viewport =>
+          sendI(VIEW,xSize)$Lisp
+          sendI(VIEW,ySize)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+
+    translate(viewport,graphIndex,xTranslateF,yTranslateF) ==
+      xTranslate := convert(xTranslateF)@SF
+      yTranslate := convert(yTranslateF)@SF
+      if (graphIndex > maxGRAPHS) then
+        error "Referring to a graph with too big an index"
+      viewport.graphStatesField.graphIndex.deltaX := xTranslate
+      viewport.graphStatesField.graphIndex.deltaY := yTranslate
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW2D)$Lisp
+        sendI(VIEW,TRANSLATE2D)$Lisp
+        checkViewport viewport =>
+          sendI(VIEW,graphIndex)$Lisp
+          sendSF(VIEW,xTranslate)$Lisp
+          sendSF(VIEW,yTranslate)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+
+    scale(viewport,graphIndex,xScaleF,yScaleF) ==
+      xScale := convert(xScaleF)@SF
+      yScale := convert(yScaleF)@SF
+      if (graphIndex > maxGRAPHS) then
+        error "Referring to a graph with too big an index"
+      viewport.graphStatesField.graphIndex.scaleX := xScale  -- check union (undefined?)
+      viewport.graphStatesField.graphIndex.scaleY := yScale  -- check union (undefined?)
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW2D)$Lisp
+        sendI(VIEW,SCALE2D)$Lisp
+        checkViewport viewport =>
+          sendI(VIEW,graphIndex)$Lisp
+          sendSF(VIEW,xScale)$Lisp
+          sendSF(VIEW,yScale)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+
+    viewport2D ==
+      [0,new(maxGRAPHS,"undefined"), _
+       new(maxGRAPHS,copy defaultGS),"AXIOM2D", _
+        [viewPosDefault().1,viewPosDefault().2],[viewSizeDefault().1,viewSizeDefault().2], _
+         [noControl], [] ]
+      
+    makeViewport2D(g:G,opts:L DROP) ==
+      viewport               := viewport2D()
+      viewport.graphsField.1 := g
+      viewport.optionsField := opts
+      makeViewport2D viewport
+
+    makeViewport2D viewportDollar ==
+      viewport := viewportDollar::Rep
+      doOptions viewport --local function to extract and assign optional arguments for 2D viewports
+      sayBrightly(["   AXIOM2D data being transmitted to the viewport manager..."::E]$List(E))$Lisp
+      sendI(VIEW,typeVIEW2D)$Lisp
+      sendI(VIEW,makeVIEW2D)$Lisp
+      sendSTR(VIEW,viewport.title)$Lisp
+      sendI(VIEW,viewport.moveTo.X)$Lisp
+      sendI(VIEW,viewport.moveTo.Y)$Lisp
+      sendI(VIEW,viewport.size.X)$Lisp
+      sendI(VIEW,viewport.size.Y)$Lisp
+      sendI(VIEW,viewport.flags.showCP)$Lisp
+      for i in 1..maxGRAPHS repeat
+        g := (graphs viewport).i
+        if g case "undefined" then
+          sendI(VIEW,0$I)$Lisp
+        else
+          sendI(VIEW,key(g::G))$Lisp
+          gs := (graphStates viewport).i
+          sendSF(VIEW,gs.scaleX)$Lisp
+          sendSF(VIEW,gs.scaleY)$Lisp
+          sendSF(VIEW,gs.deltaX)$Lisp
+          sendSF(VIEW,gs.deltaY)$Lisp
+          sendI(VIEW,gs.points)$Lisp
+          sendI(VIEW,gs.connect)$Lisp
+          sendI(VIEW,gs.spline)$Lisp
+          sendI(VIEW,gs.axes)$Lisp
+          hueShade := hue hue gs.axesColor + shade gs.axesColor * numberOfHues()
+          sendI(VIEW,hueShade)$Lisp
+          sendI(VIEW,gs.units)$Lisp
+          hueShade := hue hue gs.unitsColor + shade gs.unitsColor * numberOfHues()
+          sendI(VIEW,hueShade)$Lisp
+          sendI(VIEW,gs.showing)$Lisp
+      viewport.key := getI(VIEW)$Lisp
+      viewport
+
+    graphState(viewport,num,sX,sY,dX,dY,Points,Lines,Spline, _
+               Axes,AxesColor,Units,UnitsColor,Showing) ==
+      viewport.graphStatesField.num := [sX,sY,dX,dY,Points,Lines,Spline, _
+                                        Axes,AxesColor,Units,UnitsColor,Showing]
+
+    title(viewport,Title) == 
+      viewport.title := Title
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW2D)$Lisp
+        sendI(VIEW,TITLE)$Lisp
+        checkViewport viewport =>
+          sendSTR(VIEW,Title)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+
+    reset viewport ==
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW2D)$Lisp
+        sendI(VIEW,SPADBUTTONPRESS)$Lisp
+        checkViewport viewport =>
+          sendI(VIEW,reset2D)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+
+    axes (viewport:$,graphIndex:PI,onOff:STR) : Void ==
+      if (graphIndex > maxGRAPHS) then
+        error "Referring to a graph with too big an index"
+      if onOff = "on" then
+        status := yes
+      else
+        status := no
+      viewport.graphStatesField.graphIndex.axes := status  -- check union (undefined?)
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW2D)$Lisp
+        sendI(VIEW,axesOnOff2D)$Lisp 
+        checkViewport viewport =>
+          sendI(VIEW,graphIndex)$Lisp
+          sendI(VIEW,status)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+
+    axes (viewport:$,graphIndex:PI,color:PAL) : Void ==
+      if (graphIndex > maxGRAPHS) then
+        error "Referring to a graph with too big an index"
+      viewport.graphStatesField.graphIndex.axesColor := color
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW2D)$Lisp
+        sendI(VIEW,axesColor2D)$Lisp
+        checkViewport viewport =>
+          sendI(VIEW,graphIndex)$Lisp
+          hueShade := hue hue color + shade color * numberOfHues()
+          sendI(VIEW,hueShade)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+
+    units (viewport:$,graphIndex:PI,onOff:STR) : Void ==
+      if (graphIndex > maxGRAPHS) then
+        error "Referring to a graph with too big an index"
+      if onOff = "on" then
+        status := yes
+      else
+        status := no
+      viewport.graphStatesField.graphIndex.units := status  -- check union (undefined?)
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW2D)$Lisp
+        sendI(VIEW,unitsOnOff2D)$Lisp
+        checkViewport viewport =>
+          sendI(VIEW,graphIndex)$Lisp
+          sendI(VIEW,status)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+
+    units (viewport:$,graphIndex:PI,color:PAL) : Void ==
+      if (graphIndex > maxGRAPHS) then
+        error "Referring to a graph with too big an index"
+      viewport.graphStatesField.graphIndex.unitsColor := color
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW2D)$Lisp
+        sendI(VIEW,unitsColor2D)$Lisp
+        checkViewport viewport =>
+          sendI(VIEW,graphIndex)$Lisp
+          hueShade := hue hue color + shade color * numberOfHues()
+          sendI(VIEW,hueShade)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+
+    connect (viewport:$,graphIndex:PI,onOff:STR) : Void ==
+      if (graphIndex > maxGRAPHS) then
+        error "Referring to a graph with too big an index"
+      if onOff = "on" then
+        status := 1$I
+      else
+        status := 0$I
+      viewport.graphStatesField.graphIndex.connect := status  -- check union (undefined?)
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW2D)$Lisp
+        sendI(VIEW,connectOnOff)$Lisp
+        checkViewport viewport =>
+          sendI(VIEW,graphIndex)$Lisp
+          sendI(VIEW,status)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+
+    points (viewport:$,graphIndex:PI,onOff:STR) : Void ==
+      if (graphIndex > maxGRAPHS) then
+        error "Referring to a graph with too big an index"
+      if onOff = "on" then
+        status := 1$I
+      else
+        status := 0$I
+      viewport.graphStatesField.graphIndex.points := status  -- check union (undefined?)
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW2D)$Lisp
+        sendI(VIEW,pointsOnOff)$Lisp
+        checkViewport viewport =>
+          sendI(VIEW,graphIndex)$Lisp
+          sendI(VIEW,status)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+
+    region (viewport:$,graphIndex:PI,onOff:STR) : Void ==
+      if (graphIndex > maxGRAPHS) then
+        error "Referring to a graph with too big an index"
+      if onOff = "on" then
+        status := 1$I
+      else
+        status := 0$I
+      viewport.graphStatesField.graphIndex.spline := status  -- check union (undefined?)
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW2D)$Lisp
+        sendI(VIEW,spline2D)$Lisp
+        checkViewport viewport =>
+          sendI(VIEW,graphIndex)$Lisp
+          sendI(VIEW,status)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+
+    show (viewport,graphIndex,onOff) ==
+      if (graphIndex > maxGRAPHS) then
+        error "Referring to a graph with too big an index"
+      if onOff = "on" then
+        status := 1$I
+      else
+        status := 0$I
+      viewport.graphStatesField.graphIndex.showing := status  -- check union (undefined?)
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW2D)$Lisp
+        sendI(VIEW,showing2D)$Lisp
+        checkViewport viewport =>
+          sendI(VIEW,graphIndex)$Lisp
+          sendI(VIEW,status)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+
+    controlPanel (viewport,onOff) ==
+      if onOff = "on" then viewport.flags.showCP := yes
+      else viewport.flags.showCP := no
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW2D)$Lisp
+        sendI(VIEW,hideControl2D)$Lisp
+        checkViewport viewport =>
+          sendI(VIEW,viewport.flags.showCP)$Lisp
+          getI(VIEW)$Lisp          -- acknowledge
+
+    close viewport ==
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW2D)$Lisp
+        sendI(VIEW,closeAll2D)$Lisp
+        checkViewport viewport =>
+          getI(VIEW)$Lisp          -- acknowledge
+          viewport.key := 0$I
+
+    coerce viewport ==
+      (key(viewport) = 0$I) =>
+        hconcat ["Closed or Undefined TwoDimensionalViewport: "::E,
+                  (viewport.title)::E]
+      hconcat ["TwoDimensionalViewport: "::E, (viewport.title)::E]
+
+    write(viewport:$,Filename:STR,aThingToWrite:STR) ==
+      write(viewport,Filename,[aThingToWrite])
+    
+    write(viewport,Filename) ==
+      write(viewport,Filename,viewWriteDefault())
+
+    write(viewport:$,Filename:STR,thingsToWrite:L STR) ==
+      stringToSend : STR := ""
+      (key(viewport) ^= 0$I) =>
+        sendI(VIEW,typeVIEW2D)$Lisp
+        sendI(VIEW,writeView)$Lisp
+        checkViewport viewport =>
+          sendSTR(VIEW,Filename)$Lisp
+          m := minIndex(avail := viewWriteAvailable())
+          for aTypeOfFile in thingsToWrite repeat
+            if (writeTypeInt:= position(upperCase aTypeOfFile,avail)-m) < 0 then
+              sayBrightly(["  > "::E,(concat(aTypeOfFile, _
+                " is not a valid file type for writing a 2D viewport"))::E]$List(E))$Lisp
+            else
+              sendI(VIEW,writeTypeInt+(1$I))$Lisp
+                  --              stringToSend := concat [stringToSend,"%",aTypeOfFile]
+                  --              sendSTR(VIEW,stringToSend)$Lisp
+          sendI(VIEW,0$I)$Lisp     -- no more types of things to write
+          getI(VIEW)$Lisp          -- acknowledge
+          Filename
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \chapter{Chapter U}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \section{domain ULS UnivariateLaurentSeries}
@@ -77646,9 +82690,494 @@ UniversalSegment(S: Type): SegmentCategory(S) with
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \chapter{Chapter V}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain VARIABLE Variable}
+\pagehead{Variable}{VARIABLE}
+\pagepic{ps/v103variable.ps}{VARIABLE}{1.00}
+<<domain VARIABLE Variable>>=
+)abbrev domain VARIABLE Variable
+++ Description:
+++ This domain implements variables
+Variable(sym:Symbol): Join(SetCategory, CoercibleTo Symbol) with
+        coerce  : % -> Symbol
+		++ coerce(x) returns the symbol
+        variable: () -> Symbol
+		++ variable() returns the symbol
+    == add
+        coerce(x:%):Symbol     == sym
+        coerce(x:%):OutputForm == sym::OutputForm
+        variable()             == sym
+        x = y                  == true
+        latex(x:%):String      == latex sym
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain VECTOR Vector}
+<<Vector.input>>=
+-- vector.spad.pamphlet Vector.input
+)spool Vector.output
+)set message test on
+)set message auto off
+)clear all
+--S 1 of 11
+u : VECTOR INT := new(5,12)
+--R 
+--R
+--R   (1)  [12,12,12,12,12]
+--R                                                         Type: Vector Integer
+--E 1
+
+--S 2 of 11
+v : VECTOR INT := vector([1,2,3,4,5])
+--R 
+--R
+--R   (2)  [1,2,3,4,5]
+--R                                                         Type: Vector Integer
+--E 2
+
+--S 3 of 11
+#(v)
+--R 
+--R
+--R   (3)  5
+--R                                                        Type: PositiveInteger
+--E 3
+
+--S 4 of 11
+v.2
+--R 
+--R
+--R   (4)  2
+--R                                                        Type: PositiveInteger
+--E 4
+
+--S 5 of 11
+v.3 := 99
+--R 
+--R
+--R   (5)  99
+--R                                                        Type: PositiveInteger
+--E 5
+
+--S 6 of 11
+v
+--R 
+--R
+--R   (6)  [1,2,99,4,5]
+--R                                                         Type: Vector Integer
+--E 6
+
+--S 7 of 11
+5 * v
+--R 
+--R
+--R   (7)  [5,10,495,20,25]
+--R                                                         Type: Vector Integer
+--E 7
+
+--S 8 of 11
+v * 7
+--R 
+--R
+--R   (8)  [7,14,693,28,35]
+--R                                                         Type: Vector Integer
+--E 8
+
+--S 9 of 11
+w : VECTOR INT := vector([2,3,4,5,6])
+--R 
+--R
+--R   (9)  [2,3,4,5,6]
+--R                                                         Type: Vector Integer
+--E 9
+
+--S 10 of 11
+v + w
+--R 
+--R
+--R   (10)  [3,5,103,9,11]
+--R                                                         Type: Vector Integer
+--E 10
+
+--S 11 of 11
+v - w
+--R 
+--R
+--R   (11)  [- 1,- 1,95,- 1,- 1]
+--R                                                         Type: Vector Integer
+--E 11
+)spool
+)lisp (bye)
+@
+<<Vector.help>>=
+====================================================================
+Vector examples
+====================================================================
+
+The Vector domain is used for storing data in a one-dimensional
+indexed data structure.  A vector is a homogeneous data structure in
+that all the components of the vector must belong to the same Axiom
+domain.  Each vector has a fixed length specified by the user; vectors
+are not extensible.  This domain is similar to the OneDimensionalArray
+domain, except that when the components of a Vector belong to a Ring,
+arithmetic operations are provided.
+
+As with the OneDimensionalArray domain, a Vector can be created by
+calling the operation new, its components can be accessed by calling
+the operations elt and qelt, and its components can be reset by
+calling the operations setelt and qsetelt.
+
+This creates a vector of integers of length 5 all of whose components are 12.
+
+  u : VECTOR INT := new(5,12)
+    [12,12,12,12,12]
+                                Type: Vector Integer
+
+This is how you create a vector from a list of its components.
+
+  v : VECTOR INT := vector([1,2,3,4,5])
+    [1,2,3,4,5]
+                                Type: Vector Integer
+
+Indexing for vectors begins at 1.  The last element has index equal to
+the length of the vector, which is computed by #.
+
+ #(v)
+    5
+                                Type: PositiveInteger
+
+This is the standard way to use elt to extract an element.
+Functionally, it is the same as if you had typed elt(v,2).
+
+  v.2
+    2
+                                Type: PositiveInteger
+
+This is the standard way to use setelt to change an element.  It is
+the same as if you had typed setelt(v,3,99).
+
+  v.3 := 99
+    99
+                                Type: PositiveInteger
+
+Now look at v to see the change.  You can use qelt and qsetelt
+(instead of elt and setelt, respectively) but only when you know that
+the index is within the valid range.
+
+  v
+    [1,2,99,4,5]
+                                Type: Vector Integer
+
+When the components belong to a Ring, Axiom provides arithmetic
+operations for Vector.  These include left and right scalar multiplication.
+
+  5 * v
+    [5,10,495,20,25]
+                                Type: Vector Integer
+
+  v * 7
+    [7,14,693,28,35]
+                                Type: Vector Integer
+
+  w : VECTOR INT := vector([2,3,4,5,6])
+    [2,3,4,5,6]
+                                Type: Vector Integer
+
+Addition and subtraction are also available.
+
+  v + w
+    [3,5,103,9,11]
+                                Type: Vector Integer
+
+Of course, when adding or subtracting, the two vectors must have the same
+length or an error message is displayed.
+
+  v - w
+    [- 1,- 1,95,- 1,- 1]
+                                Type: Vector Integer
+
+See Also:
+o )help List
+o )help Matrix
+o )help OneDimensionalArray
+o )help Set
+o )help Table
+o )help TwoDimensionalArray
+o )show Vector
+o $AXIOM/doc/src/algebra/vector.spad.dvi
+
+@
+\pagehead{Vector}{VECTOR}
+\pagepic{ps/v103vector.ps}{VECTOR}{1.00}
+<<domain VECTOR Vector>>=
+)abbrev domain VECTOR Vector
+++ Author:
+++ Date Created:
+++ Date Last Updated:
+++ Basic Functions:
+++ Related Constructors: IndexedVector, DirectProduct
+++ Also See:
+++ AMS Classifications:
+++ Keywords:
+++ References:
+++ Description:
+++ This type represents vector like objects with varying lengths
+++ and indexed by a finite segment of integers starting at 1.
+ 
+Vector(R:Type): Exports == Implementation where
+ VECTORMININDEX ==> 1       -- if you want to change this, be my guest
+
+ Exports ==> VectorCategory R with 
+   vector: List R -> %
+     ++ vector(l) converts the list l to a vector.
+ Implementation ==>
+  IndexedVector(R, VECTORMININDEX) add 
+     vector l == construct l
+     if R has ConvertibleTo InputForm then
+       convert(x:%):InputForm ==
+          convert [convert("vector"::Symbol)@InputForm,
+                          convert(parts x)@InputForm]
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain VOID Void}
+<<Void.input>>=
+-- void.spad.pamphlet Void.input
+)spool Void.output
+)set message test on
+)set message auto off
+)clear all
+--S 1
+r := (a; b; if c then d else e; f) 
+--R 
+--R 
+--RDaly Bug
+--R   An expression following if/when must evaluate to a Boolean and you 
+--R      have written one that does not.
+--E 1
+
+--S 2
+a : Integer
+--R 
+--R                                                                   Type: Void
+--E 2
+
+)set message void on
+
+--S 3
+b : Fraction Integer
+--R 
+--R
+--R   (2)  "()"
+--R                                                                   Type: Void
+--E 3
+
+)set message void off
+ 
+--S 4
+3::Void
+--R 
+--R                                                                   Type: Void
+--E 4
+
+--S 5
+% :: PositiveInteger
+--R 
+--R 
+--RDaly Bug
+--R   Cannot convert from type Void to PositiveInteger for value
+--R   "()"
+--R
+--E 5
+)spool
+)lisp (bye)
+@
+<<Void.help>>=
+====================================================================
+Void examples
+====================================================================
+
+When an expression is not in a value context, it is given type Void.
+For example, in the expression
+
+  r := (a; b; if c then d else e; f) 
+
+values are used only from the subexpressions c and f: all others are thrown 
+away.  The subexpressions a, b, d and e are evaluated for side-effects only 
+and have type Void.  There is a unique value of type Void.
+
+You will most often see results of type Void when you declare a variable.
+
+  a : Integer
+                                Type: Void
+
+Usually no output is displayed for Void results.  You can force the
+display of a rather ugly object by issuing
+
+  )set message void on
+
+  b : Fraction Integer
+                                Type: Void
+
+  )set message void off
+
+All values can be converted to type Void.
+
+  3::Void
+                                Type: Void
+
+Once a value has been converted to Void, it cannot be recovered.
+
+  % :: PositiveInteger
+   Cannot convert from type Void to PositiveInteger for value "()"
+
+See Also:
+o )show Void
+o $AXIOM/doc/src/algebra/void.spad.dvi
+
+@
+\pagehead{Void}{VOID}
+\pagepic{ps/v103void.ps}{VOID}{1.00}
+<<domain VOID Void>>=
+)abbrev domain VOID Void
+-- These types act as the top and bottom of the type lattice
+-- and are known to the compiler and interpreter for type resolution.
+++ Author: Stephen M. Watt
+++ Date Created: 1986
+++ Date Last Updated: May 30, 1991
+++ Basic Operations: 
+++ Related Domains: ErrorFunctions, ResolveLatticeCompletion, Exit
+++ Also See:
+++ AMS Classifications:
+++ Keywords: type, mode, coerce, no value
+++ Examples:
+++ References:
+++ Description:
+++   This type is used when no value is needed, e.g., in the \spad{then}
+++   part of a one armed \spad{if}.
+++   All values can be coerced to type Void.  Once a value has been coerced
+++   to Void, it cannot be recovered.
+
+Void: with
+        void: () -> %
+          ++ void() produces a void object.
+        coerce: % -> OutputForm
+          ++ coerce(v) coerces void object to outputForm.
+    == add
+        Rep := String
+        void()      == voidValue()$Lisp
+        coerce(v:%) == coerce(v)$Rep
+
+@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \chapter{Chapter W}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain WP WeightedPolynomials}
+\pagehead{WeightedPolynomials}{WP}
+\pagepic{ps/v103weightedpolynomials.ps}{WP}{1.00}
+<<domain WP WeightedPolynomials>>=
+)abbrev domain WP WeightedPolynomials
+++ Author: James Davenport
+++ Date Created:  17 April 1992
+++ Date Last Updated: 12 July 1992
+++ Basic Functions: Ring, changeWeightLevel
+++ Related Constructors: PolynomialRing
+++ Also See: OrdinaryWeightedPolynomials
+++ AMS Classifications:
+++ Keywords:
+++ References:
+++ Description:
+++ This domain represents truncated weighted polynomials over a general
+++ (not necessarily commutative) polynomial type. The variables must be
+++ specified, as must the weights.
+++ The representation is sparse
+++ in the sense that only non-zero terms are represented.
+
+WeightedPolynomials(R:Ring,VarSet: OrderedSet, E:OrderedAbelianMonoidSup,
+                           P:PolynomialCategory(R,E,VarSet),
+                             vl:List VarSet, wl:List NonNegativeInteger,
+                              wtlevel:NonNegativeInteger):
+       Ring with
+         if R has CommutativeRing then Algebra(R)
+         coerce: $ -> P
+	         ++ convert back into a "P", ignoring weights
+         if R has Field then "/": ($,$) -> Union($,"failed")
+	         ++ x/y division (only works if minimum weight
+	         ++ of divisor is zero, and if R is a Field)
+         coerce: P -> $
+	         ++ coerce(p) coerces p into Weighted form, applying weights and ignoring terms
+         changeWeightLevel: NonNegativeInteger -> Void
+        	 ++ changeWeightLevel(n) changes the weight level to the new value given:
+	         ++ NB: previously calculated terms are not affected
+    ==
+  add
+   --representations
+   Rep  := PolynomialRing(P,NonNegativeInteger)
+   p:P
+   w,x1,x2:$
+   n:NonNegativeInteger
+   z:Integer
+   changeWeightLevel(n) ==
+        wtlevel:=n
+   lookupList:List Record(var:VarSet, weight:NonNegativeInteger)
+   if #vl ^= #wl then error "incompatible length lists in WeightedPolynomial"
+   lookupList:=[[v,n] for v in vl for n in wl]
+   -- local operation
+   innercoerce:(p,z) -> $
+   lookup:Varset -> NonNegativeInteger
+   lookup v ==
+      l:=lookupList
+      while l ^= [] repeat
+        v = l.first.var => return l.first.weight
+        l:=l.rest
+      0
+   innercoerce(p,z) ==
+      z<0 => 0
+      zero? p => 0
+      mv:= mainVariable p
+      mv case "failed" => monomial(p,0)
+      n:=lookup(mv)
+      up:=univariate(p,mv)
+      ans:$
+      ans:=0
+      while not zero? up  repeat
+        d:=degree up
+        f:=n*d
+        lcup:=leadingCoefficient up
+        up:=up-leadingMonomial up
+        mon:=monomial(1,mv,d)
+        f<=z =>
+            tmp:= innercoerce(lcup,z-f)
+            while not zero? tmp repeat
+              ans:=ans+ monomial(mon*leadingCoefficient(tmp),degree(tmp)+f)
+              tmp:=reductum tmp
+      ans
+   coerce(p):$ == innercoerce(p,wtlevel)
+   coerce(w):P ==  "+"/[c for c in coefficients w]
+   coerce(p:$):OutputForm ==
+     zero? p => (0$Integer)::OutputForm
+     degree p = 0 => leadingCoefficient(p):: OutputForm
+     reduce("+",(reverse [paren(c::OutputForm) for c in coefficients p])
+                 ::List OutputForm)
+   0 == 0$Rep
+   1 == 1$Rep
+   x1 = x2 ==
+      -- Note that we must strip out any terms greater than wtlevel
+      while degree x1 > wtlevel repeat
+            x1 := reductum x1
+      while degree x2 > wtlevel repeat
+            x2 := reductum x2
+      x1 =$Rep x2
+   x1 + x2 == x1 +$Rep x2
+   -x1 == -(x1::Rep)
+   x1 * x2 ==
+     -- Note that this is probably an extremely inefficient definition
+     w:=x1 *$Rep x2
+     while degree(w) > wtlevel repeat
+           w:=reductum w
+     w
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \section{domain WUTSET WuWenTsunTriangularSet}
 <<WuWenTsunTriangularSet.input>>=
 -- triset.spad.pamphlet WuWenTsunTriangularSet.input
@@ -78210,6 +83739,2319 @@ WuWenTsunTriangularSet(R,E,V,P) : Exports == Implementation where
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \chapter{Chapter X}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain XDPOLY XDistributedPolynomial}
+Polynomial arithmetic with non-commutative variables has been improved
+by a contribution of Michel Petitot (University of Lille I, France).
+The domain constructor
+{\bf XDistributedPolynomial} provide a distributed
+representation for these polynomials. It is the non-commutative
+equivalent for the 
+{\bf DistributedMultivariatePolynomial} constructor.
+\pagehead{XDistributedPolynomial}{XDPOLY}
+\pagepic{ps/v103xdistributedpolynomial.ps}{XDPOLY}{1.00}
+<<domain XDPOLY XDistributedPolynomial>>=
+)abbrev domain XDPOLY XDistributedPolynomial
+++ Author: Michel Petitot petitot@lifl.fr
+++ Date Created: 91
+++ Date Last Updated: 7 Juillet 92
+++ Fix History: compilation v 2.1 le 13 dec 98
+++ Basic Functions:
+++ Related Constructors:
+++ Also See:
+++ AMS Classifications:
+++ Keywords:
+++ References:
+++ Description:
+++   This type supports distributed multivariate polynomials
+++ whose variables do not commute.
+++ The coefficient ring may be non-commutative too.
+++ However, coefficients and variables commute.
+++ Author: Michel Petitot (petitot@lifl.fr)
+
+XDistributedPolynomial(vl:OrderedSet,R:Ring): XDPcat == XDPdef where
+
+  WORD ==> OrderedFreeMonoid(vl)
+  I    ==> Integer
+  NNI  ==> NonNegativeInteger
+  TERM ==> Record(k:WORD, c:R)
+
+  XDPcat == Join(FreeModuleCat(R, WORD), XPolynomialsCat(vl,R))
+
+  XDPdef == XPolynomialRing(R,WORD) add
+
+       import( WORD, TERM)
+
+    -- Representation
+       Rep  :=  List TERM
+
+    -- local functions
+       shw: (WORD , WORD) -> %    -- shuffle de 2 mots
+
+    -- definitions
+
+       mindegTerm p == last(p)$Rep
+
+       if R has CommutativeRing then
+         sh(p:%, n:NNI):% ==
+            n=0 => 1
+            n=1 => p
+            n1: NNI := (n-$I 1)::NNI
+            sh(p, sh(p,n1))
+
+      
+         sh(p1:%, p2:%) ==
+           p:% := 0 
+           for t1 in p1 repeat
+             for t2 in p2 repeat
+                p := p + (t1.c * t2.c) * shw(t1.k,t2.k) 
+           p
+
+       coerce(v: vl):% == coerce(v::WORD)
+       v:vl * p:% ==
+         [[v * t.k , t.c]$TERM for t in p]
+
+       mirror p == 
+         null p => p
+         monom(mirror$WORD leadingMonomial p, leadingCoefficient p) + _
+               mirror reductum p
+
+       degree(p) == length(maxdeg(p))$WORD
+
+       trunc(p, n) ==
+         p = 0 => p
+         degree(p) > n => trunc( reductum p , n)
+         p
+
+       varList p ==
+         constant? p => []
+         le : List vl := "setUnion"/[varList(t.k) for t in p]
+         sort_!(le)
+
+       rquo(p:% , w: WORD) == 
+         [[r::WORD,t.c]$TERM for t in p | not (r:= rquo(t.k,w)) case "failed" ]
+       lquo(p:% , w: WORD) ==
+         [[r::WORD,t.c]$TERM for t in p | not (r:= lquo(t.k,w)) case "failed" ]
+       rquo(p:% , v: vl) ==
+         [[r::WORD,t.c]$TERM for t in p | not (r:= rquo(t.k,v)) case "failed" ]
+       lquo(p:% , v: vl) ==
+         [[r::WORD,t.c]$TERM for t in p | not (r:= lquo(t.k,v)) case "failed" ]
+
+       shw(w1,w2) ==
+         w1 = 1$WORD => w2::%
+         w2 = 1$WORD => w1::%
+         x: vl := first w1 ; y: vl := first w2
+         x * shw(rest w1,w2) + y * shw(w1,rest w2)
+ 
+       lquo(p:%,q:%):% ==
+         +/  [r * t.c for t in q | (r := lquo(p,t.k)) ^= 0] 
+
+       rquo(p:%,q:%):% ==
+         +/  [r * t.c for t in q | (r := rquo(p,t.k)) ^= 0] 
+
+       coef(p:%,q:%):R ==
+         p = 0 => 0$R
+         q = 0 => 0$R 
+         p.first.k > q.first.k => coef(p.rest,q)
+         p.first.k < q.first.k => coef(p,q.rest) 
+         return p.first.c * q.first.c + coef(p.rest,q.rest)
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain XPBWPOLY XPBWPolynomial}
+<<XPBWPolynomial.input>>=
+-- xlpoly.spad.pamphlet XPBWPolynomial.input
+)spool XPBWPolynomial.output
+)set message test on
+)set message auto off
+)clear all
+--S 1 of 39
+a:Symbol := 'a
+--R 
+--R
+--R   (1)  a
+--R                                                                 Type: Symbol
+--E 1
+
+--S 2 of 39
+b:Symbol := 'b
+--R 
+--R
+--R   (2)  b
+--R                                                                 Type: Symbol
+--E 2
+
+--S 3 of 39
+RN := Fraction(Integer)
+--R 
+--R
+--R   (3)  Fraction Integer
+--R                                                                 Type: Domain
+--E 3
+
+--S 4 of 39
+word := OrderedFreeMonoid Symbol
+--R 
+--R
+--R   (4)  OrderedFreeMonoid Symbol
+--R                                                                 Type: Domain
+--E 4
+
+--S 5 of 39
+lword := LyndonWord(Symbol)
+--R 
+--R
+--R   (5)  LyndonWord Symbol
+--R                                                                 Type: Domain
+--E 5
+
+--S 6 of 39
+base := PoincareBirkhoffWittLyndonBasis Symbol
+--R 
+--R
+--R   (6)  PoincareBirkhoffWittLyndonBasis Symbol
+--R                                                                 Type: Domain
+--E 6
+
+--S 7 of 39
+dpoly := XDistributedPolynomial(Symbol, RN)
+--R 
+--R
+--R   (7)  XDistributedPolynomial(Symbol,Fraction Integer)
+--R                                                                 Type: Domain
+--E 7
+
+--S 8 of 39
+rpoly := XRecursivePolynomial(Symbol, RN)
+--R 
+--R
+--R   (8)  XRecursivePolynomial(Symbol,Fraction Integer)
+--R                                                                 Type: Domain
+--E 8
+
+--S 9 of 39
+lpoly := LiePolynomial(Symbol, RN)
+--R 
+--R
+--R   (9)  LiePolynomial(Symbol,Fraction Integer)
+--R                                                                 Type: Domain
+--E 9
+
+--S 10 of 39
+poly  := XPBWPolynomial(Symbol, RN)
+--R 
+--R
+--R   (10)  XPBWPolynomial(Symbol,Fraction Integer)
+--R                                                                 Type: Domain
+--E 10
+
+--S 11 of 39
+liste : List lword := LyndonWordsList([a,b], 6)
+--R 
+--R
+--R   (11)
+--R                       2        2     3      2 2       3     4      3 2
+--R   [[a], [b], [a b], [a b], [a b ], [a b], [a b ], [a b ], [a b], [a b ],
+--R      2          2 3           2       4     5      4 2     3          3 3
+--R    [a b a b], [a b ], [a b a b ], [a b ], [a b], [a b ], [a b a b], [a b ],
+--R      2     2     2 2        2 4           3       5
+--R    [a b a b ], [a b a b], [a b ], [a b a b ], [a b ]]
+--R                                                 Type: List LyndonWord Symbol
+--E 11
+
+--S 12 of 39
+0$poly
+--R 
+--R
+--R   (12)  0
+--R                                Type: XPBWPolynomial(Symbol,Fraction Integer)
+--E 12
+
+--S 13 of 39
+1$poly
+--R 
+--R
+--R   (13)  1
+--R                                Type: XPBWPolynomial(Symbol,Fraction Integer)
+--E 13
+
+--S 14 of 39
+p : poly := a
+--R 
+--R
+--R   (14)  [a]
+--R                                Type: XPBWPolynomial(Symbol,Fraction Integer)
+--E 14
+
+--S 15 of 39
+q : poly := b
+--R 
+--R
+--R   (15)  [b]
+--R                                Type: XPBWPolynomial(Symbol,Fraction Integer)
+--E 15
+
+--S 16 of 39
+pq: poly := p*q
+--R 
+--R
+--R   (16)  [a b] + [b][a]
+--R                                Type: XPBWPolynomial(Symbol,Fraction Integer)
+--E 16
+
+--S 17 of 39
+pq :: dpoly
+--R 
+--R
+--R   (17)  a b
+--R                        Type: XDistributedPolynomial(Symbol,Fraction Integer)
+--E 17
+
+--S 18 of 39
+mirror pq
+--R 
+--R
+--R   (18)  [b][a]
+--R                                Type: XPBWPolynomial(Symbol,Fraction Integer)
+--E 18
+
+--S 19 of 39
+ListOfTerms pq
+--R 
+--R
+--R   (19)  [[k= [b][a],c= 1],[k= [a b],c= 1]]
+--RType: List Record(k: PoincareBirkhoffWittLyndonBasis Symbol,c: Fraction Integer)
+--E 19
+
+--S 20 of 39
+reductum pq
+--R 
+--R
+--R   (20)  [a b]
+--R                                Type: XPBWPolynomial(Symbol,Fraction Integer)
+--E 20
+
+--S 21 of 39
+leadingMonomial pq
+--R 
+--R
+--R   (21)  [b][a]
+--R                                 Type: PoincareBirkhoffWittLyndonBasis Symbol
+--E 21
+
+--S 22 of 39
+coefficients pq
+--R 
+--R
+--R   (22)  [1,1]
+--R                                                  Type: List Fraction Integer
+--E 22
+
+--S 23 of 39
+leadingTerm pq
+--R 
+--R
+--R   (23)  [k= [b][a],c= 1]
+--R  Type: Record(k: PoincareBirkhoffWittLyndonBasis Symbol,c: Fraction Integer)
+--E 23
+
+--S 24 of 39
+degree pq
+--R 
+--R
+--R   (24)  2
+--R                                                        Type: PositiveInteger
+--E 24
+
+--S 25 of 39
+pq4:=exp(pq,4)
+--R 
+--R
+--R   (25)
+--R                          1              1     2       1      2
+--R     1 + [a b] + [b][a] + - [a b][a b] + - [a b ][a] + - [b][a b]
+--R                          2              2             2
+--R   + 
+--R     3               1
+--R     - [b][a b][a] + - [b][b][a][a]
+--R     2               2
+--R                                Type: XPBWPolynomial(Symbol,Fraction Integer)
+--E 25
+
+--S 26 of 39
+log(pq4,4) - pq
+--R 
+--R
+--R   (26)  0
+--R                                Type: XPBWPolynomial(Symbol,Fraction Integer)
+--E 26
+
+--S 27 of 39
+lp1 :lpoly := LiePoly liste.10
+--R 
+--R
+--R           3 2
+--R   (27)  [a b ]
+--R                                 Type: LiePolynomial(Symbol,Fraction Integer)
+--E 27
+
+--S 28 of 39
+lp2 :lpoly := LiePoly liste.11
+--R 
+--R
+--R           2
+--R   (28)  [a b a b]
+--R                                 Type: LiePolynomial(Symbol,Fraction Integer)
+--E 28
+
+--S 29 of 39
+lp :lpoly := [lp1, lp2]
+--R 
+--R
+--R           3 2 2
+--R   (29)  [a b a b a b]
+--R                                 Type: LiePolynomial(Symbol,Fraction Integer)
+--E 29
+
+--S 30 of 39
+lpd1: dpoly := lp1
+--R 
+--R
+--R          3 2     2         2 2                    2 2           2    2 3
+--R   (30)  a b  - 2a b a b - a b a + 4a b a b a - a b a  - 2b a b a  + b a
+--R                        Type: XDistributedPolynomial(Symbol,Fraction Integer)
+--E 30
+
+--S 31 of 39
+lpd2: dpoly := lp2
+--R 
+--R
+--R   (31)
+--R      2         2 2          2                    2 2       3        2
+--R     a b a b - a b a - 3a b a b + 4a b a b a - a b a  + 2b a b - 3b a b a
+--R   + 
+--R            2
+--R     b a b a
+--R                        Type: XDistributedPolynomial(Symbol,Fraction Integer)
+--E 31
+
+--S 32 of 39
+lpd : dpoly := lpd1 * lpd2 - lpd2 * lpd1
+--R 
+--R
+--R   (32)
+--R      3 2 2         3 2 2 2      3 2     2      3 2             3 2   2 2
+--R     a b a b a b - a b a b a - 3a b a b a b + 4a b a b a b a - a b a b a
+--R   + 
+--R       3 3 3      3 3 2       3 3     2    2       3 2     2       2 2
+--R     2a b a b - 3a b a b a + a b a b a  - a b a b a b  + 3a b a b a b a
+--R   + 
+--R       2           2       2                    2         2 2     2     2 3
+--R     6a b a b a b a b - 12a b a b a b a b a + 3a b a b a b a  - 4a b a b a b
+--R   + 
+--R       2     2 2       2     3 3    2 2 4 2     2 2 3          2 2 2   2
+--R     6a b a b a b a - a b a b a  + a b a b  - 3a b a b a b + 3a b a b a b
+--R   + 
+--R         2 2     3      2 2     2        2 2         2    2 2   2 3
+--R     - 2a b a b a b + 3a b a b a b a - 3a b a b a b a  + a b a b a
+--R   + 
+--R           2   3 2         2   2              2   2 2           2
+--R     3a b a b a b  - 6a b a b a b a b - 3a b a b a b a + 12a b a b a b a b a
+--R   + 
+--R             2     2 2         2 2     2         2 3 3             4 2
+--R     - 3a b a b a b a  - 6a b a b a b a  + 3a b a b a  - 4a b a b a b
+--R   + 
+--R                3                   2   2                  3
+--R     12a b a b a b a b - 12a b a b a b a b + 8a b a b a b a b
+--R   + 
+--R                      2                         2               2 3      2 5 2
+--R     - 12a b a b a b a b a + 12a b a b a b a b a  - 4a b a b a b a  + a b a b
+--R   + 
+--R           2 4            2 3   2        2 2   3        2 2   2
+--R     - 3a b a b a b + 3a b a b a b - 2a b a b a b + 3a b a b a b a
+--R   + 
+--R           2 2       2      2 2 2 3       3   3 2       3   2
+--R     - 3a b a b a b a  + a b a b a  - 2b a b a b  + 4b a b a b a b
+--R   + 
+--R         3   2 2        3                  3     2 2       3 2     2       3 3 3
+--R     2b a b a b a - 8b a b a b a b a + 2b a b a b a  + 4b a b a b a  - 2b a b a
+--R   + 
+--R         2   4 2       2   3            2   3 2         2   2
+--R     3b a b a b  - 6b a b a b a b - 3b a b a b a + 12b a b a b a b a
+--R   + 
+--R           2   2 2 2       2           2       2     2 3          5 2
+--R     - 3b a b a b a  - 6b a b a b a b a  + 3b a b a b a  - b a b a b
+--R   + 
+--R             4 2            3   2             3                  3 2 2
+--R     3b a b a b a + 6b a b a b a b - 12b a b a b a b a + 3b a b a b a
+--R   + 
+--R               2   3            2   2             2 2 3    2 5         2 5 2
+--R     - 4b a b a b a b + 6b a b a b a b a - b a b a b a  + b a b a b - b a b a
+--R   + 
+--R         2 4   2      2 4           2 4 2 2     2 3   3      2 3   2
+--R     - 3b a b a b + 4b a b a b a - b a b a  + 2b a b a b - 3b a b a b a
+--R   + 
+--R      2 3       2
+--R     b a b a b a
+--R                        Type: XDistributedPolynomial(Symbol,Fraction Integer)
+--E 32
+
+--S 33 of 39
+lp :: dpoly - lpd
+--R 
+--R
+--R   (33)  0
+--R                        Type: XDistributedPolynomial(Symbol,Fraction Integer)
+--E 33
+
+--S 34 of 39
+p := 3 * lp
+--R 
+--R
+--R            3 2 2
+--R   (34)  3[a b a b a b]
+--R                                Type: XPBWPolynomial(Symbol,Fraction Integer)
+--E 34
+
+--S 35 of 39
+q := lp1
+--R 
+--R
+--R           3 2
+--R   (35)  [a b ]
+--R                                Type: XPBWPolynomial(Symbol,Fraction Integer)
+--E 35
+
+--S 36 of 39
+pq:= p * q
+--R 
+--R
+--R            3 2 2        3 2
+--R   (36)  3[a b a b a b][a b ]
+--R                                Type: XPBWPolynomial(Symbol,Fraction Integer)
+--E 36
+
+--S 37 of 39
+pr:rpoly := p :: rpoly
+--R 
+--R
+--R   (37)
+--R       a
+--R    *
+--R           a
+--R        *
+--R               a b b
+--R            *
+--R                 a(a b(a b 3 + b a(- 3)) + b(a(a b(- 9) + b a 12) + b a a(- 3)))
+--R               + 
+--R                 b a(a(a b 6 + b a(- 9)) + b a a 3)
+--R           + 
+--R               b
+--R            *
+--R                   a b
+--R                *
+--R                       a
+--R                    *
+--R                         a(a b b(- 3) + b b a 9)
+--R                       + 
+--R                         b(a(a b 18 + b a(- 36)) + b a a 9)
+--R                   + 
+--R                     b(a a(a b(- 12) + b a 18) + b a a a(- 3))
+--R               + 
+--R                   b a
+--R                *
+--R                     a(a(a b b 3 + b a b(- 9)) + b a a b 9)
+--R                   + 
+--R                     b(a(a(a b(- 6) + b a 9) + b a a(- 9)) + b a a a 3)
+--R       + 
+--R           b
+--R        *
+--R               a
+--R            *
+--R                   a b
+--R                *
+--R                       a
+--R                    *
+--R                         a(a b b 9 + b(a b(- 18) + b a(- 9)))
+--R                       + 
+--R                         b(a b a 36 + b a a(- 9))
+--R                   + 
+--R                     b(a b a a(- 18) + b a a a 9)
+--R               + 
+--R                   b a
+--R                *
+--R                     a(a(a b b(- 12) + b a b 36) + b a a b(- 36))
+--R                   + 
+--R                     b(a(a(a b 24 + b a(- 36)) + b a a 36) + b a a a(- 12))
+--R           + 
+--R               b a a
+--R            *
+--R                 a(a(a b b 3 + b a b(- 9)) + b a a b 9)
+--R               + 
+--R                 b(a(a(a b(- 6) + b a 9) + b a a(- 9)) + b a a a 3)
+--R   + 
+--R       b
+--R    *
+--R           a
+--R        *
+--R               a
+--R            *
+--R                   a b
+--R                *
+--R                       a
+--R                    *
+--R                         a(a b b(- 6) + b(a b 12 + b a 6))
+--R                       + 
+--R                         b(a b a(- 24) + b a a 6)
+--R                   + 
+--R                     b(a b a a 12 + b a a a(- 6))
+--R               + 
+--R                   b a
+--R                *
+--R                       a
+--R                    *
+--R                         a(a b b 9 + b(a b(- 18) + b a(- 9)))
+--R                       + 
+--R                         b(a b a 36 + b a a(- 9))
+--R                   + 
+--R                     b(a b a a(- 18) + b a a a 9)
+--R           + 
+--R               b a a
+--R            *
+--R                 a(a(a b b(- 3) + b b a 9) + b(a(a b 18 + b a(- 36)) + b a a 9))
+--R               + 
+--R                 b(a a(a b(- 12) + b a 18) + b a a a(- 3))
+--R       + 
+--R           b a a a
+--R        *
+--R             a(a b(a b 3 + b a(- 3)) + b(a(a b(- 9) + b a 12) + b a a(- 3)))
+--R           + 
+--R             b a(a(a b 6 + b a(- 9)) + b a a 3)
+--R                          Type: XRecursivePolynomial(Symbol,Fraction Integer)
+--E 37
+
+--S 38 of 39
+qr:rpoly := q :: rpoly
+--R 
+--R
+--R   (38)
+--R     a(a(a b b 1 + b(a b(- 2) + b a(- 1))) + b(a b a 4 + b a a(- 1)))
+--R   + 
+--R     b(a b a a(- 2) + b a a a 1)
+--R                          Type: XRecursivePolynomial(Symbol,Fraction Integer)
+--E 38
+
+--S 39 of 39
+pq :: rpoly - pr*qr
+--R 
+--R
+--R   (39)  0
+--R                          Type: XRecursivePolynomial(Symbol,Fraction Integer)
+--E 39
+)spool
+)lisp (bye)
+@
+<<XPBWPolynomial.help>>=
+====================================================================
+XPBWPolynomial examples
+====================================================================
+
+Initialisations
+
+  a:Symbol := 'a
+    a
+                                  Type: Symbol
+
+  b:Symbol := 'b
+    b
+                                  Type: Symbol
+
+  RN := Fraction(Integer)
+    Fraction Integer
+                                  Type: Domain
+
+  word := OrderedFreeMonoid Symbol
+    OrderedFreeMonoid Symbol
+                                  Type: Domain
+
+  lword := LyndonWord(Symbol)
+    LyndonWord Symbol
+                                  Type: Domain
+
+  base := PoincareBirkhoffWittLyndonBasis Symbol
+    PoincareBirkhoffWittLyndonBasis Symbol
+                                  Type: Domain
+
+  dpoly := XDistributedPolynomial(Symbol, RN)
+    XDistributedPolynomial(Symbol,Fraction Integer)
+                                  Type: Domain
+
+  rpoly := XRecursivePolynomial(Symbol, RN)
+    XRecursivePolynomial(Symbol,Fraction Integer)
+                                  Type: Domain
+
+  lpoly := LiePolynomial(Symbol, RN)
+    LiePolynomial(Symbol,Fraction Integer)
+                                  Type: Domain
+
+  poly  := XPBWPolynomial(Symbol, RN)
+    XPBWPolynomial(Symbol,Fraction Integer)
+                                  Type: Domain
+
+  liste : List lword := LyndonWordsList([a,b], 6)
+                       2        2     3      2 2       3     4      3 2
+   [[a], [b], [a b], [a b], [a b ], [a b], [a b ], [a b ], [a b], [a b ],
+      2          2 3           2       4     5      4 2     3          3 3
+    [a b a b], [a b ], [a b a b ], [a b ], [a b], [a b ], [a b a b], [a b ],
+      2     2     2 2        2 4           3       5
+    [a b a b ], [a b a b], [a b ], [a b a b ], [a b ]]
+                                  Type: List LyndonWord Symbol
+
+Let's make some polynomials
+
+  0$poly
+    0
+                           Type: XPBWPolynomial(Symbol,Fraction Integer)
+
+  1$poly
+    1
+                           Type: XPBWPolynomial(Symbol,Fraction Integer)
+
+  p : poly := a
+    [a]
+                           Type: XPBWPolynomial(Symbol,Fraction Integer)
+
+  q : poly := b
+    [b]
+                           Type: XPBWPolynomial(Symbol,Fraction Integer)
+
+  pq: poly := p*q
+    [a b] + [b][a]
+                           Type: XPBWPolynomial(Symbol,Fraction Integer)
+
+Coerce to distributed polynomial
+
+  pq :: dpoly
+    a b
+                      Type: XDistributedPolynomial(Symbol,Fraction Integer)
+
+Check some polynomial operations
+
+  mirror pq
+    [b][a]
+                      Type: XPBWPolynomial(Symbol,Fraction Integer)
+
+  ListOfTerms pq
+    [[k= [b][a],c= 1],[k= [a b],c= 1]]
+      Type: List Record(k: PoincareBirkhoffWittLyndonBasis Symbol,
+                        c: Fraction Integer)
+
+  reductum pq
+    [a b]
+                      Type: XPBWPolynomial(Symbol,Fraction Integer)
+
+  leadingMonomial pq
+    [b][a]
+                      Type: PoincareBirkhoffWittLyndonBasis Symbol
+
+  coefficients pq
+    [1,1]
+                      Type: List Fraction Integer
+
+  leadingTerm pq
+    [k= [b][a],c= 1]
+              Type: Record(k: PoincareBirkhoffWittLyndonBasis Symbol,
+                           c: Fraction Integer)
+
+  degree pq
+    2
+                      Type: PositiveInteger
+
+  pq4:=exp(pq,4)
+                          1              1     2       1      2
+     1 + [a b] + [b][a] + - [a b][a b] + - [a b ][a] + - [b][a b]
+                          2              2             2
+   + 
+     3               1
+     - [b][a b][a] + - [b][b][a][a]
+     2               2
+                      Type: XPBWPolynomial(Symbol,Fraction Integer)
+
+  log(pq4,4) - pq
+   (26)  0
+                      Type: XPBWPolynomial(Symbol,Fraction Integer)
+
+Calculations with verification in XDistributedPolynomial.
+
+  lp1 :lpoly := LiePoly liste.10
+       3 2
+     [a b ]
+                      Type: LiePolynomial(Symbol,Fraction Integer)
+
+  lp2 :lpoly := LiePoly liste.11
+      2
+    [a b a b]
+                      Type: LiePolynomial(Symbol,Fraction Integer)
+
+  lp :lpoly := [lp1, lp2]
+      3 2 2
+    [a b a b a b]
+                      Type: LiePolynomial(Symbol,Fraction Integer)
+
+  lpd1: dpoly := lp1
+     3 2     2         2 2                    2 2           2    2 3
+    a b  - 2a b a b - a b a + 4a b a b a - a b a  - 2b a b a  + b a
+                      Type: XDistributedPolynomial(Symbol,Fraction Integer)
+
+  lpd2: dpoly := lp2
+      2         2 2          2                    2 2       3        2
+     a b a b - a b a - 3a b a b + 4a b a b a - a b a  + 2b a b - 3b a b a
+   + 
+            2
+     b a b a
+                      Type: XDistributedPolynomial(Symbol,Fraction Integer)
+
+  lpd : dpoly := lpd1 * lpd2 - lpd2 * lpd1
+      3 2 2         3 2 2 2      3 2     2      3 2             3 2   2 2
+     a b a b a b - a b a b a - 3a b a b a b + 4a b a b a b a - a b a b a
+   + 
+       3 3 3      3 3 2       3 3     2    2       3 2     2       2 2
+     2a b a b - 3a b a b a + a b a b a  - a b a b a b  + 3a b a b a b a
+   + 
+       2           2       2                    2         2 2     2     2 3
+     6a b a b a b a b - 12a b a b a b a b a + 3a b a b a b a  - 4a b a b a b
+   + 
+       2     2 2       2     3 3    2 2 4 2     2 2 3          2 2 2   2
+     6a b a b a b a - a b a b a  + a b a b  - 3a b a b a b + 3a b a b a b
+   + 
+         2 2     3      2 2     2        2 2         2    2 2   2 3
+     - 2a b a b a b + 3a b a b a b a - 3a b a b a b a  + a b a b a
+   + 
+           2   3 2         2   2              2   2 2           2
+     3a b a b a b  - 6a b a b a b a b - 3a b a b a b a + 12a b a b a b a b a
+   + 
+             2     2 2         2 2     2         2 3 3             4 2
+     - 3a b a b a b a  - 6a b a b a b a  + 3a b a b a  - 4a b a b a b
+   + 
+                3                   2   2                  3
+     12a b a b a b a b - 12a b a b a b a b + 8a b a b a b a b
+   + 
+                      2                         2               2 3      2 5 2
+     - 12a b a b a b a b a + 12a b a b a b a b a  - 4a b a b a b a  + a b a b
+   + 
+           2 4            2 3   2        2 2   3        2 2   2
+     - 3a b a b a b + 3a b a b a b - 2a b a b a b + 3a b a b a b a
+   + 
+           2 2       2      2 2 2 3       3   3 2       3   2
+     - 3a b a b a b a  + a b a b a  - 2b a b a b  + 4b a b a b a b
+   + 
+         3   2 2        3                  3     2 2       3 2     2       3 3 3
+     2b a b a b a - 8b a b a b a b a + 2b a b a b a  + 4b a b a b a  - 2b a b a
+   + 
+         2   4 2       2   3            2   3 2         2   2
+     3b a b a b  - 6b a b a b a b - 3b a b a b a + 12b a b a b a b a
+   + 
+           2   2 2 2       2           2       2     2 3          5 2
+     - 3b a b a b a  - 6b a b a b a b a  + 3b a b a b a  - b a b a b
+   + 
+             4 2            3   2             3                  3 2 2
+     3b a b a b a + 6b a b a b a b - 12b a b a b a b a + 3b a b a b a
+   + 
+               2   3            2   2             2 2 3    2 5         2 5 2
+     - 4b a b a b a b + 6b a b a b a b a - b a b a b a  + b a b a b - b a b a
+   + 
+         2 4   2      2 4           2 4 2 2     2 3   3      2 3   2
+     - 3b a b a b + 4b a b a b a - b a b a  + 2b a b a b - 3b a b a b a
+   + 
+      2 3       2
+     b a b a b a
+                    Type: XDistributedPolynomial(Symbol,Fraction Integer)
+
+  lp :: dpoly - lpd
+    0
+                    Type: XDistributedPolynomial(Symbol,Fraction Integer)
+
+Calculations with verification in XRecursivePolynomial.
+
+  p := 3 * lp
+       3 2 2
+    3[a b a b a b]
+                    Type: XPBWPolynomial(Symbol,Fraction Integer)
+
+  q := lp1
+      3 2
+    [a b ]
+                    Type: XPBWPolynomial(Symbol,Fraction Integer)
+
+  pq:= p * q
+       3 2 2        3 2
+    3[a b a b a b][a b ]
+                    Type: XPBWPolynomial(Symbol,Fraction Integer)
+
+  pr:rpoly := p :: rpoly
+       a
+    *
+           a
+        *
+               a b b
+            *
+                a(a b(a b 3 + b a(- 3)) + b(a(a b(- 9) + b a 12) + b a a(- 3)))
+               + 
+                 b a(a(a b 6 + b a(- 9)) + b a a 3)
+           + 
+               b
+            *
+                   a b
+                *
+                       a
+                    *
+                         a(a b b(- 3) + b b a 9)
+                       + 
+                         b(a(a b 18 + b a(- 36)) + b a a 9)
+                   + 
+                     b(a a(a b(- 12) + b a 18) + b a a a(- 3))
+               + 
+                   b a
+                *
+                     a(a(a b b 3 + b a b(- 9)) + b a a b 9)
+                   + 
+                     b(a(a(a b(- 6) + b a 9) + b a a(- 9)) + b a a a 3)
+       + 
+           b
+        *
+               a
+            *
+                   a b
+                *
+                       a
+                    *
+                         a(a b b 9 + b(a b(- 18) + b a(- 9)))
+                       + 
+                         b(a b a 36 + b a a(- 9))
+                   + 
+                     b(a b a a(- 18) + b a a a 9)
+               + 
+                   b a
+                *
+                     a(a(a b b(- 12) + b a b 36) + b a a b(- 36))
+                   + 
+                     b(a(a(a b 24 + b a(- 36)) + b a a 36) + b a a a(- 12))
+           + 
+               b a a
+            *
+                 a(a(a b b 3 + b a b(- 9)) + b a a b 9)
+               + 
+                 b(a(a(a b(- 6) + b a 9) + b a a(- 9)) + b a a a 3)
+   + 
+       b
+    *
+           a
+        *
+               a
+            *
+                   a b
+                *
+                       a
+                    *
+                         a(a b b(- 6) + b(a b 12 + b a 6))
+                       + 
+                         b(a b a(- 24) + b a a 6)
+                   + 
+                     b(a b a a 12 + b a a a(- 6))
+               + 
+                   b a
+                *
+                       a
+                    *
+                         a(a b b 9 + b(a b(- 18) + b a(- 9)))
+                       + 
+                         b(a b a 36 + b a a(- 9))
+                   + 
+                     b(a b a a(- 18) + b a a a 9)
+           + 
+               b a a
+            *
+                a(a(a b b(- 3) + b b a 9) + b(a(a b 18 + b a(- 36)) + b a a 9))
+               + 
+                 b(a a(a b(- 12) + b a 18) + b a a a(- 3))
+       + 
+           b a a a
+        *
+             a(a b(a b 3 + b a(- 3)) + b(a(a b(- 9) + b a 12) + b a a(- 3)))
+           + 
+             b a(a(a b 6 + b a(- 9)) + b a a 3)
+                      Type: XRecursivePolynomial(Symbol,Fraction Integer)
+
+  qr:rpoly := q :: rpoly
+     a(a(a b b 1 + b(a b(- 2) + b a(- 1))) + b(a b a 4 + b a a(- 1)))
+   + 
+     b(a b a a(- 2) + b a a a 1)
+                      Type: XRecursivePolynomial(Symbol,Fraction Integer)
+
+  pq :: rpoly - pr*qr
+    0
+                      Type: XRecursivePolynomial(Symbol,Fraction Integer)
+
+See Also:
+o )show XPBWPolynomial
+o $AXIOM/doc/src/algebra/xlpoly.spad.dvi
+
+@
+\pagehead{XPBWPolynomial}{XPBWPOLY}
+\pagepic{ps/v103xpbwpolynomial.ps}{XPBWPOLY}{1.00}
+<<domain XPBWPOLY XPBWPolynomial>>=
+)abbrev domain XPBWPOLY XPBWPolynomial
+++ Author: Michel Petitot (petitot@lifl.fr).
+++ Date Created: 91
+++ Date Last Updated: 7 Juillet 92
+++ Fix History: compilation v 2.1 le 13 dec 98
+++ Basic Functions:
+++ Related Constructors:
+++ Also See:
+++ AMS Classifications:
+++ Keywords:
+++ References:
+++ Description:
+++ This domain constructor implements polynomials in non-commutative
+++ variables written in the Poincare-Birkhoff-Witt basis from the
+++ Lyndon basis.
+++ These polynomials can be used to compute Baker-Campbell-Hausdorff
+++ relations. \newline Author: Michel Petitot (petitot@lifl.fr).
+
+XPBWPolynomial(VarSet:OrderedSet,R:CommutativeRing): XDPcat == XDPdef where
+
+  WORD   ==> OrderedFreeMonoid(VarSet)
+  LWORD  ==> LyndonWord(VarSet)
+  LWORDS ==> List LWORD
+  BASIS  ==> PoincareBirkhoffWittLyndonBasis(VarSet)
+  TERM   ==> Record(k:BASIS, c:R)
+  LTERMS ==> List(TERM)
+  LPOLY  ==> LiePolynomial(VarSet,R)  
+  EX     ==> OutputForm
+  XDPOLY ==> XDistributedPolynomial(VarSet,R)
+  XRPOLY ==> XRecursivePolynomial(VarSet,R)
+  TERM1  ==> Record(k:LWORD, c:R)
+  NNI    ==> NonNegativeInteger
+  I      ==> Integer
+  RN     ==> Fraction(Integer)
+
+  XDPcat == Join(XPolynomialsCat(VarSet,R), FreeModuleCat(R, BASIS)) with
+    coerce      : LPOLY -> $
+      ++ \axiom{coerce(p)} returns \axiom{p}. 
+    coerce      : $ -> XDPOLY
+      ++ \axiom{coerce(p)} returns \axiom{p} as a distributed polynomial. 
+    coerce      : $ -> XRPOLY
+      ++ \axiom{coerce(p)} returns \axiom{p} as a recursive polynomial.
+    LiePolyIfCan: $ -> Union(LPOLY,"failed")
+      ++ \axiom{LiePolyIfCan(p)} return  \axiom{p} if \axiom{p} is a Lie polynomial.
+    product     : ($,$,NNI) -> $           -- produit tronque a l'ordre n
+      ++ \axiom{product(a,b,n)} returns \axiom{a*b} (truncated up to order \axiom{n}).
+
+    if R has Module(RN) then
+       exp      : ($,NNI) -> $
+          ++ \axiom{exp(p,n)} returns the exponential of \axiom{p} 
+          ++ (truncated up to order \axiom{n}).
+       log      : ($,NNI) -> $
+          ++ \axiom{log(p,n)} returns the logarithm of \axiom{p}
+          ++ (truncated up to order \axiom{n}).
+
+  XDPdef == FreeModule1(R,BASIS) add
+       import(TERM)
+
+    -- Representation
+       Rep:= LTERMS 
+
+    -- local functions
+       prod1: (BASIS, $) -> $
+       prod2: ($, BASIS) -> $
+       prod : (BASIS, BASIS) -> $
+
+       prod11: (BASIS, $, NNI) -> $
+       prod22: ($, BASIS, NNI) -> $
+
+       outForm : TERM -> EX
+       Dexpand : BASIS -> XDPOLY
+       Rexpand : BASIS -> XRPOLY
+       process : (List LWORD, LWORD, List LWORD) -> $
+       mirror1 : BASIS -> $
+
+    -- functions locales
+       outForm t ==
+           t.c =$R 1 => t.k :: EX
+           t.k =$BASIS 1 => t.c :: EX
+           t.c::EX * t.k ::EX
+
+       prod1(b:BASIS, p:$):$ ==
+         +/ [t.c * prod(b, t.k) for t in p]
+
+       prod2(p:$, b:BASIS):$ ==
+         +/ [t.c * prod(t.k, b) for t in p]
+ 
+       prod11(b,p,n) ==
+           limit: I := n -$I length b
+           +/ [t.c * prod(b, t.k) for t in p| length(t.k) :: I <= limit]
+
+       prod22(p,b,n) ==
+           limit: I := n -$I length b
+           +/ [t.c * prod(t.k, b) for t in p| length(t.k) :: I <= limit]
+
+       prod(g,d) ==
+         d = 1 => monom(g,1)
+         g = 1 => monom(d,1)
+         process(reverse ListOfTerms g, first d, rest ListOfTerms d)
+
+       Dexpand b == 
+         b = 1 => 1$XDPOLY
+         */ [LiePoly(l)$LPOLY :: XDPOLY for l in ListOfTerms b]
+
+       Rexpand b ==
+         b = 1 => 1$XRPOLY
+         */ [LiePoly(l)$LPOLY :: XRPOLY for l in ListOfTerms b]
+
+       mirror1(b:BASIS):$ ==
+         b = 1 => 1
+         lp: LPOLY := LiePoly first b
+         lp := mirror lp
+         mirror1(rest b) * lp :: $
+
+       process(gauche, x, droite) ==    -- algo du "collect process"
+         null gauche => monom( cons(x, droite) pretend BASIS, 1$R)
+         r1, r2 : $
+         not lexico(first gauche, x) =>     -- cas facile !!!
+           monom(append(reverse gauche, cons(x, droite)) pretend BASIS , 1$R)
+
+         p: LPOLY := [first gauche , x]      -- on crochete !!!
+         null droite =>
+           r1 :=  +/ [t.c * process(rest gauche, t.k, droite) for t in _
+                      ListOfTerms p]
+           r2 :=  process( rest gauche, x, list first gauche)
+           r1 + r2 
+         rd: List LWORD := rest droite; fd: LWORD := first droite
+         r1 := +/ [t.c * process(list t.k, fd, rd) for t in  ListOfTerms p] 
+         r1 := +/ [t.c * process(rest gauche, first t.k, rest ListOfTerms(t.k))_
+                  for t in  r1] 
+         r2 := process([first gauche, x], fd, rd)
+         r2 := +/ [t.c * process(rest gauche, first t.k, rest ListOfTerms(t.k))_
+                  for t in  r2]
+         r1 + r2
+
+    -- definitions
+       1 == monom(1$BASIS, 1$R)
+
+       coerce(r:R):$ == [[1$BASIS , r]$TERM ]
+
+       coerce(p:$):EX ==
+         null p => (0$R) :: EX
+         le : List EX := nil
+         for rec in p repeat le := cons(outForm rec, le)
+         reduce(_+, le)$List(EX)
+
+       coerce(v: VarSet):$ == monom(v::BASIS , 1$R)
+       coerce(p: LPOLY):$ ==
+          [[t.k :: BASIS , t.c ]$TERM for t in ListOfTerms p]
+
+       coerce(p:$):XDPOLY ==
+         +/ [t.c * Dexpand t.k for t in p]
+
+       coerce(p:$):XRPOLY ==
+         p = 0 => 0$XRPOLY
+         +/ [t.c * Rexpand t.k for t in p]
+
+       constant? p == (null p) or (leadingMonomial(p) =$BASIS 1)
+       constant p == 
+         null p => 0$R
+         p.last.k = 1$BASIS => p.last.c
+         0$R
+
+       quasiRegular? p == (p=0) or (p.last.k ^= 1$BASIS)
+       quasiRegular p == 
+         p = 0 => p
+         p.last.k = 1$BASIS => delete(p, maxIndex p)
+         p
+    
+       x:$ * y:$ ==
+         y = 0$$ => 0
+         +/ [t.c * prod1(t.k, y) for t in x]
+
+--       ListOfTerms p == p pretend LTERMS
+
+       varList p == 
+          lv: List VarSet := "setUnion"/ [varList(b.k)$BASIS for b in p]
+          sort(lv)
+
+       degree(p) ==
+          p=0 => error "null polynomial"
+          length(leadingMonomial p)
+
+       trunc(p, n) ==
+         p = 0 => p
+         degree(p) > n => trunc( reductum p , n)
+         p
+
+       product(x,y,n) ==
+         x = 0 => 0
+         y = 0 => 0
+         +/ [t.c * prod11(t.k, y, n) for t in x]
+
+       if R has Module(RN) then
+         exp (p,n) ==
+             p = 0 => 1
+             not quasiRegular? p => 
+               error "a proper polynomial is required"
+             s : $ := 1 ; r: $ := 1                  -- resultat
+             for i in 1..n repeat
+                k1 :RN := 1/i
+                k2 : R := k1 * 1$R
+                s := k2 * product(p, s, n)
+                r := r + s
+             r
+  
+         log (p,n) ==
+             p = 1 => 0
+             p1: $ := 1 - p
+             not quasiRegular? p1 => 
+               error "constant term <> 1, impossible log "
+             s : $ := - 1 ; r: $ := 0                 -- resultat
+             for i in 1..n repeat
+               k1 :RN := 1/i
+               k2 : R := k1 * 1$R
+               s := product(p1, s, n)
+               r := k2 * s + r
+             r
+ 
+       LiePolyIfCan p ==
+         p = 0 => 0$LPOLY
+         "and"/ [retractable?(t.k)$BASIS for t in p] =>
+            lt : List TERM1 := _
+                 [[retract(t.k)$BASIS, t.c]$TERM1 for t in p]
+            lt pretend LPOLY
+         "failed"
+
+       mirror p ==
+         +/ [t.c * mirror1(t.k) for t in p]
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain XPOLY XPolynomial}
+<<XPolynomial.input>>=
+-- xpoly.spad.pamphlet XPolynomial.input
+)spool XPolynomial.output
+)set message test on
+)set message auto off
+)clear all
+--S 1 of 14
+poly := XPolynomial(Integer)
+--R 
+--R
+--R   (1)  XPolynomial Integer
+--R                                                                 Type: Domain
+--E 1
+
+--S 2 of 14
+pr: poly := 2*x + 3*y-5 
+--R 
+--R
+--R   (2)  - 5 + x 2 + y 3
+--R                                                    Type: XPolynomial Integer
+--E 2
+
+--S 3 of 14
+pr2: poly := pr*pr
+--R 
+--R
+--R   (3)  25 + x(- 20 + x 4 + y 6) + y(- 30 + x 6 + y 9)
+--R                                                    Type: XPolynomial Integer
+--E 3
+
+--S 4 of 14
+pd  := expand pr
+--R 
+--R
+--R   (4)  - 5 + 2x + 3y
+--R                                 Type: XDistributedPolynomial(Symbol,Integer)
+--E 4
+
+--S 5 of 14
+pd2 := pd*pd
+--R 
+--R
+--R                           2                   2
+--R   (5)  25 - 20x - 30y + 4x  + 6x y + 6y x + 9y
+--R                                 Type: XDistributedPolynomial(Symbol,Integer)
+--E 5
+
+--S 6 of 14
+expand(pr2) - pd2
+--R 
+--R
+--R   (6)  0
+--R                                 Type: XDistributedPolynomial(Symbol,Integer)
+--E 6
+
+--S 7 of 14
+qr :=  pr**3
+--R 
+--R
+--R   (7)
+--R     - 125 + x(150 + x(- 60 + x 8 + y 12) + y(- 90 + x 12 + y 18))
+--R   + 
+--R     y(225 + x(- 90 + x 12 + y 18) + y(- 135 + x 18 + y 27))
+--R                                                    Type: XPolynomial Integer
+--E 7
+
+--S 8 of 14
+qd :=  pd**3
+--R 
+--R
+--R   (8)
+--R                              2                       2     3      2
+--R     - 125 + 150x + 225y - 60x  - 90x y - 90y x - 135y  + 8x  + 12x y + 12x y x
+--R   + 
+--R          2        2                2       3
+--R     18x y  + 12y x  + 18y x y + 18y x + 27y
+--R                                 Type: XDistributedPolynomial(Symbol,Integer)
+--E 8
+
+--S 9 of 14
+trunc(qd,2)
+--R 
+--R
+--R                                 2                       2
+--R   (9)  - 125 + 150x + 225y - 60x  - 90x y - 90y x - 135y
+--R                                 Type: XDistributedPolynomial(Symbol,Integer)
+--E 9
+
+--S 10 of 14
+trunc(qr,2)
+--R 
+--R
+--R   (10)  - 125 + x(150 + x(- 60) + y(- 90)) + y(225 + x(- 90) + y(- 135))
+--R                                                    Type: XPolynomial Integer
+--E 10
+
+--S 11 of 14
+Word := OrderedFreeMonoid Symbol
+--R 
+--R
+--R   (11)  OrderedFreeMonoid Symbol
+--R                                                                 Type: Domain
+--E 11
+
+--S 12 of 14
+w: Word := x*y**2
+--R 
+--R
+--R            2
+--R   (12)  x y
+--R                                               Type: OrderedFreeMonoid Symbol
+--E 12
+
+--S 13 of 14
+rquo(qr,w)
+--R 
+--R
+--R   (13)  18
+--R                                                    Type: XPolynomial Integer
+--E 13
+
+--S 14 of 14
+sh(pr,w::poly)
+--R 
+--R
+--R   (14)  x(x y y 4 + y(x y 2 + y(- 5 + x 2 + y 9))) + y x y y 3
+--R                                                    Type: XPolynomial Integer
+--E 14
+)spool
+)lisp (bye)
+@
+<<XPolynomial.help>>=
+====================================================================
+XPolynomial examples
+====================================================================
+
+The XPolynomial domain constructor implements multivariate polynomials
+whose set of variables is Symbol.  These variables do not commute.
+The only parameter of this construtor is the coefficient ring which
+may be non-commutative.  However, coefficients and variables commute.
+The representation of the polynomials is recursive.  The abbreviation
+for XPolynomial is XPOLY.
+
+Other constructors like XPolynomialRing, XRecursivePolynomial as well 
+as XDistributedPolynomial, LiePolynomial and XPBWPolynomial implement 
+multivariate polynomials in non-commutative variables.
+
+We illustrate now some of the facilities of the XPOLY domain constructor.
+
+Define a polynomial ring over the integers.
+
+  poly := XPolynomial(Integer)
+    XPolynomial Integer
+                                 Type: Domain
+
+Define a first polynomial,
+
+  pr: poly := 2*x + 3*y-5 
+    - 5 + x 2 + y 3
+                                 Type: XPolynomial Integer
+
+and a second one.
+
+  pr2: poly := pr*pr
+    25 + x(- 20 + x 4 + y 6) + y(- 30 + x 6 + y 9)
+                                 Type: XPolynomial Integer
+
+Rewrite pr in a distributive way,
+
+  pd  := expand pr
+    - 5 + 2x + 3y
+                                 Type: XDistributedPolynomial(Symbol,Integer)
+
+compute its square,
+
+  pd2 := pd*pd
+                       2                   2
+    25 - 20x - 30y + 4x  + 6x y + 6y x + 9y
+                                 Type: XDistributedPolynomial(Symbol,Integer)
+
+and checks that:
+
+  expand(pr2) - pd2
+    0
+                                 Type: XDistributedPolynomial(Symbol,Integer)
+
+We define:
+
+  qr :=  pr**3
+     - 125 + x(150 + x(- 60 + x 8 + y 12) + y(- 90 + x 12 + y 18))
+   + 
+     y(225 + x(- 90 + x 12 + y 18) + y(- 135 + x 18 + y 27))
+                                 Type: XPolynomial Integer
+
+and:
+
+  qd :=  pd**3
+                              2                       2     3      2
+     - 125 + 150x + 225y - 60x  - 90x y - 90y x - 135y  + 8x  + 12x y + 12x y x
+   + 
+          2        2                2       3
+     18x y  + 12y x  + 18y x y + 18y x + 27y
+                                 Type: XDistributedPolynomial(Symbol,Integer)
+
+We truncate qd at degree 3.
+
+  trunc(qd,2)
+                             2                       2
+    - 125 + 150x + 225y - 60x  - 90x y - 90y x - 135y
+                                 Type: XDistributedPolynomial(Symbol,Integer)
+
+The same for qr:
+
+  trunc(qr,2)
+    - 125 + x(150 + x(- 60) + y(- 90)) + y(225 + x(- 90) + y(- 135))
+                                 Type: XPolynomial Integer
+
+We define:
+
+  Word := OrderedFreeMonoid Symbol
+    OrderedFreeMonoid Symbol
+                                 Type: Domain
+
+and:
+
+  w: Word := x*y**2
+       2
+    x y
+                                 Type: OrderedFreeMonoid Symbol
+
+We can compute the right-quotient of qr by r:
+
+  rquo(qr,w)
+    18
+                                 Type: XPolynomial Integer
+
+and the shuffle-product of pr by r:
+
+  sh(pr,w::poly)
+    x(x y y 4 + y(x y 2 + y(- 5 + x 2 + y 9))) + y x y y 3
+                                 Type: XPolynomial Integer
+
+See Also:
+o )help XPBWPolynomial
+o )help LiePolynomial
+o )help XDistributedPolynomial
+o )help XRecursivePolynomial
+o )help XPolynomialRing
+o )show XPolynomial
+o $AXIOM/doc/src/algebra/xpoly.spad.dvi
+
+@
+\pagehead{XPolynomial}{XPOLY}
+\pagepic{ps/v103xpolynomial.ps}{XPOLY}{1.00}
+<<domain XPOLY XPolynomial>>=
+)abbrev domain XPOLY XPolynomial
+++ Author: Michel Petitot petitot@lifl.fr
+++ Date Created: 91
+++ Date Last Updated: 7 Juillet 92
+++ Fix History: compilation v 2.1 le 13 dec 98
+++   extend renomme en expand
+++ Basic Functions:
+++ Related Constructors:
+++ Also See:
+++ AMS Classifications:
+++ Keywords:
+++ References:
+++ Description:
+++   This type supports multivariate polynomials
+++ whose set of variables is \spadtype{Symbol}.
+++ The representation is recursive.
+++ The coefficient ring may be non-commutative and the variables 
+++ do not commute.
+++ However, coefficients and variables commute.
+++ Author: Michel Petitot (petitot@lifl.fr)
+
+XPolynomial(R:Ring) == XRecursivePolynomial(Symbol, R)
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain XPR XPolynomialRing}
+<<XPolynomialRing.input>>=
+-- xpoly.spad.pamphlet XPolynomialRing.input
+)spool XPolynomialRing.output
+)set message test on
+)set message auto off
+)clear all
+--S 1 of 15
+Word := OrderedFreeMonoid(Symbol)
+--R 
+--R
+--R   (1)  OrderedFreeMonoid Symbol
+--R                                                                 Type: Domain
+--E 1
+
+--S 2 of 15
+poly:= XPR(Integer,Word)
+--R 
+--R
+--R   (2)  XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
+--R                                                                 Type: Domain
+--E 2
+
+--S 3 of 15
+p:poly := 2 * x - 3 * y + 1
+--R 
+--R
+--R   (3)  1 + 2x - 3y
+--R                      Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
+--E 3
+
+--S 4 of 15
+q:poly := 2 * x + 1
+--R 
+--R
+--R   (4)  1 + 2x
+--R                      Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
+--E 4
+
+--S 5 of 15
+p + q
+--R 
+--R
+--R   (5)  2 + 4x - 3y
+--R                      Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
+--E 5
+
+--S 6 of 15
+p * q
+--R 
+--R
+--R                        2
+--R   (6)  1 + 4x - 3y + 4x  - 6y x
+--R                      Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
+--E 6
+
+--S 7 of 15
+(p+q)**2-p**2-q**2-2*p*q
+--R 
+--R
+--R   (7)  - 6x y + 6y x
+--R                      Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
+--E 7
+
+--S 8 of 15
+M := SquareMatrix(2,Fraction Integer)
+--R 
+--R
+--R   (8)  SquareMatrix(2,Fraction Integer)
+--R                                                                 Type: Domain
+--E 8
+
+--S 9 of 15
+poly1:= XPR(M,Word)
+--R 
+--R
+--R   (9)
+--R   XPolynomialRing(SquareMatrix(2,Fraction Integer),OrderedFreeMonoid Symbol)
+--R                                                                 Type: Domain
+--E 9
+
+--S 10 of 15
+m1:M := matrix [ [i*j**2 for i in 1..2] for j in 1..2]
+--R 
+--R
+--R         +1  2+
+--R   (10)  |    |
+--R         +4  8+
+--R                                       Type: SquareMatrix(2,Fraction Integer)
+--E 10
+
+--S 11 of 15
+m2:M := m1 - 5/4
+--R 
+--R
+--R         +  1    +
+--R         |- -  2 |
+--R         |  4    |
+--R   (11)  |       |
+--R         |     27|
+--R         | 4   --|
+--R         +      4+
+--R                                       Type: SquareMatrix(2,Fraction Integer)
+--E 11
+
+--S 12 of 15
+m3: M := m2**2
+--R 
+--R
+--R         +129     +
+--R         |---  13 |
+--R         | 16     |
+--R   (12)  |        |
+--R         |     857|
+--R         |26   ---|
+--R         +      16+
+--R                                       Type: SquareMatrix(2,Fraction Integer)
+--E 12
+
+--S 13 of 15
+pm:poly1   := m1*x + m2*y + m3*z - 2/3 
+--R 
+--R
+--R         +  2     +             +  1    +    +129     +
+--R         |- -   0 |             |- -  2 |    |---  13 |
+--R         |  3     |   +1  2+    |  4    |    | 16     |
+--R   (13)  |        | + |    |x + |       |y + |        |z
+--R         |       2|   +4  8+    |     27|    |     857|
+--R         | 0   - -|             | 4   --|    |26   ---|
+--R         +       3+             +      4+    +      16+
+--RType: XPolynomialRing(SquareMatrix(2,Fraction Integer),OrderedFreeMonoid Symbol)
+--E 13
+
+--S 14 of 15
+qm:poly1 := pm - m1*x
+--R 
+--R
+--R         +  2     +   +  1    +    +129     +
+--R         |- -   0 |   |- -  2 |    |---  13 |
+--R         |  3     |   |  4    |    | 16     |
+--R   (14)  |        | + |       |y + |        |z
+--R         |       2|   |     27|    |     857|
+--R         | 0   - -|   | 4   --|    |26   ---|
+--R         +       3+   +      4+    +      16+
+--RType: XPolynomialRing(SquareMatrix(2,Fraction Integer),OrderedFreeMonoid Symbol)
+--E 14
+
+--S 15 of 15
+qm**3
+--R 
+--R
+--R   (15)
+--R     +   8      +   +  1  8+    +43   52 +    +  129       +
+--R     |- --   0  |   |- -  -|    |--   -- |    |- ---  - 26 |
+--R     |  27      |   |  3  3|    | 4    3 |    |   8        | 2
+--R     |          | + |      |y + |        |z + |            |y
+--R     |         8|   |16    |    |104  857|    |         857|
+--R     | 0    - --|   |--   9|    |---  ---|    |- 52   - ---|
+--R     +        27+   + 3    +    + 3    12+    +          8 +
+--R   + 
+--R     +  3199     831 +      +  3199     831 +      +  103169     6409 +
+--R     |- ----   - --- |      |- ----   - --- |      |- ------   - ---- |
+--R     |   32       4  |      |   32       4  |      |    128        4  | 2
+--R     |               |y z + |               |z y + |                  |z
+--R     |  831     26467|      |  831     26467|      |   6409     820977|
+--R     |- ---   - -----|      |- ---   - -----|      | - ----   - ------|
+--R     +   2        32 +      +   2        32 +      +     2        128 +
+--R   + 
+--R     +3199   831 +     +103169   6409 +      +103169   6409 +
+--R     |----   --- |     |------   ---- |      |------   ---- |
+--R     | 64     8  | 3   |  256      8  | 2    |  256      8  |
+--R     |           |y  + |              |y z + |              |y z y
+--R     |831   26467|     | 6409   820977|      | 6409   820977|
+--R     |---   -----|     | ----   ------|      | ----   ------|
+--R     + 4      64 +     +   4      256 +      +   4      256 +
+--R   + 
+--R     +3178239   795341 +       +103169   6409 +       +3178239   795341 +
+--R     |-------   ------ |       |------   ---- |       |-------   ------ |
+--R     |  1024      128  |   2   |  256      8  |   2   |  1024      128  |
+--R     |                 |y z  + |              |z y  + |                 |z y z
+--R     |795341   25447787|       | 6409   820977|       |795341   25447787|
+--R     |------   --------|       | ----   ------|       |------   --------|
+--R     +  64       1024  +       +   4      256 +       +  64       1024  +
+--R   + 
+--R     +3178239   795341 +      +98625409  12326223 +
+--R     |-------   ------ |      |--------  -------- |
+--R     |  1024      128  | 2    |  4096       256   | 3
+--R     |                 |z y + |                   |z
+--R     |795341   25447787|      |12326223  788893897|
+--R     |------   --------|      |--------  ---------|
+--R     +  64       1024  +      +   128       4096  +
+--RType: XPolynomialRing(SquareMatrix(2,Fraction Integer),OrderedFreeMonoid Symbol)
+--E 15
+)spool
+)lisp (bye)
+@
+<<XPolynomialRing.help>>=
+====================================================================
+XPolynomialRing examples
+====================================================================
+
+The XPolynomialRing domain constructor implements generalized
+polynomials with coefficients from an arbitrary Ring (not necessarily
+commutative) and whose exponents are words from an arbitrary
+OrderedMonoid (not necessarily commutative too).  Thus these
+polynomials are (finite) linear combinations of words.
+
+This constructor takes two arguments.  The first one is a Ring and the
+second is an OrderedMonoid.  The abbreviation for XPolynomialRing is XPR.
+
+Other constructors like XPolynomial, XRecursivePolynomial, 
+XDistributedPolynomial, LiePolynomial and XPBWPolynomial implement 
+multivariate polynomials in non-commutative variables.
+
+We illustrate now some of the facilities of the XPR domain constructor.
+
+Define the free ordered monoid generated by the symbols.
+
+  Word := OrderedFreeMonoid(Symbol)
+    OrderedFreeMonoid Symbol
+                                 Type: Domain
+
+Define the linear combinations of these words with integer coefficients.
+
+  poly:= XPR(Integer,Word)
+    XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
+                                 Type: Domain
+
+Then we define a first element from poly.
+
+  p:poly := 2 * x - 3 * y + 1
+    1 + 2x - 3y
+                     Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
+
+And a second one.
+
+  q:poly := 2 * x + 1
+    1 + 2x
+                     Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
+
+We compute their sum,
+
+  p + q
+    2 + 4x - 3y
+                     Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
+
+their product,
+
+  p * q
+                    2
+    1 + 4x - 3y + 4x  - 6y x
+                     Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
+
+and see that variables do not commute.
+
+  (p+q)**2-p**2-q**2-2*p*q
+    - 6x y + 6y x
+                     Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
+
+Now we define a ring of square matrices,
+
+  M := SquareMatrix(2,Fraction Integer)
+    SquareMatrix(2,Fraction Integer)
+                                 Type: Domain
+
+and the linear combinations of words with these  matrices as coefficients.
+
+  poly1:= XPR(M,Word)
+   XPolynomialRing(SquareMatrix(2,Fraction Integer),OrderedFreeMonoid Symbol)
+                                 Type: Domain
+
+Define a first matrix,
+
+  m1:M := matrix [ [i*j**2 for i in 1..2] for j in 1..2]
+         +1  2+
+         |    |
+         +4  8+
+                                 Type: SquareMatrix(2,Fraction Integer)
+
+a second one,
+
+  m2:M := m1 - 5/4
+         +  1    +
+         |- -  2 |
+         |  4    |
+         |       |
+         |     27|
+         | 4   --|
+         +      4+
+                                Type: SquareMatrix(2,Fraction Integer)
+
+and a third one.
+
+  m3: M := m2**2
+         +129     +
+         |---  13 |
+         | 16     |
+         |        |
+         |     857|
+         |26   ---|
+         +      16+
+                               Type: SquareMatrix(2,Fraction Integer)
+
+Define a polynomial,
+
+  pm:poly1   := m1*x + m2*y + m3*z - 2/3 
+         +  2     +             +  1    +    +129     +
+         |- -   0 |             |- -  2 |    |---  13 |
+         |  3     |   +1  2+    |  4    |    | 16     |
+         |        | + |    |x + |       |y + |        |z
+         |       2|   +4  8+    |     27|    |     857|
+         | 0   - -|             | 4   --|    |26   ---|
+         +       3+             +      4+    +      16+
+     Type: XPolynomialRing(SquareMatrix(2,Fraction Integer),
+                           OrderedFreeMonoid Symbol)
+
+a second one,
+
+  qm:poly1 := pm - m1*x
+         +  2     +   +  1    +    +129     +
+         |- -   0 |   |- -  2 |    |---  13 |
+         |  3     |   |  4    |    | 16     |
+         |        | + |       |y + |        |z
+         |       2|   |     27|    |     857|
+         | 0   - -|   | 4   --|    |26   ---|
+         +       3+   +      4+    +      16+
+      Type: XPolynomialRing(SquareMatrix(2,Fraction Integer),
+                            OrderedFreeMonoid Symbol)
+
+and the following power.
+
+  qm**3
+     +   8      +   +  1  8+    +43   52 +    +  129       +
+     |- --   0  |   |- -  -|    |--   -- |    |- ---  - 26 |
+     |  27      |   |  3  3|    | 4    3 |    |   8        | 2
+     |          | + |      |y + |        |z + |            |y
+     |         8|   |16    |    |104  857|    |         857|
+     | 0    - --|   |--   9|    |---  ---|    |- 52   - ---|
+     +        27+   + 3    +    + 3    12+    +          8 +
+   + 
+     +  3199     831 +      +  3199     831 +      +  103169     6409 +
+     |- ----   - --- |      |- ----   - --- |      |- ------   - ---- |
+     |   32       4  |      |   32       4  |      |    128        4  | 2
+     |               |y z + |               |z y + |                  |z
+     |  831     26467|      |  831     26467|      |   6409     820977|
+     |- ---   - -----|      |- ---   - -----|      | - ----   - ------|
+     +   2        32 +      +   2        32 +      +     2        128 +
+   + 
+     +3199   831 +     +103169   6409 +      +103169   6409 +
+     |----   --- |     |------   ---- |      |------   ---- |
+     | 64     8  | 3   |  256      8  | 2    |  256      8  |
+     |           |y  + |              |y z + |              |y z y
+     |831   26467|     | 6409   820977|      | 6409   820977|
+     |---   -----|     | ----   ------|      | ----   ------|
+     + 4      64 +     +   4      256 +      +   4      256 +
+   + 
+     +3178239   795341 +       +103169   6409 +       +3178239   795341 +
+     |-------   ------ |       |------   ---- |       |-------   ------ |
+     |  1024      128  |   2   |  256      8  |   2   |  1024      128  |
+     |                 |y z  + |              |z y  + |                 |z y z
+     |795341   25447787|       | 6409   820977|       |795341   25447787|
+     |------   --------|       | ----   ------|       |------   --------|
+     +  64       1024  +       +   4      256 +       +  64       1024  +
+   + 
+     +3178239   795341 +      +98625409  12326223 +
+     |-------   ------ |      |--------  -------- |
+     |  1024      128  | 2    |  4096       256   | 3
+     |                 |z y + |                   |z
+     |795341   25447787|      |12326223  788893897|
+     |------   --------|      |--------  ---------|
+     +  64       1024  +      +   128       4096  +
+        Type: XPolynomialRing(SquareMatrix(2,Fraction Integer),
+                              OrderedFreeMonoid Symbol)
+
+See Also:
+o )help XPBWPolynomial
+o )help LiePolynomial
+o )help XDistributedPolynomial
+o )help XRecursivePolynomial
+o )help XPolynomial
+o )show XPolynomialRing
+o $AXIOM/doc/src/algebra/xpoly.spad.dvi
+
+@
+\pagehead{XPolynomialRing}{XPR}
+\pagepic{ps/v103xpolynomialring.ps}{XPR}{1.00}
+<<domain XPR XPolynomialRing>>=
+)abbrev domain XPR XPolynomialRing
+++ Author: Michel Petitot petitot@lifl.fr
+++ Date Created: 91
+++ Date Last Updated: 7 Juillet 92
+++ Fix History: compilation v 2.1 le 13 dec 98
+++ Basic Functions:
+++ Related Constructors:
+++ Also See:
+++ AMS Classifications:
+++ Keywords:
+++ References:
+++ Description:
+++ This domain represents generalized polynomials with coefficients
+++ (from a not necessarily commutative ring), and words
+++ belonging to an arbitrary \spadtype{OrderedMonoid}.
+++ This type is used, for instance, by the \spadtype{XDistributedPolynomial} 
+++ domain constructor where the Monoid is free.
+++ Author: Michel Petitot (petitot@lifl.fr)
+
+XPolynomialRing(R:Ring,E:OrderedMonoid): T == C where
+  TERM   ==> Record(k: E, c: R)
+  EX     ==> OutputForm
+  NNI    ==> NonNegativeInteger
+
+  T == Join(Ring, XAlgebra(R), FreeModuleCat(R,E)) with
+    --operations
+      "*": (%,R) -> %
+        ++ \spad{p*r} returns the product of \spad{p} by \spad{r}.
+      "#": % -> NonNegativeInteger
+        ++ \spad{# p} returns the number of terms in \spad{p}.
+      coerce: E -> %
+        ++ \spad{coerce(e)} returns \spad{1*e}
+      maxdeg: % -> E
+        ++ \spad{maxdeg(p)} returns the greatest word occurring in the polynomial \spad{p}
+        ++ with a non-zero coefficient. An error is produced if  \spad{p} is zero.
+      mindeg: % -> E
+        ++ \spad{mindeg(p)} returns the smallest word occurring in the polynomial \spad{p}
+        ++ with a non-zero coefficient. An error is produced if  \spad{p} is zero.
+      reductum : % -> %   
+        ++ \spad{reductum(p)} returns \spad{p} minus its leading term.
+        ++ An error is produced if  \spad{p} is zero.
+      coef  : (%,E) -> R
+        ++ \spad{coef(p,e)} extracts the coefficient of the monomial \spad{e}.
+        ++ Returns zero if \spad{e} is not present. 
+      constant?:% -> Boolean
+        ++ \spad{constant?(p)} tests whether the polynomial \spad{p} belongs to the
+        ++ coefficient ring.
+      constant: % -> R
+        ++ \spad{constant(p)} return the constant term of \spad{p}.
+      quasiRegular? : % -> Boolean
+        ++ \spad{quasiRegular?(x)} return true if \spad{constant(p)} is zero.
+      quasiRegular : % -> % 
+        ++ \spad{quasiRegular(x)} return \spad{x} minus its constant term.
+      map   : (R -> R, %) -> %
+        ++ \spad{map(fn,x)} returns \spad{Sum(fn(r_i) w_i)} if \spad{x} writes \spad{Sum(r_i w_i)}.
+      if R has Field then "/" : (%,R) -> %
+        ++ \spad{p/r} returns \spad{p*(1/r)}.
+
+    --assertions
+      if R has noZeroDivisors then noZeroDivisors
+      if R has unitsKnown then unitsKnown
+      if R has canonicalUnitNormal then canonicalUnitNormal
+          ++ canonicalUnitNormal guarantees that the function
+          ++ unitCanonical returns the same representative for all
+          ++ associates of any particular element.
+
+
+  C == FreeModule1(R,E) add
+    --representations
+       Rep:=  List TERM
+    --uses
+       repeatMultExpt: (%,NonNegativeInteger) -> %
+    --define
+       1  == [[1$E,1$R]]
+ 
+       characteristic  == characteristic$R
+       #x == #$Rep x
+       maxdeg p == if null p then  error " polynome nul !!"
+                             else p.first.k
+       mindeg p == if null p then  error " polynome nul !!" 
+                             else (last p).k
+       
+       coef(p,e)  ==
+          for tm in p repeat
+            tm.k=e => return tm.c
+            tm.k < e => return 0$R
+          0$R
+
+       constant? p == (p = 0) or (maxdeg(p) = 1$E)
+       constant  p == coef(p,1$E)
+
+       quasiRegular? p == (p=0) or (last p).k ^= 1$E
+       quasiRegular  p == 
+          quasiRegular?(p) => p
+          [t for t in p | not(t.k = 1$E)]
+
+       recip(p) ==
+           p=0 => "failed"
+           p.first.k > 1$E => "failed"
+           (u:=recip(p.first.c)) case "failed" => "failed"
+           (u::R)::%
+ 
+       coerce(r:R) == if r=0$R then 0$% else [[1$E,r]]
+       coerce(n:Integer) == (n::R)::%
+ 
+       if R has noZeroDivisors then
+         p1:% * p2:%  ==
+            null p1 => 0
+            null p2 => 0
+            p1.first.k = 1$E => p1.first.c * p2
+            p2 = 1 => p1
+--            +/[[[t1.k*t2.k,t1.c*t2.c]$TERM for t2 in p2]
+--                   for t1 in reverse(p1)]
+            +/[[[t1.k*t2.k,t1.c*t2.c]$TERM for t2 in p2]
+                   for t1 in p1]
+        else
+         p1:% * p2:%  ==
+            null p1 => 0
+            null p2 => 0
+            p1.first.k = 1$E => p1.first.c * p2
+            p2 = 1 => p1
+--            +/[[[t1.k*t2.k,r]$TERM for t2 in p2 | not (r:=t1.c*t2.c) =$R 0]
+--                 for t1 in reverse(p1)]
+            +/[[[t1.k*t2.k,r]$TERM for t2 in p2 | not (r:=t1.c*t2.c) =$R 0]
+                   for t1 in p1]
+       p:% ** nn:NNI  == repeatMultExpt(p,nn)
+       repeatMultExpt(x,nn) ==
+               nn = 0 => 1
+               y:% := x
+               for i in 2..nn repeat y:= x * y
+               y
+              
+       outTerm(r:R, m:E):EX ==
+            r=1 => m::EX
+            m=1 => r::EX
+            r::EX * m::EX
+
+--       coerce(x:%) : EX ==
+--         null x => (0$R) :: EX
+--         le : List EX := nil
+--         for rec in x repeat
+--           rec.c = 1$R => le := cons(rec.k :: EX, le)
+--           rec.k = 1$E => le := cons(rec.c :: EX, le)
+--           le := cons(mkBinary("*"::EX,rec.c :: EX,
+--             rec.k :: EX), le)
+--         1 = #le => first le
+--         mkNary("+" :: EX,le)
+
+       coerce(a:%):EX ==
+            empty? a => (0$R)::EX
+            reduce(_+, reverse_! [outTerm(t.c, t.k) for t in a])$List(EX)
+
+ 
+       if R has Field then
+          x/r == inv(r)*x
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain XRPOLY XRecursivePolynomial}
+Polynomial arithmetic with non-commutative variables has been improved
+by a contribution of Michel Petitot (University of Lille I, France).
+The domain constructors {\bf XRecursivePolynomial} 
+provides a recursive for these polynomials. It is the non-commutative
+equivalents for the {\bf SparseMultivariatePolynomial} constructor.
+\pagehead{XRecursivePolynomial}{XRPOLY}
+\pagepic{ps/v103xrecursivepolynomial.ps}{XRPOLY}{1.00}
+<<domain XRPOLY XRecursivePolynomial>>=
+)abbrev domain XRPOLY XRecursivePolynomial
+++ Author: Michel Petitot petitot@lifl.fr
+++ Date Created: 91
+++ Date Last Updated: 7 Juillet 92
+++ Fix History: compilation v 2.1 le 13 dec 98
+++   extend renomme en expand
+++ Basic Functions:
+++ Related Constructors:
+++ Also See:
+++ AMS Classifications:
+++ Keywords:
+++ References:
+++ Description:
+++   This type supports multivariate polynomials
+++ whose variables do not commute.
+++ The representation is recursive.
+++ The coefficient ring may be non-commutative.
+++ Coefficients and variables commute.
+++ Author: Michel Petitot (petitot@lifl.fr)
+
+XRecursivePolynomial(VarSet:OrderedSet,R:Ring):  Xcat == Xdef where
+  I      ==> Integer
+  NNI    ==> NonNegativeInteger
+  XDPOLY ==> XDistributedPolynomial(VarSet, R)
+  EX     ==> OutputForm
+  WORD   ==> OrderedFreeMonoid(VarSet)
+  TERM   ==> Record(k:VarSet , c:%)
+  LTERMS ==> List(TERM) 
+  REGPOLY==> FreeModule1(%, VarSet) 
+  VPOLY  ==> Record(c0:R, reg:REGPOLY)
+
+  Xcat == XPolynomialsCat(VarSet,R) with
+       expand: % -> XDPOLY
+         ++ \spad{expand(p)} returns \spad{p} in distributed form.
+       unexpand : XDPOLY -> %
+         ++ \spad{unexpand(p)} returns \spad{p} in recursive form.
+       RemainderList: % -> LTERMS
+         ++ \spad{RemainderList(p)} returns the regular part of \spad{p}
+         ++ as a list of terms.
+
+  Xdef == add
+       import(VPOLY)
+
+    -- representation
+       Rep     := Union(R,VPOLY)
+
+    -- local functions
+       construct: LTERMS -> REGPOLY
+       simplifie: VPOLY -> %
+       lquo1: (LTERMS,LTERMS) -> %        ++ a ajouter
+       coef1: (LTERMS,LTERMS) -> R        ++ a ajouter
+       outForm: REGPOLY -> EX
+
+    --define
+       construct(lt) == lt pretend REGPOLY
+       p1:%  =  p2:%  ==
+         p1 case R =>
+             p2 case R => p1 =$R p2
+             false
+         p2 case R => false
+         p1.c0 =$R p2.c0 and p1.reg =$REGPOLY p2.reg
+
+       monom(w, r) == 
+         r =0 => 0
+         r * w::%
+
+--       if R has Field then                  -- Bug non resolu !!!!!!!!
+--         p:% / r: R == inv(r) * p
+ 
+       rquo(p1:%, p2:%):% ==
+         p2 case R => p1 * p2::R
+         p1 case R => p1  * p2.c0
+         x:REGPOLY := construct [[t.k, a]$TERM for t in ListOfTerms(p1.reg) _
+                         | (a:= rquo(t.c,p2)) ^= 0$% ]$LTERMS
+         simplifie [coef(p1,p2) , x]$VPOLY
+
+       trunc(p,n) ==
+         n = 0 or (p case R) => (constant p)::%
+         n1: NNI := (n-1)::NNI
+         lt: LTERMS := [[t.k, r]$TERM for t in ListOfTerms p.reg _
+                        | (r := trunc(t.c, n1)) ^= 0]$LTERMS
+         x: REGPOLY := construct lt
+         simplifie [constant p, x]$VPOLY
+
+       unexpand p ==
+         constant? p => (constant p)::%
+         vl: List VarSet := sort(#1 > #2, varList p)
+         x : REGPOLY := _
+           construct [[v, unexpand r]$TERM for v in vl| (r:=lquo(p,v)) ^= 0]
+         [constant p, x]$VPOLY
+
+       if R has CommutativeRing then
+         sh(p:%, n:NNI):% ==
+            n = 0 => 1
+            p case R => (p::R)** n
+            n1: NNI := (n-1)::NNI
+            p1: % := n * sh(p, n1)  
+            lt: LTERMS := [[t.k, sh(t.c, p1)]$TERM for t in ListOfTerms p.reg]
+            [p.c0 ** n, construct lt]$VPOLY
+ 
+         sh(p1:%, p2:%) ==
+            p1 case R => p1::R * p2
+            p2 case R => p1 * p2::R 
+            lt1:LTERMS := ListOfTerms p1.reg ; lt2:LTERMS := ListOfTerms p2.reg
+            x: REGPOLY := construct [[t.k,sh(t.c,p2)]$TERM for t in lt1]
+            y: REGPOLY := construct [[t.k,sh(p1,t.c)]$TERM for t in lt2]
+            [p1.c0*p2.c0,x + y]$VPOLY
+
+       RemainderList p == 
+           p case R => []
+           ListOfTerms( p.reg)$REGPOLY
+ 
+       lquo(p1:%,p2:%):% ==
+         p2 case R => p1 * p2
+         p1 case R => p1  *$R p2.c0
+         p1 * p2.c0 +$% lquo1(ListOfTerms p1.reg, ListOfTerms p2.reg)
+
+       lquo1(x:LTERMS,y:LTERMS):% ==
+         null x => 0$%  
+         null y => 0$%
+         x.first.k < y.first.k => lquo1(x,y.rest)
+         x.first.k = y.first.k => 
+             lquo(x.first.c,y.first.c) + lquo1(x.rest,y.rest)
+         return lquo1(x.rest,y)
+
+       coef(p1:%, p2:%):R ==
+         p1 case R => p1::R * constant p2
+         p2 case R => p1.c0 * p2::R
+         p1.c0 * p2.c0 +$R coef1(ListOfTerms p1.reg, ListOfTerms p2.reg)
+
+       coef1(x:LTERMS,y:LTERMS):R ==
+         null x => 0$R
+         null y => 0$R
+         x.first.k < y.first.k => coef1(x,y.rest)
+         x.first.k = y.first.k =>
+             coef(x.first.c,y.first.c) + coef1(x.rest,y.rest)
+         return coef1(x.rest,y)
+
+       --------------------------------------------------------------
+       outForm(p:REGPOLY): EX ==
+          le : List EX :=  [t.k::EX * t.c::EX for t in ListOfTerms p]
+          reduce(_+, reverse_! le)$List(EX)
+
+       coerce(p:$): EX ==
+          p case R => (p::R)::EX
+          p.c0 = 0 => outForm p.reg
+          p.c0::EX + outForm p.reg 
+
+       0 == 0$R::%
+       1 == 1$R::%
+       constant? p ==  p case R
+       constant p == 
+          p case R => p
+          p.c0
+
+       simplifie p ==
+         p.reg = 0$REGPOLY => (p.c0)::%
+         p
+
+       coerce (v:VarSet):% ==
+         [0$R,coerce(v)$REGPOLY]$VPOLY
+
+       coerce (r:R):% == r::%
+       coerce (n:Integer) == n::R::%
+       coerce (w:WORD) == 
+         w = 1 => 1$R
+         (first w) * coerce(rest w)
+ 
+       expand p ==
+         p case R => p::R::XDPOLY
+         lt:LTERMS := ListOfTerms(p.reg)
+         ep:XDPOLY := (p.c0)::XDPOLY
+         for t in lt repeat
+           ep:= ep + t.k * expand(t.c)
+         ep
+                
+       - p:% ==
+         p case R => -$R p
+         [- p.c0, - p.reg]$VPOLY
+ 
+       p1 + p2 ==
+         p1 case R and p2 case R => p1 +$R p2
+         p1 case R => [p1 + p2.c0 , p2.reg]$VPOLY
+         p2 case R => [p2 + p1.c0 , p1.reg]$VPOLY 
+         simplifie [p1.c0 + p2.c0 , p1.reg +$REGPOLY p2.reg]$VPOLY
+ 
+       p1 - p2 ==
+         p1 case R and p2 case R => p1 -$R p2
+         p1 case R => [p1 - p2.c0 , -p2.reg]$VPOLY
+         p2 case R => [p1.c0 - p2 , p1.reg]$VPOLY
+         simplifie [p1.c0 - p2.c0 , p1.reg -$REGPOLY p2.reg]$VPOLY
+ 
+       n:Integer * p:% ==
+         n=0 => 0$%
+         p case R => n *$R p
+         -- [ n*p.c0,n*p.reg]$VPOLY
+         simplifie [ n*p.c0,n*p.reg]$VPOLY
+
+       r:R * p:% ==
+         r=0 => 0$%
+         p case R => r *$R p
+         -- [ r*p.c0,r*p.reg]$VPOLY
+         simplifie [ r*p.c0,r*p.reg]$VPOLY
+
+       p:% * r:R ==
+         r=0 => 0$%
+         p case R => p *$R r
+         -- [ p.c0 * r,p.reg * r]$VPOLY
+         simplifie [ r*p.c0,r*p.reg]$VPOLY
+
+       v:VarSet * p:% == 
+          p = 0 => 0$%
+          [0$R, v *$REGPOLY p]$VPOLY
+ 
+       p1:% * p2:% ==
+         p1 case R => p1::R * p2
+         p2 case R => p1 * p2::R
+         x:REGPOLY := p1.reg *$REGPOLY p2
+         y:REGPOLY := (p1.c0)::% *$REGPOLY p2.reg  -- maladroit:(p1.c0)::% !!
+         -- [ p1.c0 * p2.c0 , x+y ]$VPOLY
+         simplifie [ p1.c0 * p2.c0 , x+y ]$VPOLY
+
+       lquo(p:%, v:VarSet):% ==
+         p case R => 0
+         coefficient(p.reg,v)$REGPOLY
+
+       lquo(p:%, w:WORD):% ==
+         w = 1$WORD => p
+         lquo(lquo(p,first w),rest w)
+
+       rquo(p:%, v:VarSet):% ==
+         p case R => 0
+         x:REGPOLY := construct [[t.k, a]$TERM for t in ListOfTerms(p.reg)
+                         | (a:= rquo(t.c,v)) ^= 0 ]
+         simplifie [constant(coefficient(p.reg,v)) , x]$VPOLY 
+        
+       rquo(p:%, w:WORD):% ==
+         w = 1$WORD => p
+         rquo(rquo(p,rest w),first w)
+ 
+       coef(p:%, w:WORD):R ==
+         constant lquo(p,w)
+
+       quasiRegular? p == 
+         p case R => p = 0$R
+         p.c0 = 0$R
+
+       quasiRegular p ==
+         p case R => 0$%
+         [0$R,p.reg]$VPOLY
+
+       characteristic == characteristic()$R
+       recip p ==
+         p case R => recip(p::R)
+         "failed"
+
+       mindeg p ==
+         p case R =>
+           p = 0 => error "XRPOLY.mindeg: polynome nul !!"
+           1$WORD
+         p.c0 ^= 0 => 1$WORD
+         "min"/[(t.k) *$WORD mindeg(t.c) for t in ListOfTerms p.reg] 
+
+       maxdeg p ==
+         p case R => 
+            p = 0 => error "XRPOLY.maxdeg: polynome nul !!"
+            1$WORD
+         "max"/[(t.k) *$WORD maxdeg(t.c) for t in ListOfTerms p.reg] 
+
+       degree p == 
+          p = 0 => error "XRPOLY.degree: polynome nul !!"
+          length(maxdeg p)
+
+       map(fn,p) ==
+         p case R => fn(p::R)
+         x:REGPOLY := construct [[t.k,a]$TERM for t in ListOfTerms p.reg
+                         |(a := map(fn,t.c)) ^= 0$R]
+         simplifie [fn(p.c0),x]$VPOLY
+
+       varList p ==
+         p case R => []
+         lv: List VarSet := "setUnion"/[varList(t.c) for t in ListOfTerms p.reg]
+         lv:= setUnion(lv,[t.k for t in ListOfTerms p.reg])
+         sort_!(lv)
+
+@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \chapter{Chapter Y}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -82984,12 +90826,139 @@ Note that this code is not included in the generated catdef.spad file.
 (MAKEPROP (QUOTE |Symbol|) (QUOTE NILADIC) T) 
 @
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{VECTOR.lsp BOOTSTRAP} 
+{\bf VECTOR} depends on itself.
+We need to break this cycle to build the algebra. So we keep a
+cached copy of the translated {\bf VECTOR} category which we can write
+into the {\bf MID} directory. We compile the lisp code and copy the
+{\bf VECTOR.o} file to the {\bf OUT} directory.  This is eventually
+forcibly replaced by a recompiled version.
+
+Note that this code is not included in the generated catdef.spad file.
+
+<<VECTOR.lsp BOOTSTRAP>>=
+
+(|/VERSIONCHECK| 2) 
+
+(DEFUN |VECTOR;vector;L$;1| (|l| |$|) (SPADCALL |l| (QREFELT |$| 8))) 
+
+(DEFUN |VECTOR;convert;$If;2| (|x| |$|)
+ (SPADCALL
+  (LIST
+   (SPADCALL (SPADCALL "vector" (QREFELT |$| 12)) (QREFELT |$| 14))
+   (SPADCALL (SPADCALL |x| (QREFELT |$| 15)) (QREFELT |$| 16)))
+  (QREFELT |$| 18))) 
+
+(DEFUN |Vector| (#1=#:G84134)
+ (PROG NIL
+  (RETURN
+   (PROG (#2=#:G84135)
+    (RETURN
+     (COND
+      ((LETT #2#
+        (|lassocShiftWithFunction| (LIST (|devaluate| #1#)) (HGET |$ConstructorCache| (QUOTE |Vector|)) (QUOTE |domainEqualList|))
+        |Vector|)
+         (|CDRwithIncrement| #2#))
+      ((QUOTE T)
+       (|UNWIND-PROTECT|
+        (PROG1
+         (|Vector;| #1#)
+         (LETT #2# T |Vector|))
+        (COND ((NOT #2#) (HREM |$ConstructorCache| (QUOTE |Vector|)))))))))))) 
+
+(DEFUN |Vector;| (|#1|)
+ (PROG (|DV$1| |dv$| |$| #1=#:G84133 |pv$|)
+  (RETURN
+   (PROGN
+    (LETT |DV$1| (|devaluate| |#1|) . #2=(|Vector|))
+    (LETT |dv$| (LIST (QUOTE |Vector|) |DV$1|) . #2#)
+    (LETT |$| (GETREFV 36) . #2#)
+    (QSETREFV |$| 0 |dv$|)
+    (QSETREFV |$| 3
+     (LETT |pv$|
+      (|buildPredVector| 0 0
+       (LIST
+        (|HasCategory| |#1| (QUOTE (|SetCategory|)))
+        (|HasCategory| |#1| (QUOTE (|ConvertibleTo| (|InputForm|))))
+        (LETT #1# (|HasCategory| |#1| (QUOTE (|OrderedSet|))) . #2#)
+        (OR #1# (|HasCategory| |#1| (QUOTE (|SetCategory|))))
+        (|HasCategory| (|Integer|) (QUOTE (|OrderedSet|)))
+        (|HasCategory| |#1| (QUOTE (|AbelianSemiGroup|)))
+        (|HasCategory| |#1| (QUOTE (|AbelianMonoid|)))
+        (|HasCategory| |#1| (QUOTE (|AbelianGroup|)))
+        (|HasCategory| |#1| (QUOTE (|Monoid|)))
+        (|HasCategory| |#1| (QUOTE (|Ring|)))
+        (AND
+         (|HasCategory| |#1| (QUOTE (|RadicalCategory|)))
+         (|HasCategory| |#1| (QUOTE (|Ring|))))
+        (AND
+         (|HasCategory| |#1| (LIST (QUOTE |Evalable|) (|devaluate| |#1|)))
+         (|HasCategory| |#1| (QUOTE (|SetCategory|))))
+        (OR
+         (AND
+          (|HasCategory| |#1| (LIST (QUOTE |Evalable|) (|devaluate| |#1|)))
+          #1#)
+         (AND
+          (|HasCategory| |#1| (LIST (QUOTE |Evalable|) (|devaluate| |#1|)))
+          (|HasCategory| |#1| (QUOTE (|SetCategory|)))))))
+      . #2#))
+    (|haddProp|
+     |$ConstructorCache|
+     (QUOTE |Vector|)
+     (LIST |DV$1|)
+     (CONS 1 |$|))
+    (|stuffDomainSlots| |$|)
+    (QSETREFV |$| 6 |#1|)
+    (COND
+     ((|testBitVector| |pv$| 2)
+       (QSETREFV |$| 19
+         (CONS (|dispatchFunction| |VECTOR;convert;$If;2|) |$|))))
+    |$|)))) 
+
+(MAKEPROP
+ (QUOTE |Vector|)
+ (QUOTE |infovec|)
+ (LIST
+  (QUOTE #(NIL NIL NIL NIL NIL (|IndexedVector| 6 (NRTEVAL 1)) (|local| |#1|)
+    (|List| 6) (0 . |construct|) |VECTOR;vector;L$;1| (|String|) (|Symbol|)
+    (5 . |coerce|) (|InputForm|) (10 . |convert|) (15 . |parts|) 
+    (20 . |convert|) (|List| |$|) (25 . |convert|) (30 . |convert|) 
+    (|Mapping| 6 6 6) (|Boolean|) (|NonNegativeInteger|) (|List| 24) 
+    (|Equation| 6) (|Integer|) (|Mapping| 21 6) (|Mapping| 21 6 6) 
+    (|UniversalSegment| 25) (|Void|) (|Mapping| 6 6) (|Matrix| 6) 
+    (|OutputForm|) (|SingleInteger|) (|Union| 6 (QUOTE "failed")) 
+    (|List| 25)))
+  (QUOTE #(|vector| 35 |parts| 40 |convert| 45 |construct| 50))
+  (QUOTE ((|shallowlyMutable| . 0) (|finiteAggregate| . 0)))
+  (CONS
+   (|makeByteWordVec2| 13 (QUOTE (0 0 0 0 0 0 0 3 0 0 13 4 0 0 13 1 2 4)))
+   (CONS
+    (QUOTE #(|VectorCategory&| |OneDimensionalArrayAggregate&|
+      |FiniteLinearAggregate&| |LinearAggregate&| |IndexedAggregate&|
+      |Collection&| |HomogeneousAggregate&| |OrderedSet&| |Aggregate&|
+      |EltableAggregate&| |Evalable&| |SetCategory&| NIL NIL 
+      |InnerEvalable&| NIL NIL |BasicType&|))
+    (CONS
+     (QUOTE #((|VectorCategory| 6) (|OneDimensionalArrayAggregate| 6)
+      (|FiniteLinearAggregate| 6) (|LinearAggregate| 6) 
+      (|IndexedAggregate| 25 6) (|Collection| 6) 
+      (|HomogeneousAggregate| 6) (|OrderedSet|) (|Aggregate|) 
+      (|EltableAggregate| 25 6) (|Evalable| 6) (|SetCategory|) 
+      (|Type|) (|Eltable| 25 6) (|InnerEvalable| 6 6) 
+      (|CoercibleTo| 32) (|ConvertibleTo| 13) (|BasicType|)))
+     (|makeByteWordVec2| 19
+      (QUOTE (1 0 0 7 8 1 11 0 10 12 1 13 0 11 14 1 0 7 0 15 1 7 13 0 16 1 13
+          0 17 18 1 0 13 0 19 1 0 0 7 9 1 0 7 0 15 1 2 13 0 19 1 0 0 7 8))))))
+  (QUOTE |lookupIncomplete|))) 
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \chapter{Chunk collections}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 <<algebra>>=
 <<domain ALGSC AlgebraGivenByStructuralConstants>>
 <<domain ALGFF AlgebraicFunctionField>>
 <<domain AN AlgebraicNumber>>
+<<domain ANON AnonymousFunction>>
 <<domain ANTISYM AntiSymm>>
 <<domain ANY Any>>
 <<domain ASTACK ArrayStack>>
@@ -83058,6 +91027,7 @@ Note that this code is not included in the generated catdef.spad file.
 <<domain DEQUEUE Dequeue>>
 <<domain DERHAM DeRhamComplex>>
 <<domain DSMP DifferentialSparseMultivariatePolynomial>>
+<<domain DIRPROD DirectProduct>>
 <<domain DPMM DirectProductMatrixModule>>
 <<domain DPMO DirectProductModule>>
 <<domain DMP DistributedMultivariatePolynomial>>
@@ -83086,6 +91056,7 @@ Note that this code is not included in the generated catdef.spad file.
 <<domain EXPEXPAN ExponentialExpansion>>
 <<domain EXPUPXS ExponentialOfUnivariatePuiseuxSeries>>
 <<domain EMR EuclideanModularRing>>
+<<domain EXIT Exit>>
 <<domain EXPR Expression>>
 <<domain EAB ExtAlgBasis>>
 <<domain E04DGFA e04dgfAnnaType>>
@@ -83126,9 +91097,11 @@ Note that this code is not included in the generated catdef.spad file.
 <<domain FAMONOID FreeAbelianMonoid>>
 <<domain FGROUP FreeGroup>>
 <<domain FM FreeModule>>
+<<domain FM1 FreeModule1>>
 <<domain FMONOID FreeMonoid>>
 <<domain FNLA FreeNilpotentLie>>
 <<domain FPARFRAC FullPartialFractionExpansion>>
+<<domain FUNCTION FunctionCalled>>
 
 <<domain GDMP GeneralDistributedMultivariatePolynomial>>
 <<domain GMODPOL GeneralModulePolynomial>>
@@ -83137,6 +91110,7 @@ Note that this code is not included in the generated catdef.spad file.
 <<domain GSTBL GeneralSparseTable>>
 <<domain GTSET GeneralTriangularSet>>
 <<domain GSERIES GeneralUnivariatePowerSeries>>
+<<domain GRIMAGE GraphImage>>
 
 <<domain HASHTBL HashTable>>
 <<domain HEAP Heap>>
@@ -83159,6 +91133,7 @@ Note that this code is not included in the generated catdef.spad file.
 <<domain IARRAY1 IndexedOneDimensionalArray>>
 <<domain ISTRING IndexedString>>
 <<domain IARRAY2 IndexedTwoDimensionalArray>>
+<<domain IVECTOR IndexedVector>>
 <<domain ITUPLE InfiniteTuple>>
 <<domain IAN InnerAlgebraicNumber>>
 <<domain IFF InnerFiniteField>>
@@ -83181,6 +91156,8 @@ Note that this code is not included in the generated catdef.spad file.
 
 <<domain LAUPOL LaurentPolynomial>>
 <<domain LIB Library>>
+<<domain LEXP LieExponentials>>
+<<domain LPOLY LiePolynomial>>
 <<domain LSQM LieSquareMatrix>>
 <<domain LODO LinearOrdinaryDifferentialOperator>>
 <<domain LODO1 LinearOrdinaryDifferentialOperator1>>
@@ -83190,10 +91167,12 @@ Note that this code is not included in the generated catdef.spad file.
 <<domain LMDICT ListMultiDictionary>>
 <<domain LA LocalAlgebra>>
 <<domain LO Localize>>
+<<domain LWORD LyndonWord>>
 
 <<domain MCMPLX MachineComplex>>
 <<domain MFLOAT MachineFloat>>
 <<domain MINT MachineInteger>>
+<<domain MAGMA Magma>>
 <<domain MKCHSET MakeCachableSet>>
 <<domain MATRIX Matrix>>
 <<domain MODMON ModMonic>>
@@ -83228,9 +91207,12 @@ Note that this code is not included in the generated catdef.spad file.
 <<domain OMLO OppositeMonogenicLinearOperator>>
 <<domain ORDCOMP OrderedCompletion>>
 <<domain ODP OrderedDirectProduct>>
+<<domain OFMONOID OrderedFreeMonoid>>
+<<domain OVAR OrderedVariableList>>
 <<domain ODPOL OrderlyDifferentialPolynomial>>
 <<domain ODVAR OrderlyDifferentialVariable>>
 <<domain ODR OrdinaryDifferentialRing>>
+<<domain OWP OrdinaryWeightedPolynomials>>
 <<domain OSI OrdSetInts>>
 <<domain OUTFORM OutputForm>>
 
@@ -83253,6 +91235,7 @@ Note that this code is not included in the generated catdef.spad file.
 <<domain ACPLOT PlaneAlgebraicCurvePlot>>
 <<domain PLOT Plot>>
 <<domain PLOT3D Plot3D>>
+<<domain PBWLB PoincareBirkhoffWittLyndonBasis>>
 <<domain POINT Point>>
 <<domain POLY Polynomial>>
 <<domain IDEAL PolynomialIdeals>>
@@ -83273,6 +91256,7 @@ Note that this code is not included in the generated catdef.spad file.
 <<domain RECLOS RealClosure>>
 <<domain RMATRIX RectangularMatrix>>
 <<domain REF Reference>>
+<<domain RGCHAIN RegularChain>>
 <<domain REGSET RegularTriangularSet>>
 <<domain RESRING ResidueRing>>
 <<domain RESULT Result>>
@@ -83280,6 +91264,7 @@ Note that this code is not included in the generated catdef.spad file.
 <<domain ROIRC RightOpenIntervalRootCharacterization>>
 <<domain ROMAN RomanNumeral>>
 <<domain ROUTINE RoutinesTable>>
+<<domain RULECOLD RuleCalled>>
 <<domain RULESET Ruleset>>
 
 <<domain FORMULA ScriptFormulaFormat>>
@@ -83328,11 +91313,13 @@ Note that this code is not included in the generated catdef.spad file.
 <<domain TEXTFILE TextFile>>
 <<domain SYMS TheSymbolTable>>
 <<domain M3D ThreeDimensionalMatrix>>
+<<domain VIEW3D ThreeDimensionalViewport>>
 <<domain SPACE3 ThreeSpace>>
 <<domain TREE Tree>>
 <<domain TUBE TubePlot>>
 <<domain TUPLE Tuple>>
 <<domain ARRAY2 TwoDimensionalArray>>
+<<domain VIEW2D TwoDimensionalViewport>>
 
 <<domain ULS UnivariateLaurentSeries>>
 <<domain ULSCONS UnivariateLaurentSeriesConstructor>>
@@ -83344,7 +91331,18 @@ Note that this code is not included in the generated catdef.spad file.
 <<domain UTS UnivariateTaylorSeries>>
 <<domain UNISEG UniversalSegment>>
 
+<<domain VARIABLE Variable>>
+<<domain VECTOR Vector>>
+<<domain VOID Void>>
+
+<<domain WP WeightedPolynomials>>
 <<domain WUTSET WuWenTsunTriangularSet>>
+
+<<domain XDPOLY XDistributedPolynomial>>
+<<domain XPBWPOLY XPBWPolynomial>>
+<<domain XPOLY XPolynomial>>
+<<domain XPR XPolynomialRing>>
+<<domain XRPOLY XRecursivePolynomial>>
 @
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \chapter{Index}
diff --git a/books/ps/v103anonymousfunction.ps b/books/ps/v103anonymousfunction.ps
new file mode 100644
index 0000000..41dd5d3
--- /dev/null
+++ b/books/ps/v103anonymousfunction.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 178 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 178 80
+%%PageOrientation: Portrait
+gsave
+36 36 142 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+140 42 lineto
+140 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+140 42 lineto
+140 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% AnonymousFunction
+[ /Rect [ 0 0 134 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=ANON) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 134 36 moveto
+0 36 lineto
+0 0 lineto
+134 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 134 36 moveto
+0 36 lineto
+0 0 lineto
+134 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+7 13 moveto
+(AnonymousFunction)
+[10.08 6.96 6.96 6.48 6.96 10.8 6.96 6.96 5.52 7.44 6.96 6.96 6.24 3.84 3.84 6.96 6.96]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103directproduct.ps b/books/ps/v103directproduct.ps
new file mode 100644
index 0000000..40e21f6
--- /dev/null
+++ b/books/ps/v103directproduct.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 140 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 140 80
+%%PageOrientation: Portrait
+gsave
+36 36 104 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+102 42 lineto
+102 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+102 42 lineto
+102 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% DirectProduct
+[ /Rect [ 0 0 96 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=DIRPROD) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 96 36 moveto
+0 36 lineto
+0 0 lineto
+96 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 96 36 moveto
+0 36 lineto
+0 0 lineto
+96 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+8 13 moveto
+(DirectProduct)
+[10.08 3.84 4.8 6.24 6.24 3.84 7.68 4.8 6.96 6.96 6.96 6.24 3.84]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103exit.ps b/books/ps/v103exit.ps
new file mode 100644
index 0000000..ae73ec3
--- /dev/null
+++ b/books/ps/v103exit.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 98 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 98 80
+%%PageOrientation: Portrait
+gsave
+36 36 62 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+60 42 lineto
+60 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+60 42 lineto
+60 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% Exit
+[ /Rect [ 0 0 54 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=EXIT) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 54 36 moveto
+0 36 lineto
+0 0 lineto
+54 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 54 36 moveto
+0 36 lineto
+0 0 lineto
+54 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+15 13 moveto
+(Exit)
+[8.64 6.96 3.84 3.84]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103freemodule1.ps b/books/ps/v103freemodule1.ps
new file mode 100644
index 0000000..e3a4298
--- /dev/null
+++ b/books/ps/v103freemodule1.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 136 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 136 80
+%%PageOrientation: Portrait
+gsave
+36 36 100 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+98 42 lineto
+98 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+98 42 lineto
+98 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% FreeModule1
+[ /Rect [ 0 0 92 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=FM1) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 92 36 moveto
+0 36 lineto
+0 0 lineto
+92 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 92 36 moveto
+0 36 lineto
+0 0 lineto
+92 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+8 13 moveto
+(FreeModule1)
+[7.44 4.8 6.24 6.24 12.48 6.96 6.96 6.96 3.84 6.24 6.96]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103functioncalled.ps b/books/ps/v103functioncalled.ps
new file mode 100644
index 0000000..baadc66
--- /dev/null
+++ b/books/ps/v103functioncalled.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 146 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 146 80
+%%PageOrientation: Portrait
+gsave
+36 36 110 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+108 42 lineto
+108 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+108 42 lineto
+108 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% FunctionCalled
+[ /Rect [ 0 0 102 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=FUNCTION) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 102 36 moveto
+0 36 lineto
+0 0 lineto
+102 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 102 36 moveto
+0 36 lineto
+0 0 lineto
+102 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+8 13 moveto
+(FunctionCalled)
+[7.44 6.96 6.96 6.24 3.84 3.84 6.96 6.96 9.36 6.24 3.84 3.84 6.24 6.96]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103graphimage.ps b/books/ps/v103graphimage.ps
new file mode 100644
index 0000000..dfaa833
--- /dev/null
+++ b/books/ps/v103graphimage.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 130 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 130 80
+%%PageOrientation: Portrait
+gsave
+36 36 94 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+92 42 lineto
+92 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+92 42 lineto
+92 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% GraphImage
+[ /Rect [ 0 0 86 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=GRIMAGE) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 86 36 moveto
+0 36 lineto
+0 0 lineto
+86 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 86 36 moveto
+0 36 lineto
+0 0 lineto
+86 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+8 13 moveto
+(GraphImage)
+[10.08 4.8 6.24 6.96 6.96 4.56 10.8 6.24 6.72 6.24]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103indexedvector.ps b/books/ps/v103indexedvector.ps
new file mode 100644
index 0000000..790d471
--- /dev/null
+++ b/books/ps/v103indexedvector.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 142 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 142 80
+%%PageOrientation: Portrait
+gsave
+36 36 106 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+104 42 lineto
+104 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+104 42 lineto
+104 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% IndexedVector
+[ /Rect [ 0 0 98 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=IVECTOR) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 98 36 moveto
+0 36 lineto
+0 0 lineto
+98 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 98 36 moveto
+0 36 lineto
+0 0 lineto
+98 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+7 13 moveto
+(IndexedVector)
+[4.56 6.96 6.96 5.76 6.48 6.24 6.96 8.88 6.24 6.24 3.84 6.96 4.8]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103lieexponentials.ps b/books/ps/v103lieexponentials.ps
new file mode 100644
index 0000000..f03dc12
--- /dev/null
+++ b/books/ps/v103lieexponentials.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 152 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 152 80
+%%PageOrientation: Portrait
+gsave
+36 36 116 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+114 42 lineto
+114 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+114 42 lineto
+114 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% LieExponentials
+[ /Rect [ 0 0 108 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=LEXP) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 108 36 moveto
+0 36 lineto
+0 0 lineto
+108 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 108 36 moveto
+0 36 lineto
+0 0 lineto
+108 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+8 13 moveto
+(LieExponentials)
+[8.64 3.84 6.24 8.64 6.96 6.96 6.96 6.96 6.24 6.96 3.84 3.84 6.24 3.84 5.52]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103liepolynomial.ps b/books/ps/v103liepolynomial.ps
new file mode 100644
index 0000000..b0abd5c
--- /dev/null
+++ b/books/ps/v103liepolynomial.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 142 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 142 80
+%%PageOrientation: Portrait
+gsave
+36 36 106 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+104 42 lineto
+104 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+104 42 lineto
+104 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% LiePolynomial
+[ /Rect [ 0 0 98 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=LPOLY) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 98 36 moveto
+0 36 lineto
+0 0 lineto
+98 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 98 36 moveto
+0 36 lineto
+0 0 lineto
+98 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+7 13 moveto
+(LiePolynomial)
+[8.64 3.84 6.24 7.44 6.96 3.6 6.96 6.96 6.96 10.8 3.84 6.24 3.84]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103lyndonword.ps b/books/ps/v103lyndonword.ps
new file mode 100644
index 0000000..d5bd521
--- /dev/null
+++ b/books/ps/v103lyndonword.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 134 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 134 80
+%%PageOrientation: Portrait
+gsave
+36 36 98 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+96 42 lineto
+96 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+96 42 lineto
+96 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% LyndonWord
+[ /Rect [ 0 0 90 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=LWORD) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 90 36 moveto
+0 36 lineto
+0 0 lineto
+90 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 90 36 moveto
+0 36 lineto
+0 0 lineto
+90 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+8 13 moveto
+(LyndonWord)
+[7.92 6.96 6.96 6.96 6.96 6.96 12.24 6.96 4.56 6.96]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103magma.ps b/books/ps/v103magma.ps
new file mode 100644
index 0000000..8b2aa4a
--- /dev/null
+++ b/books/ps/v103magma.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 104 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 104 80
+%%PageOrientation: Portrait
+gsave
+36 36 68 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+66 42 lineto
+66 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+66 42 lineto
+66 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% Magma
+[ /Rect [ 0 0 60 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=MAGMA) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 60 36 moveto
+0 36 lineto
+0 0 lineto
+60 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 60 36 moveto
+0 36 lineto
+0 0 lineto
+60 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+8 13 moveto
+(Magma)
+[12.48 6.24 6.96 10.8 6.24]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103orderedfreemonoid.ps b/books/ps/v103orderedfreemonoid.ps
new file mode 100644
index 0000000..49a47ac
--- /dev/null
+++ b/books/ps/v103orderedfreemonoid.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 174 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 174 80
+%%PageOrientation: Portrait
+gsave
+36 36 138 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+136 42 lineto
+136 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+136 42 lineto
+136 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% OrderedFreeMonoid
+[ /Rect [ 0 0 130 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=OFMONOID) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 130 36 moveto
+0 36 lineto
+0 0 lineto
+130 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 130 36 moveto
+0 36 lineto
+0 0 lineto
+130 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+7 13 moveto
+(OrderedFreeMonoid)
+[10.08 4.56 6.96 6.24 4.8 6.24 6.96 7.44 4.8 6.24 6.24 12.48 6.96 6.96 6.96 3.84 6.96]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103orderedvariablelist.ps b/books/ps/v103orderedvariablelist.ps
new file mode 100644
index 0000000..29af8ff
--- /dev/null
+++ b/books/ps/v103orderedvariablelist.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 174 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 174 80
+%%PageOrientation: Portrait
+gsave
+36 36 138 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+136 42 lineto
+136 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+136 42 lineto
+136 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% OrderedVariableList
+[ /Rect [ 0 0 130 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=OVAR) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 130 36 moveto
+0 36 lineto
+0 0 lineto
+130 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 130 36 moveto
+0 36 lineto
+0 0 lineto
+130 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+7 13 moveto
+(OrderedVariableList)
+[10.08 4.56 6.96 6.24 4.8 6.24 6.96 8.88 6.24 5.04 3.84 6.24 6.96 3.84 6.24 8.64 3.84 5.28 3.84]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103ordinaryweightedpolynomials.ps b/books/ps/v103ordinaryweightedpolynomials.ps
new file mode 100644
index 0000000..86eedcf
--- /dev/null
+++ b/books/ps/v103ordinaryweightedpolynomials.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 234 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 234 80
+%%PageOrientation: Portrait
+gsave
+36 36 198 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+196 42 lineto
+196 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+196 42 lineto
+196 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% OrdinaryWeightedPolynomials
+[ /Rect [ 0 0 190 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=OWP) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 190 36 moveto
+0 36 lineto
+0 0 lineto
+190 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 190 36 moveto
+0 36 lineto
+0 0 lineto
+190 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+8 13 moveto
+(OrdinaryWeightedPolynomials)
+[10.08 4.56 6.96 3.84 6.96 6.24 5.04 6.96 12.24 6.24 3.84 6.96 6.96 3.84 6.24 6.96 7.44 6.96 3.6 6.96 6.96 6.96 10.8 3.84 6.24 3.84 5.52]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103poincarebirkhoffwittlyndonbasis.ps b/books/ps/v103poincarebirkhoffwittlyndonbasis.ps
new file mode 100644
index 0000000..ecbfe76
--- /dev/null
+++ b/books/ps/v103poincarebirkhoffwittlyndonbasis.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 256 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 256 80
+%%PageOrientation: Portrait
+gsave
+36 36 220 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+218 42 lineto
+218 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+218 42 lineto
+218 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% PoincareBirkhoffWittLyndonBasis
+[ /Rect [ 0 0 212 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=PBWLB) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 212 36 moveto
+0 36 lineto
+0 0 lineto
+212 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 212 36 moveto
+0 36 lineto
+0 0 lineto
+212 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+8 13 moveto
+(PoincareBirkhoffWittLyndonBasis)
+[7.44 6.96 3.84 6.96 6.24 6.24 4.8 6.24 9.36 3.84 4.56 6.96 6.96 6.96 4.56 4.56 12.96 3.84 3.84 3.84 7.92 6.96 6.96 6.96 6.96 6.96 9.36 6.24 5.52 3.84 5.52]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103regularchain.ps b/books/ps/v103regularchain.ps
new file mode 100644
index 0000000..eba8978
--- /dev/null
+++ b/books/ps/v103regularchain.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 138 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 138 80
+%%PageOrientation: Portrait
+gsave
+36 36 102 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+100 42 lineto
+100 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+100 42 lineto
+100 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% RegularChain
+[ /Rect [ 0 0 94 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=RGCHAIN) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 94 36 moveto
+0 36 lineto
+0 0 lineto
+94 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 94 36 moveto
+0 36 lineto
+0 0 lineto
+94 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+8 13 moveto
+(RegularChain)
+[9.12 6.24 6.96 6.96 3.84 6.24 4.8 9.36 6.96 6.24 3.84 6.96]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103rulecalled.ps b/books/ps/v103rulecalled.ps
new file mode 100644
index 0000000..1819c46
--- /dev/null
+++ b/books/ps/v103rulecalled.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 122 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 122 80
+%%PageOrientation: Portrait
+gsave
+36 36 86 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+84 42 lineto
+84 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+84 42 lineto
+84 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% RuleCalled
+[ /Rect [ 0 0 78 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=RULECOLD) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 78 36 moveto
+0 36 lineto
+0 0 lineto
+78 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 78 36 moveto
+0 36 lineto
+0 0 lineto
+78 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+7 13 moveto
+(RuleCalled)
+[9.12 6.96 3.84 6.24 9.36 6.24 3.84 3.84 6.24 6.96]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103threedimensionalviewport.ps b/books/ps/v103threedimensionalviewport.ps
new file mode 100644
index 0000000..a88ca9e
--- /dev/null
+++ b/books/ps/v103threedimensionalviewport.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 216 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 216 80
+%%PageOrientation: Portrait
+gsave
+36 36 180 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+178 42 lineto
+178 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+178 42 lineto
+178 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% ThreeDimensionalViewport
+[ /Rect [ 0 0 172 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=VIEW3D) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 172 36 moveto
+0 36 lineto
+0 0 lineto
+172 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 172 36 moveto
+0 36 lineto
+0 0 lineto
+172 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+7 13 moveto
+(ThreeDimensionalViewport)
+[8.64 6.96 4.8 6.24 6.24 10.08 3.84 10.8 6.24 6.96 5.52 3.84 6.96 6.96 6.24 3.84 9.84 3.84 5.76 10.08 6.96 6.96 5.04 3.84]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103twodimensionalviewport.ps b/books/ps/v103twodimensionalviewport.ps
new file mode 100644
index 0000000..ae66b7f
--- /dev/null
+++ b/books/ps/v103twodimensionalviewport.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 208 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 208 80
+%%PageOrientation: Portrait
+gsave
+36 36 172 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+170 42 lineto
+170 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+170 42 lineto
+170 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% TwoDimensionalViewport
+[ /Rect [ 0 0 164 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=VIEW2D) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 164 36 moveto
+0 36 lineto
+0 0 lineto
+164 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 164 36 moveto
+0 36 lineto
+0 0 lineto
+164 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+8 13 moveto
+(TwoDimensionalViewport)
+[7.2 9.6 6.96 10.08 3.84 10.8 6.24 6.96 5.52 3.84 6.96 6.96 6.24 3.84 9.84 3.84 5.76 10.08 6.96 6.96 5.04 3.84]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103variable.ps b/books/ps/v103variable.ps
new file mode 100644
index 0000000..e3b18de
--- /dev/null
+++ b/books/ps/v103variable.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 108 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 108 80
+%%PageOrientation: Portrait
+gsave
+36 36 72 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+70 42 lineto
+70 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+70 42 lineto
+70 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% Variable
+[ /Rect [ 0 0 64 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=VARIABLE) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 64 36 moveto
+0 36 lineto
+0 0 lineto
+64 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 64 36 moveto
+0 36 lineto
+0 0 lineto
+64 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+7 13 moveto
+(Variable)
+[8.88 6.24 5.04 3.84 6.24 6.96 3.84 6.24]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103vector.ps b/books/ps/v103vector.ps
new file mode 100644
index 0000000..3aec492
--- /dev/null
+++ b/books/ps/v103vector.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 98 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 98 80
+%%PageOrientation: Portrait
+gsave
+36 36 62 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+60 42 lineto
+60 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+60 42 lineto
+60 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% Vector
+[ /Rect [ 0 0 54 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=VECTOR) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 54 36 moveto
+0 36 lineto
+0 0 lineto
+54 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 54 36 moveto
+0 36 lineto
+0 0 lineto
+54 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+7 13 moveto
+(Vector)
+[8.88 6.24 6.24 3.84 6.96 4.8]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103void.ps b/books/ps/v103void.ps
new file mode 100644
index 0000000..3dc3924
--- /dev/null
+++ b/books/ps/v103void.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 98 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 98 80
+%%PageOrientation: Portrait
+gsave
+36 36 62 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+60 42 lineto
+60 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+60 42 lineto
+60 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% Void
+[ /Rect [ 0 0 54 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=VOID) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 54 36 moveto
+0 36 lineto
+0 0 lineto
+54 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 54 36 moveto
+0 36 lineto
+0 0 lineto
+54 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+13 13 moveto
+(Void)
+[8.88 6.96 3.84 6.96]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103weightedpolynomials.ps b/books/ps/v103weightedpolynomials.ps
new file mode 100644
index 0000000..3dd6bf7
--- /dev/null
+++ b/books/ps/v103weightedpolynomials.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 184 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 184 80
+%%PageOrientation: Portrait
+gsave
+36 36 148 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+146 42 lineto
+146 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+146 42 lineto
+146 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% WeightedPolynomials
+[ /Rect [ 0 0 140 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=WP) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 140 36 moveto
+0 36 lineto
+0 0 lineto
+140 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 140 36 moveto
+0 36 lineto
+0 0 lineto
+140 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+8 13 moveto
+(WeightedPolynomials)
+[12.24 6.24 3.84 6.96 6.96 3.84 6.24 6.96 7.44 6.96 3.6 6.96 6.96 6.96 10.8 3.84 6.24 3.84 5.52]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103xdistributedpolynomial.ps b/books/ps/v103xdistributedpolynomial.ps
new file mode 100644
index 0000000..9dae559
--- /dev/null
+++ b/books/ps/v103xdistributedpolynomial.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 198 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 198 80
+%%PageOrientation: Portrait
+gsave
+36 36 162 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+160 42 lineto
+160 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+160 42 lineto
+160 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% XDistributedPolynomial
+[ /Rect [ 0 0 154 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=XDPOLY) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 154 36 moveto
+0 36 lineto
+0 0 lineto
+154 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 154 36 moveto
+0 36 lineto
+0 0 lineto
+154 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+8 13 moveto
+(XDistributedPolynomial)
+[10.08 10.08 3.84 5.28 3.84 5.04 3.84 6.96 6.96 3.84 6.24 6.96 7.44 6.96 3.6 6.96 6.96 6.96 10.8 3.84 6.24 3.84]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103xpbwpolynomial.ps b/books/ps/v103xpbwpolynomial.ps
new file mode 100644
index 0000000..0dfc9f8
--- /dev/null
+++ b/books/ps/v103xpbwpolynomial.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 164 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 164 80
+%%PageOrientation: Portrait
+gsave
+36 36 128 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+126 42 lineto
+126 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+126 42 lineto
+126 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% XPBWPolynomial
+[ /Rect [ 0 0 120 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=XPBWPOLY) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 120 36 moveto
+0 36 lineto
+0 0 lineto
+120 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 120 36 moveto
+0 36 lineto
+0 0 lineto
+120 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+7 13 moveto
+(XPBWPolynomial)
+[10.08 7.68 8.64 13.2 7.44 6.96 3.6 6.96 6.96 6.96 10.8 3.84 6.24 3.84]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103xpolynomial.ps b/books/ps/v103xpolynomial.ps
new file mode 100644
index 0000000..53c0e8a
--- /dev/null
+++ b/books/ps/v103xpolynomial.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 134 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 134 80
+%%PageOrientation: Portrait
+gsave
+36 36 98 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+96 42 lineto
+96 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+96 42 lineto
+96 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% XPolynomial
+[ /Rect [ 0 0 90 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=XPOLY) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 90 36 moveto
+0 36 lineto
+0 0 lineto
+90 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 90 36 moveto
+0 36 lineto
+0 0 lineto
+90 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+7 13 moveto
+(XPolynomial)
+[10.08 7.44 6.96 3.6 6.96 6.96 6.96 10.8 3.84 6.24 3.84]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103xpolynomialring.ps b/books/ps/v103xpolynomialring.ps
new file mode 100644
index 0000000..b9d47db
--- /dev/null
+++ b/books/ps/v103xpolynomialring.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 162 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 162 80
+%%PageOrientation: Portrait
+gsave
+36 36 126 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+124 42 lineto
+124 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+124 42 lineto
+124 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% XPolynomialRing
+[ /Rect [ 0 0 118 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=XPR) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 118 36 moveto
+0 36 lineto
+0 0 lineto
+118 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 118 36 moveto
+0 36 lineto
+0 0 lineto
+118 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+8 13 moveto
+(XPolynomialRing)
+[10.08 7.44 6.96 3.6 6.96 6.96 6.96 10.8 3.84 6.24 3.84 9.36 3.84 6.96 6.96]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103xrecursivepolynomial.ps b/books/ps/v103xrecursivepolynomial.ps
new file mode 100644
index 0000000..404fe03
--- /dev/null
+++ b/books/ps/v103xrecursivepolynomial.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 190 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 190 80
+%%PageOrientation: Portrait
+gsave
+36 36 154 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+152 42 lineto
+152 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+152 42 lineto
+152 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% XRecursivePolynomial
+[ /Rect [ 0 0 146 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=XRPOLY) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 146 36 moveto
+0 36 lineto
+0 0 lineto
+146 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 146 36 moveto
+0 36 lineto
+0 0 lineto
+146 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+7 13 moveto
+(XRecursivePolynomial)
+[10.08 9.12 6.24 6.24 6.96 4.8 5.52 3.84 6.48 6.24 7.44 6.96 3.6 6.96 6.96 6.96 10.8 3.84 6.24 3.84]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/changelog b/changelog
index 43b0db7..347c07b 100644
--- a/changelog
+++ b/changelog
@@ -1,3 +1,49 @@
+20081216 tpd src/axiom-website/patches.html 20081216.04.tpd.patch
+20081216 tpd books/ps/v103anonymousfunction.ps added
+20081216 tpd books/ps/v103directproduct.ps added
+20081216 tpd books/ps/v103exit.ps added
+20081216 tpd books/ps/v103freemodule1.ps added
+20081216 tpd books/ps/v103functioncalled.ps added
+20081216 tpd books/ps/v103graphimage.ps added
+20081216 tpd books/ps/v103indexedvector.ps added
+20081216 tpd books/ps/v103lieexponentials.ps added
+20081216 tpd books/ps/v103liepolynomial.ps added
+20081216 tpd books/ps/v103lyndonword.ps added
+20081216 tpd books/ps/v103magma.ps added
+20081216 tpd books/ps/v103orderedfreemonoid.ps added
+20081216 tpd books/ps/v103orderedvariablelist.ps added
+20081216 tpd books/ps/v103ordinaryweightedpolynomials.ps added
+20081216 tpd books/ps/v103poincarebirkhoffwittlyndonbasis.ps added
+20081216 tpd books/ps/v103regularchain.ps added
+20081216 tpd books/ps/v103rulecalled.ps added
+20081216 tpd books/ps/v103threedimensionalviewport.ps added
+20081216 tpd books/ps/v103twodimensionalviewport.ps added
+20081216 tpd books/ps/v103variable.ps added
+20081216 tpd books/ps/v103vector.ps added
+20081216 tpd books/ps/v103void.ps added
+20081216 tpd books/ps/v103weightedpolynomials.ps added
+20081216 tpd books/ps/v103xdistributedpolynomial.ps added
+20081216 tpd books/ps/v103xpbwpolynomial.ps added
+20081216 tpd books/ps/v103xpolynomial.ps added
+20081216 tpd books/ps/v103xpolynomialring.ps added
+20081216 tpd books/ps/v103xrecursivepolynomial.ps added
+20081216 tpd books/bookvol10.3 add domains
+20081216 tpd src/algebra/zerodim.spad move domain to bookvol10.3
+20081216 tpd src/algebra/Makefile fixed help
+20081216 tpd src/algebra/xpoly.spad removed, move domains to bookvol10.3
+20081216 tpd src/algebra/xlpoly.spad move domains to bookvol10.3
+20081216 tpd src/algebra/Makefile remove wtpol.spad
+20081216 tpd src/algebra/wtpol.spad removed, move domains to bookvol10.3
+20081216 tpd src/algebra/Makefile fixup help
+20081216 tpd src/algebra/void.spad move domains to bookvol10.3
+20081216 tpd src/algebra/Makefile remove view3d
+20081216 tpd src/algebra/view3d.spad removed, moved domains to bookvol10.3
+20081216 tpd src/algebra/Makefile remove view2d, fixup help
+20081216 tpd src/algebra/view2d.spad removed, moved domains to bookvol10.3
+20081216 tpd src/algebra/Makefile fixup help
+20081216 tpd src/algebra/vector.spad move domains to bookvol10.3
+20081216 tpd src/algebra/Makefile remove variable.spad
+20081216 tpd src/algebra/variable.spad removed, move domains to bookvol10.3
 20081216 tpd src/axiom-website/patches.html 20081216.03.tpd.patch
 20081216 tpd books/bookvol10.3 add domains
 20081216 tpd books/ps/v103wuwentsuntriangularset.ps added
diff --git a/src/algebra/Makefile.pamphlet b/src/algebra/Makefile.pamphlet
index 1c80278..22de514 100644
--- a/src/algebra/Makefile.pamphlet
+++ b/src/algebra/Makefile.pamphlet
@@ -415,8 +415,6 @@ ore.spad.pamphlet (OREPCAT APPLYORE AUTOMOR OREPCTO ORESUP OREUP)
 stream.spad.pamphlet (LZSTAGG CSTTOOLS STREAM STREAM1 STREAM2 STREAM3)
 xlpoly.spad.pamphlet (MAGMA LWORD LIECAT FLALG XEXPPKG LPOLY PBWLB XPBWPOLY
                       LEXP)
-xpoly.spad.pamphlet (OFMONOID FMCAT FM1 XALG XFALG XPOLYC XPR XDPOLY XRPOLY
-                     XPOLY)
 \end{verbatim}
 
 <<layer11>>=
@@ -561,10 +559,8 @@ updecomp.spad.pamphlet (UPDECOMP)
 updivp.spad.pamphlet (UPDIVP)
 viewdef.spad.pamphlet (VIEWDEF)
 vector.spad.pamphlet (VECTCAT IVECTOR VECTOR VECTOR2 DIRPCAT DIRPROD DIRPROD2)
-view2d.spad.pamphlet (GRIMAGE VIEW2D)
 void.spad.pamphlet (VOID EXIT)
 weier.spad.pamphlet (WEIER)
-wtpol.spad.pamphlet (WP OWP)
 \end{verbatim}
 
 <<layer14>>=
@@ -675,7 +671,6 @@ padiclib.spad.pamphlet (IBPTOOLS IBACHIN PWFFINTB)
 permgrps.spad.pamphlet (PERMGRP PGE)
 random.spad.pamphlet (RANDSRC RDIST INTBIT RIDIST RFDIST)
 sgcf.spad.pamphlet (SGCF)
-view3d.spad.pamphlet (VIEW3D)
 \end{verbatim}
 
 <<layer17>>=
@@ -751,7 +746,6 @@ s.spad.pamphlet (NAGS)
 seg.spad.pamphlet (SEGCAT SEGXCAT SEG SEG2 SEGBIND SETBIND2 UNISEG UNISEG2
                    INCRMAPS)
 syssolp.spad.pamphlet (SYSSOLP)
-variable.spad.pamphlet (OVAR VARIABLE RULECOLD FUNCTION ANON)
 \end{verbatim}
 
 <<layer19>>=
@@ -1206,11 +1200,11 @@ SPADFILES= \
  ${OUTSRC}/tube.spad ${OUTSRC}/twofact.spad \
  ${OUTSRC}/unifact.spad ${OUTSRC}/updecomp.spad ${OUTSRC}/updivp.spad \
  ${OUTSRC}/utsode.spad \
- ${OUTSRC}/variable.spad ${OUTSRC}/vector.spad ${OUTSRC}/view2d.spad \
- ${OUTSRC}/view3d.spad ${OUTSRC}/viewdef.spad ${OUTSRC}/viewpack.spad \
+ ${OUTSRC}/vector.spad  \
+ ${OUTSRC}/viewdef.spad ${OUTSRC}/viewpack.spad \
  ${OUTSRC}/void.spad \
- ${OUTSRC}/weier.spad ${OUTSRC}/wtpol.spad \
- ${OUTSRC}/xlpoly.spad ${OUTSRC}/xpoly.spad \
+ ${OUTSRC}/weier.spad \
+ ${OUTSRC}/xlpoly.spad  \
  ${OUTSRC}/ystream.spad \
  ${OUTSRC}/zerodim.spad
 
@@ -1358,11 +1352,11 @@ DOCFILES= \
  ${DOC}/tube.spad.dvi ${DOC}/twofact.spad.dvi \
  ${DOC}/unifact.spad.dvi ${DOC}/updecomp.spad.dvi ${DOC}/updivp.spad.dvi \
  ${DOC}/utsode.spad.dvi \
- ${DOC}/variable.spad.dvi ${DOC}/vector.spad.dvi ${DOC}/view2d.spad.dvi \
- ${DOC}/view3d.spad.dvi ${DOC}/viewdef.spad.dvi ${DOC}/viewpack.spad.dvi \
+ ${DOC}/vector.spad.dvi  \
+ ${DOC}/viewdef.spad.dvi ${DOC}/viewpack.spad.dvi \
  ${DOC}/void.spad.dvi \
- ${DOC}/weier.spad.dvi ${DOC}/wtpol.spad.dvi \
- ${DOC}/xlpoly.spad.dvi ${DOC}/xpoly.spad.dvi \
+ ${DOC}/weier.spad.dvi \
+ ${DOC}/xlpoly.spad.dvi  \
  ${DOC}/ystream.spad.dvi \
  ${DOC}/zerodim.spad.dvi
 
@@ -2479,20 +2473,21 @@ ${HELP}/Library.help: ${BOOKS}/bookvol10.3.pamphlet
 	@${TANGLE} -R"Library.input" ${BOOKS}/bookvol10.3.pamphlet \
             >${INPUT}/Library.input
 
-${HELP}/LieExponentials.help: ${IN}/xlpoly.spad.pamphlet
-	@echo 7040 create LieExponentials.help from ${IN}/xlpoly.spad.pamphlet
-	@${TANGLE} -R"LieExponentials.help" ${IN}/xlpoly.spad.pamphlet \
+${HELP}/LieExponentials.help: ${BOOKS}/bookvol10.3.pamphlet
+	@echo 7040 create LieExponentials.help from \
+           ${BOOKS}/bookvol10.3.pamphlet
+	@${TANGLE} -R"LieExponentials.help" ${BOOKS}/bookvol10.3.pamphlet \
            >${HELP}/LieExponentials.help
 	@cp ${HELP}/LieExponentials.help ${HELP}/LEXP.help
-	@${TANGLE} -R"LieExponentials.input" ${IN}/xlpoly.spad.pamphlet \
+	@${TANGLE} -R"LieExponentials.input" ${BOOKS}/bookvol10.3.pamphlet \
             >${INPUT}/LieExponentials.input
 
-${HELP}/LiePolynomial.help: ${IN}/xlpoly.spad.pamphlet
-	@echo 7041 create LiePolynomial.help from ${IN}/xlpoly.spad.pamphlet
-	@${TANGLE} -R"LiePolynomial.help" ${IN}/xlpoly.spad.pamphlet \
+${HELP}/LiePolynomial.help: ${BOOKS}/bookvol10.3.pamphlet
+	@echo 7041 create LiePolynomial.help from ${BOOKS}/bookvol10.3.pamphlet
+	@${TANGLE} -R"LiePolynomial.help" ${BOOKS}/bookvol10.3.pamphlet \
            >${HELP}/LiePolynomial.help
 	@cp ${HELP}/LiePolynomial.help ${HELP}/LPOLY.help
-	@${TANGLE} -R"LiePolynomial.input" ${IN}/xlpoly.spad.pamphlet \
+	@${TANGLE} -R"LiePolynomial.input" ${BOOKS}/bookvol10.3.pamphlet \
             >${INPUT}/LiePolynomial.input
 
 ${HELP}/LinearOrdinaryDifferentialOperator.help: ${BOOKS}/bookvol10.3.pamphlet
@@ -2538,20 +2533,20 @@ ${HELP}/List.help: ${BOOKS}/bookvol10.3.pamphlet
 	@${TANGLE} -R"List.input" ${BOOKS}/bookvol10.3.pamphlet \
             >${INPUT}/List.input
 
-${HELP}/LyndonWord.help: ${IN}/xlpoly.spad.pamphlet
-	@echo 7046 create LyndonWord.help from ${IN}/xlpoly.spad.pamphlet
-	@${TANGLE} -R"LyndonWord.help" ${IN}/xlpoly.spad.pamphlet \
+${HELP}/LyndonWord.help: ${BOOKS}/bookvol10.3.pamphlet
+	@echo 7046 create LyndonWord.help from ${BOOKS}/bookvol10.3.pamphlet
+	@${TANGLE} -R"LyndonWord.help" ${BOOKS}/bookvol10.3.pamphlet \
             >${HELP}/LyndonWord.help
 	@cp ${HELP}/LyndonWord.help ${HELP}/LWORD.help
-	@${TANGLE} -R"LyndonWord.input" ${IN}/xlpoly.spad.pamphlet \
+	@${TANGLE} -R"LyndonWord.input" ${BOOKS}/bookvol10.3.pamphlet \
             >${INPUT}/LyndonWord.input
 
-${HELP}/Magma.help: ${IN}/xlpoly.spad.pamphlet
-	@echo 7047 create Magma.help from ${IN}/xlpoly.spad.pamphlet
-	@${TANGLE} -R"Magma.help" ${IN}/xlpoly.spad.pamphlet \
+${HELP}/Magma.help: ${BOOKS}/bookvol10.3.pamphlet 
+	@echo 7047 create Magma.help from ${BOOKS}/bookvol10.3.pamphlet 
+	@${TANGLE} -R"Magma.help" ${BOOKS}/bookvol10.3.pamphlet  \
             >${HELP}/Magma.help
 	@-cp ${HELP}/Magma.help ${HELP}/MAGMA.help
-	@${TANGLE} -R"Magma.input" ${IN}/xlpoly.spad.pamphlet \
+	@${TANGLE} -R"Magma.input" ${BOOKS}/bookvol10.3.pamphlet  \
             >${INPUT}/Magma.input
 
 ${HELP}/MakeFunction.help: ${IN}/mkfunc.spad.pamphlet
@@ -2647,13 +2642,15 @@ ${HELP}/Operator.help: ${BOOKS}/bookvol10.3.pamphlet
 	@${TANGLE} -R"Operator.input" ${BOOKS}/bookvol10.3.pamphlet \
             >${INPUT}/Operator.input
 
-${HELP}/OrderedVariableList.help: ${IN}/variable.spad.pamphlet
+${HELP}/OrderedVariableList.help: ${BOOKS}/bookvol10.3.pamphlet
 	@echo 7059 create OrderedVariableList.help from \
-           ${IN}/variable.spad.pamphlet
-	@${TANGLE} -R"OrderedVariableList.help" ${IN}/variable.spad.pamphlet \
+           ${BOOKS}/bookvol10.3.pamphlet
+	@${TANGLE} -R"OrderedVariableList.help" \
+           ${BOOKS}/bookvol10.3.pamphlet \
            >${HELP}/OrderedVariableList.help
 	@cp ${HELP}/OrderedVariableList.help ${HELP}/OVAR.help
-	@${TANGLE} -R"OrderedVariableList.input" ${IN}/variable.spad.pamphlet \
+	@${TANGLE} -R"OrderedVariableList.input" \
+            ${BOOKS}/bookvol10.3.pamphlet \
             >${INPUT}/OrderedVariableList.input
 
 ${HELP}/OrderlyDifferentialPolynomial.help: ${BOOKS}/bookvol10.3.pamphlet
@@ -2889,11 +2886,11 @@ ${HELP}/TwoDimensionalArray.help: ${BOOKS}/bookvol10.3.pamphlet
             ${BOOKS}/bookvol10.3.pamphlet \
             >${INPUT}/TwoDimensionalArray.input
 
-${HELP}/TwoDimensionalViewport.help: ${IN}/view2d.spad.pamphlet
+${HELP}/TwoDimensionalViewport.help: ${BOOKS}/bookvol10.3.pamphlet
 	@echo 7085 create TwoDimensionalViewport.help from \
-           ${IN}/view2d.spad.pamphlet
+           ${BOOKS}/bookvol10.3.pamphlet
 	@${TANGLE} -R"TwoDimensionalViewport.help" \
-           ${IN}/view2d.spad.pamphlet \
+           ${BOOKS}/bookvol10.3.pamphlet \
            >${HELP}/TwoDimensionalViewport.help 
 	@cp ${HELP}/TwoDimensionalViewport.help ${HELP}/VIEW2D.help
 # Note:no input regression file due to graphics
@@ -2918,19 +2915,21 @@ ${HELP}/UniversalSegment.help: ${BOOKS}/bookvol10.3.pamphlet
 	@${TANGLE} -R"UniversalSegment.input" ${BOOKS}/bookvol10.3.pamphlet \
             >${INPUT}/UniversalSegment.input
 
-${HELP}/Vector.help: ${IN}/vector.spad.pamphlet
-	@echo 7088 create Vector.help from ${IN}/vector.spad.pamphlet
-	@${TANGLE} -R"Vector.help" ${IN}/vector.spad.pamphlet \
+${HELP}/Vector.help: ${BOOKS}/bookvol10.3.pamphlet
+	@echo 7088 create Vector.help from ${BOOKS}/bookvol10.3.pamphlet
+	@${TANGLE} -R"Vector.help" ${BOOKS}/bookvol10.3.pamphlet \
            >${HELP}/Vector.help
 	@-cp ${HELP}/Vector.help ${HELP}/VECTOR.help
-	@${TANGLE} -R"Vector.input" ${IN}/vector.spad.pamphlet \
+	@${TANGLE} -R"Vector.input" ${BOOKS}/bookvol10.3.pamphlet \
             >${INPUT}/Vector.input
 
-${HELP}/Void.help: ${IN}/void.spad.pamphlet
-	@echo 7089 create Void.help from ${IN}/void.spad.pamphlet
-	@${TANGLE} -R"Void.help" ${IN}/void.spad.pamphlet >${HELP}/Void.help
+${HELP}/Void.help: ${BOOKS}/bookvol10.3.pamphlet
+	@echo 7089 create Void.help from ${BOOKS}/bookvol10.3.pamphlet
+	@${TANGLE} -R"Void.help" ${BOOKS}/bookvol10.3.pamphlet \
+            >${HELP}/Void.help
 	@-cp ${HELP}/Void.help ${HELP}/VOID.help
-	@${TANGLE} -R"Void.input" ${IN}/void.spad.pamphlet >${INPUT}/Void.input
+	@${TANGLE} -R"Void.input" ${BOOKS}/bookvol10.3.pamphlet \
+            >${INPUT}/Void.input
 
 ${HELP}/WuWenTsunTriangularSet.help: ${BOOKS}/bookvol10.3.pamphlet
 	@echo 7090 create WuWenTsunTriangularSet.help from \
@@ -2943,31 +2942,32 @@ ${HELP}/WuWenTsunTriangularSet.help: ${BOOKS}/bookvol10.3.pamphlet
             ${BOOKS}/bookvol10.3.pamphlet \
             >${INPUT}/WuWenTsunTriangularSet.input
 
-${HELP}/XPBWPolynomial.help: ${IN}/xlpoly.spad.pamphlet
+${HELP}/XPBWPolynomial.help: ${BOOKS}/bookvol10.3.pamphlet
 	@echo 7091 create XPBWPolynomial.help from \
-           ${IN}/xlpoly.spad.pamphlet
+           ${BOOKS}/bookvol10.3.pamphlet
 	@${TANGLE} -R"XPBWPolynomial.help" \
-           ${IN}/xlpoly.spad.pamphlet \
+           ${BOOKS}/bookvol10.3.pamphlet \
            >${HELP}/XPBWPolynomial.help
 	@cp ${HELP}/XPBWPolynomial.help ${HELP}/XPBWPOLY.help
 	@${TANGLE} -R"XPBWPolynomial.input" \
-            ${IN}/xlpoly.spad.pamphlet \
+            ${BOOKS}/bookvol10.3.pamphlet \
             >${INPUT}/XPBWPolynomial.input
 
-${HELP}/XPolynomial.help: ${IN}/xpoly.spad.pamphlet
-	@echo 7092 create XPolynomial.help from ${IN}/xpoly.spad.pamphlet
-	@${TANGLE} -R"XPolynomial.help" ${IN}/xpoly.spad.pamphlet \
+${HELP}/XPolynomial.help: ${BOOKS}/bookvol10.3.pamphlet
+	@echo 7092 create XPolynomial.help from ${BOOKS}/bookvol10.3.pamphlet
+	@${TANGLE} -R"XPolynomial.help" ${BOOKS}/bookvol10.3.pamphlet \
            >${HELP}/XPolynomial.help
 	@cp ${HELP}/XPolynomial.help ${HELP}/XPOLY.help
-	@${TANGLE} -R"XPolynomial.input" ${IN}/xpoly.spad.pamphlet \
+	@${TANGLE} -R"XPolynomial.input" ${BOOKS}/bookvol10.3.pamphlet \
             >${INPUT}/XPolynomial.input
 
-${HELP}/XPolynomialRing.help: ${IN}/xpoly.spad.pamphlet
-	@echo 7093 create XPolynomialRing.help from ${IN}/xpoly.spad.pamphlet
-	@${TANGLE} -R"XPolynomialRing.help" ${IN}/xpoly.spad.pamphlet \
+${HELP}/XPolynomialRing.help: ${BOOKS}/bookvol10.3.pamphlet
+	@echo 7093 create XPolynomialRing.help from \
+           ${BOOKS}/bookvol10.3.pamphlet
+	@${TANGLE} -R"XPolynomialRing.help" ${BOOKS}/bookvol10.3.pamphlet \
            >${HELP}/XPolynomialRing.help
 	@cp ${HELP}/XPolynomialRing.help ${HELP}/XPR.help
-	@${TANGLE} -R"XPolynomialRing.input" ${IN}/xpoly.spad.pamphlet \
+	@${TANGLE} -R"XPolynomialRing.input" ${BOOKS}/bookvol10.3.pamphlet \
             >${INPUT}/XPolynomialRing.input
 
 ${HELP}/ZeroDimensionalSolvePackage.help: ${IN}/zerodim.spad.pamphlet
diff --git a/src/algebra/variable.spad.pamphlet b/src/algebra/variable.spad.pamphlet
deleted file mode 100644
index e9e5f02..0000000
--- a/src/algebra/variable.spad.pamphlet
+++ /dev/null
@@ -1,241 +0,0 @@
-\documentclass{article}
-\usepackage{axiom}
-\begin{document}
-\title{\$SPAD/src/algebra variable.spad}
-\author{The Axiom Team}
-\maketitle
-\begin{abstract}
-\end{abstract}
-\eject
-\tableofcontents
-\eject
-\section{domain OVAR OrderedVariableList}
-<<OrderedVariableList.input>>=
--- variable.spad.pamphlet OrderedVariableList.input
-)spool OrderedVariableList.output
-)set message test on
-)set message auto off
-)clear all
---S 1
-ls:List Symbol:=['x,'a,'z]
---R 
---R
---R   (1)  [x,a,z]
---R                                                            Type: List Symbol
---E 1
-
---S 2
-Z:=OVAR ls
---R 
---R
---R   (2)  OrderedVariableList [x,a,z]
---R                                                                 Type: Domain
---E 2
-
---S 3
-size()$Z
---R 
---R
---R   (3)  3
---R                                                     Type: NonNegativeInteger
---E 3
-
---S 4
-lv:=[index(i::PI)$Z for i in 1..size()$Z]
---R 
---I   Compiling function G1408 with type Integer -> Boolean 
---I   Compiling function G1572 with type NonNegativeInteger -> Boolean 
---R
---R   (4)  [x,a,z]
---R                                       Type: List OrderedVariableList [x,a,z]
---E 4
-
---S 5
-sorted?(>,lv)
---R 
---R
---R   (5)  true
---R                                                                Type: Boolean
---E 5
-)spool
-)lisp (bye)
-@
-<<OrderedVariableList.help>>=
-====================================================================
-OrderedVariableList examples
-====================================================================
-
-The domain OrderedVariableList provides symbols which are restricted
-to a particular list and have a definite ordering. Those two features
-are specified by a List Symbol object that is the argument to the
-domain.
-
-This is a sample ordering of three symbols.
-
-  ls:List Symbol:=['x,'a,'z]
-    [x,a,z]
-                                Type: List Symbol
-
-Let's build the domain
-
-  Z:=OVAR ls
-    OrderedVariableList [x,a,z]
-                                Type: Domain
-
-How many variables does it have?
-
-  size()$Z
-    3
-                                Type: NonNegativeInteger
-
-They are (in the imposed order)
-
-  lv:=[index(i::PI)$Z for i in 1..size()$Z]
-    [x,a,z]
-                                Type: List OrderedVariableList [x,a,z]
-
-Check that the ordering is right
-
-  sorted?(>,lv)
-    true
-                                Type: Boolean
-
-See Also:
-o )show OrderedVariableList
-o $AXIOM/doc/src/algebra/variable.spad.dvi
-
-@
-<<domain OVAR OrderedVariableList>>=
-)abbrev domain OVAR OrderedVariableList
-++ Description:
-++ This domain implements ordered variables
-OrderedVariableList(VariableList:List Symbol):
-  Join(OrderedFinite, ConvertibleTo Symbol, ConvertibleTo InputForm,
-       ConvertibleTo Pattern Float, ConvertibleTo Pattern Integer) with
-         variable: Symbol -> Union(%,"failed")
-		++ variable(s) returns a member of the variable set or failed
-    == add
-       VariableList := removeDuplicates VariableList
-       Rep := PositiveInteger
-       s1,s2:%
-       convert(s1):Symbol == VariableList.((s1::Rep)::PositiveInteger)
-       coerce(s1):OutputForm == (convert(s1)@Symbol)::OutputForm
-       convert(s1):InputForm == convert(convert(s1)@Symbol)
-       convert(s1):Pattern(Integer) == convert(convert(s1)@Symbol)
-       convert(s1):Pattern(Float) == convert(convert(s1)@Symbol)
-       index i   == i::%
-       lookup j  == j :: Rep
-       size ()   == #VariableList
-       variable(exp:Symbol) ==
-            for i in 1.. for exp2 in VariableList repeat
-                if exp=exp2 then return i::PositiveInteger::%
-            "failed"
-       s1 < s2 == s2 <$Rep s1
-       s1 = s2 == s1 =$Rep s2
-       latex(x:%):String      == latex(convert(x)@Symbol)
-
-@
-\section{domain VARIABLE Variable}
-<<domain VARIABLE Variable>>=
-)abbrev domain VARIABLE Variable
-++ Description:
-++ This domain implements variables
-Variable(sym:Symbol): Join(SetCategory, CoercibleTo Symbol) with
-        coerce  : % -> Symbol
-		++ coerce(x) returns the symbol
-        variable: () -> Symbol
-		++ variable() returns the symbol
-    == add
-        coerce(x:%):Symbol     == sym
-        coerce(x:%):OutputForm == sym::OutputForm
-        variable()             == sym
-        x = y                  == true
-        latex(x:%):String      == latex sym
-
-@
-\section{domain RULECOLD RuleCalled}
-<<domain RULECOLD RuleCalled>>=
-)abbrev domain RULECOLD RuleCalled
-++ Description:
-++ This domain implements named rules 
-RuleCalled(f:Symbol): SetCategory with 
-	name: % -> Symbol 
-		++ name(x) returns the symbol
- == add
-  name r                 == f
-  coerce(r:%):OutputForm == f::OutputForm
-  x = y                  == true
-  latex(x:%):String      == latex f
-
-@
-\section{domain FUNCTION FunctionCalled}
-<<domain FUNCTION FunctionCalled>>=
-)abbrev domain FUNCTION FunctionCalled
-++ Description:
-++ This domain implements named functions
-FunctionCalled(f:Symbol): SetCategory with 
-	name: % -> Symbol 
-		++ name(x) returns the symbol
-  == add
-   name r                 == f
-   coerce(r:%):OutputForm == f::OutputForm
-   x = y                  == true
-   latex(x:%):String      == latex f
-
-@
-\section{domain ANON AnonymousFunction}
-<<domain ANON AnonymousFunction>>=
-)abbrev domain ANON AnonymousFunction
-++ Description:
-++ This domain implements anonymous functions
-AnonymousFunction():SetCategory == add
-  coerce(x:%):OutputForm == x pretend OutputForm
-
-@
-\section{License}
-<<license>>=
---Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd.
---All rights reserved.
---
---Redistribution and use in source and binary forms, with or without
---modification, are permitted provided that the following conditions are
---met:
---
---    - Redistributions of source code must retain the above copyright
---      notice, this list of conditions and the following disclaimer.
---
---    - Redistributions in binary form must reproduce the above copyright
---      notice, this list of conditions and the following disclaimer in
---      the documentation and/or other materials provided with the
---      distribution.
---
---    - Neither the name of The Numerical ALgorithms Group Ltd. nor the
---      names of its contributors may be used to endorse or promote products
---      derived from this software without specific prior written permission.
---
---THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
---IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
---TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
---PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
---OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
---EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
---PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
---PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
---LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
---NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
---SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-@
-<<*>>=
-<<license>>
-
-<<domain VARIABLE Variable>>
-<<domain RULECOLD RuleCalled>>
-<<domain FUNCTION FunctionCalled>>
-<<domain OVAR OrderedVariableList>>
-<<domain ANON AnonymousFunction>>
-@
-\eject
-\begin{thebibliography}{99}
-\bibitem{1} nothing
-\end{thebibliography}
-\end{document}
diff --git a/src/algebra/vector.spad.pamphlet b/src/algebra/vector.spad.pamphlet
index 23b3443..1837bd4 100644
--- a/src/algebra/vector.spad.pamphlet
+++ b/src/algebra/vector.spad.pamphlet
@@ -9,275 +9,6 @@
 \eject
 \tableofcontents
 \eject
-\section{domain IVECTOR IndexedVector}
-<<domain IVECTOR IndexedVector>>=
-)abbrev domain IVECTOR IndexedVector
-++ Author:
-++ Date Created:
-++ Date Last Updated:
-++ Basic Functions:
-++ Related Constructors: Vector, DirectProduct
-++ Also See:
-++ AMS Classifications:
-++ Keywords:
-++ References:
-++ Description:
-++   This type represents vector like objects with varying lengths
-++ and a user-specified initial index.
- 
-IndexedVector(R:Type, mn:Integer):
-  VectorCategory R == IndexedOneDimensionalArray(R, mn)
- 
-@
-\section{domain VECTOR Vector}
-<<Vector.input>>=
--- vector.spad.pamphlet Vector.input
-)spool Vector.output
-)set message test on
-)set message auto off
-)clear all
---S 1 of 11
-u : VECTOR INT := new(5,12)
---R 
---R
---R   (1)  [12,12,12,12,12]
---R                                                         Type: Vector Integer
---E 1
-
---S 2 of 11
-v : VECTOR INT := vector([1,2,3,4,5])
---R 
---R
---R   (2)  [1,2,3,4,5]
---R                                                         Type: Vector Integer
---E 2
-
---S 3 of 11
-#(v)
---R 
---R
---R   (3)  5
---R                                                        Type: PositiveInteger
---E 3
-
---S 4 of 11
-v.2
---R 
---R
---R   (4)  2
---R                                                        Type: PositiveInteger
---E 4
-
---S 5 of 11
-v.3 := 99
---R 
---R
---R   (5)  99
---R                                                        Type: PositiveInteger
---E 5
-
---S 6 of 11
-v
---R 
---R
---R   (6)  [1,2,99,4,5]
---R                                                         Type: Vector Integer
---E 6
-
---S 7 of 11
-5 * v
---R 
---R
---R   (7)  [5,10,495,20,25]
---R                                                         Type: Vector Integer
---E 7
-
---S 8 of 11
-v * 7
---R 
---R
---R   (8)  [7,14,693,28,35]
---R                                                         Type: Vector Integer
---E 8
-
---S 9 of 11
-w : VECTOR INT := vector([2,3,4,5,6])
---R 
---R
---R   (9)  [2,3,4,5,6]
---R                                                         Type: Vector Integer
---E 9
-
---S 10 of 11
-v + w
---R 
---R
---R   (10)  [3,5,103,9,11]
---R                                                         Type: Vector Integer
---E 10
-
---S 11 of 11
-v - w
---R 
---R
---R   (11)  [- 1,- 1,95,- 1,- 1]
---R                                                         Type: Vector Integer
---E 11
-)spool
-)lisp (bye)
-@
-<<Vector.help>>=
-====================================================================
-Vector examples
-====================================================================
-
-The Vector domain is used for storing data in a one-dimensional
-indexed data structure.  A vector is a homogeneous data structure in
-that all the components of the vector must belong to the same Axiom
-domain.  Each vector has a fixed length specified by the user; vectors
-are not extensible.  This domain is similar to the OneDimensionalArray
-domain, except that when the components of a Vector belong to a Ring,
-arithmetic operations are provided.
-
-As with the OneDimensionalArray domain, a Vector can be created by
-calling the operation new, its components can be accessed by calling
-the operations elt and qelt, and its components can be reset by
-calling the operations setelt and qsetelt.
-
-This creates a vector of integers of length 5 all of whose components are 12.
-
-  u : VECTOR INT := new(5,12)
-    [12,12,12,12,12]
-                                Type: Vector Integer
-
-This is how you create a vector from a list of its components.
-
-  v : VECTOR INT := vector([1,2,3,4,5])
-    [1,2,3,4,5]
-                                Type: Vector Integer
-
-Indexing for vectors begins at 1.  The last element has index equal to
-the length of the vector, which is computed by #.
-
- #(v)
-    5
-                                Type: PositiveInteger
-
-This is the standard way to use elt to extract an element.
-Functionally, it is the same as if you had typed elt(v,2).
-
-  v.2
-    2
-                                Type: PositiveInteger
-
-This is the standard way to use setelt to change an element.  It is
-the same as if you had typed setelt(v,3,99).
-
-  v.3 := 99
-    99
-                                Type: PositiveInteger
-
-Now look at v to see the change.  You can use qelt and qsetelt
-(instead of elt and setelt, respectively) but only when you know that
-the index is within the valid range.
-
-  v
-    [1,2,99,4,5]
-                                Type: Vector Integer
-
-When the components belong to a Ring, Axiom provides arithmetic
-operations for Vector.  These include left and right scalar multiplication.
-
-  5 * v
-    [5,10,495,20,25]
-                                Type: Vector Integer
-
-  v * 7
-    [7,14,693,28,35]
-                                Type: Vector Integer
-
-  w : VECTOR INT := vector([2,3,4,5,6])
-    [2,3,4,5,6]
-                                Type: Vector Integer
-
-Addition and subtraction are also available.
-
-  v + w
-    [3,5,103,9,11]
-                                Type: Vector Integer
-
-Of course, when adding or subtracting, the two vectors must have the same
-length or an error message is displayed.
-
-  v - w
-    [- 1,- 1,95,- 1,- 1]
-                                Type: Vector Integer
-
-See Also:
-o )help List
-o )help Matrix
-o )help OneDimensionalArray
-o )help Set
-o )help Table
-o )help TwoDimensionalArray
-o )show Vector
-o $AXIOM/doc/src/algebra/vector.spad.dvi
-
-@
-<<domain VECTOR Vector>>=
-)abbrev domain VECTOR Vector
-++ Author:
-++ Date Created:
-++ Date Last Updated:
-++ Basic Functions:
-++ Related Constructors: IndexedVector, DirectProduct
-++ Also See:
-++ AMS Classifications:
-++ Keywords:
-++ References:
-++ Description:
-++ This type represents vector like objects with varying lengths
-++ and indexed by a finite segment of integers starting at 1.
- 
-Vector(R:Type): Exports == Implementation where
- VECTORMININDEX ==> 1       -- if you want to change this, be my guest
-
- Exports ==> VectorCategory R with 
-   vector: List R -> %
-     ++ vector(l) converts the list l to a vector.
- Implementation ==>
-  IndexedVector(R, VECTORMININDEX) add 
-     vector l == construct l
-     if R has ConvertibleTo InputForm then
-       convert(x:%):InputForm ==
-          convert [convert("vector"::Symbol)@InputForm,
-                          convert(parts x)@InputForm]
-
-@
-\section{VECTOR.lsp BOOTSTRAP} 
-{\bf VECTOR} depends on itself.
-We need to break this cycle to build the algebra. So we keep a
-cached copy of the translated {\bf VECTOR} category which we can write
-into the {\bf MID} directory. We compile the lisp code and copy the
-{\bf VECTOR.o} file to the {\bf OUT} directory.  This is eventually
-forcibly replaced by a recompiled version.
-
-Note that this code is not included in the generated catdef.spad file.
-
-<<VECTOR.lsp BOOTSTRAP>>=
-
-(|/VERSIONCHECK| 2) 
-
-(DEFUN |VECTOR;vector;L$;1| (|l| |$|) (SPADCALL |l| (QREFELT |$| 8))) 
-
-(DEFUN |VECTOR;convert;$If;2| (|x| |$|) (SPADCALL (LIST (SPADCALL (SPADCALL "vector" (QREFELT |$| 12)) (QREFELT |$| 14)) (SPADCALL (SPADCALL |x| (QREFELT |$| 15)) (QREFELT |$| 16))) (QREFELT |$| 18))) 
-
-(DEFUN |Vector| (#1=#:G84134) (PROG NIL (RETURN (PROG (#2=#:G84135) (RETURN (COND ((LETT #2# (|lassocShiftWithFunction| (LIST (|devaluate| #1#)) (HGET |$ConstructorCache| (QUOTE |Vector|)) (QUOTE |domainEqualList|)) |Vector|) (|CDRwithIncrement| #2#)) ((QUOTE T) (|UNWIND-PROTECT| (PROG1 (|Vector;| #1#) (LETT #2# T |Vector|)) (COND ((NOT #2#) (HREM |$ConstructorCache| (QUOTE |Vector|)))))))))))) 
-
-(DEFUN |Vector;| (|#1|) (PROG (|DV$1| |dv$| |$| #1=#:G84133 |pv$|) (RETURN (PROGN (LETT |DV$1| (|devaluate| |#1|) . #2=(|Vector|)) (LETT |dv$| (LIST (QUOTE |Vector|) |DV$1|) . #2#) (LETT |$| (GETREFV 36) . #2#) (QSETREFV |$| 0 |dv$|) (QSETREFV |$| 3 (LETT |pv$| (|buildPredVector| 0 0 (LIST (|HasCategory| |#1| (QUOTE (|SetCategory|))) (|HasCategory| |#1| (QUOTE (|ConvertibleTo| (|InputForm|)))) (LETT #1# (|HasCategory| |#1| (QUOTE (|OrderedSet|))) . #2#) (OR #1# (|HasCategory| |#1| (QUOTE (|SetCategory|)))) (|HasCategory| (|Integer|) (QUOTE (|OrderedSet|))) (|HasCategory| |#1| (QUOTE (|AbelianSemiGroup|))) (|HasCategory| |#1| (QUOTE (|AbelianMonoid|))) (|HasCategory| |#1| (QUOTE (|AbelianGroup|))) (|HasCategory| |#1| (QUOTE (|Monoid|))) (|HasCategory| |#1| (QUOTE (|Ring|))) (AND (|HasCategory| |#1| (QUOTE (|RadicalCategory|))) (|HasCategory| |#1| (QUOTE (|Ring|)))) (AND (|HasCategory| |#1| (LIST (QUOTE |Evalable|) (|devaluate| |#1|))) (|HasCategory| |#1| (QUOTE (|SetCategory|)))) (OR (AND (|HasCategory| |#1| (LIST (QUOTE |Evalable|) (|devaluate| |#1|))) #1#) (AND (|HasCategory| |#1| (LIST (QUOTE |Evalable|) (|devaluate| |#1|))) (|HasCategory| |#1| (QUOTE (|SetCategory|))))))) . #2#)) (|haddProp| |$ConstructorCache| (QUOTE |Vector|) (LIST |DV$1|) (CONS 1 |$|)) (|stuffDomainSlots| |$|) (QSETREFV |$| 6 |#1|) (COND ((|testBitVector| |pv$| 2) (QSETREFV |$| 19 (CONS (|dispatchFunction| |VECTOR;convert;$If;2|) |$|)))) |$|)))) 
-
-(MAKEPROP (QUOTE |Vector|) (QUOTE |infovec|) (LIST (QUOTE #(NIL NIL NIL NIL NIL (|IndexedVector| 6 (NRTEVAL 1)) (|local| |#1|) (|List| 6) (0 . |construct|) |VECTOR;vector;L$;1| (|String|) (|Symbol|) (5 . |coerce|) (|InputForm|) (10 . |convert|) (15 . |parts|) (20 . |convert|) (|List| |$|) (25 . |convert|) (30 . |convert|) (|Mapping| 6 6 6) (|Boolean|) (|NonNegativeInteger|) (|List| 24) (|Equation| 6) (|Integer|) (|Mapping| 21 6) (|Mapping| 21 6 6) (|UniversalSegment| 25) (|Void|) (|Mapping| 6 6) (|Matrix| 6) (|OutputForm|) (|SingleInteger|) (|Union| 6 (QUOTE "failed")) (|List| 25))) (QUOTE #(|vector| 35 |parts| 40 |convert| 45 |construct| 50)) (QUOTE ((|shallowlyMutable| . 0) (|finiteAggregate| . 0))) (CONS (|makeByteWordVec2| 13 (QUOTE (0 0 0 0 0 0 0 3 0 0 13 4 0 0 13 1 2 4))) (CONS (QUOTE #(|VectorCategory&| |OneDimensionalArrayAggregate&| |FiniteLinearAggregate&| |LinearAggregate&| |IndexedAggregate&| |Collection&| |HomogeneousAggregate&| |OrderedSet&| |Aggregate&| |EltableAggregate&| |Evalable&| |SetCategory&| NIL NIL |InnerEvalable&| NIL NIL |BasicType&|)) (CONS (QUOTE #((|VectorCategory| 6) (|OneDimensionalArrayAggregate| 6) (|FiniteLinearAggregate| 6) (|LinearAggregate| 6) (|IndexedAggregate| 25 6) (|Collection| 6) (|HomogeneousAggregate| 6) (|OrderedSet|) (|Aggregate|) (|EltableAggregate| 25 6) (|Evalable| 6) (|SetCategory|) (|Type|) (|Eltable| 25 6) (|InnerEvalable| 6 6) (|CoercibleTo| 32) (|ConvertibleTo| 13) (|BasicType|))) (|makeByteWordVec2| 19 (QUOTE (1 0 0 7 8 1 11 0 10 12 1 13 0 11 14 1 0 7 0 15 1 7 13 0 16 1 13 0 17 18 1 0 13 0 19 1 0 0 7 9 1 0 7 0 15 1 2 13 0 19 1 0 0 7 8)))))) (QUOTE |lookupIncomplete|))) 
-@
 \section{package VECTOR2 VectorFunctions2}
 <<package VECTOR2 VectorFunctions2>>=
 )abbrev package VECTOR2 VectorFunctions2
@@ -334,108 +65,6 @@ VectorFunctions2(A, B): Exports == Implementation where
      vector reverse! res
 
 @
-\section{domain DIRPROD DirectProduct}
-<<domain DIRPROD DirectProduct>>=
-)abbrev domain DIRPROD DirectProduct
-++ Author:
-++ Date Created:
-++ Date Last Updated:
-++ Basic Functions:
-++ Related Constructors: Vector, IndexedVector
-++ Also See: OrderedDirectProduct
-++ AMS Classifications:
-++ Keywords:
-++ References:
-++ Description:
-++   This type represents the finite direct or cartesian product of an
-++ underlying component type. This contrasts with simple vectors in that
-++ the members can be viewed as having constant length. Thus many
-++ categorical properties can by lifted from the underlying component type.
-++ Component extraction operations are provided but no updating operations.
-++ Thus new direct product elements can either be created by converting
-++ vector elements using the \spadfun{directProduct} function
-++ or by taking appropriate linear combinations of basis vectors provided
-++ by the \spad{unitVector} operation.
- 
-DirectProduct(dim:NonNegativeInteger, R:Type):
-  DirectProductCategory(dim, R) == Vector R add
- 
-      Rep := Vector R
- 
-      coerce(z:%):Vector(R)        == copy(z)$Rep pretend Vector(R)
-      coerce(r:R):%                == new(dim, r)$Rep
- 
-      parts x == VEC2LIST(x)$Lisp
- 
-      directProduct z ==
-        size?(z, dim) => copy(z)$Rep
-        error "Not of the correct length"
- 
- 
-      if R has SetCategory then
-        same?: % -> Boolean
-        same? z == every?(#1 = z(minIndex z), z)
- 
-        x = y == _and/[qelt(x,i)$Rep = qelt(y,i)$Rep for i in 1..dim]
- 
-        retract(z:%):R ==
-          same? z => z(minIndex z)
-          error "Not retractable"
- 
-        retractIfCan(z:%):Union(R, "failed") ==
-          same? z => z(minIndex z)
-          "failed"
- 
- 
-      if R has AbelianSemiGroup then
-        u:% + v:% == map(_+ , u, v)$Rep
- 
-      if R has AbelianMonoid then
-        0 == zero(dim)$Vector(R) pretend %
- 
-      if R has Monoid then
-        1 == new(dim, 1)$Vector(R) pretend %
-        u:% * r:R       == map(#1 * r, u)
-        r:R * u:%       == map(r * #1, u)
-        x:% * y:% == [x.i * y.i for i in 1..dim]$Vector(R) pretend %
- 
-      if R has CancellationAbelianMonoid then
-        subtractIfCan(u:%, v:%):Union(%,"failed") ==
-          w := new(dim,0)$Vector(R)
-          for i in 1..dim repeat
-            (c := subtractIfCan(qelt(u, i)$Rep, qelt(v,i)$Rep)) case "failed" =>
-                    return "failed"
-            qsetelt_!(w, i, c::R)$Rep
-          w pretend %
- 
-      if R has Ring then
- 
-        u:% * v:%                    == map(_* , u, v)$Rep
- 
-        recip z ==
-          w := new(dim,0)$Vector(R)
-          for i in minIndex w .. maxIndex w repeat
-            (u := recip qelt(z, i)) case "failed" => return "failed"
-            qsetelt_!(w, i, u::R)
-          w pretend %
- 
-        unitVector i ==
-          v:= new(dim,0)$Vector(R)
-          v.i := 1
-          v pretend %
- 
-      if R has OrderedSet then
-        x < y ==
-          for i in 1..dim repeat
-             qelt(x,i) < qelt(y,i) => return true
-             qelt(x,i) > qelt(y,i) => return false
-          false
-
-      if R has OrderedAbelianMonoidSup then sup(x, y) == map(sup, x, y)
- 
---)bo $noSubsumption := false
-
-@
 \section{package DIRPROD2 DirectProductFunctions2}
 <<package DIRPROD2 DirectProductFunctions2>>=
 )abbrev package DIRPROD2 DirectProductFunctions2
@@ -521,10 +150,7 @@ DirectProductFunctions2(dim, A, B): Exports == Implementation where
 <<*>>=
 <<license>>
  
-<<domain IVECTOR IndexedVector>>
-<<domain VECTOR Vector>>
 <<package VECTOR2 VectorFunctions2>>
-<<domain DIRPROD DirectProduct>>
 <<package DIRPROD2 DirectProductFunctions2>>
  
 @
diff --git a/src/algebra/view2d.spad.pamphlet b/src/algebra/view2d.spad.pamphlet
deleted file mode 100644
index 8b27df5..0000000
--- a/src/algebra/view2d.spad.pamphlet
+++ /dev/null
@@ -1,1352 +0,0 @@
-\documentclass{article}
-\usepackage{axiom}
-\begin{document}
-\title{\$SPAD/src/algebra view2d.spad}
-\author{James Wen}
-\maketitle
-\begin{abstract}
-\end{abstract}
-\eject
-\tableofcontents
-\eject
-\section{domain GRIMAGE GraphImage}
-<<domain GRIMAGE GraphImage>>=
-)abbrev domain GRIMAGE GraphImage
-++ Author: Jim Wen
-++ Date Created: 27 April 1989
-++ Date Last Updated: 1995 September 20, Mike Richardson (MGR)
-++ Basic Operations: 
-++ Related Constructors:
-++ Also See:
-++ AMS Classifications:
-++ Keywords: 
-++ References:
-++ Description: TwoDimensionalGraph creates virtual two dimensional graphs 
-++ (to be displayed on TwoDimensionalViewports).
-GraphImage (): Exports == Implementation where
-
-  VIEW    ==> VIEWPORTSERVER$Lisp
-  sendI   ==> SOCK_-SEND_-INT
-  sendSF  ==> SOCK_-SEND_-FLOAT
-  sendSTR ==> SOCK_-SEND_-STRING
-  getI    ==> SOCK_-GET_-INT
-  getSF   ==> SOCK_-GET_-FLOAT
-
-  typeGRAPH  ==> 2
-  typeVIEW2D ==> 3
-
-  makeGRAPH  ==> (-1)$SingleInteger
-  makeVIEW2D ==> (-1)$SingleInteger
- 
-  I   ==> Integer
-  PI  ==> PositiveInteger
-  NNI ==> NonNegativeInteger
-  SF  ==> DoubleFloat
-  F   ==> Float
-  L   ==> List
-  P   ==> Point(SF)
-  V   ==> Vector
-  SEG ==> Segment
-  RANGESF   ==> L SEG SF
-  RANGEF    ==> L SEG F
-  UNITSF   ==> L SF
-  UNITF    ==> L F
-  PAL ==> Palette
-  E   ==> OutputForm
-  DROP ==> DrawOption
-  PP ==> PointPackage(SF)
-  COORDSYS ==> CoordinateSystems(SF)
-
-  Exports ==> SetCategory with
-    graphImage      :  ()                                        -> $
-      ++ graphImage() returns an empty graph with 0 point lists 
-      ++ of the domain \spadtype{GraphImage}.  A graph image contains
-      ++ the graph data component of a two dimensional viewport.
-    makeGraphImage  :  $                                         -> $ 
-      ++ makeGraphImage(gi) takes the given graph, \spad{gi} of the
-      ++ domain \spadtype{GraphImage}, and sends it's data to the
-      ++ viewport manager where it waits to be included in a two-dimensional
-      ++ viewport window.  \spad{gi} cannot be an empty graph, and it's
-      ++ elements must have been created using the \spadfun{point} or
-      ++ \spadfun{component} functions, not by a previous
-      ++ \spadfun{makeGraphImage}.
-    makeGraphImage  :  (L L P)                                   -> $
-      ++ makeGraphImage(llp) returns a graph of the domain 
-      ++ \spadtype{GraphImage} which is composed of the points and 
-      ++ lines from the list of lists of points, \spad{llp}, with 
-      ++ default point size and default point and line colours. The graph
-      ++ data is then sent to the viewport manager where it waits to be
-      ++ included in a two-dimensional viewport window.
-    makeGraphImage  :  (L L P,L PAL,L PAL,L PI)                  -> $ 
-      ++ makeGraphImage(llp,lpal1,lpal2,lp) returns a graph of the
-      ++ domain \spadtype{GraphImage} which is composed of the points
-      ++ and lines from the list of lists of points, \spad{llp}, whose
-      ++ point colors are indicated by the list of palette colors,
-      ++ \spad{lpal1}, and whose lines are colored according to the list
-      ++ of palette colors, \spad{lpal2}.  The paramater lp is a list of
-      ++ integers which denote the size of the data points.  The graph
-      ++ data is then sent to the viewport manager where it waits to be
-      ++ included in a two-dimensional viewport window.
-    makeGraphImage  :  (L L P,L PAL,L PAL,L PI,L DROP)           -> $
-      ++ makeGraphImage(llp,lpal1,lpal2,lp,lopt) returns a graph of
-      ++ the domain \spadtype{GraphImage} which is composed of the 
-      ++ points and lines from the list of lists of points, \spad{llp},
-      ++ whose point colors are indicated by the list of palette colors,
-      ++ \spad{lpal1}, and whose lines are colored according to the list
-      ++ of palette colors, \spad{lpal2}.  The paramater lp is a list of
-      ++ integers which denote the size of the data points, and \spad{lopt}
-      ++ is the list of draw command options.  The graph data is then sent
-      ++ to the viewport manager where it waits to be included in a 
-      ++ two-dimensional viewport window.
-    pointLists      :  $                                         -> L L P
-      ++ pointLists(gi) returns the list of lists of points which compose
-      ++ the given graph, \spad{gi}, of the domain \spadtype{GraphImage}.
-    key             :  $                                         -> I
-      ++ key(gi) returns the process ID of the given graph, \spad{gi},
-      ++ of the domain \spadtype{GraphImage}.
-    ranges          :  $                                         -> RANGEF
-      ++ ranges(gi) returns the list of ranges of the point components from
-      ++ the indicated graph, \spad{gi}, of the domain \spadtype{GraphImage}.
-    ranges          :  ($,RANGEF)                                -> RANGEF
-      ++ ranges(gi,lr) modifies the list of ranges for the given graph,
-      ++ \spad{gi} of the domain \spadtype{GraphImage}, to be that of the
-      ++ list of range segments, \spad{lr}, and returns the new range list
-      ++ for \spad{gi}. 
-    units           :  $                                         -> UNITF
-      ++ units(gi) returns the list of unit increments for the x and y
-      ++ axes of the indicated graph, \spad{gi}, of the domain
-      ++ \spadtype{GraphImage}.
-    units           :  ($,UNITF)                                 -> UNITF
-      ++ units(gi,lu) modifies the list of unit increments for the x and y
-      ++ axes of the given graph, \spad{gi} of the domain
-      ++ \spadtype{GraphImage}, to be that of the list of unit increments,
-      ++ \spad{lu}, and returns the new list of units for \spad{gi}. 
-    component       :  ($,L P,PAL,PAL,PI)                        -> Void
-      ++ component(gi,lp,pal1,pal2,p) sets the components of the
-      ++ graph, \spad{gi} of the domain \spadtype{GraphImage}, to the
-      ++ values given.  The point list for \spad{gi} is set to the list
-      ++ \spad{lp}, the color of the points in \spad{lp} is set to
-      ++ the palette color \spad{pal1}, the color of the lines which
-      ++ connect the points \spad{lp} is set to the palette color
-      ++ \spad{pal2}, and the size of the points in \spad{lp} is given
-      ++ by the integer p.
-    component       :  ($,P)                                     -> Void
-      ++ component(gi,pt) modifies the graph \spad{gi} of the domain
-      ++ \spadtype{GraphImage} to contain one point component, \spad{pt}
-      ++ whose point color, line color and point size are determined by
-      ++ the default functions \spadfun{pointColorDefault},
-      ++ \spadfun{lineColorDefault}, and \spadfun{pointSizeDefault}.
-    component       :  ($,P,PAL,PAL,PI)                          -> Void
-      ++ component(gi,pt,pal1,pal2,ps) modifies the graph \spad{gi} of
-      ++ the domain \spadtype{GraphImage} to contain one point component,
-      ++ \spad{pt} whose point color is set to the palette color \spad{pal1},
-      ++ line color is set to the palette color \spad{pal2}, and point
-      ++ size is set to the positive integer \spad{ps}.
-    appendPoint     :  ($,P)                                     -> Void
-      ++ appendPoint(gi,pt) appends the point \spad{pt} to the end
-      ++ of the list of points component for the graph, \spad{gi}, which is
-      ++ of the domain \spadtype{GraphImage}.
-    point           :  ($,P,PAL)                                 -> Void
-      ++ point(gi,pt,pal) modifies the graph \spad{gi} of the domain
-      ++ \spadtype{GraphImage} to contain one point component, \spad{pt}
-      ++ whose point color is set to be the palette color \spad{pal}, and
-      ++ whose line color and point size are determined by the default
-      ++ functions \spadfun{lineColorDefault} and \spadfun{pointSizeDefault}.
-    coerce          :  L L P                                     -> $
-      ++ coerce(llp)
-      ++ component(gi,pt) creates and returns a graph of the domain
-      ++ \spadtype{GraphImage} which is composed of the list of list
-      ++ of points given by \spad{llp}, and whose point colors, line colors
-      ++ and point sizes are determined by the default functions 
-      ++ \spadfun{pointColorDefault}, \spadfun{lineColorDefault}, and
-      ++ \spadfun{pointSizeDefault}.  The graph data is then sent to the 
-      ++ viewport manager where it waits to be included in a two-dimensional
-      ++ viewport window.
-    coerce          :  $                                         -> E
-      ++ coerce(gi) returns the indicated graph, \spad{gi}, of domain
-      ++ \spadtype{GraphImage} as output of the domain \spadtype{OutputForm}.
-    putColorInfo    : (L L P,L PAL)                              -> L L P
-      ++ putColorInfo(llp,lpal) takes a list of list of points, \spad{llp},
-      ++ and returns the points with their hue and shade components
-      ++ set according to the list of palette colors, \spad{lpal}.
-    figureUnits : L L P                       -> UNITSF
-
-  Implementation ==> add
-    import Color()
-    import Palette()
-    import ViewDefaultsPackage()
-    import PlotTools()
-    import DrawOptionFunctions0
-    import P
-    import PP
-    import COORDSYS
-
-    Rep := Record(key: I, rangesField: RANGESF, unitsField: UNITSF, _
-       llPoints: L L P, pointColors: L PAL, lineColors: L PAL, pointSizes: L PI, _
-       optionsField: L DROP)
-
---%Internal Functions
-
-    graph       : RANGEF                          -> $
-    scaleStep   : SF                          -> SF
-    makeGraph   :  $                          -> $
-
-
-    numberCheck(nums:Point SF):Void ==
-      for i in minIndex(nums)..maxIndex(nums) repeat
-        COMPLEXP(nums.(i::PositiveInteger))$Lisp =>
-          error "An unexpected complex number was encountered in the calculations."
-           
-
-    doOptions(g:Rep):Void ==    
-      lr : RANGEF := ranges(g.optionsField,ranges g)
-      if (#lr > 1$I) then
-        g.rangesField := [segment(convert(lo(lr.1))@SF,convert(hi(lr.1))@SF)$(Segment(SF)), 
-                           segment(convert(lo(lr.2))@SF,convert(hi(lr.2))@SF)$(Segment(SF))]
-      else
-        g.rangesField := []
-      lu : UNITF := units(g.optionsField,units g)
-      if (#lu > 1$I) then
-        g.unitsField := [convert(lu.1)@SF,convert(lu.2)@SF]
-      else
-        g.unitsField := []
-    -- etc - graphimage specific stuff...
-
-    putColorInfo(llp,listOfPalettes) ==
-      llp2 : L L P := []
-      for lp in llp for pal in listOfPalettes repeat
-        lp2 : L P := []
-        daHue   := (hue(hue pal))::SF
-        daShade := (shade pal)::SF
-        for p in lp repeat
-          if (d := dimension p) < 3 then
-            p := extend(p,[daHue,daShade])
-          else
-            p.3 := daHue
-            d < 4 => p := extend(p,[daShade])
-            p.4 := daShade
-          lp2 := cons(p,lp2)
-        llp2 := cons(reverse_! lp2,llp2)
-      reverse_! llp2
-
-    graph demRanges ==
-      null demRanges =>  [ 0, [], [], [], [], [], [], [] ]
-      demRangesSF : RANGESF := _
-        [ segment(convert(lo demRanges.1)@SF,convert(hi demRanges.1)@SF)$(Segment(SF)), _
-          segment(convert(lo demRanges.1)@SF,convert(hi demRanges.1)@SF)$(Segment(SF)) ]
-      [ 0, demRangesSF, [], [], [], [], [], [] ]
-
-    scaleStep(range) ==                        -- MGR
-      
-      adjust:NNI
-      tryStep:SF
-      scaleDown:SF
-      numerals:String
-      adjust := 0
-      while range < 100.0::SF repeat
-        adjust := adjust + 1
-        range := range * 10.0::SF -- might as well take big steps
-      tryStep := range/10.0::SF
-      numerals := string(((retract(ceiling(tryStep)$SF)$SF)@I))$String
-      scaleDown := (10@I **$I (((#(numerals)@I) - 1$I) pretend PI))::SF
-      scaleDown*ceiling(tryStep/scaleDown - 0.5::SF)/((10 **$I adjust)::SF)
-
-    figureUnits(listOfListsOfPoints) ==
-        -- figure out the min/max and divide by 10 for unit markers
-      xMin := xMax := xCoord first first listOfListsOfPoints
-      yMin := yMax := yCoord first first listOfListsOfPoints
-      if xMin ~= xMin then xMin:=max()
-      if xMax ~= xMax then xMax:=min()
-      if yMin ~= yMin then yMin:=max()
-      if yMax ~= yMax then yMax:=min()
-      for pL in listOfListsOfPoints repeat
-        for p in pL repeat
-          if ((px := (xCoord p)) < xMin) then
-            xMin := px
-          if px > xMax then
-            xMax := px
-          if ((py := (yCoord p)) < yMin) then
-            yMin := py
-          if py > yMax then
-            yMax := py
-      if xMin = xMax then
-        xMin := xMin - convert(0.5)$Float
-        xMax := xMax + convert(0.5)$Float
-      if yMin = yMax then
-        yMin := yMin - convert(0.5)$Float
-        yMax := yMax + convert(0.5)$Float
-      [scaleStep(xMax-xMin),scaleStep(yMax-yMin)]
-
-    plotLists(graf:Rep,listOfListsOfPoints:L L P,listOfPointColors:L PAL,listOfLineColors:L PAL,listOfPointSizes:L PI):$ ==
-      givenLen := #listOfListsOfPoints
-        -- take out point lists that are actually empty
-      listOfListsOfPoints := [ l for l in listOfListsOfPoints | ^null l ]
-      if (null listOfListsOfPoints) then
-        error "GraphImage was given a list that contained no valid point lists"
-      if ((len := #listOfListsOfPoints) ^= givenLen) then
-        sayBrightly(["   Warning: Ignoring pointless point list"::E]$List(E))$Lisp
-      graf.llPoints := listOfListsOfPoints
-        -- do point colors
-      if ((givenLen := #listOfPointColors) > len) then
-         -- pad or discard elements if given list has length different from the point list
-        graf.pointColors := concat(listOfPointColors,
-            new((len - givenLen)::NonNegativeInteger + 1, pointColorDefault()))
-      else graf.pointColors := first(listOfPointColors, len)
-        -- do line colors
-      if ((givenLen := #listOfLineColors) > len) then
-        graf.lineColors := concat(listOfLineColors,
-             new((len - givenLen)::NonNegativeInteger + 1, lineColorDefault()))
-      else graf.lineColors := first(listOfLineColors, len)
-        -- do point sizes
-      if ((givenLen := #listOfPointSizes) > len) then
-        graf.pointSizes := concat(listOfPointSizes,
-             new((len - givenLen)::NonNegativeInteger + 1, pointSizeDefault()))
-      else graf.pointSizes := first(listOfPointSizes, len)
-      graf
-
-    makeGraph graf ==
-      doOptions(graf)
-      (s := #(graf.llPoints)) = 0 =>
-        error "You are trying to make a graph with no points"
-      key graf ^= 0 => 
-        error "You are trying to draw over an existing graph"
-      transform := coord(graf.optionsField,cartesian$COORDSYS)$DrawOptionFunctions0 
-      graf.llPoints:= putColorInfo(graf.llPoints,graf.pointColors)
-      if null(ranges graf) then  -- figure out best ranges for points
-        graf.rangesField := calcRanges(graf.llPoints)  --::V SEG SF
-      if null(units graf) then  -- figure out best ranges for points
-        graf.unitsField := figureUnits(graf.llPoints)  --::V SEG SF
-      sayBrightly(["   Graph data being transmitted to the viewport manager..."::E]$List(E))$Lisp
-      sendI(VIEW,typeGRAPH)$Lisp
-      sendI(VIEW,makeGRAPH)$Lisp
-      tonto := (graf.rangesField)::RANGESF
-      sendSF(VIEW,lo(first tonto))$Lisp
-      sendSF(VIEW,hi(first tonto))$Lisp
-      sendSF(VIEW,lo(second tonto))$Lisp
-      sendSF(VIEW,hi(second tonto))$Lisp
-      sendSF(VIEW,first (graf.unitsField))$Lisp
-      sendSF(VIEW,second (graf.unitsField))$Lisp
-      sendI(VIEW,s)$Lisp     -- how many lists of points are being sent
-      for aList in graf.llPoints for pColor in graf.pointColors for lColor in graf.lineColors for s in graf.pointSizes repeat
-        sendI(VIEW,#aList)$Lisp  -- how many points in this list
-        for p in aList repeat
-          aPoint := transform p
-          sendSF(VIEW,xCoord aPoint)$Lisp
-          sendSF(VIEW,yCoord aPoint)$Lisp
-          sendSF(VIEW,hue(p)$PP)$Lisp  -- ?use aPoint as well...?
-          sendSF(VIEW,shade(p)$PP)$Lisp
-        hueShade := hue hue pColor + shade pColor * numberOfHues() 
-        sendI(VIEW,hueShade)$Lisp
-        hueShade := (hue hue lColor -1)*5 + shade lColor
-        sendI(VIEW,hueShade)$Lisp
-        sendI(VIEW,s)$Lisp
-      graf.key := getI(VIEW)$Lisp
-      graf        
-
-
---%Exported Functions
-    makeGraphImage(graf:$)    == makeGraph graf
-    key graf                  == graf.key
-    pointLists graf           == graf.llPoints
-    ranges graf                == 
-      null graf.rangesField => []
-      [segment(convert(lo graf.rangesField.1)@F,convert(hi graf.rangesField.1)@F), _
-       segment(convert(lo graf.rangesField.2)@F,convert(hi graf.rangesField.2)@F)]
-    ranges(graf,rangesList)     == 
-      graf.rangesField := 
-        [segment(convert(lo rangesList.1)@SF,convert(hi rangesList.1)@SF), _
-         segment(convert(lo rangesList.2)@SF,convert(hi rangesList.2)@SF)]
-      rangesList
-    units graf                == 
-      null(graf.unitsField) => []
-      [convert(graf.unitsField.1)@F,convert(graf.unitsField.2)@F]
-    units (graf,unitsToBe)    == 
-      graf.unitsField := [convert(unitsToBe.1)@SF,convert(unitsToBe.2)@SF]
-      unitsToBe
-    graphImage                == graph []
-
-    makeGraphImage(llp) ==
-      makeGraphImage(llp,
-        [pointColorDefault() for i in 1..(l:=#llp)],
-	 [lineColorDefault() for i in 1..l], 
-          [pointSizeDefault() for i in 1..l])
-
-    makeGraphImage(llp,lpc,llc,lps) ==
-      makeGraphImage(llp,lpc,llc,lps,[])
-
-    makeGraphImage(llp,lpc,llc,lps,opts) ==
-      graf := graph(ranges(opts,[]))
-      graf.optionsField := opts
-      graf := plotLists(graf,llp,lpc,llc,lps)
-      transform := coord(graf.optionsField,cartesian$COORDSYS)$DrawOptionFunctions0
-      for aList in graf.llPoints repeat
-        for p in aList repeat
-          aPoint := transform p
-          numberCheck aPoint
-      makeGraph graf
-
-    component (graf:$,ListOfPoints:L P,PointColor:PAL,LineColor:PAL,PointSize:PI) ==
-      graf.llPoints    := append(graf.llPoints,[ListOfPoints])
-      graf.pointColors := append(graf.pointColors,[PointColor])
-      graf.lineColors  := append(graf.lineColors,[LineColor])
-      graf.pointSizes  := append(graf.pointSizes,[PointSize])     
-
-    component (graf,aPoint) ==
-      component(graf,aPoint,pointColorDefault(),lineColorDefault(),pointSizeDefault())
-
-    component (graf:$,aPoint:P,PointColor:PAL,LineColor:PAL,PointSize:PI) ==
-      component (graf,[aPoint],PointColor,LineColor,PointSize)
-
-    appendPoint (graf,aPoint) ==
-      num : I  := #(graf.llPoints) - 1
-      num < 0 => error "No point lists to append to!"
-      (graf.llPoints.num) := append((graf.llPoints.num),[aPoint])
-
-    point (graf,aPoint,PointColor) ==
-      component(graf,aPoint,PointColor,lineColorDefault(),pointSizeDefault())
-
-    coerce (llp : L L P) : $ ==
-      makeGraphImage(llp,
-          [pointColorDefault() for i in 1..(l:=#llp)],
-		[lineColorDefault() for i in 1..l], 
-                     [pointSizeDefault() for i in 1..l])
-
-    coerce (graf : $) : E ==
-      hconcat( ["Graph with " :: E,(p := # pointLists graf) :: E, 
-         (p=1 => " point list"; " point lists") :: E])
-
-@
-\section{domain VIEW2D TwoDimensionalViewport}
-<<TwoDimensionalViewport.help>>=
-====================================================================
-TwoDimensionalViewport examples
-====================================================================
-
-We want to graph x^3 * (a+b*x) on the interval x=-1..1
-so we clear out the workspace
-
-We assign values to the constants
-  a:=0.5
-    0.5
-                              Type: Float
-  b:=0.5
-    0.5
-                              Type: Float
-
-We draw the first case of the graph
-
-  y1:=draw(x^3*(a+b*x),x=-1..1,title=="2.2.10 explicit")
-    TwoDimensionalViewport: "2.2.10 explicit"
-                              Type: TwoDimensionalViewport
-
-We fetch the graph of the first object
-
-  g1:=getGraph(y1,1)
-    Graph with 1 point list
-                              Type: GraphImage
-
-We extract its points
-
-  pointLists g1
-   [
-     [[-1.,0.,1.,3.], [-0.95833333333333337,-1.8336166570216028E-2,1.,3.],
-      [-0.91666666666666674,-3.2093942901234518E-2,1.,3.],
-      [-0.87500000000000011,-4.18701171875E-2,1.,3.],
-      [-0.83333333333333348,-4.8225308641975301E-2,1.,3.],
-      [-0.79166666666666685,-5.1683967496141986E-2,1.,3.],
-      [-0.75000000000000022,-5.2734375E-2,1.,3.],
-      [-0.70833333333333359,-5.1828643422067916E-2,1.,3.],
-      [-0.66666666666666696,-4.9382716049382741E-2,1.,3.],
-      [-0.62500000000000033,-4.5776367187500042E-2,1.,3.],
-      [-0.5833333333333337,-4.1353202160493867E-2,1.,3.],
-      [-0.54166666666666707,-3.6420657310956832E-2,1.,3.],
-      [-0.50000000000000044,-3.1250000000000056E-2,1.,3.],
-      [-0.45833333333333376,-2.6076328607253136E-2,1.,3.],
-      [-0.41666666666666707,-2.1098572530864244E-2,1.,3.],
-      [-0.37500000000000039,-1.6479492187500042E-2,1.,3.],
-      [-0.3333333333333337,-1.2345679012345713E-2,1.,3.],
-      [-0.29166666666666702,-8.7875554591049648E-3,1.,3.],
-      [-0.25000000000000033,-5.8593750000000208E-3,1.,3.],
-      [-0.20833333333333368,-3.5792221257716214E-3,1.,3.],
-      [-0.16666666666666702,-1.9290123456790237E-3,1.,3.],
-      [-0.12500000000000036,-8.5449218750000705E-4,1.,3.],
-      [-8.3333333333333703E-2,-2.6523919753086765E-4,1.,3.],
-      [-4.1666666666667039E-2,-3.4661940586420673E-5,1.,3.],
-      [-3.7470027081099033E-16,-2.6304013894372334E-47,1.,3.],
-      [4.166666666666629E-2,3.7676022376542178E-5,1.,3.],
-      [8.3333333333332954E-2,3.1346450617283515E-4,1.,3.],
-      [0.12499999999999961,1.0986328124999894E-3,1.,3.],
-      [0.16666666666666627,2.7006172839505972E-3,1.,3.],
-      [0.20833333333333293,5.463023244598731E-3,1.,3.],
-      [0.24999999999999958,9.765624999999948E-3,1.,3.],
-      [0.29166666666666624,1.6024365837191284E-2,1.,3.],
-      [0.33333333333333293,2.469135802469126E-2,1.,3.],
-      [0.37499999999999961,3.6254882812499882E-2,1.,3.],
-      [0.4166666666666663,5.1239390432098617E-2,1.,3.],
-      [0.45833333333333298,7.0205500096450435E-2,1.,3.],
-      [0.49999999999999967,9.3749999999999792E-2,1.,3.],
-      [0.5416666666666663,0.12250584731867258,1.,3.],
-      [0.58333333333333293,0.15714216820987617,1.,3.],
-      [0.62499999999999956,0.1983642578124995,1.,3.],
-      [0.66666666666666619,0.24691358024691298,1.,3.],
-      [0.70833333333333282,0.30356776861496837,1.,3.],
-      [0.74999999999999944,0.369140624999999,1.,3.],
-      [0.79166666666666607,0.44448212046681984,1.,3.],
-      [0.8333333333333327,0.530478395061727,1.,3.],
-      [0.87499999999999933,0.62805175781249845,1.,3.],
-      [0.91666666666666596,0.73816068672839308,1.,3.],
-      [0.95833333333333259,0.86179982880015205,1.,3.], [1.,1.,1.,3.]]
-     ]
-                        Type: List List Point DoubleFloat
-
-Now we create a second graph with a changed parameter
-
-  b:=1.0
-    1.0
-                        Type: Float
-
-We draw it
-
-  y2:=draw(x^3*(a+b*x),x=-1..1)
-    TwoDimensionalViewport: "AXIOM2D"
-                        Type: TwoDimensionalViewport
-
-We fetch this new graph
-
-  g2:=getGraph(y2,1)
-    Graph with 1 point list
-                       Type: GraphImage
-
-We get the points from this graph
-
-  pointLists g2
-   [
-     [[-1.,0.5,1.,3.], [-0.95833333333333337,0.40339566454475323,1.,3.],
-      [-0.91666666666666674,0.32093942901234584,1.,3.],
-      [-0.87500000000000011,0.25122070312500017,1.,3.],
-      [-0.83333333333333348,0.19290123456790137,1.,3.],
-      [-0.79166666666666685,0.14471510898919768,1.,3.],
-      [-0.75000000000000022,0.10546875000000019,1.,3.],
-      [-0.70833333333333359,7.404091917438288E-2,1.,3.],
-      [-0.66666666666666696,4.938271604938288E-2,1.,3.],
-      [-0.62500000000000033,3.0517578125000125E-2,1.,3.],
-      [-0.5833333333333337,1.6541280864197649E-2,1.,3.],
-      [-0.54166666666666707,6.6219376929013279E-3,1.,3.],
-      [-0.50000000000000044,5.5511151231257827E-17,1.,3.],
-      [-0.45833333333333376,-4.011742862654287E-3,1.,3.],
-      [-0.41666666666666707,-6.0281635802469057E-3,1.,3.],
-      [-0.37500000000000039,-6.5917968750000035E-3,1.,3.],
-      [-0.3333333333333337,-6.1728395061728461E-3,1.,3.],
-      [-0.29166666666666702,-5.1691502700617377E-3,1.,3.],
-      [-0.25000000000000033,-3.9062500000000104E-3,1.,3.],
-      [-0.20833333333333368,-2.6373215663580349E-3,1.,3.],
-      [-0.16666666666666702,-1.543209876543218E-3,1.,3.],
-      [-0.12500000000000036,-7.3242187500000564E-4,1.,3.],
-      [-8.3333333333333703E-2,-2.4112654320987957E-4,1.,3.],
-      [-4.1666666666667039E-2,-3.315489969135889E-5,1.,3.],
-      [-3.7470027081099033E-16,-2.6304013894372324E-47,1.,3.],
-      [4.166666666666629E-2,3.9183063271603852E-5,1.,3.],
-      [8.3333333333332954E-2,3.3757716049382237E-4,1.,3.],
-      [0.12499999999999961,1.2207031249999879E-3,1.,3.],
-      [0.16666666666666627,3.0864197530863957E-3,1.,3.],
-      [0.20833333333333293,6.4049238040123045E-3,1.,3.],
-      [0.24999999999999958,1.1718749999999934E-2,1.,3.],
-      [0.29166666666666624,1.9642771026234473E-2,1.,3.],
-      [0.33333333333333293,3.0864197530864071E-2,1.,3.],
-      [0.37499999999999961,4.6142578124999847E-2,1.,3.],
-      [0.4166666666666663,6.6309799382715848E-2,1.,3.],
-      [0.45833333333333298,9.2270085841049135E-2,1.,3.],
-      [0.49999999999999967,0.12499999999999971,1.,3.],
-      [0.5416666666666663,0.16554844232253049,1.,3.],
-      [0.58333333333333293,0.21503665123456736,1.,3.],
-      [0.62499999999999956,0.27465820312499928,1.,3.],
-      [0.66666666666666619,0.3456790123456781,1.,3.],
-      [0.70833333333333282,0.42943733121141858,1.,3.],
-      [0.74999999999999944,0.52734374999999845,1.,3.],
-      [0.79166666666666607,0.64088119695215873,1.,3.],
-      [0.8333333333333327,0.77160493827160281,1.,3.],
-      [0.87499999999999933,0.92114257812499756,1.,3.],
-      [0.91666666666666596,1.0911940586419722,1.,3.],
-      [0.95833333333333259,1.2835316599151199,1.,3.], [1.,1.5,1.,3.]]
-     ]
-                           Type: List List Point DoubleFloat
-
-and we put these points, g2 onto the first graph y1 as graph 2
-
-  putGraph(y1,g2,2)
-                           Type: Void
-
-And now we do the whole sequence again
-
-  b:=2.0
-    2.0
-                           Type: Float
-
-  y3:=draw(x^3*(a+b*x),x=-1..1)
-    TwoDimensionalViewport: "AXIOM2D"
-                          Type: TwoDimensionalViewport
-
-  g3:=getGraph(y3,1)
-    Graph with 1 point list
-                          Type: GraphImage
-
-  pointLists g3
-   [
-     [[-1.,1.5,1.,3.], [-0.95833333333333337,1.2468593267746917,1.,3.],
-      [-0.91666666666666674,1.0270061728395066,1.,3.],
-      [-0.87500000000000011,0.83740234375000044,1.,3.],
-      [-0.83333333333333348,0.67515432098765471,1.,3.],
-      [-0.79166666666666685,0.53751326195987703,1.,3.],
-      [-0.75000000000000022,0.42187500000000056,1.,3.],
-      [-0.70833333333333359,0.32578004436728447,1.,3.],
-      [-0.66666666666666696,0.24691358024691412,1.,3.],
-      [-0.62500000000000033,0.18310546875000044,1.,3.],
-      [-0.5833333333333337,0.1323302469135807,1.,3.],
-      [-0.54166666666666707,9.2707127700617648E-2,1.,3.],
-      [-0.50000000000000044,6.2500000000000278E-2,1.,3.],
-      [-0.45833333333333376,4.0117428626543411E-2,1.,3.],
-      [-0.41666666666666707,2.4112654320987775E-2,1.,3.],
-      [-0.37500000000000039,1.3183593750000073E-2,1.,3.],
-      [-0.3333333333333337,6.1728395061728877E-3,1.,3.],
-      [-0.29166666666666702,2.0676601080247183E-3,1.,3.],
-      [-0.25000000000000033,1.0408340855860843E-17,1.,3.],
-      [-0.20833333333333368,-7.5352044753086191E-4,1.,3.],
-      [-0.16666666666666702,-7.7160493827160663E-4,1.,3.],
-      [-0.12500000000000036,-4.8828125000000282E-4,1.,3.],
-      [-8.3333333333333703E-2,-1.9290123456790339E-4,1.,3.],
-      [-4.1666666666667039E-2,-3.0140817901235325E-5,1.,3.],
-      [-3.7470027081099033E-16,-2.6304013894372305E-47,1.,3.],
-      [4.166666666666629E-2,4.21971450617272E-5,1.,3.],
-      [8.3333333333332954E-2,3.8580246913579681E-4,1.,3.],
-      [0.12499999999999961,1.4648437499999848E-3,1.,3.],
-      [0.16666666666666627,3.8580246913579933E-3,1.,3.],
-      [0.20833333333333293,8.2887249228394497E-3,1.,3.],
-      [0.24999999999999958,1.562499999999991E-2,1.,3.],
-      [0.29166666666666624,2.6879581404320851E-2,1.,3.],
-      [0.33333333333333293,4.3209876543209694E-2,1.,3.],
-      [0.37499999999999961,6.5917968749999764E-2,1.,3.],
-      [0.4166666666666663,9.6450617283950296E-2,1.,3.],
-      [0.45833333333333298,0.13639925733024652,1.,3.],
-      [0.49999999999999967,0.18749999999999956,1.,3.],
-      [0.5416666666666663,0.25163363233024633,1.,3.],
-      [0.58333333333333293,0.33082561728394977,1.,3.],
-      [0.62499999999999956,0.42724609374999883,1.,3.],
-      [0.66666666666666619,0.5432098765432084,1.,3.],
-      [0.70833333333333282,0.68117645640431912,1.,3.],
-      [0.74999999999999944,0.84374999999999756,1.,3.],
-      [0.79166666666666607,1.0336793499228365,1.,3.],
-      [0.8333333333333327,1.2538580246913544,1.,3.],
-      [0.87499999999999933,1.507324218749996,1.,3.],
-      [0.91666666666666596,1.7972608024691306,1.,3.],
-      [0.95833333333333259,2.1269953221450555,1.,3.], [1.,2.5,1.,3.]]
-     ]
-                        Type: List List Point DoubleFloat
-
-and put the third graphs points g3 onto the first graph y1 as graph 3
-
-  putGraph(y1,g3,3)
-                        Type: Void
-
-Finally we show the combined result
-
-  vp:=makeViewport2D(y1)
-    TwoDimensionalViewport: "2.2.10 explicit"
-                        Type: TwoDimensionalViewport
-
-See Also:
-o )show TwoDimensionalViewport
-o $AXIOM/doc/src/algebra/view2d.spad.dvi
-
-@
-<<domain VIEW2D TwoDimensionalViewport>>=
-)abbrev domain VIEW2D TwoDimensionalViewport
-++ Author: Jim Wen
-++ Date Created: 28 April 1989
-++ Date Last Updated: 29 October 1991, Jon Steinbach
-++ Basic Operations:
-++ Related Constructors:
-++ Also See:
-++ AMS Classifications:
-++ Keywords: 
-++ References:
-++ Description: TwoDimensionalViewport creates viewports to display graphs.
-TwoDimensionalViewport ():Exports == Implementation where
-
-  VIEW    ==> VIEWPORTSERVER$Lisp
-  sendI   ==> SOCK_-SEND_-INT
-  sendSF  ==> SOCK_-SEND_-FLOAT
-  sendSTR ==> SOCK_-SEND_-STRING
-  getI    ==> SOCK_-GET_-INT
-  getSF   ==> SOCK_-GET_-FLOAT
-
-  typeGRAPH  ==> 2
-  typeVIEW2D ==> 3
-
-  makeGRAPH  ==> (-1)$SingleInteger
-  makeVIEW2D ==> (-1)$SingleInteger
- 
-  I    ==> Integer
-  PI   ==> PositiveInteger
-  NNI  ==> NonNegativeInteger
-  XY   ==> Record( X:I, Y:I )
-  XYP  ==> Record( X:PI, Y:PI )
-  XYNN ==> Record( X:NNI, Y:NNI )
-  F    ==> Float
-  SF   ==> DoubleFloat
-  STR  ==> String
-  L    ==> List
-  V    ==> Vector
-  E    ==> OutputForm
-  FLAG ==> Record( showCP:I )
-  PAL  ==> Palette()
-  B    ==> Boolean
-  G    ==> GraphImage
-  GS   ==> Record( scaleX:SF, scaleY:SF, deltaX:SF, deltaY:SF, _
-                  points:I, connect:I, spline:I, _
-                  axes:I, axesColor:PAL, units:I, unitsColor:PAL, _
-                  showing:I)
-  GU   ==> Union(G,"undefined")
-  DROP ==> DrawOption
-  POINT ==> Point(SF)
-
-  TRANSLATE2D     ==> 0$I
-  SCALE2D         ==> 1$I
-  pointsOnOff     ==> 2
-  connectOnOff    ==> 3
-  spline2D        ==> 4   -- used for controlling regions, now
-  reset2D         ==> 5
-  hideControl2D   ==> 6
-  closeAll2D      ==> 7
-  axesOnOff2D     ==> 8
-  unitsOnOff2D    ==> 9
-
-  SPADBUTTONPRESS ==> 100
-  MOVE            ==> 102
-  RESIZE          ==> 103
-  TITLE           ==> 104
-  showing2D       ==> 105  -- as defined in include/actions.h
-  putGraph2D      ==> 106
-  writeView       ==> 110
-  axesColor2D     ==> 112
-  unitsColor2D    ==> 113
-  getPickedPTS    ==> 119
-
-  graphStart      ==> 13   -- as defined in include/actions.h
-
-  noControl ==> 0$I
-
-  yes       ==> 1$I
-  no        ==> 0$I
-
-  maxGRAPHS ==> 9::I   -- should be the same as maxGraphs in include/view2d.h
-
-  fileTypeDefs ==> ["PIXMAP"]    -- see include/write.h for things to include
-
-  Exports ==> SetCategory with
-    getPickedPoints : $ -> L POINT
-      ++ getPickedPoints(x) 
-      ++ returns a list of small floats for the points the
-      ++ user interactively picked on the viewport
-      ++ for full integration into the system, some design
-      ++ issues need to be addressed: e.g. how to go through
-      ++ the GraphImage interface, how to default to graphs, etc.
-    viewport2D     : ()                                     -> $
-      ++ viewport2D() returns an undefined two-dimensional viewport
-      ++ of the domain \spadtype{TwoDimensionalViewport} whose
-      ++ contents are empty.
-    makeViewport2D : $                                      -> $
-      ++ makeViewport2D(v) takes the given two-dimensional viewport,
-      ++ v, of the domain \spadtype{TwoDimensionalViewport} and
-      ++ displays a viewport window on the screen which contains
-      ++ the contents of v.
-    options        : $                                      -> L DROP
-      ++ options(v) takes the given two-dimensional viewport, v, of the
-      ++ domain \spadtype{TwoDimensionalViewport} and returns a list
-      ++ containing the draw options from the domain \spadtype{DrawOption}
-      ++ for v.
-    options        : ($,L DROP)                             -> $
-      ++ options(v,lopt) takes the given two-dimensional viewport, v,
-      ++ of the domain \spadtype{TwoDimensionalViewport} and returns
-      ++ v with it's draw options modified to be those which are indicated
-      ++ in the given list, \spad{lopt} of domain \spadtype{DrawOption}.
-    makeViewport2D : (G,L DROP)                             -> $
-      ++ makeViewport2D(gi,lopt) creates and displays a viewport window
-      ++ of the domain \spadtype{TwoDimensionalViewport} whose graph
-      ++ field is assigned to be the given graph, \spad{gi}, of domain
-      ++ \spadtype{GraphImage}, and whose options field is set to be
-      ++ the list of options, \spad{lopt} of domain \spadtype{DrawOption}.
-    graphState     : ($,PI,SF,SF,SF,SF,I,I,I,I,PAL,I,PAL,I) -> Void
-      ++ graphState(v,num,sX,sY,dX,dY,pts,lns,box,axes,axesC,un,unC,cP)
-      ++ sets the state of the characteristics for the graph indicated
-      ++ by \spad{num} in the given two-dimensional viewport v, of domain
-      ++ \spadtype{TwoDimensionalViewport}, to the values given as
-      ++ parameters.  The scaling of the graph in the x and y component
-      ++ directions is set to be \spad{sX} and \spad{sY}; the window
-      ++ translation in the x and y component directions is set to be
-      ++ \spad{dX} and \spad{dY}; The graph points, lines, bounding box,
-      ++ axes, or units will be shown in the viewport if their given
-      ++ parameters \spad{pts}, \spad{lns}, \spad{box}, \spad{axes} or
-      ++ \spad{un} are set to be \spad{1}, but will not be shown if they
-      ++ are set to \spad{0}.  The color of the axes and the color of the
-      ++ units are indicated by the palette colors \spad{axesC} and
-      ++ \spad{unC} respectively.  To display the control panel when
-      ++ the viewport window is displayed, set \spad{cP} to \spad{1},
-      ++ otherwise set it to \spad{0}.
-    graphStates    : $                                      -> V GS
-      ++ graphStates(v) returns and shows a listing of a record containing
-      ++ the current state of the characteristics of each of the ten graph
-      ++ records in the given two-dimensional viewport, v, which is of
-      ++ domain \spadtype{TwoDimensionalViewport}.
-    graphs         : $                                      -> V GU
-      ++ graphs(v) returns a vector, or list, which is a union of all
-      ++ the graphs, of the domain \spadtype{GraphImage}, which are
-      ++ allocated for the two-dimensional viewport, v, of domain
-      ++ \spadtype{TwoDimensionalViewport}.  Those graphs which have
-      ++ no data are labeled "undefined", otherwise their contents
-      ++ are shown.
-    title          : ($,STR)                                -> Void
-      ++ title(v,s) changes the title which is shown in the two-dimensional 
-      ++ viewport window, v of domain \spadtype{TwoDimensionalViewport}.
-    putGraph       : ($,G,PI)                               -> Void
-      ++ putGraph(v,gi,n) sets the graph field indicated by n, of the
-      ++ indicated two-dimensional viewport, v, which is of domain
-      ++ \spadtype{TwoDimensionalViewport}, to be the graph, \spad{gi}
-      ++ of domain \spadtype{GraphImage}.  The contents of viewport, v,
-      ++ will contain \spad{gi} when the function \spadfun{makeViewport2D}
-      ++ is called to create the an updated viewport v.
-    getGraph       : ($,PI)                                 -> G
-      ++ getGraph(v,n) returns the graph which is of the domain
-      ++ \spadtype{GraphImage} which is located in graph field n
-      ++ of the given two-dimensional viewport, v, which is of the
-      ++ domain \spadtype{TwoDimensionalViewport}.
-    axes           : ($,PI,STR)                             -> Void
-      ++ axes(v,n,s) displays the axes of the graph in field n of
-      ++ the given two-dimensional viewport, v, which is of domain
-      ++ \spadtype{TwoDimensionalViewport}, if s is "on", or does
-      ++ not display the axes if s is "off".
-    axes           : ($,PI,PAL)                             -> Void
-      ++ axes(v,n,c) displays the axes of the graph in field n of
-      ++ the given two-dimensional viewport, v, which is of domain
-      ++ \spadtype{TwoDimensionalViewport}, with the axes color set to
-      ++ the given palette color c.
-    units          : ($,PI,STR)                             -> Void
-      ++ units(v,n,s) displays the units of the graph in field n of
-      ++ the given two-dimensional viewport, v, which is of domain
-      ++ \spadtype{TwoDimensionalViewport}, if s is "on", or does
-      ++ not display the units if s is "off".
-    units          : ($,PI,PAL)                             -> Void
-      ++ units(v,n,c) displays the units of the graph in field n of
-      ++ the given two-dimensional viewport, v, which is of domain
-      ++ \spadtype{TwoDimensionalViewport}, with the units color set to
-      ++ the given palette color c.
-    points         : ($,PI,STR)                             -> Void
-      ++ points(v,n,s) displays the points of the graph in field n of
-      ++ the given two-dimensional viewport, v, which is of domain
-      ++ \spadtype{TwoDimensionalViewport}, if s is "on", or does
-      ++ not display the points if s is "off".
-    region         : ($,PI,STR)                             -> Void
-      ++ region(v,n,s) displays the bounding box of the graph in
-      ++ field n of the given two-dimensional viewport, v, which is
-      ++ of domain \spadtype{TwoDimensionalViewport}, if s is "on",
-      ++ or does not display the bounding box if s is "off".
-    connect        : ($,PI,STR)                             -> Void
-      ++ connect(v,n,s) displays the lines connecting the graph
-      ++ points in field n of the given two-dimensional viewport, v,
-      ++ which is of domain \spadtype{TwoDimensionalViewport}, if s
-      ++ is "on", or does not display the lines if s is "off".
-    controlPanel   : ($,STR)                                -> Void
-      ++ controlPanel(v,s) displays the control panel of the given
-      ++ two-dimensional viewport, v, which is of domain
-      ++ \spadtype{TwoDimensionalViewport}, if s is "on", or hides
-      ++ the control panel if s is "off".
-    close          : $                                      -> Void
-      ++ close(v) closes the viewport window of the given
-      ++ two-dimensional viewport, v, which is of domain
-      ++ \spadtype{TwoDimensionalViewport}, and terminates the
-      ++ corresponding process ID.
-    dimensions     : ($,NNI,NNI,PI,PI)                      -> Void
-      ++ dimensions(v,x,y,width,height) sets the position of the
-      ++ upper left-hand corner of the two-dimensional viewport, v,
-      ++ which is of domain \spadtype{TwoDimensionalViewport}, to
-      ++ the window coordinate x, y, and sets the dimensions of the
-      ++ window to that of \spad{width}, \spad{height}.  The new
-      ++ dimensions are not displayed until the function
-      ++ \spadfun{makeViewport2D} is executed again for v.
-    scale          : ($,PI,F,F)                             -> Void
-      ++ scale(v,n,sx,sy) displays the graph in field n of the given
-      ++ two-dimensional viewport, v, which is of domain
-      ++ \spadtype{TwoDimensionalViewport}, scaled by the factor \spad{sx}
-      ++ in the x-coordinate direction and by the factor \spad{sy} in
-      ++ the y-coordinate direction.
-    translate      : ($,PI,F,F)                             -> Void
-      ++ translate(v,n,dx,dy) displays the graph in field n of the given
-      ++ two-dimensional viewport, v, which is of domain
-      ++ \spadtype{TwoDimensionalViewport}, translated by \spad{dx} in
-      ++ the x-coordinate direction from the center of the viewport, and
-      ++ by \spad{dy} in the y-coordinate direction from the center.
-      ++ Setting \spad{dx} and \spad{dy} to \spad{0} places the center
-      ++ of the graph at the center of the viewport.
-    show           : ($,PI,STR)                             -> Void
-      ++ show(v,n,s) displays the graph in field n of the given
-      ++ two-dimensional viewport, v, which is of domain
-      ++ \spadtype{TwoDimensionalViewport}, if s is "on", or does not
-      ++ display the graph if s is "off".
-    move           : ($,NNI,NNI)                            -> Void  
-      ++ move(v,x,y) displays the two-dimensional viewport, v, which
-      ++ is of domain \spadtype{TwoDimensionalViewport}, with the upper
-      ++ left-hand corner of the viewport window at the screen 
-      ++ coordinate position x, y.
-    update         :($,G,PI)                               -> Void
-      ++ update(v,gr,n) drops the graph \spad{gr} in slot \spad{n} 
-      ++ of viewport \spad{v}. The graph gr must have been 
-      ++ transmitted already and acquired an integer key.
-    resize         : ($,PI,PI)                              -> Void  
-      ++ resize(v,w,h) displays the two-dimensional viewport, v, which
-      ++ is of domain \spadtype{TwoDimensionalViewport}, with a width
-      ++ of w and a height of h, keeping the upper left-hand corner
-      ++ position unchanged.
-    write          : ($,STR)                                -> STR
-      ++ write(v,s) takes the given two-dimensional viewport, v, which
-      ++ is of domain \spadtype{TwoDimensionalViewport}, and creates
-      ++ a directory indicated by s, which contains the graph data
-      ++ files for v.
-    write          : ($,STR,STR)                            -> STR
-      ++ write(v,s,f) takes the given two-dimensional viewport, v, which
-      ++ is of domain \spadtype{TwoDimensionalViewport}, and creates
-      ++ a directory indicated by s, which contains the graph data
-      ++ files for v and an optional file type f.
-    write          : ($,STR,L STR)                          -> STR
-      ++ write(v,s,lf) takes the given two-dimensional viewport, v, which
-      ++ is of domain \spadtype{TwoDimensionalViewport}, and creates
-      ++ a directory indicated by s, which contains the graph data
-      ++ files for v and the optional file types indicated by the list lf.
-    reset          :  $                                     -> Void
-      ++ reset(v) sets the current state of the graph characteristics
-      ++ of the given two-dimensional viewport, v, which is of domain
-      ++ \spadtype{TwoDimensionalViewport}, back to their initial settings.
-    key            :  $                                     -> I
-      ++ key(v) returns the process ID number of the given two-dimensional
-      ++ viewport, v, which is of domain \spadtype{TwoDimensionalViewport}.
-    coerce         :  $                                     -> E
-      ++ coerce(v) returns the given two-dimensional viewport, v, which
-      ++ is of domain \spadtype{TwoDimensionalViewport} as output of
-      ++ the domain \spadtype{OutputForm}.
-
-  Implementation ==> add
-
-    import GraphImage()
-    import Color()
-    import Palette()
-    import ViewDefaultsPackage()
-    import DrawOptionFunctions0
-    import POINT
-
-    Rep := Record (key:I, graphsField:V GU, graphStatesField:V GS, _
-                   title:STR, moveTo:XYNN, size:XYP, flags:FLAG, optionsField:L DROP)
-
-    defaultGS : GS := [convert(0.9)@SF, convert(0.9)@SF, 0$SF, 0$SF, _
-                      yes, yes, no, _
-                      yes, axesColorDefault(), no, unitsColorDefault(), _
-                      yes]
-
-
-     --% Local Functions
-    checkViewport (viewport:$):B ==
-        -- checks to see if this viewport still exists
-        -- by sending the key to the viewport manager and
-        -- waiting for its reply after it checks it against
-        -- the viewports in its list. a -1 means it doesn't
-        -- exist.
-      sendI(VIEW,viewport.key)$Lisp
-      i := getI(VIEW)$Lisp
-      (i < 0$I) => 
-        viewport.key := 0$I
-        error "This viewport has already been closed!"
-      true
-
-    doOptions(v:Rep):Void ==    
-      v.title := title(v.optionsField,"AXIOM2D")
-      -- etc - 2D specific stuff...
-
-     --% Exported Functions
-
-    options viewport ==
-      viewport.optionsField
-
-    options(viewport,opts) ==
-      viewport.optionsField := opts
-      viewport
-
-    putGraph (viewport,aGraph,which) ==
-      if ((which > maxGRAPHS) or (which < 1)) then
-        error "Trying to put a graph with a negative index or too big an index"
-      viewport.graphsField.which := aGraph
-
-    getGraph (viewport,which) ==
-      if ((which > maxGRAPHS) or (which < 1)) then
-        error "Trying to get a graph with a negative index or too big an index"
-      viewport.graphsField.which case "undefined" =>
-        error "Graph is undefined!"
-      viewport.graphsField.which::GraphImage
-
-
-    graphStates viewport  == viewport.graphStatesField
-    graphs viewport       == viewport.graphsField
-    key viewport          == viewport.key
-
-    dimensions(viewport,ViewX,ViewY,ViewWidth,ViewHeight) ==
-      viewport.moveTo := [ViewX,ViewY]
-      viewport.size   := [ViewWidth,ViewHeight]
-
-    move(viewport,xLoc,yLoc) ==
-      viewport.moveTo := [xLoc,yLoc]
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW2D)$Lisp
-        sendI(VIEW,MOVE)$Lisp
-        checkViewport viewport =>
-          sendI(VIEW,xLoc)$Lisp
-          sendI(VIEW,yLoc)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-
-    update(viewport,graph,slot) ==
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW2D)$Lisp
-        sendI(VIEW,putGraph2D)$Lisp
-        checkViewport viewport =>
-          sendI(VIEW,key graph)$Lisp
-          sendI(VIEW,slot)$Lisp
-          getI(VIEW)$Lisp -- acknowledge 
-
-    resize(viewport,xSize,ySize) ==
-      viewport.size := [xSize,ySize]
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW2D)$Lisp
-        sendI(VIEW,RESIZE)$Lisp
-        checkViewport viewport =>
-          sendI(VIEW,xSize)$Lisp
-          sendI(VIEW,ySize)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-
-    translate(viewport,graphIndex,xTranslateF,yTranslateF) ==
-      xTranslate := convert(xTranslateF)@SF
-      yTranslate := convert(yTranslateF)@SF
-      if (graphIndex > maxGRAPHS) then
-        error "Referring to a graph with too big an index"
-      viewport.graphStatesField.graphIndex.deltaX := xTranslate
-      viewport.graphStatesField.graphIndex.deltaY := yTranslate
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW2D)$Lisp
-        sendI(VIEW,TRANSLATE2D)$Lisp
-        checkViewport viewport =>
-          sendI(VIEW,graphIndex)$Lisp
-          sendSF(VIEW,xTranslate)$Lisp
-          sendSF(VIEW,yTranslate)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-
-    scale(viewport,graphIndex,xScaleF,yScaleF) ==
-      xScale := convert(xScaleF)@SF
-      yScale := convert(yScaleF)@SF
-      if (graphIndex > maxGRAPHS) then
-        error "Referring to a graph with too big an index"
-      viewport.graphStatesField.graphIndex.scaleX := xScale  -- check union (undefined?)
-      viewport.graphStatesField.graphIndex.scaleY := yScale  -- check union (undefined?)
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW2D)$Lisp
-        sendI(VIEW,SCALE2D)$Lisp
-        checkViewport viewport =>
-          sendI(VIEW,graphIndex)$Lisp
-          sendSF(VIEW,xScale)$Lisp
-          sendSF(VIEW,yScale)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-
-    viewport2D ==
-      [0,new(maxGRAPHS,"undefined"), _
-       new(maxGRAPHS,copy defaultGS),"AXIOM2D", _
-        [viewPosDefault().1,viewPosDefault().2],[viewSizeDefault().1,viewSizeDefault().2], _
-         [noControl], [] ]
-      
-    makeViewport2D(g:G,opts:L DROP) ==
-      viewport               := viewport2D()
-      viewport.graphsField.1 := g
-      viewport.optionsField := opts
-      makeViewport2D viewport
-
-    makeViewport2D viewportDollar ==
-      viewport := viewportDollar::Rep
-      doOptions viewport --local function to extract and assign optional arguments for 2D viewports
-      sayBrightly(["   AXIOM2D data being transmitted to the viewport manager..."::E]$List(E))$Lisp
-      sendI(VIEW,typeVIEW2D)$Lisp
-      sendI(VIEW,makeVIEW2D)$Lisp
-      sendSTR(VIEW,viewport.title)$Lisp
-      sendI(VIEW,viewport.moveTo.X)$Lisp
-      sendI(VIEW,viewport.moveTo.Y)$Lisp
-      sendI(VIEW,viewport.size.X)$Lisp
-      sendI(VIEW,viewport.size.Y)$Lisp
-      sendI(VIEW,viewport.flags.showCP)$Lisp
-      for i in 1..maxGRAPHS repeat
-        g := (graphs viewport).i
-        if g case "undefined" then
-          sendI(VIEW,0$I)$Lisp
-        else
-          sendI(VIEW,key(g::G))$Lisp
-          gs := (graphStates viewport).i
-          sendSF(VIEW,gs.scaleX)$Lisp
-          sendSF(VIEW,gs.scaleY)$Lisp
-          sendSF(VIEW,gs.deltaX)$Lisp
-          sendSF(VIEW,gs.deltaY)$Lisp
-          sendI(VIEW,gs.points)$Lisp
-          sendI(VIEW,gs.connect)$Lisp
-          sendI(VIEW,gs.spline)$Lisp
-          sendI(VIEW,gs.axes)$Lisp
-          hueShade := hue hue gs.axesColor + shade gs.axesColor * numberOfHues()
-          sendI(VIEW,hueShade)$Lisp
-          sendI(VIEW,gs.units)$Lisp
-          hueShade := hue hue gs.unitsColor + shade gs.unitsColor * numberOfHues()
-          sendI(VIEW,hueShade)$Lisp
-          sendI(VIEW,gs.showing)$Lisp
-      viewport.key := getI(VIEW)$Lisp
-      viewport
-
-    graphState(viewport,num,sX,sY,dX,dY,Points,Lines,Spline, _
-               Axes,AxesColor,Units,UnitsColor,Showing) ==
-      viewport.graphStatesField.num := [sX,sY,dX,dY,Points,Lines,Spline, _
-                                        Axes,AxesColor,Units,UnitsColor,Showing]
-
-    title(viewport,Title) == 
-      viewport.title := Title
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW2D)$Lisp
-        sendI(VIEW,TITLE)$Lisp
-        checkViewport viewport =>
-          sendSTR(VIEW,Title)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-
-    reset viewport ==
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW2D)$Lisp
-        sendI(VIEW,SPADBUTTONPRESS)$Lisp
-        checkViewport viewport =>
-          sendI(VIEW,reset2D)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-
-    axes (viewport:$,graphIndex:PI,onOff:STR) : Void ==
-      if (graphIndex > maxGRAPHS) then
-        error "Referring to a graph with too big an index"
-      if onOff = "on" then
-        status := yes
-      else
-        status := no
-      viewport.graphStatesField.graphIndex.axes := status  -- check union (undefined?)
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW2D)$Lisp
-        sendI(VIEW,axesOnOff2D)$Lisp 
-        checkViewport viewport =>
-          sendI(VIEW,graphIndex)$Lisp
-          sendI(VIEW,status)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-
-    axes (viewport:$,graphIndex:PI,color:PAL) : Void ==
-      if (graphIndex > maxGRAPHS) then
-        error "Referring to a graph with too big an index"
-      viewport.graphStatesField.graphIndex.axesColor := color
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW2D)$Lisp
-        sendI(VIEW,axesColor2D)$Lisp
-        checkViewport viewport =>
-          sendI(VIEW,graphIndex)$Lisp
-          hueShade := hue hue color + shade color * numberOfHues()
-          sendI(VIEW,hueShade)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-
-    units (viewport:$,graphIndex:PI,onOff:STR) : Void ==
-      if (graphIndex > maxGRAPHS) then
-        error "Referring to a graph with too big an index"
-      if onOff = "on" then
-        status := yes
-      else
-        status := no
-      viewport.graphStatesField.graphIndex.units := status  -- check union (undefined?)
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW2D)$Lisp
-        sendI(VIEW,unitsOnOff2D)$Lisp
-        checkViewport viewport =>
-          sendI(VIEW,graphIndex)$Lisp
-          sendI(VIEW,status)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-
-    units (viewport:$,graphIndex:PI,color:PAL) : Void ==
-      if (graphIndex > maxGRAPHS) then
-        error "Referring to a graph with too big an index"
-      viewport.graphStatesField.graphIndex.unitsColor := color
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW2D)$Lisp
-        sendI(VIEW,unitsColor2D)$Lisp
-        checkViewport viewport =>
-          sendI(VIEW,graphIndex)$Lisp
-          hueShade := hue hue color + shade color * numberOfHues()
-          sendI(VIEW,hueShade)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-
-    connect (viewport:$,graphIndex:PI,onOff:STR) : Void ==
-      if (graphIndex > maxGRAPHS) then
-        error "Referring to a graph with too big an index"
-      if onOff = "on" then
-        status := 1$I
-      else
-        status := 0$I
-      viewport.graphStatesField.graphIndex.connect := status  -- check union (undefined?)
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW2D)$Lisp
-        sendI(VIEW,connectOnOff)$Lisp
-        checkViewport viewport =>
-          sendI(VIEW,graphIndex)$Lisp
-          sendI(VIEW,status)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-
-    points (viewport:$,graphIndex:PI,onOff:STR) : Void ==
-      if (graphIndex > maxGRAPHS) then
-        error "Referring to a graph with too big an index"
-      if onOff = "on" then
-        status := 1$I
-      else
-        status := 0$I
-      viewport.graphStatesField.graphIndex.points := status  -- check union (undefined?)
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW2D)$Lisp
-        sendI(VIEW,pointsOnOff)$Lisp
-        checkViewport viewport =>
-          sendI(VIEW,graphIndex)$Lisp
-          sendI(VIEW,status)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-
-    region (viewport:$,graphIndex:PI,onOff:STR) : Void ==
-      if (graphIndex > maxGRAPHS) then
-        error "Referring to a graph with too big an index"
-      if onOff = "on" then
-        status := 1$I
-      else
-        status := 0$I
-      viewport.graphStatesField.graphIndex.spline := status  -- check union (undefined?)
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW2D)$Lisp
-        sendI(VIEW,spline2D)$Lisp
-        checkViewport viewport =>
-          sendI(VIEW,graphIndex)$Lisp
-          sendI(VIEW,status)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-
-    show (viewport,graphIndex,onOff) ==
-      if (graphIndex > maxGRAPHS) then
-        error "Referring to a graph with too big an index"
-      if onOff = "on" then
-        status := 1$I
-      else
-        status := 0$I
-      viewport.graphStatesField.graphIndex.showing := status  -- check union (undefined?)
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW2D)$Lisp
-        sendI(VIEW,showing2D)$Lisp
-        checkViewport viewport =>
-          sendI(VIEW,graphIndex)$Lisp
-          sendI(VIEW,status)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-
-    controlPanel (viewport,onOff) ==
-      if onOff = "on" then viewport.flags.showCP := yes
-      else viewport.flags.showCP := no
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW2D)$Lisp
-        sendI(VIEW,hideControl2D)$Lisp
-        checkViewport viewport =>
-          sendI(VIEW,viewport.flags.showCP)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-
-    close viewport ==
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW2D)$Lisp
-        sendI(VIEW,closeAll2D)$Lisp
-        checkViewport viewport =>
-          getI(VIEW)$Lisp          -- acknowledge
-          viewport.key := 0$I
-
-    coerce viewport ==
-      (key(viewport) = 0$I) =>
-        hconcat ["Closed or Undefined TwoDimensionalViewport: "::E,
-                  (viewport.title)::E]
-      hconcat ["TwoDimensionalViewport: "::E, (viewport.title)::E]
-
-    write(viewport:$,Filename:STR,aThingToWrite:STR) ==
-      write(viewport,Filename,[aThingToWrite])
-    
-    write(viewport,Filename) ==
-      write(viewport,Filename,viewWriteDefault())
-
-    write(viewport:$,Filename:STR,thingsToWrite:L STR) ==
-      stringToSend : STR := ""
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW2D)$Lisp
-        sendI(VIEW,writeView)$Lisp
-        checkViewport viewport =>
-          sendSTR(VIEW,Filename)$Lisp
-          m := minIndex(avail := viewWriteAvailable())
-          for aTypeOfFile in thingsToWrite repeat
-            if (writeTypeInt:= position(upperCase aTypeOfFile,avail)-m) < 0 then
-              sayBrightly(["  > "::E,(concat(aTypeOfFile, _
-                " is not a valid file type for writing a 2D viewport"))::E]$List(E))$Lisp
-            else
-              sendI(VIEW,writeTypeInt+(1$I))$Lisp
-                  --              stringToSend := concat [stringToSend,"%",aTypeOfFile]
-                  --              sendSTR(VIEW,stringToSend)$Lisp
-          sendI(VIEW,0$I)$Lisp     -- no more types of things to write
-          getI(VIEW)$Lisp          -- acknowledge
-          Filename
-
-@
-\subsection{TEST VIEW2D}
-<<TEST VIEW2D>>=
-<<multigraph.input>>
-@
-\section{License}
-<<license>>=
---Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd.
---All rights reserved.
---
---Redistribution and use in source and binary forms, with or without
---modification, are permitted provided that the following conditions are
---met:
---
---    - Redistributions of source code must retain the above copyright
---      notice, this list of conditions and the following disclaimer.
---
---    - Redistributions in binary form must reproduce the above copyright
---      notice, this list of conditions and the following disclaimer in
---      the documentation and/or other materials provided with the
---      distribution.
---
---    - Neither the name of The Numerical ALgorithms Group Ltd. nor the
---      names of its contributors may be used to endorse or promote products
---      derived from this software without specific prior written permission.
---
---THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
---IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
---TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
---PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
---OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
---EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
---PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
---PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
---LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
---NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
---SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-@
-<<*>>=
-<<license>>
- 
-<<domain GRIMAGE GraphImage>>
-<<domain VIEW2D TwoDimensionalViewport>>
-@
-\eject
-\begin{thebibliography}{99}
-\bibitem{1} nothing
-\end{thebibliography}
-\end{document}
diff --git a/src/algebra/view3d.spad.pamphlet b/src/algebra/view3d.spad.pamphlet
deleted file mode 100644
index 2bcb53a..0000000
--- a/src/algebra/view3d.spad.pamphlet
+++ /dev/null
@@ -1,1006 +0,0 @@
-\documentclass{article}
-\usepackage{axiom}
-\begin{document}
-\title{\$SPAD/src/algebra view3D.spad}
-\author{James Wen}
-\maketitle
-\begin{abstract}
-\end{abstract}
-\eject
-\tableofcontents
-\eject
-\section{domain VIEW3D ThreeDimensionalViewport}
-<<domain VIEW3D ThreeDimensionalViewport>>=
-)abbrev domain VIEW3D ThreeDimensionalViewport
-++ Author: Jim Wen
-++ Date Created: 28 April 1989
-++ Date Last Updated: 2 November 1991, Jim Wen
-++ Basic Operations:
-++ Related Constructors:
-++ Also See:
-++ AMS Classifications:
-++ Keywords: 
-++ References:
-++ Description: ThreeDimensionalViewport creates viewports to display graphs
-VIEW    ==> VIEWPORTSERVER$Lisp
-sendI   ==> SOCK_-SEND_-INT
-sendSF  ==> SOCK_-SEND_-FLOAT
-sendSTR ==> SOCK_-SEND_-STRING
-getI    ==> SOCK_-GET_-INT
-getSF   ==> SOCK_-GET_-FLOAT
-
-typeVIEW3D   ==> 1$I
-typeVIEWTube ==> 4
-
-makeVIEW3D ==> (-1)$SingleInteger
-
-ThreeDimensionalViewport(): Exports == Implementation where
-  I   ==> Integer
-  PI  ==> PositiveInteger
-  NNI ==> NonNegativeInteger
-  XY  ==> Record( X:I, Y:I )
-  XYP ==> Record( X:PI, Y:PI )
-  XYNN ==> Record( X:NNI, Y:NNI )
-  SF  ==> DoubleFloat
-  F   ==> Float
-  L   ==> List
-  Pt ==> ColoredThreeDimensionalPoint
-  SEG ==> Segment
-  S   ==> String
-  E   ==> OutputForm
-  PLOT3D ==> Plot3D
-  TUBE   ==> TubePlot
-  V   ==> Record( theta:SF, phi:SF, scale:SF, scaleX:SF, scaleY:SF, scaleZ:SF, deltaX:SF, deltaY:SF )
-  H   ==> Record( hueOffset:I, hueNumber:I)
-  FLAG   ==> Record( showCP:I, style:I, axesOn:I, diagonalsOn:I, outlineRenderOn:I, showRegionField:I )
-  FR  ==> Record( fn:Fn2, fc: FnU, xmin:SF, xmax:SF, ymin:SF, ymax:SF, xnum:I, ynum:I )
-  FParamR ==> Record( theTube:TUBE )
-  LR  ==> Record( lightX:SF, lightY:SF, lightZ:SF, lightTheta:SF, lightPhi:SF , translucence:SF)
-  UFR ==> Union(FR,FParamR,"undefined")
-  PR  ==> Record( perspectiveField:I, eyeDistance:SF, hitherPlane:SF)
-  VR  ==> Record( clipXMin:SF, clipXMax:SF, clipYMin:SF, clipYMax:SF, clipZMin:SF, clipZMax:SF, clipRegionField:I, clipSurfaceField:I)
-  C   ==> Color()
-  B   ==> Boolean
-  POINT ==> Point(SF)
-  SUBSPACE ==> SubSpace(3,SF)
-  SPACE3 ==> ThreeSpace(SF)
-  DROP ==> DrawOption
-  COORDSYS ==> CoordinateSystems(SF)
-
-    -- the below macros correspond to the ones in include/actions.h
-  ROTATE       ==> 0$I  -- rotate      in actions.h
-  ZOOM         ==> 1$I  -- zoom        in actions.h
-  TRANSLATE    ==> 2    -- translate   in actions.h
-  rendered     ==> 3    -- render      in actions.h
-  hideControl  ==> 4
-  closeAll     ==> 5
-  axesOnOff    ==> 6
-  opaque       ==> 7    -- opaqueMesh  in action.h
-  contour      ==> 24
-  RESET        ==> 8
-  wireMesh     ==> 9    -- transparent in actions.h
-  region3D     ==> 12
-  smooth       ==> 22
-  diagOnOff    ==> 26      
-  outlineOnOff ==> 13      
-  zoomx        ==> 14
-  zoomy        ==> 15
-  zoomz        ==> 16
-  perspectiveOnOff ==> 27  
-  clipRegionOnOff ==> 66   
-  clipSurfaceOnOff ==> 67  
-
-  SPADBUTTONPRESS ==> 100
-  COLORDEF        ==> 101
-  MOVE            ==> 102
-  RESIZE          ==> 103
-  TITLE           ==> 104
-  lightDef        ==> 108
-  translucenceDef ==> 109
-  writeView       ==> 110
-  eyeDistanceData ==> 111
-  modifyPOINT     ==> 114
---  printViewport   ==> 115
-  hitherPlaneData ==> 116
-  queryVIEWPOINT  ==> 117
-  changeVIEWPOINT ==> 118
-
-  noControl ==> 0$I
-
-  yes       ==> 1$I
-  no        ==> 0$I
-
-  EYED      ==> 500::SF  -- see draw.h, should be the same(?) as clipOffset
-  HITHER    ==> (-250)::SF   -- see process.h in view3D/ (not yet passed to viewman)
-
-  openTube  ==> 1$I
-  closedTube ==> 0$I
-
-  fun2Var3D  ==> "   Three Dimensional Viewport: Function of Two Variables"
-  para1Var3D ==> "   Three Dimensional Viewport: Parametric Curve of One Variable"
-  undef3D    ==> "   Three Dimensional Viewport: No function defined for this viewport yet"
-
-  Exports ==> SetCategory with  
-    viewThetaDefault      : ()                                       -> F
-      ++ viewThetaDefault() returns the current default longitudinal
-      ++ view angle in radians.
-    viewThetaDefault      : F                                        -> F
-      ++ viewThetaDefault(t) sets the current default longitudinal
-      ++ view angle in radians to the value t and returns t.
-    viewPhiDefault        : ()                                       -> F
-      ++ viewPhiDefault() returns the current default latitudinal
-      ++ view angle in radians.
-    viewPhiDefault        : F                                        -> F
-      ++ viewPhiDefault(p) sets the current default latitudinal
-      ++ view angle in radians to the value p and returns p.
-    viewZoomDefault       : ()                                       -> F
-      ++ viewZoomDefault() returns the current default graph scaling
-      ++ value.
-    viewZoomDefault       : F                                        -> F
-      ++ viewZoomDefault(s) sets the current default graph scaling
-      ++ value to s and returns s.
-    viewDeltaXDefault     : ()                                       -> F
-      ++ viewDeltaXDefault() returns the current default horizontal
-      ++ offset from the center of the viewport window.
-    viewDeltaXDefault     : F                                        -> F
-      ++ viewDeltaXDefault(dx) sets the current default horizontal
-      ++ offset from the center of the viewport window to be \spad{dx}
-      ++ and returns \spad{dx}.
-    viewDeltaYDefault     : ()                                       -> F
-      ++ viewDeltaYDefault() returns the current default vertical
-      ++ offset from the center of the viewport window.
-    viewDeltaYDefault     : F                                        -> F
-      ++ viewDeltaYDefault(dy) sets the current default vertical
-      ++ offset from the center of the viewport window to be \spad{dy}
-      ++ and returns \spad{dy}.
-    viewport3D            : ()                                       -> %
-      ++ viewport3D() returns an undefined three-dimensional viewport
-      ++ of the domain \spadtype{ThreeDimensionalViewport} whose
-      ++ contents are empty.
-    makeViewport3D        : %                                        -> %
-      ++ makeViewport3D(v) takes the given three-dimensional viewport,
-      ++ v, of the domain \spadtype{ThreeDimensionalViewport} and
-      ++ displays a viewport window on the screen which contains 
-      ++ the contents of v.
-    makeViewport3D        : (SPACE3,S)                               -> %
-      ++ makeViewport3D(sp,s) takes the given space, \spad{sp} which is
-      ++ of the domain \spadtype{ThreeSpace} and displays a viewport
-      ++ window on the screen which contains the contents of \spad{sp},
-      ++ and whose title is given by s.
-    makeViewport3D        : (SPACE3,L DROP)                          -> %
-      ++ makeViewport3D(sp,lopt) takes the given space, \spad{sp} which is
-      ++ of the domain \spadtype{ThreeSpace} and displays a viewport
-      ++ window on the screen which contains the contents of \spad{sp},
-      ++ and whose draw options are indicated by the list \spad{lopt}, which
-      ++ is a list of options from the domain \spad{DrawOption}.
-    subspace              : %                                        -> SPACE3
-      ++ subspace(v) returns the contents of the viewport v, which is
-      ++ of the domain \spadtype{ThreeDimensionalViewport}, as a subspace
-      ++ of the domain \spad{ThreeSpace}.
-    subspace              : (%,SPACE3)                               -> %
-      ++ subspace(v,sp) places the contents of the viewport v, which is
-      ++ of the domain \spadtype{ThreeDimensionalViewport}, in the subspace
-      ++ \spad{sp}, which is of the domain \spad{ThreeSpace}.
-    modifyPointData       : (%,NNI,POINT)                            -> Void
-      ++ modifyPointData(v,ind,pt) takes the viewport, v, which is of the
-      ++ domain \spadtype{ThreeDimensionalViewport}, and places the data
-      ++ point, \spad{pt} into the list of points database of v at the index
-      ++ location given by \spad{ind}.
-    options               : %                                        -> L DROP
-      ++ options(v) takes the viewport, v, which is of the domain
-      ++ \spadtype{ThreeDimensionalViewport} and returns a list of all
-      ++ the draw options from the domain \spad{DrawOption} which are
-      ++ being used by v.
-    options               : (%,L DROP)                               -> %
-      ++ options(v,lopt) takes the viewport, v, which is of the domain
-      ++ \spadtype{ThreeDimensionalViewport} and sets the draw options
-      ++ being used by v to those indicated in the list, \spad{lopt},
-      ++ which is a list of options from the domain \spad{DrawOption}.
-    move                  : (%,NNI,NNI)                              -> Void
-      ++ move(v,x,y) displays the three-dimensional viewport, v, which
-      ++ is of domain \spadtype{ThreeDimensionalViewport}, with the upper
-      ++ left-hand corner of the viewport window at the screen 
-      ++ coordinate position x, y.
-    resize                : (%,PI,PI)                                -> Void
-      ++ resize(v,w,h) displays the three-dimensional viewport, v, which
-      ++ is of domain \spadtype{ThreeDimensionalViewport}, with a width
-      ++ of w and a height of h, keeping the upper left-hand corner
-      ++ position unchanged.
-    title                 : (%,S)                                    -> Void
-      ++ title(v,s) changes the title which is shown in the three-dimensional 
-      ++ viewport window, v of domain \spadtype{ThreeDimensionalViewport}.
-    dimensions            : (%,NNI,NNI,PI,PI)                        -> Void
-      ++ dimensions(v,x,y,width,height) sets the position of the
-      ++ upper left-hand corner of the three-dimensional viewport, v,
-      ++ which is of domain \spadtype{ThreeDimensionalViewport}, to
-      ++ the window coordinate x, y, and sets the dimensions of the
-      ++ window to that of \spad{width}, \spad{height}.  The new
-      ++ dimensions are not displayed until the function
-      ++ \spadfun{makeViewport3D} is executed again for v.
-    viewpoint             : (%,F,F,F,F,F)                            -> Void
-      ++ viewpoint(v,th,phi,s,dx,dy) sets the longitudinal view angle
-      ++ to \spad{th} radians, the latitudinal view angle to \spad{phi}
-      ++ radians, the scale factor to \spad{s}, the horizontal viewport 
-      ++ offset to \spad{dx}, and the vertical viewport offset to \spad{dy}
-      ++ for the viewport v, which is of the domain
-      ++ \spadtype{ThreeDimensionalViewport}.  The new viewpoint position
-      ++ is not displayed until the function \spadfun{makeViewport3D} is
-      ++ executed again for v.
-    viewpoint             : (%)					    -> V
-      ++ viewpoint(v) returns the current viewpoint setting of the given
-      ++ viewport, v.  This function is useful in the situation where the
-      ++ user has created a viewport, proceeded to interact with it via
-      ++ the control panel and desires to save the values of the viewpoint
-      ++ as the default settings for another viewport to be created using
-      ++ the system.
-    viewpoint		  : (%,V)				     -> Void
-      ++ viewpoint(v,viewpt) sets the viewpoint for the viewport.  The
-      ++ viewport record consists of the latitudal and longitudal angles,
-      ++ the zoom factor, the X, Y, and Z scales, and the X and Y displacements.
-    viewpoint             : (%,I,I,F,F,F)                            -> Void
-      ++ viewpoint(v,th,phi,s,dx,dy) sets the longitudinal view angle
-      ++ to \spad{th} degrees, the latitudinal view angle to \spad{phi}
-      ++ degrees, the scale factor to \spad{s}, the horizontal viewport 
-      ++ offset to \spad{dx}, and the vertical viewport offset to \spad{dy}
-      ++ for the viewport v, which is of the domain
-      ++ \spadtype{ThreeDimensionalViewport}.  The new viewpoint position
-      ++ is not displayed until the function \spadfun{makeViewport3D} is
-      ++ executed again for v.
-    viewpoint             : (%,F,F)                                  -> Void
-      ++ viewpoint(v,th,phi) sets the longitudinal view angle to \spad{th}
-      ++ radians and the latitudinal view angle to \spad{phi} radians
-      ++ for the viewport v, which is of the domain
-      ++ \spadtype{ThreeDimensionalViewport}.  The new viewpoint position
-      ++ is not displayed until the function \spadfun{makeViewport3D} is
-      ++ executed again for v.
-    viewpoint             : (%,F,F,F)                                -> Void
-      ++ viewpoint(v,rotx,roty,rotz) sets the rotation about the x-axis
-      ++ to be \spad{rotx} radians, sets the rotation about the y-axis
-      ++ to be \spad{roty} radians, and sets the rotation about the z-axis
-      ++ to be \spad{rotz} radians, for the viewport v, which is of the
-      ++ domain \spadtype{ThreeDimensionalViewport} and displays v with
-      ++ the new view position.
-    controlPanel          : (%,S)                                    -> Void
-      ++ controlPanel(v,s) displays the control panel of the given
-      ++ three-dimensional viewport, v, which is of domain
-      ++ \spadtype{ThreeDimensionalViewport}, if s is "on", or hides
-      ++ the control panel if s is "off".
-    axes                  : (%,S)                                    -> Void
-      ++ axes(v,s) displays the axes of the given three-dimensional
-      ++ viewport, v, which is of domain \spadtype{ThreeDimensionalViewport},
-      ++ if s is "on", or does not display the axes if s is "off".
-    diagonals             : (%,S)                                    -> Void
-      ++ diagonals(v,s) displays the diagonals of the polygon outline
-      ++ showing a triangularized surface instead of a quadrilateral
-      ++ surface outline, for the given three-dimensional viewport v
-      ++ which is of domain \spadtype{ThreeDimensionalViewport}, if s is 
-      ++ "on", or does not display the diagonals if s is "off".
-    outlineRender         : (%,S)                                    -> Void
-      ++ outlineRender(v,s) displays the polygon outline showing either
-      ++ triangularized surface or a quadrilateral surface outline depending
-      ++ on the whether the \spadfun{diagonals} function has been set, for
-      ++ the given three-dimensional viewport v which is of domain
-      ++ \spadtype{ThreeDimensionalViewport}, if s is "on", or does not
-      ++ display the polygon outline if s is "off".
-    drawStyle             : (%,S)                                    -> Void
-      ++ drawStyle(v,s) displays the surface for the given three-dimensional
-      ++ viewport v which is of domain \spadtype{ThreeDimensionalViewport}
-      ++ in the style of drawing indicated by s.  If s is not a valid
-      ++ drawing style the style is wireframe by default.  Possible
-      ++ styles are \spad{"shade"}, \spad{"solid"} or \spad{"opaque"},
-      ++ \spad{"smooth"}, and \spad{"wireMesh"}.
-    rotate                : (%,F,F)                                  -> Void
-      ++ rotate(v,th,phi) rotates the graph to the longitudinal view angle
-      ++ \spad{th} radians and the latitudinal view angle \spad{phi} radians
-      ++ for the viewport v, which is of the domain
-      ++ \spadtype{ThreeDimensionalViewport}.
-    rotate                : (%,I,I)                                  -> Void
-      ++ rotate(v,th,phi) rotates the graph to the longitudinal view angle
-      ++ \spad{th} degrees and the latitudinal view angle \spad{phi} degrees
-      ++ for the viewport v, which is of the domain
-      ++ \spadtype{ThreeDimensionalViewport}.  The new rotation position
-      ++ is not displayed until the function \spadfun{makeViewport3D} is
-      ++ executed again for v.
-    zoom                  : (%,F)                                    -> Void
-      ++ zoom(v,s) sets the graph scaling factor to s, for the viewport v,
-      ++ which is of the domain \spadtype{ThreeDimensionalViewport}.
-    zoom                  : (%,F,F,F)                                -> Void
-      ++ zoom(v,sx,sy,sz) sets the graph scaling factors for the x-coordinate
-      ++ axis to \spad{sx}, the y-coordinate axis to \spad{sy} and the
-      ++ z-coordinate axis to \spad{sz} for the viewport v, which is of
-      ++ the domain \spadtype{ThreeDimensionalViewport}.
-    translate             : (%,F,F)                                  -> Void
-      ++ translate(v,dx,dy) sets the horizontal viewport offset to \spad{dx}
-      ++ and the vertical viewport offset to \spad{dy}, for the viewport v,
-      ++ which is of the domain \spadtype{ThreeDimensionalViewport}.
-    perspective           : (%,S)                                    -> Void
-      ++ perspective(v,s) displays the graph in perspective if s is "on",
-      ++ or does not display perspective if s is "off" for the given
-      ++ three-dimensional viewport, v, which is of domain
-      ++ \spadtype{ThreeDimensionalViewport}.
-    eyeDistance           : (%,F)                                    -> Void
-      ++ eyeDistance(v,d) sets the distance of the observer from the center
-      ++ of the graph to d, for the viewport v, which is of the domain
-      ++ \spadtype{ThreeDimensionalViewport}.
-    hitherPlane           : (%,F)                                    -> Void
-      ++ hitherPlane(v,h) sets the hither clipping plane of the graph to h,
-      ++ for the viewport v, which is of the domain
-      ++ \spadtype{ThreeDimensionalViewport}.
-    showRegion            : (%,S)                                    -> Void
-      ++ showRegion(v,s) displays the bounding box of the given 
-      ++ three-dimensional viewport, v, which is of domain
-      ++ \spadtype{ThreeDimensionalViewport}, if s is "on", or does not
-      ++ display the box if s is "off".
-    showClipRegion        : (%,S)                                    -> Void
-      ++ showClipRegion(v,s) displays the clipping region of the given 
-      ++ three-dimensional viewport, v, which is of domain
-      ++ \spadtype{ThreeDimensionalViewport}, if s is "on", or does not
-      ++ display the region if s is "off".
-    clipSurface           : (%,S)                                    -> Void
-      ++ clipSurface(v,s) displays the graph with the specified
-      ++ clipping region removed if s is "on", or displays the graph
-      ++ without clipping implemented if s is "off", for the given 
-      ++ three-dimensional viewport, v, which is of domain
-      ++ \spadtype{ThreeDimensionalViewport}.
-    lighting              : (%,F,F,F)                                -> Void
-      ++ lighting(v,x,y,z) sets the position of the light source to
-      ++ the coordinates x, y, and z and displays the graph for the given 
-      ++ three-dimensional viewport, v, which is of domain
-      ++ \spadtype{ThreeDimensionalViewport}.
-    intensity             : (%,F)                                    -> Void
-      ++ intensity(v,i) sets the intensity of the light source to i, for
-      ++ the given three-dimensional viewport, v, which is of domain
-      ++ \spadtype{ThreeDimensionalViewport}.
-    reset                 :  %                                       -> Void
-      ++ reset(v) sets the current state of the graph characteristics
-      ++ of the given three-dimensional viewport, v, which is of domain
-      ++ \spadtype{ThreeDimensionalViewport}, back to their initial settings.
-    colorDef              : (%,C,C)                                  -> Void
-      ++ colorDef(v,c1,c2) sets the range of colors along the colormap so
-      ++ that the lower end of the colormap is defined by \spad{c1} and the
-      ++ top end of the colormap is defined by \spad{c2}, for the given
-      ++ three-dimensional viewport, v, which is of domain
-      ++ \spadtype{ThreeDimensionalViewport}.
-    write                 : (%,S)                                    -> S
-      ++ write(v,s) takes the given three-dimensional viewport, v, which
-      ++ is of domain \spadtype{ThreeDimensionalViewport}, and creates
-      ++ a directory indicated by s, which contains the graph data
-      ++ file for v.
-    write                 : (%,S,S)                                  -> S
-      ++ write(v,s,f) takes the given three-dimensional viewport, v, which
-      ++ is of domain \spadtype{ThreeDimensionalViewport}, and creates
-      ++ a directory indicated by s, which contains the graph data
-      ++ file for v and an optional file type f.
-    write                 : (%,S,L S)                                -> S
-      ++ write(v,s,lf) takes the given three-dimensional viewport, v, which
-      ++ is of domain \spadtype{ThreeDimensionalViewport}, and creates
-      ++ a directory indicated by s, which contains the graph data
-      ++ file for v and the optional file types indicated by the list lf.
-    close                 :  %                                       -> Void
-      ++ close(v) closes the viewport window of the given
-      ++ three-dimensional viewport, v, which is of domain
-      ++ \spadtype{ThreeDimensionalViewport}, and terminates the
-      ++ corresponding process ID.
-    key                   :  %                                       -> I
-      ++ key(v) returns the process ID number of the given three-dimensional
-      ++ viewport, v, which is of domain \spadtype{ThreeDimensionalViewport}.
---    print                 :  %                                       -> Void
-
-  Implementation ==> add
-    import Color()
-    import ViewDefaultsPackage()
-    import Plot3D()
-    import TubePlot()
-    import POINT
-    import PointPackage(SF)
-    import SubSpaceComponentProperty()
-    import SPACE3
-    import MeshCreationRoutinesForThreeDimensions()
-    import DrawOptionFunctions0
-    import COORDSYS
-    import Set(PositiveInteger)
-
-    Rep := Record (key:I, fun:I, _
-                   title:S, moveTo:XYNN, size:XYP, viewpoint:V, colors:H, flags:FLAG, _
-                   lighting:LR, perspective:PR, volume:VR, _
-                   space3D:SPACE3, _
-                   optionsField:L DROP)
-
-    degrees := pi()$F / 180.0
-    degreesSF := pi()$SF / 180
-    defaultTheta  : Reference(SF) := ref(convert(pi()$F/4.0)@SF)
-    defaultPhi    : Reference(SF) := ref(convert(-pi()$F/4.0)@SF)
-    defaultZoom   : Reference(SF) := ref(convert(1.2)@SF)
-    defaultDeltaX : Reference(SF) := ref 0
-    defaultDeltaY : Reference(SF) := ref 0
-
-
---%Local Functions
-    checkViewport (viewport:%):B ==
-        -- checks to see if this viewport still exists
-        -- by sending the key to the viewport manager and
-        -- waiting for its reply after it checks it against
-        -- the viewports in its list. a -1 means it doesn't
-        -- exist.
-      sendI(VIEW,viewport.key)$Lisp
-      i := getI(VIEW)$Lisp
-      (i < 0$I) => 
-        viewport.key := 0$I
-        error "This viewport has already been closed!"
-      true
-    
-    arcsinTemp(x:SF):SF ==
-      -- the asin function doesn't exist in the SF domain currently
-      x >= 1  => (pi()$SF / 2)  -- to avoid floating point error from SF (ie 1.0 -> 1.00001)
-      x <= -1 => 3 * pi()$SF / 2
-      convert(asin(convert(x)@Float)$Float)@SF
-
-    arctanTemp(x:SF):SF == convert(atan(convert(x)@Float)$Float)@SF
-
-    doOptions(v:Rep):Void ==    
-      v.title := title(v.optionsField,"AXIOM3D")
-      st:S := style(v.optionsField,"wireMesh")
-      if (st = "shade" or st = "render") then
-        v.flags.style := rendered
-      else if (st = "solid" or st = "opaque") then
-        v.flags.style := opaque
-      else if (st = "contour") then
-        v.flags.style := contour      
-      else if (st = "smooth") then
-        v.flags.style := smooth
-      else v.flags.style := wireMesh
-      v.viewpoint := viewpoint(v.optionsField,
-        [deref defaultTheta,deref defaultPhi,deref defaultZoom, _
-          1$SF,1$SF,1$SF,deref defaultDeltaX, deref defaultDeltaY])
-        -- etc - 3D specific stuff...
-
---%Exported Functions : Default Settings
-    viewport3D() ==
-      [0,typeVIEW3D,"AXIOM3D",[viewPosDefault().1,viewPosDefault().2], _
-       [viewSizeDefault().1,viewSizeDefault().2], _
-        [deref defaultTheta,deref defaultPhi,deref defaultZoom, _
-          1$SF,1$SF,1$SF,deref defaultDeltaX, deref defaultDeltaY], [0,27], _
-            [noControl,wireMesh,yes,no,no,no], [0$SF,0$SF,1$SF,0$SF,0$SF,1$SF], _
-              [yes, EYED, HITHER], [0$SF,1$SF,0$SF,1$SF,0$SF,1$SF,no,yes], _
-                create3Space()$SPACE3, [] ]
-
-    subspace viewport ==
-      viewport.space3D
-
-    subspace(viewport,space) ==
-      viewport.space3D := space
-      viewport
-
-    options viewport ==
-      viewport.optionsField
-
-    options(viewport,opts) ==
-      viewport.optionsField := opts
-      viewport
-
-    makeViewport3D(space:SPACE3,Title:S):% ==
-      v := viewport3D()
-      v.space3D := space
-      v.optionsField := [title(Title)]
-      makeViewport3D v
-
-    makeViewport3D(space:SPACE3,opts:L DROP):% ==
-      v := viewport3D()
-      v.space3D := space
-      v.optionsField := opts
-      makeViewport3D v
-
-    makeViewport3D viewport ==
-      doOptions viewport --local function to extract and assign optional arguments for 3D viewports
-      sayBrightly(["   Transmitting data..."::E]$List(E))$Lisp
-      transform := coord(viewport.optionsField,cartesian$COORDSYS)$DrawOptionFunctions0
-      check(viewport.space3D)
-      lpts := lp(viewport.space3D) 
-      lllipts  := lllip(viewport.space3D)
-      llprops := llprop(viewport.space3D)
-      lprops  := lprop(viewport.space3D)
-        -- check for dimensionality of points
-        -- if they are all 4D points, then everything is okay
-        -- if they are all 3D points, then pad an extra constant
-        -- coordinate for color
-        -- if they have varying dimensionalities, give an error
-      s := brace()$Set(PI)
-      for pt in lpts repeat
-        insert_!(dimension pt,s)
-      #s > 1 => error "All points should have the same dimension"
-      (n := first parts s) < 3 => error "Dimension of points should be greater than 2"
-      sendI(VIEW,viewport.fun)$Lisp
-      sendI(VIEW,makeVIEW3D)$Lisp
-      sendSTR(VIEW,viewport.title)$Lisp
-      sendSF(VIEW,viewport.viewpoint.deltaX)$Lisp
-      sendSF(VIEW,viewport.viewpoint.deltaY)$Lisp
-      sendSF(VIEW,viewport.viewpoint.scale)$Lisp
-      sendSF(VIEW,viewport.viewpoint.scaleX)$Lisp
-      sendSF(VIEW,viewport.viewpoint.scaleY)$Lisp
-      sendSF(VIEW,viewport.viewpoint.scaleZ)$Lisp
-      sendSF(VIEW,viewport.viewpoint.theta)$Lisp
-      sendSF(VIEW,viewport.viewpoint.phi)$Lisp
-      sendI(VIEW,viewport.moveTo.X)$Lisp
-      sendI(VIEW,viewport.moveTo.Y)$Lisp
-      sendI(VIEW,viewport.size.X)$Lisp
-      sendI(VIEW,viewport.size.Y)$Lisp
-      sendI(VIEW,viewport.flags.showCP)$Lisp
-      sendI(VIEW,viewport.flags.style)$Lisp
-      sendI(VIEW,viewport.flags.axesOn)$Lisp
-      sendI(VIEW,viewport.flags.diagonalsOn)$Lisp
-      sendI(VIEW,viewport.flags.outlineRenderOn)$Lisp
-      sendI(VIEW,viewport.flags.showRegionField)$Lisp  -- add to make3D.c
-      sendI(VIEW,viewport.volume.clipRegionField)$Lisp  -- add to make3D.c
-      sendI(VIEW,viewport.volume.clipSurfaceField)$Lisp  -- add to make3D.c
-      sendI(VIEW,viewport.colors.hueOffset)$Lisp
-      sendI(VIEW,viewport.colors.hueNumber)$Lisp
-      sendSF(VIEW,viewport.lighting.lightX)$Lisp
-      sendSF(VIEW,viewport.lighting.lightY)$Lisp
-      sendSF(VIEW,viewport.lighting.lightZ)$Lisp
-      sendSF(VIEW,viewport.lighting.translucence)$Lisp
-      sendI(VIEW,viewport.perspective.perspectiveField)$Lisp
-      sendSF(VIEW,viewport.perspective.eyeDistance)$Lisp
-        -- new, crazy points domain stuff
-          -- first, send the point data list
-      sendI(VIEW,#lpts)$Lisp
-      for pt in lpts repeat
-        aPoint := transform pt
-        sendSF(VIEW,xCoord aPoint)$Lisp
-        sendSF(VIEW,yCoord aPoint)$Lisp
-        sendSF(VIEW,zCoord aPoint)$Lisp
-        n = 3 => sendSF(VIEW,zCoord aPoint)$Lisp
-        sendSF(VIEW,color aPoint)$Lisp  -- change to c
-          -- now, send the 3d subspace structure
-      sendI(VIEW,#lllipts)$Lisp
-      for allipts in lllipts for oneprop in lprops for onelprops in llprops repeat
-           -- the following is false for f(x,y) and user-defined for [x(t),y(t),z(t)]
-           -- this is temporary - until the generalized points stuff gets put in
-        sendI(VIEW,(closed? oneprop => yes; no))$Lisp
-        sendI(VIEW,(solid? oneprop => yes; no))$Lisp
-        sendI(VIEW,#allipts)$Lisp
-        for alipts in allipts for tinyprop in onelprops repeat
-           -- the following is false for f(x,y) and true for [x(t),y(t),z(t)]
-           -- this is temporary -- until the generalized points stuff gets put in
-          sendI(VIEW,(closed? tinyprop => yes;no))$Lisp
-          sendI(VIEW,(solid? tinyprop => yes;no))$Lisp
-          sendI(VIEW,#alipts)$Lisp
-          for oneIndexedPoint in alipts repeat
-            sendI(VIEW,oneIndexedPoint)$Lisp 
-      viewport.key := getI(VIEW)$Lisp
-      viewport
-         -- the key (now set to 0) should be what the viewport returns
-
-    viewThetaDefault    == convert(defaultTheta())@F
-    viewThetaDefault  t == 
-      defaultTheta() := convert(t)@SF
-      t
-    viewPhiDefault      == convert(defaultPhi())@F
-    viewPhiDefault    t == 
-      defaultPhi() := convert(t)@SF
-      t
-    viewZoomDefault     == convert(defaultZoom())@F
-    viewZoomDefault   t == 
-      defaultZoom() := convert(t)@SF
-      t
-    viewDeltaXDefault   == convert(defaultDeltaX())@F
-    viewDeltaXDefault t == 
-      defaultDeltaX() := convert(t)@SF
-      t
-    viewDeltaYDefault   == convert(defaultDeltaY())@F
-    viewDeltaYDefault t == 
-      defaultDeltaY() := convert(t)@SF
-      t
-
---Exported Functions: Available features for 3D viewports
-    lighting(viewport,Xlight,Ylight,Zlight) ==
-      viewport.lighting.lightX := convert(Xlight)@SF
-      viewport.lighting.lightY := convert(Ylight)@SF
-      viewport.lighting.lightZ := convert(Zlight)@SF
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW3D)$Lisp
-        sendI(VIEW,lightDef)$Lisp
-        checkViewport viewport =>
-          sendSF(VIEW,viewport.lighting.lightX)$Lisp
-          sendSF(VIEW,viewport.lighting.lightY)$Lisp
-          sendSF(VIEW,viewport.lighting.lightZ)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-
-    axes (viewport,onOff) ==
-      if onOff = "on" then viewport.flags.axesOn := yes
-      else viewport.flags.axesOn := no
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW3D)$Lisp
-        sendI(VIEW,axesOnOff)$Lisp
-        checkViewport viewport =>
-          sendI(VIEW,viewport.flags.axesOn)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-
-    diagonals (viewport,onOff) ==
-      if onOff = "on" then viewport.flags.diagonalsOn := yes
-      else viewport.flags.diagonalsOn := no
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW3D)$Lisp
-        sendI(VIEW,diagOnOff)$Lisp
-        checkViewport viewport =>
-          sendI(VIEW,viewport.flags.diagonalsOn)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-
-    outlineRender (viewport,onOff) ==
-      if onOff = "on" then viewport.flags.outlineRenderOn := yes
-      else viewport.flags.outlineRenderOn := no
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW3D)$Lisp
-        sendI(VIEW,outlineOnOff)$Lisp
-        checkViewport viewport =>
-          sendI(VIEW,viewport.flags.outlineRenderOn)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-
-    controlPanel (viewport,onOff) ==
-      if onOff = "on" then viewport.flags.showCP := yes
-      else viewport.flags.showCP := no
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW3D)$Lisp
-        sendI(VIEW,hideControl)$Lisp
-        checkViewport viewport =>
-          sendI(VIEW,viewport.flags.showCP)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-
-    drawStyle (viewport,how) ==
-      if (how = "shade") then                    -- render
-        viewport.flags.style := rendered
-      else if (how = "solid") then               -- opaque
-        viewport.flags.style := opaque
-      else if (how = "contour") then             -- contour
-        viewport.flags.style := contour
-      else if (how = "smooth") then              -- smooth
-        viewport.flags.style := smooth
-      else viewport.flags.style := wireMesh
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW3D)$Lisp
-        sendI(VIEW,viewport.flags.style)$Lisp
-        checkViewport viewport =>
-          getI(VIEW)$Lisp          -- acknowledge
-
-    reset viewport ==
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW3D)$Lisp
-        sendI(VIEW,SPADBUTTONPRESS)$Lisp
-        checkViewport viewport =>
-          sendI(VIEW,RESET)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-
-    close viewport ==
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW3D)$Lisp
-        sendI(VIEW,closeAll)$Lisp
-        checkViewport viewport =>
-          getI(VIEW)$Lisp          -- acknowledge
-          viewport.key := 0$I
-
-    viewpoint (viewport:%):V ==
-      (key(viewport) ^= 0$I) =>
-	sendI(VIEW,typeVIEW3D)$Lisp
-	sendI(VIEW,queryVIEWPOINT)$Lisp
-	checkViewport viewport =>
-	  deltaX_sf : SF := getSF(VIEW)$Lisp
-	  deltaY_sf : SF := getSF(VIEW)$Lisp
-	  scale_sf  : SF := getSF(VIEW)$Lisp
-	  scaleX_sf : SF := getSF(VIEW)$Lisp
-	  scaleY_sf : SF := getSF(VIEW)$Lisp
-	  scaleZ_sf : SF := getSF(VIEW)$Lisp
-	  theta_sf  : SF := getSF(VIEW)$Lisp
-	  phi_sf    : SF := getSF(VIEW)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-	  viewport.viewpoint := 
-	    [ theta_sf, phi_sf, scale_sf, scaleX_sf, scaleY_sf, scaleZ_sf, 
-	      deltaX_sf, deltaY_sf ]
-        viewport.viewpoint
-
-    viewpoint (viewport:%, viewpt:V):Void ==
-      viewport.viewpoint := viewpt
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW3D)$Lisp
-        sendI(VIEW,changeVIEWPOINT)$Lisp
-        checkViewport viewport =>
-          sendSF(VIEW,viewport.viewpoint.deltaX)$Lisp
-          sendSF(VIEW,viewport.viewpoint.deltaY)$Lisp
-          sendSF(VIEW,viewport.viewpoint.scale)$Lisp
-          sendSF(VIEW,viewport.viewpoint.scaleX)$Lisp
-          sendSF(VIEW,viewport.viewpoint.scaleY)$Lisp
-          sendSF(VIEW,viewport.viewpoint.scaleZ)$Lisp
-          sendSF(VIEW,viewport.viewpoint.theta)$Lisp
-          sendSF(VIEW,viewport.viewpoint.phi)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-
-
-    viewpoint (viewport:%,Theta:F,Phi:F,Scale:F,DeltaX:F,DeltaY:F):Void ==
-      viewport.viewpoint := 
-        [convert(Theta)@SF,convert(Phi)@SF,convert(Scale)@SF,1$SF,1$SF,1$SF,convert(DeltaX)@SF,convert(DeltaY)@SF]
-
-    viewpoint (viewport:%,Theta:I,Phi:I,Scale:F,DeltaX:F,DeltaY:F):Void ==
-      viewport.viewpoint := [convert(Theta)@SF * degreesSF,convert(Phi)@SF * degreesSF,
-        convert(Scale)@SF,1$SF,1$SF,1$SF,convert(DeltaX)@SF,convert(DeltaY)@SF]
-
-    viewpoint (viewport:%,Theta:F,Phi:F):Void ==
-      viewport.viewpoint.theta := convert(Theta)@SF * degreesSF
-      viewport.viewpoint.phi   := convert(Phi)@SF * degreesSF
-
-    viewpoint (viewport:%,X:F,Y:F,Z:F):Void ==
-      Theta : F
-      Phi : F
-      if (X=0$F) and (Y=0$F) then
-        Theta := 0$F
-        if (Z>=0$F) then
-          Phi := 0$F
-        else 
-          Phi := 180.0
-      else
-        Theta := asin(Y/(R := sqrt(X*X+Y*Y)))
-        if (Z=0$F) then
-          Phi := 90.0
-        else
-          Phi := atan(Z/R)
-      rotate(viewport, Theta * degrees, Phi * degrees)
-    
-    title (viewport,Title) == 
-      viewport.title := Title
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW3D)$Lisp
-        sendI(VIEW,TITLE)$Lisp
-        checkViewport viewport =>
-          sendSTR(VIEW,Title)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-
-    colorDef (viewport,HueOffset,HueNumber) ==
-      viewport.colors := [h := (hue HueOffset),(hue HueNumber) - h]
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW3D)$Lisp
-        sendI(VIEW,COLORDEF)$Lisp
-        checkViewport viewport =>
-          sendI(VIEW,hue HueOffset)$Lisp
-          sendI(VIEW,hue HueNumber)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-
-    dimensions (viewport,ViewX,ViewY,ViewWidth,ViewHeight) ==
-      viewport.moveTo := [ViewX,ViewY]
-      viewport.size   := [ViewWidth,ViewHeight]
-
-    move(viewport,xLoc,yLoc) ==
-      viewport.moveTo := [xLoc,yLoc]
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW3D)$Lisp
-        sendI(VIEW,MOVE)$Lisp
-        checkViewport viewport =>
-          sendI(VIEW,xLoc)$Lisp
-          sendI(VIEW,yLoc)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-
-    resize(viewport,xSize,ySize) ==
-      viewport.size := [xSize,ySize]
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW3D)$Lisp
-        sendI(VIEW,RESIZE)$Lisp
-        checkViewport viewport =>
-          sendI(VIEW,xSize)$Lisp
-          sendI(VIEW,ySize)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
- 
-    coerce viewport ==
-      (key(viewport) = 0$I) =>
-        hconcat
-          ["Closed or Undefined ThreeDimensionalViewport: "::E,
-           (viewport.title)::E]
-      hconcat ["ThreeDimensionalViewport: "::E, (viewport.title)::E]
-
-    key viewport == viewport.key
-
-    rotate(viewport:%,Theta:I,Phi:I) ==
-      rotate(viewport,Theta::F * degrees,Phi::F * degrees) 
-
-    rotate(viewport:%,Theta:F,Phi:F) ==
-      viewport.viewpoint.theta := convert(Theta)@SF
-      viewport.viewpoint.phi   := convert(Phi)@SF
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW3D)$Lisp
-        sendI(VIEW,ROTATE)$Lisp
-        checkViewport viewport =>
-          sendSF(VIEW,viewport.viewpoint.theta)$Lisp
-          sendSF(VIEW,viewport.viewpoint.phi)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-
-    zoom(viewport:%,Scale:F) ==
-      viewport.viewpoint.scale := convert(Scale)@SF
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW3D)$Lisp
-        sendI(VIEW,ZOOM)$Lisp
-        checkViewport viewport =>
-          sendSF(VIEW,viewport.viewpoint.scale)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-
-    zoom(viewport:%,ScaleX:F,ScaleY:F,ScaleZ:F) ==
-      viewport.viewpoint.scaleX := convert(ScaleX)@SF
-      viewport.viewpoint.scaleY := convert(ScaleY)@SF
-      viewport.viewpoint.scaleZ := convert(ScaleZ)@SF
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW3D)$Lisp
-        sendI(VIEW,zoomx)$Lisp
-        checkViewport viewport =>
-          sendSF(VIEW,viewport.viewpoint.scaleX)$Lisp
-          sendSF(VIEW,viewport.viewpoint.scaleY)$Lisp
-          sendSF(VIEW,viewport.viewpoint.scaleZ)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-
-    translate(viewport,DeltaX,DeltaY) ==
-      viewport.viewpoint.deltaX := convert(DeltaX)@SF
-      viewport.viewpoint.deltaY := convert(DeltaY)@SF
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW3D)$Lisp
-        sendI(VIEW,TRANSLATE)$Lisp
-        checkViewport viewport =>
-          sendSF(VIEW,viewport.viewpoint.deltaX)$Lisp
-          sendSF(VIEW,viewport.viewpoint.deltaY)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-
-    intensity(viewport,Amount) ==
-      if (Amount < 0$F) or (Amount > 1$F) then
-        error "The intensity must be a value between 0 and 1, inclusively."
-      viewport.lighting.translucence := convert(Amount)@SF
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW3D)$Lisp
-        sendI(VIEW,translucenceDef)$Lisp
-        checkViewport viewport =>
-          sendSF(VIEW,viewport.lighting.translucence)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-
-    write(viewport:%,Filename:S,aThingToWrite:S) ==
-      write(viewport,Filename,[aThingToWrite])
-    
-    write(viewport,Filename) ==
-      write(viewport,Filename,viewWriteDefault())
-
-    write(viewport:%,Filename:S,thingsToWrite:L S) ==
-      stringToSend : S := ""
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW3D)$Lisp
-        sendI(VIEW,writeView)$Lisp
-        checkViewport viewport =>
-          sendSTR(VIEW,Filename)$Lisp
-          m := minIndex(avail := viewWriteAvailable())
-          for aTypeOfFile in thingsToWrite repeat
-            if (writeTypeInt:= position(upperCase aTypeOfFile,avail)-m) < 0 then
-              sayBrightly(["  > "::E,(concat(aTypeOfFile, _
-                " is not a valid file type for writing a 3D viewport"))::E]$List(E))$Lisp
-            else
-              sendI(VIEW,writeTypeInt+(1$I))$Lisp
-          sendI(VIEW,0$I)$Lisp     -- no more types of things to write
-          getI(VIEW)$Lisp          -- acknowledge
-          Filename
-
-    perspective (viewport,onOff) ==
-      if onOff = "on" then viewport.perspective.perspectiveField := yes
-      else viewport.perspective.perspectiveField := no
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW3D)$Lisp
-        sendI(VIEW,perspectiveOnOff)$Lisp
-        checkViewport viewport =>
-          sendI(VIEW,viewport.perspective.perspectiveField)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-
-    showRegion (viewport,onOff) ==
-      if onOff = "on" then viewport.flags.showRegionField := yes
-      else viewport.flags.showRegionField := no
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW3D)$Lisp
-        sendI(VIEW,region3D)$Lisp
-        checkViewport viewport =>
-          sendI(VIEW,viewport.flags.showRegionField)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-
-    showClipRegion (viewport,onOff) ==
-      if onOff = "on" then viewport.volume.clipRegionField := yes
-      else viewport.volume.clipRegionField := no
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW3D)$Lisp
-        sendI(VIEW,clipRegionOnOff)$Lisp
-        checkViewport viewport =>
-          sendI(VIEW,viewport.volume.clipRegionField)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-
-    clipSurface (viewport,onOff) ==
-      if onOff = "on" then viewport.volume.clipSurfaceField := yes
-      else viewport.volume.clipSurfaceField := no
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW3D)$Lisp
-        sendI(VIEW,clipSurfaceOnOff)$Lisp
-        checkViewport viewport =>
-          sendI(VIEW,viewport.volume.clipSurfaceField)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-
-    eyeDistance(viewport:%,EyeDistance:F) ==
-      viewport.perspective.eyeDistance := convert(EyeDistance)@SF
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW3D)$Lisp
-        sendI(VIEW,eyeDistanceData)$Lisp
-        checkViewport viewport =>
-          sendSF(VIEW,viewport.perspective.eyeDistance)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-
-    hitherPlane(viewport:%,HitherPlane:F) ==
-      viewport.perspective.hitherPlane := convert(HitherPlane)@SF
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW3D)$Lisp
-        sendI(VIEW,hitherPlaneData)$Lisp
-        checkViewport viewport =>
-          sendSF(VIEW,viewport.perspective.hitherPlane)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-
-    modifyPointData(viewport,anIndex,aPoint) ==
-      (n := dimension aPoint) < 3 => error "The point should have dimension of at least 3"
-      viewport.space3D := modifyPointData(viewport.space3D,anIndex,aPoint)
-      (key(viewport) ^= 0$I) =>
-        sendI(VIEW,typeVIEW3D)$Lisp
-        sendI(VIEW,modifyPOINT)$Lisp
-        checkViewport viewport =>
-          sendI(VIEW,anIndex)$Lisp
-          sendSF(VIEW,xCoord aPoint)$Lisp
-          sendSF(VIEW,yCoord aPoint)$Lisp
-          sendSF(VIEW,zCoord aPoint)$Lisp
-          if (n = 3) then sendSF(VIEW,convert(0.5)@SF)$Lisp
-          else sendSF(VIEW,color aPoint)$Lisp
-          getI(VIEW)$Lisp          -- acknowledge
-
---    print viewport ==
---      (key(viewport) ^= 0$I) =>
---        sendI(VIEW,typeVIEW3D)$Lisp
---        sendI(VIEW,printViewport)$Lisp
---        checkViewport viewport =>
---          getI(VIEW)$Lisp          -- acknowledge
-
-@
-\section{License}
-<<license>>=
---Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd.
---All rights reserved.
---
---Redistribution and use in source and binary forms, with or without
---modification, are permitted provided that the following conditions are
---met:
---
---    - Redistributions of source code must retain the above copyright
---      notice, this list of conditions and the following disclaimer.
---
---    - Redistributions in binary form must reproduce the above copyright
---      notice, this list of conditions and the following disclaimer in
---      the documentation and/or other materials provided with the
---      distribution.
---
---    - Neither the name of The Numerical ALgorithms Group Ltd. nor the
---      names of its contributors may be used to endorse or promote products
---      derived from this software without specific prior written permission.
---
---THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
---IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
---TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
---PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
---OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
---EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
---PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
---PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
---LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
---NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
---SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-@
-<<*>>=
-<<license>>
-
--- this is a new graphics package and does not depend on any of the
--- current plotting stuff
--- so it is best to run it in a minimum system (like spadsys)
-
-<<domain VIEW3D ThreeDimensionalViewport>>
-@
-\eject
-\begin{thebibliography}{99}
-\bibitem{1} nothing
-\end{thebibliography}
-\end{document}
diff --git a/src/algebra/void.spad.pamphlet b/src/algebra/void.spad.pamphlet
index 200d924..9187366 100644
--- a/src/algebra/void.spad.pamphlet
+++ b/src/algebra/void.spad.pamphlet
@@ -9,257 +9,6 @@
 \eject
 \tableofcontents
 \eject
-\section{domain VOID Void}
-<<Void.input>>=
--- void.spad.pamphlet Void.input
-)spool Void.output
-)set message test on
-)set message auto off
-)clear all
---S 1
-r := (a; b; if c then d else e; f) 
---R 
---R 
---RDaly Bug
---R   An expression following if/when must evaluate to a Boolean and you 
---R      have written one that does not.
---E 1
-
---S 2
-a : Integer
---R 
---R                                                                   Type: Void
---E 2
-
-)set message void on
-
---S 3
-b : Fraction Integer
---R 
---R
---R   (2)  "()"
---R                                                                   Type: Void
---E 3
-
-)set message void off
- 
---S 4
-3::Void
---R 
---R                                                                   Type: Void
---E 4
-
---S 5
-% :: PositiveInteger
---R 
---R 
---RDaly Bug
---R   Cannot convert from type Void to PositiveInteger for value
---R   "()"
---R
---E 5
-)spool
-)lisp (bye)
-@
-<<Void.help>>=
-====================================================================
-Void examples
-====================================================================
-
-When an expression is not in a value context, it is given type Void.
-For example, in the expression
-
-  r := (a; b; if c then d else e; f) 
-
-values are used only from the subexpressions c and f: all others are thrown 
-away.  The subexpressions a, b, d and e are evaluated for side-effects only 
-and have type Void.  There is a unique value of type Void.
-
-You will most often see results of type Void when you declare a variable.
-
-  a : Integer
-                                Type: Void
-
-Usually no output is displayed for Void results.  You can force the
-display of a rather ugly object by issuing
-
-  )set message void on
-
-  b : Fraction Integer
-                                Type: Void
-
-  )set message void off
-
-All values can be converted to type Void.
-
-  3::Void
-                                Type: Void
-
-Once a value has been converted to Void, it cannot be recovered.
-
-  % :: PositiveInteger
-   Cannot convert from type Void to PositiveInteger for value "()"
-
-See Also:
-o )show Void
-o $AXIOM/doc/src/algebra/void.spad.dvi
-
-@
-<<domain VOID Void>>=
-)abbrev domain VOID Void
--- These types act as the top and bottom of the type lattice
--- and are known to the compiler and interpreter for type resolution.
-++ Author: Stephen M. Watt
-++ Date Created: 1986
-++ Date Last Updated: May 30, 1991
-++ Basic Operations: 
-++ Related Domains: ErrorFunctions, ResolveLatticeCompletion, Exit
-++ Also See:
-++ AMS Classifications:
-++ Keywords: type, mode, coerce, no value
-++ Examples:
-++ References:
-++ Description:
-++   This type is used when no value is needed, e.g., in the \spad{then}
-++   part of a one armed \spad{if}.
-++   All values can be coerced to type Void.  Once a value has been coerced
-++   to Void, it cannot be recovered.
-
-Void: with
-        void: () -> %            ++ void() produces a void object.
-        coerce: % -> OutputForm  ++ coerce(v) coerces void object to outputForm.
-    == add
-        Rep := String
-        void()      == voidValue()$Lisp
-        coerce(v:%) == coerce(v)$Rep
-
-@
-\section{domain EXIT Exit}
-<<Exit.input>>=
--- void.spad.pamphlet Exit.input
-)spool Exit.output
-)set message test on
-)set message auto off
-)clear all
---S 1
-n := 0
---R 
---R
---R   (1)  0
---R                                                     Type: NonNegativeInteger
---E 1
-
---S 2
-gasp(): Exit ==
-  free n
-  n := n + 1
-  error "Oh no!"
---R 
---R   Function declaration gasp : () -> Exit has been added to workspace.
---R                                                                   Type: Void
---E 2
-
---S 3
-half(k) ==
-  if odd? k then gasp()
-  else k quo 2
---R 
---R                                                                   Type: Void
---E 3
-
---S 4
-half 4
---R 
---R   Compiling function gasp with type () -> Exit 
---R   Compiling function half with type PositiveInteger -> Integer 
---R
---R   (4)  2
---R                                                        Type: PositiveInteger
---E 4
-
---S 5
-half 3
---R 
---R 
---RDaly Bug
---R   Error signalled from user code in function gasp: 
---R      Oh no!
---E 5
-
---S 6
-n
---R 
---R
---R   (5)  1
---R                                                     Type: NonNegativeInteger
---E 6
-)spool
-)lisp (bye)
-@
-<<Exit.help>>=
-====================================================================
-Exit examples
-====================================================================
-
-A function that does not return directly to its caller has Exit as its
-return type.  The operation error is an example of one which does not
-return to its caller.  Instead, it causes a return to top-level.
-
-  n := 0
-
-The function gasp is given return type Exit since it is guaranteed
-never to return a value to its caller.
-
-  gasp(): Exit ==
-    free n
-    n := n + 1
-    error "Oh no!"
- 
-The return type of half is determined by resolving the types of the
-two branches of the if.
-
-  half(k) ==
-    if odd? k then gasp()
-    else k quo 2
-
-Because gasp has the return type Exit, the type of if in half is
-resolved to be Integer.
-
-  half 4
-
-  half 3
-
-  n
-
-See Also:
-o )show Exit
-o $AXIOM/doc/src/algebra/void.spad.dvi
-
-@
-<<domain EXIT Exit>>=
-)abbrev domain EXIT Exit
-++ Author: Stephen M. Watt
-++ Date Created: 1986
-++ Date Last Updated: May 30, 1991
-++ Basic Operations: 
-++ Related Domains: ErrorFunctions, ResolveLatticeCompletion, Void
-++ Also See:
-++ AMS Classifications:
-++ Keywords: exit, throw, error, non-local return
-++ Examples:
-++ References:
-++ Description:
-++   A function which does not return directly to its caller should
-++   have Exit as its return type.
-++
-++   Note: It is convenient to have a formal \spad{coerce} into each type from
-++   type Exit. This allows, for example, errors to be raised in 
-++   one half of a type-balanced \spad{if}.
-Exit: SetCategory == add
-        coerce(n:%) == error "Cannot use an Exit value."
-        n1 = n2     == error "Cannot use an Exit value."
-
-@
 \section{package RESLATC ResolveLatticeCompletion}
 <<package RESLATC ResolveLatticeCompletion>>=
 )abbrev package RESLATC ResolveLatticeCompletion
@@ -330,8 +79,6 @@ ResolveLatticeCompletion(S: Type): with
 <<*>>=
 <<license>>
  
-<<domain VOID Void>>
-<<domain EXIT Exit>>
 <<package RESLATC ResolveLatticeCompletion>>
 @
 \eject
diff --git a/src/algebra/wtpol.spad.pamphlet b/src/algebra/wtpol.spad.pamphlet
deleted file mode 100644
index c3ee8d2..0000000
--- a/src/algebra/wtpol.spad.pamphlet
+++ /dev/null
@@ -1,199 +0,0 @@
-\documentclass{article}
-\usepackage{axiom}
-\begin{document}
-\title{\$SPAD/src/algebra wtpol.spad}
-\author{James Davenport}
-\maketitle
-\begin{abstract}
-\end{abstract}
-\eject
-\tableofcontents
-\eject
-\section{domain WP WeightedPolynomials}
-<<domain WP WeightedPolynomials>>=
-)abbrev domain WP WeightedPolynomials
-++ Author: James Davenport
-++ Date Created:  17 April 1992
-++ Date Last Updated: 12 July 1992
-++ Basic Functions: Ring, changeWeightLevel
-++ Related Constructors: PolynomialRing
-++ Also See: OrdinaryWeightedPolynomials
-++ AMS Classifications:
-++ Keywords:
-++ References:
-++ Description:
-++ This domain represents truncated weighted polynomials over a general
-++ (not necessarily commutative) polynomial type. The variables must be
-++ specified, as must the weights.
-++ The representation is sparse
-++ in the sense that only non-zero terms are represented.
-
-WeightedPolynomials(R:Ring,VarSet: OrderedSet, E:OrderedAbelianMonoidSup,
-                           P:PolynomialCategory(R,E,VarSet),
-                             vl:List VarSet, wl:List NonNegativeInteger,
-                              wtlevel:NonNegativeInteger):
-       Ring with
-         if R has CommutativeRing then Algebra(R)
-         coerce: $ -> P
-	         ++ convert back into a "P", ignoring weights
-         if R has Field then "/": ($,$) -> Union($,"failed")
-	         ++ x/y division (only works if minimum weight
-	         ++ of divisor is zero, and if R is a Field)
-         coerce: P -> $
-	         ++ coerce(p) coerces p into Weighted form, applying weights and ignoring terms
-         changeWeightLevel: NonNegativeInteger -> Void
-        	 ++ changeWeightLevel(n) changes the weight level to the new value given:
-	         ++ NB: previously calculated terms are not affected
-    ==
-  add
-   --representations
-   Rep  := PolynomialRing(P,NonNegativeInteger)
-   p:P
-   w,x1,x2:$
-   n:NonNegativeInteger
-   z:Integer
-   changeWeightLevel(n) ==
-        wtlevel:=n
-   lookupList:List Record(var:VarSet, weight:NonNegativeInteger)
-   if #vl ^= #wl then error "incompatible length lists in WeightedPolynomial"
-   lookupList:=[[v,n] for v in vl for n in wl]
-   -- local operation
-   innercoerce:(p,z) -> $
-   lookup:Varset -> NonNegativeInteger
-   lookup v ==
-      l:=lookupList
-      while l ^= [] repeat
-        v = l.first.var => return l.first.weight
-        l:=l.rest
-      0
-   innercoerce(p,z) ==
-      z<0 => 0
-      zero? p => 0
-      mv:= mainVariable p
-      mv case "failed" => monomial(p,0)
-      n:=lookup(mv)
-      up:=univariate(p,mv)
-      ans:$
-      ans:=0
-      while not zero? up  repeat
-        d:=degree up
-        f:=n*d
-        lcup:=leadingCoefficient up
-        up:=up-leadingMonomial up
-        mon:=monomial(1,mv,d)
-        f<=z =>
-            tmp:= innercoerce(lcup,z-f)
-            while not zero? tmp repeat
-              ans:=ans+ monomial(mon*leadingCoefficient(tmp),degree(tmp)+f)
-              tmp:=reductum tmp
-      ans
-   coerce(p):$ == innercoerce(p,wtlevel)
-   coerce(w):P ==  "+"/[c for c in coefficients w]
-   coerce(p:$):OutputForm ==
-     zero? p => (0$Integer)::OutputForm
-     degree p = 0 => leadingCoefficient(p):: OutputForm
-     reduce("+",(reverse [paren(c::OutputForm) for c in coefficients p])
-                 ::List OutputForm)
-   0 == 0$Rep
-   1 == 1$Rep
-   x1 = x2 ==
-      -- Note that we must strip out any terms greater than wtlevel
-      while degree x1 > wtlevel repeat
-            x1 := reductum x1
-      while degree x2 > wtlevel repeat
-            x2 := reductum x2
-      x1 =$Rep x2
-   x1 + x2 == x1 +$Rep x2
-   -x1 == -(x1::Rep)
-   x1 * x2 ==
-     -- Note that this is probably an extremely inefficient definition
-     w:=x1 *$Rep x2
-     while degree(w) > wtlevel repeat
-           w:=reductum w
-     w
-
-@
-\section{domain OWP OrdinaryWeightedPolynomials}
-<<domain OWP OrdinaryWeightedPolynomials>>=
-)abbrev domain OWP OrdinaryWeightedPolynomials
-++ Author: James Davenport
-++ Date Created:  17 April 1992
-++ Date Last Updated: 12 July 1992
-++ Basic Functions: Ring, changeWeightLevel
-++ Related Constructors: WeightedPolynomials
-++ Also See: PolynomialRing
-++ AMS classifications:
-++ Keywords:
-++ References:
-++ Description:
-++ This domain represents truncated weighted polynomials over the
-++ "Polynomial" type. The variables must be
-++ specified, as must the weights.
-++ The representation is sparse
-++ in the sense that only non-zero terms are represented.
-
-OrdinaryWeightedPolynomials(R:Ring,
-                             vl:List Symbol, wl:List NonNegativeInteger,
-                              wtlevel:NonNegativeInteger):
-       Ring with
-         if R has CommutativeRing then Algebra(R)
-         coerce: $ -> Polynomial(R)
-	         ++ coerce(p) converts back into a Polynomial(R), ignoring weights
-         coerce: Polynomial(R) -> $
-      	 	++ coerce(p) coerces a Polynomial(R) into Weighted form,
-         	++ applying weights and ignoring terms
-         if R has Field then "/": ($,$) -> Union($,"failed")
-	         ++ x/y division (only works if minimum weight
-       		 ++ of divisor is zero, and if R is a Field)
-         changeWeightLevel: NonNegativeInteger -> Void
-	         ++ changeWeightLevel(n) This changes the weight level to the new value given:
-         	 ++ NB: previously calculated terms are not affected
-    == WeightedPolynomials(R,Symbol,IndexedExponents(Symbol),
-                           Polynomial(R),
-                            vl,wl,wtlevel)
-
-@
-\section{License}
-<<license>>=
---Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd.
---All rights reserved.
---
---Redistribution and use in source and binary forms, with or without
---modification, are permitted provided that the following conditions are
---met:
---
---    - Redistributions of source code must retain the above copyright
---      notice, this list of conditions and the following disclaimer.
---
---    - Redistributions in binary form must reproduce the above copyright
---      notice, this list of conditions and the following disclaimer in
---      the documentation and/or other materials provided with the
---      distribution.
---
---    - Neither the name of The Numerical ALgorithms Group Ltd. nor the
---      names of its contributors may be used to endorse or promote products
---      derived from this software without specific prior written permission.
---
---THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
---IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
---TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
---PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
---OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
---EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
---PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
---PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
---LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
---NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
---SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-@
-<<*>>=
-<<license>>
-
-<<domain WP WeightedPolynomials>>
-<<domain OWP OrdinaryWeightedPolynomials>>
-@
-\eject
-\begin{thebibliography}{99}
-\bibitem{1} nothing
-\end{thebibliography}
-\end{document}
diff --git a/src/algebra/xlpoly.spad.pamphlet b/src/algebra/xlpoly.spad.pamphlet
index bc703ed..ac27d5a 100644
--- a/src/algebra/xlpoly.spad.pamphlet
+++ b/src/algebra/xlpoly.spad.pamphlet
@@ -9,948 +9,6 @@
 \eject
 \tableofcontents
 \eject
-\section{domain MAGMA Magma}
-<<Magma.input>>=
--- xlpoly.spad.pamphlet Magma.input
-)spool Magma.output
-)set message test on
-)set message auto off
-)clear all
---S 1
-x:Symbol :='x
---R 
---R
---R   (1)  x
---R                                                                 Type: Symbol
---E 1
-
---S 2
-y:Symbol :='y
---R 
---R
---R   (2)  y
---R                                                                 Type: Symbol
---E 2
-
---S 3
-z:Symbol :='z
---R 
---R
---R   (3)  z
---R                                                                 Type: Symbol
---E 3
-
---S 4
-word := OrderedFreeMonoid(Symbol)
---R 
---R
---R   (4)  OrderedFreeMonoid Symbol
---R                                                                 Type: Domain
---E 4
-
---S 5
-tree := Magma(Symbol)
---R 
---R
---R   (5)  Magma Symbol
---R                                                                 Type: Domain
---E 5
-
---S 6
-a:tree := x*x 
---R 
---R
---R   (6)  [x,x]
---R                                                           Type: Magma Symbol
---E 6
-
---S 7
-b:tree := y*y
---R 
---R
---R   (7)  [y,y]
---R                                                           Type: Magma Symbol
---E 7
-
---S 8
-c:tree := a*b
---R 
---R
---R   (8)  [[x,x],[y,y]]
---R                                                           Type: Magma Symbol
---E 8
-
---S 9
-left c
---R 
---R
---R   (9)  [x,x]
---R                                                           Type: Magma Symbol
---E 9
-
---S 10
-right c
---R 
---R
---R   (10)  [y,y]
---R                                                           Type: Magma Symbol
---E 10
-
---S 11
-length c
---R 
---R
---R   (11)  4
---R                                                        Type: PositiveInteger
---E 11
-
---S 12
-c::word
---R 
---R
---R          2 2
---R   (12)  x y
---R                                               Type: OrderedFreeMonoid Symbol
---E 12
-
---S 13
-a < b
---R 
---R
---R   (13)  true
---R                                                                Type: Boolean
---E 13
-
---S 14
-a < c
---R 
---R
---R   (14)  true
---R                                                                Type: Boolean
---E 14
-
---S 15
-b < c
---R 
---R
---R   (15)  true
---R                                                                Type: Boolean
---E 15
-
---S 16
-first c
---R 
---R
---R   (16)  x
---R                                                                 Type: Symbol
---E 16
-
---S 17
-rest c
---R 
---R
---R   (17)  [x,[y,y]]
---R                                                           Type: Magma Symbol
---E 17
-
---S 18
-rest rest c
---R 
---R
---R   (18)  [y,y]
---R                                                           Type: Magma Symbol
---E 18
-
---S 19
-ax:tree := a*x
---R 
---R
---R   (19)  [[x,x],x]
---R                                                           Type: Magma Symbol
---E 19
-
---S 20
-xa:tree := x*a
---R 
---R
---R   (20)  [x,[x,x]]
---R                                                           Type: Magma Symbol
---E 20
-
---S 21
-xa < ax
---R 
---R
---R   (21)  true
---R                                                                Type: Boolean
---E 21
-
---S 22
-lexico(xa,ax)
---R 
---R
---R   (22)  false
---R                                                                Type: Boolean
---E 22
-)spool
-)lisp (bye)
-@
-<<Magma.help>>=
-====================================================================
-Magma examples
-====================================================================
-
-Initialisations
-
-  x:Symbol :='x
-    x
-                         Type: Symbol
-
-  y:Symbol :='y
-    y
-                         Type: Symbol
-
-  z:Symbol :='z
-    z
-                         Type: Symbol
-
-  word := OrderedFreeMonoid(Symbol)
-    OrderedFreeMonoid Symbol
-                         Type: Domain
-
-  tree := Magma(Symbol)
-    Magma Symbol
-                         Type: Domain
-
-Let's make some trees
-
-  a:tree := x*x 
-    [x,x]
-                         Type: Magma Symbol
-
-  b:tree := y*y
-    [y,y]
-                         Type: Magma Symbol
-
-  c:tree := a*b
-    [[x,x],[y,y]]
-                         Type: Magma Symbol
-
-Query the trees
-
-  left c
-    [x,x]
-                         Type: Magma Symbol
-
-  right c
-    [y,y]
-                         Type: Magma Symbol
-
-  length c
-    4
-                         Type: PositiveInteger
-
-Coerce to the monoid
-
-  c::word
-     2 2
-    x y
-                         Type: OrderedFreeMonoid Symbol
-
-Check ordering
-
-  a < b
-    true
-                         Type: Boolean
-
-  a < c
-    true
-                         Type: Boolean
-
-  b < c
-    true
-                         Type: Boolean
-
-Navigate the tree
-
-  first c
-    x
-                         Type: Symbol
-
-  rest c
-    [x,[y,y]]
-                         Type: Magma Symbol
-
-  rest rest c
-    [y,y]
-                         Type: Magma Symbol
-
-Check ordering
-
-  ax:tree := a*x
-    [[x,x],x]
-                         Type: Magma Symbol
-
-  xa:tree := x*a
-    [x,[x,x]]
-                         Type: Magma Symbol
-
-  xa < ax
-    true
-                         Type: Boolean
-
-  lexico(xa,ax)
-    false
-                         Type: Boolean
-
-See Also:
-o )show Magma
-o $AXIOM/doc/src/algebra/xlpoly.spad.dvi
-
-@
-<<domain MAGMA Magma>>=
-)abbrev domain MAGMA Magma
-++ Author: Michel Petitot (petitot@lifl.fr).
-++ Date Created: 91
-++ Date Last Updated: 7 Juillet 92
-++ Fix History: compilation v 2.1 le 13 dec 98
-++ Basic Functions:
-++ Related Constructors:
-++ Also See:
-++ AMS Classifications:
-++ Keywords:
-++ References:
-++ Description:
-++ This type is the basic representation of 
-++ parenthesized words (binary trees over arbitrary symbols)
-++ useful in \spadtype{LiePolynomial}. \newline Author: Michel Petitot (petitot@lifl.fr).
-
-Magma(VarSet:OrderedSet):Public == Private where
-   WORD ==> OrderedFreeMonoid(VarSet)
-   EX   ==> OutputForm
-
-   Public == Join(OrderedSet,RetractableTo VarSet) with
-      "*"           : ($,$) -> $
-        ++ \axiom{x*y} returns the tree \axiom{[x,y]}.
-      coerce        : $ -> WORD
-        ++ \axiom{coerce(x)} returns the element of \axiomType{OrderedFreeMonoid}(VarSet) 
-        ++ corresponding to \axiom{x} by removing parentheses.
-      first         : $ -> VarSet
-        ++ \axiom{first(x)} returns the first entry of the tree \axiom{x}.
-      left          : $ -> $
-        ++ \axiom{left(x)} returns left subtree of \axiom{x} or
-        ++ error if \axiomOpFrom{retractable?}{Magma}(\axiom{x}) is true.
-      length        : $ -> PositiveInteger
-        ++ \axiom{length(x)} returns the number of entries in \axiom{x}.
-      lexico        : ($,$) -> Boolean
-        ++ \axiom{lexico(x,y)} returns \axiom{true} iff  \axiom{x} is smaller than 
-        ++ \axiom{y} w.r.t. the lexicographical ordering induced by \axiom{VarSet}. 
-        ++ N.B. This operation does not take into account the tree structure of
-        ++ its arguments. Thus this is not a total ordering.
-      mirror        : $ -> $
-        ++ \axiom{mirror(x)} returns the reversed word of \axiom{x}. 
-        ++ That is \axiom{x} itself if \axiomOpFrom{retractable?}{Magma}(\axiom{x}) is true and
-        ++ \axiom{mirror(z) * mirror(y)} if \axiom{x} is \axiom{y*z}.
-      rest          : $ -> $
-        ++ \axiom{rest(x)} return \axiom{x} without the first entry or 
-        ++ error if \axiomOpFrom{retractable?}{Magma}(\axiom{x}) is true.
-      retractable?  : $ -> Boolean
-        ++ \axiom{retractable?(x)} tests if \axiom{x} is a tree with only one entry.
-      right         : $ -> $
-        ++ \axiom{right(x)} returns right subtree of \axiom{x} or 
-        ++ error if \axiomOpFrom{retractable?}{Magma}(\axiom{x}) is true.
-      varList       : $ -> List VarSet
-        ++ \axiom{varList(x)} returns the list of distinct entries of \axiom{x}.
-
-   Private == add
-    -- representation
-      VWORD := Record(left:$ ,right:$)
-      Rep:= Union(VarSet,VWORD)  
-
-      recursif: ($,$) -> Boolean
-
-    -- define
-      x:$ = y:$ ==
-        x case VarSet => 
-           y case VarSet => x::VarSet = y::VarSet
-           false
-        y case VWORD => x::VWORD = y::VWORD
-        false
- 
-      varList x == 
-        x case VarSet => [x::VarSet]
-        lv: List VarSet := setUnion(varList x.left, varList x.right)
-        sort_!(lv)
-
-      left x == 
-        x case VarSet => error "x has only one entry"
-        x.left
-
-      right x == 
-        x case VarSet => error "x has only one entry"
-        x.right
-      retractable? x == (x case VarSet)
-
-      retract x ==
-         x case VarSet => x::VarSet
-         error "Not retractable"
-
-      retractIfCan x == (retractable? x => x::VarSet ; "failed")
-      coerce(l:VarSet):$  == l
-
-      mirror x ==
-        x case VarSet => x
-        [mirror x.right, mirror x.left]$VWORD
-
-      coerce(x:$): WORD ==
-        x case VarSet => x::VarSet::WORD
-        x.left::WORD * x.right::WORD
-
-      coerce(x:$):EX ==
-         x case VarSet => x::VarSet::EX
-         bracket [x.left::EX, x.right::EX]
-
-      x * y == [x,y]$VWORD
-
-      first x ==
-         x case VarSet => x::VarSet
-         first x.left
-
-      rest x ==
-         x case VarSet => error "rest$Magma: inexistant rest"
-         lx:$ := x.left
-         lx case VarSet => x.right
-         [rest lx , x.right]$VWORD
-
-      length x ==
-         x case VarSet => 1
-         length(x.left) + length(x.right)
-
-      recursif(x,y) ==    
-         x case VarSet => 
-            y case VarSet => x::VarSet < y::VarSet
-            true
-         y case VarSet => false
-         x.left =  y.left =>  x.right <  y.right
-         x.left < y.left
-
-      lexico(x,y) ==      	-- peut etre amelioree !!!!!!!!!!!
-         x case VarSet => 
-            y case VarSet => x::VarSet < y::VarSet
-            x::VarSet <= first y
-         y case VarSet => first x < retract y
-         fx:VarSet := first x ; fy:VarSet := first y 
-         fx = fy => lexico(rest x , rest y)
-         fx < fy 
-
-      x < y ==                 	-- recursif par longueur
-         lx,ly: PositiveInteger
-         lx:= length x ; ly:= length y
-         lx = ly => recursif(x,y)
-         lx < ly 
-
-@
-\section{domain LWORD LyndonWord}
-<<LyndonWord.input>>=
--- xlpoly.spad.pamphlet LyndonWord.input
-)spool LyndonWord.output
-)set message test on
-)set message auto off
-)clear all
---S 1 of 22
-a:Symbol :='a
---R 
---R
---R   (1)  a
---R                                                                 Type: Symbol
---E 1
-
---S 2 of 22
-b:Symbol :='b
---R 
---R
---R   (2)  b
---R                                                                 Type: Symbol
---E 2
-
---S 3 of 22
-c:Symbol :='c
---R 
---R
---R   (3)  c
---R                                                                 Type: Symbol
---E 3
-
---S 4 of 22
-lword:= LyndonWord(Symbol)
---R 
---R
---R   (4)  LyndonWord Symbol
---R                                                                 Type: Domain
---E 4
-
---S 5 of 22
-magma := Magma(Symbol)
---R 
---R
---R   (5)  Magma Symbol
---R                                                                 Type: Domain
---E 5
-
---S 6 of 22
-word := OrderedFreeMonoid(Symbol)
---R 
---R
---R   (6)  OrderedFreeMonoid Symbol
---R                                                                 Type: Domain
---E 6
-
---S 7 of 22
-LyndonWordsList1([a,b,c],3)$lword
---R 
---R
---R   (7)
---R   [[[a],[b],[c]], [[a b],[a c],[b c]],
---R       2     2       2                      2    2       2
---R    [[a b],[a c],[a b ],[a b c],[a c b],[a c ],[b c],[b c ]]]
---R                             Type: OneDimensionalArray List LyndonWord Symbol
---E 7
-
---S 8 of 22
-LyndonWordsList([a,b,c],3)$lword
---R 
---R
---R   (8)
---R                                          2      2        2
---R   [[a], [b], [c], [a b], [a c], [b c], [a b], [a c], [a b ], [a b c], [a c b],
---R        2     2        2
---R    [a c ], [b c], [b c ]]
---R                                                 Type: List LyndonWord Symbol
---E 8
-
---S 9 of 22
-lw := LyndonWordsList([a,b],5)$lword
---R 
---R
---R   (9)
---R                       2        2     3      2 2       3     4      3 2
---R   [[a], [b], [a b], [a b], [a b ], [a b], [a b ], [a b ], [a b], [a b ],
---R      2          2 3           2       4
---R    [a b a b], [a b ], [a b a b ], [a b ]]
---R                                                 Type: List LyndonWord Symbol
---E 9
-
---S 10 of 22
-w1 : word := lw.4 :: word
---R 
---R
---R          2
---R   (10)  a b
---R                                               Type: OrderedFreeMonoid Symbol
---E 10
-
---S 11 of 22
-w2 : word := lw.5 :: word
---R 
---R
---R            2
---R   (11)  a b
---R                                               Type: OrderedFreeMonoid Symbol
---E 11
-
---S 12 of 22
-factor(a::word)$lword
---R 
---R
---R   (12)  [[a]]
---R                                                 Type: List LyndonWord Symbol
---E 12
-
---S 13 of 22
-factor(w1*w2)$lword
---R 
---R
---R            2     2
---R   (13)  [[a b a b ]]
---R                                                 Type: List LyndonWord Symbol
---E 13
-
---S 14 of 22
-factor(w2*w2)$lword
---R 
---R
---R              2      2
---R   (14)  [[a b ],[a b ]]
---R                                                 Type: List LyndonWord Symbol
---E 14
-
---S 15 of 22
-factor(w2*w1)$lword
---R 
---R
---R              2    2
---R   (15)  [[a b ],[a b]]
---R                                                 Type: List LyndonWord Symbol
---E 15
-
---S 16 of 22
-lyndon?(w1)$lword
---R 
---R
---R   (16)  true
---R                                                                Type: Boolean
---E 16
-
---S 17 of 22
-lyndon?(w1*w2)$lword
---R 
---R
---R   (17)  true
---R                                                                Type: Boolean
---E 17
-
---S 18 of 22
-lyndon?(w2*w1)$lword
---R 
---R
---R   (18)  false
---R                                                                Type: Boolean
---E 18
-
---S 19 of 22
-lyndonIfCan(w1)$lword
---R 
---R
---R           2
---R   (19)  [a b]
---R                                           Type: Union(LyndonWord Symbol,...)
---E 19
-
---S 20 of 22
-lyndonIfCan(w2*w1)$lword
---R 
---R
---R   (20)  "failed"
---R                                                    Type: Union("failed",...)
---E 20
-
---S 21 of 22
-lyndon(w1)$lword
---R 
---R
---R           2
---R   (21)  [a b]
---R                                                      Type: LyndonWord Symbol
---E 21
-
---S 22 of 22
-lyndon(w1*w2)$lword
---R 
---R
---R           2     2
---R   (22)  [a b a b ]
---R                                                      Type: LyndonWord Symbol
---E 22
-)spool
-)lisp (bye)
-@
-<<LyndonWord.help>>=
-====================================================================
-LyndonWord examples
-====================================================================
-
-A function f in [0,1] is called acyclic if C(F) consists of n
-different objects. The canonical representative of the orbit of an
-acyclic function is usually called a Lyndon Word. If f is acyclic,
-then all elements in the orbit C(f) are acyclic as well, and we call
-C(f) an acyclic orbit.
-
-====================================================================
-Initialisations
-====================================================================
-
-  a:Symbol :='a
-    a
-                            Type: Symbol
-
-  b:Symbol :='b
-    b
-                            Type: Symbol
-
-  c:Symbol :='c
-    c
-                            Type: Symbol
-
-  lword:= LyndonWord(Symbol)
-    LyndonWord Symbol
-                            Type: Domain
-
-  magma := Magma(Symbol)
-    Magma Symbol
-                            Type: Domain
-
-  word := OrderedFreeMonoid(Symbol)
-    OrderedFreeMonoid Symbol
-                            Type: Domain
-
-All Lyndon words of with a, b, c to order 3
-
-  LyndonWordsList1([a,b,c],3)$lword
-   [[[a],[b],[c]], [[a b],[a c],[b c]],
-       2     2       2                      2    2       2
-    [[a b],[a c],[a b ],[a b c],[a c b],[a c ],[b c],[b c ]]]
-                            Type: OneDimensionalArray List LyndonWord Symbol
-
-All Lyndon words of with a, b, c to order 3 in flat list
-
-  LyndonWordsList([a,b,c],3)$lword
-                                          2      2        2
-   [[a], [b], [c], [a b], [a c], [b c], [a b], [a c], [a b ], [a b c], [a c b],
-        2     2        2
-    [a c ], [b c], [b c ]]
-                            Type: List LyndonWord Symbol
-
-All Lyndon words of with a, b to order 5
-
-  lw := LyndonWordsList([a,b],5)$lword
-                       2        2     3      2 2       3     4      3 2
-   [[a], [b], [a b], [a b], [a b ], [a b], [a b ], [a b ], [a b], [a b ],
-      2          2 3           2       4
-    [a b a b], [a b ], [a b a b ], [a b ]]
-                            Type: List LyndonWord Symbol
-
-  w1 : word := lw.4 :: word
-     2
-    a b
-                             Type: OrderedFreeMonoid Symbol
-
-  w2 : word := lw.5 :: word
-       2
-    a b
-                             Type: OrderedFreeMonoid Symbol
-
-Let's try factoring
-
-  factor(a::word)$lword
-    [[a]]
-                             Type: List LyndonWord Symbol
-
-  factor(w1*w2)$lword
-       2     2
-    [[a b a b ]]
-                             Type: List LyndonWord Symbol
-
-  factor(w2*w2)$lword
-         2      2
-    [[a b ],[a b ]]
-                             Type: List LyndonWord Symbol
-
-  factor(w2*w1)$lword
-         2    2
-    [[a b ],[a b]]
-                             Type: List LyndonWord Symbol
-
-====================================================================
-Checks and coercions
-====================================================================
-
-  lyndon?(w1)$lword
-    true
-                             Type: Boolean
-
-  lyndon?(w1*w2)$lword
-    true
-                             Type: Boolean
-
-  lyndon?(w2*w1)$lword
-    false
-                             Type: Boolean
-
-  lyndonIfCan(w1)$lword
-      2
-    [a b]
-                             Type: Union(LyndonWord Symbol,...)
-
-  lyndonIfCan(w2*w1)$lword
-    "failed"
-                             Type: Union("failed",...)
-
-  lyndon(w1)$lword
-      2
-    [a b]
-                             Type: LyndonWord Symbol
-
-  lyndon(w1*w2)$lword
-      2     2
-    [a b a b ]
-                             Type: LyndonWord Symbol
-
-See Also:
-o )show LyndonWord
-o $AXIOM/doc/src/algebra/xlpoly.spad.dvi
-
-@
-<<domain LWORD LyndonWord>>=
-)abbrev domain LWORD LyndonWord
-++ Author: Michel Petitot (petitot@lifl.fr).
-++ Date Created: 91
-++ Date Last Updated: 7 Juillet 92
-++ Fix History: compilation v 2.1 le 13 dec 98
-++ Basic Functions:
-++ Related Constructors:
-++ Also See:
-++ AMS Classifications:
-++ Keywords:
-++ References: Free Lie Algebras by C. Reutenauer (Oxford science publications).
-++ Description:
-++ Lyndon words over arbitrary (ordered) symbols:
-++ see Free Lie Algebras by C. Reutenauer (Oxford science publications).
-++ A Lyndon word is a word which is smaller than any of its right factors
-++ w.r.t. the pure lexicographical ordering.
-++ If \axiom{a} and \axiom{b} are two Lyndon words such that \axiom{a < b}
-++ holds w.r.t lexicographical ordering then \axiom{a*b} is a Lyndon word.
-++ Parenthesized Lyndon words can be generated from symbols by using the following
-++ rule: \axiom{[[a,b],c]} is a Lyndon word iff \axiom{a*b < c <= b} holds.
-++ Lyndon words are internally represented by binary trees using the
-++ \spadtype{Magma} domain constructor.
-++ Two ordering are provided: lexicographic and 
-++ length-lexicographic. \newline 
-++ Author : Michel Petitot (petitot@lifl.fr).
-
-LyndonWord(VarSet:OrderedSet):Public == Private where
-   OFMON ==> OrderedFreeMonoid(VarSet)
-   PI    ==> PositiveInteger
-   NNI   ==> NonNegativeInteger
-   I     ==> Integer
-   OF    ==> OutputForm
-   ARRAY1==> OneDimensionalArray
-
-   Public == Join(OrderedSet,RetractableTo VarSet) with
-      retractable?  : $ -> Boolean
-        ++ \axiom{retractable?(x)} tests if \axiom{x} is a tree with only one entry.
-      left          : $ -> $
-        ++ \axiom{left(x)} returns left subtree of \axiom{x} or
-        ++ error if \axiomOpFrom{retractable?}{LyndonWord}(\axiom{x}) is true.
-      right  :  $ -> $
-        ++ \axiom{right(x)} returns right subtree of \axiom{x} or
-        ++ error if \axiomOpFrom{retractable?}{LyndonWord}(\axiom{x}) is true.
-      length :  $ -> PI
-        ++ \axiom{length(x)} returns the number of entries in \axiom{x}.
-      lexico :  ($,$) -> Boolean 
-        ++ \axiom{lexico(x,y)} returns \axiom{true} iff  \axiom{x} is smaller than 
-        ++ \axiom{y} w.r.t. the lexicographical ordering induced by \axiom{VarSet}. 
-      coerce :  $ -> OFMON
-        ++ \axiom{coerce(x)} returns the element of \axiomType{OrderedFreeMonoid}(VarSet) 
-        ++ corresponding to \axiom{x}.
-      coerce :  $ -> Magma VarSet
-        ++ \axiom{coerce(x)} returns the element of \axiomType{Magma}(VarSet)
-        ++ corresponding to \axiom{x}.
-      factor :  OFMON -> List $  
-        ++ \axiom{factor(x)} returns the decreasing factorization into Lyndon words. 
-      lyndon?:  OFMON -> Boolean
-        ++ \axiom{lyndon?(w)} test if \axiom{w} is a Lyndon word.
-      lyndon :  OFMON -> $
-        ++ \axiom{lyndon(w)} convert \axiom{w} into a Lyndon word, 
-        ++ error if \axiom{w} is not a Lyndon word.
-      lyndonIfCan : OFMON -> Union($, "failed")
-        ++ \axiom{lyndonIfCan(w)} convert \axiom{w} into a Lyndon word.
-      varList     : $ -> List VarSet
-        ++ \axiom{varList(x)} returns the list of distinct entries of \axiom{x}.
-      LyndonWordsList1: (List VarSet, PI)  -> ARRAY1 List $
-        ++ \axiom{LyndonWordsList1(vl, n)} returns an array of lists of Lyndon
-        ++ words over the alphabet \axiom{vl}, up to order \axiom{n}.
-      LyndonWordsList : (List VarSet, PI)  -> List $
-        ++ \axiom{LyndonWordsList(vl, n)} returns the list of Lyndon
-        ++ words over the alphabet \axiom{vl}, up to order \axiom{n}.
-
-   Private == Magma(VarSet) add
-     -- Representation
-       Rep:= Magma(VarSet)
-
-     -- Fonctions locales
-       LetterList : OFMON -> List VarSet
-       factor1    : (List $, $, List $) -> List $
-
-     -- Definitions
-       lyndon? w ==
-         w = 1$OFMON => false
-         f: OFMON := rest w
-         while f ^= 1$OFMON repeat
-           not lexico(w,f) => return false
-           f := rest f
-         true
-
-       lyndonIfCan w ==
-         l: List $ := factor w
-         # l = 1 => first l
-         "failed"
-
-       lyndon w ==
-         l: List $ := factor w
-         # l = 1 => first l
-         error "This word is not a Lyndon word"
-
-       LetterList w ==
-         w = 1 => []
-         cons(first w , LetterList rest w)
-
-       factor1 (gauche, x, droite) == 
-         g: List $ := gauche; d: List $ := droite
-         while not null g repeat             ++ (l in g or l=x) et u in d 
-           lexico(  g.first , x ) =>         ++  => right(l) >= u 
-              x  := g.first *$Rep x          -- crochetage
-              null(d) => g := rest g
-              g := cons( x, rest g)          -- mouvement a droite
-              x  := first d
-              d := rest d
-           d := cons( x , d)                 -- mouvement a gauche
-           x  := first g
-           g := rest g
-         return cons(x, d)
-
-       factor w ==
-         w = 1 => []
-         l : List $ := reverse [ u::$ for u in LetterList w]
-         factor1( rest l, first l , [] )
-      
-       x < y ==                     -- lexicographique par longueur
-         lx,ly: PI
-         lx:= length x ; ly:= length y
-         lx = ly => lexico(x,y)
-         lx < ly
- 
-       coerce(x:$):OF == bracket(x::OFMON::OF)
-       coerce(x:$):Magma VarSet == x::Rep
-
-       LyndonWordsList1 (vl,n) ==    -- a ameliorer !!!!!!!!!!!
-            null vl => error "empty list"
-            base: ARRAY1 List $ := new(n::I::NNI ,[])
-           
-           -- mots de longueur 1
-            lbase1:List $ := [w::$ for w in sort(vl)]
-            base.1 := lbase1
-
-           -- calcul des mots de longueur ll
-            for ll in 2..n:I  repeat 
-               lbase1 := []   
-               for a in base(1) repeat              -- lettre + mot
-                  for b in base(ll-1) repeat
-                     if lexico(a,b) then lbase1:=cons(a*b,lbase1)
-
-               for i in 2..ll-1 repeat              -- mot + mot
-                 for a in base(i) repeat             
-                   for b in base(ll-i) repeat
-                     if lexico(a,b) and (lexico(b,right a) or b = right a ) 
-                     then lbase1:=cons(a*b,lbase1)
- 
-               base(ll):= sort_!(lexico, lbase1)
-            return base
-           
-       LyndonWordsList (vl,n) ==
-           v:ARRAY1 List $ := LyndonWordsList1(vl,n)
-           "append"/ [v.i for i in 1..n] 
-
-@
 \section{package XEXPPKG XExponentialPackage}
 <<package XEXPPKG XExponentialPackage>>=
 )abbrev package XEXPPKG XExponentialPackage
@@ -1023,2138 +81,6 @@ XExponentialPackage(R, VarSet, XPOLY): Public == Private where
            log(p1*q1, n)
 
 @
-\section{domain LPOLY LiePolynomial}
-<<LiePolynomial.input>>=
--- xlpoly.spad.pamphlet LiePolynomial.input
-)spool LiePolynomial.output
-)set message test on
-)set message auto off
-)clear all
---S 1 of 28
-RN := Fraction Integer
---R 
---R
---R   (1)  Fraction Integer
---R                                                                 Type: Domain
---E 1
-
---S 2 of 28
-Lpoly := LiePolynomial(Symbol,RN)
---R 
---R
---R   (2)  LiePolynomial(Symbol,Fraction Integer)
---R                                                                 Type: Domain
---E 2
-
---S 3 of 28
-Dpoly := XDPOLY(Symbol,RN)
---R 
---R
---R   (3)  XDistributedPolynomial(Symbol,Fraction Integer)
---R                                                                 Type: Domain
---E 3
-
---S 4 of 28
-Lword := LyndonWord Symbol
---R 
---R
---R   (4)  LyndonWord Symbol
---R                                                                 Type: Domain
---E 4
-
---S 5 of 28
-a:Symbol := 'a
---R 
---R
---R   (5)  a
---R                                                                 Type: Symbol
---E 5
-
---S 6 of 28
-b:Symbol := 'b 
---R 
---R
---R   (6)  b
---R                                                                 Type: Symbol
---E 6
-
---S 7 of 28
-c:Symbol := 'c
---R 
---R
---R   (7)  c
---R                                                                 Type: Symbol
---E 7
-
---S 8 of 28
-aa: Lpoly := a 
---R 
---R
---R   (8)  [a]
---R                                 Type: LiePolynomial(Symbol,Fraction Integer)
---E 8
-
---S 9 of 28
-bb: Lpoly := b
---R 
---R
---R   (9)  [b]
---R                                 Type: LiePolynomial(Symbol,Fraction Integer)
---E 9
-
---S 10 of 28
-cc: Lpoly := c
---R 
---R
---R   (10)  [c]
---R                                 Type: LiePolynomial(Symbol,Fraction Integer)
---E 10
-
---S 11 of 28
-p : Lpoly := [aa,bb]
---R 
---R
---R   (11)  [a b]
---R                                 Type: LiePolynomial(Symbol,Fraction Integer)
---E 11
-
---S 12 of 28
-q : Lpoly := [p,bb]
---R 
---R
---R             2
---R   (12)  [a b ]
---R                                 Type: LiePolynomial(Symbol,Fraction Integer)
---E 12
-
---S 13 of 28
-liste : List Lword := LyndonWordsList([a,b], 4)
---R 
---R
---R                          2       2    3     2 2      3
---R   (13)  [[a],[b],[a b],[a b],[a b ],[a b],[a b ],[a b ]]
---R                                                 Type: List LyndonWord Symbol
---E 13
-
---S 14 of 28
-r: Lpoly := p + q + 3*LiePoly(liste.4)$Lpoly
---R 
---R
---R                    2         2
---R   (14)  [a b] + 3[a b] + [a b ]
---R                                 Type: LiePolynomial(Symbol,Fraction Integer)
---E 14
-
---S 15 of 28
-s:Lpoly := [p,r]
---R 
---R
---R              2                 2
---R   (15)  - 3[a b a b] + [a b a b ]
---R                                 Type: LiePolynomial(Symbol,Fraction Integer)
---E 15
-
---S 16 of 28
-t:Lpoly  := s  + 2*LiePoly(liste.3) - 5*LiePoly(liste.5)
---R 
---R
---R                       2       2                 2
---R   (16)  2[a b] - 5[a b ] - 3[a b a b] + [a b a b ]
---R                                 Type: LiePolynomial(Symbol,Fraction Integer)
---E 16
-
---S 17 of 28
-degree t
---R 
---R
---R   (17)  5
---R                                                        Type: PositiveInteger
---E 17
-
---S 18 of 28
-mirror t
---R 
---R
---R                         2       2                 2
---R   (18)  - 2[a b] - 5[a b ] - 3[a b a b] + [a b a b ]
---R                                 Type: LiePolynomial(Symbol,Fraction Integer)
---E 18
-
---S 19 of 28
-Jacobi(p: Lpoly, q: Lpoly, r: Lpoly): Lpoly == _
-   [ [p,q]$Lpoly, r] + [ [q,r]$Lpoly, p] + [ [r,p]$Lpoly, q]  
---R 
---R   Function declaration Jacobi : (LiePolynomial(Symbol,Fraction Integer
---R      ),LiePolynomial(Symbol,Fraction Integer),LiePolynomial(Symbol,
---R      Fraction Integer)) -> LiePolynomial(Symbol,Fraction Integer) has 
---R      been added to workspace.
---R                                                                   Type: Void
---E 19
-
---S 20 of 28
-test: Lpoly := Jacobi(a,b,b)
---R 
---R   Compiling function Jacobi with type (LiePolynomial(Symbol,Fraction 
---R      Integer),LiePolynomial(Symbol,Fraction Integer),LiePolynomial(
---R      Symbol,Fraction Integer)) -> LiePolynomial(Symbol,Fraction 
---R      Integer) 
---R
---R   (20)  0
---R                                 Type: LiePolynomial(Symbol,Fraction Integer)
---E 20
-
---S 21 of 28
-test: Lpoly := Jacobi(p,q,r)
---R 
---R
---R   (21)  0
---R                                 Type: LiePolynomial(Symbol,Fraction Integer)
---E 21
-
---S 22 of 28
-test: Lpoly := Jacobi(r,s,t)
---R 
---R
---R   (22)  0
---R                                 Type: LiePolynomial(Symbol,Fraction Integer)
---E 22
-
---S 23 of 28
-eval(p, a, p)$Lpoly
---R 
---R
---R             2
---R   (23)  [a b ]
---R                                 Type: LiePolynomial(Symbol,Fraction Integer)
---E 23
-
---S 24 of 28
-eval(p, [a,b], [2*bb, 3*aa])$Lpoly
---R 
---R
---R   (24)  - 6[a b]
---R                                 Type: LiePolynomial(Symbol,Fraction Integer)
---E 24
-
---S 25 of 28
-r: Lpoly := [p,c]
---R 
---R
---R   (25)  [a b c] + [a c b]
---R                                 Type: LiePolynomial(Symbol,Fraction Integer)
---E 25
-
---S 26 of 28
-r1: Lpoly := eval(r, [a,b,c], [bb, cc, aa])$Lpoly 
---R 
---R
---R   (26)  - [a b c]
---R                                 Type: LiePolynomial(Symbol,Fraction Integer)
---E 26
-
---S 27 of 28
-r2: Lpoly := eval(r, [a,b,c], [cc, aa, bb])$Lpoly 
---R 
---R
---R   (27)  - [a c b]
---R                                 Type: LiePolynomial(Symbol,Fraction Integer)
---E 27
-
---S 28 of 28
-r + r1 + r2
---R 
---R
---R   (28)  0
---R                                 Type: LiePolynomial(Symbol,Fraction Integer)
---E 28
-)spool
- 
-)lisp (bye)
-@
-<<LiePolynomial.help>>=
-====================================================================
-LiePolynomial examples
-====================================================================
-
-====================================================================
-Declaration of domains
-====================================================================
-
-  RN := Fraction Integer
-    Fraction Integer
-                     Type: Domain
-
-  Lpoly := LiePolynomial(Symbol,RN)
-    LiePolynomial(Symbol,Fraction Integer)
-                     Type: Domain
-
-  Dpoly := XDPOLY(Symbol,RN)
-    XDistributedPolynomial(Symbol,Fraction Integer)
-                     Type: Domain
-
-  Lword := LyndonWord Symbol
-    LyndonWord Symbol
-                     Type: Domain
-
-====================================================================
-Initialisation
-====================================================================
-
-  a:Symbol := 'a
-    a
-                     Type: Symbol
-
-  b:Symbol := 'b 
-    b
-                     Type: Symbol
-
-  c:Symbol := 'c
-    c
-                     Type: Symbol
-
-  aa: Lpoly := a 
-    [a]
-                     Type: LiePolynomial(Symbol,Fraction Integer)
-
-  bb: Lpoly := b
-    [b]
-                     Type: LiePolynomial(Symbol,Fraction Integer)
-
-  cc: Lpoly := c
-    [c]
-                     Type: LiePolynomial(Symbol,Fraction Integer)
-
-  p : Lpoly := [aa,bb]
-    [a b]
-                     Type: LiePolynomial(Symbol,Fraction Integer)
-
-  q : Lpoly := [p,bb]
-        2
-    [a b ]
-                     Type: LiePolynomial(Symbol,Fraction Integer)
-
-All the Lyndon words of order 4
-
-  liste : List Lword := LyndonWordsList([a,b], 4)
-                     2       2    3     2 2      3
-    [[a],[b],[a b],[a b],[a b ],[a b],[a b ],[a b ]]
-                     Type: List LyndonWord Symbol
-
-  r: Lpoly := p + q + 3*LiePoly(liste.4)$Lpoly
-               2         2
-    [a b] + 3[a b] + [a b ]
-                     Type: LiePolynomial(Symbol,Fraction Integer)
-
-  s:Lpoly := [p,r]
-         2                 2
-    - 3[a b a b] + [a b a b ]
-                     Type: LiePolynomial(Symbol,Fraction Integer)
-
-  t:Lpoly  := s  + 2*LiePoly(liste.3) - 5*LiePoly(liste.5)
-                  2       2                 2
-    2[a b] - 5[a b ] - 3[a b a b] + [a b a b ]
-                     Type: LiePolynomial(Symbol,Fraction Integer)
-
-  degree t
-    5
-                     Type: PositiveInteger
-
-  mirror t
-                    2       2                 2
-    - 2[a b] - 5[a b ] - 3[a b a b] + [a b a b ]
-                     Type: LiePolynomial(Symbol,Fraction Integer)
-
-====================================================================
-Jacobi Relation
-====================================================================
-
- Jacobi(p: Lpoly, q: Lpoly, r: Lpoly): Lpoly == _
-   [ [p,q]\$Lpoly, r] + [ [q,r]\$Lpoly, p] + [ [r,p]\$Lpoly, q]  
-                    Type: Void
-
-====================================================================
-Tests
-====================================================================
-
-  test: Lpoly := Jacobi(a,b,b)
-    0
-                    Type: LiePolynomial(Symbol,Fraction Integer)
-
-  test: Lpoly := Jacobi(p,q,r)
-    0
-                    Type: LiePolynomial(Symbol,Fraction Integer)
-
-  test: Lpoly := Jacobi(r,s,t)
-    0
-                    Type: LiePolynomial(Symbol,Fraction Integer)
-
-====================================================================
-Evaluation
-====================================================================
-
-  eval(p, a, p)$Lpoly
-        2
-    [a b ]
-                    Type: LiePolynomial(Symbol,Fraction Integer)
-
-  eval(p, [a,b], [2*bb, 3*aa])$Lpoly
-    - 6[a b]
-                    Type: LiePolynomial(Symbol,Fraction Integer)
-
-  r: Lpoly := [p,c]
-    [a b c] + [a c b]
-                    Type: LiePolynomial(Symbol,Fraction Integer)
-
-  r1: Lpoly := eval(r, [a,b,c], [bb, cc, aa])$Lpoly 
-    - [a b c]
-                    Type: LiePolynomial(Symbol,Fraction Integer)
-
-  r2: Lpoly := eval(r, [a,b,c], [cc, aa, bb])$Lpoly 
-    - [a c b]
-                    Type: LiePolynomial(Symbol,Fraction Integer)
-
-  r + r1 + r2
-    0
-                    Type: LiePolynomial(Symbol,Fraction Integer)
-
-See Also:
-o )help LyndonWord
-o )help XDistributedPolynomial
-o )show LiePolynomial
-o $AXIOM/doc/src/algebra/xlpoly.spad.dvi 
-
-@
-<<domain LPOLY LiePolynomial>>=
-)abbrev domain LPOLY LiePolynomial
-++ Author: Michel Petitot (petitot@lifl.fr).
-++ Date Created: 91
-++ Date Last Updated: 7 Juillet 92
-++ Fix History: compilation v 2.1 le 13 dec 98
-++ Basic Functions:
-++ Related Constructors:
-++ Also See:
-++ AMS Classifications:
-++ Keywords:
-++ References:Free Lie Algebras by C. Reutenauer (Oxford science publications). 
-++ Description:
-++ This type supports Lie polynomials in Lyndon basis
-++ see Free Lie Algebras by C. Reutenauer 
-++ (Oxford science publications). \newline Author: Michel Petitot (petitot@lifl.fr).
-
-LiePolynomial(VarSet:OrderedSet, R:CommutativeRing) : Public == Private where
-   MAGMA   ==> Magma(VarSet)
-   LWORD   ==> LyndonWord(VarSet)
-   WORD    ==> OrderedFreeMonoid(VarSet)
-   XDPOLY  ==> XDistributedPolynomial(VarSet,R)
-   XRPOLY  ==> XRecursivePolynomial(VarSet,R)
-   NNI     ==> NonNegativeInteger
-   RN      ==> Fraction Integer
-   EX      ==> OutputForm
-   TERM    ==> Record(k: LWORD, c: R)
-
-   Public == Join(FreeLieAlgebra(VarSet,R), FreeModuleCat(R,LWORD)) with
-      LiePolyIfCan: XDPOLY -> Union($, "failed")
-        ++ \axiom{LiePolyIfCan(p)} returns \axiom{p} in Lyndon basis
-        ++ if \axiom{p} is a Lie polynomial, otherwise \axiom{"failed"}
-        ++ is returned.
-      construct: (LWORD, LWORD) -> $
-        ++ \axiom{construct(x,y)} returns the Lie bracket \axiom{[x,y]}.
-      construct: (LWORD, $) -> $
-        ++ \axiom{construct(x,y)} returns the Lie bracket \axiom{[x,y]}.
-      construct: ($, LWORD) -> $     
-        ++ \axiom{construct(x,y)} returns the Lie bracket \axiom{[x,y]}.
-
-   Private ==  FreeModule1(R, LWORD) add       
-        import(TERM)
-
-      --representation
-        Rep :=  List TERM
-
-      -- fonctions locales
-        cr1 : (LWORD, $    ) -> $
-        cr2 : ($, LWORD    ) -> $
-        crw : (LWORD, LWORD) -> $     -- crochet de 2 mots de Lyndon
-        DPoly: LWORD -> XDPOLY
-        lquo1: (XRPOLY , LWORD) -> XRPOLY
-        lyndon: (LWORD, LWORD) -> $
-        makeLyndon: (LWORD, LWORD) -> LWORD
-        rquo1: (XRPOLY , LWORD) -> XRPOLY
-        RPoly: LWORD -> XRPOLY
-        eval1: (LWORD, VarSet, $) -> $                     -- 08/03/98
-        eval2: (LWORD, List VarSet, List $) -> $           -- 08/03/98
-
-
-      -- Evaluation
-        eval1(lw,v,nv) ==                                  -- 08/03/98
-          not member?(v, varList(lw)$LWORD) => LiePoly lw
-          (s := retractIfCan(lw)$LWORD) case VarSet => 
-             if (s::VarSet) = v then nv else LiePoly lw 
-          l: LWORD := left lw
-          r: LWORD := right lw
-          construct(eval1(l,v,nv), eval1(r,v,nv))
-
-        eval2(lw,lv,lnv) ==                                -- 08/03/98
-          p: Integer
-          (s := retractIfCan(lw)$LWORD) case VarSet =>
-             p := position(s::VarSet, lv)$List(VarSet) 
-             if p=0 then lw::$ else elt(lnv,p)$List($)
-          l: LWORD := left lw
-          r: LWORD := right lw
-          construct(eval2(l,lv,lnv), eval2(r,lv,lnv))
-
-        eval(p:$, v: VarSet, nv: $): $ ==                  -- 08/03/98
-          +/ [t.c * eval1(t.k, v, nv) for t in p]
-
-        eval(p:$, lv: List(VarSet), lnv: List($)): $ ==    -- 08/03/98
-          +/ [t.c * eval2(t.k, lv, lnv) for t in p]
-
-        lquo1(p,lw) ==
-          constant? p => 0$XRPOLY
-          retractable? lw => lquo(p, retract lw)$XRPOLY
-          lquo1(lquo1(p, left lw),right lw) - lquo1(lquo1(p, right lw),left lw)  
-        rquo1(p,lw) ==
-          constant? p => 0$XRPOLY
-          retractable? lw => rquo(p, retract lw)$XRPOLY
-          rquo1(rquo1(p, left lw),right lw) - rquo1(rquo1(p, right lw),left lw)
-
-        coef(p, lp) == coef(p, lp::XRPOLY)$XRPOLY
-
-        lquo(p, lp) ==
-          lp = 0 => 0$XRPOLY
-          +/ [t.c * lquo1(p,t.k) for t in lp]
- 
-        rquo(p, lp) ==
-          lp = 0 => 0$XRPOLY
-          +/ [t.c * rquo1(p,t.k) for t in lp] 
-
-        LiePolyIfCan p ==         -- inefficace a cause de la rep. de XDPOLY
-           not quasiRegular? p => "failed"
-           p1: XDPOLY := p ; r:$ := 0
-           while p1 ^= 0 repeat
-             t: Record(k:WORD, c:R) := mindegTerm p1
-             w: WORD := t.k; coef:R := t.c
-             (l := lyndonIfCan(w)$LWORD) case "failed" => return "failed"
-             lp:$ := coef * LiePoly(l::LWORD)
-             r := r + lp 
-             p1 := p1 - lp::XDPOLY 
-           r
- 
-      --definitions locales
-        makeLyndon(u,v) == (u::MAGMA * v::MAGMA) pretend LWORD
- 
-        crw(u,v) ==               -- u et v sont des mots de Lyndon
-          u = v => 0
-          lexico(u,v) => lyndon(u,v)
-          - lyndon (v,u)
-
-        lyndon(u,v) ==            -- u et v sont des mots de Lyndon tq u < v
-          retractable? u => monom(makeLyndon(u,v),1)
-          u1: LWORD := left u
-          u2: LWORD := right u
-          lexico(u2,v) => cr1(u1, lyndon(u2,v)) + cr2(lyndon(u1,v), u2)
-          monom(makeLyndon(u,v),1)
-           
-        cr1 (l, p) ==
-            +/[t.c * crw(l, t.k) for t in p]
-
-        cr2 (p, l) ==
-            +/[t.c * crw(t.k, l) for t in p]
-
-        DPoly w ==
-           retractable? w => retract(w) :: XDPOLY 
-           l:XDPOLY := DPoly left w
-           r:XDPOLY := DPoly right w
-           l*r - r*l
-
-        RPoly w ==
-           retractable? w => retract(w) :: XRPOLY 
-           l:XRPOLY := RPoly left w
-           r:XRPOLY := RPoly right w
-           l*r - r*l 
-    
-      -- definitions
-
-        coerce(v:VarSet) == monom(v::LWORD , 1)
-
-        construct(x:$ , y:$):$ ==
-            +/[t.c * cr1(t.k, y) for t in x]
-
-        construct(l:LWORD , p:$):$ == cr1(l,p) 
-        construct(p:$ , l:LWORD):$ == cr2(p,l)
-        construct(u:LWORD , v:LWORD):$ == crw(u,v)
-
-        coerce(p:$):XDPOLY ==
-            +/ [t.c * DPoly(t.k) for t in p]
-
-        coerce(p:$):XRPOLY ==
-            +/ [t.c * RPoly(t.k) for t in p]
-
-        LiePoly(l) == monom(l,1)
-
-        varList p ==
-          le : List VarSet := "setUnion"/[varList(t.k)$LWORD for t in p]
-          sort(le)$List(VarSet)
-
-        mirror p ==
-          [[t.k, (odd? length t.k => t.c; -t.c)]$TERM for t in p]
-
-        trunc(p, n) ==
-          degree(p) > n => trunc( reductum p , n)
-          p
-
-        degree p == 
-          null p => 0
-          length( p.first.k)$LWORD
-
-      --  ListOfTerms p == p pretend List TERM
-        
---        coerce(x) : EX ==
---           null x => (0$R) :: EX
---           le : List EX := nil
---           for rec in x repeat
---             rec.c = 1$R => le := cons(rec.k :: EX, le)
---             le := cons(mkBinary("*"::EX,  rec.c :: EX, rec.k :: EX), le)
---           1 = #le => first le
---           mkNary("+" :: EX,le)
-
-@
-\section{domain PBWLB PoincareBirkhoffWittLyndonBasis}
-<<domain PBWLB PoincareBirkhoffWittLyndonBasis>>=
-)abbrev domain PBWLB PoincareBirkhoffWittLyndonBasis
-++ Author: Michel Petitot (petitot@lifl.fr).
-++ Date Created: 91
-++ Date Last Updated: 7 Juillet 92
-++ Fix History: compilation v 2.1 le 13 dec 98
-++ Basic Functions:
-++ Related Constructors:
-++ Also See:
-++ AMS Classifications:
-++ Keywords:
-++ References:
-++ Description:
-++ This domain provides the internal representation
-++ of polynomials in non-commutative variables written
-++ over the Poincare-Birkhoff-Witt basis.
-++ See the \spadtype{XPBWPolynomial} domain constructor.
-++ See Free Lie Algebras by C. Reutenauer 
-++ (Oxford science publications). \newline Author: Michel Petitot (petitot@lifl.fr).
-
-PoincareBirkhoffWittLyndonBasis(VarSet: OrderedSet): Public == Private where
-   WORD    ==> OrderedFreeMonoid(VarSet)
-   LWORD   ==> LyndonWord(VarSet)
-   LWORDS  ==> List(LWORD)
-   PI      ==> PositiveInteger
-   NNI     ==> NonNegativeInteger
-   EX      ==> OutputForm
-
-   Public == Join(OrderedSet, RetractableTo LWORD) with
-      1: constant -> %
-         ++ \spad{1} returns the empty list.
-      coerce       : $ -> WORD
-         ++ \spad{coerce([l1]*[l2]*...[ln])} returns the word \spad{l1*l2*...*ln},
-         ++ where \spad{[l_i]} is the backeted form of the Lyndon word \spad{l_i}.
-      coerce       : VarSet -> $
-         ++ \spad{coerce(v)} return \spad{v}
-      first        : $ -> LWORD
-         ++ \spad{first([l1]*[l2]*...[ln])} returns the Lyndon word \spad{l1}.
-      length       : $ -> NNI
-         ++ \spad{length([l1]*[l2]*...[ln])} returns the length of the word \spad{l1*l2*...*ln}.
-      ListOfTerms  : $ -> LWORDS
-         ++ \spad{ListOfTerms([l1]*[l2]*...[ln])} returns the list of words \spad{l1, l2, .... ln}.
-      rest         : $ -> $
-         ++ \spad{rest([l1]*[l2]*...[ln])} returns the list \spad{l2, .... ln}.
-      retractable? : $ -> Boolean
-         ++ \spad{retractable?([l1]*[l2]*...[ln])} returns true iff \spad{n}  equals \spad{1}.
-      varList      : $ -> List VarSet
-         ++ \spad{varList([l1]*[l2]*...[ln])} returns the list of
-         ++ variables in the word \spad{l1*l2*...*ln}.
-   
-   Private == add
-
-    -- Representation
-     Rep := LWORDS
-
-    -- Locales
-     recursif: ($,$) -> Boolean
-
-    -- Define
-     1 == nil
-
-     x = y == x =$Rep y
-
-     varList x ==
-        null x => nil
-        le: List VarSet := "setUnion"/ [varList$LWORD l for l in x]
-
-     first x == first(x)$Rep
-     rest x == rest(x)$Rep
-
-     coerce(v: VarSet):$ == [ v::LWORD ]
-     coerce(l: LWORD):$ == [l]
-     ListOfTerms(x:$):LWORDS == x pretend LWORDS      
-
-     coerce(x:$):WORD ==
-       null x => 1
-       x.first :: WORD *$WORD coerce(x.rest)
-
-     coerce(x:$):EX ==
-       null x => outputForm(1$Integer)$EX
-       reduce(_* ,[l :: EX for l in x])$List(EX)
-
-     retractable? x == 
-       null x => false
-       null x.rest
-
-     retract x == 
-        #x ^= 1 => error "cannot convert to Lyndon word"
-        x.first
-
-     retractIfCan x ==
-        retractable? x => x.first
-        "failed"
-      
-     length x ==
-        n: Integer := +/[ length l for l in x]
-        n::NNI
-
-     recursif(x, y) ==
-       null y => false
-       null x => true
-       x.first = y.first => recursif(rest(x), rest(y))
-       lexico(x.first, y.first)
-
-     x < y == 
-       lx: NNI := length x; ly: NNI := length y 
-       lx = ly => recursif(x,y)
-       lx < ly
-
-@
-\section{domain XPBWPOLY XPBWPolynomial}
-<<XPBWPolynomial.input>>=
--- xlpoly.spad.pamphlet XPBWPolynomial.input
-)spool XPBWPolynomial.output
-)set message test on
-)set message auto off
-)clear all
---S 1 of 39
-a:Symbol := 'a
---R 
---R
---R   (1)  a
---R                                                                 Type: Symbol
---E 1
-
---S 2 of 39
-b:Symbol := 'b
---R 
---R
---R   (2)  b
---R                                                                 Type: Symbol
---E 2
-
---S 3 of 39
-RN := Fraction(Integer)
---R 
---R
---R   (3)  Fraction Integer
---R                                                                 Type: Domain
---E 3
-
---S 4 of 39
-word := OrderedFreeMonoid Symbol
---R 
---R
---R   (4)  OrderedFreeMonoid Symbol
---R                                                                 Type: Domain
---E 4
-
---S 5 of 39
-lword := LyndonWord(Symbol)
---R 
---R
---R   (5)  LyndonWord Symbol
---R                                                                 Type: Domain
---E 5
-
---S 6 of 39
-base := PoincareBirkhoffWittLyndonBasis Symbol
---R 
---R
---R   (6)  PoincareBirkhoffWittLyndonBasis Symbol
---R                                                                 Type: Domain
---E 6
-
---S 7 of 39
-dpoly := XDistributedPolynomial(Symbol, RN)
---R 
---R
---R   (7)  XDistributedPolynomial(Symbol,Fraction Integer)
---R                                                                 Type: Domain
---E 7
-
---S 8 of 39
-rpoly := XRecursivePolynomial(Symbol, RN)
---R 
---R
---R   (8)  XRecursivePolynomial(Symbol,Fraction Integer)
---R                                                                 Type: Domain
---E 8
-
---S 9 of 39
-lpoly := LiePolynomial(Symbol, RN)
---R 
---R
---R   (9)  LiePolynomial(Symbol,Fraction Integer)
---R                                                                 Type: Domain
---E 9
-
---S 10 of 39
-poly  := XPBWPolynomial(Symbol, RN)
---R 
---R
---R   (10)  XPBWPolynomial(Symbol,Fraction Integer)
---R                                                                 Type: Domain
---E 10
-
---S 11 of 39
-liste : List lword := LyndonWordsList([a,b], 6)
---R 
---R
---R   (11)
---R                       2        2     3      2 2       3     4      3 2
---R   [[a], [b], [a b], [a b], [a b ], [a b], [a b ], [a b ], [a b], [a b ],
---R      2          2 3           2       4     5      4 2     3          3 3
---R    [a b a b], [a b ], [a b a b ], [a b ], [a b], [a b ], [a b a b], [a b ],
---R      2     2     2 2        2 4           3       5
---R    [a b a b ], [a b a b], [a b ], [a b a b ], [a b ]]
---R                                                 Type: List LyndonWord Symbol
---E 11
-
---S 12 of 39
-0$poly
---R 
---R
---R   (12)  0
---R                                Type: XPBWPolynomial(Symbol,Fraction Integer)
---E 12
-
---S 13 of 39
-1$poly
---R 
---R
---R   (13)  1
---R                                Type: XPBWPolynomial(Symbol,Fraction Integer)
---E 13
-
---S 14 of 39
-p : poly := a
---R 
---R
---R   (14)  [a]
---R                                Type: XPBWPolynomial(Symbol,Fraction Integer)
---E 14
-
---S 15 of 39
-q : poly := b
---R 
---R
---R   (15)  [b]
---R                                Type: XPBWPolynomial(Symbol,Fraction Integer)
---E 15
-
---S 16 of 39
-pq: poly := p*q
---R 
---R
---R   (16)  [a b] + [b][a]
---R                                Type: XPBWPolynomial(Symbol,Fraction Integer)
---E 16
-
---S 17 of 39
-pq :: dpoly
---R 
---R
---R   (17)  a b
---R                        Type: XDistributedPolynomial(Symbol,Fraction Integer)
---E 17
-
---S 18 of 39
-mirror pq
---R 
---R
---R   (18)  [b][a]
---R                                Type: XPBWPolynomial(Symbol,Fraction Integer)
---E 18
-
---S 19 of 39
-ListOfTerms pq
---R 
---R
---R   (19)  [[k= [b][a],c= 1],[k= [a b],c= 1]]
---RType: List Record(k: PoincareBirkhoffWittLyndonBasis Symbol,c: Fraction Integer)
---E 19
-
---S 20 of 39
-reductum pq
---R 
---R
---R   (20)  [a b]
---R                                Type: XPBWPolynomial(Symbol,Fraction Integer)
---E 20
-
---S 21 of 39
-leadingMonomial pq
---R 
---R
---R   (21)  [b][a]
---R                                 Type: PoincareBirkhoffWittLyndonBasis Symbol
---E 21
-
---S 22 of 39
-coefficients pq
---R 
---R
---R   (22)  [1,1]
---R                                                  Type: List Fraction Integer
---E 22
-
---S 23 of 39
-leadingTerm pq
---R 
---R
---R   (23)  [k= [b][a],c= 1]
---R  Type: Record(k: PoincareBirkhoffWittLyndonBasis Symbol,c: Fraction Integer)
---E 23
-
---S 24 of 39
-degree pq
---R 
---R
---R   (24)  2
---R                                                        Type: PositiveInteger
---E 24
-
---S 25 of 39
-pq4:=exp(pq,4)
---R 
---R
---R   (25)
---R                          1              1     2       1      2
---R     1 + [a b] + [b][a] + - [a b][a b] + - [a b ][a] + - [b][a b]
---R                          2              2             2
---R   + 
---R     3               1
---R     - [b][a b][a] + - [b][b][a][a]
---R     2               2
---R                                Type: XPBWPolynomial(Symbol,Fraction Integer)
---E 25
-
---S 26 of 39
-log(pq4,4) - pq
---R 
---R
---R   (26)  0
---R                                Type: XPBWPolynomial(Symbol,Fraction Integer)
---E 26
-
---S 27 of 39
-lp1 :lpoly := LiePoly liste.10
---R 
---R
---R           3 2
---R   (27)  [a b ]
---R                                 Type: LiePolynomial(Symbol,Fraction Integer)
---E 27
-
---S 28 of 39
-lp2 :lpoly := LiePoly liste.11
---R 
---R
---R           2
---R   (28)  [a b a b]
---R                                 Type: LiePolynomial(Symbol,Fraction Integer)
---E 28
-
---S 29 of 39
-lp :lpoly := [lp1, lp2]
---R 
---R
---R           3 2 2
---R   (29)  [a b a b a b]
---R                                 Type: LiePolynomial(Symbol,Fraction Integer)
---E 29
-
---S 30 of 39
-lpd1: dpoly := lp1
---R 
---R
---R          3 2     2         2 2                    2 2           2    2 3
---R   (30)  a b  - 2a b a b - a b a + 4a b a b a - a b a  - 2b a b a  + b a
---R                        Type: XDistributedPolynomial(Symbol,Fraction Integer)
---E 30
-
---S 31 of 39
-lpd2: dpoly := lp2
---R 
---R
---R   (31)
---R      2         2 2          2                    2 2       3        2
---R     a b a b - a b a - 3a b a b + 4a b a b a - a b a  + 2b a b - 3b a b a
---R   + 
---R            2
---R     b a b a
---R                        Type: XDistributedPolynomial(Symbol,Fraction Integer)
---E 31
-
---S 32 of 39
-lpd : dpoly := lpd1 * lpd2 - lpd2 * lpd1
---R 
---R
---R   (32)
---R      3 2 2         3 2 2 2      3 2     2      3 2             3 2   2 2
---R     a b a b a b - a b a b a - 3a b a b a b + 4a b a b a b a - a b a b a
---R   + 
---R       3 3 3      3 3 2       3 3     2    2       3 2     2       2 2
---R     2a b a b - 3a b a b a + a b a b a  - a b a b a b  + 3a b a b a b a
---R   + 
---R       2           2       2                    2         2 2     2     2 3
---R     6a b a b a b a b - 12a b a b a b a b a + 3a b a b a b a  - 4a b a b a b
---R   + 
---R       2     2 2       2     3 3    2 2 4 2     2 2 3          2 2 2   2
---R     6a b a b a b a - a b a b a  + a b a b  - 3a b a b a b + 3a b a b a b
---R   + 
---R         2 2     3      2 2     2        2 2         2    2 2   2 3
---R     - 2a b a b a b + 3a b a b a b a - 3a b a b a b a  + a b a b a
---R   + 
---R           2   3 2         2   2              2   2 2           2
---R     3a b a b a b  - 6a b a b a b a b - 3a b a b a b a + 12a b a b a b a b a
---R   + 
---R             2     2 2         2 2     2         2 3 3             4 2
---R     - 3a b a b a b a  - 6a b a b a b a  + 3a b a b a  - 4a b a b a b
---R   + 
---R                3                   2   2                  3
---R     12a b a b a b a b - 12a b a b a b a b + 8a b a b a b a b
---R   + 
---R                      2                         2               2 3      2 5 2
---R     - 12a b a b a b a b a + 12a b a b a b a b a  - 4a b a b a b a  + a b a b
---R   + 
---R           2 4            2 3   2        2 2   3        2 2   2
---R     - 3a b a b a b + 3a b a b a b - 2a b a b a b + 3a b a b a b a
---R   + 
---R           2 2       2      2 2 2 3       3   3 2       3   2
---R     - 3a b a b a b a  + a b a b a  - 2b a b a b  + 4b a b a b a b
---R   + 
---R         3   2 2        3                  3     2 2       3 2     2       3 3 3
---R     2b a b a b a - 8b a b a b a b a + 2b a b a b a  + 4b a b a b a  - 2b a b a
---R   + 
---R         2   4 2       2   3            2   3 2         2   2
---R     3b a b a b  - 6b a b a b a b - 3b a b a b a + 12b a b a b a b a
---R   + 
---R           2   2 2 2       2           2       2     2 3          5 2
---R     - 3b a b a b a  - 6b a b a b a b a  + 3b a b a b a  - b a b a b
---R   + 
---R             4 2            3   2             3                  3 2 2
---R     3b a b a b a + 6b a b a b a b - 12b a b a b a b a + 3b a b a b a
---R   + 
---R               2   3            2   2             2 2 3    2 5         2 5 2
---R     - 4b a b a b a b + 6b a b a b a b a - b a b a b a  + b a b a b - b a b a
---R   + 
---R         2 4   2      2 4           2 4 2 2     2 3   3      2 3   2
---R     - 3b a b a b + 4b a b a b a - b a b a  + 2b a b a b - 3b a b a b a
---R   + 
---R      2 3       2
---R     b a b a b a
---R                        Type: XDistributedPolynomial(Symbol,Fraction Integer)
---E 32
-
---S 33 of 39
-lp :: dpoly - lpd
---R 
---R
---R   (33)  0
---R                        Type: XDistributedPolynomial(Symbol,Fraction Integer)
---E 33
-
---S 34 of 39
-p := 3 * lp
---R 
---R
---R            3 2 2
---R   (34)  3[a b a b a b]
---R                                Type: XPBWPolynomial(Symbol,Fraction Integer)
---E 34
-
---S 35 of 39
-q := lp1
---R 
---R
---R           3 2
---R   (35)  [a b ]
---R                                Type: XPBWPolynomial(Symbol,Fraction Integer)
---E 35
-
---S 36 of 39
-pq:= p * q
---R 
---R
---R            3 2 2        3 2
---R   (36)  3[a b a b a b][a b ]
---R                                Type: XPBWPolynomial(Symbol,Fraction Integer)
---E 36
-
---S 37 of 39
-pr:rpoly := p :: rpoly
---R 
---R
---R   (37)
---R       a
---R    *
---R           a
---R        *
---R               a b b
---R            *
---R                 a(a b(a b 3 + b a(- 3)) + b(a(a b(- 9) + b a 12) + b a a(- 3)))
---R               + 
---R                 b a(a(a b 6 + b a(- 9)) + b a a 3)
---R           + 
---R               b
---R            *
---R                   a b
---R                *
---R                       a
---R                    *
---R                         a(a b b(- 3) + b b a 9)
---R                       + 
---R                         b(a(a b 18 + b a(- 36)) + b a a 9)
---R                   + 
---R                     b(a a(a b(- 12) + b a 18) + b a a a(- 3))
---R               + 
---R                   b a
---R                *
---R                     a(a(a b b 3 + b a b(- 9)) + b a a b 9)
---R                   + 
---R                     b(a(a(a b(- 6) + b a 9) + b a a(- 9)) + b a a a 3)
---R       + 
---R           b
---R        *
---R               a
---R            *
---R                   a b
---R                *
---R                       a
---R                    *
---R                         a(a b b 9 + b(a b(- 18) + b a(- 9)))
---R                       + 
---R                         b(a b a 36 + b a a(- 9))
---R                   + 
---R                     b(a b a a(- 18) + b a a a 9)
---R               + 
---R                   b a
---R                *
---R                     a(a(a b b(- 12) + b a b 36) + b a a b(- 36))
---R                   + 
---R                     b(a(a(a b 24 + b a(- 36)) + b a a 36) + b a a a(- 12))
---R           + 
---R               b a a
---R            *
---R                 a(a(a b b 3 + b a b(- 9)) + b a a b 9)
---R               + 
---R                 b(a(a(a b(- 6) + b a 9) + b a a(- 9)) + b a a a 3)
---R   + 
---R       b
---R    *
---R           a
---R        *
---R               a
---R            *
---R                   a b
---R                *
---R                       a
---R                    *
---R                         a(a b b(- 6) + b(a b 12 + b a 6))
---R                       + 
---R                         b(a b a(- 24) + b a a 6)
---R                   + 
---R                     b(a b a a 12 + b a a a(- 6))
---R               + 
---R                   b a
---R                *
---R                       a
---R                    *
---R                         a(a b b 9 + b(a b(- 18) + b a(- 9)))
---R                       + 
---R                         b(a b a 36 + b a a(- 9))
---R                   + 
---R                     b(a b a a(- 18) + b a a a 9)
---R           + 
---R               b a a
---R            *
---R                 a(a(a b b(- 3) + b b a 9) + b(a(a b 18 + b a(- 36)) + b a a 9))
---R               + 
---R                 b(a a(a b(- 12) + b a 18) + b a a a(- 3))
---R       + 
---R           b a a a
---R        *
---R             a(a b(a b 3 + b a(- 3)) + b(a(a b(- 9) + b a 12) + b a a(- 3)))
---R           + 
---R             b a(a(a b 6 + b a(- 9)) + b a a 3)
---R                          Type: XRecursivePolynomial(Symbol,Fraction Integer)
---E 37
-
---S 38 of 39
-qr:rpoly := q :: rpoly
---R 
---R
---R   (38)
---R     a(a(a b b 1 + b(a b(- 2) + b a(- 1))) + b(a b a 4 + b a a(- 1)))
---R   + 
---R     b(a b a a(- 2) + b a a a 1)
---R                          Type: XRecursivePolynomial(Symbol,Fraction Integer)
---E 38
-
---S 39 of 39
-pq :: rpoly - pr*qr
---R 
---R
---R   (39)  0
---R                          Type: XRecursivePolynomial(Symbol,Fraction Integer)
---E 39
-)spool
-)lisp (bye)
-@
-<<XPBWPolynomial.help>>=
-====================================================================
-XPBWPolynomial examples
-====================================================================
-
-Initialisations
-
-  a:Symbol := 'a
-    a
-                                  Type: Symbol
-
-  b:Symbol := 'b
-    b
-                                  Type: Symbol
-
-  RN := Fraction(Integer)
-    Fraction Integer
-                                  Type: Domain
-
-  word := OrderedFreeMonoid Symbol
-    OrderedFreeMonoid Symbol
-                                  Type: Domain
-
-  lword := LyndonWord(Symbol)
-    LyndonWord Symbol
-                                  Type: Domain
-
-  base := PoincareBirkhoffWittLyndonBasis Symbol
-    PoincareBirkhoffWittLyndonBasis Symbol
-                                  Type: Domain
-
-  dpoly := XDistributedPolynomial(Symbol, RN)
-    XDistributedPolynomial(Symbol,Fraction Integer)
-                                  Type: Domain
-
-  rpoly := XRecursivePolynomial(Symbol, RN)
-    XRecursivePolynomial(Symbol,Fraction Integer)
-                                  Type: Domain
-
-  lpoly := LiePolynomial(Symbol, RN)
-    LiePolynomial(Symbol,Fraction Integer)
-                                  Type: Domain
-
-  poly  := XPBWPolynomial(Symbol, RN)
-    XPBWPolynomial(Symbol,Fraction Integer)
-                                  Type: Domain
-
-  liste : List lword := LyndonWordsList([a,b], 6)
-                       2        2     3      2 2       3     4      3 2
-   [[a], [b], [a b], [a b], [a b ], [a b], [a b ], [a b ], [a b], [a b ],
-      2          2 3           2       4     5      4 2     3          3 3
-    [a b a b], [a b ], [a b a b ], [a b ], [a b], [a b ], [a b a b], [a b ],
-      2     2     2 2        2 4           3       5
-    [a b a b ], [a b a b], [a b ], [a b a b ], [a b ]]
-                                  Type: List LyndonWord Symbol
-
-Let's make some polynomials
-
-  0$poly
-    0
-                           Type: XPBWPolynomial(Symbol,Fraction Integer)
-
-  1$poly
-    1
-                           Type: XPBWPolynomial(Symbol,Fraction Integer)
-
-  p : poly := a
-    [a]
-                           Type: XPBWPolynomial(Symbol,Fraction Integer)
-
-  q : poly := b
-    [b]
-                           Type: XPBWPolynomial(Symbol,Fraction Integer)
-
-  pq: poly := p*q
-    [a b] + [b][a]
-                           Type: XPBWPolynomial(Symbol,Fraction Integer)
-
-Coerce to distributed polynomial
-
-  pq :: dpoly
-    a b
-                      Type: XDistributedPolynomial(Symbol,Fraction Integer)
-
-Check some polynomial operations
-
-  mirror pq
-    [b][a]
-                      Type: XPBWPolynomial(Symbol,Fraction Integer)
-
-  ListOfTerms pq
-    [[k= [b][a],c= 1],[k= [a b],c= 1]]
-      Type: List Record(k: PoincareBirkhoffWittLyndonBasis Symbol,
-                        c: Fraction Integer)
-
-  reductum pq
-    [a b]
-                      Type: XPBWPolynomial(Symbol,Fraction Integer)
-
-  leadingMonomial pq
-    [b][a]
-                      Type: PoincareBirkhoffWittLyndonBasis Symbol
-
-  coefficients pq
-    [1,1]
-                      Type: List Fraction Integer
-
-  leadingTerm pq
-    [k= [b][a],c= 1]
-              Type: Record(k: PoincareBirkhoffWittLyndonBasis Symbol,
-                           c: Fraction Integer)
-
-  degree pq
-    2
-                      Type: PositiveInteger
-
-  pq4:=exp(pq,4)
-                          1              1     2       1      2
-     1 + [a b] + [b][a] + - [a b][a b] + - [a b ][a] + - [b][a b]
-                          2              2             2
-   + 
-     3               1
-     - [b][a b][a] + - [b][b][a][a]
-     2               2
-                      Type: XPBWPolynomial(Symbol,Fraction Integer)
-
-  log(pq4,4) - pq
-   (26)  0
-                      Type: XPBWPolynomial(Symbol,Fraction Integer)
-
-Calculations with verification in XDistributedPolynomial.
-
-  lp1 :lpoly := LiePoly liste.10
-       3 2
-     [a b ]
-                      Type: LiePolynomial(Symbol,Fraction Integer)
-
-  lp2 :lpoly := LiePoly liste.11
-      2
-    [a b a b]
-                      Type: LiePolynomial(Symbol,Fraction Integer)
-
-  lp :lpoly := [lp1, lp2]
-      3 2 2
-    [a b a b a b]
-                      Type: LiePolynomial(Symbol,Fraction Integer)
-
-  lpd1: dpoly := lp1
-     3 2     2         2 2                    2 2           2    2 3
-    a b  - 2a b a b - a b a + 4a b a b a - a b a  - 2b a b a  + b a
-                      Type: XDistributedPolynomial(Symbol,Fraction Integer)
-
-  lpd2: dpoly := lp2
-      2         2 2          2                    2 2       3        2
-     a b a b - a b a - 3a b a b + 4a b a b a - a b a  + 2b a b - 3b a b a
-   + 
-            2
-     b a b a
-                      Type: XDistributedPolynomial(Symbol,Fraction Integer)
-
-  lpd : dpoly := lpd1 * lpd2 - lpd2 * lpd1
-      3 2 2         3 2 2 2      3 2     2      3 2             3 2   2 2
-     a b a b a b - a b a b a - 3a b a b a b + 4a b a b a b a - a b a b a
-   + 
-       3 3 3      3 3 2       3 3     2    2       3 2     2       2 2
-     2a b a b - 3a b a b a + a b a b a  - a b a b a b  + 3a b a b a b a
-   + 
-       2           2       2                    2         2 2     2     2 3
-     6a b a b a b a b - 12a b a b a b a b a + 3a b a b a b a  - 4a b a b a b
-   + 
-       2     2 2       2     3 3    2 2 4 2     2 2 3          2 2 2   2
-     6a b a b a b a - a b a b a  + a b a b  - 3a b a b a b + 3a b a b a b
-   + 
-         2 2     3      2 2     2        2 2         2    2 2   2 3
-     - 2a b a b a b + 3a b a b a b a - 3a b a b a b a  + a b a b a
-   + 
-           2   3 2         2   2              2   2 2           2
-     3a b a b a b  - 6a b a b a b a b - 3a b a b a b a + 12a b a b a b a b a
-   + 
-             2     2 2         2 2     2         2 3 3             4 2
-     - 3a b a b a b a  - 6a b a b a b a  + 3a b a b a  - 4a b a b a b
-   + 
-                3                   2   2                  3
-     12a b a b a b a b - 12a b a b a b a b + 8a b a b a b a b
-   + 
-                      2                         2               2 3      2 5 2
-     - 12a b a b a b a b a + 12a b a b a b a b a  - 4a b a b a b a  + a b a b
-   + 
-           2 4            2 3   2        2 2   3        2 2   2
-     - 3a b a b a b + 3a b a b a b - 2a b a b a b + 3a b a b a b a
-   + 
-           2 2       2      2 2 2 3       3   3 2       3   2
-     - 3a b a b a b a  + a b a b a  - 2b a b a b  + 4b a b a b a b
-   + 
-         3   2 2        3                  3     2 2       3 2     2       3 3 3
-     2b a b a b a - 8b a b a b a b a + 2b a b a b a  + 4b a b a b a  - 2b a b a
-   + 
-         2   4 2       2   3            2   3 2         2   2
-     3b a b a b  - 6b a b a b a b - 3b a b a b a + 12b a b a b a b a
-   + 
-           2   2 2 2       2           2       2     2 3          5 2
-     - 3b a b a b a  - 6b a b a b a b a  + 3b a b a b a  - b a b a b
-   + 
-             4 2            3   2             3                  3 2 2
-     3b a b a b a + 6b a b a b a b - 12b a b a b a b a + 3b a b a b a
-   + 
-               2   3            2   2             2 2 3    2 5         2 5 2
-     - 4b a b a b a b + 6b a b a b a b a - b a b a b a  + b a b a b - b a b a
-   + 
-         2 4   2      2 4           2 4 2 2     2 3   3      2 3   2
-     - 3b a b a b + 4b a b a b a - b a b a  + 2b a b a b - 3b a b a b a
-   + 
-      2 3       2
-     b a b a b a
-                    Type: XDistributedPolynomial(Symbol,Fraction Integer)
-
-  lp :: dpoly - lpd
-    0
-                    Type: XDistributedPolynomial(Symbol,Fraction Integer)
-
-Calculations with verification in XRecursivePolynomial.
-
-  p := 3 * lp
-       3 2 2
-    3[a b a b a b]
-                    Type: XPBWPolynomial(Symbol,Fraction Integer)
-
-  q := lp1
-      3 2
-    [a b ]
-                    Type: XPBWPolynomial(Symbol,Fraction Integer)
-
-  pq:= p * q
-       3 2 2        3 2
-    3[a b a b a b][a b ]
-                    Type: XPBWPolynomial(Symbol,Fraction Integer)
-
-  pr:rpoly := p :: rpoly
-       a
-    *
-           a
-        *
-               a b b
-            *
-                a(a b(a b 3 + b a(- 3)) + b(a(a b(- 9) + b a 12) + b a a(- 3)))
-               + 
-                 b a(a(a b 6 + b a(- 9)) + b a a 3)
-           + 
-               b
-            *
-                   a b
-                *
-                       a
-                    *
-                         a(a b b(- 3) + b b a 9)
-                       + 
-                         b(a(a b 18 + b a(- 36)) + b a a 9)
-                   + 
-                     b(a a(a b(- 12) + b a 18) + b a a a(- 3))
-               + 
-                   b a
-                *
-                     a(a(a b b 3 + b a b(- 9)) + b a a b 9)
-                   + 
-                     b(a(a(a b(- 6) + b a 9) + b a a(- 9)) + b a a a 3)
-       + 
-           b
-        *
-               a
-            *
-                   a b
-                *
-                       a
-                    *
-                         a(a b b 9 + b(a b(- 18) + b a(- 9)))
-                       + 
-                         b(a b a 36 + b a a(- 9))
-                   + 
-                     b(a b a a(- 18) + b a a a 9)
-               + 
-                   b a
-                *
-                     a(a(a b b(- 12) + b a b 36) + b a a b(- 36))
-                   + 
-                     b(a(a(a b 24 + b a(- 36)) + b a a 36) + b a a a(- 12))
-           + 
-               b a a
-            *
-                 a(a(a b b 3 + b a b(- 9)) + b a a b 9)
-               + 
-                 b(a(a(a b(- 6) + b a 9) + b a a(- 9)) + b a a a 3)
-   + 
-       b
-    *
-           a
-        *
-               a
-            *
-                   a b
-                *
-                       a
-                    *
-                         a(a b b(- 6) + b(a b 12 + b a 6))
-                       + 
-                         b(a b a(- 24) + b a a 6)
-                   + 
-                     b(a b a a 12 + b a a a(- 6))
-               + 
-                   b a
-                *
-                       a
-                    *
-                         a(a b b 9 + b(a b(- 18) + b a(- 9)))
-                       + 
-                         b(a b a 36 + b a a(- 9))
-                   + 
-                     b(a b a a(- 18) + b a a a 9)
-           + 
-               b a a
-            *
-                a(a(a b b(- 3) + b b a 9) + b(a(a b 18 + b a(- 36)) + b a a 9))
-               + 
-                 b(a a(a b(- 12) + b a 18) + b a a a(- 3))
-       + 
-           b a a a
-        *
-             a(a b(a b 3 + b a(- 3)) + b(a(a b(- 9) + b a 12) + b a a(- 3)))
-           + 
-             b a(a(a b 6 + b a(- 9)) + b a a 3)
-                      Type: XRecursivePolynomial(Symbol,Fraction Integer)
-
-  qr:rpoly := q :: rpoly
-     a(a(a b b 1 + b(a b(- 2) + b a(- 1))) + b(a b a 4 + b a a(- 1)))
-   + 
-     b(a b a a(- 2) + b a a a 1)
-                      Type: XRecursivePolynomial(Symbol,Fraction Integer)
-
-  pq :: rpoly - pr*qr
-    0
-                      Type: XRecursivePolynomial(Symbol,Fraction Integer)
-
-See Also:
-o )show XPBWPolynomial
-o $AXIOM/doc/src/algebra/xlpoly.spad.dvi
-
-@
-<<domain XPBWPOLY XPBWPolynomial>>=
-)abbrev domain XPBWPOLY XPBWPolynomial
-++ Author: Michel Petitot (petitot@lifl.fr).
-++ Date Created: 91
-++ Date Last Updated: 7 Juillet 92
-++ Fix History: compilation v 2.1 le 13 dec 98
-++ Basic Functions:
-++ Related Constructors:
-++ Also See:
-++ AMS Classifications:
-++ Keywords:
-++ References:
-++ Description:
-++ This domain constructor implements polynomials in non-commutative
-++ variables written in the Poincare-Birkhoff-Witt basis from the
-++ Lyndon basis.
-++ These polynomials can be used to compute Baker-Campbell-Hausdorff
-++ relations. \newline Author: Michel Petitot (petitot@lifl.fr).
-
-XPBWPolynomial(VarSet:OrderedSet,R:CommutativeRing): XDPcat == XDPdef where
-
-  WORD   ==> OrderedFreeMonoid(VarSet)
-  LWORD  ==> LyndonWord(VarSet)
-  LWORDS ==> List LWORD
-  BASIS  ==> PoincareBirkhoffWittLyndonBasis(VarSet)
-  TERM   ==> Record(k:BASIS, c:R)
-  LTERMS ==> List(TERM)
-  LPOLY  ==> LiePolynomial(VarSet,R)  
-  EX     ==> OutputForm
-  XDPOLY ==> XDistributedPolynomial(VarSet,R)
-  XRPOLY ==> XRecursivePolynomial(VarSet,R)
-  TERM1  ==> Record(k:LWORD, c:R)
-  NNI    ==> NonNegativeInteger
-  I      ==> Integer
-  RN     ==> Fraction(Integer)
-
-  XDPcat == Join(XPolynomialsCat(VarSet,R), FreeModuleCat(R, BASIS)) with
-    coerce      : LPOLY -> $
-      ++ \axiom{coerce(p)} returns \axiom{p}. 
-    coerce      : $ -> XDPOLY
-      ++ \axiom{coerce(p)} returns \axiom{p} as a distributed polynomial. 
-    coerce      : $ -> XRPOLY
-      ++ \axiom{coerce(p)} returns \axiom{p} as a recursive polynomial.
-    LiePolyIfCan: $ -> Union(LPOLY,"failed")
-      ++ \axiom{LiePolyIfCan(p)} return  \axiom{p} if \axiom{p} is a Lie polynomial.
-    product     : ($,$,NNI) -> $           -- produit tronque a l'ordre n
-      ++ \axiom{product(a,b,n)} returns \axiom{a*b} (truncated up to order \axiom{n}).
-
-    if R has Module(RN) then
-       exp      : ($,NNI) -> $
-          ++ \axiom{exp(p,n)} returns the exponential of \axiom{p} 
-          ++ (truncated up to order \axiom{n}).
-       log      : ($,NNI) -> $
-          ++ \axiom{log(p,n)} returns the logarithm of \axiom{p}
-          ++ (truncated up to order \axiom{n}).
-
-  XDPdef == FreeModule1(R,BASIS) add
-       import(TERM)
-
-    -- Representation
-       Rep:= LTERMS 
-
-    -- local functions
-       prod1: (BASIS, $) -> $
-       prod2: ($, BASIS) -> $
-       prod : (BASIS, BASIS) -> $
-
-       prod11: (BASIS, $, NNI) -> $
-       prod22: ($, BASIS, NNI) -> $
-
-       outForm : TERM -> EX
-       Dexpand : BASIS -> XDPOLY
-       Rexpand : BASIS -> XRPOLY
-       process : (List LWORD, LWORD, List LWORD) -> $
-       mirror1 : BASIS -> $
-
-    -- functions locales
-       outForm t ==
-           t.c =$R 1 => t.k :: EX
-           t.k =$BASIS 1 => t.c :: EX
-           t.c::EX * t.k ::EX
-
-       prod1(b:BASIS, p:$):$ ==
-         +/ [t.c * prod(b, t.k) for t in p]
-
-       prod2(p:$, b:BASIS):$ ==
-         +/ [t.c * prod(t.k, b) for t in p]
- 
-       prod11(b,p,n) ==
-           limit: I := n -$I length b
-           +/ [t.c * prod(b, t.k) for t in p| length(t.k) :: I <= limit]
-
-       prod22(p,b,n) ==
-           limit: I := n -$I length b
-           +/ [t.c * prod(t.k, b) for t in p| length(t.k) :: I <= limit]
-
-       prod(g,d) ==
-         d = 1 => monom(g,1)
-         g = 1 => monom(d,1)
-         process(reverse ListOfTerms g, first d, rest ListOfTerms d)
-
-       Dexpand b == 
-         b = 1 => 1$XDPOLY
-         */ [LiePoly(l)$LPOLY :: XDPOLY for l in ListOfTerms b]
-
-       Rexpand b ==
-         b = 1 => 1$XRPOLY
-         */ [LiePoly(l)$LPOLY :: XRPOLY for l in ListOfTerms b]
-
-       mirror1(b:BASIS):$ ==
-         b = 1 => 1
-         lp: LPOLY := LiePoly first b
-         lp := mirror lp
-         mirror1(rest b) * lp :: $
-
-       process(gauche, x, droite) ==    -- algo du "collect process"
-         null gauche => monom( cons(x, droite) pretend BASIS, 1$R)
-         r1, r2 : $
-         not lexico(first gauche, x) =>     -- cas facile !!!
-           monom(append(reverse gauche, cons(x, droite)) pretend BASIS , 1$R)
-
-         p: LPOLY := [first gauche , x]      -- on crochete !!!
-         null droite =>
-           r1 :=  +/ [t.c * process(rest gauche, t.k, droite) for t in _
-                      ListOfTerms p]
-           r2 :=  process( rest gauche, x, list first gauche)
-           r1 + r2 
-         rd: List LWORD := rest droite; fd: LWORD := first droite
-         r1 := +/ [t.c * process(list t.k, fd, rd) for t in  ListOfTerms p] 
-         r1 := +/ [t.c * process(rest gauche, first t.k, rest ListOfTerms(t.k))_
-                  for t in  r1] 
-         r2 := process([first gauche, x], fd, rd)
-         r2 := +/ [t.c * process(rest gauche, first t.k, rest ListOfTerms(t.k))_
-                  for t in  r2]
-         r1 + r2
-
-    -- definitions
-       1 == monom(1$BASIS, 1$R)
-
-       coerce(r:R):$ == [[1$BASIS , r]$TERM ]
-
-       coerce(p:$):EX ==
-         null p => (0$R) :: EX
-         le : List EX := nil
-         for rec in p repeat le := cons(outForm rec, le)
-         reduce(_+, le)$List(EX)
-
-       coerce(v: VarSet):$ == monom(v::BASIS , 1$R)
-       coerce(p: LPOLY):$ ==
-          [[t.k :: BASIS , t.c ]$TERM for t in ListOfTerms p]
-
-       coerce(p:$):XDPOLY ==
-         +/ [t.c * Dexpand t.k for t in p]
-
-       coerce(p:$):XRPOLY ==
-         p = 0 => 0$XRPOLY
-         +/ [t.c * Rexpand t.k for t in p]
-
-       constant? p == (null p) or (leadingMonomial(p) =$BASIS 1)
-       constant p == 
-         null p => 0$R
-         p.last.k = 1$BASIS => p.last.c
-         0$R
-
-       quasiRegular? p == (p=0) or (p.last.k ^= 1$BASIS)
-       quasiRegular p == 
-         p = 0 => p
-         p.last.k = 1$BASIS => delete(p, maxIndex p)
-         p
-    
-       x:$ * y:$ ==
-         y = 0$$ => 0
-         +/ [t.c * prod1(t.k, y) for t in x]
-
---       ListOfTerms p == p pretend LTERMS
-
-       varList p == 
-          lv: List VarSet := "setUnion"/ [varList(b.k)$BASIS for b in p]
-          sort(lv)
-
-       degree(p) ==
-          p=0 => error "null polynomial"
-          length(leadingMonomial p)
-
-       trunc(p, n) ==
-         p = 0 => p
-         degree(p) > n => trunc( reductum p , n)
-         p
-
-       product(x,y,n) ==
-         x = 0 => 0
-         y = 0 => 0
-         +/ [t.c * prod11(t.k, y, n) for t in x]
-
-       if R has Module(RN) then
-         exp (p,n) ==
-             p = 0 => 1
-             not quasiRegular? p => 
-               error "a proper polynomial is required"
-             s : $ := 1 ; r: $ := 1                  -- resultat
-             for i in 1..n repeat
-                k1 :RN := 1/i
-                k2 : R := k1 * 1$R
-                s := k2 * product(p, s, n)
-                r := r + s
-             r
-  
-         log (p,n) ==
-             p = 1 => 0
-             p1: $ := 1 - p
-             not quasiRegular? p1 => 
-               error "constant term <> 1, impossible log "
-             s : $ := - 1 ; r: $ := 0                 -- resultat
-             for i in 1..n repeat
-               k1 :RN := 1/i
-               k2 : R := k1 * 1$R
-               s := product(p1, s, n)
-               r := k2 * s + r
-             r
- 
-       LiePolyIfCan p ==
-         p = 0 => 0$LPOLY
-         "and"/ [retractable?(t.k)$BASIS for t in p] =>
-            lt : List TERM1 := _
-                 [[retract(t.k)$BASIS, t.c]$TERM1 for t in p]
-            lt pretend LPOLY
-         "failed"
-
-       mirror p ==
-         +/ [t.c * mirror1(t.k) for t in p]
-
-@
-\section{domain LEXP LieExponentials}
-<<LieExponentials.input>>=
--- xlpoly.spad.pamphlet LieExponentials.input
-)spool LieExponentials.output
-)set message test on
-)set message auto off
-)clear all
---S 1 of 13
-a: Symbol := 'a
---R 
---R
---R   (1)  a
---R                                                                 Type: Symbol
---E 1
-
---S 2 of 13
-b: Symbol := 'b
---R 
---R
---R   (2)  b
---R                                                                 Type: Symbol
---E 2
-
---S 3 of 13
-coef := Fraction(Integer) 
---R 
---R
---R   (3)  Fraction Integer
---R                                                                 Type: Domain
---E 3
-
---S 4 of 13
-group := LieExponentials(Symbol, coef, 3)
---R 
---R
---R   (4)  LieExponentials(Symbol,Fraction Integer,3)
---R                                                                 Type: Domain
---E 4
-
---S 5 of 13
-lpoly := LiePolynomial(Symbol, coef)
---R 
---R
---R   (5)  LiePolynomial(Symbol,Fraction Integer)
---R                                                                 Type: Domain
---E 5
-
---S 6 of 13
-poly := XPBWPolynomial(Symbol, coef)
---R 
---R
---R   (6)  XPBWPolynomial(Symbol,Fraction Integer)
---R                                                                 Type: Domain
---E 6
-
---S 7 of 13
-ea := exp(a::lpoly)$group
---R 
---R
---R         [a]
---R   (7)  e
---R                             Type: LieExponentials(Symbol,Fraction Integer,3)
---E 7
-
---S 8 of 13
-eb := exp(b::lpoly)$group
---R 
---R
---R         [b]
---R   (8)  e
---R                             Type: LieExponentials(Symbol,Fraction Integer,3)
---E 8
-
---S 9 of 13
-g: group := ea*eb
---R 
---R
---R             1     2        1   2
---R             - [a b ]       - [a b]
---R         [b] 2        [a b] 2       [a]
---R   (9)  e   e        e     e       e
---R                             Type: LieExponentials(Symbol,Fraction Integer,3)
---E 9
-
---S 10 of 13
-g :: poly
---R 
---R
---R   (10)
---R                     1                           1          1
---R     1 + [a] + [b] + - [a][a] + [a b] + [b][a] + - [b][b] + - [a][a][a]
---R                     2                           2          6
---R   + 
---R     1   2                1     2    1                        1
---R     - [a b] + [a b][a] + - [a b ] + - [b][a][a] + [b][a b] + - [b][b][a]
---R     2                    2          2                        2
---R   + 
---R     1
---R     - [b][b][b]
---R     6
---R                                Type: XPBWPolynomial(Symbol,Fraction Integer)
---E 10
-
---S 11 of 13
-log(g)$group
---R 
---R
---R                     1          1   2      1     2
---R   (11)  [a] + [b] + - [a b] + -- [a b] + -- [a b ]
---R                     2         12         12
---R                                 Type: LiePolynomial(Symbol,Fraction Integer)
---E 11
-
---S 12 of 13
-g1: group := inv(g)
---R 
---R
---R          - [b] - [a]
---R   (12)  e     e
---R                             Type: LieExponentials(Symbol,Fraction Integer,3)
---E 12
-
---S 13 of 13
-g*g1
---R 
---R
---R   (13)  1
---R                             Type: LieExponentials(Symbol,Fraction Integer,3)
---E 13
-)spool
-)lisp (bye)
-@
-<<LieExponentials.help>>=
-====================================================================
-LieExponentials examples
-====================================================================
-
-  a: Symbol := 'a
-    a
-                         Type: Symbol
-
-  b: Symbol := 'b
-    b
-                         Type: Symbol
-
-====================================================================
-Declarations of domains
-====================================================================
-
-  coef := Fraction(Integer) 
-    Fraction Integer
-                         Type: Domain
-
-  group := LieExponentials(Symbol, coef, 3)
-    LieExponentials(Symbol,Fraction Integer,3)
-                         Type: Domain
-
-  lpoly := LiePolynomial(Symbol, coef)
-    LiePolynomial(Symbol,Fraction Integer)
-                         Type: Domain
-
-  poly := XPBWPolynomial(Symbol, coef)
-    XPBWPolynomial(Symbol,Fraction Integer)
-                         Type: Domain
-
-====================================================================
-Calculations
-====================================================================
-
-  ea := exp(a::lpoly)$group
-     [a]
-    e
-                         Type: LieExponentials(Symbol,Fraction Integer,3)
-
-  eb := exp(b::lpoly)$group
-     [b]
-    e
-                         Type: LieExponentials(Symbol,Fraction Integer,3)
-
-  g: group := ea*eb
-         1     2        1   2
-         - [a b ]       - [a b]
-     [b] 2        [a b] 2       [a]
-    e   e        e     e       e
-                         Type: LieExponentials(Symbol,Fraction Integer,3)
-
-  g :: poly
-                     1                           1          1
-     1 + [a] + [b] + - [a][a] + [a b] + [b][a] + - [b][b] + - [a][a][a]
-                     2                           2          6
-   + 
-     1   2                1     2    1                        1
-     - [a b] + [a b][a] + - [a b ] + - [b][a][a] + [b][a b] + - [b][b][a]
-     2                    2          2                        2
-   + 
-     1
-     - [b][b][b]
-     6
-                        Type: XPBWPolynomial(Symbol,Fraction Integer)
-
-  log(g)$group
-                1          1   2      1     2
-    [a] + [b] + - [a b] + -- [a b] + -- [a b ]
-                2         12         12
-                        Type: LiePolynomial(Symbol,Fraction Integer)
-
-  g1: group := inv(g)
-     - [b] - [a]
-    e     e
-                        Type: LieExponentials(Symbol,Fraction Integer,3)
-
-  g*g1
-    1
-                        Type: LieExponentials(Symbol,Fraction Integer,3)
-
-See Also:
-o )show LieExponentials
-o $AXIOM/doc/src/algebra/xlpoly.spad.dvi
-
-@
-<<domain LEXP LieExponentials>>=
-)abbrev domain LEXP LieExponentials
-++ Author: Michel Petitot (petitot@lifl.fr).
-++ Date Created: 91
-++ Date Last Updated: 7 Juillet 92
-++ Fix History: compilation v 2.1 le 13 dec 98
-++ Basic Functions:
-++ Related Constructors:
-++ Also See:
-++ AMS Classifications:
-++ Keywords:
-++ References:
-++ Description:
-++ Management of the Lie Group associated with a
-++ free nilpotent Lie algebra. Every Lie bracket with 
-++ length greater than \axiom{Order} are
-++ assumed to be null.
-++ The implementation inherits from the \spadtype{XPBWPolynomial}
-++ domain constructor: Lyndon
-++ coordinates are exponential coordinates 
-++ of the second kind. \newline Author: Michel Petitot (petitot@lifl.fr).
-
-LieExponentials(VarSet, R, Order): XDPcat == XDPdef where
-
-  EX     ==> OutputForm
-  PI     ==> PositiveInteger
-  NNI    ==> NonNegativeInteger
-  I      ==> Integer
-  RN     ==> Fraction(I)
-  R      : Join(CommutativeRing, Module RN)
-  Order  : PI 
-  VarSet : OrderedSet
-  LWORD  ==> LyndonWord(VarSet)
-  LWORDS ==> List LWORD
-  BASIS  ==> PoincareBirkhoffWittLyndonBasis(VarSet)
-  TERM   ==> Record(k:BASIS, c:R)
-  LTERMS ==> List(TERM)
-  LPOLY  ==> LiePolynomial(VarSet,R)  
-  XDPOLY ==> XDistributedPolynomial(VarSet,R)
-  PBWPOLY==> XPBWPolynomial(VarSet, R)
-  TERM1  ==> Record(k:LWORD, c:R)
-  EQ     ==> Equation(R)
-
-  XDPcat == Group with
-    exp         : LPOLY -> $
-      ++ \axiom{exp(p)} returns the exponential of \axiom{p}.
-    log         : $ -> LPOLY
-      ++ \axiom{log(p)} returns the logarithm of \axiom{p}.
-    ListOfTerms : $ -> LTERMS
-      ++ \axiom{ListOfTerms(p)} returns the internal representation of \axiom{p}.
-    coerce      : $ -> XDPOLY
-      ++ \axiom{coerce(g)} returns the internal representation of \axiom{g}.
-    coerce      : $ -> PBWPOLY
-      ++ \axiom{coerce(g)} returns the internal representation of \axiom{g}.
-    mirror      : $ -> $
-      ++ \axiom{mirror(g)} is the mirror of the internal representation of \axiom{g}.
-    varList     : $ -> List VarSet
-      ++ \axiom{varList(g)} returns the list of variables of \axiom{g}. 
-    LyndonBasis : List VarSet -> List LPOLY
-      ++ \axiom{LyndonBasis(lv)} returns the Lyndon basis of the nilpotent free
-      ++ Lie algebra.
-    LyndonCoordinates: $ -> List TERM1
-      ++ \axiom{LyndonCoordinates(g)} returns the exponential coordinates of \axiom{g}.
-    identification: ($,$) -> List EQ
-      ++ \axiom{identification(g,h)} returns the list of equations \axiom{g_i = h_i},
-      ++ where \axiom{g_i} (resp. \axiom{h_i}) are exponential coordinates 
-      ++ of \axiom{g} (resp. \axiom{h}). 
-
-  XDPdef == PBWPOLY add
-
-    -- Representation
-       Rep := PBWPOLY 
-
-    -- local functions
-       compareTerm1s: (TERM1, TERM1) -> Boolean
-       out: TERM1 -> EX
-       ident: (List TERM1, List TERM1) -> List EQ
-
-    -- functions locales
-       ident(l1, l2) ==
-         import(TERM1)
-         null l1 => [equation(0$R,t.c)$EQ for t in l2]
-         null l2 => [equation(t.c, 0$R)$EQ for t in l1]        
-         u1 : LWORD := l1.first.k; c1 :R := l1.first.c
-         u2 : LWORD := l2.first.k; c2 :R := l2.first.c
-         u1 = u2 =>
-            r: R := c1 - c2
-            r = 0 => ident(rest l1, rest l2) 
-            cons(equation(c1,c2)$EQ , ident(rest l1, rest l2))
-         lexico(u1, u2)$LWORD =>
-            cons(equation(0$R,c2)$EQ , ident(l1, rest l2))
-         cons(equation(c1,0$R)$EQ , ident(rest l1, l2))
-
-       -- ordre lexico decroissant
-       compareTerm1s(u:TERM1, v:TERM1):Boolean == lexico(v.k, u.k)$LWORD
-
-       out(t:TERM1):EX ==
-         t.c =$R 1 => char("e")$Character :: EX ** t.k ::EX
-         char("e")$Character :: EX ** (t.c::EX * t.k::EX)
- 
-    -- definitions
-       identification(x,y) ==
-          l1: List TERM1 := LyndonCoordinates x
-          l2: List TERM1 := LyndonCoordinates y
-          ident(l1, l2)
- 
-       LyndonCoordinates x ==
-         lt: List TERM1 := [[l::LWORD, t.c]$TERM1 for t in ListOfTerms x | _
-                             (l := retractIfCan(t.k)$BASIS) case LWORD ] 
-         lt := sort(compareTerm1s,lt)
-
-       x:$ * y:$ == product(x::Rep, y::Rep, Order::I::NNI)$Rep
-
-       exp p == exp(p::Rep , Order::I::NNI)$Rep
-
-       log p == LiePolyIfCan(log(p,Order::I::NNI))$Rep :: LPOLY
-
-       coerce(p:$):EX ==
-          p = 1$$ => 1$R :: EX
-          lt : List TERM1 := LyndonCoordinates p 
-          reduce(_*, [out t for t in lt])$List(EX)
-
-
-       LyndonBasis(lv) == 
-         [LiePoly(l)$LPOLY for l in LyndonWordsList(lv,Order)$LWORD]
-
-       coerce(p:$):PBWPOLY == p::Rep
-
-       inv x ==
-         x = 1 => 1
-         lt:LTERMS := ListOfTerms mirror x
-         lt:= [[t.k, (odd? length(t.k)$BASIS => - t.c; t.c)]$TERM for t in lt ]
-         lt pretend $
-
-@
 \section{License}
 <<license>>=
 --Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd.
@@ -3191,13 +117,7 @@ LieExponentials(VarSet, R, Order): XDPcat == XDPdef where
 <<*>>=
 <<license>>
 
-<<domain MAGMA Magma>>
-<<domain LWORD LyndonWord>>
 <<package XEXPPKG XExponentialPackage>>
-<<domain LPOLY LiePolynomial>>
-<<domain PBWLB PoincareBirkhoffWittLyndonBasis>>
-<<domain XPBWPOLY XPBWPolynomial>>
-<<domain LEXP LieExponentials>>
 @
 \eject
 \begin{thebibliography}{99}
diff --git a/src/algebra/xpoly.spad.pamphlet b/src/algebra/xpoly.spad.pamphlet
deleted file mode 100644
index 3fb7b2b..0000000
--- a/src/algebra/xpoly.spad.pamphlet
+++ /dev/null
@@ -1,1542 +0,0 @@
-\documentclass{article}
-\usepackage{axiom}
-\begin{document}
-\title{\$SPAD/src/algebra xpoly.spad}
-\author{Michel Petitot}
-\maketitle
-\begin{abstract}
-\end{abstract}
-\eject
-\tableofcontents
-\eject
-\section{domain OFMONOID OrderedFreeMonoid}
-<<domain OFMONOID OrderedFreeMonoid>>=
-)abbrev domain OFMONOID OrderedFreeMonoid
-++ Author: Michel Petitot petitot@lifl.fr
-++ Date Created: 91
-++ Date Last Updated: 7 Juillet 92
-++ Fix History: compilation v 2.1 le 13 dec 98
-++ Basic Functions:
-++ Related Constructors:
-++ Also See:
-++ AMS Classifications:
-++ Keywords:
-++ References:
-++ Description:
-++    The free monoid on a set \spad{S} is the monoid of finite products of
-++ the form \spad{reduce(*,[si ** ni])} where the si's are in S, and the ni's
-++ are non-negative integers. The multiplication is not commutative.
-++ For two elements \spad{x} and \spad{y} the relation \spad{x < y}
-++ holds if either \spad{length(x) < length(y)} holds or if these lengths
-++ are equal and if \spad{x} is smaller than \spad{y} w.r.t. the lexicographical
-++ ordering induced by \spad{S}.
-++ This domain inherits implementation from \spadtype{FreeMonoid}.
-++ Author: Michel Petitot (petitot@lifl.fr)
-
-OrderedFreeMonoid(S: OrderedSet): OFMcategory == OFMdefinition where
-    NNI ==> NonNegativeInteger
-    REC ==> Record(gen:S, exp:NNI)
- 
-    OFMcategory == Join(OrderedMonoid, RetractableTo S) with
-        "*":    (S, %) -> %
-          ++ \spad{s * x} returns the product of \spad{x} by \spad{s} on the left.
-        "*":    (%, S) -> %
-          ++ \spad{x * s} returns the product of \spad{x} by \spad{s} on the right.
-        "**":   (S, NNI) -> %
-          ++ \spad{s ** n} returns the product of \spad{s} by itself \spad{n} times.
-        first: % -> S
-          ++ \spad{first(x)} returns the first letter of \spad{x}.
-        rest:  % -> %
-          ++ \spad{rest(x)} returns \spad{x} except the first letter.
-        mirror: % -> %
-          ++ \spad{mirror(x)} returns the reversed word of \spad{x}.
-        lexico: (%,%) -> Boolean
-          ++ \spad{lexico(x,y)} returns \spad{true} iff \spad{x} is smaller than \spad{y}
-          ++ w.r.t. the pure lexicographical ordering induced by \spad{S}.
-        hclf:   (%, %) -> %
-          ++ \spad{hclf(x, y)} returns the highest common left factor 
-          ++ of \spad{x} and \spad{y},
-          ++ that is the largest \spad{d} such that \spad{x = d a} and \spad{y = d b}.
-        hcrf:   (%, %) -> %
-          ++ \spad{hcrf(x, y)} returns the highest common right 
-          ++ factor of \spad{x} and \spad{y},
-          ++ that is the largest \spad{d} such that \spad{x = a d} and \spad{y = b d}.
-        lquo:   (%, %) -> Union(%, "failed")
-          ++ \spad{lquo(x, y)} returns the exact left quotient of \spad{x}
-          ++  by \spad{y} that is \spad{q} such that \spad{x = y * q},
-          ++ "failed" if \spad{x} is not of the form \spad{y * q}.
-        rquo:   (%, %) -> Union(%, "failed")
-          ++ \spad{rquo(x, y)} returns the exact right quotient of \spad{x} 
-          ++ by \spad{y} that is \spad{q} such that \spad{x = q * y},
-          ++ "failed" if \spad{x} is not of the form \spad{q * y}.
-        lquo:   (%, S) -> Union(%, "failed")
-          ++ \spad{lquo(x, s)} returns the exact left quotient of \spad{x} 
-          ++ by \spad{s}. 
-        rquo:   (%, S) -> Union(%, "failed")
-          ++ \spad{rquo(x, s)} returns the exact right quotient 
-          ++ of \spad{x} by \spad{s}.
-        "div":   (%, %) -> Union(Record(lm: %, rm: %), "failed")
-          ++ \spad{x div y} returns the left and right exact quotients of
-          ++ \spad{x} by \spad{y}, that is \spad{[l, r]} such that \spad{x = l * y * r}.
-          ++ "failed" is returned iff \spad{x} is not of the form \spad{l * y * r}.
-        overlap: (%, %) -> Record(lm: %, mm: %, rm: %)
-          ++ \spad{overlap(x, y)} returns \spad{[l, m, r]} such that
-          ++ \spad{x = l * m} and \spad{y = m * r} hold and such that 
-          ++ \spad{l} and \spad{r} have no overlap,
-          ++ that is \spad{overlap(l, r) = [l, 1, r]}.
-        size:   % -> NNI
-          ++ \spad{size(x)} returns the number of monomials in \spad{x}.
-        nthExpon:  (%, Integer) -> NNI
-          ++ \spad{nthExpon(x, n)} returns the exponent of the 
-          ++ \spad{n-th} monomial of \spad{x}.
-        nthFactor: (%, Integer) -> S
-          ++ \spad{nthFactor(x, n)} returns the factor of the \spad{n-th} 
-          ++ monomial of \spad{x}.
-        factors: % -> List REC
-          ++ \spad{factors(a1\^e1,...,an\^en)} returns \spad{[[a1, e1],...,[an, en]]}.
-        length: % -> NNI
-          ++ \spad{length(x)} returns the length of \spad{x}.
-        varList: % -> List S
-          ++ \spad{varList(x)} returns the list of variables of \spad{x}.
-
-    OFMdefinition == FreeMonoid(S) add
-        Rep := ListMonoidOps(S, NNI, 1)
-        
-      -- definitions
-        lquo(w:%, l:S) == 
-          x: List REC := listOfMonoms(w)$Rep
-          null x        => "failed"
-          fx: REC := first x
-          fx.gen ^= l  => "failed"
-          fx.exp = 1   => makeMulti rest(x)
-          makeMulti [[fx.gen, (fx.exp - 1)::NNI ]$REC, :rest x]
-       
-        rquo(w:%, l:S) ==
-          u:% := reverse w
-          (r := lquo (u,l)) case "failed" => "failed"
-          reverse_! (r::%)
-
-        length x == reduce("+" ,[f.exp for f in listOfMonoms x], 0)
-
-        varList x ==
-          le: List S := [t.gen for t in listOfMonoms x]
-          sort_! removeDuplicates(le)
- 
-        first w ==
-          x: List REC := listOfMonoms w
-          null x => error "empty word !!!"
-          x.first.gen
-
-        rest w ==
-          x: List REC := listOfMonoms w
-          null x => error "empty word !!!"
-          fx: REC := first x
-          fx.exp = 1 => makeMulti rest x
-          makeMulti [[fx.gen , (fx.exp - 1)::NNI ]$REC , :rest x]
-
-        lexico(a,b) ==         --  ordre lexicographique
-            la := listOfMonoms a
-            lb := listOfMonoms b
-            while (not null la) and (not null lb) repeat
-                la.first.gen > lb.first.gen => return false
-                la.first.gen < lb.first.gen => return true
-                if la.first.exp = lb.first.exp then
-                    la:=rest la
-                    lb:=rest lb
-                else if la.first.exp > lb.first.exp then
-                    la:=concat([la.first.gen,
-                           (la.first.exp - lb.first.exp)::NNI], rest lb)
-                    lb:=rest lb
-                else
-                    lb:=concat([lb.first.gen,
-                             (lb.first.exp-la.first.exp)::NNI], rest la)
-                    la:=rest la
-            empty? la and not empty? lb
-
-
-        a < b ==               --  ordre lexicographique par longueur
-            la:NNI := length a; lb:NNI := length b
-            la = lb =>  lexico(a,b)
-            la < lb 
-
-        mirror x == reverse(x)$Rep
-
-@
-\section{domain FM1 FreeModule1}
-<<domain FM1 FreeModule1>>=
-)abbrev domain FM1 FreeModule1
-++ Author: Michel Petitot petitot@lifl.fr
-++ Date Created: 91
-++ Date Last Updated: 7 Juillet 92
-++ Fix History: compilation v 2.1 le 13 dec 98
-++ Basic Functions:
-++ Related Constructors:
-++ Also See:
-++ AMS Classifications:
-++ Keywords:
-++ References:
-++ Description:
-++   This domain implements linear combinations
-++   of elements from the domain \spad{S} with coefficients
-++   in the domain \spad{R} where \spad{S} is an ordered set
-++   and \spad{R} is a ring (which may be non-commutative).
-++   This domain is used by domains of non-commutative algebra such as:
-++       \spadtype{XDistributedPolynomial},
-++       \spadtype{XRecursivePolynomial}.
-++   Author: Michel Petitot (petitot@lifl.fr)
-
-FreeModule1(R:Ring,S:OrderedSet): FMcat == FMdef where
-  EX ==> OutputForm
-  TERM ==> Record(k:S,c:R)
-
-  FMcat == FreeModuleCat(R,S) with
-    "*":(S,R) -> %
-      ++ \spad{s*r} returns the product \spad{r*s}
-      ++ used by \spadtype{XRecursivePolynomial} 
-  FMdef == FreeModule(R,S) add
-    -- representation
-      Rep := List TERM  
-
-    -- declarations
-      lt: List TERM 
-      x : %
-      r : R
-      s : S
-
-    -- define
-      numberOfMonomials p ==
-         # (p::Rep)
-
-      ListOfTerms(x) == x:List TERM 
-
-      leadingTerm x == x.first
-      leadingMonomial x == x.first.k
-      coefficients x == [t.c for t in x]
-      monomials x == [ monom (t.k, t.c) for t in x]
-
-      retractIfCan x ==
-         numberOfMonomials(x) ^= 1 => "failed"
-         x.first.c = 1 => x.first.k
-         "failed"
-
-      coerce(s:S):% == [[s,1$R]]
-      retract x ==
-         (rr := retractIfCan x) case "failed" => error "FM1.retract impossible"
-         rr :: S
-
-      if R has noZeroDivisors then
-         r * x  ==
-             r = 0 => 0
-             [[u.k,r * u.c]$TERM for u in x]
-         x * r  == 
-             r = 0 => 0
-             [[u.k,u.c * r]$TERM for u in x]
-       else
-         r * x  ==
-             r = 0 => 0
-             [[u.k,a] for u in x | not (a:=r*u.c)= 0$R]
-         x * r  ==
-             r = 0 => 0
-             [[u.k,a] for u in x | not (a:=u.c*r)= 0$R]
-
-      r * s ==
-        r = 0 => 0
-        [[s,r]$TERM]
-
-      s * r ==
-        r = 0 => 0
-        [[s,r]$TERM]
-
-      monom(b,r):% == [[b,r]$TERM] 
-
-      outTerm(r:R, s:S):EX ==
-            r=1  => s::EX
-            r::EX * s::EX
-
-      coerce(a:%):EX ==
-            empty? a => (0$R)::EX
-            reduce(_+, reverse_! [outTerm(t.c, t.k) for t in a])$List(EX)
-
-      coefficient(x,s) ==
-         null x => 0$R
-         x.first.k > s => coefficient(rest x,s)
-         x.first.k = s => x.first.c
-         0$R
-
-@
-\section{domain XPR XPolynomialRing}
-<<XPolynomialRing.input>>=
--- xpoly.spad.pamphlet XPolynomialRing.input
-)spool XPolynomialRing.output
-)set message test on
-)set message auto off
-)clear all
---S 1 of 15
-Word := OrderedFreeMonoid(Symbol)
---R 
---R
---R   (1)  OrderedFreeMonoid Symbol
---R                                                                 Type: Domain
---E 1
-
---S 2 of 15
-poly:= XPR(Integer,Word)
---R 
---R
---R   (2)  XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
---R                                                                 Type: Domain
---E 2
-
---S 3 of 15
-p:poly := 2 * x - 3 * y + 1
---R 
---R
---R   (3)  1 + 2x - 3y
---R                      Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
---E 3
-
---S 4 of 15
-q:poly := 2 * x + 1
---R 
---R
---R   (4)  1 + 2x
---R                      Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
---E 4
-
---S 5 of 15
-p + q
---R 
---R
---R   (5)  2 + 4x - 3y
---R                      Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
---E 5
-
---S 6 of 15
-p * q
---R 
---R
---R                        2
---R   (6)  1 + 4x - 3y + 4x  - 6y x
---R                      Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
---E 6
-
---S 7 of 15
-(p+q)**2-p**2-q**2-2*p*q
---R 
---R
---R   (7)  - 6x y + 6y x
---R                      Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
---E 7
-
---S 8 of 15
-M := SquareMatrix(2,Fraction Integer)
---R 
---R
---R   (8)  SquareMatrix(2,Fraction Integer)
---R                                                                 Type: Domain
---E 8
-
---S 9 of 15
-poly1:= XPR(M,Word)
---R 
---R
---R   (9)
---R   XPolynomialRing(SquareMatrix(2,Fraction Integer),OrderedFreeMonoid Symbol)
---R                                                                 Type: Domain
---E 9
-
---S 10 of 15
-m1:M := matrix [ [i*j**2 for i in 1..2] for j in 1..2]
---R 
---R
---R         +1  2+
---R   (10)  |    |
---R         +4  8+
---R                                       Type: SquareMatrix(2,Fraction Integer)
---E 10
-
---S 11 of 15
-m2:M := m1 - 5/4
---R 
---R
---R         +  1    +
---R         |- -  2 |
---R         |  4    |
---R   (11)  |       |
---R         |     27|
---R         | 4   --|
---R         +      4+
---R                                       Type: SquareMatrix(2,Fraction Integer)
---E 11
-
---S 12 of 15
-m3: M := m2**2
---R 
---R
---R         +129     +
---R         |---  13 |
---R         | 16     |
---R   (12)  |        |
---R         |     857|
---R         |26   ---|
---R         +      16+
---R                                       Type: SquareMatrix(2,Fraction Integer)
---E 12
-
---S 13 of 15
-pm:poly1   := m1*x + m2*y + m3*z - 2/3 
---R 
---R
---R         +  2     +             +  1    +    +129     +
---R         |- -   0 |             |- -  2 |    |---  13 |
---R         |  3     |   +1  2+    |  4    |    | 16     |
---R   (13)  |        | + |    |x + |       |y + |        |z
---R         |       2|   +4  8+    |     27|    |     857|
---R         | 0   - -|             | 4   --|    |26   ---|
---R         +       3+             +      4+    +      16+
---RType: XPolynomialRing(SquareMatrix(2,Fraction Integer),OrderedFreeMonoid Symbol)
---E 13
-
---S 14 of 15
-qm:poly1 := pm - m1*x
---R 
---R
---R         +  2     +   +  1    +    +129     +
---R         |- -   0 |   |- -  2 |    |---  13 |
---R         |  3     |   |  4    |    | 16     |
---R   (14)  |        | + |       |y + |        |z
---R         |       2|   |     27|    |     857|
---R         | 0   - -|   | 4   --|    |26   ---|
---R         +       3+   +      4+    +      16+
---RType: XPolynomialRing(SquareMatrix(2,Fraction Integer),OrderedFreeMonoid Symbol)
---E 14
-
---S 15 of 15
-qm**3
---R 
---R
---R   (15)
---R     +   8      +   +  1  8+    +43   52 +    +  129       +
---R     |- --   0  |   |- -  -|    |--   -- |    |- ---  - 26 |
---R     |  27      |   |  3  3|    | 4    3 |    |   8        | 2
---R     |          | + |      |y + |        |z + |            |y
---R     |         8|   |16    |    |104  857|    |         857|
---R     | 0    - --|   |--   9|    |---  ---|    |- 52   - ---|
---R     +        27+   + 3    +    + 3    12+    +          8 +
---R   + 
---R     +  3199     831 +      +  3199     831 +      +  103169     6409 +
---R     |- ----   - --- |      |- ----   - --- |      |- ------   - ---- |
---R     |   32       4  |      |   32       4  |      |    128        4  | 2
---R     |               |y z + |               |z y + |                  |z
---R     |  831     26467|      |  831     26467|      |   6409     820977|
---R     |- ---   - -----|      |- ---   - -----|      | - ----   - ------|
---R     +   2        32 +      +   2        32 +      +     2        128 +
---R   + 
---R     +3199   831 +     +103169   6409 +      +103169   6409 +
---R     |----   --- |     |------   ---- |      |------   ---- |
---R     | 64     8  | 3   |  256      8  | 2    |  256      8  |
---R     |           |y  + |              |y z + |              |y z y
---R     |831   26467|     | 6409   820977|      | 6409   820977|
---R     |---   -----|     | ----   ------|      | ----   ------|
---R     + 4      64 +     +   4      256 +      +   4      256 +
---R   + 
---R     +3178239   795341 +       +103169   6409 +       +3178239   795341 +
---R     |-------   ------ |       |------   ---- |       |-------   ------ |
---R     |  1024      128  |   2   |  256      8  |   2   |  1024      128  |
---R     |                 |y z  + |              |z y  + |                 |z y z
---R     |795341   25447787|       | 6409   820977|       |795341   25447787|
---R     |------   --------|       | ----   ------|       |------   --------|
---R     +  64       1024  +       +   4      256 +       +  64       1024  +
---R   + 
---R     +3178239   795341 +      +98625409  12326223 +
---R     |-------   ------ |      |--------  -------- |
---R     |  1024      128  | 2    |  4096       256   | 3
---R     |                 |z y + |                   |z
---R     |795341   25447787|      |12326223  788893897|
---R     |------   --------|      |--------  ---------|
---R     +  64       1024  +      +   128       4096  +
---RType: XPolynomialRing(SquareMatrix(2,Fraction Integer),OrderedFreeMonoid Symbol)
---E 15
-)spool
-)lisp (bye)
-@
-<<XPolynomialRing.help>>=
-====================================================================
-XPolynomialRing examples
-====================================================================
-
-The XPolynomialRing domain constructor implements generalized
-polynomials with coefficients from an arbitrary Ring (not necessarily
-commutative) and whose exponents are words from an arbitrary
-OrderedMonoid (not necessarily commutative too).  Thus these
-polynomials are (finite) linear combinations of words.
-
-This constructor takes two arguments.  The first one is a Ring and the
-second is an OrderedMonoid.  The abbreviation for XPolynomialRing is XPR.
-
-Other constructors like XPolynomial, XRecursivePolynomial, 
-XDistributedPolynomial, LiePolynomial and XPBWPolynomial implement 
-multivariate polynomials in non-commutative variables.
-
-We illustrate now some of the facilities of the XPR domain constructor.
-
-Define the free ordered monoid generated by the symbols.
-
-  Word := OrderedFreeMonoid(Symbol)
-    OrderedFreeMonoid Symbol
-                                 Type: Domain
-
-Define the linear combinations of these words with integer coefficients.
-
-  poly:= XPR(Integer,Word)
-    XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
-                                 Type: Domain
-
-Then we define a first element from poly.
-
-  p:poly := 2 * x - 3 * y + 1
-    1 + 2x - 3y
-                     Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
-
-And a second one.
-
-  q:poly := 2 * x + 1
-    1 + 2x
-                     Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
-
-We compute their sum,
-
-  p + q
-    2 + 4x - 3y
-                     Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
-
-their product,
-
-  p * q
-                    2
-    1 + 4x - 3y + 4x  - 6y x
-                     Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
-
-and see that variables do not commute.
-
-  (p+q)**2-p**2-q**2-2*p*q
-    - 6x y + 6y x
-                     Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
-
-Now we define a ring of square matrices,
-
-  M := SquareMatrix(2,Fraction Integer)
-    SquareMatrix(2,Fraction Integer)
-                                 Type: Domain
-
-and the linear combinations of words with these  matrices as coefficients.
-
-  poly1:= XPR(M,Word)
-   XPolynomialRing(SquareMatrix(2,Fraction Integer),OrderedFreeMonoid Symbol)
-                                 Type: Domain
-
-Define a first matrix,
-
-  m1:M := matrix [ [i*j**2 for i in 1..2] for j in 1..2]
-         +1  2+
-         |    |
-         +4  8+
-                                 Type: SquareMatrix(2,Fraction Integer)
-
-a second one,
-
-  m2:M := m1 - 5/4
-         +  1    +
-         |- -  2 |
-         |  4    |
-         |       |
-         |     27|
-         | 4   --|
-         +      4+
-                                Type: SquareMatrix(2,Fraction Integer)
-
-and a third one.
-
-  m3: M := m2**2
-         +129     +
-         |---  13 |
-         | 16     |
-         |        |
-         |     857|
-         |26   ---|
-         +      16+
-                               Type: SquareMatrix(2,Fraction Integer)
-
-Define a polynomial,
-
-  pm:poly1   := m1*x + m2*y + m3*z - 2/3 
-         +  2     +             +  1    +    +129     +
-         |- -   0 |             |- -  2 |    |---  13 |
-         |  3     |   +1  2+    |  4    |    | 16     |
-         |        | + |    |x + |       |y + |        |z
-         |       2|   +4  8+    |     27|    |     857|
-         | 0   - -|             | 4   --|    |26   ---|
-         +       3+             +      4+    +      16+
-     Type: XPolynomialRing(SquareMatrix(2,Fraction Integer),
-                           OrderedFreeMonoid Symbol)
-
-a second one,
-
-  qm:poly1 := pm - m1*x
-         +  2     +   +  1    +    +129     +
-         |- -   0 |   |- -  2 |    |---  13 |
-         |  3     |   |  4    |    | 16     |
-         |        | + |       |y + |        |z
-         |       2|   |     27|    |     857|
-         | 0   - -|   | 4   --|    |26   ---|
-         +       3+   +      4+    +      16+
-      Type: XPolynomialRing(SquareMatrix(2,Fraction Integer),
-                            OrderedFreeMonoid Symbol)
-
-and the following power.
-
-  qm**3
-     +   8      +   +  1  8+    +43   52 +    +  129       +
-     |- --   0  |   |- -  -|    |--   -- |    |- ---  - 26 |
-     |  27      |   |  3  3|    | 4    3 |    |   8        | 2
-     |          | + |      |y + |        |z + |            |y
-     |         8|   |16    |    |104  857|    |         857|
-     | 0    - --|   |--   9|    |---  ---|    |- 52   - ---|
-     +        27+   + 3    +    + 3    12+    +          8 +
-   + 
-     +  3199     831 +      +  3199     831 +      +  103169     6409 +
-     |- ----   - --- |      |- ----   - --- |      |- ------   - ---- |
-     |   32       4  |      |   32       4  |      |    128        4  | 2
-     |               |y z + |               |z y + |                  |z
-     |  831     26467|      |  831     26467|      |   6409     820977|
-     |- ---   - -----|      |- ---   - -----|      | - ----   - ------|
-     +   2        32 +      +   2        32 +      +     2        128 +
-   + 
-     +3199   831 +     +103169   6409 +      +103169   6409 +
-     |----   --- |     |------   ---- |      |------   ---- |
-     | 64     8  | 3   |  256      8  | 2    |  256      8  |
-     |           |y  + |              |y z + |              |y z y
-     |831   26467|     | 6409   820977|      | 6409   820977|
-     |---   -----|     | ----   ------|      | ----   ------|
-     + 4      64 +     +   4      256 +      +   4      256 +
-   + 
-     +3178239   795341 +       +103169   6409 +       +3178239   795341 +
-     |-------   ------ |       |------   ---- |       |-------   ------ |
-     |  1024      128  |   2   |  256      8  |   2   |  1024      128  |
-     |                 |y z  + |              |z y  + |                 |z y z
-     |795341   25447787|       | 6409   820977|       |795341   25447787|
-     |------   --------|       | ----   ------|       |------   --------|
-     +  64       1024  +       +   4      256 +       +  64       1024  +
-   + 
-     +3178239   795341 +      +98625409  12326223 +
-     |-------   ------ |      |--------  -------- |
-     |  1024      128  | 2    |  4096       256   | 3
-     |                 |z y + |                   |z
-     |795341   25447787|      |12326223  788893897|
-     |------   --------|      |--------  ---------|
-     +  64       1024  +      +   128       4096  +
-        Type: XPolynomialRing(SquareMatrix(2,Fraction Integer),
-                              OrderedFreeMonoid Symbol)
-
-See Also:
-o )help XPBWPolynomial
-o )help LiePolynomial
-o )help XDistributedPolynomial
-o )help XRecursivePolynomial
-o )help XPolynomial
-o )show XPolynomialRing
-o $AXIOM/doc/src/algebra/xpoly.spad.dvi
-
-@
-<<domain XPR XPolynomialRing>>=
-)abbrev domain XPR XPolynomialRing
-++ Author: Michel Petitot petitot@lifl.fr
-++ Date Created: 91
-++ Date Last Updated: 7 Juillet 92
-++ Fix History: compilation v 2.1 le 13 dec 98
-++ Basic Functions:
-++ Related Constructors:
-++ Also See:
-++ AMS Classifications:
-++ Keywords:
-++ References:
-++ Description:
-++ This domain represents generalized polynomials with coefficients
-++ (from a not necessarily commutative ring), and words
-++ belonging to an arbitrary \spadtype{OrderedMonoid}.
-++ This type is used, for instance, by the \spadtype{XDistributedPolynomial} 
-++ domain constructor where the Monoid is free.
-++ Author: Michel Petitot (petitot@lifl.fr)
-
-XPolynomialRing(R:Ring,E:OrderedMonoid): T == C where
-  TERM   ==> Record(k: E, c: R)
-  EX     ==> OutputForm
-  NNI    ==> NonNegativeInteger
-
-  T == Join(Ring, XAlgebra(R), FreeModuleCat(R,E)) with
-    --operations
-      "*": (%,R) -> %
-        ++ \spad{p*r} returns the product of \spad{p} by \spad{r}.
-      "#": % -> NonNegativeInteger
-        ++ \spad{# p} returns the number of terms in \spad{p}.
-      coerce: E -> %
-        ++ \spad{coerce(e)} returns \spad{1*e}
-      maxdeg: % -> E
-        ++ \spad{maxdeg(p)} returns the greatest word occurring in the polynomial \spad{p}
-        ++ with a non-zero coefficient. An error is produced if  \spad{p} is zero.
-      mindeg: % -> E
-        ++ \spad{mindeg(p)} returns the smallest word occurring in the polynomial \spad{p}
-        ++ with a non-zero coefficient. An error is produced if  \spad{p} is zero.
-      reductum : % -> %   
-        ++ \spad{reductum(p)} returns \spad{p} minus its leading term.
-        ++ An error is produced if  \spad{p} is zero.
-      coef  : (%,E) -> R
-        ++ \spad{coef(p,e)} extracts the coefficient of the monomial \spad{e}.
-        ++ Returns zero if \spad{e} is not present. 
-      constant?:% -> Boolean
-        ++ \spad{constant?(p)} tests whether the polynomial \spad{p} belongs to the
-        ++ coefficient ring.
-      constant: % -> R
-        ++ \spad{constant(p)} return the constant term of \spad{p}.
-      quasiRegular? : % -> Boolean
-        ++ \spad{quasiRegular?(x)} return true if \spad{constant(p)} is zero.
-      quasiRegular : % -> % 
-        ++ \spad{quasiRegular(x)} return \spad{x} minus its constant term.
-      map   : (R -> R, %) -> %
-        ++ \spad{map(fn,x)} returns \spad{Sum(fn(r_i) w_i)} if \spad{x} writes \spad{Sum(r_i w_i)}.
-      if R has Field then "/" : (%,R) -> %
-        ++ \spad{p/r} returns \spad{p*(1/r)}.
-
-    --assertions
-      if R has noZeroDivisors then noZeroDivisors
-      if R has unitsKnown then unitsKnown
-      if R has canonicalUnitNormal then canonicalUnitNormal
-          ++ canonicalUnitNormal guarantees that the function
-          ++ unitCanonical returns the same representative for all
-          ++ associates of any particular element.
-
-
-  C == FreeModule1(R,E) add
-    --representations
-       Rep:=  List TERM
-    --uses
-       repeatMultExpt: (%,NonNegativeInteger) -> %
-    --define
-       1  == [[1$E,1$R]]
- 
-       characteristic  == characteristic$R
-       #x == #$Rep x
-       maxdeg p == if null p then  error " polynome nul !!"
-                             else p.first.k
-       mindeg p == if null p then  error " polynome nul !!" 
-                             else (last p).k
-       
-       coef(p,e)  ==
-          for tm in p repeat
-            tm.k=e => return tm.c
-            tm.k < e => return 0$R
-          0$R
-
-       constant? p == (p = 0) or (maxdeg(p) = 1$E)
-       constant  p == coef(p,1$E)
-
-       quasiRegular? p == (p=0) or (last p).k ^= 1$E
-       quasiRegular  p == 
-          quasiRegular?(p) => p
-          [t for t in p | not(t.k = 1$E)]
-
-       recip(p) ==
-           p=0 => "failed"
-           p.first.k > 1$E => "failed"
-           (u:=recip(p.first.c)) case "failed" => "failed"
-           (u::R)::%
- 
-       coerce(r:R) == if r=0$R then 0$% else [[1$E,r]]
-       coerce(n:Integer) == (n::R)::%
- 
-       if R has noZeroDivisors then
-         p1:% * p2:%  ==
-            null p1 => 0
-            null p2 => 0
-            p1.first.k = 1$E => p1.first.c * p2
-            p2 = 1 => p1
---            +/[[[t1.k*t2.k,t1.c*t2.c]$TERM for t2 in p2]
---                   for t1 in reverse(p1)]
-            +/[[[t1.k*t2.k,t1.c*t2.c]$TERM for t2 in p2]
-                   for t1 in p1]
-        else
-         p1:% * p2:%  ==
-            null p1 => 0
-            null p2 => 0
-            p1.first.k = 1$E => p1.first.c * p2
-            p2 = 1 => p1
---            +/[[[t1.k*t2.k,r]$TERM for t2 in p2 | not (r:=t1.c*t2.c) =$R 0]
---                 for t1 in reverse(p1)]
-            +/[[[t1.k*t2.k,r]$TERM for t2 in p2 | not (r:=t1.c*t2.c) =$R 0]
-                   for t1 in p1]
-       p:% ** nn:NNI  == repeatMultExpt(p,nn)
-       repeatMultExpt(x,nn) ==
-               nn = 0 => 1
-               y:% := x
-               for i in 2..nn repeat y:= x * y
-               y
-              
-       outTerm(r:R, m:E):EX ==
-            r=1 => m::EX
-            m=1 => r::EX
-            r::EX * m::EX
-
---       coerce(x:%) : EX ==
---         null x => (0$R) :: EX
---         le : List EX := nil
---         for rec in x repeat
---           rec.c = 1$R => le := cons(rec.k :: EX, le)
---           rec.k = 1$E => le := cons(rec.c :: EX, le)
---           le := cons(mkBinary("*"::EX,rec.c :: EX,
---             rec.k :: EX), le)
---         1 = #le => first le
---         mkNary("+" :: EX,le)
-
-       coerce(a:%):EX ==
-            empty? a => (0$R)::EX
-            reduce(_+, reverse_! [outTerm(t.c, t.k) for t in a])$List(EX)
-
- 
-       if R has Field then
-          x/r == inv(r)*x
-
-@
-\section{domain XDPOLY XDistributedPolynomial}
-Polynomial arithmetic with non-commutative variables has been improved
-by a contribution of Michel Petitot (University of Lille I, France).
-The domain constructor
-{\bf XDistributedPolynomial} provide a distributed
-representation for these polynomials. It is the non-commutative
-equivalent for the 
-{\bf DistributedMultivariatePolynomial} constructor.
-<<domain XDPOLY XDistributedPolynomial>>=
-)abbrev domain XDPOLY XDistributedPolynomial
-++ Author: Michel Petitot petitot@lifl.fr
-++ Date Created: 91
-++ Date Last Updated: 7 Juillet 92
-++ Fix History: compilation v 2.1 le 13 dec 98
-++ Basic Functions:
-++ Related Constructors:
-++ Also See:
-++ AMS Classifications:
-++ Keywords:
-++ References:
-++ Description:
-++   This type supports distributed multivariate polynomials
-++ whose variables do not commute.
-++ The coefficient ring may be non-commutative too.
-++ However, coefficients and variables commute.
-++ Author: Michel Petitot (petitot@lifl.fr)
-
-XDistributedPolynomial(vl:OrderedSet,R:Ring): XDPcat == XDPdef where
-
-  WORD ==> OrderedFreeMonoid(vl)
-  I    ==> Integer
-  NNI  ==> NonNegativeInteger
-  TERM ==> Record(k:WORD, c:R)
-
-  XDPcat == Join(FreeModuleCat(R, WORD), XPolynomialsCat(vl,R))
-
-  XDPdef == XPolynomialRing(R,WORD) add
-
-       import( WORD, TERM)
-
-    -- Representation
-       Rep  :=  List TERM
-
-    -- local functions
-       shw: (WORD , WORD) -> %    -- shuffle de 2 mots
-
-    -- definitions
-
-       mindegTerm p == last(p)$Rep
-
-       if R has CommutativeRing then
-         sh(p:%, n:NNI):% ==
-            n=0 => 1
-            n=1 => p
-            n1: NNI := (n-$I 1)::NNI
-            sh(p, sh(p,n1))
-
-      
-         sh(p1:%, p2:%) ==
-           p:% := 0 
-           for t1 in p1 repeat
-             for t2 in p2 repeat
-                p := p + (t1.c * t2.c) * shw(t1.k,t2.k) 
-           p
-
-       coerce(v: vl):% == coerce(v::WORD)
-       v:vl * p:% ==
-         [[v * t.k , t.c]$TERM for t in p]
-
-       mirror p == 
-         null p => p
-         monom(mirror$WORD leadingMonomial p, leadingCoefficient p) + _
-               mirror reductum p
-
-       degree(p) == length(maxdeg(p))$WORD
-
-       trunc(p, n) ==
-         p = 0 => p
-         degree(p) > n => trunc( reductum p , n)
-         p
-
-       varList p ==
-         constant? p => []
-         le : List vl := "setUnion"/[varList(t.k) for t in p]
-         sort_!(le)
-
-       rquo(p:% , w: WORD) == 
-         [[r::WORD,t.c]$TERM for t in p | not (r:= rquo(t.k,w)) case "failed" ]
-       lquo(p:% , w: WORD) ==
-         [[r::WORD,t.c]$TERM for t in p | not (r:= lquo(t.k,w)) case "failed" ]
-       rquo(p:% , v: vl) ==
-         [[r::WORD,t.c]$TERM for t in p | not (r:= rquo(t.k,v)) case "failed" ]
-       lquo(p:% , v: vl) ==
-         [[r::WORD,t.c]$TERM for t in p | not (r:= lquo(t.k,v)) case "failed" ]
-
-       shw(w1,w2) ==
-         w1 = 1$WORD => w2::%
-         w2 = 1$WORD => w1::%
-         x: vl := first w1 ; y: vl := first w2
-         x * shw(rest w1,w2) + y * shw(w1,rest w2)
- 
-       lquo(p:%,q:%):% ==
-         +/  [r * t.c for t in q | (r := lquo(p,t.k)) ^= 0] 
-
-       rquo(p:%,q:%):% ==
-         +/  [r * t.c for t in q | (r := rquo(p,t.k)) ^= 0] 
-
-       coef(p:%,q:%):R ==
-         p = 0 => 0$R
-         q = 0 => 0$R 
-         p.first.k > q.first.k => coef(p.rest,q)
-         p.first.k < q.first.k => coef(p,q.rest) 
-         return p.first.c * q.first.c + coef(p.rest,q.rest)
-
-@
-\section{domain XRPOLY XRecursivePolynomial}
-Polynomial arithmetic with non-commutative variables has been improved
-by a contribution of Michel Petitot (University of Lille I, France).
-The domain constructors {\bf XRecursivePolynomial} 
-provides a recursive for these polynomials. It is the non-commutative
-equivalents for the {\bf SparseMultivariatePolynomial} constructor.
-<<domain XRPOLY XRecursivePolynomial>>=
-)abbrev domain XRPOLY XRecursivePolynomial
-++ Author: Michel Petitot petitot@lifl.fr
-++ Date Created: 91
-++ Date Last Updated: 7 Juillet 92
-++ Fix History: compilation v 2.1 le 13 dec 98
-++   extend renomme en expand
-++ Basic Functions:
-++ Related Constructors:
-++ Also See:
-++ AMS Classifications:
-++ Keywords:
-++ References:
-++ Description:
-++   This type supports multivariate polynomials
-++ whose variables do not commute.
-++ The representation is recursive.
-++ The coefficient ring may be non-commutative.
-++ Coefficients and variables commute.
-++ Author: Michel Petitot (petitot@lifl.fr)
-
-XRecursivePolynomial(VarSet:OrderedSet,R:Ring):  Xcat == Xdef where
-  I      ==> Integer
-  NNI    ==> NonNegativeInteger
-  XDPOLY ==> XDistributedPolynomial(VarSet, R)
-  EX     ==> OutputForm
-  WORD   ==> OrderedFreeMonoid(VarSet)
-  TERM   ==> Record(k:VarSet , c:%)
-  LTERMS ==> List(TERM) 
-  REGPOLY==> FreeModule1(%, VarSet) 
-  VPOLY  ==> Record(c0:R, reg:REGPOLY)
-
-  Xcat == XPolynomialsCat(VarSet,R) with
-       expand: % -> XDPOLY
-         ++ \spad{expand(p)} returns \spad{p} in distributed form.
-       unexpand : XDPOLY -> %
-         ++ \spad{unexpand(p)} returns \spad{p} in recursive form.
-       RemainderList: % -> LTERMS
-         ++ \spad{RemainderList(p)} returns the regular part of \spad{p}
-         ++ as a list of terms.
-
-  Xdef == add
-       import(VPOLY)
-
-    -- representation
-       Rep     := Union(R,VPOLY)
-
-    -- local functions
-       construct: LTERMS -> REGPOLY
-       simplifie: VPOLY -> %
-       lquo1: (LTERMS,LTERMS) -> %        ++ a ajouter
-       coef1: (LTERMS,LTERMS) -> R        ++ a ajouter
-       outForm: REGPOLY -> EX
-
-    --define
-       construct(lt) == lt pretend REGPOLY
-       p1:%  =  p2:%  ==
-         p1 case R =>
-             p2 case R => p1 =$R p2
-             false
-         p2 case R => false
-         p1.c0 =$R p2.c0 and p1.reg =$REGPOLY p2.reg
-
-       monom(w, r) == 
-         r =0 => 0
-         r * w::%
-
---       if R has Field then                  -- Bug non resolu !!!!!!!!
---         p:% / r: R == inv(r) * p
- 
-       rquo(p1:%, p2:%):% ==
-         p2 case R => p1 * p2::R
-         p1 case R => p1  * p2.c0
-         x:REGPOLY := construct [[t.k, a]$TERM for t in ListOfTerms(p1.reg) _
-                         | (a:= rquo(t.c,p2)) ^= 0$% ]$LTERMS
-         simplifie [coef(p1,p2) , x]$VPOLY
-
-       trunc(p,n) ==
-         n = 0 or (p case R) => (constant p)::%
-         n1: NNI := (n-1)::NNI
-         lt: LTERMS := [[t.k, r]$TERM for t in ListOfTerms p.reg _
-                        | (r := trunc(t.c, n1)) ^= 0]$LTERMS
-         x: REGPOLY := construct lt
-         simplifie [constant p, x]$VPOLY
-
-       unexpand p ==
-         constant? p => (constant p)::%
-         vl: List VarSet := sort(#1 > #2, varList p)
-         x : REGPOLY := _
-           construct [[v, unexpand r]$TERM for v in vl| (r:=lquo(p,v)) ^= 0]
-         [constant p, x]$VPOLY
-
-       if R has CommutativeRing then
-         sh(p:%, n:NNI):% ==
-            n = 0 => 1
-            p case R => (p::R)** n
-            n1: NNI := (n-1)::NNI
-            p1: % := n * sh(p, n1)  
-            lt: LTERMS := [[t.k, sh(t.c, p1)]$TERM for t in ListOfTerms p.reg]
-            [p.c0 ** n, construct lt]$VPOLY
- 
-         sh(p1:%, p2:%) ==
-            p1 case R => p1::R * p2
-            p2 case R => p1 * p2::R 
-            lt1:LTERMS := ListOfTerms p1.reg ; lt2:LTERMS := ListOfTerms p2.reg
-            x: REGPOLY := construct [[t.k,sh(t.c,p2)]$TERM for t in lt1]
-            y: REGPOLY := construct [[t.k,sh(p1,t.c)]$TERM for t in lt2]
-            [p1.c0*p2.c0,x + y]$VPOLY
-
-       RemainderList p == 
-           p case R => []
-           ListOfTerms( p.reg)$REGPOLY
- 
-       lquo(p1:%,p2:%):% ==
-         p2 case R => p1 * p2
-         p1 case R => p1  *$R p2.c0
-         p1 * p2.c0 +$% lquo1(ListOfTerms p1.reg, ListOfTerms p2.reg)
-
-       lquo1(x:LTERMS,y:LTERMS):% ==
-         null x => 0$%  
-         null y => 0$%
-         x.first.k < y.first.k => lquo1(x,y.rest)
-         x.first.k = y.first.k => 
-             lquo(x.first.c,y.first.c) + lquo1(x.rest,y.rest)
-         return lquo1(x.rest,y)
-
-       coef(p1:%, p2:%):R ==
-         p1 case R => p1::R * constant p2
-         p2 case R => p1.c0 * p2::R
-         p1.c0 * p2.c0 +$R coef1(ListOfTerms p1.reg, ListOfTerms p2.reg)
-
-       coef1(x:LTERMS,y:LTERMS):R ==
-         null x => 0$R
-         null y => 0$R
-         x.first.k < y.first.k => coef1(x,y.rest)
-         x.first.k = y.first.k =>
-             coef(x.first.c,y.first.c) + coef1(x.rest,y.rest)
-         return coef1(x.rest,y)
-
-       --------------------------------------------------------------
-       outForm(p:REGPOLY): EX ==
-          le : List EX :=  [t.k::EX * t.c::EX for t in ListOfTerms p]
-          reduce(_+, reverse_! le)$List(EX)
-
-       coerce(p:$): EX ==
-          p case R => (p::R)::EX
-          p.c0 = 0 => outForm p.reg
-          p.c0::EX + outForm p.reg 
-
-       0 == 0$R::%
-       1 == 1$R::%
-       constant? p ==  p case R
-       constant p == 
-          p case R => p
-          p.c0
-
-       simplifie p ==
-         p.reg = 0$REGPOLY => (p.c0)::%
-         p
-
-       coerce (v:VarSet):% ==
-         [0$R,coerce(v)$REGPOLY]$VPOLY
-
-       coerce (r:R):% == r::%
-       coerce (n:Integer) == n::R::%
-       coerce (w:WORD) == 
-         w = 1 => 1$R
-         (first w) * coerce(rest w)
- 
-       expand p ==
-         p case R => p::R::XDPOLY
-         lt:LTERMS := ListOfTerms(p.reg)
-         ep:XDPOLY := (p.c0)::XDPOLY
-         for t in lt repeat
-           ep:= ep + t.k * expand(t.c)
-         ep
-                
-       - p:% ==
-         p case R => -$R p
-         [- p.c0, - p.reg]$VPOLY
- 
-       p1 + p2 ==
-         p1 case R and p2 case R => p1 +$R p2
-         p1 case R => [p1 + p2.c0 , p2.reg]$VPOLY
-         p2 case R => [p2 + p1.c0 , p1.reg]$VPOLY 
-         simplifie [p1.c0 + p2.c0 , p1.reg +$REGPOLY p2.reg]$VPOLY
- 
-       p1 - p2 ==
-         p1 case R and p2 case R => p1 -$R p2
-         p1 case R => [p1 - p2.c0 , -p2.reg]$VPOLY
-         p2 case R => [p1.c0 - p2 , p1.reg]$VPOLY
-         simplifie [p1.c0 - p2.c0 , p1.reg -$REGPOLY p2.reg]$VPOLY
- 
-       n:Integer * p:% ==
-         n=0 => 0$%
-         p case R => n *$R p
-         -- [ n*p.c0,n*p.reg]$VPOLY
-         simplifie [ n*p.c0,n*p.reg]$VPOLY
-
-       r:R * p:% ==
-         r=0 => 0$%
-         p case R => r *$R p
-         -- [ r*p.c0,r*p.reg]$VPOLY
-         simplifie [ r*p.c0,r*p.reg]$VPOLY
-
-       p:% * r:R ==
-         r=0 => 0$%
-         p case R => p *$R r
-         -- [ p.c0 * r,p.reg * r]$VPOLY
-         simplifie [ r*p.c0,r*p.reg]$VPOLY
-
-       v:VarSet * p:% == 
-          p = 0 => 0$%
-          [0$R, v *$REGPOLY p]$VPOLY
- 
-       p1:% * p2:% ==
-         p1 case R => p1::R * p2
-         p2 case R => p1 * p2::R
-         x:REGPOLY := p1.reg *$REGPOLY p2
-         y:REGPOLY := (p1.c0)::% *$REGPOLY p2.reg  -- maladroit:(p1.c0)::% !!
-         -- [ p1.c0 * p2.c0 , x+y ]$VPOLY
-         simplifie [ p1.c0 * p2.c0 , x+y ]$VPOLY
-
-       lquo(p:%, v:VarSet):% ==
-         p case R => 0
-         coefficient(p.reg,v)$REGPOLY
-
-       lquo(p:%, w:WORD):% ==
-         w = 1$WORD => p
-         lquo(lquo(p,first w),rest w)
-
-       rquo(p:%, v:VarSet):% ==
-         p case R => 0
-         x:REGPOLY := construct [[t.k, a]$TERM for t in ListOfTerms(p.reg)
-                         | (a:= rquo(t.c,v)) ^= 0 ]
-         simplifie [constant(coefficient(p.reg,v)) , x]$VPOLY 
-        
-       rquo(p:%, w:WORD):% ==
-         w = 1$WORD => p
-         rquo(rquo(p,rest w),first w)
- 
-       coef(p:%, w:WORD):R ==
-         constant lquo(p,w)
-
-       quasiRegular? p == 
-         p case R => p = 0$R
-         p.c0 = 0$R
-
-       quasiRegular p ==
-         p case R => 0$%
-         [0$R,p.reg]$VPOLY
-
-       characteristic == characteristic()$R
-       recip p ==
-         p case R => recip(p::R)
-         "failed"
-
-       mindeg p ==
-         p case R =>
-           p = 0 => error "XRPOLY.mindeg: polynome nul !!"
-           1$WORD
-         p.c0 ^= 0 => 1$WORD
-         "min"/[(t.k) *$WORD mindeg(t.c) for t in ListOfTerms p.reg] 
-
-       maxdeg p ==
-         p case R => 
-            p = 0 => error "XRPOLY.maxdeg: polynome nul !!"
-            1$WORD
-         "max"/[(t.k) *$WORD maxdeg(t.c) for t in ListOfTerms p.reg] 
-
-       degree p == 
-          p = 0 => error "XRPOLY.degree: polynome nul !!"
-          length(maxdeg p)
-
-       map(fn,p) ==
-         p case R => fn(p::R)
-         x:REGPOLY := construct [[t.k,a]$TERM for t in ListOfTerms p.reg
-                         |(a := map(fn,t.c)) ^= 0$R]
-         simplifie [fn(p.c0),x]$VPOLY
-
-       varList p ==
-         p case R => []
-         lv: List VarSet := "setUnion"/[varList(t.c) for t in ListOfTerms p.reg]
-         lv:= setUnion(lv,[t.k for t in ListOfTerms p.reg])
-         sort_!(lv)
-
-@
-\section{domain XPOLY XPolynomial}
-<<XPolynomial.input>>=
--- xpoly.spad.pamphlet XPolynomial.input
-)spool XPolynomial.output
-)set message test on
-)set message auto off
-)clear all
---S 1 of 14
-poly := XPolynomial(Integer)
---R 
---R
---R   (1)  XPolynomial Integer
---R                                                                 Type: Domain
---E 1
-
---S 2 of 14
-pr: poly := 2*x + 3*y-5 
---R 
---R
---R   (2)  - 5 + x 2 + y 3
---R                                                    Type: XPolynomial Integer
---E 2
-
---S 3 of 14
-pr2: poly := pr*pr
---R 
---R
---R   (3)  25 + x(- 20 + x 4 + y 6) + y(- 30 + x 6 + y 9)
---R                                                    Type: XPolynomial Integer
---E 3
-
---S 4 of 14
-pd  := expand pr
---R 
---R
---R   (4)  - 5 + 2x + 3y
---R                                 Type: XDistributedPolynomial(Symbol,Integer)
---E 4
-
---S 5 of 14
-pd2 := pd*pd
---R 
---R
---R                           2                   2
---R   (5)  25 - 20x - 30y + 4x  + 6x y + 6y x + 9y
---R                                 Type: XDistributedPolynomial(Symbol,Integer)
---E 5
-
---S 6 of 14
-expand(pr2) - pd2
---R 
---R
---R   (6)  0
---R                                 Type: XDistributedPolynomial(Symbol,Integer)
---E 6
-
---S 7 of 14
-qr :=  pr**3
---R 
---R
---R   (7)
---R     - 125 + x(150 + x(- 60 + x 8 + y 12) + y(- 90 + x 12 + y 18))
---R   + 
---R     y(225 + x(- 90 + x 12 + y 18) + y(- 135 + x 18 + y 27))
---R                                                    Type: XPolynomial Integer
---E 7
-
---S 8 of 14
-qd :=  pd**3
---R 
---R
---R   (8)
---R                              2                       2     3      2
---R     - 125 + 150x + 225y - 60x  - 90x y - 90y x - 135y  + 8x  + 12x y + 12x y x
---R   + 
---R          2        2                2       3
---R     18x y  + 12y x  + 18y x y + 18y x + 27y
---R                                 Type: XDistributedPolynomial(Symbol,Integer)
---E 8
-
---S 9 of 14
-trunc(qd,2)
---R 
---R
---R                                 2                       2
---R   (9)  - 125 + 150x + 225y - 60x  - 90x y - 90y x - 135y
---R                                 Type: XDistributedPolynomial(Symbol,Integer)
---E 9
-
---S 10 of 14
-trunc(qr,2)
---R 
---R
---R   (10)  - 125 + x(150 + x(- 60) + y(- 90)) + y(225 + x(- 90) + y(- 135))
---R                                                    Type: XPolynomial Integer
---E 10
-
---S 11 of 14
-Word := OrderedFreeMonoid Symbol
---R 
---R
---R   (11)  OrderedFreeMonoid Symbol
---R                                                                 Type: Domain
---E 11
-
---S 12 of 14
-w: Word := x*y**2
---R 
---R
---R            2
---R   (12)  x y
---R                                               Type: OrderedFreeMonoid Symbol
---E 12
-
---S 13 of 14
-rquo(qr,w)
---R 
---R
---R   (13)  18
---R                                                    Type: XPolynomial Integer
---E 13
-
---S 14 of 14
-sh(pr,w::poly)
---R 
---R
---R   (14)  x(x y y 4 + y(x y 2 + y(- 5 + x 2 + y 9))) + y x y y 3
---R                                                    Type: XPolynomial Integer
---E 14
-)spool
-)lisp (bye)
-@
-<<XPolynomial.help>>=
-====================================================================
-XPolynomial examples
-====================================================================
-
-The XPolynomial domain constructor implements multivariate polynomials
-whose set of variables is Symbol.  These variables do not commute.
-The only parameter of this construtor is the coefficient ring which
-may be non-commutative.  However, coefficients and variables commute.
-The representation of the polynomials is recursive.  The abbreviation
-for XPolynomial is XPOLY.
-
-Other constructors like XPolynomialRing, XRecursivePolynomial as well 
-as XDistributedPolynomial, LiePolynomial and XPBWPolynomial implement 
-multivariate polynomials in non-commutative variables.
-
-We illustrate now some of the facilities of the XPOLY domain constructor.
-
-Define a polynomial ring over the integers.
-
-  poly := XPolynomial(Integer)
-    XPolynomial Integer
-                                 Type: Domain
-
-Define a first polynomial,
-
-  pr: poly := 2*x + 3*y-5 
-    - 5 + x 2 + y 3
-                                 Type: XPolynomial Integer
-
-and a second one.
-
-  pr2: poly := pr*pr
-    25 + x(- 20 + x 4 + y 6) + y(- 30 + x 6 + y 9)
-                                 Type: XPolynomial Integer
-
-Rewrite pr in a distributive way,
-
-  pd  := expand pr
-    - 5 + 2x + 3y
-                                 Type: XDistributedPolynomial(Symbol,Integer)
-
-compute its square,
-
-  pd2 := pd*pd
-                       2                   2
-    25 - 20x - 30y + 4x  + 6x y + 6y x + 9y
-                                 Type: XDistributedPolynomial(Symbol,Integer)
-
-and checks that:
-
-  expand(pr2) - pd2
-    0
-                                 Type: XDistributedPolynomial(Symbol,Integer)
-
-We define:
-
-  qr :=  pr**3
-     - 125 + x(150 + x(- 60 + x 8 + y 12) + y(- 90 + x 12 + y 18))
-   + 
-     y(225 + x(- 90 + x 12 + y 18) + y(- 135 + x 18 + y 27))
-                                 Type: XPolynomial Integer
-
-and:
-
-  qd :=  pd**3
-                              2                       2     3      2
-     - 125 + 150x + 225y - 60x  - 90x y - 90y x - 135y  + 8x  + 12x y + 12x y x
-   + 
-          2        2                2       3
-     18x y  + 12y x  + 18y x y + 18y x + 27y
-                                 Type: XDistributedPolynomial(Symbol,Integer)
-
-We truncate qd at degree 3.
-
-  trunc(qd,2)
-                             2                       2
-    - 125 + 150x + 225y - 60x  - 90x y - 90y x - 135y
-                                 Type: XDistributedPolynomial(Symbol,Integer)
-
-The same for qr:
-
-  trunc(qr,2)
-    - 125 + x(150 + x(- 60) + y(- 90)) + y(225 + x(- 90) + y(- 135))
-                                 Type: XPolynomial Integer
-
-We define:
-
-  Word := OrderedFreeMonoid Symbol
-    OrderedFreeMonoid Symbol
-                                 Type: Domain
-
-and:
-
-  w: Word := x*y**2
-       2
-    x y
-                                 Type: OrderedFreeMonoid Symbol
-
-We can compute the right-quotient of qr by r:
-
-  rquo(qr,w)
-    18
-                                 Type: XPolynomial Integer
-
-and the shuffle-product of pr by r:
-
-  sh(pr,w::poly)
-    x(x y y 4 + y(x y 2 + y(- 5 + x 2 + y 9))) + y x y y 3
-                                 Type: XPolynomial Integer
-
-See Also:
-o )help XPBWPolynomial
-o )help LiePolynomial
-o )help XDistributedPolynomial
-o )help XRecursivePolynomial
-o )help XPolynomialRing
-o )show XPolynomial
-o $AXIOM/doc/src/algebra/xpoly.spad.dvi
-
-@
-<<domain XPOLY XPolynomial>>=
-)abbrev domain XPOLY XPolynomial
-++ Author: Michel Petitot petitot@lifl.fr
-++ Date Created: 91
-++ Date Last Updated: 7 Juillet 92
-++ Fix History: compilation v 2.1 le 13 dec 98
-++   extend renomme en expand
-++ Basic Functions:
-++ Related Constructors:
-++ Also See:
-++ AMS Classifications:
-++ Keywords:
-++ References:
-++ Description:
-++   This type supports multivariate polynomials
-++ whose set of variables is \spadtype{Symbol}.
-++ The representation is recursive.
-++ The coefficient ring may be non-commutative and the variables 
-++ do not commute.
-++ However, coefficients and variables commute.
-++ Author: Michel Petitot (petitot@lifl.fr)
-
-XPolynomial(R:Ring) == XRecursivePolynomial(Symbol, R)
-
-@
-\section{License}
-<<license>>=
---Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd.
---All rights reserved.
---
---Redistribution and use in source and binary forms, with or without
---modification, are permitted provided that the following conditions are
---met:
---
---    - Redistributions of source code must retain the above copyright
---      notice, this list of conditions and the following disclaimer.
---
---    - Redistributions in binary form must reproduce the above copyright
---      notice, this list of conditions and the following disclaimer in
---      the documentation and/or other materials provided with the
---      distribution.
---
---    - Neither the name of The Numerical ALgorithms Group Ltd. nor the
---      names of its contributors may be used to endorse or promote products
---      derived from this software without specific prior written permission.
---
---THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
---IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
---TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
---PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
---OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
---EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
---PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
---PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
---LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
---NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
---SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-@
-<<*>>=
-<<license>>
-
-<<domain OFMONOID OrderedFreeMonoid>>
-<<domain FM1 FreeModule1>>
-<<domain XPR XPolynomialRing>>
-<<domain XDPOLY XDistributedPolynomial>>
-<<domain XRPOLY XRecursivePolynomial>>
-<<domain XPOLY XPolynomial>>
-@
-\eject
-\begin{thebibliography}{99}
-\bibitem{1} nothing
-\end{thebibliography}
-\end{document}
diff --git a/src/algebra/zerodim.spad.pamphlet b/src/algebra/zerodim.spad.pamphlet
index 5b6d499..ed12706 100644
--- a/src/algebra/zerodim.spad.pamphlet
+++ b/src/algebra/zerodim.spad.pamphlet
@@ -91,41 +91,6 @@ FGLMIfCanPackage(R,ls): Exports == Implementation where
        [dmpToP(q3)$poltopol for q3 in lq3]
 
 @
-\section{domain RGCHAIN RegularChain}
-<<domain RGCHAIN RegularChain>>=
-)abbrev domain RGCHAIN RegularChain
-++ Author: Marc Moreno Maza
-++ Date Created: 01/1999
-++ Date Last Updated: 23/01/1999
-++ Description: 
-++   A domain for regular chains (i.e. regular triangular sets) over
-++   a Gcd-Domain and with a fix list of variables.
-++   This is just a front-end for the \spadtype{RegularTriangularSet}
-++   domain constructor.
-++ Version: 1.
-
-RegularChain(R,ls): Exports == Implementation where
-  R : GcdDomain
-  ls: List Symbol
-  V ==> OrderedVariableList ls
-  E ==> IndexedExponents V
-  P ==> NewSparseMultivariatePolynomial(R,V)
-  TS ==> RegularTriangularSet(R,E,V,P)
-
-  Exports ==  RegularTriangularSetCategory(R,E,V,P) with
-     zeroSetSplit: (List P, Boolean, Boolean) -> List $
-       ++ \spad{zeroSetSplit(lp,clos?,info?)} returns a list \spad{lts} of regular
-       ++ chains such that the union of the closures of their regular zero sets
-       ++ equals the affine variety associated with \spad{lp}. Moreover, 
-       ++ if \spad{clos?} is \spad{false} then the union of the regular zero 
-       ++ set of the \spad{ts} (for \spad{ts} in \spad{lts}) equals this variety.
-       ++ If \spad{info?} is \spad{true} then some information is 
-       ++ displayed during the computations. See 
-       ++ \axiomOpFrom{zeroSetSplit}{RegularTriangularSet}.
-
-  Implementation == RegularTriangularSet(R,E,V,P) 
-
-@
 \section{package LEXTRIPK LexTriangularPackage}
 <<LexTriangularPackage.input>>=
 -- zerodim.spad.pamphlet LexTriangularPackage.input
@@ -7734,7 +7699,6 @@ ZeroDimensionalSolvePackage(R,ls,ls2): Exports == Implementation where
 <<license>>
 
 <<package FGLMICPK FGLMIfCanPackage>>
-<<domain RGCHAIN RegularChain>>
 <<package LEXTRIPK LexTriangularPackage>>
 <<package IRURPK InternalRationalUnivariateRepresentationPackage>>
 <<package RURPK RationalUnivariateRepresentationPackage>>
diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html
index eef4097..a7c066a 100644
--- a/src/axiom-website/patches.html
+++ b/src/axiom-website/patches.html
@@ -813,6 +813,8 @@ bookvol7.1 give complete path to htadd<br/>
 biquat.input fix regression failure<br/>
 <a href="patches/20081216.03.tpd.patch">20081216.03.tpd.patch</a>
 bookvol10.3 add domains<br/>
+<a href="patches/20081216.04.tpd.patch">20081216.04.tpd.patch</a>
+bookvol10.3 add domains<br/>
 
  </body>
 </html>
\ No newline at end of file
