Let n be a positive integer and M a set of rational n×n-matrices such that M generates a finite multiplicative semigroup.
We show that any matrix in the semigroup is a product of matrices in M whose length is at most 2n(2n+3)g(n)n+1∈2O(n2logn),
where g(n) is the maximum order of finite groups over rational n×n-matrices. This result implies algorithms with an elementary running time for
deciding finiteness of weighted automata over the rationals and for deciding
reachability in affine integer vector addition systems with states with the
finite monoid property