Understanding RLHF from First Principles