Source: https://guthlabs.ai/docs/instruments/modular-exponentiation-calculator/implementation/

instrument implementation / implementation-contract

# Modular Exponentiation Calculator implementation

A source-bound implementation contract for Modular Exponentiation Calculator; deployment and executable qualification remain separate.

Status: **VERIFIED_CLEAN**Lifecycle: **implementation-contract**

## Binding contract

This record describes what an executable surface must bind and validate. It does not claim that a public calculator, package, or production route is deployed.

**Record owner**: Guth Instruments

**Lifecycle**: verified-clean

**Evidence ID**: t4-136

**Effect**: Computation or source lookup only

## Input and validation requirements

The specification does not define behavior for modulus 0 or define the residue convention for negative bases. Modulus 0 must be rejected, and raw JavaScript remainder semantics produce -2 for base -3, exponent 3, modulus 5 whereas the standard least-nonnegative modular result is 3.

## Required corrections

No binding erratum is attached to this unique-name record. Implementers must still preserve the declared units, domain, and failure behavior.

## Inspectable interface fixture

The sample below is evidence for interface and validation tests, not a production implementation.

````
{
  "inputs": {
    "base": 5,
    "exponent": 13,
    "modulus": 23
  },
  "expected_outputs": {
    "result": 21,
    "trace": {
      "exponent_binary": "1101",
      "squared_residues": [
        {
          "bit": 0,
          "value": 5
        },
        {
          "bit": 1,
          "value": 2
        },
        {
          "bit": 2,
          "value": 4
        },
        {
          "bit": 3,
          "value": 16
        }
      ],
      "selected_bits": [
        0,
        2,
        3
      ],
      "accumulator_values": [
        5,
        20,
        21
      ]
    }
  },
  "working": "13 = 2^3 + 2^2 + 2^0 = 1101_2. b^(2^0) mod m = 5^1 mod 23 = 5. b^(2^1) mod m = 5^2 = 25, 25 mod 23 = 2. b^(2^2) mod m = 2^2 = 4. b^(2^3) mod m = 4^2 = 16. Select bits 0, 2, and 3: accumulator = 1 × 5 = 5; then 5 × 4 = 20; then 20 × 16 = 320; 320 mod 23 = 21."
}
````

## Other records

[01**Overview**](<https://guthlabs.ai/docs/instruments/modular-exponentiation-calculator/>)[02**Mechanism**](<https://guthlabs.ai/docs/instruments/modular-exponentiation-calculator/mechanism/>)[04**Qualification**](<https://guthlabs.ai/docs/instruments/modular-exponentiation-calculator/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`
