Operations

The header <kitty/operations.hpp> implements several operations on truth tables.

Predicates

Function
Description

equal(first, second)

Checks whether two truth tables are equal.

equal(first, second)

None

equal(first, second)

None

less_than(first, second)

Checks whether a truth table is lexicographically smaller than another.

less_than(first, second)

Checks whether a ternary truth table is lexicographically smaller than another.

less_than(first, second)

Checks whether a quaternary truth table is lexicographically smaller than another.

has_var(tt, var_index)

Checks whether truth table depends on given variable index.

has_var(tt, var_index)

Checks whether a ternary truth table depends on given variable index Don’t cares are treated like zeros.

has_var(tt, var_index)

Checks whether a quaternary truth table depends on given variable index. This function returns false if the truth table potentially does not depend on the variable (due to don’t cares) and returns true if the truth table potentially depends on the variable (due to don’t knows).

is_const0(tt)

Checks whether truth table is contant 0.

implies(first, second)

Checks if first truth table implies a second truth table.

implies(first, second)

Checks if first ternary truth table implies a second ternary truth table.

implies(first, second)

Checks if first quaternary truth table implies a second quaternary truth table.

intersection_is_empty(first, second)

Checks whether the intersection of two truth tables is empty.

intersection_is_empty(first, second, third)

Checks whether the intersection of three truth tables is empty.

Combination and manipulation

Function
Description

unary_not(tt)

Inverts all bits in a truth table.

unary_not(tt)

None

unary_not(tt)

None

binary_and(first, second)

Bitwise AND of two truth tables.

binary_and(first, second)

Bitwise AND of two ternary truth tables.

binary_and(first, second)

Bitwise OR of two quaternary truth tables.

binary_or(first, second)

Bitwise OR of two truth tables.

binary_or(first, second)

Bitwise OR of two ternary truth tables.

binary_or(first, second)

Bitwise OR of two quaternary truth tables.

binary_xor(first, second)

Bitwise XOR of two truth tables.

binary_xor(first, second)

Bitwise XOR of two ternary truth tables.

binary_xor(first, second)

Bitwise XOR of two ternary truth tables.

ternary_ite(first, second, third)

Performs ternary if-then-else of three truth tables.

ternary_ite(first, second, third)

None

ternary_ite(first, second, third)

Performs ternary if-then-else of three quaternary truth tables.

ternary_majority(first, second, third)

Ternary majority of three truth tables.

ternary_majority(first, second, third)

Ternary majority of three truth tables.

ternary_majority(first, second, third)

Ternary majority of three quaternary truth tables.

mux_var(var_index, then_, else_)

Muxes two truth tables based on a variable.

mux_var(var_index, then_, else_)

Muxes two ternary truth tables based on a variable.

mux_var(var_index, then_, else_)

Muxes two ternary truth tables based on a variable.

next_inplace(tt)

Computes the next lexicographically larger truth table.

next_inplace(tt)

Computes the next lexicographically larger truth table.

next_inplace(tt)

Computes the next lexicographically larger truth table.

next(tt)

Returns the next lexicographically larger truth table.

cofactor0_inplace(tt, var_index)

Computes co-factor with respect to 0.

cofactor0_inplace(tt, var_index)

Computes co-factor with respect to 0.

cofactor0_inplace(tt, var_index)

Computes co-factor with respect to 0.

cofactor0(tt, var_index)

Returns co-factor with respect to 0.

cofactor1_inplace(tt, var_index)

Computes co-factor with respect to 1.

cofactor1_inplace(tt, var_index)

Computes co-factor with respect to 1.

cofactor1_inplace(tt, var_index)

Computes co-factor with respect to 1.

cofactor1(tt, var_index)

Returns co-factor with respect to 1.

swap_inplace(tt, var_index1, var_index2)

Swaps two variables in a truth table.

swap_inplace(tt, var_index1, var_index2)

Swaps two variables in a truth table.

swap_inplace(tt, var_index1, var_index2)

Swaps two variables in a truth table.

swap(tt, var_index1, var_index2)

Swaps two adjacent variables in a truth table.

swap_adjacent_inplace(tt, var_index)

Swaps two adjacent variables in a truth table.

swap_adjacent_inplace(tt, var_index)

Swaps two adjacent variables in a truth table.

swap_adjacent_inplace(tt, var_index)

Swaps two adjacent variables in a truth table.

swap_adjacent(tt, var_index)

Swaps two adjacent variables in a truth table.

flip_inplace(tt, var_index)

Flips a variable in a truth table.

flip_inplace(tt, var_index)

Flips a variable in a ternary truth table.

flip_inplace(tt, var_index)

Flips a variable in a ternary truth table.

flip(tt, var_index)

Flips a variable in a truth table.

min_base_inplace(tt)

Reorders truth table to have minimum base.

expand_inplace(tt, support)

Expands truth table from minimum base to original based on support.

extend_to_inplace(tt, from)

Extends smaller truth table to larger one.

extend_to_inplace(tt, from)

Extends smaller ternary truth table to larger one.

extend_to_inplace(tt, from)

Extends smaller ternary truth table to larger one.

extend_to(from)

Extends smaller truth table to larger static one.

extend_to(from, num_vars)

Extends smaller truth table to larger dynamic one.

extend_to(from, num_vars)

Extends smaller ternary truth table to larger one of the same underlying type.

extend_to(from, num_vars)

Extends smaller ternary truth table to larger one of the same underlying type.

shrink_to_inplace(tt, from)

Shrinks larger truth table to smaller one.

shrink_to_inplace(tt, from)

Shrinks larger ternary truth table to smaller one.

shrink_to_inplace(tt, from)

Shrinks larger ternary truth table to smaller one.

shrink_to(from)

Shrinks larger truth table to smaller static one.

shrink_to(from, num_vars)

Shrinks larger truth table to smaller dynamic one.

shrink_to(from, num_vars)

Shrinks larger ternary truth table to smaller one of the same underlying type.

shrink_to(from, num_vars)

Shrinks larger ternary truth table to smaller one of the same underlying type.

shift_left_inplace(tt, shift)

Left-shift truth table.

shift_left_inplace(tt, shift)

Left-shift ternary truth table.

shift_left_inplace(tt, shift)

Left-shift quaternary truth table.

shift_left(tt, shift)

Left-shift truth table.

shift_right_inplace(tt, shift)

Right-shift truth table.

shift_right_inplace(tt, shift)

Right-shift ternary truth table.

shift_right_inplace(tt, shift)

Right-shift quaternary truth table.

shift_right(tt, shift)

Right-shift truth table.

shift_with_mask_inplace(f, mask)

Shifts a small truth table with respect to a mask.

shift_with_mask_inplace(f, mask)

Shifts a small truth table with respect to a mask.

shift_with_mask_inplace(f, mask)

None

shift_with_mask(f, mask)

Shifts a small truth table with respect to a mask.