I am conducting numerical experiments involving the Gröbner–Shirshov Basis for restricted Lie algebras. At each step of the computation, I need to work with restricted Lie polynomials. Specifically, I am looking for an efficient method, ideally a computer program, to express a restricted Lie polynomial as a linear combination of $p$-basic monomials, as described in Section 2.7.1 of Yuri Bahturin's book Identical Relations in Lie Algebras.
To clarify, the space of free Lie polynomials is spanned by Lie polynomials associated with nonassociative Lyndon-Shirshov words, which form a $ \mathbb{Z} $-basis. For a natural number $ n = m p^t $ with $ (m, p) = 1 $, the space of restricted Lie polynomials of degree $ n $ has a basis given by the set $ \{ w^{[p^r]} \mid 0 \leq r \leq t \} $. Here, $ w $ is a Lie polynomial associated with a nonassociative Lyndon-Shirshov word of length $ m p^{t - r} $, and the $ w^{[p^r]} $ are referred to as $ p $-basic monomials.
Any guidance, including relevant software or computational techniques, would be greatly appreciated.
Thank you in advance!