The Holy Quran
The second source of infallible Imams’ sciences is the Holy Quran. This heavenly book is the main most valid source of Islamic sciences, teachings, commandments, and rules. The reliability of Holy Quran is certain, because successive narrations and Muslims’ consensus throughout history prove that the present text of Quran has revealed from Almighty Allah to Prophet Muhammad’s (s) luminous heart. He has recited it –with its rich content– and Imam Ali (`a) and other revelation writers have recorded it and transmitted to Muslims in that era and finally to us. The Holy Quran has a very rich content to the extent that whatever human being needs for his salvation in this world and the Hereafter –and has necessitated sending of the prophets (s) for the Generous Al-wise– exists in it. The sciences and teachings mentioning which have been necessary because of Allah’s Mercy as pointed out in Holy Quran are: major principles about the world Creator, theology and the Almighty Allah’s Attributes, some of His blessings, the after-death life, Resurrection, reckoning human deeds in the Hereafter, the Paradise and rewards of good deeds, the Hell and punishment of evil deeds, Prophet Muhammad (s) and other prophets (s) and their role in guiding mankind throughout history, good conduct and its result in human salvation, bad behavior and its harm, duties of the servants before the Creator, and the methods of worshipping and thanking Him. Human should know these issues, ignoring which brings about irreparable harms. Therefore, common sense necessitates that the All-Merciful never leaves human without guiding him; rather He sends prophets (s) equipped with sciences to guide people to the true way.
The Prophet of Islam (s) was appointed to prophet hood for the same reason and his mission plan is mentioned in the Holy Quran. Prophet Muhammad (s) is the last messenger and there will be no prophet with a heavenly book after him. Since human mind is always progressing, reaching new findings everyday and evolving his life, sciences and teachings of the Holy Quran should be so comprehensive that they fulfill religious requirements of all times, places, and conditions. The Holy Quran introduces itself this way,
وَنَزَّلْنا عَلَیْکَ الکِتابَ تِبْیاناً لِکُلِّ شَىءٍ وَهُدىً وَرَحْمَةً وَبُشْرى لِلْمُسْلِمِینَ
And We have sent down to thee the Book explaining all things, a Guide, a Mercy, and Glad Tidings to Muslims. 
In other words, all sciences and teachings that are related to religion and human beings need are present in the Quran.
It should be borne in mind, however, that though the Holy Quran is an explanatory guiding book from which every human can benefit as much as his understanding, it has a very deep inside, which is not captured by everyone. Different people have different understandings from the Quran internal meanings, which have led to appearance of Quranic exegesis (tafsir). The Quranic verses are not alike; there are indisputable and analogous verses, cancelling and cancelled verses, general and specific verses, and absolute and conditional verses. The exegetists of Holy Quran can compare the verses, ponder, use related sciences, and refer understanding of analogous verses to the indisputable ones, thus finding the truth of verses. An expert exegetist is someone who is completely familiar with Arabic language, literature, and minute linguistic points, speculative theology (ilmul kalam), philosophy, and other related sciences, as well as all Quranic verses and traditions of Prophet Muhammad (s). However, not all exegetists have equal knowledge in these fields. Everyone can benefit from deep meanings of this heavenly book to the extent of his innate genius and curiosity.
The honorable Prophet of Islam (s) was a brilliant Quran exegetist. He was quite aware of indisputable vs. analogous, cancelling vs. cancelled, general vs. specific verses, and absolute vs. conditional verses, revelation reason of verses, and minute literary points of Quranic verses. Moreover, he was familiar with interpretation of verses and was considered a pioneer in Quranic sciences. His understanding of Quranic themes was chiefly different from other exegetists; ordinary exegetists get Quranic teachings by their apparent or inner senses and are not aware of objective realities, while Prophet Muhammad (s) –the first addressee of Holy Quran– observed Quranic realities through his inner sense in their own places, which helped have mental understanding of them too. This unseen means of understanding was always a powerful aid for him. The secret of his infallibility is also rooted in this important privilege.
As a result, Prophet Muhammad’s (s) understanding of theology, theism, or Allah’s attributes is different from and much deeper than our understanding of these themes, because his knowledge is intuitive while ours is acquirable. When the honorable Messenger of Allah (s) gave news of the after-death life, Resurrection, the Paradise, and the Hell, he had already witnessed their true setting; his mental understanding resulted from objective realities.
The Prophet’s (s) understanding of enjoining and forbidding, obligations and prohibitions, religious rules and commandments was different from our understanding. During revelation, Prophet Muhammad (s) saw true expediency or imperfection of religious rules and their sources and roots –which show the true path to humanity and guarantee salvation in this world and the Hereafter– through his insight. Moreover, he witnessed the goodness of good deeds and evilness of wrongdoing directly.
Considering this background about Prophet Muhammad’s (s) sciences, we can conclude that some commandments –which are not mentioned as revelation– have been general revelation. Or they have been issued by the Prophet (s); he was religiously allowed to issue verdicts because of his known purified conduct.
 Surah Al-Nahl (16): 89.