The stages of the emergence of Ibn Khaldun in sociology