Commit graph

201 commits

Author SHA1 Message Date
5e7200c84f feat(infra): add optional --rrc alignment to lake_build_ingest.py
When --rrc is given, the shim runs pist-classify-trace on the trace fixture
and rrc-watchdog for RRC alignment, then writes an additional
rrc_alignment receipt into ene.receipts alongside the build receipt.
2026-06-22 03:46:58 -05:00
1a44f890c8 fix(infra): make lake_build_ingest.py duplicate-safe
Sets content_hash to NULL for build_log packages so the partial unique

index ene_pkg_hash_idx does not prevent multiple ingestions of the same

build output. Each build session now gets its own package row. Also makes

receipt/ingest_event inserts idempotent with ON CONFLICT DO NOTHING.
2026-06-22 03:14:23 -05:00
27efd54f6d feat(infra): add lake build ingestion shim for ENE database
Adds 4-Infrastructure/shim/lake_build_ingest.py, a pure-I/O shim that:
- runs `lake build <target>` in the Semantics directory,
- parses job count, error count, warnings, and status,
- inserts a session, package, receipt, and ingest_event into the
  ENE database on neon-64gb (arxiv-pg container).

The script contains no admissibility logic and no Float arithmetic.
Tested with `lake build Semantics.NKHodgeFAMM` — 8316 jobs, 0 errors,
session d1ea53db2185df87dd41497da12101f5.
2026-06-22 02:20:17 -05:00
69988453bc chore(infra): stage working tree modifications
Build: 8604 jobs, 0 errors (lake build)
2026-06-22 01:23:17 -05:00
1f7ec15f12 feat(lean): add logarithmic viscosity coordinates to NKHodgeFAMM
Adds logViscosityRatio, log_viscosity_monotone, and ν_eff_monotone
to Semantics/NKHodgeFAMM.lean section 6b. The adaptive viscosity law
ν_eff = ν₀*(1+μ) is multiplicative in ν₀ and additive in scar density μ;
taking λ = log(ν_eff/ν₀) = log(1+μ) turns the multiplicative feedback into
an additive coordinate. This gives nlinarith a direct handle on viscosity
monotonicity and connects the module to Kritchevsky's "Everything Is
Logarithms" framing (SilverSight CITATION.cff).

Also marks a few pre-existing unused variables with underscores to silence
the linter.

Build: 8316 jobs, 0 errors (lake build Semantics.NKHodgeFAMM)
2026-06-22 01:21:58 -05:00
8079ca3a20 docs(infra): document bosonic tensor network regime discovery and fix dim formula
- Updates CHANGELOG.md with 2026-06-21 entry describing the two-regime
  phase transition observed on neon-64gb: bosonic MC (p<=4) vs
  distinguishable approximation (p>=5) in rrc_bosonic_tensor_network.py.
- Adds BMCTE, SBOE, LPMCE, effective support, and observable-estimation
  vs exact-simulation terms to 6-Documentation/docs/GLOSSARY.md.
- Fixes Hilbert-dimension summary in rrc_bosonic_tensor_network.py to use
  C(N+p-1, p) instead of C(N, p).

No core logic changed; documentation and summary-output correction only.
2026-06-22 01:11:17 -05:00
88db8987b0 feat(infra): add hybrid arxiv search with pgvector HNSW + pg_trgm
- embed_arxiv.py: batch embedding of 700k arxiv abstracts using
  static-retrieval-mrl-en-v1 (1024-dim model)
- hybrid_search.sql: RRF merger of trigram + vector search, 22ms query time
- jaccard_hybrid.py: 48 cornfield concepts matched to arxiv papers

Results: 480 hybrid citations loaded (vector-only matches for abstract concepts)
Build: 3314 jobs, 0 errors (lake build Compiler)
2026-06-22 01:11:17 -05:00
d28e9de6ca fix(infra): optimize drive compression memory usage and download skip
Check file sizes before loading bytes into memory and stream large files
directly into the tarball to prevent OOM errors on Steam Deck. Skip downloading
files that already exist locally.

Build: 0 errors (py_compile)
2026-06-22 01:11:17 -05:00
0149a5c93d feat(infra): add MCP-only Drive GCCL compression shim
Adds 4-Infrastructure/shim/mcp_drive_gccl_compress.py:
- downloads a Google Drive folder via @piotr-agier/google-drive-mcp
- GCCL-delta-compresses contents into .tar.zst + JSON manifest
- uploads archive + manifest back to Drive
- optionally trashes the original folder
- handles MCP listFolder pagination

Updates 4-Infrastructure/AGENTS.md with the new shim anchor.

No rclone or egress-heavy operations; all Drive I/O goes through MCP.
2026-06-22 01:11:17 -05:00
2b3d255a40 feat(infra): add fast Jaccard matcher using /shm keyword index
Pre-built keyword index on /shm (272 MB, 111k keywords, 700k papers).
Runs in 39 seconds vs 10+ minutes timeout for SQL-based approach.

