# Simplify with assumption of unknown function [duplicate]

I have an unknown multivariate function entry[x,y,z], which is positive. Then how to get FALSE and entry[1,2,3] in the following evaluations?

FullSimplify[entry[1, 2, 3] < 0, entry[_, _, _] > 0]
FullSimplify[Sqrt[entry[1, 2, 3]^2], entry[_, _, _] > 0]

• Related: (6182) Apr 8 '15 at 15:37
• Very closely related, probably a duplicate: Unknown function with arbitrary arguments assumption
– Jens
Apr 8 '15 at 16:55
• The accepted answer to the question I linked earlier also works for this case. So I would say it's a duplicate. You just have to do your simplifications wrapped by AssumingAll[entry[__]>0, ...]
– Jens
Apr 9 '15 at 4:14
• @Jens Thanks! Maybe I agree this is a duplicate. I am such a novice in Mathematica that I cannot immediately comprehand the commands in that "AssumingAll" function. So I gave my own poor solution beneath. I guess that "AssumingAll" is more advanced in functionality. It will be so nice of you to say something about that. Apr 9 '15 at 4:27

This might be what you want:

myfullsimplify[expr_, assum_] := Module[
{pat, tmp, seq},
pat = FirstCase[Level[assum, Infinity], p[_]] /. p[x_] -> x;
tmp = FirstCase[Level[expr, Infinity], pat];
seq = {expr, assum} /. {pat -> #, p[_] -> #};
FullSimplify @@ seq /. # -> tmp
]


It's used as follows:

myfullsimplify[entry[1, 2, 3] < 0, p[entry[_, _, _]] > 0]
myfullsimplify[Sqrt[entry[1, 2, 3]^2], p[entry[_, _, _]] > 0]


You'd have to wrap your pattern with p[...] though.

Here comes a simple solution, perhaps. The two cases characterize the usage well.

expr = Sqrt[f[y[qq], z]^2] + Sqrt[DD[2, 3, 4]^2] + (f[1, 2] > 0);

FullSimplify[expr, Thread[Cases[expr, x_[___] /; ! ValueQ[x], Infinity] > 0]]
FullSimplify[expr, Thread[Cases[expr, f[___] /; ! ValueQ[f], Infinity] > 0]]

Out[94]= True + DD[2, 3, 4] + f[y[qq], z]
Out[95]= True + Sqrt[DD[2, 3, 4]^2] + f[y[qq], z]

• The output doesn't seem to make mathematical sense because addition of logical values isn't defined.
– Jens
Apr 9 '15 at 4:04
• Yes. I just want to show the possible usage. Apr 9 '15 at 4:13