souffle icon indicating copy to clipboard operation
souffle copied to clipboard

`inline` cause `Ungrounded variable` not assertion failure

Open DerZc opened this issue 2 years ago • 1 comments

Hi,

I meet an Ungrounded variable error with inline in the following program:

.decl iyis(A:symbol, B:number)
.decl ghxz(A:symbol, B:symbol) inline
.decl mrjp(A:symbol, B:symbol, C:symbol) inline
.decl kerp(A:number, B:number, C:symbol, D:symbol)
.decl wtcf(A:symbol, B:symbol, C:symbol, D:symbol, E:symbol) inline
.decl kspj(A:number, B:number, C:number)

iyis("j", 7).
kerp(-9, -9, "G", "G").

ghxz(A, A) :- iyis("S", B), iyis(A, B).
mrjp(A, A, A) :- ghxz(A, A).
wtcf(B, B, B, B, B) :- mrjp(B, B, B).
kspj(A, A, A) :- kerp(A, A, B, B), !wtcf(B, B, B, B, B).

.output kspj

I run it with souffle -w ex.dl and get the error message:

Error: Ungrounded variable <inlined_B_5> in file orig_rules_copy.dl at line 11
ghxz(A, A) :- iyis("S", B), iyis(A, B).
------------------------^---------------
Error: Ungrounded variable <inlined_B_5> in file orig_rules_copy.dl at line 11
ghxz(A, A) :- iyis("S", B), iyis(A, B).
------------------------------------^---

There are two difference with #2318. The first is as long as I remove any of the inlines in this program, it will run correctly. The second is that the error message is not assertion failure.

The version of Souffle I use is 29c5921.

DerZc avatar Oct 25 '22 05:10 DerZc

I reduce this program and get a simpler version:

.decl iyis(A:symbol, B:number)
.decl ghxz(A:symbol) inline
.decl mrjp(A:symbol) inline
.decl kerp(A:number, B:symbol)
.decl kspj(A:number)

iyis("j", 7).
kerp(-9, "G").

ghxz(A) :- iyis(A, B).
mrjp(A) :- ghxz(A).
kspj(A) :- kerp(A, B), !mrjp(B).

.output kspj

And output is:

Error: Ungrounded variable <inlined_B_3> in file orig_rules_copy.dl at line 10
ghxz(A) :- iyis(A, B).
-------------------^---

I guess the reason is we can not inline a negative relation with many arity.

DerZc avatar Oct 31 '22 01:10 DerZc