0

I have the following excercise:

Demostrate this grammar is ambiguous:

S-> bA | aB
A-> a | aS | bAA
B-> b | bS | aBB

By the theory that I've read a grammar can be ambiguous if:

1) A string W ∈ L(G), generates two differents trees 
2) Makes 2 or more left/right derivations

So, i couldnt determinate a string that confirms 1) , so i've tryed with 2).For what i understand just need 2 reflexive derivations to get my grammar as ambiguous??

for example:

w=bbaa S->bA->bbAA->bbaA->bbaa 
                ^^--here i made two reflexive/recursive derivation              

Is this correct as i described or need more detailled information ?

PD: is there any tip for get strings that generates two threes ??

k1k4ss0
  • 139
  • 4
  • Since this is not a programming problem involving code, you should probably delete this and ask, instead, on https://softwareengineering.stackexchange.com/ – Rob Aug 12 '19 at 15:46
  • @Rob But it's a theoretical computer science question, so maybe it should be on https://cs.stackexchange.com/ or https://cstheory.stackexchange.com/ instead. – Anderson Green Aug 12 '19 at 18:55
  • I would agree with that. – Rob Aug 12 '19 at 23:43
  • I'm voting to close this question as off-topic because it is not a programming question as defined in the Help Center and should be asked on https://cs.stackexchange.com/ or https://cstheory.stackexchange.com/ instead. – Rob Aug 13 '19 at 00:02
  • 1
    @rob: for future reference, [cstheory.se] expects [research-level questions](https://cstheory.stackexchange.com/help/on-topic). Undergraduate exercises don't qualify. – rici Aug 13 '19 at 03:26

1 Answers1

1

No, this is not a correct demonstration of ambiguity.

Your understanding of point #2 is flawed. A grammar G is ambiguous iff some w in L(G) has more than one leftmost (or rightmost) derivation. You've shown one leftmost derivation for w=bbaa, so if you could show another (i.e., a different leftmost derivation for the same string), that would demonstrate ambiguity. However, there doesn't appear to be one, so you'll have to pick a different string.

Note that this has nothing to do with whether a derivation involves the application of recursive/reflexive productions.

Michael Dyck
  • 2,153
  • 1
  • 14
  • 18