Is a*b* regular?

狂风中的少年 提交于 2019-12-17 05:11:11

问题


I know anbn for n > 0 is not regular by the pumping lemma but I would imagine a*b* to be regular since both a,b don't have to be the same length. Is there a proof for it being regular or not?


回答1:


Answer to your question:

imagine a*b* to be regular, Is there a proof for it being regular or not?

No need to imagine, expression a*b* is called regular expression (re), and regular expressions are possible only for regular languages. If a language is not a regular then regular expression is also not possible for that and if a language is regular language then we can always represent it by some regular expression.

Yes, a*b* represents a regular language.

Language description: Any number of a followed by any numbers of b (by any number I mean zero (including null ^) or more times). Some example strings are:

{^, a, b, aab, abbb, aabbb, ...}

DFA for RE a*b* will be as follows:

      a-            b-
      ||            ||
      ▼|            ▼|
---►((Q0))---b---►((Q1))

In figure: `(())` means final state, so both `{Q0, Q1}` are final states.

You need to understand following basic concept:

What is basically a regular language? And why an infinite language `a*b*` is regular whereas languages like `{ anbn | n > 0 }` are not regular!!

A language(a set) is called regular language, if it require only bounded(finite) amount of information to keep store at any instance of time while processing strings of the language.

So, what is 'bounded' information?
For example: Consider a fan 'on'/'off' switch. By viewing fan switch we can say whether fan is in on or off state (this is bounded or limited information). But we can not say that 'how many times' a fan has been switched on and off in past! (to memorized, it require a mechanism to store 'unbounded' amount of information to count — 'how many times' e.g. some kind of meter uses in our cars/bikes).

The language { anbn | n > 0 } is not a regular language because here n is unbounded(that can be infinity large). To verify strings in language anbn, we need to memorize that how many a symbols has been came and it require an infinite memory storage to count because number of a symbols in string can be infinity large!

That means, an automata is only capable to process strings of the language anbn if it has infinite memory e.g PDA.

Whereas, a*b* is of-course regular by its nature, because there is bounded restriction ‐ that b may be come after some a ( and a can't came after b). And that is why every string of this language can be easily processed (or recognized) by an automata in which we have finite memory - and finite automata is a class of automata where memory is finite. Yes, in finite automata, we have finite amount of memory in the term of states.

(Memory in finite automata is present in the form of states Q and according to automata principal: any automata can have only finite states. hence finite automata has finite memory, this is the reason class of automata for regular languages is called finite automata. You can think a finite automata like CPU without memory, that has finite register to remember its internal states)

Finite State ⇒ Finite Memory ⇒ Only language can be process for which finite memory need to store at any instance of time while processing the string ⇒ that language is called Regular Language

Absent of external memory is limitation of finite automate ⇒ or we can say limitation of finite automata defined class of language called Regular Language.

You should read other answer "finiteness of regular language" to learn scope of regular language.

side note::

  • language { anbn | n > 0 } is subset of a*b*
  • Also a language { anbn | 10>100 n > 0 } is regular, a large set but regular because n is bounded, hence finite automata and regular expression is possible for this language.

You should also read: How to prove a language is regular?




回答2:


The proof is: ((a*)(b*)) is a well-formed regular expression, hence matching a regular language. a*b* is a syntactic shortenning of the same expression.

Another proof: Regular languages are closed to concatenation. a* is a regular language. b* is a regular language, therefore their concatenation, a*b*, is also a regular expression.

You can build an automat for it:

0 ->(a) 1
0 ->(b) 2
1 ->(a) 1
1 ->(b) 2
2 ->(b) 2
2 ->(a) 3
3 ->(a,b) 3

where only 3 is not an accepting state, and prove that the language is a*b*.




回答3:


To prove that a language is regular, it is sufficient to show either:

1) There exists some DFA that recognizes it. In this case, the DFA is trivial.

2) The language can be expressed as a regular expression, as mentioned in another answer. a*b* is a regular expression to recognize this language.




回答4:


A regular language is a language that can be expressed with a regular expression or a deterministic or non-deterministic finite automata or state machine. A language is a set of strings which are made up of characters from a specified alphabet, or set of symbols. Regular languages are a subset of the set of all strings.

a closure property is a statement that a certain operation on languages, when applied to languages in a class (e.g., the regular languages), produces a result that is also in that class.

this RE shows..the type of language that accepts multiple of (a) if any but before (b)

means language without containing any substring (ba)



来源:https://stackoverflow.com/questions/16723185/is-ab-regular

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!