Torsors for monoids 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.
 A: There is a notion of torsor for monoids in the book Sheaves in Geometry and Logic by MacLane and Moerdijk.  Roughly speaking it is an action of the monoid on a set such that the associated category of elements is filtering.  An alternative definition, which also applies to actions by partial functions, is given in the paper of Funk and Hofstra at http://www.tac.mta.ca/tac/volumes/24/6/24-06abs.html
A: A reasonable definition would be the following:
Given a topological monoid $M$, consider the strict 2-functor from topological spaces to the 2-category of small categories:
$y(M):T \mapsto Hom(T^{id},M)$
which assigns a space $T$ the category whose objects are continuous functors from $T$ (considered as a topological category with only identity arrows) to $M$, and whose arrows are continuous natural transformations. Note that $Hom(T^{id},M)$ can only have one objects as the object space of $M$ is terminal. In fact, $Hom(T^{id},M)$ is the monoid $\coprod_{t \in T} M$.
Any such continuous functor is a (rather trivial) torsor. To get all torsors, you need to "stackify" the 2-functor $y(M)$ to get a "sheaf of categories". So let $Tor(M)$ denote this stackification. Then we have that $Tor(M)(T)$ is 2-categorical colimit of the categories $Hom(S_U,y(M))$, over covering sieves $S_U$ of $T$. Concretely, this amounts to taking the colimit over all covers $U$ of $T$ of the categories $Hom(T_U,M)$, where $T_U$ is the Cech-groupoid associated to the cover $U$ of $T$. However,since $T_U$ is a groupoid, ever arrow is invertible, so any such functor will factor through the inclusion of the invertible elements $M^{\times} \to M$. So, in this sense, you will only recover the notion of a principal $M^{\times}$-bundle over $T$. However, it appears the the CATEGORY Tor(M)(T) will be different than $Bun_{M^{\times}}(T)$, in much the same way that although any functor $T \to M$ factors (rather trivially) through $M^{\times}$, the two categories $Hom(T^{id},M)$ and $Hom(T^{id},M^{\times})$ are different (one is a monoid and one is a group).
So it depends what you want to do with these torsors. In some sense, they are the same as principal bundles for the underlying group $M^{\times}$, but not really, since they have different morphisms.
A: One common definition of torsor under a group $G$ is a (Edit: nonempty) set $X$ together with an action $act: G \times X \to X$, such that the map $(act,id): G \times X \to X \times X$ is a bijection of sets.  The definition is still meaningful if you replace "group" with "monoid".
Edit: As Torsten has pointed out, replacing "group" with "monoid" doesn't give you any additional generality, since the bijection endows $G$ with inverses.  We can instead ask that the map $(act,id)$ be injective.  No, that doesn't specialize correctly to the setting of groups.  I think I'll quit while I'm behind, and let this stand as a cautionary tale for others.
Allowing $X$ to be empty yields a notion of pseudotorsor, which seems kind of useless in a bare set-theoretic context.  It seems to come up in algebraic geometry, though.
A: 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. 
