Simplify controlled gate for SumOfProducts
Simplify the SumOfProducts control value when possible (if there's only a single product in it) when constructing a ControlledGate. This allows the X.controlled() -> CX optimization when using a SumOfProducts control value.
Add a two-step test to check X.controlled(num_qubits=2) -> CCX optimization, and include SumOfProducts check there too.
Make use of this simplification where we were hacking it in previously.
Fixes #5883
most optimization and inferences were implemented for the vanilla ways (as ints, lists ..etc) of defining control values, those were ported to ProductOfSums, but for SumOfProduct they didn't make sense in most cases, however in this case what you do in the constructor effectivelly transforms SumOfProducts to ProductOfSums representation, looks good to me
Automerge cancelled: A required status check is not present.
Missing statuses: ['Misc check', 'Pytest Ubuntu (3.7)', 'Pytest Ubuntu (3.8)', 'Pytest Ubuntu (3.9)', 'Pytest Windows (3.7)', 'Pytest Windows (3.8)', 'Pytest Windows (3.9)', 'Typescript lint check', 'Typescript tests', 'Typescript tests coverage']