Formal Methods and Theory of Security