dag::is_dag recursive implementation done very dirty, needs some cleanup; non-recursive, two-stack implementation not working yet