A Sum-Substitutor Used as Trigonometric Simplifier

A program is presented that substitutes arbitrary sums. Among other applications, this sum-substitutor has been set up to exploit the relation: $$sin^2 + \cos ^2 - 1 = 0$$ (1) which it does more intelligently than previous programs, acheaving close to maximal reduction in size (see examples below).