diff --git a/books/bookvol10.3.pamphlet b/books/bookvol10.3.pamphlet
index aae6652..05cda8d 100644
--- a/books/bookvol10.3.pamphlet
+++ b/books/bookvol10.3.pamphlet
@@ -1,10 +1,18 @@
 \documentclass[dvipdfm]{book}
-\usepackage{hyperref}
-\usepackage{amssymb}
-\usepackage{axiom}
-\usepackage{makeidx}
+\usepackage{hyperref}%% we need hyperlinks
+\usepackage{amssymb} %% we need \therefore symbol
+\usepackage{axiom}   %% we need noweb support
+\usepackage{makeidx} %% we need an index
 \makeindex
-\usepackage{graphicx}
+\usepackage{graphicx}%%we need \includegraphics
+
+%% We need to use a dagger to mark footnotes because numbers can be
+%% mistaken as superscripts
+\renewcommand{\thefootnote}{\fnsymbol{footnote}}
+%% Before each footnote we explicitly set the counter to 1 so that
+%% when it increments it prints a dagger
+\setcounter{footnote}{1}
+
 %%
 %% Note that this file will eventually generate a dvi file
 %% which will eventually be processed by dvipdfm to create a pdf.
@@ -22,7 +30,7 @@
 %%
 \newcommand{\dest}[1]{% e.g. \dest{abb}
 \special{pdf:dest (#1) [ @thispage /FitH @ypos ]}}
-%%
+
 %%
 %% pagehead consolidates standard page indexing
 %%
@@ -34,28 +42,33 @@
 \label{#2}%
 \index{{#1}}%
 \index{{#2}}}%
+
 %%
 %% pagepic adds an image and an index entry
 %%
 \newcommand{\pagepic}[3]{% e.g. \pagepic{pathandfile}{abb}{scale}
 \includegraphics[scale=#3]{#1}\\%
 \index{images!#2}}
+
 %%
 %% \refto is a link to a referenced page that returns it arg
 %%
 \newcommand{\refto}[1]{% e.g. \refto{name}
 (p\pageref{#1}) #1}
+
 %%
 %% pageto is a forward link to a referenced page
 %%
 \newcommand{\pageto}[2]{% e.g. \pageto{abb}{name}
 \ \\${\bf\Rightarrow{}}${``#1''} (#2) \ref{#1} on page~\pageref{#1}}
+
 %%
 %% pagefrom is a backward link to a referencing page
 %%
 \newcommand{\pagefrom}[2]{% e.g. \pagefrom{name}{abb}
 \ \\${\bf\Leftarrow{}}${``#1''} (#2) \ref{#1} on page~\pageref{#1}}
-%%
+
+
 %% cross will put the category and function in the index
 %% cross will leave the funcname so it can be put inline.
 %%
@@ -5964,6 +5977,222 @@ AssociationList(Key:SetCategory, Entry:SetCategory):
 
 @
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain ATTRBUT AttributeButtons}
+\pagehead{AttributeButtons}{ATTRBUT}
+\pagepic{ps/v103attributebuttons.ps}{ATTRBUT}{1.00}
+<<domain ATTRBUT AttributeButtons>>=
+)abbrev domain ATTRBUT AttributeButtons
+++ Author: Brian Dupee
+++ Date Created: April 1996
+++ Date Last Updated: December 1997
+++ Basic Operations: increase, decrease, getButtonValue, setButtonValue
+++ Related Constructors: Table(String,Float)
+++ Description:
+++ \axiomType{AttributeButtons} implements a database and associated
+++ adjustment mechanisms for a set of attributes.
+++
+++ For ODEs these attributes are "stiffness", "stability" (i.e. how much
+++ affect the cosine or sine component of the solution has on the stability of
+++ the result), "accuracy" and "expense" (i.e. how expensive is the evaluation
+++ of the ODE).  All these have bearing on the cost of calculating the 
+++ solution given that reducing the step-length to achieve greater accuracy 
+++ requires considerable number of evaluations and calculations.
+++
+++ The effect of each of these attributes can be altered by increasing or
+++ decreasing the button value.
+++
+++ For Integration there is a button for increasing and decreasing the preset
+++ number of function evaluations for each method.  This is automatically used
+++ by ANNA when a method fails due to insufficient workspace or where the
+++ limit of function evaluations has been reached before the required
+++ accuracy is achieved. 
+++ 
+AttributeButtons(): E == I where
+  F	==> Float
+  ST	==> String
+  LST	==> List String
+  Rec	==> Record(key:Symbol,entry:Any)
+  RList	==> List(Record(key:Symbol,entry:Any))
+  IFL	==> List(Record(ifail:Integer,instruction:ST))
+  Entry	==> Record(chapter:ST, type:ST, domainName: ST, 
+                     defaultMin:F, measure:F, failList:IFL, explList:LST)
+
+
+  E ==> SetCategory with
+
+    increase:(ST,ST) -> F
+      ++ \axiom{increase(routineName,attributeName)} increases the value
+      ++ for the effect of the attribute \axiom{attributeName} with routine 
+      ++ \axiom{routineName}.
+      ++
+      ++ \axiom{attributeName} should be one of the values
+      ++ "stiffness", "stability", "accuracy", "expense" or
+      ++ "functionEvaluations".
+    increase:(ST) -> F
+      ++ \axiom{increase(attributeName)} increases the value for the
+      ++ effect of the attribute \axiom{attributeName} with all routines.
+      ++
+      ++ \axiom{attributeName} should be one of the values
+      ++ "stiffness", "stability", "accuracy", "expense" or
+      ++ "functionEvaluations".
+    decrease:(ST,ST) -> F
+      ++ \axiom{decrease(routineName,attributeName)} decreases the value
+      ++ for the effect of the attribute \axiom{attributeName} with routine
+      ++ \axiom{routineName}.
+      ++
+      ++ \axiom{attributeName} should be one of the values
+      ++ "stiffness", "stability", "accuracy", "expense" or
+      ++ "functionEvaluations".
+    decrease:(ST) -> F
+      ++ \axiom{decrease(attributeName)} decreases the value for the
+      ++ effect of the attribute \axiom{attributeName} with all routines.
+      ++
+      ++ \axiom{attributeName} should be one of the values
+      ++ "stiffness", "stability", "accuracy", "expense" or
+      ++ "functionEvaluations".
+    getButtonValue:(ST,ST) -> F
+      ++ \axiom{getButtonValue(routineName,attributeName)} returns the 
+      ++ current value for the effect of the attribute \axiom{attributeName}  
+      ++ with routine \axiom{routineName}.
+      ++
+      ++ \axiom{attributeName} should be one of the values
+      ++ "stiffness", "stability", "accuracy", "expense" or
+      ++ "functionEvaluations".
+    resetAttributeButtons:() -> Void 
+      ++ \axiom{resetAttributeButtons()} resets the Attribute buttons to a 
+      ++ neutral level.
+    setAttributeButtonStep:(F) -> F
+      ++ \axiom{setAttributeButtonStep(n)} sets the value of the steps for 
+      ++ increasing and decreasing the button values. \axiom{n} must be 
+      ++ greater than 0 and less than 1.  The preset value is 0.5.
+    setButtonValue:(ST,F) -> F
+      ++ \axiom{setButtonValue(attributeName,n)} sets the
+      ++ value of all buttons of attribute \spad{attributeName}
+      ++ to \spad{n}. \spad{n} must be in the range [0..1].
+      ++
+      ++ \axiom{attributeName} should be one of the values
+      ++ "stiffness", "stability", "accuracy", "expense" or
+      ++ "functionEvaluations".
+    setButtonValue:(ST,ST,F) -> F
+      ++ \axiom{setButtonValue(attributeName,routineName,n)} sets the
+      ++ value of the button of attribute \spad{attributeName} to routine
+      ++ \spad{routineName} to \spad{n}. \spad{n} must be in the range [0..1].
+      ++
+      ++ \axiom{attributeName} should be one of the values
+      ++ "stiffness", "stability", "accuracy", "expense" or
+      ++ "functionEvaluations".
+    finiteAggregate
+
+  I ==> add
+
+    Rep := StringTable(F)
+    import Rep
+
+    buttons:() -> $
+
+    buttons():$ == 
+      eList := empty()$List(Record(key:ST,entry:F))
+      l1:List String := ["stability","stiffness","accuracy","expense"]
+      l2:List String := ["functionEvaluations"]
+      ro1 := selectODEIVPRoutines(r := routines()$RoutinesTable)$RoutinesTable
+      ro2 := selectIntegrationRoutines(r)$RoutinesTable
+      k1:List String := [string(i)$Symbol for i in keys(ro1)$RoutinesTable]
+      k2:List String := [string(i)$Symbol for i in keys(ro2)$RoutinesTable]
+      for i in k1 repeat
+        for j in l1 repeat
+          e:Record(key:ST,entry:F) := [i j,0.5]
+          eList := cons(e,eList)$List(Record(key:ST,entry:F))
+      for i in k2 repeat
+        for j in l2 repeat
+          e:Record(key:ST,entry:F) := [i j,0.5]
+          eList := cons(e,eList)$List(Record(key:ST,entry:F))
+      construct(eList)$Rep
+
+    attributeButtons:$ := buttons()
+
+    attributeStep:F := 0.5
+
+    setAttributeButtonStep(n:F):F ==
+      positive?(n)$F and (n<1$F) => attributeStep:F := n
+      error("setAttributeButtonStep","New value must be in (0..1)")$ErrorFunctions
+
+    resetAttributeButtons():Void ==
+      attributeButtons := buttons()
+      void()$Void
+
+    setButtonValue(routineName:ST,attributeName:ST,n:F):F ==
+      f := search(routineName attributeName,attributeButtons)$Rep
+      f case Float => 
+        n>=0$F and n<=1$F => 
+          setelt(attributeButtons,routineName attributeName,n)$Rep
+        error("setAttributeButtonStep","New value must be in [0..1]")$ErrorFunctions
+      error("setButtonValue","attribute name " attributeName 
+             " not found for routine " routineName)$ErrorFunctions
+
+    setButtonValue(attributeName:ST,n:F):F ==
+      ro1 := selectODEIVPRoutines(r := routines()$RoutinesTable)$RoutinesTable
+      ro2 := selectIntegrationRoutines(r)$RoutinesTable
+      l1:List String := ["stability","stiffness","accuracy","expense"]
+      l2:List String := ["functionEvaluations"]
+      if attributeName="functionEvaluations" then
+        for i in keys(ro2)$RoutinesTable repeat
+          setButtonValue(string(i)$Symbol,attributeName,n)
+      else
+        for i in keys(ro1)$RoutinesTable repeat
+          setButtonValue(string(i)$Symbol,attributeName,n)
+      n
+
+    increase(routineName:ST,attributeName:ST):F ==
+      f := search(routineName attributeName,attributeButtons)$Rep
+      f case Float => 
+        newValue:F := (1$F-attributeStep)*f+attributeStep
+        setButtonValue(routineName,attributeName,newValue)
+      error("increase","attribute name " attributeName 
+             " not found for routine " routineName)$ErrorFunctions
+
+    increase(attributeName:ST):F ==
+      ro1 := selectODEIVPRoutines(r := routines()$RoutinesTable)$RoutinesTable
+      ro2 := selectIntegrationRoutines(r)$RoutinesTable
+      l1:List String := ["stability","stiffness","accuracy","expense"]
+      l2:List String := ["functionEvaluations"]
+      if attributeName="functionEvaluations" then
+        for i in keys(ro2)$RoutinesTable repeat
+          increase(string(i)$Symbol,attributeName)
+      else
+        for i in keys(ro1)$RoutinesTable repeat
+          increase(string(i)$Symbol,attributeName)
+      getButtonValue(string(i)$Symbol,attributeName)
+
+    decrease(routineName:ST,attributeName:ST):F ==
+      f := search(routineName attributeName,attributeButtons)$Rep
+      f case Float => 
+        newValue:F := (1$F-attributeStep)*f
+        setButtonValue(routineName,attributeName,newValue)
+      error("increase","attribute name " attributeName 
+             " not found for routine " routineName)$ErrorFunctions
+
+    decrease(attributeName:ST):F ==
+      ro1 := selectODEIVPRoutines(r := routines()$RoutinesTable)$RoutinesTable
+      ro2 := selectIntegrationRoutines(r)$RoutinesTable
+      l1:List String := ["stability","stiffness","accuracy","expense"]
+      l2:List String := ["functionEvaluations"]
+      if attributeName="functionEvaluations" then
+        for i in keys(ro2)$RoutinesTable repeat
+          decrease(string(i)$Symbol,attributeName)
+      else
+        for i in keys(ro1)$RoutinesTable repeat
+          decrease(string(i)$Symbol,attributeName)
+      getButtonValue(string(i)$Symbol,attributeName)
+
+
+    getButtonValue(routineName:ST,attributeName:ST):F == 
+      f := search(routineName attributeName,attributeButtons)$Rep
+      f case Float => f
+      error("getButtonValue","attribute name " attributeName 
+              " not found for routine " routineName)$ErrorFunctions
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \section{domain AUTOMOR Automorphism}
 \pagehead{Automorphism}{AUTOMOR}
 \pagepic{ps/v103automorphism.ps}{AUTOMOR}{1.00}
@@ -6642,6 +6871,206 @@ BasicOperator(): Exports == Implementation where
 
 @
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain BINARY BinaryExpansion}
+<<BinaryExpansion.input>>=
+-- radix.spad.pamphlet BinaryExpansion.input
+)spool BinaryExpansion.output
+)set message test on
+)set message auto off
+)clear all
+--S 1
+r := binary(22/7)
+--R 
+--R
+--R           ___
+--R   (1)  11.001
+--R                                                        Type: BinaryExpansion
+--E 1
+
+--S 2
+r + binary(6/7)
+--R 
+--R
+--R   (2)  100
+--R                                                        Type: BinaryExpansion
+--E 2
+
+--S 3
+[binary(1/i) for i in 102..106]
+--R 
+--R
+--R   (3)
+--R       ________    ___________________________________________________
+--R   [0.000000101, 0.000000100111110001000101100101111001110010010101001,
+--R         ____________    ____________
+--R    0.000000100111011, 0.000000100111,
+--R       ____________________________________________________
+--R    0.00000010011010100100001110011111011001010110111100011]
+--R                                                   Type: List BinaryExpansion
+--E 3
+
+--S 4
+binary(1/1007)
+--R 
+--R
+--R   (4)
+--R   0.
+--R     OVERBAR
+--R        00000000010000010001010010010111100000111111000010111111001011000111110
+--R          100010011100100110011000110010010101011110110100110000000011000011001
+--R          111011100011010001011110100100011110110000101011101110011101010111001
+--R          100101001011100000001110001111001000000100100100110111001010100111010
+--R          001101110110101110001001000001100101101100000010110010111110001010000
+--R          010101010110101100000110110111010010101111111010111010100110010000101
+--R          0011011000100110001000100001000011000111010011110001
+--R                                                        Type: BinaryExpansion
+--E 4
+
+--S 5
+p := binary(1/4)*x**2 + binary(2/3)*x + binary(4/9)
+--R 
+--R
+--R             2     __      ______
+--R   (5)  0.01x  + 0.10x + 0.011100
+--R                                             Type: Polynomial BinaryExpansion
+--E 5
+
+--S 6
+q := D(p, x)
+--R 
+--R
+--R                 __
+--R   (6)  0.1x + 0.10
+--R                                             Type: Polynomial BinaryExpansion
+--E 6
+
+--S 7
+g := gcd(p, q)
+--R 
+--R
+--R              __
+--R   (7)  x + 1.01
+--R                                             Type: Polynomial BinaryExpansion
+--E 7
+)spool
+)lisp (bye)
+@
+<<BinaryExpansion.help>>=
+====================================================================
+BinaryExpansion examples
+====================================================================
+All rational numbers have repeating binary expansions.  Operations to
+access the individual bits of a binary expansion can be obtained by
+converting the value to RadixExpansion(2).  More examples of
+expansions are available with
+
+The expansion (of type BinaryExpansion) of a rational number is
+returned by the binary operation.
+
+  r := binary(22/7)
+      ___
+   11.001
+                      Type: BinaryExpansion
+
+Arithmetic is exact.
+
+  r + binary(6/7)
+   100 
+                      Type: BinaryExpansion
+
+The period of the expansion can be short or long.
+
+  [binary(1/i) for i in 102..106]
+      ________
+   [0.00000101,
+      ___________________________________________________
+    0.000000100111110001000101100101111001110010010101001,
+         ____________    ____________
+    0.000000100111011, 0.000000100111,
+       ____________________________________________________
+    0.00000010011010100100001110011111011001010110111100011]
+                      Type: List BinaryExpansion
+
+or very long.
+
+  binary(1/1007)
+     ________________________________________________________________________
+   0.000000000100000100010100100101111000001111110000101111110010110001111101
+     ________________________________________________________________________
+     000100111001001100110001100100101010111101101001100000000110000110011110
+     ________________________________________________________________________
+     111000110100010111101001000111101100001010111011100111010101110011001010
+     ________________________________________________________________________
+     010111000000011100011110010000001001001001101110010101001110100011011101
+     ________________________________________________________________________
+     101011100010010000011001011011000000101100101111100010100000101010101101
+     ________________________________________________________________________
+     011000001101101110100101011111110101110101001100100001010011011000100110
+     ____________________________________
+     001000100001000011000111010011110001
+                      Type: BinaryExpansion
+
+These numbers are bona fide algebraic objects.
+
+  p := binary(1/4)*x**2 + binary(2/3)*x + binary(4/9)
+               __       ______
+   0.01 x^2 +0.10 x + 0.011100
+                      Type: Polynomial BinaryExpansion
+
+  q := D(p, x)
+             __
+   0.1 x + 0.10
+                      Type: Polynomial BinaryExpansion
+
+  g := gcd(p, q)
+       __
+   x+1.01
+                      Type: Polynomial BinaryExpansion
+
+See Also:
+o )help DecimalExpansion
+o )help HexadecimalExpansion
+o )show BinaryExpansion
+o $AXIOM/doc/src/algebra/radix.spad.dvi
+
+@
+\pagehead{BinaryExpansion}{BINARY}
+\pagepic{ps/v103binaryexpansion.ps}{BINARY}{1.00}
+<<domain BINARY BinaryExpansion>>=
+)abbrev domain BINARY BinaryExpansion
+++ Author: Clifton J. Williamson
+++ Date Created: April 26, 1990
+++ Date Last Updated: May 15, 1991
+++ Basic Operations:
+++ Related Domains: RadixExpansion
+++ Also See:
+++ AMS Classifications:
+++ Keywords: radix, base, binary
+++ Examples:
+++ References:
+++ Description:
+++   This domain allows rational numbers to be presented as repeating
+++   binary expansions.
+
+BinaryExpansion(): Exports == Implementation where
+  Exports ==> QuotientFieldCategory(Integer) with
+    coerce: % -> Fraction Integer
+      ++ coerce(b) converts a binary expansion to a rational number.
+    coerce: % -> RadixExpansion(2)
+      ++ coerce(b) converts a binary expansion to a radix expansion with base 2.
+    fractionPart: % -> Fraction Integer
+      ++ fractionPart(b) returns the fractional part of a binary expansion.
+    binary: Fraction Integer -> %
+      ++ binary(r) converts a rational number to a binary expansion.
+      ++
+      ++X binary(22/7)
+
+  Implementation ==> RadixExpansion(2) add
+    binary r == r :: %
+    coerce(x:%): RadixExpansion(2) == x pretend RadixExpansion(2)
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \section{domain BINFILE BinaryFile}
 \pagehead{BinaryFile}{BINFILE}
 \pagepic{ps/v103binaryfile.ps}{BINFILE}{1.00}
@@ -11495,6 +11924,193 @@ DataList(S:OrderedSet) : Exports == Implementation where
 
 @
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain DECIMAL DecimalExpansion}
+<<DecimalExpansion.input>>=
+-- radix.spad.pamphlet DecimalExpansion.input
+)spool DecimalExpansion.output
+)set message test on
+)set message auto off
+)clear all
+--S 1 of 7
+r := decimal(22/7)
+--R 
+--R
+--R          ______
+--R   (1)  3.142857
+--R                                                       Type: DecimalExpansion
+--E 1
+
+--S 2 of 7
+r + decimal(6/7)
+--R 
+--R
+--R   (2)  4
+--R                                                       Type: DecimalExpansion
+--E 2
+
+--S 3 of 7
+[decimal(1/i) for i in 350..354]
+--R 
+--R
+--R   (3)
+--R        ______    ______         __    ________________________________
+--R   [0.00285714, 0.002849, 0.0028409, 0.00283286118980169971671388101983,
+--R       __________________________________________________________
+--R    0.00282485875706214689265536723163841807909604519774011299435]
+--R                                                  Type: List DecimalExpansion
+--E 3
+
+--S 4 of 7
+decimal(1/2049)
+--R 
+--R
+--R   (4)
+--R   0.
+--R     OVERBAR
+--R        00048804294777940458760370912640312347486578818936066373840897999023914
+--R          104441190824792581747193753050268423621278672523182040019521717911176
+--R          183504148365056124938994631527574426549536359199609565641776476329917
+--R          032698877501220107369448511469009272816007808687164470473401659346022
+--R          449975597852611029770619814543679843826256710590531966813079551
+--R                                                       Type: DecimalExpansion
+--E 4
+
+--S 5 of 7
+p := decimal(1/4)*x**2 + decimal(2/3)*x + decimal(4/9) 
+--R 
+--R
+--R             2     _      _
+--R   (5)  0.25x  + 0.6x + 0.4
+--R                                            Type: Polynomial DecimalExpansion
+--E 5
+
+--S 6 of 7
+q := differentiate(p, x)
+--R 
+--R
+--R                 _
+--R   (6)  0.5x + 0.6
+--R                                            Type: Polynomial DecimalExpansion
+--E 6
+
+--S 7 of 7
+g := gcd(p, q)
+--R 
+--R
+--R              _
+--R   (7)  x + 1.3
+--R                                            Type: Polynomial DecimalExpansion
+--E 7
+)spool
+)lisp (bye)
+@
+<<DecimalExpansion.help>>=
+====================================================================
+DecimalExpansion examples
+====================================================================
+
+All rationals have repeating decimal expansions.  Operations to access
+the individual digits of a decimal expansion can be obtained by
+converting the value to RadixExpansion(10).  
+
+The operation decimal is used to create this expansion of type
+DecimalExpansion.
+
+  r := decimal(22/7)
+      ______
+    3.142857
+                      Type: DecimalExpansion
+
+Arithmetic is exact.
+
+  r + decimal(6/7)
+   4
+                      Type: DecimalExpansion
+
+The period of the expansion can be short or long ...
+
+  [decimal(1/i) for i in 350..354]
+        ______    ______         __    ________________________________
+   [0.00285714, 0.002849, 0.0028409, 0.00283286118980169971671388101983,
+       __________________________________________________________
+    0.00282485875706214689265536723163841807909604519774011299435]
+                      Type: List DecimalExpansion
+
+or very long.
+
+  decimal(1/2049)
+     _______________________________________________________________________
+   0.00048804294777940458760370912640312347486578818936066373840897999023914
+     _____________________________________________________________________
+     104441190824792581747193753050268423621278672523182040019521717911176
+     _____________________________________________________________________
+     183504148365056124938994631527574426549536359199609565641776476329917
+     _____________________________________________________________________
+     032698877501220107369448511469009272816007808687164470473401659346022
+     _______________________________________________________________
+     449975597852611029770619814543679843826256710590531966813079551
+                     Type: DecimalExpansion
+
+These numbers are bona fide algebraic objects.
+
+  p := decimal(1/4)*x**2 + decimal(2/3)*x + decimal(4/9) 
+        2     _      _
+   0.25x  + 0.6x + 0.4
+                     Type: Polynomial DecimalExpansion
+
+  q := differentiate(p, x)
+            _
+   0.5x + 0.6
+                     Type: Polynomial DecimalExpansion
+
+  g := gcd(p, q)
+         _
+   x + 1.3
+                     Type: Polynomial DecimalExpansion
+
+See Also:
+o )help RadixExpansion
+o )help BinaryExpansion
+o )help HexadecimalExpansion
+o )show DecimalExpansion
+o $AXIOM/doc/src/algebra/radix.spad.dvi
+
+@
+\pagehead{DecimalExpansion}{DECIMAL}
+\pagepic{ps/v103decimalexpansion.ps}{DECIMAL}{1.00}
+<<domain DECIMAL DecimalExpansion>>=
+)abbrev domain DECIMAL DecimalExpansion
+++ Author: Stephen M. Watt
+++ Date Created: October, 1986
+++ Date Last Updated: May 15, 1991
+++ Basic Operations:
+++ Related Domains: RadixExpansion
+++ Also See:
+++ AMS Classifications:
+++ Keywords: radix, base, repeating decimal
+++ Examples:
+++ References:
+++ Description:
+++   This domain allows rational numbers to be presented as repeating
+++   decimal expansions.
+DecimalExpansion(): Exports == Implementation where
+  Exports ==> QuotientFieldCategory(Integer) with
+    coerce: % -> Fraction Integer
+      ++ coerce(d) converts a decimal expansion to a rational number.
+    coerce: % -> RadixExpansion(10)
+      ++ coerce(d) converts a decimal expansion to a radix expansion
+      ++ with base 10.
+    fractionPart: % -> Fraction Integer
+      ++ fractionPart(d) returns the fractional part of a decimal expansion.
+    decimal: Fraction Integer -> %
+      ++ decimal(r) converts a rational number to a decimal expansion.
+
+  Implementation ==> RadixExpansion(10) add
+    decimal r == r :: %
+    coerce(x:%): RadixExpansion(10) == x pretend RadixExpansion(10)
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \section{Denavit-Hartenberg Matrices}
 \subsection{Homogeneous Transformations}
 The study of robot manipulation is concerned with the relationship between
@@ -28680,6 +29296,187 @@ Heap(S:OrderedSet): Exports == Implementation where
 
 @
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain HEXADEC HexadecimalExpansion}
+<<HexadecimalExpansion.input>>=
+-- radix.spad.pamphlet HexadecimalExpansion.input
+)spool HexadecimalExpansion.output
+)set message test on
+)set message auto off
+)clear all
+--S 1 of 7
+r := hex(22/7)
+--R 
+--R
+--R          ___
+--R   (1)  3.249
+--R                                                   Type: HexadecimalExpansion
+--E 1
+
+--S 2 of 7
+r + hex(6/7)
+--R 
+--R
+--R   (2)  4
+--R                                                   Type: HexadecimalExpansion
+--E 2
+
+--S 3 of 7
+[hex(1/i) for i in 350..354]
+--R 
+--R
+--R   (3)
+--R       _______________    _________      _____    ______________________
+--R   [0.00BB3EE721A54D88, 0.00BAB6561, 0.00BA2E8, 0.00B9A7862A0FF465879D5F,
+--R       _____________________________
+--R    0.00B92143FA36F5E02E4850FE8DBD78]
+--R                                              Type: List HexadecimalExpansion
+--E 3
+
+--S 4 of 7
+hex(1/1007)
+--R 
+--R
+--R   (4)
+--R   0.
+--R     OVERBAR
+--R        0041149783F0BF2C7D13933192AF6980619EE345E91EC2BB9D5CCA5C071E40926E54E8D
+--R          DAE24196C0B2F8A0AAD60DBA57F5D4C8536262210C74F1
+--R                                                   Type: HexadecimalExpansion
+--E 4
+
+--S 5 of 7
+p := hex(1/4)*x**2 + hex(2/3)*x + hex(4/9)
+--R 
+--R
+--R            2     _      ___
+--R   (5)  0.4x  + 0.Ax + 0.71C
+--R                                        Type: Polynomial HexadecimalExpansion
+--E 5
+
+--S 6 of 7
+q := D(p, x)
+--R 
+--R
+--R                 _
+--R   (6)  0.8x + 0.A
+--R                                        Type: Polynomial HexadecimalExpansion
+--E 6
+
+--S 7 of 7
+g := gcd(p, q)
+--R 
+--R
+--R              _
+--R   (7)  x + 1.5
+--R                                        Type: Polynomial HexadecimalExpansion
+--E 7
+)spool
+)lisp (bye)
+@
+<<HexadecimalExpansion.help>>=
+====================================================================
+HexadecimalExpansion
+====================================================================
+
+All rationals have repeating hexadecimal expansions.  The operation
+hex returns these expansions of type HexadecimalExpansion.  Operations
+to access the individual numerals of a hexadecimal expansion can be
+obtained by converting the value to RadixExpansion(16).  More examples
+of expansions are available in the DecimalExpansion, BinaryExpansion,
+and RadixExpansion.
+
+This is a hexadecimal expansion of a rational number.
+
+  r := hex(22/7)
+      ___
+    3.249
+                      Type: HexadecimalExpansion
+
+Arithmetic is exact.
+
+  r + hex(6/7)
+    4
+                      Type: HexadecimalExpansion
+
+The period of the expansion can be short or long ...
+
+  [hex(1/i) for i in 350..354]
+       _______________    _________      _____    ______________________
+   [0.00BB3EE721A54D88, 0.00BAB6561, 0.00BA2E8, 0.00B9A7862A0FF465879D5F,
+       _____________________________
+    0.00B92143FA36F5E02E4850FE8DBD78]
+                      Type: List HexadecimalExpansion
+
+or very long!
+
+  hex(1/1007)
+     _______________________________________________________________________
+   0.0041149783F0BF2C7D13933192AF6980619EE345E91EC2BB9D5CCA5C071E40926E54E8D
+     ______________________________________________
+     DAE24196C0B2F8A0AAD60DBA57F5D4C8536262210C74F1
+                      Type: HexadecimalExpansion
+
+These numbers are bona fide algebraic objects.
+
+  p := hex(1/4)*x**2 + hex(2/3)*x + hex(4/9)
+        2     _      ___
+    0.4x  + 0.Ax + 0.71C
+                      Type: Polynomial HexadecimalExpansion
+
+  q := D(p, x)
+             _
+    0.8x + 0.A
+                      Type: Polynomial HexadecimalExpansion
+
+  g := gcd(p, q)
+          _
+    x + 1.5
+                      Type: Polynomial HexadecimalExpansion
+
+See Also:
+o )help RadixExpansion
+o )help BinaryExpansion
+o )help DecimalExpansion
+o )show HexadecimalExpansion
+o $AXIOM/doc/src/algebra/radix.spad.dvi
+
+@
+\pagehead{HexadecimalExpansion}{HEXADEC}
+\pagepic{ps/v103hexadecimalexpansion.ps}{HEXADEC}{1.00}
+<<domain HEXADEC HexadecimalExpansion>>=
+)abbrev domain HEXADEC HexadecimalExpansion
+++ Author: Clifton J. Williamson
+++ Date Created: April 26, 1990
+++ Date Last Updated: May 15, 1991
+++ Basic Operations:
+++ Related Domains: RadixExpansion
+++ Also See:
+++ AMS Classifications:
+++ Keywords: radix, base, hexadecimal
+++ Examples:
+++ References:
+++ Description:
+++   This domain allows rational numbers to be presented as repeating
+++   hexadecimal expansions.
+
+HexadecimalExpansion(): Exports == Implementation where
+  Exports ==> QuotientFieldCategory(Integer) with
+    coerce: % -> Fraction Integer
+      ++ coerce(h) converts a hexadecimal expansion to a rational number.
+    coerce: % -> RadixExpansion(16)
+      ++ coerce(h) converts a hexadecimal expansion to a radix expansion
+      ++ with base 16.
+    fractionPart: % -> Fraction Integer
+      ++ fractionPart(h) returns the fractional part of a hexadecimal expansion.
+    hex: Fraction Integer -> %
+      ++ hex(r) converts a rational number to a hexadecimal expansion.
+
+  Implementation ==> RadixExpansion(16) add
+    hex r == r :: %
+    coerce(x:%): RadixExpansion(16) == x pretend RadixExpansion(16)
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \section{domain HDP HomogeneousDirectProduct}
 \pagehead{HomogeneousDirectProduct}{HDP}
 \pagepic{ps/v103homogeneousdirectproduct.ps}{HDP}{1.00}
@@ -51499,6 +52296,479 @@ QuadraticForm(n, K): T == Impl where
 
 @
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain QALGSET QuasiAlgebraicSet}
+\pagehead{QuasiAlgebraicSet}{QALGSET}
+\pagepic{ps/v103quasialgebraicset.ps}{QALGSET}{1.00}
+<<domain QALGSET QuasiAlgebraicSet>>=
+)abbrev domain QALGSET QuasiAlgebraicSet
+++ Author:  William Sit
+++ Date Created: March 13, 1992
+++ Date Last Updated: June 12, 1992 
+++ Basic Operations:
+++ Related Constructors:GroebnerPackage
+++ See Also: QuasiAlgebraicSet2
+++ AMS Classifications:
+++ Keywords: Zariski closed sets, quasi-algebraic sets
+++ References:William Sit, "An Algorithm for Parametric Linear Systems"
+++            J. Sym. Comp., April, 1992
+++ Description:
+++ \spadtype{QuasiAlgebraicSet} constructs a domain representing
+++ quasi-algebraic sets, which
+++ is the intersection of a Zariski
+++ closed set, defined as the common zeros of a given list of
+++ polynomials (the defining polynomials for equations), and a principal
+++ Zariski open set, defined as the complement of the common
+++ zeros of a polynomial f (the defining polynomial for the inequation).
+++ This domain provides simplification of a user-given representation
+++ using groebner basis computations.
+++ There are two simplification routines: the first function
+++ \spadfun{idealSimplify}  uses groebner
+++ basis of ideals alone, while the second, \spadfun{simplify} uses both
+++ groebner basis and factorization.  The resulting defining equations L
+++ always form a groebner basis, and the resulting defining
+++ inequation f is always reduced.  The function \spadfun{simplify} may
+++ be applied several times if desired.   A third simplification
+++ routine \spadfun{radicalSimplify} is provided in
+++ \spadtype{QuasiAlgebraicSet2}  for comparison study only,
+++ as it is inefficient compared to the other two, as well as is
+++ restricted to only certain coefficient domains.  For detail analysis
+++ and a comparison of the three methods, please consult the reference
+++ cited.
+++
+++ A polynomial function q defined on the quasi-algebraic set
+++ is equivalent to its reduced form with respect to L.  While
+++ this may be obtained using the usual normal form
+++ algorithm, there is no canonical form for q.
+++
+++ The ordering in groebner basis computation is determined by
+++ the data type of the input polynomials.  If it is possible
+++ we suggest to use refinements of total degree orderings.
+QuasiAlgebraicSet(R, Var,Expon,Dpoly) : C == T
+ where
+   R         :  GcdDomain
+   Expon     :  OrderedAbelianMonoidSup
+   Var       :  OrderedSet
+   Dpoly     :  PolynomialCategory(R,Expon,Var)
+   NNI      ==> NonNegativeInteger
+   newExpon ==> Product(NNI,Expon)
+   newPoly  ==> PolynomialRing(R,newExpon)
+   Ex       ==> OutputForm
+   mrf      ==> MultivariateFactorize(Var,Expon,R,Dpoly)
+   Status   ==> Union(Boolean,"failed") -- empty or not, or don't know
+ 
+   C == Join(SetCategory, CoercibleTo OutputForm) with
+  --- should be Object instead of SetCategory, bug in LIST Object ---
+  --- equality is not implemented ---
+     empty: () -> $
+       ++ empty() returns the empty quasi-algebraic set
+     quasiAlgebraicSet:   (List Dpoly, Dpoly) -> $
+       ++ quasiAlgebraicSet(pl,q) returns the quasi-algebraic set
+       ++ with defining equations p = 0 for p belonging to the list pl, and
+       ++ defining inequation q ^= 0.
+     status: $ -> Status
+       ++ status(s) returns true if the quasi-algebraic set is empty,
+       ++ false if it is not, and "failed" if not yet known
+     setStatus: ($, Status) -> $
+       ++ setStatus(s,t) returns the same representation for s, but
+       ++ asserts the following: if t is true, then s is empty,
+       ++ if t is false, then s is non-empty, and if t = "failed",
+       ++ then no assertion is made (that is, "don't know").
+       ++ Note: for internal use only, with care.
+     empty?          :   $   -> Boolean
+       ++ empty?(s) returns
+       ++ true if the quasialgebraic set s has no points,
+       ++ and false otherwise.
+     definingEquations: $ -> List Dpoly
+       ++ definingEquations(s) returns a list of defining polynomials
+       ++ for equations, that is, for the Zariski closed part of s.
+     definingInequation: $ -> Dpoly
+       ++ definingInequation(s) returns a single defining polynomial for the
+       ++ inequation, that is, the Zariski open part of s.
+     idealSimplify:$ -> $
+       ++ idealSimplify(s) returns a different and presumably simpler
+       ++ representation of s with the defining polynomials for the
+       ++ equations
+       ++ forming a groebner basis, and the defining polynomial for the
+       ++ inequation reduced with respect to the basis, using Buchberger's
+       ++ algorithm.
+     if (R has EuclideanDomain) and (R has CharacteristicZero) then
+       simplify:$ -> $
+         ++ simplify(s) returns a different and presumably simpler
+         ++ representation of s with the defining polynomials for the
+         ++ equations
+         ++ forming a groebner basis, and the defining polynomial for the
+         ++ inequation reduced with respect to the basis, using a heuristic
+         ++ algorithm based on factoring.
+   T  == add
+     Rep := Record(status:Status,zero:List Dpoly, nzero:Dpoly)
+     x:$
+ 
+     import GroebnerPackage(R,Expon,Var,Dpoly)
+     import GroebnerPackage(R,newExpon,Var,newPoly)
+     import GroebnerInternalPackage(R,Expon,Var,Dpoly)
+ 
+                       ----  Local Functions  ----
+ 
+     minset   : List List Dpoly -> List List Dpoly
+     overset? : (List Dpoly, List List Dpoly) -> Boolean
+     npoly    : Dpoly            ->  newPoly
+     oldpoly  : newPoly          ->  Union(Dpoly,"failed")
+ 
+ 
+     if (R has EuclideanDomain) and (R has CharacteristicZero) then
+       factorset (y:Dpoly):List Dpoly ==
+         ground? y => []
+         [j.factor for j in factors factor$mrf  y]
+ 
+       simplify x ==
+         if x.status case "failed" then
+           x:=quasiAlgebraicSet(zro:=groebner x.zero, redPol(x.nzero,zro))
+         (pnzero:=x.nzero)=0 => empty()
+         nzro:=factorset pnzero
+         mset:=minset [factorset p for p in x.zero]
+         mset:=[setDifference(s,nzro) for s in mset]
+         zro:=groebner [*/s for s in mset]
+         member? (1$Dpoly, zro) => empty()
+         [x.status, zro, primitivePart redPol(*/nzro, zro)]
+ 
+     npoly(f:Dpoly) : newPoly ==
+       zero? f => 0
+       monomial(leadingCoefficient f,makeprod(0,degree f))$newPoly +
+             npoly(reductum f)
+ 
+     oldpoly(q:newPoly) : Union(Dpoly,"failed") ==
+       q=0$newPoly => 0$Dpoly
+       dq:newExpon:=degree q
+       n:NNI:=selectfirst (dq)
+       n^=0 => "failed"
+       ((g:=oldpoly reductum q) case "failed") => "failed"
+       monomial(leadingCoefficient q,selectsecond dq)$Dpoly + (g::Dpoly)
+ 
+     coerce x ==
+       x.status = true => "Empty"::Ex
+       bracket [[hconcat(f::Ex, " = 0"::Ex) for f in x.zero ]::Ex,
+                 hconcat( x.nzero::Ex, " != 0"::Ex)]
+ 
+     empty? x ==
+       if x.status case "failed" then x:=idealSimplify x
+       x.status :: Boolean
+ 
+     empty() == [true::Status, [1$Dpoly], 0$Dpoly]
+     status x == x.status
+     setStatus(x,t) == [t,x.zero,x.nzero]
+     definingEquations x == x.zero
+     definingInequation x == x.nzero
+     quasiAlgebraicSet(z0,n0) == ["failed", z0, n0]
+ 
+     idealSimplify x ==
+       x.status case Boolean => x
+       z0:= x.zero
+       n0:= x.nzero
+       empty? z0 => [false, z0, n0]
+       member? (1$Dpoly, z0) => empty()
+       tp:newPoly:=(monomial(1,makeprod(1,0$Expon))$newPoly * npoly n0)-1
+       ngb:=groebner concat(tp, [npoly g for g in z0])
+       member? (1$newPoly, ngb) => empty()
+       gb:List Dpoly:=nil
+       while not empty? ngb repeat
+         if ((f:=oldpoly ngb.first) case Dpoly) then gb:=concat(f, gb)
+         ngb:=ngb.rest
+       [false::Status, gb, primitivePart redPol(n0, gb)]
+ 
+ 
+     minset lset ==
+       empty? lset => lset
+       [s for s  in lset | ^(overset?(s,lset))]
+ 
+     overset?(p,qlist) ==
+       empty? qlist => false
+       or/[(brace$(Set Dpoly) q) <$(Set Dpoly) (brace$(Set Dpoly) p) for q in qlist]
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain QUAT Quaternion}
+<<Quaternion.input>>=
+-- quat.spad.pamphlet Quaternion.input
+)spool Quaternion.output
+)set message test on
+)set message auto off
+)clear all
+--S 1 of 13
+q := quatern(2/11,-8,3/4,1)
+--R 
+--R
+--R         2        3
+--R   (1)  -- - 8i + - j + k
+--R        11        4
+--R                                            Type: Quaternion Fraction Integer
+--E 1
+
+--S 2 of 13
+[real q, imagI q, imagJ q, imagK q]
+--R 
+--R
+--R          2     3
+--R   (2)  [--,- 8,-,1]
+--R         11     4
+--R                                                  Type: List Fraction Integer
+--E 2
+
+--S 3 of 13
+inv q
+--R 
+--R
+--R          352     15488      484       1936
+--R   (3)  ------ + ------ i - ----- j - ------ k
+--R        126993   126993     42331     126993
+--R                                            Type: Quaternion Fraction Integer
+--E 3
+
+--S 4 of 13
+q^6
+--R 
+--R
+--R          2029490709319345   48251690851     144755072553     48251690851
+--R   (4)  - ---------------- - ----------- i + ------------ j + ----------- k
+--R             7256313856        1288408         41229056         10307264
+--R                                            Type: Quaternion Fraction Integer
+--E 4
+
+--S 5 of 13
+r := quatern(-2,3,23/9,-89); q + r
+--R 
+--R
+--R          20        119
+--R   (5)  - -- - 5i + --- j - 88k
+--R          11         36
+--R                                            Type: Quaternion Fraction Integer
+--E 5
+
+--S 6 of 13
+q * r - r * q
+--R 
+--R
+--R          2495             817
+--R   (6)  - ---- i - 1418j - --- k
+--R           18               18
+--R                                            Type: Quaternion Fraction Integer
+--E 6
+
+--S 7 of 13
+i:=quatern(0,1,0,0) 
+--R 
+--R
+--R   (7)  i
+--R                                                     Type: Quaternion Integer
+--E 7
+
+--S 8 of 13
+j:=quatern(0,0,1,0) 
+--R 
+--R
+--R   (8)  j
+--R                                                     Type: Quaternion Integer
+--E 8
+
+--S 9 of 13
+k:=quatern(0,0,0,1)
+--R 
+--R
+--R   (9)  k
+--R                                                     Type: Quaternion Integer
+--E 9
+
+--S 10 of 13
+[i*i, j*j, k*k, i*j, j*k, k*i, q*i]
+--R 
+--R
+--R                                 2         3
+--R   (10)  [- 1,- 1,- 1,k,i,j,8 + -- i + j - - k]
+--R                                11         4
+--R                                       Type: List Quaternion Fraction Integer
+--E 10
+
+--S 11 of 13
+norm q
+--R 
+--R
+--R         126993
+--R   (11)  ------
+--R          1936
+--R                                                       Type: Fraction Integer
+--E 11
+
+--S 12 of 13
+conjugate q 
+--R 
+--R
+--R          2        3
+--R   (12)  -- + 8i - - j - k
+--R         11        4
+--R                                            Type: Quaternion Fraction Integer
+--E 12
+
+--S 13 of 13
+q * %
+--R 
+--R
+--R         126993
+--R   (13)  ------
+--R          1936
+--R                                            Type: Quaternion Fraction Integer
+--E 13
+)spool
+)lisp (bye)
+@
+<<Quaternion.help>>=
+====================================================================
+Quaternion examples
+====================================================================
+
+The domain constructor Quaternion implements quaternions over
+commutative rings.
+
+The basic operation for creating quaternions is quatern.  This is a
+quaternion over the rational numbers.
+
+  q := quatern(2/11,-8,3/4,1)
+     2        3
+    -- - 8i + - j + k
+    11        4
+                        Type: Quaternion Fraction Integer
+
+The four arguments are the real part, the i imaginary part, the j
+imaginary part, and the k imaginary part, respectively.
+
+  [real q, imagI q, imagJ q, imagK q]
+      2     3
+    [--,- 8,-,1]
+     11     4
+                        Type: List Fraction Integer
+
+Because q is over the rationals (and nonzero), you can invert it.
+
+  inv q
+      352     15488      484       1936
+    ------ + ------ i - ----- j - ------ k
+    126993   126993     42331     126993
+                        Type: Quaternion Fraction Integer
+
+The usual arithmetic (ring) operations are available
+
+  q^6
+      2029490709319345   48251690851     144755072553     48251690851
+    - ---------------- - ----------- i + ------------ j + ----------- k
+         7256313856        1288408         41229056         10307264
+                        Type: Quaternion Fraction Integer
+
+  r := quatern(-2,3,23/9,-89); q + r
+      20        119
+    - -- - 5i + --- j - 88k
+      11         36
+                        Type: Quaternion Fraction Integer
+
+In general, multiplication is not commutative.
+
+  q * r - r * q
+      2495             817
+    - ---- i - 1418j - --- k
+       18               18
+                         Type: Quaternion Fraction Integer
+
+There are no predefined constants for the imaginary i, j, and k parts,
+but you can easily define them.
+
+  i:=quatern(0,1,0,0) 
+    i
+                         Type: Quaternion Integer
+
+  j:=quatern(0,0,1,0) 
+    j
+                         Type: Quaternion Integer
+ 
+  k:=quatern(0,0,0,1)
+    k
+                         Type: Quaternion Integer
+
+These satisfy the normal identities.
+
+  [i*i, j*j, k*k, i*j, j*k, k*i, q*i]
+                             2         3
+     [- 1,- 1,- 1,k,i,j,8 + -- i + j - - k]
+                            11         4
+                          Type: List Quaternion Fraction Integer
+
+The norm is the quaternion times its conjugate.
+
+  norm q
+    126993
+    ------
+     1936
+                          Type: Fraction Integer
+
+  conjugate q 
+      2        3
+     -- + 8i - - j - k
+     11        4
+                          Type: Quaternion Fraction Integer
+
+  q * %
+     126993
+     ------
+      1936
+                          Type: Quaternion Fraction Integer
+
+See Also:
+o )help Octonion
+o )help Complex
+o )help CliffordAlgebra
+o )show Quaternion
+o $AXIOM/doc/src/algebra/quat.spad.dvi
+
+@
+\pagehead{Quaternion}{QUAT}
+\pagepic{ps/v103quaternion.ps}{QUAT}{1.00}
+<<domain QUAT Quaternion>>=
+)abbrev domain QUAT Quaternion
+++ Author: Robert S. Sutor
+++ Date Created: 23 May 1990
+++ Change History:
+++   10 September 1990
+++ Basic Operations: (Algebra)
+++   abs, conjugate, imagI, imagJ, imagK, norm, quatern, rational,
+++   rational?, real
+++ Related Constructors: QuaternionCategoryFunctions2
+++ Also See: QuaternionCategory, DivisionRing
+++ AMS Classifications: 11R52
+++ Keywords: quaternions, division ring, algebra
+++ Description: \spadtype{Quaternion} implements quaternions over a
+++   commutative ring. The main constructor function is \spadfun{quatern}
+++   which takes 4 arguments: the real part, the i imaginary part, the j
+++   imaginary part and the k imaginary part.
+ 
+Quaternion(R:CommutativeRing): QuaternionCategory(R) == add
+  Rep := Record(r:R,i:R,j:R,k:R)
+ 
+  0 == [0,0,0,0]
+  1 == [1,0,0,0]
+ 
+  a,b,c,d : R
+  x,y : $
+ 
+  real  x == x.r
+  imagI x == x.i
+  imagJ x == x.j
+  imagK x == x.k
+ 
+  quatern(a,b,c,d) == [a,b,c,d]
+ 
+  x * y == [x.r*y.r-x.i*y.i-x.j*y.j-x.k*y.k,
+               x.r*y.i+x.i*y.r+x.j*y.k-x.k*y.j,
+                 x.r*y.j+x.j*y.r+x.k*y.i-x.i*y.k,
+                   x.r*y.k+x.k*y.r+x.i*y.j-x.j*y.i]
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \section{domain QEQUAT QueryEquation}
 <<dot>>=
 "QEQUAT" -> "KOERCE"
@@ -51806,6 +53076,2076 @@ RadicalFunctionField(F, UP, UPUP, radicnd, n): Exports == Impl where
 
 @
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain RADIX RadixExpansion}
+<<RadixExpansion.input>>=
+-- radix.spad.pamphlet RadixExpansion.input
+)spool RadixExpansion.output
+)set message test on
+)set message auto off
+)clear all
+--S 1 of 17
+111::RadixExpansion(5)
+--R 
+--R
+--R   (1)  421
+--R                                                       Type: RadixExpansion 5
+--E 1
+
+--S 2 of 17
+(5/24)::RadixExpansion(2)
+--R 
+--R
+--R             __
+--R   (2)  0.00110
+--R                                                       Type: RadixExpansion 2
+--E 2
+
+--S 3 of 17
+(5/24)::RadixExpansion(3)
+--R 
+--R
+--R           __
+--R   (3)  0.012
+--R                                                       Type: RadixExpansion 3
+--E 3
+
+--S 4 of 17
+(5/24)::RadixExpansion(8)
+--R 
+--R
+--R           __
+--R   (4)  0.152
+--R                                                       Type: RadixExpansion 8
+--E 4
+
+--S 5 of 17
+(5/24)::RadixExpansion(10)
+--R 
+--R
+--R             _
+--R   (5)  0.2083
+--R                                                      Type: RadixExpansion 10
+--E 5
+
+--S 6 of 17
+(5/24)::RadixExpansion(12)
+--R 
+--R
+--R   (6)  0.26
+--R                                                      Type: RadixExpansion 12
+--E 6
+
+--S 7 of 17
+(5/24)::RadixExpansion(16)
+--R 
+--R
+--R           _
+--R   (7)  0.35
+--R                                                      Type: RadixExpansion 16
+--E 7
+
+--S 8 of 17
+(5/24)::RadixExpansion(36)
+--R 
+--R
+--R   (8)  0.7I
+--R                                                      Type: RadixExpansion 36
+--E 8
+
+--S 9 of 17
+(5/24)::RadixExpansion(38)
+--R 
+--R
+--R                    _____
+--R   (9)  0 . 7 34 31 25 12
+--R                                                      Type: RadixExpansion 38
+--E 9
+
+--S 10 of 17
+a := (76543/210)::RadixExpansion(8)
+--R 
+--R
+--R              ____
+--R   (10)  554.37307
+--R                                                       Type: RadixExpansion 8
+--E 10
+
+--S 11 of 17
+w := wholeRagits a
+--R 
+--R
+--R   (11)  [5,5,4]
+--R                                                           Type: List Integer
+--E 11
+
+--S 12 of 17
+f0 := prefixRagits a
+--R 
+--R
+--R   (12)  [3]
+--R                                                           Type: List Integer
+--E 12
+
+--S 13 of 17
+f1 := cycleRagits a
+--R 
+--R
+--R   (13)  [7,3,0,7]
+--R                                                           Type: List Integer
+--E 13
+
+--S 14 of 17
+u:RadixExpansion(8):=wholeRadix(w)+fractRadix(f0,f1)
+--R 
+--R
+--R              ____
+--R   (14)  554.37307
+--R                                                       Type: RadixExpansion 8
+--E 14
+
+--S 15 of 17
+v: RadixExpansion(12) := fractRadix([1,2,3,11], [0])
+--R 
+--R
+--R               _
+--R   (15)  0.123B0
+--R                                                      Type: RadixExpansion 12
+--E 15
+
+--S 16 of 17
+fractRagits(u)
+--R 
+--R
+--R              _______
+--R   (16)  [3,7,3,0,7,7]
+--R                                                         Type: Stream Integer
+--E 16
+
+--S 17 of 17
+a :: Fraction(Integer)
+--R 
+--R
+--R         76543
+--R   (17)  -----
+--R          210
+--R                                                       Type: Fraction Integer
+--E 17
+)spool
+)lisp (bye)
+@
+<<RadixExpansion.help>>=
+====================================================================
+RadixExpansion examples
+====================================================================
+
+It possible to expand numbers in general bases.
+
+Here we expand 111 in base 5. This means
+  10^2+10^1+10^0 = 4 * 5^2+2 * 5^1 + 5^0
+
+  111::RadixExpansion(5)
+    421
+                              Type: RadixExpansion 5
+
+You can expand fractions to form repeating expansions.
+
+  (5/24)::RadixExpansion(2)
+         __
+    0.00110
+                              Type: RadixExpansion 2
+
+  (5/24)::RadixExpansion(3)
+       __
+    0.012
+                              Type: RadixExpansion 3
+
+  (5/24)::RadixExpansion(8)
+       __
+    0.152
+                              Type: RadixExpansion 8
+
+  (5/24)::RadixExpansion(10)
+         _
+    0.2083
+                              Type: RadixExpansion 10
+
+For bases from 11 to 36 the letters A through Z are used.
+
+  (5/24)::RadixExpansion(12)
+    0.26
+                              Type: RadixExpansion 12
+
+  (5/24)::RadixExpansion(16)
+       _
+    0.35
+                              Type: RadixExpansion 16
+
+  (5/24)::RadixExpansion(36)
+    0.7I
+                              Type: RadixExpansion 36
+
+For bases greater than 36, the ragits are separated by blanks.
+
+  (5/24)::RadixExpansion(38)
+                _____
+    0 . 7 34 31 25 12
+                              Type: RadixExpansion 38
+
+The RadixExpansion type provides operations to obtain the individual
+ragits.  Here is a rational number in base 8.
+
+  a := (76543/210)::RadixExpansion(8)
+          ____
+     554.37307
+                              Type: RadixExpansion 8
+
+The operation wholeRagits returns a list of the ragits for the
+integral part of the number.
+
+  w := wholeRagits a
+    [5,5,4]
+                              Type: List Integer
+
+The operations prefixRagits and cycleRagits return lists of the initial
+and repeating ragits in the fractional part of the number.
+
+  f0 := prefixRagits a
+    [3]
+                              Type: List Integer
+
+  f1 := cycleRagits a
+    [7,3,0,7]
+                              Type: List Integer
+
+You can construct any radix expansion by giving the whole, prefix and
+cycle parts.  The declaration is necessary to let Axiom know the base
+of the ragits.
+
+  u:RadixExpansion(8):=wholeRadix(w)+fractRadix(f0,f1)
+         ____
+    554.37307
+                              Type: RadixExpansion 8
+
+If there is no repeating part, then the list [0] should be used.
+
+  v: RadixExpansion(12) := fractRadix([1,2,3,11], [0])
+          _
+    0.123B0
+                              Type: RadixExpansion 12
+
+If you are not interested in the repeating nature of the expansion, an
+infinite stream of ragits can be obtained using fractRagits.
+
+  fractRagits(u)
+         _______
+    [3,7,3,0,7,7]
+                              Type: Stream Integer
+
+Of course, it's possible to recover the fraction representation:
+
+  a :: Fraction(Integer)
+    76543
+    -----
+     210
+                              Type: Fraction Integer
+
+See Also:
+o )help DecimalExpansion
+o )help BinaryExpansion
+o )help HexadecimalExpansion
+o )show RadixExpansion
+o $AXIOM/doc/src/algebra/radix.spad.dvi
+
+@
+\pagehead{RadixExpansion}{RADIX}
+\pagepic{ps/v103radixexpansion.ps}{RADIX}{1.00}
+<<domain RADIX RadixExpansion>>=
+)abbrev domain RADIX RadixExpansion
+++ Author: Stephen M. Watt
+++ Date Created: October 1986
+++ Date Last Updated: May 15, 1991
+++ Basic Operations: wholeRadix, fractRadix, wholeRagits, fractRagits
+++ Related Domains: BinaryExpansion, DecimalExpansion, HexadecimalExpansion,
+++    RadixUtilities
+++ Also See:
+++ AMS Classifications:
+++ Keywords: radix, base, repeating decimal
+++ Examples:
+++ References:
+++ Description:
+++   This domain allows rational numbers to be presented as repeating
+++   decimal expansions or more generally as repeating expansions in any base.
+
+RadixExpansion(bb): Exports == Implementation where
+  bb   :  Integer
+  I   ==> Integer
+  NNI ==> NonNegativeInteger
+  OUT ==> OutputForm
+  RN  ==> Fraction Integer
+  ST  ==> Stream Integer
+  QuoRem ==> Record(quotient: Integer, remainder: Integer)
+
+  Exports ==> QuotientFieldCategory(Integer) with
+    coerce: % -> Fraction Integer
+      ++ coerce(rx) converts a radix expansion to a rational number.
+    fractionPart: % -> Fraction Integer
+      ++ fractionPart(rx) returns the fractional part of a radix expansion.
+    wholeRagits: % -> List Integer
+      ++ wholeRagits(rx) returns the ragits of the integer part
+      ++ of a radix expansion.
+    fractRagits: % -> Stream Integer
+      ++ fractRagits(rx) returns the ragits of the fractional part
+      ++ of a radix expansion.
+    prefixRagits: % -> List Integer
+      ++ prefixRagits(rx) returns the non-cyclic part of the ragits
+      ++ of the fractional part of a radix expansion.
+      ++ For example, if \spad{x = 3/28 = 0.10 714285 714285 ...},
+      ++ then \spad{prefixRagits(x)=[1,0]}.
+    cycleRagits: % -> List Integer
+      ++ cycleRagits(rx) returns the cyclic part of the ragits of the
+      ++ fractional part of a radix expansion.
+      ++ For example, if \spad{x = 3/28 = 0.10 714285 714285 ...},
+      ++ then \spad{cycleRagits(x) = [7,1,4,2,8,5]}.
+    wholeRadix: List Integer -> %
+      ++ wholeRadix(l) creates an integral radix expansion from a list
+      ++ of ragits.
+      ++ For example, \spad{wholeRadix([1,3,4])} will return \spad{134}.
+    fractRadix: (List Integer, List Integer) -> %
+      ++ fractRadix(pre,cyc) creates a fractional radix expansion
+      ++ from a list of prefix ragits and a list of cyclic ragits.
+      ++ e.g., \spad{fractRadix([1],[6])} will return \spad{0.16666666...}.
+
+  Implementation ==> add
+    -- The efficiency of arithmetic operations is poor.
+    -- Could use a lazy eval where either rational rep
+    -- or list of ragit rep (the current) or both are kept
+    -- as demanded.
+
+    bb < 2 => error "Radix base must be at least 2"
+    Rep := Record(sgn: Integer,      int: List Integer,
+                  pfx: List Integer, cyc: List Integer)
+
+    q:     RN
+    qr:    QuoRem
+    a,b:   %
+    n:     I
+
+    radixInt:    (I, I)    -> List I
+    radixFrac:   (I, I, I) -> Record(pfx: List I, cyc: List I)
+    checkRagits: List I    -> Boolean
+
+    -- Arithmetic operations
+    characteristic() == 0
+    differentiate a == 0
+
+    0     == [1, nil(),  nil(), nil()]
+    1     == [1, [1], nil(), nil()]
+    - a   == (a = 0 => 0; [-a.sgn, a.int, a.pfx, a.cyc])
+    a + b == (a::RN + b::RN)::%
+    a - b == (a::RN - b::RN)@RN::%
+    n * a == (n     * a::RN)::%
+    a * b == (a::RN * b::RN)::%
+    a / b == (a::RN / b::RN)::%
+    (i:I) / (j:I) == (i/j)@RN :: %
+    a < b == a::RN < b::RN
+    a = b == a.sgn = b.sgn and a.int = b.int and
+             a.pfx = b.pfx and a.cyc = b.cyc
+    numer a == numer(a::RN)
+    denom a == denom(a::RN)
+
+    -- Algebraic coercions
+    coerce(a):RN == (wholePart a) :: RN + fractionPart a
+    coerce(n):%  == n :: RN :: %
+    coerce(q):%  ==
+      s := 1; if q < 0 then (s := -1; q := -q)
+      qr      := divide(numer q,denom q)
+      whole   := radixInt (qr.quotient,bb)
+      fractn  := radixFrac(qr.remainder,denom q,bb)
+      cycle   := (fractn.cyc = [0] => nil(); fractn.cyc)
+      [s,whole,fractn.pfx,cycle]
+
+    retractIfCan(a):Union(RN,"failed") == a::RN
+    retractIfCan(a):Union(I,"failed") ==
+      empty?(a.pfx) and empty?(a.cyc) => wholePart a
+      "failed"
+
+    -- Exported constructor/destructors
+    ceiling a == ceiling(a::RN)
+    floor a == floor(a::RN)
+
+    wholePart a ==
+      n0 := 0
+      for r in a.int repeat n0 := bb*n0 + r
+      a.sgn*n0
+    fractionPart a ==
+      n0 := 0
+      for r in a.pfx repeat n0 := bb*n0 + r
+      null a.cyc =>
+          a.sgn*n0/bb**((#a.pfx)::NNI)
+      n1 := n0
+      for r in a.cyc repeat n1 := bb*n1 + r
+      n := n1 - n0
+      d := (bb**((#a.cyc)::NNI) - 1) * bb**((#a.pfx)::NNI)
+      a.sgn*n/d
+
+    wholeRagits  a == a.int
+    fractRagits  a == concat(construct(a.pfx)@ST,repeating a.cyc)
+    prefixRagits a == a.pfx
+    cycleRagits  a == a.cyc
+
+    wholeRadix li ==
+      checkRagits li
+      [1, li, nil(), nil()]
+    fractRadix(lpfx, lcyc) ==
+      checkRagits lpfx; checkRagits lcyc
+      [1, nil(), lpfx, lcyc]
+
+    -- Output
+
+    ALPHAS : String := "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+
+    intToExpr(i:I): OUT ==
+      -- computes a digit for bases between 11 and 36
+      i < 10 => i :: OUT
+      elt(ALPHAS,(i-10) + minIndex(ALPHAS)) :: OUT
+
+    exprgroup(le: List OUT): OUT ==
+      empty? le      => error "exprgroup needs non-null list"
+      empty? rest le => first le
+      abs bb <= 36 => hconcat le
+      blankSeparate le
+
+    intgroup(li: List I): OUT ==
+      empty? li      => error "intgroup needs non-null list"
+      empty? rest li => intToExpr first(li)
+      abs bb <= 10 => hconcat [i :: OUT for i in li]
+      abs bb <= 36 => hconcat [intToExpr(i) for i in li]
+      blankSeparate [i :: OUT for i in li]
+
+    overBar(li: List I): OUT == overbar intgroup li
+
+    coerce(a): OUT ==
+      le : List OUT := nil()
+      if not null a.cyc then le := concat(overBar  a.cyc,le)
+      if not null a.pfx then le := concat(intgroup a.pfx,le)
+      if not null le    then le := concat("." :: OUT,le)
+      if not null a.int then le := concat(intgroup a.int,le)
+      else le := concat(0 :: OUT,le)
+      rex := exprgroup le
+      if a.sgn < 0 then -rex else rex
+
+    -- Construction utilities
+    checkRagits li ==
+      for i in li repeat if i < 0 or i >= bb then
+        error "Each ragit (digit) must be between 0 and base-1"
+      true
+
+    radixInt(n,bas) ==
+      rits: List I := nil()
+      while abs n ^= 0 repeat
+        qr   := divide(n,bas)
+        n    := qr.quotient
+        rits := concat(qr.remainder,rits)
+      rits
+
+    radixFrac(num,den,bas) ==
+      -- Rits is the sequence of quotient/remainder pairs
+      -- in calculating the radix expansion of the rational number.
+      -- We wish to find p and c such that
+      --    rits.i are distinct    for 0<=i<=p+c-1
+      --    rits.i = rits.(i+p)    for i>p
+      -- I.e. p is the length of the non-periodic prefix and c is
+      -- the length of the cycle.
+
+      -- Compute p and c using Floyd's algorithm.
+      -- 1. Find smallest n s.t. rits.n = rits.(2*n)
+      qr    := divide(bas * num, den)
+      i : I := 0
+      qr1i  := qr2i := qr
+      rits: List QuoRem := [qr]
+      until qr1i = qr2i repeat
+        qr1i := divide(bas * qr1i.remainder,den)
+        qrt  := divide(bas * qr2i.remainder,den)
+        qr2i := divide(bas * qrt.remainder,den)
+        rits := concat(qr2i, concat(qrt, rits))
+        i    := i + 1
+      rits := reverse_! rits
+      n    := i
+      -- 2. Find p = first i such that rits.i = rits.(i+n)
+      ritsi := rits
+      ritsn := rits; for i in 1..n repeat ritsn := rest ritsn
+      i := 0
+      while first(ritsi) ^= first(ritsn) repeat
+        ritsi := rest ritsi
+        ritsn := rest ritsn
+        i     := i + 1
+      p := i
+      -- 3. Find c = first i such that rits.p = rits.(p+i)
+      ritsn := rits; for i in 1..n repeat ritsn := rest ritsn
+      rn    := first ritsn
+      cfound:= false
+      c : I := 0
+      for i in 1..p while not cfound repeat
+        ritsn := rest ritsn
+        if rn = first(ritsn) then
+          c := i
+          cfound := true
+      if not cfound then c := n
+      -- 4. Now produce the lists of ragits.
+      ritspfx: List I := nil()
+      ritscyc: List I := nil()
+      for i in 1..p repeat
+        ritspfx := concat(first(rits).quotient, ritspfx)
+        rits    := rest rits
+      for i in 1..c repeat
+        ritscyc := concat(first(rits).quotient, ritscyc)
+        rits    := rest rits
+      [reverse_! ritspfx, reverse_! ritscyc]
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain RECLOS RealClosure}
+The domain constructore {\bf RealClosure} by Renaud Rioboo (University
+of Paris 6, France) provides the real closure of an ordered field.
+The implementation is based on interval arithmetic. Moreover, the
+design of this constructor and its related packages allows an easy
+use of other codings for real algebraic numbers.
+ordered field
+
+The RealClosure domain is the end-user code, it provides usual arithmetics
+with real algebraic numbers, along with the functionalities of a real closed
+field. It also provides functions to approximate a real algebraic number by an
+element of the base field. This approximation may either be absolute
+(approximate) or relative (realtivApprox).
+
+CAVEATS
+
+Since real algebraic expressions are stored as depending on "real roots" which
+are managed like variables, there is an ordering on these. This ordering is
+dynamical in the sense that any new algebraic takes precedence over older
+ones. In particular every cretaion function raises a new "real root". This has
+the effect that when you type something like sqrt(2) + sqrt(2) you have two
+new variables which happen to be equal. To avoid this name the expression such
+as in s2 := sqrt(2) ; s2 + s2
+
+Also note that computing times depend strongly on the ordering you implicitly
+provide. Please provide algebraics in the order which most natural to you.
+
+LIMITATIONS
+
+The file reclos.input show some basic use of the package.  This packages uses
+algorithms which are published in [1] and [2] which are based on field
+arithmetics, inparticular for polynomial gcd related algorithms. This can be
+quite slow for high degree polynomials and subresultants methods usually work
+best. Betas versions of the package try to use these techniques in a better
+way and work significantly faster. These are mostly based on unpublished
+algorithms and cannot be distributed. Please contact the author if you have a
+particular problem to solve or want to use these versions.
+
+Be aware that approximations behave as post-processing and that all
+computations are done excatly. They can thus be quite time consuming when
+depending on several "real roots".
+<<RealClosure.input>>=
+-- reclos.spad.pamphlet RealClosure.input
+)spool RealClosure.output
+)set message test on
+)set message auto off
+)clear all
+--S 1 of 67
+Ran := RECLOS(FRAC INT)
+--R 
+--R
+--R   (1)  RealClosure Fraction Integer
+--R                                                                 Type: Domain
+--E 1
+
+--S 2 of 67
+fourSquares(a:Ran,b:Ran,c:Ran,d:Ran):Ran==sqrt(a)+sqrt(b)-sqrt(c)-sqrt(d)
+--R 
+--R   Function declaration fourSquares : (RealClosure Fraction Integer,
+--R      RealClosure Fraction Integer,RealClosure Fraction Integer,
+--R      RealClosure Fraction Integer) -> RealClosure Fraction Integer has
+--R      been added to workspace.
+--R                                                                   Type: Void
+--E 2
+
+--S 3 of 67
+squareDiff1 := fourSquares(73,548,60,586)
+--R 
+--R   Compiling function fourSquares with type (RealClosure Fraction 
+--R      Integer,RealClosure Fraction Integer,RealClosure Fraction Integer
+--R      ,RealClosure Fraction Integer) -> RealClosure Fraction Integer 
+--R
+--R           +---+    +--+    +---+    +--+
+--R   (3)  - \|586  - \|60  + \|548  + \|73
+--R                                           Type: RealClosure Fraction Integer
+--E 3
+
+--S 4 of 67
+recip(squareDiff1)
+--R 
+--R
+--R   (4)
+--R             +---+          +--+  +--+         +--+ +---+            +---+
+--R     ((54602\|548  + 149602\|73 )\|60  + 49502\|73 \|548  + 9900895)\|586
+--R   + 
+--R             +--+ +---+             +--+            +---+            +--+
+--R     (154702\|73 \|548  + 30941947)\|60  + 10238421\|548  + 28051871\|73
+--R                                Type: Union(RealClosure Fraction Integer,...)
+--E 4
+
+--S 5 of 67
+sign(squareDiff1)
+--R 
+--R
+--R   (5)  1
+--R                                                        Type: PositiveInteger
+--E 5
+
+--S 6 of 67
+squareDiff2 := fourSquares(165,778,86,990)
+--R 
+--R
+--R           +---+    +--+    +---+    +---+
+--R   (6)  - \|990  - \|86  + \|778  + \|165
+--R                                           Type: RealClosure Fraction Integer
+--E 6
+
+--S 7 of 67
+recip(squareDiff2)
+--R 
+--R
+--R   (7)
+--R                +---+           +---+  +--+          +---+ +---+
+--R       ((556778\|778  + 1209010\|165 )\|86  + 401966\|165 \|778  + 144019431)
+--R    *
+--R        +---+
+--R       \|990
+--R   + 
+--R              +---+ +---+              +--+             +---+             +---+
+--R     (1363822\|165 \|778  + 488640503)\|86  + 162460913\|778  + 352774119\|165
+--R                                Type: Union(RealClosure Fraction Integer,...)
+--E 7
+
+--S 8 of 67
+sign(squareDiff2)
+--R 
+--R
+--R   (8)  1
+--R                                                        Type: PositiveInteger
+--E 8
+
+--S 9 of 67
+squareDiff3 := fourSquares(217,708,226,692)
+--R 
+--R
+--R           +---+    +---+    +---+    +---+
+--R   (9)  - \|692  - \|226  + \|708  + \|217
+--R                                           Type: RealClosure Fraction Integer
+--E 9
+
+--S 10 of 67
+recip(squareDiff3)
+--R 
+--R
+--R   (10)
+--R               +---+         +---+  +---+         +---+ +---+             +---+
+--R     ((- 34102\|708  - 61598\|217 )\|226  - 34802\|217 \|708  - 13641141)\|692
+--R   + 
+--R              +---+ +---+             +---+            +---+            +---+
+--R     (- 60898\|217 \|708  - 23869841)\|226  - 13486123\|708  - 24359809\|217
+--R                                Type: Union(RealClosure Fraction Integer,...)
+--E 10
+
+--S 11 of 67
+sign(squareDiff3)
+--R 
+--R
+--R   (11)  - 1
+--R                                                                Type: Integer
+--E 11
+
+--S 12 of 67
+squareDiff4 := fourSquares(155,836,162,820)
+--R 
+--R
+--R            +---+    +---+    +---+    +---+
+--R   (12)  - \|820  - \|162  + \|836  + \|155
+--R                                           Type: RealClosure Fraction Integer
+--E 12
+
+--S 13 of 67
+recip(squareDiff4)
+--R 
+--R
+--R   (13)
+--R               +---+         +---+  +---+         +---+ +---+             +---+
+--R     ((- 37078\|836  - 86110\|155 )\|162  - 37906\|155 \|836  - 13645107)\|820
+--R   + 
+--R              +---+ +---+             +---+            +---+            +---+
+--R     (- 85282\|155 \|836  - 30699151)\|162  - 13513901\|836  - 31384703\|155
+--R                                Type: Union(RealClosure Fraction Integer,...)
+--E 13
+
+--S 14 of 67
+sign(squareDiff4)
+--R 
+--R
+--R   (14)  - 1
+--R                                                                Type: Integer
+--E 14
+
+--S 15 of 67
+squareDiff5 := fourSquares(591,772,552,818)
+--R 
+--R
+--R            +---+    +---+    +---+    +---+
+--R   (15)  - \|818  - \|552  + \|772  + \|591
+--R                                           Type: RealClosure Fraction Integer
+--E 15
+
+--S 16 of 67
+recip(squareDiff5)
+--R 
+--R
+--R   (16)
+--R             +---+         +---+  +---+         +---+ +---+             +---+
+--R     ((70922\|772  + 81058\|591 )\|552  + 68542\|591 \|772  + 46297673)\|818
+--R   + 
+--R            +---+ +---+             +---+            +---+            +---+
+--R     (83438\|591 \|772  + 56359389)\|552  + 47657051\|772  + 54468081\|591
+--R                                Type: Union(RealClosure Fraction Integer,...)
+--E 16
+
+--S 17 of 67
+sign(squareDiff5)
+--R 
+--R
+--R   (17)  1
+--R                                                        Type: PositiveInteger
+--E 17
+
+--S 18 of 67
+squareDiff6 := fourSquares(434,1053,412,1088)
+--R 
+--R
+--R            +----+    +---+    +----+    +---+
+--R   (18)  - \|1088  - \|412  + \|1053  + \|434
+--R                                           Type: RealClosure Fraction Integer
+--E 18
+
+--S 19 of 67
+recip(squareDiff6)
+--R 
+--R
+--R   (19)
+--R                +----+          +---+  +---+          +---+ +----+
+--R       ((115442\|1053  + 179818\|434 )\|412  + 112478\|434 \|1053  + 76037291)
+--R    *
+--R        +----+
+--R       \|1088
+--R   + 
+--R           +---+ +----+              +---+            +----+             +---+
+--R   (182782\|434 \|1053  + 123564147)\|412  + 77290639\|1053  + 120391609\|434
+--R                                Type: Union(RealClosure Fraction Integer,...)
+--E 19
+
+--S 20 of 67
+sign(squareDiff6)
+--R 
+--R
+--R   (20)  1
+--R                                                        Type: PositiveInteger
+--E 20
+
+--S 21 of 67
+squareDiff7 := fourSquares(514,1049,446,1152)
+--R 
+--R
+--R            +----+    +---+    +----+    +---+
+--R   (21)  - \|1152  - \|446  + \|1049  + \|514
+--R                                           Type: RealClosure Fraction Integer
+--E 21
+
+--S 22 of 67
+recip(squareDiff7)
+--R 
+--R
+--R   (22)
+--R                +----+          +---+  +---+          +---+ +----+
+--R       ((349522\|1049  + 499322\|514 )\|446  + 325582\|514 \|1049  + 239072537)
+--R    *
+--R        +----+
+--R       \|1152
+--R   + 
+--R           +---+ +----+              +---+             +----+             +---+
+--R   (523262\|514 \|1049  + 384227549)\|446  + 250534873\|1049  + 357910443\|514
+--R                                Type: Union(RealClosure Fraction Integer,...)
+--E 22
+
+--S 23 of 67
+sign(squareDiff7)
+--R 
+--R
+--R   (23)  1
+--R                                                        Type: PositiveInteger
+--E 23
+
+--S 24 of 67
+squareDiff8 := fourSquares(190,1751,208,1698)
+--R 
+--R
+--R            +----+    +---+    +----+    +---+
+--R   (24)  - \|1698  - \|208  + \|1751  + \|190
+--R                                           Type: RealClosure Fraction Integer
+--E 24
+
+--S 25 of 67
+recip(squareDiff8)
+--R 
+--R
+--R   (25)
+--R                     +----+          +---+  +---+          +---+ +----+
+--R           (- 214702\|1751  - 651782\|190 )\|208  - 224642\|190 \|1751
+--R         + 
+--R           - 129571901
+--R    *
+--R        +----+
+--R       \|1698
+--R   + 
+--R               +---+ +----+              +---+             +----+
+--R     (- 641842\|190 \|1751  - 370209881)\|208  - 127595865\|1751
+--R   + 
+--R                 +---+
+--R     - 387349387\|190
+--R                                Type: Union(RealClosure Fraction Integer,...)
+--E 25
+
+--S 26 of 67
+sign(squareDiff8)
+--R 
+--R
+--R   (26)  - 1
+--R                                                                Type: Integer
+--E 26
+
+--S 27 of 67
+relativeApprox(squareDiff8,10**(-3))::Float
+--R 
+--R
+--R   (27)  - 0.2340527771 5937700123 E -10
+--R                                                                  Type: Float
+--E 27
+
+--S 28 of 67
+l := allRootsOf((x**2-2)**2-2)$Ran
+--R 
+--R
+--R   (28)  [%A33,%A34,%A35,%A36]
+--R                                      Type: List RealClosure Fraction Integer
+--E 28
+
+--S 29 of 67
+removeDuplicates map(mainDefiningPolynomial,l)
+--R 
+--R
+--R           4     2
+--R   (29)  [?  - 4?  + 2]
+--RType: List Union(SparseUnivariatePolynomial RealClosure Fraction Integer,"failed")
+--E 29
+
+--S 30 of 67
+map(mainCharacterization,l)
+--R 
+--R
+--R   (30)  [[- 2,- 1[,[- 1,0[,[0,1[,[1,2[]
+--RType: List Union(RightOpenIntervalRootCharacterization(RealClosure Fraction Integer,SparseUnivariatePolynomial RealClosure Fraction Integer),"failed")
+--E 30
+
+--S 31 of 67
+[reduce(+,l),reduce(*,l)-2]
+--R 
+--R
+--R   (31)  [0,0]
+--R                                      Type: List RealClosure Fraction Integer
+--E 31
+
+--S 32 of 67
+(s2, s5, s10) := (sqrt(2)$Ran, sqrt(5)$Ran, sqrt(10)$Ran)
+--R 
+--R
+--R          +--+
+--R   (32)  \|10
+--R                                           Type: RealClosure Fraction Integer
+--E 32
+
+--S 33 of 67
+eq1:=sqrt(s10+3)*sqrt(s5+2) - sqrt(s10-3)*sqrt(s5-2) = sqrt(10*s2+10)
+--R 
+--R
+--R            +---------+ +--------+    +---------+ +--------+   +-----------+
+--R            | +--+      | +-+         | +--+      | +-+        |   +-+
+--R   (33)  - \|\|10  - 3 \|\|5  - 2  + \|\|10  + 3 \|\|5  + 2 = \|10\|2  + 10
+--R                                  Type: Equation RealClosure Fraction Integer
+--E 33
+
+--S 34 of 67
+eq1::Boolean
+--R 
+--R
+--R   (34)  true
+--R                                                                Type: Boolean
+--E 34
+
+--S 35 of 67
+eq2:=sqrt(s5+2)*sqrt(s2+1) - sqrt(s5-2)*sqrt(s2-1) = sqrt(2*s10+2)
+--R 
+--R
+--R            +--------+ +--------+    +--------+ +--------+   +----------+
+--R            | +-+      | +-+         | +-+      | +-+        |  +--+
+--R   (35)  - \|\|5  - 2 \|\|2  - 1  + \|\|5  + 2 \|\|2  + 1 = \|2\|10  + 2
+--R                                  Type: Equation RealClosure Fraction Integer
+--E 35
+
+--S 36 of 67
+eq2::Boolean
+--R 
+--R
+--R   (36)  true
+--R                                                                Type: Boolean
+--E 36
+
+--S 37 of 67
+s3 := sqrt(3)$Ran
+--R 
+--R
+--R          +-+
+--R   (37)  \|3
+--R                                           Type: RealClosure Fraction Integer
+--E 37
+
+--S 38 of 67
+s7:= sqrt(7)$Ran
+--R 
+--R
+--R          +-+
+--R   (38)  \|7
+--R                                           Type: RealClosure Fraction Integer
+--E 38
+
+--S 39 of 67
+e1 := sqrt(2*s7-3*s3,3)
+--R 
+--R
+--R          +-------------+
+--R         3|  +-+     +-+
+--R   (39)  \|2\|7  - 3\|3
+--R                                           Type: RealClosure Fraction Integer
+--E 39
+
+--S 40 of 67
+e2 := sqrt(2*s7+3*s3,3)
+--R 
+--R
+--R          +-------------+
+--R         3|  +-+     +-+
+--R   (40)  \|2\|7  + 3\|3
+--R                                           Type: RealClosure Fraction Integer
+--E 40
+
+--S 41 of 67
+e2-e1-s3
+--R 
+--R
+--R   (41)  0
+--R                                           Type: RealClosure Fraction Integer
+--E 41
+
+--S 42 of 67
+pol : UP(x,Ran) := x**4+(7/3)*x**2+30*x-(100/3)
+--R 
+--R
+--R          4   7  2         100
+--R   (42)  x  + - x  + 30x - ---
+--R              3             3
+--R                   Type: UnivariatePolynomial(x,RealClosure Fraction Integer)
+--E 42
+
+--S 43 of 67
+r1 := sqrt(7633)$Ran
+--R 
+--R
+--R          +----+
+--R   (43)  \|7633
+--R                                           Type: RealClosure Fraction Integer
+--E 43
+
+--S 44 of 67
+alpha := sqrt(5*r1-436,3)/3
+--R 
+--R
+--R            +--------------+
+--R         1 3|  +----+
+--R   (44)  - \|5\|7633  - 436
+--R         3
+--R                                           Type: RealClosure Fraction Integer
+--E 44
+
+--S 45 of 67
+beta := -sqrt(5*r1+436,3)/3 
+--R 
+--R
+--R              +--------------+
+--R           1 3|  +----+
+--R   (45)  - - \|5\|7633  + 436
+--R           3
+--R                                           Type: RealClosure Fraction Integer
+--E 45
+
+--S 46 of 67
+pol.(alpha+beta-1/3)
+--R 
+--R
+--R   (46)  0
+--R                                           Type: RealClosure Fraction Integer
+--E 46
+
+--S 47 of 67
+qol : UP(x,Ran) := x**5+10*x**3+20*x+22
+--R 
+--R
+--R          5      3
+--R   (47)  x  + 10x  + 20x + 22
+--R                   Type: UnivariatePolynomial(x,RealClosure Fraction Integer)
+--E 47
+
+--S 48 of 67
+r2 := sqrt(153)$Ran
+--R 
+--R
+--R          +---+
+--R   (48)  \|153
+--R                                           Type: RealClosure Fraction Integer
+--E 48
+
+--S 49 of 67
+alpha2 := sqrt(r2-11,5)
+--R 
+--R
+--R          +-----------+
+--R         5| +---+
+--R   (49)  \|\|153  - 11
+--R                                           Type: RealClosure Fraction Integer
+--E 49
+
+--S 50 of 67
+beta2 := -sqrt(r2+11,5)
+--R 
+--R
+--R            +-----------+
+--R           5| +---+
+--R   (50)  - \|\|153  + 11
+--R                                           Type: RealClosure Fraction Integer
+--E 50
+
+--S 51 of 67
+qol(alpha2+beta2)
+--R 
+--R
+--R   (51)  0
+--R                                           Type: RealClosure Fraction Integer
+--E 51
+
+--S 52 of 67
+dst1:=sqrt(9+4*s2)=1+2*s2
+--R 
+--R
+--R          +---------+
+--R          |  +-+         +-+
+--R   (52)  \|4\|2  + 9 = 2\|2  + 1
+--R                                  Type: Equation RealClosure Fraction Integer
+--E 52
+
+--S 53 of 67
+dst1::Boolean
+--R 
+--R
+--R   (53)  true
+--R                                                                Type: Boolean
+--E 53
+
+--S 54 of 67
+s6:Ran:=sqrt 6
+--R 
+--R
+--R          +-+
+--R   (54)  \|6
+--R                                           Type: RealClosure Fraction Integer
+--E 54
+
+--S 55 of 67
+dst2:=sqrt(5+2*s6)+sqrt(5-2*s6) = 2*s3
+--R 
+--R
+--R          +-----------+    +---------+
+--R          |    +-+         |  +-+         +-+
+--R   (55)  \|- 2\|6  + 5  + \|2\|6  + 5 = 2\|3
+--R                                  Type: Equation RealClosure Fraction Integer
+--E 55
+
+--S 56 of 67
+dst2::Boolean
+--R 
+--R
+--R   (56)  true
+--R                                                                Type: Boolean
+--E 56
+
+--S 57 of 67
+s29:Ran:=sqrt 29
+--R 
+--R
+--R          +--+
+--R   (57)  \|29
+--R                                           Type: RealClosure Fraction Integer
+--E 57
+
+--S 58 of 67
+dst4:=sqrt(16-2*s29+2*sqrt(55-10*s29)) = sqrt(22+2*s5)-sqrt(11+2*s29)+s5
+--R 
+--R
+--R   (58)
+--R    +--------------------------------+
+--R    |  +--------------+                    +-----------+    +----------+
+--R    |  |     +--+           +--+           |  +--+          |  +-+          +-+
+--R   \|2\|- 10\|29  + 55  - 2\|29  + 16 = - \|2\|29  + 11  + \|2\|5  + 22  + \|5
+--R                                  Type: Equation RealClosure Fraction Integer
+--E 58
+
+--S 59 of 67
+dst4::Boolean
+--R 
+--R
+--R   (59)  true
+--R                                                                Type: Boolean
+--E 59
+
+--S 60 of 67
+dst6:=sqrt((112+70*s2)+(46+34*s2)*s5) = (5+4*s2)+(3+s2)*s5 
+--R 
+--R
+--R          +--------------------------------+
+--R          |    +-+       +-+      +-+           +-+      +-+     +-+
+--R   (60)  \|(34\|2  + 46)\|5  + 70\|2  + 112 = (\|2  + 3)\|5  + 4\|2  + 5
+--R                                  Type: Equation RealClosure Fraction Integer
+--E 60
+
+--S 61 of 67
+dst6::Boolean
+--R 
+--R
+--R   (61)  true
+--R                                                                Type: Boolean
+--E 61
+
+--S 62 of 67
+f3:Ran:=sqrt(3,5)
+--R 
+--R
+--R         5+-+
+--R   (62)  \|3
+--R                                           Type: RealClosure Fraction Integer
+--E 62
+
+--S 63 of 67
+f25:Ran:=sqrt(1/25,5)
+--R 
+--R
+--R          +--+
+--R          | 1
+--R   (63)  5|--
+--R         \|25
+--R                                           Type: RealClosure Fraction Integer
+--E 63
+
+--S 64 of 67
+f32:Ran:=sqrt(32/5,5)
+--R 
+--R
+--R          +--+
+--R          |32
+--R   (64)  5|--
+--R         \| 5
+--R                                           Type: RealClosure Fraction Integer
+--E 64
+
+--S 65 of 67
+f27:Ran:=sqrt(27/5,5)
+--R 
+--R
+--R          +--+
+--R          |27
+--R   (65)  5|--
+--R         \| 5
+--R                                           Type: RealClosure Fraction Integer
+--E 65
+
+--S 66 of 67
+dst5:=sqrt((f32-f27,3)) = f25*(1+f3-f3**2)
+--R 
+--R
+--R          +---------------+
+--R          |   +--+    +--+                         +--+
+--R          |   |27     |32       5+-+2   5+-+       | 1
+--R   (66)  3|- 5|--  + 5|--  = (- \|3   + \|3  + 1) 5|--
+--R         \|  \| 5    \| 5                         \|25
+--R                                  Type: Equation RealClosure Fraction Integer
+--E 66
+
+--S 67 of 67
+dst5::Boolean
+--R 
+--R
+--R   (67)  true
+--R                                                                Type: Boolean
+--E 67
+)spool
+)lisp (bye)
+@
+<<RealClosure.help>>=
+====================================================================
+RealClosure examples
+====================================================================
+
+The Real Closure 1.0 package provided by Renaud Rioboo consists of
+different packages, categories and domains :
+
+The package RealPolynomialUtilitiesPackage which needs a Field F and a 
+UnivariatePolynomialCategory domain with coefficients in F. It computes 
+some simple functions such as Sturm and Sylvester sequences sturmSequence,
+sylvesterSequence.
+
+The category RealRootCharacterizationCategory provides abstract
+functions to work with "real roots" of univariate polynomials. These
+resemble variables with some functionality needed to compute important
+operations.
+
+The category RealClosedField provides common operations available over
+real closed fiels. These include finding all the roots of a univariate
+polynomial, taking square (and higher) roots, ...
+
+The domain RightOpenIntervalRootCharacterization is the main code that
+provides the functionality of RealRootCharacterizationCategory for the
+case of archimedean fields. Abstract roots are encoded with a left
+closed right open interval containing the root together with a
+defining polynomial for the root.
+
+The RealClosure domain is the end-user code. It provides usual arithmetic 
+with real algebraic numbers, along with the functionality of a real closed 
+field. It also provides functions to approximate a real algebraic number 
+by an element of the base field. This approximation may either be absolute, 
+approximate or relative (relativeApprox).
+
+====================================================================
+CAVEATS
+====================================================================
+
+Since real algebraic expressions are stored as depending on "real
+roots" which are managed like variables, there is an ordering on
+these. This ordering is dynamical in the sense that any new algebraic
+takes precedence over older ones. In particular every creation
+function raises a new "real root". This has the effect that when you
+type something like sqrt(2) + sqrt(2) you have two new variables
+which happen to be equal. To avoid this name the expression such as in
+s2 := sqrt(2) ; s2 + s2
+
+Also note that computing times depend strongly on the ordering you
+implicitly provide. Please provide algebraics in the order which seems
+most natural to you.
+
+====================================================================
+LIMITATIONS
+====================================================================
+
+This packages uses algorithms which are published in [1] and [2] which
+are based on field arithmetics, in particular for polynomial gcd
+related algorithms. This can be quite slow for high degree polynomials
+and subresultants methods usually work best. Beta versions of the
+package try to use these techniques in a better way and work
+significantly faster. These are mostly based on unpublished algorithms
+and cannot be distributed. Please contact the author if you have a
+particular problem to solve or want to use these versions.
+
+Be aware that approximations behave as post-processing and that all
+computations are done exactly. They can thus be quite time consuming when
+depending on several ``real roots''.
+
+====================================================================
+REFERENCES
+====================================================================
+
+
+[1]  R. Rioboo : Real Algebraic Closure of an ordered Field : Implementation 
+     in Axiom. 
+     In proceedings of the ISSAC'92 Conference, Berkeley 1992 pp. 206-215.
+
+[2]  Z. Ligatsikas, R. Rioboo, M. F. Roy : Generic computation of the real
+     closure of an ordered field.
+     In Mathematics and Computers in Simulation Volume 42, Issue 4-6,
+     November 1996.
+
+====================================================================
+EXAMPLES
+====================================================================
+
+We shall work with the real closure of the ordered field of 
+rational numbers.
+
+  Ran := RECLOS(FRAC INT)
+    RealClosure Fraction Integer
+                              Type: Domain
+
+Some simple signs for square roots, these correspond to an extension
+of degree 16 of the rational numbers. Examples provided by J. Abbot.
+
+  fourSquares(a:Ran,b:Ran,c:Ran,d:Ran):Ran==sqrt(a)+sqrt(b)-sqrt(c)-sqrt(d)
+                              Type: Void
+
+These produce values very close to zero.
+
+  squareDiff1 := fourSquares(73,548,60,586)
+       +---+    +--+    +---+    +--+
+    - \|586  - \|60  + \|548  + \|73
+                              Type: RealClosure Fraction Integer
+
+  recip(squareDiff1)
+             +---+          +--+  +--+         +--+ +---+            +---+
+     ((54602\|548  + 149602\|73 )\|60  + 49502\|73 \|548  + 9900895)\|586
+   + 
+             +--+ +---+             +--+            +---+            +--+
+     (154702\|73 \|548  + 30941947)\|60  + 10238421\|548  + 28051871\|73
+                              Type: Union(RealClosure Fraction Integer,...)
+
+  sign(squareDiff1)
+    1
+                              Type: PositiveInteger
+
+  squareDiff2 := fourSquares(165,778,86,990)
+       +---+    +--+    +---+    +---+
+    - \|990  - \|86  + \|778  + \|165
+                              Type: RealClosure Fraction Integer
+
+  recip(squareDiff2)
+                +---+           +---+  +--+          +---+ +---+
+       ((556778\|778  + 1209010\|165 )\|86  + 401966\|165 \|778  + 144019431)
+    *
+        +---+
+       \|990
+   + 
+              +---+ +---+              +--+             +---+             +---+
+     (1363822\|165 \|778  + 488640503)\|86  + 162460913\|778  + 352774119\|165
+                              Type: Union(RealClosure Fraction Integer,...)
+
+  sign(squareDiff2)
+    1
+                              Type: PositiveInteger
+
+  squareDiff3 := fourSquares(217,708,226,692)
+       +---+    +---+    +---+    +---+
+    - \|692  - \|226  + \|708  + \|217
+                              Type: RealClosure Fraction Integer
+
+  recip(squareDiff3)
+               +---+         +---+  +---+         +---+ +---+             +---+
+     ((- 34102\|708  - 61598\|217 )\|226  - 34802\|217 \|708  - 13641141)\|692
+   + 
+              +---+ +---+             +---+            +---+            +---+
+     (- 60898\|217 \|708  - 23869841)\|226  - 13486123\|708  - 24359809\|217
+                              Type: Union(RealClosure Fraction Integer,...)
+
+  sign(squareDiff3)
+    - 1
+                              Type: Integer
+
+  squareDiff4 := fourSquares(155,836,162,820)
+       +---+    +---+    +---+    +---+
+    - \|820  - \|162  + \|836  + \|155
+                              Type: RealClosure Fraction Integer
+
+  recip(squareDiff4)
+               +---+         +---+  +---+         +---+ +---+             +---+
+     ((- 37078\|836  - 86110\|155 )\|162  - 37906\|155 \|836  - 13645107)\|820
+   + 
+              +---+ +---+             +---+            +---+            +---+
+     (- 85282\|155 \|836  - 30699151)\|162  - 13513901\|836  - 31384703\|155
+                              Type: Union(RealClosure Fraction Integer,...)
+
+  sign(squareDiff4)
+    - 1
+                              Type: Integer
+
+  squareDiff5 := fourSquares(591,772,552,818)
+       +---+    +---+    +---+    +---+
+    - \|818  - \|552  + \|772  + \|591
+                              Type: RealClosure Fraction Integer
+
+  recip(squareDiff5)
+             +---+         +---+  +---+         +---+ +---+             +---+
+     ((70922\|772  + 81058\|591 )\|552  + 68542\|591 \|772  + 46297673)\|818
+   + 
+            +---+ +---+             +---+            +---+            +---+
+     (83438\|591 \|772  + 56359389)\|552  + 47657051\|772  + 54468081\|591
+                              Type: Union(RealClosure Fraction Integer,...)
+
+  sign(squareDiff5)
+    1
+                              Type: PositiveInteger
+
+  squareDiff6 := fourSquares(434,1053,412,1088)
+       +----+    +---+    +----+    +---+
+    - \|1088  - \|412  + \|1053  + \|434
+                              Type: RealClosure Fraction Integer
+
+  recip(squareDiff6)
+                +----+          +---+  +---+          +---+ +----+
+       ((115442\|1053  + 179818\|434 )\|412  + 112478\|434 \|1053  + 76037291)
+    *
+        +----+
+       \|1088
+   + 
+           +---+ +----+              +---+            +----+             +---+
+   (182782\|434 \|1053  + 123564147)\|412  + 77290639\|1053  + 120391609\|434
+                             Type: Union(RealClosure Fraction Integer,...)
+
+  sign(squareDiff6)
+    1
+                             Type: PositiveInteger
+
+  squareDiff7 := fourSquares(514,1049,446,1152)
+       +----+    +---+    +----+    +---+
+    - \|1152  - \|446  + \|1049  + \|514
+                             Type: RealClosure Fraction Integer
+
+  recip(squareDiff7)
+                +----+          +---+  +---+          +---+ +----+
+       ((349522\|1049  + 499322\|514 )\|446  + 325582\|514 \|1049  + 239072537)
+    *
+        +----+
+       \|1152
+   + 
+           +---+ +----+              +---+             +----+             +---+
+   (523262\|514 \|1049  + 384227549)\|446  + 250534873\|1049  + 357910443\|514
+                             Type: Union(RealClosure Fraction Integer,...)
+
+  sign(squareDiff7)
+    1
+                             Type: PositiveInteger
+
+  squareDiff8 := fourSquares(190,1751,208,1698)
+       +----+    +---+    +----+    +---+
+    - \|1698  - \|208  + \|1751  + \|190
+                             Type: RealClosure Fraction Integer
+
+  recip(squareDiff8)
+                     +----+          +---+  +---+          +---+ +----+
+           (- 214702\|1751  - 651782\|190 )\|208  - 224642\|190 \|1751
+         + 
+           - 129571901
+    *
+        +----+
+       \|1698
+   + 
+               +---+ +----+              +---+             +----+
+     (- 641842\|190 \|1751  - 370209881)\|208  - 127595865\|1751
+   + 
+                 +---+
+     - 387349387\|190
+                            Type: Union(RealClosure Fraction Integer,...)
+
+  sign(squareDiff8)
+    - 1
+                            Type: Integer
+
+This should give three digits of precision
+
+  relativeApprox(squareDiff8,10**(-3))::Float
+    - 0.2340527771 5937700123 E -10
+                            Type: Float
+
+The sum of these 4 roots is 0
+
+  l := allRootsOf((x**2-2)**2-2)$Ran
+    [%A33,%A34,%A35,%A36]
+                            Type: List RealClosure Fraction Integer
+
+Check that they are all roots of the same polynomial
+
+  removeDuplicates map(mainDefiningPolynomial,l)
+      4     2
+    [?  - 4?  + 2]
+       Type: List Union(
+                   SparseUnivariatePolynomial RealClosure Fraction Integer,
+                   "failed")
+
+We can see at a glance that they are separate roots
+
+  map(mainCharacterization,l)
+    [[- 2,- 1[,[- 1,0[,[0,1[,[1,2[]
+       Type: List Union(
+              RightOpenIntervalRootCharacterization(
+               RealClosure Fraction Integer,
+               SparseUnivariatePolynomial RealClosure Fraction Integer),
+              "failed")
+
+Check the sum and product
+
+  [reduce(+,l),reduce(*,l)-2]
+    [0,0]
+                    Type: List RealClosure Fraction Integer
+
+A more complicated test that involve an extension of degree 256.
+This is a way of checking nested radical identities.
+
+  (s2, s5, s10) := (sqrt(2)$Ran, sqrt(5)$Ran, sqrt(10)$Ran)
+     +--+
+    \|10
+                    Type: RealClosure Fraction Integer
+
+  eq1:=sqrt(s10+3)*sqrt(s5+2) - sqrt(s10-3)*sqrt(s5-2) = sqrt(10*s2+10)
+       +---------+ +--------+    +---------+ +--------+   +-----------+
+       | +--+      | +-+         | +--+      | +-+        |   +-+
+    - \|\|10  - 3 \|\|5  - 2  + \|\|10  + 3 \|\|5  + 2 = \|10\|2  + 10
+                    Type: Equation RealClosure Fraction Integer
+
+  eq1::Boolean
+    true
+                    Type: Boolean
+
+  eq2:=sqrt(s5+2)*sqrt(s2+1) - sqrt(s5-2)*sqrt(s2-1) = sqrt(2*s10+2)
+       +--------+ +--------+    +--------+ +--------+   +----------+
+       | +-+      | +-+         | +-+      | +-+        |  +--+
+    - \|\|5  - 2 \|\|2  - 1  + \|\|5  + 2 \|\|2  + 1 = \|2\|10  + 2
+                    Type: Equation RealClosure Fraction Integer
+
+  eq2::Boolean
+    true
+                    Type: Boolean
+
+Some more examples from J. M. Arnaudies
+
+  s3 := sqrt(3)$Ran
+     +-+
+    \|3
+                    Type: RealClosure Fraction Integer
+
+  s7:= sqrt(7)$Ran
+     +-+
+    \|7
+                    Type: RealClosure Fraction Integer
+
+  e1 := sqrt(2*s7-3*s3,3)
+     +-------------+
+    3|  +-+     +-+
+    \|2\|7  - 3\|3
+                    Type: RealClosure Fraction Integer
+
+  e2 := sqrt(2*s7+3*s3,3)
+     +-------------+
+    3|  +-+     +-+
+    \|2\|7  + 3\|3
+                    Type: RealClosure Fraction Integer
+
+This should be null
+
+  e2-e1-s3
+    0
+                    Type: RealClosure Fraction Integer
+
+A quartic polynomial
+
+  pol : UP(x,Ran) := x**4+(7/3)*x**2+30*x-(100/3)
+     4   7  2         100
+    x  + - x  + 30x - ---
+         3             3
+                  Type: UnivariatePolynomial(x,RealClosure Fraction Integer)
+
+Add some cubic roots
+
+  r1 := sqrt(7633)$Ran
+     +----+
+    \|7633
+                        Type: RealClosure Fraction Integer
+
+  alpha := sqrt(5*r1-436,3)/3
+       +--------------+
+    1 3|  +----+
+    - \|5\|7633  - 436
+    3
+                        Type: RealClosure Fraction Integer
+
+  beta := -sqrt(5*r1+436,3)/3 
+         +--------------+
+      1 3|  +----+
+    - - \|5\|7633  + 436
+      3
+                        Type: RealClosure Fraction Integer
+
+this should be null
+
+  pol.(alpha+beta-1/3)
+    0
+                        Type: RealClosure Fraction Integer
+
+A quintic polynomial
+
+  qol : UP(x,Ran) := x**5+10*x**3+20*x+22
+     5      3
+    x  + 10x  + 20x + 22
+              Type: UnivariatePolynomial(x,RealClosure Fraction Integer)
+
+Add some cubic roots
+
+  r2 := sqrt(153)$Ran
+     +---+
+    \|153
+                          Type: RealClosure Fraction Integer
+
+  alpha2 := sqrt(r2-11,5)
+     +-----------+
+    5| +---+
+    \|\|153  - 11
+                          Type: RealClosure Fraction Integer
+
+  beta2 := -sqrt(r2+11,5)
+       +-----------+
+      5| +---+
+    - \|\|153  + 11
+                          Type: RealClosure Fraction Integer
+
+this should be null
+
+  qol(alpha2+beta2)
+    0
+                          Type: RealClosure Fraction Integer
+
+Finally, some examples from the book Computer Algebra by Davenport,
+Siret and Tournier (page 77).  The last one is due to Ramanujan.
+
+  dst1:=sqrt(9+4*s2)=1+2*s2
+     +---------+
+     |  +-+         +-+
+    \|4\|2  + 9 = 2\|2  + 1
+                          Type: Equation RealClosure Fraction Integer
+
+  dst1::Boolean
+    true
+                          Type: Boolean
+
+  s6:Ran:=sqrt 6
+     +-+
+    \|6
+                          Type: RealClosure Fraction Integer
+
+  dst2:=sqrt(5+2*s6)+sqrt(5-2*s6) = 2*s3
+     +-----------+    +---------+
+     |    +-+         |  +-+         +-+
+    \|- 2\|6  + 5  + \|2\|6  + 5 = 2\|3
+                          Type: Equation RealClosure Fraction Integer
+
+  dst2::Boolean
+    true
+                          Type: Boolean
+
+  s29:Ran:=sqrt 29
+     +--+
+    \|29
+                          Type: RealClosure Fraction Integer
+
+  dst4:=sqrt(16-2*s29+2*sqrt(55-10*s29)) = sqrt(22+2*s5)-sqrt(11+2*s29)+s5
+    +--------------------------------+
+    |  +--------------+                    +-----------+    +----------+
+    |  |     +--+           +--+           |  +--+          |  +-+          +-+
+   \|2\|- 10\|29  + 55  - 2\|29  + 16 = - \|2\|29  + 11  + \|2\|5  + 22  + \|5
+                          Type: Equation RealClosure Fraction Integer
+
+  dst4::Boolean
+    true
+                          Type: Boolean
+
+  dst6:=sqrt((112+70*s2)+(46+34*s2)*s5) = (5+4*s2)+(3+s2)*s5 
+     +--------------------------------+
+     |    +-+       +-+      +-+           +-+      +-+     +-+
+    \|(34\|2  + 46)\|5  + 70\|2  + 112 = (\|2  + 3)\|5  + 4\|2  + 5
+                          Type: Equation RealClosure Fraction Integer
+
+  dst6::Boolean
+    true
+                          Type: Boolean
+
+  f3:Ran:=sqrt(3,5)
+    5+-+
+    \|3
+                          Type: RealClosure Fraction Integer
+
+  f25:Ran:=sqrt(1/25,5)
+     +--+
+     | 1
+    5|--
+    \|25
+                          Type: RealClosure Fraction Integer
+
+  f32:Ran:=sqrt(32/5,5)
+     +--+
+     |32
+    5|--
+    \| 5
+                          Type: RealClosure Fraction Integer
+
+  f27:Ran:=sqrt(27/5,5)
+     +--+
+     |27
+    5|--
+    \| 5
+                          Type: RealClosure Fraction Integer
+
+  dst5:=sqrt((f32-f27,3)) = f25*(1+f3-f3**2)
+     +---------------+
+     |   +--+    +--+                         +--+
+     |   |27     |32       5+-+2   5+-+       | 1
+    3|- 5|--  + 5|--  = (- \|3   + \|3  + 1) 5|--
+    \|  \| 5    \| 5                         \|25
+                          Type: Equation RealClosure Fraction Integer
+
+  dst5::Boolean
+    true
+                          Type: Boolean
+
+See Also:
+o )help RightOpenIntervalRootCharacterization
+o )help RealClosedField
+o )help RealRootCharacterizationCategory
+o )help UnivariatePolynomialCategory
+o )help Field
+o )help RealPolynomialUtilitiesPackage
+o )show RealClosure
+o $AXIOM/doc/src/algebra/reclos.spad.dvi
+
+@
+\pagehead{RealClosure}{RECLOS}
+\pagepic{ps/v103realclosure.ps}{RECLOS}{1.00}
+<<domain RECLOS RealClosure>>=
+)abbrev domain RECLOS RealClosure
+++ Author: Renaud Rioboo
+++ Date Created: summer 1988
+++ Date Last Updated: January 2004
+++ Basic Functions: provides computations in an ordered real closure
+++ Related Constructors: RightOpenIntervalRootCharacterization
+++ Also See:
+++ AMS Classifications:
+++ Keywords: Real Algebraic Numbers
+++ References: 
+++ Description:
+++ This domain implements the real closure of an ordered field.
+++ Note: 
+++ The code here is generic i.e. it does not depend of the way the operations
+++ are done. The two macros PME and SEG should be passed as functorial
+++ arguments to the domain. It does not help much to write a category
+++ since non trivial methods cannot be placed there either.
+++ 
+RealClosure(TheField): PUB == PRIV where
+
+   TheField   : Join(OrderedRing, Field, RealConstant)
+
+--   ThePols    : UnivariatePolynomialCategory($)
+--   PME       ==> ThePols
+--   TheCharDom : RealRootCharacterizationCategory($, ThePols )
+--   SEG       ==> TheCharDom
+-- this does not work yet
+
+   E         ==> OutputForm
+   Z         ==> Integer
+   SE        ==> Symbol
+   B         ==> Boolean
+   SUP       ==> SparseUnivariatePolynomial($)
+   N         ==> PositiveInteger
+   RN        ==> Fraction Z
+   LF        ==> ListFunctions2($,N)
+
+-- *****************************************************************
+-- *****************************************************************
+--             PUT YOUR OWN PREFERENCE HERE
+-- *****************************************************************
+-- *****************************************************************
+   PME       ==> SparseUnivariatePolynomial($)
+   SEG       ==> RightOpenIntervalRootCharacterization($,PME)
+-- *****************************************************************
+-- *****************************************************************
+
+
+   PUB == Join(RealClosedField,
+               FullyRetractableTo TheField,
+               Algebra TheField) with
+
+       algebraicOf :   (SEG,E) -> $
+             ++ \axiom{algebraicOf(char)} is the external number
+
+       mainCharacterization :   $ -> Union(SEG,"failed")
+             ++ \axiom{mainCharacterization(x)} is the main algebraic 
+             ++ quantity of \axiom{x} (\axiom{SEG})
+
+       relativeApprox :     ($,$) -> RN
+             ++ \axiom{relativeApprox(n,p)} gives a relative 
+             ++ approximation of \axiom{n} 
+             ++ that has precision \axiom{p}
+
+   PRIV == add
+
+-- local functions
+
+       lessAlgebraic  : $ -> $
+       newElementIfneeded : (SEG,E) -> $
+
+-- Representation
+
+       Rec := Record(seg: SEG, val:PME, outForm:E, order:N)
+       Rep := Union(TheField,Rec)
+
+-- global (mutable) variables
+
+       orderOfCreation : N := 1$N
+          -- it is internally used to sort the algebraic levels
+
+       instanceName : Symbol := new()$Symbol
+          -- this used to print the results, thus different instanciations
+          -- use different names
+
+-- now the code
+
+       relativeApprox(nbe,prec) ==
+          nbe case TheField => retract(nbe)
+          appr := relativeApprox(nbe.val, nbe.seg, prec)
+          -- now appr has the good exact precision but is $
+          relativeApprox(appr,prec)
+
+
+       approximate(nbe,prec) ==
+          abs(nbe) < prec => 0
+          nbe case TheField => retract(nbe)
+          appr := approximate(nbe.val, nbe.seg, prec)
+          -- now appr has the good exact precision but is $
+          approximate(appr,prec)
+
+       newElementIfneeded(s,o) ==
+         p := definingPolynomial(s)
+         degree(p) = 1 => 
+             - coefficient(p,0) / leadingCoefficient(p)
+         res := [s, monomial(1,1), o, orderOfCreation ]$Rec
+         orderOfCreation := orderOfCreation + 1
+         res :: $
+
+       algebraicOf(s,o) ==
+         pol := definingPolynomial(s)
+         degree(pol) = 1 => 
+           -coefficient(pol,0) / leadingCoefficient(pol) 
+         res := [s, monomial(1,1), o, orderOfCreation ]$Rec
+         orderOfCreation := orderOfCreation + 1
+         res :: $
+         
+       rename!(x,o) ==
+         x.outForm := o
+         x
+
+       rename(x,o) ==
+         [x.seg, x.val, o, x.order]$Rec
+
+       rootOf(pol,n) ==
+        degree(pol) = 0 => "failed"
+        degree(pol) = 1 =>
+          if n=1
+          then
+            -coefficient(pol,0) / leadingCoefficient(pol)
+          else
+            "failed"
+        r := rootOf(pol,n)$SEG
+        r case "failed" => "failed"
+        o := hconcat(instanceName :: E , orderOfCreation :: E)$E
+        algebraicOf(r,o)
+
+       allRootsOf(pol:SUP):List($) == 
+        degree(pol)=0 => []
+        degree(pol)=1 => [-coefficient(pol,0) / leadingCoefficient(pol)]
+        liste := allRootsOf(pol)$SEG
+        res : List $ := []
+        for term in liste repeat
+           o := hconcat(instanceName :: E , orderOfCreation :: E)$E
+           res := cons(algebraicOf(term,o), res)
+        reverse! res
+
+       coerce(x:$):$ ==
+          x case TheField => x
+          [x.seg,x.val rem$PME definingPolynomial(x.seg),x.outForm,x.order]$Rec
+
+       positive?(x) == 
+          x case TheField => positive?(x)$TheField
+          positive?(x.val,x.seg)$SEG
+
+       negative?(x) == 
+          x case TheField => negative?(x)$TheField
+          negative?(x.val,x.seg)$SEG
+
+       abs(x) == sign(x)*x
+
+       sign(x) ==
+          x case TheField => sign(x)$TheField
+          sign(x.val,x.seg)$SEG
+
+       x < y == positive?(y-x)
+
+       x = y == zero?(x-y)
+
+       mainCharacterization(x) ==
+          x case TheField => "failed"
+          x.seg
+
+       mainDefiningPolynomial(x) ==
+          x case TheField => "failed"
+          definingPolynomial x.seg
+
+       mainForm(x) ==
+          x case TheField => "failed"
+          x.outForm
+
+       mainValue(x) ==
+          x case TheField => "failed"
+          x.val
+
+       coerce(x:$):E ==
+          x case TheField => x::TheField :: E
+          xx:$ := coerce(x)
+          outputForm(univariate(xx.val),x.outForm)$SUP
+
+
+       inv(x) ==
+          (res:= recip x) case "failed" => error "Division by 0"
+          res :: $
+
+       recip(x) ==
+         x case TheField =>
+           if ((r := recip(x)$TheField) case TheField)
+           then r::$
+           else "failed"
+         if ((r := recip(x.val,x.seg)$SEG) case "failed")
+         then "failed"
+         else lessAlgebraic([x.seg,r::PME,x.outForm,x.order]$Rec) 
+
+       (n:Z * x:$):$ == 
+          x case TheField => n *$TheField x
+          zero?(n) => 0
+          one?(n) => x
+          [x.seg,map(n * #1, x.val),x.outForm,x.order]$Rec
+
+       (rn:TheField * x:$):$ == 
+          x case TheField => rn *$TheField x
+          zero?(rn) => 0
+          one?(rn) => x
+          [x.seg,map(rn * #1, x.val),x.outForm,x.order]$Rec
+
+       (x:$ * y:$):$ ==
+          (x case TheField) and (y case TheField) => x *$TheField y
+          (x case TheField) => x::TheField * y
+              -- x is no longer TheField
+          (y case TheField) => y::TheField * x
+              -- now both are algebraic
+          y.order > x.order => 
+            [y.seg,map(x * #1 , y.val),y.outForm,y.order]$Rec
+          x.order > y.order => 
+            [x.seg,map( #1 * y , x.val),x.outForm,x.order]$Rec
+              -- now x.exp = y.exp
+              -- we will multiply the polynomials and then reduce
+              -- however wee need to call lessAlgebraic  
+          lessAlgebraic([x.seg,
+                         (x.val * y.val) rem definingPolynomial(x.seg),
+                         x.outForm,
+                         x.order]$Rec)
+
+       nonNull(rep:Rec):$ ==
+         degree(rep.val)=0 => leadingCoefficient(rep.val)
+         numberOfMonomials(rep.val) = 1 => rep
+         zero?(rep.val,rep.seg)$SEG => 0
+         rep
+
+--       zero?(x) ==
+--          x case TheField => zero?(x)$TheField
+--          zero?(x.val,x.seg)$SEG
+ 
+       zero?(x) ==
+          x case TheField => zero?(x)$TheField
+          false
+ 
+       x + y ==
+          (x case TheField) and (y case TheField) => x +$TheField y
+          (x case TheField) => 
+             if zero?(x)
+             then 
+               y
+             else 
+               nonNull([y.seg,x::PME+(y.val),y.outForm,y.order]$Rec)
+             -- x is no longer TheField
+          (y case TheField) => 
+             if zero?(y)
+             then 
+               x
+             else 
+               nonNull([x.seg,(x.val)+y::PME,x.outForm,x.order]$Rec)
+             -- now both are algebraic
+          y.order > x.order => 
+               nonNull([y.seg,x::PME+y.val,y.outForm,y.order]$Rec)
+          x.order > y.order => 
+               nonNull([x.seg,(x.val)+y::PME,x.outForm,x.order]$Rec)
+              -- now x.exp = y.exp 
+              -- we simply add polynomials (since degree cannot increase)
+              -- however wee need to call lessAlgebraic  
+          nonNull([x.seg,x.val + y.val,x.outForm,x.order])
+
+
+       -x ==
+          x case TheField => -$TheField (x::TheField)
+          [x.seg,-$PME x.val,x.outForm,x.order]$Rec
+
+
+       retractIfCan(x:$):Union(TheField,"failed") ==
+          x case TheField => x
+          o := x.order
+          res := lessAlgebraic x
+          res case TheField => res
+          o = res.order => "failed"
+          retractIfCan res
+
+       retract(x:$):TheField ==
+          x case TheField => x
+          o := x.order
+          res := lessAlgebraic x
+          res case TheField => res
+          o = res.order => error "Can't retract"
+          retract res
+
+
+       lessAlgebraic(x) ==
+          x case TheField => x
+          degree(x.val) = 0 => leadingCoefficient(x.val)
+          def := definingPolynomial(x.seg)
+          degree(def) = 1 => 
+            x.val.(- coefficient(def,0) / leadingCoefficient(def))
+          x
+
+       0 == (0$TheField) :: $
+
+       1 == (1$TheField) :: $
+
+       coerce(rn:TheField):$ == rn :: $
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \section{domain RMATRIX RectangularMatrix}
 \pagehead{RectangularMatrix}{RMATRIX}
 \pagepic{ps/v103rectangularmatrix.ps}{RMATRIX}{1.00}
@@ -51957,6 +55297,1832 @@ Reference(S:Type): Type with
 
 @
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain REGSET RegularTriangularSet}
+Several domain constructors implement regular triangular sets (or regular
+chains). Among them {\bf RegularTriangularSet} and 
+{\bf SquareFreeRegularTriangularSet}. They also implement an algorithm
+by Marc Moreno Maza for computing triangular decompositions of polynomial
+systems. This method is refined in the package {\bf LazardSetSolvingPackage}
+in order to produce decompositions by means of Lazard triangular sets.
+<<RegularTriangularSet.input>>=
+-- regset.spad.pamphlet RegularTriangularSet.input
+)spool RegularTriangularSet.output
+)set message test on
+)set message auto off
+)clear all
+--S 1 of 34
+R := Integer
+--R 
+--R
+--R   (1)  Integer
+--R                                                                 Type: Domain
+--E 1
+
+--S 2 of 34
+ls : List Symbol := [x,y,z,t]
+--R 
+--R
+--R   (2)  [x,y,z,t]
+--R                                                            Type: List Symbol
+--E 2
+
+--S 3 of 34
+V := OVAR(ls)
+--R 
+--R
+--R   (3)  OrderedVariableList [x,y,z,t]
+--R                                                                 Type: Domain
+--E 3
+
+--S 4 of 34
+E := IndexedExponents V
+--R 
+--R
+--R   (4)  IndexedExponents OrderedVariableList [x,y,z,t]
+--R                                                                 Type: Domain
+--E 4
+
+--S 5 of 34
+P := NSMP(R, V)
+--R 
+--R
+--R   (5)  NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
+--R                                                                 Type: Domain
+--E 5
+
+--S 6 of 34
+x: P := 'x
+--R 
+--R
+--R   (6)  x
+--R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
+--E 6
+
+--S 7 of 34
+y: P := 'y
+--R 
+--R
+--R   (7)  y
+--R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
+--E 7
+
+--S 8 of 34
+z: P := 'z
+--R 
+--R
+--R   (8)  z
+--R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
+--E 8
+
+--S 9 of 34
+t: P := 't
+--R 
+--R
+--R   (9)  t
+--R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
+--E 9
+
+--S 10 of 34
+T := REGSET(R,E,V,P)
+--R 
+--R
+--R   (10)
+--R  RegularTriangularSet(Integer,IndexedExponents OrderedVariableList [x,y,z,t],O
+--R  rderedVariableList [x,y,z,t],NewSparseMultivariatePolynomial(Integer,OrderedV
+--R  ariableList [x,y,z,t]))
+--R                                                                 Type: Domain
+--E 10
+
+--S 11 of 34
+p1 := x ** 31 - x ** 6 - x - y 
+--R 
+--R
+--R          31    6
+--R   (11)  x   - x  - x - y
+--R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
+--E 11
+
+--S 12 of 34
+p2 := x ** 8  - z 
+--R 
+--R
+--R          8
+--R   (12)  x  - z
+--R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
+--E 12
+
+--S 13 of 34
+p3 := x ** 10 - t 
+--R 
+--R
+--R          10
+--R   (13)  x   - t
+--R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
+--E 13
+
+--S 14 of 34
+lp := [p1, p2, p3]
+--R 
+--R
+--R           31    6          8      10
+--R   (14)  [x   - x  - x - y,x  - z,x   - t]
+--RType: List NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
+--E 14
+
+--S 15 of 34
+zeroSetSplit(lp)$T
+--R 
+--R
+--R            5    4      2     3     8     5    3    2   4                2
+--R   (15)  [{z  - t ,t z y  + 2z y - t  + 2t  + t  - t ,(t  - t)x - t y - z }]
+--RType: List RegularTriangularSet(Integer,IndexedExponents OrderedVariableList [x,y,z,t],OrderedVariableList [x,y,z,t],NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t]))
+--E 15
+
+--S 16 of 34
+lts := zeroSetSplit(lp,false)$T
+--R 
+--R
+--R   (16)
+--R      5    4      2     3     8     5    3    2   4                2
+--R   [{z  - t ,t z y  + 2z y - t  + 2t  + t  - t ,(t  - t)x - t y - z },
+--R      3      5          2     3         2
+--R    {t  - 1,z  - t,t z y  + 2z y + 1,z x  - t}, {t,z,y,x}]
+--RType: List RegularTriangularSet(Integer,IndexedExponents OrderedVariableList [x,y,z,t],OrderedVariableList [x,y,z,t],NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t]))
+--E 16
+
+--S 17 of 34
+[coHeight(ts) for ts in lts]
+--R 
+--R
+--R   (17)  [1,0,0]
+--R                                                Type: List NonNegativeInteger
+--E 17
+
+--S 18 of 34
+f1 := y**2*z+2*x*y*t-2*x-z
+--R 
+--R
+--R                          2
+--R   (18)  (2t y - 2)x + z y  - z
+--R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
+--E 18
+
+--S 19 of 34
+f2:=-x**3*z+ 4*x*y**2*z+4*x**2*y*t+2*y**3*t+4*x**2-10*y**2+4*x*z-10*y*t+2
+--R 
+--R
+--R              3              2        2              3      2
+--R   (19)  - z x  + (4t y + 4)x  + (4z y  + 4z)x + 2t y  - 10y  - 10t y + 2
+--R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
+--E 19
+
+--S 20 of 34
+f3 :=  2*y*z*t+x*t**2-x-2*z 
+--R 
+--R
+--R           2
+--R   (20)  (t  - 1)x + 2t z y - 2z
+--R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
+--E 20
+
+--S 21 of 34
+f4:=-x*z**3+4*y*z**2*t+4*x*z*t**2+2*y*t**3+4*x*z+4*z**2-10*y*t- 10*t**2+2
+--R 
+--R
+--R             3      2                2     3             2      2
+--R   (21)  (- z  + (4t  + 4)z)x + (4t z  + 2t  - 10t)y + 4z  - 10t  + 2
+--R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
+--E 21
+
+--S 22 of 34
+lf := [f1, f2, f3, f4]
+--R 
+--R
+--R   (22)
+--R                     2
+--R   [(2t y - 2)x + z y  - z,
+--R         3              2        2              3      2
+--R    - z x  + (4t y + 4)x  + (4z y  + 4z)x + 2t y  - 10y  - 10t y + 2,
+--R      2
+--R    (t  - 1)x + 2t z y - 2z,
+--R        3      2                2     3             2      2
+--R    (- z  + (4t  + 4)z)x + (4t z  + 2t  - 10t)y + 4z  - 10t  + 2]
+--RType: List NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
+--E 22
+
+--S 23 of 34
+zeroSetSplit(lf)$T
+--R 
+--R
+--R   (23)
+--R      2      8      6       2                 3            2
+--R   [{t  - 1,z  - 16z  + 256z  - 256,t y - 1,(z  - 8z)x - 8z  + 16},
+--R       2      2     2
+--R    {3t  + 1,z  - 7t  - 1,y + t,x + z},
+--R      8      6      2         3            2
+--R    {t  - 10t  + 10t  - 1,z,(t  - 5t)y - 5t  + 1,x},
+--R      2      2
+--R    {t  + 3,z  - 4,y + t,x - z}]
+--RType: List RegularTriangularSet(Integer,IndexedExponents OrderedVariableList [x,y,z,t],OrderedVariableList [x,y,z,t],NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t]))
+--E 23
+
+--S 24 of 34
+lts2 := zeroSetSplit(lf,false)$T
+--R 
+--R
+--R   (24)
+--R      8      6      2         3            2
+--R   [{t  - 10t  + 10t  - 1,z,(t  - 5t)y - 5t  + 1,x},
+--R      2      8      6       2                 3            2
+--R    {t  - 1,z  - 16z  + 256z  - 256,t y - 1,(z  - 8z)x - 8z  + 16},
+--R       2      2     2                     2      2
+--R    {3t  + 1,z  - 7t  - 1,y + t,x + z}, {t  + 3,z  - 4,y + t,x - z}]
+--RType: List RegularTriangularSet(Integer,IndexedExponents OrderedVariableList [x,y,z,t],OrderedVariableList [x,y,z,t],NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t]))
+--E 24
+
+--S 25 of 34
+[coHeight(ts) for ts in lts2]
+--R 
+--R
+--R   (25)  [0,0,0,0]
+--R                                                Type: List NonNegativeInteger
+--E 25
+
+--S 26 of 34
+degrees := [degree(ts) for ts in lts2]
+--R 
+--R
+--R   (26)  [8,16,4,4]
+--R                                                Type: List NonNegativeInteger
+--E 26
+
+--S 27 of 34
+reduce(+,degrees)
+--R 
+--R
+--R   (27)  32
+--R                                                        Type: PositiveInteger
+--E 27
+
+--S 28 of 34
+u : R := 2 
+--R 
+--R
+--R   (28)  2
+--R                                                                Type: Integer
+--E 28
+
+--S 29 of 34
+q1 := 2*(u-1)**2+ 2*(x-z*x+z**2)+ y**2*(x-1)**2- 2*u*x+ 2*y*t*(1-x)*(x-z)+_
+      2*u*z*t*(t-y)+ u**2*t**2*(1-2*z)+ 2*u*t**2*(z-x)+ 2*u*t*y*(z-1)+_
+      2*u*z*x*(y+1)+ (u**2-2*u)*z**2*t**2+ 2*u**2*z**2+ 4*u*(1-u)*z+_
+      t**2*(z-x)**2
+--R 
+--R
+--R   (29)
+--R       2           2  2        2                            2           2
+--R     (y  - 2t y + t )x  + (- 2y  + ((2t + 4)z + 2t)y + (- 2t  + 2)z - 4t  - 2)x
+--R   + 
+--R      2                      2       2          2
+--R     y  + (- 2t z - 4t)y + (t  + 10)z  - 8z + 4t  + 2
+--R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
+--E 29
+
+--S 30 of 34
+q2 := t*(2*z+1)*(x-z)+ y*(z+2)*(1-x)+ u*(u-2)*t+ u*(1-2*u)*z*t+_
+      u*y*(x+u-z*x-1)+ u*(u+1)*z**2*t
+--R 
+--R
+--R                                               2
+--R   (30)  (- 3z y + 2t z + t)x + (z + 4)y + 4t z  - 7t z
+--R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
+--E 30
+
+--S 31 of 34
+q3 := -u**2*(z-1)**2+ 2*z*(z-x)-2*(x-1)
+--R 
+--R
+--R                         2
+--R   (31)  (- 2z - 2)x - 2z  + 8z - 2
+--R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
+--E 31
+
+--S 32 of 34
+q4 := u**2+4*(z-x**2)+3*y**2*(x-1)**2- 3*t**2*(z-x)**2+_
+      3*u**2*t**2*(z-1)**2+u**2*z*(z-2)+6*u*t*y*(z+x+z*x-1)
+--R 
+--R
+--R   (32)
+--R        2     2      2        2                      2        2
+--R     (3y  - 3t  - 4)x  + (- 6y  + (12t z + 12t)y + 6t z)x + 3y  + (12t z - 12t)y
+--R   + 
+--R        2      2         2            2
+--R     (9t  + 4)z  + (- 24t  - 4)z + 12t  + 4
+--R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
+--E 32
+
+--S 33 of 34
+lq := [q1, q2, q3, q4]
+--R 
+--R
+--R   (33)
+--R   [
+--R         2           2  2
+--R       (y  - 2t y + t )x
+--R     + 
+--R            2                            2           2          2
+--R       (- 2y  + ((2t + 4)z + 2t)y + (- 2t  + 2)z - 4t  - 2)x + y
+--R     + 
+--R                          2       2          2
+--R       (- 2t z - 4t)y + (t  + 10)z  - 8z + 4t  + 2
+--R     ,
+--R                                          2                         2
+--R    (- 3z y + 2t z + t)x + (z + 4)y + 4t z  - 7t z, (- 2z - 2)x - 2z  + 8z - 2,
+--R
+--R          2     2      2        2                      2        2
+--R       (3y  - 3t  - 4)x  + (- 6y  + (12t z + 12t)y + 6t z)x + 3y
+--R     + 
+--R                           2      2         2            2
+--R       (12t z - 12t)y + (9t  + 4)z  + (- 24t  - 4)z + 12t  + 4
+--R     ]
+--RType: List NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
+--E 33
+
+--S 34 of 34
+zeroSetSplit(lq,true,true)$T
+--R 
+--R[1 <4,0> -> |4|; {0}]W[2 <5,0>,<3,1> -> |8|; {0}][2 <4,1>,<3,1> -> |7|; {0}][1 <3,1> -> |3|; {0}]G[2 <4,1>,<4,1> -> |8|; {0}]W[3 <5,1>,<4,1>,<3,2> -> |12|; {0}]GI[3 <4,2>,<4,1>,<3,2> -> |11|; {0}]GWw[3 <4,1>,<3,2>,<5,2> -> |12|; {0}][3 <3,2>,<3,2>,<5,2> -> |11|; {0}]GIwWWWw[4 <3,2>,<4,2>,<5,2>,<2,3> -> |14|; {0}][4 <2,2>,<4,2>,<5,2>,<2,3> -> |13|; {0}]Gwww[5 <3,2>,<3,2>,<4,2>,<5,2>,<2,3> -> |17|; {0}]Gwwwwww[8 <3,2>,<4,2>,<4,2>,<4,2>,<4,2>,<4,2>,<5,2>,<2,3> -> |30|; {0}]Gwwwwww[8 <4,2>,<4,2>,<4,2>,<4,2>,<4,2>,<4,2>,<5,2>,<2,3> -> |31|; {0}][8 <3,3>,<4,2>,<4,2>,<4,2>,<4,2>,<4,2>,<5,2>,<2,3> -> |30|; {0}][8 <2,3>,<4,2>,<4,2>,<4,2>,<4,2>,<4,2>,<5,2>,<2,3> -> |29|; {0}][8 <1,3>,<4,2>,<4,2>,<4,2>,<4,2>,<4,2>,<5,2>,<2,3> -> |28|; {0}][7 <4,2>,<4,2>,<4,2>,<4,2>,<4,2>,<5,2>,<2,3> -> |27|; {0}][6 <4,2>,<4,2>,<4,2>,<4,2>,<5,2>,<2,3> -> |23|; {0}][5 <4,2>,<4,2>,<4,2>,<5,2>,<2,3> -> |19|; {0}]GIGIWwww[6 <5,2>,<4,2>,<4,2>,<5,2>,<3,3>,<2,3> -> |23|; {0}][6 <4,3>,<4,2>,<4,2>,<5,2>,<3,3>,<2,3> -> |22|; {0}]GIGI[6 <3,4>,<4,2>,<4,2>,<5,2>,<3,3>,<2,3> -> |21|; {0}][6 <2,4>,<4,2>,<4,2>,<5,2>,<3,3>,<2,3> -> |20|; {0}]GGG[5 <4,2>,<4,2>,<5,2>,<3,3>,<2,3> -> |18|; {0}]GIGIWwwwW[6 <5,2>,<4,2>,<5,2>,<3,3>,<3,3>,<2,3> -> |22|; {0}][6 <4,3>,<4,2>,<5,2>,<3,3>,<3,3>,<2,3> -> |21|; {0}]GIwwWwWWWWWWWwWWWWwwwww[8 <4,2>,<5,2>,<3,3>,<3,3>,<4,3>,<2,3>,<3,4>,<3,4> -> |27|; {0}][8 <3,3>,<5,2>,<3,3>,<3,3>,<4,3>,<2,3>,<3,4>,<3,4> -> |26|; {0}][8 <2,3>,<5,2>,<3,3>,<3,3>,<4,3>,<2,3>,<3,4>,<3,4> -> |25|; {0}]Gwwwwwwwwwwwwwwwwwwww[9 <5,2>,<3,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,4>,<3,4> -> |29|; {0}]GI[9 <4,3>,<3,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,4>,<3,4> -> |28|; {0}][9 <3,3>,<3,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,4>,<3,4> -> |27|; {0}][9 <2,3>,<3,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,4>,<3,4> -> |26|; {0}]GGwwwwwwwwwwwwWWwwwwwwww[11 <3,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |33|; {0}][11 <2,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |32|; {0}][11 <1,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |31|; {0}]GGGwwwwwwwwwwwww[12 <2,3>,<2,3>,<3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |34|; {0}]GGwwwwwwwwwwwww[13 <3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |38|; {0}]Gwwwwwwwwwwwww[13 <2,3>,<3,3>,<4,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |39|; {0}]GGGwwwwwwwwwwwww[15 <3,3>,<4,3>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |46|; {0}][14 <4,3>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |43|; {0}]GIGGGGIGGI[14 <3,4>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |42|; {0}]GGG[14 <2,4>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |41|; {0}][14 <1,4>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |40|; {0}]GGG[13 <3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |39|; {0}]Gwwwwwwwwwwwww[15 <3,3>,<3,3>,<4,3>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |48|; {0}]Gwwwwwwwwwwwww[15 <4,3>,<4,3>,<3,3>,<4,3>,<4,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |49|; {0}]GIGI[15 <3,4>,<4,3>,<3,3>,<4,3>,<4,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |48|; {0}]G[14 <4,3>,<3,3>,<4,3>,<4,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |45|; {0}][13 <3,3>,<4,3>,<4,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |41|; {0}]Gwwwwwwwwwwwww[13 <4,3>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |42|; {0}]GIGGGGIGGI[13 <3,4>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |41|; {0}]GGGGGGGG[13 <2,4>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |40|; {0}][13 <1,4>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |39|; {0}][13 <0,4>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |38|; {0}][12 <4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |38|; {1}][11 <4,3>,<3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |34|; {1}][10 <3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |30|; {1}][10 <2,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |29|; {1}]GGGwwwwwwwwwwwww[11 <3,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |33|; {1}]GGGwwwwwwwwwwwww[12 <4,3>,<3,3>,<4,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |38|; {1}]Gwwwwwwwwwwwww[12 <3,3>,<4,3>,<5,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |39|; {1}]GGwwwwwwwwwwwww[13 <5,3>,<4,3>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |44|; {1}]GIGGGGIGGIW[13 <4,4>,<4,3>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |43|; {1}]GGW[13 <3,4>,<4,3>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |42|; {1}]GGG[12 <4,3>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |39|; {1}]Gwwwwwwwwwwwww[12 <4,3>,<4,3>,<5,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |40|; {1}]Gwwwwwwwwwwwww[13 <5,3>,<5,3>,<4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |46|; {1}]GIGIW[13 <4,4>,<5,3>,<4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |45|; {1}][13 <3,4>,<5,3>,<4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |44|; {1}][13 <2,4>,<5,3>,<4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |43|; {1}]GG[12 <5,3>,<4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |41|; {1}]GIGGGGIGGIW[12 <4,4>,<4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |40|; {1}]GGGGGGW[12 <3,4>,<4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |39|; {1}][12 <2,4>,<4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |38|; {1}][12 <1,4>,<4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |37|; {1}]GGG[11 <4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |36|; {1}][10 <5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |32|; {1}][9 <3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |27|; {1}]W[9 <2,4>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |26|; {1}][9 <1,4>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |25|; {1}][8 <3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |24|; {1}]W[8 <2,4>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |23|; {1}][8 <1,4>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |22|; {1}][7 <4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |21|; {1}]w[7 <3,4>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |20|; {1}][7 <2,4>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |19|; {1}][7 <1,4>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |18|; {1}][6 <2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |17|; {1}]GGwwwwww[7 <3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |21|; {1}]GIW[7 <2,4>,<3,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |20|; {1}]GG[6 <3,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |18|; {1}]Gwwwwww[7 <4,3>,<4,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |23|; {1}]GIW[7 <3,4>,<4,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |22|; {1}][6 <4,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |19|; {1}]GIW[6 <3,4>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |18|; {1}]GGW[6 <2,4>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |17|; {1}][6 <1,4>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |16|; {1}]GGG[5 <3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |15|; {1}]GIW[5 <2,4>,<3,3>,<3,3>,<3,4>,<3,4> -> |14|; {1}]GG[4 <3,3>,<3,3>,<3,4>,<3,4> -> |12|; {1}][3 <3,3>,<3,4>,<3,4> -> |9|; {1}]W[3 <2,4>,<3,4>,<3,4> -> |8|; {1}][3 <1,4>,<3,4>,<3,4> -> |7|; {1}]G[2 <3,4>,<3,4> -> |6|; {1}]G[1 <3,4> -> |3|; {1}][1 <2,4> -> |2|; {1}][1 <1,4> -> |1|; {1}]
+--R   *** QCMPACK Statistics ***
+--R      Table     size:  36
+--R      Entries reused:  255
+--R
+--R   *** REGSETGCD: Gcd Statistics ***
+--R      Table     size:  125
+--R      Entries reused:  0
+--R
+--R   *** REGSETGCD: Inv Set Statistics ***
+--R      Table     size:  30
+--R      Entries reused:  0
+--R
+--R   (34)
+--R   [
+--R     {
+--R                         24                   23                    22
+--R         960725655771966t   + 386820897948702t   + 8906817198608181t
+--R       + 
+--R                          21                     20                    19
+--R         2704966893949428t   + 37304033340228264t   + 7924782817170207t
+--R       + 
+--R                           18                     17                      16
+--R         93126799040354990t   + 13101273653130910t   + 156146250424711858t
+--R       + 
+--R                           15                      14                     13
+--R         16626490957259119t   + 190699288479805763t   + 24339173367625275t
+--R       + 
+--R                            12                     11                      10
+--R         180532313014960135t   + 35288089030975378t   + 135054975747656285t
+--R       + 
+--R                           9                     8                     7
+--R         34733736952488540t  + 75947600354493972t  + 19772555692457088t
+--R       + 
+--R                           6                    5                    4
+--R         28871558573755428t  + 5576152439081664t  + 6321711820352976t
+--R       + 
+--R                       3                   2
+--R       438314209312320t  + 581105748367008t  - 60254467992576t + 1449115951104
+--R       ,
+--R
+--R                                                                         23
+--R             26604210869491302385515265737052082361668474181372891857784t
+--R           + 
+--R                                                                          22
+--R             443104378424686086067294899528296664238693556855017735265295t
+--R           + 
+--R                                                                          21
+--R             279078393286701234679141342358988327155321305829547090310242t
+--R           + 
+--R                                                                           20
+--R             3390276361413232465107617176615543054620626391823613392185226t
+--R           + 
+--R                                                                          19
+--R             941478179503540575554198645220352803719793196473813837434129t
+--R           + 
+--R                                                                            18
+--R             11547855194679475242211696749673949352585747674184320988144390t
+--R           + 
+--R                                                                           17
+--R             1343609566765597789881701656699413216467215660333356417241432t
+--R           + 
+--R                                                                            16
+--R             23233813868147873503933551617175640859899102987800663566699334t
+--R           + 
+--R                                                                          15
+--R             869574020537672336950845440508790740850931336484983573386433t
+--R           + 
+--R                                                                            14
+--R             31561554305876934875419461486969926554241750065103460820476969t
+--R           + 
+--R                                                                           13
+--R             1271400990287717487442065952547731879554823889855386072264931t
+--R           + 
+--R                                                                            12
+--R             31945089913863736044802526964079540198337049550503295825160523t
+--R           + 
+--R                                                                           11
+--R             3738735704288144509871371560232845884439102270778010470931960t
+--R           + 
+--R                                                                            10
+--R             25293997512391412026144601435771131587561905532992045692885927t
+--R           + 
+--R                                                                           9
+--R             5210239009846067123469262799870052773410471135950175008046524t
+--R           + 
+--R                                                                            8
+--R             15083887986930297166259870568608270427403187606238713491129188t
+--R           + 
+--R                                                                           7
+--R             3522087234692930126383686270775779553481769125670839075109000t
+--R           + 
+--R                                                                           6
+--R             6079945200395681013086533792568886491101244247440034969288588t
+--R           + 
+--R                                                                           5
+--R             1090634852433900888199913756247986023196987723469934933603680t
+--R           + 
+--R                                                                           4
+--R             1405819430871907102294432537538335402102838994019667487458352t
+--R           + 
+--R                                                                         3
+--R             88071527950320450072536671265507748878347828884933605202432t
+--R           + 
+--R                                                                          2
+--R             135882489433640933229781177155977768016065765482378657129440t
+--R           + 
+--R             - 13957283442882262230559894607400314082516690749975646520320t
+--R           + 
+--R             334637692973189299277258325709308472592117112855749713920
+--R        *
+--R           z
+--R       + 
+--R                                                                    23
+--R         8567175484043952879756725964506833932149637101090521164936t
+--R       + 
+--R                                                                      22
+--R         149792392864201791845708374032728942498797519251667250945721t
+--R       + 
+--R                                                                     21
+--R         77258371783645822157410861582159764138123003074190374021550t
+--R       + 
+--R                                                                       20
+--R         1108862254126854214498918940708612211184560556764334742191654t
+--R       + 
+--R                                                                      19
+--R         213250494460678865219774480106826053783815789621501732672327t
+--R       + 
+--R                                                                       18
+--R         3668929075160666195729177894178343514501987898410131431699882t
+--R       + 
+--R                                                                      17
+--R         171388906471001872879490124368748236314765459039567820048872t
+--R       + 
+--R                                                                       16
+--R         7192430746914602166660233477331022483144921771645523139658986t
+--R       + 
+--R                                                                        15
+--R         - 128798674689690072812879965633090291959663143108437362453385t
+--R       + 
+--R                                                                       14
+--R         9553010858341425909306423132921134040856028790803526430270671t
+--R       + 
+--R                                                                       13
+--R         - 13296096245675492874538687646300437824658458709144441096603t
+--R       + 
+--R                                                                       12
+--R         9475806805814145326383085518325333106881690568644274964864413t
+--R       + 
+--R                                                                      11
+--R         803234687925133458861659855664084927606298794799856265539336t
+--R       + 
+--R                                                                       10
+--R         7338202759292865165994622349207516400662174302614595173333825t
+--R       + 
+--R                                                                       9
+--R         1308004628480367351164369613111971668880538855640917200187108t
+--R       + 
+--R                                                                       8
+--R         4268059455741255498880229598973705747098216067697754352634748t
+--R       + 
+--R                                                                      7
+--R         892893526858514095791318775904093300103045601514470613580600t
+--R       + 
+--R                                                                       6
+--R         1679152575460683956631925852181341501981598137465328797013652t
+--R       + 
+--R                                                                      5
+--R         269757415767922980378967154143357835544113158280591408043936t
+--R       + 
+--R                                                                      4
+--R         380951527864657529033580829801282724081345372680202920198224t
+--R       + 
+--R                                                                     3
+--R         19785545294228495032998826937601341132725035339452913286656t
+--R       + 
+--R                                                                     2
+--R         36477412057384782942366635303396637763303928174935079178528t
+--R       + 
+--R         - 3722212879279038648713080422224976273210890229485838670848t
+--R       + 
+--R         89079724853114348361230634484013862024728599906874105856
+--R       ,
+--R         3      2                  3       2
+--R      (3z  - 11z  + 8z + 4)y + 2t z  + 4t z  - 5t z - t,
+--R                  2
+--R      (z + 1)x + z  - 4z + 1}
+--R     ]
+--RType: List RegularTriangularSet(Integer,IndexedExponents OrderedVariableList [x,y,z,t],OrderedVariableList [x,y,z,t],NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t]))
+--E 34
+)spool
+)lisp (bye)
+@
+<<RegularTriangularSet.help>>=
+====================================================================
+RegularTriangularSet examples
+====================================================================
+
+The RegularTriangularSet domain constructor implements regular
+triangular sets.  These particular triangular sets were introduced by
+M. Kalkbrener (1991) in his PhD Thesis under the name regular chains.
+Regular chains and their related concepts are presented in the paper
+"On the Theories of Triangular sets" By P. Aubry, D. Lazard and
+M. Moreno Maza (to appear in the Journal of Symbolic Computation).
+The RegularTriangularSet constructor also provides a new method
+(by the third author) for solving polynomial system by means of
+regular chains.  This method has two ways of solving.  One has the
+same specifications as Kalkbrener's algorithm (1991) and the other is
+closer to Lazard's method (Discr. App. Math, 1991).  Moreover, this
+new method removes redundant component from the decompositions when
+this is not too expensive.  This is always the case with
+square-free regular chains.  So if you want to obtain decompositions
+without redundant components just use the SquareFreeRegularTriangularSet 
+domain constructor or the LazardSetSolvingPackage package constructor.  
+See also the LexTriangularPackage and ZeroDimensionalSolvePackage for the
+case of algebraic systems with a finite number of (complex) solutions.
+
+One of the main features of regular triangular sets is that they
+naturally define towers of simple extensions of a field.  This allows
+to perform with multivariate polynomials the same kind of operations
+as one can do in an EuclideanDomain.
+
+The RegularTriangularSet constructor takes four arguments.  The first
+one, R, is the coefficient ring of the polynomials; it must belong to
+the category GcdDomain.  The second one, E, is the exponent monoid of
+the polynomials; it must belong to the category OrderedAbelianMonoidSup.  
+The third one, V, is the ordered set of variables; it must belong to the 
+category OrderedSet.  The last one is the polynomial ring; it must belong 
+to the category RecursivePolynomialCategory(R,E,V).  The abbreviation for
+RegularTriangularSet is REGSET.  See also the constructor RegularChain
+which only takes two arguments, the coefficient ring and the ordered
+set of variables; in that case, polynomials are necessarily built with
+the NewSparseMultivariatePolynomial domain constructor.
+
+We shall explain now how to use the constructor REGSET and how to read
+the decomposition of a polynomial system by means of regular sets.
+
+Let us give some examples.  We start with an easy one
+(Donati-Traverso) in order to understand the two ways of solving
+polynomial systems provided by the REGSET constructor.
+
+Define the coefficient ring.
+
+  R := Integer
+    Integer
+                               Type: Domain
+
+Define the list of variables,
+
+  ls : List Symbol := [x,y,z,t]
+    [x,y,z,t]
+                               Type: List Symbol
+
+and make it an ordered set;
+
+  V := OVAR(ls)
+    OrderedVariableList [x,y,z,t]
+                               Type: Domain
+
+then define the exponent monoid.
+
+  E := IndexedExponents V
+    IndexedExponents OrderedVariableList [x,y,z,t]
+                               Type: Domain
+
+Define the polynomial ring.
+
+  P := NSMP(R, V)
+    NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
+                               Type: Domain
+
+Let the variables be polynomial.
+
+  x: P := 'x
+    x
+             Type: NewSparseMultivariatePolynomial(Integer,
+                                   OrderedVariableList [x,y,z,t])
+  y: P := 'y
+    y
+             Type: NewSparseMultivariatePolynomial(Integer,
+                                   OrderedVariableList [x,y,z,t])
+
+  z: P := 'z
+    z
+             Type: NewSparseMultivariatePolynomial(Integer,
+                                   OrderedVariableList [x,y,z,t])
+
+  t: P := 't
+   t
+             Type: NewSparseMultivariatePolynomial(Integer,
+                                   OrderedVariableList [x,y,z,t])
+
+Now call the RegularTriangularSet domain constructor.
+
+  T := REGSET(R,E,V,P)
+  RegularTriangularSet(Integer,IndexedExponents OrderedVariableList [x,y,z,t],O
+  rderedVariableList [x,y,z,t],NewSparseMultivariatePolynomial(Integer,OrderedV
+  ariableList [x,y,z,t]))
+                               Type: Domain
+
+Define a polynomial system.
+
+  p1 := x ** 31 - x ** 6 - x - y 
+      31    6
+     x   - x  - x - y
+             Type: NewSparseMultivariatePolynomial(Integer,
+                                   OrderedVariableList [x,y,z,t])
+
+  p2 := x ** 8  - z 
+     8
+    x  - z
+             Type: NewSparseMultivariatePolynomial(Integer,
+                                   OrderedVariableList [x,y,z,t])
+
+  p3 := x ** 10 - t 
+     10
+    x   - t
+             Type: NewSparseMultivariatePolynomial(Integer,
+                                   OrderedVariableList [x,y,z,t])
+
+  lp := [p1, p2, p3]
+      31    6          8      10
+    [x   - x  - x - y,x  - z,x   - t]
+             Type: List NewSparseMultivariatePolynomial(Integer,
+                                       OrderedVariableList [x,y,z,t])
+
+First of all, let us solve this system in the sense of Kalkbrener.
+
+  zeroSetSplit(lp)$T
+       5    4      2     3     8     5    3    2   4                2
+    [{z  - t ,t z y  + 2z y - t  + 2t  + t  - t ,(t  - t)x - t y - z }]
+        Type: List RegularTriangularSet(Integer,
+                    IndexedExponents OrderedVariableList [x,y,z,t],
+                    OrderedVariableList [x,y,z,t],
+                    NewSparseMultivariatePolynomial(Integer,
+                        OrderedVariableList [x,y,z,t]))
+
+And now in the sense of Lazard (or Wu and other authors).
+
+  lts := zeroSetSplit(lp,false)$T
+      5    4      2     3     8     5    3    2   4                2
+   [{z  - t ,t z y  + 2z y - t  + 2t  + t  - t ,(t  - t)x - t y - z },
+      3      5          2     3         2
+    {t  - 1,z  - t,t z y  + 2z y + 1,z x  - t}, {t,z,y,x}]
+        Type: List RegularTriangularSet(Integer,
+                    IndexedExponents OrderedVariableList [x,y,z,t],
+                    OrderedVariableList [x,y,z,t],
+                    NewSparseMultivariatePolynomial(Integer,
+                        OrderedVariableList [x,y,z,t]))
+
+We can see that the first decomposition is a subset of the second.
+So how can both be correct ?
+
+Recall first that polynomials from a domain of the category 
+RecursivePolynomialCategory are regarded as univariate polynomials in
+their main variable.  For instance the second polynomial in the first
+set of each decomposition has main variable y and its initial
+(i.e. its leading coefficient w.r.t. its main variable) is t z.
+
+Now let us explain how to read the second decomposition.  Note that
+the non-constant initials of the first set are t^4-t and t z. Then 
+the solutions described by this first set are the common zeros of
+its polynomials that do not cancel the polynomials t^4-t and ty z.
+Now the solutions of the input system lp satisfying these equations 
+are described by the second and the third sets of the decomposition.  
+Thus, in some sense, they can be considered as degenerated solutions.  
+The solutions given by the first set are called the generic points of 
+the system; they give the general form of the solutions.  The first 
+decomposition only provides these generic points.  This latter 
+decomposition is useful when they are many degenerated solutions 
+(which is sometimes hard to compute) and when one is only interested 
+in general informations, like the dimension of the input system.
+
+We can get the dimensions of each component of a decomposition as follows.
+
+  [coHeight(ts) for ts in lts]
+    [1,0,0]
+                             Type: List NonNegativeInteger
+
+Thus the first set has dimension one.  Indeed t can take any value,
+except 0 or any third root of 1, whereas z is completely determined
+from t, y is given by z and t, and finally x is given by the other
+three variables.  In the second and the third sets of the second
+decomposition the four variables are completely determined and thus
+these sets have dimension zero.
+
+We give now the precise specifications of each decomposition.  This
+assume some mathematical knowledge.  However, for the non-expert user,
+the above explanations will be sufficient to understand the other
+features of the RSEGSET constructor.
+
+The input system lp is decomposed in the sense of Kalkbrener as
+finitely many regular sets T1,...,Ts such that the radical ideal
+generated by lp is the intersection of the radicals of the saturated
+ideals of T1,...,Ts.  In other words, the affine variety associated
+with lp is the union of the closures (w.r.t. Zarisky topology) of the
+regular-zeros sets of T1,...,Ts.
+
+N. B. The prime ideals associated with the radical of the saturated
+ideal of a regular triangular set have all the same dimension;
+moreover these prime ideals can be given by characteristic sets with
+the same main variables.  Thus a decomposition in the sense of
+Kalkbrener is unmixed dimensional.  Then it can be viewed as a lazy
+decomposition into prime ideals (some of these prime ideals being
+merged into unmixed dimensional ideals).
+
+Now we explain the other way of solving by means of regular triangular
+sets.  The input system lp is decomposed in the sense of Lazard as
+finitely many regular triangular sets T1,...,Ts such that the affine
+variety associated with lp is the union of the regular-zeros sets of
+T1,...,Ts.  Thus a decomposition in the sense of Lazard is also a
+decomposition in the sense of Kalkbrener; the converse is false as we
+have seen before.
+
+When the input system has a finite number of solutions, both ways of
+solving provide similar decompositions as we shall see with this
+second example (Caprasse).
+
+Define a polynomial system.
+
+  f1 := y**2*z+2*x*y*t-2*x-z
+                     2
+    (2t y - 2)x + z y  - z
+           Type: NewSparseMultivariatePolynomial(Integer,
+                    OrderedVariableList [x,y,z,t])
+
+  f2:=-x**3*z+ 4*x*y**2*z+4*x**2*y*t+2*y**3*t+4*x**2-10*y**2+4*x*z-10*y*t+2
+         3              2        2              3      2
+    - z x  + (4t y + 4)x  + (4z y  + 4z)x + 2t y  - 10y  - 10t y + 2
+           Type: NewSparseMultivariatePolynomial(Integer,
+                    OrderedVariableList [x,y,z,t])
+
+  f3 :=  2*y*z*t+x*t**2-x-2*z 
+      2
+    (t  - 1)x + 2t z y - 2z
+           Type: NewSparseMultivariatePolynomial(Integer,
+                    OrderedVariableList [x,y,z,t])
+
+  f4:=-x*z**3+4*y*z**2*t+4*x*z*t**2+2*y*t**3+4*x*z+4*z**2-10*y*t- 10*t**2+2
+        3      2                2     3             2      2
+    (- z  + (4t  + 4)z)x + (4t z  + 2t  - 10t)y + 4z  - 10t  + 2
+           Type: NewSparseMultivariatePolynomial(Integer,
+                    OrderedVariableList [x,y,z,t])
+
+  lf := [f1, f2, f3, f4]
+                     2
+   [(2t y - 2)x + z y  - z,
+         3              2        2              3      2
+    - z x  + (4t y + 4)x  + (4z y  + 4z)x + 2t y  - 10y  - 10t y + 2,
+      2
+    (t  - 1)x + 2t z y - 2z,
+        3      2                2     3             2      2
+    (- z  + (4t  + 4)z)x + (4t z  + 2t  - 10t)y + 4z  - 10t  + 2]
+           Type: List NewSparseMultivariatePolynomial(Integer,
+                            OrderedVariableList [x,y,z,t])
+
+First of all, let us solve this system in the sense of Kalkbrener.
+
+  zeroSetSplit(lf)$T
+      2      8      6       2                 3            2
+   [{t  - 1,z  - 16z  + 256z  - 256,t y - 1,(z  - 8z)x - 8z  + 16},
+       2      2     2
+    {3t  + 1,z  - 7t  - 1,y + t,x + z},
+      8      6      2         3            2
+    {t  - 10t  + 10t  - 1,z,(t  - 5t)y - 5t  + 1,x},
+      2      2
+    {t  + 3,z  - 4,y + t,x - z}]
+      Type: List RegularTriangularSet(Integer,
+                  IndexedExponents OrderedVariableList [x,y,z,t],
+                  OrderedVariableList [x,y,z,t],
+                  NewSparseMultivariatePolynomial(Integer,
+                      OrderedVariableList [x,y,z,t]))
+
+And now in the sense of Lazard (or Wu and other authors).
+
+  lts2 := zeroSetSplit(lf,false)$T
+      8      6      2         3            2
+   [{t  - 10t  + 10t  - 1,z,(t  - 5t)y - 5t  + 1,x},
+      2      8      6       2                 3            2
+    {t  - 1,z  - 16z  + 256z  - 256,t y - 1,(z  - 8z)x - 8z  + 16},
+       2      2     2                     2      2
+    {3t  + 1,z  - 7t  - 1,y + t,x + z}, {t  + 3,z  - 4,y + t,x - z}]
+       Type: List RegularTriangularSet(Integer,
+                   IndexedExponents OrderedVariableList [x,y,z,t],
+                   OrderedVariableList [x,y,z,t],
+                   NewSparseMultivariatePolynomial(Integer,
+                       OrderedVariableList [x,y,z,t]))
+
+Up to the ordering of the components, both decompositions are identical.
+
+Let us check that each component has a finite number of solutions.
+
+  [coHeight(ts) for ts in lts2]
+    [0,0,0,0]
+                        Type: List NonNegativeInteger
+
+Let us count the degrees of each component,
+
+  degrees := [degree(ts) for ts in lts2]
+    [8,16,4,4]
+                        Type: List NonNegativeInteger
+
+and compute their sum.
+
+  reduce(+,degrees)
+    32
+                        Type: PositiveInteger
+
+We study now the options of the zeroSetSplit operation.  As we have seen 
+yet, there is an optional second argument which is a boolean value. If this 
+value is true (this is the default) then the decomposition is computed in 
+the sense of Kalkbrener, otherwise it is computed in the sense of Lazard.
+
+There is a second boolean optional argument that can be used (in that
+case the first optional argument must be present).  This second option
+allows you to get some information during the computations.
+
+Therefore, we need to understand a little what is going on during the
+computations.  An important feature of the algorithm is that the
+intermediate computations are managed in some sense like the processes
+of a Unix system.  Indeed, each intermediate computation may generate
+other intermediate computations and the management of all these
+computations is a crucial task for the efficiency.  Thus any
+intermediate computation may be suspended, killed or resumed,
+depending on algebraic considerations that determine priorities for
+these processes.  The goal is of course to go as fast as possible
+towards the final decomposition which means to avoid as much as
+possible unnecessary computations.
+
+To follow the computations, one needs to set to true the second
+argument.  Then a lot of numbers and letters are displayed.  Between a
+[ and a ] one has the state of the processes at a given time.  Just
+after [ one can see the number of processes.  Then each process is
+represented by two numbers between < and >.  A process consists of a
+list of polynomial ps and a triangular set ts; its goal is to compute
+the common zeros of ps that belong to the regular-zeros set of ts.
+After the processes, the number between pipes gives the total number
+of polynomials in all the sets ps.  Finally, the number between braces
+gives the number of components of a decomposition that are already
+computed. This number may decrease.
+
+Let us take a third example (Czapor-Geddes-Wang) to see how this
+information is displayed.
+
+Define a polynomial system.
+
+  u : R := 2 
+    2
+                            Type: Integer
+
+  q1 := 2*(u-1)**2+ 2*(x-z*x+z**2)+ y**2*(x-1)**2- 2*u*x+ 2*y*t*(1-x)*(x-z)+_
+        2*u*z*t*(t-y)+ u**2*t**2*(1-2*z)+ 2*u*t**2*(z-x)+ 2*u*t*y*(z-1)+_
+        2*u*z*x*(y+1)+ (u**2-2*u)*z**2*t**2+ 2*u**2*z**2+ 4*u*(1-u)*z+_
+        t**2*(z-x)**2}
+       2           2  2        2                            2           2
+     (y  - 2t y + t )x  + (- 2y  + ((2t + 4)z + 2t)y + (- 2t  + 2)z - 4t  - 2)x
+   + 
+      2                      2       2          2
+     y  + (- 2t z - 4t)y + (t  + 10)z  - 8z + 4t  + 2
+       Type: NewSparseMultivariatePolynomial(Integer,
+               OrderedVariableList [x,y,z,t])
+
+  q2 := t*(2*z+1)*(x-z)+ y*(z+2)*(1-x)+ u*(u-2)*t+ u*(1-2*u)*z*t+_
+        u*y*(x+u-z*x-1)+ u*(u+1)*z**2*t}
+    (- 3z y + 2t z + t)x + (z + 4)y + 4t z  - 7t z
+       Type: NewSparseMultivariatePolynomial(Integer,
+               OrderedVariableList [x,y,z,t])
+
+  q3 := -u**2*(z-1)**2+ 2*z*(z-x)-2*(x-1)
+    (- 2z - 2)x - 2z  + 8z - 2
+       Type: NewSparseMultivariatePolynomial(Integer,
+               OrderedVariableList [x,y,z,t])
+
+  q4 := u**2+4*(z-x**2)+3*y**2*(x-1)**2- 3*t**2*(z-x)**2+_
+        3*u**2*t**2*(z-1)**2+u**2*z*(z-2)+6*u*t*y*(z+x+z*x-1)}
+       2     2      2        2                      2        2
+    (3y  - 3t  - 4)x  + (- 6y  + (12t z + 12t)y + 6t z)x + 3y  + (12t z - 12t)y
+   + 
+       2      2         2            2
+    (9t  + 4)z  + (- 24t  - 4)z + 12t  + 4
+        Type: NewSparseMultivariatePolynomial(Integer,
+                OrderedVariableList [x,y,z,t])
+
+  lq := [q1, q2, q3, q4]
+   [
+         2           2  2
+       (y  - 2t y + t )x
+     + 
+            2                            2           2          2
+       (- 2y  + ((2t + 4)z + 2t)y + (- 2t  + 2)z - 4t  - 2)x + y
+     + 
+                          2       2          2
+       (- 2t z - 4t)y + (t  + 10)z  - 8z + 4t  + 2
+     ,
+                                          2                         2
+    (- 3z y + 2t z + t)x + (z + 4)y + 4t z  - 7t z, (- 2z - 2)x - 2z  + 8z - 2,
+
+          2     2      2        2                      2        2
+       (3y  - 3t  - 4)x  + (- 6y  + (12t z + 12t)y + 6t z)x + 3y
+     + 
+                           2      2         2            2
+       (12t z - 12t)y + (9t  + 4)z  + (- 24t  - 4)z + 12t  + 4
+     ]
+        Type: List NewSparseMultivariatePolynomial(Integer,
+                     OrderedVariableList [x,y,z,t])
+
+Let us try the information option.  N.B. The timing should be between
+1 and 10 minutes, depending on your machine.
+
+  zeroSetSplit(lq,true,true)$T
+     [1 <4,0> -> |4|; {0}]W[2 <5,0>,<3,1> -> |8|; {0}]
+     [2 <4,1>,<3,1> -> |7|; {0}]
+     [1 <3,1> -> |3|; {0}]G
+     [2 <4,1>,<4,1> -> |8|; {0}]W
+     [3 <5,1>,<4,1>,<3,2> -> |12|; {0}]GI
+     [3 <4,2>,<4,1>,<3,2> -> |11|; {0}]GWw
+     [3 <4,1>,<3,2>,<5,2> -> |12|; {0}]
+     [3 <3,2>,<3,2>,<5,2> -> |11|; {0}]GIwWWWw
+     [4 <3,2>,<4,2>,<5,2>,<2,3> -> |14|; {0}]
+     [4 <2,2>,<4,2>,<5,2>,<2,3> -> |13|; {0}]Gwww
+     [5 <3,2>,<3,2>,<4,2>,<5,2>,<2,3> -> |17|; {0}]Gwwwwww
+     [8 <3,2>,<4,2>,<4,2>,<4,2>,<4,2>,<4,2>,<5,2>,<2,3> -> |30|; {0}]Gwwwwww
+     [8 <4,2>,<4,2>,<4,2>,<4,2>,<4,2>,<4,2>,<5,2>,<2,3> -> |31|; {0}]
+     [8 <3,3>,<4,2>,<4,2>,<4,2>,<4,2>,<4,2>,<5,2>,<2,3> -> |30|; {0}]
+     [8 <2,3>,<4,2>,<4,2>,<4,2>,<4,2>,<4,2>,<5,2>,<2,3> -> |29|; {0}]
+     [8 <1,3>,<4,2>,<4,2>,<4,2>,<4,2>,<4,2>,<5,2>,<2,3> -> |28|; {0}]
+     [7 <4,2>,<4,2>,<4,2>,<4,2>,<4,2>,<5,2>,<2,3> -> |27|; {0}]
+     [6 <4,2>,<4,2>,<4,2>,<4,2>,<5,2>,<2,3> -> |23|; {0}]
+     [5 <4,2>,<4,2>,<4,2>,<5,2>,<2,3> -> |19|; {0}]GIGIWwww
+     [6 <5,2>,<4,2>,<4,2>,<5,2>,<3,3>,<2,3> -> |23|; {0}]
+     [6 <4,3>,<4,2>,<4,2>,<5,2>,<3,3>,<2,3> -> |22|; {0}]GIGI
+     [6 <3,4>,<4,2>,<4,2>,<5,2>,<3,3>,<2,3> -> |21|; {0}]
+     [6 <2,4>,<4,2>,<4,2>,<5,2>,<3,3>,<2,3> -> |20|; {0}]GGG
+     [5 <4,2>,<4,2>,<5,2>,<3,3>,<2,3> -> |18|; {0}]GIGIWwwwW
+     [6 <5,2>,<4,2>,<5,2>,<3,3>,<3,3>,<2,3> -> |22|; {0}]
+     [6 <4,3>,<4,2>,<5,2>,<3,3>,<3,3>,<2,3> -> |21|; {0}]
+     GIwwWwWWWWWWWwWWWWwwwww
+     [8 <4,2>,<5,2>,<3,3>,<3,3>,<4,3>,<2,3>,<3,4>,<3,4> -> |27|; {0}]
+     [8 <3,3>,<5,2>,<3,3>,<3,3>,<4,3>,<2,3>,<3,4>,<3,4> -> |26|; {0}]
+     [8 <2,3>,<5,2>,<3,3>,<3,3>,<4,3>,<2,3>,<3,4>,<3,4> -> |25|; {0}]
+     Gwwwwwwwwwwwwwwwwwwww
+     [9 <5,2>,<3,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,4>,<3,4> -> |29|; {0}]GI
+     [9 <4,3>,<3,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,4>,<3,4> -> |28|; {0}]
+     [9 <3,3>,<3,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,4>,<3,4> -> |27|; {0}]
+     [9 <2,3>,<3,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,4>,<3,4> -> |26|; {0}]
+     GGwwwwwwwwwwwwWWwwwwwwww
+     [11 <3,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4>
+        -> |33|; {0}]
+     [11 <2,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> 
+       -> |32|; {0}]
+     [11 <1,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> 
+       -> |31|; {0}]GGGwwwwwwwwwwwww
+     [12 <2,3>,<2,3>,<3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,
+       <3,4> -> |34|; {0}]GGwwwwwwwwwwwww
+     [13 <3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,
+       <3,4>,<3,4> -> |38|; {0}]Gwwwwwwwwwwwww
+     [13 <2,3>,<3,3>,<4,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,
+       <3,4>,<3,4> -> |39|; {0}]GGGwwwwwwwwwwwww
+     [15 <3,3>,<4,3>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,
+       <3,3>,<3,3>,<3,4>,<3,4> -> |46|; {0}]
+     [14 <4,3>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,
+       <3,3>,<3,4>,<3,4> -> |43|; {0}]GIGGGGIGGI
+     [14 <3,4>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,
+       <3,3>,<3,4>,<3,4> -> |42|; {0}]GGG
+     [14 <2,4>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,
+       <3,3>,<3,4>,<3,4> -> |41|; {0}]
+     [14 <1,4>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,
+       <3,3>,<3,4>,<3,4> -> |40|; {0}]GGG
+     [13 <3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,
+       <3,4>,<3,4> -> |39|; {0}]Gwwwwwwwwwwwww
+     [15 <3,3>,<3,3>,<4,3>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,
+       <3,3>,<3,3>,<3,4>,<3,4> -> |48|; {0}]Gwwwwwwwwwwwww
+     [15 <4,3>,<4,3>,<3,3>,<4,3>,<4,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,3>,
+       <3,3>,<3,3>,<3,4>,<3,4> -> |49|; {0}]GIGI
+     [15 <3,4>,<4,3>,<3,3>,<4,3>,<4,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,3>,
+       <3,3>,<3,3>,<3,4>,<3,4> -> |48|; {0}]G
+     [14 <4,3>,<3,3>,<4,3>,<4,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,3>,<3,3>,
+       <3,3>,<3,4>,<3,4> -> |45|; {0}]
+     [13 <3,3>,<4,3>,<4,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,
+       <3,4>,<3,4> -> |41|; {0}]Gwwwwwwwwwwwww
+     [13 <4,3>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,
+       <3,4>,<3,4> -> |42|; {0}]GIGGGGIGGI
+     [13 <3,4>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,
+       <3,4>,<3,4> -> |41|; {0}]GGGGGGGG
+     [13 <2,4>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,
+       <3,4>,<3,4> -> |40|; {0}]
+     [13 <1,4>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,
+       <3,4>,<3,4>  -> |39|; {0}]
+     [13 <0,4>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,
+       <3,4>,<3,4> -> |38|; {0}]
+     [12 <4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,
+       <3,4> -> |38|; {1}]
+     [11 <4,3>,<3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> 
+       -> |34|; {1}]
+     [10 <3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> 
+       -> |30|; {1}]
+     [10 <2,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> 
+       -> |29|; {1}]GGGwwwwwwwwwwwww
+     [11 <3,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> 
+       -> |33|; {1}]GGGwwwwwwwwwwwww
+     [12 <4,3>,<3,3>,<4,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,
+       <3,4> -> |38|; {1}]Gwwwwwwwwwwwww
+     [12 <3,3>,<4,3>,<5,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,
+       <3,4> -> |39|; {1}]GGwwwwwwwwwwwww
+     [13 <5,3>,<4,3>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,
+       <3,4>,<3,4> -> |44|; {1}]GIGGGGIGGIW
+     [13 <4,4>,<4,3>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,
+       <3,4>,<3,4> -> |43|; {1}]GGW
+     [13 <3,4>,<4,3>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,
+       <3,4>,<3,4> -> |42|; {1}]GGG
+     [12 <4,3>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,
+       <3,4> -> |39|; {1}]Gwwwwwwwwwwwww
+     [12 <4,3>,<4,3>,<5,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,
+       <3,4> -> |40|; {1}]Gwwwwwwwwwwwww
+     [13 <5,3>,<5,3>,<4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,
+       <3,4>,<3,4> -> |46|; {1}]GIGIW
+     [13 <4,4>,<5,3>,<4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,
+       <3,4>,<3,4> -> |45|; {1}]
+     [13 <3,4>,<5,3>,<4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,
+       <3,4>,<3,4> -> |44|; {1}]
+     [13 <2,4>,<5,3>,<4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,
+       <3,4>,<3,4> -> |43|; {1}]GG
+     [12 <5,3>,<4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,
+       <3,4> -> |41|; {1}]GIGGGGIGGIW
+     [12 <4,4>,<4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,
+       <3,4> -> |40|; {1}]GGGGGGW
+     [12 <3,4>,<4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,
+       <3,4> -> |39|; {1}]
+     [12 <2,4>,<4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,
+       <3,4> -> |38|; {1}]
+     [12 <1,4>,<4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,
+       <3,4> -> |37|; {1}]GGG
+     [11 <4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> 
+       -> |36|; {1}]
+     [10 <5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> 
+       -> |32|; {1}]
+     [9 <3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |27|; {1}]W
+     [9 <2,4>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |26|; {1}]
+     [9 <1,4>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |25|; {1}]
+     [8 <3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |24|; {1}]W
+     [8 <2,4>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |23|; {1}]
+     [8 <1,4>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |22|; {1}]
+     [7 <4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |21|; {1}]w
+     [7 <3,4>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |20|; {1}]
+     [7 <2,4>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |19|; {1}]
+     [7 <1,4>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |18|; {1}]
+     [6 <2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |17|; {1}]GGwwwwww
+     [7 <3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |21|; {1}]GIW
+     [7 <2,4>,<3,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |20|; {1}]GG
+     [6 <3,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |18|; {1}]Gwwwwww
+     [7 <4,3>,<4,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |23|; {1}]GIW
+     [7 <3,4>,<4,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |22|; {1}]
+     [6 <4,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |19|; {1}]GIW
+     [6 <3,4>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |18|; {1}]GGW
+     [6 <2,4>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |17|; {1}]
+     [6 <1,4>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |16|; {1}]GGG
+     [5 <3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |15|; {1}]GIW
+     [5 <2,4>,<3,3>,<3,3>,<3,4>,<3,4> -> |14|; {1}]GG
+     [4 <3,3>,<3,3>,<3,4>,<3,4> -> |12|; {1}]
+     [3 <3,3>,<3,4>,<3,4> -> |9|; {1}]W
+     [3 <2,4>,<3,4>,<3,4> -> |8|; {1}]
+     [3 <1,4>,<3,4>,<3,4> -> |7|; {1}]G
+     [2 <3,4>,<3,4> -> |6|; {1}]G
+     [1 <3,4> -> |3|; {1}]
+     [1 <2,4> -> |2|; {1}]
+     [1 <1,4> -> |1|; {1}]
+   *** QCMPACK Statistics ***
+      Table     size:  36
+      Entries reused:  255
+
+   *** REGSETGCD: Gcd Statistics ***
+      Table     size:  125
+      Entries reused:  0
+
+   *** REGSETGCD: Inv Set Statistics ***
+      Table     size:  30
+      Entries reused:  0
+
+   [
+     {
+                         24                   23                    22
+         960725655771966t   + 386820897948702t   + 8906817198608181t
+       + 
+                          21                     20                    19
+         2704966893949428t   + 37304033340228264t   + 7924782817170207t
+       + 
+                           18                     17                      16
+         93126799040354990t   + 13101273653130910t   + 156146250424711858t
+       + 
+                           15                      14                     13
+         16626490957259119t   + 190699288479805763t   + 24339173367625275t
+       + 
+                            12                     11                      10
+         180532313014960135t   + 35288089030975378t   + 135054975747656285t
+       + 
+                           9                     8                     7
+         34733736952488540t  + 75947600354493972t  + 19772555692457088t
+       + 
+                           6                    5                    4
+         28871558573755428t  + 5576152439081664t  + 6321711820352976t
+       + 
+                       3                   2
+       438314209312320t  + 581105748367008t  - 60254467992576t + 1449115951104
+       ,
+
+                                                                         23
+             26604210869491302385515265737052082361668474181372891857784t
+           + 
+                                                                          22
+             443104378424686086067294899528296664238693556855017735265295t
+           + 
+                                                                          21
+             279078393286701234679141342358988327155321305829547090310242t
+           + 
+                                                                           20
+             3390276361413232465107617176615543054620626391823613392185226t
+           + 
+                                                                          19
+             941478179503540575554198645220352803719793196473813837434129t
+           + 
+                                                                            18
+             11547855194679475242211696749673949352585747674184320988144390t
+           + 
+                                                                           17
+             1343609566765597789881701656699413216467215660333356417241432t
+           + 
+                                                                            16
+             23233813868147873503933551617175640859899102987800663566699334t
+           + 
+                                                                          15
+             869574020537672336950845440508790740850931336484983573386433t
+           + 
+                                                                            14
+             31561554305876934875419461486969926554241750065103460820476969t
+           + 
+                                                                           13
+             1271400990287717487442065952547731879554823889855386072264931t
+           + 
+                                                                            12
+             31945089913863736044802526964079540198337049550503295825160523t
+           + 
+                                                                           11
+             3738735704288144509871371560232845884439102270778010470931960t
+           + 
+                                                                            10
+             25293997512391412026144601435771131587561905532992045692885927t
+           + 
+                                                                           9
+             5210239009846067123469262799870052773410471135950175008046524t
+           + 
+                                                                            8
+             15083887986930297166259870568608270427403187606238713491129188t
+           + 
+                                                                           7
+             3522087234692930126383686270775779553481769125670839075109000t
+           + 
+                                                                           6
+             6079945200395681013086533792568886491101244247440034969288588t
+           + 
+                                                                           5
+             1090634852433900888199913756247986023196987723469934933603680t
+           + 
+                                                                           4
+             1405819430871907102294432537538335402102838994019667487458352t
+           + 
+                                                                         3
+             88071527950320450072536671265507748878347828884933605202432t
+           + 
+                                                                          2
+             135882489433640933229781177155977768016065765482378657129440t
+           + 
+             - 13957283442882262230559894607400314082516690749975646520320t
+           + 
+             334637692973189299277258325709308472592117112855749713920
+        *
+           z
+       + 
+                                                                    23
+         8567175484043952879756725964506833932149637101090521164936t
+       + 
+                                                                      22
+         149792392864201791845708374032728942498797519251667250945721t
+       + 
+                                                                     21
+         77258371783645822157410861582159764138123003074190374021550t
+       + 
+                                                                       20
+         1108862254126854214498918940708612211184560556764334742191654t
+       + 
+                                                                      19
+         213250494460678865219774480106826053783815789621501732672327t
+       + 
+                                                                       18
+         3668929075160666195729177894178343514501987898410131431699882t
+       + 
+                                                                      17
+         171388906471001872879490124368748236314765459039567820048872t
+       + 
+                                                                       16
+         7192430746914602166660233477331022483144921771645523139658986t
+       + 
+                                                                        15
+         - 128798674689690072812879965633090291959663143108437362453385t
+       + 
+                                                                       14
+         9553010858341425909306423132921134040856028790803526430270671t
+       + 
+                                                                       13
+         - 13296096245675492874538687646300437824658458709144441096603t
+       + 
+                                                                       12
+         9475806805814145326383085518325333106881690568644274964864413t
+       + 
+                                                                      11
+         803234687925133458861659855664084927606298794799856265539336t
+       + 
+                                                                       10
+         7338202759292865165994622349207516400662174302614595173333825t
+       + 
+                                                                       9
+         1308004628480367351164369613111971668880538855640917200187108t
+       + 
+                                                                       8
+         4268059455741255498880229598973705747098216067697754352634748t
+       + 
+                                                                      7
+         892893526858514095791318775904093300103045601514470613580600t
+       + 
+                                                                       6
+         1679152575460683956631925852181341501981598137465328797013652t
+       + 
+                                                                      5
+         269757415767922980378967154143357835544113158280591408043936t
+       + 
+                                                                      4
+         380951527864657529033580829801282724081345372680202920198224t
+       + 
+                                                                     3
+         19785545294228495032998826937601341132725035339452913286656t
+       + 
+                                                                     2
+         36477412057384782942366635303396637763303928174935079178528t
+       + 
+         - 3722212879279038648713080422224976273210890229485838670848t
+       + 
+         89079724853114348361230634484013862024728599906874105856
+       ,
+         3      2                  3       2
+      (3z  - 11z  + 8z + 4)y + 2t z  + 4t z  - 5t z - t,
+                  2
+      (z + 1)x + z  - 4z + 1}
+     ]
+       Type: List RegularTriangularSet(Integer,
+                   IndexedExponents OrderedVariableList [x,y,z,t],
+                   OrderedVariableList [x,y,z,t],
+                   NewSparseMultivariatePolynomial(Integer,
+                     OrderedVariableList [x,y,z,t]))
+
+Between a sequence of processes, thus between a ] and a [ you can see
+capital letters W, G, I and lower case letters i, w. Each time a
+capital letter appears a non-trivial computation has be performed and
+its result is put in a hash-table.  Each time a lower case letter
+appears a needed result has been found in an hash-table.  The use of
+these hash-tables generally speed up the computations.  However, on
+very large systems, it may happen that these hash-tables become too
+big to be handle by your AXIOM configuration.  Then in these
+exceptional cases, you may prefer getting a result (even if it takes a
+long time) than getting nothing.  Hence you need to know how to
+prevent the RSEGSET constructor from using these hash-tables.  In that
+case you will be using the zeroSetSplit with five arguments.  The
+first one is the input system lp as above.  The second one is a
+boolean value hash?  which is true iff you want to use hash-tables.
+The third one is boolean value clos? which is true iff you want to
+solve your system in the sense of Kalkbrener, the other way remaining
+that of Lazard.  The fourth argument is boolean value info? which is
+true iff you want to display information during the computations.  The
+last one is boolean value prep? which is true iff you want to use some
+heuristics that are performed on the input system before starting the
+real algorithm.  The value of this flag is true when you are using
+zeroSetSplit with less than five arguments.  Note that there is no
+available signature for zeroSetSplit with four arguments.
+
+We finish this section by some remarks about both ways of solving, in
+the sense of Kalkbrener or in the sense of Lazard.  For problems with
+a finite number of solutions, there are theoretically equivalent and
+the resulting decompositions are identical, up to the ordering of the
+components.  However, when solving in the sense of Lazard, the
+algorithm behaves differently.  In that case, it becomes more
+incremental than in the sense of Kalkbrener. That means the
+polynomials of the input system are considered one after another
+whereas in the sense of Kalkbrener the input system is treated more
+globally.
+
+This makes an important difference in positive dimension.  Indeed when
+solving in the sense of Kalkbrener, the Primeidealkettensatz of Krull
+is used.  That means any regular triangular containing more
+polynomials than the input system can be deleted.  This is not
+possible when solving in the sense of Lazard.  This explains why
+Kalkbrener's decompositions usually contain less components than those
+of Lazard.  However, it may happen with some examples that the
+incremental process (that cannot be used when solving in the sense of
+Kalkbrener) provide a more efficient way of solving than the global
+one even if the Primeidealkettensatz is used.  Thus just try both,
+with the various options, before concluding that you cannot solve your
+favorite system with zeroSetSplit.  There exist more options at the
+development level that are not currently available in this public
+version.
+
+See Also:
+o )help GcdDomain
+o )help OrderedAbelianMonoidSup
+o )help OrderedSet
+o )help RecursivePolynomialCategory
+o )help RegularChain
+o )help NewSparseMultivariatePolynomial
+o )help ZeroDimensionalSolvePackage
+o )help LexTriangularPackage
+o )help LazardSetSolvingPackage
+o )help SquareFreeRegularTriangularSet
+o )show RegularTriangularSet
+o $AXIOM/doc/src/algebra/regset.spad.dvi
+
+@
+\pagehead{RegularTriangularSet}{REGSET}
+\pagepic{ps/v103regulartriangularset.ps}{REGSET}{1.00}
+<<domain REGSET RegularTriangularSet>>=
+)abbrev domain REGSET RegularTriangularSet
+++ Author: Marc Moreno Maza
+++ Date Created: 08/25/1998
+++ Date Last Updated: 16/12/1998
+++ Basic Functions:
+++ Related Constructors:
+++ Also See: 
+++ AMS Classifications:
+++ Keywords:
+++ Description: 
+++ This domain provides an implementation of regular chains.
+++ Moreover, the operation \axiomOpFrom{zeroSetSplit}{RegularTriangularSetCategory}
+++ is an implementation of a new algorithm for solving polynomial systems by
+++ means of regular chains.\newline
+++ References :
+++  [1] M. MORENO MAZA "A new algorithm for computing triangular
+++      decomposition of algebraic varieties" NAG Tech. Rep. 4/98.
+++ Version: Version 11. 
+
+RegularTriangularSet(R,E,V,P) : Exports == Implementation where
+
+  R : GcdDomain
+  E : OrderedAbelianMonoidSup
+  V : OrderedSet
+  P : RecursivePolynomialCategory(R,E,V)
+  N ==> NonNegativeInteger
+  Z ==> Integer
+  B ==> Boolean
+  LP ==> List P
+  PtoP ==> P -> P
+  PS ==> GeneralPolynomialSet(R,E,V,P)
+  PWT ==> Record(val : P, tower : $)
+  BWT ==> Record(val : Boolean, tower : $)
+  LpWT ==> Record(val : (List P), tower : $)
+  Split ==> List $
+  iprintpack ==> InternalPrintPackage()
+  polsetpack ==> PolynomialSetUtilitiesPackage(R,E,V,P)
+  quasicomppack ==> QuasiComponentPackage(R,E,V,P,$)
+  regsetgcdpack ==> RegularTriangularSetGcdPackage(R,E,V,P,$)
+  regsetdecomppack ==> RegularSetDecompositionPackage(R,E,V,P,$)
+
+  Exports ==  RegularTriangularSetCategory(R,E,V,P) with
+
+     internalAugment: (P,$,B,B,B,B,B) -> List $
+       ++ \axiom{internalAugment(p,ts,b1,b2,b3,b4,b5)}
+       ++ is an internal subroutine, exported only for developement.
+     zeroSetSplit: (LP, B, B) -> Split
+       ++ \axiom{zeroSetSplit(lp,clos?,info?)} has the same specifications as
+       ++ \axiomOpFrom{zeroSetSplit}{RegularTriangularSetCategory}.
+       ++ Moreover, if \axiom{clos?} then solves in the sense of the Zariski closure
+       ++ else solves in the sense of the regular zeros. If \axiom{info?} then
+       ++ do print messages during the computations.
+     zeroSetSplit: (LP, B, B, B, B) -> Split
+       ++ \axiom{zeroSetSplit(lp,b1,b2.b3,b4)} 
+       ++ is an internal subroutine, exported only for developement.
+     internalZeroSetSplit: (LP, B, B, B) -> Split
+       ++ \axiom{internalZeroSetSplit(lp,b1,b2,b3)}
+       ++ is an internal subroutine, exported only for developement.
+     pre_process: (LP, B, B) -> Record(val: LP, towers: Split)
+       ++ \axiom{pre_process(lp,b1,b2)} 
+       ++ is an internal subroutine, exported only for developement.
+
+  Implementation == add
+
+     Rep ==> LP
+
+     rep(s:$):Rep == s pretend Rep
+     per(l:Rep):$ == l pretend $
+
+     copy ts ==
+       per(copy(rep(ts))$LP)
+     empty() ==
+       per([])
+     empty?(ts:$) ==
+       empty?(rep(ts))
+     parts ts ==
+       rep(ts)
+     members ts ==
+       rep(ts)
+     map (f : PtoP, ts : $) : $ ==
+       construct(map(f,rep(ts))$LP)$$
+     map! (f : PtoP, ts : $) : $  ==
+       construct(map!(f,rep(ts))$LP)$$
+     member? (p,ts) ==
+       member?(p,rep(ts))$LP
+     unitIdealIfCan() ==
+       "failed"::Union($,"failed")
+     roughUnitIdeal? ts ==
+       false
+     coerce(ts:$) : OutputForm ==
+       lp : List(P) := reverse(rep(ts))
+       brace([p::OutputForm for p in lp]$List(OutputForm))$OutputForm
+     mvar ts ==
+       empty? ts => error "mvar$REGSET: #1 is empty"
+       mvar(first(rep(ts)))$P
+     first ts ==
+       empty? ts => "failed"::Union(P,"failed")
+       first(rep(ts))::Union(P,"failed")
+     last ts ==
+       empty? ts => "failed"::Union(P,"failed")
+       last(rep(ts))::Union(P,"failed")
+     rest ts ==
+       empty? ts => "failed"::Union($,"failed")
+       per(rest(rep(ts)))::Union($,"failed")
+     coerce(ts:$) : (List P) ==
+       rep(ts)
+
+     collectUpper (ts,v) ==
+       empty? ts => ts
+       lp := rep(ts)
+       newlp : Rep := []
+       while (not empty? lp) and (mvar(first(lp)) > v) repeat
+         newlp := cons(first(lp),newlp)
+         lp := rest lp
+       per(reverse(newlp))
+
+     collectUnder (ts,v) ==
+       empty? ts => ts
+       lp := rep(ts)
+       while (not empty? lp) and (mvar(first(lp)) >= v) repeat
+         lp := rest lp
+       per(lp)
+
+     construct(lp:List(P)) ==
+       ts : $ := per([])
+       empty? lp => ts
+       lp := sort(infRittWu?,lp)
+       while not empty? lp repeat
+         eif := extendIfCan(ts,first(lp))
+         not (eif case $) =>
+           error"in construct : List P -> $  from REGSET : bad #1"
+         ts := eif::$
+         lp := rest lp
+       ts
+
+     extendIfCan(ts:$,p:P) ==
+       ground? p => "failed"::Union($,"failed")       
+       empty? ts => 
+         p := primitivePart p
+         (per([p]))::Union($,"failed")
+       not (mvar(ts) < mvar(p)) => "failed"::Union($,"failed")
+       invertible?(init(p),ts)@Boolean => 
+         (per(cons(p,rep(ts))))::Union($,"failed")
+       "failed"::Union($,"failed")
+
+     removeZero(p:P, ts:$): P ==
+       (ground? p) or (empty? ts) => p
+       v := mvar(p)
+       ts_v_- := collectUnder(ts,v)
+       if algebraic?(v,ts) 
+         then
+           q := lazyPrem(p,select(ts,v)::P)
+           zero? q => return q
+           zero? removeZero(q,ts_v_-) => return 0
+       empty? ts_v_- => p
+       q: P := 0
+       while positive? degree(p,v) repeat
+          q := removeZero(init(p),ts_v_-) * mainMonomial(p) + q
+          p := tail(p)
+       q + removeZero(p,ts_v_-)
+
+     internalAugment(p:P,ts:$): $ ==
+       -- ASSUME that adding p to ts DOES NOT require any split
+       ground? p => error "in internalAugment$REGSET: ground? #1"
+       first(internalAugment(p,ts,false,false,false,false,false))
+
+     internalAugment(lp:List(P),ts:$): $ ==
+       -- ASSUME that adding p to ts DOES NOT require any split
+       empty? lp => ts
+       internalAugment(rest lp, internalAugment(first lp, ts))
+
+     internalAugment(p:P,ts:$,rem?:B,red?:B,prim?:B,sqfr?:B,extend?:B): Split ==
+       -- ASSUME p is not a constant
+       -- ASSUME mvar(p) is not algebraic w.r.t. ts
+       -- ASSUME init(p) invertible modulo ts
+       -- if rem? then REDUCE p by remainder
+       -- if prim? then REPLACE p by its main primitive part
+       -- if sqfr? then FACTORIZE SQUARE FREE p over R
+       -- if extend? DO NOT ASSUME every pol in ts_v_+ is invertible modulo ts
+       v := mvar(p)
+       ts_v_- := collectUnder(ts,v)
+       ts_v_+ := collectUpper(ts,v)
+       if rem? then p := remainder(p,ts_v_-).polnum
+       -- if rem? then p := reduceByQuasiMonic(p,ts_v_-)
+       if red? then p := removeZero(p,ts_v_-)
+       if prim? then p := mainPrimitivePart p
+       if sqfr?
+         then
+           lsfp := squareFreeFactors(p)$polsetpack
+           lts: Split := [per(cons(f,rep(ts_v_-))) for f in lsfp]
+         else
+           lts: Split := [per(cons(p,rep(ts_v_-)))]
+       extend? => extend(members(ts_v_+),lts)
+       [per(concat(rep(ts_v_+),rep(us))) for us in lts]
+
+     augment(p:P,ts:$): List $ ==
+       ground? p => error "in augment$REGSET: ground? #1"
+       algebraic?(mvar(p),ts) => error "in augment$REGSET: bad #1"
+       -- ASSUME init(p) invertible modulo ts
+       -- DOES NOT ASSUME anything else.
+       -- THUS reduction, mainPrimitivePart and squareFree are NEEDED
+       internalAugment(p,ts,true,true,true,true,true)
+
+     extend(p:P,ts:$): List $ ==
+       ground? p => error "in extend$REGSET: ground? #1"
+       v := mvar(p)
+       not (mvar(ts) < mvar(p)) => error "in extend$REGSET: bad #1"
+       lts: List($) := []
+       split: List($) := invertibleSet(init(p),ts)
+       for us in split repeat
+         lts := concat(augment(p,us),lts)
+       lts
+
+     invertible?(p:P,ts:$): Boolean == 
+       toseInvertible?(p,ts)$regsetgcdpack
+       
+     invertible?(p:P,ts:$): List BWT ==
+       toseInvertible?(p,ts)$regsetgcdpack
+
+     invertibleSet(p:P,ts:$): Split ==
+       toseInvertibleSet(p,ts)$regsetgcdpack
+
+     lastSubResultant(p1:P,p2:P,ts:$): List PWT ==
+       toseLastSubResultant(p1,p2,ts)$regsetgcdpack
+
+     squareFreePart(p:P, ts: $): List PWT ==
+       toseSquareFreePart(p,ts)$regsetgcdpack
+
+     intersect(p:P, ts: $): List($) == decompose([p], [ts], false, false)$regsetdecomppack
+
+     intersect(lp: LP, lts: List($)): List($) == decompose(lp, lts, false, false)$regsetdecomppack
+        -- SOLVE in the regular zero sense 
+        -- and DO NOT PRINT info
+
+     decompose(p:P, ts: $): List($) == decompose([p], [ts], true, false)$regsetdecomppack
+
+     decompose(lp: LP, lts: List($)): List($) == decompose(lp, lts, true, false)$regsetdecomppack
+        -- SOLVE in the closure sense 
+        -- and DO NOT PRINT info
+
+     zeroSetSplit(lp:List(P)) == zeroSetSplit(lp,true,false)
+        -- by default SOLVE in the closure sense 
+        -- and DO NOT PRINT info
+
+     zeroSetSplit(lp:List(P), clos?: B) == zeroSetSplit(lp,clos?, false)
+        -- DO NOT PRINT info
+
+     zeroSetSplit(lp:List(P), clos?: B, info?: B) ==
+       -- if clos? then SOLVE in the closure sense 
+       -- if info? then PRINT info
+       -- by default USE hash-tables
+       -- and PREPROCESS the input system
+       zeroSetSplit(lp,true,clos?,info?,true)
+
+     zeroSetSplit(lp:List(P),hash?:B,clos?:B,info?:B,prep?:B) == 
+       -- if hash? then USE hash-tables
+       -- if info? then PRINT information
+       -- if clos? then SOLVE in the closure sense
+       -- if prep? then PREPROCESS the input system
+       if hash? 
+         then
+           s1, s2, s3, dom1, dom2, dom3: String
+           e: String := empty()$String
+           if info? then (s1,s2,s3) := ("w","g","i") else (s1,s2,s3) := (e,e,e)
+           if info? 
+             then 
+               (dom1, dom2, dom3) := ("QCMPACK", "REGSETGCD: Gcd", "REGSETGCD: Inv Set")
+             else
+               (dom1, dom2, dom3) := (e,e,e)
+           startTable!(s1,"W",dom1)$quasicomppack
+           startTableGcd!(s2,"G",dom2)$regsetgcdpack
+           startTableInvSet!(s3,"I",dom3)$regsetgcdpack
+       lts := internalZeroSetSplit(lp,clos?,info?,prep?)
+       if hash? 
+         then
+           stopTable!()$quasicomppack
+           stopTableGcd!()$regsetgcdpack
+           stopTableInvSet!()$regsetgcdpack
+       lts
+
+     internalZeroSetSplit(lp:LP,clos?:B,info?:B,prep?:B) ==
+       -- if info? then PRINT information
+       -- if clos? then SOLVE in the closure sense
+       -- if prep? then PREPROCESS the input system
+       if prep?
+         then
+           pp := pre_process(lp,clos?,info?)
+           lp := pp.val
+           lts := pp.towers
+         else
+           ts: $ := [[]]
+           lts := [ts]
+       lp := remove(zero?, lp)
+       any?(ground?, lp) => []
+       empty? lp => lts
+       empty? lts => lts
+       lp := sort(infRittWu?,lp)
+       clos? => decompose(lp,lts, clos?, info?)$regsetdecomppack
+       -- IN DIM > 0 with clos? the following is false ...
+       for p in lp repeat
+         lts := decompose([p],lts, clos?, info?)$regsetdecomppack
+       lts
+
+     largeSystem?(lp:LP): Boolean == 
+       -- Gonnet and Gerdt and not Wu-Wang.2
+       #lp > 16 => true
+       #lp < 13 => false
+       lts: List($) := []
+       (#lp :: Z - numberOfVariables(lp,lts)$regsetdecomppack :: Z) > 3
+
+     smallSystem?(lp:LP): Boolean == 
+       -- neural, Vermeer, Liu, and not f-633 and not Hairer-2
+       #lp < 5
+
+     mediumSystem?(lp:LP): Boolean == 
+       -- f-633 and not Hairer-2
+       lts: List($) := []
+       (numberOfVariables(lp,lts)$regsetdecomppack :: Z - #lp :: Z) < 2
+
+--     lin?(p:P):Boolean == ground?(init(p)) and one?(mdeg(p))
+     lin?(p:P):Boolean == ground?(init(p)) and (mdeg(p) = 1)
+
+     pre_process(lp:LP,clos?:B,info?:B): Record(val: LP, towers: Split) ==
+       -- if info? then PRINT information
+       -- if clos? then SOLVE in the closure sense
+       ts: $ := [[]]; 
+       lts: Split := [ts]
+       empty? lp => [lp,lts]
+       lp1: List P := []
+       lp2: List P := []
+       for p in lp repeat 
+          ground? (tail p) => lp1 := cons(p, lp1)
+          lp2 := cons(p, lp2)
+       lts: Split := decompose(lp1,[ts],clos?,info?)$regsetdecomppack
+       probablyZeroDim?(lp)$polsetpack =>
+          largeSystem?(lp) => return [lp2,lts]
+          if #lp > 7
+            then 
+              -- Butcher (8,8) + Wu-Wang.2 (13,16) 
+              lp2 := crushedSet(lp2)$polsetpack
+              lp2 := remove(zero?,lp2)
+              any?(ground?,lp2) => return [lp2, lts]
+              lp3 := [p for p in lp2 | lin?(p)]
+              lp4 := [p for p in lp2 | not lin?(p)]
+              if clos?
+                then 
+                  lts := decompose(lp4,lts, clos?, info?)$regsetdecomppack
+                else
+                  lp4 := sort(infRittWu?,lp4)
+                  for p in lp4 repeat
+                    lts := decompose([p],lts, clos?, info?)$regsetdecomppack
+              lp2 := lp3
+            else
+              lp2 := crushedSet(lp2)$polsetpack
+              lp2 := remove(zero?,lp2)
+              any?(ground?,lp2) => return [lp2, lts]
+          if clos?
+            then
+              lts := decompose(lp2,lts, clos?, info?)$regsetdecomppack
+            else
+              lp2 := sort(infRittWu?,lp2)
+              for p in lp2 repeat
+                lts := decompose([p],lts, clos?, info?)$regsetdecomppack
+          lp2 := []
+          return [lp2,lts]
+       smallSystem?(lp) => [lp2,lts]
+       mediumSystem?(lp) => [crushedSet(lp2)$polsetpack,lts]
+       lp3 := [p for p in lp2 | lin?(p)]
+       lp4 := [p for p in lp2 | not lin?(p)]
+       if clos?
+         then 
+           lts := decompose(lp4,lts, clos?, info?)$regsetdecomppack
+         else
+           lp4 := sort(infRittWu?,lp4)
+           for p in lp4 repeat
+             lts := decompose([p],lts, clos?, info?)$regsetdecomppack
+       if clos?
+         then 
+           lts := decompose(lp3,lts, clos?, info?)$regsetdecomppack
+         else
+           lp3 := sort(infRittWu?,lp3)
+           for p in lp3 repeat
+             lts := decompose([p],lts, clos?, info?)$regsetdecomppack
+       lp2 := []
+       return [lp2,lts]
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain RESRING ResidueRing}
+\pagehead{ResidueRing}{RESRING}
+\pagepic{ps/v103residuering.ps}{RESRING}{1.00}
+<<domain RESRING ResidueRing>>=
+)abbrev domain RESRING ResidueRing
+++ Author: P.Gianni
+++ Date Created: December 1992
+++ Date Last Updated:
+++ Basic Functions: 
+++ Related Constructors:
+++ Also See:
+++ AMS Classifications:
+++ Keywords: 
+++ References:
+++ Description: ResidueRing is the quotient of a polynomial ring by  an ideal.
+++ The ideal is given as a list of generators. The elements of the domain
+++ are equivalence classes expressed in terms of reduced elements
+
+ResidueRing(F,Expon,VarSet,FPol,LFPol) : Dom  == Body
+ where
+   F       :  Field
+   Expon   :  OrderedAbelianMonoidSup
+   VarSet  :  OrderedSet
+   FPol    :  PolynomialCategory(F, Expon, VarSet)
+   LFPol   :  List FPol
+   
+   Dom   == Join(CommutativeRing, Algebra F) with
+     reduce   :   FPol -> $
+     ++ reduce(f) produces the equivalence class of f in the residue ring
+     coerce   :   FPol -> $
+     ++ coerce(f) produces the equivalence class of f in the residue ring
+     lift     :     $  -> FPol
+     ++ lift(x) return the canonical representative of the equivalence class x
+   Body  ==  add 
+    --representation
+      Rep:= FPol
+      import GroebnerPackage(F,Expon,VarSet,FPol)
+      relations:= groebner(LFPol)
+      relations = [1] => error "the residue ring is the zero ring"
+    --declarations
+      x,y: $
+    --definitions
+      0 == 0$Rep
+      1 == 1$Rep
+      reduce(f : FPol) : $ == normalForm(f,relations)
+      coerce(f : FPol) : $ == normalForm(f,relations)
+      lift x  == x :: Rep :: FPol
+      x + y == x +$Rep y
+      -x == -$Rep x
+      x*y == normalForm(lift(x *$Rep y),relations)
+      (n : Integer) * x == n *$Rep x
+      (a : F) * x == a *$Rep x
+      x = y == x =$Rep y
+      characteristic()      == characteristic()$F
+      coerce(x) : OutputForm == coerce(x)$Rep
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \section{domain RESULT Result}
 \pagehead{Result}{RESULT}
 \pagepic{ps/v103result.ps}{RESULT}{1.00}
@@ -52048,6 +57214,641 @@ digraph pic {
 }
 @
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain RULE RewriteRule}
+\pagehead{RewriteRule}{RULE}
+\pagepic{ps/v103rewriterule.ps}{RULE}{1.00}
+<<domain RULE RewriteRule>>=
+)abbrev domain RULE RewriteRule
+++ Rules for the pattern matcher
+++ Author: Manuel Bronstein
+++ Date Created: 24 Oct 1988
+++ Date Last Updated: 26 October 1993
+++ Keywords: pattern, matching, rule.
+RewriteRule(Base, R, F): Exports == Implementation where
+  Base   : SetCategory
+  R      : Join(Ring, PatternMatchable Base, OrderedSet,
+                                 ConvertibleTo Pattern Base)
+  F      : Join(FunctionSpace R, PatternMatchable Base,
+                                 ConvertibleTo Pattern Base)
+
+  P    ==> Pattern Base
+
+  Exports ==>
+   Join(SetCategory, Eltable(F, F), RetractableTo Equation F) with
+    rule    : (F, F) -> $
+      ++ rule(f, g) creates the rewrite rule: \spad{f == eval(g, g is f)},
+      ++ with left-hand side f and right-hand side g.
+    rule    : (F, F, List Symbol) -> $
+      ++ rule(f, g, [f1,...,fn]) creates the rewrite rule
+      ++ \spad{f == eval(eval(g, g is f), [f1,...,fn])},
+      ++ that is a rule with left-hand side f and right-hand side g;
+      ++ The symbols f1,...,fn are the operators that are considered
+      ++ quoted, that is they are not evaluated during any rewrite,
+      ++ but just applied formally to their arguments.
+    suchThat: ($, List Symbol, List F -> Boolean) -> $
+      ++ suchThat(r, [a1,...,an], f) returns the rewrite rule r with
+      ++ the predicate \spad{f(a1,...,an)} attached to it.
+    pattern : $ -> P
+      ++ pattern(r) returns the pattern corresponding to
+      ++ the left hand side of the rule r.
+    lhs     : $ -> F
+      ++ lhs(r) returns the left hand side of the rule r.
+    rhs     : $ -> F
+      ++ rhs(r) returns the right hand side of the rule r.
+    elt     : ($, F, PositiveInteger) -> F
+      ++ elt(r,f,n) or r(f, n) applies the rule r to f at most n times.
+    quotedOperators: $ -> List Symbol
+      ++ quotedOperators(r) returns the list of operators
+      ++ on the right hand side of r that are considered
+      ++ quoted, that is they are not evaluated during any rewrite,
+      ++ but just applied formally to their arguments.
+
+  Implementation ==> add
+    import ApplyRules(Base, R, F)
+    import PatternFunctions1(Base, F)
+    import FunctionSpaceAssertions(R, F)
+
+    Rep := Record(pat: P, lft: F, rgt: F, qot: List Symbol)
+
+    mkRule      : (P, F, F, List Symbol) -> $
+    transformLhs: P -> Record(plus: F, times: F)
+    bad?        : Union(List P, "failed") -> Boolean
+    appear?     : (P, List P) -> Boolean
+    opt         : F -> P
+    F2Symbol    : F -> F
+
+    pattern x                == x.pat
+    lhs x                    == x.lft
+    rhs x                    == x.rgt
+    quotedOperators x        == x.qot
+    mkRule(pt, p, s, l)      == [pt, p, s, l]
+    coerce(eq:Equation F):$  == rule(lhs eq, rhs eq, empty())
+    rule(l, r)               == rule(l, r, empty())
+    elt(r:$, s:F) == applyRules([r pretend RewriteRule(Base, R, F)], s)
+
+    suchThat(x, l, f) ==
+      mkRule(suchThat(pattern x,l,f),  lhs x, rhs x, quotedOperators x)
+
+    x = y ==
+     (lhs x = lhs y) and (rhs x = rhs y) and
+        (quotedOperators x = quotedOperators y)
+
+    elt(r:$, s:F, n:PositiveInteger) ==
+      applyRules([r pretend RewriteRule(Base, R, F)], s, n)
+
+-- remove the extra properties from the constant symbols in f
+    F2Symbol f ==
+      l := select_!(symbolIfCan #1 case Symbol, tower f)$List(Kernel F)
+      eval(f, l, [symbolIfCan(k)::Symbol::F for k in l])
+
+    retractIfCan r ==
+      constant? pattern r =>
+        (u:= retractIfCan(lhs r)@Union(Kernel F,"failed")) case "failed"
+          => "failed"
+        F2Symbol(u::Kernel(F)::F) = rhs r
+      "failed"
+
+    rule(p, s, l) ==
+      lh := transformLhs(pt := convert(p)@P)
+      mkRule(opt(lh.times) * (opt(lh.plus) + pt),
+             lh.times * (lh.plus + p), lh.times * (lh.plus + s), l)
+
+    opt f ==
+      retractIfCan(f)@Union(R, "failed") case R => convert f
+      convert optional f
+
+-- appear?(x, [p1,...,pn]) is true if x appears as a variable in
+-- a composite pattern pi.
+    appear?(x, l) ==
+      for p in l | p ^= x repeat
+        member?(x, variables p) => return true
+      false
+
+-- a sum/product p1 @ ... @ pn is "bad" if it will not match
+-- a sum/product p1 @ ... @ pn @ p(n+1)
+-- in which case one should transform p1 @ ... @ pn to
+-- p1 @ ... @ ?p(n+1) which does not change its meaning.
+-- examples of "bad" combinations
+--   sin(x) @ sin(y)     sin(x) @ x
+-- examples of "good" combinations
+--   sin(x) @ y
+    bad? u ==
+      u case List(P) =>
+        for x in u::List(P) repeat
+          generic? x and not appear?(x, u::List(P)) => return false
+        true
+      false
+
+    transformLhs p ==
+      bad? isPlus p  => [new()$Symbol :: F, 1]
+      bad? isTimes p => [0, new()$Symbol :: F]
+      [0, 1]
+
+    coerce(x:$):OutputForm ==
+      infix(" == "::Symbol::OutputForm,
+            lhs(x)::OutputForm, rhs(x)::OutputForm)
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain ROIRC RightOpenIntervalRootCharacterization}
+The domain RightOpenIntervalRootCharacterization is the main code that
+provides the functionalities of RealRootCharacterizationCategory for the case
+of archimedean fileds. Abstract roots are encoded with a left closed right
+open interval containing the root together with a defining polynomial for the
+root.
+
+CAVEATS
+
+Since real algebraic expressions are stored as depending on "real roots" which
+are managed like variables, there is an ordering on these. This ordering is
+dynamical in the sense that any new algebraic takes precedence over older
+ones. In particular every cretaion function raises a new "real root". This has
+the effect that when you type something like sqrt(2) + sqrt(2) you have two
+new variables which happen to be equal. To avoid this name the expression such
+as in s2 := sqrt(2) ; s2 + s2
+
+Also note that computing times depend strongly on the ordering you implicitly
+provide. Please provide algebraics in the order which most natural to you.
+
+LIMITATIONS
+
+The file reclos.input show some basic use of the package.  This packages uses
+algorithms which are published in [1] and [2] which are based on field
+arithmetics, inparticular for polynomial gcd related algorithms. This can be
+quite slow for high degree polynomials and subresultants methods usually work
+best. Betas versions of the package try to use these techniques in a better
+way and work significantly faster. These are mostly based on unpublished
+algorithms and cannot be distributed. Please contact the author if you have a
+particular problem to solve or want to use these versions.
+
+Be aware that approximations behave as post-processing and that all
+computations are done excatly. They can thus be quite time consuming when
+depending on several "real roots".
+\pagehead{RightOpenIntervalRootCharacterization}{ROIRC}
+\pagepic{ps/v103rightopenintervalrootcharacterization.ps}{ROIRC}{1.00}
+<<domain ROIRC RightOpenIntervalRootCharacterization>>=
+)abbrev domain ROIRC RightOpenIntervalRootCharacterization 
+++ Author: Renaud Rioboo
+++ Date Created: summer 1992
+++ Date Last Updated: January 2004
+++ Basic Functions: provides computations with real roots of olynomials 
+++ Related Constructors: RealRootCharacterizationCategory, RealClosure
+++ Also See: 
+++ AMS Classifications:
+++ Keywords: Real Algebraic Numbers
+++ References: 
+++ Description:
+++ \axiomType{RightOpenIntervalRootCharacterization} provides work with
+++ interval root coding.
+RightOpenIntervalRootCharacterization(TheField,ThePolDom) : PUB == PRIV where
+
+  TheField : Join(OrderedRing,Field)
+  ThePolDom : UnivariatePolynomialCategory(TheField)
+
+
+  Z           ==>  Integer
+  P           ==>  ThePolDom
+  N           ==>  NonNegativeInteger
+  B           ==>  Boolean
+  UTIL        ==>  RealPolynomialUtilitiesPackage(TheField,ThePolDom)
+  RRCC        ==>  RealRootCharacterizationCategory
+  O ==> OutputForm
+  TwoPoints ==> Record(low:TheField , high:TheField)
+
+  PUB == RealRootCharacterizationCategory(TheField, ThePolDom) with
+
+      left    :             $            -> TheField
+           ++ \axiom{left(rootChar)} is the left bound of the isolating
+           ++ interval
+      right   :             $            -> TheField
+           ++ \axiom{right(rootChar)} is the right bound of the isolating
+           ++ interval
+      size    :             $            -> TheField
+           ++ The size of the isolating interval
+      middle  :             $            -> TheField
+           ++ \axiom{middle(rootChar)} is the middle of the isolating
+           ++ interval
+      refine  :             $            ->    $
+           ++ \axiom{refine(rootChar)} shrinks isolating interval around 
+           ++ \axiom{rootChar}
+      mightHaveRoots :     (P,$)         ->    B
+           ++ \axiom{mightHaveRoots(p,r)} is false if \axiom{p.r} is not 0
+      relativeApprox :     (P,$,TheField) -> TheField
+           ++ \axiom{relativeApprox(exp,c,p) = a} is relatively close to exp
+           ++ as a polynomial in c ip to precision p
+
+  PRIV == add
+
+
+
+-- local functions
+
+
+   makeChar:             (TheField,TheField,ThePolDom) ->     $
+   refine! :                              $            ->     $
+   sturmIsolate : (List(P), TheField, TheField,N,N)    -> List TwoPoints
+   isolate :                            List(P)        -> List TwoPoints
+   rootBound :                             P           ->   TheField
+--   varStar :                                P          ->     N
+   linearRecip :                       ( P , $)        -> Union(P, "failed")
+   linearZero? :                     (TheField,$)      ->     B
+   linearSign :                          (P,$)         ->     Z
+   sturmNthRoot : (List(P), TheField, TheField,N,N,N)  -> Union(TwoPoints,"failed")
+   addOne :                              P             ->      P
+   minus :                               P             ->      P
+   translate :                    (P,TheField)         ->      P
+   dilate :                       (P,TheField)         ->      P
+   invert :                              P             ->      P
+   evalOne :                             P             ->   TheField
+   hasVarsl:                     List(TheField)        ->      B
+   hasVars:                              P             ->      B
+
+-- Representation
+
+   Rep:= Record(low:TheField,high:TheField,defPol:ThePolDom)
+
+-- and now the code !
+
+
+   size(rootCode) ==
+     rootCode.high - rootCode.low
+
+   relativeApprox(pval,rootCode,prec) ==
+     -- beurk !
+     dPol := rootCode.defPol
+     degree(dPol) = 1 => 
+       c := -coefficient(dPol,0)/leadingCoefficient(dPol)
+       pval.c
+     pval := pval rem dPol
+     degree(pval) = 0 => leadingCoefficient(pval)
+     zero?(pval,rootCode)  => 0
+     while mightHaveRoots(pval,rootCode) repeat
+          rootCode := refine(rootCode)
+     dpval := differentiate(pval)
+     degree(dpval) = 0 =>
+       l := left(rootCode)
+       r := right(rootCode)
+       a := pval.l
+       b := pval.r
+       while ( abs(2*(a-b)/(a+b)) > prec ) repeat
+         rootCode := refine(rootCode)
+         l := left(rootCode)
+         r := right(rootCode)
+         a := pval.l
+         b := pval.r
+       (a+b)/(2::TheField)
+     zero?(dpval,rootCode) => 
+        relativeApprox(pval, 
+                       [left(rootCode),
+                         right(rootCode),
+                           gcd(dpval,rootCode.defPol)]$Rep,
+                       prec)
+     while mightHaveRoots(dpval,rootCode) repeat
+          rootCode := refine(rootCode)
+     l := left(rootCode)
+     r := right(rootCode)
+     a := pval.l
+     b := pval.r
+     while ( abs(2*(a-b)/(a+b)) > prec ) repeat
+       rootCode := refine(rootCode)
+       l := left(rootCode)
+       r := right(rootCode)
+       a := pval.l
+       b := pval.r
+     (a+b)/(2::TheField)
+
+   approximate(pval,rootCode,prec) ==
+     -- glurp
+     dPol := rootCode.defPol
+     degree(dPol) = 1 => 
+       c := -coefficient(dPol,0)/leadingCoefficient(dPol)
+       pval.c
+     pval := pval rem dPol
+     degree(pval) = 0 => leadingCoefficient(pval)
+     dpval := differentiate(pval)
+     degree(dpval) = 0 =>
+       l := left(rootCode)
+       r := right(rootCode)
+       while ( abs((a := pval.l) - (b := pval.r)) > prec ) repeat
+         rootCode := refine(rootCode)
+         l := left(rootCode)
+         r := right(rootCode)
+       (a+b)/(2::TheField)
+     zero?(dpval,rootCode) => 
+        approximate(pval, 
+                    [left(rootCode),
+                     right(rootCode),
+                      gcd(dpval,rootCode.defPol)]$Rep,
+                    prec)
+     while mightHaveRoots(dpval,rootCode) repeat
+          rootCode := refine(rootCode)
+     l := left(rootCode)
+     r := right(rootCode)
+     while ( abs((a := pval.l) - (b := pval.r)) > prec ) repeat
+       rootCode := refine(rootCode)
+       l := left(rootCode)
+       r := right(rootCode)
+     (a+b)/(2::TheField)
+
+
+   addOne(p) == p.(monomial(1,1)+(1::P))
+
+   minus(p) == p.(monomial(-1,1))
+
+   translate(p,a) == p.(monomial(1,1)+(a::P))
+
+   dilate(p,a) == p.(monomial(a,1))
+
+   evalOne(p) == "+" / coefficients(p)
+
+   invert(p) == 
+        d := degree(p)
+        mapExponents((d-#1)::N, p)
+
+   rootBound(p) ==
+     res : TheField := 1
+     raw :TheField := 1+boundOfCauchy(p)$UTIL
+     while (res < raw) repeat
+       res := 2*(res)
+     res
+
+   sturmNthRoot(lp,l,r,vl,vr,n) ==
+    nv := (vl - vr)::N
+    nv < n => "failed"
+    ((nv = 1) and (n = 1)) => [l,r]
+    int := (l+r)/(2::TheField)
+    lt:List(TheField):=[]
+    for t in lp repeat
+        lt := cons(t.int , lt)
+    vi := sturmVariationsOf(reverse! lt)$UTIL
+    o :Z := n - vl + vi
+    if o > 0
+    then 
+       sturmNthRoot(lp,int,r,vi,vr,o::N)
+    else
+       sturmNthRoot(lp,l,int,vl,vi,n)
+
+   sturmIsolate(lp,l,r,vl,vr) ==
+    r <= l => error "ROIRC: sturmIsolate: bad bounds"
+    n := (vl - vr)::N
+    zero?(n) => []
+    one?(n) => [[l,r]]
+    int := (l+r)/(2::TheField)
+    vi := sturmVariationsOf( [t.int for t in lp ] )$UTIL
+    append(sturmIsolate(lp,l,int,vl,vi),sturmIsolate(lp,int,r,vi,vr))
+
+   isolate(lp) ==
+     b := rootBound(first(lp))
+     l1,l2 : List(TheField)
+     (l1,l2) := ([] , [])
+     for t in reverse(lp) repeat
+       if odd?(degree(t))
+       then
+        (l1,l2):= (cons(-leadingCoefficient(t),l1),
+                   cons(leadingCoefficient(t),l2))
+       else
+        (l1,l2):= (cons(leadingCoefficient(t),l1),
+                   cons(leadingCoefficient(t),l2))
+     sturmIsolate(lp,
+                  -b,
+                  b,
+                  sturmVariationsOf(l1)$UTIL,
+                  sturmVariationsOf(l2)$UTIL)
+
+   rootOf(pol,n) ==
+    ls := sturmSequence(pol)$UTIL
+    pol := unitCanonical(first(ls)) -- this one is SqFR
+    degree(pol) = 0 => "failed"
+    numberOfMonomials(pol) = 1 => ([0,1,monomial(1,1)]$Rep)::$
+    b := rootBound(pol)
+    l1,l2 : List(TheField)
+    (l1,l2) := ([] , [])
+    for t in reverse(ls) repeat
+      if odd?(degree(t))
+      then
+       (l1,l2):= (cons(leadingCoefficient(t),l1),
+                  cons(-leadingCoefficient(t),l2))
+      else
+       (l1,l2):= (cons(leadingCoefficient(t),l1),
+                  cons(leadingCoefficient(t),l2))
+    res := sturmNthRoot(ls,
+                        -b,
+                        b,
+                        sturmVariationsOf(l2)$UTIL,
+                        sturmVariationsOf(l1)$UTIL,
+                        n)
+    res case "failed" => "failed"
+    makeChar(res.low,res.high,pol)
+
+   allRootsOf(pol) == 
+    ls := sturmSequence(unitCanonical pol)$UTIL
+    pol := unitCanonical(first(ls)) -- this one is SqFR
+    degree(pol) = 0 => []
+    numberOfMonomials(pol) = 1 => [[0,1,monomial(1,1)]$Rep]
+    [ makeChar(term.low,term.high,pol) for term in isolate(ls) ]
+
+
+   hasVarsl(l:List(TheField)) ==
+    null(l) => false
+    f := sign(first(l))
+    for term in rest(l) repeat
+      if f*term < 0 then return(true)
+    false
+    
+   hasVars(p:P) ==
+    zero?(p) => error "ROIRC: hasVars: null polynonial"
+    zero?(coefficient(p,0)) => true
+    hasVarsl(coefficients(p))
+
+
+   mightHaveRoots(p,rootChar) == 
+      a := rootChar.low
+      q := translate(p,a)
+      not(hasVars(q)) => false
+--      varStar(q) = 0 => false
+      a := (rootChar.high) - a
+      q := dilate(q,a)
+      sign(coefficient(q,0))*sign(evalOne(q)) <= 0 => true
+      q := minus(addOne(q))
+      not(hasVars(q)) => false
+--      varStar(q) = 0 => false
+      q := invert(q)
+      hasVars(addOne(q))
+--      ^(varStar(addOne(q)) = 0)
+
+   coerce(rootChar:$):O == 
+     commaSeparate([ hconcat("[" :: O , (rootChar.low)::O), 
+                     hconcat((rootChar.high)::O,"[" ::O ) ])
+
+   c1 = c2 == 
+     mM := max(c1.low,c2.low)
+     Mm := min(c1.high,c2.high)
+     mM >= Mm => false
+     rr : ThePolDom := gcd(c1.defPol,c2.defPol)
+     degree(rr) = 0 => false
+     sign(rr.mM) * sign(rr.Mm) <= 0
+
+   makeChar(left,right,pol) == 
+-- The following lines of code, which check for a possible error,
+-- cause major performance problems and were removed by Renaud Rioboo,
+-- the original author. They were originally inserted for debugging.
+--    right <= left => error "ROIRC: makeChar: Bad interval"
+--    (pol.left * pol.right) > 0 => error "ROIRC: makeChar: Bad pol"
+    res :$ := [left,right,leadingMonomial(pol)+reductum(pol)]$Rep -- safe copy
+    while zero?(pol.(res.high)) repeat refine!(res)
+    while (res.high * res.low < 0 ) repeat refine!(res)
+    zero?(pol.(res.low)) => [res.low,res.high,monomial(1,1)-(res.low)::P]
+    res
+
+   definingPolynomial(rootChar) == rootChar.defPol
+
+   linearRecip(toTest,rootChar) ==
+      c := - inv(leadingCoefficient(toTest)) * coefficient(toTest,0)
+      r := recip(rootChar.defPol.c)
+      if (r case "failed")
+      then
+        if (c - rootChar.low) * (c - rootChar.high) <= 0
+        then 
+          "failed"
+        else
+          newPol := (rootChar.defPol exquo toTest)::P
+          ((1$ThePolDom - inv(newPol.c)*newPol) exquo toTest)::P
+      else
+         ((1$ThePolDom - (r::TheField)*rootChar.defPol) exquo toTest)::P
+
+   recip(toTest,rootChar) ==
+     degree(toTest) = 0 or degree(rootChar.defPol) <= degree(toTest) =>
+       error "IRC: recip: Not reduced"
+     degree(rootChar.defPol) = 1 =>
+       error "IRC: recip: Linear Defining Polynomial"
+     degree(toTest) = 1 =>
+       linearRecip(toTest, rootChar)
+     d := extendedEuclidean((rootChar.defPol),toTest)
+     (degree(d.generator) = 0 ) => 
+         d.coef2
+     d.generator := unitCanonical(d.generator)
+     (d.generator.(rootChar.low) *
+      d.generator.(rootChar.high)<= 0) => "failed"
+     newPol := (rootChar.defPol exquo (d.generator))::P
+     degree(newPol) = 1 =>
+       c := - inv(leadingCoefficient(newPol)) * coefficient(newPol,0)
+       inv(toTest.c)::P
+     degree(toTest) = 1 => 
+       c := - coefficient(toTest,0)/ leadingCoefficient(toTest)
+       ((1$ThePolDom - inv(newPol.(c))*newPol) exquo toTest)::P
+     d := extendedEuclidean(newPol,toTest)
+     d.coef2
+
+   linearSign(toTest,rootChar) ==
+      c := - inv(leadingCoefficient(toTest)) * coefficient(toTest,0)
+      ev := sign(rootChar.defPol.c)
+      if zero?(ev)
+      then
+        if (c - rootChar.low) * (c - rootChar.high) <= 0
+        then
+          0
+        else
+          sign(toTest.(rootChar.high))
+      else
+        if (ev*sign(rootChar.defPol.(rootChar.high)) <= 0 )
+        then
+          sign(toTest.(rootChar.high))
+        else
+          sign(toTest.(rootChar.low))
+
+   sign(toTest,rootChar) ==
+     degree(toTest) = 0 or degree(rootChar.defPol) <= degree(toTest) =>
+       error "IRC: sign: Not reduced"
+     degree(rootChar.defPol) = 1 =>
+       error "IRC: sign: Linear Defining Polynomial"
+     degree(toTest) = 1 =>
+      linearSign(toTest, rootChar)
+     s := sign(leadingCoefficient(toTest))
+     toTest := monomial(1,degree(toTest))+
+               inv(leadingCoefficient(toTest))*reductum(toTest)
+     delta := gcd(toTest,rootChar.defPol)
+     newChar := [rootChar.low,rootChar.high,rootChar.defPol]$Rep
+     if degree(delta) > 0
+     then
+       if sign(delta.(rootChar.low) * delta.(rootChar.high)) <= 0
+       then
+        return(0)
+       else
+        newChar.defPol := (newChar.defPol exquo delta) :: P
+        toTest := toTest rem (newChar.defPol)
+     degree(toTest) = 0 => s * sign(leadingCoefficient(toTest))
+     degree(toTest) = 1 => s * linearSign(toTest, newChar)
+     while mightHaveRoots(toTest,newChar) repeat
+       newChar := refine(newChar)
+     s*sign(toTest.(newChar.low))
+
+   linearZero?(c,rootChar) == 
+      zero?((rootChar.defPol).c) and 
+       (c - rootChar.low) * (c - rootChar.high) <= 0
+
+   zero?(toTest,rootChar) ==
+     degree(toTest) = 0 or degree(rootChar.defPol) <= degree(toTest) =>
+       error "IRC: zero?: Not reduced"
+     degree(rootChar.defPol) = 1 =>
+       error "IRC: zero?: Linear Defining Polynomial"
+     degree(toTest) = 1 => 
+      linearZero?(- inv(leadingCoefficient(toTest)) * coefficient(toTest,0),
+                  rootChar)
+     toTest := monomial(1,degree(toTest))+
+               inv(leadingCoefficient(toTest))*reductum(toTest)
+     delta := gcd(toTest,rootChar.defPol)
+     degree(delta) = 0 => false
+     sign(delta.(rootChar.low) * delta.(rootChar.high)) <= 0
+
+
+   refine!(rootChar) ==
+     -- this is not a safe function, it can work with badly created object
+     -- we do not assume (rootChar.defPol).(rootChar.high) <> 0
+        int := middle(rootChar)
+        s1 := sign((rootChar.defPol).(rootChar.low))
+        zero?(s1) =>
+          rootChar.high := int
+          rootChar.defPol := monomial(1,1) - (rootChar.low)::P
+          rootChar
+        s2 := sign((rootChar.defPol).int)
+        zero?(s2) =>
+          rootChar.low := int
+          rootChar.defPol := monomial(1,1) - int::P
+          rootChar
+        if (s1*s2 < 0)
+        then 
+          rootChar.high := int
+        else 
+          rootChar.low := int
+        rootChar
+
+   refine(rootChar) ==
+     -- we assume (rootChar.defPol).(rootChar.high) <> 0
+        int := middle(rootChar)
+        s:= (rootChar.defPol).int * (rootChar.defPol).(rootChar.high)
+        zero?(s) => [int,rootChar.high,monomial(1,1)-int::P]
+        if s < 0 
+        then 
+          [int,rootChar.high,rootChar.defPol]
+        else 
+          [rootChar.low,int,rootChar.defPol]
+
+   left(rootChar) == rootChar.low
+
+   right(rootChar) == rootChar.high
+
+   middle(rootChar) == (rootChar.low + rootChar.high)/(2::TheField)
+
+--   varStar(p) == -- if 0 no roots in [0,:infty[
+--     res : N := 0
+--     lsg := sign(coefficient(p,0))
+--     l := [ sign(i) for i in reverse!(coefficients(p))]
+--     for sg in l repeat
+--      if (sg ^= lsg) then res := res + 1
+--      lsg := sg
+--     res
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \section{domain ROMAN RomanNumeral}
 <<RomanNumeral.input>>=
 -- integer.spad.pamphlet RomanNumeral.input
@@ -52378,6 +58179,432 @@ RomanNumeral(): IntegerNumberSystem with
 
 @
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain ROUTINE RoutinesTable}
+\pagehead{RoutinesTable}{ROUTINE}
+\pagepic{ps/v103routinestable.ps}{ROUTINE}{1.00}
+<<domain ROUTINE RoutinesTable>>=
+)abbrev domain ROUTINE RoutinesTable
+++ Author: Brian Dupee
+++ Date Created: August 1994
+++ Date Last Updated: December 1997
+++ Basic Operations: routines, getMeasure
+++ Related Constructors: TableAggregate(Symbol,Any)
+++ Description:
+++ \axiomType{RoutinesTable} implements a database and associated tuning
+++ mechanisms for a set of known NAG routines
+RoutinesTable(): E == I where
+  F	==> Float
+  ST	==> String
+  LST	==> List String
+  Rec	==> Record(key:Symbol,entry:Any)
+  RList	==> List(Record(key:Symbol,entry:Any))
+  IFL	==> List(Record(ifail:Integer,instruction:ST))
+  Entry	==> Record(chapter:ST, type:ST, domainName: ST, 
+                     defaultMin:F, measure:F, failList:IFL, explList:LST)
+
+  E ==> TableAggregate(Symbol,Any) with
+
+    concat:(%,%) -> %
+      ++ concat(x,y) merges two tables x and y
+    routines:() -> %
+      ++ routines() initialises a database of known NAG routines
+    selectIntegrationRoutines:% -> % 
+      ++ selectIntegrationRoutines(R) chooses only those routines from 
+      ++ the database which are for integration
+    selectOptimizationRoutines:% -> % 
+      ++ selectOptimizationRoutines(R) chooses only those routines from 
+      ++ the database which are for integration
+    selectPDERoutines:% -> % 
+      ++ selectPDERoutines(R) chooses only those routines from the 
+      ++ database which are for the solution of PDE's
+    selectODEIVPRoutines:% -> % 
+      ++ selectODEIVPRoutines(R) chooses only those routines from the 
+      ++ database which are for the solution of ODE's
+    selectFiniteRoutines:% -> % 
+      ++ selectFiniteRoutines(R) chooses only those routines from the 
+      ++ database which are designed for use with finite expressions
+    selectSumOfSquaresRoutines:% -> % 
+      ++ selectSumOfSquaresRoutines(R) chooses only those routines from the 
+      ++ database which are designed for use with sums of squares
+    selectNonFiniteRoutines:% -> % 
+      ++ selectNonFiniteRoutines(R) chooses only those routines from the 
+      ++ database which are designed for use with non-finite expressions.
+    selectMultiDimensionalRoutines:% -> %
+      ++ selectMultiDimensionalRoutines(R) chooses only those routines from 
+      ++ the database which are designed for use with multi-dimensional
+      ++ expressions
+    changeThreshhold:(%,Symbol,F) -> %
+      ++ changeThreshhold(R,s,newValue) changes the value below which, 
+      ++ given a NAG routine generating a higher measure, the routines will 
+      ++ make no attempt to generate a measure.
+    changeMeasure:(%,Symbol,F) -> %
+      ++ changeMeasure(R,s,newValue) changes the maximum value for a 
+      ++ measure of the given NAG routine.
+    getMeasure:(%,Symbol) -> F
+      ++ getMeasure(R,s) gets the current value of the maximum measure for 
+      ++ the given NAG routine.
+    getExplanations:(%,ST) -> LST
+      ++ getExplanations(R,s) gets the explanations of the output parameters for 
+      ++ the given NAG routine.
+    deleteRoutine!:(%,Symbol) -> %
+      ++ deleteRoutine!(R,s) destructively deletes the given routine from 
+      ++ the current database of NAG routines
+    showTheRoutinesTable:() -> %
+      ++ showTheRoutinesTable() returns the current table of NAG routines.
+    recoverAfterFail:(%,ST,Integer) ->  Union(ST,"failed")
+      ++ recoverAfterFail(routs,routineName,ifailValue) acts on the 
+      ++ instructions given by the ifail list
+    finiteAggregate
+
+  I ==> Result add
+
+    Rep := Result
+    import Rep
+
+    theRoutinesTable:% := routines()
+
+    showTheRoutinesTable():% == theRoutinesTable
+
+    integrationRoutine?(r:Record(key:Symbol,entry:Any)):Boolean ==
+      (a := retractIfCan(r.entry)$AnyFunctions1(Entry)) case Entry =>
+        elt(a,chapter) = "Integration"
+      false
+
+    selectIntegrationRoutines(R:%):% == select(integrationRoutine?,R)
+     
+    optimizationRoutine?(r:Record(key:Symbol,entry:Any)):Boolean ==
+      (a := retractIfCan(r.entry)$AnyFunctions1(Entry)) case Entry =>
+        elt(a,chapter) = "Optimization"
+      false
+
+    selectOptimizationRoutines(R:%):% == select(optimizationRoutine?,R)
+     
+    PDERoutine?(r:Record(key:Symbol,entry:Any)):Boolean ==
+      (a := retractIfCan(r.entry)$AnyFunctions1(Entry)) case Entry =>
+        elt(a,chapter) = "PDE"
+      false
+
+    selectPDERoutines(R:%):% == select(PDERoutine?,R)
+     
+    ODERoutine?(r:Record(key:Symbol,entry:Any)):Boolean ==
+      (a := retractIfCan(r.entry)$AnyFunctions1(Entry)) case Entry =>
+        elt(a,chapter) = "ODE"
+      false
+
+    selectODEIVPRoutines(R:%):% == select(ODERoutine?,R)
+     
+    sumOfSquaresRoutine?(r:Record(key:Symbol,entry:Any)):Boolean ==
+      (a := retractIfCan(r.entry)$AnyFunctions1(Entry)) case Entry =>
+        elt(a,type) = "SS"
+      false
+
+    selectSumOfSquaresRoutines(R:%):% == select(sumOfSquaresRoutine?,R)
+
+    finiteRoutine?(r:Record(key:Symbol,entry:Any)):Boolean ==
+      (a := retractIfCan(r.entry)$AnyFunctions1(Entry)) case Entry =>
+        elt(a,type) = "One-dimensional finite"
+      false
+
+    selectFiniteRoutines(R:%):% == select(finiteRoutine?,R)
+
+    infiniteRoutine?(r:Record(key:Symbol,entry:Any)):Boolean ==
+      (a := retractIfCan(r.entry)$AnyFunctions1(Entry)) case Entry =>
+        elt(a,type) = "One-dimensional infinite"
+      false
+
+    semiInfiniteRoutine?(r:Record(key:Symbol,entry:Any)):Boolean ==
+      (a := retractIfCan(r.entry)$AnyFunctions1(Entry)) case Entry =>
+        elt(a,type) = "One-dimensional semi-infinite"
+      false
+
+    nonFiniteRoutine?(r:Record(key:Symbol,entry:Any)):Boolean ==
+      (semiInfiniteRoutine?(r) or infiniteRoutine?(r))
+
+    selectNonFiniteRoutines(R:%):% == select(nonFiniteRoutine?,R)
+
+    multiDimensionalRoutine?(r:Record(key:Symbol,entry:Any)):Boolean ==
+      (a := retractIfCan(r.entry)$AnyFunctions1(Entry)) case Entry =>
+        elt(a,type) = "Multi-dimensional"
+      false
+
+    selectMultiDimensionalRoutines(R:%):% == select(multiDimensionalRoutine?,R)
+
+    concat(a:%,b:%):% ==
+      membersOfa := (members(a)@List(Record(key:Symbol,entry:Any)))
+      membersOfb := (members(b)@List(Record(key:Symbol,entry:Any)))
+      allMembers:=
+        concat(membersOfa,membersOfb)$List(Record(key:Symbol,entry:Any))
+      construct(allMembers)
+
+    changeThreshhold(R:%,s:Symbol,newValue:F):% ==
+      (a := search(s,R)) case Any =>
+        e := retract(a)$AnyFunctions1(Entry)
+        e.defaultMin := newValue
+        a := coerce(e)$AnyFunctions1(Entry)
+        insert!([s,a],R)
+      error("changeThreshhold","Cannot find routine of that name")$ErrorFunctions
+      
+    changeMeasure(R:%,s:Symbol,newValue:F):% ==
+      (a := search(s,R)) case Any =>
+        e := retract(a)$AnyFunctions1(Entry)
+        e.measure := newValue
+        a := coerce(e)$AnyFunctions1(Entry)
+        insert!([s,a],R)
+      error("changeMeasure","Cannot find routine of that name")$ErrorFunctions
+      
+    getMeasure(R:%,s:Symbol):F ==
+      (a := search(s,R)) case Any =>
+        e := retract(a)$AnyFunctions1(Entry)
+        e.measure
+      error("getMeasure","Cannot find routine of that name")$ErrorFunctions
+
+    deleteRoutine!(R:%,s:Symbol):% ==
+      (a := search(s,R)) case Any =>
+        e:Record(key:Symbol,entry:Any) := [s,a]
+        remove!(e,R)
+      error("deleteRoutine!","Cannot find routine of that name")$ErrorFunctions
+
+    routines():% ==
+      f := "One-dimensional finite"
+      s := "One-dimensional semi-infinite"
+      i := "One-dimensional infinite"
+      m := "Multi-dimensional"
+      int := "Integration"
+      ode := "ODE"
+      pde := "PDE"
+      opt := "Optimization"
+      d01ajfExplList:LST := ["result:  Calculated value of the integral",
+                                 "iw:  iw(1) contains the actual number of sub-intervals used, the rest is workspace",
+                                  "w:  contains the end-points of the sub-intervals used along with the integral contributions and error estimates over the sub-intervals",
+                                   "abserr:  the estimate of the absolute error of the result",
+                                    "ifail:  the error warning parameter",
+                                     "method:  details of the method used and measures of all methods",
+                                      "attributes:  a list of the attributes pertaining to the integrand which had some bearing on the choice of method"]
+      d01asfExplList:LST := ["result:  Calculated value of the integral",
+                                 "iw:  iw(1) contains the actual number of sub-intervals used, the rest is workspace",
+                                  "lst:  contains the actual number of sub-intervals used",
+                                   "erlst:  contains the error estimates over the sub-intervals",
+                                    "rslst:  contains the integral contributions of the sub-intervals",
+                                     "ierlst:  contains the error flags corresponding to the values in rslst",
+                                      "abserr:  the estimate of the absolute error of the result",
+                                       "ifail:  the error warning parameter",
+                                        "method:  details of the method used and measures of all methods",
+                                         "attributes:  a list of the attributes pertaining to the integrand which had some bearing on the choice of method"]
+      d01fcfExplList:LST := ["result:  Calculated value of the integral",
+                                 "acc:  the estimate of the relative error of the result",
+                                  "minpts:  the number of integrand evaluations",
+                                   "ifail:  the error warning parameter",
+                                    "method:  details of the method used and measures of all methods",
+                                     "attributes:  a list of the attributes pertaining to the integrand which had some bearing on the choice of method"]
+      d01transExplList:LST := ["result:  Calculated value of the integral",
+                                   "abserr:  the estimate of the absolute error of the result",
+                                    "method:  details of the method and transformation used and measures of all methods",
+                                     "d01***AnnaTypeAnswer:  the individual results from the routines",
+                                      "attributes:  a list of the attributes pertaining to the integrand which had some bearing on the choice of method"]
+      d02bhfExplList:LST := ["x:  the value of x at the end of the calculation",
+                                  "y:  the computed values of Y\[1\]..Y\[n\] at x",
+                                   "tol:   the (possible) estimate of the error; this is not guarunteed",
+                                    "ifail:  the error warning parameter",
+                                     "method:  details of the method used and measures of all methods",
+                                      "intensityFunctions:  a list of the attributes and values pertaining to the ODE which had some bearing on the choice of method"]
+      d02bbfExplList:LST := concat(["result:  the computed values of the solution at the required points"],d02bhfExplList)$LST
+      d03eefExplList:LST := ["See the NAG On-line Documentation for D03EEF/D03EDF",
+                                  "u:  the computed solution u[i][j] is returned in u(i+(j-1)*ngx),for i = 1,2,..ngx; j = 1,2,..ngy"]
+      e04fdfExplList:LST := ["x:  the position of the minimum",
+                                  "objf:  the value of the objective function at x",
+                                   "ifail:  the error warning parameter",
+                                    "method:  details of the method used and measures of all methods",
+                                      "attributes:  a list of the attributes pertaining to the function or functions which had some bearing on the choice of method"]
+      e04dgfExplList:LST := concat(e04fdfExplList,
+                                        ["objgrd:  the values of the derivatives at x",
+                                          "iter:  the number of iterations performed"])$LST
+      e04jafExplList:LST := concat(e04fdfExplList,
+                                        ["bu:  the values of the upper bounds used",
+                                          "bl:  the values of the lower bounds used"])$LST
+      e04ucfExplList:LST := concat(e04dgfExplList,
+                                        ["istate:  the status of every constraint at x",
+                                          "clamda:  the QP multipliers for the last QP sub-problem",
+                                           "For other output parameters see the NAG On-line Documentation for E04UCF"])$LST
+      e04mbfExplList:LST := concat(e04fdfExplList,
+                                        ["istate:  the status of every constraint at x",
+                                          "clamda:  the Lagrange multipliers for each constraint"])$LST
+      d01ajfIfail:IFL := [[1,"incrFunEvals"], [2,"delete"], [3,"delete"], [4,"delete"],  
+                          [5,"delete"], [6,"delete"]]
+      d01akfIfail:IFL := [[1,"incrFunEvals"], [2,"delete"], [3,"delete"], [4,"delete"]]
+      d01alfIfail:IFL := [[1,"incrFunEvals"], [2,"delete"], [3,"delete"], [4,"delete"], 
+                          [5,"delete"], [6,"delete"], [7,"delete"]]
+      d01amfIfail:IFL := [[1,"incrFunEvals"], [2,"delete"], [3,"delete"], [4,"delete"], 
+                          [5,"delete"], [6,"delete"]]
+      d01anfIfail:IFL := [[1,"incrFunEvals"], [2,"delete"], [3,"delete"], [4,"delete"], 
+                          [5,"delete"], [6,"delete"], [7,"delete"]]
+      d01apfIfail:IFL :=
+        [[1,"incrFunEvals"], [2,"delete"], [3,"delete"], [4,"delete"], [5,"delete"]]
+      d01aqfIfail:IFL :=
+        [[1,"incrFunEvals"], [2,"delete"], [3,"delete"], [4,"delete"], [5,"delete"]]
+      d01asfIfail:IFL := [[1,"incrFunEvals"], [2,"delete"], [3,"delete"], [4,"delete"], 
+            [5,"delete"], [6,"delete"], [7,"delete"], [8,"delete"], [9,"delete"]]
+      d01fcfIfail:IFL := [[1,"delete"], [2,"incrFunEvals"], [3,"delete"]]
+      d01gbfIfail:IFL := [[1,"delete"], [2,"incrFunEvals"]]
+      d02bbfIfail:IFL := 
+        [[1,"delete"], [2,"decrease tolerance"], [3,"increase tolerance"],
+         [4,"delete"], [5,"delete"], [6,"delete"], [7,"delete"]]
+      d02bhfIfail:IFL := 
+        [[1,"delete"], [2,"decrease tolerance"], [3,"increase tolerance"],
+         [4,"no action"], [5,"delete"], [6,"delete"], [7,"delete"]]
+      d02cjfIfail:IFL := 
+        [[1,"delete"], [2,"decrease tolerance"], [3,"increase tolerance"],
+         [4,"delete"], [5,"delete"], [6,"no action"], [7,"delete"]]
+      d02ejfIfail:IFL := 
+        [[1,"delete"], [2,"decrease tolerance"], [3,"increase tolerance"],
+         [4,"delete"], [5,"delete"], [6,"no action"], [7,"delete"], [8,"delete"],
+          [9,"delete"]]
+      e04dgfIfail:IFL := [[3,"delete"], [4,"no action"], [6,"delete"], 
+                          [7,"delete"], [8,"delete"], [9,"delete"]]
+      e04fdfIfail:IFL := 
+        [[1,"delete"], [2,"delete"], [3,"delete"], [4,"delete"], 
+          [5,"no action"], [6,"no action"], [7,"delete"], [8,"delete"]]
+      e04gcfIfail:IFL := [[1,"delete"], [2,"delete"], [3,"delete"], [4,"delete"], 
+        [5,"no action"], [6,"no action"], [7,"delete"], [8,"delete"], [9,"delete"]]
+      e04jafIfail:IFL := [[1,"delete"], [2,"delete"], [3,"delete"], [4,"delete"], 
+        [5,"no action"], [6,"no action"], [7,"delete"], [8,"delete"], [9,"delete"]]
+      e04mbfIfail:IFL := 
+        [[1,"delete"], [2,"delete"], [3,"delete"], [4,"delete"], [5,"delete"]]
+      e04nafIfail:IFL := 
+        [[1,"delete"], [2,"delete"], [3,"delete"], [4,"delete"], [5,"delete"],
+          [6,"delete"], [7,"delete"], [8,"delete"], [9,"delete"]]
+      e04ucfIfail:IFL := [[1,"delete"], [2,"delete"], [3,"delete"], [4,"delete"], 
+        [5,"delete"], [6,"delete"], [7,"delete"], [8,"delete"], [9,"delete"]]
+      d01ajfEntry:Entry := [int, f, "d01ajfAnnaType",0.4,0.4,d01ajfIfail,d01ajfExplList]
+      d01akfEntry:Entry := [int, f, "d01akfAnnaType",0.6,1.0,d01akfIfail,d01ajfExplList]
+      d01alfEntry:Entry := [int, f, "d01alfAnnaType",0.6,0.6,d01alfIfail,d01ajfExplList]
+      d01amfEntry:Entry := [int, i, "d01amfAnnaType",0.5,0.5,d01amfIfail,d01ajfExplList]
+      d01anfEntry:Entry := [int, f, "d01anfAnnaType",0.6,0.9,d01anfIfail,d01ajfExplList]
+      d01apfEntry:Entry := [int, f, "d01apfAnnaType",0.7,0.7,d01apfIfail,d01ajfExplList]
+      d01aqfEntry:Entry := [int, f, "d01aqfAnnaType",0.6,0.7,d01aqfIfail,d01ajfExplList]
+      d01asfEntry:Entry := [int, s, "d01asfAnnaType",0.6,0.9,d01asfIfail,d01asfExplList]
+      d01transEntry:Entry:=[int, i, "d01TransformFunctionType",0.6,0.9,[],d01transExplList]
+      d01gbfEntry:Entry := [int, m, "d01gbfAnnaType",0.6,0.6,d01gbfIfail,d01fcfExplList]
+      d01fcfEntry:Entry := [int, m, "d01fcfAnnaType",0.5,0.5,d01fcfIfail,d01fcfExplList]
+      d02bbfEntry:Entry := [ode, "IVP", "d02bbfAnnaType",0.7,0.5,d02bbfIfail,d02bbfExplList]
+      d02bhfEntry:Entry := [ode, "IVP", "d02bhfAnnaType",0.7,0.49,d02bhfIfail,d02bhfExplList]
+      d02cjfEntry:Entry := [ode, "IVP", "d02cjfAnnaType",0.7,0.5,d02cjfIfail,d02bbfExplList]
+      d02ejfEntry:Entry := [ode, "IVP", "d02ejfAnnaType",0.7,0.5,d02ejfIfail,d02bbfExplList]
+      d03eefEntry:Entry := [pde, "2", "d03eefAnnaType",0.6,0.5,[],d03eefExplList]
+      --d03fafEntry:Entry := [pde, "3", "d03fafAnnaType",0.6,0.5,[],[]]
+      e04dgfEntry:Entry := [opt, "CGA", "e04dgfAnnaType",0.4,0.4,e04dgfIfail,e04dgfExplList]
+      e04fdfEntry:Entry := [opt, "SS", "e04fdfAnnaType",0.7,0.7,e04fdfIfail,e04fdfExplList]
+      e04gcfEntry:Entry := [opt, "SS", "e04gcfAnnaType",0.8,0.8,e04gcfIfail,e04fdfExplList]
+      e04jafEntry:Entry := [opt, "QNA", "e04jafAnnaType",0.5,0.5,e04jafIfail,e04jafExplList]
+      e04mbfEntry:Entry := [opt, "LP", "e04mbfAnnaType",0.7,0.7,e04mbfIfail,e04mbfExplList]
+      e04nafEntry:Entry := [opt, "QP", "e04nafAnnaType",0.7,0.7,e04nafIfail,e04mbfExplList]
+      e04ucfEntry:Entry := [opt, "SQP", "e04ucfAnnaType",0.6,0.6,e04ucfIfail,e04ucfExplList]
+      rl:RList :=
+        [["d01apf" :: Symbol, coerce(d01apfEntry)$AnyFunctions1(Entry)],_
+         ["d01aqf" :: Symbol, coerce(d01aqfEntry)$AnyFunctions1(Entry)],_
+         ["d01alf" :: Symbol, coerce(d01alfEntry)$AnyFunctions1(Entry)],_
+         ["d01anf" :: Symbol, coerce(d01anfEntry)$AnyFunctions1(Entry)],_
+         ["d01akf" :: Symbol, coerce(d01akfEntry)$AnyFunctions1(Entry)],_
+         ["d01ajf" :: Symbol, coerce(d01ajfEntry)$AnyFunctions1(Entry)],_
+         ["d01asf" :: Symbol, coerce(d01asfEntry)$AnyFunctions1(Entry)],_
+         ["d01amf" :: Symbol, coerce(d01amfEntry)$AnyFunctions1(Entry)],_
+         ["d01transform" :: Symbol, coerce(d01transEntry)$AnyFunctions1(Entry)],_
+         ["d01gbf" :: Symbol, coerce(d01gbfEntry)$AnyFunctions1(Entry)],_
+         ["d01fcf" :: Symbol, coerce(d01fcfEntry)$AnyFunctions1(Entry)],_
+         ["d02bbf" :: Symbol, coerce(d02bbfEntry)$AnyFunctions1(Entry)],_
+         ["d02bhf" :: Symbol, coerce(d02bhfEntry)$AnyFunctions1(Entry)],_
+         ["d02cjf" :: Symbol, coerce(d02cjfEntry)$AnyFunctions1(Entry)],_
+         ["d02ejf" :: Symbol, coerce(d02ejfEntry)$AnyFunctions1(Entry)],_
+         ["d03eef" :: Symbol, coerce(d03eefEntry)$AnyFunctions1(Entry)],_
+         --["d03faf" :: Symbol, coerce(d03fafEntry)$AnyFunctions1(Entry)],
+         ["e04dgf" :: Symbol, coerce(e04dgfEntry)$AnyFunctions1(Entry)],_
+         ["e04fdf" :: Symbol, coerce(e04fdfEntry)$AnyFunctions1(Entry)],_
+         ["e04gcf" :: Symbol, coerce(e04gcfEntry)$AnyFunctions1(Entry)],_
+         ["e04jaf" :: Symbol, coerce(e04jafEntry)$AnyFunctions1(Entry)],_
+         ["e04mbf" :: Symbol, coerce(e04mbfEntry)$AnyFunctions1(Entry)],_
+         ["e04naf" :: Symbol, coerce(e04nafEntry)$AnyFunctions1(Entry)],_
+         ["e04ucf" :: Symbol, coerce(e04ucfEntry)$AnyFunctions1(Entry)]]
+      construct(rl)
+
+    getIFL(s:Symbol,l:%):Union(IFL,"failed") ==
+      o := search(s,l)$%
+      o case "failed" => "failed"
+      e := retractIfCan(o)$AnyFunctions1(Entry)
+      e case "failed" => "failed"
+      e.failList
+
+    getInstruction(l:IFL,ifailValue:Integer):Union(ST,"failed") ==
+      output := empty()$ST
+      for i in 1..#l repeat
+        if ((l.i).ifail=ifailValue)@Boolean then 
+          output := (l.i).instruction
+      empty?(output)$ST => "failed"
+      output
+
+    recoverAfterFail(routs:%,routineName:ST,
+                      ifailValue:Integer):Union(ST,"failed") ==
+      name := routineName :: Symbol
+      failedList := getIFL(name,routs)
+      failedList case "failed" => "failed"
+      empty? failedList => "failed"
+      instr := getInstruction(failedList,ifailValue)
+      instr case "failed" => concat(routineName," failed")$ST
+      (instr = "delete")@Boolean => 
+        deleteRoutine!(routs,name)
+        concat(routineName," failed - trying alternatives")$ST
+      instr
+
+    getExplanations(R:%,routineName:ST):LST ==
+      name := routineName :: Symbol
+      (a := search(name,R)) case Any => 
+        e := retract(a)$AnyFunctions1(Entry)
+        e.explList
+      empty()$LST
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain RULESET Ruleset}
+\pagehead{Ruleset}{RULESET}
+\pagepic{ps/v103ruleset.ps}{RULESET}{1.00}
+<<domain RULESET Ruleset>>=
+)abbrev domain RULESET Ruleset
+++ Sets of rules for the pattern matcher
+++ Author: Manuel Bronstein
+++ Date Created: 20 Mar 1990
+++ Date Last Updated: 29 Jun 1990
+++ Description:
+++   A ruleset is a set of pattern matching rules grouped together.
+++ Keywords: pattern, matching, rule.
+Ruleset(Base, R, F): Exports == Implementation where
+  Base   : SetCategory
+  R      : Join(Ring, PatternMatchable Base, OrderedSet,
+                                 ConvertibleTo Pattern Base)
+  F      : Join(FunctionSpace R, PatternMatchable Base,
+                                 ConvertibleTo Pattern Base)
+
+  RR ==> RewriteRule(Base, R, F)
+
+  Exports ==> Join(SetCategory, Eltable(F, F)) with
+    ruleset: List RR -> $
+      ++ ruleset([r1,...,rn]) creates the rule set \spad{{r1,...,rn}}.
+    rules  : $ -> List RR
+      ++ rules(r) returns the rules contained in r.
+    elt    : ($, F, PositiveInteger) -> F
+      ++ elt(r,f,n) or r(f, n) applies all the rules of r to f at most n times.
+
+  Implementation ==> add
+    import ApplyRules(Base, R, F)
+
+    Rep := Set RR
+
+    ruleset l                        == {l}$Rep
+    coerce(x:$):OutputForm           == coerce(x)$Rep
+    x = y                            == x =$Rep y
+    elt(x:$, f:F)                    == applyRules(rules x, f)
+    elt(r:$, s:F, n:PositiveInteger) == applyRules(rules r, s, n)
+    rules x                          == parts(x)$Rep
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \chapter{Chapter S}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \section{domain FORMULA ScriptFormulaFormat}
@@ -62637,12 +68864,14 @@ Note that this code is not included in the generated catdef.spad file.
 <<domain JORDAN AssociatedJordanAlgebra>>
 <<domain LIE AssociatedLieAlgebra>>
 <<domain ALIST AssociationList>>
+<<domain ATTRBUT AttributeButtons>>
 <<domain AUTOMOR Automorphism>>
 
 <<domain BPADIC BalancedPAdicInteger>>
 <<domain BPADICRT BalancedPAdicRational>>
 <<domain BFUNCT BasicFunctions>>
 <<domain BOP BasicOperator>>
+<<domain BINARY BinaryExpansion>>
 <<domain BINFILE BinaryFile>>
 <<domain BITS Bits>>
 <<domain BOOLEAN Boolean>>
@@ -62658,6 +68887,7 @@ Note that this code is not included in the generated catdef.spad file.
 <<domain DHMATRIX DenavitHartenbergMatrix>>
 <<domain DBASE Database>>
 <<domain DLIST DataList>>
+<<domain DECIMAL DecimalExpansion>>
 <<domain DEQUEUE Dequeue>>
 <<domain DERHAM DeRhamComplex>>
 <<domain DSMP DifferentialSparseMultivariatePolynomial>>
@@ -62738,6 +68968,7 @@ Note that this code is not included in the generated catdef.spad file.
 <<domain GSERIES GeneralUnivariatePowerSeries>>
 
 <<domain HEAP Heap>>
+<<domain HEXADEC HexadecimalExpansion>>
 <<domain HDP HomogeneousDirectProduct>>
 <<domain HDMP HomogeneousDistributedMultivariatePolynomial>>
 <<domain HELLFDIV HyperellipticFiniteDivisor>>
@@ -62855,14 +69086,24 @@ Note that this code is not included in the generated catdef.spad file.
 <<domain PRODUCT Product>>
 
 <<domain QFORM QuadraticForm>> 
+<<domain QALGSET QuasiAlgebraicSet>>
+<<domain QUAT Quaternion>>
 <<domain QEQUAT QueryEquation>>
 <<domain QUEUE Queue>>
 
 <<domain RADFF RadicalFunctionField>>
+<<domain RADIX RadixExpansion>>
+<<domain RECLOS RealClosure>>
 <<domain RMATRIX RectangularMatrix>>
 <<domain REF Reference>>
+<<domain REGSET RegularTriangularSet>>
+<<domain RESRING ResidueRing>>
 <<domain RESULT Result>>
+<<domain RULE RewriteRule>>
+<<domain ROIRC RightOpenIntervalRootCharacterization>>
 <<domain ROMAN RomanNumeral>>
+<<domain ROUTINE RoutinesTable>>
+<<domain RULESET Ruleset>>
 
 <<domain FORMULA ScriptFormulaFormat>>
 <<domain SAE SimpleAlgebraicExtension>>
diff --git a/books/ps/v103attributebuttons.ps b/books/ps/v103attributebuttons.ps
new file mode 100644
index 0000000..10f47dc
--- /dev/null
+++ b/books/ps/v103attributebuttons.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 154 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 154 80
+%%PageOrientation: Portrait
+gsave
+36 36 118 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
+116 42 lineto
+116 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+116 42 lineto
+116 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% AttributeButtons
+[ /Rect [ 0 0 110 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=ATTRBUT) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 110 36 moveto
+0 36 lineto
+0 0 lineto
+110 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 110 36 moveto
+0 36 lineto
+0 0 lineto
+110 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+7 13 moveto
+(AttributeButtons)
+[9.84 3.84 3.84 5.04 3.84 6.96 6.96 3.84 6.24 9.36 6.96 3.84 3.84 6.96 6.96 5.52]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103binaryexpansion.ps b/books/ps/v103binaryexpansion.ps
new file mode 100644
index 0000000..4bb48db
--- /dev/null
+++ b/books/ps/v103binaryexpansion.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 158 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 158 80
+%%PageOrientation: Portrait
+gsave
+36 36 122 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
+120 42 lineto
+120 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+120 42 lineto
+120 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% BinaryExpansion
+[ /Rect [ 0 0 114 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=BINARY) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 114 36 moveto
+0 36 lineto
+0 0 lineto
+114 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 114 36 moveto
+0 36 lineto
+0 0 lineto
+114 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+7 13 moveto
+(BinaryExpansion)
+[9.36 3.84 6.96 6.24 5.04 6.96 8.64 6.96 6.96 6.24 6.96 5.52 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/v103decimalexpansion.ps b/books/ps/v103decimalexpansion.ps
new file mode 100644
index 0000000..e3d070d
--- /dev/null
+++ b/books/ps/v103decimalexpansion.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 168 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 168 80
+%%PageOrientation: Portrait
+gsave
+36 36 132 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
+130 42 lineto
+130 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+130 42 lineto
+130 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% DecimalExpansion
+[ /Rect [ 0 0 124 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=DECIMAL) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 124 36 moveto
+0 36 lineto
+0 0 lineto
+124 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 124 36 moveto
+0 36 lineto
+0 0 lineto
+124 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+8 13 moveto
+(DecimalExpansion)
+[10.08 6.24 6.24 3.84 10.8 6.24 3.84 8.64 6.96 6.96 6.24 6.96 5.52 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/v103hexadecimalexpansion.ps b/books/ps/v103hexadecimalexpansion.ps
new file mode 100644
index 0000000..d0c570c
--- /dev/null
+++ b/books/ps/v103hexadecimalexpansion.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 194 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 194 80
+%%PageOrientation: Portrait
+gsave
+36 36 158 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
+156 42 lineto
+156 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+156 42 lineto
+156 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% HexadecimalExpansion
+[ /Rect [ 0 0 150 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=HEXADEC) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 150 36 moveto
+0 36 lineto
+0 0 lineto
+150 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 150 36 moveto
+0 36 lineto
+0 0 lineto
+150 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+8 13 moveto
+(HexadecimalExpansion)
+[10.08 5.76 6.72 6.24 6.96 6.24 6.24 3.84 10.8 6.24 3.84 8.64 6.96 6.96 6.24 6.96 5.52 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/v103quasialgebraicset.ps b/books/ps/v103quasialgebraicset.ps
new file mode 100644
index 0000000..226b956
--- /dev/null
+++ b/books/ps/v103quasialgebraicset.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 166 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 166 80
+%%PageOrientation: Portrait
+gsave
+36 36 130 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
+128 42 lineto
+128 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+128 42 lineto
+128 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% QuasiAlgebraicSet
+[ /Rect [ 0 0 122 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=QALGSET) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 122 36 moveto
+0 36 lineto
+0 0 lineto
+122 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 122 36 moveto
+0 36 lineto
+0 0 lineto
+122 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+8 13 moveto
+(QuasiAlgebraicSet)
+[10.08 6.96 6.24 5.52 3.84 10.08 3.84 6.72 6.24 6.96 4.8 6.24 3.84 6.24 7.68 6 3.84]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103quaternion.ps b/books/ps/v103quaternion.ps
new file mode 100644
index 0000000..c24b55a
--- /dev/null
+++ b/books/ps/v103quaternion.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 124 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 124 80
+%%PageOrientation: Portrait
+gsave
+36 36 88 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
+86 42 lineto
+86 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+86 42 lineto
+86 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% Quaternion
+[ /Rect [ 0 0 80 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=QUAT) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 80 36 moveto
+0 36 lineto
+0 0 lineto
+80 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 80 36 moveto
+0 36 lineto
+0 0 lineto
+80 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+8 13 moveto
+(Quaternion)
+[10.08 6.96 6.24 3.84 6.24 5.04 6.96 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/v103radixexpansion.ps b/books/ps/v103radixexpansion.ps
new file mode 100644
index 0000000..4ff9ec3
--- /dev/null
+++ b/books/ps/v103radixexpansion.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
+% RadixExpansion
+[ /Rect [ 0 0 108 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=RADIX) >>
+  /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
+7 13 moveto
+(RadixExpansion)
+[9.36 6.24 6.96 3.84 6.96 8.64 6.96 6.96 6.24 6.96 5.52 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/v103realclosure.ps b/books/ps/v103realclosure.ps
new file mode 100644
index 0000000..b7d5be0
--- /dev/null
+++ b/books/ps/v103realclosure.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
+% RealClosure
+[ /Rect [ 0 0 86 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=RECLOS) >>
+  /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
+(RealClosure)
+[9.12 6.24 6.24 3.84 9.36 3.84 6.96 5.52 6.96 4.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/v103regulartriangularset.ps b/books/ps/v103regulartriangularset.ps
new file mode 100644
index 0000000..6ee514f
--- /dev/null
+++ b/books/ps/v103regulartriangularset.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 180 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 180 80
+%%PageOrientation: Portrait
+gsave
+36 36 144 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
+142 42 lineto
+142 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+142 42 lineto
+142 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% RegularTriangularSet
+[ /Rect [ 0 0 136 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=REGSET) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 136 36 moveto
+0 36 lineto
+0 0 lineto
+136 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 136 36 moveto
+0 36 lineto
+0 0 lineto
+136 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+7 13 moveto
+(RegularTriangularSet)
+[9.12 6.24 6.96 6.96 3.84 6.24 4.8 7.92 5.04 3.84 6.24 6.96 6.96 6.96 3.84 6.24 4.8 7.68 6 3.84]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103residuering.ps b/books/ps/v103residuering.ps
new file mode 100644
index 0000000..7f2f1c6
--- /dev/null
+++ b/books/ps/v103residuering.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 132 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 132 80
+%%PageOrientation: Portrait
+gsave
+36 36 96 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
+94 42 lineto
+94 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+94 42 lineto
+94 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% ResidueRing
+[ /Rect [ 0 0 88 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=RESRING) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 88 36 moveto
+0 36 lineto
+0 0 lineto
+88 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 88 36 moveto
+0 36 lineto
+0 0 lineto
+88 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+7 13 moveto
+(ResidueRing)
+[9.12 6.24 5.52 3.84 6.96 6.96 6.24 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/v103rewriterule.ps b/books/ps/v103rewriterule.ps
new file mode 100644
index 0000000..a2dc6b2
--- /dev/null
+++ b/books/ps/v103rewriterule.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
+% RewriteRule
+[ /Rect [ 0 0 86 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=RULE) >>
+  /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
+7 13 moveto
+(RewriteRule)
+[9.12 5.76 10.08 5.04 3.84 3.84 6.24 9.12 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/v103rightopenintervalrootcharacterization.ps b/books/ps/v103rightopenintervalrootcharacterization.ps
new file mode 100644
index 0000000..df43504
--- /dev/null
+++ b/books/ps/v103rightopenintervalrootcharacterization.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 284 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 284 80
+%%PageOrientation: Portrait
+gsave
+36 36 248 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
+246 42 lineto
+246 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+246 42 lineto
+246 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% RightOpenIntervalRootCharacterization
+[ /Rect [ 0 0 240 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=ROIRC) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 240 36 moveto
+0 36 lineto
+0 0 lineto
+240 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 240 36 moveto
+0 36 lineto
+0 0 lineto
+240 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+7 13 moveto
+(RightOpenIntervalRootCharacterization)
+[9.36 3.84 6.96 6.96 3.84 10.08 6.96 6.24 6.96 4.56 6.96 3.84 6.24 5.04 6.72 6.24 3.84 8.88 6.96 6.72 3.84 9.36 6.96 6.24 4.8 6.24 6.24 3.84 6.24 5.04 3.84 6.24 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/v103routinestable.ps b/books/ps/v103routinestable.ps
new file mode 100644
index 0000000..322c019
--- /dev/null
+++ b/books/ps/v103routinestable.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
+% RoutinesTable
+[ /Rect [ 0 0 96 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=ROUTINE) >>
+  /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
+7 13 moveto
+(RoutinesTable)
+[8.88 6.96 6.96 3.84 3.84 6.96 6.24 5.52 7.68 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/v103ruleset.ps b/books/ps/v103ruleset.ps
new file mode 100644
index 0000000..f30be84
--- /dev/null
+++ b/books/ps/v103ruleset.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 102 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 102 80
+%%PageOrientation: Portrait
+gsave
+36 36 66 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
+64 42 lineto
+64 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+64 42 lineto
+64 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% Ruleset
+[ /Rect [ 0 0 58 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=RULE) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 58 36 moveto
+0 36 lineto
+0 0 lineto
+58 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 58 36 moveto
+0 36 lineto
+0 0 lineto
+58 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+8 13 moveto
+(Ruleset)
+[9.12 6.96 3.84 6.24 5.52 6 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 8d2230b..8d394a3 100644
--- a/changelog
+++ b/changelog
@@ -1,3 +1,31 @@
+20081214 tpd src/axiom-website/patches.html 20081214.01.tpd.patch
+20081214 tpd books/bookvol10.3.pamphlet add domains
+20081214 tpd books/ps/v103ruleset.ps added
+20081214 tpd books/ps/v103routinestable.ps added
+20081214 tpd books/ps/v103rightopenintervalrootcharacterization.ps added
+20081214 tpd books/ps/v103rewriterule.ps added
+20081214 tpd books/ps/v103residuering.ps added
+20081214 tpd books/ps/v103regulartriangularset.ps added
+20081214 tpd books/ps/v103realclosure.ps added
+20081214 tpd books/ps/v103radixexpansion.ps added
+20081214 tpd books/ps/v103quaternion.ps added
+20081214 tpd books/ps/v103quasialgebraicset.ps added
+20081214 tpd books/ps/v103hexadecimalexpansion.ps added
+20081214 tpd books/ps/v103decimalexpansion.ps added
+20081214 tpd books/ps/v103binaryexpansion.ps added
+20081214 tpd books/ps/v103attributebuttons.ps added
+20081214 tpd src/algebra/rule.spad move domains to bookvol10.3
+20081214 tpd src/algebra/routines.spad removed, move domains to bookvol10.3
+20081214 tpd src/algebra/resring.spad removed, move domains to bookvol10.3
+20081214 tpd src/algebra/Makefile fix up regset help
+20081214 tpd src/algebra/regset.spad move domain to bookvol10.3
+20081214 tpd src/algebra/Makefile fix up reclos help
+20081214 tpd src/algebra/reclos.spad move domains to bookvol10.3
+20081214 tpd src/algebra/Makefile fix up radix help
+20081214 tpd src/algebra/radix.spad move domains to bookvol10.3
+20081214 tpd src/algebra/Makefile fix up quaterion.help
+20081214 tpd src/algebra/quat.spad move domain to bookvol10.3
+20081214 tpd src/algebra/qalgset.spad move domain to bookvol10.3
 20081213 tpd src/axiom-website/patches.html 20081213.02.tpd.patch
 20081213 tpd books/ps/v103univariatepuiseuxseriesconstructor.ps added
 20081213 tpd books/ps/v103univariatepuiseuxseries.ps added
diff --git a/src/algebra/Makefile.pamphlet b/src/algebra/Makefile.pamphlet
index 08aa905..d29b0de 100644
--- a/src/algebra/Makefile.pamphlet
+++ b/src/algebra/Makefile.pamphlet
@@ -553,7 +553,6 @@ ratfact.spad.pamphlet (RATFACT)
 rderf.spad.pamphlet (RDETR)
 realzero.spad.pamphlet (REAL0)
 real0q.spad.pamphlet (REAL0Q)
-resring.spad.pamphlet (RESRING)
 rf.spad.pamphlet (POLYCATQ RF)
 solvefor.spad.pamphlet (SOLVEFOR)
 solvelin.spad.pamphlet (LSMP LSMP1 LSPP)
@@ -757,7 +756,6 @@ pattern.spad.pamphlet (PATTERN PATTERN1 PATTERN2 PATAB)
 qalgset.spad.pamphlet (QALGSET QALGSET2)
 reclos.spad.pamphlet (POLUTIL RRCC RCFIELD ROIRC RECLOS)
 rep1.spad.pamphlet (REP1)
-routines.spad.pamphlet (ROUTINE ATTRBUT)
 s.spad.pamphlet (NAGS)
 seg.spad.pamphlet (SEGCAT SEGXCAT SEG SEG2 SEGBIND SETBIND2 UNISEG UNISEG2
                    INCRMAPS)
@@ -1203,9 +1201,8 @@ SPADFILES= \
  ${OUTSRC}/ratfact.spad ${OUTSRC}/rdeef.spad ${OUTSRC}/rderf.spad \
  ${OUTSRC}/rdesys.spad ${OUTSRC}/real0q.spad ${OUTSRC}/realzero.spad \
  ${OUTSRC}/reclos.spad ${OUTSRC}/regset.spad ${OUTSRC}/rep1.spad \
- ${OUTSRC}/rep2.spad ${OUTSRC}/resring.spad ${OUTSRC}/retract.spad \
+ ${OUTSRC}/rep2.spad ${OUTSRC}/retract.spad \
  ${OUTSRC}/rf.spad ${OUTSRC}/riccati.spad ${OUTSRC}/rinterp.spad \
- ${OUTSRC}/routines.spad \
  ${OUTSRC}/rule.spad \
  ${OUTSRC}/seg.spad ${OUTSRC}/setorder.spad ${OUTSRC}/sets.spad \
  ${OUTSRC}/sex.spad ${OUTSRC}/sf.spad ${OUTSRC}/sgcf.spad \
@@ -1357,9 +1354,8 @@ DOCFILES= \
  ${DOC}/ratfact.spad.dvi ${DOC}/rdeef.spad.dvi ${DOC}/rderf.spad.dvi \
  ${DOC}/rdesys.spad.dvi ${DOC}/real0q.spad.dvi ${DOC}/realzero.spad.dvi \
  ${DOC}/reclos.spad.dvi ${DOC}/regset.spad.dvi ${DOC}/rep1.spad.dvi \
- ${DOC}/rep2.spad.dvi ${DOC}/resring.spad.dvi ${DOC}/retract.spad.dvi \
+ ${DOC}/rep2.spad.dvi ${DOC}/retract.spad.dvi \
  ${DOC}/rf.spad.dvi ${DOC}/riccati.spad.dvi ${DOC}/rinterp.spad.dvi \
- ${DOC}/routines.spad.dvi \
  ${DOC}/rule.spad.dvi \
  ${DOC}/seg.spad.dvi ${DOC}/setorder.spad.dvi ${DOC}/sets.spad.dvi \
  ${DOC}/sex.spad.dvi ${DOC}/sf.spad.dvi ${DOC}/sgcf.spad.dvi \
@@ -2152,12 +2148,13 @@ ${HELP}/BasicOperator.help: ${BOOKS}/bookvol10.3.pamphlet
 	@${TANGLE} -R"BasicOperator.input" ${BOOKS}/bookvol10.3.pamphlet \
             >${INPUT}/BasicOperator.input
 
-${HELP}/BinaryExpansion.help: ${IN}/radix.spad.pamphlet
-	@echo 7003 create BinaryExpansion.help from ${IN}/radix.spad.pamphlet
-	@${TANGLE} -R"BinaryExpansion.help" ${IN}/radix.spad.pamphlet \
+${HELP}/BinaryExpansion.help: ${BOOKS}/bookvol10.3.pamphlet
+	@echo 7003 create BinaryExpansion.help from \
+            ${BOOKS}/bookvol10.3.pamphlet
+	@${TANGLE} -R"BinaryExpansion.help" ${BOOKS}/bookvol10.3.pamphlet \
             >${HELP}/BinaryExpansion.help
 	@cp ${HELP}/BinaryExpansion.help ${HELP}/BINARY.help
-	@${TANGLE} -R"BinaryExpansion.input" ${IN}/radix.spad.pamphlet \
+	@${TANGLE} -R"BinaryExpansion.input" ${BOOKS}/bookvol10.3.pamphlet \
             >${INPUT}/BinaryExpansion.input
 
 ${HELP}/BinarySearchTree.help: ${IN}/tree.spad.pamphlet
@@ -2245,12 +2242,13 @@ ${HELP}/DeRhamComplex.help: ${BOOKS}/bookvol10.3.pamphlet
 	@${TANGLE} -R"DeRhamComplex.input" ${BOOKS}/bookvol10.3.pamphlet \
             >${INPUT}/DeRhamComplex.input
 
-${HELP}/DecimalExpansion.help: ${IN}/radix.spad.pamphlet
-	@echo 7014 create DecimalExpansion.help from ${IN}/radix.spad.pamphlet
-	@${TANGLE} -R"DecimalExpansion.help" ${IN}/radix.spad.pamphlet \
+${HELP}/DecimalExpansion.help: ${BOOKS}/bookvol10.3.pamphlet
+	@echo 7014 create DecimalExpansion.help from \
+            ${BOOKS}/bookvol10.3.pamphlet
+	@${TANGLE} -R"DecimalExpansion.help" ${BOOKS}/bookvol10.3.pamphlet \
             >${HELP}/DecimalExpansion.help
 	@cp ${HELP}/DecimalExpansion.help ${HELP}/DECIMAL.help
-	@${TANGLE} -R"DecimalExpansion.input" ${IN}/radix.spad.pamphlet \
+	@${TANGLE} -R"DecimalExpansion.input" ${BOOKS}/bookvol10.3.pamphlet \
             >${INPUT}/DecimalExpansion.input
 
 ${HELP}/DistributedMultivariatePolynomial.help: \
@@ -2405,14 +2403,15 @@ ${HELP}/Heap.help: ${BOOKS}/bookvol10.3.pamphlet
 	@${TANGLE} -R"Heap.input" ${BOOKS}/bookvol10.3.pamphlet \
             >${INPUT}/Heap.input
 
-${HELP}/HexadecimalExpansion.help: ${IN}/radix.spad.pamphlet
+${HELP}/HexadecimalExpansion.help: ${BOOKS}/bookvol10.3.pamphlet
 	@echo 7031 create HexadecimalExpansion.help \
-            from ${IN}/radix.spad.pamphlet
-	@${TANGLE} -R"HexadecimalExpansion.help" ${IN}/radix.spad.pamphlet \
+            from ${BOOKS}/bookvol10.3.pamphlet
+	@${TANGLE} -R"HexadecimalExpansion.help" \
+           ${BOOKS}/bookvol10.3.pamphlet \
             >${HELP}/HexadecimalExpansion.help
 	@cp ${HELP}/HexadecimalExpansion.help  ${HELP}/HEXADEC.help
 	@${TANGLE} -R"HexadecimalExpansion.input" \
-           ${IN}/radix.spad.pamphlet >${INPUT}/HexadecimalExpansion.input
+           ${BOOKS}/bookvol10.3.pamphlet >${INPUT}/HexadecimalExpansion.input
 
 ${HELP}/HomogeneousDistributedMultivariatePolynomial.help: \
             ${BOOKS}/bookvol10.3.pamphlet
@@ -2732,28 +2731,29 @@ ${HELP}/Polynomial.help: ${BOOKS}/bookvol10.3.pamphlet
 	@${TANGLE} -R"Polynomial.input" ${BOOKS}/bookvol10.3.pamphlet \
             >${INPUT}/Polynomial.input
 
-${HELP}/Quaternion.help: ${IN}/quat.spad.pamphlet
-	@echo 7066 create Quaternion.help from ${IN}/quat.spad.pamphlet
-	@${TANGLE} -R"Quaternion.help" ${IN}/quat.spad.pamphlet \
+${HELP}/Quaternion.help: ${BOOKS}/bookvol10.3.pamphlet
+	@echo 7066 create Quaternion.help from ${BOOKS}/bookvol10.3.pamphlet
+	@${TANGLE} -R"Quaternion.help" ${BOOKS}/bookvol10.3.pamphlet \
            >${HELP}/Quaternion.help
 	@cp ${HELP}/Quaternion.help ${HELP}/QUAT.help
-	@${TANGLE} -R"Quaternion.input" ${IN}/quat.spad.pamphlet \
+	@${TANGLE} -R"Quaternion.input" ${BOOKS}/bookvol10.3.pamphlet \
             >${INPUT}/Quaternion.input
 
-${HELP}/RadixExpansion.help: ${IN}/radix.spad.pamphlet
-	@echo 7067 create RadixExpansion.help from ${IN}/radix.spad.pamphlet
-	@${TANGLE} -R"RadixExpansion.help" ${IN}/radix.spad.pamphlet \
+${HELP}/RadixExpansion.help: ${BOOKS}/bookvol10.3.pamphlet
+	@echo 7067 create RadixExpansion.help from \
+           ${BOOKS}/bookvol10.3.pamphlet
+	@${TANGLE} -R"RadixExpansion.help" ${BOOKS}/bookvol10.3.pamphlet \
            >${HELP}/RadixExpansion.help
 	@cp ${HELP}/RadixExpansion.help ${HELP}/RADIX.help
-	@${TANGLE} -R"RadixExpansion.input" ${IN}/radix.spad.pamphlet \
+	@${TANGLE} -R"RadixExpansion.input" ${BOOKS}/bookvol10.3.pamphlet \
             >${INPUT}/RadixExpansion.input
 
-${HELP}/RealClosure.help: ${IN}/reclos.spad.pamphlet
-	@echo 7068 create RealClosure.help from ${IN}/reclos.spad.pamphlet
-	@${TANGLE} -R"RealClosure.help" ${IN}/reclos.spad.pamphlet \
+${HELP}/RealClosure.help: ${BOOKS}/bookvol10.3.pamphlet 
+	@echo 7068 create RealClosure.help from ${BOOKS}/bookvol10.3.pamphlet 
+	@${TANGLE} -R"RealClosure.help" ${BOOKS}/bookvol10.3.pamphlet  \
            >${HELP}/RealClosure.help
 	@cp ${HELP}/RealClosure.help ${HELP}/RECLOS.help
-	@${TANGLE} -R"RealClosure.input" ${IN}/reclos.spad.pamphlet \
+	@${TANGLE} -R"RealClosure.input" ${BOOKS}/bookvol10.3.pamphlet  \
             >${INPUT}/RealClosure.input
 
 ${HELP}/RealSolvePackage.help: ${IN}/acplot.spad.pamphlet
@@ -2764,13 +2764,15 @@ ${HELP}/RealSolvePackage.help: ${IN}/acplot.spad.pamphlet
 	@${TANGLE} -R"RealSolvePackage.input" ${IN}/acplot.spad.pamphlet \
             >${INPUT}/RealSolvePackage.input
 
-${HELP}/RegularTriangularSet.help: ${IN}/regset.spad.pamphlet
+${HELP}/RegularTriangularSet.help: ${BOOKS}/bookvol10.3.pamphlet
 	@echo 7070 create RegularTriangularSet.help from \
-          ${IN}/regset.spad.pamphlet
-	@${TANGLE} -R"RegularTriangularSet.help" ${IN}/regset.spad.pamphlet \
+          ${BOOKS}/bookvol10.3.pamphlet
+	@${TANGLE} -R"RegularTriangularSet.help" \
+          ${BOOKS}/bookvol10.3.pamphlet \
            >${HELP}/RegularTriangularSet.help
 	@cp ${HELP}/RegularTriangularSet.help ${HELP}/REGSET.help
-	@${TANGLE} -R"RegularTriangularSet.input" ${IN}/regset.spad.pamphlet \
+	@${TANGLE} -R"RegularTriangularSet.input" \
+          ${BOOKS}/bookvol10.3.pamphlet \
             >${INPUT}/RegularTriangularSet.input
 
 ${HELP}/RomanNumeral.help: ${BOOKS}/bookvol10.3.pamphlet
diff --git a/src/algebra/qalgset.spad.pamphlet b/src/algebra/qalgset.spad.pamphlet
index 7f5a037..87fdd02 100644
--- a/src/algebra/qalgset.spad.pamphlet
+++ b/src/algebra/qalgset.spad.pamphlet
@@ -9,193 +9,6 @@
 \eject
 \tableofcontents
 \eject
-\section{domain QALGSET QuasiAlgebraicSet}
-<<domain QALGSET QuasiAlgebraicSet>>=
-)abbrev domain QALGSET QuasiAlgebraicSet
-++ Author:  William Sit
-++ Date Created: March 13, 1992
-++ Date Last Updated: June 12, 1992 
-++ Basic Operations:
-++ Related Constructors:GroebnerPackage
-++ See Also: QuasiAlgebraicSet2
-++ AMS Classifications:
-++ Keywords: Zariski closed sets, quasi-algebraic sets
-++ References:William Sit, "An Algorithm for Parametric Linear Systems"
-++            J. Sym. Comp., April, 1992
-++ Description:
-++ \spadtype{QuasiAlgebraicSet} constructs a domain representing
-++ quasi-algebraic sets, which
-++ is the intersection of a Zariski
-++ closed set, defined as the common zeros of a given list of
-++ polynomials (the defining polynomials for equations), and a principal
-++ Zariski open set, defined as the complement of the common
-++ zeros of a polynomial f (the defining polynomial for the inequation).
-++ This domain provides simplification of a user-given representation
-++ using groebner basis computations.
-++ There are two simplification routines: the first function
-++ \spadfun{idealSimplify}  uses groebner
-++ basis of ideals alone, while the second, \spadfun{simplify} uses both
-++ groebner basis and factorization.  The resulting defining equations L
-++ always form a groebner basis, and the resulting defining
-++ inequation f is always reduced.  The function \spadfun{simplify} may
-++ be applied several times if desired.   A third simplification
-++ routine \spadfun{radicalSimplify} is provided in
-++ \spadtype{QuasiAlgebraicSet2}  for comparison study only,
-++ as it is inefficient compared to the other two, as well as is
-++ restricted to only certain coefficient domains.  For detail analysis
-++ and a comparison of the three methods, please consult the reference
-++ cited.
-++
-++ A polynomial function q defined on the quasi-algebraic set
-++ is equivalent to its reduced form with respect to L.  While
-++ this may be obtained using the usual normal form
-++ algorithm, there is no canonical form for q.
-++
-++ The ordering in groebner basis computation is determined by
-++ the data type of the input polynomials.  If it is possible
-++ we suggest to use refinements of total degree orderings.
-QuasiAlgebraicSet(R, Var,Expon,Dpoly) : C == T
- where
-   R         :  GcdDomain
-   Expon     :  OrderedAbelianMonoidSup
-   Var       :  OrderedSet
-   Dpoly     :  PolynomialCategory(R,Expon,Var)
-   NNI      ==> NonNegativeInteger
-   newExpon ==> Product(NNI,Expon)
-   newPoly  ==> PolynomialRing(R,newExpon)
-   Ex       ==> OutputForm
-   mrf      ==> MultivariateFactorize(Var,Expon,R,Dpoly)
-   Status   ==> Union(Boolean,"failed") -- empty or not, or don't know
- 
-   C == Join(SetCategory, CoercibleTo OutputForm) with
-  --- should be Object instead of SetCategory, bug in LIST Object ---
-  --- equality is not implemented ---
-     empty: () -> $
-       ++ empty() returns the empty quasi-algebraic set
-     quasiAlgebraicSet:   (List Dpoly, Dpoly) -> $
-       ++ quasiAlgebraicSet(pl,q) returns the quasi-algebraic set
-       ++ with defining equations p = 0 for p belonging to the list pl, and
-       ++ defining inequation q ^= 0.
-     status: $ -> Status
-       ++ status(s) returns true if the quasi-algebraic set is empty,
-       ++ false if it is not, and "failed" if not yet known
-     setStatus: ($, Status) -> $
-       ++ setStatus(s,t) returns the same representation for s, but
-       ++ asserts the following: if t is true, then s is empty,
-       ++ if t is false, then s is non-empty, and if t = "failed",
-       ++ then no assertion is made (that is, "don't know").
-       ++ Note: for internal use only, with care.
-     empty?          :   $   -> Boolean
-       ++ empty?(s) returns
-       ++ true if the quasialgebraic set s has no points,
-       ++ and false otherwise.
-     definingEquations: $ -> List Dpoly
-       ++ definingEquations(s) returns a list of defining polynomials
-       ++ for equations, that is, for the Zariski closed part of s.
-     definingInequation: $ -> Dpoly
-       ++ definingInequation(s) returns a single defining polynomial for the
-       ++ inequation, that is, the Zariski open part of s.
-     idealSimplify:$ -> $
-       ++ idealSimplify(s) returns a different and presumably simpler
-       ++ representation of s with the defining polynomials for the
-       ++ equations
-       ++ forming a groebner basis, and the defining polynomial for the
-       ++ inequation reduced with respect to the basis, using Buchberger's
-       ++ algorithm.
-     if (R has EuclideanDomain) and (R has CharacteristicZero) then
-       simplify:$ -> $
-         ++ simplify(s) returns a different and presumably simpler
-         ++ representation of s with the defining polynomials for the
-         ++ equations
-         ++ forming a groebner basis, and the defining polynomial for the
-         ++ inequation reduced with respect to the basis, using a heuristic
-         ++ algorithm based on factoring.
-   T  == add
-     Rep := Record(status:Status,zero:List Dpoly, nzero:Dpoly)
-     x:$
- 
-     import GroebnerPackage(R,Expon,Var,Dpoly)
-     import GroebnerPackage(R,newExpon,Var,newPoly)
-     import GroebnerInternalPackage(R,Expon,Var,Dpoly)
- 
-                       ----  Local Functions  ----
- 
-     minset   : List List Dpoly -> List List Dpoly
-     overset? : (List Dpoly, List List Dpoly) -> Boolean
-     npoly    : Dpoly            ->  newPoly
-     oldpoly  : newPoly          ->  Union(Dpoly,"failed")
- 
- 
-     if (R has EuclideanDomain) and (R has CharacteristicZero) then
-       factorset (y:Dpoly):List Dpoly ==
-         ground? y => []
-         [j.factor for j in factors factor$mrf  y]
- 
-       simplify x ==
-         if x.status case "failed" then
-           x:=quasiAlgebraicSet(zro:=groebner x.zero, redPol(x.nzero,zro))
-         (pnzero:=x.nzero)=0 => empty()
-         nzro:=factorset pnzero
-         mset:=minset [factorset p for p in x.zero]
-         mset:=[setDifference(s,nzro) for s in mset]
-         zro:=groebner [*/s for s in mset]
-         member? (1$Dpoly, zro) => empty()
-         [x.status, zro, primitivePart redPol(*/nzro, zro)]
- 
-     npoly(f:Dpoly) : newPoly ==
-       zero? f => 0
-       monomial(leadingCoefficient f,makeprod(0,degree f))$newPoly +
-             npoly(reductum f)
- 
-     oldpoly(q:newPoly) : Union(Dpoly,"failed") ==
-       q=0$newPoly => 0$Dpoly
-       dq:newExpon:=degree q
-       n:NNI:=selectfirst (dq)
-       n^=0 => "failed"
-       ((g:=oldpoly reductum q) case "failed") => "failed"
-       monomial(leadingCoefficient q,selectsecond dq)$Dpoly + (g::Dpoly)
- 
-     coerce x ==
-       x.status = true => "Empty"::Ex
-       bracket [[hconcat(f::Ex, " = 0"::Ex) for f in x.zero ]::Ex,
-                 hconcat( x.nzero::Ex, " != 0"::Ex)]
- 
-     empty? x ==
-       if x.status case "failed" then x:=idealSimplify x
-       x.status :: Boolean
- 
-     empty() == [true::Status, [1$Dpoly], 0$Dpoly]
-     status x == x.status
-     setStatus(x,t) == [t,x.zero,x.nzero]
-     definingEquations x == x.zero
-     definingInequation x == x.nzero
-     quasiAlgebraicSet(z0,n0) == ["failed", z0, n0]
- 
-     idealSimplify x ==
-       x.status case Boolean => x
-       z0:= x.zero
-       n0:= x.nzero
-       empty? z0 => [false, z0, n0]
-       member? (1$Dpoly, z0) => empty()
-       tp:newPoly:=(monomial(1,makeprod(1,0$Expon))$newPoly * npoly n0)-1
-       ngb:=groebner concat(tp, [npoly g for g in z0])
-       member? (1$newPoly, ngb) => empty()
-       gb:List Dpoly:=nil
-       while not empty? ngb repeat
-         if ((f:=oldpoly ngb.first) case Dpoly) then gb:=concat(f, gb)
-         ngb:=ngb.rest
-       [false::Status, gb, primitivePart redPol(n0, gb)]
- 
- 
-     minset lset ==
-       empty? lset => lset
-       [s for s  in lset | ^(overset?(s,lset))]
- 
-     overset?(p,qlist) ==
-       empty? qlist => false
-       or/[(brace$(Set Dpoly) q) <$(Set Dpoly) (brace$(Set Dpoly) p) for q in qlist]
-
-@
 \section{package QALGSET2 QuasiAlgebraicSet2}
 <<package QALGSET2 QuasiAlgebraicSet2>>=
 )abbrev package QALGSET2 QuasiAlgebraicSet2
@@ -343,7 +156,6 @@ QuasiAlgebraicSet2(vl,nv) : C == T where
 <<*>>=
 <<license>>
 
-<<domain QALGSET QuasiAlgebraicSet>>
 <<package QALGSET2 QuasiAlgebraicSet2>>
 @
 \eject
diff --git a/src/algebra/quat.spad.pamphlet b/src/algebra/quat.spad.pamphlet
index 3aa45dd..9703b0e 100644
--- a/src/algebra/quat.spad.pamphlet
+++ b/src/algebra/quat.spad.pamphlet
@@ -1,7 +1,7 @@
 \documentclass{book}
-\usepackage{graphicx}%%we need \includegraphics
-\usepackage{amssymb}%% we need \therefore symbol
-\usepackage{axiom}%%we need noweb support
+\usepackage{graphicx}
+\usepackage{amssymb}
+\usepackage{axiom}
 %%% We add some special commands to handle Axiom portions of the document.
 \makeindex
 
@@ -5049,286 +5049,6 @@ the result of the preceding example ?
 \newpage
 \chapter{Axiom Algebra Code}
 
-\section{domain QUAT Quaternion}
-<<Quaternion.input>>=
--- quat.spad.pamphlet Quaternion.input
-)spool Quaternion.output
-)set message test on
-)set message auto off
-)clear all
---S 1 of 13
-q := quatern(2/11,-8,3/4,1)
---R 
---R
---R         2        3
---R   (1)  -- - 8i + - j + k
---R        11        4
---R                                            Type: Quaternion Fraction Integer
---E 1
-
---S 2 of 13
-[real q, imagI q, imagJ q, imagK q]
---R 
---R
---R          2     3
---R   (2)  [--,- 8,-,1]
---R         11     4
---R                                                  Type: List Fraction Integer
---E 2
-
---S 3 of 13
-inv q
---R 
---R
---R          352     15488      484       1936
---R   (3)  ------ + ------ i - ----- j - ------ k
---R        126993   126993     42331     126993
---R                                            Type: Quaternion Fraction Integer
---E 3
-
---S 4 of 13
-q^6
---R 
---R
---R          2029490709319345   48251690851     144755072553     48251690851
---R   (4)  - ---------------- - ----------- i + ------------ j + ----------- k
---R             7256313856        1288408         41229056         10307264
---R                                            Type: Quaternion Fraction Integer
---E 4
-
---S 5 of 13
-r := quatern(-2,3,23/9,-89); q + r
---R 
---R
---R          20        119
---R   (5)  - -- - 5i + --- j - 88k
---R          11         36
---R                                            Type: Quaternion Fraction Integer
---E 5
-
---S 6 of 13
-q * r - r * q
---R 
---R
---R          2495             817
---R   (6)  - ---- i - 1418j - --- k
---R           18               18
---R                                            Type: Quaternion Fraction Integer
---E 6
-
---S 7 of 13
-i:=quatern(0,1,0,0) 
---R 
---R
---R   (7)  i
---R                                                     Type: Quaternion Integer
---E 7
-
---S 8 of 13
-j:=quatern(0,0,1,0) 
---R 
---R
---R   (8)  j
---R                                                     Type: Quaternion Integer
---E 8
-
---S 9 of 13
-k:=quatern(0,0,0,1)
---R 
---R
---R   (9)  k
---R                                                     Type: Quaternion Integer
---E 9
-
---S 10 of 13
-[i*i, j*j, k*k, i*j, j*k, k*i, q*i]
---R 
---R
---R                                 2         3
---R   (10)  [- 1,- 1,- 1,k,i,j,8 + -- i + j - - k]
---R                                11         4
---R                                       Type: List Quaternion Fraction Integer
---E 10
-
---S 11 of 13
-norm q
---R 
---R
---R         126993
---R   (11)  ------
---R          1936
---R                                                       Type: Fraction Integer
---E 11
-
---S 12 of 13
-conjugate q 
---R 
---R
---R          2        3
---R   (12)  -- + 8i - - j - k
---R         11        4
---R                                            Type: Quaternion Fraction Integer
---E 12
-
---S 13 of 13
-q * %
---R 
---R
---R         126993
---R   (13)  ------
---R          1936
---R                                            Type: Quaternion Fraction Integer
---E 13
-)spool
-)lisp (bye)
-@
-<<Quaternion.help>>=
-====================================================================
-Quaternion examples
-====================================================================
-
-The domain constructor Quaternion implements quaternions over
-commutative rings.
-
-The basic operation for creating quaternions is quatern.  This is a
-quaternion over the rational numbers.
-
-  q := quatern(2/11,-8,3/4,1)
-     2        3
-    -- - 8i + - j + k
-    11        4
-                        Type: Quaternion Fraction Integer
-
-The four arguments are the real part, the i imaginary part, the j
-imaginary part, and the k imaginary part, respectively.
-
-  [real q, imagI q, imagJ q, imagK q]
-      2     3
-    [--,- 8,-,1]
-     11     4
-                        Type: List Fraction Integer
-
-Because q is over the rationals (and nonzero), you can invert it.
-
-  inv q
-      352     15488      484       1936
-    ------ + ------ i - ----- j - ------ k
-    126993   126993     42331     126993
-                        Type: Quaternion Fraction Integer
-
-The usual arithmetic (ring) operations are available
-
-  q^6
-      2029490709319345   48251690851     144755072553     48251690851
-    - ---------------- - ----------- i + ------------ j + ----------- k
-         7256313856        1288408         41229056         10307264
-                        Type: Quaternion Fraction Integer
-
-  r := quatern(-2,3,23/9,-89); q + r
-      20        119
-    - -- - 5i + --- j - 88k
-      11         36
-                        Type: Quaternion Fraction Integer
-
-In general, multiplication is not commutative.
-
-  q * r - r * q
-      2495             817
-    - ---- i - 1418j - --- k
-       18               18
-                         Type: Quaternion Fraction Integer
-
-There are no predefined constants for the imaginary i, j, and k parts,
-but you can easily define them.
-
-  i:=quatern(0,1,0,0) 
-    i
-                         Type: Quaternion Integer
-
-  j:=quatern(0,0,1,0) 
-    j
-                         Type: Quaternion Integer
- 
-  k:=quatern(0,0,0,1)
-    k
-                         Type: Quaternion Integer
-
-These satisfy the normal identities.
-
-  [i*i, j*j, k*k, i*j, j*k, k*i, q*i]
-                             2         3
-     [- 1,- 1,- 1,k,i,j,8 + -- i + j - - k]
-                            11         4
-                          Type: List Quaternion Fraction Integer
-
-The norm is the quaternion times its conjugate.
-
-  norm q
-    126993
-    ------
-     1936
-                          Type: Fraction Integer
-
-  conjugate q 
-      2        3
-     -- + 8i - - j - k
-     11        4
-                          Type: Quaternion Fraction Integer
-
-  q * %
-     126993
-     ------
-      1936
-                          Type: Quaternion Fraction Integer
-
-See Also:
-o )help Octonion
-o )help Complex
-o )help CliffordAlgebra
-o )show Quaternion
-o $AXIOM/doc/src/algebra/quat.spad.dvi
-
-@
-<<domain QUAT Quaternion>>=
-)abbrev domain QUAT Quaternion
-++ Author: Robert S. Sutor
-++ Date Created: 23 May 1990
-++ Change History:
-++   10 September 1990
-++ Basic Operations: (Algebra)
-++   abs, conjugate, imagI, imagJ, imagK, norm, quatern, rational,
-++   rational?, real
-++ Related Constructors: QuaternionCategoryFunctions2
-++ Also See: QuaternionCategory, DivisionRing
-++ AMS Classifications: 11R52
-++ Keywords: quaternions, division ring, algebra
-++ Description: \spadtype{Quaternion} implements quaternions over a
-++   commutative ring. The main constructor function is \spadfun{quatern}
-++   which takes 4 arguments: the real part, the i imaginary part, the j
-++   imaginary part and the k imaginary part.
- 
-Quaternion(R:CommutativeRing): QuaternionCategory(R) == add
-  Rep := Record(r:R,i:R,j:R,k:R)
- 
-  0 == [0,0,0,0]
-  1 == [1,0,0,0]
- 
-  a,b,c,d : R
-  x,y : $
- 
-  real  x == x.r
-  imagI x == x.i
-  imagJ x == x.j
-  imagK x == x.k
- 
-  quatern(a,b,c,d) == [a,b,c,d]
- 
-  x * y == [x.r*y.r-x.i*y.i-x.j*y.j-x.k*y.k,
-               x.r*y.i+x.i*y.r+x.j*y.k-x.k*y.j,
-                 x.r*y.j+x.j*y.r+x.k*y.i-x.i*y.k,
-                   x.r*y.k+x.k*y.r+x.i*y.j-x.j*y.i]
-
-@
 \section{package QUATCT2 QuaternionCategoryFunctions2}
 <<package QUATCT2 QuaternionCategoryFunctions2>>=
 )abbrev package QUATCT2 QuaternionCategoryFunctions2
@@ -5538,7 +5258,6 @@ $$
 <<*>>=
 <<license>>
  
-<<domain QUAT Quaternion>>
 <<package QUATCT2 QuaternionCategoryFunctions2>>
 @
 \vfill
diff --git a/src/algebra/radix.spad.pamphlet b/src/algebra/radix.spad.pamphlet
index 06bb6b8..028ec95 100644
--- a/src/algebra/radix.spad.pamphlet
+++ b/src/algebra/radix.spad.pamphlet
@@ -9,1090 +9,6 @@
 \eject
 \tableofcontents
 \eject
-\section{domain RADIX RadixExpansion}
-<<RadixExpansion.input>>=
--- radix.spad.pamphlet RadixExpansion.input
-)spool RadixExpansion.output
-)set message test on
-)set message auto off
-)clear all
---S 1 of 17
-111::RadixExpansion(5)
---R 
---R
---R   (1)  421
---R                                                       Type: RadixExpansion 5
---E 1
-
---S 2 of 17
-(5/24)::RadixExpansion(2)
---R 
---R
---R             __
---R   (2)  0.00110
---R                                                       Type: RadixExpansion 2
---E 2
-
---S 3 of 17
-(5/24)::RadixExpansion(3)
---R 
---R
---R           __
---R   (3)  0.012
---R                                                       Type: RadixExpansion 3
---E 3
-
---S 4 of 17
-(5/24)::RadixExpansion(8)
---R 
---R
---R           __
---R   (4)  0.152
---R                                                       Type: RadixExpansion 8
---E 4
-
---S 5 of 17
-(5/24)::RadixExpansion(10)
---R 
---R
---R             _
---R   (5)  0.2083
---R                                                      Type: RadixExpansion 10
---E 5
-
---S 6 of 17
-(5/24)::RadixExpansion(12)
---R 
---R
---R   (6)  0.26
---R                                                      Type: RadixExpansion 12
---E 6
-
---S 7 of 17
-(5/24)::RadixExpansion(16)
---R 
---R
---R           _
---R   (7)  0.35
---R                                                      Type: RadixExpansion 16
---E 7
-
---S 8 of 17
-(5/24)::RadixExpansion(36)
---R 
---R
---R   (8)  0.7I
---R                                                      Type: RadixExpansion 36
---E 8
-
---S 9 of 17
-(5/24)::RadixExpansion(38)
---R 
---R
---R                    _____
---R   (9)  0 . 7 34 31 25 12
---R                                                      Type: RadixExpansion 38
---E 9
-
---S 10 of 17
-a := (76543/210)::RadixExpansion(8)
---R 
---R
---R              ____
---R   (10)  554.37307
---R                                                       Type: RadixExpansion 8
---E 10
-
---S 11 of 17
-w := wholeRagits a
---R 
---R
---R   (11)  [5,5,4]
---R                                                           Type: List Integer
---E 11
-
---S 12 of 17
-f0 := prefixRagits a
---R 
---R
---R   (12)  [3]
---R                                                           Type: List Integer
---E 12
-
---S 13 of 17
-f1 := cycleRagits a
---R 
---R
---R   (13)  [7,3,0,7]
---R                                                           Type: List Integer
---E 13
-
---S 14 of 17
-u:RadixExpansion(8):=wholeRadix(w)+fractRadix(f0,f1)
---R 
---R
---R              ____
---R   (14)  554.37307
---R                                                       Type: RadixExpansion 8
---E 14
-
---S 15 of 17
-v: RadixExpansion(12) := fractRadix([1,2,3,11], [0])
---R 
---R
---R               _
---R   (15)  0.123B0
---R                                                      Type: RadixExpansion 12
---E 15
-
---S 16 of 17
-fractRagits(u)
---R 
---R
---R              _______
---R   (16)  [3,7,3,0,7,7]
---R                                                         Type: Stream Integer
---E 16
-
---S 17 of 17
-a :: Fraction(Integer)
---R 
---R
---R         76543
---R   (17)  -----
---R          210
---R                                                       Type: Fraction Integer
---E 17
-)spool
-)lisp (bye)
-@
-<<RadixExpansion.help>>=
-====================================================================
-RadixExpansion examples
-====================================================================
-
-It possible to expand numbers in general bases.
-
-Here we expand 111 in base 5. This means
-  10^2+10^1+10^0 = 4 * 5^2+2 * 5^1 + 5^0
-
-  111::RadixExpansion(5)
-    421
-                              Type: RadixExpansion 5
-
-You can expand fractions to form repeating expansions.
-
-  (5/24)::RadixExpansion(2)
-         __
-    0.00110
-                              Type: RadixExpansion 2
-
-  (5/24)::RadixExpansion(3)
-       __
-    0.012
-                              Type: RadixExpansion 3
-
-  (5/24)::RadixExpansion(8)
-       __
-    0.152
-                              Type: RadixExpansion 8
-
-  (5/24)::RadixExpansion(10)
-         _
-    0.2083
-                              Type: RadixExpansion 10
-
-For bases from 11 to 36 the letters A through Z are used.
-
-  (5/24)::RadixExpansion(12)
-    0.26
-                              Type: RadixExpansion 12
-
-  (5/24)::RadixExpansion(16)
-       _
-    0.35
-                              Type: RadixExpansion 16
-
-  (5/24)::RadixExpansion(36)
-    0.7I
-                              Type: RadixExpansion 36
-
-For bases greater than 36, the ragits are separated by blanks.
-
-  (5/24)::RadixExpansion(38)
-                _____
-    0 . 7 34 31 25 12
-                              Type: RadixExpansion 38
-
-The RadixExpansion type provides operations to obtain the individual
-ragits.  Here is a rational number in base 8.
-
-  a := (76543/210)::RadixExpansion(8)
-          ____
-     554.37307
-                              Type: RadixExpansion 8
-
-The operation wholeRagits returns a list of the ragits for the
-integral part of the number.
-
-  w := wholeRagits a
-    [5,5,4]
-                              Type: List Integer
-
-The operations prefixRagits and cycleRagits return lists of the initial
-and repeating ragits in the fractional part of the number.
-
-  f0 := prefixRagits a
-    [3]
-                              Type: List Integer
-
-  f1 := cycleRagits a
-    [7,3,0,7]
-                              Type: List Integer
-
-You can construct any radix expansion by giving the whole, prefix and
-cycle parts.  The declaration is necessary to let Axiom know the base
-of the ragits.
-
-  u:RadixExpansion(8):=wholeRadix(w)+fractRadix(f0,f1)
-         ____
-    554.37307
-                              Type: RadixExpansion 8
-
-If there is no repeating part, then the list [0] should be used.
-
-  v: RadixExpansion(12) := fractRadix([1,2,3,11], [0])
-          _
-    0.123B0
-                              Type: RadixExpansion 12
-
-If you are not interested in the repeating nature of the expansion, an
-infinite stream of ragits can be obtained using fractRagits.
-
-  fractRagits(u)
-         _______
-    [3,7,3,0,7,7]
-                              Type: Stream Integer
-
-Of course, it's possible to recover the fraction representation:
-
-  a :: Fraction(Integer)
-    76543
-    -----
-     210
-                              Type: Fraction Integer
-
-See Also:
-o )help DecimalExpansion
-o )help BinaryExpansion
-o )help HexadecimalExpansion
-o )show RadixExpansion
-o $AXIOM/doc/src/algebra/radix.spad.dvi
-
-@
-<<domain RADIX RadixExpansion>>=
-)abbrev domain RADIX RadixExpansion
-++ Author: Stephen M. Watt
-++ Date Created: October 1986
-++ Date Last Updated: May 15, 1991
-++ Basic Operations: wholeRadix, fractRadix, wholeRagits, fractRagits
-++ Related Domains: BinaryExpansion, DecimalExpansion, HexadecimalExpansion,
-++    RadixUtilities
-++ Also See:
-++ AMS Classifications:
-++ Keywords: radix, base, repeating decimal
-++ Examples:
-++ References:
-++ Description:
-++   This domain allows rational numbers to be presented as repeating
-++   decimal expansions or more generally as repeating expansions in any base.
-
-RadixExpansion(bb): Exports == Implementation where
-  bb   :  Integer
-  I   ==> Integer
-  NNI ==> NonNegativeInteger
-  OUT ==> OutputForm
-  RN  ==> Fraction Integer
-  ST  ==> Stream Integer
-  QuoRem ==> Record(quotient: Integer, remainder: Integer)
-
-  Exports ==> QuotientFieldCategory(Integer) with
-    coerce: % -> Fraction Integer
-      ++ coerce(rx) converts a radix expansion to a rational number.
-    fractionPart: % -> Fraction Integer
-      ++ fractionPart(rx) returns the fractional part of a radix expansion.
-    wholeRagits: % -> List Integer
-      ++ wholeRagits(rx) returns the ragits of the integer part
-      ++ of a radix expansion.
-    fractRagits: % -> Stream Integer
-      ++ fractRagits(rx) returns the ragits of the fractional part
-      ++ of a radix expansion.
-    prefixRagits: % -> List Integer
-      ++ prefixRagits(rx) returns the non-cyclic part of the ragits
-      ++ of the fractional part of a radix expansion.
-      ++ For example, if \spad{x = 3/28 = 0.10 714285 714285 ...},
-      ++ then \spad{prefixRagits(x)=[1,0]}.
-    cycleRagits: % -> List Integer
-      ++ cycleRagits(rx) returns the cyclic part of the ragits of the
-      ++ fractional part of a radix expansion.
-      ++ For example, if \spad{x = 3/28 = 0.10 714285 714285 ...},
-      ++ then \spad{cycleRagits(x) = [7,1,4,2,8,5]}.
-    wholeRadix: List Integer -> %
-      ++ wholeRadix(l) creates an integral radix expansion from a list
-      ++ of ragits.
-      ++ For example, \spad{wholeRadix([1,3,4])} will return \spad{134}.
-    fractRadix: (List Integer, List Integer) -> %
-      ++ fractRadix(pre,cyc) creates a fractional radix expansion
-      ++ from a list of prefix ragits and a list of cyclic ragits.
-      ++ e.g., \spad{fractRadix([1],[6])} will return \spad{0.16666666...}.
-
-  Implementation ==> add
-    -- The efficiency of arithmetic operations is poor.
-    -- Could use a lazy eval where either rational rep
-    -- or list of ragit rep (the current) or both are kept
-    -- as demanded.
-
-    bb < 2 => error "Radix base must be at least 2"
-    Rep := Record(sgn: Integer,      int: List Integer,
-                  pfx: List Integer, cyc: List Integer)
-
-    q:     RN
-    qr:    QuoRem
-    a,b:   %
-    n:     I
-
-    radixInt:    (I, I)    -> List I
-    radixFrac:   (I, I, I) -> Record(pfx: List I, cyc: List I)
-    checkRagits: List I    -> Boolean
-
-    -- Arithmetic operations
-    characteristic() == 0
-    differentiate a == 0
-
-    0     == [1, nil(),  nil(), nil()]
-    1     == [1, [1], nil(), nil()]
-    - a   == (a = 0 => 0; [-a.sgn, a.int, a.pfx, a.cyc])
-    a + b == (a::RN + b::RN)::%
-    a - b == (a::RN - b::RN)@RN::%
-    n * a == (n     * a::RN)::%
-    a * b == (a::RN * b::RN)::%
-    a / b == (a::RN / b::RN)::%
-    (i:I) / (j:I) == (i/j)@RN :: %
-    a < b == a::RN < b::RN
-    a = b == a.sgn = b.sgn and a.int = b.int and
-             a.pfx = b.pfx and a.cyc = b.cyc
-    numer a == numer(a::RN)
-    denom a == denom(a::RN)
-
-    -- Algebraic coercions
-    coerce(a):RN == (wholePart a) :: RN + fractionPart a
-    coerce(n):%  == n :: RN :: %
-    coerce(q):%  ==
-      s := 1; if q < 0 then (s := -1; q := -q)
-      qr      := divide(numer q,denom q)
-      whole   := radixInt (qr.quotient,bb)
-      fractn  := radixFrac(qr.remainder,denom q,bb)
-      cycle   := (fractn.cyc = [0] => nil(); fractn.cyc)
-      [s,whole,fractn.pfx,cycle]
-
-    retractIfCan(a):Union(RN,"failed") == a::RN
-    retractIfCan(a):Union(I,"failed") ==
-      empty?(a.pfx) and empty?(a.cyc) => wholePart a
-      "failed"
-
-    -- Exported constructor/destructors
-    ceiling a == ceiling(a::RN)
-    floor a == floor(a::RN)
-
-    wholePart a ==
-      n0 := 0
-      for r in a.int repeat n0 := bb*n0 + r
-      a.sgn*n0
-    fractionPart a ==
-      n0 := 0
-      for r in a.pfx repeat n0 := bb*n0 + r
-      null a.cyc =>
-          a.sgn*n0/bb**((#a.pfx)::NNI)
-      n1 := n0
-      for r in a.cyc repeat n1 := bb*n1 + r
-      n := n1 - n0
-      d := (bb**((#a.cyc)::NNI) - 1) * bb**((#a.pfx)::NNI)
-      a.sgn*n/d
-
-    wholeRagits  a == a.int
-    fractRagits  a == concat(construct(a.pfx)@ST,repeating a.cyc)
-    prefixRagits a == a.pfx
-    cycleRagits  a == a.cyc
-
-    wholeRadix li ==
-      checkRagits li
-      [1, li, nil(), nil()]
-    fractRadix(lpfx, lcyc) ==
-      checkRagits lpfx; checkRagits lcyc
-      [1, nil(), lpfx, lcyc]
-
-    -- Output
-
-    ALPHAS : String := "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-
-    intToExpr(i:I): OUT ==
-      -- computes a digit for bases between 11 and 36
-      i < 10 => i :: OUT
-      elt(ALPHAS,(i-10) + minIndex(ALPHAS)) :: OUT
-
-    exprgroup(le: List OUT): OUT ==
-      empty? le      => error "exprgroup needs non-null list"
-      empty? rest le => first le
-      abs bb <= 36 => hconcat le
-      blankSeparate le
-
-    intgroup(li: List I): OUT ==
-      empty? li      => error "intgroup needs non-null list"
-      empty? rest li => intToExpr first(li)
-      abs bb <= 10 => hconcat [i :: OUT for i in li]
-      abs bb <= 36 => hconcat [intToExpr(i) for i in li]
-      blankSeparate [i :: OUT for i in li]
-
-    overBar(li: List I): OUT == overbar intgroup li
-
-    coerce(a): OUT ==
-      le : List OUT := nil()
-      if not null a.cyc then le := concat(overBar  a.cyc,le)
-      if not null a.pfx then le := concat(intgroup a.pfx,le)
-      if not null le    then le := concat("." :: OUT,le)
-      if not null a.int then le := concat(intgroup a.int,le)
-      else le := concat(0 :: OUT,le)
-      rex := exprgroup le
-      if a.sgn < 0 then -rex else rex
-
-    -- Construction utilities
-    checkRagits li ==
-      for i in li repeat if i < 0 or i >= bb then
-        error "Each ragit (digit) must be between 0 and base-1"
-      true
-
-    radixInt(n,bas) ==
-      rits: List I := nil()
-      while abs n ^= 0 repeat
-        qr   := divide(n,bas)
-        n    := qr.quotient
-        rits := concat(qr.remainder,rits)
-      rits
-
-    radixFrac(num,den,bas) ==
-      -- Rits is the sequence of quotient/remainder pairs
-      -- in calculating the radix expansion of the rational number.
-      -- We wish to find p and c such that
-      --    rits.i are distinct    for 0<=i<=p+c-1
-      --    rits.i = rits.(i+p)    for i>p
-      -- I.e. p is the length of the non-periodic prefix and c is
-      -- the length of the cycle.
-
-      -- Compute p and c using Floyd's algorithm.
-      -- 1. Find smallest n s.t. rits.n = rits.(2*n)
-      qr    := divide(bas * num, den)
-      i : I := 0
-      qr1i  := qr2i := qr
-      rits: List QuoRem := [qr]
-      until qr1i = qr2i repeat
-        qr1i := divide(bas * qr1i.remainder,den)
-        qrt  := divide(bas * qr2i.remainder,den)
-        qr2i := divide(bas * qrt.remainder,den)
-        rits := concat(qr2i, concat(qrt, rits))
-        i    := i + 1
-      rits := reverse_! rits
-      n    := i
-      -- 2. Find p = first i such that rits.i = rits.(i+n)
-      ritsi := rits
-      ritsn := rits; for i in 1..n repeat ritsn := rest ritsn
-      i := 0
-      while first(ritsi) ^= first(ritsn) repeat
-        ritsi := rest ritsi
-        ritsn := rest ritsn
-        i     := i + 1
-      p := i
-      -- 3. Find c = first i such that rits.p = rits.(p+i)
-      ritsn := rits; for i in 1..n repeat ritsn := rest ritsn
-      rn    := first ritsn
-      cfound:= false
-      c : I := 0
-      for i in 1..p while not cfound repeat
-        ritsn := rest ritsn
-        if rn = first(ritsn) then
-          c := i
-          cfound := true
-      if not cfound then c := n
-      -- 4. Now produce the lists of ragits.
-      ritspfx: List I := nil()
-      ritscyc: List I := nil()
-      for i in 1..p repeat
-        ritspfx := concat(first(rits).quotient, ritspfx)
-        rits    := rest rits
-      for i in 1..c repeat
-        ritscyc := concat(first(rits).quotient, ritscyc)
-        rits    := rest rits
-      [reverse_! ritspfx, reverse_! ritscyc]
-
-@
-\section{domain BINARY BinaryExpansion}
-<<BinaryExpansion.input>>=
--- radix.spad.pamphlet BinaryExpansion.input
-)spool BinaryExpansion.output
-)set message test on
-)set message auto off
-)clear all
---S 1
-r := binary(22/7)
---R 
---R
---R           ___
---R   (1)  11.001
---R                                                        Type: BinaryExpansion
---E 1
-
---S 2
-r + binary(6/7)
---R 
---R
---R   (2)  100
---R                                                        Type: BinaryExpansion
---E 2
-
---S 3
-[binary(1/i) for i in 102..106]
---R 
---R
---R   (3)
---R       ________    ___________________________________________________
---R   [0.000000101, 0.000000100111110001000101100101111001110010010101001,
---R         ____________    ____________
---R    0.000000100111011, 0.000000100111,
---R       ____________________________________________________
---R    0.00000010011010100100001110011111011001010110111100011]
---R                                                   Type: List BinaryExpansion
---E 3
-
---S 4
-binary(1/1007)
---R 
---R
---R   (4)
---R   0.
---R     OVERBAR
---R        00000000010000010001010010010111100000111111000010111111001011000111110
---R          100010011100100110011000110010010101011110110100110000000011000011001
---R          111011100011010001011110100100011110110000101011101110011101010111001
---R          100101001011100000001110001111001000000100100100110111001010100111010
---R          001101110110101110001001000001100101101100000010110010111110001010000
---R          010101010110101100000110110111010010101111111010111010100110010000101
---R          0011011000100110001000100001000011000111010011110001
---R                                                        Type: BinaryExpansion
---E 4
-
---S 5
-p := binary(1/4)*x**2 + binary(2/3)*x + binary(4/9)
---R 
---R
---R             2     __      ______
---R   (5)  0.01x  + 0.10x + 0.011100
---R                                             Type: Polynomial BinaryExpansion
---E 5
-
---S 6
-q := D(p, x)
---R 
---R
---R                 __
---R   (6)  0.1x + 0.10
---R                                             Type: Polynomial BinaryExpansion
---E 6
-
---S 7
-g := gcd(p, q)
---R 
---R
---R              __
---R   (7)  x + 1.01
---R                                             Type: Polynomial BinaryExpansion
---E 7
-)spool
-)lisp (bye)
-@
-<<BinaryExpansion.help>>=
-====================================================================
-BinaryExpansion examples
-====================================================================
-All rational numbers have repeating binary expansions.  Operations to
-access the individual bits of a binary expansion can be obtained by
-converting the value to RadixExpansion(2).  More examples of
-expansions are available with
-
-The expansion (of type BinaryExpansion) of a rational number is
-returned by the binary operation.
-
-  r := binary(22/7)
-      ___
-   11.001
-                      Type: BinaryExpansion
-
-Arithmetic is exact.
-
-  r + binary(6/7)
-   100 
-                      Type: BinaryExpansion
-
-The period of the expansion can be short or long.
-
-  [binary(1/i) for i in 102..106]
-      ________
-   [0.00000101,
-      ___________________________________________________
-    0.000000100111110001000101100101111001110010010101001,
-         ____________    ____________
-    0.000000100111011, 0.000000100111,
-       ____________________________________________________
-    0.00000010011010100100001110011111011001010110111100011]
-                      Type: List BinaryExpansion
-
-or very long.
-
-  binary(1/1007)
-     ________________________________________________________________________
-   0.000000000100000100010100100101111000001111110000101111110010110001111101
-     ________________________________________________________________________
-     000100111001001100110001100100101010111101101001100000000110000110011110
-     ________________________________________________________________________
-     111000110100010111101001000111101100001010111011100111010101110011001010
-     ________________________________________________________________________
-     010111000000011100011110010000001001001001101110010101001110100011011101
-     ________________________________________________________________________
-     101011100010010000011001011011000000101100101111100010100000101010101101
-     ________________________________________________________________________
-     011000001101101110100101011111110101110101001100100001010011011000100110
-     ____________________________________
-     001000100001000011000111010011110001
-                      Type: BinaryExpansion
-
-These numbers are bona fide algebraic objects.
-
-  p := binary(1/4)*x**2 + binary(2/3)*x + binary(4/9)
-               __       ______
-   0.01 x^2 +0.10 x + 0.011100
-                      Type: Polynomial BinaryExpansion
-
-  q := D(p, x)
-             __
-   0.1 x + 0.10
-                      Type: Polynomial BinaryExpansion
-
-  g := gcd(p, q)
-       __
-   x+1.01
-                      Type: Polynomial BinaryExpansion
-
-See Also:
-o )help DecimalExpansion
-o )help HexadecimalExpansion
-o )show BinaryExpansion
-o $AXIOM/doc/src/algebra/radix.spad.dvi
-
-@
-<<domain BINARY BinaryExpansion>>=
-)abbrev domain BINARY BinaryExpansion
-++ Author: Clifton J. Williamson
-++ Date Created: April 26, 1990
-++ Date Last Updated: May 15, 1991
-++ Basic Operations:
-++ Related Domains: RadixExpansion
-++ Also See:
-++ AMS Classifications:
-++ Keywords: radix, base, binary
-++ Examples:
-++ References:
-++ Description:
-++   This domain allows rational numbers to be presented as repeating
-++   binary expansions.
-
-BinaryExpansion(): Exports == Implementation where
-  Exports ==> QuotientFieldCategory(Integer) with
-    coerce: % -> Fraction Integer
-      ++ coerce(b) converts a binary expansion to a rational number.
-    coerce: % -> RadixExpansion(2)
-      ++ coerce(b) converts a binary expansion to a radix expansion with base 2.
-    fractionPart: % -> Fraction Integer
-      ++ fractionPart(b) returns the fractional part of a binary expansion.
-    binary: Fraction Integer -> %
-      ++ binary(r) converts a rational number to a binary expansion.
-      ++
-      ++X binary(22/7)
-
-  Implementation ==> RadixExpansion(2) add
-    binary r == r :: %
-    coerce(x:%): RadixExpansion(2) == x pretend RadixExpansion(2)
-
-@
-\section{domain DECIMAL DecimalExpansion}
-<<DecimalExpansion.input>>=
--- radix.spad.pamphlet DecimalExpansion.input
-)spool DecimalExpansion.output
-)set message test on
-)set message auto off
-)clear all
---S 1 of 7
-r := decimal(22/7)
---R 
---R
---R          ______
---R   (1)  3.142857
---R                                                       Type: DecimalExpansion
---E 1
-
---S 2 of 7
-r + decimal(6/7)
---R 
---R
---R   (2)  4
---R                                                       Type: DecimalExpansion
---E 2
-
---S 3 of 7
-[decimal(1/i) for i in 350..354]
---R 
---R
---R   (3)
---R        ______    ______         __    ________________________________
---R   [0.00285714, 0.002849, 0.0028409, 0.00283286118980169971671388101983,
---R       __________________________________________________________
---R    0.00282485875706214689265536723163841807909604519774011299435]
---R                                                  Type: List DecimalExpansion
---E 3
-
---S 4 of 7
-decimal(1/2049)
---R 
---R
---R   (4)
---R   0.
---R     OVERBAR
---R        00048804294777940458760370912640312347486578818936066373840897999023914
---R          104441190824792581747193753050268423621278672523182040019521717911176
---R          183504148365056124938994631527574426549536359199609565641776476329917
---R          032698877501220107369448511469009272816007808687164470473401659346022
---R          449975597852611029770619814543679843826256710590531966813079551
---R                                                       Type: DecimalExpansion
---E 4
-
---S 5 of 7
-p := decimal(1/4)*x**2 + decimal(2/3)*x + decimal(4/9) 
---R 
---R
---R             2     _      _
---R   (5)  0.25x  + 0.6x + 0.4
---R                                            Type: Polynomial DecimalExpansion
---E 5
-
---S 6 of 7
-q := differentiate(p, x)
---R 
---R
---R                 _
---R   (6)  0.5x + 0.6
---R                                            Type: Polynomial DecimalExpansion
---E 6
-
---S 7 of 7
-g := gcd(p, q)
---R 
---R
---R              _
---R   (7)  x + 1.3
---R                                            Type: Polynomial DecimalExpansion
---E 7
-)spool
-)lisp (bye)
-@
-<<DecimalExpansion.help>>=
-====================================================================
-DecimalExpansion examples
-====================================================================
-
-All rationals have repeating decimal expansions.  Operations to access
-the individual digits of a decimal expansion can be obtained by
-converting the value to RadixExpansion(10).  
-
-The operation decimal is used to create this expansion of type
-DecimalExpansion.
-
-  r := decimal(22/7)
-      ______
-    3.142857
-                      Type: DecimalExpansion
-
-Arithmetic is exact.
-
-  r + decimal(6/7)
-   4
-                      Type: DecimalExpansion
-
-The period of the expansion can be short or long ...
-
-  [decimal(1/i) for i in 350..354]
-        ______    ______         __    ________________________________
-   [0.00285714, 0.002849, 0.0028409, 0.00283286118980169971671388101983,
-       __________________________________________________________
-    0.00282485875706214689265536723163841807909604519774011299435]
-                      Type: List DecimalExpansion
-
-or very long.
-
-  decimal(1/2049)
-     _______________________________________________________________________
-   0.00048804294777940458760370912640312347486578818936066373840897999023914
-     _____________________________________________________________________
-     104441190824792581747193753050268423621278672523182040019521717911176
-     _____________________________________________________________________
-     183504148365056124938994631527574426549536359199609565641776476329917
-     _____________________________________________________________________
-     032698877501220107369448511469009272816007808687164470473401659346022
-     _______________________________________________________________
-     449975597852611029770619814543679843826256710590531966813079551
-                     Type: DecimalExpansion
-
-These numbers are bona fide algebraic objects.
-
-  p := decimal(1/4)*x**2 + decimal(2/3)*x + decimal(4/9) 
-        2     _      _
-   0.25x  + 0.6x + 0.4
-                     Type: Polynomial DecimalExpansion
-
-  q := differentiate(p, x)
-            _
-   0.5x + 0.6
-                     Type: Polynomial DecimalExpansion
-
-  g := gcd(p, q)
-         _
-   x + 1.3
-                     Type: Polynomial DecimalExpansion
-
-See Also:
-o )help RadixExpansion
-o )help BinaryExpansion
-o )help HexadecimalExpansion
-o )show DecimalExpansion
-o $AXIOM/doc/src/algebra/radix.spad.dvi
-
-@
-<<domain DECIMAL DecimalExpansion>>=
-)abbrev domain DECIMAL DecimalExpansion
-++ Author: Stephen M. Watt
-++ Date Created: October, 1986
-++ Date Last Updated: May 15, 1991
-++ Basic Operations:
-++ Related Domains: RadixExpansion
-++ Also See:
-++ AMS Classifications:
-++ Keywords: radix, base, repeating decimal
-++ Examples:
-++ References:
-++ Description:
-++   This domain allows rational numbers to be presented as repeating
-++   decimal expansions.
-DecimalExpansion(): Exports == Implementation where
-  Exports ==> QuotientFieldCategory(Integer) with
-    coerce: % -> Fraction Integer
-      ++ coerce(d) converts a decimal expansion to a rational number.
-    coerce: % -> RadixExpansion(10)
-      ++ coerce(d) converts a decimal expansion to a radix expansion
-      ++ with base 10.
-    fractionPart: % -> Fraction Integer
-      ++ fractionPart(d) returns the fractional part of a decimal expansion.
-    decimal: Fraction Integer -> %
-      ++ decimal(r) converts a rational number to a decimal expansion.
-
-  Implementation ==> RadixExpansion(10) add
-    decimal r == r :: %
-    coerce(x:%): RadixExpansion(10) == x pretend RadixExpansion(10)
-
-@
-\section{domain HEXADEC HexadecimalExpansion}
-<<HexadecimalExpansion.input>>=
--- radix.spad.pamphlet HexadecimalExpansion.input
-)spool HexadecimalExpansion.output
-)set message test on
-)set message auto off
-)clear all
---S 1 of 7
-r := hex(22/7)
---R 
---R
---R          ___
---R   (1)  3.249
---R                                                   Type: HexadecimalExpansion
---E 1
-
---S 2 of 7
-r + hex(6/7)
---R 
---R
---R   (2)  4
---R                                                   Type: HexadecimalExpansion
---E 2
-
---S 3 of 7
-[hex(1/i) for i in 350..354]
---R 
---R
---R   (3)
---R       _______________    _________      _____    ______________________
---R   [0.00BB3EE721A54D88, 0.00BAB6561, 0.00BA2E8, 0.00B9A7862A0FF465879D5F,
---R       _____________________________
---R    0.00B92143FA36F5E02E4850FE8DBD78]
---R                                              Type: List HexadecimalExpansion
---E 3
-
---S 4 of 7
-hex(1/1007)
---R 
---R
---R   (4)
---R   0.
---R     OVERBAR
---R        0041149783F0BF2C7D13933192AF6980619EE345E91EC2BB9D5CCA5C071E40926E54E8D
---R          DAE24196C0B2F8A0AAD60DBA57F5D4C8536262210C74F1
---R                                                   Type: HexadecimalExpansion
---E 4
-
---S 5 of 7
-p := hex(1/4)*x**2 + hex(2/3)*x + hex(4/9)
---R 
---R
---R            2     _      ___
---R   (5)  0.4x  + 0.Ax + 0.71C
---R                                        Type: Polynomial HexadecimalExpansion
---E 5
-
---S 6 of 7
-q := D(p, x)
---R 
---R
---R                 _
---R   (6)  0.8x + 0.A
---R                                        Type: Polynomial HexadecimalExpansion
---E 6
-
---S 7 of 7
-g := gcd(p, q)
---R 
---R
---R              _
---R   (7)  x + 1.5
---R                                        Type: Polynomial HexadecimalExpansion
---E 7
-)spool
-)lisp (bye)
-@
-<<HexadecimalExpansion.help>>=
-====================================================================
-HexadecimalExpansion
-====================================================================
-
-All rationals have repeating hexadecimal expansions.  The operation
-hex returns these expansions of type HexadecimalExpansion.  Operations
-to access the individual numerals of a hexadecimal expansion can be
-obtained by converting the value to RadixExpansion(16).  More examples
-of expansions are available in the DecimalExpansion, BinaryExpansion,
-and RadixExpansion.
-
-This is a hexadecimal expansion of a rational number.
-
-  r := hex(22/7)
-      ___
-    3.249
-                      Type: HexadecimalExpansion
-
-Arithmetic is exact.
-
-  r + hex(6/7)
-    4
-                      Type: HexadecimalExpansion
-
-The period of the expansion can be short or long ...
-
-  [hex(1/i) for i in 350..354]
-       _______________    _________      _____    ______________________
-   [0.00BB3EE721A54D88, 0.00BAB6561, 0.00BA2E8, 0.00B9A7862A0FF465879D5F,
-       _____________________________
-    0.00B92143FA36F5E02E4850FE8DBD78]
-                      Type: List HexadecimalExpansion
-
-or very long!
-
-  hex(1/1007)
-     _______________________________________________________________________
-   0.0041149783F0BF2C7D13933192AF6980619EE345E91EC2BB9D5CCA5C071E40926E54E8D
-     ______________________________________________
-     DAE24196C0B2F8A0AAD60DBA57F5D4C8536262210C74F1
-                      Type: HexadecimalExpansion
-
-These numbers are bona fide algebraic objects.
-
-  p := hex(1/4)*x**2 + hex(2/3)*x + hex(4/9)
-        2     _      ___
-    0.4x  + 0.Ax + 0.71C
-                      Type: Polynomial HexadecimalExpansion
-
-  q := D(p, x)
-             _
-    0.8x + 0.A
-                      Type: Polynomial HexadecimalExpansion
-
-  g := gcd(p, q)
-          _
-    x + 1.5
-                      Type: Polynomial HexadecimalExpansion
-
-See Also:
-o )help RadixExpansion
-o )help BinaryExpansion
-o )help DecimalExpansion
-o )show HexadecimalExpansion
-o $AXIOM/doc/src/algebra/radix.spad.dvi
-
-@
-<<domain HEXADEC HexadecimalExpansion>>=
-)abbrev domain HEXADEC HexadecimalExpansion
-++ Author: Clifton J. Williamson
-++ Date Created: April 26, 1990
-++ Date Last Updated: May 15, 1991
-++ Basic Operations:
-++ Related Domains: RadixExpansion
-++ Also See:
-++ AMS Classifications:
-++ Keywords: radix, base, hexadecimal
-++ Examples:
-++ References:
-++ Description:
-++   This domain allows rational numbers to be presented as repeating
-++   hexadecimal expansions.
-
-HexadecimalExpansion(): Exports == Implementation where
-  Exports ==> QuotientFieldCategory(Integer) with
-    coerce: % -> Fraction Integer
-      ++ coerce(h) converts a hexadecimal expansion to a rational number.
-    coerce: % -> RadixExpansion(16)
-      ++ coerce(h) converts a hexadecimal expansion to a radix expansion
-      ++ with base 16.
-    fractionPart: % -> Fraction Integer
-      ++ fractionPart(h) returns the fractional part of a hexadecimal expansion.
-    hex: Fraction Integer -> %
-      ++ hex(r) converts a rational number to a hexadecimal expansion.
-
-  Implementation ==> RadixExpansion(16) add
-    hex r == r :: %
-    coerce(x:%): RadixExpansion(16) == x pretend RadixExpansion(16)
-
-@
 \section{package RADUTIL RadixUtilities}
 <<package RADUTIL RadixUtilities>>=
 )abbrev package RADUTIL RadixUtilities
@@ -1153,10 +69,6 @@ RadixUtilities: Exports == Implementation where
 <<*>>=
 <<license>>
 
-<<domain RADIX RadixExpansion>>
-<<domain BINARY BinaryExpansion>>
-<<domain DECIMAL DecimalExpansion>>
-<<domain HEXADEC HexadecimalExpansion>>
 <<package RADUTIL RadixUtilities>>
 @
 \eject
diff --git a/src/algebra/reclos.spad.pamphlet b/src/algebra/reclos.spad.pamphlet
index 2c39ac3..0d7147d 100644
--- a/src/algebra/reclos.spad.pamphlet
+++ b/src/algebra/reclos.spad.pamphlet
@@ -21,24 +21,12 @@ functionalities to work with "real roots" of univariate polynomials. These
 resemble variables with some functionalities needed to compute important
 operations.
 
-- RealClosedField is a category with provides comon operations available over
+- RealClosedField is a category with provides common operations available over
 real closed fiels. These include finding all the roots of univariate
 polynomial, taking square roots, ...
 
-- The domain RightOpenIntervalRootCharacterization is the main code that
-provides the functionalities of RealRootCharacterizationCategory for the case
-of archimedean fileds. Abstract roots are encoded with a left closed right
-open interval containing the root together with a defining polynomial for the
-root.
 
-- The RealClosure domain is the end-user code, it provides usual arithmetics
-with real algebraic numbers, along with the functionalities of a real closed
-field. It also provides functions to approximate a real algebraic number by an
-element of the base field. This approximation may either be absolute
-(approximate) or relative (realtivApprox).
-
-
-CAVEEATS
+CAVEATS
 
 Since real algebraic expressions are stored as depending on "real roots" which
 are managed like variables, there is an ordering on these. This ordering is
@@ -179,1980 +167,6 @@ RealPolynomialUtilitiesPackage(TheField,ThePols) : PUB == PRIV where
            lazyVariations(rest(rest(l)),s,sh)
     
 @
-\section{domain ROIRC RightOpenIntervalRootCharacterization}
-\subsection{makeChar performance problem}
-The following lines of code, which check for a possible error,
-cause major performance problems and were removed by Renaud Rioboo,
-the original author. They were originally inserted for debugging.
-\begin{verbatim}
-    right <= left => error "ROIRC: makeChar: Bad interval"
-    (pol.left * pol.right) > 0 => error "ROIRC: makeChar: Bad pol"
-\end{verbatim}
-<<performance problem>>=
-@
-<<domain ROIRC RightOpenIntervalRootCharacterization>>=
-)abbrev domain ROIRC RightOpenIntervalRootCharacterization 
-++ Author: Renaud Rioboo
-++ Date Created: summer 1992
-++ Date Last Updated: January 2004
-++ Basic Functions: provides computations with real roots of olynomials 
-++ Related Constructors: RealRootCharacterizationCategory, RealClosure
-++ Also See: 
-++ AMS Classifications:
-++ Keywords: Real Algebraic Numbers
-++ References: 
-++ Description:
-++ \axiomType{RightOpenIntervalRootCharacterization} provides work with
-++ interval root coding.
-RightOpenIntervalRootCharacterization(TheField,ThePolDom) : PUB == PRIV where
-
-  TheField : Join(OrderedRing,Field)
-  ThePolDom : UnivariatePolynomialCategory(TheField)
-
-
-  Z           ==>  Integer
-  P           ==>  ThePolDom
-  N           ==>  NonNegativeInteger
-  B           ==>  Boolean
-  UTIL        ==>  RealPolynomialUtilitiesPackage(TheField,ThePolDom)
-  RRCC        ==>  RealRootCharacterizationCategory
-  O ==> OutputForm
-  TwoPoints ==> Record(low:TheField , high:TheField)
-
-  PUB == RealRootCharacterizationCategory(TheField, ThePolDom) with
-
-      left    :             $            -> TheField
-           ++ \axiom{left(rootChar)} is the left bound of the isolating
-           ++ interval
-      right   :             $            -> TheField
-           ++ \axiom{right(rootChar)} is the right bound of the isolating
-           ++ interval
-      size    :             $            -> TheField
-           ++ The size of the isolating interval
-      middle  :             $            -> TheField
-           ++ \axiom{middle(rootChar)} is the middle of the isolating
-           ++ interval
-      refine  :             $            ->    $
-           ++ \axiom{refine(rootChar)} shrinks isolating interval around 
-           ++ \axiom{rootChar}
-      mightHaveRoots :     (P,$)         ->    B
-           ++ \axiom{mightHaveRoots(p,r)} is false if \axiom{p.r} is not 0
-      relativeApprox :     (P,$,TheField) -> TheField
-           ++ \axiom{relativeApprox(exp,c,p) = a} is relatively close to exp
-           ++ as a polynomial in c ip to precision p
-
-  PRIV == add
-
-
-
--- local functions
-
-
-   makeChar:             (TheField,TheField,ThePolDom) ->     $
-   refine! :                              $            ->     $
-   sturmIsolate : (List(P), TheField, TheField,N,N)    -> List TwoPoints
-   isolate :                            List(P)        -> List TwoPoints
-   rootBound :                             P           ->   TheField
---   varStar :                                P          ->     N
-   linearRecip :                       ( P , $)        -> Union(P, "failed")
-   linearZero? :                     (TheField,$)      ->     B
-   linearSign :                          (P,$)         ->     Z
-   sturmNthRoot : (List(P), TheField, TheField,N,N,N)  -> Union(TwoPoints,"failed")
-   addOne :                              P             ->      P
-   minus :                               P             ->      P
-   translate :                    (P,TheField)         ->      P
-   dilate :                       (P,TheField)         ->      P
-   invert :                              P             ->      P
-   evalOne :                             P             ->   TheField
-   hasVarsl:                     List(TheField)        ->      B
-   hasVars:                              P             ->      B
-
--- Representation
-
-   Rep:= Record(low:TheField,high:TheField,defPol:ThePolDom)
-
--- and now the code !
-
-
-   size(rootCode) ==
-     rootCode.high - rootCode.low
-
-   relativeApprox(pval,rootCode,prec) ==
-     -- beurk !
-     dPol := rootCode.defPol
-     degree(dPol) = 1 => 
-       c := -coefficient(dPol,0)/leadingCoefficient(dPol)
-       pval.c
-     pval := pval rem dPol
-     degree(pval) = 0 => leadingCoefficient(pval)
-     zero?(pval,rootCode)  => 0
-     while mightHaveRoots(pval,rootCode) repeat
-          rootCode := refine(rootCode)
-     dpval := differentiate(pval)
-     degree(dpval) = 0 =>
-       l := left(rootCode)
-       r := right(rootCode)
-       a := pval.l
-       b := pval.r
-       while ( abs(2*(a-b)/(a+b)) > prec ) repeat
-         rootCode := refine(rootCode)
-         l := left(rootCode)
-         r := right(rootCode)
-         a := pval.l
-         b := pval.r
-       (a+b)/(2::TheField)
-     zero?(dpval,rootCode) => 
-        relativeApprox(pval, 
-                       [left(rootCode),
-                         right(rootCode),
-                           gcd(dpval,rootCode.defPol)]$Rep,
-                       prec)
-     while mightHaveRoots(dpval,rootCode) repeat
-          rootCode := refine(rootCode)
-     l := left(rootCode)
-     r := right(rootCode)
-     a := pval.l
-     b := pval.r
-     while ( abs(2*(a-b)/(a+b)) > prec ) repeat
-       rootCode := refine(rootCode)
-       l := left(rootCode)
-       r := right(rootCode)
-       a := pval.l
-       b := pval.r
-     (a+b)/(2::TheField)
-
-   approximate(pval,rootCode,prec) ==
-     -- glurp
-     dPol := rootCode.defPol
-     degree(dPol) = 1 => 
-       c := -coefficient(dPol,0)/leadingCoefficient(dPol)
-       pval.c
-     pval := pval rem dPol
-     degree(pval) = 0 => leadingCoefficient(pval)
-     dpval := differentiate(pval)
-     degree(dpval) = 0 =>
-       l := left(rootCode)
-       r := right(rootCode)
-       while ( abs((a := pval.l) - (b := pval.r)) > prec ) repeat
-         rootCode := refine(rootCode)
-         l := left(rootCode)
-         r := right(rootCode)
-       (a+b)/(2::TheField)
-     zero?(dpval,rootCode) => 
-        approximate(pval, 
-                    [left(rootCode),
-                     right(rootCode),
-                      gcd(dpval,rootCode.defPol)]$Rep,
-                    prec)
-     while mightHaveRoots(dpval,rootCode) repeat
-          rootCode := refine(rootCode)
-     l := left(rootCode)
-     r := right(rootCode)
-     while ( abs((a := pval.l) - (b := pval.r)) > prec ) repeat
-       rootCode := refine(rootCode)
-       l := left(rootCode)
-       r := right(rootCode)
-     (a+b)/(2::TheField)
-
-
-   addOne(p) == p.(monomial(1,1)+(1::P))
-
-   minus(p) == p.(monomial(-1,1))
-
-   translate(p,a) == p.(monomial(1,1)+(a::P))
-
-   dilate(p,a) == p.(monomial(a,1))
-
-   evalOne(p) == "+" / coefficients(p)
-
-   invert(p) == 
-        d := degree(p)
-        mapExponents((d-#1)::N, p)
-
-   rootBound(p) ==
-     res : TheField := 1
-     raw :TheField := 1+boundOfCauchy(p)$UTIL
-     while (res < raw) repeat
-       res := 2*(res)
-     res
-
-   sturmNthRoot(lp,l,r,vl,vr,n) ==
-    nv := (vl - vr)::N
-    nv < n => "failed"
-    ((nv = 1) and (n = 1)) => [l,r]
-    int := (l+r)/(2::TheField)
-    lt:List(TheField):=[]
-    for t in lp repeat
-        lt := cons(t.int , lt)
-    vi := sturmVariationsOf(reverse! lt)$UTIL
-    o :Z := n - vl + vi
-    if o > 0
-    then 
-       sturmNthRoot(lp,int,r,vi,vr,o::N)
-    else
-       sturmNthRoot(lp,l,int,vl,vi,n)
-
-   sturmIsolate(lp,l,r,vl,vr) ==
-    r <= l => error "ROIRC: sturmIsolate: bad bounds"
-    n := (vl - vr)::N
-    zero?(n) => []
-    one?(n) => [[l,r]]
-    int := (l+r)/(2::TheField)
-    vi := sturmVariationsOf( [t.int for t in lp ] )$UTIL
-    append(sturmIsolate(lp,l,int,vl,vi),sturmIsolate(lp,int,r,vi,vr))
-
-   isolate(lp) ==
-     b := rootBound(first(lp))
-     l1,l2 : List(TheField)
-     (l1,l2) := ([] , [])
-     for t in reverse(lp) repeat
-       if odd?(degree(t))
-       then
-        (l1,l2):= (cons(-leadingCoefficient(t),l1),
-                   cons(leadingCoefficient(t),l2))
-       else
-        (l1,l2):= (cons(leadingCoefficient(t),l1),
-                   cons(leadingCoefficient(t),l2))
-     sturmIsolate(lp,
-                  -b,
-                  b,
-                  sturmVariationsOf(l1)$UTIL,
-                  sturmVariationsOf(l2)$UTIL)
-
-   rootOf(pol,n) ==
-    ls := sturmSequence(pol)$UTIL
-    pol := unitCanonical(first(ls)) -- this one is SqFR
-    degree(pol) = 0 => "failed"
-    numberOfMonomials(pol) = 1 => ([0,1,monomial(1,1)]$Rep)::$
-    b := rootBound(pol)
-    l1,l2 : List(TheField)
-    (l1,l2) := ([] , [])
-    for t in reverse(ls) repeat
-      if odd?(degree(t))
-      then
-       (l1,l2):= (cons(leadingCoefficient(t),l1),
-                  cons(-leadingCoefficient(t),l2))
-      else
-       (l1,l2):= (cons(leadingCoefficient(t),l1),
-                  cons(leadingCoefficient(t),l2))
-    res := sturmNthRoot(ls,
-                        -b,
-                        b,
-                        sturmVariationsOf(l2)$UTIL,
-                        sturmVariationsOf(l1)$UTIL,
-                        n)
-    res case "failed" => "failed"
-    makeChar(res.low,res.high,pol)
-
-   allRootsOf(pol) == 
-    ls := sturmSequence(unitCanonical pol)$UTIL
-    pol := unitCanonical(first(ls)) -- this one is SqFR
-    degree(pol) = 0 => []
-    numberOfMonomials(pol) = 1 => [[0,1,monomial(1,1)]$Rep]
-    [ makeChar(term.low,term.high,pol) for term in isolate(ls) ]
-
-
-   hasVarsl(l:List(TheField)) ==
-    null(l) => false
-    f := sign(first(l))
-    for term in rest(l) repeat
-      if f*term < 0 then return(true)
-    false
-    
-   hasVars(p:P) ==
-    zero?(p) => error "ROIRC: hasVars: null polynonial"
-    zero?(coefficient(p,0)) => true
-    hasVarsl(coefficients(p))
-
-
-   mightHaveRoots(p,rootChar) == 
-      a := rootChar.low
-      q := translate(p,a)
-      not(hasVars(q)) => false
---      varStar(q) = 0 => false
-      a := (rootChar.high) - a
-      q := dilate(q,a)
-      sign(coefficient(q,0))*sign(evalOne(q)) <= 0 => true
-      q := minus(addOne(q))
-      not(hasVars(q)) => false
---      varStar(q) = 0 => false
-      q := invert(q)
-      hasVars(addOne(q))
---      ^(varStar(addOne(q)) = 0)
-
-   coerce(rootChar:$):O == 
-     commaSeparate([ hconcat("[" :: O , (rootChar.low)::O), 
-                     hconcat((rootChar.high)::O,"[" ::O ) ])
-
-   c1 = c2 == 
-     mM := max(c1.low,c2.low)
-     Mm := min(c1.high,c2.high)
-     mM >= Mm => false
-     rr : ThePolDom := gcd(c1.defPol,c2.defPol)
-     degree(rr) = 0 => false
-     sign(rr.mM) * sign(rr.Mm) <= 0
-
-   makeChar(left,right,pol) == 
-<<performance problem>>
-    res :$ := [left,right,leadingMonomial(pol)+reductum(pol)]$Rep -- safe copy
-    while zero?(pol.(res.high)) repeat refine!(res)
-    while (res.high * res.low < 0 ) repeat refine!(res)
-    zero?(pol.(res.low)) => [res.low,res.high,monomial(1,1)-(res.low)::P]
-    res
-
-   definingPolynomial(rootChar) == rootChar.defPol
-
-   linearRecip(toTest,rootChar) ==
-      c := - inv(leadingCoefficient(toTest)) * coefficient(toTest,0)
-      r := recip(rootChar.defPol.c)
-      if (r case "failed")
-      then
-        if (c - rootChar.low) * (c - rootChar.high) <= 0
-        then 
-          "failed"
-        else
-          newPol := (rootChar.defPol exquo toTest)::P
-          ((1$ThePolDom - inv(newPol.c)*newPol) exquo toTest)::P
-      else
-         ((1$ThePolDom - (r::TheField)*rootChar.defPol) exquo toTest)::P
-
-   recip(toTest,rootChar) ==
-     degree(toTest) = 0 or degree(rootChar.defPol) <= degree(toTest) =>
-       error "IRC: recip: Not reduced"
-     degree(rootChar.defPol) = 1 =>
-       error "IRC: recip: Linear Defining Polynomial"
-     degree(toTest) = 1 =>
-       linearRecip(toTest, rootChar)
-     d := extendedEuclidean((rootChar.defPol),toTest)
-     (degree(d.generator) = 0 ) => 
-         d.coef2
-     d.generator := unitCanonical(d.generator)
-     (d.generator.(rootChar.low) *
-      d.generator.(rootChar.high)<= 0) => "failed"
-     newPol := (rootChar.defPol exquo (d.generator))::P
-     degree(newPol) = 1 =>
-       c := - inv(leadingCoefficient(newPol)) * coefficient(newPol,0)
-       inv(toTest.c)::P
-     degree(toTest) = 1 => 
-       c := - coefficient(toTest,0)/ leadingCoefficient(toTest)
-       ((1$ThePolDom - inv(newPol.(c))*newPol) exquo toTest)::P
-     d := extendedEuclidean(newPol,toTest)
-     d.coef2
-
-   linearSign(toTest,rootChar) ==
-      c := - inv(leadingCoefficient(toTest)) * coefficient(toTest,0)
-      ev := sign(rootChar.defPol.c)
-      if zero?(ev)
-      then
-        if (c - rootChar.low) * (c - rootChar.high) <= 0
-        then
-          0
-        else
-          sign(toTest.(rootChar.high))
-      else
-        if (ev*sign(rootChar.defPol.(rootChar.high)) <= 0 )
-        then
-          sign(toTest.(rootChar.high))
-        else
-          sign(toTest.(rootChar.low))
-
-   sign(toTest,rootChar) ==
-     degree(toTest) = 0 or degree(rootChar.defPol) <= degree(toTest) =>
-       error "IRC: sign: Not reduced"
-     degree(rootChar.defPol) = 1 =>
-       error "IRC: sign: Linear Defining Polynomial"
-     degree(toTest) = 1 =>
-      linearSign(toTest, rootChar)
-     s := sign(leadingCoefficient(toTest))
-     toTest := monomial(1,degree(toTest))+
-               inv(leadingCoefficient(toTest))*reductum(toTest)
-     delta := gcd(toTest,rootChar.defPol)
-     newChar := [rootChar.low,rootChar.high,rootChar.defPol]$Rep
-     if degree(delta) > 0
-     then
-       if sign(delta.(rootChar.low) * delta.(rootChar.high)) <= 0
-       then
-        return(0)
-       else
-        newChar.defPol := (newChar.defPol exquo delta) :: P
-        toTest := toTest rem (newChar.defPol)
-     degree(toTest) = 0 => s * sign(leadingCoefficient(toTest))
-     degree(toTest) = 1 => s * linearSign(toTest, newChar)
-     while mightHaveRoots(toTest,newChar) repeat
-       newChar := refine(newChar)
-     s*sign(toTest.(newChar.low))
-
-   linearZero?(c,rootChar) == 
-      zero?((rootChar.defPol).c) and 
-       (c - rootChar.low) * (c - rootChar.high) <= 0
-
-   zero?(toTest,rootChar) ==
-     degree(toTest) = 0 or degree(rootChar.defPol) <= degree(toTest) =>
-       error "IRC: zero?: Not reduced"
-     degree(rootChar.defPol) = 1 =>
-       error "IRC: zero?: Linear Defining Polynomial"
-     degree(toTest) = 1 => 
-      linearZero?(- inv(leadingCoefficient(toTest)) * coefficient(toTest,0),
-                  rootChar)
-     toTest := monomial(1,degree(toTest))+
-               inv(leadingCoefficient(toTest))*reductum(toTest)
-     delta := gcd(toTest,rootChar.defPol)
-     degree(delta) = 0 => false
-     sign(delta.(rootChar.low) * delta.(rootChar.high)) <= 0
-
-
-   refine!(rootChar) ==
-     -- this is not a safe function, it can work with badly created object
-     -- we do not assume (rootChar.defPol).(rootChar.high) <> 0
-        int := middle(rootChar)
-        s1 := sign((rootChar.defPol).(rootChar.low))
-        zero?(s1) =>
-          rootChar.high := int
-          rootChar.defPol := monomial(1,1) - (rootChar.low)::P
-          rootChar
-        s2 := sign((rootChar.defPol).int)
-        zero?(s2) =>
-          rootChar.low := int
-          rootChar.defPol := monomial(1,1) - int::P
-          rootChar
-        if (s1*s2 < 0)
-        then 
-          rootChar.high := int
-        else 
-          rootChar.low := int
-        rootChar
-
-   refine(rootChar) ==
-     -- we assume (rootChar.defPol).(rootChar.high) <> 0
-        int := middle(rootChar)
-        s:= (rootChar.defPol).int * (rootChar.defPol).(rootChar.high)
-        zero?(s) => [int,rootChar.high,monomial(1,1)-int::P]
-        if s < 0 
-        then 
-          [int,rootChar.high,rootChar.defPol]
-        else 
-          [rootChar.low,int,rootChar.defPol]
-
-   left(rootChar) == rootChar.low
-
-   right(rootChar) == rootChar.high
-
-   middle(rootChar) == (rootChar.low + rootChar.high)/(2::TheField)
-
---   varStar(p) == -- if 0 no roots in [0,:infty[
---     res : N := 0
---     lsg := sign(coefficient(p,0))
---     l := [ sign(i) for i in reverse!(coefficients(p))]
---     for sg in l repeat
---      if (sg ^= lsg) then res := res + 1
---      lsg := sg
---     res
-@
-\section{domain RECLOS RealClosure}
-The domain constructore {\bf RealClosure} by Renaud Rioboo (University
-of Paris 6, France) provides the real closure of an ordered field.
-The implementation is based on interval arithmetic. Moreover, the
-design of this constructor and its related packages allows an easy
-use of other codings for real algebraic numbers.
-ordered field
-<<RealClosure.input>>=
--- reclos.spad.pamphlet RealClosure.input
-)spool RealClosure.output
-)set message test on
-)set message auto off
-)clear all
---S 1 of 67
-Ran := RECLOS(FRAC INT)
---R 
---R
---R   (1)  RealClosure Fraction Integer
---R                                                                 Type: Domain
---E 1
-
---S 2 of 67
-fourSquares(a:Ran,b:Ran,c:Ran,d:Ran):Ran==sqrt(a)+sqrt(b)-sqrt(c)-sqrt(d)
---R 
---R   Function declaration fourSquares : (RealClosure Fraction Integer,
---R      RealClosure Fraction Integer,RealClosure Fraction Integer,
---R      RealClosure Fraction Integer) -> RealClosure Fraction Integer has
---R      been added to workspace.
---R                                                                   Type: Void
---E 2
-
---S 3 of 67
-squareDiff1 := fourSquares(73,548,60,586)
---R 
---R   Compiling function fourSquares with type (RealClosure Fraction 
---R      Integer,RealClosure Fraction Integer,RealClosure Fraction Integer
---R      ,RealClosure Fraction Integer) -> RealClosure Fraction Integer 
---R
---R           +---+    +--+    +---+    +--+
---R   (3)  - \|586  - \|60  + \|548  + \|73
---R                                           Type: RealClosure Fraction Integer
---E 3
-
---S 4 of 67
-recip(squareDiff1)
---R 
---R
---R   (4)
---R             +---+          +--+  +--+         +--+ +---+            +---+
---R     ((54602\|548  + 149602\|73 )\|60  + 49502\|73 \|548  + 9900895)\|586
---R   + 
---R             +--+ +---+             +--+            +---+            +--+
---R     (154702\|73 \|548  + 30941947)\|60  + 10238421\|548  + 28051871\|73
---R                                Type: Union(RealClosure Fraction Integer,...)
---E 4
-
---S 5 of 67
-sign(squareDiff1)
---R 
---R
---R   (5)  1
---R                                                        Type: PositiveInteger
---E 5
-
---S 6 of 67
-squareDiff2 := fourSquares(165,778,86,990)
---R 
---R
---R           +---+    +--+    +---+    +---+
---R   (6)  - \|990  - \|86  + \|778  + \|165
---R                                           Type: RealClosure Fraction Integer
---E 6
-
---S 7 of 67
-recip(squareDiff2)
---R 
---R
---R   (7)
---R                +---+           +---+  +--+          +---+ +---+
---R       ((556778\|778  + 1209010\|165 )\|86  + 401966\|165 \|778  + 144019431)
---R    *
---R        +---+
---R       \|990
---R   + 
---R              +---+ +---+              +--+             +---+             +---+
---R     (1363822\|165 \|778  + 488640503)\|86  + 162460913\|778  + 352774119\|165
---R                                Type: Union(RealClosure Fraction Integer,...)
---E 7
-
---S 8 of 67
-sign(squareDiff2)
---R 
---R
---R   (8)  1
---R                                                        Type: PositiveInteger
---E 8
-
---S 9 of 67
-squareDiff3 := fourSquares(217,708,226,692)
---R 
---R
---R           +---+    +---+    +---+    +---+
---R   (9)  - \|692  - \|226  + \|708  + \|217
---R                                           Type: RealClosure Fraction Integer
---E 9
-
---S 10 of 67
-recip(squareDiff3)
---R 
---R
---R   (10)
---R               +---+         +---+  +---+         +---+ +---+             +---+
---R     ((- 34102\|708  - 61598\|217 )\|226  - 34802\|217 \|708  - 13641141)\|692
---R   + 
---R              +---+ +---+             +---+            +---+            +---+
---R     (- 60898\|217 \|708  - 23869841)\|226  - 13486123\|708  - 24359809\|217
---R                                Type: Union(RealClosure Fraction Integer,...)
---E 10
-
---S 11 of 67
-sign(squareDiff3)
---R 
---R
---R   (11)  - 1
---R                                                                Type: Integer
---E 11
-
---S 12 of 67
-squareDiff4 := fourSquares(155,836,162,820)
---R 
---R
---R            +---+    +---+    +---+    +---+
---R   (12)  - \|820  - \|162  + \|836  + \|155
---R                                           Type: RealClosure Fraction Integer
---E 12
-
---S 13 of 67
-recip(squareDiff4)
---R 
---R
---R   (13)
---R               +---+         +---+  +---+         +---+ +---+             +---+
---R     ((- 37078\|836  - 86110\|155 )\|162  - 37906\|155 \|836  - 13645107)\|820
---R   + 
---R              +---+ +---+             +---+            +---+            +---+
---R     (- 85282\|155 \|836  - 30699151)\|162  - 13513901\|836  - 31384703\|155
---R                                Type: Union(RealClosure Fraction Integer,...)
---E 13
-
---S 14 of 67
-sign(squareDiff4)
---R 
---R
---R   (14)  - 1
---R                                                                Type: Integer
---E 14
-
---S 15 of 67
-squareDiff5 := fourSquares(591,772,552,818)
---R 
---R
---R            +---+    +---+    +---+    +---+
---R   (15)  - \|818  - \|552  + \|772  + \|591
---R                                           Type: RealClosure Fraction Integer
---E 15
-
---S 16 of 67
-recip(squareDiff5)
---R 
---R
---R   (16)
---R             +---+         +---+  +---+         +---+ +---+             +---+
---R     ((70922\|772  + 81058\|591 )\|552  + 68542\|591 \|772  + 46297673)\|818
---R   + 
---R            +---+ +---+             +---+            +---+            +---+
---R     (83438\|591 \|772  + 56359389)\|552  + 47657051\|772  + 54468081\|591
---R                                Type: Union(RealClosure Fraction Integer,...)
---E 16
-
---S 17 of 67
-sign(squareDiff5)
---R 
---R
---R   (17)  1
---R                                                        Type: PositiveInteger
---E 17
-
---S 18 of 67
-squareDiff6 := fourSquares(434,1053,412,1088)
---R 
---R
---R            +----+    +---+    +----+    +---+
---R   (18)  - \|1088  - \|412  + \|1053  + \|434
---R                                           Type: RealClosure Fraction Integer
---E 18
-
---S 19 of 67
-recip(squareDiff6)
---R 
---R
---R   (19)
---R                +----+          +---+  +---+          +---+ +----+
---R       ((115442\|1053  + 179818\|434 )\|412  + 112478\|434 \|1053  + 76037291)
---R    *
---R        +----+
---R       \|1088
---R   + 
---R           +---+ +----+              +---+            +----+             +---+
---R   (182782\|434 \|1053  + 123564147)\|412  + 77290639\|1053  + 120391609\|434
---R                                Type: Union(RealClosure Fraction Integer,...)
---E 19
-
---S 20 of 67
-sign(squareDiff6)
---R 
---R
---R   (20)  1
---R                                                        Type: PositiveInteger
---E 20
-
---S 21 of 67
-squareDiff7 := fourSquares(514,1049,446,1152)
---R 
---R
---R            +----+    +---+    +----+    +---+
---R   (21)  - \|1152  - \|446  + \|1049  + \|514
---R                                           Type: RealClosure Fraction Integer
---E 21
-
---S 22 of 67
-recip(squareDiff7)
---R 
---R
---R   (22)
---R                +----+          +---+  +---+          +---+ +----+
---R       ((349522\|1049  + 499322\|514 )\|446  + 325582\|514 \|1049  + 239072537)
---R    *
---R        +----+
---R       \|1152
---R   + 
---R           +---+ +----+              +---+             +----+             +---+
---R   (523262\|514 \|1049  + 384227549)\|446  + 250534873\|1049  + 357910443\|514
---R                                Type: Union(RealClosure Fraction Integer,...)
---E 22
-
---S 23 of 67
-sign(squareDiff7)
---R 
---R
---R   (23)  1
---R                                                        Type: PositiveInteger
---E 23
-
---S 24 of 67
-squareDiff8 := fourSquares(190,1751,208,1698)
---R 
---R
---R            +----+    +---+    +----+    +---+
---R   (24)  - \|1698  - \|208  + \|1751  + \|190
---R                                           Type: RealClosure Fraction Integer
---E 24
-
---S 25 of 67
-recip(squareDiff8)
---R 
---R
---R   (25)
---R                     +----+          +---+  +---+          +---+ +----+
---R           (- 214702\|1751  - 651782\|190 )\|208  - 224642\|190 \|1751
---R         + 
---R           - 129571901
---R    *
---R        +----+
---R       \|1698
---R   + 
---R               +---+ +----+              +---+             +----+
---R     (- 641842\|190 \|1751  - 370209881)\|208  - 127595865\|1751
---R   + 
---R                 +---+
---R     - 387349387\|190
---R                                Type: Union(RealClosure Fraction Integer,...)
---E 25
-
---S 26 of 67
-sign(squareDiff8)
---R 
---R
---R   (26)  - 1
---R                                                                Type: Integer
---E 26
-
---S 27 of 67
-relativeApprox(squareDiff8,10**(-3))::Float
---R 
---R
---R   (27)  - 0.2340527771 5937700123 E -10
---R                                                                  Type: Float
---E 27
-
---S 28 of 67
-l := allRootsOf((x**2-2)**2-2)$Ran
---R 
---R
---R   (28)  [%A33,%A34,%A35,%A36]
---R                                      Type: List RealClosure Fraction Integer
---E 28
-
---S 29 of 67
-removeDuplicates map(mainDefiningPolynomial,l)
---R 
---R
---R           4     2
---R   (29)  [?  - 4?  + 2]
---RType: List Union(SparseUnivariatePolynomial RealClosure Fraction Integer,"failed")
---E 29
-
---S 30 of 67
-map(mainCharacterization,l)
---R 
---R
---R   (30)  [[- 2,- 1[,[- 1,0[,[0,1[,[1,2[]
---RType: List Union(RightOpenIntervalRootCharacterization(RealClosure Fraction Integer,SparseUnivariatePolynomial RealClosure Fraction Integer),"failed")
---E 30
-
---S 31 of 67
-[reduce(+,l),reduce(*,l)-2]
---R 
---R
---R   (31)  [0,0]
---R                                      Type: List RealClosure Fraction Integer
---E 31
-
---S 32 of 67
-(s2, s5, s10) := (sqrt(2)$Ran, sqrt(5)$Ran, sqrt(10)$Ran)
---R 
---R
---R          +--+
---R   (32)  \|10
---R                                           Type: RealClosure Fraction Integer
---E 32
-
---S 33 of 67
-eq1:=sqrt(s10+3)*sqrt(s5+2) - sqrt(s10-3)*sqrt(s5-2) = sqrt(10*s2+10)
---R 
---R
---R            +---------+ +--------+    +---------+ +--------+   +-----------+
---R            | +--+      | +-+         | +--+      | +-+        |   +-+
---R   (33)  - \|\|10  - 3 \|\|5  - 2  + \|\|10  + 3 \|\|5  + 2 = \|10\|2  + 10
---R                                  Type: Equation RealClosure Fraction Integer
---E 33
-
---S 34 of 67
-eq1::Boolean
---R 
---R
---R   (34)  true
---R                                                                Type: Boolean
---E 34
-
---S 35 of 67
-eq2:=sqrt(s5+2)*sqrt(s2+1) - sqrt(s5-2)*sqrt(s2-1) = sqrt(2*s10+2)
---R 
---R
---R            +--------+ +--------+    +--------+ +--------+   +----------+
---R            | +-+      | +-+         | +-+      | +-+        |  +--+
---R   (35)  - \|\|5  - 2 \|\|2  - 1  + \|\|5  + 2 \|\|2  + 1 = \|2\|10  + 2
---R                                  Type: Equation RealClosure Fraction Integer
---E 35
-
---S 36 of 67
-eq2::Boolean
---R 
---R
---R   (36)  true
---R                                                                Type: Boolean
---E 36
-
---S 37 of 67
-s3 := sqrt(3)$Ran
---R 
---R
---R          +-+
---R   (37)  \|3
---R                                           Type: RealClosure Fraction Integer
---E 37
-
---S 38 of 67
-s7:= sqrt(7)$Ran
---R 
---R
---R          +-+
---R   (38)  \|7
---R                                           Type: RealClosure Fraction Integer
---E 38
-
---S 39 of 67
-e1 := sqrt(2*s7-3*s3,3)
---R 
---R
---R          +-------------+
---R         3|  +-+     +-+
---R   (39)  \|2\|7  - 3\|3
---R                                           Type: RealClosure Fraction Integer
---E 39
-
---S 40 of 67
-e2 := sqrt(2*s7+3*s3,3)
---R 
---R
---R          +-------------+
---R         3|  +-+     +-+
---R   (40)  \|2\|7  + 3\|3
---R                                           Type: RealClosure Fraction Integer
---E 40
-
---S 41 of 67
-e2-e1-s3
---R 
---R
---R   (41)  0
---R                                           Type: RealClosure Fraction Integer
---E 41
-
---S 42 of 67
-pol : UP(x,Ran) := x**4+(7/3)*x**2+30*x-(100/3)
---R 
---R
---R          4   7  2         100
---R   (42)  x  + - x  + 30x - ---
---R              3             3
---R                   Type: UnivariatePolynomial(x,RealClosure Fraction Integer)
---E 42
-
---S 43 of 67
-r1 := sqrt(7633)$Ran
---R 
---R
---R          +----+
---R   (43)  \|7633
---R                                           Type: RealClosure Fraction Integer
---E 43
-
---S 44 of 67
-alpha := sqrt(5*r1-436,3)/3
---R 
---R
---R            +--------------+
---R         1 3|  +----+
---R   (44)  - \|5\|7633  - 436
---R         3
---R                                           Type: RealClosure Fraction Integer
---E 44
-
---S 45 of 67
-beta := -sqrt(5*r1+436,3)/3 
---R 
---R
---R              +--------------+
---R           1 3|  +----+
---R   (45)  - - \|5\|7633  + 436
---R           3
---R                                           Type: RealClosure Fraction Integer
---E 45
-
---S 46 of 67
-pol.(alpha+beta-1/3)
---R 
---R
---R   (46)  0
---R                                           Type: RealClosure Fraction Integer
---E 46
-
---S 47 of 67
-qol : UP(x,Ran) := x**5+10*x**3+20*x+22
---R 
---R
---R          5      3
---R   (47)  x  + 10x  + 20x + 22
---R                   Type: UnivariatePolynomial(x,RealClosure Fraction Integer)
---E 47
-
---S 48 of 67
-r2 := sqrt(153)$Ran
---R 
---R
---R          +---+
---R   (48)  \|153
---R                                           Type: RealClosure Fraction Integer
---E 48
-
---S 49 of 67
-alpha2 := sqrt(r2-11,5)
---R 
---R
---R          +-----------+
---R         5| +---+
---R   (49)  \|\|153  - 11
---R                                           Type: RealClosure Fraction Integer
---E 49
-
---S 50 of 67
-beta2 := -sqrt(r2+11,5)
---R 
---R
---R            +-----------+
---R           5| +---+
---R   (50)  - \|\|153  + 11
---R                                           Type: RealClosure Fraction Integer
---E 50
-
---S 51 of 67
-qol(alpha2+beta2)
---R 
---R
---R   (51)  0
---R                                           Type: RealClosure Fraction Integer
---E 51
-
---S 52 of 67
-dst1:=sqrt(9+4*s2)=1+2*s2
---R 
---R
---R          +---------+
---R          |  +-+         +-+
---R   (52)  \|4\|2  + 9 = 2\|2  + 1
---R                                  Type: Equation RealClosure Fraction Integer
---E 52
-
---S 53 of 67
-dst1::Boolean
---R 
---R
---R   (53)  true
---R                                                                Type: Boolean
---E 53
-
---S 54 of 67
-s6:Ran:=sqrt 6
---R 
---R
---R          +-+
---R   (54)  \|6
---R                                           Type: RealClosure Fraction Integer
---E 54
-
---S 55 of 67
-dst2:=sqrt(5+2*s6)+sqrt(5-2*s6) = 2*s3
---R 
---R
---R          +-----------+    +---------+
---R          |    +-+         |  +-+         +-+
---R   (55)  \|- 2\|6  + 5  + \|2\|6  + 5 = 2\|3
---R                                  Type: Equation RealClosure Fraction Integer
---E 55
-
---S 56 of 67
-dst2::Boolean
---R 
---R
---R   (56)  true
---R                                                                Type: Boolean
---E 56
-
---S 57 of 67
-s29:Ran:=sqrt 29
---R 
---R
---R          +--+
---R   (57)  \|29
---R                                           Type: RealClosure Fraction Integer
---E 57
-
---S 58 of 67
-dst4:=sqrt(16-2*s29+2*sqrt(55-10*s29)) = sqrt(22+2*s5)-sqrt(11+2*s29)+s5
---R 
---R
---R   (58)
---R    +--------------------------------+
---R    |  +--------------+                    +-----------+    +----------+
---R    |  |     +--+           +--+           |  +--+          |  +-+          +-+
---R   \|2\|- 10\|29  + 55  - 2\|29  + 16 = - \|2\|29  + 11  + \|2\|5  + 22  + \|5
---R                                  Type: Equation RealClosure Fraction Integer
---E 58
-
---S 59 of 67
-dst4::Boolean
---R 
---R
---R   (59)  true
---R                                                                Type: Boolean
---E 59
-
---S 60 of 67
-dst6:=sqrt((112+70*s2)+(46+34*s2)*s5) = (5+4*s2)+(3+s2)*s5 
---R 
---R
---R          +--------------------------------+
---R          |    +-+       +-+      +-+           +-+      +-+     +-+
---R   (60)  \|(34\|2  + 46)\|5  + 70\|2  + 112 = (\|2  + 3)\|5  + 4\|2  + 5
---R                                  Type: Equation RealClosure Fraction Integer
---E 60
-
---S 61 of 67
-dst6::Boolean
---R 
---R
---R   (61)  true
---R                                                                Type: Boolean
---E 61
-
---S 62 of 67
-f3:Ran:=sqrt(3,5)
---R 
---R
---R         5+-+
---R   (62)  \|3
---R                                           Type: RealClosure Fraction Integer
---E 62
-
---S 63 of 67
-f25:Ran:=sqrt(1/25,5)
---R 
---R
---R          +--+
---R          | 1
---R   (63)  5|--
---R         \|25
---R                                           Type: RealClosure Fraction Integer
---E 63
-
---S 64 of 67
-f32:Ran:=sqrt(32/5,5)
---R 
---R
---R          +--+
---R          |32
---R   (64)  5|--
---R         \| 5
---R                                           Type: RealClosure Fraction Integer
---E 64
-
---S 65 of 67
-f27:Ran:=sqrt(27/5,5)
---R 
---R
---R          +--+
---R          |27
---R   (65)  5|--
---R         \| 5
---R                                           Type: RealClosure Fraction Integer
---E 65
-
---S 66 of 67
-dst5:=sqrt((f32-f27,3)) = f25*(1+f3-f3**2)
---R 
---R
---R          +---------------+
---R          |   +--+    +--+                         +--+
---R          |   |27     |32       5+-+2   5+-+       | 1
---R   (66)  3|- 5|--  + 5|--  = (- \|3   + \|3  + 1) 5|--
---R         \|  \| 5    \| 5                         \|25
---R                                  Type: Equation RealClosure Fraction Integer
---E 66
-
---S 67 of 67
-dst5::Boolean
---R 
---R
---R   (67)  true
---R                                                                Type: Boolean
---E 67
-)spool
-)lisp (bye)
-@
-<<RealClosure.help>>=
-====================================================================
-RealClosure examples
-====================================================================
-
-The Real Closure 1.0 package provided by Renaud Rioboo consists of
-different packages, categories and domains :
-
-The package RealPolynomialUtilitiesPackage which needs a Field F and a 
-UnivariatePolynomialCategory domain with coefficients in F. It computes 
-some simple functions such as Sturm and Sylvester sequences sturmSequence,
-sylvesterSequence.
-
-The category RealRootCharacterizationCategory provides abstract
-functions to work with "real roots" of univariate polynomials. These
-resemble variables with some functionality needed to compute important
-operations.
-
-The category RealClosedField provides common operations available over
-real closed fiels. These include finding all the roots of a univariate
-polynomial, taking square (and higher) roots, ...
-
-The domain RightOpenIntervalRootCharacterization is the main code that
-provides the functionality of RealRootCharacterizationCategory for the
-case of archimedean fields. Abstract roots are encoded with a left
-closed right open interval containing the root together with a
-defining polynomial for the root.
-
-The RealClosure domain is the end-user code. It provides usual arithmetic 
-with real algebraic numbers, along with the functionality of a real closed 
-field. It also provides functions to approximate a real algebraic number 
-by an element of the base field. This approximation may either be absolute, 
-approximate or relative (relativeApprox).
-
-====================================================================
-CAVEATS
-====================================================================
-
-Since real algebraic expressions are stored as depending on "real
-roots" which are managed like variables, there is an ordering on
-these. This ordering is dynamical in the sense that any new algebraic
-takes precedence over older ones. In particular every creation
-function raises a new "real root". This has the effect that when you
-type something like sqrt(2) + sqrt(2) you have two new variables
-which happen to be equal. To avoid this name the expression such as in
-s2 := sqrt(2) ; s2 + s2
-
-Also note that computing times depend strongly on the ordering you
-implicitly provide. Please provide algebraics in the order which seems
-most natural to you.
-
-====================================================================
-LIMITATIONS
-====================================================================
-
-This packages uses algorithms which are published in [1] and [2] which
-are based on field arithmetics, in particular for polynomial gcd
-related algorithms. This can be quite slow for high degree polynomials
-and subresultants methods usually work best. Beta versions of the
-package try to use these techniques in a better way and work
-significantly faster. These are mostly based on unpublished algorithms
-and cannot be distributed. Please contact the author if you have a
-particular problem to solve or want to use these versions.
-
-Be aware that approximations behave as post-processing and that all
-computations are done exactly. They can thus be quite time consuming when
-depending on several ``real roots''.
-
-====================================================================
-REFERENCES
-====================================================================
-
-
-[1]  R. Rioboo : Real Algebraic Closure of an ordered Field : Implementation 
-     in Axiom. 
-     In proceedings of the ISSAC'92 Conference, Berkeley 1992 pp. 206-215.
-
-[2]  Z. Ligatsikas, R. Rioboo, M. F. Roy : Generic computation of the real
-     closure of an ordered field.
-     In Mathematics and Computers in Simulation Volume 42, Issue 4-6,
-     November 1996.
-
-====================================================================
-EXAMPLES
-====================================================================
-
-We shall work with the real closure of the ordered field of 
-rational numbers.
-
-  Ran := RECLOS(FRAC INT)
-    RealClosure Fraction Integer
-                              Type: Domain
-
-Some simple signs for square roots, these correspond to an extension
-of degree 16 of the rational numbers. Examples provided by J. Abbot.
-
-  fourSquares(a:Ran,b:Ran,c:Ran,d:Ran):Ran==sqrt(a)+sqrt(b)-sqrt(c)-sqrt(d)
-                              Type: Void
-
-These produce values very close to zero.
-
-  squareDiff1 := fourSquares(73,548,60,586)
-       +---+    +--+    +---+    +--+
-    - \|586  - \|60  + \|548  + \|73
-                              Type: RealClosure Fraction Integer
-
-  recip(squareDiff1)
-             +---+          +--+  +--+         +--+ +---+            +---+
-     ((54602\|548  + 149602\|73 )\|60  + 49502\|73 \|548  + 9900895)\|586
-   + 
-             +--+ +---+             +--+            +---+            +--+
-     (154702\|73 \|548  + 30941947)\|60  + 10238421\|548  + 28051871\|73
-                              Type: Union(RealClosure Fraction Integer,...)
-
-  sign(squareDiff1)
-    1
-                              Type: PositiveInteger
-
-  squareDiff2 := fourSquares(165,778,86,990)
-       +---+    +--+    +---+    +---+
-    - \|990  - \|86  + \|778  + \|165
-                              Type: RealClosure Fraction Integer
-
-  recip(squareDiff2)
-                +---+           +---+  +--+          +---+ +---+
-       ((556778\|778  + 1209010\|165 )\|86  + 401966\|165 \|778  + 144019431)
-    *
-        +---+
-       \|990
-   + 
-              +---+ +---+              +--+             +---+             +---+
-     (1363822\|165 \|778  + 488640503)\|86  + 162460913\|778  + 352774119\|165
-                              Type: Union(RealClosure Fraction Integer,...)
-
-  sign(squareDiff2)
-    1
-                              Type: PositiveInteger
-
-  squareDiff3 := fourSquares(217,708,226,692)
-       +---+    +---+    +---+    +---+
-    - \|692  - \|226  + \|708  + \|217
-                              Type: RealClosure Fraction Integer
-
-  recip(squareDiff3)
-               +---+         +---+  +---+         +---+ +---+             +---+
-     ((- 34102\|708  - 61598\|217 )\|226  - 34802\|217 \|708  - 13641141)\|692
-   + 
-              +---+ +---+             +---+            +---+            +---+
-     (- 60898\|217 \|708  - 23869841)\|226  - 13486123\|708  - 24359809\|217
-                              Type: Union(RealClosure Fraction Integer,...)
-
-  sign(squareDiff3)
-    - 1
-                              Type: Integer
-
-  squareDiff4 := fourSquares(155,836,162,820)
-       +---+    +---+    +---+    +---+
-    - \|820  - \|162  + \|836  + \|155
-                              Type: RealClosure Fraction Integer
-
-  recip(squareDiff4)
-               +---+         +---+  +---+         +---+ +---+             +---+
-     ((- 37078\|836  - 86110\|155 )\|162  - 37906\|155 \|836  - 13645107)\|820
-   + 
-              +---+ +---+             +---+            +---+            +---+
-     (- 85282\|155 \|836  - 30699151)\|162  - 13513901\|836  - 31384703\|155
-                              Type: Union(RealClosure Fraction Integer,...)
-
-  sign(squareDiff4)
-    - 1
-                              Type: Integer
-
-  squareDiff5 := fourSquares(591,772,552,818)
-       +---+    +---+    +---+    +---+
-    - \|818  - \|552  + \|772  + \|591
-                              Type: RealClosure Fraction Integer
-
-  recip(squareDiff5)
-             +---+         +---+  +---+         +---+ +---+             +---+
-     ((70922\|772  + 81058\|591 )\|552  + 68542\|591 \|772  + 46297673)\|818
-   + 
-            +---+ +---+             +---+            +---+            +---+
-     (83438\|591 \|772  + 56359389)\|552  + 47657051\|772  + 54468081\|591
-                              Type: Union(RealClosure Fraction Integer,...)
-
-  sign(squareDiff5)
-    1
-                              Type: PositiveInteger
-
-  squareDiff6 := fourSquares(434,1053,412,1088)
-       +----+    +---+    +----+    +---+
-    - \|1088  - \|412  + \|1053  + \|434
-                              Type: RealClosure Fraction Integer
-
-  recip(squareDiff6)
-                +----+          +---+  +---+          +---+ +----+
-       ((115442\|1053  + 179818\|434 )\|412  + 112478\|434 \|1053  + 76037291)
-    *
-        +----+
-       \|1088
-   + 
-           +---+ +----+              +---+            +----+             +---+
-   (182782\|434 \|1053  + 123564147)\|412  + 77290639\|1053  + 120391609\|434
-                             Type: Union(RealClosure Fraction Integer,...)
-
-  sign(squareDiff6)
-    1
-                             Type: PositiveInteger
-
-  squareDiff7 := fourSquares(514,1049,446,1152)
-       +----+    +---+    +----+    +---+
-    - \|1152  - \|446  + \|1049  + \|514
-                             Type: RealClosure Fraction Integer
-
-  recip(squareDiff7)
-                +----+          +---+  +---+          +---+ +----+
-       ((349522\|1049  + 499322\|514 )\|446  + 325582\|514 \|1049  + 239072537)
-    *
-        +----+
-       \|1152
-   + 
-           +---+ +----+              +---+             +----+             +---+
-   (523262\|514 \|1049  + 384227549)\|446  + 250534873\|1049  + 357910443\|514
-                             Type: Union(RealClosure Fraction Integer,...)
-
-  sign(squareDiff7)
-    1
-                             Type: PositiveInteger
-
-  squareDiff8 := fourSquares(190,1751,208,1698)
-       +----+    +---+    +----+    +---+
-    - \|1698  - \|208  + \|1751  + \|190
-                             Type: RealClosure Fraction Integer
-
-  recip(squareDiff8)
-                     +----+          +---+  +---+          +---+ +----+
-           (- 214702\|1751  - 651782\|190 )\|208  - 224642\|190 \|1751
-         + 
-           - 129571901
-    *
-        +----+
-       \|1698
-   + 
-               +---+ +----+              +---+             +----+
-     (- 641842\|190 \|1751  - 370209881)\|208  - 127595865\|1751
-   + 
-                 +---+
-     - 387349387\|190
-                            Type: Union(RealClosure Fraction Integer,...)
-
-  sign(squareDiff8)
-    - 1
-                            Type: Integer
-
-This should give three digits of precision
-
-  relativeApprox(squareDiff8,10**(-3))::Float
-    - 0.2340527771 5937700123 E -10
-                            Type: Float
-
-The sum of these 4 roots is 0
-
-  l := allRootsOf((x**2-2)**2-2)$Ran
-    [%A33,%A34,%A35,%A36]
-                            Type: List RealClosure Fraction Integer
-
-Check that they are all roots of the same polynomial
-
-  removeDuplicates map(mainDefiningPolynomial,l)
-      4     2
-    [?  - 4?  + 2]
-       Type: List Union(
-                   SparseUnivariatePolynomial RealClosure Fraction Integer,
-                   "failed")
-
-We can see at a glance that they are separate roots
-
-  map(mainCharacterization,l)
-    [[- 2,- 1[,[- 1,0[,[0,1[,[1,2[]
-       Type: List Union(
-              RightOpenIntervalRootCharacterization(
-               RealClosure Fraction Integer,
-               SparseUnivariatePolynomial RealClosure Fraction Integer),
-              "failed")
-
-Check the sum and product
-
-  [reduce(+,l),reduce(*,l)-2]
-    [0,0]
-                    Type: List RealClosure Fraction Integer
-
-A more complicated test that involve an extension of degree 256.
-This is a way of checking nested radical identities.
-
-  (s2, s5, s10) := (sqrt(2)$Ran, sqrt(5)$Ran, sqrt(10)$Ran)
-     +--+
-    \|10
-                    Type: RealClosure Fraction Integer
-
-  eq1:=sqrt(s10+3)*sqrt(s5+2) - sqrt(s10-3)*sqrt(s5-2) = sqrt(10*s2+10)
-       +---------+ +--------+    +---------+ +--------+   +-----------+
-       | +--+      | +-+         | +--+      | +-+        |   +-+
-    - \|\|10  - 3 \|\|5  - 2  + \|\|10  + 3 \|\|5  + 2 = \|10\|2  + 10
-                    Type: Equation RealClosure Fraction Integer
-
-  eq1::Boolean
-    true
-                    Type: Boolean
-
-  eq2:=sqrt(s5+2)*sqrt(s2+1) - sqrt(s5-2)*sqrt(s2-1) = sqrt(2*s10+2)
-       +--------+ +--------+    +--------+ +--------+   +----------+
-       | +-+      | +-+         | +-+      | +-+        |  +--+
-    - \|\|5  - 2 \|\|2  - 1  + \|\|5  + 2 \|\|2  + 1 = \|2\|10  + 2
-                    Type: Equation RealClosure Fraction Integer
-
-  eq2::Boolean
-    true
-                    Type: Boolean
-
-Some more examples from J. M. Arnaudies
-
-  s3 := sqrt(3)$Ran
-     +-+
-    \|3
-                    Type: RealClosure Fraction Integer
-
-  s7:= sqrt(7)$Ran
-     +-+
-    \|7
-                    Type: RealClosure Fraction Integer
-
-  e1 := sqrt(2*s7-3*s3,3)
-     +-------------+
-    3|  +-+     +-+
-    \|2\|7  - 3\|3
-                    Type: RealClosure Fraction Integer
-
-  e2 := sqrt(2*s7+3*s3,3)
-     +-------------+
-    3|  +-+     +-+
-    \|2\|7  + 3\|3
-                    Type: RealClosure Fraction Integer
-
-This should be null
-
-  e2-e1-s3
-    0
-                    Type: RealClosure Fraction Integer
-
-A quartic polynomial
-
-  pol : UP(x,Ran) := x**4+(7/3)*x**2+30*x-(100/3)
-     4   7  2         100
-    x  + - x  + 30x - ---
-         3             3
-                  Type: UnivariatePolynomial(x,RealClosure Fraction Integer)
-
-Add some cubic roots
-
-  r1 := sqrt(7633)$Ran
-     +----+
-    \|7633
-                        Type: RealClosure Fraction Integer
-
-  alpha := sqrt(5*r1-436,3)/3
-       +--------------+
-    1 3|  +----+
-    - \|5\|7633  - 436
-    3
-                        Type: RealClosure Fraction Integer
-
-  beta := -sqrt(5*r1+436,3)/3 
-         +--------------+
-      1 3|  +----+
-    - - \|5\|7633  + 436
-      3
-                        Type: RealClosure Fraction Integer
-
-this should be null
-
-  pol.(alpha+beta-1/3)
-    0
-                        Type: RealClosure Fraction Integer
-
-A quintic polynomial
-
-  qol : UP(x,Ran) := x**5+10*x**3+20*x+22
-     5      3
-    x  + 10x  + 20x + 22
-              Type: UnivariatePolynomial(x,RealClosure Fraction Integer)
-
-Add some cubic roots
-
-  r2 := sqrt(153)$Ran
-     +---+
-    \|153
-                          Type: RealClosure Fraction Integer
-
-  alpha2 := sqrt(r2-11,5)
-     +-----------+
-    5| +---+
-    \|\|153  - 11
-                          Type: RealClosure Fraction Integer
-
-  beta2 := -sqrt(r2+11,5)
-       +-----------+
-      5| +---+
-    - \|\|153  + 11
-                          Type: RealClosure Fraction Integer
-
-this should be null
-
-  qol(alpha2+beta2)
-    0
-                          Type: RealClosure Fraction Integer
-
-Finally, some examples from the book Computer Algebra by Davenport,
-Siret and Tournier (page 77).  The last one is due to Ramanujan.
-
-  dst1:=sqrt(9+4*s2)=1+2*s2
-     +---------+
-     |  +-+         +-+
-    \|4\|2  + 9 = 2\|2  + 1
-                          Type: Equation RealClosure Fraction Integer
-
-  dst1::Boolean
-    true
-                          Type: Boolean
-
-  s6:Ran:=sqrt 6
-     +-+
-    \|6
-                          Type: RealClosure Fraction Integer
-
-  dst2:=sqrt(5+2*s6)+sqrt(5-2*s6) = 2*s3
-     +-----------+    +---------+
-     |    +-+         |  +-+         +-+
-    \|- 2\|6  + 5  + \|2\|6  + 5 = 2\|3
-                          Type: Equation RealClosure Fraction Integer
-
-  dst2::Boolean
-    true
-                          Type: Boolean
-
-  s29:Ran:=sqrt 29
-     +--+
-    \|29
-                          Type: RealClosure Fraction Integer
-
-  dst4:=sqrt(16-2*s29+2*sqrt(55-10*s29)) = sqrt(22+2*s5)-sqrt(11+2*s29)+s5
-    +--------------------------------+
-    |  +--------------+                    +-----------+    +----------+
-    |  |     +--+           +--+           |  +--+          |  +-+          +-+
-   \|2\|- 10\|29  + 55  - 2\|29  + 16 = - \|2\|29  + 11  + \|2\|5  + 22  + \|5
-                          Type: Equation RealClosure Fraction Integer
-
-  dst4::Boolean
-    true
-                          Type: Boolean
-
-  dst6:=sqrt((112+70*s2)+(46+34*s2)*s5) = (5+4*s2)+(3+s2)*s5 
-     +--------------------------------+
-     |    +-+       +-+      +-+           +-+      +-+     +-+
-    \|(34\|2  + 46)\|5  + 70\|2  + 112 = (\|2  + 3)\|5  + 4\|2  + 5
-                          Type: Equation RealClosure Fraction Integer
-
-  dst6::Boolean
-    true
-                          Type: Boolean
-
-  f3:Ran:=sqrt(3,5)
-    5+-+
-    \|3
-                          Type: RealClosure Fraction Integer
-
-  f25:Ran:=sqrt(1/25,5)
-     +--+
-     | 1
-    5|--
-    \|25
-                          Type: RealClosure Fraction Integer
-
-  f32:Ran:=sqrt(32/5,5)
-     +--+
-     |32
-    5|--
-    \| 5
-                          Type: RealClosure Fraction Integer
-
-  f27:Ran:=sqrt(27/5,5)
-     +--+
-     |27
-    5|--
-    \| 5
-                          Type: RealClosure Fraction Integer
-
-  dst5:=sqrt((f32-f27,3)) = f25*(1+f3-f3**2)
-     +---------------+
-     |   +--+    +--+                         +--+
-     |   |27     |32       5+-+2   5+-+       | 1
-    3|- 5|--  + 5|--  = (- \|3   + \|3  + 1) 5|--
-    \|  \| 5    \| 5                         \|25
-                          Type: Equation RealClosure Fraction Integer
-
-  dst5::Boolean
-    true
-                          Type: Boolean
-
-See Also:
-o )help RightOpenIntervalRootCharacterization
-o )help RealClosedField
-o )help RealRootCharacterizationCategory
-o )help UnivariatePolynomialCategory
-o )help Field
-o )help RealPolynomialUtilitiesPackage
-o )show RealClosure
-o $AXIOM/doc/src/algebra/reclos.spad.dvi
-
-@
-<<domain RECLOS RealClosure>>=
-)abbrev domain RECLOS RealClosure
-++ Author: Renaud Rioboo
-++ Date Created: summer 1988
-++ Date Last Updated: January 2004
-++ Basic Functions: provides computations in an ordered real closure
-++ Related Constructors: RightOpenIntervalRootCharacterization
-++ Also See:
-++ AMS Classifications:
-++ Keywords: Real Algebraic Numbers
-++ References: 
-++ Description:
-++ This domain implements the real closure of an ordered field.
-++ Note: 
-++ The code here is generic i.e. it does not depend of the way the operations
-++ are done. The two macros PME and SEG should be passed as functorial
-++ arguments to the domain. It does not help much to write a category
-++ since non trivial methods cannot be placed there either.
-++ 
-RealClosure(TheField): PUB == PRIV where
-
-   TheField   : Join(OrderedRing, Field, RealConstant)
-
---   ThePols    : UnivariatePolynomialCategory($)
---   PME       ==> ThePols
---   TheCharDom : RealRootCharacterizationCategory($, ThePols )
---   SEG       ==> TheCharDom
--- this does not work yet
-
-   E         ==> OutputForm
-   Z         ==> Integer
-   SE        ==> Symbol
-   B         ==> Boolean
-   SUP       ==> SparseUnivariatePolynomial($)
-   N         ==> PositiveInteger
-   RN        ==> Fraction Z
-   LF        ==> ListFunctions2($,N)
-
--- *****************************************************************
--- *****************************************************************
---             PUT YOUR OWN PREFERENCE HERE
--- *****************************************************************
--- *****************************************************************
-   PME       ==> SparseUnivariatePolynomial($)
-   SEG       ==> RightOpenIntervalRootCharacterization($,PME)
--- *****************************************************************
--- *****************************************************************
-
-
-   PUB == Join(RealClosedField,
-               FullyRetractableTo TheField,
-               Algebra TheField) with
-
-       algebraicOf :   (SEG,E) -> $
-             ++ \axiom{algebraicOf(char)} is the external number
-
-       mainCharacterization :   $ -> Union(SEG,"failed")
-             ++ \axiom{mainCharacterization(x)} is the main algebraic 
-             ++ quantity of \axiom{x} (\axiom{SEG})
-
-       relativeApprox :     ($,$) -> RN
-             ++ \axiom{relativeApprox(n,p)} gives a relative 
-             ++ approximation of \axiom{n} 
-             ++ that has precision \axiom{p}
-
-   PRIV == add
-
--- local functions
-
-       lessAlgebraic  : $ -> $
-       newElementIfneeded : (SEG,E) -> $
-
--- Representation
-
-       Rec := Record(seg: SEG, val:PME, outForm:E, order:N)
-       Rep := Union(TheField,Rec)
-
--- global (mutable) variables
-
-       orderOfCreation : N := 1$N
-          -- it is internally used to sort the algebraic levels
-
-       instanceName : Symbol := new()$Symbol
-          -- this used to print the results, thus different instanciations
-          -- use different names
-
--- now the code
-
-       relativeApprox(nbe,prec) ==
-          nbe case TheField => retract(nbe)
-          appr := relativeApprox(nbe.val, nbe.seg, prec)
-          -- now appr has the good exact precision but is $
-          relativeApprox(appr,prec)
-
-
-       approximate(nbe,prec) ==
-          abs(nbe) < prec => 0
-          nbe case TheField => retract(nbe)
-          appr := approximate(nbe.val, nbe.seg, prec)
-          -- now appr has the good exact precision but is $
-          approximate(appr,prec)
-
-       newElementIfneeded(s,o) ==
-         p := definingPolynomial(s)
-         degree(p) = 1 => 
-             - coefficient(p,0) / leadingCoefficient(p)
-         res := [s, monomial(1,1), o, orderOfCreation ]$Rec
-         orderOfCreation := orderOfCreation + 1
-         res :: $
-
-       algebraicOf(s,o) ==
-         pol := definingPolynomial(s)
-         degree(pol) = 1 => 
-           -coefficient(pol,0) / leadingCoefficient(pol) 
-         res := [s, monomial(1,1), o, orderOfCreation ]$Rec
-         orderOfCreation := orderOfCreation + 1
-         res :: $
-         
-       rename!(x,o) ==
-         x.outForm := o
-         x
-
-       rename(x,o) ==
-         [x.seg, x.val, o, x.order]$Rec
-
-       rootOf(pol,n) ==
-        degree(pol) = 0 => "failed"
-        degree(pol) = 1 =>
-          if n=1
-          then
-            -coefficient(pol,0) / leadingCoefficient(pol)
-          else
-            "failed"
-        r := rootOf(pol,n)$SEG
-        r case "failed" => "failed"
-        o := hconcat(instanceName :: E , orderOfCreation :: E)$E
-        algebraicOf(r,o)
-
-       allRootsOf(pol:SUP):List($) == 
-        degree(pol)=0 => []
-        degree(pol)=1 => [-coefficient(pol,0) / leadingCoefficient(pol)]
-        liste := allRootsOf(pol)$SEG
-        res : List $ := []
-        for term in liste repeat
-           o := hconcat(instanceName :: E , orderOfCreation :: E)$E
-           res := cons(algebraicOf(term,o), res)
-        reverse! res
-
-       coerce(x:$):$ ==
-          x case TheField => x
-          [x.seg,x.val rem$PME definingPolynomial(x.seg),x.outForm,x.order]$Rec
-
-       positive?(x) == 
-          x case TheField => positive?(x)$TheField
-          positive?(x.val,x.seg)$SEG
-
-       negative?(x) == 
-          x case TheField => negative?(x)$TheField
-          negative?(x.val,x.seg)$SEG
-
-       abs(x) == sign(x)*x
-
-       sign(x) ==
-          x case TheField => sign(x)$TheField
-          sign(x.val,x.seg)$SEG
-
-       x < y == positive?(y-x)
-
-       x = y == zero?(x-y)
-
-       mainCharacterization(x) ==
-          x case TheField => "failed"
-          x.seg
-
-       mainDefiningPolynomial(x) ==
-          x case TheField => "failed"
-          definingPolynomial x.seg
-
-       mainForm(x) ==
-          x case TheField => "failed"
-          x.outForm
-
-       mainValue(x) ==
-          x case TheField => "failed"
-          x.val
-
-       coerce(x:$):E ==
-          x case TheField => x::TheField :: E
-          xx:$ := coerce(x)
-          outputForm(univariate(xx.val),x.outForm)$SUP
-
-
-       inv(x) ==
-          (res:= recip x) case "failed" => error "Division by 0"
-          res :: $
-
-       recip(x) ==
-         x case TheField =>
-           if ((r := recip(x)$TheField) case TheField)
-           then r::$
-           else "failed"
-         if ((r := recip(x.val,x.seg)$SEG) case "failed")
-         then "failed"
-         else lessAlgebraic([x.seg,r::PME,x.outForm,x.order]$Rec) 
-
-       (n:Z * x:$):$ == 
-          x case TheField => n *$TheField x
-          zero?(n) => 0
-          one?(n) => x
-          [x.seg,map(n * #1, x.val),x.outForm,x.order]$Rec
-
-       (rn:TheField * x:$):$ == 
-          x case TheField => rn *$TheField x
-          zero?(rn) => 0
-          one?(rn) => x
-          [x.seg,map(rn * #1, x.val),x.outForm,x.order]$Rec
-
-       (x:$ * y:$):$ ==
-          (x case TheField) and (y case TheField) => x *$TheField y
-          (x case TheField) => x::TheField * y
-              -- x is no longer TheField
-          (y case TheField) => y::TheField * x
-              -- now both are algebraic
-          y.order > x.order => 
-            [y.seg,map(x * #1 , y.val),y.outForm,y.order]$Rec
-          x.order > y.order => 
-            [x.seg,map( #1 * y , x.val),x.outForm,x.order]$Rec
-              -- now x.exp = y.exp
-              -- we will multiply the polynomials and then reduce
-              -- however wee need to call lessAlgebraic  
-          lessAlgebraic([x.seg,
-                         (x.val * y.val) rem definingPolynomial(x.seg),
-                         x.outForm,
-                         x.order]$Rec)
-
-       nonNull(rep:Rec):$ ==
-         degree(rep.val)=0 => leadingCoefficient(rep.val)
-         numberOfMonomials(rep.val) = 1 => rep
-         zero?(rep.val,rep.seg)$SEG => 0
-         rep
-
---       zero?(x) ==
---          x case TheField => zero?(x)$TheField
---          zero?(x.val,x.seg)$SEG
- 
-       zero?(x) ==
-          x case TheField => zero?(x)$TheField
-          false
- 
-       x + y ==
-          (x case TheField) and (y case TheField) => x +$TheField y
-          (x case TheField) => 
-             if zero?(x)
-             then 
-               y
-             else 
-               nonNull([y.seg,x::PME+(y.val),y.outForm,y.order]$Rec)
-             -- x is no longer TheField
-          (y case TheField) => 
-             if zero?(y)
-             then 
-               x
-             else 
-               nonNull([x.seg,(x.val)+y::PME,x.outForm,x.order]$Rec)
-             -- now both are algebraic
-          y.order > x.order => 
-               nonNull([y.seg,x::PME+y.val,y.outForm,y.order]$Rec)
-          x.order > y.order => 
-               nonNull([x.seg,(x.val)+y::PME,x.outForm,x.order]$Rec)
-              -- now x.exp = y.exp 
-              -- we simply add polynomials (since degree cannot increase)
-              -- however wee need to call lessAlgebraic  
-          nonNull([x.seg,x.val + y.val,x.outForm,x.order])
-
-
-       -x ==
-          x case TheField => -$TheField (x::TheField)
-          [x.seg,-$PME x.val,x.outForm,x.order]$Rec
-
-
-       retractIfCan(x:$):Union(TheField,"failed") ==
-          x case TheField => x
-          o := x.order
-          res := lessAlgebraic x
-          res case TheField => res
-          o = res.order => "failed"
-          retractIfCan res
-
-       retract(x:$):TheField ==
-          x case TheField => x
-          o := x.order
-          res := lessAlgebraic x
-          res case TheField => res
-          o = res.order => error "Can't retract"
-          retract res
-
-
-       lessAlgebraic(x) ==
-          x case TheField => x
-          degree(x.val) = 0 => leadingCoefficient(x.val)
-          def := definingPolynomial(x.seg)
-          degree(def) = 1 => 
-            x.val.(- coefficient(def,0) / leadingCoefficient(def))
-          x
-
-       0 == (0$TheField) :: $
-
-       1 == (1$TheField) :: $
-
-       coerce(rn:TheField):$ == rn :: $
-
-@
 \section{License}
 <<license>>=
 -----------------------------------------------------------------------------
@@ -2164,8 +178,6 @@ RealClosure(TheField): PUB == PRIV where
 <<*>>=
 <<license>>
 <<package POLUTIL RealPolynomialUtilitiesPackage>>
-<<domain ROIRC RightOpenIntervalRootCharacterization>>
-<<domain RECLOS RealClosure>>
 @
 \eject
 \begin{thebibliography}{99}
diff --git a/src/algebra/regset.spad.pamphlet b/src/algebra/regset.spad.pamphlet
index e9a65a0..b7aae8f 100644
--- a/src/algebra/regset.spad.pamphlet
+++ b/src/algebra/regset.spad.pamphlet
@@ -1020,1771 +1020,6 @@ RegularSetDecompositionPackage(R,E,V,P,TS): Exports == Implementation where
        removeSuperfluousCases(branches)$quasicomppack
 
 @
-\section{domain REGSET RegularTriangularSet}
-Several domain constructors implement regular triangular sets (or regular
-chains). Among them {\bf RegularTriangularSet} and 
-{\bf SquareFreeRegularTriangularSet}. They also implement an algorithm
-by Marc Moreno Maza for computing triangular decompositions of polynomial
-systems. This method is refined in the package {\bf LazardSetSolvingPackage}
-in order to produce decompositions by means of Lazard triangular sets.
-<<RegularTriangularSet.input>>=
--- regset.spad.pamphlet RegularTriangularSet.input
-)spool RegularTriangularSet.output
-)set message test on
-)set message auto off
-)clear all
---S 1 of 34
-R := Integer
---R 
---R
---R   (1)  Integer
---R                                                                 Type: Domain
---E 1
-
---S 2 of 34
-ls : List Symbol := [x,y,z,t]
---R 
---R
---R   (2)  [x,y,z,t]
---R                                                            Type: List Symbol
---E 2
-
---S 3 of 34
-V := OVAR(ls)
---R 
---R
---R   (3)  OrderedVariableList [x,y,z,t]
---R                                                                 Type: Domain
---E 3
-
---S 4 of 34
-E := IndexedExponents V
---R 
---R
---R   (4)  IndexedExponents OrderedVariableList [x,y,z,t]
---R                                                                 Type: Domain
---E 4
-
---S 5 of 34
-P := NSMP(R, V)
---R 
---R
---R   (5)  NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
---R                                                                 Type: Domain
---E 5
-
---S 6 of 34
-x: P := 'x
---R 
---R
---R   (6)  x
---R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
---E 6
-
---S 7 of 34
-y: P := 'y
---R 
---R
---R   (7)  y
---R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
---E 7
-
---S 8 of 34
-z: P := 'z
---R 
---R
---R   (8)  z
---R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
---E 8
-
---S 9 of 34
-t: P := 't
---R 
---R
---R   (9)  t
---R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
---E 9
-
---S 10 of 34
-T := REGSET(R,E,V,P)
---R 
---R
---R   (10)
---R  RegularTriangularSet(Integer,IndexedExponents OrderedVariableList [x,y,z,t],O
---R  rderedVariableList [x,y,z,t],NewSparseMultivariatePolynomial(Integer,OrderedV
---R  ariableList [x,y,z,t]))
---R                                                                 Type: Domain
---E 10
-
---S 11 of 34
-p1 := x ** 31 - x ** 6 - x - y 
---R 
---R
---R          31    6
---R   (11)  x   - x  - x - y
---R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
---E 11
-
---S 12 of 34
-p2 := x ** 8  - z 
---R 
---R
---R          8
---R   (12)  x  - z
---R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
---E 12
-
---S 13 of 34
-p3 := x ** 10 - t 
---R 
---R
---R          10
---R   (13)  x   - t
---R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
---E 13
-
---S 14 of 34
-lp := [p1, p2, p3]
---R 
---R
---R           31    6          8      10
---R   (14)  [x   - x  - x - y,x  - z,x   - t]
---RType: List NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
---E 14
-
---S 15 of 34
-zeroSetSplit(lp)$T
---R 
---R
---R            5    4      2     3     8     5    3    2   4                2
---R   (15)  [{z  - t ,t z y  + 2z y - t  + 2t  + t  - t ,(t  - t)x - t y - z }]
---RType: List RegularTriangularSet(Integer,IndexedExponents OrderedVariableList [x,y,z,t],OrderedVariableList [x,y,z,t],NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t]))
---E 15
-
---S 16 of 34
-lts := zeroSetSplit(lp,false)$T
---R 
---R
---R   (16)
---R      5    4      2     3     8     5    3    2   4                2
---R   [{z  - t ,t z y  + 2z y - t  + 2t  + t  - t ,(t  - t)x - t y - z },
---R      3      5          2     3         2
---R    {t  - 1,z  - t,t z y  + 2z y + 1,z x  - t}, {t,z,y,x}]
---RType: List RegularTriangularSet(Integer,IndexedExponents OrderedVariableList [x,y,z,t],OrderedVariableList [x,y,z,t],NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t]))
---E 16
-
---S 17 of 34
-[coHeight(ts) for ts in lts]
---R 
---R
---R   (17)  [1,0,0]
---R                                                Type: List NonNegativeInteger
---E 17
-
---S 18 of 34
-f1 := y**2*z+2*x*y*t-2*x-z
---R 
---R
---R                          2
---R   (18)  (2t y - 2)x + z y  - z
---R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
---E 18
-
---S 19 of 34
-f2:=-x**3*z+ 4*x*y**2*z+4*x**2*y*t+2*y**3*t+4*x**2-10*y**2+4*x*z-10*y*t+2
---R 
---R
---R              3              2        2              3      2
---R   (19)  - z x  + (4t y + 4)x  + (4z y  + 4z)x + 2t y  - 10y  - 10t y + 2
---R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
---E 19
-
---S 20 of 34
-f3 :=  2*y*z*t+x*t**2-x-2*z 
---R 
---R
---R           2
---R   (20)  (t  - 1)x + 2t z y - 2z
---R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
---E 20
-
---S 21 of 34
-f4:=-x*z**3+4*y*z**2*t+4*x*z*t**2+2*y*t**3+4*x*z+4*z**2-10*y*t- 10*t**2+2
---R 
---R
---R             3      2                2     3             2      2
---R   (21)  (- z  + (4t  + 4)z)x + (4t z  + 2t  - 10t)y + 4z  - 10t  + 2
---R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
---E 21
-
---S 22 of 34
-lf := [f1, f2, f3, f4]
---R 
---R
---R   (22)
---R                     2
---R   [(2t y - 2)x + z y  - z,
---R         3              2        2              3      2
---R    - z x  + (4t y + 4)x  + (4z y  + 4z)x + 2t y  - 10y  - 10t y + 2,
---R      2
---R    (t  - 1)x + 2t z y - 2z,
---R        3      2                2     3             2      2
---R    (- z  + (4t  + 4)z)x + (4t z  + 2t  - 10t)y + 4z  - 10t  + 2]
---RType: List NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
---E 22
-
---S 23 of 34
-zeroSetSplit(lf)$T
---R 
---R
---R   (23)
---R      2      8      6       2                 3            2
---R   [{t  - 1,z  - 16z  + 256z  - 256,t y - 1,(z  - 8z)x - 8z  + 16},
---R       2      2     2
---R    {3t  + 1,z  - 7t  - 1,y + t,x + z},
---R      8      6      2         3            2
---R    {t  - 10t  + 10t  - 1,z,(t  - 5t)y - 5t  + 1,x},
---R      2      2
---R    {t  + 3,z  - 4,y + t,x - z}]
---RType: List RegularTriangularSet(Integer,IndexedExponents OrderedVariableList [x,y,z,t],OrderedVariableList [x,y,z,t],NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t]))
---E 23
-
---S 24 of 34
-lts2 := zeroSetSplit(lf,false)$T
---R 
---R
---R   (24)
---R      8      6      2         3            2
---R   [{t  - 10t  + 10t  - 1,z,(t  - 5t)y - 5t  + 1,x},
---R      2      8      6       2                 3            2
---R    {t  - 1,z  - 16z  + 256z  - 256,t y - 1,(z  - 8z)x - 8z  + 16},
---R       2      2     2                     2      2
---R    {3t  + 1,z  - 7t  - 1,y + t,x + z}, {t  + 3,z  - 4,y + t,x - z}]
---RType: List RegularTriangularSet(Integer,IndexedExponents OrderedVariableList [x,y,z,t],OrderedVariableList [x,y,z,t],NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t]))
---E 24
-
---S 25 of 34
-[coHeight(ts) for ts in lts2]
---R 
---R
---R   (25)  [0,0,0,0]
---R                                                Type: List NonNegativeInteger
---E 25
-
---S 26 of 34
-degrees := [degree(ts) for ts in lts2]
---R 
---R
---R   (26)  [8,16,4,4]
---R                                                Type: List NonNegativeInteger
---E 26
-
---S 27 of 34
-reduce(+,degrees)
---R 
---R
---R   (27)  32
---R                                                        Type: PositiveInteger
---E 27
-
---S 28 of 34
-u : R := 2 
---R 
---R
---R   (28)  2
---R                                                                Type: Integer
---E 28
-
---S 29 of 34
-q1 := 2*(u-1)**2+ 2*(x-z*x+z**2)+ y**2*(x-1)**2- 2*u*x+ 2*y*t*(1-x)*(x-z)+_
-      2*u*z*t*(t-y)+ u**2*t**2*(1-2*z)+ 2*u*t**2*(z-x)+ 2*u*t*y*(z-1)+_
-      2*u*z*x*(y+1)+ (u**2-2*u)*z**2*t**2+ 2*u**2*z**2+ 4*u*(1-u)*z+_
-      t**2*(z-x)**2
---R 
---R
---R   (29)
---R       2           2  2        2                            2           2
---R     (y  - 2t y + t )x  + (- 2y  + ((2t + 4)z + 2t)y + (- 2t  + 2)z - 4t  - 2)x
---R   + 
---R      2                      2       2          2
---R     y  + (- 2t z - 4t)y + (t  + 10)z  - 8z + 4t  + 2
---R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
---E 29
-
---S 30 of 34
-q2 := t*(2*z+1)*(x-z)+ y*(z+2)*(1-x)+ u*(u-2)*t+ u*(1-2*u)*z*t+_
-      u*y*(x+u-z*x-1)+ u*(u+1)*z**2*t
---R 
---R
---R                                               2
---R   (30)  (- 3z y + 2t z + t)x + (z + 4)y + 4t z  - 7t z
---R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
---E 30
-
---S 31 of 34
-q3 := -u**2*(z-1)**2+ 2*z*(z-x)-2*(x-1)
---R 
---R
---R                         2
---R   (31)  (- 2z - 2)x - 2z  + 8z - 2
---R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
---E 31
-
---S 32 of 34
-q4 := u**2+4*(z-x**2)+3*y**2*(x-1)**2- 3*t**2*(z-x)**2+_
-      3*u**2*t**2*(z-1)**2+u**2*z*(z-2)+6*u*t*y*(z+x+z*x-1)
---R 
---R
---R   (32)
---R        2     2      2        2                      2        2
---R     (3y  - 3t  - 4)x  + (- 6y  + (12t z + 12t)y + 6t z)x + 3y  + (12t z - 12t)y
---R   + 
---R        2      2         2            2
---R     (9t  + 4)z  + (- 24t  - 4)z + 12t  + 4
---R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
---E 32
-
---S 33 of 34
-lq := [q1, q2, q3, q4]
---R 
---R
---R   (33)
---R   [
---R         2           2  2
---R       (y  - 2t y + t )x
---R     + 
---R            2                            2           2          2
---R       (- 2y  + ((2t + 4)z + 2t)y + (- 2t  + 2)z - 4t  - 2)x + y
---R     + 
---R                          2       2          2
---R       (- 2t z - 4t)y + (t  + 10)z  - 8z + 4t  + 2
---R     ,
---R                                          2                         2
---R    (- 3z y + 2t z + t)x + (z + 4)y + 4t z  - 7t z, (- 2z - 2)x - 2z  + 8z - 2,
---R
---R          2     2      2        2                      2        2
---R       (3y  - 3t  - 4)x  + (- 6y  + (12t z + 12t)y + 6t z)x + 3y
---R     + 
---R                           2      2         2            2
---R       (12t z - 12t)y + (9t  + 4)z  + (- 24t  - 4)z + 12t  + 4
---R     ]
---RType: List NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
---E 33
-
---S 34 of 34
-zeroSetSplit(lq,true,true)$T
---R 
---R[1 <4,0> -> |4|; {0}]W[2 <5,0>,<3,1> -> |8|; {0}][2 <4,1>,<3,1> -> |7|; {0}][1 <3,1> -> |3|; {0}]G[2 <4,1>,<4,1> -> |8|; {0}]W[3 <5,1>,<4,1>,<3,2> -> |12|; {0}]GI[3 <4,2>,<4,1>,<3,2> -> |11|; {0}]GWw[3 <4,1>,<3,2>,<5,2> -> |12|; {0}][3 <3,2>,<3,2>,<5,2> -> |11|; {0}]GIwWWWw[4 <3,2>,<4,2>,<5,2>,<2,3> -> |14|; {0}][4 <2,2>,<4,2>,<5,2>,<2,3> -> |13|; {0}]Gwww[5 <3,2>,<3,2>,<4,2>,<5,2>,<2,3> -> |17|; {0}]Gwwwwww[8 <3,2>,<4,2>,<4,2>,<4,2>,<4,2>,<4,2>,<5,2>,<2,3> -> |30|; {0}]Gwwwwww[8 <4,2>,<4,2>,<4,2>,<4,2>,<4,2>,<4,2>,<5,2>,<2,3> -> |31|; {0}][8 <3,3>,<4,2>,<4,2>,<4,2>,<4,2>,<4,2>,<5,2>,<2,3> -> |30|; {0}][8 <2,3>,<4,2>,<4,2>,<4,2>,<4,2>,<4,2>,<5,2>,<2,3> -> |29|; {0}][8 <1,3>,<4,2>,<4,2>,<4,2>,<4,2>,<4,2>,<5,2>,<2,3> -> |28|; {0}][7 <4,2>,<4,2>,<4,2>,<4,2>,<4,2>,<5,2>,<2,3> -> |27|; {0}][6 <4,2>,<4,2>,<4,2>,<4,2>,<5,2>,<2,3> -> |23|; {0}][5 <4,2>,<4,2>,<4,2>,<5,2>,<2,3> -> |19|; {0}]GIGIWwww[6 <5,2>,<4,2>,<4,2>,<5,2>,<3,3>,<2,3> -> |23|; {0}][6 <4,3>,<4,2>,<4,2>,<5,2>,<3,3>,<2,3> -> |22|; {0}]GIGI[6 <3,4>,<4,2>,<4,2>,<5,2>,<3,3>,<2,3> -> |21|; {0}][6 <2,4>,<4,2>,<4,2>,<5,2>,<3,3>,<2,3> -> |20|; {0}]GGG[5 <4,2>,<4,2>,<5,2>,<3,3>,<2,3> -> |18|; {0}]GIGIWwwwW[6 <5,2>,<4,2>,<5,2>,<3,3>,<3,3>,<2,3> -> |22|; {0}][6 <4,3>,<4,2>,<5,2>,<3,3>,<3,3>,<2,3> -> |21|; {0}]GIwwWwWWWWWWWwWWWWwwwww[8 <4,2>,<5,2>,<3,3>,<3,3>,<4,3>,<2,3>,<3,4>,<3,4> -> |27|; {0}][8 <3,3>,<5,2>,<3,3>,<3,3>,<4,3>,<2,3>,<3,4>,<3,4> -> |26|; {0}][8 <2,3>,<5,2>,<3,3>,<3,3>,<4,3>,<2,3>,<3,4>,<3,4> -> |25|; {0}]Gwwwwwwwwwwwwwwwwwwww[9 <5,2>,<3,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,4>,<3,4> -> |29|; {0}]GI[9 <4,3>,<3,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,4>,<3,4> -> |28|; {0}][9 <3,3>,<3,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,4>,<3,4> -> |27|; {0}][9 <2,3>,<3,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,4>,<3,4> -> |26|; {0}]GGwwwwwwwwwwwwWWwwwwwwww[11 <3,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |33|; {0}][11 <2,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |32|; {0}][11 <1,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |31|; {0}]GGGwwwwwwwwwwwww[12 <2,3>,<2,3>,<3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |34|; {0}]GGwwwwwwwwwwwww[13 <3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |38|; {0}]Gwwwwwwwwwwwww[13 <2,3>,<3,3>,<4,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |39|; {0}]GGGwwwwwwwwwwwww[15 <3,3>,<4,3>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |46|; {0}][14 <4,3>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |43|; {0}]GIGGGGIGGI[14 <3,4>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |42|; {0}]GGG[14 <2,4>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |41|; {0}][14 <1,4>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |40|; {0}]GGG[13 <3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |39|; {0}]Gwwwwwwwwwwwww[15 <3,3>,<3,3>,<4,3>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |48|; {0}]Gwwwwwwwwwwwww[15 <4,3>,<4,3>,<3,3>,<4,3>,<4,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |49|; {0}]GIGI[15 <3,4>,<4,3>,<3,3>,<4,3>,<4,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |48|; {0}]G[14 <4,3>,<3,3>,<4,3>,<4,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |45|; {0}][13 <3,3>,<4,3>,<4,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |41|; {0}]Gwwwwwwwwwwwww[13 <4,3>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |42|; {0}]GIGGGGIGGI[13 <3,4>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |41|; {0}]GGGGGGGG[13 <2,4>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |40|; {0}][13 <1,4>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |39|; {0}][13 <0,4>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |38|; {0}][12 <4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |38|; {1}][11 <4,3>,<3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |34|; {1}][10 <3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |30|; {1}][10 <2,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |29|; {1}]GGGwwwwwwwwwwwww[11 <3,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |33|; {1}]GGGwwwwwwwwwwwww[12 <4,3>,<3,3>,<4,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |38|; {1}]Gwwwwwwwwwwwww[12 <3,3>,<4,3>,<5,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |39|; {1}]GGwwwwwwwwwwwww[13 <5,3>,<4,3>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |44|; {1}]GIGGGGIGGIW[13 <4,4>,<4,3>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |43|; {1}]GGW[13 <3,4>,<4,3>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |42|; {1}]GGG[12 <4,3>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |39|; {1}]Gwwwwwwwwwwwww[12 <4,3>,<4,3>,<5,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |40|; {1}]Gwwwwwwwwwwwww[13 <5,3>,<5,3>,<4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |46|; {1}]GIGIW[13 <4,4>,<5,3>,<4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |45|; {1}][13 <3,4>,<5,3>,<4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |44|; {1}][13 <2,4>,<5,3>,<4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |43|; {1}]GG[12 <5,3>,<4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |41|; {1}]GIGGGGIGGIW[12 <4,4>,<4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |40|; {1}]GGGGGGW[12 <3,4>,<4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |39|; {1}][12 <2,4>,<4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |38|; {1}][12 <1,4>,<4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |37|; {1}]GGG[11 <4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |36|; {1}][10 <5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |32|; {1}][9 <3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |27|; {1}]W[9 <2,4>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |26|; {1}][9 <1,4>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |25|; {1}][8 <3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |24|; {1}]W[8 <2,4>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |23|; {1}][8 <1,4>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |22|; {1}][7 <4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |21|; {1}]w[7 <3,4>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |20|; {1}][7 <2,4>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |19|; {1}][7 <1,4>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |18|; {1}][6 <2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |17|; {1}]GGwwwwww[7 <3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |21|; {1}]GIW[7 <2,4>,<3,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |20|; {1}]GG[6 <3,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |18|; {1}]Gwwwwww[7 <4,3>,<4,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |23|; {1}]GIW[7 <3,4>,<4,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |22|; {1}][6 <4,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |19|; {1}]GIW[6 <3,4>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |18|; {1}]GGW[6 <2,4>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |17|; {1}][6 <1,4>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |16|; {1}]GGG[5 <3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |15|; {1}]GIW[5 <2,4>,<3,3>,<3,3>,<3,4>,<3,4> -> |14|; {1}]GG[4 <3,3>,<3,3>,<3,4>,<3,4> -> |12|; {1}][3 <3,3>,<3,4>,<3,4> -> |9|; {1}]W[3 <2,4>,<3,4>,<3,4> -> |8|; {1}][3 <1,4>,<3,4>,<3,4> -> |7|; {1}]G[2 <3,4>,<3,4> -> |6|; {1}]G[1 <3,4> -> |3|; {1}][1 <2,4> -> |2|; {1}][1 <1,4> -> |1|; {1}]
---R   *** QCMPACK Statistics ***
---R      Table     size:  36
---R      Entries reused:  255
---R
---R   *** REGSETGCD: Gcd Statistics ***
---R      Table     size:  125
---R      Entries reused:  0
---R
---R   *** REGSETGCD: Inv Set Statistics ***
---R      Table     size:  30
---R      Entries reused:  0
---R
---R   (34)
---R   [
---R     {
---R                         24                   23                    22
---R         960725655771966t   + 386820897948702t   + 8906817198608181t
---R       + 
---R                          21                     20                    19
---R         2704966893949428t   + 37304033340228264t   + 7924782817170207t
---R       + 
---R                           18                     17                      16
---R         93126799040354990t   + 13101273653130910t   + 156146250424711858t
---R       + 
---R                           15                      14                     13
---R         16626490957259119t   + 190699288479805763t   + 24339173367625275t
---R       + 
---R                            12                     11                      10
---R         180532313014960135t   + 35288089030975378t   + 135054975747656285t
---R       + 
---R                           9                     8                     7
---R         34733736952488540t  + 75947600354493972t  + 19772555692457088t
---R       + 
---R                           6                    5                    4
---R         28871558573755428t  + 5576152439081664t  + 6321711820352976t
---R       + 
---R                       3                   2
---R       438314209312320t  + 581105748367008t  - 60254467992576t + 1449115951104
---R       ,
---R
---R                                                                         23
---R             26604210869491302385515265737052082361668474181372891857784t
---R           + 
---R                                                                          22
---R             443104378424686086067294899528296664238693556855017735265295t
---R           + 
---R                                                                          21
---R             279078393286701234679141342358988327155321305829547090310242t
---R           + 
---R                                                                           20
---R             3390276361413232465107617176615543054620626391823613392185226t
---R           + 
---R                                                                          19
---R             941478179503540575554198645220352803719793196473813837434129t
---R           + 
---R                                                                            18
---R             11547855194679475242211696749673949352585747674184320988144390t
---R           + 
---R                                                                           17
---R             1343609566765597789881701656699413216467215660333356417241432t
---R           + 
---R                                                                            16
---R             23233813868147873503933551617175640859899102987800663566699334t
---R           + 
---R                                                                          15
---R             869574020537672336950845440508790740850931336484983573386433t
---R           + 
---R                                                                            14
---R             31561554305876934875419461486969926554241750065103460820476969t
---R           + 
---R                                                                           13
---R             1271400990287717487442065952547731879554823889855386072264931t
---R           + 
---R                                                                            12
---R             31945089913863736044802526964079540198337049550503295825160523t
---R           + 
---R                                                                           11
---R             3738735704288144509871371560232845884439102270778010470931960t
---R           + 
---R                                                                            10
---R             25293997512391412026144601435771131587561905532992045692885927t
---R           + 
---R                                                                           9
---R             5210239009846067123469262799870052773410471135950175008046524t
---R           + 
---R                                                                            8
---R             15083887986930297166259870568608270427403187606238713491129188t
---R           + 
---R                                                                           7
---R             3522087234692930126383686270775779553481769125670839075109000t
---R           + 
---R                                                                           6
---R             6079945200395681013086533792568886491101244247440034969288588t
---R           + 
---R                                                                           5
---R             1090634852433900888199913756247986023196987723469934933603680t
---R           + 
---R                                                                           4
---R             1405819430871907102294432537538335402102838994019667487458352t
---R           + 
---R                                                                         3
---R             88071527950320450072536671265507748878347828884933605202432t
---R           + 
---R                                                                          2
---R             135882489433640933229781177155977768016065765482378657129440t
---R           + 
---R             - 13957283442882262230559894607400314082516690749975646520320t
---R           + 
---R             334637692973189299277258325709308472592117112855749713920
---R        *
---R           z
---R       + 
---R                                                                    23
---R         8567175484043952879756725964506833932149637101090521164936t
---R       + 
---R                                                                      22
---R         149792392864201791845708374032728942498797519251667250945721t
---R       + 
---R                                                                     21
---R         77258371783645822157410861582159764138123003074190374021550t
---R       + 
---R                                                                       20
---R         1108862254126854214498918940708612211184560556764334742191654t
---R       + 
---R                                                                      19
---R         213250494460678865219774480106826053783815789621501732672327t
---R       + 
---R                                                                       18
---R         3668929075160666195729177894178343514501987898410131431699882t
---R       + 
---R                                                                      17
---R         171388906471001872879490124368748236314765459039567820048872t
---R       + 
---R                                                                       16
---R         7192430746914602166660233477331022483144921771645523139658986t
---R       + 
---R                                                                        15
---R         - 128798674689690072812879965633090291959663143108437362453385t
---R       + 
---R                                                                       14
---R         9553010858341425909306423132921134040856028790803526430270671t
---R       + 
---R                                                                       13
---R         - 13296096245675492874538687646300437824658458709144441096603t
---R       + 
---R                                                                       12
---R         9475806805814145326383085518325333106881690568644274964864413t
---R       + 
---R                                                                      11
---R         803234687925133458861659855664084927606298794799856265539336t
---R       + 
---R                                                                       10
---R         7338202759292865165994622349207516400662174302614595173333825t
---R       + 
---R                                                                       9
---R         1308004628480367351164369613111971668880538855640917200187108t
---R       + 
---R                                                                       8
---R         4268059455741255498880229598973705747098216067697754352634748t
---R       + 
---R                                                                      7
---R         892893526858514095791318775904093300103045601514470613580600t
---R       + 
---R                                                                       6
---R         1679152575460683956631925852181341501981598137465328797013652t
---R       + 
---R                                                                      5
---R         269757415767922980378967154143357835544113158280591408043936t
---R       + 
---R                                                                      4
---R         380951527864657529033580829801282724081345372680202920198224t
---R       + 
---R                                                                     3
---R         19785545294228495032998826937601341132725035339452913286656t
---R       + 
---R                                                                     2
---R         36477412057384782942366635303396637763303928174935079178528t
---R       + 
---R         - 3722212879279038648713080422224976273210890229485838670848t
---R       + 
---R         89079724853114348361230634484013862024728599906874105856
---R       ,
---R         3      2                  3       2
---R      (3z  - 11z  + 8z + 4)y + 2t z  + 4t z  - 5t z - t,
---R                  2
---R      (z + 1)x + z  - 4z + 1}
---R     ]
---RType: List RegularTriangularSet(Integer,IndexedExponents OrderedVariableList [x,y,z,t],OrderedVariableList [x,y,z,t],NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t]))
---E 34
-)spool
-)lisp (bye)
-@
-<<RegularTriangularSet.help>>=
-====================================================================
-RegularTriangularSet examples
-====================================================================
-
-The RegularTriangularSet domain constructor implements regular
-triangular sets.  These particular triangular sets were introduced by
-M. Kalkbrener (1991) in his PhD Thesis under the name regular chains.
-Regular chains and their related concepts are presented in the paper
-"On the Theories of Triangular sets" By P. Aubry, D. Lazard and
-M. Moreno Maza (to appear in the Journal of Symbolic Computation).
-The RegularTriangularSet constructor also provides a new method
-(by the third author) for solving polynomial system by means of
-regular chains.  This method has two ways of solving.  One has the
-same specifications as Kalkbrener's algorithm (1991) and the other is
-closer to Lazard's method (Discr. App. Math, 1991).  Moreover, this
-new method removes redundant component from the decompositions when
-this is not too expensive.  This is always the case with
-square-free regular chains.  So if you want to obtain decompositions
-without redundant components just use the SquareFreeRegularTriangularSet 
-domain constructor or the LazardSetSolvingPackage package constructor.  
-See also the LexTriangularPackage and ZeroDimensionalSolvePackage for the
-case of algebraic systems with a finite number of (complex) solutions.
-
-One of the main features of regular triangular sets is that they
-naturally define towers of simple extensions of a field.  This allows
-to perform with multivariate polynomials the same kind of operations
-as one can do in an EuclideanDomain.
-
-The RegularTriangularSet constructor takes four arguments.  The first
-one, R, is the coefficient ring of the polynomials; it must belong to
-the category GcdDomain.  The second one, E, is the exponent monoid of
-the polynomials; it must belong to the category OrderedAbelianMonoidSup.  
-The third one, V, is the ordered set of variables; it must belong to the 
-category OrderedSet.  The last one is the polynomial ring; it must belong 
-to the category RecursivePolynomialCategory(R,E,V).  The abbreviation for
-RegularTriangularSet is REGSET.  See also the constructor RegularChain
-which only takes two arguments, the coefficient ring and the ordered
-set of variables; in that case, polynomials are necessarily built with
-the NewSparseMultivariatePolynomial domain constructor.
-
-We shall explain now how to use the constructor REGSET and how to read
-the decomposition of a polynomial system by means of regular sets.
-
-Let us give some examples.  We start with an easy one
-(Donati-Traverso) in order to understand the two ways of solving
-polynomial systems provided by the REGSET constructor.
-
-Define the coefficient ring.
-
-  R := Integer
-    Integer
-                               Type: Domain
-
-Define the list of variables,
-
-  ls : List Symbol := [x,y,z,t]
-    [x,y,z,t]
-                               Type: List Symbol
-
-and make it an ordered set;
-
-  V := OVAR(ls)
-    OrderedVariableList [x,y,z,t]
-                               Type: Domain
-
-then define the exponent monoid.
-
-  E := IndexedExponents V
-    IndexedExponents OrderedVariableList [x,y,z,t]
-                               Type: Domain
-
-Define the polynomial ring.
-
-  P := NSMP(R, V)
-    NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
-                               Type: Domain
-
-Let the variables be polynomial.
-
-  x: P := 'x
-    x
-             Type: NewSparseMultivariatePolynomial(Integer,
-                                   OrderedVariableList [x,y,z,t])
-  y: P := 'y
-    y
-             Type: NewSparseMultivariatePolynomial(Integer,
-                                   OrderedVariableList [x,y,z,t])
-
-  z: P := 'z
-    z
-             Type: NewSparseMultivariatePolynomial(Integer,
-                                   OrderedVariableList [x,y,z,t])
-
-  t: P := 't
-   t
-             Type: NewSparseMultivariatePolynomial(Integer,
-                                   OrderedVariableList [x,y,z,t])
-
-Now call the RegularTriangularSet domain constructor.
-
-  T := REGSET(R,E,V,P)
-  RegularTriangularSet(Integer,IndexedExponents OrderedVariableList [x,y,z,t],O
-  rderedVariableList [x,y,z,t],NewSparseMultivariatePolynomial(Integer,OrderedV
-  ariableList [x,y,z,t]))
-                               Type: Domain
-
-Define a polynomial system.
-
-  p1 := x ** 31 - x ** 6 - x - y 
-      31    6
-     x   - x  - x - y
-             Type: NewSparseMultivariatePolynomial(Integer,
-                                   OrderedVariableList [x,y,z,t])
-
-  p2 := x ** 8  - z 
-     8
-    x  - z
-             Type: NewSparseMultivariatePolynomial(Integer,
-                                   OrderedVariableList [x,y,z,t])
-
-  p3 := x ** 10 - t 
-     10
-    x   - t
-             Type: NewSparseMultivariatePolynomial(Integer,
-                                   OrderedVariableList [x,y,z,t])
-
-  lp := [p1, p2, p3]
-      31    6          8      10
-    [x   - x  - x - y,x  - z,x   - t]
-             Type: List NewSparseMultivariatePolynomial(Integer,
-                                       OrderedVariableList [x,y,z,t])
-
-First of all, let us solve this system in the sense of Kalkbrener.
-
-  zeroSetSplit(lp)$T
-       5    4      2     3     8     5    3    2   4                2
-    [{z  - t ,t z y  + 2z y - t  + 2t  + t  - t ,(t  - t)x - t y - z }]
-        Type: List RegularTriangularSet(Integer,
-                    IndexedExponents OrderedVariableList [x,y,z,t],
-                    OrderedVariableList [x,y,z,t],
-                    NewSparseMultivariatePolynomial(Integer,
-                        OrderedVariableList [x,y,z,t]))
-
-And now in the sense of Lazard (or Wu and other authors).
-
-  lts := zeroSetSplit(lp,false)$T
-      5    4      2     3     8     5    3    2   4                2
-   [{z  - t ,t z y  + 2z y - t  + 2t  + t  - t ,(t  - t)x - t y - z },
-      3      5          2     3         2
-    {t  - 1,z  - t,t z y  + 2z y + 1,z x  - t}, {t,z,y,x}]
-        Type: List RegularTriangularSet(Integer,
-                    IndexedExponents OrderedVariableList [x,y,z,t],
-                    OrderedVariableList [x,y,z,t],
-                    NewSparseMultivariatePolynomial(Integer,
-                        OrderedVariableList [x,y,z,t]))
-
-We can see that the first decomposition is a subset of the second.
-So how can both be correct ?
-
-Recall first that polynomials from a domain of the category 
-RecursivePolynomialCategory are regarded as univariate polynomials in
-their main variable.  For instance the second polynomial in the first
-set of each decomposition has main variable y and its initial
-(i.e. its leading coefficient w.r.t. its main variable) is t z.
-
-Now let us explain how to read the second decomposition.  Note that
-the non-constant initials of the first set are t^4-t and t z. Then 
-the solutions described by this first set are the common zeros of
-its polynomials that do not cancel the polynomials t^4-t and ty z.
-Now the solutions of the input system lp satisfying these equations 
-are described by the second and the third sets of the decomposition.  
-Thus, in some sense, they can be considered as degenerated solutions.  
-The solutions given by the first set are called the generic points of 
-the system; they give the general form of the solutions.  The first 
-decomposition only provides these generic points.  This latter 
-decomposition is useful when they are many degenerated solutions 
-(which is sometimes hard to compute) and when one is only interested 
-in general informations, like the dimension of the input system.
-
-We can get the dimensions of each component of a decomposition as follows.
-
-  [coHeight(ts) for ts in lts]
-    [1,0,0]
-                             Type: List NonNegativeInteger
-
-Thus the first set has dimension one.  Indeed t can take any value,
-except 0 or any third root of 1, whereas z is completely determined
-from t, y is given by z and t, and finally x is given by the other
-three variables.  In the second and the third sets of the second
-decomposition the four variables are completely determined and thus
-these sets have dimension zero.
-
-We give now the precise specifications of each decomposition.  This
-assume some mathematical knowledge.  However, for the non-expert user,
-the above explanations will be sufficient to understand the other
-features of the RSEGSET constructor.
-
-The input system lp is decomposed in the sense of Kalkbrener as
-finitely many regular sets T1,...,Ts such that the radical ideal
-generated by lp is the intersection of the radicals of the saturated
-ideals of T1,...,Ts.  In other words, the affine variety associated
-with lp is the union of the closures (w.r.t. Zarisky topology) of the
-regular-zeros sets of T1,...,Ts.
-
-N. B. The prime ideals associated with the radical of the saturated
-ideal of a regular triangular set have all the same dimension;
-moreover these prime ideals can be given by characteristic sets with
-the same main variables.  Thus a decomposition in the sense of
-Kalkbrener is unmixed dimensional.  Then it can be viewed as a lazy
-decomposition into prime ideals (some of these prime ideals being
-merged into unmixed dimensional ideals).
-
-Now we explain the other way of solving by means of regular triangular
-sets.  The input system lp is decomposed in the sense of Lazard as
-finitely many regular triangular sets T1,...,Ts such that the affine
-variety associated with lp is the union of the regular-zeros sets of
-T1,...,Ts.  Thus a decomposition in the sense of Lazard is also a
-decomposition in the sense of Kalkbrener; the converse is false as we
-have seen before.
-
-When the input system has a finite number of solutions, both ways of
-solving provide similar decompositions as we shall see with this
-second example (Caprasse).
-
-Define a polynomial system.
-
-  f1 := y**2*z+2*x*y*t-2*x-z
-                     2
-    (2t y - 2)x + z y  - z
-           Type: NewSparseMultivariatePolynomial(Integer,
-                    OrderedVariableList [x,y,z,t])
-
-  f2:=-x**3*z+ 4*x*y**2*z+4*x**2*y*t+2*y**3*t+4*x**2-10*y**2+4*x*z-10*y*t+2
-         3              2        2              3      2
-    - z x  + (4t y + 4)x  + (4z y  + 4z)x + 2t y  - 10y  - 10t y + 2
-           Type: NewSparseMultivariatePolynomial(Integer,
-                    OrderedVariableList [x,y,z,t])
-
-  f3 :=  2*y*z*t+x*t**2-x-2*z 
-      2
-    (t  - 1)x + 2t z y - 2z
-           Type: NewSparseMultivariatePolynomial(Integer,
-                    OrderedVariableList [x,y,z,t])
-
-  f4:=-x*z**3+4*y*z**2*t+4*x*z*t**2+2*y*t**3+4*x*z+4*z**2-10*y*t- 10*t**2+2
-        3      2                2     3             2      2
-    (- z  + (4t  + 4)z)x + (4t z  + 2t  - 10t)y + 4z  - 10t  + 2
-           Type: NewSparseMultivariatePolynomial(Integer,
-                    OrderedVariableList [x,y,z,t])
-
-  lf := [f1, f2, f3, f4]
-                     2
-   [(2t y - 2)x + z y  - z,
-         3              2        2              3      2
-    - z x  + (4t y + 4)x  + (4z y  + 4z)x + 2t y  - 10y  - 10t y + 2,
-      2
-    (t  - 1)x + 2t z y - 2z,
-        3      2                2     3             2      2
-    (- z  + (4t  + 4)z)x + (4t z  + 2t  - 10t)y + 4z  - 10t  + 2]
-           Type: List NewSparseMultivariatePolynomial(Integer,
-                            OrderedVariableList [x,y,z,t])
-
-First of all, let us solve this system in the sense of Kalkbrener.
-
-  zeroSetSplit(lf)$T
-      2      8      6       2                 3            2
-   [{t  - 1,z  - 16z  + 256z  - 256,t y - 1,(z  - 8z)x - 8z  + 16},
-       2      2     2
-    {3t  + 1,z  - 7t  - 1,y + t,x + z},
-      8      6      2         3            2
-    {t  - 10t  + 10t  - 1,z,(t  - 5t)y - 5t  + 1,x},
-      2      2
-    {t  + 3,z  - 4,y + t,x - z}]
-      Type: List RegularTriangularSet(Integer,
-                  IndexedExponents OrderedVariableList [x,y,z,t],
-                  OrderedVariableList [x,y,z,t],
-                  NewSparseMultivariatePolynomial(Integer,
-                      OrderedVariableList [x,y,z,t]))
-
-And now in the sense of Lazard (or Wu and other authors).
-
-  lts2 := zeroSetSplit(lf,false)$T
-      8      6      2         3            2
-   [{t  - 10t  + 10t  - 1,z,(t  - 5t)y - 5t  + 1,x},
-      2      8      6       2                 3            2
-    {t  - 1,z  - 16z  + 256z  - 256,t y - 1,(z  - 8z)x - 8z  + 16},
-       2      2     2                     2      2
-    {3t  + 1,z  - 7t  - 1,y + t,x + z}, {t  + 3,z  - 4,y + t,x - z}]
-       Type: List RegularTriangularSet(Integer,
-                   IndexedExponents OrderedVariableList [x,y,z,t],
-                   OrderedVariableList [x,y,z,t],
-                   NewSparseMultivariatePolynomial(Integer,
-                       OrderedVariableList [x,y,z,t]))
-
-Up to the ordering of the components, both decompositions are identical.
-
-Let us check that each component has a finite number of solutions.
-
-  [coHeight(ts) for ts in lts2]
-    [0,0,0,0]
-                        Type: List NonNegativeInteger
-
-Let us count the degrees of each component,
-
-  degrees := [degree(ts) for ts in lts2]
-    [8,16,4,4]
-                        Type: List NonNegativeInteger
-
-and compute their sum.
-
-  reduce(+,degrees)
-    32
-                        Type: PositiveInteger
-
-We study now the options of the zeroSetSplit operation.  As we have seen 
-yet, there is an optional second argument which is a boolean value. If this 
-value is true (this is the default) then the decomposition is computed in 
-the sense of Kalkbrener, otherwise it is computed in the sense of Lazard.
-
-There is a second boolean optional argument that can be used (in that
-case the first optional argument must be present).  This second option
-allows you to get some information during the computations.
-
-Therefore, we need to understand a little what is going on during the
-computations.  An important feature of the algorithm is that the
-intermediate computations are managed in some sense like the processes
-of a Unix system.  Indeed, each intermediate computation may generate
-other intermediate computations and the management of all these
-computations is a crucial task for the efficiency.  Thus any
-intermediate computation may be suspended, killed or resumed,
-depending on algebraic considerations that determine priorities for
-these processes.  The goal is of course to go as fast as possible
-towards the final decomposition which means to avoid as much as
-possible unnecessary computations.
-
-To follow the computations, one needs to set to true the second
-argument.  Then a lot of numbers and letters are displayed.  Between a
-[ and a ] one has the state of the processes at a given time.  Just
-after [ one can see the number of processes.  Then each process is
-represented by two numbers between < and >.  A process consists of a
-list of polynomial ps and a triangular set ts; its goal is to compute
-the common zeros of ps that belong to the regular-zeros set of ts.
-After the processes, the number between pipes gives the total number
-of polynomials in all the sets ps.  Finally, the number between braces
-gives the number of components of a decomposition that are already
-computed. This number may decrease.
-
-Let us take a third example (Czapor-Geddes-Wang) to see how this
-information is displayed.
-
-Define a polynomial system.
-
-  u : R := 2 
-    2
-                            Type: Integer
-
-  q1 := 2*(u-1)**2+ 2*(x-z*x+z**2)+ y**2*(x-1)**2- 2*u*x+ 2*y*t*(1-x)*(x-z)+_
-        2*u*z*t*(t-y)+ u**2*t**2*(1-2*z)+ 2*u*t**2*(z-x)+ 2*u*t*y*(z-1)+_
-        2*u*z*x*(y+1)+ (u**2-2*u)*z**2*t**2+ 2*u**2*z**2+ 4*u*(1-u)*z+_
-        t**2*(z-x)**2}
-       2           2  2        2                            2           2
-     (y  - 2t y + t )x  + (- 2y  + ((2t + 4)z + 2t)y + (- 2t  + 2)z - 4t  - 2)x
-   + 
-      2                      2       2          2
-     y  + (- 2t z - 4t)y + (t  + 10)z  - 8z + 4t  + 2
-       Type: NewSparseMultivariatePolynomial(Integer,
-               OrderedVariableList [x,y,z,t])
-
-  q2 := t*(2*z+1)*(x-z)+ y*(z+2)*(1-x)+ u*(u-2)*t+ u*(1-2*u)*z*t+_
-        u*y*(x+u-z*x-1)+ u*(u+1)*z**2*t}
-    (- 3z y + 2t z + t)x + (z + 4)y + 4t z  - 7t z
-       Type: NewSparseMultivariatePolynomial(Integer,
-               OrderedVariableList [x,y,z,t])
-
-  q3 := -u**2*(z-1)**2+ 2*z*(z-x)-2*(x-1)
-    (- 2z - 2)x - 2z  + 8z - 2
-       Type: NewSparseMultivariatePolynomial(Integer,
-               OrderedVariableList [x,y,z,t])
-
-  q4 := u**2+4*(z-x**2)+3*y**2*(x-1)**2- 3*t**2*(z-x)**2+_
-        3*u**2*t**2*(z-1)**2+u**2*z*(z-2)+6*u*t*y*(z+x+z*x-1)}
-       2     2      2        2                      2        2
-    (3y  - 3t  - 4)x  + (- 6y  + (12t z + 12t)y + 6t z)x + 3y  + (12t z - 12t)y
-   + 
-       2      2         2            2
-    (9t  + 4)z  + (- 24t  - 4)z + 12t  + 4
-        Type: NewSparseMultivariatePolynomial(Integer,
-                OrderedVariableList [x,y,z,t])
-
-  lq := [q1, q2, q3, q4]
-   [
-         2           2  2
-       (y  - 2t y + t )x
-     + 
-            2                            2           2          2
-       (- 2y  + ((2t + 4)z + 2t)y + (- 2t  + 2)z - 4t  - 2)x + y
-     + 
-                          2       2          2
-       (- 2t z - 4t)y + (t  + 10)z  - 8z + 4t  + 2
-     ,
-                                          2                         2
-    (- 3z y + 2t z + t)x + (z + 4)y + 4t z  - 7t z, (- 2z - 2)x - 2z  + 8z - 2,
-
-          2     2      2        2                      2        2
-       (3y  - 3t  - 4)x  + (- 6y  + (12t z + 12t)y + 6t z)x + 3y
-     + 
-                           2      2         2            2
-       (12t z - 12t)y + (9t  + 4)z  + (- 24t  - 4)z + 12t  + 4
-     ]
-        Type: List NewSparseMultivariatePolynomial(Integer,
-                     OrderedVariableList [x,y,z,t])
-
-Let us try the information option.  N.B. The timing should be between
-1 and 10 minutes, depending on your machine.
-
-  zeroSetSplit(lq,true,true)$T
-     [1 <4,0> -> |4|; {0}]W[2 <5,0>,<3,1> -> |8|; {0}]
-     [2 <4,1>,<3,1> -> |7|; {0}]
-     [1 <3,1> -> |3|; {0}]G
-     [2 <4,1>,<4,1> -> |8|; {0}]W
-     [3 <5,1>,<4,1>,<3,2> -> |12|; {0}]GI
-     [3 <4,2>,<4,1>,<3,2> -> |11|; {0}]GWw
-     [3 <4,1>,<3,2>,<5,2> -> |12|; {0}]
-     [3 <3,2>,<3,2>,<5,2> -> |11|; {0}]GIwWWWw
-     [4 <3,2>,<4,2>,<5,2>,<2,3> -> |14|; {0}]
-     [4 <2,2>,<4,2>,<5,2>,<2,3> -> |13|; {0}]Gwww
-     [5 <3,2>,<3,2>,<4,2>,<5,2>,<2,3> -> |17|; {0}]Gwwwwww
-     [8 <3,2>,<4,2>,<4,2>,<4,2>,<4,2>,<4,2>,<5,2>,<2,3> -> |30|; {0}]Gwwwwww
-     [8 <4,2>,<4,2>,<4,2>,<4,2>,<4,2>,<4,2>,<5,2>,<2,3> -> |31|; {0}]
-     [8 <3,3>,<4,2>,<4,2>,<4,2>,<4,2>,<4,2>,<5,2>,<2,3> -> |30|; {0}]
-     [8 <2,3>,<4,2>,<4,2>,<4,2>,<4,2>,<4,2>,<5,2>,<2,3> -> |29|; {0}]
-     [8 <1,3>,<4,2>,<4,2>,<4,2>,<4,2>,<4,2>,<5,2>,<2,3> -> |28|; {0}]
-     [7 <4,2>,<4,2>,<4,2>,<4,2>,<4,2>,<5,2>,<2,3> -> |27|; {0}]
-     [6 <4,2>,<4,2>,<4,2>,<4,2>,<5,2>,<2,3> -> |23|; {0}]
-     [5 <4,2>,<4,2>,<4,2>,<5,2>,<2,3> -> |19|; {0}]GIGIWwww
-     [6 <5,2>,<4,2>,<4,2>,<5,2>,<3,3>,<2,3> -> |23|; {0}]
-     [6 <4,3>,<4,2>,<4,2>,<5,2>,<3,3>,<2,3> -> |22|; {0}]GIGI
-     [6 <3,4>,<4,2>,<4,2>,<5,2>,<3,3>,<2,3> -> |21|; {0}]
-     [6 <2,4>,<4,2>,<4,2>,<5,2>,<3,3>,<2,3> -> |20|; {0}]GGG
-     [5 <4,2>,<4,2>,<5,2>,<3,3>,<2,3> -> |18|; {0}]GIGIWwwwW
-     [6 <5,2>,<4,2>,<5,2>,<3,3>,<3,3>,<2,3> -> |22|; {0}]
-     [6 <4,3>,<4,2>,<5,2>,<3,3>,<3,3>,<2,3> -> |21|; {0}]
-     GIwwWwWWWWWWWwWWWWwwwww
-     [8 <4,2>,<5,2>,<3,3>,<3,3>,<4,3>,<2,3>,<3,4>,<3,4> -> |27|; {0}]
-     [8 <3,3>,<5,2>,<3,3>,<3,3>,<4,3>,<2,3>,<3,4>,<3,4> -> |26|; {0}]
-     [8 <2,3>,<5,2>,<3,3>,<3,3>,<4,3>,<2,3>,<3,4>,<3,4> -> |25|; {0}]
-     Gwwwwwwwwwwwwwwwwwwww
-     [9 <5,2>,<3,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,4>,<3,4> -> |29|; {0}]GI
-     [9 <4,3>,<3,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,4>,<3,4> -> |28|; {0}]
-     [9 <3,3>,<3,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,4>,<3,4> -> |27|; {0}]
-     [9 <2,3>,<3,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,4>,<3,4> -> |26|; {0}]
-     GGwwwwwwwwwwwwWWwwwwwwww
-     [11 <3,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4>
-        -> |33|; {0}]
-     [11 <2,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> 
-       -> |32|; {0}]
-     [11 <1,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> 
-       -> |31|; {0}]GGGwwwwwwwwwwwww
-     [12 <2,3>,<2,3>,<3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,
-       <3,4> -> |34|; {0}]GGwwwwwwwwwwwww
-     [13 <3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,
-       <3,4>,<3,4> -> |38|; {0}]Gwwwwwwwwwwwww
-     [13 <2,3>,<3,3>,<4,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,
-       <3,4>,<3,4> -> |39|; {0}]GGGwwwwwwwwwwwww
-     [15 <3,3>,<4,3>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,
-       <3,3>,<3,3>,<3,4>,<3,4> -> |46|; {0}]
-     [14 <4,3>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,
-       <3,3>,<3,4>,<3,4> -> |43|; {0}]GIGGGGIGGI
-     [14 <3,4>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,
-       <3,3>,<3,4>,<3,4> -> |42|; {0}]GGG
-     [14 <2,4>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,
-       <3,3>,<3,4>,<3,4> -> |41|; {0}]
-     [14 <1,4>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,
-       <3,3>,<3,4>,<3,4> -> |40|; {0}]GGG
-     [13 <3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,
-       <3,4>,<3,4> -> |39|; {0}]Gwwwwwwwwwwwww
-     [15 <3,3>,<3,3>,<4,3>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,
-       <3,3>,<3,3>,<3,4>,<3,4> -> |48|; {0}]Gwwwwwwwwwwwww
-     [15 <4,3>,<4,3>,<3,3>,<4,3>,<4,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,3>,
-       <3,3>,<3,3>,<3,4>,<3,4> -> |49|; {0}]GIGI
-     [15 <3,4>,<4,3>,<3,3>,<4,3>,<4,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,3>,
-       <3,3>,<3,3>,<3,4>,<3,4> -> |48|; {0}]G
-     [14 <4,3>,<3,3>,<4,3>,<4,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,3>,<3,3>,
-       <3,3>,<3,4>,<3,4> -> |45|; {0}]
-     [13 <3,3>,<4,3>,<4,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,
-       <3,4>,<3,4> -> |41|; {0}]Gwwwwwwwwwwwww
-     [13 <4,3>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,
-       <3,4>,<3,4> -> |42|; {0}]GIGGGGIGGI
-     [13 <3,4>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,
-       <3,4>,<3,4> -> |41|; {0}]GGGGGGGG
-     [13 <2,4>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,
-       <3,4>,<3,4> -> |40|; {0}]
-     [13 <1,4>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,
-       <3,4>,<3,4>  -> |39|; {0}]
-     [13 <0,4>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,
-       <3,4>,<3,4> -> |38|; {0}]
-     [12 <4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,
-       <3,4> -> |38|; {1}]
-     [11 <4,3>,<3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> 
-       -> |34|; {1}]
-     [10 <3,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> 
-       -> |30|; {1}]
-     [10 <2,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> 
-       -> |29|; {1}]GGGwwwwwwwwwwwww
-     [11 <3,3>,<3,3>,<4,3>,<3,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> 
-       -> |33|; {1}]GGGwwwwwwwwwwwww
-     [12 <4,3>,<3,3>,<4,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,
-       <3,4> -> |38|; {1}]Gwwwwwwwwwwwww
-     [12 <3,3>,<4,3>,<5,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,
-       <3,4> -> |39|; {1}]GGwwwwwwwwwwwww
-     [13 <5,3>,<4,3>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,
-       <3,4>,<3,4> -> |44|; {1}]GIGGGGIGGIW
-     [13 <4,4>,<4,3>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,
-       <3,4>,<3,4> -> |43|; {1}]GGW
-     [13 <3,4>,<4,3>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,
-       <3,4>,<3,4> -> |42|; {1}]GGG
-     [12 <4,3>,<4,3>,<4,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,
-       <3,4> -> |39|; {1}]Gwwwwwwwwwwwww
-     [12 <4,3>,<4,3>,<5,3>,<3,3>,<4,3>,<3,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,
-       <3,4> -> |40|; {1}]Gwwwwwwwwwwwww
-     [13 <5,3>,<5,3>,<4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,
-       <3,4>,<3,4> -> |46|; {1}]GIGIW
-     [13 <4,4>,<5,3>,<4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,
-       <3,4>,<3,4> -> |45|; {1}]
-     [13 <3,4>,<5,3>,<4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,
-       <3,4>,<3,4> -> |44|; {1}]
-     [13 <2,4>,<5,3>,<4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,
-       <3,4>,<3,4> -> |43|; {1}]GG
-     [12 <5,3>,<4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,
-       <3,4> -> |41|; {1}]GIGGGGIGGIW
-     [12 <4,4>,<4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,
-       <3,4> -> |40|; {1}]GGGGGGW
-     [12 <3,4>,<4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,
-       <3,4> -> |39|; {1}]
-     [12 <2,4>,<4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,
-       <3,4> -> |38|; {1}]
-     [12 <1,4>,<4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,
-       <3,4> -> |37|; {1}]GGG
-     [11 <4,3>,<5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> 
-       -> |36|; {1}]
-     [10 <5,3>,<3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> 
-       -> |32|; {1}]
-     [9 <3,3>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |27|; {1}]W
-     [9 <2,4>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |26|; {1}]
-     [9 <1,4>,<3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |25|; {1}]
-     [8 <3,3>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |24|; {1}]W
-     [8 <2,4>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |23|; {1}]
-     [8 <1,4>,<4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |22|; {1}]
-     [7 <4,3>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |21|; {1}]w
-     [7 <3,4>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |20|; {1}]
-     [7 <2,4>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |19|; {1}]
-     [7 <1,4>,<2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |18|; {1}]
-     [6 <2,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |17|; {1}]GGwwwwww
-     [7 <3,3>,<3,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |21|; {1}]GIW
-     [7 <2,4>,<3,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |20|; {1}]GG
-     [6 <3,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |18|; {1}]Gwwwwww
-     [7 <4,3>,<4,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |23|; {1}]GIW
-     [7 <3,4>,<4,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |22|; {1}]
-     [6 <4,3>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |19|; {1}]GIW
-     [6 <3,4>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |18|; {1}]GGW
-     [6 <2,4>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |17|; {1}]
-     [6 <1,4>,<3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |16|; {1}]GGG
-     [5 <3,3>,<3,3>,<3,3>,<3,4>,<3,4> -> |15|; {1}]GIW
-     [5 <2,4>,<3,3>,<3,3>,<3,4>,<3,4> -> |14|; {1}]GG
-     [4 <3,3>,<3,3>,<3,4>,<3,4> -> |12|; {1}]
-     [3 <3,3>,<3,4>,<3,4> -> |9|; {1}]W
-     [3 <2,4>,<3,4>,<3,4> -> |8|; {1}]
-     [3 <1,4>,<3,4>,<3,4> -> |7|; {1}]G
-     [2 <3,4>,<3,4> -> |6|; {1}]G
-     [1 <3,4> -> |3|; {1}]
-     [1 <2,4> -> |2|; {1}]
-     [1 <1,4> -> |1|; {1}]
-   *** QCMPACK Statistics ***
-      Table     size:  36
-      Entries reused:  255
-
-   *** REGSETGCD: Gcd Statistics ***
-      Table     size:  125
-      Entries reused:  0
-
-   *** REGSETGCD: Inv Set Statistics ***
-      Table     size:  30
-      Entries reused:  0
-
-   [
-     {
-                         24                   23                    22
-         960725655771966t   + 386820897948702t   + 8906817198608181t
-       + 
-                          21                     20                    19
-         2704966893949428t   + 37304033340228264t   + 7924782817170207t
-       + 
-                           18                     17                      16
-         93126799040354990t   + 13101273653130910t   + 156146250424711858t
-       + 
-                           15                      14                     13
-         16626490957259119t   + 190699288479805763t   + 24339173367625275t
-       + 
-                            12                     11                      10
-         180532313014960135t   + 35288089030975378t   + 135054975747656285t
-       + 
-                           9                     8                     7
-         34733736952488540t  + 75947600354493972t  + 19772555692457088t
-       + 
-                           6                    5                    4
-         28871558573755428t  + 5576152439081664t  + 6321711820352976t
-       + 
-                       3                   2
-       438314209312320t  + 581105748367008t  - 60254467992576t + 1449115951104
-       ,
-
-                                                                         23
-             26604210869491302385515265737052082361668474181372891857784t
-           + 
-                                                                          22
-             443104378424686086067294899528296664238693556855017735265295t
-           + 
-                                                                          21
-             279078393286701234679141342358988327155321305829547090310242t
-           + 
-                                                                           20
-             3390276361413232465107617176615543054620626391823613392185226t
-           + 
-                                                                          19
-             941478179503540575554198645220352803719793196473813837434129t
-           + 
-                                                                            18
-             11547855194679475242211696749673949352585747674184320988144390t
-           + 
-                                                                           17
-             1343609566765597789881701656699413216467215660333356417241432t
-           + 
-                                                                            16
-             23233813868147873503933551617175640859899102987800663566699334t
-           + 
-                                                                          15
-             869574020537672336950845440508790740850931336484983573386433t
-           + 
-                                                                            14
-             31561554305876934875419461486969926554241750065103460820476969t
-           + 
-                                                                           13
-             1271400990287717487442065952547731879554823889855386072264931t
-           + 
-                                                                            12
-             31945089913863736044802526964079540198337049550503295825160523t
-           + 
-                                                                           11
-             3738735704288144509871371560232845884439102270778010470931960t
-           + 
-                                                                            10
-             25293997512391412026144601435771131587561905532992045692885927t
-           + 
-                                                                           9
-             5210239009846067123469262799870052773410471135950175008046524t
-           + 
-                                                                            8
-             15083887986930297166259870568608270427403187606238713491129188t
-           + 
-                                                                           7
-             3522087234692930126383686270775779553481769125670839075109000t
-           + 
-                                                                           6
-             6079945200395681013086533792568886491101244247440034969288588t
-           + 
-                                                                           5
-             1090634852433900888199913756247986023196987723469934933603680t
-           + 
-                                                                           4
-             1405819430871907102294432537538335402102838994019667487458352t
-           + 
-                                                                         3
-             88071527950320450072536671265507748878347828884933605202432t
-           + 
-                                                                          2
-             135882489433640933229781177155977768016065765482378657129440t
-           + 
-             - 13957283442882262230559894607400314082516690749975646520320t
-           + 
-             334637692973189299277258325709308472592117112855749713920
-        *
-           z
-       + 
-                                                                    23
-         8567175484043952879756725964506833932149637101090521164936t
-       + 
-                                                                      22
-         149792392864201791845708374032728942498797519251667250945721t
-       + 
-                                                                     21
-         77258371783645822157410861582159764138123003074190374021550t
-       + 
-                                                                       20
-         1108862254126854214498918940708612211184560556764334742191654t
-       + 
-                                                                      19
-         213250494460678865219774480106826053783815789621501732672327t
-       + 
-                                                                       18
-         3668929075160666195729177894178343514501987898410131431699882t
-       + 
-                                                                      17
-         171388906471001872879490124368748236314765459039567820048872t
-       + 
-                                                                       16
-         7192430746914602166660233477331022483144921771645523139658986t
-       + 
-                                                                        15
-         - 128798674689690072812879965633090291959663143108437362453385t
-       + 
-                                                                       14
-         9553010858341425909306423132921134040856028790803526430270671t
-       + 
-                                                                       13
-         - 13296096245675492874538687646300437824658458709144441096603t
-       + 
-                                                                       12
-         9475806805814145326383085518325333106881690568644274964864413t
-       + 
-                                                                      11
-         803234687925133458861659855664084927606298794799856265539336t
-       + 
-                                                                       10
-         7338202759292865165994622349207516400662174302614595173333825t
-       + 
-                                                                       9
-         1308004628480367351164369613111971668880538855640917200187108t
-       + 
-                                                                       8
-         4268059455741255498880229598973705747098216067697754352634748t
-       + 
-                                                                      7
-         892893526858514095791318775904093300103045601514470613580600t
-       + 
-                                                                       6
-         1679152575460683956631925852181341501981598137465328797013652t
-       + 
-                                                                      5
-         269757415767922980378967154143357835544113158280591408043936t
-       + 
-                                                                      4
-         380951527864657529033580829801282724081345372680202920198224t
-       + 
-                                                                     3
-         19785545294228495032998826937601341132725035339452913286656t
-       + 
-                                                                     2
-         36477412057384782942366635303396637763303928174935079178528t
-       + 
-         - 3722212879279038648713080422224976273210890229485838670848t
-       + 
-         89079724853114348361230634484013862024728599906874105856
-       ,
-         3      2                  3       2
-      (3z  - 11z  + 8z + 4)y + 2t z  + 4t z  - 5t z - t,
-                  2
-      (z + 1)x + z  - 4z + 1}
-     ]
-       Type: List RegularTriangularSet(Integer,
-                   IndexedExponents OrderedVariableList [x,y,z,t],
-                   OrderedVariableList [x,y,z,t],
-                   NewSparseMultivariatePolynomial(Integer,
-                     OrderedVariableList [x,y,z,t]))
-
-Between a sequence of processes, thus between a ] and a [ you can see
-capital letters W, G, I and lower case letters i, w. Each time a
-capital letter appears a non-trivial computation has be performed and
-its result is put in a hash-table.  Each time a lower case letter
-appears a needed result has been found in an hash-table.  The use of
-these hash-tables generally speed up the computations.  However, on
-very large systems, it may happen that these hash-tables become too
-big to be handle by your AXIOM configuration.  Then in these
-exceptional cases, you may prefer getting a result (even if it takes a
-long time) than getting nothing.  Hence you need to know how to
-prevent the RSEGSET constructor from using these hash-tables.  In that
-case you will be using the zeroSetSplit with five arguments.  The
-first one is the input system lp as above.  The second one is a
-boolean value hash?  which is true iff you want to use hash-tables.
-The third one is boolean value clos? which is true iff you want to
-solve your system in the sense of Kalkbrener, the other way remaining
-that of Lazard.  The fourth argument is boolean value info? which is
-true iff you want to display information during the computations.  The
-last one is boolean value prep? which is true iff you want to use some
-heuristics that are performed on the input system before starting the
-real algorithm.  The value of this flag is true when you are using
-zeroSetSplit with less than five arguments.  Note that there is no
-available signature for zeroSetSplit with four arguments.
-
-We finish this section by some remarks about both ways of solving, in
-the sense of Kalkbrener or in the sense of Lazard.  For problems with
-a finite number of solutions, there are theoretically equivalent and
-the resulting decompositions are identical, up to the ordering of the
-components.  However, when solving in the sense of Lazard, the
-algorithm behaves differently.  In that case, it becomes more
-incremental than in the sense of Kalkbrener. That means the
-polynomials of the input system are considered one after another
-whereas in the sense of Kalkbrener the input system is treated more
-globally.
-
-This makes an important difference in positive dimension.  Indeed when
-solving in the sense of Kalkbrener, the Primeidealkettensatz of Krull
-is used.  That means any regular triangular containing more
-polynomials than the input system can be deleted.  This is not
-possible when solving in the sense of Lazard.  This explains why
-Kalkbrener's decompositions usually contain less components than those
-of Lazard.  However, it may happen with some examples that the
-incremental process (that cannot be used when solving in the sense of
-Kalkbrener) provide a more efficient way of solving than the global
-one even if the Primeidealkettensatz is used.  Thus just try both,
-with the various options, before concluding that you cannot solve your
-favorite system with zeroSetSplit.  There exist more options at the
-development level that are not currently available in this public
-version.
-
-See Also:
-o )help GcdDomain
-o )help OrderedAbelianMonoidSup
-o )help OrderedSet
-o )help RecursivePolynomialCategory
-o )help RegularChain
-o )help NewSparseMultivariatePolynomial
-o )help ZeroDimensionalSolvePackage
-o )help LexTriangularPackage
-o )help LazardSetSolvingPackage
-o )help SquareFreeRegularTriangularSet
-o )show RegularTriangularSet
-o $AXIOM/doc/src/algebra/regset.spad.dvi
-
-@
-<<domain REGSET RegularTriangularSet>>=
-)abbrev domain REGSET RegularTriangularSet
-++ Author: Marc Moreno Maza
-++ Date Created: 08/25/1998
-++ Date Last Updated: 16/12/1998
-++ Basic Functions:
-++ Related Constructors:
-++ Also See: 
-++ AMS Classifications:
-++ Keywords:
-++ Description: 
-++ This domain provides an implementation of regular chains.
-++ Moreover, the operation \axiomOpFrom{zeroSetSplit}{RegularTriangularSetCategory}
-++ is an implementation of a new algorithm for solving polynomial systems by
-++ means of regular chains.\newline
-++ References :
-++  [1] M. MORENO MAZA "A new algorithm for computing triangular
-++      decomposition of algebraic varieties" NAG Tech. Rep. 4/98.
-++ Version: Version 11. 
-
-RegularTriangularSet(R,E,V,P) : Exports == Implementation where
-
-  R : GcdDomain
-  E : OrderedAbelianMonoidSup
-  V : OrderedSet
-  P : RecursivePolynomialCategory(R,E,V)
-  N ==> NonNegativeInteger
-  Z ==> Integer
-  B ==> Boolean
-  LP ==> List P
-  PtoP ==> P -> P
-  PS ==> GeneralPolynomialSet(R,E,V,P)
-  PWT ==> Record(val : P, tower : $)
-  BWT ==> Record(val : Boolean, tower : $)
-  LpWT ==> Record(val : (List P), tower : $)
-  Split ==> List $
-  iprintpack ==> InternalPrintPackage()
-  polsetpack ==> PolynomialSetUtilitiesPackage(R,E,V,P)
-  quasicomppack ==> QuasiComponentPackage(R,E,V,P,$)
-  regsetgcdpack ==> RegularTriangularSetGcdPackage(R,E,V,P,$)
-  regsetdecomppack ==> RegularSetDecompositionPackage(R,E,V,P,$)
-
-  Exports ==  RegularTriangularSetCategory(R,E,V,P) with
-
-     internalAugment: (P,$,B,B,B,B,B) -> List $
-       ++ \axiom{internalAugment(p,ts,b1,b2,b3,b4,b5)}
-       ++ is an internal subroutine, exported only for developement.
-     zeroSetSplit: (LP, B, B) -> Split
-       ++ \axiom{zeroSetSplit(lp,clos?,info?)} has the same specifications as
-       ++ \axiomOpFrom{zeroSetSplit}{RegularTriangularSetCategory}.
-       ++ Moreover, if \axiom{clos?} then solves in the sense of the Zariski closure
-       ++ else solves in the sense of the regular zeros. If \axiom{info?} then
-       ++ do print messages during the computations.
-     zeroSetSplit: (LP, B, B, B, B) -> Split
-       ++ \axiom{zeroSetSplit(lp,b1,b2.b3,b4)} 
-       ++ is an internal subroutine, exported only for developement.
-     internalZeroSetSplit: (LP, B, B, B) -> Split
-       ++ \axiom{internalZeroSetSplit(lp,b1,b2,b3)}
-       ++ is an internal subroutine, exported only for developement.
-     pre_process: (LP, B, B) -> Record(val: LP, towers: Split)
-       ++ \axiom{pre_process(lp,b1,b2)} 
-       ++ is an internal subroutine, exported only for developement.
-
-  Implementation == add
-
-     Rep ==> LP
-
-     rep(s:$):Rep == s pretend Rep
-     per(l:Rep):$ == l pretend $
-
-     copy ts ==
-       per(copy(rep(ts))$LP)
-     empty() ==
-       per([])
-     empty?(ts:$) ==
-       empty?(rep(ts))
-     parts ts ==
-       rep(ts)
-     members ts ==
-       rep(ts)
-     map (f : PtoP, ts : $) : $ ==
-       construct(map(f,rep(ts))$LP)$$
-     map! (f : PtoP, ts : $) : $  ==
-       construct(map!(f,rep(ts))$LP)$$
-     member? (p,ts) ==
-       member?(p,rep(ts))$LP
-     unitIdealIfCan() ==
-       "failed"::Union($,"failed")
-     roughUnitIdeal? ts ==
-       false
-     coerce(ts:$) : OutputForm ==
-       lp : List(P) := reverse(rep(ts))
-       brace([p::OutputForm for p in lp]$List(OutputForm))$OutputForm
-     mvar ts ==
-       empty? ts => error "mvar$REGSET: #1 is empty"
-       mvar(first(rep(ts)))$P
-     first ts ==
-       empty? ts => "failed"::Union(P,"failed")
-       first(rep(ts))::Union(P,"failed")
-     last ts ==
-       empty? ts => "failed"::Union(P,"failed")
-       last(rep(ts))::Union(P,"failed")
-     rest ts ==
-       empty? ts => "failed"::Union($,"failed")
-       per(rest(rep(ts)))::Union($,"failed")
-     coerce(ts:$) : (List P) ==
-       rep(ts)
-
-     collectUpper (ts,v) ==
-       empty? ts => ts
-       lp := rep(ts)
-       newlp : Rep := []
-       while (not empty? lp) and (mvar(first(lp)) > v) repeat
-         newlp := cons(first(lp),newlp)
-         lp := rest lp
-       per(reverse(newlp))
-
-     collectUnder (ts,v) ==
-       empty? ts => ts
-       lp := rep(ts)
-       while (not empty? lp) and (mvar(first(lp)) >= v) repeat
-         lp := rest lp
-       per(lp)
-
-     construct(lp:List(P)) ==
-       ts : $ := per([])
-       empty? lp => ts
-       lp := sort(infRittWu?,lp)
-       while not empty? lp repeat
-         eif := extendIfCan(ts,first(lp))
-         not (eif case $) =>
-           error"in construct : List P -> $  from REGSET : bad #1"
-         ts := eif::$
-         lp := rest lp
-       ts
-
-     extendIfCan(ts:$,p:P) ==
-       ground? p => "failed"::Union($,"failed")       
-       empty? ts => 
-         p := primitivePart p
-         (per([p]))::Union($,"failed")
-       not (mvar(ts) < mvar(p)) => "failed"::Union($,"failed")
-       invertible?(init(p),ts)@Boolean => 
-         (per(cons(p,rep(ts))))::Union($,"failed")
-       "failed"::Union($,"failed")
-
-     removeZero(p:P, ts:$): P ==
-       (ground? p) or (empty? ts) => p
-       v := mvar(p)
-       ts_v_- := collectUnder(ts,v)
-       if algebraic?(v,ts) 
-         then
-           q := lazyPrem(p,select(ts,v)::P)
-           zero? q => return q
-           zero? removeZero(q,ts_v_-) => return 0
-       empty? ts_v_- => p
-       q: P := 0
-       while positive? degree(p,v) repeat
-          q := removeZero(init(p),ts_v_-) * mainMonomial(p) + q
-          p := tail(p)
-       q + removeZero(p,ts_v_-)
-
-     internalAugment(p:P,ts:$): $ ==
-       -- ASSUME that adding p to ts DOES NOT require any split
-       ground? p => error "in internalAugment$REGSET: ground? #1"
-       first(internalAugment(p,ts,false,false,false,false,false))
-
-     internalAugment(lp:List(P),ts:$): $ ==
-       -- ASSUME that adding p to ts DOES NOT require any split
-       empty? lp => ts
-       internalAugment(rest lp, internalAugment(first lp, ts))
-
-     internalAugment(p:P,ts:$,rem?:B,red?:B,prim?:B,sqfr?:B,extend?:B): Split ==
-       -- ASSUME p is not a constant
-       -- ASSUME mvar(p) is not algebraic w.r.t. ts
-       -- ASSUME init(p) invertible modulo ts
-       -- if rem? then REDUCE p by remainder
-       -- if prim? then REPLACE p by its main primitive part
-       -- if sqfr? then FACTORIZE SQUARE FREE p over R
-       -- if extend? DO NOT ASSUME every pol in ts_v_+ is invertible modulo ts
-       v := mvar(p)
-       ts_v_- := collectUnder(ts,v)
-       ts_v_+ := collectUpper(ts,v)
-       if rem? then p := remainder(p,ts_v_-).polnum
-       -- if rem? then p := reduceByQuasiMonic(p,ts_v_-)
-       if red? then p := removeZero(p,ts_v_-)
-       if prim? then p := mainPrimitivePart p
-       if sqfr?
-         then
-           lsfp := squareFreeFactors(p)$polsetpack
-           lts: Split := [per(cons(f,rep(ts_v_-))) for f in lsfp]
-         else
-           lts: Split := [per(cons(p,rep(ts_v_-)))]
-       extend? => extend(members(ts_v_+),lts)
-       [per(concat(rep(ts_v_+),rep(us))) for us in lts]
-
-     augment(p:P,ts:$): List $ ==
-       ground? p => error "in augment$REGSET: ground? #1"
-       algebraic?(mvar(p),ts) => error "in augment$REGSET: bad #1"
-       -- ASSUME init(p) invertible modulo ts
-       -- DOES NOT ASSUME anything else.
-       -- THUS reduction, mainPrimitivePart and squareFree are NEEDED
-       internalAugment(p,ts,true,true,true,true,true)
-
-     extend(p:P,ts:$): List $ ==
-       ground? p => error "in extend$REGSET: ground? #1"
-       v := mvar(p)
-       not (mvar(ts) < mvar(p)) => error "in extend$REGSET: bad #1"
-       lts: List($) := []
-       split: List($) := invertibleSet(init(p),ts)
-       for us in split repeat
-         lts := concat(augment(p,us),lts)
-       lts
-
-     invertible?(p:P,ts:$): Boolean == 
-       toseInvertible?(p,ts)$regsetgcdpack
-       
-     invertible?(p:P,ts:$): List BWT ==
-       toseInvertible?(p,ts)$regsetgcdpack
-
-     invertibleSet(p:P,ts:$): Split ==
-       toseInvertibleSet(p,ts)$regsetgcdpack
-
-     lastSubResultant(p1:P,p2:P,ts:$): List PWT ==
-       toseLastSubResultant(p1,p2,ts)$regsetgcdpack
-
-     squareFreePart(p:P, ts: $): List PWT ==
-       toseSquareFreePart(p,ts)$regsetgcdpack
-
-     intersect(p:P, ts: $): List($) == decompose([p], [ts], false, false)$regsetdecomppack
-
-     intersect(lp: LP, lts: List($)): List($) == decompose(lp, lts, false, false)$regsetdecomppack
-        -- SOLVE in the regular zero sense 
-        -- and DO NOT PRINT info
-
-     decompose(p:P, ts: $): List($) == decompose([p], [ts], true, false)$regsetdecomppack
-
-     decompose(lp: LP, lts: List($)): List($) == decompose(lp, lts, true, false)$regsetdecomppack
-        -- SOLVE in the closure sense 
-        -- and DO NOT PRINT info
-
-     zeroSetSplit(lp:List(P)) == zeroSetSplit(lp,true,false)
-        -- by default SOLVE in the closure sense 
-        -- and DO NOT PRINT info
-
-     zeroSetSplit(lp:List(P), clos?: B) == zeroSetSplit(lp,clos?, false)
-        -- DO NOT PRINT info
-
-     zeroSetSplit(lp:List(P), clos?: B, info?: B) ==
-       -- if clos? then SOLVE in the closure sense 
-       -- if info? then PRINT info
-       -- by default USE hash-tables
-       -- and PREPROCESS the input system
-       zeroSetSplit(lp,true,clos?,info?,true)
-
-     zeroSetSplit(lp:List(P),hash?:B,clos?:B,info?:B,prep?:B) == 
-       -- if hash? then USE hash-tables
-       -- if info? then PRINT information
-       -- if clos? then SOLVE in the closure sense
-       -- if prep? then PREPROCESS the input system
-       if hash? 
-         then
-           s1, s2, s3, dom1, dom2, dom3: String
-           e: String := empty()$String
-           if info? then (s1,s2,s3) := ("w","g","i") else (s1,s2,s3) := (e,e,e)
-           if info? 
-             then 
-               (dom1, dom2, dom3) := ("QCMPACK", "REGSETGCD: Gcd", "REGSETGCD: Inv Set")
-             else
-               (dom1, dom2, dom3) := (e,e,e)
-           startTable!(s1,"W",dom1)$quasicomppack
-           startTableGcd!(s2,"G",dom2)$regsetgcdpack
-           startTableInvSet!(s3,"I",dom3)$regsetgcdpack
-       lts := internalZeroSetSplit(lp,clos?,info?,prep?)
-       if hash? 
-         then
-           stopTable!()$quasicomppack
-           stopTableGcd!()$regsetgcdpack
-           stopTableInvSet!()$regsetgcdpack
-       lts
-
-     internalZeroSetSplit(lp:LP,clos?:B,info?:B,prep?:B) ==
-       -- if info? then PRINT information
-       -- if clos? then SOLVE in the closure sense
-       -- if prep? then PREPROCESS the input system
-       if prep?
-         then
-           pp := pre_process(lp,clos?,info?)
-           lp := pp.val
-           lts := pp.towers
-         else
-           ts: $ := [[]]
-           lts := [ts]
-       lp := remove(zero?, lp)
-       any?(ground?, lp) => []
-       empty? lp => lts
-       empty? lts => lts
-       lp := sort(infRittWu?,lp)
-       clos? => decompose(lp,lts, clos?, info?)$regsetdecomppack
-       -- IN DIM > 0 with clos? the following is false ...
-       for p in lp repeat
-         lts := decompose([p],lts, clos?, info?)$regsetdecomppack
-       lts
-
-     largeSystem?(lp:LP): Boolean == 
-       -- Gonnet and Gerdt and not Wu-Wang.2
-       #lp > 16 => true
-       #lp < 13 => false
-       lts: List($) := []
-       (#lp :: Z - numberOfVariables(lp,lts)$regsetdecomppack :: Z) > 3
-
-     smallSystem?(lp:LP): Boolean == 
-       -- neural, Vermeer, Liu, and not f-633 and not Hairer-2
-       #lp < 5
-
-     mediumSystem?(lp:LP): Boolean == 
-       -- f-633 and not Hairer-2
-       lts: List($) := []
-       (numberOfVariables(lp,lts)$regsetdecomppack :: Z - #lp :: Z) < 2
-
---     lin?(p:P):Boolean == ground?(init(p)) and one?(mdeg(p))
-     lin?(p:P):Boolean == ground?(init(p)) and (mdeg(p) = 1)
-
-     pre_process(lp:LP,clos?:B,info?:B): Record(val: LP, towers: Split) ==
-       -- if info? then PRINT information
-       -- if clos? then SOLVE in the closure sense
-       ts: $ := [[]]; 
-       lts: Split := [ts]
-       empty? lp => [lp,lts]
-       lp1: List P := []
-       lp2: List P := []
-       for p in lp repeat 
-          ground? (tail p) => lp1 := cons(p, lp1)
-          lp2 := cons(p, lp2)
-       lts: Split := decompose(lp1,[ts],clos?,info?)$regsetdecomppack
-       probablyZeroDim?(lp)$polsetpack =>
-          largeSystem?(lp) => return [lp2,lts]
-          if #lp > 7
-            then 
-              -- Butcher (8,8) + Wu-Wang.2 (13,16) 
-              lp2 := crushedSet(lp2)$polsetpack
-              lp2 := remove(zero?,lp2)
-              any?(ground?,lp2) => return [lp2, lts]
-              lp3 := [p for p in lp2 | lin?(p)]
-              lp4 := [p for p in lp2 | not lin?(p)]
-              if clos?
-                then 
-                  lts := decompose(lp4,lts, clos?, info?)$regsetdecomppack
-                else
-                  lp4 := sort(infRittWu?,lp4)
-                  for p in lp4 repeat
-                    lts := decompose([p],lts, clos?, info?)$regsetdecomppack
-              lp2 := lp3
-            else
-              lp2 := crushedSet(lp2)$polsetpack
-              lp2 := remove(zero?,lp2)
-              any?(ground?,lp2) => return [lp2, lts]
-          if clos?
-            then
-              lts := decompose(lp2,lts, clos?, info?)$regsetdecomppack
-            else
-              lp2 := sort(infRittWu?,lp2)
-              for p in lp2 repeat
-                lts := decompose([p],lts, clos?, info?)$regsetdecomppack
-          lp2 := []
-          return [lp2,lts]
-       smallSystem?(lp) => [lp2,lts]
-       mediumSystem?(lp) => [crushedSet(lp2)$polsetpack,lts]
-       lp3 := [p for p in lp2 | lin?(p)]
-       lp4 := [p for p in lp2 | not lin?(p)]
-       if clos?
-         then 
-           lts := decompose(lp4,lts, clos?, info?)$regsetdecomppack
-         else
-           lp4 := sort(infRittWu?,lp4)
-           for p in lp4 repeat
-             lts := decompose([p],lts, clos?, info?)$regsetdecomppack
-       if clos?
-         then 
-           lts := decompose(lp3,lts, clos?, info?)$regsetdecomppack
-         else
-           lp3 := sort(infRittWu?,lp3)
-           for p in lp3 repeat
-             lts := decompose([p],lts, clos?, info?)$regsetdecomppack
-       lp2 := []
-       return [lp2,lts]
-
-@
 \section{License}
 <<license>>=
 --Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd.
@@ -2824,7 +1059,6 @@ RegularTriangularSet(R,E,V,P) : Exports == Implementation where
 <<package QCMPACK QuasiComponentPackage>>
 <<package RSETGCD RegularTriangularSetGcdPackage>>
 <<package RSDCMPK RegularSetDecompositionPackage>>
-<<domain REGSET RegularTriangularSet>>
 @
 \eject
 \begin{thebibliography}{99}
diff --git a/src/algebra/resring.spad.pamphlet b/src/algebra/resring.spad.pamphlet
deleted file mode 100644
index 5137df0..0000000
--- a/src/algebra/resring.spad.pamphlet
+++ /dev/null
@@ -1,109 +0,0 @@
-\documentclass{article}
-\usepackage{axiom}
-\begin{document}
-\title{\$SPAD/src/algebra resring.spad}
-\author{Patrizia Gianni}
-\maketitle
-\begin{abstract}
-\end{abstract}
-\eject
-\tableofcontents
-\eject
-\section{domain RESRING ResidueRing}
-<<domain RESRING ResidueRing>>=
-)abbrev domain RESRING ResidueRing
-++ Author: P.Gianni
-++ Date Created: December 1992
-++ Date Last Updated:
-++ Basic Functions: 
-++ Related Constructors:
-++ Also See:
-++ AMS Classifications:
-++ Keywords: 
-++ References:
-++ Description: ResidueRing is the quotient of a polynomial ring by  an ideal.
-++ The ideal is given as a list of generators. The elements of the domain
-++ are equivalence classes expressed in terms of reduced elements
-
-ResidueRing(F,Expon,VarSet,FPol,LFPol) : Dom  == Body
- where
-   F       :  Field
-   Expon   :  OrderedAbelianMonoidSup
-   VarSet  :  OrderedSet
-   FPol    :  PolynomialCategory(F, Expon, VarSet)
-   LFPol   :  List FPol
-   
-   Dom   == Join(CommutativeRing, Algebra F) with
-     reduce   :   FPol -> $
-     ++ reduce(f) produces the equivalence class of f in the residue ring
-     coerce   :   FPol -> $
-     ++ coerce(f) produces the equivalence class of f in the residue ring
-     lift     :     $  -> FPol
-     ++ lift(x) return the canonical representative of the equivalence class x
-   Body  ==  add 
-    --representation
-      Rep:= FPol
-      import GroebnerPackage(F,Expon,VarSet,FPol)
-      relations:= groebner(LFPol)
-      relations = [1] => error "the residue ring is the zero ring"
-    --declarations
-      x,y: $
-    --definitions
-      0 == 0$Rep
-      1 == 1$Rep
-      reduce(f : FPol) : $ == normalForm(f,relations)
-      coerce(f : FPol) : $ == normalForm(f,relations)
-      lift x  == x :: Rep :: FPol
-      x + y == x +$Rep y
-      -x == -$Rep x
-      x*y == normalForm(lift(x *$Rep y),relations)
-      (n : Integer) * x == n *$Rep x
-      (a : F) * x == a *$Rep x
-      x = y == x =$Rep y
-      characteristic()      == characteristic()$F
-      coerce(x) : OutputForm == coerce(x)$Rep
-
-@
-\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 RESRING ResidueRing>>
-@
-\eject
-\begin{thebibliography}{99}
-\bibitem{1} nothing
-\end{thebibliography}
-\end{document}
diff --git a/src/algebra/routines.spad.pamphlet b/src/algebra/routines.spad.pamphlet
deleted file mode 100644
index c491b23..0000000
--- a/src/algebra/routines.spad.pamphlet
+++ /dev/null
@@ -1,648 +0,0 @@
-\documentclass{article}
-\usepackage{axiom}
-\begin{document}
-\title{\$SPAD/src/algebra routines.spad}
-\author{Brian Dupee}
-\maketitle
-\begin{abstract}
-\end{abstract}
-\eject
-\tableofcontents
-\eject
-\section{domain ROUTINE RoutinesTable}
-<<domain ROUTINE RoutinesTable>>=
-)abbrev domain ROUTINE RoutinesTable
-++ Author: Brian Dupee
-++ Date Created: August 1994
-++ Date Last Updated: December 1997
-++ Basic Operations: routines, getMeasure
-++ Related Constructors: TableAggregate(Symbol,Any)
-++ Description:
-++ \axiomType{RoutinesTable} implements a database and associated tuning
-++ mechanisms for a set of known NAG routines
-RoutinesTable(): E == I where
-  F	==> Float
-  ST	==> String
-  LST	==> List String
-  Rec	==> Record(key:Symbol,entry:Any)
-  RList	==> List(Record(key:Symbol,entry:Any))
-  IFL	==> List(Record(ifail:Integer,instruction:ST))
-  Entry	==> Record(chapter:ST, type:ST, domainName: ST, 
-                     defaultMin:F, measure:F, failList:IFL, explList:LST)
-
-  E ==> TableAggregate(Symbol,Any) with
-
-    concat:(%,%) -> %
-      ++ concat(x,y) merges two tables x and y
-    routines:() -> %
-      ++ routines() initialises a database of known NAG routines
-    selectIntegrationRoutines:% -> % 
-      ++ selectIntegrationRoutines(R) chooses only those routines from 
-      ++ the database which are for integration
-    selectOptimizationRoutines:% -> % 
-      ++ selectOptimizationRoutines(R) chooses only those routines from 
-      ++ the database which are for integration
-    selectPDERoutines:% -> % 
-      ++ selectPDERoutines(R) chooses only those routines from the 
-      ++ database which are for the solution of PDE's
-    selectODEIVPRoutines:% -> % 
-      ++ selectODEIVPRoutines(R) chooses only those routines from the 
-      ++ database which are for the solution of ODE's
-    selectFiniteRoutines:% -> % 
-      ++ selectFiniteRoutines(R) chooses only those routines from the 
-      ++ database which are designed for use with finite expressions
-    selectSumOfSquaresRoutines:% -> % 
-      ++ selectSumOfSquaresRoutines(R) chooses only those routines from the 
-      ++ database which are designed for use with sums of squares
-    selectNonFiniteRoutines:% -> % 
-      ++ selectNonFiniteRoutines(R) chooses only those routines from the 
-      ++ database which are designed for use with non-finite expressions.
-    selectMultiDimensionalRoutines:% -> %
-      ++ selectMultiDimensionalRoutines(R) chooses only those routines from 
-      ++ the database which are designed for use with multi-dimensional
-      ++ expressions
-    changeThreshhold:(%,Symbol,F) -> %
-      ++ changeThreshhold(R,s,newValue) changes the value below which, 
-      ++ given a NAG routine generating a higher measure, the routines will 
-      ++ make no attempt to generate a measure.
-    changeMeasure:(%,Symbol,F) -> %
-      ++ changeMeasure(R,s,newValue) changes the maximum value for a 
-      ++ measure of the given NAG routine.
-    getMeasure:(%,Symbol) -> F
-      ++ getMeasure(R,s) gets the current value of the maximum measure for 
-      ++ the given NAG routine.
-    getExplanations:(%,ST) -> LST
-      ++ getExplanations(R,s) gets the explanations of the output parameters for 
-      ++ the given NAG routine.
-    deleteRoutine!:(%,Symbol) -> %
-      ++ deleteRoutine!(R,s) destructively deletes the given routine from 
-      ++ the current database of NAG routines
-    showTheRoutinesTable:() -> %
-      ++ showTheRoutinesTable() returns the current table of NAG routines.
-    recoverAfterFail:(%,ST,Integer) ->  Union(ST,"failed")
-      ++ recoverAfterFail(routs,routineName,ifailValue) acts on the 
-      ++ instructions given by the ifail list
-    finiteAggregate
-
-  I ==> Result add
-
-    Rep := Result
-    import Rep
-
-    theRoutinesTable:% := routines()
-
-    showTheRoutinesTable():% == theRoutinesTable
-
-    integrationRoutine?(r:Record(key:Symbol,entry:Any)):Boolean ==
-      (a := retractIfCan(r.entry)$AnyFunctions1(Entry)) case Entry =>
-        elt(a,chapter) = "Integration"
-      false
-
-    selectIntegrationRoutines(R:%):% == select(integrationRoutine?,R)
-     
-    optimizationRoutine?(r:Record(key:Symbol,entry:Any)):Boolean ==
-      (a := retractIfCan(r.entry)$AnyFunctions1(Entry)) case Entry =>
-        elt(a,chapter) = "Optimization"
-      false
-
-    selectOptimizationRoutines(R:%):% == select(optimizationRoutine?,R)
-     
-    PDERoutine?(r:Record(key:Symbol,entry:Any)):Boolean ==
-      (a := retractIfCan(r.entry)$AnyFunctions1(Entry)) case Entry =>
-        elt(a,chapter) = "PDE"
-      false
-
-    selectPDERoutines(R:%):% == select(PDERoutine?,R)
-     
-    ODERoutine?(r:Record(key:Symbol,entry:Any)):Boolean ==
-      (a := retractIfCan(r.entry)$AnyFunctions1(Entry)) case Entry =>
-        elt(a,chapter) = "ODE"
-      false
-
-    selectODEIVPRoutines(R:%):% == select(ODERoutine?,R)
-     
-    sumOfSquaresRoutine?(r:Record(key:Symbol,entry:Any)):Boolean ==
-      (a := retractIfCan(r.entry)$AnyFunctions1(Entry)) case Entry =>
-        elt(a,type) = "SS"
-      false
-
-    selectSumOfSquaresRoutines(R:%):% == select(sumOfSquaresRoutine?,R)
-
-    finiteRoutine?(r:Record(key:Symbol,entry:Any)):Boolean ==
-      (a := retractIfCan(r.entry)$AnyFunctions1(Entry)) case Entry =>
-        elt(a,type) = "One-dimensional finite"
-      false
-
-    selectFiniteRoutines(R:%):% == select(finiteRoutine?,R)
-
-    infiniteRoutine?(r:Record(key:Symbol,entry:Any)):Boolean ==
-      (a := retractIfCan(r.entry)$AnyFunctions1(Entry)) case Entry =>
-        elt(a,type) = "One-dimensional infinite"
-      false
-
-    semiInfiniteRoutine?(r:Record(key:Symbol,entry:Any)):Boolean ==
-      (a := retractIfCan(r.entry)$AnyFunctions1(Entry)) case Entry =>
-        elt(a,type) = "One-dimensional semi-infinite"
-      false
-
-    nonFiniteRoutine?(r:Record(key:Symbol,entry:Any)):Boolean ==
-      (semiInfiniteRoutine?(r) or infiniteRoutine?(r))
-
-    selectNonFiniteRoutines(R:%):% == select(nonFiniteRoutine?,R)
-
-    multiDimensionalRoutine?(r:Record(key:Symbol,entry:Any)):Boolean ==
-      (a := retractIfCan(r.entry)$AnyFunctions1(Entry)) case Entry =>
-        elt(a,type) = "Multi-dimensional"
-      false
-
-    selectMultiDimensionalRoutines(R:%):% == select(multiDimensionalRoutine?,R)
-
-    concat(a:%,b:%):% ==
-      membersOfa := (members(a)@List(Record(key:Symbol,entry:Any)))
-      membersOfb := (members(b)@List(Record(key:Symbol,entry:Any)))
-      allMembers:=
-        concat(membersOfa,membersOfb)$List(Record(key:Symbol,entry:Any))
-      construct(allMembers)
-
-    changeThreshhold(R:%,s:Symbol,newValue:F):% ==
-      (a := search(s,R)) case Any =>
-        e := retract(a)$AnyFunctions1(Entry)
-        e.defaultMin := newValue
-        a := coerce(e)$AnyFunctions1(Entry)
-        insert!([s,a],R)
-      error("changeThreshhold","Cannot find routine of that name")$ErrorFunctions
-      
-    changeMeasure(R:%,s:Symbol,newValue:F):% ==
-      (a := search(s,R)) case Any =>
-        e := retract(a)$AnyFunctions1(Entry)
-        e.measure := newValue
-        a := coerce(e)$AnyFunctions1(Entry)
-        insert!([s,a],R)
-      error("changeMeasure","Cannot find routine of that name")$ErrorFunctions
-      
-    getMeasure(R:%,s:Symbol):F ==
-      (a := search(s,R)) case Any =>
-        e := retract(a)$AnyFunctions1(Entry)
-        e.measure
-      error("getMeasure","Cannot find routine of that name")$ErrorFunctions
-
-    deleteRoutine!(R:%,s:Symbol):% ==
-      (a := search(s,R)) case Any =>
-        e:Record(key:Symbol,entry:Any) := [s,a]
-        remove!(e,R)
-      error("deleteRoutine!","Cannot find routine of that name")$ErrorFunctions
-
-    routines():% ==
-      f := "One-dimensional finite"
-      s := "One-dimensional semi-infinite"
-      i := "One-dimensional infinite"
-      m := "Multi-dimensional"
-      int := "Integration"
-      ode := "ODE"
-      pde := "PDE"
-      opt := "Optimization"
-      d01ajfExplList:LST := ["result:  Calculated value of the integral",
-                                 "iw:  iw(1) contains the actual number of sub-intervals used, the rest is workspace",
-                                  "w:  contains the end-points of the sub-intervals used along with the integral contributions and error estimates over the sub-intervals",
-                                   "abserr:  the estimate of the absolute error of the result",
-                                    "ifail:  the error warning parameter",
-                                     "method:  details of the method used and measures of all methods",
-                                      "attributes:  a list of the attributes pertaining to the integrand which had some bearing on the choice of method"]
-      d01asfExplList:LST := ["result:  Calculated value of the integral",
-                                 "iw:  iw(1) contains the actual number of sub-intervals used, the rest is workspace",
-                                  "lst:  contains the actual number of sub-intervals used",
-                                   "erlst:  contains the error estimates over the sub-intervals",
-                                    "rslst:  contains the integral contributions of the sub-intervals",
-                                     "ierlst:  contains the error flags corresponding to the values in rslst",
-                                      "abserr:  the estimate of the absolute error of the result",
-                                       "ifail:  the error warning parameter",
-                                        "method:  details of the method used and measures of all methods",
-                                         "attributes:  a list of the attributes pertaining to the integrand which had some bearing on the choice of method"]
-      d01fcfExplList:LST := ["result:  Calculated value of the integral",
-                                 "acc:  the estimate of the relative error of the result",
-                                  "minpts:  the number of integrand evaluations",
-                                   "ifail:  the error warning parameter",
-                                    "method:  details of the method used and measures of all methods",
-                                     "attributes:  a list of the attributes pertaining to the integrand which had some bearing on the choice of method"]
-      d01transExplList:LST := ["result:  Calculated value of the integral",
-                                   "abserr:  the estimate of the absolute error of the result",
-                                    "method:  details of the method and transformation used and measures of all methods",
-                                     "d01***AnnaTypeAnswer:  the individual results from the routines",
-                                      "attributes:  a list of the attributes pertaining to the integrand which had some bearing on the choice of method"]
-      d02bhfExplList:LST := ["x:  the value of x at the end of the calculation",
-                                  "y:  the computed values of Y\[1\]..Y\[n\] at x",
-                                   "tol:   the (possible) estimate of the error; this is not guarunteed",
-                                    "ifail:  the error warning parameter",
-                                     "method:  details of the method used and measures of all methods",
-                                      "intensityFunctions:  a list of the attributes and values pertaining to the ODE which had some bearing on the choice of method"]
-      d02bbfExplList:LST := concat(["result:  the computed values of the solution at the required points"],d02bhfExplList)$LST
-      d03eefExplList:LST := ["See the NAG On-line Documentation for D03EEF/D03EDF",
-                                  "u:  the computed solution u[i][j] is returned in u(i+(j-1)*ngx),for i = 1,2,..ngx; j = 1,2,..ngy"]
-      e04fdfExplList:LST := ["x:  the position of the minimum",
-                                  "objf:  the value of the objective function at x",
-                                   "ifail:  the error warning parameter",
-                                    "method:  details of the method used and measures of all methods",
-                                      "attributes:  a list of the attributes pertaining to the function or functions which had some bearing on the choice of method"]
-      e04dgfExplList:LST := concat(e04fdfExplList,
-                                        ["objgrd:  the values of the derivatives at x",
-                                          "iter:  the number of iterations performed"])$LST
-      e04jafExplList:LST := concat(e04fdfExplList,
-                                        ["bu:  the values of the upper bounds used",
-                                          "bl:  the values of the lower bounds used"])$LST
-      e04ucfExplList:LST := concat(e04dgfExplList,
-                                        ["istate:  the status of every constraint at x",
-                                          "clamda:  the QP multipliers for the last QP sub-problem",
-                                           "For other output parameters see the NAG On-line Documentation for E04UCF"])$LST
-      e04mbfExplList:LST := concat(e04fdfExplList,
-                                        ["istate:  the status of every constraint at x",
-                                          "clamda:  the Lagrange multipliers for each constraint"])$LST
-      d01ajfIfail:IFL := [[1,"incrFunEvals"], [2,"delete"], [3,"delete"], [4,"delete"],  
-                          [5,"delete"], [6,"delete"]]
-      d01akfIfail:IFL := [[1,"incrFunEvals"], [2,"delete"], [3,"delete"], [4,"delete"]]
-      d01alfIfail:IFL := [[1,"incrFunEvals"], [2,"delete"], [3,"delete"], [4,"delete"], 
-                          [5,"delete"], [6,"delete"], [7,"delete"]]
-      d01amfIfail:IFL := [[1,"incrFunEvals"], [2,"delete"], [3,"delete"], [4,"delete"], 
-                          [5,"delete"], [6,"delete"]]
-      d01anfIfail:IFL := [[1,"incrFunEvals"], [2,"delete"], [3,"delete"], [4,"delete"], 
-                          [5,"delete"], [6,"delete"], [7,"delete"]]
-      d01apfIfail:IFL :=
-        [[1,"incrFunEvals"], [2,"delete"], [3,"delete"], [4,"delete"], [5,"delete"]]
-      d01aqfIfail:IFL :=
-        [[1,"incrFunEvals"], [2,"delete"], [3,"delete"], [4,"delete"], [5,"delete"]]
-      d01asfIfail:IFL := [[1,"incrFunEvals"], [2,"delete"], [3,"delete"], [4,"delete"], 
-            [5,"delete"], [6,"delete"], [7,"delete"], [8,"delete"], [9,"delete"]]
-      d01fcfIfail:IFL := [[1,"delete"], [2,"incrFunEvals"], [3,"delete"]]
-      d01gbfIfail:IFL := [[1,"delete"], [2,"incrFunEvals"]]
-      d02bbfIfail:IFL := 
-        [[1,"delete"], [2,"decrease tolerance"], [3,"increase tolerance"],
-         [4,"delete"], [5,"delete"], [6,"delete"], [7,"delete"]]
-      d02bhfIfail:IFL := 
-        [[1,"delete"], [2,"decrease tolerance"], [3,"increase tolerance"],
-         [4,"no action"], [5,"delete"], [6,"delete"], [7,"delete"]]
-      d02cjfIfail:IFL := 
-        [[1,"delete"], [2,"decrease tolerance"], [3,"increase tolerance"],
-         [4,"delete"], [5,"delete"], [6,"no action"], [7,"delete"]]
-      d02ejfIfail:IFL := 
-        [[1,"delete"], [2,"decrease tolerance"], [3,"increase tolerance"],
-         [4,"delete"], [5,"delete"], [6,"no action"], [7,"delete"], [8,"delete"],
-          [9,"delete"]]
-      e04dgfIfail:IFL := [[3,"delete"], [4,"no action"], [6,"delete"], 
-                          [7,"delete"], [8,"delete"], [9,"delete"]]
-      e04fdfIfail:IFL := 
-        [[1,"delete"], [2,"delete"], [3,"delete"], [4,"delete"], 
-          [5,"no action"], [6,"no action"], [7,"delete"], [8,"delete"]]
-      e04gcfIfail:IFL := [[1,"delete"], [2,"delete"], [3,"delete"], [4,"delete"], 
-        [5,"no action"], [6,"no action"], [7,"delete"], [8,"delete"], [9,"delete"]]
-      e04jafIfail:IFL := [[1,"delete"], [2,"delete"], [3,"delete"], [4,"delete"], 
-        [5,"no action"], [6,"no action"], [7,"delete"], [8,"delete"], [9,"delete"]]
-      e04mbfIfail:IFL := 
-        [[1,"delete"], [2,"delete"], [3,"delete"], [4,"delete"], [5,"delete"]]
-      e04nafIfail:IFL := 
-        [[1,"delete"], [2,"delete"], [3,"delete"], [4,"delete"], [5,"delete"],
-          [6,"delete"], [7,"delete"], [8,"delete"], [9,"delete"]]
-      e04ucfIfail:IFL := [[1,"delete"], [2,"delete"], [3,"delete"], [4,"delete"], 
-        [5,"delete"], [6,"delete"], [7,"delete"], [8,"delete"], [9,"delete"]]
-      d01ajfEntry:Entry := [int, f, "d01ajfAnnaType",0.4,0.4,d01ajfIfail,d01ajfExplList]
-      d01akfEntry:Entry := [int, f, "d01akfAnnaType",0.6,1.0,d01akfIfail,d01ajfExplList]
-      d01alfEntry:Entry := [int, f, "d01alfAnnaType",0.6,0.6,d01alfIfail,d01ajfExplList]
-      d01amfEntry:Entry := [int, i, "d01amfAnnaType",0.5,0.5,d01amfIfail,d01ajfExplList]
-      d01anfEntry:Entry := [int, f, "d01anfAnnaType",0.6,0.9,d01anfIfail,d01ajfExplList]
-      d01apfEntry:Entry := [int, f, "d01apfAnnaType",0.7,0.7,d01apfIfail,d01ajfExplList]
-      d01aqfEntry:Entry := [int, f, "d01aqfAnnaType",0.6,0.7,d01aqfIfail,d01ajfExplList]
-      d01asfEntry:Entry := [int, s, "d01asfAnnaType",0.6,0.9,d01asfIfail,d01asfExplList]
-      d01transEntry:Entry:=[int, i, "d01TransformFunctionType",0.6,0.9,[],d01transExplList]
-      d01gbfEntry:Entry := [int, m, "d01gbfAnnaType",0.6,0.6,d01gbfIfail,d01fcfExplList]
-      d01fcfEntry:Entry := [int, m, "d01fcfAnnaType",0.5,0.5,d01fcfIfail,d01fcfExplList]
-      d02bbfEntry:Entry := [ode, "IVP", "d02bbfAnnaType",0.7,0.5,d02bbfIfail,d02bbfExplList]
-      d02bhfEntry:Entry := [ode, "IVP", "d02bhfAnnaType",0.7,0.49,d02bhfIfail,d02bhfExplList]
-      d02cjfEntry:Entry := [ode, "IVP", "d02cjfAnnaType",0.7,0.5,d02cjfIfail,d02bbfExplList]
-      d02ejfEntry:Entry := [ode, "IVP", "d02ejfAnnaType",0.7,0.5,d02ejfIfail,d02bbfExplList]
-      d03eefEntry:Entry := [pde, "2", "d03eefAnnaType",0.6,0.5,[],d03eefExplList]
-      --d03fafEntry:Entry := [pde, "3", "d03fafAnnaType",0.6,0.5,[],[]]
-      e04dgfEntry:Entry := [opt, "CGA", "e04dgfAnnaType",0.4,0.4,e04dgfIfail,e04dgfExplList]
-      e04fdfEntry:Entry := [opt, "SS", "e04fdfAnnaType",0.7,0.7,e04fdfIfail,e04fdfExplList]
-      e04gcfEntry:Entry := [opt, "SS", "e04gcfAnnaType",0.8,0.8,e04gcfIfail,e04fdfExplList]
-      e04jafEntry:Entry := [opt, "QNA", "e04jafAnnaType",0.5,0.5,e04jafIfail,e04jafExplList]
-      e04mbfEntry:Entry := [opt, "LP", "e04mbfAnnaType",0.7,0.7,e04mbfIfail,e04mbfExplList]
-      e04nafEntry:Entry := [opt, "QP", "e04nafAnnaType",0.7,0.7,e04nafIfail,e04mbfExplList]
-      e04ucfEntry:Entry := [opt, "SQP", "e04ucfAnnaType",0.6,0.6,e04ucfIfail,e04ucfExplList]
-      rl:RList :=
-        [["d01apf" :: Symbol, coerce(d01apfEntry)$AnyFunctions1(Entry)],_
-         ["d01aqf" :: Symbol, coerce(d01aqfEntry)$AnyFunctions1(Entry)],_
-         ["d01alf" :: Symbol, coerce(d01alfEntry)$AnyFunctions1(Entry)],_
-         ["d01anf" :: Symbol, coerce(d01anfEntry)$AnyFunctions1(Entry)],_
-         ["d01akf" :: Symbol, coerce(d01akfEntry)$AnyFunctions1(Entry)],_
-         ["d01ajf" :: Symbol, coerce(d01ajfEntry)$AnyFunctions1(Entry)],_
-         ["d01asf" :: Symbol, coerce(d01asfEntry)$AnyFunctions1(Entry)],_
-         ["d01amf" :: Symbol, coerce(d01amfEntry)$AnyFunctions1(Entry)],_
-         ["d01transform" :: Symbol, coerce(d01transEntry)$AnyFunctions1(Entry)],_
-         ["d01gbf" :: Symbol, coerce(d01gbfEntry)$AnyFunctions1(Entry)],_
-         ["d01fcf" :: Symbol, coerce(d01fcfEntry)$AnyFunctions1(Entry)],_
-         ["d02bbf" :: Symbol, coerce(d02bbfEntry)$AnyFunctions1(Entry)],_
-         ["d02bhf" :: Symbol, coerce(d02bhfEntry)$AnyFunctions1(Entry)],_
-         ["d02cjf" :: Symbol, coerce(d02cjfEntry)$AnyFunctions1(Entry)],_
-         ["d02ejf" :: Symbol, coerce(d02ejfEntry)$AnyFunctions1(Entry)],_
-         ["d03eef" :: Symbol, coerce(d03eefEntry)$AnyFunctions1(Entry)],_
-         --["d03faf" :: Symbol, coerce(d03fafEntry)$AnyFunctions1(Entry)],
-         ["e04dgf" :: Symbol, coerce(e04dgfEntry)$AnyFunctions1(Entry)],_
-         ["e04fdf" :: Symbol, coerce(e04fdfEntry)$AnyFunctions1(Entry)],_
-         ["e04gcf" :: Symbol, coerce(e04gcfEntry)$AnyFunctions1(Entry)],_
-         ["e04jaf" :: Symbol, coerce(e04jafEntry)$AnyFunctions1(Entry)],_
-         ["e04mbf" :: Symbol, coerce(e04mbfEntry)$AnyFunctions1(Entry)],_
-         ["e04naf" :: Symbol, coerce(e04nafEntry)$AnyFunctions1(Entry)],_
-         ["e04ucf" :: Symbol, coerce(e04ucfEntry)$AnyFunctions1(Entry)]]
-      construct(rl)
-
-    getIFL(s:Symbol,l:%):Union(IFL,"failed") ==
-      o := search(s,l)$%
-      o case "failed" => "failed"
-      e := retractIfCan(o)$AnyFunctions1(Entry)
-      e case "failed" => "failed"
-      e.failList
-
-    getInstruction(l:IFL,ifailValue:Integer):Union(ST,"failed") ==
-      output := empty()$ST
-      for i in 1..#l repeat
-        if ((l.i).ifail=ifailValue)@Boolean then 
-          output := (l.i).instruction
-      empty?(output)$ST => "failed"
-      output
-
-    recoverAfterFail(routs:%,routineName:ST,
-                      ifailValue:Integer):Union(ST,"failed") ==
-      name := routineName :: Symbol
-      failedList := getIFL(name,routs)
-      failedList case "failed" => "failed"
-      empty? failedList => "failed"
-      instr := getInstruction(failedList,ifailValue)
-      instr case "failed" => concat(routineName," failed")$ST
-      (instr = "delete")@Boolean => 
-        deleteRoutine!(routs,name)
-        concat(routineName," failed - trying alternatives")$ST
-      instr
-
-    getExplanations(R:%,routineName:ST):LST ==
-      name := routineName :: Symbol
-      (a := search(name,R)) case Any => 
-        e := retract(a)$AnyFunctions1(Entry)
-        e.explList
-      empty()$LST
-
-@
-\section{domain ATTRBUT AttributeButtons}
-<<domain ATTRBUT AttributeButtons>>=
-)abbrev domain ATTRBUT AttributeButtons
-++ Author: Brian Dupee
-++ Date Created: April 1996
-++ Date Last Updated: December 1997
-++ Basic Operations: increase, decrease, getButtonValue, setButtonValue
-++ Related Constructors: Table(String,Float)
-++ Description:
-++ \axiomType{AttributeButtons} implements a database and associated
-++ adjustment mechanisms for a set of attributes.
-++
-++ For ODEs these attributes are "stiffness", "stability" (i.e. how much
-++ affect the cosine or sine component of the solution has on the stability of
-++ the result), "accuracy" and "expense" (i.e. how expensive is the evaluation
-++ of the ODE).  All these have bearing on the cost of calculating the 
-++ solution given that reducing the step-length to achieve greater accuracy 
-++ requires considerable number of evaluations and calculations.
-++
-++ The effect of each of these attributes can be altered by increasing or
-++ decreasing the button value.
-++
-++ For Integration there is a button for increasing and decreasing the preset
-++ number of function evaluations for each method.  This is automatically used
-++ by ANNA when a method fails due to insufficient workspace or where the
-++ limit of function evaluations has been reached before the required
-++ accuracy is achieved. 
-++ 
-AttributeButtons(): E == I where
-  F	==> Float
-  ST	==> String
-  LST	==> List String
-  Rec	==> Record(key:Symbol,entry:Any)
-  RList	==> List(Record(key:Symbol,entry:Any))
-  IFL	==> List(Record(ifail:Integer,instruction:ST))
-  Entry	==> Record(chapter:ST, type:ST, domainName: ST, 
-                     defaultMin:F, measure:F, failList:IFL, explList:LST)
-
-
-  E ==> SetCategory with
-
-    increase:(ST,ST) -> F
-      ++ \axiom{increase(routineName,attributeName)} increases the value
-      ++ for the effect of the attribute \axiom{attributeName} with routine 
-      ++ \axiom{routineName}.
-      ++
-      ++ \axiom{attributeName} should be one of the values
-      ++ "stiffness", "stability", "accuracy", "expense" or
-      ++ "functionEvaluations".
-    increase:(ST) -> F
-      ++ \axiom{increase(attributeName)} increases the value for the
-      ++ effect of the attribute \axiom{attributeName} with all routines.
-      ++
-      ++ \axiom{attributeName} should be one of the values
-      ++ "stiffness", "stability", "accuracy", "expense" or
-      ++ "functionEvaluations".
-    decrease:(ST,ST) -> F
-      ++ \axiom{decrease(routineName,attributeName)} decreases the value
-      ++ for the effect of the attribute \axiom{attributeName} with routine
-      ++ \axiom{routineName}.
-      ++
-      ++ \axiom{attributeName} should be one of the values
-      ++ "stiffness", "stability", "accuracy", "expense" or
-      ++ "functionEvaluations".
-    decrease:(ST) -> F
-      ++ \axiom{decrease(attributeName)} decreases the value for the
-      ++ effect of the attribute \axiom{attributeName} with all routines.
-      ++
-      ++ \axiom{attributeName} should be one of the values
-      ++ "stiffness", "stability", "accuracy", "expense" or
-      ++ "functionEvaluations".
-    getButtonValue:(ST,ST) -> F
-      ++ \axiom{getButtonValue(routineName,attributeName)} returns the 
-      ++ current value for the effect of the attribute \axiom{attributeName}  
-      ++ with routine \axiom{routineName}.
-      ++
-      ++ \axiom{attributeName} should be one of the values
-      ++ "stiffness", "stability", "accuracy", "expense" or
-      ++ "functionEvaluations".
-    resetAttributeButtons:() -> Void 
-      ++ \axiom{resetAttributeButtons()} resets the Attribute buttons to a 
-      ++ neutral level.
-    setAttributeButtonStep:(F) -> F
-      ++ \axiom{setAttributeButtonStep(n)} sets the value of the steps for 
-      ++ increasing and decreasing the button values. \axiom{n} must be 
-      ++ greater than 0 and less than 1.  The preset value is 0.5.
-    setButtonValue:(ST,F) -> F
-      ++ \axiom{setButtonValue(attributeName,n)} sets the
-      ++ value of all buttons of attribute \spad{attributeName}
-      ++ to \spad{n}. \spad{n} must be in the range [0..1].
-      ++
-      ++ \axiom{attributeName} should be one of the values
-      ++ "stiffness", "stability", "accuracy", "expense" or
-      ++ "functionEvaluations".
-    setButtonValue:(ST,ST,F) -> F
-      ++ \axiom{setButtonValue(attributeName,routineName,n)} sets the
-      ++ value of the button of attribute \spad{attributeName} to routine
-      ++ \spad{routineName} to \spad{n}. \spad{n} must be in the range [0..1].
-      ++
-      ++ \axiom{attributeName} should be one of the values
-      ++ "stiffness", "stability", "accuracy", "expense" or
-      ++ "functionEvaluations".
-    finiteAggregate
-
-  I ==> add
-
-    Rep := StringTable(F)
-    import Rep
-
-    buttons:() -> $
-
-    buttons():$ == 
-      eList := empty()$List(Record(key:ST,entry:F))
-      l1:List String := ["stability","stiffness","accuracy","expense"]
-      l2:List String := ["functionEvaluations"]
-      ro1 := selectODEIVPRoutines(r := routines()$RoutinesTable)$RoutinesTable
-      ro2 := selectIntegrationRoutines(r)$RoutinesTable
-      k1:List String := [string(i)$Symbol for i in keys(ro1)$RoutinesTable]
-      k2:List String := [string(i)$Symbol for i in keys(ro2)$RoutinesTable]
-      for i in k1 repeat
-        for j in l1 repeat
-          e:Record(key:ST,entry:F) := [i j,0.5]
-          eList := cons(e,eList)$List(Record(key:ST,entry:F))
-      for i in k2 repeat
-        for j in l2 repeat
-          e:Record(key:ST,entry:F) := [i j,0.5]
-          eList := cons(e,eList)$List(Record(key:ST,entry:F))
-      construct(eList)$Rep
-
-    attributeButtons:$ := buttons()
-
-    attributeStep:F := 0.5
-
-    setAttributeButtonStep(n:F):F ==
-      positive?(n)$F and (n<1$F) => attributeStep:F := n
-      error("setAttributeButtonStep","New value must be in (0..1)")$ErrorFunctions
-
-    resetAttributeButtons():Void ==
-      attributeButtons := buttons()
-      void()$Void
-
-    setButtonValue(routineName:ST,attributeName:ST,n:F):F ==
-      f := search(routineName attributeName,attributeButtons)$Rep
-      f case Float => 
-        n>=0$F and n<=1$F => 
-          setelt(attributeButtons,routineName attributeName,n)$Rep
-        error("setAttributeButtonStep","New value must be in [0..1]")$ErrorFunctions
-      error("setButtonValue","attribute name " attributeName 
-             " not found for routine " routineName)$ErrorFunctions
-
-    setButtonValue(attributeName:ST,n:F):F ==
-      ro1 := selectODEIVPRoutines(r := routines()$RoutinesTable)$RoutinesTable
-      ro2 := selectIntegrationRoutines(r)$RoutinesTable
-      l1:List String := ["stability","stiffness","accuracy","expense"]
-      l2:List String := ["functionEvaluations"]
-      if attributeName="functionEvaluations" then
-        for i in keys(ro2)$RoutinesTable repeat
-          setButtonValue(string(i)$Symbol,attributeName,n)
-      else
-        for i in keys(ro1)$RoutinesTable repeat
-          setButtonValue(string(i)$Symbol,attributeName,n)
-      n
-
-    increase(routineName:ST,attributeName:ST):F ==
-      f := search(routineName attributeName,attributeButtons)$Rep
-      f case Float => 
-        newValue:F := (1$F-attributeStep)*f+attributeStep
-        setButtonValue(routineName,attributeName,newValue)
-      error("increase","attribute name " attributeName 
-             " not found for routine " routineName)$ErrorFunctions
-
-    increase(attributeName:ST):F ==
-      ro1 := selectODEIVPRoutines(r := routines()$RoutinesTable)$RoutinesTable
-      ro2 := selectIntegrationRoutines(r)$RoutinesTable
-      l1:List String := ["stability","stiffness","accuracy","expense"]
-      l2:List String := ["functionEvaluations"]
-      if attributeName="functionEvaluations" then
-        for i in keys(ro2)$RoutinesTable repeat
-          increase(string(i)$Symbol,attributeName)
-      else
-        for i in keys(ro1)$RoutinesTable repeat
-          increase(string(i)$Symbol,attributeName)
-      getButtonValue(string(i)$Symbol,attributeName)
-
-    decrease(routineName:ST,attributeName:ST):F ==
-      f := search(routineName attributeName,attributeButtons)$Rep
-      f case Float => 
-        newValue:F := (1$F-attributeStep)*f
-        setButtonValue(routineName,attributeName,newValue)
-      error("increase","attribute name " attributeName 
-             " not found for routine " routineName)$ErrorFunctions
-
-    decrease(attributeName:ST):F ==
-      ro1 := selectODEIVPRoutines(r := routines()$RoutinesTable)$RoutinesTable
-      ro2 := selectIntegrationRoutines(r)$RoutinesTable
-      l1:List String := ["stability","stiffness","accuracy","expense"]
-      l2:List String := ["functionEvaluations"]
-      if attributeName="functionEvaluations" then
-        for i in keys(ro2)$RoutinesTable repeat
-          decrease(string(i)$Symbol,attributeName)
-      else
-        for i in keys(ro1)$RoutinesTable repeat
-          decrease(string(i)$Symbol,attributeName)
-      getButtonValue(string(i)$Symbol,attributeName)
-
-
-    getButtonValue(routineName:ST,attributeName:ST):F == 
-      f := search(routineName attributeName,attributeButtons)$Rep
-      f case Float => f
-      error("getButtonValue","attribute name " attributeName 
-              " not found for routine " routineName)$ErrorFunctions
-
-@
-\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 ROUTINE RoutinesTable>>
-<<domain ATTRBUT AttributeButtons>>
-@
-\eject
-\begin{thebibliography}{99}
-\bibitem{1} nothing
-\end{thebibliography}
-\end{document}
diff --git a/src/algebra/rule.spad.pamphlet b/src/algebra/rule.spad.pamphlet
index ce3011b..daadf27 100644
--- a/src/algebra/rule.spad.pamphlet
+++ b/src/algebra/rule.spad.pamphlet
@@ -9,139 +9,6 @@
 \eject
 \tableofcontents
 \eject
-\section{domain RULE RewriteRule}
-<<domain RULE RewriteRule>>=
-)abbrev domain RULE RewriteRule
-++ Rules for the pattern matcher
-++ Author: Manuel Bronstein
-++ Date Created: 24 Oct 1988
-++ Date Last Updated: 26 October 1993
-++ Keywords: pattern, matching, rule.
-RewriteRule(Base, R, F): Exports == Implementation where
-  Base   : SetCategory
-  R      : Join(Ring, PatternMatchable Base, OrderedSet,
-                                 ConvertibleTo Pattern Base)
-  F      : Join(FunctionSpace R, PatternMatchable Base,
-                                 ConvertibleTo Pattern Base)
-
-  P    ==> Pattern Base
-
-  Exports ==>
-   Join(SetCategory, Eltable(F, F), RetractableTo Equation F) with
-    rule    : (F, F) -> $
-      ++ rule(f, g) creates the rewrite rule: \spad{f == eval(g, g is f)},
-      ++ with left-hand side f and right-hand side g.
-    rule    : (F, F, List Symbol) -> $
-      ++ rule(f, g, [f1,...,fn]) creates the rewrite rule
-      ++ \spad{f == eval(eval(g, g is f), [f1,...,fn])},
-      ++ that is a rule with left-hand side f and right-hand side g;
-      ++ The symbols f1,...,fn are the operators that are considered
-      ++ quoted, that is they are not evaluated during any rewrite,
-      ++ but just applied formally to their arguments.
-    suchThat: ($, List Symbol, List F -> Boolean) -> $
-      ++ suchThat(r, [a1,...,an], f) returns the rewrite rule r with
-      ++ the predicate \spad{f(a1,...,an)} attached to it.
-    pattern : $ -> P
-      ++ pattern(r) returns the pattern corresponding to
-      ++ the left hand side of the rule r.
-    lhs     : $ -> F
-      ++ lhs(r) returns the left hand side of the rule r.
-    rhs     : $ -> F
-      ++ rhs(r) returns the right hand side of the rule r.
-    elt     : ($, F, PositiveInteger) -> F
-      ++ elt(r,f,n) or r(f, n) applies the rule r to f at most n times.
-    quotedOperators: $ -> List Symbol
-      ++ quotedOperators(r) returns the list of operators
-      ++ on the right hand side of r that are considered
-      ++ quoted, that is they are not evaluated during any rewrite,
-      ++ but just applied formally to their arguments.
-
-  Implementation ==> add
-    import ApplyRules(Base, R, F)
-    import PatternFunctions1(Base, F)
-    import FunctionSpaceAssertions(R, F)
-
-    Rep := Record(pat: P, lft: F, rgt: F, qot: List Symbol)
-
-    mkRule      : (P, F, F, List Symbol) -> $
-    transformLhs: P -> Record(plus: F, times: F)
-    bad?        : Union(List P, "failed") -> Boolean
-    appear?     : (P, List P) -> Boolean
-    opt         : F -> P
-    F2Symbol    : F -> F
-
-    pattern x                == x.pat
-    lhs x                    == x.lft
-    rhs x                    == x.rgt
-    quotedOperators x        == x.qot
-    mkRule(pt, p, s, l)      == [pt, p, s, l]
-    coerce(eq:Equation F):$  == rule(lhs eq, rhs eq, empty())
-    rule(l, r)               == rule(l, r, empty())
-    elt(r:$, s:F) == applyRules([r pretend RewriteRule(Base, R, F)], s)
-
-    suchThat(x, l, f) ==
-      mkRule(suchThat(pattern x,l,f),  lhs x, rhs x, quotedOperators x)
-
-    x = y ==
-     (lhs x = lhs y) and (rhs x = rhs y) and
-        (quotedOperators x = quotedOperators y)
-
-    elt(r:$, s:F, n:PositiveInteger) ==
-      applyRules([r pretend RewriteRule(Base, R, F)], s, n)
-
--- remove the extra properties from the constant symbols in f
-    F2Symbol f ==
-      l := select_!(symbolIfCan #1 case Symbol, tower f)$List(Kernel F)
-      eval(f, l, [symbolIfCan(k)::Symbol::F for k in l])
-
-    retractIfCan r ==
-      constant? pattern r =>
-        (u:= retractIfCan(lhs r)@Union(Kernel F,"failed")) case "failed"
-          => "failed"
-        F2Symbol(u::Kernel(F)::F) = rhs r
-      "failed"
-
-    rule(p, s, l) ==
-      lh := transformLhs(pt := convert(p)@P)
-      mkRule(opt(lh.times) * (opt(lh.plus) + pt),
-             lh.times * (lh.plus + p), lh.times * (lh.plus + s), l)
-
-    opt f ==
-      retractIfCan(f)@Union(R, "failed") case R => convert f
-      convert optional f
-
--- appear?(x, [p1,...,pn]) is true if x appears as a variable in
--- a composite pattern pi.
-    appear?(x, l) ==
-      for p in l | p ^= x repeat
-        member?(x, variables p) => return true
-      false
-
--- a sum/product p1 @ ... @ pn is "bad" if it will not match
--- a sum/product p1 @ ... @ pn @ p(n+1)
--- in which case one should transform p1 @ ... @ pn to
--- p1 @ ... @ ?p(n+1) which does not change its meaning.
--- examples of "bad" combinations
---   sin(x) @ sin(y)     sin(x) @ x
--- examples of "good" combinations
---   sin(x) @ y
-    bad? u ==
-      u case List(P) =>
-        for x in u::List(P) repeat
-          generic? x and not appear?(x, u::List(P)) => return false
-        true
-      false
-
-    transformLhs p ==
-      bad? isPlus p  => [new()$Symbol :: F, 1]
-      bad? isTimes p => [0, new()$Symbol :: F]
-      [0, 1]
-
-    coerce(x:$):OutputForm ==
-      infix(" == "::Symbol::OutputForm,
-            lhs(x)::OutputForm, rhs(x)::OutputForm)
-
-@
 \section{package APPRULE ApplyRules}
 <<package APPRULE ApplyRules>>=
 )abbrev package APPRULE ApplyRules
@@ -262,46 +129,6 @@ ApplyRules(Base, R, F): Exports == Implementation where
       subject
 
 @
-\section{domain RULESET Ruleset}
-<<domain RULESET Ruleset>>=
-)abbrev domain RULESET Ruleset
-++ Sets of rules for the pattern matcher
-++ Author: Manuel Bronstein
-++ Date Created: 20 Mar 1990
-++ Date Last Updated: 29 Jun 1990
-++ Description:
-++   A ruleset is a set of pattern matching rules grouped together.
-++ Keywords: pattern, matching, rule.
-Ruleset(Base, R, F): Exports == Implementation where
-  Base   : SetCategory
-  R      : Join(Ring, PatternMatchable Base, OrderedSet,
-                                 ConvertibleTo Pattern Base)
-  F      : Join(FunctionSpace R, PatternMatchable Base,
-                                 ConvertibleTo Pattern Base)
-
-  RR ==> RewriteRule(Base, R, F)
-
-  Exports ==> Join(SetCategory, Eltable(F, F)) with
-    ruleset: List RR -> $
-      ++ ruleset([r1,...,rn]) creates the rule set \spad{{r1,...,rn}}.
-    rules  : $ -> List RR
-      ++ rules(r) returns the rules contained in r.
-    elt    : ($, F, PositiveInteger) -> F
-      ++ elt(r,f,n) or r(f, n) applies all the rules of r to f at most n times.
-
-  Implementation ==> add
-    import ApplyRules(Base, R, F)
-
-    Rep := Set RR
-
-    ruleset l                        == {l}$Rep
-    coerce(x:$):OutputForm           == coerce(x)$Rep
-    x = y                            == x =$Rep y
-    elt(x:$, f:F)                    == applyRules(rules x, f)
-    elt(r:$, s:F, n:PositiveInteger) == applyRules(rules r, s, n)
-    rules x                          == parts(x)$Rep
-
-@
 \section{License}
 <<license>>=
 --Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd.
@@ -338,9 +165,7 @@ Ruleset(Base, R, F): Exports == Implementation where
 <<*>>=
 <<license>>
 
-<<domain RULE RewriteRule>>
 <<package APPRULE ApplyRules>>
-<<domain RULESET Ruleset>>
 @
 \eject
 \begin{thebibliography}{99}
diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html
index 9369a9f..2615787 100644
--- a/src/axiom-website/patches.html
+++ b/src/axiom-website/patches.html
@@ -801,6 +801,8 @@ bookvol10.3 add domains<br/>
 lisp move to GCL-pre3<br/>
 <a href="patches/20081213.02.tpd.patch">20081213.02.tpd.patch</a>
 bookvol10.3 add domains<br/>
+<a href="patches/20081214.01.tpd.patch">20081214.01.tpd.patch</a>
+bookvol10.3 add domains<br/>
 
  </body>
 </html>
\ No newline at end of file
