dfa

DFA vs NFA engines: What is the difference in their capabilities and limitations?

瘦欲@ 提交于 2019-11-26 18:55:13
问题 I am looking for a non-technical explanation of the difference between DFA vs NFA engines, based on their capabilities and limitations. 回答1: Deterministic Finite Automatons (DFAs) and Nondeterministic Finite Automatons (NFAs) have exactly the same capabilities and limitations. The only difference is notational convenience. A finite automaton is a processor that has states and reads input, each input character potentially setting it into another state. For example, a state might be "just read

What will be the DFA for the regular expression 0(0+1)*0+1(0+1)*1?

♀尐吖头ヾ 提交于 2019-11-26 18:36:37
问题 This is the DFA i have drawn- Is it correct? I am confused because q4 state has 2 different transitions for same input symbol which violates the rule of DFA , but I can't think of any other solution. 回答1: Your DFA is not correct. your DFA is completely wrong so I don't comment DFA for RE: 0(1 + 0)*0 + 1(1 + 0)*1 Language Description : if string start with 0 it should end with 0 or if string start with 1 it should end with 1 . hence two final states (state-5, state-4). state-4 : accepts 1(1 +

Pumping lemma for regular language

倖福魔咒の 提交于 2019-11-26 17:49:44
问题 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

Grammatical inference of regular expressions for given finite list of representative strings?

旧时模样 提交于 2019-11-26 16:15:01
问题 I'm working on analyzing a large public dataset with lots of verbose human-readable strings that were clearly generated by some regular (in the formal language theory sense) grammar. It's not too hard to look at sets of these strings one by one to see the patterns; unfortunately, there's about 24,000 of these unique strings broken up into 33 categories and 1714 subcategories, so it's somewhat painful to do this manually. Basically, I'm looking for an existing algorithm (preferably with an

Design DFA accepting binary strings divisible by a number 'n'

≡放荡痞女 提交于 2019-11-26 15:01:40
问题 I need to learn how to design a DFA such that given any number 'n', it accepts binary strings {0, 1} whose decimal equivalent number is divisible by 'n'. There will be different DFAs for different 'n', but can somebody give a basic approach that I should follow to proceed with any number 0 < n < 10 . 回答1: Below, I have written an answer for n equals to 5, but you can apply same approach to draw DFAs for any value of n and 'any positional number system' e.g binary, ternary... First lean the

Regular expressions Equivalence

一笑奈何 提交于 2019-11-26 14:48:28
问题 Is there a way to find out if two arbitrary regular expressions are equivalent? Looks like complex problem to me, but there might be some DFA simplification mechanism or something? 回答1: To test equivalence you can compute the minimal DFAs for the expressions and compare them. 回答2: Testability of equality is one of the classical properties of regular expressions. (N.B. This doesn't hold if you're really talking about Perl regular expressions or some other technically nonregular superlanguage.)

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

点点圈 提交于 2019-11-26 09:34:19
问题 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 回答1: 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

Finding the complement of a DFA?

巧了我就是萌 提交于 2019-11-26 08:13:30
问题 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

【正则表达式介绍篇】 -- 2019-08-07 10:54:47

﹥>﹥吖頭↗ 提交于 2019-11-25 20:17:17
原创: http://106.13.73.98/__/158/      正则表达式 ,又称规则表达式。(英语:Regular Expression,在代码中常简写为Regex、regexp或RE),计算机科学的一个概念。正则表达式通常被用来检索、替换那些符合某个模式(规则)的文本。     许多程序设计语言都支持利用正则表达式进行字符串操作。例如,在 Perl 中就内建了一个功能强大的正则表达式引擎。正则表达式这个概念最初是由 Unix 中工具软件(例如 sed 和 grep )普及开的。正则表达式通常缩写称“regex”, 单数 有regexp、regex, 复数 regexps、regexes、regexen。 *** 概念     正则表达式是对 字符串 操作的一种逻辑公式,就是用事先定义好的一些特殊字符、及这个特定字符的组合,组成一个“规则字符串”,这个“规则字符串”用来表达对字符串的一种过滤逻辑。 简介     正则表达式是对字符串(包括普通字符(例如,a到z之间的字母)和特殊字符(称为“元字符”))操作的一种逻辑公式,就是用事先定义好的一些特定字符、及这些特定字符的组合,组成一个“规则字符串”,这个“规则字符串”用来表达对字符串的一种过滤逻辑。正则表达式是一种文本模式,模式描述在搜索文本时要匹配的一个或多个字符串。 起源     正则表达式的“鼻祖