Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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