This problem does not occur on the NAG version: \begin{axiom} dom:=(INT->INT) g(f:dom):dom== x+->(f(x))^2 p(x:INT):INT == x-1 \end{axiom} The next line crashes Axiom. (Here the crash is indicated by not showing the result for \begin{axiom} q:= g p \end{axiom} Below is the transcript for the NAG version: G82322 (1) -> dom:= (INT->INT) +++ |*1;g;1;G82322| redefined
(4) theMap(LAMBDA_ibs3ze_708,174) Type: (Integer -> Integer) G82322 (5) -> q 3 property change --wyscc, Fri, 04 Mar 2005 04:37:59 -0600 reply Name: #114 Maps on Function crash => #114 Map on Functions crash
We can avoid the use of an anonymous function and use
function composition to define the functional axiom dom ==> INT -> INT Type: Void
axiom g(f:dom):dom == function(x^2, Type: Void
axiom p(x:INT):INT == x-1 Type: Void
axiom q := g p axiom Compiling function p with type Integer -> Integer There are 35 exposed and 24 unexposed library operations named * having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, axiom Compiling function g with type (Integer -> Integer) -> (Integer -> Integer) Compiled code for g has been cleared. axiom Compiling function sq with type Integer -> Integer
Type: (Integer -> Integer)
axiom q 3
Type: PositiveInteger?
Take a look at FunctionalMapping? for an example of this sort thing
written in SPAD.
Thanks to both contributions and guides to use composition. However, this is a bug still since the original code works under the NAG version. We should figure out why the open source version breaks down. Afterall, anonymous functions are convenience that the system should be able to handle by assigning intermediate variables automatically.
|