Context awareness is one of the key characteristics of ubiquitous and pervasive computing. Most current formalism works focus on two aspects: context representing and system modeling. However, how the temporal property of context can be modeled and how context can be manipulated are not well addressed. This paper proposes a formal way based on set theory for modeling and manipulating context, in which a context is defined as a set of context entries and operators are introduced to specify how to manipulate contexts in according to the needs of different applications. To show the usability of the proposed model, a demo implementation is also included in this paper.