This article explores the relation between the work of Lacan and Derrida, focusing on the use of modal logic in both writers (the categories of necessity, impossibility, contingency, and possibility). The author explores the structure of the aporia in Derrida as a peculiar conjunction of necessity and impossibility, distinct from previous forms of contradiction (antinomies in Kant and dialectical contradiction in Hegel) and therefore historically situated in relation to the tradition of metaphysics. He argues that the other two modal categories, possibility and contingency, are largely absorbed by the aporia of necessity and impossibility. In Lacan, by contrast, modal categories are introduced in Encore, his notorious seminar on sexual difference, to develop the distinction between masculinity and femininity. The author argues that the sexuation graph of Encore, which is written in symbolic logic, is later redescribed by Lacan in modal terms, and this later description alters Lacan's initial presentation, allowing for greater flexibility among these categories. The essay shows that Lacan eventually presents a model of discursive transformation in which each modal category is capable of being shifted into another. This produces a model of discursive transformation that brings Lacan closer to Foucault than most commentators have acknowledged. The broader horizon of the argument concerns psychoanalysis and historical change, and the author argues that Foucault, Lacan, and Derrida all address the problem of history and that the relations among these thinkers deserve more attention than their polemical reception has allowed, particularly with regard to attacks on psychoanalysis as ahistorical.