Valeyard

Valeyard was a title, potentially Gallifreyan in origin, which the Sixth Doctor knew to mean "learned court prosecutor". (TV: The Mysterious Planet) According to the Inquisitor, it meant "doctor of law". (PROSE: The Inquisitor) In the Sixth Doctor's trial, the title was claimed by a Time Lord known as the Valeyard, who revealed to be an amalgamation of the Doctor's darker sides, taken from a point in the Doctor's personal future. (TV: The Ultimate Foe)

Behind the scenes
Contrary to the in-universe definition and despite what Shannon Sullivan's A Brief History Of Time claims, "Valeyard" is not a genuine legal title meaning "learned court prosecutor" or an obsolete phrasing of "doctor of law." The term was entirely made-up during production - as evidenced by the character outline as delivered on 5 July 1985 and was devised by either John Nathan-Turner or Eric Saward. The term is originally briefly spelled in this documentation as "Valiyard", but this was amended that same day.