Usage:
  # Build index (one-time, ~2 min)
  ssh neon-64gb 'python3 /tmp/build_keyword_index.py'

  # Run matcher (39 seconds)
  ssh neon-64gb 'python3 /tmp/jaccard_fast.py'

/shm setup:
  - tmpfs mount (32 GB), persistent in fstab
  - /shm/arxiv_texts.tsv (559 MB) — raw paper texts
  - /shm/keyword_index.json (272 MB) — inverted index
2026-06-22 01:11:17 -05:00
5a8179fe38 feat(infra): add Jaccard matcher for arxiv paper discovery
Finds related arxiv papers for cornfield concepts via keyword overlap.
Uses /shm/arxiv_texts.tsv (559 MB) for fast local matching.
pg_trgm GIN indexes on neon-64gb for Postgres queries.

Results: 240 candidate citations for 48 concepts.
Loaded into concept_citations table (relation_type='candidate').
2026-06-22 01:11:17 -05:00
67e77d8f24 feat(lean,infra): SilverSight-first offline PIST trace classifier
Moves all classification authority from Python into Lean:

- Adds `0-Core-Formalism/lean/Semantics/PistClassifyTrace.lean` executable.
  Reads a raw trace JSON and emits spectral radius, RRC shape, and tactic
  family using `Semantics.PIST.Spectral` and `Semantics.PIST.Classify`.
- Registers `pist-classify-trace` in `lakefile.toml`.
- Fixes `Semantics.PIST.Spectral` power iteration to handle directed
  transition matrices:
  - `symmetrize` now preserves half-integer weights as Q16_16 raw values.
  - `matVecMul` uses saturated Q16_16 arithmetic to prevent overflow.
- Rewrites `4-Infrastructure/shim/pist_trace_classify_offline.py` as a pure
  I/O wrapper: reads JSON, calls the Lean classifier, optionally calls
  `rrc-watchdog`, and emits the combined JSON. Removes Python-side spectral
  computation, shape thresholds, tactic heuristic, and KNN.
- Updates `AGENTS.md` and `4-Infrastructure/AGENTS.md` with the new build
  baseline and shim contract.

Verification:
- `lake build` → 8604 jobs, 0 errors
- Canary trace outputs match previous Python outputs to within Q16_16 rounding
  (e.g., apply_chain λ_q16 = 59044 vs 59045).
- `python3 -m py_compile` on the rewritten shim passes.
2026-06-22 01:11:17 -05:00
7b731f87c0 feat(rrc): add offline token-free trace classifier
Created a local, offline Python shim `pist_trace_classify_offline.py` that computes trace transition matrix spectra, maps the max eigenvalue to the Q16.16 spectral radius, evaluates the color-space shape classification logic from `Semantics.PIST.Classify`, and invokes the local `rrc-watchdog` Lean binary inside the podman container to verify alignment. This avoids querying the dead AWS RDS instance and saves LLM API tokens.

Build: 3314 jobs, 0 errors (lake build Compiler)
2026-06-22 01:11:17 -05:00
7b0c0a363b feat(infra): citation crawler and spectral cross-validation research shims
Add exploratory Python shims for:
- OpenAlex citation crawling
- Semantic Scholar citation crawling
- PageRank eigenvalue survey
- SNAP PIST spectral cross-validation
- Fiedler vector validation
2026-06-21 01:04:19 -05:00
7d3e90331a feat(infra): Finsler QAOA adapter fixes and benchmark shim
- qaoa_adapter.py: fix finsler_metric_to_qubo to store Q_ij + Q_ji per
  undirected pair; update is_anisotropic and _find_anisotropic_pair to
  accept raw_matrix so asymmetry detection still works after summation;
  add measure option to pauli_to_cirq.
- benchmark_finsler_qaoa.py: new benchmark harness for Finsler-Randers
  routing via QAOA.
2026-06-21 01:04:19 -05:00
5a4a46d486 feat(infra): Finsler-Randers QAP benchmark at n=8/12/24/48
Formulate directed Finsler routing as TSP-MTZ (QAP) using HiGHS MIP and
benchmark against QUBO subset-selection. Five solvers across four sizes.

Key results:
- QAP-MIP scales well: n=48 solves to feasibility in 13s
- QUBO degenerate for all-positive Q_ij (unconstrained always selects 0)
- 2-phase strategy viable: QUBO-card to select K, then TSP-on-subset

Build: N/A (Python shim)
2026-06-21 00:32:24 -05:00
7b498b95e4 feat(infra): capability probe — 9/9 backends functional, v1 receipt
- capability_probe.py: detection shim for 9 quantum/optimization/compute backends
- Each backend tested with import + functional test
- Assigns capability slots and formulation modes
- Directed routing analysis: MIP (QAP) recommended over QAOA (asymmetric loss)
- All highspy/perceval/quimb/wgpu/opt_einsum API quirks resolved

