In the Gesta Romanorum Virgil is represented as a mighty but benevolent enchanter. This is the character that Italian tradition always gives him, and it is this traditional character that furnishes Dante with his conception of making Virgil his guide through the infernal regions. From the AEneid grammarians illustrated their rules, rhetoricians selected the subjects of their declamations, and Christians looked on the poet as half-inspired; hence the use of his poems in divination. (See Sortes Virgilianae.)
Dante makes Virgil the personification of human wisdom, Beatrice of that wisdom which comes of faith, and St. Bernard of spiritual wisdom. Virgil conducts Dante through the Inferno, Beatrice through Purgatory, and St. Bernard through Paradise
Virgil was wise, and as craft was considered a part of wisdom, especially over-reaching the spirits of evil, so he is represented by mediaeval writers as out-witting the demon. On one occasion, it is said, he saw an imp in a hole of a mountain, and the imp promised to teach the poet the black art if he released him. Virgil did so, and after learning all the imp could teach him, expressed amazement that one of such imposing stature could be squeezed into so small a rift. The imp said, “Oh, that is not wonderful,” and crept into the hole to show Virgil how it was done, whereupon Virgil closed up the hole and kept the imp there. (Een Schone Historie Van Virgilius, 1552.)
This tale is almost identical with that of the Fisherman and the Genius in the Arabian Nights. The fisherman trapped in his net a small copper vessel, from which, when opened, an evil genius came out, who told the fisherman he had vowed to kill the person who released him. The fisherman began to mock the genius, and declared it was quite impossible for such a monster to squeeze himself into so small a vessel. The genius, to convince the fisherman, metamorphosed himself into smoke and got into the vessel, whereupon the fisherman clapped down the lid and flung the vessel back into the sea.
The Swiss tale of Theophrastus and the Devil is another analogous story. Theophrastus liberates the devil from a hollow tree, and the sequel is like those given above. (Gorres: Folksbücher, p. 226.)
There are numerous tales of the devil outwitted.