This book presents a systematic treatment of Gr bner bases in several contexts. The book builds up to the theory of Gr bner bases for operads due to the second author and Khoroshkin as well as various applications of the corresponding diamond lemmas in algebra. Throughout the book, both the mathematical theory and computational methods ar