Skip to content

Prove referent validity implications for native trait impls - #3890

Open
joshlf wants to merge 1 commit into
Gd7mcbq7u5yus3mis4yyvjdxx6qo4trg6from
Gsrhkadysza6axfyzqxp4iamxj6iko5ex
Open

joshlf wants to merge 1 commit into
Gd7mcbq7u5yus3mis4yyvjdxx6qo4trg6from
Gsrhkadysza6axfyzqxp4iamxj6iko5ex

Conversation

@joshlf

@joshlf joshlf commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Annotate Validity, TransmuteFrom, and CastableFrom, and prove 24 native
implementation laws: the four validity markers, four blanket transfers,
twelve wrapper directions, two Cell/UnsafeCell chains, and the two
permitted type-independent state pairs. Safe contents must pass the
retained physical and mathematical decoders. Empty safe domains remain
valid without constructing an inhabitant.

Attach optional state codes to the existing generated providers for the
four empty marker types, and check each against its actual Validity::KIND.
Keep the original Rust trait signatures. Missing metadata cannot silently
select a weaker state, and missing physical support supplies no decoder
view from which to apply a content law.

Add generic and concrete Rust clients that consume the actual dictionaries.
Check their proofs against independent byte-content expectations, retaining
all original inputs and model providers. Add negative controls for invalid
boolean bytes, extra proof premises, replaced providers, missing support,
and forbidden results even outside the interpreted state cases. Refresh
the golden models and generated annotation snapshots.

These are conditional referent-content claims, not pointer access or
resource proofs. AsInitialized contents and opaque MaybeUninit storage
remain deferred.

Authored by an AI agent acting on joshlf's behalf.


Latest Update: v4 — Compare vs v3

📚 Full Patch History

Links show the diff between the row version and the column version.

Version v3 v2 v1 Base
v4 vs v3 vs v2 vs v1 vs Base
v3 vs v2 vs v1 vs Base
v2 vs v1 vs Base
v1 vs Base
⬇️ Download this PR

Branch

git fetch origin refs/heads/Gsrhkadysza6axfyzqxp4iamxj6iko5ex && git checkout -b pr-Gsrhkadysza6axfyzqxp4iamxj6iko5ex FETCH_HEAD

Checkout

git fetch origin refs/heads/Gsrhkadysza6axfyzqxp4iamxj6iko5ex && git checkout FETCH_HEAD

Cherry Pick

git fetch origin refs/heads/Gsrhkadysza6axfyzqxp4iamxj6iko5ex && git cherry-pick FETCH_HEAD

Pull

git pull origin refs/heads/Gsrhkadysza6axfyzqxp4iamxj6iko5ex

Stacked PRs enabled by GHerrit.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T19:07:25.691568Z 3c48caa PR opened
🔒 Security Review ✅ Completed 2026-10-15T19:07:40.668585Z 3c48caa PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

This was referenced Oct 15, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request formalizes and verifies referent validity implications within the Aeneas verification framework for zerocopy. It updates design documentation, adds Lean models and proofs for validity markers and transparent wrappers, and introduces verification clients in zerocopy/src/pointer/referent_checks.rs. The feedback suggests a minor refactoring in the newly added referent_checks.rs to move the Dst: ?Sized bounds from the where clauses to the generic parameter lists for consistency with Src: ?Sized.

