





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






Correctness By Construction © John C. Knight 2009, All Rights Reserved 2
Correctness By Construction © John C. Knight 2009, All Rights Reserved 3
Correctness By Construction © John C. Knight 2009, All Rights Reserved 4
Correctness By Construction © John C. Knight 2009, All Rights Reserved 7
Correctness By Construction © John C. Knight 2009, All Rights Reserved 8
Correctness By Construction © John C. Knight 2009, All Rights Reserved 9
Correctness By Construction © John C. Knight 2009, All Rights Reserved 10
Correctness By Construction © John C. Knight 2009, All Rights Reserved 19
Correctness By Construction © John C. Knight 2009, All Rights Reserved 20
Correctness By Construction © John C. Knight 2009, All Rights Reserved 21
Correctness By Construction © John C. Knight 2009, All Rights Reserved 22
Correctness By Construction © John C. Knight 2009, All Rights Reserved 25
Correctness By Construction © John C. Knight 2009, All Rights Reserved 26
Correctness By Construction © John C. Knight 2009, All Rights Reserved 27
Correctness By Construction © John C. Knight 2009, All Rights Reserved 28
Correctness By Construction © John C. Knight 2009, All Rights Reserved 37
Correctness By Construction © John C. Knight 2009, All Rights Reserved 38
Correctness By Construction © John C. Knight 2009, All Rights Reserved 39
Correctness By Construction © John C. Knight 2009, All Rights Reserved 40
Access types needed for dynamic storage management
dependability—need to prove that storage
Generally infeasible Also need to ensure no memory leaks, no dangling pointers, etc. A pointer!^ ^ Note: The Java approach is not a solution
Correctness By Construction © John C. Knight 2009, All Rights Reserved 43
Correctness By Construction © John C. Knight 2009, All Rights Reserved 44
Correctness By Construction © John C. Knight 2009, All Rights Reserved 45
Correctness By Construction © John C. Knight 2009, All Rights Reserved 46
package Odometer --# own Trip, Total : Integer; is
procedure Zero_Trip; --# global out Trip; --# derives Trip from ; --# post Trip = 0;
function Read_Trip return Integer; --# global in Trip;
function Read_Total return Integer; --# global in Total;
procedure Inc; --# global in out Trip, Total; --# derives Trip from Trip & Total from Total; --# post Trip = Trip~ + 1 and Total = Total~ + 1;
end Odometer;
package body Odometer is Trip, Total : Integer;
procedure Zero_Trip is begin Trip := 0; end Zero_Trip;
function Read_Trip return Integer is begin return Trip; end Read_Trip;
function Read_Total return Integer is begin return Total; end Read_Total;
procedure Inc is begin Trip := Trip + 1; Total := Total + 1; end Inc;
end Odometer;