Skip to content

feat(abi): EchidnaABI.TacticRecord — fixed-point confidence + total-order proof#151

Merged
hyperpolymath merged 1 commit into
mainfrom
feat/idris2-abi-tactic-record
May 30, 2026
Merged

feat(abi): EchidnaABI.TacticRecord — fixed-point confidence + total-order proof#151
hyperpolymath merged 1 commit into
mainfrom
feat/idris2-abi-tactic-record

Conversation

@hyperpolymath
Copy link
Copy Markdown
Owner

@hyperpolymath hyperpolymath commented May 30, 2026

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)

Lemma What it says
`compareNatRefl` `compare m m = EQ` for all m
`compareByConfidenceRefl` Comparing a tactic to itself is EQ
`compareNatAntiSym` `compare m n = LT → compare n m = GT`
`compareByConfidenceAntiSym` Lifted to TacticSuggestion
`confidenceFloatZero` Float view of `FZ` is `0.0`

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 --check EchidnaABI/TacticRecord.idr` (standalone, with
    `IDRIS2_PREFIX` pointing at the prover-toolchain install) green
  • Module entry added to `echidnaabi.ipkg`
  • CI `Idris2 ABI Type-Check` is acknowledged-red on `main`
    per the owner-managed dual-tree state — this PR does not
    attempt to reconcile that.

🤖 Generated with Claude Code

…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>
@hyperpolymath hyperpolymath enabled auto-merge (squash) May 30, 2026 20:02
@hyperpolymath hyperpolymath merged commit cfa1e7f into main May 30, 2026
28 of 38 checks passed
@hyperpolymath hyperpolymath deleted the feat/idris2-abi-tactic-record branch May 30, 2026 22:19
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.

1 participant