

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
An overview of mathematic induction and its application to program correctness. Two approaches to ensuring program correctness: testing and proof. Testing is compared to csc370, where outputs are compared to expected results, but it requires much manual effort and cannot show that a program is error-free. Proof, on the other hand, is a rigorous, mathematical analysis of the algorithm, which is important for critical programs like medical diagnostic and flight avionics. The document also includes an example of euclid's algorithm and a proof of its termination.
Typology: Assignments
1 / 3
This page cannot be seen from the preview
Don't miss anything!
12 September , Day 5 Handout – mathematic induction Written Assignment #1 due (on Chemnitz/Student Data) Return/Review Systems Assignment #0 (great ideas – Post) “professional programming practice” Written Assignment #2 (chapter 10) assigned – due in one week, Day 7 System Assignment #1 (first presentation) topic due next time Chapter 10 Program Correctness Two Approaches
Note: debugging is different from testing Note: if proof is correct, we have confidence in program if proof fails, then it may be due to a logic error (bug) in the program and the proof helps us to find that error {test: it’s not just that proof fails, therefore, we have to debug entire program to find out what’s wrong – where proof fails points to error in program} Again, Dewdney “suddenly” does something on page 64. The 15, 9, and 3 bar are obvious. But what happens when he gets to 16 and 22 bar? Notice that we suddenly have something “left over” and this is repeated. Well, this is Euclid’s algorithm. Don’t get hung up here … keep reading. (As we mentioned before, good to read chapter straight through first, and then re-read) Follow algorithm on page 65 for 16, 22 while M=16 > 0 (M=16, N=22) L = N mod M = 22 mod 16 = 6 N = M = 16 M = L = 6 while M=6 > 0 (M=6, N=16) L = N mod M = 16 mod 6 = 4 N = M = 6 M = L = 4 while M=4 > 0 (M=4, N=6) L = N mod M = 6 mod 4 = 2 N = M = 4 M = L = 2 while M=2 > 0 (M=2, N=4) L = N mod M = 4 mod 2 = 0 N = M = 2 M = L = 0 while M=0 > 0 false N =2, the gcd Now, you “desk check” (follow) the algorithm for M=10 and N=35. What is GCD? What is N? (5) Interesting: relationship between graphical ruler on page 64 and modulo on page 65 Now, follow proof … beginning on bottom of page 66: