I'm having some trouble understanding how to get the intersection of two context-free languages (L = L1 ∩ L2). I've seen the very common example where:
L1 = {a^i b^i c^j | i,j ≥0}
L2 = {a^i b^j c^j | i,j ≥0}
L1 ∩ L2 = {a^i b^i c^i | i ≥0}
but what about an example like this:
L1 = {a^i b^i c^j d^j | i,j ≥0}
L2 = {a^j b^i c^i d^k | i,j,k ≥0}
L1 ∩ L2 = ???
I get that I need to come up with context-free grammars for the both, which I have:
G1: S->AB
A->aAb|λ
B->cBd|λ
G2: S->aS|AB
A->bAc|λ
B->dB|λ
But at this point, I don't know how to intersect the two and come up with a language. I was wondering if someone could show me how. Thank you in advance.