# Bounded Harmonic Pair Results

Date: 2026-10-29 (America/Los_Angeles).
Status: scoped gate PASS. Targeted, real-data, kahler, default and example gates complete.
Uncommitted and not deployed.

## What now exists

`POST /v1/bundles/{name}/brain/harmonic_conjugate` (kahler feature) takes a
complete real polynomial field and the conjugate's value at the center. One
returned polynomial contains the real harmonic component, its recovered
harmonic conjugate, holomorphicity, a full-complex bound and both derivatives.
The implementation is general purpose, with no wine/power/data-specific branches.

The earlier `/brain/holomorphic` interpolator remains available. That endpoint
starts from incomplete complex observations and returns a compatible function
and marginal value disks. This endpoint instead starts from a complete REAL
polynomial, checks harmonic compatibility, and recovers the conjugate uniquely
after its additive imaginary constant is fixed. These are different contracts.

Implementation: `src/geometry/harmonic_conjugate.rs`; HTTP boundary and shared
measurement checks: `src/bin/gigi_stream_handlers/holomorphic.rs`.
Specification: `docs/HARMONIC_CONJUGATE_SPEC.md`. Full schema: `openapi.json`.

## Small worked case

Store these two records in a bundle with numeric fiber fields xp, yp and
coefficient, and base key id:

```json
[
  {"id": 0, "xp": 2, "yp": 0, "coefficient": 1},
  {"id": 1, "xp": 0, "yp": 2, "coefficient": -1}
]
```

