More thoughts on how to understand the term "world" in scripture. Since there is a very large spiritual component to the biblical definition of this term, I thought I would "mathematically" express how this term very often talks of one of two very distinct spiritual groups. (Ms. Selahsays, maybe this will make it easier for you to understand.)
Group 1 = Non-Elect in Adam
This group is physically IN AND spiritually OF this world.
Group 2 = Elect in Last Adam
This group is physically IN this world but NOT spiritually OF it.
Therefore, in order to understand the term "world" in the distributive sense to mean each and every person, the context of the passage must make it crystal clear that it's talking about both groups simultaneously. The passage must be talking about the Elect and Non-Elect. So, with this understanding let's apply the "math" to Jn 17:9.
Jesus clearly prayed for two groups of elect: His Jewish disciples in his presence and, therefore, by extension all believing Jews. This group consist of his Jewish sheep. Likewise, the 2nd group he prayed for are his sheep from a different flock (Jn 10:16) -- the Gentile elect who would come to believe on him through the evangelizing of his Jewish flock, with the divine purpose being that both flocks would become one in the Body of Christ.
By Jesus explicitly not praying for the world, we can only understand this exclusion as referencing only Group 1. And since he did in fact pray for Group 2 who are also IN the world (along with Group 2), then their exclusion from the world means this term must be understood in the limited sense since both groups are most definitely not included in the term "world".
1Jn 2:2 has a little different twist to it since John is referencing both kinds of people in Group 2. He excluded the Jewish flock (to whom he was primarily writing) by clearly making a distinction between them and the Gentile flock also IN the "world" with "but". And it's not surprising that John did this because the ancient Jewish mindset was that the chosen covenant people of God were never a part of the pagan Gentile nations that comprise the rest of the world. Most ancient Jews were loathe to even enter the homes of Gentiles.
Someone might object and say it's arbitrary and convenient for me to assume that the Gentiles included in the term "world" don't include the non-elect Gentiles as well. My retort would be if this were the case, this would present more than few a theological problems. For example, why didn't Christ pray for the non-elect Gentiles of the world for whom he his is the "atoning sacrifice", according to John? Another problem are the many verses that limit the atonement to "many" versus all in the distributive sense. These would present many contradictions, etc.
Also, way back in my 2117, I exegeted 1Jn 5:19 which teaches that the "whole world is under the power of the evil one". I showed in that post how understanding the term world in that passage as consisting of both the aforementioned groups would present some serious contradictions, also. One of the major ones is that that kind of interpretation would immediately contradict v. 18 And also, it would imply that Jesus epically failed in one aspect of his earthly mission which was to destroy the works of the devil (1Jn 3:8). Therefore, the only logical and biblical way to understand the term "world" in 1Jn 5:19 in the limited sense in that John is referring only to Group 1. After all, it is the spiritually dead in Adam who love the things of this world.