Question: For each of the two code samples shown, use the weakest precondition approach to derive any necessary precondition in order to prove that the code
For each of the two code samples shown, use the weakest precondition approach to derive any necessary precondition in order to prove that the code is partially correct with respect to the specification. Sample uses information derived from the tokeneer scenario
Be sure to show each step in the derivation and indicate which proof rules have been used.
Sums method
method Sumsx: int, y: int returns m: int, n: int
ensures m n
var a: int;
m : x;
n : y;
a : m n;
n : n ;
m : a;
Update Alarms method
datatype ALARM silent alarming
method UpdateAlarmsdoorAlarm: ALARM, auditAlarm: ALARM returns alarm: ALARM
ensures alarm alarming
doorAlarm alarmingauditAlarm alarming
if doorAlarm alarming auditAlarm alarming
alarm : alarming;
else
alarm : silent ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
