Calculus of Consent -- Logical Foundations of Constitutional Democracy