Give an example of a rule involving negation and an arithmetic atom which is safe. R(x,y) <- S(x,y), NOT T(x,y), x>y. Express ordered pairs where 0<x<y<4 as a collection of datalog facts, then express the query which selects pair where y>2. Ordered(1,2) <-. Ordered(1,3) <-. Ordered(2,3) <-. Select(x,y) <- Ordered(x,y), y>2
1. P(x, y) <- Q(x, y), NOT W(x, y), x < y. 2. P(1, 2) <- . P(1, 3) <- . P(2, 3) <- . Q(x, y) <- P(x, y), y > 2.
1. A(x,y) <- B(x,y), NOT y > 2 2. P(1, 2) <- . P(1, 3) <- . P(2, 3) <- . Q(x, y) <- P(x, y), y > 2.
A(x,y) <- B(x,y), NOT x<y P(1,2) <-. P(1,3) <-. P(2,3) <-. Q(x,y) <- P(x,y), y>2
A(x,y) <- B(x,y,z), NOT C(x,y,z); x+y<4+z O(1,2) O(2,3) O(1,3) P(x,y) <- O(x,y), y>2