Changing the direction of the rewrite rule arrow operators

8 views
Skip to first unread message

Ted Kosan

unread,
Jul 8, 2019, 10:31:32 PM7/8/19
to mathpi...@googlegroups.com
Mathematica is a rewrite system ("Mathematica as a Rewrite Langauge",
Bruno Butchberger), and MathPiper is partially based on Mathematica. A
rewrite system is a kind of production system
(https://en.wikipedia.org/wiki/Production_system_(computer_science)).
The arrows of production system rules typically point to the right
("Knowledge Representation: Logical, Philosophical, and Computational
Foundations", John Sowa, Brooks/Cole, 2000, p.165). This evidence
implies that MathPiper's rules should point to the right instead of to
the left. Therefore, I am in the process of changing the global
rewrite rule arrows from "<--" to "-->", and the local rewrite rule
arrows from "<-" to "->".

However, inside the documentation "in_prompt" folds, "->" is currently
being used as a symbol that separates example code from its output. I
would like to change this symbol so it does not clash with the new
"-->" and "->" rewrite rule arrows. One possibility that comes to mind
is ":::". For example:

2-3 -> -1

would become

2-3 ::: -1

Can anyone think of a better symbol than ":::" for this purpose?

Ted

Kory Byrne

unread,
Jul 8, 2019, 10:43:34 PM7/8/19
to mathpi...@googlegroups.com

Hmm... The first thing that comes to mind is '=>', although maybe that is too similar to '->'? Fortunately due to mathpiper's predicate naming convention, it wouldn't be confused with >= or <=.

My other thought is, and this is probably due to me not knowing what this "in_prompt" fold is, but why not use the standard mathpiper console "In>" and  the result is below?


--
You received this message because you are subscribed to the Google Groups "mathpiper-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathpiper-dev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mathpiper-dev/CAOJRwx1SemdYZ0dtEX7%3DW-A1-ZFxzPgSG7zuast%2BFZitXZ2Y%3Dw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Ted Kosan

unread,
Jul 8, 2019, 10:58:59 PM7/8/19
to mathpi...@googlegroups.com
Kory,

Here is an example of an "in_prompts" fold:

%mathpiper,name="-",subtype="in_prompts"

2-3 -> -1
-3 -> -3

%/mathpiper

It will result in the following examples being placed into the
documentation page for the unary and binary minus operators:

In> 2-3
Result: -1

In> - 3
Result: -3

It also results in the following tests being added to the test suite:

Verify(2-3, -1);
Verify(-3, -3);

The intent of the "in_prompts" system is to enable the test suite to
test as may of the examples in the documentation as possible.
Christopher and Kyle have been working hard on converting the
documentation examples to this system, and it has resulted in a
significant increase in their correctness.

The symbol "=>" may be used in the future for other kinds of
production rules. However, your idea of using the following is
interesting:

In> 2-3
-1

Ted
>> To unsubscribe from this group and stop receiving emails from it, send an email to mathpiper-de...@googlegroups.com.
> --
> You received this message because you are subscribed to the Google Groups "mathpiper-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to mathpiper-de...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/mathpiper-dev/CAEQJeZDVKTTJMzJFi7tY4uF7-nJ%3D_t-cQX4qSGPXz%3DkVHEWb1Q%40mail.gmail.com.

Nick

unread,
Jul 9, 2019, 12:40:01 AM7/9/19
to mathpi...@googlegroups.com

Ted Kosan

unread,
Jul 10, 2019, 1:18:38 AM7/10/19
to mathpi...@googlegroups.com
I think "~>" is better than ":::", and since it involves minimal
changes to the documentation processing code, I am going to use it
(for now).

Ted
> To view this discussion on the web visit https://groups.google.com/d/msgid/mathpiper-dev/CAFU-7WDPwHkFHeKKE%2B65Cvr2AB2Y0OGugnepO%3DttXumeJLJ3Mw%40mail.gmail.com.

Ted Kosan

unread,
Jul 11, 2019, 8:51:44 PM7/11/19
to mathpi...@googlegroups.com
As of commit 53816a5c, the "<--" global rewrite rule operator has been
changed to "-->, the "<-" local rewrite rule operator has been changed
to "->", and the "->" "in_prompts" symbol has been changed to "~>".

Ted
Reply all
Reply to author
Forward
0 new messages