A foundation for reactive systems