0

I want to know how to prove a language that has order constraints is regular. For example if you had that Σ = {1,2,3,4,5} where L (a subset of Σ*) = (a1,a2,...an) such that an+1 was larger than an how would you prove that this is a regular language?

e.g α = (1,3,5) would be accepted, however α = (1,4,5,2) would not.

Quanqai
  • 647
  • 1
  • 5
  • 10

1 Answers1

1

Any language that can be recognized by a DFA (deterministic finite automaton) is regular. To prove that the language you described is regular, you simply have to prove that there exists a DFA that recognizes this particular language.

Remember that Σ is finite. If I understood the constraint of the language properly, one construction that works would have one starting state (accepting or non-accepting depending on whether you want to include ε in your language), one accepting state for each symbol in Σ and one rejecting state. The transition function should result in the state corresponding to the current input symbol if the current state is the starting state or corresponds to a "lesser" symbol, and to the rejecting state otherwise.

A shortcut is also available - each finite language is regular, and if I understood the constraint of the language you described properly, it is clearly finite (since Σ is finite). This trivially means that the language is also regular.

kviiri
  • 3,282
  • 1
  • 21
  • 30
  • This is a simplified version of the language I am trying to prove is regular, I was looking for a concept that I could apply to the more difficult problem. The way you have described is how I have attempted to draw the DFA for my problem but I had an issue that it needed to be starred (I think). In the more complex case there are order constraints like this but unlike with numbers it has that, say, p can follow r and t can follow p but then r can follow t. However your insight is helpful as I completely forgot about a reject state to make it complete :) – Quanqai Oct 29 '13 at 23:34
  • The same general solution applies, in any case: if you can construct a DFA or NFA to describe the language, it's regular. Using the Kleene star shouldn't be a problem as it is very easy to modify an automaton to accept a starred version of its original language --> A* is regular if A is. You might also want to prove that the language is a union of several regular languages if that's easier. Regular languages are closed over the union operator so the resulting language is regular as well. – kviiri Oct 29 '13 at 23:39
  • I think that breaking down the language into smaller DFA and then doing a union of them all will probably be my best bet. Thanks for the help. – Quanqai Oct 29 '13 at 23:43
  • No problem, hope you make it! – kviiri Oct 29 '13 at 23:43