1
$\begingroup$

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?

$\endgroup$
  • $\begingroup$ @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. $\endgroup$ – vasili111 Aug 19 '18 at 15:31
2
$\begingroup$

Just add the additional column !q:

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

$\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}$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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