lcert_verify.builder

Reference LCERT-1 bundle builder — stdlib only.

A verifier nobody can produce input for is untestable. This module is the minimal reference producer: it emits a well-formed litholab-cert-bundle/1 directory from certificates and key/value rows you supply, using exactly the commitment spine the verifier re-derives.

It deliberately does not compute any physics. Producing a meaningful certificate — one whose legs correspond to a real manufacturability, process window, model-robustness or photon-shot guarantee — requires the certification engine, which is not part of this package. What this builder produces is a structurally valid bundle: correct manifest, Merkle root, outputs commitment and canonical JSON. That is what conformance testing needs.

def make_bundle( bundle_dir, *, gate_certs=None, kpis=None, prereg=None, seed: int = 149, payload_files=None, image_bound_certs=None, resource_floor_certs=None, interval_bound_certs=None) -> pathlib.Path:

Write a canonical bundle directory; return the path to bundle.json.

prereg is any JSON-serializable object recording what was declared before measurement; it is always copied in and manifest-covered.

def bundle_fingerprint(bundle_dir) -> str:

SHA-256 of bundle.json — the out-of-band trust anchor.

def kappa_for_budget(budget: float, lo: float = 0.0, hi: float = 40.0) -> float:

Invert 0.5*erfc(kappa) = budget by bisection, to the tolerance the verifier enforces.

The verifier does not trust a supplied kappa; it re-runs the erfc round-trip. This helper produces a kappa that survives that check.

def gate_cert( name: str, *, budget: float, safety: float, n_photons: float, thr: float, delta_dose: float, loci) -> dict:

Assemble a stochastic gate certificate record in LCERT columnar form.

loci is an iterable of (I_lo, I_hi, ae0) triples. kappa and K are derived here and re-derived by the verifier; the verdict is likewise re-derived, never supplied -- which is the entire point of the format.

def interval_bound_cert( name: str, *, quantity: str, unit: str, threshold: float, direction: str, loci, evidence: str = '') -> dict:

Assemble a domain-agnostic LCERT-BOUND-1 certificate.

loci is an iterable of (lo, hi) pairs: your outward-rounded enclosure of the quantity at each locus. direction is "below" (safe means the upper bound stays under the threshold) or "above".

The verdict is derived here and re-derived by the verifier, never supplied. Nothing about this certificate is lithography-specific; where the intervals come from is your analysis and your evidence, and this file does not and cannot compute them.