context-free-grammar,automata,automata-theory

Checking whether a grammar is ambiguous or not is an Undecidable problem, which means that there exists no algorithm which will correctly output Yes/No to this problem every time. The undecidablity is shown by showing that it is equivalen to Post Correspondence Problem, which is also undecidable....

regex,finite-automata,automata

For this proof, you don't have to construct a DFA for L. Your premise is that L is regular, so you know that there exists a DFA for L. Choose any, and now you can construct a NFA for L', by running your L DFA parallel to a copy of...

Here's a hint: if you consider any power of two greater than k (say, 2k), then 2k + k is not a power of two, since 2k + k < 2k + 2k = 2k+1 See if that can guide you to choose the right string and find your choice...

Regarding your first question, on the runtime of the non-optimal DFA. Purely theoretically your intuition that it should still run in O(n) is correct. However, imagine (as an example) the following pseudo-code for the Kleene-Star operator: // given that the kleene-star operator starts at i=something while string[i] == 'r': accepting...

regex,automata,nfa,non-deterministic

You've chosen to create a DFA (and I can't tell how to make one with only 4 states either). However, you are allowed to build an NFA, which means you can have multiple transitions with the same letter. You could therefore omit state (2), move the b-edge that went from...

regex,perl,computer-science,theory,automata

It doesn't look that different from standard regex... the only change you would have to make is to swap + with | (change (0+1) to (0|1)). Apart from that, you would just have to make the resulting regex match the entire line, either by prepending ^ and suffixing $ or...

Each state is a member of some group, and for each group you have a list of the states in the group. To find the transitions for a group G1, pick one of the states S1 in the group, take the transitions for S1, and for each target state S2...

Does the automaton go directly to the next state if there is an ɛ-transition? Roughly speaking, yes. An ɛ-transition (in a non-deterministic finite automaton, or NFA, for short) is a transition that is not associated with the consumption of any symbol (0 or 1, in this case). Once you...

finite-automata,automata,automata-theory

s -> Bx x -> Ay | By | Cy y -> Ay | By | Cy | A It is not too difficult to draw the finite automaton. The small letters are the states, the capital letters are the input symbols. State "s" is the start state. From there...

A string is any combination of the letters of an alphabet where as the words of a language are the strings that are always made according to certain rules used to define that language.For example if we take Alphabet Σ = { a , b } Here a , b...

python,multithreading,algorithm,automata

There's no need for multithreading, you just have to make sure that more than one '- -> H'-transitions are possible in each simulation step. I've coded a minimal example starting from your code (but with slightly different class layout): class Simul(object): def __init__(self, width, height): board_1 = [[None for _...

finite-automata,automata,turing-machines,automata-theory

You can use a stack. To begin with, suppose you took your Turing machine, and added to it another track. Clearly, it is is possible to use the additional track for the stack. However, a multitrack Turing machine is equivalent to a Turing machine, and there is a mechanical way...

finite-automata,automata,pda,pushdown-automaton,automata-theory

Of course, every state can be final in a deterministic pushdown automaton. Your approach seems correct to me. Depending on your definition on determinism it might be necessary to also add a transition that deals with the case where you read a 0 in state q_1 in order to have...

Right now, you have vectors of pointers. When you copy from one vector to another, you're copying the pointers, not the elements themselves. Since you have two pointers referring to the same node, any modification made to a node will be visible in the other group--i.e., if yo make a...

parsing,recursion,compiler-construction,automata,pushdown-automaton

Firstly,you'll need to remove left-recursion leading to S -> cAd A -> aA' A' -> bA' | epsilon Then, you can calculate FIRST(A) = a // as a is the only terminal nderived first from A. EDIT :- For your second question, S -> AS' S' -> AS' | epsilon...

context-free-grammar,automata,context-free-language

Some hints: Start with a grammar for { anbn | n in N }. The grammar you built in part (1) probably worked by laying down a's on one side of the string and b's on the other. That way, there end up being the same number of a's and...

Loopback interfaces are quite special, and Scapy sometimes messes with them. You should probably use a "real" interface....