Smart environments and activity recognition: a logic-based approach