$SPAD/src/input inputform.input

Timothy Daly December 3, 2016

Abstract

Contents

2

— * —

)set break resume
)sys rm -f inputform.output
)spool inputform.output
)set message test on
)set message auto off
)clear all

———-

Consider the three strings:

— * —

--S 1 of 18
a1:="(a/x)+(a/y)"
--R
--R
--R   (1)  "(a/x)+(a/y)"
--R                                                                 Type: String
--E 1
--S 2 of 18
a2:="(a/x) + (a/y)"
--R
--R
--R   (2)  "(a/x) + (a/y)"
--R                                                                 Type: String
--E 2
--S 3 of 18
a3:="(a*x+a*y)/(x*y)"
--R
--R
--R   (3)  "(a*x+a*y)/(x*y)"
--R                                                                 Type: String
--E 3

———-

Of course as members of the Domain String these are all different.

— * —

--S 4 of 18
(a1=a2)::Boolean
--R

--R
--R   (4)  false
--R                                                                Type: Boolean
--E 4
--S 5 of 18
(a1=a3)::Boolean
--R
--R
--R   (5)  false
--R                                                                Type: Boolean
--E 5
--S 6 of 18
(a2=a3)::Boolean
--R
--R
--R   (6)  false
--R                                                                Type: Boolean
--E 6

———-

While as members of the Domain Expression Integer these are equal.

— * —

--S 7 of 18
interpretString(a1."=".a2)::Boolean
--R
--R
--R   (7)  true
--R                                                                Type: Boolean
--E 7
--S 8 of 18
interpretString(a1."=".a3)::Boolean
--R
--R
--R   (8)  true
--R                                                                Type: Boolean
--E 8
--S 9 of 18
interpretString(a2."=".a3)::Boolean
--R
--R
--R   (9)  true
--R                                                                Type: Boolean

--E 9

———-

But when we evaluate them as symbolic expressions in the domain InputForm:

— * —

--S 10 of 18
x:INFORM:=x
--R
--R
--R   (10)  x
--R                                                              Type: InputForm
--E 10
--S 11 of 18
y:INFORM:=y
--R
--R
--R   (11)  y
--R                                                              Type: InputForm
--E 11
--S 12 of 18
a:INFORM:=a
--R
--R
--R   (12)  a
--R                                                              Type: InputForm
--E 12

———-

The first two are equal but the third is something different!

— * —

--S 13 of 18
interpretString(a1."=".a2)::Boolean
--R
--R
--R   (13)  true
--R                                                                Type: Boolean
--E 13
--S 14 of 18
interpretString(a1."=".a3)::Boolean

--R
--R
--R   (14)  false
--R                                                                Type: Boolean
--E 14
--S 15 of 18
interpretString(a2."=".a3)::Boolean
--R
--R
--R   (15)  false
--R                                                                Type: Boolean
--E 15

———-

So equality of these ”algebraic” objects in Expression Integer is not the same as equality in a purely symbolic domain like InputForm.

In fact, after completing this exercise I realized that the original Axiom developers actually did already anticipate the need for an OutputForm for InputForm that is equivalent the actual input to the Axiom interpreter. The function that I was looking for is called ’expr’ in the domain InputForm.

— * —

--S 16 of 18
map(expr,map(interpretString,a1=a2)::Equation(INFORM))
--R
--R
--R         a   a  a   a
--R   (16)  - + -= - + -
--R         x   y  x   y
--R                                                   Type: Equation(OutputForm)
--E 16
--S 17 of 18
map(expr,map(interpretString,a2=a3)::Equation(INFORM))
--R
--R
--R         a   a  a x + a y
--R   (17)  - + -= ---------
--R         x   y     x y
--R                                                   Type: Equation(OutputForm)
--E 17
--S 18 of 18
map(expr,map(interpretString,a1=a3)::Equation(INFORM))
--R
--R

--R         a   a  a x + a y
--R   (18)  - + -= ---------
--R         x   y     x y
--R                                                   Type: Equation(OutputForm)
--E 18
)spool
)lisp (bye)

———-

References^{[1] nothing}

8