A Mathematical Theory of Depreciation and Replacement