We propose a mathematical model of economic agents to study origin of money. This multi-agent model is based on commodity theory of money, which says that a commodity used as money emerges from barter transaction. Each agent has a different value system which is given by a Heyting algebra, and exchanges one's commodities based on the value system. In each value system, necessity and unnecessity of commodities are expressed by some elements and their compliments on a Heyting Algebra. Moreover, the concept of the compliment is extended. Consequently, the duality of the necessity-unnecessity is weakened, and the exchanges of the commodities are promoted. The commodities which keeps being exchanged for a long time can correspond to money.