---
library: "bootstrap"
slug: "Compare"
name: "Compare"
ref: "Compare#15a0"
hash: "sema:Compare#mh:SHA-256:15a079e73bd3c280efbe2b35ab4b082b2302ab65e5dd5eb1c4fba1a5f554cebe"
type: "Primitives"
layer: "Infrastructure"
version: "0.11.0"
root: "a6a3d1ff0f982ee30430c5b42f3784c8ec901fd68482cfc1bc30899c1e5e48c5"
license: null
url: "https://semahash.org/vocabularies/bootstrap/patterns/Compare"
---

# Compare

Relational check

Infrastructure · Primitives

## Mechanism

Evaluate relation between two values: Equal, Less, Greater, Incomparable.

## Invariants

- Single outcome: Compare(A, B) returns exactly one of Equal, Less, Greater, or Incomparable.
- Reflexive: A equals A.
- Operand reversal: Compare(B, A) preserves Equal and Incomparable, and swaps Less with Greater.
- Exact equality is transitive; a tolerance-based Equal does not carry this guarantee.

## Failure modes

- Tolerance chaining: under near-equality A≈B and B≈C without A≈C, so grouping by equality becomes order-dependent.
- Undeclared coercion: values are converted by a rule the comparator did not declare, producing Equal, Less, or Greater where its declared relation would return Incomparable.

## Where this came from

—

## Used by

- [ParetoFront](https://semahash.org/vocabularies/bootstrap/patterns/ParetoFront.md) (composes_with)
- [TranslationProxy](https://semahash.org/vocabularies/bootstrap/patterns/TranslationProxy.md) (references)
- [Webtrace](https://semahash.org/vocabularies/bootstrap/patterns/Webtrace.md) (references)

## Related

- [Webtrace](https://semahash.org/vocabularies/bootstrap/patterns/Webtrace.md)

## Identity

- Library: bootstrap 0.11.0 (root a6a3d1ff0f98)
- Ref: Compare#15a0
- Hash: sema:Compare#mh:SHA-256:15a079e73bd3c280efbe2b35ab4b082b2302ab65e5dd5eb1c4fba1a5f554cebe

## Links

- Page: https://semahash.org/vocabularies/bootstrap/patterns/Compare
- JSON: https://semahash.org/vocabularies/bootstrap/patterns/Compare.json
- Library: https://semahash.org/vocabularies/bootstrap
- Library index: https://semahash.org/vocabularies/bootstrap/index.json
