TITLE: Torsors for monoids
QUESTION [6 upvotes]: Torsors are defined as a special kind of group action. I am wondering whether the analogous notion exists for monoid actions. Some references would be helpful.
In general I'm interesting in the notion of 'subtraction/division' induced by having a torsor. My application is in computer science. A monoid is used to capture modifications to a computer program and the monoid action corresponds to performing the modification on the program. If I have a torsor-like entity, I can take two software entities and produce the modification required to convert one into the other.
The answer is that any such monoid will automatically be a group. In my application, it seems that I will only get close to the notion of torsor if my modifications have inverses, which they do not.

REPLY [9 votes]: This will be an expansion on Ben Steinberg's answer (which unfortunately I saw only after I was in the middle of compiling this answer). 
For a group $G$, another point of view on $G$-torsors is that they are classified by $BG$, which here denotes the topos of $G$-sets $Set^G$. (This should resonate with the meaning of the classifying space $BG$ in algebraic topology, which classifies $G$-principal bundles.) The meaning of this in topos theory is that geometric morphisms $Set \to Set^G$ ("points" of $BG$) are equivalent to torsors over $G$, and more generally that a $G$-torsor as interpreted in any topos $E$ (not just $Set$) is equivalent to a geometric morphism $E \to Set^G$. 
Equivalently, left exact left adjoints $Set^G \to Set$ are equivalent to torsors; by a result known as Diaconescu's theorem (see Mac Lane and Moerdijk's book on topos theory), these in turn are equivalent to flat functors $G \to Set$, i.e., a torsor as $G$-set is essentially the same as a filtered colimit of copies of the representable $G$-set. 
We could if we like expand the meaning of "torsor" by adopting this as a definition: if $C$ is a category, then a $C$-torsor is a functor $C \to Set$ obtained as a filtered colimit of representables $\hom_C(c, -): C \to Set$. 
I realize this may seem highly abstract, so it's worth seeing what this means for a monoid and bringing this back down to earth. As an example, consider the monoid $\mathbb{N}$. We are trying to understand filtered colimits of copies of $\mathbb{N}$ as $\mathbb{N}$-sets. An example is the colimit of the filtered diagram 
$$\mathbb{N} \stackrel{s}{\to} \mathbb{N} \stackrel{s}{\to} \ldots$$ 
where $s$ is the successor function. Here the colimit is $\mathbb{Z}$ with the "standard" action $\mathbb{N} \times \mathbb{Z} \to \mathbb{Z}$ given by addition. This is isomorphic to the "non-standard" action $\mathbb{N} \times \mathbb{Z} \to \mathbb{Z}$ given by subtraction, $(n, m) \mapsto -n+m$. 
For commutative monoids at least, I think this is a somewhat typical example: filtered colimits of copies of the representable are isomorphic to those obtained by formally inverting some set of elements. (Cf. the fact that localizations of commutative rings are flat.) I am less sure about the general case of non-commutative monoids.