Resilient TDMA-based Communication Algorithm for Dynamic Ad-hoc Networks and Formal Verification