Metric Axiom Test Suite¶
Test suite — instantiates Metric-Space Specification and Validation
Runs a systematic battery over a candidate distance to verify non-negativity, identity, symmetry, and the triangle inequality — and flags scores that fail.
Before a distance function is allowed to wear the word "metric," its formal promises should be tested rather than assumed. Metric Axiom Test Suite is the automated battery that checks a candidate distance against all four metric axioms — non-negativity, the identity-of-indiscernibles rule, symmetry, and the triangle inequality — over a systematic set of sampled points, pairs, and triples, and returns a pass/fail verdict per axiom. Its defining idea is comprehensive, repeatable certification: it does not hunt for one kind of flaw but sweeps every axiom across a fixed test set, so that a metric earns its guarantees on evidence and a score that fails any axiom is explicitly demoted to a weaker category rather than smuggled through. It is a certifier, not a semantic judge; it says the promises hold, not that they mean anything useful.
Example¶
A team ships a document-retrieval feature that ranks results by "distance" defined as one minus cosine similarity over text embeddings. Someone asks whether that quantity is actually a metric — because a downstream indexing structure they want to adopt requires one. They run the test suite. It samples thousands of documents and checks each axiom: non-negativity passes, symmetry passes, identical documents get distance zero. Then it samples triples and tests the triangle inequality — and finds violations. For some triples of documents, the direct distance from A to C exceeds the sum of A-to-B and B-to-C.
The verdict is precise: this quantity satisfies three axioms but not the triangle inequality, so it is a semimetric, not a metric[n1]. That single result blocks the plan to plug it into the metric-assuming index, and it tells the team either to transform the score into a genuine metric or to choose an index that does not rely on the triangle inequality. What had been an unexamined assumption is now a documented, reproducible fact.
How it works¶
- Sample a structured test set. Draw individual points (to check non-negativity and identity), ordered pairs (to check symmetry), and triples (to check the triangle inequality), covering ordinary, boundary, and degenerate cases.
- Test each axiom independently. Every axiom gets its own assertion so a report can say precisely which promises hold and which break, rather than a single opaque pass/fail.
- Report violations with witnesses. A failure returns the specific points, pairs, or triples that broke it, so the result is diagnosable rather than a bare "false."
- Classify the result. Based on which axioms hold, the suite names what the function actually is — full metric, pseudometric, semimetric, or nonmetric score — and stamps it accordingly.
Tuning parameters¶
- Sample size and coverage — how many points, pairs, and triples are tested. More samples raise the chance of catching rare violations but cost computation, especially for triples, which grow cubically.
- Sampling strategy — uniform random versus targeted at boundary and degenerate cases. Targeted sampling finds edge-case violations a uniform sweep would miss.
- Numerical tolerance — the slack allowed before a near-miss counts as a violation, accommodating floating-point error without waving through real failures.
- Axiom strictness — whether to demand the full identity-of-indiscernibles rule or accept the weaker pseudometric condition (distinct points may have zero distance). This sets the bar the candidate must clear.
When it helps, and when it misleads¶
Its strength is preventing metric-axiom overclaim — the quiet, common error of treating a similarity score, divergence, or penalty as a metric and letting downstream systems inherit guarantees it never had. It is fast, repeatable, and definitive about the formal question, and it produces an audit record that a later reviewer can trust without re-deriving anything.
Its central limitation is that it is sampling-based and can only falsify, never fully prove: passing the suite means no violation was found, not that none exists, and a rare pathological triple can slip past a finite sample. Its deeper trap is that formal validity is silent about meaning — a distance can pass every axiom and still be domain nonsense, so a green test suite invites false confidence that the metric is good rather than merely well-formed. The classic misuse is treating axiom-passing as validation and skipping semantic checks entirely. The guarding discipline is to sample triples densely and adversarially rather than sparsely, treat a pass as "no counterexample found so far," and always pair the formal certificate with a separate check of semantic fit.
How it implements the components¶
metric_axiom_check— this is its defining function: the systematic, per-axiom verification of non-negativity, identity, symmetry, and the triangle inequality.validation_case_set— it maintains the structured battery of points, pairs, and triples the axioms are tested over, kept as a reusable regression set.nonmetric_score_boundary— on failure it explicitly names where the candidate falls short of a metric (semimetric, pseudometric, or nonmetric), drawing the boundary past which metric guarantees may not be claimed.
It does not adversarially hunt for the single worst triangle-inequality-violating triple — that focused search is Triangle-Inequality Counterexample Search, its nearest twin; the suite systematically verifies all four axioms across a fixed battery, while the search targets one axiom with an optimizer. Nor does it define the proximity_semantics_contract giving the passing distances domain meaning — that is Domain Expert Calibration Panel.
Related¶
- Instantiates: Metric-Space Specification and Validation — it supplies the archetype's formal-validity gate, certifying which axioms a candidate distance actually satisfies.
- Consumes: Triangle-Inequality Counterexample Search — a witnessed violation from the search seeds a targeted regression case in the suite's battery.
- Sibling mechanisms: Triangle-Inequality Counterexample Search · Domain Expert Calibration Panel · Graph Shortest-Path Metric · Pairwise Distance Matrix · Distance-Choice Sensitivity Analysis
Editorial Notes¶
Form Classification¶
Form family: Experiment, Test & Rehearsal
Rationale: Metric Axiom Test Suite operates as a bounded trial, probe, simulation, or rehearsal that generates evidence from performance because it runs a systematic battery over a candidate distance to verify non-negativity, identity, symmetry, and the triangle inequality — and flags scores that fail.
Independent corroboration: The frozen evidence defines Metric Axiom Test Suite as 'Runs a systematic battery over a candidate distance to verify non-negativity, identity, symmetry, and the triangle inequality — and flags scores that fail', so its operative form is Experiment, Test & Rehearsal.
Review outcome: Independent reviewer agreement; high confidence.
Origin Attribution¶
Primary origin: Mathematics
Origin pattern: Cross-disciplinary synthesis
Present-day reach: Multi-domain
Rationale: Non-negativity, identity, symmetry, and triangle inequality define mathematical metric spaces.
Related originating lineages:
- Computer Science & Software Engineering — Executable property tests turn the axioms into a systematic test suite.
Review resolution: Both independent reviews place the primary provenance in mathematics. The queued differences (alternate_origin_disagreement, origin_mode_disagreement, domain_reach_disagreement, encyclopedia_synthesis_disagreement) concern secondary metadata, not primary lineage. The final retains computer_science only where a reviewer supplied a formative-lineage rationale; downstream use or broad applicability by itself is not treated as origin. origin_mode=cross_disciplinary_synthesis because the supplied rationales identify formative contributions that are composed in the mechanism's present form. domain_reach=multi_domain records established application breadth separately from provenance. confidence=high preserves the more cautious evidence assessment. encyclopedia_synthesis=true records whether either reviewer identified deliberate corpus-level composition.
Encyclopedia synthesis: The exact catalogued form synthesizes established practice rather than reproducing a single standard historical label.
Review outcome: Reconciled after independent review; high confidence.
Notes¶
[n1] A semimetric satisfies non-negativity, identity, and symmetry but not the triangle inequality; a pseudometric satisfies the triangle inequality and symmetry but allows distinct points to have zero distance. Naming which of these a candidate actually is, rather than calling everything a "metric," is exactly the overclaim the suite exists to prevent. ↩