Foundations of kinship mathematics