Foundations of Security Analysis and Design IV