They describe `u(x,y)=x^2-y^2` ("you of ex, why equals ex squared minus why
squared"). The generic endpoint request is:

```json
{
  "power_fields": ["xp", "yp"],
  "coefficient_field": "coefficient",
  "conjugate_at_center": 0,
  "bound": 1.01,
  "queries": [[0.2, 0.3]]
}
```

It recovers `v(x,y)=2xy` ("vee of ex, why equals two ex why") and
`f(z)=z^2` ("eff of zee equals zee squared"). At the query point, the complex
value is approximately [-0.05, 0.12], first derivative [0.4, 0.6], second
derivative [2, 0]. These values and signs are covered by executable gates.
Changing the second coefficient to +1 produces a non-harmonic field and no
function object. A larger imaginary center constant can violate the complex
bound even when the real field is unchanged.

## Test receipts

All logs below are in `output/harmonic-conjugate/`.

| Gate | Result |
| --- | --- |
| Compiling mathematical stub | `red-math.log`: 10 behavioral failures |
| Compiling HTTP stub | `red-http.log`: 2 behavioral failures |
| Targeted mathematical restoration | `green-math.log`: 10 pass |
| Initial HTTP/shared-boundary run | `green-http.log`: 7 pass, before the additional recreation test |
| Harmonicity validation removed | `mutant-harmonicity.log`: non-harmonic input incorrectly accepted; gate fails |
| Whole-boundary correction removed | `mutant-global-bound.log`: inter-sample excess incorrectly accepted; gate fails |
| Both intentional mutants restored | Restored before full regression and live build |
| Full kahler suite | `all-targets-kahler.log`: 2,092 passed, 0 failed, 23 pre-existing ignored (including doctests) |
| Full default suite | `all-targets-default.log`: 1,580 passed, 0 failed, 22 pre-existing ignored (including doctests) |
| Example targets, with and without kahler | All 3 targets compile/run in each configuration; they define no unit tests |
| Live real-data acceptance | PASS, 17/17 fields, all controls |

There are 13 new tests: 10 mathematical and 3 HTTP. The restored full kahler
run includes all of them and the earlier holomorphic endpoint's five HTTP
tests. Ignored items are not counted as passes or repaired here: 19 pre-existing
regular exclusions plus four kahler/three default doctest exclusions. Other
optional feature combinations, such as halcyon, were not enabled in this gate.

Additional HTTP coverage includes JSON/DHOOM equality, provenance, missing and
unknown fields, nulls/timestamps/nonrepresentable integers, fractional/negative
powers, encrypted fields in all five modes, same-size mutation, deletion, and
recreation at the same revision. Shared validators keep the earlier endpoint's
measurement contract intact. No result cache is introduced.

## Large real-data case

The same schema-driven code ran on all 6,497 UCI Wine Quality records and all
9,568 original Combined Cycle Power Plant records: 16,065 records, 17 measured
numeric fields, no hand-selected subset. The 32-bin empirical generating
polynomial is a declared analytic fingerprint of each field's distribution.
Only its REAL polynomial coefficients are sent to the new endpoint. Original
records, bin edges/counts and source hashes are retained for traceability.

Integer-count polynomial coefficients avoid independently rounding probabilities
across the expanded monomials. Both coefficients and the requested bound are
scaled by record count; the normalized bound stays 1.01. This numerical
representation was specified before the live gate, not tuned to its results.

The independent oracle evaluates the full empirical polynomial using direct
powers, rather than production's simultaneous Horner recurrence. It tests 48
unseen interior points per field, both derivatives, and 2,048 boundary points.
The boundary grid is an oracle check, NOT the implementation's bound proof:
production uses a coefficient triangle bound or a mesh PLUS global derivative
correction, with a disclosed numerical allowance.

| Measurement | Result |
| --- | --- |
| Fields accepted | 17/17 |
| Unseen complex values | 816/816 agree; both derivatives also agree |
| Maximum normalized value/derivative error | 2.27485e-14, against required <=1e-8 |
| Worst recovered-imaginary RMSE | 4.23040e-17 |
| Best zero-imaginary baseline RMSE | 0.00524894; every field exceeds the required 100x improvement |
| Coefficient reconstruction residual | Zero on every field |
| Normalized coefficient-Laplacian residual | Zero on every field |
| Real monomial terms supplied | 3,227 total |
| Returned complex coefficients | 544 total (32 per field) |
| Maximum observed request time | 31.21 ms in a debug build; not a production benchmark |
| Non-harmonic edit and restoration | PASS |
| Same-size coherent source change | PASS |
| Imaginary-normalization bound violation | PASS |
| Restart over every field | PASS |

The smaller polynomial representation is not a database/wire-compression ratio:
responses also retain evidence. Histogram binning is lossy. The held-out values
are implied by the complete supplied real field, not new physical observations
being predicted. No statistical calibration or recovery of arbitrary facts is
claimed. Raw wine chemistry and turbine physics are not declared holomorphic.

### Transport finding

The initial live probe used exact equality for echoed floating query coordinates.
It stopped at a 1.38778e-17 difference through the existing JSON round trip.
`live-query-red.log` and `query-red/real-data-report.json` preserve that failure.
The harness now reports and checks coordinate drift <=1e-15; the maximum was
5.55112e-17. The solver, query set and predeclared 1e-8 value/derivative gates
were NOT changed. The oracle still evaluates the originally requested points.
This does not claim JSON float round trips are bit-identical.

## Sources and reproduction

Sources and original pinned SHA-256 digests:

- [UCI Wine Quality](https://archive.ics.uci.edu/dataset/186/wine+quality),
  Cortez et al. (2009), DOI 10.24432/C56S3T, CC BY 4.0:
  `3ed56667f4b828242bd732d7d1dd7f2861e54432239d7fa63877014cbb0304d4`.
- [UCI Combined Cycle Power Plant](https://archive.ics.uci.edu/dataset/294/combined+cycle+power+plant),
  Tufekci and Kaya (2014), DOI 10.24432/C5002N, CC BY 4.0:
  `cc7b2a4977c0a44e8221c91d9a7e5746b3c68186cff7e5c61c70af6432b98c7a`.

```powershell
cargo test --features kahler
cargo test -j 2
cargo test --examples --features kahler
cargo test --examples
cargo build --features kahler --bin gigi-stream
python e2e/probes/harmonic_conjugate_real_data.py --binary target/debug/gigi-stream.exe
```

The live build and owned executable copy had matching SHA-256:
`a2441626d439879346171ff4f58ab92ef0a730eabf0d1170566809c7875d34c4`.
Build mtime: 2026-10-30 00:45:21 UTC (2026-10-29 local).
`real-data-report.json` contains the per-field measurements and binary identity.
The harness uses its own temporary database/process, 127.0.0.1, strips production
environment settings from the child, and stops the child even on failure.
The user's pre-existing release engine was not restarted or modified.

## Limits

One complex variable, unit disk, complete real polynomial degree <=32, 1..561
monomials, <=256 queries. No inference of harmonicity from scattered real
samples, general-domain/annulus support, chart gluing, noise fitting, or Marcella
integration. Near-bound or near-harmonic numerical ambiguity is unresolved,
never silently projected. The returned analytic representation and numerical
evidence are not a formal exact-arithmetic certificate for the measured input.
