# Is There a Quick Way to Make a Logic Table Like This?

This is a typical table from Elliott Mendelson's Introduction to Mathematical Logic.

This is part of a method for determining if a statement form is a tautology. I would like to be able to reproduce it in an efficient way.

• Not sure if there's a faster way than the "obvious" solution of using a array environment and careful manipulation of spacing (needs some knowledge of TeX spacing rules etc. I think) to make the first line correct. Aug 15, 2022 at 15:56

You can do it quick, or you can do it well. It's pretty hard to do it both. You'll notice even the one you posted, which I gather is taken right from Mendelson's published book, is screwed up. The T in line 2 should be under the biconditional, not under the A.

The best approach I can think of is to use an array (or tabular). The hard thing is to make the formula at the top have something like its usual mathematical spacing. If you break each statement and connective into its own cell, the usual LaTeX math spacing rules will get ignored. So what you basically have to do is use @{…} in the column specifier between every column, and put in spaces @{\ } before and after the binary connectives, and remove all inter-column space @{} elsewhere.

The resulting code is a little ugly:

\documentclass{article}
\usepackage{array}
\usepackage{amssymb}
\usepackage{mathpazo}% optional: a font more like Mendelson's
\newcommand{\F}{\mathrm{F}}
\newcommand{\T}{\mathrm{T}}
\begin{document}

\newcounter{tableline}
\setcounter{tableline}{0}
$\begin{array}% {@{}r@{}c@{\ }c@{\ } r@{}r@{} c@{}l@{\ }c@{\ }c@{}l@{\ }c@{\ } r@{}r@{} c@{}l@{\ }c@{\ } c@{}l@{\ }c@{}} (( &A &\Leftrightarrow&(( &\lnot&B &) &\lor &C &)) &\Rightarrow&(( &\lnot&A &) &\Rightarrow&B &)) & \\ & & & & & & & & & &\F & & & & & & & & \advline\\ & &\T & & & & & & & & & & & & &\F & & & \advline\\ & & & & & & & & & & & &\T & & & &\F & & \advline\\ &\F & & & & & & & & & & & &\F & & & & & \advline\\ & & & & & & &\F & & & & & & & & & & & \advline\\ & & & &\F & & & &\F & & & & & & & & & & \advline\\ & & & & &\T & & & & & & & & & & & & & \advline\\ \end{array}$
\end{document}



I put in spaces in the column specifier so you can see which column specification goes with which column. (I made the columns for left parentheses right-aligned and those for right parentheses left-aligned to stick with what they apply to, but I doubt that matters.)

The output looks like this:

You could probably use lua to write a script that automatically parsed the statement and put in the right kind of spacing (and while you're at, fill in the rest of the table, as computers are pretty good at truth functional logic …) But that's more work than I'm willing to do for a StackExchange answer.

• There are already scripts which can generate truth tables. Not sure about Lua. I used a python one. But I don't think there is a 'rest of the table' to be filled in by anybody. This is a not-counterexample, I think. That is, it is a reductio. Hence the numbering.
– cfr
Nov 12 at 4:46