A Logic-Based Infrastructure for Reconfiguring Applications