Abu al-Husn and His Slave-Girl Tawaddud
Abu al-Husn and His Slave-Girl Tawaddud is a story that is first attested in medieval Arabic (later appearing in the Thousand and One Nights) that, besides being well known in itself, inspired spin-offs in Persian, Spanish, Portuguese, Mayan, and Tagalog.

The tale in Arabic

Summary 
As summarised by Ulrich Marzolph, Richard van Leeuwen, and Hassan Wassouf, the version in the Cairo edition of the Thousand and One Nights runs as follows:
A rich man in Baghdad has a son called Abu ’l-Husn. When his father dies, Abu ’l-Husn squanders his inheritance ... until he owns nothing except a slave-girl named Tawaddud. Tawaddud advises him to take her to Caliph Hârûn al-Rashîd and sell her for 10,000 dinars. When she is led before the caliph, Hârûn starts interrogating her and she claims to be well versed in all the sciences. Thereupon Hârûn holds a contest between the foremost scholars of Baghdad and Tawaddud. She is questioned about the Koran, the traditions and the law, about theology, physiology and medicine, astronomy, and philosophy. In every discipline she proves to be exceptionally well informed and emerges victorious. Then she beats the champions of chess and backgammon and shows her ability to play the lute. Finally the caliph awards Abu ’l-Husn 10,000 dinars and takes him as a boon companion. He is allowed to keep Tawaddud.

Origins 
The tenth-century CE Ibn al-Nadīm's famed catalogue of Arabic books, the Kitāb al-Fihrist, includes a chapter on 'the names of fables known by nickname, nothing more than that being known about them', among which al-Nadīm lists 'The Philosopher Who Paid Attention to the Handmaid (of) Qaytar and the Story of the Philosophers Connected with Her'. This sounds similar to the story of Tawaddud, so some scholars have guessed that it represents an earlier version of the same story. Because the subsection where this story is mentioned contains 'names of the books composed about sermons, morals, and wisdom, by the Persians, Greeks and Arabs', it has moreover been thought that the story of Qaytar (if that is indeed the name: the reading of the word is uncertain) was translated into Arabic from Greek. This claim too is merely speculative, however.

Witnesses 
The Tawaddud story is first securely attested in a manuscript from the thirteenth century CE: Madrid, Real Academia de la Historia, Pascual de Gayanos collection, MS T-lxxi, as Hikāyat al jāriya Tūdūr wa mākānahā min ḥadīthihā maʿ al-munajjim wa-l-faylasūfi wa al-Naẓẓām bi ḥaḍrat Hārūn al-Rashīd. Another thirteenth-century Arabic manuscript is also known from Granada.

The tale later came to be included in manuscripts of the Thousand and One Nights. It does not appear in the Galland Manuscript, the sole medieval manuscript of the Nights, but it does appear in many post-medieval manuscripts and the major printed edition known as Calcutta II, from which it was most famously rendered into English by Richard Francis Burton. Thematically, the tale fits the Nights well. Like the frame-story of the Nights, it is about a woman displaying her exceptional wit before a king, showing herself to be wiser than the men of his court. A number of stories in the Nights give a prominent role to women, such as Nūr al-Dīn ʿAlī and Anīs al-Jalīs,  The Man of al-Yaman and his Six Slave-girls, ʿAlī Shār and Zumurrud, and ʿAlī Nūr al-Dīn and Maryam the Girdle-girl. The Tale of King ʿUmar ibn al-Nuʿmān involves Nuzhat al-Zamān being questioned in a similar way to Tawaddud. In style, however, the story of Tawaddud is very different from most of the stories in the Nights, being clearly a literary (adab) work. In the estimation of Marzolph, van Leeuwen, and Wassouf, "it is unlikely that the story ever formed part of an original version of the Arabian Nights; it was probably added only in the late Egyptian recensions".

Risālah-yi Ḥusnīyah
A very similar story to the Tawaddud tale is found in Persian; the earliest known manuscripts are from the seventeenth century, later than the earliest Arabic Tawaddud-manuscripts. Precisely how the Persian text relates to the Arabic one has yet to be determined, but a relationship is not in doubt. Whereas Tawaddud's theology is explicitly Sunni, Ḥusnīyah is transformed into a Shīʿī, speaking to a Sunni court.

