Computer Science Articles - Page 39 of 62

Explain about pumping lemma for context free language?

Bhanu Priya
Updated on 16-Jun-2021 13:41:23

2K+ Views

ProblemExplain the pumping lemma for context free language by showing that the language of strings in the form xnynzn is not a context free language.SolutionPumping lemma (Context free grammar)We can prove that a particular language is not context free grammar using pumping lemma.Let’s take the concept of proof by contradictionHere we assume that language is CFGConditions of pumping lemmaFirst of all consider a string and split into 5 parts those are pqrst it must satisfy the following conditions −|qs|>=1|qrs|=n (“ n” is pumping length)pqirsit € L for different values of iLet the L be the CF language.Now we can take ... Read More

What are the undecidable problems in TOC?

Bhanu Priya
Updated on 16-Jun-2021 14:01:08

14K+ Views

The problems for which we can’t construct an algorithm that can answer the problem correctly in the infinite time are termed as Undecidable Problems in the theory of computation (TOC).A problem is undecidable if there is no Turing machine that will always halt an infinite amount of time to answer as ‘yes’ or ‘no’.ExamplesThe examples of undecidable problems are explained below. Here, CFG refers to Context Free Grammar.Whether two CFG L and M equal − Since, we cannot determine all the strings of any CFG, we can predict that two CFG are equal or not.Given a context-free language, there is ... Read More

Give the examples of a context free language that are not regular?

Bhanu Priya
Updated on 16-Jun-2021 13:40:50

3K+ Views

A context-free grammar (CFG) consisting of a finite set of grammar rules is a quadruple (V, T, P, S)Where, V is a variable (non terminals).T is a set of terminals.P is a set of rules, P: V→ (V ∪ T)*, i.e., the left-hand sides of the production rule. P does have any right context or left context.S is the start symbol.By using the rules of any language, we can derive any strings in that language.For language a* CFG is as follows −S -> aSS -> ɛHere, S are the variables.a and ɛ terminals.S is the start symbol.By using these rules, ... Read More

Differentiate between recognizable and decidable in the Turing machine?

Bhanu Priya
Updated on 16-Jun-2021 13:34:12

15K+ Views

When we talk about Turing machines (TM) it could accept the input, reject it or keep computing which is called loop.Now a language is recognizable if and only if a Turing machine accepts the string, when the provided input lies in the language.Also, a language can be recognizable if the TM either terminates and rejects the string or doesn't terminate at all. This means that the TM continues with the computing when the provided input doesn't lie in the language.Whereas, the language is decidable if and only if there is a machine which accepts the string when the provided input ... Read More

Prove the equalities of regular expressions by applying properties?

Bhanu Priya
Updated on 16-Jun-2021 13:33:17

1K+ Views

ProblemProve each of the following equalities of regular expressions.a. ab*a(a + bb*a)*b = a(b + aa*b)*aa*b.b. b + ab* + aa*b + aa*ab* = a*(b + ab*).SolutionProblem 1Prove that ab*a(a + bb*a)*b = a(b + aa*b)*aa*b.Let’s take LHS ,    = ab*a(a + bb*a)*b Use property of (a+b)* = a*(ba*)*    = ab*a (a* ((bb*a) a* )* a*b    = ab* a (a*bb*a)* a*b {Associative property}    = ab* (a (a*bb*a)*)a*b    = ab*(aa*bb*)*aa*b    = a (b*(aa*bb*)*)aa*b Use property a* (ba*)*= (a+b)*    = a(b+aa*b)*aa*b    = RHS Hence provedProblem 2Prove that b + ab* + aa*b + aa*ab* ... Read More

Show that the set of recursive languages is closed under reversal?

Bhanu Priya
Updated on 16-Jun-2021 13:29:59

786 Views

Consider a Language L, over an alphabet T is known as recursive enumerable if there exists a turing machine (TM) which generates a sequence of numbers T* which have precisely the members of L.Whereas L is said to be recursive if there exists a Turing Machine enlisting all members of L and stopping on each member of L as the input.Thus it is clear from the above statements that every recursive language is also recursively enumerable but the converse is not true.The precise connection between families of languages is given below.TheoremStep 1 − A language L is said to be ... Read More

Explain the Closure Under Kleene Star of CFL in TOC?

Bhanu Priya
Updated on 16-Jun-2021 13:29:01

726 Views

If L is a CFL, then L*is a CFL. Here CFL refers to Context Free Language.StepsLet CFG for L has nonterminal S, A, B, C, . . ..Change the nonterminal from S to S1.We create a new CFG for L* as follows −Include all the nonterminal S1, A, B, C, . . . from the CFG for L.Include all productions of the CFG for L.Add new nonterminal S and new productionS → S1S | ∧We can repeat last productionS → S1S → S1S1S → S1S1S1S → S1S1S1S1S → S1S1S1S1∧ → S1S1S1S1Note that any word in L* can be generated by ... Read More

Explain the context free language closure under concatenation?

Bhanu Priya
Updated on 16-Jun-2021 13:28:14

1K+ Views

Here CFL refers to Context Free Language. Now, let us understand closure under concatenation.Closure under ConcatenationsIf L1 and L2 are CFLs, then L1L2 is a CFL.Follow the steps given below −L1 CFL implies that L1 has CFG1 that generates it.Assume that the nonterminals in CFG1 are S, A, B, C, . . ..Change the nonterminal in CFG1 to S1, A1, B1, C1, . . ..Don’t change the terminals in the CFG1.L2 CFL implies that L2 has CFG2 that generates it.Assume that the nonterminals in CFG2 are S, A, B, C, . . ..Change the nonterminal in CFG2 to S2, A2, ... Read More

Explain the context free language closure under union operation?

Bhanu Priya
Updated on 16-Jun-2021 13:27:48

856 Views

If L1 and L2 are CFLs, then their union L1 + L2 is a CFL.Here CFL refers to Context Free Language.L1 CFL implies that L1 has a CFG, let it is CFG1, that generates it.Assume that the nonterminals in CFG1 are S, A, B, C, . . ..Change the nonterminal in CFG1 to S1, A1, B1, C1, . . ..Don’t change the terminals in the CFG1.L2 CFL implies that L2 has a CFG, Let it is CFG2, that generates it.Assume that the nonterminals in CFG2 are S, A, B, C, . . ..Change the nonterminal in CFG2 to S2, A2, ... Read More

Generate a Context-free grammar for the language L = {anbm| m≠n}?

Bhanu Priya
Updated on 16-Jun-2021 13:21:38

8K+ Views

A context-free grammar is a quadruple G = (N, T, P, S), Where, N is a finite set of nonterminal symbols, T is a finite set of terminal symbols, N ∩ T = ∅, P is a finite set of productions of the form A → α, Where A ∈ N, α ∈ (N ∪ T)*, S is the start symbol, S ∈ N.Construct a Context free grammar for the language, L = {anbm| m ≠n}Case 1n > m − We generate a string with an equal number of a’s and b’s and add extra a’s on the left −S ... Read More

Advertisements