A Principled Loss Function for Direct Language Model Alignment