Programming Distributed Applications with Symbolic Reasoning on WSNs