Connected-sum gluing of functions (source code)

= Connected-sum gluing of functions

Remove small <disks> around a nondegenerate maximum of a <smooth function> on one closed <surface> and a nondegenerate minimum on another. Rescale their values so the boundary values agree with the two ends of a neck. Their regular level collars allow a strictly monotone function on the neck, with nonzero derivative, matching smoothly to both sides. The resulting <connected sum> has all the old <critical points> except the deleted maximum and minimum. This permits one degenerate <torus> saddle to be retained while adding ordinary <handles> for higher genus.