All these prohibitions have one common thrust: that one should not pay attention to idol worship. Whoever performs a deed that reflects his concern with [idol worship] receives lashes [as punishment].
The worship of false gods is not the only subject to which we are forbidden to pay attention; rather, we are warned not to consider any thought which will cause us to uproot one of the fundamentals of the Torah. We should not turn our minds to these matters, think about them, or be drawn after the thoughts of our hearts.
In general, people have limited powers of understanding, and not all minds are capable of appreciating the truth in its fullness. [Accordingly,] were a person to follow the thoughts of his heart, it is possible that he would destroy the world because of his limited understanding.
What is implied? There are times when a person will stray after star worship, and times when he will wonder about God's oneness: Perhaps He is one, perhaps He is not? [He might also wonder:] What exists above, [in the heavenly realms]? What exists below [them]? What was before time? What will be after time? Similarly, [one might wonder about] prophecy: Perhaps it is true, perhaps it is not? And [one may also wonder] about the Torah: Perhaps it emanates from God, perhaps it does not?
Since he may not know the guidelines with which to evaluate [ideas that will lead him] to the truth in its fullness, he may come to heresy. The Torah has warned about this matter, saying [Numbers 15:39]: "Do not stray after your hearts and eyes, which have led you to immorality" - i.e., each one of you should not follow his limited powers of understanding and think that he has comprehended the truth.
Our Sages [interpreted this warning]: "After your hearts," this refers to heresy; "after your eyes," this refers to immorality. This prohibition - though [severe,] causing a person to be prevented [from attaining a portion] in the world to come - is not punishable by lashes.