login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Edit detail for SubDomain revision 7 of 7

1 2 3 4 5 6 7
Editor: Bill Page
Time: 2008/09/20 17:12:46 GMT-7
Note: problems with values of domains in types

removed:
-K := Fraction Integer
-g := matrix [[1,0,0,0], [0,-1,0,0], [0,0,-1,0], [0,0,0,-1]]
-D := CliffordAlgebra(4,K, quadraticForm g)
-D::InputForm
-unparse %

added:

Here is a useful function for parsing input strings
\begin{axiom}
parse(s:String):InputForm == ncParseFromString(s)$Lisp pretend InputForm
parse("Integer")
\end{axiom}

There are still problems problems with values of domains in types
\begin{axiom}
)set output tex off
)set output algebra on
\end{axiom}

\begin{axiom}
CliffordAlgebra(4,Fraction Integer, quadraticForm matrix [[1,0,0,0], [0,-1,0,0], [0,0,-1,0], [0,0,0,-1]])
%::InputForm
parse("CliffordAlgebra(4,Fraction Integer, quadraticForm matrix [[1,0,0,0], [0,-1,0,0], [0,0,-1,0], [0,0,0,-1]])")
interpret(%)
%::InputForm
\end{axiom}

changed:
-package.
package. But limitation of FriCAS that prevent us from passing
domain-values as parameters of functions mean we must do it
this way.

removed:
-parse(s:String):InputForm == ncParseFromString(s)$Lisp pretend InputForm

PositiveInteger and NonNegativeInteger are subdomains of Integer.

Domain is a domain whose values are all domains. Categories are values of the domain SubDomain Domain. For example: \begin{axiom} Integer Ring \end{axiom}

Unfortunately the original Axiom library did not include definitions of these domains.

\begin{axiom} [Integer,PrimeField(3)] \end{axiom}

\begin{axiom} [Ring,Field] \end{axiom}

OpenAxiom has implemented Domain and replaced SubDomain Domain with Category. Here we try to provide something similar for FriCAS. \begin{spad} )abbrev domain DOMAIN Domain Domain():SetCategory == add coerce(x:%):OutputForm == n:SExpression:=devaluate(x)$Lisp #n=1 => car(n) pretend OutputForm n pretend OutputForm x = y == devaluate(x)$Lisp = devaluate(y)$Lisp \end{spad}

\begin{spad} )abbrev domain SUBDOM SubDomain SubDomain(D:Domain):SetCategory == add coerce(x:%):OutputForm == n:SExpression:=devaluate(x)$Lisp #n=1 => car(n) pretend OutputForm n pretend OutputForm x = y == devaluate(x)$Lisp = devaluate(y)$Lisp \end{spad}

\begin{axiom} [Integer,PrimeField(3)] %.1 \end{axiom}

\begin{axiom} [Ring,Field,IntegerNumberSystem] \end{axiom}

Also we would like to be able to coerce both Domain and SubDomain to InputForm \begin{axiom} Integer::InputForm \end{axiom}

Coercions like these are a special case in the Axiom interpreter. Here we modify the treatment for InputForm in references to '(InputForm) below.

From: interp/i-coerce.boot \begin{boot} coerceInteractive(triple,t2) == -- bind flag for recording/reporting instantiations -- (see recordInstantiation) t1 := objMode triple val := objVal triple null(t2) or t2 = $EmptyMode => NIL t2 = t1 => triple t2 = '$NoValueMode => objNew(val,t2) if t2 is [SubDomain,x,.] then t2:= x -- JHD added category Aug 1996 for BasicMath -- WSP modified for coercion to InputForm Sept 2008 t1 in ((Category) (Mode) (Domain) (SubDomain (Domain))) => t2 = $OutputForm => objNew(val,t2) t2 = '(InputForm) => objNewWrap(val,t2) NIL t1 = '$NoValueMode => if $compilingMap then clearDependentMaps($mapName,nil) throwKeyedMsg("S2IC0009",[t2,$mapName]) $insideCoerceInteractive: local := true expr2 := EQUAL(t2,$OutputForm) if expr2 then startTimingProcess 'print else startTimingProcess 'coercion -- next 2 lines handle cases like '"failed" result := expr2 and (t1 = val) => objNew(val,$OutputForm) expr2 and t1 is [Variable,var] => objNewWrap(var,$OutputForm) t2 = (InputForm) => objNewWrap(val,t2) coerceInt0(triple,t2) if expr2 then stopTimingProcess 'print else stopTimingProcess 'coercion result \end{boot}

