Skip to content

Map auto-generated impl proofs to their implements clause in dependency analysis#1049

Draft
jcp19 wants to merge 2 commits into
keuscha/dependency_analysis_refactoringfrom
claude/gobra-issue-1042-ix9p2e
Draft

Map auto-generated impl proofs to their implements clause in dependency analysis#1049
jcp19 wants to merge 2 commits into
keuscha/dependency_analysis_refactoringfrom
claude/gobra-issue-1042-ix9p2e

Conversation

@jcp19

@jcp19 jcp19 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

For an implementation proof that Gobra generates itself (the user wrote an implements clause but no proof body, or only a partial one), the Viper nodes of the generated proof previously inherited their dependency-analysis source from wherever they were built: the interface method's pre-/postconditions, the concrete method declaration, and its implicit pre-/postconditions. As a result the dependency analysis reported the proof's obligations as several unrelated Gobra nodes instead of one, and duplicated interface-spec nodes (issue #1042).

This attaches the implements clause as the dependency-analysis source info of every Viper node of the generated proof, so the analysis presents them as a single dependency node (the clause). The change is confined to the dependency analysis: each node's Verifier.Info, position and error transformer are left untouched, so the position of verification errors is unchanged. Proofs without an implements clause and user-provided proof bodies are left exactly as before.

  • MethodSubtypeProof / PureMethodSubtypeProof carry the optional clause source.
  • Desugar looks up the clause via a new TypeInfo.localImplementationProofNode.
  • InterfaceEncoding stamps the clause source over the generated proof subtree.

Claude-Session: https://claude.ai/code/session_017ooFpeAJHUgFCaStKfdUTy

…ency analysis

For an implementation proof that Gobra generates itself (the user wrote an
`implements` clause but no proof body, or only a partial one), the Viper nodes
of the generated proof previously inherited their dependency-analysis source
from wherever they were built: the interface method's pre-/postconditions, the
concrete method declaration, and its implicit pre-/postconditions. As a result
the dependency analysis reported the proof's obligations as several unrelated
Gobra nodes instead of one, and duplicated interface-spec nodes (issue #1042).

This attaches the `implements` clause as the dependency-analysis source info of
every Viper node of the generated proof, so the analysis presents them as a
single dependency node (the clause). The change is confined to the dependency
analysis: each node's Verifier.Info, position and error transformer are left
untouched, so the position of verification errors is unchanged. Proofs without
an `implements` clause and user-provided proof bodies are left exactly as
before.

- MethodSubtypeProof / PureMethodSubtypeProof carry the optional clause source.
- Desugar looks up the clause via a new TypeInfo.localImplementationProofNode.
- InterfaceEncoding stamps the clause source over the generated proof subtree.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017ooFpeAJHUgFCaStKfdUTy
…ncy node

Extends the previous change so that generated implementation proofs are handled
in both cases the dependency analysis cares about:

- With an `implements` clause: all Viper nodes of the generated proof are
  presented as the single clause node (as before).
- Without a clause (the proof is demanded e.g. only by an upcast): all its
  Viper nodes are grouped into one node marked internal via DependencyType
  Internal, so it stays in the lower-level graph and is hidden from the user,
  while the existing SimpleDependencyAnalysisJoin tags keep it connected to the
  corresponding upcasts.

An auto-generated check on the AutoImplProofAnnotation distinguishes generated
proofs from user-provided ones (both carry no clause source), so user-provided
proofs remain untouched. Verifier.Info, positions and error transformers are
preserved throughout, so verification error positions are unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017ooFpeAJHUgFCaStKfdUTy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants