Program: Truth Tables Version 1.1
Platform: HP48G or GX
Programmer: MacDonald R. Phillips
Email: mrp100@erols.com
       phillipsm.ggd@gao.gov

This program is designed to construct and display or print truth
tables for 1 to 7 variables and any logical expression based on
those variables.

What's New

I corrected a programming error in the use of variables.  Using
the letters V or N as logical variables caused conflicts with
other variables, also named V and N by the stupid programmer,
causing the program to "blow up."  I also added an error checking
routine to be sure all variables used in a logical expression are
also in the varibles list.  If not, an "Uninitiated variables"
message appears.

Using The Program

Load the program TRTBL to your calculator in binary mode.  A
directory will be created called TRTBL.  Enter the directory and
press GO-> to set up the custom menu.

To construct truth tables you need a list of variables and a
logical expression.  The first soft key, VARS, is for entering a
list of variables.  (I find it best to use single, capital
letters for the variables so there will be no conflict with the
variables the program routines are stored in.)  Press VARS and
you will be prompted to enter the variables in the list on the
command line.  The calculator is automatically put in alpha mode,
so just enter the letters one by one with a space between them. 
When the list is complete, press ENTER and the table will be
constructed.

After the table is constructed, enter a logical expression to be
evaluated.  Press EXPR and you will be prompted to enter an 
expression.  The logic keys (AND, OR, XOR, and NOT) are available
to aid in entering the expression.  Since the calculator is not
in alpha mode, the alpha key must be pressed before entering each
variable.  When you are done entering the expression, press ENTER
and it will be stored.

Logical expressions can be of any length and complexity; however,
they must be constructed of _only_ the variables entered in the
variables list, although not all the variables need be used.  The
logical expression can be changed without changing the variables
list as long as the new expression is made from _only_ the
variables in the list.  In this way logical arguments as well as
expressions can be evaluated.

The truth table can be displayed, six lines at a time, by
pressing TRTBL.  If there are more than six lines in the table,
press CONT to display them.  To stop the display of additional
lines and return to the menu, press KILL.

Press PRINT to print the entire truth table, if you have an HP 
infrared printer.  A date and time stamp will be printed for each
truth table.  Your name will also be printed, if you enter your
name, as a string, and press NAME, which is next to the GO-> key.
This stores it permanently for future printing.

Example:

Press VARS
In the empty list { } that appears on the stack, enter P Q and
then press ENTER.  You do not have to put the calculator in alpha
mode; just press the appropriate letters followed by the SPC key
(for space).  By pressing left-shift (LS) VARS, the current list
of variables is recalled to the stack.

Press EXPR
In the empty quotes ' ' that appear on the stack, enter NOT P OR
Q and press ENTER.  Since the calculator is _not_ in alpha mode
here, the alpha key must be hit before hitting the P or Q keys. 
By pressing LS EXPR, the current expression is recalled to the
stack.

Press TRTBL to display the output.

{ P Q }            1/0
{ 1 1 }             1
{ 1 0 }             0
{ 0 1 }             1
{ 0 0 }             1


Ones (1) mean T for true, and zeros (0) mean F for false.

The expression just evaluated, NOT P OR Q, represents material
implication which is expressed in logic textbooks as P -> Q and
has the meaning, IF P, THEN Q.

Material equivalence, P <-> Q, which has the meaning, P IF AND
ONLY IF Q, can be expressed as NOT(P XOR Q) on the HP48.

Logical arguments can also be evaluated with truth tables.  For
example:

P -> Q
Q -> R  /:. P -> R

This argument is composed of two premises and a conclusion.  It
has three variables.

Press VARS and enter the variables { P Q R }.

Enter the premises and conclusion one at a time and pres TRTBL.

1. NOT P OR Q   2. NOT Q OR R   3. NOT P OR R

All of the truth tables, when put together, will look like this.

{ P Q R }  |  P -> Q   Q -> R   P -> R
  1 1 1    |    1       1        1
  1 1 0    |    1       0        0
  1 0 1    |    0       1        1
  1 0 0    |    0       1        0
  0 1 1    |    1       1        1
  0 1 0    |    1       0        1
  0 0 1    |    1       1        1
  0 0 0    |    1       1        1

An argument is valid if for those cases where the conclusion is
false, all of the premises are not true.  That is, for this case,
where P -> R is 0, not both P -> Q and Q -> R are 1.  In plain
English, an argument is valid when true premises do not yield a
false conclusion.  The above argument is therefore valid.

If you like this program, please sent me an email message.  It's
nice to hear from people who find your work useful.