To my knowledge, the idea of representing weak-order with a function dates back to Cantor. So my questions are:
1) Was Cantor the first person to rigorize these kinds of representation?
2) Were there anyone in the ancient world who (though not rigorously) developed the idea of representing social choice or preference by a function?