Dynamic Invariant Detection for Program Understanding and Reliability