A Formal Approach to Modeling the Memory of a Living Organism