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

Edit detail for #206 Interpreter code generation failed for function returning a Type revision 9 of 11

1 2 3 4 5 6 7 8 9 10 11
Editor: Bill Page
Time: 2008/02/27 21:24:27 GMT-8
Note: Well, maybe if we don't confuse it too much ...

added:

From BillPage Wed Feb 27 21:24:23 -0800 2008
From: Bill Page
Date: Wed, 27 Feb 2008 21:24:23 -0800
Subject: Well, maybe if we don't confuse it too much ...
Message-ID: <20080227212423-0800@axiom-wiki.newsynthesis.org>

Same function in SPAD:
\begin{spad}
)abbrev package TT testtype
testtype(): exports == implementation where
  exports == with
    tt1: (Integer) -> Type
  implementation == add
    tt1(x) ==
      x=0 => Integer
      Float
\end{spad}

Calling the function like this now works::

\begin{axiom}
TofF:=tt1(1)
\end{axiom}

But can we use it?
\begin{axiom}
f:TofF:=1.2
\end{axiom}

Submitted by : (unknown) at: 2007-11-17T22:08:25-08:00 (16 years ago)
Name :
Axiom Version :
Category : Severity : Status :
Optional subject :  
Optional comment :

This function should return a type that depends on a
parameter:
\begin{axiom}
tt:INT->Type
tt(x)== (x=0 => Integer; Float)
tt(1)
\end{axiom}

Here is the same function in SPAD: \begin{spad} )abbrev package TT testtype testtype(): exports == implementation where exports == with tt1: (Integer) -> Type implementation == add tt1(x) == x=0 => Integer Float \end{spad}

Calling this function like this:

  \begin{axiom}
  tt1(1)
  \end{axiom}

causes Axiom to crash:

  (1) -> tt1(1)

   >> System error:
   Caught fatal error [memory may be damaged]

But this works using Aldor! :-) \begin{aldor} #include "axiom.as"; testtype2(): with { tt2: (Integer) -> Type; } == add { tt2(x:Integer):Type == { x=0 => Integer; Float; } } \end{aldor}

\begin{axiom} tt2(1) tt2(0) \end{axiom}

The problem here, I believe, is that Type is a category almost isolated. The interpreter thinks of Integer and Float as of type Domain, not Type. If you change the return type from `Type' to `Domain'. It would not work in OpenAxiom?. Both `Type' and `Object' seems to be isolated in the type hierarchy.

Fixed in OpenAxiom? --gdr, Tue, 19 Feb 2008 23:46:28 -0800 reply
This issue is fixed in OpenAxiom?-1.2.0. Comment from me on Friday January 25, 2008 had a typo in it: I meant If you change the return type from `Type' to `Domain'. It would work in OpenAxiom?. Now, the original testcase just works fine.

\begin{axiom} tt:INT->Domain tt(x)== (x=0 => Integer; Float) tt(1) \end{axiom}

Status: open => fixed somewhere

functions that return domains --Bill Page, Mon, 25 Feb 2008 07:20:30 -0800 reply
If I define a function that returns a domain (such as above): \begin{axiom} tt:INT->Domain tt(x)== (x=0 => Integer; Float) tt(0) \end{axiom} then can I use it to define new objects? Like this: \begin{axiom} f:tt(1):=3.2 g:tt(0):=3 \end{axiom} or this: \begin{axiom} F:=tt(1) f:F:=3.2 G:=tt(0) g:G:=3 \end{axiom}

Try it again with SPAD --Bill Page, Wed, 27 Feb 2008 21:21:55 -0800 reply
Same function in SPAD: \begin{spad} )abbrev package TT testtype testtype(): exports == implementation where exports == with tt1: (Integer) -> Type implementation == add tt1(x) == x=0 => Integer Float \end{spad}

Calling the function like this now works::

\begin{axiom} FF:=tt1(1) \end{axiom}

But can we use it? \begin{axiom} f:FF:=1.2 \end{axiom}

Well, maybe if we don't confuse it too much ... --Bill Page, Wed, 27 Feb 2008 21:24:23 -0800 reply
Same function in SPAD: \begin{spad} )abbrev package TT testtype testtype(): exports == implementation where exports == with tt1: (Integer) -> Type implementation == add tt1(x) == x=0 => Integer Float \end{spad}

Calling the function like this now works::

\begin{axiom} TofF:=tt1(1) \end{axiom}

But can we use it? \begin{axiom} f:TofF:=1.2 \end{axiom}


Some or all expressions may not have rendered properly, because Axiom returned the following error:
Error: export AXIOM=/usr/local/lib/open-axiom/x86_64-unknown-linux/1.1.0-2008-01-28; 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/open-axiom/x86_64-unknown-linux/1.1.0-2008-01-28/lib; LANG=en_US.UTF-8 $AXIOM/bin/AXIOMsys < /var/zope2/var/LatexWiki/2241559447947071093-25px.axm
/bin/sh: /usr/local/lib/open-axiom/x86_64-unknown-linux/1.1.0-2008-01-28/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
(./7507606179060983141-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/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/generic/xypic/xyknot.tex Xy-pic option: Knots and Links feature v.3.4 knots and links, loaded)) (/usr/share/texmf-texlive/tex/generic/xypic/xyarc.tex Xy-pic option: Circle, Ellipse, Arc feature v.3.4 circles, ellipses, elliptical arcs, loaded) (/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/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 7507606179060983141-16.0px.sage (./7507606179060983141-16.0px.sout)) (/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)) (./7507606179060983141-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 126.

[1] You can't use `macro parameter character #' in vertical mode. l.138 # include "axiom.as"; [2]

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

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

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

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

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

[3]

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

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

[4]

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

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

(/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) [5] (./7507606179060983141-16.0px.aux) ) (see the transcript file for additional information) Output written on 7507606179060983141-16.0px.dvi (5 pages, 2840 bytes). Transcript written on 7507606179060983141-16.0px.log.