Docsity

Recursive Defination, Assignments of Theory of Automata

Toggle sidebar
bg1
Question #1
a) What is recursive definition of language
A recursive language is a formal language for which there exists a Turing machine that, when
presented with any finite input string, halts and accepts if the string is in the language, and halts
and rejects otherwise.
Recursion is a very important concept in computer science. Many problems can be simplified by
the use of recursion. A formal definition of recursion is โ€“ A function that calls itself directly or
indirectly and terminates after a finite number of steps.
So that the program does not continue to run indefinitely, a well-defined recursive function
should have the following properties:
There must be a base criterion for which the function does not call itself.
With every call to itself the function must be closer to the base criteria.
For example, a factorial can be defined recursively as:
factorial(x) = x * factorial (x โ€“ 1) for x > 1= 1 for x = 1 or x = 0
The base criteria for the function is at x = 1 or x = 0. i.e. the function does not call itself when it
reaches x = 1 or x = 0. The function calls itself whenever x is not 1 or 0 and moves closer to the
base criteria as x is reduced at every recursive call.
b) Define a Recursive language L beginning and ending on the different letters defined
over โˆ‘={a,b}.
Definition:
A recursive language is a formal language for which there exists a Turing machine that, when
presented with any finite input string, halts and accepts if the string is in the language, and halts
and rejects otherwise.
โˆ‘={a,b}
Language L beginning and ending on the different letters
๐ฟ = {๐‘Ž๐‘,๐‘๐‘Ž,๐‘Ž๐‘Ž๐‘,๐‘๐‘๐‘Ž, ๐‘Ž๐‘๐‘ , ๐‘Ž๐‘๐‘๐‘, ๐‘Ž๐‘๐‘Ž๐‘, ๐‘Ž๐‘Ž๐‘Ž๐‘๐‘๐‘Ž๐‘, โ€ฆ }
Question #2
How regular expression is different from Descriptive Method explain with the help of
example?
Def in it io n
The language accepted by finite automata can be easily described by simple expressions called
Regular Expressions. ... A regular expression can also be described as a sequence of pattern that
defines a string. Regular expressions are used to match character combinations in strings
๏‚ท The language accepted by finite automata can be easily described by simple expressions
called Regular Expressions. It is the most effective way to represent any language.
pf3
pf4

Partial preview of the text

Download Recursive Defination and more Assignments Theory of Automata in PDF only on Docsity!

Question

a) What is recursive definition of language A recursive language is a formal language for which there exists a Turing machine that, when presented with any finite input string, halts and accepts if the string is in the language, and halts and rejects otherwise. Recursion is a very important concept in computer science. Many problems can be simplified by the use of recursion. A formal definition of recursion is โ€“ A function that calls itself directly or indirectly and terminates after a finite number of steps. So that the program does not continue to run indefinitely, a well-defined recursive function should have the following properties: There must be a base criterion for which the function does not call itself. With every call to itself the function must be closer to the base criteria. For example, a factorial can be defined recursively as: factorial(x) = x * factorial (x โ€“ 1) for x > 1= 1 for x = 1 or x = 0 The base criteria for the function is at x = 1 or x = 0. i.e. the function does not call itself when it reaches x = 1 or x = 0. The function calls itself whenever x is not 1 or 0 and moves closer to the base criteria as x is reduced at every recursive call. b) Define a Recursive language L beginning and ending on the different letters defined over โˆ‘={a,b}. Definition: A recursive language is a formal language for which there exists a Turing machine that, when presented with any finite input string, halts and accepts if the string is in the language, and halts and rejects otherwise. โˆ‘={a,b} Language L beginning and ending on the different letters ๐ฟ = {๐‘Ž๐‘, ๐‘๐‘Ž, ๐‘Ž๐‘Ž๐‘, ๐‘๐‘๐‘Ž, ๐‘Ž๐‘๐‘, ๐‘Ž๐‘๐‘๐‘, ๐‘Ž๐‘๐‘Ž๐‘, ๐‘Ž๐‘Ž๐‘Ž๐‘๐‘๐‘Ž๐‘, โ€ฆ }

Question

How regular expression is different from Descriptive Method explain with the help of example? Definition The language accepted by finite automata can be easily described by simple expressions called Regular Expressions. ... A regular expression can also be described as a sequence of pattern that defines a string. Regular expressions are used to match character combinations in strings ๏‚ท The language accepted by finite automata can be easily described by simple expressions called Regular Expressions. It is the most effective way to represent any language.

๏‚ท The languages accepted by some regular expression are referred to as Regular languages. ๏‚ท A regular expression can also be described as a sequence of pattern that defines a string. ๏‚ท Regular expressions are used to match character combinations in strings. String searching algorithm used this pattern to find the operations on a string. For instance: In a regular expression, x* means zero or more occurrence of x. It can generate {e, x, xx, xxx, xxxx,.....} In a regular expression, x+ means one or more occurrence of x. It can generate {x, xx, xxx, xxxx,.....} Operations on Regular Language The various operations on regular language are: Union: If L and M are two regular languages then their union L U M is also a union.

  1. L U M = {s | s is in L or s is in M} Intersection: If L and M are two regular languages then their intersection is also an intersection.
  2. L โ‹‚ M = {st | s is in L and t is in M} Kleen closure: If L is a regular language then its Kleen closure L1* will also be a regular language.
  3. L* = Zero or more occurrence of language L. Example 1: Write the regular expression for the language accepting all combinations of a's, over the set โˆ‘ = Solution: All combinations of a's means a may be zero, single, double and so on. If a is appearing zero times, that means a null string. That is we expect the set of {ฮต, a, aa, aaa, ....}. So we give a regular expression for this as: R = a* That is Kleen closure of a. Example 2: Write the regular expression for the language accepting all combinations of a's except the null string, over the set โˆ‘ = {a} Solution: The regular expression has to be built for the language L = {a, aa, aaa, ....} This set indicates that there is no null string. So we can denote regular expression as: R = a+ Example 3:

Backtracking It is possible to use backtracking in DFA. It is not possible to use backtracking at all times in the case of NFA. Ease of construction Given its complex nature, it is tougher to construct DFA. NFA is more easily constructed in comparison to DFA. Supremacy All DFAs are derived from NFAs. All NFAs are not DFAs. Transition functions The number related to the next state is one. The number related to the next state/ states is either zero or one. Complexities of time The total time required for running any input string in DFA is less than what it is in NFA. The total time required for running any input string in NFA is larger than that in comparison to DFA. Full form The full form of DFA is Deterministic Finite Automata. The full form of NFA is Nondeterministic Finite Automata (NFA). Space requirement More space allocation needed. Less space needed. The setting of the next possible set The next possible state is clearly set in DFA. In NFA, every single pair of input symbols and states may contain many possible next states.

Question

If โˆ‘={a,b} write all possible strings and Draw NFA contains exactly 2aโ€™s. R. E=babab* All possible strings: ๐ฟ = {๐‘Ž๐‘Ž, ๐‘๐‘Ž๐‘Ž, ๐‘๐‘Ž๐‘๐‘Ž, ๐‘๐‘Ž๐‘๐‘Ž๐‘, ๐‘๐‘Ž๐‘Ž๐‘, ๐‘Ž๐‘Ž๐‘, ๐‘Ž๐‘๐‘Ž, ๐‘Ž๐‘๐‘Ž๐‘} Draw NFA contains exactly 2aโ€™s.

b b b

โŸถ ๐‘ž 0 โŸถa ๐‘ž 1 โŸถa ๐‘ž 2