The paper presents an architecture of the Industry 4.0 enterprise production management system based on digital twins of plant and products. The principles of creating and employing the digital twins in the course of the product life cycle are defined. We demonstrate the example structure of an integrated manufacturing automation system that includes digital twins and a number of other systems. The functions of digital twins in such a system are indicated. The domain ontology is described as a semantic basis for integrating numerous disparate models that comprise the digital twins. In order to formalize and automate a digital twin development process, we propose to apply novel mathematical methods based on category theory.