Generalized Template Splay: A Basic Theory and Calculus