Now we get \begin{axiom} a:=Integer::InputForm interpret(a)$InputForm unparse(a)$InputForm b:=PrimeField(11)::InputForm interpret(b)$InputForm unparse(b)$InputForm c:=DirectProduct(3,Fraction Integer)::InputForm interpret(c)$InputForm unparse(c)$InputForm d:=Ring::InputForm interpret(d)$InputForm unparse(d)$InputForm \end{axiom}

Here is a useful function for parsing input strings \begin{axiom} parse(s:String):InputForm == ncParseFromString(s)$Lisp pretend InputForm parse("Integer") \end{axiom}

There are still problems problems with values of domains in types \begin{axiom} )set output tex off )set output algebra on \end{axiom}

\begin{axiom} CliffordAlgebra(4,Fraction Integer, quadraticForm matrix [[1,0,0,0], [0,-1,0,0], [0,0,-1,0], [0,0,0,-1]]) %::InputForm parse("CliffordAlgebra(4,Fraction Integer, quadraticForm matrix [[1,0,0,0], [0,-1,0,0], [0,0,-1,0], [0,0,0,-1]])") interpret(%) %::InputForm \end{axiom}

We can easily implement similar functionality at the Spad (algebra library) level by extending the InputFormFunction1 package. But limitation of FriCAS that prevent us from passing domain-values as parameters of functions mean we must do it this way. \begin{spad} )abbrev package INFORM1 InputFormFunctions1 --)boot $noSubsumption := false

++ Tools for manipulating input forms ++ Author: Manuel Bronstein ++ Date Created: ??? ++ Date Last Updated: 19 April 1991 ++ Description: Tools for manipulating input forms.

InputFormFunctions1(R:Type):with packageCall: Symbol -> InputForm ++ packageCall(f) returns the input form corresponding to f$R. interpret : InputForm -> R ++ interpret(f) passes f to the interpreter, and transforms ++ the result into an object of type R. domainToInputForm: () -> InputForm ++ convert a domain to InputForm == add domainToInputForm():InputForm == devaluate(R)$Lisp

packageCall name == convert([convert($elt), domainToInputForm(), convert name]$List(InputForm))@InputForm

interpret form ==

retract(interpret(convert([convert(@), form, domainToInputForm()]$List(InputForm))@InputForm)$InputForm)$AnyFunctions1(R)

\end{spad}

\begin{axiom} domainToInputForm()$INFORM1(PrimeField 7) interpret(parse("x^2+1"))$INFORM1(Polynomial Float) \end{axiom}


Some or all expressions may not have rendered properly, because Axiom returned the following error:
Error: export AXIOM=/usr/local/lib/fricas/target/x86_64-unknown-linux; export ALDORROOT=/usr/local/aldor/linux/1.1.0; export PATH=$ALDORROOT/bin:$PATH; export HOME=/var/zope2/var/LatexWiki; ulimit -t 600; export LD_LIBRARY_PATH=/usr/local/lib/fricas/target/x86_64-unknown-linux/lib; LANG=en_US.UTF-8 $AXIOM/bin/AXIOMsys < /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/4337775783186056780-25px.axm
/bin/sh: /usr/local/lib/fricas/target/x86_64-unknown-linux/bin/AXIOMsys: not found


Some or all expressions may not have rendered properly, because Latex returned the following error:
This is pdfTeXk, Version 3.141592-1.40.3 (Web2C 7.5.6)
 \write18 enabled.
 %&-line parsing enabled.