Comment on lines +27 to +31
fn require_transfer<Src: ?Sized, Dst, SV, DV>()
where
Dst: TransmuteFrom<Src, SV, DV> + ?Sized,
{
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

For consistency with Src: ?Sized in the generic parameter list, it is more idiomatic to declare Dst: ?Sized in the generic parameter list as well, rather than relaxing the bound in the where clause.

Suggested change
fn require_transfer<Src: ?Sized, Dst, SV, DV>()
where
Dst: TransmuteFrom<Src, SV, DV> + ?Sized,
{
}
fn require_transfer<Src: ?Sized, Dst: ?Sized, SV, DV>()
where
Dst: TransmuteFrom<Src, SV, DV>,
{
}

Comment on lines +37 to +41
fn require_type_independent<Src: ?Sized, Dst, SV, DV>()
where
Dst: CastableFrom<Src, SV, DV> + ?Sized,
{
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

For consistency with Src: ?Sized in the generic parameter list, it is more idiomatic to declare Dst: ?Sized in the generic parameter list as well, rather than relaxing the bound in the where clause.

Suggested change
fn require_type_independent<Src: ?Sized, Dst, SV, DV>()
where
Dst: CastableFrom<Src, SV, DV> + ?Sized,
{
}
fn require_type_independent<Src: ?Sized, Dst: ?Sized, SV, DV>()
where
Dst: CastableFrom<Src, SV, DV>,
{
}

@codecov-commenter

codecov-commenter commented Oct 15, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 21 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (Gd7mcbq7u5yus3mis4yyvjdxx6qo4trg6@3abac09). Learn more about missing BASE report.

Files with missing lines Patch % Lines
zerocopy/src/pointer/referent_checks.rs 0.00% 21 Missing ⚠️
Additional details and impacted files
@@                         Coverage Diff                          @@
##             Gd7mcbq7u5yus3mis4yyvjdxx6qo4trg6    #3890   +/-   ##
====================================================================
  Coverage                                     ?   48.67%           
====================================================================
  Files                                        ?       35           
  Lines                                        ?     4754           
  Branches                                     ?        0           
====================================================================
  Hits                                         ?     2314           
  Misses                                       ?     2440           
  Partials                                     ?        0           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3c48caa912

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +100 to +101
contentTransfer modelBool boolDecoder (modelUScalar .U8) u8BitDecoder .safe .initialized ∧
contentTransfer (modelUScalar .U8) u8BitDecoder modelBool boolDecoder .initialized .uninit ∧

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Cover every concrete transfer selected by the client

The concrete client invokes six dictionaries, but this independent contract observes only the bool → u8 and u8 → bool transfers and one type-independent pair. In particular, the [u8; 4] → u32 initialized-to-safe call and the ManuallyDrop<u8> → u8 wrapper call on lines 74 and 76 of referent_checks.rs are absent, so their calls can be removed or replaced while concrete_transfers_spec and its required-contract proof still pass. Add postconditions for those transfers (and the omitted Uninit pair) so this harness actually checks every concrete implementation it claims to select.

Useful? React with 👍 / 👎.

@joshlf
joshlf force-pushed the Gd7mcbq7u5yus3mis4yyvjdxx6qo4trg6 branch from 8473f05 to 508e3b3 Compare October 15, 2026 19:25
@joshlf
joshlf force-pushed the Gsrhkadysza6axfyzqxp4iamxj6iko5ex branch from 3c48caa to 21b16c4 Compare October 15, 2026 19:25
Annotate Validity, TransmuteFrom, and CastableFrom, and prove 24 native
implementation laws: the four validity markers, four blanket transfers,
twelve wrapper directions, two Cell/UnsafeCell chains, and the two
permitted type-independent state pairs. Safe contents must pass the
retained physical and mathematical decoders. Empty safe domains remain
valid without constructing an inhabitant.

Attach optional state codes to the existing generated providers for the
four empty marker types, and check each against its actual Validity::KIND.
Keep the original Rust trait signatures. Missing metadata cannot silently
select a weaker state, and missing physical support supplies no decoder
view from which to apply a content law.

Add generic and concrete Rust clients that consume the actual dictionaries.
Check their proofs against independent byte-content expectations, retaining
all original inputs and model providers. Add negative controls for invalid
boolean bytes, extra proof premises, replaced providers, missing support,
and forbidden results even outside the interpreted state cases. Refresh
the golden models and generated annotation snapshots.

These are conditional referent-content claims, not pointer access or
resource proofs. AsInitialized contents and opaque MaybeUninit storage
remain deferred.

gherrit-pr-id: Gsrhkadysza6axfyzqxp4iamxj6iko5ex
Agent-authored-by: AI agent acting on joshlf's behalf

This branch has not been deployed

No deployments
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