Iterative Synthesis of Threshold Functions