unicode_fol_kit.sanitize_names

unicode_fol_kit.sanitize_names(node, mapping=None)[source]

Return (sanitized_node, mapping) with all names rewritten to legal tokens.

parse(sanitized_node.to_unicode_str()) == sanitized_node holds for the default MSFLParser (FOL mode). Already-legal names are unchanged. Pass the returned mapping back in (mapping=…) to keep names consistent across formulas of one problem; use NameMapping.reverse() to recover the originals.

Parameters:
  • node (Node) – any AST node (typically a classical FOL formula from an importer).

  • mapping (NameMapping | None) – an existing NameMapping to extend, or None for a fresh one.

Returns:

The rewritten node and the (possibly extended) mapping.

Return type:

Tuple[Node, NameMapping]