A Logic Programming Approach to Activity Recognition