Bounded typed values after measurement
Negotiate immutable Int, Float, fixed arrays, explicit measurement conversions, deterministic runtime evidence, and fail-closed numeric bounds.
Typed classical values at the quantum boundary
NM-RFC-0005 makes post-measurement aggregation explicit and bounded. Stable N/M 0.1 Bit behavior stays unchanged until every surface negotiates the feature.
NM-RFC-0005experimental0.2.0-runtime-experimentalImmutable scalar values
Int is a safe integer and Float is finite and bounded. Numeric widening is explicit, so a sampled Bit cannot silently enter arithmetic.
let ratio: Float = int_to_float(count) / 3.0;Fixed bounded arrays
Array<Bit|Int|Float, N> fixes its element type and 1..256 length in source. Indexes are compile-time literals and are checked before execution.
let bits: Array<Bit, 3> = [a, b, c];Safe measurement helpers
bit_to_int, bits_to_int, count_ones, int_to_float, and mean cover the first deterministic aggregation boundary without general-purpose mutable state.
bit_to_int · int_to_float · bits_to_int · count_ones · mean · sin · cos · sqrt · exp · log · log1p · expm1 · tanh · sigmoid · abs · floor · ceil · round · min · max · clamp · sum · dot · norm · add · sub · scale · variance · stddev · argmin · argmax · radians · degrees · to_radians · to_degreesOrdered runtime evidence
Core and Worker expose the same ordered name, canonical type, value, and source-line evidence. Missing values and invalid arithmetic fail closed.
deterministic-fail-closed-with-ordered-evidenceMeasurement aggregation example
1module typed_measurement_summary;2@seed(17);3 4fn main() {5 let q: QReg<3> = qreg[3];6 H(q[0]);7 CNOT(q[0], q[1]);8 let a: Bit = measure(q[0]);9 let b: Bit = measure(q[1]);10 let c: Bit = measure(q[2]);11 let outcomes: Array<Bit, 3> = [a, b, c];12 let encoded: Int = bits_to_int(outcomes);13 let ones: Int = count_ones(outcomes);14 let ratio: Float = int_to_float(ones) / 3.0;15 return encoded;16}Explicit surface negotiation
parseNMCode(source, { experimental: { typedClassicalValues: true } })nm run main.nm --experimental-typed-classical-values --jsoninitializationOptions.nm.experimental.typedClassicalValues = truenm.experimental.typedClassicalValues = trueStable diagnostics
NM-PARSE-062NM-PARSE-063NM-TYPE-023NM-TYPE-024NM-RUNTIME-032The first contract excludes mutation, dynamic indexes, nested arrays, arbitrary classical functions, implicit casts, and branch-sensitive result inference. NM-RFC-0007 adds structured main results only when separately negotiated.