Skip to content
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

Check that for dfa all transitions must have all the alphabets #3

Open
Devorein opened this issue Nov 13, 2021 · 0 comments
Open

Check that for dfa all transitions must have all the alphabets #3

Devorein opened this issue Nov 13, 2021 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@Devorein
Copy link
Owner

const { DeterministicFiniteAutomaton } = require('fauton');

const startsWithBC = new DeterministicFiniteAutomaton(
	(inputString) => inputString.startsWith('bc'),
	{
		alphabets: ['a', 'b'],
		transitions: {
			A: ['A'],
			B: [null, 'B'],
		},
	}
);

The DFA accepts 2 alphabets a and b but in the transition map for state A, it only indicates where to go when we encounter the symbol a but not for b. This should not be the case for dfa. Even in the 2nd state B, it's gonna transition to null state for symbol a, which is also a violation for DFA. Every state must have an array of state strings that have an equal length as that of the alphabets to ensure we cover all cases. An error should be thrown in this regard

@Devorein Devorein self-assigned this Nov 13, 2021
@Devorein Devorein added the bug Something isn't working label Nov 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant