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 =
ToString[TraditionalForm@#] & /@ {f};
rawData = Transpose@Boole[BooleanTable[#, atoms] & /@ {f}];
If[Last[{f}] === 1,
Transpose@Boole[BooleanTable[#, atoms] & /@ Most[{f}]],
If[Last[{f}] === "rev",
truthTableFormattor[{ToString[
TraditionalForm@#] & /@ (Most@{f})}~Join~
Transpose[(Reverse /@
Boole[BooleanTable[#, atoms] & /@ (Most@{f})])]],
truthTableFormattor[{heads}~Join~rawData]]]];
f0[a0_, a1_, a2_, a3_] := a0 \[And] \[Not] a1 \[And] \[Not] a2 \[And] a3;
truthTable[a0, a1, a2, a3, f0[a0, a1, a2, a3]]

BooleanTable
command. Does it help? For creating the corresponding function you can use logical and:&&
and logical or:||
in case you don't know. $\endgroup$ – user59583 Dec 3 '18 at 6:17BooleanTable
can help me, but it cannot generate a table like the picture above, it only returns a series of true or false. $\endgroup$ – user61698 Dec 3 '18 at 6:23TableForm
with the optionTableHeadings
for the result. Something like:TableForm[{{a, b, c, d}}, TableHeadings -> {None, {"a0", "a1", "a2", "a3"}}]
$\endgroup$ – user59583 Dec 3 '18 at 6:24TableForm[{{True, False, True, False, f0[True, False, True, False]}}, TableHeadings -> {None, {"a0", "a1", "a2", "a3", "b0"}}]
$\endgroup$ – user61698 Dec 3 '18 at 6:44