Tafsir Ibn Kathir -> Surah Al-Hajj -> Allah tells us how perfect is His knowledge of His creation, and that He encompasses all that is in the heavens and on earth.

Not even the weight of a speck of dust, or less than that or greater escapes His knowledge in the heavens or in the earth. He knows all things even before they happen, and He has written that in His Book, Al-Lawh Al-Mahfuz, as was reported in Sahih Muslim from `Abdullah bin `Amr, who said, "The Messenger of Allah said:

«إِنَّ اللهَ قَدَّرَ مَقَادِيرَ الْخَلَائِقِ قَبْلَ خَلْقِ السَّموَاتِ وَالْأَرْضِ بِخَمْسِينَ أَلْفَ سَنَةٍ، وَكَانَ عَرْشُهُ عَلَى الْمَاء»

(Allah issued His decrees concerning the measurement and due proportion of the creatures fifty thousand years before He created the heavens and the earth, and His Throne was over the water.) In the Sunan, it was reported from a group of the Companions that the Messenger of Allah said:

«أَوَّلُ مَا خَلَقَ اللهُ الْقَلَمُ، قَالَ لَهُ: اكْتُبْ، قَالَ: وَ مَا أَكْتُبُ؟ قَالَ: اكْتُبْ مَا هُوَ كَائِنٌ، فَجَرَى الْقَلَمُ بِمَا هُوَ كَائِنٌ إِلَى يَوْمِ الْقِيَامَة»

(The first thing that Allah created was the Pen. He said to it, "Write!'' It said, "What should I write'' He said, "Write what will happen,'' so the Pen wrote everything that will happen until the Day of Resurrection.) Allah says:

﴿إِنَّ ذلِكَ فِى كِتَـبٍ إِنَّ ذلِكَ عَلَى اللَّهِ يَسِيرٌ﴾

(Verily, it is (all) in the Book. Verily, that is easy for Allah.)

﴿وَيَعْبُدُونَ مِن دُونِ اللَّهِ مَا لَمْ يُنَزِّلْ بِهِ سُلْطَـناً وَمَا لَيْسَ لَهُمْ بِهِ عِلْمٌ وَمَا لِلظَّـلِمِينَ مِن نَّصِيرٍ - وَإِذَا تُتْلَى عَلَيْهِمْ ءَايَـتُنَا بَيِّنَـتٍ تَعْرِفُ فِى وُجُوهِ الَّذِينَ كَفَرُواْ الْمُنْكَرَ يَكَـدُونَ يَسْطُونَ بِالَّذِينَ يَتْلُونَ عَلَيْهِمْ ءَايَـتُنَا قُلْ أَفَأُنَبِّئُكُم بِشَرٍّ مِّن ذلِكُمُ النَّارُ وَعَدَهَا اللَّهُ الَّذِينَ كَفَرُواْ وَبِئْسَ الْمَصِيرُ ﴾

(71. And they worship besides Allah others for which He has sent down no authority, and of which they have no knowledge; and for the wrongdoers there is no helper.) (72. And when Our clear Ayat are recited to them, you will notice a denial on the faces of the disbelievers! They are nearly ready to attack with violence those who recite Our Ayat to them. Say: "Shall I tell you of something worse than that The Fire which Allah has promised to those who disbelieved, and worst indeed is that destination!'')