Found 690 Articles for Computer Science

Explain the construction of finite and infinite language?

Bhanu Priya
Updated on 15-Jun-2021 12:02:27

1K+ Views

Firstly, let us learn about the infinite language and then understand how to construct the finite and infinite language in the theory of computation (TOC).Infinite languageThere is no bound on the length of any strings in an infinite language.There is no bound on any number of derivation steps used to derive the strings also.For example, if the grammar has n productions, then any derivation consisting of n + 1 steps uses some production twice.If the language is said to be infinite, then some production or sequence of productions must be used repeatedly to construct the derivationsExampleThe infinite language {anb | ... Read More

Explain type 2 grammar with properties

Bhanu Priya
Updated on 15-Jun-2021 11:57:28

1K+ Views

Type 2 grammars are context free grammars (CFG).All productions are of the form −A → x — where A is nonterminal, x is a string of nonterminal and terminals, A context-free grammar is equivalent to a pushdown automaton (PDA) and to context free languages.Example − Pushdown Automaton (PDA)PropertiesA grammars, G = (V, T, P, S) is said to be context free if the production rule is of the form, A → α .The transition allows A → ε [i.e., α → ε] where, A is a non terminal symbol α is any terminal or non-terminal symbol.Here, the left hand side of ... Read More

Construct a TM recognizing strings of the form an bn cn| n≥1 over = {a, b, c}

Bhanu Priya
Updated on 15-Jun-2021 11:55:29

481 Views

AlgorithmStep 1: Process the leftmost „a‟ and replace it by „x‟.Step 2: Move right until the leftmost „b‟ is reached. Replace it by „y‟.Step 3: Move right until the leftmost „c‟ is reached. Replace it by „z‟.Step 4: Move left to reach the leftmost „a‟ and perform steps 1, 2 and 3 (n – 1) times.Step 5: Halt if there are „n‟ number of x, y, z.Turing Machine for the given language is as follows −The Turing machine, M is given by M = (Q, Σ, Γ, δ, q0, B, F)Where, Q = {q0, q1, q2, q3, q4, q5}Σ = ... Read More

Explain formal definition of language with examples in TOC?

Bhanu Priya
Updated on 15-Jun-2021 11:54:25

3K+ Views

The set of all strings (over terminal symbols) which can be derived from the start symbol is the language generated by the grammar G.Example 1Let grammar G be defined by the set of terminals T = {a, b}, the only non-terminal start symbol S and the set of production rules. Hence, the grammar G would be as follows −S → ∧, S → aSbOr in shorthand, it is as mentioned below −S → ∧ | aSbL(G) = {∧, ab, aabb, aaabbb, . . . }DefinitionIf G is called as a grammar with start symbol S and set of terminals T, ... Read More

What is type 3 grammar? Explain its properties

Bhanu Priya
Updated on 15-Jun-2021 11:50:16

931 Views

Type 3 grammars are regular grammars that describe regular / formal languages.These grammars contain production rules consisting of the following −Only one non-terminal at the left hand side, The right hand side has a single terminal and may or may not be followed by non terminals.ExampleA → ε , A → a, A → b, A → aA etc.TypesThere are two types of regular grammars namely −Right linear / Right regular grammarLeft linear / Left regular grammarLet us learn about these two types of grammar in detail.Right linear grammarThis is a regular grammar with the production rules of the formA ... Read More

What do you mean by grammar and production in TOC?

Bhanu Priya
Updated on 15-Jun-2021 11:51:49

3K+ Views

Let us understand the concept of grammar in the theory of computation (TOC).Introduction to GrammarA language over an alphabet ∑ is a set of strings from ∑.Grammar is a set of rules used to define a language. In short, it is the structure of the strings in the language.To describe a grammar for a language, two collections of alphabets (symbols) are necessary. These are explained below −Terminals are those symbols from which all strings in the language are made – symbols of a ‘given’ alphabet for a generated language. These are usually the lower case letters.Non-terminal are ‘temporary’ symbols (disjoint ... Read More

What are the basic properties of products in TOC?

Bhanu Priya
Updated on 15-Jun-2021 11:47:26

173 Views

It is easy to see that for any language L the following simple properties hold −L · {∧} = {∧} · L = LL · ∅ = ∅ · L = ∅Now let’s see the commutativity and associativity of the operation of concatenation.Properties of products – commutativityThe operation of concatenation is not commutative. In other words, the order matters!Given two languages L and M, it’s usually true thatL · M ≠ M · LExampleIf L = {ab, ac} and M = {a, bc, abc}, then the productL · M is the languageL · M = {aba, abbc, ababc, aca, acbc, ... Read More

Design NPDA for accepting the language L = {am b(2m) | m>=1}

Bhanu Priya
Updated on 15-Jun-2021 11:43:25

521 Views

Basically a push down automata (PDA) is as follows −“Finite state machine+ a stack”PDA has three components, which are as follows −An Input tape.A control unit.A Stack with infinite size.A PDA can be formally described as seven tuples(Q, Σ, S, δ, q0, I, F)Where, Q is finite number of statesΣ is input alphabetS is stack symbolΔ is the transition function: QX(Σ∪{e})XSXQq0 is the initial state (q0 belongs to Q)I is the initial state top symbolF is a set of accepting states (F belongs to Q)ProblemConstruct a non-deterministic PDA (NPDA) for accepting the languageL = {a^m b^{2m} | m>=1}.SolutionThe strings which ... Read More

Construct DPDA for anbmc(n+m) n,m≥1 in TOC

Bhanu Priya
Updated on 15-Jun-2021 11:41:32

1K+ Views

A push down automata (PDA) can be formally described as seven tuples(Q, Σ, S, δ, q0, I, F)Where, Q is finite number of statesΣ is input alphabetS is stack symbolΔ is the transition function: QX(ΣU{e})XSXQq0 is the initial state (q0 belongs to Q)I is the initial state top symbolF is a set of accepting states (F belongs to Q)ProblemConstruct PDA for anbmc(n+m) n, m≥1SolutionSo, the strings which are generated by the given language are as follows−L={abcc, aabccc, aaabbccccc, ….}That is to add the number of a's and b's, and that will equal the number of c's.So for every a's and ... Read More

Explain the technique for combining two languages in TOC?

Bhanu Priya
Updated on 15-Jun-2021 11:43:48

730 Views

There are three common ways of creating a new language from two languages −UnionIntersectionProductLanguages are sets of strings, so they can be combined by the usual set operations of union and intersection.IntersectionIf L1 and L2 are languages over ∑, then L1 ∩ L2 is the language of strings in both L1 and L2 .For example, If L = {aa, bb, ab} and M = {ab, aabb} then, The intersection is as follows −L ∩ M = {ab}AndUnionIf L1 and L2 are languages over the alphabet ∑, then the language L1 ∪ L2 is the language of all strings in at ... Read More

Advertisements