In mathematics, demonic composition is an operation on binary relations that is somewhat comparable to ordinary composition of relations but is robust to refinement of the relations into (partial) functions or injective relations.
Unlike ordinary composition of relations, demonic composition is not associative.
Suppose R is a binary relation between X and Y and S is a relation between Y and Z. Their right demonic composition R ;→ S is a relation between X and Z. Its graph is defined as
Conversely, their left demonic composition R ;← S is defined by