Text this: Mathematical theory of democracy