Receipt: 9/9 functional, 9 formulation modes, JSON schema v1
2026-06-21 00:32:24 -05:00
ec3c4cd440 chore(infra): add perceval-quandela to shim requirements
Perceval is the photonic quantum simulation SDK used by
rrc_photonic_stress_test.py (SLOS backend). Already installed
system-wide; added to requirements.txt for venv reproducibility.
2026-06-21 00:32:24 -05:00
c83e80df25 chore(infra): add missing quantum/GPU/db dependencies to shim requirements.txt
Adds 16 packages for bosonic tensor networks (quimb, opt_einsum),
QAOA shims (cirq, qiskit, qiskit-aer), graph/spectral analysis
(networkx, scipy), GPU dispatch (wgpu, ray), database backends
(psycopg2-binary, gremlinpython, boto3, pymysql), data/pipeline
(pandas, xxhash, pyserial).
2026-06-21 00:32:24 -05:00
2f011c08fb feat(lean): Chentsov->Finsler->QUBO->QAOA routing bridge
Chentsov's theorem forces the Fisher metric; Finsler-Randers generalizes
with asymmetric drift beta; QUBO discretizes the geodesic; QAOA solves it.

- TransportQUBOBridge.lean (new, 0 sorries, 2 axioms with TODO(lean-port)):
  randersMetricToQUBO, geodesicAssignment, isAnisotropic bridging
  TransportTheory.RandersMetric -> EntropyMeasures.QUBOFormulation.
  Two Q16_16 lemma boundaries: add_self_eq_zero_iff, cost_nonneg.
- computeAlphaCost_neg / computeBetaCost_neg lemmas added to TransportTheory.lean
  (alpha symmetric, beta antisymmetric under direction negation).
- qaoa_adapter.py section III-D: FinslerMetric dataclass + finsler_metric_to_qubo()
  conversion + finsler_demo CLI (verified: anisotropic pair Q_01=0.927, Q_10=0.0).
- docs/chentsov_finsler_qubo_routing.md: full 4-layer pipeline formalization.
- AGENTS.md updated: TransportQUBOBridge in blessed surface + pending proof work.

Build: lake build Semantics.TransportQUBOBridge -> 0 errors, 0 sorries
2026-06-21 00:32:23 -05:00
Allaun Silverfox
c714a10374 agent-swarm: optimize core math, close E=mc2 trace
- Fix BindAxioms associativity: semigroup cocycle condition
- Replace 4x True:=by trivial with real theorem statements
- Implement fisherRaoDistance via Real.arccos
- Add chaos_trajectory_no_collision, sidon_guided_basin_unique
- Deterministic sidon_guided_chaos_game with convergence detection
- Structurally informative EquationShape type signatures
- Principled 5D manifold from real equation properties
- Proper Merkle tree with non-commutative mixHash
- spectral_to_sidon_address pipeline
- Close one trace: E=mc2 -> EquationShape -> Sidon -> Chaos Game -> Receipt
- Receipt: ff9976852fa80ecaa9bc8158430497a771a00adf9a162b936b26d57dc84126e3
2026-06-20 22:43:52 -05:00
b038778361 feat(lean): SDPVerify, GoormaghtighCert, Hachimoji modules; Gremlin mathblob graph loader; branch cleanup
- SDPVerify.lean: certificate verification engine (714 lines, compiles cleanly)
- GoormaghtighCert.lean: Goormaghtigh conjecture SDP certificate
- HachimojiManifoldAxiom/HachimojiSubstitution: Hachimoji DNA encoding
- GeneticBraidBridge.lean: genetic algorithm braid bridge
- load_dependency_graph/load_module_graph: Gremlin Cosmos DB graph loaders
- test_graph_queries/rrc_math_xref: graph verification queries
- Gremlin mathblob DB provisioned and accessible
- Branch cleanup: deleted 11 stale remote branches

Build: 3297 jobs, 0 errors (lake build Semantics.SDPVerify)
2026-06-19 23:06:16 -05:00
50322c88f9 fix(infra): handle database deduplication unique constraints in db buffer
- Intercepts psycopg2 UniqueViolation exceptions on the ene_pkg_hash_idx
  unique index constraint.
- Logs duplicate content violations as successful deduplication skips
  instead of triggering transaction retries and fallback logging.

Build: 0 jobs, 0 errors (lake build)
2026-06-18 23:35:03 -05:00
e6bbb612d0 fix(infra): point default RDS host to neon server Tailscale IP
- Redirected the default RDS_HOST/PGHOST database connection default
  to neon-64gb (100.92.88.64) across all Python shims, shell wrappers,
  and Rust probes.
- Cleaned up local defaults in rds_connect.py, sync_wiki_to_rds.py,
  dataset_ingest_rds.py, batch_embed_artifacts.py, db.rs, cache-offload.sh,
  db-consolidate.sh, backup.sh, and ene-api-wrapper.sh.

Build: 0 jobs, 0 errors (lake build)
2026-06-18 23:28:46 -05:00
ab6fe3e69b fix(infra): purge all default AWS RDS hosts and IAM credentials
- Replaced database-1-instance-1.cghu8yqogqwo.us-east-1.rds.amazonaws.com
  with 'localhost' as default.
