Invariant (computer science)

From Wikipedia, the free encyclopedia

An invariant is a condition that does not change, or should not, if the system is working correctly.

For example, consider code in a computer program that repeatedly operates on some data. It is often the case that some data is expected to change, and some is expected to not change.

In computer science, optimizing compilers, the methodology of design by contract and formal methods pay close attention to invariant quantities in computer programs, where the set of transformations involved is the execution of the steps of the computer program.

[edit] See also


In other languages