P = epsilonIn co-L, ns don"t know how to ensure, the there won"t it is in the same number of a,b. Should I develop something favor this?

P = bS

Consider this logic: a sentence in the enhance of \$L\$ either should start with \$b\$ or end in \$a\$ or if it starts through \$a\$ and also ends through \$b\$ the substring in between the two must not it is in in \$L\$ (should be in the enhance of \$L\$). Therefore we deserve to write:

\$S o bA|Aa|aSb\$

\$A o aA|bA|epsilon\$

We deserve to break this language into the union of several easier languages:

L = \$a^i b^j\$ ∪ \$a^i b^j\$ is generated by a simple CFG:

\$S_1 → aS_1b|aS_1|a\$

Similarly because that { \$a^ib^j\$ | i

Source: http://cseweb.ucsd.edu/classes/su99/cse105/sample2.pdf

re-superstructure
point out
monitor
reply Nov 19 "17 at 21:20

TheNavigatTheNavigat
\$endgroup\$
1
1
\$egingroup\$
The strings not of kind \$a^nb^n\$ come in several groups.

You are watching: Complement of a^nb^n

A string beginning with \$b\$ deserve to be gotten via \$S o bS_1\$, climate \$S_1 o aS_1|bS_1|varepsilon \$

A wire may have a positive variety of \$a\$, climate a positive number of \$b\$, climate a positive number of \$a\$ and also then anything. This one takes more steps: \$S o aS_2\$, climate \$S_2 o aS_2|bS_3\$, then \$S_3 o bS_3|aS_4\$, climate \$S_4 o aS_4|bS_4|varepsilon.\$

Remaining strings in the enhance have \$a\$"s adhered to by \$b\$"s yet either an ext \$a\$ top top the left or much more \$b\$ top top the right. For more \$a\$ top top the left, use \$S o aS_5,\$ then \$S_5 o aS_5|aS_5b|varepsilon\$ ultimately for more \$b\$ top top the appropriate use \$S o S_6b,\$ and also then \$S_6 o S_6b|aS_6b|varepsilon.\$

I"m not an skilled on this topic, however the above looks intuitively to me choose it covers every the strings in the complement of \$a^nb^n\$ while no letting any kind of of the last be produced.

share
mention
follow
edited Nov 4 "13 at 11:19
answered Nov 4 "13 at 4:29

coffeemusic-from-a.comcoffeemusic-from-a.com
\$endgroup\$
include a comment |
0
\$egingroup\$
a^n b^n means equal variety of a complying with equal number of b

Grammar g=N,T,P,S

N- no Terminals-A

T- Terminals-a,b,epsilon

p- Production

S->A

A->aAb

A->Epsilon(^)

S- start Symbol-S

Hope this prize is correctANWAR MULLA (AGCE)

re-superstructure
mention
follow
reply Apr 25 "17 in ~ 4:27
ANWAR MULLAANWAR MULLA
1
\$endgroup\$
1

Thanks for contributing an answer to music-from-a.comematics Stack Exchange!

Please be sure to answer the question. Carry out details and share her research!

But avoid

Asking because that help, clarification, or responding to other answers.Making statements based upon opinion; ago them increase with referrals or an individual experience.

Use music-from-a.comJax to layout equations. music-from-a.comJax reference.

See more: Tag: Redo Of Healer Episode 6 Uncensored, Redo Of Healer (Uncensored) Episode 6 English Sub

Draft saved

authorize up making use of Google
authorize up utilizing Email and also Password
submit

### Post as a guest

name
email Required, however never shown

### Post as a guest

name
email

Required, but never shown

## Not the answer you're spring for? Browse other questions tagged formal-languages context-free-grammar or asking your very own question.

Featured ~ above Meta
0
Prove/disprove the language of enhance of \$L=m eq n space, m,ngeq1\$ is context cost-free over alphabet \$a,b\$?
1
Subtracting a context-free language from a constant language
connected
3
construct Context-free Grammar because that the Language
1
build context-free grammar because that \$a^ib^jc^k : ile j+k\$
1
Context cost-free Grammar : three tiny exercices
0
How have the right to I check that the language that one context-free grammar is a subset of a 2nd context-free grammar?
0
Giving instance for context-free grammar
2
provide a context-free grammar that generate this language
0
just how to prove that L* is paper definition free?
0
give a context-free grammar
warm Network questions an ext hot questions

concern feed