Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started