The section on Boolean operators suggests that FindInstance can be applied to them. However, when I try to use it I get a rather confusing error:

Horses :=
  (Result == 100 / Speed) &&
  ((Horse == 1) \[Equivalent] (Speed == 1)) &&
  ((Horse == 2) \[Equivalent] (Speed == 20))

Result = 5
FindInstance[Horses, {Horse}]

produces the dreaded not a quantified system of equations and inequalities error with no statement of which part is the problem.

Can I not use the relational operator Equivalent in FindInstance, or is what I'm trying to do generally invalid?

  • 1
    $\begingroup$ The documentation of FindInstance suggests to me that it can solve satisfiability problems on Boolean statements which contain Boolean-valued variables (I.e. with a True/False value). Your case is trying to solve an algebraic equation with real-valued variables, expressed as a logical statement. I saw no indication that this is possible with FindInstance. $\endgroup$
    – MarcoB
    Commented Dec 17, 2019 at 4:21
  • $\begingroup$ I saw a comment that <=> isn’t a valid operator. What I actually entered was ESC <=> ESC which I’m not sure how to represent on SO. I’m surprised if using the function call form alone fixes the problem. $\endgroup$
    – Mark Green
    Commented Dec 17, 2019 at 12:45

1 Answer 1


Your corrected code works well:

Horses := (Result == 100/Speed) &&Equivalent[(Horse == 1), (Speed == 1)] && 
Equivalent[(Horse == 2), (Speed == 20)];Result = 5;
FindInstance[Horses, {Horse, Speed}]

{{Horse -> 2, Speed -> 20}}

  • $\begingroup$ Great. I did have a really bizarre follow-up, though. I then tried change Horse==1 to Horse=="Nag", and Horse==2 to Horse=="Thoroughbred". This caused Mathematica to give a bizarre error message that "the system contains a nonconstant expression Nag", even though Nag should just be a string literal. Even changing it to String["Nag"] didn't stop this error. Weird. $\endgroup$
    – Mark Green
    Commented Dec 17, 2019 at 20:31
  • $\begingroup$ ... Also, adding && MemberQ[{1,2},Horse] to the Horses system makes it return no instances, even though the instance above makes that true also. $\endgroup$
    – Mark Green
    Commented Dec 17, 2019 at 20:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.