Adding utility functions for detecting and manipulating branches.

This PR pulls out some of the helper routines from the specialized_branched_loops code in PR #482 and provides some correctness testing for these visitors and mutators. These functions might be useful in other contexts, but the main reason for pulling them out into their own file is to help the readability of the specialize_branched_loops code, and make it easier to test them independently.
I see your point, and for this visitor I think it would be possible to convert it to use this method. The main problem is the `Scope<Expr>` that is passed in, whose entries would not have been analyzed. To get around this I could change the way this visitor is used so that you pass it a `Scope<int>` (or `Scope<T>`) of variables that depend on the variable of interest. 

However, I can't quite see how this same approach would work with the linear solver, which is the other case where the `Scope<Expr>` that I am collecting in the `specialize_branched_loops` stuff gets used. In fact I have found a bug in this code, where this visitor (`BranchesInVar`) should actually only return true if the branch condition is linear in the variable, so I am going to have to modify it to use the linear solver to detect if the condition exprs are actually linear in the variable. Of course, I could do something similar to what you suggest and analyze bound variables for a linear dependence on the variable of interest.

But eventually I do actually solve the linear equations and need the full exprs bound to each variable in the equation. So the question is whether it is worth having to track multiple scopes, e.g. one to store the variables that depend linearly on the variable of interest and another to store the actual exprs bound to each variable.

Another way around this problem would be to provide a way to iterate over a scope in the stack order (or probably reverse stack order), rather than just via the map iterator. That way I could analyze incoming `Scope<Expr>` objects and build the tracking scope.