cana.function_properties.rof module
Syntactic read-once (ROF) checks on expressions and ASTs.
Syntactic ROF means every identifier occurs exactly once in the written
expression / AST (n_variables == n_unique_variables; also called trivial
/ single-occurrence). That is distinct from semantic read-once-ness: a
formula may become read-once only after algebraic rewriting (e.g.
a & a ≡ a), which this module does not attempt.
is_rof in return dicts means syntactic ROF.
Prime count / generation for syntactic ROFs lives in
cana.primes.rof_primes.
- cana.function_properties.rof.check_syntactic_rof(expr)[source]
Return syntactic-ROF stats for expression expr.
is_rofmeans syntactic (single occurrence), not semantic read-once after simplification. Constants (no identifiers) are vacuously ROFs.- Parameters:
expr (str)
- Return type:
Dict[str, bool | int]