Deductive Approach for Programming Sensor Networks