"When we implement an algebraic system like a group, a ring or a finite field within an existing symbolic computational language, then there are three possible approaches:
(1) define new operators: for example; if we define an operator %+% for addition on a finite field, then we could operate in the following fashion: 2 %+% 4 .
(2) change mode: for example; if we write ChangeAlgebra[GF,7], then every computation is done over GF(7) until we change to some other algebra.
(3) use the same operations within the existing system (i.e. +,-,*,/ ): for this we have to identify constants and variables to be in a certain algebra. In this method a lot of original functions of the system become available to the new algebra.
Due to the fact that Mathematica is an object based language it facilitates the adaptation of the third method cited above. Thus, the package allows us to use many functions of Mathematica over finite fields without any modification, i.e.; solving linear equations, inverses, determinants, derivations, resultants, etc."
> An idea has occurred to me since I wrote this.
>
> I recall that MathPiper has a built-in ability to create a wrapper of
> LocalSymbols() [ ... ] about a program block, in which all the "named"
> symbols are "decorated" (in the sense that term is used in C++
> implementations) inside the enclosed block, transparently to the programmer.
>
> I don't know how that is implemented in MathPiper, but I think some
> extension of the same technique might serve to let us at least prototype a
> Typing system such as I described in the previous note. By adding suitable
> "decorations" (invisible to the user/programmer inside the block), the Type
> information fore that symbol might be attached. Example : x is an element
> of Galois Field GF(7), and it appears internally as x$GF_7 or some such.
>
> I say that this could be used for prototyping, mainly because it might be
> too slow for a final implementation. Each variable would have to be parsed
> by each function and operator using it, to see which variant overloaded
> function or operator should be called explicitly. In a compiled language
> like C++ this is not a problem, since this examination and determination
> only has to be done once, at compile time. In an interpreted language like
> MathPiper, it could cause considerable slowdown. But there might be ways to
> have our cake and eat it too, though I don't know enough about the
> implementation details of mathpiper to speculate on this any further.
I have been pondering your original post all day and before I submit
my thoughts on it I have a question. What assumptions do the existing
MathPiper rules make about unbound variables? For example, what type
are they assumed to be?
Ted
> as far as i know, unbound variables have no type, do they? does mathpiper
> have types? if so, what are they, and how can you query this? well, i
> guess String is a type. what are others? if bound to a different object,
> variable acquires type. But unbound...?
The rules that use unbound variables must make some implicit
assumptions about what these variables represent. What are these
implicit assumptions?
Ted
I have been pondering your original post all day and before I submit
my thoughts on it I have a question. What assumptions do the existing
MathPiper rules make about unbound variables?
For example, what type
are they assumed to be?
Bind() doesn't seem to care whether the variable was previously bound or not; it just attaches a new "object" to the symbol.
Unbind(), on the other hand, has to leave something (a symbol) in some kind of state, but that is not mentioned in the documentation. Perhaps the java code for Unbind() will tell you what kind of thing is left after using Unbind() on a symbol.
I recall that MathPiper has a built-in ability to create a wrapper of LocalSymbols() [ ... ] about a program block, in which all the "named" symbols are "decorated" (in the sense that term is used in C++ implementations) inside the enclosed block, transparently to the programmer.
I don't know how that is implemented in MathPiper,but I think some extension of the same technique might serve to let us at least prototype a Typing system such as I described in the previous note. By adding suitable "decorations" (invisible to the user/programmer inside the block), the Type information fore that symbol might be attached. Example : x is an element of Galois Field GF(7), and it appears internally as x$GF_7 or some such.
I say that this could be used for prototyping, mainly because it might be too slow for a final implementation. Each variable would have to be parsed by each function and operator using it, to see which variant overloaded function or operator should be called explicitly.
> The notion of type does does not, strictly speaking, apply here.
Here is what "The Handbook of Mathematical Discourse" by Charles Wells
(www.abstractmath.org/Handbook/handbook.pdf) has to say about the type
of a symbol:
-----------------------------------------------------------------------------------------------------------------------------------
TYPE - The type of a symbol is the kind of value it is allowed to have
in the current context.
Example 1: In the assertion "If f is differentiable and f (x) = 0 then
x is a critical point of f ."
we may deduce that f is of type function and x is (probably) of type
real, even if the author
does not say this.
This sort of type deduction requires both math-
ematical knowledge and knowledge of conventions; in
the present example one convention is that complex
numbers are more commonly written z instead of x.
Mathematical knowledge (as well as convention) tells us
that x cannot be of type integer.
TYPES AND SETS - One could dispense with the concept of type and refer
to the set of possible
values of the symbol. It appears to me however that "type" is
psychologically different from
"set". Normally one expects the type to be a natural and homogeneous
kind such as "function"
or "real number", not an arbitrary kind such as "real number bigger
than 3 or integer divis-
ible by 4". One has no such psychological constraint on sets
themselves. This needs further
investigation.
TYPE LABELING: means giving the type of a symbol along with the symbol. It is
a form of redundancy.
Example 2: If it has been established on some early page of a text
that S3 denotes the
symmetric group on 3 letters. A later reference to it as "the group S3
" or "the symmetric group
S3 " is an example of type labeling.
Remark 1: Russian mathematical authors seem to do this a lot, although
that may be
because one cannot attach grammatical endings to symbols.
References: Jeffrey Ullman, in a guest appearance in [Knuth, Larrabee
and Roberts,
1989], flatly recommends always giving the type of a symbol. Using
explicit typing in teaching is
advocated in [Wells, 1995]. See also [Bagchi and Wells, 1998a].
Difficulties: Students commonly make type mistakes
(talking about 2π being divisible by 2, for example); it
would be helpful to refer to the concept explicitly as a
way of raising consciousness. This is discussed in [Wells,
1995]. Citations: (HebMckWea89.47),(KulMir86.36).
581
Note 1:
Mathematicians do not use the word
"type" much in the sense used here.
When they do use it it typically refers
to a classification of structures in a
particular field, as in for example differ-
ential equations of hyperbolic type.
Note 2:
The discussion here is about using
the concept of type in communicating
mathematics, not its use in logic or
foundations. It is not inconsistent to
believe both of these statements:
* In mathematical teaching and
writing, it is helpful to mention
the type of a variable.
* Formal mathematical logic is best
done using untyped variables.
pages 580-581
-----------------------------------------------------------------------------------------------------------------------------------
Adding a "type labelling" capability for unbound symbols to MathPiper
(as described above) may be one way to solve the problem we are
discussing.
Ted
> Further thoughts on this subject. Empirical determination of what
> MathPiper (user language) and MathPiper-Java(underlying language) and
> perhaps MathPiper-Lisp-on-top-of-Java (effective language) consider to be
> the "type" of a symbol (not "variable" -- I agree with Grzesiek here).
"A Handbook of Mathematical Discourse"
(http://www.abstractmath.org/Handbook/handbook.pdf) has the following
definition for a variable:
"The noun variable in mathematical discourse generally refers to a
variate symbol." p. 604.
> Now, Unbind each of these.
>
> Can either MathPiper or Java distinguish a symbol which has never been bound
> from one that was bound and then unbound? Can Java? My guess (but the
> experiment should be made) is NO. In that case, an unbound symbol has NO
> STATE that can be measured or determined. Period.
>
> If it should happen that the answer is YES in any of the 3 cases mentioned
> above, then that would say a lot about the possibility that an unbound
> symbol may have a State. But I would be very surprised.
>
> Bottom line: pending proof to the contrary, I would say that an unbound
> symbol has no State; only an object which can be bound to this symbol has a
> State, and the symbol loses any such state (which "it" -- the symbol --
> never really "had") when that connection is severed.
>
> Or is all this completely missing some subtle point that I am blind to?
I think that Grzesiek's explanation of what an unbound variable
usually means in MathPiper is a good one:
"In most cases they belong to a field, either complex or real.
Unfortunately, it depends on the particular rule which field is
assumed, and there is some inconsistency in the
standard set of rules."
Your are correct in your thought that unbound variables in MathPiper
have no extra information associated with them. The people who wrote
most of the rules in MathPiper simply _assumed_ that all unbound
variables belonged to the real field or the complex field and this
assumption was then encoded into the logic of the rules.
Ted
Grzesiek wrote:> The notion of type does does not, strictly speaking, apply here.
Here is what "The Handbook of Mathematical Discourse" by Charles Wells
(www.abstractmath.org/Handbook/handbook.pdf) has to say about the type
of a symbol:-----------------------------------------------------------------------------------------------------------------------------------
TYPE - The type of a symbol is the kind of value it is allowed to have
in the current context.
TYPE LABELING: means giving the type of a symbol along with the symbol. It is
a form of redundancy.Example 2: If it has been established on some early page of a text
that S3 denotes the
symmetric group on 3 letters. A later reference to it as "the group S3
" or "the symmetric group
S3 " is an example of type labeling.Remark 1: Russian mathematical authors seem to do this a lot, although
that may be
because one cannot attach grammatical endings to symbols.
Adding a "type labelling" capability for unbound symbols to MathPiper
(as described above) may be one way to solve the problem we are
discussing.
I cannot get my mind around the -- to me -- overly subtle distinctions you are making.
> You guys are completely losing me. I cannot get my mind around the -- to me
> -- overly subtle distinctions you are making. Perhaps that just means I
> have too concrete a mind to be in this business.
>
> It seems simple to me. A student in college is learning about Finite
> Fields. She wants to be able to play around with it, using MathPiper as an
> educational tool. She wants to declare that she is working in, say, F7, and
> have all calculations subsequently be made in F7, so that if she types 3 * 6
> the answer should be 4, rather than 18. She wants to say that x is an
> unbound variable over F7, so that the polynomial multiplication
> (2*x^2-3)*(5*x+6) would automatically be done mod 7 on the coefficients (I
> think this would be 3*x^3+5*x^2+6*x+3, but don't hold me to it!). At a more
> advanced level, she might eventually want to be able to perform polynomial
> arithmetic modulo a specified "prime" polynomial.
>
> Maybe in fact this is simply outside the scope of MathPiper as we see it,
> but to me that would be a pity. I am not aiming at professional
> mathematicians here, but students who need to practice and be assured the
> the answers will be correct.
>
> Comments?
At this point I think it would be helpful if we looked at how some of
the other CASs implement the capabilities you would like to add to
MathPiper. My thought is that Axiom, Sage, Maxima, and Reduce would be
good ones to use.
We can start with the F7 example you have provided. Do you have any
other examples in mind that can be used for the comparison?
Ted
> Right. It went too far for no good reason. Sorry for the noise.
So far I have found the discussion we have been having to be helpful.
I think that we have just begun to scratch the surface of this issue
and it is going to take significantly more discussion and research
before we resolve it :-)
Ever since MathPiper was forked from Yacas in 2008, Sherm and I have
been putting off truly trying to understand how MathPiper works at it
deepest levels until we had gained a reasonable understanding of how
it works at shallower levels. If we are going to attempt to implement
the capabilities that Sherm is proposing, I don't see how we can do it
without (finally!) completely figuring out how MathPiper works first.
Sherm, earlier in this discussion you wrote:
"So you are saying that all the "expectations" concerning its
"properties" are embodied in the hodgepodge of rules, written by
different people at different times and, as you say, undoubtedly
inconsistent in many places."
My understanding is that most of the rules in MathPiper were written
by just two people (Ayal Pinkus and Sergei Winitzki) and they worked
closely together over a number of years creating the MathPiper
rulebases. As you suggested earlier, turning our attention to the
details of how the MathPiper rules system works may be a good way to
proceed.
I can put together a description of my current understanding of how
the MathPiper rule system works as a way to begin this discussion.
What do both of you think about this idea?
Ted