scallop-lang / scallop-lang.github.io

Official Website of Scallop Language
https://scallop-lang.github.io/
9 stars 7 forks source link

Incorrect computation? #3

Closed bertram-gil closed 2 years ago

bertram-gil commented 2 years ago

Hi guys,

Consider the following Scallop program:

rel a__ = { 
    (50, 100, 6),
    (47, 11, 75),
    (43, 74, 63),
}
rel b__ = { 
    (88),
    (70),
}
rel c__ = { 
    ("lk", "tf"),
}
rel d__ = {       // Output node
    ("kr", "rq"),
}

rel d__(g, g) = b__(a), c__(f, g), c__(f, d), not c__(d, d)
rel d__(b, a) = c__(b, a), c__(h, h), c__(f, a), c__(f, g)
rel d__(b, b) = c__(b, b)

query d__

When I run this program with the latest scallop executable (downloaded today from here for Linux), I get:

$ ./scli program.scl 
d__: {("kr", "rq"), ("tf", "tf")}

Now if I only add a subgoal c__(h, a) in the the second rule for the relation d__ to get the following new program:

rel a__ = { 
    (50, 100, 6),
    (47, 11, 75),
    (43, 74, 63),
}

rel b__ = { 
    (88),
    (70),
}
rel c__ = { 
    ("lk", "tf"),
}
rel d__ = {       // Output node
    ("kr", "rq"),
}

rel d__(g, g) = b__(a), c__(f, g), c__(f, d), not c__(d, d)
rel d__(b, a) = c__(b, a), c__(h, h), c__(f, a), c__(f, g), c__(h, a)
rel d__(b, b) = c__(b, b)

query d__

I get:

$ ./scli program.scl 
d__: {("kr", "rq"), ("lk", "tf"), ("tf", "tf")}

Adding this subgoal should definitely not add ("lk", "tf") in the result. Please let me know if you cannot reproduce this bug or if I am doing something wrong.

Liby99 commented 2 years ago

Bug fixed; the download links in the website now include the artifacts with the bumped version v0.1.1. Please update your executables and see whether the problem is solved!

bertram-gil commented 2 years ago

Perfect! The bug is now fixed at v0.1.1! Thanks for the quick response! :)