3

Is it possible to ask Mathematica to give us the boolean value of a proposition assuming the boolean value of some parts of it?

For instance, give the boolean value of $p\vee q$ assuming that $p$ is true and $q$ is false.

Karsten7
  • 27,448
  • 5
  • 73
  • 134
Concept7
  • 139
  • 1
  • 3
    Simplify[Or[p, q], Not[q]] outputs p, for instance. Simplify[Or[p, q], p && Not[q]] outputs True. – Patrick Stevens Sep 18 '15 at 12:13
  • 2
    Patrick, Why don't you post your comment as a response? I wasn't aware that Simplify could make boolean inferences. – DavidC Sep 18 '15 at 12:32
  • Simplify[Or[p, q], p && ! q] yields True. In fact it was stated in this post Solve for when two symbolic complex numbers are equal – Artes Sep 18 '15 at 12:48
  • But when you input something like Simplify[And[p,q], p && Not[q]] it outputs q, it's not really doing the right thing, because I know, and I wanted Mathematica to know, that q is false, I believe it's not clear in that instruction that that is a fact. – Concept7 Sep 18 '15 at 13:59
  • @Concept7 OK, what about Simplify[And[p, q], Not[q]], which returns False? – Patrick Stevens Sep 18 '15 at 14:43
  • @PatrickStevens but in that case we wouldn't give the information that pis true. Is there a way to give more than one assumption? – Concept7 Sep 18 '15 at 14:47
  • @Concept7 Yes. Simplify[expr, p && Not[q]]. I don't understand your question. – Patrick Stevens Sep 18 '15 at 15:39
  • @PatrickStevens I want to say that p is true and q is false, aren't you assuming only p && Not[q], I mean aren't you assuming something about the conjunction instead of the atomic propositions? – Concept7 Sep 18 '15 at 16:19
  • 1
    @Concept7 $p$ is true and $q$ false iff $p \wedge \neg q$. – Patrick Stevens Sep 18 '15 at 16:28
  • Yes, that works for $\wedge$ for doesn't work every time. For instance: Assuming that $p\Rightarrow q$ is true, what's the boolean value of $(p\vee r)\Rightarrow (q\vee r)$? Is there a simple method of solving this in Mathematica? – Concept7 Sep 18 '15 at 16:33
  • 1
    I suddenly stopped understanding, why Simplify[Or[p, q], Not[q]] gives p, but Simplify[Or[p,q], Not[q] == True] gives Or[p, q]... I like this approach though: With[{q = True}, And[p, q]] – LLlAMnYP Sep 19 '15 at 10:19

2 Answers2

3

Simplify handles this.

Simplify[And[p, q], Not[q]]

returns False.

Simplify[And[p, q], q]

returns p.

Patrick Stevens
  • 6,107
  • 1
  • 16
  • 42
2

You can use BooleanTable or simply rule replace:

TableForm[BooleanTable[{p, q, Or[p, q]}], 
 TableHeadings -> {None, {"p", "q", "p \[Or] q"}}]

enter image description here

p \[Or] q /. {p -> True, q -> False}

yields True

Some other examples:

ex1 = a \[Or] b /. {a -> True, b -> False}
ex2 = ex1 && c /. {c -> True}
ex3 = ex1 \[Implies] d /. {d -> False}

yielding True,True, False respectively.

ubpdqn
  • 60,617
  • 3
  • 59
  • 148