diff --git a/books/bookvol4.pamphlet b/books/bookvol4.pamphlet index 5e743fb..c0f199d 100644 --- a/books/bookvol4.pamphlet +++ b/books/bookvol4.pamphlet @@ -1,9 +1,336 @@ \documentclass[dvipdfm]{book} -\newcommand{\VolumeName}{Volume 4: Axiom Developers Guide} -\input{bookheader.tex} -\mainmatter +\usepackage{hyperref} +\usepackage{axiom} +\usepackage{makeidx} +\setlength{\textwidth}{400pt} +\makeindex +\usepackage{graphicx} +% struggle with latex figure-floating behavior +\renewcommand\floatpagefraction{.9} +\renewcommand\topfraction{.9} +\renewcommand\bottomfraction{.9} +\renewcommand\textfraction{.1} +\setcounter{totalnumber}{50} +\setcounter{topnumber}{50} +\setcounter{bottomnumber}{50} + + +%% spadgraph are the actual text that you type at the axiom prompt for draw +\providecommand{\spadgraph}[1]% +{\begin{flushleft}{\tt #1}\end{flushleft}\vskip .1cm } + +% spadfunFrom records the function name and domain in the index +\providecommand{\spadfunFrom}[2]% +{{\bf #1}\index{#1 @\begingroup \string\bf{} #1 \endgroup}\index{#2}} + +%% spadsig gives the standard -> notation for signatures +\providecommand{\spadsig}[2]{{\sf #1 $\rightarrow$ #2}} + +% special meanings for math characters +\providecommand{\N}{\mbox{\bbold N}} +\providecommand{\Natural}{\mbox{\bbold N}} +\providecommand{\Z}{\mbox{\bbold Z}} +\providecommand{\Integer}{\mbox{\bbold Z}} +\providecommand{\Rational}{\mbox{\bbold Q}} +\providecommand{\Q}{\mbox{\bbold Q}} +\providecommand{\Complex}{\mbox{\bbold C}} +\providecommand{\C}{{\mathcal C}} +\providecommand{\Real}{\mbox{\bbold R}} +\providecommand{\F}{{\mathcal F}} +\providecommand{\R}{{\mathcal R}} + +% draw a box around a text block +\providecommand\boxed[2]{% +\begin{center} +\begin{tabular}{|c|} +\hline +\begin{minipage}{#1} +\normalsize +{#2} +\end{minipage}\\ +\hline +\end{tabular} +\end{center}} + +\providecommand{\optArg}[1]{{{\tt [}{#1}{\tt ]}}} +\providecommand{\argDef}[1]{{\tt ({#1})}} +\providecommand{\funSyntax}[2]{{\bf #1}{\tt ({\small\it{#2}})}} +\providecommand{\funArgs}[1]{{\tt ({\small\it {#1}})}\newline} +\providecommand{\condata}[4]{{\bf #1} {\bf #2} {\bf #3} {\bf #4}} + +\def\glossaryTerm#1{{\bf #1}\index{#1}} +\def\glossaryTermNoIndex#1{{\bf #1}} +\def\glossarySyntaxTerm#1{{\tt #1}\index{#1}} +\long\def\ourGloss#1#2{\par\pagebreak[3]{#1}\newline{#2}} +\def\csch{\mathop{\rm csch}\nolimits} + +\def\erf{\mathop{\rm erf}\nolimits} + +\def\zag#1#2{ + {{\hfill \left. {#1} \right|} + \over + {\left| {#2} \right. \hfill} + } +} + + +% these bitmaps are used by HyperDoc +\newdimen\commentWidth +\commentWidth=11pc +\newdimen\colGutterWidth +\colGutterWidth=1pc +\newdimen\baseLeftSkip +\baseLeftSkip=\commentWidth \advance\baseLeftSkip by \colGutterWidth + +\providecommand\ExitBitmap% +{{\setlength{\unitlength}{0.01in}% +\begin{picture}(50,16)(0,0)\special{psfile=ps/exit.ps}\end{picture}}} + +\providecommand\ReturnBitmap% +{{\setlength{\unitlength}{0.01in}% +\begin{picture}(50,16)(0,0)\special{psfile=ps/home.ps}\end{picture}}} + +\providecommand\HelpBitmap% +{{\setlength{\unitlength}{0.01in}% +\begin{picture}(50,16)(0,0)\special{psfile=ps/help.ps}\end{picture}}} + +\providecommand\UpBitmap% +{{\setlength{\unitlength}{0.01in}% +\begin{picture}(50,16)(0,0)\special{psfile=ps/up.ps}\end{picture}}} + +\providecommand{\tpd}[5]% +{{\setlength{\unitlength}{0.01in}% +\begin{picture}(#1,#2)(#3,#4)\special{psfile=#5}\end{picture}}} + +\begin{document} +\begin{titlepage} +\center{\includegraphics{ps/axiomfront.ps}} +\vskip 0.1in +\includegraphics{ps/bluebayou.ps}\\ +\vskip 0.1in +{\Huge{The 30 Year Horizon}} +\vskip 0.1in +$$ +\begin{array}{lll} +Manuel\ Bronstein & William\ Burge & Timothy\ Daly \\ +James\ Davenport & Michael\ Dewar & Martin\ Dunstan \\ +Albrecht\ Fortenbacher & Patrizia\ Gianni & Johannes\ Grabmeier \\ +Jocelyn\ Guidry & Richard\ Jenks & Larry\ Lambe \\ +Michael\ Monagan & Scott\ Morrison & William\ Sit \\ +Jonathan\ Steinbach & Robert\ Sutor & Barry\ Trager \\ +Stephen\ Watt & Jim\ Wen & Clifton\ Williamson +\end{array} +$$ +\center{\large{Volume 4: Axiom Developers Guide}} +\end{titlepage} +\pagenumbering{roman} +\begin{verbatim} +Portions Copyright (c) 2005 Timothy Daly + +The Blue Bayou image Copyright (c) 2004 Jocelyn Guidry + +Portions Copyright (c) 2004 Martin Dunstan + +Portions Copyright (c) 1991-2002, +The Numerical ALgorithms Group Ltd. +All rights reserved. + +This book and the Axiom software is licensed as follows: + +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. + +\end{verbatim} + +\vfill +\newpage +Inclusion of names in the list of credits is based on historical +information and is as accurate as possible. Inclusion of names +does not in any way imply an endorsement but represents historical +influence on Axiom development. + +\begin{tabular}{lll} +Michael Albaugh & Cyril Alberga & Roy Adler\\ +Christian Aistleitner & Richard Anderson & George Andrews\\ +S.J. Atkins & Henry Baker & Martin Baker\\ +Stephen Balzac & Yurij Baransky & David R. Barton\\ +Gerald Baumgartner & Gilbert Baumslag & Michael Becker\\ +Nelson H. F. Beebe & Jay Belanger & David Bindel\\ +Fred Blair & Vladimir Bondarenko & Mark Botch\\ +Raoul Bourquin & Alexandre Bouyer & Karen Braman\\ +Peter A. Broadbery & Martin Brock & Manuel Bronstein\\ +Stephen Buchwald & Florian Bundschuh & Luanne Burns\\ +William Burge & Ralph Byers & Quentin Carpent\\ +Robert Caviness & Bruce Char & Ondrej Certik\\ +Tzu-Yi Chen & Cheekai Chin & David V. Chudnovsky\\ +Gregory V. Chudnovsky & Mark Clements & James Cloos\\ +Jia Zhao Cong & Josh Cohen & Christophe Conil\\ +Don Coppersmith & George Corliss & Robert Corless\\ +Gary Cornell & Meino Cramer & Jeremy Du Croz\\ +David Cyganski & Nathaniel Daly & Timothy Daly Sr.\\ +Timothy Daly Jr. & James H. Davenport & David Day\\ +James Demmel & Didier Deshommes & Michael Dewar\\ +Jack Dongarra & Jean Della Dora & Gabriel Dos Reis\\ +Claire DiCrescendo & Sam Dooley & Lionel Ducos\\ +Iain Duff & Lee Duhem & Martin Dunstan\\ +Brian Dupee & Dominique Duval & Robert Edwards\\ +Heow Eide-Goodman & Lars Erickson & Richard Fateman\\ +Bertfried Fauser & Stuart Feldman & John Fletcher\\ +Brian Ford & Albrecht Fortenbacher & George Frances\\ +Constantine Frangos & Timothy Freeman & Korrinn Fu\\ +Marc Gaetano & Rudiger Gebauer & Van de Geijn\\ +Kathy Gerber & Patricia Gianni & Samantha Goldrich\\ +Holger Gollan & Teresa Gomez-Diaz & Laureano Gonzalez-Vega \\ +Stephen Gortler & Johannes Grabmeier & Matt Grayson\\ +Klaus Ebbe Grue & James Griesmer & Vladimir Grinberg\\ +Oswald Gschnitzer & Ming Gu & Jocelyn Guidry\\ +Gaetan Hache & Steve Hague & Satoshi Hamaguchi\\ +Sven Hammarling & Mike Hansen & Richard Hanson\\ +Richard Harke & Bill Hart & Vilya Harvey\\ +Martin Hassner & Arthur S. Hathaway & Dan Hatton\\ +Waldek Hebisch & Karl Hegbloom & Ralf Hemmecke\\ +\end{tabular} +\vfill +\newpage +\begin{tabular}{lll} +Henderson & Antoine Hersen & Roger House\\ +Gernot Hueber & Pietro Iglio & Alejandro Jakubi\\ +Richard Jenks & William Kahan & Kai Kaminski\\ +Grant Keady & Wilfrid Kendall & Tony Kennedy\\ +Ted Kosan & Paul Kosinski & Klaus Kusche\\ +Bernhard Kutzler & Tim Lahey & Larry Lambe\\ +Kaj Laurson & George L. Legendre & Franz Lehner\\ +Frederic Lehobey & Michel Levaud & Howard Levy\\ +Ren-Cang Li & Rudiger Loos & Michael Lucks\\ +Richard Luczak & Camm Maguire & Francois Maltey\\ +Alasdair McAndrew & Bob McElrath & Michael McGettrick\\ +Ian Meikle & David Mentre & Victor S. Miller\\ +Gerard Milmeister & Mohammed Mobarak & H. Michael Moeller\\ +Michael Monagan & Marc Moreno-Maza & Scott Morrison\\ +Joel Moses & Mark Murray & William Naylor\\ +Patrice Naudin & C. Andrew Neff & John Nelder\\ +Godfrey Nolan & Arthur Norman & Jinzhong Niu\\ +Michael O'Connor & Summat Oemrawsingh & Kostas Oikonomou\\ +Humberto Ortiz-Zuazaga & Julian A. Padget & Bill Page\\ +David Parnas & Susan Pelzel & Michel Petitot\\ +Didier Pinchon & Ayal Pinkus & Frederick H. Pitts\\ +Jose Alfredo Portes & Gregorio Quintana-Orti & Claude Quitte\\ +Arthur C. Ralfs & Norman Ramsey & Anatoly Raportirenko\\ +Albert D. Rich & Michael Richardson & Guilherme Reis\\ +Huan Ren & Renaud Rioboo & Jean Rivlin\\ +Nicolas Robidoux & Simon Robinson & Raymond Rogers\\ +Michael Rothstein & Martin Rubey & Philip Santas\\ +Alfred Scheerhorn & William Schelter & Gerhard Schneider\\ +Martin Schoenert & Marshall Schor & Frithjof Schulze\\ +Fritz Schwarz & Steven Segletes & V. Sima\\ +Nick Simicich & William Sit & Elena Smirnova\\ +Jonathan Steinbach & Fabio Stumbo & Christine Sundaresan\\ +Robert Sutor & Moss E. Sweedler & Eugene Surowitz\\ +Max Tegmark & T. Doug Telford & James Thatcher\\ +Balbir Thomas & Mike Thomas & Dylan Thurston\\ +Steve Toleque & Barry Trager & Themos T. Tsikas\\ +Gregory Vanuxem & Bernhard Wall & Stephen Watt\\ +Jaap Weel & Juergen Weiss & M. Weller\\ +Mark Wegman & James Wen & Thorsten Werther\\ +Michael Wester & R. Clint Whaley & John M. Wiley\\ +Berhard Will & Clifton J. Williamson & Stephen Wilson\\ +Shmuel Winograd & Robert Wisbauer & Sandra Wityak\\ +Waldemar Wiwianka & Knut Wolf & Liu Xiaojun\\ +Clifford Yapp & David Yun & Vadim Zhytnikov\\ +Richard Zippel & Evelyn Zoernack & Bruno Zuercher\\ +Dan Zwillinger\\ +\end{tabular} +\newpage +\tableofcontents +\vfill +\eject +\setlength{\parindent}{0em} +\setlength{\parskip}{1ex} +{\Large{\bf New Foreword}} +\vskip .25in + +On October 1, 2001 Axiom was withdrawn from the market and ended +life as a commercial product. +On September 3, 2002 Axiom was released under the Modified BSD +license, including this document. +On August 27, 2003 Axiom was released as free and open source +software available for download from the Free Software Foundation's +website, Savannah. + +Work on Axiom has had the generous support of the Center for +Algorithms and Interactive Scientific Computation (CAISS) at +City College of New York. Special thanks go to Dr. Gilbert +Baumslag for his support of the long term goal. + +The online version of this documentation is roughly 1000 pages. +In order to make printed versions we've broken it up into three +volumes. The first volume is tutorial in nature. The second volume +is for programmers. The third volume is reference material. We've +also added a fourth volume for developers. All of these changes +represent an experiment in print-on-demand delivery of documentation. +Time will tell whether the experiment succeeded. + +Axiom has been in existence for over thirty years. It is estimated to +contain about three hundred man-years of research and has, as of +September 3, 2003, 143 people listed in the credits. All of these +people have contributed directly or indirectly to making Axiom +available. Axiom is being passed to the next generation. I'm looking +forward to future milestones. + +With that in mind I've introduced the theme of the ``30 year horizon''. +We must invent the tools that support the Computational Mathematician +working 30 years from now. How will research be done when every bit of +mathematical knowledge is online and instantly available? What happens +when we scale Axiom by a factor of 100, giving us 1.1 million domains? +How can we integrate theory with code? How will we integrate theorems +and proofs of the mathematics with space-time complexity proofs and +running code? What visualization tools are needed? How do we support +the conceptual structures and semantics of mathematics in effective +ways? How do we support results from the sciences? How do we teach +the next generation to be effective Computational Mathematicians? + +The ``30 year horizon'' is much nearer than it appears. + +\vskip .25in +%\noindent +Tim Daly\\ +CAISS, City College of New York\\ +November 10, 2003 ((iHy)) +\vfill +\eject +\pagenumbering{arabic} \setcounter{chapter}{0} % Chapter 1 -\chapter{Details for Axiom Developers} \section{How Axiom Builds} \subsection{The environment variables} Axiom uses a tree of Makefiles to build the system. Each Makefile @@ -299,8 +626,12 @@ in AXIOM/algebra: \subsubsection{AXIOM/autoload} \begin{verbatim} in AXIOM/autoload: + ax.o + bc-matrix.o br-con.o ht-util.o + mark.fn + mark.o nag-c02.o nag-c05.o nag-c06.o @@ -315,7 +646,16 @@ in AXIOM/autoload: nag-f04.o nag-f07.o nag-s.o + nspadaux.o + pspad1.fn + pspad1.o + pspad2.fn + pspad2.o topics.o + wi1.fn + wi1.o + wi2.fn + wi2.o \end{verbatim} \subsubsection{AXIOM/bin} @@ -2430,6 +2770,555 @@ as the internal representation of what could be easier? \end{verbatim} +\section{Spad to internal function calling} + +\subsection{getdatabse output} +\begin{verbatim} + GETDATABASE('Permutation, 'OPERATIONALIST)$Lisp +\end{verbatim} + +generates the output +\begin{verbatim} + (($unique) + (~= (((Boolean) $ $) () T ELT)) + (sort (((List $) (List $)) 76 T ELT)) + (sign (((Integer) $) 59 T ELT)) + (sample (($) () T CONST)) + (recip (((Union $ "failed") $) () T ELT)) + (order (((NonNegativeInteger) $) 57 T ELT)) + (orbit (((Set #1) $ #1) 48 T ELT)) + (one? (((Boolean) $) () T ELT)) + (odd? (((Boolean) $) 62 T ELT)) + (numberOfCycles (((NonNegativeInteger) $) 60 T ELT)) + (movedPoints (((Set #1) $) 41 T ELT)) + (min (($ $ $) () (OR (has #1 (Finite)) (has #1 (OrderedSet))) ELT)) + (max (($ $ $) () (OR (has #1 (Finite)) (has #1 (OrderedSet))) ELT)) + (listRepresentation + (((Record (: preimage (List #1)) (: image (List #1))) $) 35 T ELT)) + (latex (((String) $) () T ELT)) + (inv (($ $) 92 T ELT)) + (hash (((SingleInteger) $) () T ELT)) + (fixedPoints (((Set #1) $) 98 (has #1 (Finite)) ELT)) + (even? (((Boolean) $) 58 T ELT)) + (eval ((#1 $ #1) 46 T ELT)) + (elt ((#1 $ #1) 93 T ELT)) + (degree (((NonNegativeInteger) $) 43 T ELT)) + (cycles (($ (List (List #1))) 84 T ELT)) + (cyclePartition (((Partition) $) 52 T ELT)) + (cycle (($ (List #1)) 21 T ELT)) + (conjugate (($ $ $) () T ELT)) + (commutator (($ $ $) () T ELT)) + (coercePreimagesImages (($ (List (List #1))) 38 T ELT)) + (coerceListOfPairs (($ (List (List #1))) 87 T ELT)) + (coerceImages (($ (List #1)) 95 T ELT)) + (coerce (((OutputForm) $) 83 T ELT) (($ (List (List #1))) 65 T ELT) + (($ (List #1)) 66 T ELT)) + (^ (($ $ (PositiveInteger)) () T ELT) + (($ $ (NonNegativeInteger)) () T ELT) (($ $ (Integer)) () T ELT)) + (One (($) 16 T CONST)) + (>= (((Boolean) $ $) () (OR (has #1 (Finite)) (has #1 (OrderedSet))) ELT)) + (> (((Boolean) $ $) () (OR (has #1 (Finite)) (has #1 (OrderedSet))) ELT)) + (= (((Boolean) $ $) 44 T ELT)) + (<= (((Boolean) $ $) () (OR (has #1 (Finite)) (has #1 (OrderedSet))) ELT)) + (< (((Boolean) $ $) 64 T ELT)) + (/ (($ $ $) () T ELT)) + (** (($ $ (PositiveInteger)) () T ELT) + (($ $ (NonNegativeInteger)) () T ELT) (($ $ (Integer)) () T ELT)) + (* (($ $ $) 22 T ELT))) +\end{verbatim} + +Sometimes in a getdatabase expression you will see: + +\begin{verbatim} +(~= (((Boolean) $ $) () T ELT)) +---------------------^^ +\end{verbatim} + +and in other places there is a number + +\begin{verbatim} + (sign (((Integer) $) 59 T ELT)) +---------------------------^^ +\end{verbatim} + +In general, when a large number appears it is a byte index into +the compress.daase file. + +Axiom would not fit on a laptop. We needed smaller databases. +The solution to the problem was to scan the datatases for +common substrings, write the substring to compress.daase, +and replace the substring by the byte offset. + +When reading the database these numbers would be replaced +by the substring from compress.daase using random access +seeks based on the byte offset. + +See book volume 5 +for an explanation of the database file formats. + +HOWEVER, in this case, the number has a different meaning +which I will talk about below. + +In summary, this shows what the following incantation means: + +\begin{verbatim} + (sign (((Integer) $) () (has #1 (OrderedIntegralDomain)))) +\end{verbatim} + +\begin{verbatim} +INTEGER inherits sign from OINTDOM (OrderedIntegralDomain) +OINTDOM inherits sign from ORDRING (OrderedRing) +ORDRING implements sign + since ORDRING is a category, the actual code lives in + ORDRING-.nrlib/code.lsp +\end{verbatim} + +The code for sign in ORDRING-.nrlib/code.lsp has the signature: +\begin{verbatim} + (DEFUN |ORDRING-;sign;SI;3| (|x| $) ....) +\end{verbatim} + +We can "decode" the meaning of the function name as +\begin{itemize} +\item {\bf ORDRING-} the implementing file +\item {\bf sign} the function name +\item {\bf SI} returns SingleInteger (an old domain name) +\item {\bf 3} the third function in the file +(unique, to distinguish multiple functions with the same name) +\end{itemize} + +It takes 2 arguments, +\begin{itemize} +\item {\bf \verb?|x|?} which should be a SingleInteger +\item {\bf \verb?$?} which is the current domain (ORDRING-) +\end{itemize} + +So it looks like I have the following structure +\begin{verbatim} + (NAME ((TARGETTYPE SOURCETYPE) ?1 CONDITION ?2)) +\end{verbatim} + +but we are looking up 'sign' in INTEGER so there is +a condition on sign + +\begin{verbatim} + Integer has OrderedRing ==> true +\end{verbatim} + +so that explains the condition field. + +Here we show how Axiom finds the function implementation, looks up the +function ``in the domain'', and calls it. + +\begin{verbatim} + (sign (((Integer) $) 59 T ELT)) +\end{verbatim} + +Now you've asked for 'sign' from domain Permutation + +\begin{verbatim} + (sign (((Integer) $) 59 T ELT)) +\end{verbatim} + +The implementation for 'sign' is in PERM.nrlib/code.lsp. It reads: + +\begin{verbatim} + (defun |PERM;sign;$I;17| (|p| $) + (cond + ((spadcall |p| (qrefelt $ 58)) 1) + ('t -1))) +\end{verbatim} + +which you would read as + +\begin{verbatim} + if (calling function in position 58 of myself) is true + then return 1 + else return -1 +\end{verbatim} + +How does Axiom find the function? It is in the infovec which +is the ``information vector'' containing information about the +domain. + +First we must make sure that PERM has the necessary domain +information loaded (the 'infovec'). + +\begin{verbatim} +-> [1,2,3]::PERM(INT) +\end{verbatim} + +Now, back to the 'sign' function. You saw this: + +\begin{verbatim} + (sign (((Integer) $) 59 T ELT)) (sample (($) () T CONST)) +\end{verbatim} +which is asking you to look up element 59 from the domain (\verb|$|) + +Note that \verb|$| {\sl actually} means the infovec. So we are asking: + +\begin{verbatim} + (elt (elt (getf (symbol-plist '|Permutation|) '|infovec|) 0) 59) +\end{verbatim} +which results in: + +\begin{verbatim} + |PERM;sign;$I;17| +\end{verbatim} +so we ``looked up'' the function sign in the domain PERM. + +Explaining in more detail, from the inside out by walking the +runtime data structures we see + +\begin{verbatim} + (symbol-plist '|Permutation|) +\end{verbatim} +returns the property list on the symbol {\bf Permutation} which is where +Axiom caches domain information. Almost everything of interest about a +domain resides on the property list, shown here in all its glory. + +\begin{verbatim} +(LOADED "/research/test/mnt/ubuntu/algebra/PERM.o" + SYSTEM:DEBUG (#:G1567 #:G1568) + |infovec| ( + #(NIL NIL NIL NIL NIL NIL + (|local| |#1|) (QUOTE |Rep|) (|Boolean|) + (0 . <) (|PositiveInteger|) (6 . |lookup|) + (|Integer|) (|List| 6) (11 . |maxIndex|) + (16 . |elt|) + (CONS IDENTITY (FUNCALL (|dispatchFunction| |PERM;One;$;29|) $)) + (|NonNegativeInteger|) (22 . |last|) (28 . |first|) + (34 . |concat|) |PERM;cycle;L$;26| |PERM;*;3$;28| + (40 . =) (46 . =) (52 . |elt|) + (58 . |list|) (63 . |position|) (69 . |delete|) + (|Mapping| 8 13 13) (|List| 13) (75 . |sort|) + (81 . |copy|) (86 . |member?|) + (|Record| (|:| |preimage| 13) (|:| |image| 13)) + |PERM;listRepresentation;$R;9| (92 . |elt|) + (98 . ~=) |PERM;coercePreimagesImages;L$;10| + (|Set| 6) (104 . |construct|) |PERM;movedPoints;$S;11| + (109 . |#|) |PERM;degree;$Nni;12| |PERM;=;2$B;13| + (114 . |brace|) |PERM;eval;$2S;31| (119 . |insert!|) + |PERM;orbit;$SS;14| (|List| 12) (|Partition|) + (125 . |partition|) |PERM;cyclePartition;$P;15| + (130 . |convert|) (135 . |removeDuplicates|) + (|List| $) (140 . |lcm|) |PERM;order;$Nni;16| + |PERM;even?;$B;18| |PERM;sign;$I;17| |PERM;numberOfCycles;$Nni;33| + (145 . |even?|) |PERM;odd?;$B;19| (150 . |maxIndex|) + |PERM;<;2$B;20| |PERM;coerce;L$;21| |PERM;coerce;L$;22| + (|Record| (|:| |cycl| 30) (|:| |permut| $$)) + (|List| 67) (155 . |cons|) (|Mapping| 8 67 67) + (161 . |sort|) (|List| $$) (167 . |nil|) + (171 . |cons|) (177 . |reverse|) |PERM;sort;2L;23| + (|OutputForm|) (182 . |coerce|) (187 . |blankSeparate|) + (192 . |paren|) (197 . |outputForm|) (202 . |hconcat|) + |PERM;coerce;$Of;24| |PERM;cycles;L$;25| (207 . |second|) + (212 . =) |PERM;coerceListOfPairs;L$;27| + (|Vector| 6) (218 . |construct|) (223 . |elt|) + (229 . |new|) |PERM;inv;2$;30| |PERM;elt;$2S;32| + (235 . |coerce|) (240 . |coerceImages|) (245 . |index|) + (250 . |complement|) (255 . |fixedPoints|) (260 . |conjugate|) + (265 . +) (|Union| $ (QUOTE "failed")) + (|SingleInteger|) (|String|)) + #(~= 271 |sort| 277 |sign| 282 + |sample| 287 |recip| 291 |order| 296 + |orbit| 301 |one?| 307 |odd?| 312 + |numberOfCycles| 317 |movedPoints| 322 |min| 327 + |max| 333 |listRepresentation| 339 |latex| 344 + |inv| 349 |hash| 354 |fixedPoints| 359 + |even?| 364 |eval| 369 |elt| 375 + |degree| 381 |cycles| 386 |cyclePartition| 391 + |cycle| 396 |conjugate| 401 |commutator| 407 + |coercePreimagesImages| 413 |coerceListOfPairs| 418 |coerceImages| 423 + |coerce| 428 ^ 443 |One| 461 + >= 465 > 471 = 477 + <= 483 < 489 / 495 + ** 501 * 519) + ((|unitsKnown| . 0)) + (#(0 0 0 0 3 0 0 0) + #(NIL + |Group&| + |Monoid&| + |SemiGroup&| + |OrderedSet&| + |SetCategory&| + |BasicType&| + NIL) + #((|PermutationCategory| 6) + (|Group|) + (|Monoid|) + (|SemiGroup|) + (|OrderedSet|) + (|SetCategory|) + (|BasicType|) + (|CoercibleTo| 77)) + . + #( 2 6 8 0 0 9 1 6 10 0 11 1 13 12 0 14 2 13 6 0 12 + 15 2 13 0 0 17 18 2 13 0 0 17 19 2 13 0 0 0 20 2 6 + 8 0 0 23 2 13 8 0 0 24 2 7 13 0 12 25 1 13 0 6 26 + 2 13 12 6 0 27 2 13 0 0 12 28 2 30 0 29 0 31 1 13 0 + 0 32 2 13 8 6 0 33 2 30 13 0 12 36 2 6 8 0 0 37 1 + 39 0 13 40 1 39 17 0 42 1 39 0 13 45 2 39 0 6 0 47 1 + 50 0 49 51 1 50 49 0 53 1 49 0 0 54 1 12 0 55 56 1 12 + 8 0 61 1 30 12 0 63 2 68 0 67 0 69 2 68 0 70 0 71 0 + 72 0 73 2 72 0 2 0 74 1 72 0 0 75 1 6 77 0 78 1 77 + 0 55 79 1 77 0 0 80 1 77 0 12 81 1 77 0 55 82 1 13 6 + 0 85 2 39 8 0 0 86 1 88 0 13 89 2 88 6 0 12 90 2 7 + 0 17 13 91 1 6 0 12 94 1 0 0 13 95 1 6 0 10 96 1 39 + 0 0 97 1 0 39 0 98 1 50 0 0 99 2 50 0 0 0 100 2 0 + 8 0 0 1 1 0 55 55 76 1 0 12 0 59 0 0 0 1 1 0 101 + 0 1 1 0 17 0 57 2 0 39 0 6 48 1 0 8 0 1 1 0 8 + 0 62 1 0 17 0 60 1 0 39 0 41 2 3 0 0 0 1 2 3 0 + 0 0 1 1 0 34 0 35 1 0 103 0 1 1 0 0 0 92 1 0 102 + 0 1 1 1 39 0 98 1 0 8 0 58 2 0 6 0 6 46 2 0 6 + 0 6 93 1 0 17 0 43 1 0 0 30 84 1 0 50 0 52 1 0 0 + 13 21 2 0 0 0 0 1 2 0 0 0 0 1 1 0 0 30 38 1 0 + 0 30 87 1 0 0 13 95 1 0 0 13 66 1 0 0 30 65 1 0 77 + 0 83 2 0 0 0 12 1 2 0 0 0 17 1 2 0 0 0 10 1 0 + 0 0 16 2 3 8 0 0 1 2 3 8 0 0 1 2 0 8 0 0 44 + 2 3 8 0 0 1 2 0 8 0 0 64 2 0 0 0 0 1 2 0 0 + 0 12 1 2 0 0 0 17 1 2 0 0 0 10 1 2 0 0 0 0 22)) + |lookupComplete|) + PNAME "Permutation" + DATABASE + #S(DATABASE + ABBREVIATION PERM + ANCESTORS NIL + CONSTRUCTOR NIL + CONSTRUCTORCATEGORY 2444459 + CONSTRUCTORKIND |domain| + CONSTRUCTORMODEMAP + (((|Permutation| |#1|) + (|Join| + (|PermutationCategory| |#1|) + (CATEGORY |domain| + (SIGNATURE |listRepresentation| + ((|Record| (|:| |preimage| #) (|:| |image| #)) $)) + (SIGNATURE |coercePreimagesImages| ($ (|List| (|List| |#1|)))) + (SIGNATURE |coerce| ($ (|List| (|List| |#1|)))) + (SIGNATURE |coerce| ($ (|List| |#1|))) + (SIGNATURE |coerceListOfPairs| ($ (|List| (|List| |#1|)))) + (SIGNATURE |degree| ((|NonNegativeInteger|) $)) + (SIGNATURE |movedPoints| ((|Set| |#1|) $)) + (SIGNATURE |cyclePartition| ((|Partition|) $)) + (SIGNATURE |order| ((|NonNegativeInteger|) $)) + (SIGNATURE |numberOfCycles| ((|NonNegativeInteger|) $)) + (SIGNATURE |sign| ((|Integer|) $)) + (SIGNATURE |even?| ((|Boolean|) $)) + (SIGNATURE |odd?| ((|Boolean|) $)) + (SIGNATURE |sort| ((|List| $) (|List| $))) + (IF (|has| |#1| (|Finite|)) + (SIGNATURE |fixedPoints| ((|Set| |#1|) $)) |noBranch|) + (IF (|has| |#1| (|IntegerNumberSystem|)) + (SIGNATURE |coerceImages| ($ (|List| |#1|))) + (IF (|has| |#1| (|Finite|)) + (SIGNATURE |coerceImages| ($ #)) |noBranch|)))) + (|SetCategory|)) + (T |Permutation|)) + COSIG (NIL T) + DEFAULTDOMAIN NIL + MODEMAPS 2443154 + NILADIC NIL + OBJECT "PERM" + OPERATIONALIST + ((|$unique|) + (~= (((|Boolean|) $ $) NIL . #0=(T . #1=(ELT)))) + (|sort| (((|List| $) (|List| $)) 76 . #0#)) + (|sign| (((|Integer|) $) 59 . #0#)) + (|sample| (($) NIL T CONST)) + (|recip| (((|Union| $ "failed") $) NIL . #0#)) + (|order| (((|NonNegativeInteger|) $) 57 . #0#)) + (|orbit| (((|Set| |#1|) $ |#1|) 48 . #0#)) + (|one?| (((|Boolean|) $) NIL . #0#)) + (|odd?| (((|Boolean|) $) 62 . #0#)) + (|numberOfCycles| (((|NonNegativeInteger|) $) 60 . #0#)) + (|movedPoints| (((|Set| |#1|) $) 41 . #0#)) + (|min| (($ $ $) NIL + (OR (|has| |#1| (|Finite|)) (|has| |#1| (|OrderedSet|))) . #1#)) + (|max| (($ $ $) NIL + (OR (|has| |#1| (|Finite|)) (|has| |#1| (|OrderedSet|))) . #1#)) + (|listRepresentation| + (((|Record| (|:| |preimage| (|List| |#1|)) + (|:| |image| (|List| |#1|))) $) 35 . #0#)) + (|latex| (((|String|) $) NIL . #0#)) + (|inv| (($ $) 92 . #0#)) + (|hash| (((|SingleInteger|) $) NIL . #0#)) + (|fixedPoints| (((|Set| |#1|) $) 98 (|has| |#1| (|Finite|)) . #1#)) + (|even?| (((|Boolean|) $) 58 . #0#)) + (|eval| ((|#1| $ |#1|) 46 . #0#)) + (|elt| ((|#1| $ |#1|) 93 . #0#)) + (|degree| (((|NonNegativeInteger|) $) 43 . #0#)) + (|cycles| (($ (|List| (|List| |#1|))) 84 . #0#)) + (|cyclePartition| (((|Partition|) $) 52 . #0#)) + (|cycle| (($ (|List| |#1|)) 21 . #0#)) + (|conjugate| (($ $ $) NIL . #0#)) + (|commutator| (($ $ $) NIL . #0#)) + (|coercePreimagesImages| (($ (|List| (|List| |#1|))) 38 . #0#)) + (|coerceListOfPairs| (($ (|List| (|List| |#1|))) 87 . #0#)) + (|coerceImages| (($ (|List| |#1|)) 95 . #0#)) + (|coerce| + (((|OutputForm|) $) 83 . #0#) + (($ (|List| (|List| |#1|))) 65 . #0#) + (($ (|List| |#1|)) 66 . #0#)) + (^ (($ $ (|PositiveInteger|)) NIL . #0#) + (($ $ (|NonNegativeInteger|)) NIL . #0#) + (($ $ (|Integer|)) NIL . #0#)) + (|One| (($) 16 T CONST)) + (>= (((|Boolean|) $ $) NIL + (OR (|has| |#1| (|Finite|)) (|has| |#1| (|OrderedSet|))) . #1#)) + (> (((|Boolean|) $ $) NIL + (OR (|has| |#1| (|Finite|)) (|has| |#1| (|OrderedSet|))) . #1#)) + (= (((|Boolean|) $ $) 44 . #0#)) + (<= (((|Boolean|) $ $) NIL + (OR (|has| |#1| (|Finite|)) (|has| |#1| (|OrderedSet|))) . #1#)) + (< (((|Boolean|) $ $) 64 . #0#)) + (/ (($ $ $) NIL . #0#)) + (** (($ $ (|PositiveInteger|)) NIL . #0#) + (($ $ (|NonNegativeInteger|)) NIL . #0#) + (($ $ (|Integer|)) NIL . #0#)) + (* (($ $ $) 22 . #0#))) + DOCUMENTATION 1609893 + CONSTRUCTORFORM 1609883 + ATTRIBUTES 1614391 + PREDICATES 1614406 + SOURCEFILE "bookvol10.3.pamphlet" + PARENTS NIL + USERS NIL + DEPENDENTS NIL + SPARE NIL)) +\end{verbatim} + +There are many things on the property list which looks like + +\begin{verbatim} + (symbol1 thing1 symbol2 thing2 ... symboln thingn) +\end{verbatim} + +In the PERM case we see + +\begin{verbatim} + (LOADED "/research/silver/mnt/algebra/PERM.o" + |infovec| (# #...) + ....) +\end{verbatim} + +We can get the \verb?|infovec|? off the property list with the call + + (getf (symbol-plist '|Permutation|) '|infovec|) + +is a request to search the property list for the symbol |infovec| +and return the value, which is the domain "information vector". + +You can see this vector if you look in PERM.nrlib/code.lsp. +At the bottom of that file you'll see: + +\begin{verbatim} + (SETF (GET (QUOTE |Permutation|) (QUOTE |infovec|) ....) +\end{verbatim} + +which uses SETF to put the infovec on the property list of PERM. +This information vector contains information for function lookup. +This vector gets created when we "instantiate" PERM. + +The {\bf infovec} is a list with the structure +\begin{verbatim} + (# + # + ((|unitsKnown| . 0)) + (# + # + # . #) + |lookupComplete|) +\end{verbatim} + +So, now that we have the infovec, back to the game... + +\begin{verbatim} + (elt (getf (symbol-plist '|Permutation|) '|infovec|) 0) +\end{verbatim} + +This gets the 0th element out of the infovec list which is a +vector of the name of every function Permutation implements. +We look up function names in this list, in particular, 59: + +\begin{verbatim} + (elt (elt (getf (symbol-plist '|Permutation|) '|infovec|) 0) 59) +\end{verbatim} +looks into this vector of names at the 59th element which returns + +\begin{verbatim} + |PERM;sign;$I;17| +\end{verbatim} + +The SPAD form of this function reads: + +\begin{verbatim} + sign(p) == + even? p => 1 + -1 +\end{verbatim} + +The lisp form (see PERM.nrlib/code.lsp) reads: + +\begin{verbatim} +(defun |PERM;sign;$I;17| (|p| $) + (cond + ((spadcall |p| (qrefelt $ 58)) 1) + ('t -1))) +\end{verbatim} + +We call the \verb?|PERM;sign;$I;17|? which takes 2 arguments + +The first of which is the permutation and the second is the infovec +for the PERM domain. + +The \verb|(qrefelt $ 58)| uses the above dance to look up a function +in the infovec at the 58th position... which returns + +\begin{verbatim} + |PERM;even?;$B;18| +\end{verbatim} + +The spadcall calls \verb'|PERM;even?;$B;18|' with the value of \verb?|p|?. + +If we look in the domain Permutation for the implementation of even? + +\begin{verbatim} + even?(p) == even?(#(p.1) - numberOfCycles p) +\end{verbatim} + +which in PERM.nrlib/code.lsp we see + +\begin{verbatim} + (defun |PERM;even?;$b;18| + (spadcall + (- (length (spadcall |p| 1 (qrefelt $ 25))) + (spadcall |p| (qrefelt $ 60))) + (qrefelt % 61))) +\end{verbatim} + +where +\begin{verbatim} + (qrefelt $ 25) ==> (52 . |elt|) + (qrefelt $ 60) ==> |PERM;numberOfCycles;$Nni;33| + (qrefelt $ 61) ==> (145. |even?|) +\end{verbatim} + +So, to summarize, the small magic numbers you see in the results +are indexes into the infovec, which is where Axiom stores things +it needs to look up at runtime, usually function references. + +If there is () rather than a number than there is no need to do +a function lookup. + +Axiom execution is an alternating series of function lookups in +the infovec followed by a call of that function which results in +a function lookup in the infovec followed by a call of that +function which results in ..... + +spadcall is a wrapper macro which takes the arguments and a +function to call. qrefelt does the infovec lookup. + \section{axiom command} The axiom command will eventually be a shell script. At the moment it is just a copy of the interpsys image. However the whole Axiom diff --git a/changelog b/changelog index 3dba2fb..46de73b 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,5 @@ +20140515 tpd src/axiom-website/patches.html 20140515.01.tpd.patch +20140515 tpd bookvol4 add operationalist details 20140514 tpd src/axiom-website/patches.html 20140514.01.tpd.patch 20140514 tpd book/*.txt email cleanup 20140511 tpd src/axiom-website/patches.html 20140511.02.tpd.patch diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html index 3cf99ea..b0a4f45 100644 --- a/src/axiom-website/patches.html +++ b/src/axiom-website/patches.html @@ -4340,6 +4340,8 @@ book/*.txt email cleanup book/*.txt email cleanup 20140514.01.tpd.patch book/*.txt email cleanup +20140515.01.tpd.patch +bookvol4 add operationalist details