Makes it possible to custom define inverses on only one side

This also adds a cache to inverseFor
Refactor inverseFor cache