This question is a complicated version of "circular reasoning" which comes in the following form:
(A) is true because (B) is true and (B) is true because (A) is true!
Before taking the following steps, let's assume that there were some verses or traditions proving the infallibility of the Prophets:
(1). Prophet is infallible because Quran has stated that he is infallible
Question: How do you know that Quran is free from any error including the above-mentioned statement?
(2).Quran is infallible because it is the word or Allah.
Question: How do you know that Quran is the word of Allah?
(3).Quran is the word of Allah because the Prophet has brought it word-by-word from Allah(which is implying in another words that Prophet is infallible )
Conclusion: The prophet is infallible because the prophet is infallible
Compering the question to the following example, we will be able to gain a clear understanding of the fallacy:
"Whatever is less dense than water will float, because whatever is
less dense than water will float" sounds stupid,
"Whatever is less
dense than water will float, because such objects won't sink in water"
Question: If substantiating some fundamental beliefs like the existence of Allah, the oneness of Allah etc by using Quranic verses and traditions is logically impossible -as explained before- how come that there are some Quranic verses stating clearly the reasons behind those fundamental beliefs? (e.g. verse 22 of Surah Al-Anbiya'a)
Answer: This kind of verses is just a guidance to the intellectual precepts. These verses are just constant reminders of what we are capable of comprehending through logical reasoning.
This point should be noted that certain intellectual precepts have been accepted by All-Mighty Allah as we read in verse 165 of Surah Al-Nisa':
رُسُلاً مُبَشِّرينَ وَ مُنْذِرينَ لِئَلاَّ يَكُونَ لِلنَّاسِ عَلَى اللَّهِ حُجَّةٌ بَعْدَ الرُّسُلِ وَ كانَ اللَّهُ عَزيزاً حَكيماً
apostles, as bearers of good news and warners, so that mankind may
not have any argument against Allah, after the] sending of the
[apostles; and Allah is all-mighty, all-wise.
It's not difficult to understand that punishing a person without warning him beforehand is detestable and the validity of this very level of intellectual comprehension is undeniable in the religion of Islam.