entering extended mode
(./8564123529843784520-16.0px.tex
LaTeX2e <2005/12/01>
Babel <v3.8h> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, arabic, farsi, croatian, ukrainian, russian, bulgarian, czech, slov
ak, danish, dutch, finnish, basque, french, german, ngerman, ibycus, greek, mon
ogreek, ancientgreek, hungarian, italian, latin, mongolian, norsk, icelandic, i
nterlingua, turkish, coptic, romanian, welsh, serbian, slovenian, estonian, esp
eranto, uppersorbian, indonesian, polish, portuguese, spanish, catalan, galicia
n, swedish, ukenglish, pinyin, loaded.
(/usr/share/texmf-texlive/tex/latex/base/article.cls
Document Class: article 2005/09/16 v1.4f Standard LaTeX document class
(/usr/share/texmf-texlive/tex/latex/base/size12.clo))
(/usr/share/texmf-texlive/tex/latex/ucs/ucs.sty
(/usr/share/texmf-texlive/tex/latex/ucs/data/uni-global.def))
(/usr/share/texmf-texlive/tex/latex/base/inputenc.sty
(/usr/share/texmf-texlive/tex/latex/ucs/utf8x.def))
(/usr/share/texmf-texlive/tex/latex/bbm/bbm.sty)
(/usr/share/texmf-texlive/tex/latex/jknapltx/mathrsfs.sty)
(/usr/share/texmf-texlive/tex/latex/base/fontenc.sty
(/usr/share/texmf-texlive/tex/latex/base/t1enc.def))
(/usr/share/texmf-texlive/tex/latex/pstricks/pstricks.sty
(/usr/share/texmf-texlive/tex/generic/pstricks/pstricks.tex
`PSTricks' v1.15  <2006/12/22> (tvz)
(/usr/share/texmf-texlive/tex/generic/pstricks/pstricks.con))
(/usr/share/texmf/tex/latex/xcolor/xcolor.sty
(/etc/texmf/tex/latex/config/color.cfg)
(/usr/share/texmf-texlive/tex/latex/graphics/dvips.def)
(/usr/share/texmf-texlive/tex/latex/graphics/dvipsnam.def)))
(/usr/share/texmf-texlive/tex/latex/graphics/epsfig.sty
(/usr/share/texmf-texlive/tex/latex/graphics/graphicx.sty
(/usr/share/texmf-texlive/tex/latex/graphics/keyval.sty)
(/usr/share/texmf-texlive/tex/latex/graphics/graphics.sty
(/usr/share/texmf-texlive/tex/latex/graphics/trig.sty)
(/etc/texmf/tex/latex/config/graphics.cfg))))
(/usr/share/texmf-texlive/tex/latex/pst-grad/pst-grad.sty
(/usr/share/texmf-texlive/tex/generic/pst-grad/pst-grad.tex
(/usr/share/texmf-texlive/tex/latex/xkeyval/pst-xkey.tex
(/usr/share/texmf-texlive/tex/latex/xkeyval/xkeyval.sty
(/usr/share/texmf-texlive/tex/latex/xkeyval/xkeyval.tex)))
`pst-plot' v1.05, 2006/11/04 (tvz,dg,hv)))
(/usr/share/texmf-texlive/tex/latex/pstricks/pst-plot.sty
(/usr/share/texmf-texlive/tex/generic/pstricks/pst-plot.tex
 v97 patch 2, 1999/12/12
(/usr/share/texmf-texlive/tex/generic/multido/multido.tex
 v1.41, 2004/05/18 <tvz>)))
(/usr/share/texmf-texlive/tex/latex/geometry/geometry.sty
(/usr/share/texmf-texlive/tex/xelatex/xetexconfig/geometry.cfg)

Package geometry Warning: `lmargin' and `rmargin' result in NEGATIVE (-108.405p t). `width' should be shortened in length.

) (/usr/share/texmf-texlive/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `? option. (/usr/share/texmf-texlive/tex/latex/amsmath/amstext.sty (/usr/share/texmf-texlive/tex/latex/amsmath/amsgen.sty)) (/usr/share/texmf-texlive/tex/latex/amsmath/amsbsy.sty) (/usr/share/texmf-texlive/tex/latex/amsmath/amsopn.sty)) (/usr/share/texmf-texlive/tex/latex/amsfonts/amsfonts.sty) (/usr/share/texmf-texlive/tex/latex/amsfonts/amssymb.sty) (/usr/share/texmf-texlive/tex/latex/amscls/amsthm.sty) (/usr/share/texmf-texlive/tex/latex/setspace/setspace.sty Package: `setspace 6.7 <2000/12/01> ) (/usr/share/texmf-texlive/tex/generic/xypic/xy.sty (/usr/share/texmf-texlive/tex/generic/xypic/xy.tex Bootstrap'ing: catcodes, docmode, (/usr/share/texmf-texlive/tex/generic/xypic/xyrecat.tex) (/usr/share/texmf-texlive/tex/generic/xypic/xyidioms.tex)

Xy-pic version 3.7 <1999/02/16> Copyright (c) 1991-1998 by Kristoffer H. Rose <krisrose@ens-lyon.fr> Xy-pic is free software: see the User's Guide for details.

Loading kernel: messages; fonts; allocations: state, direction, utility macros; pictures: \xy, positions, objects, decorations; kernel objects: directionals, circles, text; options; algorithms: directions, edges, connections; Xy-pic loaded)) (/usr/share/texmf-texlive/tex/generic/xypic/xyall.tex Xy-pic option: All features v.3.3 (/usr/share/texmf-texlive/tex/generic/xypic/xycurve.tex Xy-pic option: Curve and Spline extension v.3.7 curve, circles, loaded) (/usr/share/texmf-texlive/tex/generic/xypic/xyframe.tex Xy-pic option: Frame and Bracket extension v.3.7 loaded) (/usr/share/texmf-texlive/tex/generic/xypic/xycmtip.tex Xy-pic option: Computer Modern tip extension v.3.3 (/usr/share/texmf-texlive/tex/generic/xypic/xytips.tex Xy-pic option: More Tips extension v.3.3 loaded) loaded) (/usr/share/texmf-texlive/tex/generic/xypic/xyline.tex Xy-pic option: Line styles extension v.3.6 loaded) (/usr/share/texmf-texlive/tex/generic/xypic/xyrotate.tex Xy-pic option: Rotate and Scale extension v.3.3 loaded) (/usr/share/texmf-texlive/tex/generic/xypic/xycolor.tex Xy-pic option: Colour extension v.3.3 loaded) (/usr/share/texmf-texlive/tex/generic/xypic/xymatrix.tex Xy-pic option: Matrix feature v.3.4 loaded) (/usr/share/texmf-texlive/tex/generic/xypic/xyarrow.tex Xy-pic option: Arrow and Path feature v.3.5 path, \ar, loaded) (/usr/share/texmf-texlive/tex/generic/xypic/xygraph.tex Xy-pic option: Graph feature v.3.7 loaded) loaded) (/usr/share/texmf-texlive/tex/latex/tools/verbatim.sty) (/usr/share/texmf/tex/latex/graphviz/graphviz.sty (/usr/share/texmf-texlive/tex/latex/psfrag/psfrag.sty)) (/usr/share/texmf/tex/latex/sagetex.sty Writing sage input file 8564123529843784520-16.0px.sage ) (/usr/share/texmf-texlive/tex/latex/gnuplottex/gnuplottex.sty (/usr/share/texmf-texlive/tex/latex/base/latexsym.sty) (/usr/share/texmf-texlive/tex/latex/moreverb/moreverb.sty) (/usr/share/texmf-texlive/tex/latex/base/ifthen.sty)) (./8564123529843784520-16.0px.aux) (/usr/share/texmf-texlive/tex/latex/ucs/ucsencs.def) (/usr/share/texmf-texlive/tex/latex/base/t1cmtt.fd)

LaTeX Warning: Characters dropped after `\end{axiom}' on input line 124.

LaTeX Warning: Characters dropped after `\end{axiom}' on input line 127.

LaTeX Warning: Characters dropped after `\end{axiom}' on input line 130.

(/usr/share/texmf-texlive/tex/latex/jknapltx/ursfs.fd) (/usr/share/texmf-texlive/tex/latex/amsfonts/umsa.fd) (/usr/share/texmf-texlive/tex/latex/amsfonts/umsb.fd) (/usr/share/texmf-texlive/tex/latex/base/ulasy.fd) You can't use `macro parameter character #' in math mode. l.137 # n=1 => car(n) pretend OutputForm Missing $ inserted. <inserted text> $ l.141 \end{spad} \newpage

Overfull \hbox (162.07283pt too wide) in paragraph at lines 132--141 \T1/cmr/m/n/12 )abbrev do-main DO-MAIN Do-main Do-main():SetCategory == add coe rce(x:n:SExpression:=devaluate(x)$\OML/cmm/m/it/12 Lispn \OT1/cmr/m/n/12 = 1 =\ OML/cmm/m/it/12 > car\OT1/cmr/m/n/12 (\OML/cmm/m/it/12 n\OT1/cmr/m/n/12 )\OML/c mm/m/it/12 pretendOutputFormnpretendOutputFormx \OT1/cmr/m/n/12 = [1] You can't use `macro parameter character #' in math mode. l.148 # n=1 => car(n) pretend OutputForm Missing $ inserted. <inserted text> $ l.152 \end{spad} \newpage [2]

LaTeX Warning: Characters dropped after `\end{axiom}' on input line 156.

LaTeX Warning: Characters dropped after `\end{axiom}' on input line 159.

LaTeX Warning: Characters dropped after `\end{axiom}' on input line 162.

LaTeX Error: Environment boot undefined.

See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ...

l.163 \begin{boot}

LaTeX Error: \begin{document} ended by \end{boot}.

See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ...

l.195 \end{boot} \newpage Missing $ inserted. <inserted text> $ l.195 \end{boot} \newpage

Overfull \hbox (82.2886pt too wide) in paragraph at lines 164--195 \T1/cmr/m/n/12 expr2 := EQUAL(t2,$\OML/cmm/m/it/12 OutputForm\OT1/cmr/m/n/12 )\ OML/cmm/m/it/12 ifexpr\OT1/cmr/m/n/12 2\OML/cmm/m/it/12 thenstartTimingProcess[ ]printelsestartTimingProcess[]coercion \OMS/cmsy/m/n/12 ^^@ ^^@\OML/cmm/m/it/12 next\OT1/cmr/m/n/12 2\OML/cmm/m/it/12 lineshandlecaseslike[]\OT1/cmr/m/n/12 "\ OML/cmm/m/it/12 failed\OT1/cmr/m/n/12 "\OML/cmm/m/it/12 result \OT1/cmr/m/n/12 := [3]

LaTeX Warning: Characters dropped after `\end{axiom}' on input line 209.

LaTeX Warning: Characters dropped after `\end{axiom}' on input line 213.

LaTeX Warning: Characters dropped after `\end{axiom}' on input line 217.

LaTeX Warning: Characters dropped after `\end{axiom}' on input line 224.

Missing $ inserted. <inserted text> $ l.228

Overfull \hbox (38.96309pt too wide) in paragraph at lines 235--245 \T1/cmr/m/n/12 f$\OML/cmm/m/it/12 R:interpret \OT1/cmr/m/n/12 : \OML/cmm/m/it/1 2 InputForm\OMS/cmsy/m/n/12 ^^@ \OML/cmm/m/it/12 > R \OT1/cmr/m/n/12 + +\OML/cm m/m/it/12 interpret\OT1/cmr/m/n/12 (\OML/cmm/m/it/12 f\OT1/cmr/m/n/12 )\OML/cmm /m/it/12 passesftotheinterpreter; andtransforms \OT1/cmr/m/n/12 + +\OML/cmm/m/i t/12 theresultintoanobjectoftypeR:domainToInputForm \OT1/cmr/m/n/12 : Missing $ inserted. <inserted text> $ l.254

Overfull \hbox (27.04149pt too wide) in paragraph at lines 252--254 []\T1/cmr/m/n/12 retract(interpret(convert([convert(@), form, domainT oInputForm()]$\OML/cmm/m/it/12 List\OT1/cmr/m/n/12 (\OML/cmm/m/it/12 InputForm\ OT1/cmr/m/n/12 ))@\OML/cmm/m/it/12 InputForm\OT1/cmr/m/n/12 )$\T1/cmr/m/n/12 In putForm)$\OML/cmm/m/it/12 AnyFunctions\OT1/cmr/m/n/12 1(\OML/cmm/m/it/12 R\OT1/ cmr/m/n/12 )$ [4]

LaTeX Warning: Characters dropped after `\end{axiom}' on input line 259.

[5] (./8564123529843784520-16.0px.aux) ) (see the transcript file for additional information) Output written on 8564123529843784520-16.0px.dvi (5 pages, 6472 bytes). Transcript written on 8564123529843784520-16.0px.log.