Use some software model checking techniques (formal methods).