O-Minimality, Nonclassical Modular Functions And Diophantine Problems