Grassmann semialgebras and the Cayley-Hamilton theorem