Skip to content

Examples and Tutorials

James Daley edited this page Jun 26, 2026 · 6 revisions

Examples and Tutorials

These examples are small, deterministic entry points for exploring the repository.

Tutorial 1: Verify the Repository

python -m pip install -e ".[dev]"
python tools/generate_artifacts.py
python tools/run_proof_suite.py
python -m pytest
python tools/verify_repository.py

Expected outcome: proof checks and tests pass, and repository verification reports no stale artifacts or claim violations.

Tutorial 2: Map an Array Patch

import numpy as np
from ash_model.pipeline import map_patch

current = np.linspace(0.0, 1.0, 64).reshape(8, 8)
previous = np.zeros((8, 8))

result = map_patch(current, previous=previous, branch_depth=4, scale=2, top_k=4)

print(result.source_state)
for candidate in result.selected:
    print(candidate.message, candidate.score)

This runs feature extraction, thresholding, parity-state construction, branch generation, reconstruction, source-consistency scoring, and deterministic pruning.

Tutorial 3: Inspect Finite Physics Observables

import numpy as np
from ash_model.physics import bridge_observables, uniform_physical_distribution

rho = uniform_physical_distribution()
obs = bridge_observables(rho)

print(obs.mean_hamming_weight)
print(obs.order_parameter)
print(obs.entropy_bits)
print(obs.parity_valid_probability)

Expected values include mean Hamming weight 4.5, order parameter 0.0, entropy 8.0 bits, and parity-valid probability 1.0.

Tutorial 4: Run Sector-Mixing Checks

python tools/reproduce_sector_mixing.py --output-dir .
python -m pytest tests/test_sector_mixing.py -q

Use this to verify the finite payload-sector workbench.

Tutorial 5: Run Background-Bridge Diagnostics

python tools/run_background_bridge_validation.py
python -m pytest tests/test_background_bridge_remediation.py -q

Use this for synthetic recovery and diagnostic output only. It does not fit external observations.

Tutorial 6: Inspect Science Blockers

python tools/audit_physics_readiness.py . --expect-open --write-json docs/remediation/physics-readiness.json

The expected state is that repository mechanics pass while external science blockers remain explicit.

Clone this wiki locally