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

RemoveRelationCopies transformation removes intermediate eqrel #2243

Closed
langston-barrett opened this issue Mar 30, 2022 · 1 comment · Fixed by #2244
Closed

RemoveRelationCopies transformation removes intermediate eqrel #2243

langston-barrett opened this issue Mar 30, 2022 · 1 comment · Fixed by #2244

Comments

@langston-barrett
Copy link
Contributor

langston-barrett commented Mar 30, 2022

Consider the following program:

.decl r(a: number, b: number)
.decl s(a: number, b: number) eqrel
.decl t(a: number, b: number)

r(1, 2).
s(a, b) :- r(a, b).
t(a, b) :- s(a, b).

.output t(IO=stdout)

The expected output is (1, 2), (2, 1), because s is an eqrel. However, --show=transformed-datalog reveals:

.decl r(a:number, b:number) 
.decl t(a:number, b:number) 
r(1,2).

t(a,b) :- 
   r(a,b).

This transformation is not valid, and the output of the program is

---------------
t
===============
1	2
===============
souffle --version                         
Souffle: 2.2-129-gfce85d9ec(32bit Domains)
@langston-barrett
Copy link
Contributor Author

The transformer at fault appears to be RemoveRelationCopiesTransformer:

souffle --disable-transformers=RemoveRelationCopiesTransformer --show=transformed-datalog test.dl

yields

.decl r(a:number, b:number) 
.decl s(a:number, b:number) eqrel
.decl t(a:number, b:number) 
r(1,2).

s(a,b) :- 
   r(a,b).

t(a,b) :- 
   s(a,b).

and evaluation yields

---------------                                                               
t
===============
1	1
1	2
2	1
2	2
===============

@langston-barrett langston-barrett changed the title Invalid AST transformation removes eqrel RemoveRelationCopies transformation removes intermediate eqrel Mar 30, 2022
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

Successfully merging a pull request may close this issue.

1 participant