How could I show that there exist infinitely many DFA's each of which recognises the language {ϵ,a,b}.
That depends on how you are counting DFAs. Clearly there is one DFA for the language, and you can always add an unreachable state to the automaton. Ordinarily, though, such trivial differences are discounted, and with a finite language, there are only a finite number of different DFAs. With an infinite language there would be cycles in the transition graph which can be expanded again and again, which makes for a more significant difference. Another way to put it, you cannot show that there exist an infinite number of different DFAs for the given finite language.
Related
I have a burning question about finite state machines, that how we can know that this language needs 2 states or 3 states? I mean is there any formula for that?
Although I believe, we would always work to minimize the number of states but still How can we determine the number of states to be created according to any language or string (without actually constructing the DFA)?
You are in effect asking about DFA minimization. It is a well-studied problem for which a number of algorithms have been developed. The Wikipedia article on it is a good starting point.
The theoretical result which governs the number of states is the Myhill-Nerode theorem, but this theorem doesn't give any quick formula. You have to determine the number of equivalence classes in an equivalence relation defined in terms of the language. Hopcroft's algorithm for DFA minimization is essentially an algorithm for determining the equivalence classes in the Myhill-Nerode equivalence relation. I suspect that any attempt to use Myhill-Nerode more directly is going to lead to something similar to Hopcroft's algorithm, though I am not an expert in the field.
Aho-corasick multiple pattern matching algorithm is a finite state machine with only 1 state.
Initially I modeled my objective function as follows:
argmin var(f(x),g(x))+var(c(x),d(x))
where f,g,c,d are linear functions
in order to be able to use linear solvers I modeled the problem as follows
argmin abs(f(x),g(x))+abs(c(x),d(x))
is it correct to change variance to absolute value in this context, I'm pretty sure they imply the same meaning as having the least difference between two functions
You haven't given enough context to answer the question. Even though your question doesn't seem to be about regression, in many ways it is similar to the question of choosing between least squares and least absolute deviations approaches to regression. If that term in your objective function is in any sense an error term then the most appropriate way to model the error depends on the nature of the error distribution. Least squares is better if there is normally distributed noise. Least absolute deviations is better in the nonparametric setting and is less sensitive to outliers. If the problem has nothing to do with probability at all then other criteria need to be brought in to decide between the two options.
Having said all this, the two ways of measuring distance are broadly similar. One will be fairly small if and only if the other is -- though they won't be equally small. If they are similar enough for your purposes then the fact that absolute values can be linearized could be a good motivation to use it. On the other hand -- if the variance-based one is really a better expression of what you are interested in then the fact that you can't use LP isn't sufficient justification to adopt absolute values. After all -- quadratic programming is not all that much harder than LP, at least below a certain scale.
To sum up -- they don't imply the same meaning, but they do imply similar meanings; and, whether or not they are similar enough depends upon your purposes.
I don't know what the differences are between a transition diagram and finite automata. When I google for 'transition diagram', I get state diagrams as a result.
Is there a difference between transition diagrams and finite automata? Or is finite automata a form of transition diagrams?
Thanks.
A transition diagram is a way of visually representing finite state machines. It's kind of on the borderline between flowcharts and source code; it contains enough information to completely describe the finite state machine, but when implementing FSMs on a computer, we generally use other representations that are easier for the computer to process.
A transition diagram for DFA, is a graph shows moment or transition
between states For each state in Q there is a node represented by the
circle.3 main components are initial state,final state and inputs
. Finite machine . It is an abstract machine shows finite number
of states it is the simplest machine to recognize patterns.
Hope this will be helpfull for you.
Finite Automata is a machine where you feed the machine with some input and the machine produces a respective output(Mealy Machine, Moore machine) or no output at all(Deterministic Finite Automata, Non Deterministic Finite Automata) depending on the machine.
Whereas, a transition diagram is used to show the transition from one state to another which is used by all of the above machines. For Example transition from Q1 (initial state) to QF (Final state).
A finite automaton (FA) as name implies Finite number of states
is a simple idealized machine used to recognize patterns within input taken from some character set (or alphabet) .
The job of an FA is to accept or reject an input string depending on whether that string being accepted by FA or not.
whereas ;
Transition daigram can be interpreted as a flowchart for an algorithm recognizing a language ; show the transition form one state to other after recieving input strings consists of three things:
A finite set of states, at least one of which is designated the start state and some of which are designated as final states
I'm looking for a way to write a program that creates short german sentences with a restricted letter set. The sentences can be nonsense but should grammatically be correct. The following examples only contain the letters "aeilmnost":
"Antonia ist mit Tina im Tal."
"Tamina malt mit lila Tinte Enten."
"Tina nimmt alle Tomaten mit."
For this task I need a dictionary like this one (found in the answer to "Where can I find a parsable list of German words?"). The research area for programatically create text is NLG - Natural Language Generation. On the NLG-Wiki I found a large table of NLG systems. I picked two from the list, which could be appropriate:
SimpleNLG - a Java API, which has also an adaption for the german language
KOMET - multilingual generation, from University Bremen
Do you have worked with a NLG library and have some advice which one to use for building short sentences with a letter set restriction?
Can you recommend a paper to this topic?
Grammatically correct is a pretty fuzzy area, since grammar is not to strictly defined as one might think. What you really want here though, is a part-of-speech tagger, and a markov chain.
Specifically a markov chain says that given a certain state (the first word for instance) there's just a certain chance of moving on to another state (the next word). They are relatively easy to write from scracth, but I've got a gist here in python that shows how they work if you want an example.
Once you've got that I would suggest a part-of-speech-based markov chain, combined with just checking to see if words are constructed from your desired character set. In general the algorithm would go something like this:
Pick first word at random, checking that it is constructed solely from your desired set of characters
Use the Markov Chain to predict the next word
Check if that word is an appropriate part of speech, and that it conforms to the desired character set.
If not, predict another word until it is the case.
If so, then repeat starting at 2 to completion.
Hope that's what you're looking for. Let me know if you have any more questions.
As Slater Tyranus already said, Markov chains certainly form the basis of this task. I am going to suggest a more heavy-duty approach. It is considerably more work, but is likely to give much better results in terms of grammatical correctness.
Language Model based on PCFG parse trees: A language model works by assigning a probability to a sequence of words. It requires training data, however, in order to be built first. In your case, the training process should disregard words containing letters outside the limited set.
While theoretically a language model based on parse trees is much more likely to serve your purpose, there is one caveat: due to the kind of letter-based restriction you have, data sparsity will certainly raise its ugly head. Backoff techniques (e.g. Katz's backoff model) can help a bit, but it will essentially depend on whether or not you can train on enough enough data.
As far as readily available parsers are concerned, the Stanford NLP group provides a German parser based on the Negra corpus, as mentioned in their home page.
What are the relative pro's and con's of both DFA's and NFA's when compared to each other?
I know that DFA's are easier to implement than NFA's and that NFA's are slower to arrive at the accept state than DFA's but are there any other explicit, well known advantages/disadvantages?
NFAs and DFAs accept the same set of languages - the regular languages.
A direct implementation of an NFA (which is not a DFA, since DFA is a subset of NFA) usually involves allowing backtracking whereas a direct implementation of a DFA requires only as many steps as the input length, so in that sense, DFAs "arrive at the answer" faster than equivalent NFAs (which are not DFAs).
When trying to find a FA corresponding to a given language or RE (e.g., by an algorithm), it is usually easier to arrive first at the NFA (since the rules are less strict). This is especially true when attempting to demonstrate the existence of a FA, since the existence of an NFA is as good as the existence of a DFA. If a DFA is needed, algorithms exist for (a) converting the NFA to an equivalent DFA and (b) minimizing the DFA.
Making gross generalizations, DFAs are faster but more complex (in terms of number of states and transitions) whereas NFAs are slower but more simple (in the same terms).
The advantage of NFA's over DFA's is the property, to always "choose the right path". Since you cannot say in an algorithm to "choose the right path", usually a conversion from NFA to DFA works, creating DFA states that symbolize multiple NFA states. Thus, when your NFA is in State A and has the choice to go to A,B or C then the next state in your DFA would be {A,B,C}.
This explains the advantages and the disadvantages:
DFA's can be implemented easier since their next state is determined by a function.
NFA's allow a user to easier express what they want, because the NFA can choose between many path's.
One definite advantage of NFA's over DFA's is that, you can build a FA representing the language that is a union, intersection, concetanation etc. of two (or more) languages easily by using NFA's. That is to say, if you have slightly simple FA's doing parts of the job, you can combine them easily using NFA's. While using a DFA, you need to build a new automata doing all the job by itself.
see, it is easier to implement.
but there's the time issue as you mentioned.