How can I draw truth tables using Mathematica [duplicate]

This question already has an answer here:

Creating truth tables [closed]

1 answer

For instance, the given expression p ⊕ (p v q)
In the problem I’m trying to solve. There’s a Mathematica answer to this:

p → ¬ q

which is:

BooleanTable[{p, Implies[p, ! p]}, {p}]// TableForm

True False
False True

I would appreciate some guidance on how to approach this so I can do the rest on my own.

=================

=================

1 Answer
1

=================

I think this is what you are looking for:

BooleanTable[Xor[p, p || q], {p}, {q}] // TableForm

  

 

why did you use {p}, {q} instead of {p, q}?
– wa7d
Jan 25 at 22:08

  

 

@wa7d The only reason is that with {p}, {q} I get the data in a nested list that I can pass directly to TableForm. With {p,q} the values are not sorted into columns and rows.
– C. E.
Jan 25 at 22:28