Question: exercise 6 ( solution in ex 6 . dfy ) 7 marks. A bad neighbour in an array is a neighbouring pair of elements that
exercise solution in exdfy marks. A bad neighbour in an array is a neighbouring pair of elements that sum to a negative integer. In this exercise, the first and last elements of an array of length at least are considered neighbours. For example, the arrays and each contains at least one bad neighbour. The arrays and do not contain any bad neighbours. Create a file exdfy that contains a Dafny predicate with signature: predicate badneighboura: array which is true if the given input array contains at least one bad neighbour and is false otherwise. There are no restrictions on the size of the array. Validate that your predicate works correctly by writing a validator method called ValBadNeighbour. Submit the file exdfy which should contain the predicate badneighbour and the method ValBadNeighbour. Notice the predicate name badneighbour consists of lowercase letters only. Your Dafny programs will be partly automarked so it is important that the names of the methods and the predicate, and the filenames, are spelt correctly and are casecorrect.
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
