## is $0^x1^y$ context-free?

given that L is regular, does the following make a context-free language?:

i) $$\{0^x1^y \mid 0^{x+y} \in L\}$$

ii) $$\{0^x1^y \mid 0^{x-y} \in L\}$$

since L is regular, i presumed that i) can be put into a pushdown automata, but i don’t see how to do that for ii). if ii) cannot be put into a pushdown automata, it means it is neither context free nor regular? how can it be shown?

and regarding i) it is a context free, right?

thank you very much for your effort. first post here and i’m glad to join this community

## How TO write a context-free grammar for this Language?

How can I write a context-free grammar and not context-free grammar for this Language : L:={a^n c b^n−1:n∈N*}

Thanks

Posted on Categories proxies

## Prove complement a^nb^nc^n is contextfree

So the complement of L1 = {$$a^{n}b^{n}c^{n}$$ | n $$\geq$$ 1} would be L2 = {a,b,c}* \ {$$a^{n}b^{n}c^{n}$$ | n $$\geq$$ 1}.

In other words, any combinations of a,b and c where we dont have an equal number of all three letters and w = $$\varepsilon$$ is also legit.

However, while I’m certain that there should be a contextfree grammar for L2, I can’t seem to find a grammer that allows you to generate the terminals freely without allowing $$a^{n}b^{n}c^{n}$$ with n $$\geq$$ 1.

My attempt was to make a starting Rule S -> $$Q_{_{a}}$$ ; $$Q_{_{b}}$$ ; $$Q_{_{c}}$$ ; $$\varepsilon$$ so that the individual Q rules would make it possible for two of the terminals a, b and c to have an equal number, but not for the third. (in $$Q_{_{a}}$$, a is restricted by max(b,c), in $$Q_{_{b}}$$, b is restricted by max(a,c), in $$Q_{_{c}}$$, c is restricted by max(a,b) so that the restricted terminal can never show up as often as the unrestricted terminal with the highest count)

The rules I set up though, only allow to have unlimited numbers of unrestricted terminals in any order. I’m not sure how to implement a rule for the restricted terminal, without allowing it to have as high a count as the unrestricted ones, if the unrestricted ones have the same count.

here’s my P for G$$_{_{L2}}$$ so far

S $$\rightarrow$$ $$Q_{_{a}}$$ ; $$Q_{_{b}}$$ ; $$Q_{_{c}}$$ ; $$\varepsilon$$

$$Q_{_{a}}$$ $$\rightarrow$$ $$Q_{_{a}}$$b $$Q_{_{a}}$$ ; $$Q_{_{a}}$$c $$Q_{_{a}}$$ ; $$\varepsilon$$

$$Q_{_{b}}$$ $$\rightarrow$$ $$Q_{_{b}}$$a $$Q_{_{b}}$$ ; $$Q_{_{b}}$$c $$Q_{_{b}}$$ ; $$\varepsilon$$

$$Q_{_{c}}$$ $$\rightarrow$$ $$Q_{_{c}}$$a $$Q_{_{c}}$$ ; $$Q_{_{c}}$$b $$Q_{_{c}}$$ ; $$\varepsilon$$

These are still missing the rules for the individual restricted variable. In what fashion can I add those, without breaking the [ $$a^{n}b^{n}c^{n}$$ | n = 0 ] rule?

Edit: it occured to me that I could refine the restricting rules, such that the restricted terminal can be derived from a rule if, and only if one (and only one) of the unrestricted ones is always created with it. For example:

S $$\rightarrow$$ $$Q_{_{a}}$$ ; $$Q_{_{b}}$$ ; $$Q_{_{c}}$$ ; $$\varepsilon$$

$$Q_{_{a}}$$ $$\rightarrow$$ $$Q_{_{ab}}$$b $$Q_{_{ab}}$$ ; $$Q_{_{ac}}$$c $$Q_{_{ac}}$$

$$Q_{_{ab}}$$ $$\rightarrow$$ $$Q_{_{ab}}$$b $$Q_{_{ab}}$$ ; $$Q_{_{ab}}$$c $$Q_{_{ab}}$$ ; $$Q_{_{ab}}$$ a $$Q_{_{ab}}$$ b $$Q_{_{ab}}$$ ; $$Q_{_{ab}}$$ b $$Q_{_{ab}}$$ a $$Q_{_{ab}}$$ ; $$\varepsilon$$

$$Q_{_{ac}}$$ $$\rightarrow$$ $$Q_{_{ac}}$$b $$Q_{_{ac}}$$ ; $$Q_{_{ac}}$$c $$Q_{_{ac}}$$ ; $$Q_{_{ac}}$$ a $$Q_{_{ac}}$$ c $$Q_{_{ac}}$$ ; $$Q_{_{ac}}$$ c $$Q_{_{ac}}$$ a $$Q_{_{ac}}$$ ; $$\varepsilon$$

At this point my brain starts running in circles. Would this set me on the right path?

Posted on Categories proxies

## Give an example of a context-free language that is not regular, or prove that none exists

Is it pda? how can I solve this question?

Posted on Categories proxies

## Converting context-free grammar to chomsky normal form and ait greibach normal form

I am sorry , my english is not well.

My question is:

S->aAc|asc A->aAb|ab

I found this as CNF:

S0->DB|DC S->DB|DC A->DF|DH B->AN C->AN D->a F->b H->AF N->c

And I cannot find the GNF, can you solve for me (:

Posted on Categories proxies

## Construct context-free grammars that generate for the languages L(G) = {01(110)^n 10 (11)^n : n >= 0}

I have given this question as home assignment. I tried a lot to solve it but couldn’t found any solution. Please help Thanks in Advance!

Posted on Categories proxies

## Given set of grammar rules, how to find if they correspond to Context-free or unrestricted

Given set of grammar rules, how to find if they correspond to Context-free or unrestricted.

Just for Understanding (Don’t solve the below one) Eg: S -> B/A, 1B -> 111B, 1A0 -> 00

Posted on Categories proxies