# Discrepancy between ReplaceList and ReplaceAll?

Consider the following

ClearAll[eqv, not, neqv, p, q, r]
ReplaceAll[eqv[neqv[p, q], r], neqv[p_, q_] :> not[eqv[p, q]]]


eqv[not[eqv[p, q]], r]

According to the documentation, I should expect ReplaceList to return (at least) this result in a list, but, instead, I am surprised to get an empty list:

ClearAll[eqv, not, neqv, p, q, r]
ReplaceList[eqv[neqv[p, q], r], neqv[p_, q_] :> not[eqv[p, q]]]


{}

Again, according to the documentation, ReplaceList thinks there is no transformation possible, but ReplaceAll found one. I didn't see any indication that ReplaceList could be expected to return the empty list under any other circumstances.

This is important because in some deeper and more complicated programs, I need to scan all alternative replacements, but I now fear I can't trust ReplaceList.

Mathematica 11.3.0.0 Ubuntu 18.04

This is within the documented design of these functions.

ReplaceList[expr,rules] attempts to transform the entire expression expr by applying a rule or list of rules in all possible ways, and returns a list of the results obtained.

ReplaceAll[expr,rules] applies a rule or list of rules in an attempt to transform each subpart of an expression expr.

Perhaps a simpler example clarifies things:

In[3]:= ReplaceList[{1, 2, 3, 4}, x_Integer :> x^2]

Out[3]= {}

In[4]:= ReplaceAll[{1, 2, 3, 4}, x_Integer :> x^2]

Out[4]= {1, 4, 9, 16}

• Sure enough, ReplaceList[neqvRule] /@ eqv[neqv[p, q], r], mapping instead of applying, reveals what I expected eqv[{not[eqv[neqv[p], neqv[q]]], not[eqv[p, q]]}, {}]. – Reb.Cabin Oct 13 '18 at 20:36