help-bison
[Top][All Lists]

## Re: Union Type Object problem

 From: Hans Aberg Subject: Re: Union Type Object problem Date: Fri, 13 Aug 2004 19:17:45 +0200

```At 00:39 +0200 2004/08/13, Laurence Finston wrote:
>> OK. I did not realize that CWEB is the program which does the WEB to C
>> translation. (When you mention, I recall it, but I have not followed the
>> TeX stuff so carefully in late years).
>
>No, WEB is for Pascal and CWEB is for C and C++.  `web2c' converts the Pascal
>source of TeX (and maybe MF/MP, I don't know) to C.

OK.

>>  I can send you
>> some code, if you want to.
>
>Thank you for your offer.  I may take you up on it in the future, but there
>are many things on my to-do list before I get to this task.

The equation solving works out easily like this: A key component in a
Prolog program is the unification of two formulas x, y, i.e., find the set
u(x, y) of substitutions s that make s(x) identical to s(y) (and in
traditional Prolog this set is has at most one element, but in general
math, this need not be so). The set of operations allowed in the formulas
x, y correspond to the "constructors" in functional languages like ML and
Haskell, so if these are chosen cleverly, it is easy to find the unifying
substitution, if it exists.

Now, in order to solve the kind of linear equations you indicated, one
merely adds + as a constructor. One will then have to think about how to
invert the equations. In CLP(R), one usually restricts to linear equations.
Higher order equations can be attacked using Buchberger's GBA (Groebner
Basis Algorithm). If one, for example, adds list concatenation as operator,
it leads to a difficult problem in mathematical group theory, which it is
unclear if it has been solved.  So one can play around with different
categories of equations to get automated solving built into your program,
this way.

Hans Aberg

```