All perfect praise be to Allaah, the Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His Slave and Messenger.
We would like to draw your attention to a very important fact, which is that Sharee‘ah rulings are not to be taken in such an absurd way by which you tried to know it in this issue. It is tantamount to playing with the rulings of Sharee’ah. A Muslim, when facing a problem in his religious duties, must ask scholars, as Allaah The Almighty ordered him to do. Allaah The Almighty Says (what means): {So ask the people of the message if you do not know.}[Quran 16:43]
As for the ruling on your issue, it is obvious that you did not intend to break your fasting because ejaculation was not your own action, but it began taking place during sleep, and the sleeper is not competent for religious assignment. Also, it is not possible to resist the flowing of the semen. Even if we say that you could have resisted, your fasting was still valid as long as you did not initiate the flowing of the semen. An analogy of this is that of a man who had intercourse with his wife at night and then his semen came out in the morning. Scholars hold that the fasting of that man is valid. The sleeping person for a greater reason is more excused for ejaculating after waking up.
Ibn Qudaamah said, "If a man had intercourse at night and the semen flowed in the morning, his fasting would be valid because he did not initiate its flowing in the morning. An example of this is the one who ate something at night and vomited it out in the day."
Knowing all this, it is obvious that your fast is valid and you incur no expiation.
And Allaah Knows best.