1
0
Fork
You've already forked truth_table
0
Truth Table from Boolean Algebra Expressions
  • Zig 100%
2026年05月08日 19:52:35 +07:00
src Zig ReWrite for faster and more binary on release 2026年05月08日 19:43:41 +07:00
.gitignore Initial commit 2024年07月30日 15:45:22 +00:00
build.zig Zig ReWrite for faster and more binary on release 2026年05月08日 19:43:41 +07:00
LICENSE Zig ReWrite for faster and more binary on release 2026年05月08日 19:43:41 +07:00
README.md update readme 2026年05月08日 19:52:35 +07:00

truth_table

WARNING: Some terminals display some symbols poorly.

Truth Table from Boolean Algebra Expression

quick start

$ zig build --release=fast
$ time ./zig-out/bin/truth_table -e "((a && b) || (-c && d)) && (e || (-f && g))"
┌───────────────────────────────────────────────────────────────────┐
| Truth Table │
├───┬───┬───┬───┬───┬───┬───┬───────────────────────────────────────┤
│ a │ g │ d │ b │ c │ e │ f │ ((a ∧ b)(¬c ∧ d))(e ∨ (¬f ∧ g)) │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 00000000 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 00000010 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 00000100 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 00000110 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 00001000 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 00001010 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 00001100 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 00001110 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 00010000 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 00010010 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 00010100 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 00010110 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 00011000 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 00011010 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 00011100 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 00011110 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 00100000 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 00100010 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 00100101 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 00100111 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 00101000 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 00101010 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 00101100 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 00101110 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 00110000 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 00110010 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 00110101 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 00110111 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 00111000 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 00111010 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 00111100 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 00111110 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 01000000 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 01000010 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 01000100 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 01000110 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 01001000 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 01001010 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 01001100 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 01001110 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 01010000 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 01010010 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 01010100 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 01010110 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 01011000 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 01011010 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 01011100 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 01011110 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 01100001 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 01100010 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 01100101 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 01100111 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 01101000 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 01101010 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 01101100 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 01101110 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 01110001 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 01110010 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 01110101 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 01110111 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 01111000 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 01111010 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 01111100 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 01111110 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 10000000 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 10000010 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 10000100 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 10000110 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 10001000 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 10001010 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 10001100 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 10001110 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 10010000 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 10010010 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 10010101 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 10010111 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 10011000 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 10011010 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 10011101 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 10011111 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 10100000 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 10100010 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 10100101 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 10100111 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 10101000 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 10101010 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 10101100 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 10101110 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 10110000 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 10110010 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 10110101 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 10110111 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 10111000 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 10111010 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 10111101 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 10111111 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 11000000 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 11000010 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 11000100 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 11000110 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 11001000 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 11001010 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 11001100 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 11001110 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 11010001 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 11010010 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 11010101 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 11010111 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 11011001 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 11011010 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 11011101 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 11011111 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 11100001 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 11100010 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 11100101 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 11100111 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 11101000 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 11101010 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 11101100 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 11101110 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 11110001 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 11110010 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 11110101 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 11110111 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 11111001 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 11111010 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 11111101 │
├───┼───┼───┼───┼───┼───┼───┼───────────────────────────────────────┤
│ 11111111 │
└───┴───┴───┴───┴───┴───┴───┴───────────────────────────────────────┘
real 0m0.007s
user 0m0.002s
sys 0m0.000s