Commit graph

1 commit

Author SHA1 Message Date
85cfb34a7d Phase 2, brick 1 complete: ed_compress_spec - compress emits the canonical
encoding of the denoted affine point (kernel-audited)

CurveFieldProofs.ed_compress_spec: for any valid extended point Pt
(ExtValid - the invariant every certified curve op guarantees),
    compress Pt = ok s   with
    bytesVal s = (edY Pt).val + ((edX Pt).val % 2) * 2^255
- the 32 wire bytes are the canonical little-endian y-residue with the
x-parity bit at position 255. Compress semantics AND canonicity in one
statement, because to_bytes_spec pins the bytes to the residue itself.

Supporting certificates in Proofs/CompressSpec.lean:
- is_negative_spec: the sign read is the parity of the CANONICAL residue
  (bit 0 of to_bytes) - (feVal x mod p) mod 2.
- Bytes32.exists_bytes: the 32-byte destructuring device (the
  Fe.exists_limbs idiom, 32-wide).
- to_bytes_spec': premise-free restatement of the canonicity brick.
- xor_top_bit (ToBytesMath): setting a clear top bit by XOR is addition -
  proven from xor_div_two_pow + and_xor_distrib_right, no bit-blasting.

The chain is entirely certified code: invert (Fermat), two muls, to_bytes
(canonicity), is_negative, and the sign-bit XOR. Axiom cone of
ed_compress_spec: exactly [propext, Classical.choice, Quot.sound].

check.sh: CompressSpec in PROOFS, ed_compress_spec in CERTS - full button
green fresh.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-05 13:33:58 +02:00