- Removed AWS IAM generate-db-auth-token CLI subprocessing and boto3
  token generation blocks from rds_connect.py, ingest_flexure_joints.py,
  pist_route_repair.py, and ene-api-wrapper.sh.
- Purged AWS DEFAULT_REGION and AWS_REGION configurations where applicable.
- Updated Rust rds_probe to use standard PG environment variables.

Build: 0 jobs, 0 errors (lake build)
2026-06-18 23:26:56 -05:00
f00ead35c2 feat(infra): add async database buffering program for RRC receipts
Implemented rrc_bosonic_db_buffer.py containing AsyncDatabaseBuffer
which queues, batches, and flushes PostgreSQL inserts for bosonic tensor
network receipts and metrics. Documented both rrc_bosonic_tensor_gpu.py
and rrc_bosonic_db_buffer.py in 4-Infrastructure/AGENTS.md.

Build: 0 jobs, 0 errors (lake build)
2026-06-18 23:10:46 -05:00
558431fc45 feat(lean,infra): Corpus278→250 rename + SLOS-calibrated braid defaults
- Renamed Corpus278/Matrices278 to Corpus250/Matrices250 across all
  Lean modules, Python shims, JSON schemas, and documentation
- Applied SLOS-calibrated defaults to braid_search.py:
  bracket_cost base=8x/16x, crossing_penalty gap_reward=0.01
- Synced same defaults to research-compute-fabric submodule
- Updated Burgers 0D defaults: nu=0.9995, advection=0.075
- Fixed 278→250 refs in pist_predictions JSON (claim_boundary, total)
- Fixed stale schema refs in .devin/skills/lean-proof/SKILL.md
- Updated AGENTS.md build baselines to post-clean counts (3314 jobs)
- Updated lake-manifest.json sparkle rev to match lakefile.toml
- Fixed Q16_16 signed conversion bug in qaoa_adapter tunable costs
- NBody.lean: pre-existing dirty changes (introN failures, NOT our work)

Build: 3314 jobs, 0 errors (lake build Compiler)
2026-06-18 22:16:52 -05:00
c0ec099e6d feat(infra): Burgers chaos game — quantum walk over 22-representation graph
Encodes each Burgers representation as a node connected by proven
isomorphisms from the codebase. Continuous-time quantum walk e^{-iAt}
on the adjacency matrix converges to eigenvector centrality; the
0D DualQuat Braid is confirmed as the universal hub (#1 in all three
rankings: centrality, quantum walk probability, and degree).

Build: N/A (Python shim, no Lean files touched)
2026-06-18 21:39:18 -05:00
684898e842 feat(infra,lean): add verification engine + complete Goormaghtigh proof certificate
- verify_goormaghtigh.py: Python verification engine with repunit structure
  checks, bounded/extended enumeration (exactly 2 collisions), Ramanujan-Nagell
  verification, Baker bound classical precheck
- baker_circuit.json: Quandella photonic Grover search circuit for Baker bound
  estimation
- GoormaghtighEnumeration.lean: merged ramanujan_nagell axiom,
  goormaghtigh_x2_n3 theorem (proved from Ramanujan-Nagell), goormaghtigh_complete
  (master theorem using BMS bounds + native_decide), set-equality & density
  corollaries. Zero sorries. 8 sections.

Build: 8599 jobs, 0 errors (lake build)
2026-06-18 19:40:23 -05:00
77488ac0ae feat(lean): close gaussian_line_integral_unit_dir + consolidate infrastructure
Lean proof fixes:
- N3L_Energy.lean: fully close gaussian_line_integral_unit_dir (nlinarith+hab
  for unit-circle quadratic, sqrt_mul+neg_div for integral_gaussian_1d match,
  exp_sum_of_sq order fix, add_assoc for h_gauss_shift, sq_sqrt for field_simp,
  sq_abs for perpDistance hd)
- Add Adapters/AlphaProofNexus: 12 Erdos/graph adapter stubs (AlphaProof nexus)
- Add Adapters/ErgodicAdditive.lean, SidonMatroid.lean
- Add AntiDiophantine.lean, EffectiveBoundDQ.lean, PVGS_DQ_Bridge.lean
- Add FormalConjectures/Util/ProblemImports.lean
- Add RRC/EntropyCandidates/Candidates.lean
- Add OTOM external project (lakefile.toml, lake-manifest.json, lean-toolchain)

Infrastructure:
- Add 4-Infrastructure/shim/: 17 Python probes (RRC manifold, Sidon kernel,
  Wannier, arxiv harvest, math_symbols DB, coverage density, geometric entropy)
- Add 4-Infrastructure/NoDupeLabs/: Node server + package files
- Add 6-Documentation/docs/specs/DP_RRC_RECEIPT_ENCODING_SPEC.md
- Add fix_offloat.py

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 16:53:23 -05:00
00e9eed399 fix(lean): complete projectionOrdering proof in GeometricCompressionWorkspace
Replace the TODO(lean-port) sorry with a complete proof of the
projectionOrdering theorem: for positive SourceValue pairs s1 < s2
with s2 ≤ maxExpected, projectToCoding preserves strict ordering
of the Q0_64 values.

