Check what the properties establish

The function always returns zero. It passes all six chosen dot-product properties in this original CPU example. It still fails a known-answer case: the required answer is 8. A consistency check between calls can pass when the calls are consistently wrong.[3][4]

The task is exact: take two integer vectors of length three and return their dot product as an integer. We use four authored functions: the correct dot product, always-zero, twice the dot product, and only the product of the first coordinates. These are designed controls, not samples from a model or an existing benchmark.[3][4]

The selected relations check additivity in either input, scaling either input, applying the same permutation to both inputs, and a zero left input. The fixture fixes x=[1, 2, 3], y=[4,-1, 2], u=[2, 0,-1], v=[-2, 3, 1], scale 3 and permutation [2, 0, 1] before execution. Every transformed input and each left/right call result is retained in the download.[3][4]

Compare all four functions

For the zero function, left additivity becomes 0=0+0. Scaling becomes 0=3×0. Permutation still returns 0 on both sides. Those equalities hold, even though the function does not perform the requested dot product. Twice-dot also preserves all six selected relations: a consistently wrong scale can satisfy this set of properties.[3][4]

The first-coordinate control shows that the relations can detect a fault. Before permutation, it returns 1×4=4. After the same permutation is applied to both vectors, it returns 3×2=6. That selected relation fails. Its other five relation checks pass. Property checks provide useful evidence; the question is what that evidence establishes.[3][4]

  • Consistency has a scope: Two related outputs can agree with each other and still be wrong for the task.

All four authored functions; 24 finite relation decisions and 8 anchor decisions. Passing these chosen relations is distinct from matching the known answer.

FunctionChosen relations passedNonzero anchor output (expected 8)Zero-input anchor (expected 0)
Correct dot6/68 — pass0 — pass
Always zero6/60 — fail0 — pass
Twice the dot6/616 — fail0 — pass
First coordinate only5/64 — fail0 — pass
  • First-coordinate fails simultaneous permutation: 6 versus 4.
  • The nonzero anchor separates these four functions only; it is not a universal correctness guarantee.

Keep known answers visible

The nonzero anchor supplies an answer independently of the candidate: 1×4+2×(-1)+3×2=4-2+6=8. The four functions return 8, 0, 16 and 4. Adding this anchor separates the correct function from the three authored wrong functions in this example. It does not establish that one anchor is enough for every possible implementation.[3][4]

The second anchor uses a zero left vector and expects 0. All four functions pass it. Zero inputs remain useful boundary cases, but this anchor cannot distinguish the functions we chose. Keep the anchor inputs and expected arithmetic visible instead of treating the presence of any known-answer test as sufficient.[3][4]

  • Show the anchor: Expected 8 comes from 1×4+2×(-1)+3×2, not from the candidate.

Preserve scope and credit

Chen and colleagues describe metamorphic testing through necessary relationships between related executions. Their original technical report and later review provide the method background. This fixture, the four functions and the observed arithmetic are our own teaching example; the cited work does not validate our experiment or imply that any real benchmark uses these checks.[1][2][3]

The standard-library program ran once on CPython 3.9.6. It retained 24 relation rows, 8 anchor rows and all 60 candidate calls. Six main outcome checks and eight selected malformed-fixture controls passed. The controls cover vector length and types, permutation identity, scale type, anchor arithmetic and missing relations. They are selected checks, not exhaustive verification.[3][4]

For a kernel-reward report, keep property consistency and known-answer correctness as separate decisions. Preserve the inputs, actual outputs and complete denominators behind both. This finite scalar example does not establish universal properties, a real grader defect, prevalence, GPU performance, security, reward improvement or training gain. The MIT package contains the exact executed source, frozen fixture/protocol and complete saved output.[3][5]

  • Record property checks and task-correctness checks separately, with every input and result available to audit.

Sources

  1. Metamorphic Testing: A Review of Challenges and Opportunities — Tsong Yueh Chen, Fei-Ching Kuo, Huai Liu, Pak-Lok Poon, Dave Towey, T.H. Tse, Zhi Quan Zhou i.cs.hku.hk
  2. Metamorphic Testing: A New Approach for Generating Next Test Cases — T.Y. Chen, S.C. Cheung, S.M. Yiu arxiv.org
  3. MIT proof and complete saved output data.nodus-compute.ai
  4. Saved result JSON data.nodus-compute.ai
  5. Source and saved-result provenance data.nodus-compute.ai
  6. Vector figure data.nodus-compute.ai