Cognitive Scaffold

Preparing your thinking workspace

arrow_back_ios_new
MENTAL MODEL · M11432

Equivalence Check

Equivalence Check
StructureHigh supportLogic
Included
account_tree

Updated 2026-08-13

Loading revision record…

Summary

An equivalence check verifies that two expressions, systems, or plans produce identical outputs for identical inputs, confirming that a transformation preserved the original behavior.

Definition

An equivalence check is a verification procedure that compares two implementations, formulations, or plans and asks whether they behave identically: the same input must yield the same output, and any difference must be explained rather than ignored. Its core proposition is that a refactor, migration, or substitution is safe only when observable behavior is preserved, not merely when the new version looks correct. The key qualification is coverage, because the check is only as strong as the cases it exercises, so boundary and edge conditions must be included deliberately.

How to use

- Refactor guard: compare old and new outputs on identical inputs before deleting the original. - Migration gate: run both systems in parallel and diff their results on real traffic. - Difference triage: treat every mismatch as a defect until it is proven to be an intended change.

Mechanism

Reasoning about code or plans is unreliable because the mind fills gaps with assumptions. Executing both versions on identical inputs replaces that reasoning with observed behavior, so any divergence becomes visible. Differences then point directly to the change that caused them, which localizes errors that inspection alone would miss.

Practice

In progress 0/1

Practice this model in one real situation:

Check to track your progress (stored locally)
Learning progress0%

Cases

  • A team migrating a database replays historical queries against both the old and new systems and compares row-level results.
  • Compiler projects use differential testing, running the same programs under two implementations to expose miscompilations.

Common pitfalls

  • Using unrepresentative test cases, so the check passes while boundary differences remain undetected.
  • Declaring equivalence from a sample of outputs without a stated criterion, which turns verification into a hopeful guess.
Sources

Source support: Explicit

References currently contain only Wikipedia links; primary sources still need review.

  • link
    en.wikipedia.orghttps://en.wikipedia.org/wiki/Formal_equivalence_checkingZH · Explicit
    verified
account_treeGenealogyexpand_more

RELATED MODELS