Dirges (lei 誄) are a literary genre belonging to funeral texts delivered after the death of a beloved or outstanding person. Dirges usually "sum up" (lei 累, a wordpun) the personal and social achievements of the person commemorated and stress her or his moral principles. Cao Pi 曹丕 (Emperor Wen 魏文帝, r. 220-226) clarifies in his book Dianlun 典論 (ch. Lunwen 論文) that “inscriptions and dirges [must] correspond to the truth“ (ming lei yi shi 銘誄宜實).
Dirges generally consist of two parts, namely a narrative part recording the person’s character and integrity, and a second one expressing grief and sorrow about his or her passing away. Liu Xie 劉勰 (d. 522) therefore writes in his literary theory Wenxin diaolong 文心雕龍 (12 Lei bei 誄碑) that lei were “beginning in glory and ending in sorrow” (rong shi er ai zhong 榮始而哀終). Some dirges also include an introduction (xu 序), and the text might be written in rhythmic prose (also with rhymes, usually in four-syllable verses) or in real prose. Some dirges are close to the genre of elegies (saoti 騷體). Lu Ji 陸機 (261-303), author of the didactic rhaposody Wenfu 文賦, says that dirges were “deeply moved and sad” (chanmian er qichuang 纏綿而凄愴).
The genre of lei is first mentioned in the book Mozi 墨子 (ch. Lu wen 魯問), where it is said that the lord of Lu 魯 wrote a lament after the death of his minion (bi 嬖). The biography of Huan Tan 桓譚 (23 BCE-56 CE) in the official dynastic history Houhanshu 後漢書 (ch. 28) mentions dirges as one of the 26 literary genres. The ritual classic Liji 禮記 (ch. Zengzi wen 曾子問) explains that dirges were only used for superiors to lament the death of a subordinated person (jian bu lei gui, you bu lei zhang 賤不誄貴，幼不誄長), and tells (ch. Tangong 檀弓) a story of Duke Zhuang of Lu 魯莊公 (r. 694-662) lamenting the death of his charioteer Xian Benfu 縣賁父, who died for him in battle. The composition of a dirge was thus also an occasion to award a posthumous honorific title (shi 謚).
However, the ritual rule that dirges were a matter of superiors grieving the death of a subordinated person became obsolete in imperial times, and Xu Shiceng 徐師曾 (1517-1580) therefore wrote in his literary theory Wenti mingbian xushuo 文體明辨序說 that this rule was not adhered to any more.
The most famous early dirges are Kongzi lei 孔子誄 (on Confucius) by Duke Ai of Lu 魯哀公 (r. 495-467), the lament of Liuxia Hui’s 柳下惠 (720-621 BCE) widow for her late husband quoted in the biographical collection Lienüzhuan 列女傳 (which is an early example of an inferior person writing a dirge, qi wei zhi ci 妻為之辭), Yang Xiong’s 揚雄 (53 BCE-18 CE) Yuan Hou lei 元后誄 on Empress Yuan (71 BCE-13 CE), Cao Zhi’s 曹植 (192-232) Wang Zhongxuan lei 王仲宣誄 (on Wang Can 王粲, 177-217), Pan Yue’s 潘岳 (247-300) Yang Jingzhou lei 楊荆州誄 (on Yang Zhao 楊肇) or Yan Yanzhi’s 顏延之 (384-456) Tao Zhengshi lei 陶徵士誄 (on Tao Yuanming 陶淵明, c. 365-427).