Cocalc has moved from Discord for questions, but someone has a lot of automata questions. I'm copying one here and will let them know it is here.
When using sagemaths automaton module, I'm encountering some weird behavior:
stateTransitions = [
('q0', 'q1', '0'),
('q1', 'q1', '1'),
]
DFA = Automaton(stateTransitions, initial_states=['q0'], final_states=['q1'])
list(DFA.language(5,initial_states=['q1']))
yields the output:
[['0'],
['0', '1'],
['0', '1', '1'],
['0', '1', '1', '1'],
['0', '1', '1', '1', '1']]
But shouldn't each word start with '1', if the initial state is 'q1'?
The kwargs passed from Automaton.language() seem to be not passed properly.
According to the sagemaths docs, anything after the max_length arg should be passed as kwargs to subsequent methods on the automaton:
https://doc.sagemath.org/html/en/reference/combinat/sage/combinat/finite_state_machine.html#sage.combinat.finite_state_machine.FiniteStateMachine.language