Program equivalence

from Wikipedia, the free encyclopedia

Program equivalency means that two computer programs (or two algorithms ) calculate the same function . This means that both programs always deliver the same output for the same input or that they accept the same language :

as a function: P 1 (E) = A if and only if P 2 (E) = A
as language: E ∈ L (P 1 ) if and only if E ∈ L (P 2 ) i.e. L (P 1 ) = L (P 2 )

The equivalence of two programs is of central importance in theoretical computer science , especially for formal semantics , complexity theory, and computability theory . However, it is generally not possible to decide for any two programs whether they are equivalent. This follows from Rice's theorem .