Truth tables and implicant tables are not a good form for symbolic Boolean algebra. When the columns of two tables don't match, performing algebraic operations is extremely expensive. For example, the current TruthTable implementation performs a union of the support of both tables, and then does a restrict for every point in the matching space.
It is far cheaper to require two tables to have matching columns, and then perform the operator directly on the underlying data.
For example, take these two tables:
OneHot(a, b, c) : "01101000"Majority(a, b, c) : "00010111"
Using the current algorithm, to perform an OR would require eight individual OR operations on the underlying bits. This proposal would just OR the two 16-bit (b/c of PC notation) words together, which is a single CPU op. If you attempt to do algebraic operators on two tables with mismatched columns, just throw a ValueError.
Truth tables and implicant tables are not a good form for symbolic Boolean algebra. When the columns of two tables don't match, performing algebraic operations is extremely expensive. For example, the current
TruthTable
implementation performs a union of the support of both tables, and then does arestrict
for every point in the matching space.It is far cheaper to require two tables to have matching columns, and then perform the operator directly on the underlying data.
For example, take these two tables:
OneHot(a, b, c) : "01101000"
Majority(a, b, c) : "00010111"
Using the current algorithm, to perform an
OR
would require eight individualOR
operations on the underlying bits. This proposal would justOR
the two 16-bit (b/c of PC notation) words together, which is a single CPU op. If you attempt to do algebraic operators on two tables with mismatched columns, just throw aValueError
.