Some manuscripts have an introduction in which one Ibrāhīm ibn Valī Allāh Astarābādī — of whom little is otherwise known — claims that he found an Arabic-language manuscript of the story in Damascus while returning from Hajj in 958/1551, copied it, and translated it into Persian; Astarābādī went on to dedicate it, later that year, to Shāh Ṭahmāsp (who reigned 1524‒76). Others have Astarābādī saying that the story originated, implicitly in Persian, with Abū l-Futūḥ, which would imply a twelfth-century AH origin for the text. It is possible that neither introduction gives an accurate picture of the origin of the text, but the different origins that the two stories suggest would have quite different implications for the significance of Ḥusnīyah at its time of composition. In the words of Rosemary Stanfield-Johnson,
if, on one hand, the narrative emerged under the circumstances as presented in the manuscripts in which Ibrāhīm Astarābādī states that he encountered the Arabic-language Ḥusnīyah in Damascus in 958/1551, copied it, and brought to Iran where he translated it to Persian in the same year, then the story, of course, reflects the doctrinal rhetoric of the age of Ṭahmāsp, and offers a glimpse worthy of attention into the doctrinal platform of the tenth/sixteenth century. If, on the other hand, the story was transmitted in the eleventh/seventeenth century, as numerous manuscripts from that period seem to indicate, then its doctrinal and rhetorical content relate to the period in which Twelver Shīʿism had become established in Iran.

Either way, from the seventeenth century this text became "the most popular tract on Shīʿī doctrine" in Ṣafavid Iran; over one hundred manuscripts, dating from the seventeenth century onwards, are known. In both manuscripts and in printed editions, the tale is usually found appended to Muḥammad Bāqīr al-Majlisī's popular work on Shīʿī ethics, Ḥilyat al-muttaqīn fī l-adab wa-l-sunan wa l-akhlāq (Ornament of the God-fearing). By the nineteenth century CE, the story was circulating in Ottoman Turkey, becoming a key text among the Sufi Bektashī order, provoking public declamations against it by Ṣultan ʿAbdul-Ḥamīd II (r. 1876‒1909).

Summary 
As summarised by Rosemary Stanfield-Johnson,the slave-girl Ḥusnīyah is called to the extraordinary service of her master, a wealthy Baghdād Shīʿī merchant, who has been rendered impoverished and subject to the sectarian animosity of al-Rashīd. Upon her master’s disclosing to her the extent of his plight, Ḥusnīyah contrives a plan to have him present her to the caliph with a wager that she engage the elite Sunnī scholars of the court on theology. Should she win the debate, she and her master should be awarded a great monetary sum together with their freedom to depart from the city. Ḥusnīyah then sends her protesting master to seek an audience with the caliph. Meanwhile, the reader/listener learns that Ḥusnīyah owes her brilliance to years of training in Shīʿī law under the sixth Shīʿī imām Jaʿfar al-Ṣādiq (d. 765). At court, once Hārūn sets eyes on the beautiful Ḥusnīyah, he inquires about her price. When Ḥusnīyah’s master tells the caliph the sum he expects to receive for Ḥusnīyah ‒ 100,000 dīnārs ‒ the caliph asks what about her justifies such an exorbitant amount. The merchant then conveys to the caliph Ḥusnīyah’s great intellectual abilities and proposes a debate between her and the court scholars. After some back and forth with his prime minister (wazīr) Yaḥyā Barmakī concerning Ḥusnīyah’s Shīʿī religious affiliation (madhhab), which she boldly reveals to him, he agrees to the majlis debate. At the appointed time, Ḥusnīyah steps forward unveiled to take a seated position on a par with the caliph and Barmakī. Hārūn proceeds to call for Ḥusnīyah to begin the debate with two of his luminaries, Muḥammad Shāfiʿī and Abū Yūsuf of Baghdad, who are rivals. The two end up squabbling and fail to advance the contest. So weak and foolish are they made to appear that the depiction of them may be characterized as parody. Hārūn, annoyed by the mutual antagonism of these two clumsy debaters, dismisses them and summons al-Naẓẓām to carry on. An emboldened and impatient Ḥusnīyah soon gains the upper hand and takes over the questioning, challenging her opponent’s position on topics traditionally associated with Sunnī-Shīʿī differences. As Twelver-Shīʿī Ḥusnīyah brilliantly treads the thin line between acceptable limits of debate and heresy, she amazes Hārūn, who, seized by respect for her, publicly hails her. When Ḥusnīyah’s utter triumph finally becomes apparent, Hārūn inquires about the source of her great knowledge. Ḥusnīyah then discloses that through her apprenticeship with Imām al-Ṣādiq she has attained the status of independent interpreter of religious law, or ijtihād. The narration concludes with the dazzled caliph’s bequeathing of a robe of honor to the triumphant slave-girl, the promised monetary prize and a sympathetic warning to Ḥusnīyah and her master that they should immediately leave Baghdād for their own safety. The two kiss Hārūn farewell and depart the city to spend the rest of their lives in Madīna in the service of Imām Riḍā (d. 203/818). The drama at Hārūn’s court ends with the proud exclamation that the 400 persons who had witnessed the debate at court were on that very day converted to Twelver Shīʿism.