The proof uses Nat-only arithmetic (no Float) and handles two cases:
  - a2 < d: both values fit in Q0_64 range, ordering follows from
    monotonicity of integer division
  - a2 = d: a2*s/d = s clamped to q0_64MaxRaw; a1*s/d < q0_64MaxRaw
    via the key inequality (d-1)*s < (s-1)*d

Build: 8598 jobs, 0 errors (lake build)
2026-06-18 15:06:50 -05:00
4da68e1a19 docs: update AGENTS.md for SpherionTwinPrime module + add spherion_twin_prime.py shim
AGENTS.md: added SpherionTwinPrime architecture section, updated Burgers energy dissipation to parametric form.

spherion_twin_prime.py (20KB): priority-queue walk with polarity energy tuning.

Build: 8598 jobs, 0 errors.
2026-06-16 23:38:51 -05:00
a247dcb1b6 feat: complete all four interconnected solves
1. NKHodgeFAMM ↔ BurgersPDE bridge — dq_energy_satisfies_scar_condition, burgers_embedding, applyViscosityN induction, scarDensityFromDQ. Build: 8316 jobs, 0 errors.

2. Lonely Runner sim — lonely_runner_sim.py with circular Betti tracking. All k≤4 test cases confirm beta_0 > 0 (lonely times exist). Fixed uint8 wrap-around bug.

3. Taylor-Green Betti tracker — taylor_green_betti.py with 6 scenarios. beta_2 correctly detects voids: TG smooth=0, TG+void>0, noise=77. Fixed int64 serialization in betti_tracker.py.

4. Q1/Q2 vorticity decomposition — VorticityDecomposition.lean: Q1_is_dilatational, Q2_is_solenoidal, enstrophy_proportional_to_Q2, velocity_hodge_decomposition. All rfl proofs + native_decide witnesses. Build: 8598 jobs, 0 errors.
2026-06-16 22:21:55 -05:00
8cd2fa02f3 feat: NK-Hodge-FAMM formal axiom + Lonely Runner Betti mapping + numerical Betti tracker + vorticity resolution
Four interconnected solves:

1. NKHodgeFAMM.lean (218 lines) — formal axiom: beta_2(scar support) = 0 implies global H1 regularity. Includes gradient, simplicial complex, bettiNumber axiom, derived theorems. Build: 8598 jobs, 0 errors.

2. lonely_runner_betti_mapping.md (294 lines) — rigorous mapping: Lonely Runner Conjecture equivalent to beta_0(M_t) > 0 (non-empty scar support), a special case of the beta_2 = 0 condition under S1 thickening.

3. betti_tracker.py + test_betti_tracker.py — numerical Betti tracker via gudhi cubical persistence. Computes beta_0, beta_1, beta_2 from velocity field gradient norms. 7 unit tests pass including spherical void detection.

4. cole_hopf_vorticity_resolution.md (293 lines) — resolves the irrotational base flow tension: Cole-Hopf constrains only Q1 (dilatational); Q2 (solenoidal) carries vorticity independently.
2026-06-16 22:14:10 -05:00
2d7d9bc2b8 proof(lean): close e8_singer_improvement and erdos30_e8_conditional; restate two invalid sorries
- e8_singer_improvement: proven via Singer set as direct witness; (119/120)^k ≤ 1 by
  pow_le_one₀, bound follows from mul_le_of_le_one_right.
