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

(Warning) shift creation: left < right #15

Open
LEARNTAU opened this issue Dec 31, 2024 · 1 comment
Open

(Warning) shift creation: left < right #15

LEARNTAU opened this issue Dec 31, 2024 · 1 comment

Comments

@LEARNTAU
Copy link

Tau version: 0.7 (v0.7-alpha-145-g82e48cd)
Ubuntu Linux OS

Hello, I tried to play with the code provided by ptt kk shown in the Tau dev chat.

input

succ(int0) := int1
succ(int1) := int2
succ(int2) := int3
succ(int3) := int4
succ(int4) := int5
pred(intt) := intt-1
add(x, int0) := x
add(int0, x) := x
add(x, y) := add(pred(x), succ(y))
mul(x, int1) := x
mul(int1, x) := x
mul(x, y) := add(y, mul(pred(x), y))

Everything seems to work properly, but when I entered

n mul(int0,int2)

I got this non-stop message: (Warning) shift creation: left < right

p1
p2

I cant's stop the message from appearing continuously. Is this a bug?

@pt7k
Copy link
Contributor

pt7k commented Dec 31, 2024

Good catch. It goes into some sort of endless loop due to an unhandled edge case in the multiplication recurrence.
On tau version (v0.7-alpha-136-g6df5e78) it would just go on forever without any warning messages, but if you "set severity debug" then it spits out the ever looping recurrence and crashes after a while.
Obviously the edge case can be easily fixed for the multiplication example by adding the following lines before the mul(x, y) definition's line:

mul(x, int[0](1)) := int[0](1)
mul(int[0](1), x) := int[0](1)

but still this example shows that an endless loop can be created while using recurrence functions.

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

2 participants