Editions and translations 
The text had not as of 2017 received a scholarly critical edition; the principal published text is Muhammad Bāqir al-Majlisī, Ḥilyat al-muttaqīn fī l-adab wa l-sunan wa l-akhlāq, ed. by Riḍā Marandi (Qum, 2006), pp. 484‒567. A summary and partial English translation is given in John Malcolm, The History of Persia, from the Most Early Period to the Present Time: Containing an Account of the Religion, Government, Usages, and Character of the Inhabitants of that Kingdom, rev. edn, 2 vols (London, 1829 [first publ. 1815]), II 253‒62.

La doncella Teodor

This is a Spanish translation of the Tawaddud tale, first found in Castilian manuscripts of the thirteenth to fourteenth century; evidently it was produced alongside other Spanish translations of Arabic prose texts from the same period associated with the Toledo School of Translators, such as Poridat de las Poridades, the Sendebar (a collection of Sindbad tales), and Kalīla wa-Dimna. It circulated in a number of abbreviated versions, both in Spanish and Portuguese, and, from the fifteenth century, in print: between 300 and 800 copies were exported to the New World in the period 1589–1600 alone. Between 1604 and 1617, this Spanish text was rendered as a play, La donzella Teodor, by Lope de Vega (in which Teodor's 'mission takes on a parodic edge as the learned maiden tours Spain, North Africa, Constantinople, and Persia').

According to Christine Chism, 'the slave girl is Christianized while her interlocutors and audience remain Muslim. Thus, instead of declaiming Islamic ritual practice and exhibiting her knowledge of how many letter ‘ayns there are in a particular Qur’anic sura, Tawaddud transforms into Teodor and recounts Christian practice, iturgy, and creed to an admiring Muslim audience in a fantasy of mission. [...] In the Spanish translations, the frame tale becomes more important than the examination questions, which are radically abridged and the bodies of knowledge shifted. The setting flickers across the Mediterranean from the Abbasid Baghdadi court of Harun al-Rashid, to the North African or Iberian courts of Al-Mansūr'.

The principal edition of Spanish manuscript versions of the story is Historia de la donzella Teodor, ed. by Isidro J. Rivera and Donna M. Rogers (Global
Publications/CEMERS, 2000). Translations and summaries of several of the Iberian versions are given by Margaret Parker, The Story of a Story across Cultures: The Case of the Doncella Teodor (Woodbridge: Tamesis, 1996).

Translations
In the early modern period, a version of the Spanish tale was adapted into Mayan, with three different translations being known today, in four manuscripts, among the books known as Chilam Balam ('community books'), among them the books of Kaua, Chan Kan and Mani. According to Gordon Brotherston,
in their version of the story, the Maya cut out that opening part of the narrative, before the heroine arrives at the royal court. No account is taken of prior personal motive here, nor indeed later on, when Teodora makes a bargain with the third and chief of Mansur's sages, Abraham, that whoever loses the contest of wits should strip before the assembled court. It is to save Abraham from this humiliation that Mansur agrees both to pay Teodora's master and to let her leave with him. In the Maya texts this generosity goes unexplained. In other words the emphasis is less on the motivation and behaviour of individual characters than on the actual testing of Teodora, as an intellectual experience in its own right.

The story was also adapted in the Philippines, alongside many other Spanish romances, into Tagalog.

Analogues
Greek analogues for the tale which have been adduced include hagiographies of Secundus the Silent Philosopher and Saint Catherine of Alexandria, but none has gained acceptance as a direct source for the Tawaddud story. ʿAbd al-Jalīl Rāzī's Kitāb al-Naqḍ is also a debate narrative in which, like the Persian Ḥusnīyah, Shīʿism is tested and found superior to other Islamic theologies.

Further reading

Gerresch, Claudine, 'Un recit des Mille et une nuits: Tawaddud, petite encyclopedie de l’Islam medieval', Bulletin de l’ Institut Fondamental d’Afrique Noire, 35 (1973), 55–175.
 Parker, Margaret, The Story of a Story across Cultures: The Case of the Doncella Teodor (Woodbridge: Tamesis, 1996).

References

One Thousand and One Nights
Medieval Arabic literature
Medieval legends
Persian literature
Islamic fiction
Mayan literature
Spanish literature
Portuguese literature
Qiyan