Knowledge Compilation in the Modal Logic S5