vermaseren / form

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

Pattern matching negative vectors sometimes drops the minus sign #544

Open abehring opened 4 days ago

abehring commented 4 days ago

I've noticed that the current version 5 of FORM sometimes drops a minus sign when matching a single negative vector. A minimal working example is

S du1;
CF Delta;
V p13,v1,D;

L debug=Delta(-p13,5);

id Delta(v1?,du1?)=D.v1^du1;

Print +s;
.end

With an ancient FORM 3.3 binary I get the expected

       - p13.D^5

while the current master branch yields:

       + p13.D^5

@jodavies also observed that the exact syntax on the right-hand side of the id statement matters for whether the bug is triggered:

jodavies commented 4 days ago

While discussing this with @abehring I bisected this to c5a24b7c2b476a3c3a65f524d4b14ed4bf3a7059 . It is somewhat surprising that this behaviour has been in the code for so long, without being noticed.

There are several issues on the tracker related to negative vectors, but I don't think any of them are quite the same as this one.