So I'm given the grammar $$P ::= id | P ∨ P | P ∧ P | ¬P | (P)$$ $$id ::= p | q | r | s$$
and was asked to rewrite it as unambiguous. The solution says it is $$P ::= P ∨ Q | P ∧ Q | Q$$ $$Q ::= id | ¬Q | (P)$$ $$id ::= p | q | r | s$$
but using the latter unambiguous grammar, I can't figure out how I would get a derivation for $¬(p ∧ q)$
my attempt was P => P∧Q => Q∧Q => ¬Q∧Q
but I can't figure out how to get the parens around the Q∧Q