(Exodus 20:13-14) "You shall not murder" — why is it stated? Because it says "One who sheds the blood of man" and so forth (Genesis 9:6): we have heard the punishment, but we have not heard the prohibition. Scripture teaches, saying "You shall not murder." "You shall not commit adultery" — why is it stated? Because it says "The adulterer and the adulteress shall surely be put to death" (Leviticus 20:10): we have heard the punishment, but we have not heard the prohibition. Scripture teaches, saying "You shall not commit adultery."
Do Not Murder and Do Not Commit Adultery as Warnings
Yalkut Shimoni on Torah 298:4
(שמות כ יג-יד) לֹא תִרְצַח, לָמָּה נֶאֱמַר, לְפִי שֶׁהוּא אוֹמֵר (בראשית ט, ו) "שֹׁפֵךְ דַּם הָאָדָם" וְגוֹ' עֹנֶשׁ שָׁמַעְנוּ אַזְהָרָה לֹא שָׁמַעְנוּ, תַּלְמוּד לוֹמַר לֹא תִרְצַח. לֹא תִּנְאָף, לָמָּה נֶאֱמַר, לְפִי שֶׁהוּא אוֹמֵר (ויקרא כ, י) "מוֹת יוּמַת הַנֹּאֵף וְהַנֹּאָפֶת", עֹנֶשׁ שָׁמַעְנוּ אַזְהָרָה לֹא שָׁמַעְנוּ, תַּלְמוּד לוֹמַר לֹא תִנְאָף.