Getting Started With ZeroProofML
ZeroProofML models singularities as an explicit bottom value, ⊥, and carries that decision through training, inference, export, and monitoring with masks instead of hidden guard branches.
Use this page to install the package, run the smallest examples, and choose the right next guide.
Installation
Create a virtual environment and install the backend you plan to use:
python -m venv .venv
source .venv/bin/activate
pip install "zeroproofml[torch]"
Optional extras:
pip install "zeroproofml[jax]"
pip install "zeroproofml[viz]"
pip install "zeroproofml[interactive]"
For a source checkout:
pip install -e ".[dev,torch]"
zeroproofml.* is the canonical public namespace for v0.6.0 docs and examples. The older zeroproof.* namespace remains a supported compatibility import path through the roadmap's next major milestone, so existing integrations do not need an immediate rename.
For paper-exact reproduction, keep using the v0.4.3 release tag or zeroproofml==0.4.3. v0.6.x is the active development line.
First SCM Values
Scalar SCM helpers are useful for notebooks, tests, and explaining semantics:
from zeroproofml.scm.ops import scm_add, scm_div
from zeroproofml.scm.value import scm_bottom, scm_real
x = scm_real(3.0)
zero = scm_real(0.0)
print(scm_div(x, zero)) # SCMValue(⊥)
print(scm_add(scm_bottom(), x)) # SCMValue(⊥)
The important rule is simple: once a computation reaches ⊥, the bottom value is absorptive.
Tensor Workflows
Arrays and tensors do not store ⊥ in the payload. They use a pair:
payload: ordinary numeric valuesbottom_mask: boolean mask whereTruemeans the sample is bottom
Example with NumPy vectorized SCM division:
import numpy as np
from zeroproofml.scm.ops import scm_div_numpy
num = np.array([1.0, 2.0, 3.0])
num_mask = np.array([False, False, False])
den = np.array([1.0, 0.0, 2.0])
den_mask = np.array([False, False, False])
payload, bottom_mask = scm_div_numpy(num, den, num_mask, den_mask)
assert bottom_mask.tolist() == [False, True, False]
Treat the mask as authoritative. Payload values where bottom_mask=True are implementation details and should not drive losses, metrics, or decisions.
Two Modes
ZeroProofML uses two complementary modes:
| Mode | Use it for | Contract |
|---|---|---|
| Strict SCM | Inference, validation, deployment, monitoring | Decode (P, Q) and emit ⊥ when ` |
| Projective training | Learning rational heads near poles | Train on smooth homogeneous tuples (P, Q), then decode strictly at the boundary |
The guiding rule is:
Train on smooth projective or policy-regularized objects. Infer with strict SCM semantics.
Minimal Strict Inference
from zeroproofml.inference import InferenceConfig, strict_inference
cfg = InferenceConfig(tau_infer=1e-6, tau_train=1e-4)
result = strict_inference(P, Q, config=cfg)
decoded, bottom_mask, gap_mask = result
fault_mask = result.fault_mask
semantic_bottom_mask = result.semantic_bottom_mask
bottom_provenance = result.bottom_provenance
The stable three-field tuple is always:
decoded: finite decoded payload when acceptedbottom_mask: authoritative reject/fallback mask, withbottom_mask == fault_mask | semantic_bottom_maskgap_mask: finite but near-threshold samples wheretau_infer <= |Q| < tau_train
The eager result object also carries stable provenance detail:
fault_mask: non-finiteP/Qpayload or non-finite validity factorsemantic_bottom_mask: finite denominator triggered a strict thresholdbottom_provenance: integer codes (NONE,FAULT,SEMANTIC,MIXED)
gap_mask is for monitoring and conservative routing. It is not another kind of bottom.
Promoted Examples
When you have the library checkout, start with these maintained examples:
python examples/01_quickstart.py
python examples/02_rational_layer.py
python examples/03_projective_mode.py
python examples/05_coverage_control.py
python examples/06_export_bundle.py
python examples/fru_strict_check_demo.py
They cover scalar SCM values, rational layers, projective heads, coverage-aware training, ONNX bundle export, and flattened strict checks for composed rational heads.
What Changed In v0.6.0
- Bottom provenance is stable:
fault_mask,semantic_bottom_mask, andbottom_provenanceare now guaranteed result attributes, not experimental opt-ins. - Non-finite
P,Q, and validity factors fail closed tofault_mask; censored direction must come from a finite side channel, not IEEE+inf/-inf. - Fracterm/FRU flattening exposes a public
SimplificationMode.simplification_mode="field_rational"is an explicit unsafe opt-in; strict is the default. - Projective gauge conventions are named:
GaugePolicy(canonical_denominator,unit_l2_projective,angular_unit_circle) plus the opt-inProjectiveNormalize(...)helper. - Finite numerical hazards are monitor-only:
numerical_hazard_thresholdsurfaces throughnumerical_hazard_rateand does not fold intofault_mask. - Loss defaults changed:
sign_consistency_lossis singular-only whenmask_singularis omitted,implicit_loss(..., detach_scale=False)is default, andmargin_lossgets an opt-inreduction="conditional"mode. - New training helpers:
soft_coverage_loss(...),lift_semantic_targets(...), andSemanticTargetsfor explicit finite/bottom/censored/domain-invalid/missing/fault labels. - Bundle metadata sidecar renamed to
inference_output_schema; the oldexperimental_inference_output_schemaremains a deprecated alias.
Next Steps
- Read SCM Foundations before designing custom rational heads.
- Use Training Guide when wiring projective losses and coverage control.
- Use Inference & Deployment before selecting
tau_inferor shipping a bundle. - Keep API Reference nearby when checking stable versus experimental imports.