This is because had the facts been as D supposed them to be, his conduct would have been a crime. D is guilty of attempted possession of stolen property. In fact, X is already dead at the time of intercourse. D is guilty of attempted rape, since had the facts been as he supposed them to be, his conduct would have been a crime. To establish this defense, D must show that he voluntarily abandoned his attempt before completion of the substantive crime.
D carries a loaded gun, and waits in the bushes outside V's house.
Five minutes before he expects V to come out, D decides that he doesn't really want to kill V at all. D returns home, and is arrested and charged with attempted murder. Thus if D, at the last moment, learns facts causing him to believe that he will be caught if he goes through with his plan, the abandonment will generally not be deemed voluntary. If D merely postpones his plan, because the scheduled time proves less advantageous than he thought it would be, this does not constitute a voluntary abandonment. D turns around and walks away.