There is something which I don't quite understand, and I'm hoping someone could explain it to me.

Basically, I'm trying to find a statement that expresses this:

in terms of p and q

I don't understand where the base ab came from in the above two expressions. Is there a way to do it without the ab?