Guth
NewsDocs
Page actions
View as Markdown ↗
Explore MCP tools ↗

instrument implementation / implementation-contract

Binary Search / Sorted-Array Step Visualizer implementation

A source-bound implementation contract for Binary Search / Sorted-Array Step Visualizer; deployment and executable qualification remain separate.

Status: VERIFIED_CLEANLifecycle: 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
t6-082
Effect
Computation or source lookup only

Input and validation requirements

The exact N=1 boundary exposes a mismatch between the stated estimate ceil(log2(N))=0 and the actual required comparison count of 1. N=0 also produces an undefined log2(0) result and must be rejected. Midpoint rounding is unspecified for even-length intervals, and floor versus ceil changes the trace and comparison count.

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": {
    "array": [
      2,
      5,
      8,
      12,
      16,
      21,
      30
    ],
    "target": 16,
    "mid_rule": "floor(lo+(hi-lo)/2)",
    "comparison_counting": "one midpoint inspection",
    "linear_baseline": "left-to-right"
  },
  "expected_outputs": {
    "trace": [
      {
        "step": 1,
        "lo": 0,
        "hi": 6,
        "mid": 3,
        "value": 12,
        "result": "target greater; set lo=4"
      },
      {
        "step": 2,
        "lo": 4,
        "hi": 6,
        "mid": 5,
        "value": 21,
        "result": "target smaller; set hi=4"
      },
      {
        "step": 3,
        "lo": 4,
        "hi": 4,
        "mid": 4,
        "value": 16,
        "result": "found"
      }
    ],
    "index": 4,
    "binary_comparisons": 3,
    "linear_comparisons": 5,
    "claimed_ceil_log2_n": 3
  },
  "working": "n=7. Step 1: mid=floor(0+(6-0)/2)=floor(3)=3; array[3]=12, and 16>12, so lo=4. Step 2: mid=floor(4+(6-4)/2)=floor(5)=5; array[5]=21, and 16<21, so hi=4. Step 3: mid=floor(4+(4-4)/2)=4; array[4]=16, so found at index 4. Binary comparisons=3. Linear search inspects 2, 5, 8, 12, 16: 5 comparisons. ceil(log2(7))=ceil(2.8073549...)=3."
}

Other records

Sources and evidence

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

  • VERIFIED_LEDGER.json
  • evidence-tranche6/tranche6-results.json