Closed j6k4m8 closed 3 years ago
You can use n-1 coerce !β
or n sub 1
. Both will check at runtime that the result indeed fits into !β
.
But I think what you want is just this:
def x1_xor_xn[n:!β](x:πΉ^n)lifted β x[0]βall(x[1..n]);
Aha!! It was that indexing notation precisely that I was looking for, too! I was trying all sorts of numpy flavored things like x[1:] etc. this is perfect, thank you!!
On Sun, Dec 20, 2020 at 8:36 PM Timon Gehr notifications@github.com wrote:
You can use n-1 coerce !β or n sub 1. Both will check at runtime that the result indeed fits into !β. But I think what you want is just this:
def x1_xor_xn[n:!β](x: πΉ^n)lifted β x[0]βall(x[1..n]);
β You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/eth-sri/silq/issues/19#issuecomment-748710681, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFJKBYBD56JRFZJZBPT5R3SV2RATANCNFSM4VCSYPIQ .
@tgehr I also learned about "fat-arrow" β function notation from your comment! Super helpful, thanks!
Excited to share what I suspect is my silly mistake with you :)
My challenge:
I am trying to construct an array inside a parametrized function, like so:
But it doesn't seem I can construct new primitives with my parameter
n
even though I define it to be of classical-β type:Likewise, constructing an int array fails:
And so does this silliness:
It appears that
1
is interpreted as!β€
and nothing I do can convince the compiler that I actually mean!β
, perhaps because β-βββ€...What is the correct way to construct something like this? Is this possible in silq right now? (Is there some magical way to parametrize the
n
type?)