Demo: Binary Search
Here is an interesting video showing how to derive binary search in a fancy programming environment: