Starting with the easy ones, (5) is wrong. For the moment I will regard (3) and (4) as equivalent and use only (4).
Now “derart, dass” is correct, precise, albeit a bit old-fashioned. Therefore, “so, dass” should be just as correct. However, “..., so dass” is used much more commonly, and it also fits how the phrase is usually spoken in mathematics. Therefore this also has to be seen as correct.
Now there is a certain discrepancy between this use of “..., so dass” and the usual meaning. Indeed it could be argued that version (4) should mean the following.
Eine Funktion f: A → B heißt surjektiv, wenn es für jedes b aus B ein a in A gibt. Daraus folgt dann auch, dass f(a) = b.
This is of course nonsensical.
One might therefore assume that the use of “..., so dass” is a modern sloppiness, perhaps influenced by English. To see if it is indeed new, I have looked for the phrase in van der Waerden's “Algebra I”. However, I have only the eighth edition at hand, which is from 1971. While defining an isomorphism, the author writes the following. (I have changed $\bar a$ into $a'$ for typesetting reasons and also not tried to reproduce the fraktur font for sets. The emphasis is mine.)
Wenn es nun möglich ist, die beiden Mengen eineindeutig aufeinander abzubilden derart, daß die Relationen bei der Abbildung erhalten bleiben, d.h. wenn jedem Element a von M umkehrbar eindeutig ein Element a' von M' zugeordnet werden kann, so daß die Relationen, die zwischen irgendwelchen Elementen a, b, ... von M bestehen, auch zwischen den zugeordneten Elementen a', b', ... bestehen und umgekehrt, so nennt man die beiden Mengen isomorph [...].
We see that while the good old (1) is used, (4) is also used. This has helped me to lay my qualms about it to rest. (Even though the 1930 edition was suspiciously titled “Moderne Algebra”.)
Now finally, it seems that nowadays “sodass” is preferred over “so dass” as has been explained in an answer to a different question. It could again be argued that this favours the above nonsensical reading of the sentence, but it seems that official grammar or spelling do not take that into account.