# How to generate the truth table to prove logical equivalence?

How to generate the truth table to show that $p \implies (q \vee r)$ is equivalent to $(p \wedge \neg q ) \implies r$ ? Can I use BooleanTable?

• BooleanTable[Implies[p, q || r], {p, q, r}] == BooleanTable[Implies[p && Not[q], r], {p, q, r}] Commented Dec 20, 2013 at 0:48
• Alternatively, Reduce[Equivalent[Implies[p, q || r], Implies[p && Not[q], r]]] Commented Dec 20, 2013 at 0:57

(from the comments of belisarius & Daniel Lichtblau)

Equal[
BooleanTable[Implies[p, q || r], {p, q, r}],
BooleanTable[Implies[p && Not[q], r], {p, q, r}]
]

(* ==> True *)


Or without truth tables:

Reduce[Equivalent[Implies[p, q || r], Implies[p && Not[q], r]]]

(* ==> True *)


Here is a Rube Goldberg Machine that handles sequences of formulae.

truthTableFormattor[rawData_] := Insert[Insert[
Grid[rawData /. {0 -> 0,
1 -> Item[1, Background -> Lighter[Magenta]]},
FrameStyle -> Gray,
Frame -> All], {Background -> {None, {GrayLevel[0.7], {White}}},
Dividers -> {Black, {2 -> Black}}, Frame -> True,
Spacings -> {2, {2, {0.7}, 2}}}, 2], {Dividers -> All,
Spacings -> .7 {1, 1}}, 2];

truthTable[f__] :=  Module[{}, atoms = Cases[Most[{f}],
(a_ /;Length[a] == 0 \[And] Not[StringQ[a]])];heads =