Ternary Boolean algebra