# Using Assuming with Reduce

I have the following code that includes Assuming to cut through irrelevant detail, or so I had hoped.

Assuming[w > 1/2 && P < 1, Reduce[P + f (-1 + P) (-1 + 2 w) > 0]]


To my detriment Mathematica generates an output whose first condition is $w<\frac{1}{2}$

How can I get Mathematica to use my assumptions to focus on only those values that apply within those assumptions?

• Assuming[w > 1/2 && P < 1, FullSimplify@Reduce[P + f (-1 + P) (-1 + 2 w) > 0]]? – kglr Aug 10 '18 at 12:11
• Oh dear. That was beautiful! – user120911 Aug 10 '18 at 12:17

## 3 Answers

• Assuming affects the default assumptions for all functions that have an Assumptions option.

Assumptions is not an option for Reduce:

Options[Reduce]


{Backsubstitution -> False, Cubics -> False, GeneratedParameters -> C, Method -> Automatic, Modulus -> 0, Quartics -> False, WorkingPrecision -> ∞}

You can wrap Reduce with FullSimplify:

Assuming[w > 1/2 && P < 1, FullSimplify@Reduce[P + f (-1 + P) (-1 + 2 w) > 0]]


f (-1 + P + 2 w - 2 P w) < P

There is a warning in the docs for FullSimplify:

Some of the transformations used by FullSimplify are only generically correct.

It's also true for Simplify (e.g. Simplify[Sin[Pi x]/x == 0, x ∈ Integers]). Often one uses Reduce to avoid such errors.

One way to introduce assumptions in Reduce is to include them as constraints:

Assuming[w > 1/2 && P < 1,
Reduce[\$Assumptions && P + f (-1 + P) (-1 + 2 w) > 0]]
(*  w > 1/2 && P < 1 && f < -(P/(1 - P - 2 w + 2 P w))  *)


As mentioned by @kglr (+1) Reduce will ignore the conditions in Assuming but FullSimplify will use them.

Composition[
MemberQ[Assumptions],
Keys,
Options
] /@ {Reduce, FullSimplify}
(* {False, True} *)


Another option would have been to incorporate your assumptions into the expression to Reduce.

Reduce[
And @@ {
P + f (-1 + P) (-1 + 2 w) > 0,
w > 1/2,
P < 1
}
]
(* w > 1/2 && P < 1 && f < -(P/(1 - P - 2 w + 2 P w)) *)