CMPUT272 Lecture Notes - Lecture 12: Halting Problem, Natural Number

44 views2 pages

Document Summary

Prove _correct_ for all (legal) inputs: it terminates, output needs to be correct. (according to specifications) Given a coffee can that contains some white beans and some black beans, A varient (of a loop) is an arithmetic expression that. An invarient (of a loop) is a logical expression that. Evaluates to true in each iteration of the loop. And, since w = w, w = w(mod2). Once more through the loop, suppose the loop has executed an arbitrary number of times. Let wc and bc be the current values of w and b. Assume the loop continues its execution, that is wc+bc. Let wn and bn be the values of w and b after the next iteration of the loop. In both cases wn+bn = wc+bc-1, therefor bn + wn 0 by precondition. Once through the loop, let wc and bc be the current values of w and b. therefore wc + bc wn + bc < wc + bc.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents

Related Questions