Source: https://guthlabs.ai/docs/instruments/primality-tester/mechanism/

instrument mechanism / verified-clean

# Primality Tester mechanism

The inspectable method record for Primality Tester, kept separate from implementation and qualification.

Status: **VERIFIED_CLEAN**Lifecycle: **verified-clean**

## Model scope

The core mathematical claims are standard, but the instrument is not fully verifiable as specified. Define exact Miller-Rabin bases or rounds, confidence semantics, integer-square-root behavior, n < 2 handling, and factor-list semantics before release.

- Trial division through floor(sqrt(n)) is correct for integers n >= 2, but the specification must explicitly define the divisor sequence and the handling of n < 2. Testing only odd divisors after 2 is an equivalent optimization.

- Miller-Rabin is correctly identified as a probabilistic primality test, but the specification omits the number of rounds, selected bases, random-base generation, and the exact confidence calculation.

- For supported bounded ranges, Miller-Rabin can be deterministic with a prescribed base set; without such a base set, a reported confidence must not be presented as a proof of primality.

- The factor-list formula is unspecified: it does not define whether to return the first factor, distinct factors, repeated factors with multiplicity, or only factors found during a separate bounded scan.

## Units and conventions

- The input is a mathematical integer represented exactly as a BigInt; no floating-point conversion is permitted.

- sqrt(n) means the exact integer floor square root, floor(sqrt(n)); floating-point square-root results must not determine correctness for large BigInt values.

- Primality is defined only for n >= 2. Zero, one, and negative integers are neither prime nor composite.

- The confidence value is not meaningful for deterministic trial division; for Miller-Rabin it depends on independent random bases or a declared deterministic base set and must be explicitly defined.

## Inspectable vector

One of 4 source-bound review vectors:

````
{
  "inputs": {
    "n": "29",
    "method": "trial_division"
  },
  "expected_outputs": {
    "verdict": "prime",
    "confidence": "exact (100%)",
    "small_factors": []
  },
  "working": "floor(sqrt(29)) = 5 because 5^2 = 25 and 6^2 = 36. Test divisors 2, 3, and 5: 29 mod 2 = 1, 29 mod 3 = 2, and 29 mod 5 = 4. No divisor is found through 5, so 29 is prime. Factor list = []."
}
````

## Failure boundary

**BREAK_CLAIMED** · SELF_FLAGGED

The mathematical checks have clear expected behavior, but the specification leaves the Miller-Rabin/trial-division cutover and negative-integer convention unspecified. An implementation could route boundary-sized values inconsistently, return an undefined result for negative inputs, or silently test the absolute value of a negative input.

## Other records

[01**Overview**](<https://guthlabs.ai/docs/instruments/primality-tester/>)[03**Implementation**](<https://guthlabs.ai/docs/instruments/primality-tester/implementation/>)[04**Qualification**](<https://guthlabs.ai/docs/instruments/primality-tester/qualification/>)

## Sources and evidence

These pointers bind the page to evidence. They do not grant authority or collapse verification into deployment.

- `VERIFIED_LEDGER.json`

- `evidence-tranche4/tranche4-results.json`

- `BOUNDARY_HAZARD_CATALOG.json`
