Alma has returned to his “what if” scenario. The thesis is that we cannot repent unless there is a punishment. How does that work? As a very mundane example, say there are two pencils on a table, and you pick up one and move it to a different table. Of what could you repent? Have you done anything wrong? There is no law, and certainly no punishment attached to the law, so your action is simply an action. There is nothing of which to repent.
That is the meaning of “how could a man repent except he should sin? How could he sin if there was no law? How could there be a law save there was a punishment?” Each of those questions emphasizes the relationship not between sin and the law, but between repentance and the law. We do not think of that particular relationship, but that is the critical issue here.
Repentance is the engine that moves mortal humans from one state to another, such as from evil to good (complete opposites) or even from good to better. There is no way to make reasoned and purposeful judgments unless there is a law against which we may measure ourselves. Having the law teaches us what we should do and be. Repentance overcomes the penalties attached to disobeying that law.
Verses 18–20 reinforce that idea. Without a law to know what is good, and without a punishment to enforce it, how would we ever be able to use the law to progress?