Question: Which of the following is known for his piety and memorized the Qur'an by the age of 7: Ahmad Nahavandi or Shah Waliullah Dehlawi?
Context: Al-Arba'in fi Ahwal-al-Mahdiyin ("Forty [Hadith] concerning the Mahdis") by Shah Ismail Shaheed (26 April 1779 – 6 May 1831) Balakot, Pakistan.  "Al-Arba'in fi Ahwal-al-Mahdiyin" is a small book consisting of 50 pages.  As the name suggests it has forty Ahadith in it, all these traditions pertain to the appearance of "Imam" Mahdi in the Ummah of Muhammad.  The author Shah Ismail Shaheed was the son of Shah Abdul-Ghani, and the grandson of Shah Waliullah Muhaddith Dehlawi.  Shah Ismail Shaheed died in action at Balakot fighting against the Sikh Raj on 6 May 1831.  The book has been published some 20 years after his death by a Publisher at Misri Ganj Calcutta on the 25 Muharram 1268 Hijri (21 November 1851 G).  The publisher writes, he has appended the "very famous Ode" of Shah Nimatullah Wali(1330-1431) at the end of the book.  This printed copy of the "Ode" [1851 AD] of Shah Nimatullah Wali(1330-1431) is probably the oldest published copy available at this time.  According to Professor C. M. Naim of Chicago University,calling this copy of the "Ode" Q1, " ...had long existed, and was undoubtedly copied and shared by thousands of people, its debut in the political discourse of South Asian Muslims occurred near the middle of the 19th century.  According to Qamar Islampuri, it appeared as a part of a book called Al-Arba'in fi Ahwal-al-Mahdiyin ("Forty [Hadith] concerning the Mahdis"), ascribed to "Shah Isma'il 'Shahid' and published at Misri Gunj, Calcutta, on Muharram 25, 1268 AH (21 November 1851)". Munhadiyan is a famous graveyard on left side of Delhi Gate, where Shah Waliullah was buried beside his father Shah Abdur Rahim. Madrasa Rahimiyya was an Islamic teaching centre located in Delhi.  It was founded by Shah Abdur Rahim during 18th century.  Shah Abdur Rahim was the father of Shah Waliullah.  After the death of Shah Abdur Rahim in 1718 Shah Waliullah Dehlawi started teaching at the Madrassa.  It played a leading role in teaching Islam to other people.  Later, when Shah Wali Ullah died, his sons Shah Rafi and Shah Abdul Qader began teaching here. Izalat al-Khafa'an Khilafat al-Khulfa (ازالة الخفاء عن خلافت الخلفاء ; lit.  'Removal of Ambiguity about the Caliphate of the [Early] Caliphs') is a book by the Islamic scholar Shah Waliullah Dehlawi in the Persian language. Deobandi (Pashto and Persian: دیو بندی‎ ‎ , Urdu: ‎ , Bengali: দেওবন্দী , Hindi: देवबन्दी ) is a revivalist movement within Sunni (primarily Hanafi) Islam.  It is centered in India, Pakistan, Afghanistan, and Bangladesh, has recently spread to the United Kingdom, and has a presence in South Africa.  The name derives from Deoband, India, where the school Darul Uloom Deoband is situated.  The movement was inspired by scholar Shah Waliullah Dehlawi (1703–1762), and was founded in 1867 in the wake of the failed Sepoy Rebellion in northern India a decade earlier. Shah Abdur Rahim(Ur شاہ عبدرھیم Hn शाह अब्दुर्रहीम) (1644-1719) was a sufi Syed and a scholar who assisted in the compilation of Fatawa-e-Alamgiri, the voluminous code of Islamic law.  He was the father of the Muslim philosopher Shah Waliullah Dehlawi.  He was descendant of Abdul Azeez and became a disciple of Khwaja Khurd son of Khawaja Baqi billah a revered Sufi of Delhi.  He got the training under learned Chishti Sufis. Shah Waliullah was born on 21 February 1703 to Shah Abdur Rahim, during the reign of Emperor Aurengzeb.  He was known as Shah walliullah because of his piety.  A prominent Sufi and scholar of Delhi.  He memorized the Qur'an by the age of seven.  Soon thereafter, he mastered Arabic and Persian letters.  He was married at fourteen.  By sixteen he had completed the standard curriculum of Hanafi law, theology, geometry, arithmetic and logic.  He lived during the time when Fatawa-e-Alamgiri was being compiled and he was asked to join the team of scholars that was working on it, however, credible sources reveal that he joined the team but for a very brief period of time and then he dissociated himself from the task.  His father, Shah Abdur Rahim was the founder of the Madrasah-i Rahimiyah.  Shah Abdur Rahim was on the committee appointed by Aurangzeb for compilation of the code of law, Fatwa-e-Alamgiri.  His grandfather, Sheikh Wajihuddin, was an important officer in the army of Shah Jahan. A'la Hadrat Maulana Shah Abdul Wahhab (9 October 1831 – 1921) (Tamil:அஃலா ஹள்ரத் மவ்லானா ஷாஹ் அப்துல் வஹ்ஹாப்), (Arabic: اعلى حضرت مولانا شاه عبد الوهّاب) born Shah Abdul Wahhab, also known as (A'la Hadrat, A'la Hazrat, Ala Hadrat, Ala Hazrat) (Tamil:அஃலா ஹள்ரத்,அஃலா ஹஜ்ரத்), was a renowned Sunni Islamic Scholar and Reformer of the late 19th and early 20th Century from the Southern part of India.  Like Shah Waliullah Muhaddith Dehlvi he was worried about the state of Muslims of South India, especially those of Nagore and its nearby regions.  He worked hard to purify their beliefs.  So he founded the Madrasa Al-Baqiyat As-Salihat in Vellore in the year 1857. The People's Revolutionary Congress Pakistan is a Pakistani political party based on the philosophy of Imam Shah Waliullah.  Their party platform emphasizes struggle against the exploitation of capitalism by following the philosophy of secularism and socialism espoused by Imam Waliullah. Ahmad ibn Muhammad al-Nahawandi was a Persian astronomer of the 8th and 9th centuries.  His name indicates that he was from Nahavand, a city in Iran.
Answer: Shah Waliullah