-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow DFA transition function to be partial #36
Comments
@alkkem But... but... it's not a bug, it's a feature! 😝 What you have stumble upon is actually a controversial topic: In my Automata Theory class in college, I myself was taught that each DFA state must have a transition for every symbol. However, I can understand if this DFA characteristic is subject to debate. Therefore, I will consider adding a method that allows you to toggle this characteristic (maybe an input parameter like I will add it to my backlog of features to work on, and will keep this issue open in the meantime. |
@caleb531 Hehe, you have cited the same page that I found when I was trying to figure out what the problem was. Thank you for taking this in consideration 😄 |
@alkkem You will be pleased to know that I just pushed up a partial DFA option to my in-progress v5 branch. The property is called DFA(
states={'', 'a', 'b', 'aa', 'bb', 'ab', 'ba'},
input_symbols={'a', 'b'},
transitions={
'': {'a': 'a', 'b': 'b'},
'a': {'b': 'ab', 'a': 'aa'},
'b': {'b': 'bb'},
'aa': {'a': 'aa', 'b': 'ab'},
'bb': {'a': 'ba'},
'ab': {'b': 'bb'},
'ba': {'a': 'aa'}
},
initial_state='',
final_states={'aa'},
allow_partial=True
) Please let me know what you think! |
You are awesome! A boolean parameter thst just solved the neverending discussion... Great! |
@alkkem Alright, I've released Automata v5 with the |
When I studied Automata Theory (and in the literature), the transition function for a DFA could be partial, this is, that there could be some states which do not have an associated transition for a symbol in the alphabet.
In my particular case, I was trying to get this automata:
But, as I said, some states do not have an associated transition for a symbol (take for example state b). This, in principle, accomplishes the DFA restrictions since there is no state such that for a symbol in the alphabet there is more than one associated transition.
When trying to obtain the above DFA using the transition function:
I get an exception:
I think there is a method
_validate_transition_missing_symbols
inautomata.fa.dfa
which is the culprit of this thing.I would make a pull request but right now I haven't got the time to learn how to implement and run tests and testing code coverage (I'm pretty novice in contributing tasks).
But I opened this issue in order to notify about the possible misconception about the formalities of DFA.
Thank you beforehand!
The text was updated successfully, but these errors were encountered: