Modeling Interactive Narrative Systems: A Formal Approach