The **Rambam** (Shemoneh Perakim, [end of Chapter 6](https://www.sefaria.org/Eight_Chapters.6.3?lang=bi&with=all&lang2=en)) deals with different types of *mitzvos*. He says one type are logical, and thus a perfected person shouldn't want to transgress them. He says some call these *mitzvos sichliyos*, logical *mitzvos*. He lists murder, theft, robbery, overcharging, and damaging others as examples. The **Rambam** writes that these are *mitzvos* that ***Chazal*** describe as שאילו לא נכתבו ראוים הם ליכתב, if they weren't written in the Torah (as prohibitions), they would have deserved to have been written. Meaning, they would have been forbidden because of logic.

He then describes *mitzvos* that are beyond human logic. These *mitzvos* a perfected person can desire to transgress, yet won't because G-d dictated not to. If the Torah hadn't forbidden them, they wouldn't have been considered evil. These are commonly referred to as *chukim*. He lists milk and meat, *shaatnez*, and **forbidden relations** as examples of this latter type.

My edition of Shemoneh Perakim has a note (from הגהות בד"ו, my guess is that stands for a marginal note in the Venice printing) that the **Rambam**'s source for his first category is [Yoma 67b](https://www.sefaria.org/Yoma.67b.8?lang=bi&with=all&lang2=en). It points out that we find a contradiction there to the **Rambam**'s words. There, the **gemarra** teaches:

> ת"ר (ויקרא יח, ד) את משפטי תעשו דברים שאלמלא (לא) נכתבו דין הוא שיכתבו ואלו הן עבודת כוכבים **וגלוי עריות** ושפיכות דמים וגזל וברכת השם
>
> The Sages taught with regard to the verse: “You shall do My ordinances, and you shall keep My statutes to follow them, I am the Lord your God” (Leviticus 18:4), that the phrase: My ordinances, is a reference to matters that, even had they not been written, it would have been logical that they be written. They are the prohibitions against idol worship, **prohibited sexual relations**, bloodshed, theft, and blessing God, a euphemism for cursing the Name of God.

We see that the **Rambam**'s source for logical *mitzvos* includes forbidden relations, but he included those in his list of *mitzvos* that are beyond human reasoning. This is a glaring contradiction.

The note suggests a partial answer from the **Maharsha** [there](https://www.sefaria.org/Yoma.67b.8?lang=bi&p2=Chidushei_Agadot_on_Yoma.67b.4&lang2=bi). He understands the  *gemarra* differently than I explained above. The *gemarra* doesn't mean that if they weren't written, they would have been self evident. Rather, it means if they hadn't been written, they would have been forbidden anyways, since they are forbidden to *benei Noach*. The **Rambam** could mean that even before forbidden relations were forbidden to *benei Noach*, they would have been considered permitted. The problem is, seemingly the **Rambam**'s source for his first category of *mitzvos* is this very *gemarra*, and he doesn't seem to be understanding it like the **Maharsha**.

**Edit**: I just saw that in [**Rav Kafih**'s](https://en.wikipedia.org/wiki/Yosef_Qafih) edition of the **Rambam**'s commentary on Avos (fn. 14) that he writes it is clear that the **Rambam** didn't have the words גילוי עריות in his *gemarra*. His suggestion is hard to accept, as eight manuscripts/versions of the Talmud we have list it, as well as many geonim and rishonim.

Are there any other resolutions to this contradiction?