- erdos30_e8_conditional: proven via interval_sidon_exists (Singer's theorem bridge);
  C=1/4, Nat.sqrt ↔ Real.sqrt bridge via nlinarith on squared terms.
- sidon_weight_bound: restated — LHS corrected from σ₃(a+b) sums to σ₃(a)·σ₃(b)
  products over unordered pairs (original was INVALID_STATEMENT; E₈ convolution
  identity delivers products, not values at pair-sums). Remains ANALYTIC_OPEN.
- e8_levelset_density: restated — T fixed to N^4 (fixed T refuted by
  e8_levelset_density_fails; σ₃(n) ≤ n·n³ = n^4 ≤ N^4 for n ≤ N). Fixed base
  typo Nat.log N → Nat.log 2 N. Remains ANALYTIC_OPEN sorry.
- §14 summary updated with proven theorems and restatement notes.
- Add merkle_tensegrity_load_equation_generator.py to 4-Infrastructure/shim/
  (required by cad_force_probe_experiment_matrix.py import).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-16 14:50:02 -05:00
475f6319ea chore(repo): push local 768-commit branch state onto clean remote baseline
This squashes all local history (768 commits) onto the scrubbed PR #90
baseline. Individual commits were lost during filter-repo corruption;
the working tree content is preserved intact.

Build: N/A (working tree state only)
2026-06-15 22:46:50 -05:00
Devin AI
0639eae30a chore(consolidation): integrate E8Sidon stack (PRs #79 #80 #81 #89) into one PR
Squash the four overlapping feature branches into a single change set against
main, eliminating cross-PR merge conflicts and the duplicated CI-fix scripts.

What this brings in (merge order #79 -> #80 -> #81 -> #89):
- #79 refactor(infra): shared utilities (4-Infrastructure/lib/*: q16, hashing,
  jsonl, fraction_utils) + the scripts/math-first/* validators that the
  math-check CI requires.
- #80 feat(lean): Semantics.E8Sidon (1025 lines) -- Eisenstein coefficient
  identity E4^2 = E8 and the Sidon framework. E4_sq_eq_E8_coeff is fully proved
  (all Fourier-coefficient extraction machine-checked); the single residual gap
  is pinned to E4_sq_eq_E8_qExpansion (Mathlib lacks the valence formula /
  dim M8 = 1). 4 sorries + 1 axiom (e8_additive_completeness), all TODO(lean-port).
- #81 refactor(lean): Float-free FixedPoint core (integer-only sqrt/log2/expNeg).
  E8Sidon.lean kept at #80's final 1025-line version (the #81 intermediate
  438-line copy was overridden by merge order).
- #89 feat(lean): Semantics.RRC.PolyFactorIdentity -- short-sleeve polynomial
  detection at the zerocopy limb boundary; now imports Semantics.E8Sidon for
  sigma3/sigma7/convolutionLHS (single source of truth) instead of inlining them.

Conflict resolution:
- flake.nix -> canonical rs-surface removal (Garnix shutdown).
- scripts/math-first/* -> byte-identical across branches, clean.
- .cursorrules / AGENTS.md -> unified; baselines + sorry inventory refreshed.

Verification:
- lake build (default aggregator): 3573 jobs, 0 errors.
- lake build Semantics.RRC.PolyFactorIdentity (E8Sidon + FixedPoint + PolyFactor):
  3655 jobs, 0 errors. Witnesses verified (sigma7 4 = 16513, convolutionLHS 6 = 2350).
- Python tests: 68/68 pass.

Note: the "Workers Builds: researchstack" check is a preexisting external
Cloudflare build unrelated to this change (no branch touches 4-Infrastructure/cloudflare/).

Build: 3573 jobs (default), 3655 jobs (narrow), 0 errors
Co-Authored-By: Allaun Silverfox <bigdataiscoming+9i37y6j2@protonmail.com>
2026-06-16 02:01:31 +00:00
devin-ai-integration[bot]
6db78dccf3 test(coverage): add 138 unit tests for least-covered modules (#78)
Four test files covering the modules with zero or near-zero test coverage:

- scripts/qc-flag/test_lean_qc_flagger.py (55 tests)
  Covers all pure helpers, code-line detection, QCIssue/FileResult classes,
  and all 5 check functions (structural, naming, Q16, proof quality, deps).

- 4-Infrastructure/shim/test_braid_diat_codec.py (22 tests)
  Covers Q0_2 encode/decode, ChiralityDIAT roundtrips and verify_b,
  MountainPacked dict↔bytes, BraidResidualPacked bracket↔bytes.

- 5-Applications/tools-scripts/llm/test_emitter_utils.py (33 tests)
  Covers sha256_bytes, canonical_json_bytes, repo_relative, safe_slug,
  timestamps, context bundles, message building, extract_answer,
  auth guard, and verify_receipt schema rules.

- 4-Infrastructure/shim/test_validate_rrc_predictions.py (28 tests)
  Covers require_path, parse_equation, build_proof_metrics,
  build_receipt with all domain mappings, and MATH_* constant sets.

Build: all 138 tests pass (pytest), py_compile clean

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Allaun Silverfox <bigdataiscoming+9i37y6j2@protonmail.com>
2026-06-14 19:31:16 -05:00
Brandon Schneider
aba1fba7ad fix(adversarial-review): resolve 35 critical coding bugs across 8 subsystems
Security & correctness fixes from full adversarial review:

Lean (7 fixes):
- FixedPoint.lean: guard false theorem with n > 0 precondition
- QFactor.lean: remove double-scaling error in energy decrease
- AVMIsa/Step.lean: implement addSatQ16/subSatQ16 primitives
- BraidEigensolid.lean: fix crossStep second output argument swap
- SSMS.lean: complete ACI preservation proof (with rounding caveat)
- HouseholderQR.lean: add n > 0 precondition to spectral theorem

Verilog (7 fixes):
- q16_lut_core.v: fix multiply shift (16 → 32 bits)
- q16_lut_top.v: fix valid bit (0 → 1)
- cff_accelerator.v: fix SHA-256 padding (len < 448 check)
- research_stack_top.v: fix trigger aliasing (unique counters)
- Blitter6502OISC_small.v: fix address width (15 → 16 bits)
- spatial_hash_bram.v: add OOB write guard
- tmr_oepi_safety_fsm.v: fix double-increment race

WGSL (6 fixes):
- shaders.wgsl: atomicAdd for concurrent writes
- frustration_qubo.wgsl: double-buffer + CAS loop
- braid_fft.wgsl: workgroupBarrier synchronization
- burgers_scar_filter.wgsl: atomic E_bins array

Rust (9 fixes):
- thermodynamic.rs: Arc::from_raw → Arc::clone (double-free)
- thermodynamic.rs: Box::into_raw → Box (leak)
- tools/src/lib.rs: shell injection → shlex.quote
- ene-node/src/lib.rs: LRU caps, constant-time HMAC, peer caps

Python (6 fixes):
- similarity/__init__.py: pickle.load → RestrictedUnpickler
- AI-Feynman: torch.load → weights_only=True (14 calls)
- fetch_arxiv.py, fetch_s2.py: eval → ast.literal_eval
- topology.py: os.system → shutil.copy2
- SSH pipe: os.system → base64 pipe

Build: lake build 3572 jobs, 0 errors
2026-05-31 23:38:03 -05:00
Brandon Schneider
9e80ac68ca feat(infra): Jellyfin wizard complete, SSO-Auth plugin files deployed
- Jellyfin setup wizard completed, admin account created (admin/jellyfin-admin)
- SSO-Auth plugin v4.0.0.3 downloaded and placed in plugins directory
- Authentik OIDC provider for Jellyfin updated with correct redirect URI
- All services verified running

Build: 3313 jobs, 0 errors (lake build Compiler)
2026-05-31 14:14:20 -05:00
Brandon Schneider
008cf8fefe feat(infra): migrate external service registry to aiven mysql with ssl
- Migrated service_registry.py defaults from InfinityFree to Aiven MySQL.
- Enforced REQUIRED SSL mode on connections (ssl_mode for mysql-connector, ssl dict for pymysql).
- Added helper _get_dict_cursor to resolve pymysql compatibility issues.
- Configured registry password and encryption key in decrypted/encrypted .env via SOPS.

Build: 3313 jobs, 0 errors (lake build)
2026-05-31 02:10:10 -05:00
Brandon Schneider
aff285be30 fix(infra): service registry is backup/fallback, not primary
Primary: Tailscale mesh + internal PostgreSQL/SQLite
Backup:  InfinityFree MySQL (this file)

Use cases for backup path:
  - Edge nodes that cant reach mesh (ESP32, Cloudflare Workers)
  - Mesh-down fallback (Tailscale outage)
  - Cross-mesh discovery (different tailnets)
  - Low-impact config distribution
2026-05-30 21:19:24 -05:00
Brandon Schneider
ebcf0571ec feat(infra): external service registry via InfinityFree MySQL
service_registry.py — mesh-independent node discovery and credential store.

Tables:
  nodes       — registered devices with capabilities, tier, IPs
  credentials — encrypted blobs (ChaCha20) with TTL auto-expiry
  config      — distributed key-value configuration

Features:
  - auto_register() — uses device_capability_probe to register
  - discover_nodes() — find nodes by tier, with max-age filter
  - store/get_credential() — encrypted at rest, short TTL
  - heartbeat() — keepalive for node registry
  - CLI: init, register, discover, store, get, cleanup, config-set/get

Any node with internet can reach it (no Tailscale required).
Credentials encrypted with ChaCha20, key from REGISTRY_ENCRYPT_KEY env.
2026-05-30 21:14:51 -05:00
Brandon Schneider
6d4d099625 fix(infra): tier limits leave headroom for device function
Each tier now reserves resources for its primary function:
  GPU_CUDA:     8GB VRAM (not 12 — keep 4GB for display/compositor)
  GPU_VAAPI:    256MB (keep VRAM headroom for desktop)
  GPU_APU:      128MB (shared DDR, OS needs bandwidth)
  CPU_FFMPEG:   64MB, half cores (leave for OS/k3s)
  BATCH:        1500 min/month (reserve 500 for actual CI/CD)
  ETHERNET:     500ms timeout (leave bandwidth for SSH/mgmt)
  FRAMEBUFFER:  768KB (half — keep display visible, compute in top rows)
  WASM:         512B payload, 8ms CPU (leave 2ms for JSON overhead)
  DSP:          2048 samples (half FFT, leave for overlap buffer)
  ESP32:        512B (WiFi/BLE stack needs ~80KB of 520KB SRAM)
2026-05-30 20:45:50 -05:00
Brandon Schneider
ba1bf871f8 feat(infra): per-tier device limitations for Ray scheduling
DeviceLimitations dataclass with hard constraints per tier:
  GPU_CUDA:     1GB payload, 16 concurrent, 60s, NVENC, 12GB VRAM
  GPU_VAAPI:    512MB payload, 8 concurrent, 60s, VAAPI HW
  GPU_APU:      256MB payload, 4 concurrent, 30s, shared DDR
  CPU_FFMPEG:   128MB payload, 2 concurrent, 120s, software
  BATCH:        64MB payload, 1 concurrent, 6h, 2000 min/month
  ETHERNET:     1400B payload, 1 concurrent, 1s, virtio-net
  FRAMEBUFFER:  1.5MB payload, 1 concurrent, 100ms, DMA only
  WASM:         1KB payload, 1 concurrent, 10ms, 100K req/day
  DSP:          16KB payload, 1 concurrent, 5s, FFT only
  ESP32:        2KB payload, 1 concurrent, 100ms, Q0_16 scalar

get_limitations(caps) returns actual hardware-aware limits
(vram override, framebuffer capacity, memory override)
2026-05-30 20:44:31 -05:00
Brandon Schneider
cadb38cc1b feat(infra): add AMD VAAPI + FLAC DSP to FrameDispatcher
FrameDispatcher now routes 6 tags:
  TAG_STRAND(0x01)  → BraidBackend (VCN compute)
  TAG_CROSSING(0x02) → BraidBackend (VCN compute)
  TAG_PIST(0x03)    → BraidBackend (VCN compute)
  TAG_LUPINE(0x04)  → CUDABackend (NVIDIA CUDA)
  TAG_VAAPI(0x05)   → VAAPIBackend (AMD/Intel VA-API)  ← NEW
  TAG_FLAC(0x06)    → FLACBackend (PipeWire/FLAC DSP)  ← NEW

New backends:
  - VAAPIBackend/LocalVAAPIBackend: AMD/Intel hardware encode/decode
  - FLACBackend/LocalFLACBackend: FFT spectral analysis, centroid, RMS
  - RayVAAPIBackend: Ray actor for VA-API operations
  - SyncVAAPIWrapper/SyncFLACWrapper: sync bridges for FrameDispatcher

Capability probe: DSP tier(1) added between FRAMEBUFFER(2) and ESP32(0)
2026-05-30 20:35:42 -05:00
Brandon Schneider
5320a08105 feat(infra): integrate edge WASM and GitHub batch compute tiers
- Update device_capability_probe.py to add BATCH and WASM tiers and fix a NameError bug on has_virtio_net.
- Build Cloudflare Workers WASM compilation and JS fetch handler in 4-Infrastructure/cloudflare/ executing trinary VM steps.
- Create GitHub Actions batch_compute.yml workflow to harvest runner minutes.
- Keep 4-Infrastructure/AGENTS.md updated with the WASM core library anchor.

Build: 3313 jobs, 0 errors (lake build)
2026-05-30 20:08:31 -05:00
Brandon Schneider
d6fc9cfe6d feat(infra): add ETHERNET compute tier for virtio-net PistPacket DMA
New tier between CPU_FFMPEG and FRAMEBUFFER:
  GPU_CUDA(7) > GPU_VAAPI(6) > GPU_APU(5) > CPU_FFMPEG(4) >
  ETHERNET(3) > FRAMEBUFFER(2) > ESP32(1) > RELAY(0)

- _detect_virtio_net(): probes /sys/class/net for virtio driver (0x1af4)
- PistPacket computation via TX/RX descriptor rings
- Host vhost-user backend does matrix transforms
- CRC32 hardware offload = witness verification
- Works in any VM with network (even without framebuffer)
2026-05-30 20:02:06 -05:00
Brandon Schneider
66abf92214 fix(infra): handle Cirrus Logic virtual VGA and DRM naming edge cases
- Add Cirrus Logic (0x1013) and virtio (0x1af4) to vendor map
- Fix DRM card parsing for names like "card0-VGA-1"
- Virtual GPUs (cirrus, virtio) never classified as discrete
- Virtual GPUs skip VA-API tier, fall to FRAMEBUFFER

Racknerd microVM (2vCPU, 715MB, Cirrus VGA) correctly classified as
FRAMEBUFFER tier: 1024x768 @ 16bpp = 1.57 MB DMA backplane.
2026-05-30 19:59:38 -05:00
Brandon Schneider
16101a787f feat(infra): device capability probe with framebuffer fallback
device_capability_probe.py: classify every device into a compute tier.

Tiers (highest to lowest):
  GPU_CUDA    — NVIDIA discrete + CUDA (NVENC, Ray GPU worker)
  GPU_VAAPI   — AMD/Intel discrete + VA-API (hardware encode)
  GPU_APU     — AMD integrated, yuvj420p, bandwidth-optimized
  CPU_FFMPEG  — Software encode only (libx264)
  FRAMEBUFFER — /dev/fb0 DMA backplane (8.29 MB/frame at 1080p)
  ESP32       — MCU, Q0_16 scalar in FreeRTOS idle hook
  RELAY       — Network only, no compute
  OFFLINE     — Unreachable

Features:
  - Multi-GPU DRM render node scanning (card0=AMD, card1=NVIDIA)
  - APU vs dGPU classification via device name + VRAM heuristics
  - Framebuffer detection with /sys/class/graphics/fb0 resolution
  - Ray scheduling helpers (get_ray_placement_strategy)
  - Cluster probe via SSH
  - JSON + human-readable output
2026-05-30 19:57:07 -05:00