Binary Decision Diagrams: Theory and Implementation