Added the theorem about substituting functions with their theta functions