Question: 2 . Specifications ( 1 0 p , Questions 7 9 ) Recall that we often want to translate specifications written in English into predicate
Specifications p Questions Recall that we often want to translate specifications written in English into predicate logic. For example, we may translate Bn
contains duplicates into i j in n : i j Bi Bj Now consider the specification:
Given a nonincreasing array Bn and a value v return if v does not occur
in Bn but otherwise return the index of one of the occurrences.
Example: if B is
then if v then must be returned;
if v then must be returned; if v then either or must be returned.
For that specification, you must express in predicate logic
p the precondition, that is what is assumed about Bn and v
and next the postcondition, that is what is required about r where r is the value returned.
We can write the postcondition as r Phi r Phi
p What should Phi be
p What should Phi be
Whenever B occurs in your specification it must be as part
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
