# Puzzling behavior produced by Exists

I need to simplify a set of solutions of a system, say for example:

A := (a[1] == 3 && a[2] <= 1 && b[1] <= 5) || (a[1] == 3 && a[2] == 1 && b[1] == -7)


I care only about a[1] and a[2] but I can not use Eliminate since I have inequalities. So one solution is:

Simplify[Reduce[Exists[{b[1]}, A]]]


a[1] == 3 && a[2] <= 1

It works! But since I have a large system (many b's) I need to automate this. Since:

Array[b, 1]


{b[1]}

I tried:

Simplify[Reduce[Exists[Array[b,1],A]]]


a[1] == 3 && a[2] <= 1 && b[1] <= 5

The second method yields the wrong outcome! What am I doing wrong here?

• I just noticed you deleted your other question... did you get an answer? I was midway through writing one...
– rm -rf
Commented Mar 28, 2013 at 23:59
• sorry for wasting your time! after digging more I found this mathematica.stackexchange.com/questions/3070/… which solves my other problem. thanks. Commented Mar 29, 2013 at 1:24
• Ok, no problem. In any case, what you had was mostly fine; you just needed to use HoldPattern. For example, HoldPattern[a@# == _] -> True & /@ Range@5 will generate replacement rules for a[1] through a[5]
– rm -rf
Commented Mar 29, 2013 at 1:38

Exists has attribute HoldAll:

Attributes[Exists]


You need to do

Simplify@Reduce@Exists[Evaluate@Array[b, 1], A]
(* a[1] == 3 && a[2] <= 1 *)

• Heh, guess you beat me to it. Didn't see your answer until I entered mine.
– VF1
Commented Mar 27, 2013 at 0:43

Exists has the attribute HoldAll:

Attributes[Exists]

As such, specifying Exists[Array[b, 1], A] in your argument for Reduce is the same thing as telling that there is exists a value for the symbol of the form Array[b,1], verbatim, which makes A true.
Using Evaluate to make sure that Array is expanded into its appropriate set of values, you can achieve the desired result:
Simplify[Reduce[Exists[Evaluate[Array[b, 1]], A]]]

• We also adopted the same style for posting code: code followed by (* return value *). You just wrote a little more explanation. I'm tired instead, 2AM here... Good night! Commented Mar 27, 2013 at 0:47