regex - Is this a regular language? If so, what is it's regular expression? -
regex - Is this a regular language? If so, what is it's regular expression? -
b = {1^k y | k >= 1, y in {0, 1}* , y contains @ to the lowest degree k 1's }
is language regular? if so, how prove it, , how represent regular look in python?
this class work, if explain reasons , processes behind answer, it'd much appreciated.
the language have equivalent language:
class="lang-none prettyprint-override">b' = {1 y | y in {0, 1}* , y contains @ to the lowest degree 1 1}
you can prove b' subset of b, since status in b' same b, k set 1.
proving b subset of b' involves proving words in b k >= 1 belongs b', easy, since can take away first 1 in words in b , set y
rest of string, y
contain @ to the lowest degree 1 1.
therefore, can conclude b = b'
.
so our job simplified ensuring first character 1 , there @ to the lowest degree 1 1
in rest of string.
the regular look (the cs notation) be:
10*1(0 + 1)*
in notation used mutual regex engines:
10*1[01]*
the dfa:
here q2
final state.
"at least" key solving question. if word becomes "equal", story different.
regex computer-science regular-language
Comments
Post a Comment