Skip to content

Infinite recursion found in Rubi-based SetDelayed assignments for EqQ and Star #1884

Description

@rocky

Description

Rubi is not loading, failing with:

$RecursionLimit::reclim: Recursion depth of xxx  exceeded.

It is failing in IntegrationUtilityFunctions.m which is read before any Integration rules are read in.

How to Reproduce and Output Given

Run/Import/Get this file star-bug.wl:

(*Extracted from Rubi IntegrationUtilityFunctions.m Integration Utility Functions*)

(* If u-v equals 0, EqQ[u,v] returns True; else it returns False. *)

EqQ[args___] := Null /; EqQ[args]

(* Star[u,v] displays as u*v, and returns the product of u and v with u
   distributed over the terms of v." *)

Star[u_,v_] := (
  Message[Star::error];
  0 ) /;
EqQ[u,0]

Star[u_,Star[v_,w_]] :=
  Star[u*v,w]
Print["Succeeded"]

The following is output instrumented to show recursive calls to the internal function inc_recursion_depth of Evaluation

In[1]:= Get["star-bug.wl", Trace->True]
Reading file: ./star-bug.wl

    2: (* If u-v equals 0, EqQ[u,v] returns True; else it returns False. *)

    4: EqQ[args___] := Null /; EqQ[args]

    6: (* Star[u,v] displays as u*v, and returns the product of u and v with u
        distributed over the terms of v." *)
    9: Star[u_,v_] := (
  Message[Star::error];
  0 ) /;
EqQ[u,0]

   14: Star[u_,Star[v_,w_]] :=
     Star[u*v,w]

(u:_) Star(v:_) Star (w:_) := u * v Star w

(u:_) Star(v:_) Star (w:_) := u * v Star w

(u:_) Star(v:_) Star (w:_) := u * v Star w

Expected behavior

Should print "Succeeded"

Additional context

As stated above, Rubi is broken as a result of this bug. I've Mathics 10.0 and 9.0, and these both give a maximum recursion error exception as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions