Skip to content

Prove PeerAuthPQ_implies_PeerAuth via definitional refactor#2

Merged
ChristianoBraga merged 1 commit intoBeneficial-AI-Foundation:mainfrom
yurekami:prove-peer-auth-pq-implies-peer-auth
May 3, 2026
Merged

Prove PeerAuthPQ_implies_PeerAuth via definitional refactor#2
ChristianoBraga merged 1 commit intoBeneficial-AI-Foundation:mainfrom
yurekami:prove-peer-auth-pq-implies-peer-auth

Conversation

@yurekami
Copy link
Copy Markdown

Summary

Closes the sorry in PeerAuthPQ_implies_PeerAuth (PQXDHLean/SecurityDefs.lean:402) by making the relationship between PeerAuthPQ and PeerAuth structural rather than opaque.

The previous formulation left both PeerAuth and PeerAuthPQ as opaque Props, which makes the implication literally unprovable — Lean cannot relate two unrelated opaque declarations. The theorem's docstring, and the verilib probe metadata (effort := \"small\", priority := \"medium\"), indicate that a small structural change was intended.

Change

In PQXDHLean/SecurityDefs.lean:

  • Add opaque PQSPKAgreement — the extra conjunct that distinguishes Theorem 6 from Theorem 2 (KEM public-key agreement, established under the SH-CR assumption per §5.3.2 p. 480).
  • Change opaque PeerAuthPQdef PeerAuthPQ := PeerAuth ∧ PQSPKAgreement, matching the existing docstring ("Extended peer authentication — PeerAuth plus agreement over the PQSPK").
  • Replace sorry with And.left.

Net: +24 / -5 in one file.

Fidelity to the spec

The paper (Bhargavan et al., USENIX Security 2024, §5.3.2) defines PeerAuthPQ as strictly PeerAuth strengthened with PQSPK agreement. The new def is the minimal Lean encoding of exactly that statement. PQSPKAgreement remains opaque for the same reason PeerAuth is — its truth is established externally (via CryptoVerif / the SH-CR reduction), not internally.

Downstream impact

  • PQXDH_KEM_pubkey_agreement (Theorem 6, PQXDHLean/PQXDH.lean:437) produces PeerAuthPQ as its conclusion. With PeerAuthPQ now a conjunction, that theorem's goal unfolds to PeerAuth ∧ PQSPKAgreement — arguably a more honest proof obligation than the opaque form. Its body is still sorry in the repo; unchanged by this PR.
  • No other callers consume PeerAuthPQ.
  • Doc source (docs/PQXDHDocs/DocSecurityDefs.lean:134) uses :::definition, which accepts either opaque or def. No docs change required.

Verification

lake build
# Build completed successfully (2748 jobs).

Before: SecurityDefs.lean:402 emitted declaration uses 'sorry'.
After: that warning is gone. The five unrelated sorrys in PQXDH.lean (258, 298, 371, 408, 437) are unchanged.

Test plan

  • lake build passes on Lean v4.28.0 / Mathlib v4.28.0
  • grep -n sorry PQXDHLean/SecurityDefs.lean returns no hits (was: line 403)
  • Maintainers: confirm the def form is acceptable for the Verso blueprint (docs build)

…l refactor

Converts PeerAuthPQ from an opaque Prop to a def over
`PeerAuth ∧ PQSPKAgreement`, making the implication theorem fall out
as `And.left`.

The previous opaque formulation made the theorem unprovable: Lean
cannot relate two unrelated opaque Props. The docstring already stated
the intended semantics ("PeerAuthPQ = PeerAuth plus PQSPK agreement"),
so this change makes the structure faithful to the spec.

Changes:
- New `opaque PQSPKAgreement` carrying the extra conjunct that
  distinguishes Theorem 6 from Theorem 2 (KEM public-key agreement,
  established under the SH-CR assumption).
- `PeerAuthPQ` becomes `def ... := PeerAuth ∧ PQSPKAgreement`.
- `PeerAuthPQ_implies_PeerAuth` proved as `And.left` (was `sorry`).

Downstream impact: `PQXDH_KEM_pubkey_agreement` (Theorem 6) still
produces `PeerAuthPQ` — it now has to produce both conjuncts, which
is closer to what its existing (still `sorry`) proof obligation
actually requires. No other callers consume `PeerAuthPQ`.

Build: `lake build` passes (2748 jobs). The previous sorry warning
at SecurityDefs.lean:402 is gone; unrelated PQXDH.lean sorrys
remain unchanged.

verilib probe 'peer_auth_pq_implies_peer_auth' was marked
`effort := "small"`; this matches that sizing.
Copy link
Copy Markdown

@jinxinglim jinxinglim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Copy link
Copy Markdown
Contributor

@ChristianoBraga ChristianoBraga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me too.

@ChristianoBraga ChristianoBraga merged commit 572a4fb into Beneficial-AI-Foundation:main May 3, 2026
1 check passed
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.

4 participants