Search code examples
mathcomputer-sciencefinite-automatadfa

DFA to mathematical notation


Let's say I have a DFA with alphabet {0,1} which basically accepts any strings as long as there is no consecutive 0's (at most one 0 at a time). How do I express this in a mathematical notation?

I was thinking of any number of 1's followed by either one or none 0's, then any number of 1's..... but couldn't figure out the appropriate mathematical notation for it.

My attempt but obviously incorrect since 1010 should be accepted but the notation does not indicate so: this


Solution

  • As a regular expression you could write this as 1*(01+)*0?. Arbitrary many ones, then arbitrary many groups of exactly one zero followed by at least one one, and in the end possibly one zero. Nico already wrote as much in a comment. Personally I'd consider such a regular expression sufficiently formal to call it mathematical.

    Now if you want to write this using exponents, you could do something like

    L = {1a (0 11+bi)c 0d mod 2 | a,bi,c,d ∈ ℕ for 1≤ic}

    Writing a bit of formula in the exponents has the great benefit that you don't have to split the place where you use the exponent and the place where you define the range. Here all my numbers are natural numbers (including zero). Adding one means at least one repetition. And the modulo 2 makes the exponent 0 or 1 to express the ? in the regular expression.

    Of course, there is an implied assumption here, namely that the c serves as a kind of loop, but it doesn't repeat the same expression every time, but the bi changes for each iteration. The range of the i implies this interpretation, but it might be considered confusing or even incorrect nonetheless.

    The proper solution here would be using some formal product notation using a big ∏ with a subscript i = 1 and a superscript c. That would indicate that for every i from 1 through c you want to compute the given expression (i.e. 011+bi) and concatenate all the resulting words.

    You could also give a recursive definition: The minimal fixpoint of the following definition

    L' = {1, 10} ∪ {1a 0 b | a ∈ ℕ, a > 0, bL'}

    is the language of all words which begin with a 1 and satisfy your conditions. From this you can build

    L = {ε, 0} ∪ L' ∪ {0 a | aL'}

    so you add the empty word and the lone zero, then take all the words from L' in their unmodified form and in the form with a zero added in front.