# Is there a limit to ReplaceAll rule list?

Basically I declared a simplify (small 's') function:

simplify[expr_, assump_] := Simplify[ expr /. rulelist, assump];


This scans assump which is logically connected assumptions, expanded with LogicalExpand (therefore in Disjunctive Normal Form):

(a > b && n == m) || (c > a && b != 0) || etc


this then gets broken down in consideration to whether it is Or-ed or And-ed. Then the relational expressions are recognized using pattern matching:

a > b, n == m, etc...


Then I create rules for them:

a > b -> True, n < m -> False, etc


which are all in rulelist.

A very simple approach, but necessary. As from what I've been told, Simplify would rather opt for the expensive Cylindrical Algebraic Decomposition before trying much less expensive approaches.

expr is my input and is typically quite big expression of equations logically connected together (And-ed and Or-ed).

The problem is that I get the error:

ReplaceAll::reps:


I checked the error ouput (I won't post it here) and I inserted Print to see the rulelist as it is executed. The rulelist seems to be fine. So I'm leaning towards the explanation that I'm reaching the limit of allowed rules in a rulelist to be ReplaceAll-ed.

The resulting rulelist contain some trivial assumptions, var1 > 0, var1 > var2, etc, and some very large equalities/inequalities from previous calculations (being the majority of them), expanding to several rules for each. Right now, the Length[rulelist] is just 98 but will be even larger later.

So is the error due to the max limit being reached? What system variable do I need to modify??

If it's the max being reached, I'd rather first try increasing the limit, before writing my own replaceall, that takes rulelist bit by bit using another function.

• Normally, I'd just go "Is there a limit to ReplaceAll rule list?" in the body, but nowadays I have to prove that I'm not a literal monkey behind the keyboard. So I can get some decent help and not a bunch of downvotes. Hence all this fodder. Commented Nov 7, 2016 at 12:12
• According to the docs, ReplaceAll::reps is generated "when the indicated expression does not have the expected form of a rule, a list of rules, or a dispatch table". If I understand your process correctly, your list of rules is automatically generated. My gut feeling O'Sullivan be that something might have gone subtly wrong during the generation, and an error output snuck into your rule list, thereby invalidating all of it. I'd painstakingly inspect an example of a rule list that generates this error first. Perhaps you could share a simple example of such a list as well. Commented Nov 7, 2016 at 14:50