feat(abi): EchidnaABI.TacticRecord — fixed-point confidence + total-order proof#151
Merged
Merged
Conversation
…al-order proof Wave-2 follow-on to PR #146. Adds the Idris2 ABI module for the GNN→Chapel tactic-record cross-FFI contract, deferred from the chapel-rehabilitation brief's role C. The Rust-side `TacticSuggestion` (src/rust/integration.rs) uses `f32` for confidence, which is convenient for ML output but under-specifies the ABI (two equivalent floats can have different bit patterns; `f32 == f32` is not a total equivalence). This module defines the canonical wire form: `ConfidenceFP = Fin (S MaxConfidence)` with MaxConfidence = 10000, so the on-wire representation is uniquely determined and every value has a compile-time bounded-ness proof. Proves (zero believe_me, zero postulates, zero admits): - `compareNatRefl` — reflexivity of the underlying nat comparison - `compareByConfidenceRefl` — comparing a tactic to itself is EQ - `compareNatAntiSym` — antisymmetry on `compare m n = LT → compare n m = GT` - `compareByConfidenceAntiSym` — lifted to TacticSuggestion - `confidenceFloatZero` — float view of FZ is 0.0 by definition Two round-trip lemmas (`natToFinToNat`, `clampRoundtripInRange`) are intentionally not closed here — they require an LTE-weakening step on the nat side that hasn't been spelled out structurally yet. Their absence is documented in the module, NOT replaced with believe_me or an admit; the round-trip claim is captured as a Wave-3 follow-up. Standalone type-check (`idris2 --check EchidnaABI/TacticRecord.idr`) green; module added to `echidnaabi.ipkg`. The full-package `idris2 --build echidnaabi.ipkg` is currently red on a PRE-EXISTING typo in `EchidnaABI.Foreign` (`import Echidna.ABI.Types` should be `import EchidnaABI.Types`); fixing that is out of scope here. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Wave-2 follow-on to PR #146. Adds the Idris2 ABI module for the
GNN→Chapel tactic-record cross-FFI contract — deferred from the
chapel-rehabilitation brief's role C.
The Rust-side `TacticSuggestion` (`src/rust/integration.rs:71`)
uses `f32` for confidence, which under-specifies the ABI: two
equivalent floats can have different bit patterns, and `f32 == f32`
is not a total equivalence. This module defines the canonical wire
form:
```idris
ConfidenceFP = Fin (S MaxConfidence) -- MaxConfidence = 10000
```
So the on-wire representation is uniquely determined, every value
has a compile-time bounded-ness proof, and the Chapel-side
rank-merge has a provably total comparison.
Proofs (zero believe_me, zero postulates, zero admits)
Two round-trip lemmas (`natToFinToNat`, `clampRoundtripInRange`)
are intentionally not closed — they require an LTE-weakening
step on the nat side that hasn't been spelled out structurally yet.
Their absence is documented in the module, not replaced with
`believe_me` or an admit. Captured as a Wave-3 follow-up.
Test plan
`IDRIS2_PREFIX` pointing at the prover-toolchain install) green
per the owner-managed dual-tree state — this PR does not
attempt to reconcile that.
🤖 Generated with Claude Code