CMPT 477/777 Formal Verification
Programming Assignment 3
This assignment is due by 11:59pm PT on Friday Nov 15, 2024. Please submit it to Canvas.
Late policy:
Suppose you can get n (out of 100) points based on your code and report
- If you submit before the deadline, you can get all n points.
- If you submit between 11:59pm PT Nov 15 and 11:59pm PT Nov 16, you get n − 10 points.
- If you submit between 11:59pm PT Nov 16 and 11:59pm PT Nov 17, you get n − 20 points.
- If you submit after 11:59pm PT Nov 17, you get 0 points.
- (20 points) Verify the program in Algorithm 1. Note that you cannot change the existing implementation.Algorithm 1 Find an element in the arraymethod Find(a : array⟨int⟩, v : int) returns (index : int)ensures index ≥ 0 → index < a.Length ∧ a[index] = v ensures index < 0 → ∀k. 0 ≤ k < a.Length → a[k] = v
- 1 (30 points) Given a non-empty array of integers, write a method called ArrayMin that finds the minimumvalue min in the array. Verify the method can ensure
- min is less than or equal to all elements in the array
- min is equal to some element in the array
- (30 points) Given an array of coins showing either Front or Back side on top, write a program with aSortCoins method that sorts the coins. Verify it can ensure
- All coins showing the Front side occur before those showing Back
- The sorted array is a permutation of the original array
Deliverable A zip file called P3 SFUID.zip that contains at least the followings:
- A file called P3 SFUID.dfy that contains Dafny programs for the above four questions.
- A report called P3 SFUID.pdf that explains the design choices, features, issues (if any), and anythingelse that you want to explain about your programs.
标签:11,777,CMPT,PT,59pm,points,Verification,array,Nov From: https://www.cnblogs.com/comp9021T2/p/18550697