[ CS 275 Homepage | Helpers ]

ttable - A very simple truth table calculator

ttable is a little program, written in perl, that prints truth tables. It runs from the command line under Unix and has not been tested elsewhere.

Note that, due to its extreme basic-ness, the => and <=> operators have higher priority than the negation operator.

If you have never seen unreadable code, have a look at that of ttable.

Example of usage


 >> ttable

   ttable - Print truth table of a logical proposition

       Prints the truth table of a logical proposition in which variable names
       consist of any number of consecutive letters, true is 1, false is 0,
       and operators are
 
         Not !     And &&    Or ||
 
       in that order of precedence. You may also use
 
         Then =>   Iff <=>
 
       but their precedence is greater than that of "!" and they cannot be
       chained.

 >> ttable "((A=>B)&&(B=>C)) => (A=>C)"
 
  
        A B C  |  ((A=>B)&&(B=>C)) => (A=>C)
        ------------------------------------
        0 0 0  |  1
        0 0 1  |  1
        0 1 0  |  1
        0 1 1  |  1
        1 0 0  |  1
        1 0 1  |  1
        1 1 0  |  1
        1 1 1  |  1