Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
bukhari:4508ʿUbaydullāh > Isrāʾīl > Abū Isḥāq > al-Barāʾ > Aḥmad b. ʿUthmān > Shurayḥ b. Maslamah > Ibrāhīm b. Yūsuf from his father > Abū Isḥāq > al-Barāʾ

When the order of compulsory fasting of Ramadan was revealed, the people did not have sexual relations with their wives for the whole month of Ramadan, but some men cheated themselves (by violating that restriction). So Allah revealed: "Allah is aware that you were deceiving yourselves but He accepted your repentance and forgave you.." (3.187)  

البخاري:٤٥٠٨حَدَّثَنَا عُبَيْدُ اللَّهِ عَنْ إِسْرَائِيلَ عَنْ أَبِي إِسْحَاقَ عَنِ الْبَرَاءِ وَحَدَّثَنَا أَحْمَدُ بْنُ عُثْمَانَ حَدَّثَنَا شُرَيْحُ بْنُ مَسْلَمَةَ قَالَ حَدَّثَنِي إِبْرَاهِيمُ بْنُ يُوسُفَ عَنْ أَبِيهِ عَنْ أَبِي إِسْحَاقَ قَالَ

سَمِعْتُ الْبَرَاءَ ؓ لَمَّا نَزَلَ صَوْمُ رَمَضَانَ كَانُوا لاَ يَقْرَبُونَ النِّسَاءَ رَمَضَانَ كُلَّهُ وَكَانَ رِجَالٌ يَخُونُونَ أَنْفُسَهُمْ فَأَنْزَلَ اللَّهُ {عَلِمَ اللَّهُ أَنَّكُمْ كُنْتُمْ تَخْتَانُونَ أَنْفُسَكُمْ فَتَابَ عَلَيْكُمْ وَعَفَا عَنْكُمْ}