Logical Foundations of Cyber-Physical Systems