Found 1163 Articles for Computers

Explain the Decidable and undecidable problems

Bhanu Priya
Updated on 14-Jun-2021 11:47:55

12K+ Views

Before we understand about the decidable and undecidable problems in the theory of computation (TOC), we must learn about the decidable and undecidable language. Hence, let us first see what do you mean by decidable language.Decidable LanguageA language L is called decidable if there is a decider M such that L( M) = L.Given a decider M, you can learn whether or not a string w ∈ L(M).Run M on w.Although it might take a long time, M will accept or reject w.The set R is the set of all decidable languages.L ∈ R if L is decidable.Undecidable LanguageA decision ... Read More

How to generate regular expression from finite automata?

Bhanu Priya
Updated on 16-Jun-2021 14:58:05

2K+ Views

There are two methods for converting deterministic finite automata (DFA) to Regular expression (RE). These are as follows −Arden’s MethodState Elimination MethodLet us understand these methods in detail.Arden’s TheoremLet P and Q be the two regular expressions.If P does not contain null string, then following equation in R, viz R = Q + RP,Which has a unique solution by R = QP*Here,The finite Automata do not have epsilon movesIt must have only initial state q1It’s states are q1, q2, q3,…….qn. The final state may be some qi where i

Explain the Star Height of Regular Expression and Regular Language

Bhanu Priya
Updated on 12-Jun-2021 11:58:55

590 Views

The star height of Regular expression (RE) is nothing but the depth of Kleene stars in the theory of computation (TOC).For example, a+b the star height is 0(a+b)* the star height is 1(a*+b*)* the star height is 2 …….Star height is used to indicate the structural complexity of regular languages and expressions.The regular expressions may have different star height that depends on structural complexity or nesting.The star height of a regular language is a unique number and that is equal to the least star height of any regular expression which represents that language.The star height of regular expressions is a ... Read More

How to convert FA to Left Linear Grammar in TOC?

Bhanu Priya
Updated on 12-Jun-2021 11:55:37

5K+ Views

A grammar with at most one variable at the right side of production is called linear grammar.Following is an example of the linear grammar −S→aSb/εHere, if you observe, we can write the same production by dividing …..S→AbA→aAbA→εLeft Linear GrammarA grammar is left linear grammar where all non-terminals in the right hand sides are at the left end.For example, A→Sa/εSteps for conversionThe steps for the conversion of finite automata (FA) to the left linear grammar are as follows −Step 1 − Take reverse of the finite automataStep 2 − write right linear grammarStep 3 − Then take reverse of the right ... Read More

How to convert FA to Right Linear Regular Grammar?

Bhanu Priya
Updated on 12-Jun-2021 11:53:24

7K+ Views

A grammar with at most one variable at the right side of production is called linear grammar.Example 1      S→aSb/εExample 2      S→Ab      A→aAb      A→εRight Linear GrammarA grammar is right linear grammar where all the non terminals in the right hand sides are at the right end.For example,       S->aS/εAlgorithm for conversionThe algorithm to convert the finite automata (FA) to the right linear grammar is as follows −Step 1 − Begin the process from the start state.Step 2 − Repeat the process for each state.Step 3 − Write the production as the ... Read More

How to identify if a language is regular or not in TOC?

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

6K+ Views

To identify whether a language is regular or not, is based on Pigeon Hole Principle. This is generally called as the Pumping Lemma.Pumping lemma for Regular languagesIt gives a method for pumping (generating) many substrings from a given string.In other words, we say it provides means to break a given long input string into several substrings.It gives the necessary condition(s) to prove a set of strings is not regular.But the pumping lemma is a contradiction test. This means if any language does not satisfy pumping lemma, then we can say that it is not regular. However, if it satisfies the ... Read More

Eliminate epsilon, unit and useless symbols and rewrite into CNF

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

1K+ Views

ProblemEliminate epsilon, unit and the useless symbols for the given grammar and rewrite it into CNF.S->0E0|1FF| εE->GF->S|EG->S| εSolutionIn the given grammar, we will first remove the null production. There are two null productions in the grammar, as given below −S ==> εG ==> εSo, remove null production and rewrite all the other rules containing G by epsilon there, along with old productions. We do not remove S ==> epsilon as it is the start symbol.Remove G ==> epsilon, we get the following −S ==> 0E0 | 1FF | εE ==> G | εF ==> S | EG ==> SNow remove ... Read More

Generate a CNF for a given context free grammar

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

1K+ Views

ProblemGenerate a Chomsky normal form (CNF) for the following context free grammar (CFG).S->aAa|bBb|eA->C|aB->C|bC->CDE|eD->A|B|abSolutionFollow the steps mentioned below to generate a CNF for the given CFGStep 1 − Eliminate ∧ -productionsWe can delete, erase or ∧ -productions double time repeated.S --> aAa | bBb | ∧A --> a | ∧B --> b | ∧D --> A | B | abStep 2 − Eliminate unit productions in above grammarEliminate R.H.S one symbol productionsS --> aDa | bDbD --> a | b | abStep 3 − Eliminate useless symbolsE is a useless symbol from given grammar since it is not derivative in RHS.S ... Read More

Convert the given Context free grammar to CNF

Bhanu Priya
Updated on 12-Jun-2021 12:10:49

25K+ Views

ProblemConvert the given grammar into Chomsky's Normal Form (CNF)S->AAA|BA->aA|BB-> εSolutionFollow the steps given below to convert CFG to CNF −Step 1 − Eliminate epsilon productionsTo eliminate epsilon productions, the variable which is producing epsilon must be replaced on the RHS of all other productions for the epsilon production to be removed.Replacing B with ε in all other productions gives the following production set −S-> AAA | ε | BA->aA | ε | BReplacing A with \epsilon in all other productions gives the following −S ->AAA | AA | A | B | ε [replacing 1, 2, and 3 A's with ε ... Read More

Explain how to convert CFG to CNF

Bhanu Priya
Updated on 12-Jun-2021 12:34:50

4K+ Views

CFG stands for context free grammar and CNF stands for Chomsky’s Normal Form in the theory of computation.Context Free Grammar (CFG)A context free grammar (CFG) is a forma grammar which is used to generate all possible patterns of strings in a given formal language.It is defined as four tuples −G=(V, T, P, S)Where, G is a grammar, which consists of a set of production rules. It is used to generate the strings of a language.T is the final set of terminal symbols. It is denoted by lower case letters.V is the final set of non-terminal symbols. It is denoted by ... Read More

Advertisements