vermaseren / form

The FORM project for symbolic manipulation of very big expressions
GNU General Public License v3.0
982 stars 118 forks source link

Corruption when replacing a function by a tensor #387

Open benruijl opened 3 years ago

benruijl commented 3 years ago
V p1;
CF f;
CT t;

L F = f(p1);

Multiply replace_(f, t);

Print +s;
.end

yields

   F =
       + t(7_,p1)
      ;

Try f(p1+p2) for more impressive corruption.

vermaseren commented 3 years ago

I would call this a compiler omission. Clearly using replace_ to replace a function by a tensor should not be allowed. It might be rather difficult to catch all of this though, because the function or the tensor could be coming from $-variables. In that case the calamity happens at a later stage. Maybe the safest approach would be to intercept this during execution and have the program crash on it. It is also the easiest to implement.

It is a clear example of that one cannot think of everything in advance.

On 3 Jun 2021, at 17:12, Ben Ruijl @.***> wrote:

V p1; CF f; CT t;

L F = f(p1);

Multiply replace_(f, t);

Print +s; .end yields

F =

  • t(7_,p1) ; Try f(p1+p2) for more impressive corruption.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/vermaseren/form/issues/387, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJPCEU7BAX6ER64BIACZJDTQ6LVRANCNFSM46A7Q2TQ.