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
kinput variables in MSB-first bit order (same convention asreorder()).new_labelsmust be a permutation ofold_labels. Remaps schema characters and bothperm_groupsandsame_groupsindices; each remapped group is sorted ascending to match construction. If the orders already match, returnstsunchanged.- 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-kstrings 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:
1positive,0negated,2don’t-care.same_groupsare ignored.- Parameters:
input_names (Sequence[str])
ts (Tuple[list, list])
style (str)
- Return type:
str