# Assumptions with conditions

How does one specify the assumption that a function is real for real arguments?

Compare

Simplify[Re[I f[x]], Assumptions -> f[x_] ∈ Reals]

0


with

Simplify[Re[I f[x]], Assumptions -> x ∈ Reals && f[x_/;x ∈ Reals] ∈ Reals]

-Im[f[x]]


How do I get zero in the second case?

• Well, I know it does work in some cases, but pattern-matching-based assumption is never documented… – xzczd Sep 12 '19 at 10:24
• @xzczd How would you otherwise formulate the mathematical fact of this kind about the given function? – yarchik Sep 12 '19 at 11:31
• The first case will be Simplify[Re[I f[x]], Assumptions -> f[x] ∈ Reals], but sadly I've no idea how to express 2nd case. – xzczd Sep 12 '19 at 11:47
• Re[I f[x]] // ComplexExpand – Bob Hanlon Sep 13 '19 at 4:56
• @BobHanlon No, ComplexExpand unconditionally assumes that all symbols are real. I need to impose a condition. For instance ComplexExpand[Re[I (f[x] + f[I x])]] gives me zero. But if f[z] is Sin[z]---it is a false statement. – yarchik Sep 13 '19 at 5:36