The Benn Act (European Union (Withdrawal) (No. 2) Act 2019) makes it a legal requirement for the PM to ask for an extension from the EU if no Withdrawal Agreement is ratified.
If the PM simply ignores this, say on October 31st, he is in breach of the law.
Or if he resigned immediately before the October 31st deadline, perhaps he would not ever actually breach the law.
What would then happen? There would be no time to do anything before the deadline of the European Union (Withdrawal) Act 2018.
Would that mean the passing of the deadline for that Act would have to be undone retrospectively?