Skip to content

Repair the actual Idris–RefC–Zig header bridge and replay its boundary proofs - #237

Merged
hyperpolymath merged 24 commits into
mainfrom
codex/real-header-refc-20261116
Nov 20, 2026
Merged

hyperpolymath merged 24 commits into
mainfrom
codex/real-header-refc-20261116

Conversation

@hyperpolymath

@hyperpolymath hyperpolymath commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

The header export previously checked only adjacent CRLF, disagreeing with the Idris predicate on lone CR and LF. It now calls the actual compiled Idris Bits8 transition through RefC. Zig walks the exact byte span, marshals tagged words and validates the returned state. NUL and non-UTF-8 remain data; absent backends and invalid results are explicit errors.

The qualified profile is native Linux x86_64 GNU, Zig 0.15.2 and Idris2 b6cbc25d5cd2ef2a250556266fd7b68dfc360f8b. The missing private language-bridges dependency has been replaced by a scoped repository-local ABI helper using the actual compiler SDK. Producer invalidation, complete input hashes, stale-bundle refusal and independent compiler-diagnostic/absent-output controls are included. This does not reconstruct the lost repository or implement all declared C APIs.

Soundness follow-up:

  • Replaces all 20 production assert_total sites with structural recursion, total lookup or explicit error-returning parser allowances. Regex caches carry an erased equality to the authoritative String; YAML quoted strings descend structurally and XML attributes spend their declared per-element allowance.
  • Repairs SafeMathProps against the actual APIs with two definitional zero-denominator proofs and executable arithmetic boundary tests. Two unused bodyless GCD witnesses become explicitly named outstanding obligation schemas; those laws and the covering-gcd instantiation remain unproved.
  • Adds a strict fresh-source gate: totality, warnings-as-errors, no-holes audit and actual execution. Exact attribute limits, flat/nested/malformed parsers, forged regex length, argument parsing and tree order are exercised. Parser completeness and full resource bounds remain owed.
  • Adds a 64-bit RefC representation model: universal byte round-trip, canonicality of every accepted word and null rejection. Compatible Agda, full Cubical, independent Lean/Rocq re-proofs, assumption audits, coqchk and a rejecting tag mutation run in CI. The real Zig codec constrains word width/SDK shift and checks all bytes against tag/unused-bit mutations.

Remote evidence at final signed head bb98fbc:

  • Strict regression artifact: the dedicated step passed, including no holes and execution; the broader workflow is not claimed green.
  • Actual RefC/header ABI and staging controls: passed, including all 256 single bytes, 65,536 pairs, public C caller and wrong-backend rejection.
  • Theory replay: passed; four header-model and three representation-model theorems have empty Lean axiom closures and closed Rocq assumption audits, with coqchk and rejecting controls.
    All head checks have completed: 51 successful, three skipped, one neutral and three failing. Both macOS targets now pass after moving ARM64 off the retired runner (Zig FFI run). No known review threads remain unresolved.

Merge blockers remain visible. The full OCaml audit at the final head requires 146 distinct symbols: nine exist, 137 are absent, and lifecycle signatures also conflict with the public header. The qualified proven.wired five-symbol profile passes; the full-API probe deliberately remains failing. Diagnostics across all 29 property modules found 28 failing modules (241 compiler diagnostics, not vulnerability findings); repairing SafeMath does not repair them. Five source licence headers await the owner's decision. The repository also retains a native code_coverage protection rule; no protection change has been applied. No dummy exports, proof admissions, gate bypasses or licence changes are included.

Source-to-proof remains incomplete: Atoma's importer does not yet cover this codec/loop or UAA's real registry; source/model correspondence, the foreign-call contract, pointer-region validity and compiler refinement remain separate obligations. The proofs here are model proofs and hand re-proofs, not automatic witness transport. See docs/adr/2026-11-16-header-refc-boundary.adoc. UAA #20 provides the second real C ABI consumer, with production-library comparisons against its Idris registry model.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants