computation-theory

Example of Non-Linear, UnAmbiguous and Non-Deterministic CFL?

可紊 提交于 2019-12-17 06:51:42
问题 In the Chomsky classification of formal languages, I need some examples of Non-Linear, Unambiguous and also Non-Deterministic Context-Free-Language(N-CFL)? Linear Language : For which Linear grammar is possible( ⊆ CFG) e.g. L 1 = {a n b n | n ≥ 0 } Deterministic Context Free Language(D-CFG) : For which Deterministic Push-Down-Automata(D-PDA) is possible e.g. L 2 = {a n b n c m | n ≥ 0, m ≥ 0 } L 2 is unambiguous. A CF grammar that is not linear is nonlinear. L nl = {w: n a (w) = n b (w)} is

Example of Non-Linear, UnAmbiguous and Non-Deterministic CFL?

别等时光非礼了梦想. 提交于 2019-12-17 06:51:18
问题 In the Chomsky classification of formal languages, I need some examples of Non-Linear, Unambiguous and also Non-Deterministic Context-Free-Language(N-CFL)? Linear Language : For which Linear grammar is possible( ⊆ CFG) e.g. L 1 = {a n b n | n ≥ 0 } Deterministic Context Free Language(D-CFG) : For which Deterministic Push-Down-Automata(D-PDA) is possible e.g. L 2 = {a n b n c m | n ≥ 0, m ≥ 0 } L 2 is unambiguous. A CF grammar that is not linear is nonlinear. L nl = {w: n a (w) = n b (w)} is

Is a*b* regular?

狂风中的少年 提交于 2019-12-17 05:11:11
问题 I know a n b n for n > 0 is not regular by the pumping lemma but I would imagine a*b* to be regular since both a,b don't have to be the same length. Is there a proof for it being regular or not? 回答1: Answer to your question: imagine a*b* to be regular, Is there a proof for it being regular or not? No need to imagine, expression a*b* is called regular expression (re), and regular expressions are possible only for regular languages. If a language is not a regular then regular expression is also

Union in context-free languages

我的未来我决定 提交于 2019-12-13 08:35:40
问题 Is the union of a collection of context-free languages always context-free ? Justify your answer ..... I know that the answer is yes, but how can I prove it ? 回答1: To show that the finite union of context-free languages is context-free you just have to build a context-free grammar for the union language, exactly as you would do to prove that the union of two context-free languages is context-free. If G1,...,GN are the context-free grammars for the N context-free languages you have, rename all

Writing a program that writes a program

心已入冬 提交于 2019-12-13 03:56:58
问题 Its well known in theoretical computer science that the "Hello world tester" program is an undecidable problem.(Here is a link what i mean by hello world tester My question is since given a program as input we can't say what the program will do,can we solve the reverse problem: Given set of input and output,is there an algorithm for writing a program that writes a program to achieve a one to one mapping between the given input and output. I know about metaprogramming but my question is more

Is it possible to make a halting function if you don't call it on itself?

白昼怎懂夜的黑 提交于 2019-12-12 14:24:57
问题 The standard proof of of the impossibility of solving the halting problem is usually something like this //does_halt() takes a function as input and returns true if it will ever finish computing function paradox() {if does_halt(paradox()) { while(true){} } } This proof requires that you call the halting function recursively, but is it possible to make a halting function that always computes the correct result as long as it isn't called on itself? 回答1: That proof does not require recursion.

Are all infinite languages undecidable?

落花浮王杯 提交于 2019-12-11 22:40:27
问题 I am wondering are all infinite languages undecidable? They must be right, as the TM trying to decide an infinite language would just loop forever, which makes it a recgonizer, not a decider. Thanks guys. 回答1: No, there are many infinite languages that are decidable. One trivial example is the language {n € N | a^n} , i.e. the language of words that only contain the letter "a". This language can be matched by the regular expression a* . so it is a regular language and thus decidable. 回答2: As

How does a pushdown automaton know how to read a palindrome?

孤人 提交于 2019-12-11 07:54:31
问题 For example, how does a PDA know how to read a palindrome in L = {a, b}*? PDA that accepts palindromes over {a,b}* : So, based on my drawing of the PDA: How does it know when the first half of the string is on the final terminal (letter of the alphabet), and therefore knows to go from state 0 to state 1 (and furthermore knowing to "pop" letters from the stack backwards, hence creating the palindrome)? 回答1: This is a nondeterministic pushdown automata. The answer to your question is that it

Pumping Lemma in context-free languages

这一生的挚爱 提交于 2019-12-11 05:27:08
问题 A = {0^a 1^b 2^c | a < b < c} I need to show that A is not context-free. I'm guessing I have to use the Pumping Lemma for this, but how? 回答1: The goal is to prove that for any string with length >= a minimum pumping length, the string cannot be pumped. That is, if you split it into substrings uvxyz , the string that results from making copies (or removing copies) of v and y are still in language A . Note that you only have to show that one string in the language cannot be pumped (as long as

What are the type of Strings generated by (a*+b*)

会有一股神秘感。 提交于 2019-12-10 21:00:21
问题 Besides strings of any number of a's and b's like aa.. or bb.. ,Would regular expression (a*+b*) contain a string like ab or any string ending with b ? Is (a*+b*) same as (a* b*) ? I am a little bit confuse about the strings generated by regular expression (a*+b*) and would really appreciate if someone can help. 回答1: Unless you're working with a regex language which explicitly classifies the *+ as a special token which either has a special meaning, or is reserved for future extension (and