-
Notifications
You must be signed in to change notification settings - Fork 2
Prove globals #164
Comments
The global state consists of the application state and the platform state. The platform state should have been modeled initially by the session objects. However this is not always possible as some modifications on the platform do not depend on changes in the session object. To model this an abstract The application state is fully visible to the application. However some procedures that access the application state but are called from within platform code. As this code is platform specific it cannot model global state correctly. There are two different scenarios:
|
When trying to prove the globals I noticed that global state from a withed package must always be annotated to the procedure accessing it directly. As it is not hidden it cannot be refined. This leads to the problem that specs would have to import platform dependent units just to define their global state. I see two solutions:
|
For the first option I came up with the following idea: package Platform with
SPARK_Mode,
Abstract_State => Platform_State
is
end Platform;
package body Platform with
SPARK_Mode,
Refined_State => (Platform_State => null)
is
end Platform;
private package Platform.Implementation with
SPARK_Mode,
Abstract_State => (Implementation_State with Part_Of => Platform.Platform_State)
is
procedure Do_Something with
Global => (In_Out => Implementation_State);
end Platform.Implementation;
package Platform.Definition with
SPARK_Mode
is
procedure Run with
Global => (In_Out => Platform.Platform_State);
end Platform.Definition;
package body Platform.Definition with
SPARK_Mode
is
procedure Run
is
begin
Platform.Implementation.Run;
end Run;
end Platform.Implementation; In this case if another unit wants to use a functionality of platform, its state will always be |
Fixed by #173. |
No description provided.
The text was updated successfully, but these errors were encountered: