added implementation of prefix semiring