Basic Definitions, letters, Strings
An Alphabet as denoted by the character: Σ is a non-empty set of symbols.
- So if we have
Σ={0, 1}then this is considered a binary alphabet. - However if we have something like
Σ = {a, b, c, ..., z}then this is the collection of lowercase letters
A string or word is a finite sequence of letters drawn from a given alphabet. So something like x= 01110101 is a binary string. Then something like: "Life is good" is also a string
An empty string is denoted by the character epsilon: ε and are strings with zero occurrences of letters. Empty strings can be from any alphabet
The length of a string is the sum of occurrences of it’s symbols as denoted by |x|. So for the above examples you would have |x| = 8 and the length of the "Life is Good" = 12
The set of ALL POSSIBLE STRINGS from a given alphabet of characters as denoted by Σ is then known as Σ*. So if Σ={0,1} then Σ*={0, 1, 00, 01, 10, 11}
In tandem, the set of all non-empty strings composed from the letters in Σ is denoted by Σ+
You can also be interested in only a given string of length k in a set of sigma, and this is denoted by Σ^k so for the set of Σ={0, 1} then you have Σ^2 = {00, 01, 10, 11} If the size of your alphabet is finite, then the size of it’s alphabet is the size of the alphabet to the power of k, so like Σ^k = |Σ|^k so for the above example it would be Σ^2 = 2^2 = 4. which is the size of the total number of things that exist in that set
A language is a collection of strings over an alphabet. So for example the language of palindromes over the binary alphabet is {ε, 0, 1, 00, 11, 000, 010, 101, 111, ...}
What is Automata?
A finite automaton is an abstract model of a digital computer. It is a representation of how computations are performed with limited memory space. It is a set of states which are connected through transitions. It has input (like a string over a given alphabet), and it has an output (Reject or Accept).
The input can be thought of as a string that is written on some tape, which the automaton cannot outright change, only read. Like a read-only tape. Below is the schematic representation of an automaton.
- A tape consists of an unlimited number of cells, each one of which is capable of holding a single symbol from the alphabet.
- The head basically is able to read a single symbol from the current cells in the tape. After reading a given symbol, it will move onto the next cell.
- The state shows the current state of the automaton. Using a transition function, the next state will be determined in terms of the current state and the current input symbol
You output will always either be Accept or Reject
Examples and Explanations
The automaton consists of some labeled circles which are called states and label ages which are called the transitions. The given labels on the transitions are from the alphabet, and they dictate what to do next.
The state on the left hand (q0) side with the arrow pointing to it from nowhere is called the initial state. You can think of it as the beginning of the computation. When designing an automaton, we make one assuming that there is language on the tape. With one letter in each cell.
Some states like q1 are double circled, and they are called accepting states. If the computation ends at any of these accepting states, then the machine outputs the accepted output, however if it ends at the other states, it outputs reject
Basically, in the above example, what the machine directly does, is we start out at the q0 state, which is the rejected state right, then whenever we read either the letter of a or the letter b we then move on to the accepting state of q1, and then if while we are in this state, we read again either a or b then we go on back to q0.
This in layman’s terms works out to see if the size of the given string is even, because you start out even at the value of zero, and then you proceed to become either odd or even each time you add in another letter, hence allowing for this machine to basically process the idea of a string of characters to be either even or odd.
Formal Definition of finite Automata
An Automaton M is 5-tuple, or a sequence of five elements, (Q, Σ, δ, q_0, F) where:
Qis a finite set called the statesΣis a finite set called the alphabet, the set of all letters in the transitions, everything that can be on the tape pretty muchδ: Q * Σ ⟶ Qand this is the transition function it is the function that takes in the states and letters, and outputs states. So basically it is the states multiplied by the states, and this gives you the co-domain of statesq_0, ε Qis the start state, so whatever the first state of the machine is, it belongs toQF ⊆ Qwhich is the set of the accepting states for the machine, it is a set so there can be more than a single accepting state for your machine
Previous Example expanded
In that little table where he defines delta, the formal definition basically says that you take the current state and multiply it by the element, and in essence this is what he is doing here, but what he is actually showcasing what the next step of the automaton is. Whenever you are at the q0 state, the next place for you to go for each of the two elements a or b is then q1, and then vice versa. This may seem a bit verbose for such a single topic, but I assume things can get very complicated with more complex automaton.
So we start at the cell with the value of a in the tape right, the initial state is then q0, we understand that the cell is not yet empty, and so we read the cell value at the head and then we know it to be a so we move on the state of q1. This process repeats as we now have a b in the new head cell, and so with this we move on once again going back to q0. With out location in q0 and the end of the string, we reject this string for the automaton, and that is basically how they work. If there was nothing after a for example, then we would be able to accept the string.
Examples of Automatons:
So in the above example the automaton consists of 5 different possible states as denoted by Q that is to say {A, B, C, D, E}. It has a binary alphabet as denoted by sigma: Σ = {0, 1}. The starting state of our automaton is then represented by A and we also have the accepting outputs as F = {D, E}
So imagine the input 10011. You start out at the state of A, and then reading from the left, the first value is a 1 so you go from A -> B. Now at B the next letter is a 0 and so we do: B -> E Now at E the third letter on the tape is 0 once again. Given this following the automaton we do: E->C. Next letter in the sequence is a 1 again, so from C->D. Now finally that we are at D, we have one final symbol in the string which is a 1, so from D we end up going over to B, which is the final state of the automaton, and so we no longer have anywhere to go, and the string 10011 is REJECTED
Making an Automaton
Now no matter what, when drawing an automaton, we should start out with the initial state. After finding out what our initial state is, then we should decide the action that would be taken based on the current letter in the tape, in this case a, b
So now we need to know, what do we do if we see one a or one b in this initial state that we have thought up. Basically, for each letter in the alphabet, which is the actual discrete math edition of the alphabet, so whatever the set of Σ you are working with.
Now we understand that at our initial state, we have seen basically zero a and zero b, and so both the value of a and the value of b is even. Hence, we understand that adding either an a or b to this initial state will make either or of them to flip to odd. So that is example what we draw. q1 is when the letter on the tape is an a and then q2 is the state when we run into a b. From here we now need to draw the possibility of where we end up once again for running into either an a or b for both the states q1 and q2.
This here ends up being the full automaton. Basically you draw the initial state, and then based on each letter in the alphabet, you draw what the outcome would be when this letter was the thing that you were doing to run int. Now the only thing left to do in the above image is what happens if we are in q3 and run into an a or b, and the answer is go back to q1 or q2 respectively. So doing this would look like:
Automaton Simulator
See the actual simulator here
FSA: finite state automaton.
DFA: Definite finite automaton
So this is what the site looks like basically. You can I assume make finite state machines with all of this. It has a little start state as you can see over there, and then you can pretty much add in another state using that little green button plus under the PDF icon in the image.
You can name the states whatever you want of course. To add in a new transition, you just take a given state node and then you click and drag between them to make little arrows and create your cool little state. You need to have the label for it of course.
You can even make self looks if you want to:
So the above example here would basically accept any and all strings that start with A, given the language of Σ={a, b}.
You can actually even have bulk testing and rejection for your stuff, like you can see there
So with this you have basically what strings should be good and not good, these are kind of like the automated test-cases is really what you can think of them as, and then pressing on that bulk testing green arrow is going to run all of those strings through your automaton machine and let you see which one of them works and what not. To see if your machine state is good.
Language of Automata
You can clearly see the pattern of hey, if we end with a 10, then we know that we will be accepted no matter what on the E state.
You can see this because all of the actual input that gets you to E is all zeros and nothing else.
Basically you compute backwards, and you do this for the value of D as well, you can see that the entire automaton is symmetric and so the same rules apply, therefore you can quickly make rules for the language of the automaton, the things that it intakes.
Basically what you do is you start out with the accepting state, and then you see all of the values that lead you to that accepting state. Then you look at the states before the accepting state that lead to it, so in the case of D, you look at C and E, the penultimate states. Now you look at the input that comes for them as well, you notice it is ALL 0, and so you know if a given binary string ends with 01, then that string will be accepted.
Recognize a Language
Imagine an automaton accepting every single binary:
There is a final state a, the arrows that are entering it have no given restrictions. The outgoing arrows could look into the state of A. You still need an initial state, so we can call that B. It would look something like this:
As a matter of fact you can even simplify it down to:
A good way to make an automaton is for you to first actually decide what the correct path or paths to an accepting state is, and then fill in all of the other states that exist outward from that based on just filling in the other options for all of the other states.
Weekly Practice:
Book Work:
Book Reading:
Well, what is a computer? The thing is, that even though you know what a computer is, you really cannot outright describe every single little thing that it is doing, not with a mathematical theory at least.
So instead we use something called the computational model. Now, a model for computation is not perfect, it describes somethings well, but not all things well, and there are many different computational models that exist, the simplest of which is called the finite state machine or the finite automaton
Finite automata are good model for computers with an EXTREMELY limited amount of memory. As time passes this becomes less and less of an issue, but we still do interact with various IoT things that have very little memory. Things like supermarket door entrances for example. Detect if a person is coming and if you are closed, then open, otherwise close
Here is the automaton for example, you start off closed, if there is nobody in the front rear or neither then you loop on closed, if there is someone then you open and you remain open. If there is nobody then you go back to being closed, very simple but in fact a finite automaton
This is a really good representation of a real life controller being mapped to an automaton, you have a single bit of memory but that memory is determinate for if someone or something is on it, meaning it becomes very useful. More complicated examples might be an elevator controller, which would maybe have memory for the order in which for each of the floors it has to go to in a given sequence for example. Something with more memory/
Finite automata have a probabilistic counterpart called Markov Chains which are similar enough and used for things like attempting to recognize patterns in data. These are used in things like speech processing and in optical character recognition. Even in some niche environments have been used to predict financial markets.
Automatons
Here is an example of a finite automaton. Let us call it M1 and proceed to reference all of it’s different states and characteristics
We can call it a state diagram of M1, as it has three states in it’s set of Q, this being q1, q2, and q3. The special start state is labeled by the arrow coming in from nowhere, and it is q1, this is the state our machine starts in. The accepting state is labeled with the two rings around it as q2, and the arrows going between states are called transitions
Based on a binary input as that is the alphabet denoted by Σ = {0, 1} we can input any string of ones and zeros and we either get out an accept or reject output out of our given automaton. The input string is read one by one from left to right, and based on the current state and the transitional arrows, the machine moves from state to given state.
Basically, you can see that this automaton in the above image has a few properties, it accepts any binary string that ends in either a 1 or that ends in an even number of 0.
Formal Definition of a finite automaton
Okay so boom, here is basically everything that is going on step by step.
-
The first is the finite set of all of the possible states that our finite automaton can be in right, this is all of the circular nodes that can be hit based on the various paths of input
-
The finite set denoted by sigma is then the alphabet, you can look further up for the definition of an alphabet, but it is basically just a set of symbols
-
The transition function denoted by delta
δis basically the description of hey, if you are at this current state, if you get this given input from the alphabet, what is the new state that you end up at. So say you have a statexand another statey, if you have a transition denoted by the value of 1 fromxtoy, then whenever the machine is in state x and it reads a 1 it goes to y, we can denote this with the transition function asδ(x,1)=yUsing this we can actually describe every single possible path of movement in our automaton -
The starting state is denoted by
q0and is just that, it is the place that your automaton starts in and you go begin to read input and travel through transitions from -
Finally we have the set of F which is the set of all accept states, so all of the states that return an accepted output whenever they are what you land on when you finish reading the string. This also means that obviously they are a subset of the set of all possible states for the automaton.
This defines out a few basic rules:
- You can have zero accept states as then
F = ∅ ⊆ Qwhich out in fact be true and is allowed - You can also see that by this definition, the transition function specifies exactly one next state for each possible combination of our state and symbol, so you MUST have a transition for each given input at every single state possible.
- You must also then have a starting state as well
For the above example of automaton, this would be this data specified for it:
Another few things to being, if you have a situation for an automaton M and a set of all possible strings that are return an accept output when put into m A, then you can say that M recognizes A.
A machine may accept several different strings, but it only ever recognizes one given language as denoted by the set evaluating to sigma. If a machine accepts no strings, it still recognizes one language, that being the empty set: ∅
This automaton works for multiples of 3 pretty much. Now while this was not the worst thing to draw out in the entire world, it can still be a hassle. There are also some more automatons that might be too crazy to draw, for example imagine one dealing with the entire phonetic alphabet, each node gets 26 transitions and there are probably a ton of nodes, so sometimes it is easier to just say what the automaton does rather than draw out the model, here is an example for the mod three diagram above:
This is also a really good definition for the more formula understanding of the same model. It is still the same thing, but it uses the formal definition instead of the informal one to describe what is happening, it defines the model with the basic formula and then give generalized values that proceed to describe the method in which to get to the accept state.
Designing an automaton
To design an automaton can be a fairly difficult process all things considered. Hence, you cannot outright state that there is a single method by which you should go about it, but there are some good tips. One of the better ones being is hey, pretend you yourself are the machine, what would you do in order to accomplish whatever description you have taken out?
In essence it really is kind of the same process as when creating something like maybe a flowchart or a given algorithm, but with less manipulative ability and more so just the movement between being correct and not being correct. I would say the best thing to do is find the math that would lead you to being correct, and then make all of the other possible branches you can get from each of your given symbols in the alphabet.


























