Skip to content

Support proving a frame condition when moving ownership of handles - #25

Merged
damaki merged 3 commits into
mainfrom
topic/move-frame-condition
Jun 11, 2026
Merged

Support proving a frame condition when moving ownership of handles#25
damaki merged 3 commits into
mainfrom
topic/move-frame-condition

Conversation

@damaki

@damaki damaki commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Moving ownership of a handle using Move does not modify the primitive, but this cannot be fully expressed in the postcondition of Move because the primitive types are limited types, so it is not possible to refer to the 'Old value of the primitive in the postcondition. Instead, the postcondition of Move proves that certain properties are preserved during the move, such as Valid_Request.

In some cases, however, it is useful to prove that the arbitrary properties on the primitives are also preserved during the move. For example, proving that the value of a primitive has not changed.

This change adds new, generic variants of Move that can be instantiated with arbitrary, user-defined properties which are proven to be preserved during the move in the postcondition.

The postcondition of the exiting Move procedures is also strengthened.

damaki added 3 commits June 10, 2026 20:26
The location of these annotations has changed for more recent versions
of GNATprove. We keep the annotations in both locations to support a
wider range of tool versions.
The Move procedure does not modify the stored primitive objects, and
the postcondition of Move attempts to express this. However, since
Request_Type and Confirm_Type are limited types, we cannot simply
express that Request = Request'Old. Instead, we express that _properties_
on those primitives are preserved. This change adds some missing
properties to the postcondition.

This also required adding a Requires_Cleanup function for Service_Handles.
Moving ownership of a handle using `Move` does not modify the primitive,
but this cannot be fully expressed in the postcondition of `Move` because
the primitive types are limited types, so it is not possible to refer to
the `'Old` value of the primitive in the postcondition. Instead, the
postcondition of `Move` proves that certain properties are preserved
during the move, such as Valid_Request.

In some cases, however, it is useful to prove that the arbitrary properties
on the primitives are also preserved during the move. For example, proving
that the value of a primitive has not changed.

This change adds new, generic variants of Move that can be instantiated with
arbitrary, user-defined properties which are proven to be preserved during
the move in the postcondition.
@damaki damaki self-assigned this Jun 10, 2026
@damaki damaki added the enhancement New feature or request label Jun 10, 2026
@damaki
damaki merged commit c18596d into main Jun 11, 2026
9 checks passed
@damaki
damaki deleted the topic/move-frame-condition branch June 11, 2026 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant