Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smarter solving #35

Open
croyzor opened this issue Oct 10, 2024 · 1 comment
Open

Smarter solving #35

croyzor opened this issue Oct 10, 2024 · 1 comment

Comments

@croyzor
Copy link
Collaborator

croyzor commented Oct 10, 2024

In our journey to close #28 and #29, there are places where we could be doing better. For example, we fail on the following example:

mapVec(X :: *, Y :: *, { X -> Y }, n :: #, Vec(X, n)) -> Vec(Y, n)
mapVec(_, _, _, _, []) = []
mapVec(_, _, f, _, x ,- xs) = f(x) ,- mapVec(!, !, f, !, xs)

because we can't solve the number argument to the recursive call to mapVec. If we help the typechecker by matching on the number as succ(_) then we can work it out, but this shouldn't be necessary! We know that mapVec preserves vector size, so we should be able to work out from the use of cons that the argument needs to be n - 1

@croyzor
Copy link
Collaborator Author

croyzor commented Oct 10, 2024

Another good application of this would be with the fanout/fanin operators. They are checkable currently so the places they can be used is limited, but we could guess at the expected size using this framework, they'd be much more useful!
e.g.

f(Vec(Qubit, 2)) -o Bit
f = ...

g(Qubit, Qubit) -o Bit
g = [\/]; f

h(Qubit, Qubit) -o Bit
h = [\/]; ..; f

g succeeds but h fails. I think we could do better!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant