Qualtran
Qualtran copied to clipboard
QubitCount sympy Max expressions can't be simplified
In the qubit counting protocol, we take the max of the various widths of all the moments in a circuit. This can give you expressions like Max(1*n, 2*n). If you use n = sympy.Symbol('n', positive=True, negative=True) then the expression will simplify to 2*n and all is well.
You can also get expressions like Max(3, 2*n) which really probably should be simplified to 2*n assuming n is sufficiently large. It doesn't seem like there's any way to use the sympy assumptions system to give an assumption like n > 10.