regular-language

Pumping lemma for regular language

☆樱花仙子☆ 提交于 2019-11-27 09:18:45
I have a little confusion in checking whether the given language is regular or not using pumping lemma. Suppose we have to check whether: L. The language accepting even number of 0 's in regular or not? We know that it is regular because we can construct a DFA for L. But I want to prove this with pumping lemma. Now suppose, I take a String w= "0000" : Now will divide the string as x = 0 , y = 0 , and z = 00 . Now on applying pumping lemma for i = 2 , I will get the string "00000" , which is not present in my language so by pumping lemma its prove that the language is not regular. But it is

Ambiguity in transition: How to process string in NFA?

时光毁灭记忆、已成空白 提交于 2019-11-27 07:12:02
问题 I have made DFA from a given regular expression to match the test string. There are some cases in which .* occurs. ( for example .*ab ) . Let say now the machine is in state 1. In the DFA, .* refers to the transition for all the characters to itself and another transition for a from the state 1 for 'a'. If test string contains 'a' then what could be the transition because from state 1, machine can go to two states that is not possible in DFA. 回答1: I start with fundamental with your example so

Regular vs Context Free Grammars

假如想象 提交于 2019-11-27 05:52:37
I'm studying for my computing languages test, and there's one idea I'm having problems wrapping my head around. I understood that regular grammars are simpler and cannot contain ambiguity, but can't do a lot of tasks that are required for programming languages. I also understood that context-free grammars allow ambiguity, but allow for some things necessary for programming languages (like palindromes). What I'm having trouble with is understanding how I can derive all of the above by knowing that regular grammar nonterminals can map to a terminal or a nonterminal followed by a terminal or that

What is a regular language?

社会主义新天地 提交于 2019-11-27 04:09:07
问题 I'm trying to understand the concept of languages levels (regular, context free, context sensitive, etc.). I can look this up easily, but all explanations I find are a load of symbols and talk about sets . I have two questions: Can you describe in words what a regular language is, and how the languages differ? Where do people learn to understand this stuff? As I understand it, it is formal mathematics? I had a couple of courses at uni which used it and barely anyone understood it as the

Why L={wxw^R| w, x belongs to {a,b}^+ } is a regular language

假装没事ソ 提交于 2019-11-27 02:59:48
问题 Using pumping lemma, we can easily prove that the language L1 = {WcW^R|W ∈ {a,b}*} is not a regular language . (the alphabet is {a,b,c}; W^R represents the reverse string W) However, If we replace character c with "x"(x ∈ {a,b}+) , say, L2 = {WxW^R| x, W ∈ {a,b}^+} , then L2 is a regular language . Could you give me some ideas? 回答1: If we replace character c with x where (x ∈ {a,b} + ), say, L2 = {WXW R | x, W ∈ {a,b} + }, then L2 is a regular language. Yes, L2 is Regular Language :). You can

To make sure: Pumping lemma for infinite regular languages only?

梦想的初衷 提交于 2019-11-27 02:50:37
问题 So this is not about the pumping lemma and how it works, it's about a pre-condition. Everywhere in the net you can read, that regular languages must pass the pumping lemma, but noweher anybody talks about finite languages, which actually are a part of regular languages. So we might all aggree, that the following language is a finite language as well as it's a regular one, but it definitely does not pass the pumping lemma: L = {'abc', 'defghi'} Please, tell me if simply no one writes about it

drawing minmal DFA for the given regular expression

北战南征 提交于 2019-11-27 02:06:44
What is the direct and easy approach to draw minimal DFA , that accepts the same language as of given Regular Expression(RE) . I know it can be done by: Regex ---to----► NFA ---to-----► DFA ---to-----► minimized DFA But is there any shortcut way? like for (a+b)*ab Grijesh Chauhan Regular Expression to DFA Although there is NO algorithmic shortcut to draw DFA from a Regular Expression(RE) but a shortcut technique is possible by analysis not by derivation, it can save your time to draw a minimized dfa. But off-course the technique you can learn only by practice. I take your example to show my

The difference between Chomsky type 3 and Chomsky type 2 grammar

三世轮回 提交于 2019-11-27 01:23:14
问题 I'm having trouble articulating the difference between Chomsky type 2 (context free languages) and Chomsky type 3 (Regular languages). Can someone out there give me an answer in plain English? I'm having trouble understanding the whole hierarchy thing. 回答1: A Type II grammar is a Type III grammar with a stack A Type II grammar is basically a Type III grammar with nesting. Type III grammar (Regular): Use Case - CSV (Comma Separated Values) Characteristics: can be read with a using a FSM

Need Regular Expression for Finite Automata: Even number of 1s and Even number of 0s

别来无恙 提交于 2019-11-27 01:05:13
My problem may sounds different to you. I am a beginner and I am learning Finite Automata. I am googing over Internet to find the Regular Expression for Finite Automata of Given Machine Below. Can anyone help me to write "Regular Expression for Finite Automata" of above machine Any help will be appreciated Grijesh Chauhan How to write regular expression for a DFA using Arden theorem Lets instead of language symbols 0 , 1 we take Σ = {a, b} and following is new DFA. Notice start state is Q 0 You have not given but In my answer initial state is Q 0 , Where final state is also Q 0 . Language

Finding the complement of a DFA?

天涯浪子 提交于 2019-11-26 22:12:23
I am asked to show DFA diagram and RegEx for the complement of the RegEx (00 + 1)* . In the previous problem I had to prove that the complement of a DFA is closed and is a regular expression also, so I know that to convert a DFA, M to the complement, M`, I just need to swap the initial accepting states and final accepting states. However, it appears that the initial accepting states for the RegEx are {00, 1, ^} and the final accepting states are {00, 1, ^} as well. So swapping them will just result in the exact same RegEx and DFA which seems contradictory. Am I doing something wrong or is this