Under exactly the conditions that you have in the question.
Whose is used as a relative pronoun, to introduce a clause that describes something belonging to the noun phrase it follows.
Now, there are some people do object to the adjective senses of whose being used of inanimate antecedents, based on the mistaken belief that it comes solely from who, when it comes from whos which comes from hwæs which was the genitive of both hwa (who) and hwæt(what). The objection flies in the face of much eloquent usage, and is also rarer now.
Each is a determiner, it refers to all of the examples of the thing that will be named, so that what is stated of them singularly applies to every one of them.
We have "each pair is". Generally, those things covered by each are treated as singular, unless each follows a plural subject, in which case they are treated as plural, with a further exception allowing (some would say not, while some would say insisting, it's here we enter into a matter of debate) if the plural subject is the pronoun we.
Here we do not have each following a plural subject, so the singular should be used, and so it is. Again, we're fine.
Putting them together we have a noun phrase "The set of elements" followed by a relative pronoun, followed by a determiner which insists upon singular use of what follows, followed by a singular use.
It is perfectly grammatical. Looking for objections to different uses of the words involved, we find that not only are there none, there aren't even questionable objections to argue against.
Now, it is relatively rare. It's common here to use where instead of whose, which ironically is a use that does frequently find objectors saying where can only refer to place, literally or figurative.
It's common to use every or all. However each conveys a sense of precision; it's merely a side-effect of every being treated plural and each being treated singularly leading to a sense that we are focusing on each item rather than making a more sweeping statement, and there's no real lack of precision with every, but that impression is worth making in technical cases like mathematics.
And for that reason, it is relatively common in such contexts.
About the only possible objection I can see to this as a whole, is that the form "[Noun]1 of [Noun]2s whose each [Noun]3 is..." could be ambiguous as to whether it is [Noun]1 or its [Noun]2s that possesses the [Noun]3s that are being described.
However:
- It would generally be clear from context; ambiguous forms are only a problem if they result in ambiguous reading, otherwise we can object to just about every bare expression as leaving out some information and hence being ambiguous.
- It would lean heavily toward our interpreting it as saying that it is the [Noun]2s that have the [Noun]3s (in the example, the elements that have the pairs). Only if that reading was both incorrect, and it being incorrect was not clear from context, do we have a problem.
- In this case we have the form "The set of [Noun]2s whose [Noun]3s..." since it's extremely common to define sets in terms of the properties of its elements, we're led very strongly to the understanding that it is elements that have pairs. All the more so since the word used for the elements is element (now if that was element in another sense, that would be ambiguous, but in a totally different way).
- Unless we have another context to explain some special meaning of set, then the reading of the set having the pairs makes no meaning, and so will be instantly dismissed, leaving us with no ambiguity.
So that possible objection clearly doesn't apply here. It's also not a question of grammaticality.
In all, the form is not just grammatical, and reasonably common in the domain it is used in, but a good choice.
[Taking a look at the question on ELL, it seems that the problem was that it wasn't ambiguous enough, as what they meant was "set whose each pair of elements", which is neither of the readings I suggest are possible with the form, but that's a separate issue].
I wonder whether different examples can shed some light:
How can you say [that] it's wrong?
There doesn't seem to be anything odd about the nominative subordinate clause "[that] it's wrong". To my eye, it looks like an direct object. It's the thing that can be said.
The part that seems odd is that "how can you" and "why would you" express the same sentiment in this context. That doesn't hold true in other contexts. Questions like "how can you eat so much?" and "why would you eat so much?" expect different answers, such as a high metabolism and a low self-esteem respectively.
However, that's a question of modality which we can ignore for the moment.
What do you mean that it's wrong?
Why do you say that it's wrong?
The subordinate clause still appears to be a direct object. These two questions seem to express similar sentiments and expect much the same range of answers. Both questions allow the original statement to be supported or explained, or for the implications of that statement to stand as an answer.
The oddity here is that the "what" in that question acts like "how" and "why" usually behave. "How" and "why" are adverbial interrogatives. They can be parsed as adjuncts rather than arguments. Ordinarily, "what" is a pronominal interrogative, which isn't a suitable adjunct on its own.
We can explain this oddity if we assume an elision:
What do you mean [by saying] that it's wrong.
Here, "that it's wrong" is the direct object of the gerund "saying". The entire prepositional phrase "by saying that it's wrong" is an adjunct to the verb "do mean", while "what" acts as its direct object.
If we do not assume the elision, the next obvious possibility is that "to mean" allows "what" to act as an adjunct. The questions "what do you mean that it's wrong?", "how do you mean that it's wrong" and "why do you mean that it's wrong" expect similar ranges of responses, even though we've progressed from the utterly unsurprising to the highly questionable.
The elision seems easier to support.
How do you mean that it's wrong?
You mean that it's wrong, but how?
Given a clear adjunct, we can separate the question that it asks from the statement that it modifies. The same doesn't hold for "what":
What do you mean that it's wrong?
*You mean that it's wrong, but what?
Once the verb "mean" has an obvious direct object, the word "what" no longer makes sense. It doesn't act like an adjunct from other positions, even though we haven't changed the governing verb.
What do you mean that it's wrong?
You said that it's wrong, but what do you mean?
This transformation practically begs for the restoration of at least one elided word.
Best Answer
According to Wiktionary, the adjective grammatical means:
In the linked related question, Can “grammatical” mean “grammatically correct”?, Berrie England wrote:
I have seen some occasions where there are two different explanations about a grammatical issue. For example, the linked question “The earthquake, along with its subsequent aftershocks, HAS/HAVE …” asks whether it is grammatical to use have or has after "The earthquake, along with its subsequent aftershocks..."
There are two distinctly different answers posted by two users, one says we have to use has as the earthquake is the subject and along with... is a prepositional phrase, and the other says has is right, but we could consider using have as along with... has a potential to be considered as a conjunction.
Which is grammatically correct? Both of them are grammatical as long as you could quote the right reference in a grammar book.
Should we use are or is after dummy there when there are plural words following the verb? Should we use are or is after a collective noun such as family, team, etc. Can we use an indefinite article before a mass noun? Should all the English adjectives be placed before a noun? How about something special?
There are countless number of grammatical questions that could be answered in more than two ways. And some say A is grammatically correct, but B is broadly used colloquially.
What does colloquially exactly mean, then? Does it mean it is not grammatical?
Is the above sentence grammatical? Related question, “If I would have lost you” vs “If I had lost you”.
The answer is no. But it is used colloquially by some people especially in the U.S.
If A writes a grammar book that says we can use would have + PP after the conjunction if, the above sentence would be grammatical in accordance with the grammar book written by A, but it would be ungrammatical according to B, C, D, etc.
But we can't always say which book or grammar you are referring to when you say some sentences or clauses are grammatical, then, the word is as ambiguous as it gets and should be avoided unless you are sure about which grammar book you are referring to.
I think grammatical is often times synonymous with "it makes sense to my native ears" and it could be used when you talk about uncontroversial rules that are so obvious that you don't have to quote any grammar book. But saying it is grammatical should be avoided when you are not sure about what grammar rules you are referring to.