cana.function_outputs.two_symbol module

Two-symbol schemata helpers for BooleanFunction.

Two-symbol entries are [schema_str, perm_groups, same_groups]. Expansion to one-symbol and compact expression export use perm_groups only; same_groups are display metadata and are ignored.

cana.function_outputs.two_symbol.reorder(ts, old_labels, new_labels)[source]

Return a copy with schema positions and group indices remapped.

Labels identify the k input variables in MSB-first bit order (same convention as reorder()). new_labels must be a permutation of old_labels. Remaps schema characters and both perm_groups and same_groups indices; each remapped group is sorted ascending to match construction. If the orders already match, returns ts unchanged.

Parameters:
  • ts (Tuple[list, list])

  • old_labels (Sequence[object])

  • new_labels (Sequence[object])

Return type:

Tuple[list, list]

cana.function_outputs.two_symbol.two_symbol_to_one_symbol(ts)[source]

Expand two-symbol schemata to one-symbol (F’) covers.

For each polarity and each [schema, perm_groups, _], permute values within each perm group and collect length-k strings over {0,1,2}. Does not re-run Quine–McCluskey; the result is the redescribed F’ cover, not necessarily flagged as prime-implicant.

Parameters:

ts (Tuple[list, list])

Return type:

Dict[int, Set[str]]

cana.function_outputs.two_symbol.two_symbol_to_expression(input_names, ts, style='python')[source]

Build a DNF-like expression from two-symbol ON schemata (polarity 1).

Each schema becomes an AND of fixed literals and perm-group subexpressions (each group is an OR of the distinct permutation clauses). Schemas are OR’d together. Schema characters: 1 positive, 0 negated, 2 don’t-care. same_groups are ignored.

Parameters:
  • input_names (Sequence[str])

  • ts (Tuple[list, list])

  • style (str)

Return type:

str