I write to tell of a disappointment I had. Perhaps people can explain to me

the rationale or the right solution.

I implemented my permutation type (I am porting GAP code and none of the

existing permutation packages quite filled my requirements). I was

pleasantly surprised that, as soon as I defined the product of 2

permutations, the power p^3 was automatically defined for a permutation p.

But I was soon disappointed: p^-2 gives an error message, even though I

defined inv( p )

I tracked this to the function power_by_squaring which raises an error

automatically on negative exponents. I think that power_by_squaring should

define p^-2 as power_by_squaring(inv( p ),2).

It would cause an incompatibility since inv is defined on integers,

yielding floats, so this would define negative powers of integers. But I

think defining inv on integers is a mistake since it makes inv

type-unstable.

What do people think?