Skip to content

Make SymbolicDFA accept SymPy symbols as keys of propositional interpretations #104

Open
@marcofavorito

Description

@marcofavorito

Is your feature request related to a problem? Please describe.
The following code does not work:

from pythomata.impl.symbolic import SymbolicDFA
from sympy import symbols
a = symbols("a")
dfa = SymbolicDFA()
dfa.create_state()
dfa.add_transition((0, a, 1))
dfa.set_accepting_state(1, True)

# returns True, correctly
dfa.accepts([{"a": True}])

# it raises ValueError: Symbol {a: True} is not valid.
dfa.accepts([{a: True}])

The reason is that SymbolicDFA.accepts accepts only PropositionalInterpretation whose labels are of type str and not sympy.Symbol.

Describe the solution you'd like
Make it work. That is, try to be more flexible on the data validation in SymbolicDFA.accepts.

Describe alternatives you've considered
n/a

Additional context
n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions