Skip to content

Commit

Permalink
Add some tests for simplification.
Browse files Browse the repository at this point in the history
  • Loading branch information
cedretaber committed Sep 25, 2024
1 parent 933a48a commit 2ab8b7f
Show file tree
Hide file tree
Showing 4 changed files with 462 additions and 0 deletions.
13 changes: 13 additions & 0 deletions examples/simplification_prepare3.dl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
source b('B':int, 'C':int).
source a('A':int, 'B':int).
view v('A':int, 'B':int, 'C':int).
-a(A, B) :- a(A, B) , not __updated__v(A, B, GENV1).
-b(B, C) :- b(B, C) , a(GENV2, B) , b(B, GENV3) , not -v(GENV2, B, GENV3) , not __updated__v(GENV4, B, C).
-b(B, C) :- b(B, C) , +v(GENV2, B, GENV3) , not __updated__v(GENV4, B, C).
+a(A, B) :- a(A, B) , b(B, GENV5) , not -v(A, B, GENV5) , not a(A, B).
+a(A, B) :- +v(A, B, GENV5) , not a(A, B).
+b(B, C) :- a(GENV6, B) , b(B, C) , not -v(GENV6, B, C) , not b(B, C).
+b(B, C) :- +v(GENV6, B, C) , not b(B, C).
__updated__v(A, B, C) :- a(A, B) , b(B, C) , not -v(A, B, C).
__updated__v(A, B, C) :- +v(A, B, C).
v(A, B, C) :- a(A, B) , b(B, C).
10 changes: 10 additions & 0 deletions examples/simplification_prepare4.dl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
source projs('A':int, 'B':string).
view projv('A':int).
-projs(A, B) :- projs(A, B) , -projv(A).
+projs(A, B) :- projs(A, GENV7) , not -projv(A) , not projs(A, GENV1) , not -projs(GENV2, GENV3) , B = 'a'.
+projs(A, B) :- projs(A, GENV8) , not -projv(A) , not projs(A, GENV4) , projs(GENV5, B) , -projv(GENV5).
+projs(A, B) :- +projv(A) , not projs(A, GENV1) , not -projs(GENV2, GENV3) , B = 'a'.
+projs(A, B) :- +projv(A) , not projs(A, GENV4) , projs(GENV5, B) , -projv(GENV5).
__updated__projv(A) :- projs(A, GENV6) , not -projv(A).
__updated__projv(A) :- +projv(A).
projv(A) :- projs(A, B).
13 changes: 13 additions & 0 deletions examples/simplification_prepare5.dl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
source uniona('NAME':string).
source unionb('NAME':string).
source uniono('NAME':string, 'TP':string).
view unionview('NAME':string, 'TP':string).
-uniona(N) :- uniona(N) , -unionview(N, T) , T = 'A'.
-unionb(N) :- unionb(N) , -unionview(N, T) , T = 'B'.
-uniono(N, T) :- uniono(N, T) , -unionview(N, T).
+uniona(N) :- +unionview(N, T) , not uniona(N) , T = 'A' , not uniono(N, T).
+unionb(N) :- +unionview(N, T) , not unionb(N) , T = 'B' , not uniono(N, T).
+uniono(N, T) :- +unionview(N, T) , not uniono(N, T) , not T = 'A' , not T = 'B'.
unionview(N, T) :- uniona(N) , T = 'A'.
unionview(N, T) :- unionb(N) , T = 'B'.
unionview(N, T) :- uniono(N, T).
Loading

0 comments on commit 2ab8b7f

Please sign in to comment.