Skip to content
KOBAYASI, Hiroaki edited this page May 19, 2013 · 4 revisions

ttvars - truth table (vars) generator

ttvars takes a list of possible answer-set and generates corresponding (variables side of) truth table as tab-separated text. Answers-set just treated as prolog's list, so anything valid prolog expression is usable.

You can get ttvars from https://github.com/hkoba/mytools
(you need both ttvars and ttvars.prolog)

Note: In contrast to C, prolog uses =< instead of <=. This command automatically substitutes them.

Example

$ ttvars y,n y,n
y       y
y       n
n       y
n       n
$ ttvars 'x <= 3, x > 3, na' '1,2,3' 'y,n'
x=<3    1       y
x=<3    1       n
x=<3    2       y
x=<3    2       n
x=<3    3       y
x=<3    3       n
x>3     1       y
x>3     1       n
x>3     2       y
x>3     2       n
x>3     3       y
x>3     3       n
na      1       y
na      1       n
na      2       y
na      2       n
na      3       y
na      3       n

Dependencies

  • ttvars uses Zsh, to generate command line options for underlying prolog interpreters
  • Supported prolog interpreters are followings:
  • GNU prolog
  • SWI-prolog
Clone this wiki locally