Closed mstechly closed 1 month ago
Since one can have non-trivial input register sizes in Qualtran, this is an issue for Qualtran -> QREF conversion.
Here's a branch with a precompilation step which handles simple cases by introducing a new local_variable. However, compilation works only if a given symbol is not used in resources, cause otherwise we run into the issues mentioned above. https://github.com/PsiQ/bartiq/tree/10-non-trivial-ports-workaround
Input register sizes must define new input parameters. This means it is fine to define an input register as having size $N$, but it is not fine to try and define the input size as $2N$, or any other function $f(N)$ (where $N$ is some other param, supplied either as an input param, or as an input size param for another input register).
However, one can imagine many cases where one may want to assert that the input register size is some arbitrary function of another input parameter, such as requiring that one input register is twice the size of another. Currently, this cannot be supported. This is because doing so would introduce a number of non-trivial problems. A loose overview of these are as follows:
These are the issues that come to mind initially, however, I am sure there are others one might need to consider also. This issue is to highlight this as a known issue in the current implementation, and to provide a space for us to discuss whether this is a feature we need to support in the long-term.
This might be easier to solve if we move to graph based compilation (https://github.com/PsiQ/bartiq/issues/9).