Invariants
Invariants are specific conditions or mathematical properties that must remain true throughout the entire lifecycle of a smart contract. In the context of DeFi, an invariant might be that the total value of assets in a liquidity pool must always equal the sum of its parts, or that a user's debt must never exceed their collateral value.
Formal verification tools focus on proving that these invariants cannot be violated by any sequence of user actions. When an invariant is broken, it usually signals a critical bug or an active attack.
Defining robust invariants is the first step in creating secure financial logic, as they serve as the boundary conditions for all system operations. By strictly enforcing these properties, developers ensure that the protocol maintains its economic integrity under adversarial conditions.