# Truth Table

### Mathlet

by clicking on this button. Truth Table will come up in a new window. Click on the button again to when you're ready to close Truth Table. If it doesn't come up, you may not have support for Java 2 applets. See the Java 2 page.

This mathlet creates the truth table for a logical compound proposition. Type one in (followed by the ENTER key) using the following syntax:

Mathlet Symbol Mathematics Symbol Meaning
! not
& and
| or
-> implies
<-> if and only if
|| exclusive or
`p` p truth variable
`T` T true
`F` F false

For a truth variable, any lowercase letter in the ranges a-e, g-s, u-z (i.e. omitting f and t which are reserved for false and true) may be used. The negation operator, !, is applied before all others, which are are evaluated left-to-right. Parentheses, ( ), and brackets, [ ], may be used to enforce a different evaluation order.

E.g.
p -> q
p & (q | r)
[(p -> q) & (q -> r)] -> (p -> r)
are all syntactically correct.

### To Do

The yellow monitor next to an exercise suggests that you should solve it using the mathlet and a yellow pencil indicates that pencil-and-paper computation might be necessary.

1. Get familiar with the mathlet by generating the truth tables for the elementary propositions
p
p q
p q
p q
p q
p q
and check to see that they're correct!
2. Show that p q is logically equivalent to p q by creating their truth tables.
3. The converse of p q is q p and the contrapositive of p q is q p. Show that the converse is not logically equivalent to the contrapositive by creating their truth tables.
4. Show that the contrapositive of p q is logically equivalent to p q by creating their truth tables.
5. Prove the distributive law, p (q r) is logically equivalent to (p q) (p r), by creating two truth tables.
6. Translate the following sentence into a logical proposition using three logic variables.
You can connect to the Internet from your dorm room only if you are a CS major or you have not defaulted on your tuition payments.
Then use Truth Table to create the truth table for this proposition. Under what circumstances can a student not connect to the Internet from her dorm room? Use the truth table to back up your assertion. If you are a CS major and have defaulted on your tuition payments, can you connect? Again, use the truth table to justify your conclusion.
7. Create a logical proposition s in two propositional variables p and q, with the following truth table. Use only , , and in your proposition.
p q s
T T F
T F T
F T F
F F T
Now do the same thing for three propositional variables, p, q, and r.
p q r s
T T T T
T T F F
T F T F
T F F T
F T T F
F T F T
F F T F
F F F T
Informally describe an algorithm to do this for an arbitrary truth table with n propositional variables.