# How to add additional variable columns for negated variables to generated truth table

I am creating truth table for $p\Rightarrow !q$ with:

TableForm[BooleanTable[{p, q, p \[Implies] ! q}, {p, q}], TableHeadings -> {None, {p, q, p \[Implies] ! q}}]


Truth table looks like:

p        q         p->!q
True    True    False
True    False   True
False   True    True
False   False   True


"->" in table above and below actually looks like "$\Rightarrow$". This because I cannot use latex for implication in the code segment.

I want to generate a table for $p\Rightarrow !q$ logic statement (and also to be able to do same with other logic statemens) so, that it also shows aditional columns for negated variables that are negated in a statement. For $p\Rightarrow !q$ generated table should look like:

p        q         !q        p->!q
True    True    False   False
True    False   True    True
False   True    False   True
False   False   True    True


How can I do it?

• @kglr Thank you. That is what I needed to do. I also understand how to include additional columns for other statements. If you want you can answer the question and I will accept it. – vasili111 Aug 19 '18 at 15:31

Just add the additional column !q:
TableForm[BooleanTable[{p, q, ! q, Implies[p, ! q]}, {p, q}],

$\begin{array}{cccc} p & q & \neg q & p\Rightarrow \neg q \\ \text{True} & \text{True} & \text{False} & \text{False} \\ \text{True} & \text{False} & \text{True} & \text{True} \\ \text{False} & \text{True} & \text{False} & \text{True} \\ \text{False} & \text{False} & \text{True} & \text{True} \\ \end{array}$