It would be useful to be able to infer whether or not an expression is pure - even in languages with rampant side-effectfulness and mutability, such as JavaScript. Here's my ad-hoc thoughts on how it might be achieved.
A pure expression is denoted as P -> x - that is, an expression that evaluates to x deterministically. A non pure expression that mutates a value is M[y] -> x, where M is the 'type', y is the mutated value, and x is the return value.
An expression made up of pure expressions is pure