The notation of program invariant based on the contract is described, and a theory model of dynamically generating technique of program invariant is researched and built. This document gives a theory model and the main process ofthe technology ofdynamically discovering program invariants which based on the contract and shows the technology of dynamically discovering functional dependence program invariants combined with Java program language..A main method to the problems is discussed. Programmers can analyze the associate-attributes in the program and achieve the detecting of the invariants b...