My post above ignored some simpler cases, but maybe I’ll add a few words there (not saying anything new, but maybe saying something differently.)
If we literally know that the envelopes have to contain $5 and $10, and they are shuffled around, then the text on the back is incorrect or, perhaps more subtly, being interpreted incorrectly. The envelopes say “the other contains either twice or half this one’s amount” – semantically okay – but what they should say (or how they should be read) is, “if this is the $10 envelope, the other contains half; if this is the $5 envelope, the other contains twice”. The first terse statement is incomplete when it comes to usefulness in calculating the expectation value for switching. Saying “the expectation value of switching is 1.25 times what I’m currently holding” is wrong here because “what I’m currently holding” is a random quantity that is correlated with the other envelope. I do not truly have a chance to double my value if I have the high value, and I do not truly have a chance to half my value if I have the low value, and I have to average over both possibilities when calculating my return on switching.
If this fixed-two-value case is settled, then we can try to make a three-value case: $5, $10, $20. This doesn’t remove the subtlety in any way, though. All the same arguments hold, and I have to average over outcomes for all three possible values of “what I currently hold” when calculating the value of a switch. Whatever random value we currently hold is correlated with whatever could be in the other envelopes, and we can’t pretend it isn’t when calculating expectation values.
Going to four, or five, or any discrete or continuous infinite set of possible values still doesn’t remove this essential feature. You always have in the problem some notion of a distribution of initial numbers the envelopes are populated (or populatable) with.
This is where my previous post picks up the story, concluding that no matter what the underlying distribution is, a calculation that correctly includes that distribution by calculating the sum (or integral) of the value of switching for each possible holding, with each possibility weighted by the probability of having that holding and the probability that that holding is the smaller or larger envelope, then the EV for switching is always calculated to be the same as the EV for staying pat.
Briefly back to the three-value case (or similar): if you try to reason that the statement “the other contains half or twice this amount” has to be able to be true for some set up of two presented shuffled envelopes, then when you say “If I happen to hold 10, the other has to hold 5 or 20, and both are completely allowed” you have to logically step to saying “…which means I could also be holding 20, so my calculation should include that case, and in that case the other has to hold 10 or 40 and both are completely allowed (and still equally likely)”; and at this point you have to logically say “…which means I could also be holding 40 just as well, which means the other has 20 or 80…”, etc. Thus, applying the notion that the other could truly be double or half with equal probability is identical to saying that values all the way to infinity (and all the way to zero) are allowed, which is an ill-defined probability distribution. It cannot be the actual distribution of possible values in envelopes. The resolution is simply that for any realizable distribution of possible values for the envelopes, the probability that the other envelope is double or half is not in general equal, and the probabilities of the two options (higher or lower) depends on which value I’m currently holding, and which value I’m holding is random based on the distribution that was used to fill the envelopes. But critically, it doesn’t matter what that distribution is – a proper calculation that accounts for it will necessarily yield zero expected return on switching.