subject
Computers and Technology, 17.04.2020 22:55 56340

Given positive integers a and b, we want to compute some integers s and t such that gcd(a, b) = sa + tb.

Consider the following iterative program LIN_COMB(a, b) which is supposed to accomplish this:

Initialize variables c = a, d = b, s0 = 1, t0 = 0, s1 = 0, t1 = 1

While c 6= d, do the following:

If c < d, then decrement d by c, decrement s1 by s0, decrement t1 by t0

Else if c > d, then decrement c by d, decrement s0 by s1, decrement t0 by t1

Return s0 and t0.

a) Prove that (c = s0a + t0b) ∧ (d = s1a + t1b) is a loop invariant for the while loop in LIN_COMB.

b) Assume, in addition to (a), that gcd(a, b) = gcd(c, d) is a loop invariant for the while loop in LIN_COMB. Prove that LIN_COMB satisfies partial correctness.

c) Prove that (c > 0) ∧ (d > 0) is a loop invariant for the while loop in LIN_COMB.

d) Use the well-ordering principle and (c) to prove that LIN_COMB satisfies termination.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 19:20
Number of megabytes of ram in a computer. qualitative or quantitative? because
Answers: 3
question
Computers and Technology, 22.06.2019 18:40
Mariah was working on a multimedia presentation that included both video and audio files. the file was huge, and she wanted to send it to her coworker in another office. she needed to reduce the size of the file so that it could be transmitted faster. the utility she used to do this was
Answers: 2
question
Computers and Technology, 24.06.2019 04:30
What is the process in which the software development team compiles information to determine the final product
Answers: 1
question
Computers and Technology, 24.06.2019 12:00
How can we take picture in this app
Answers: 1
You know the right answer?
Given positive integers a and b, we want to compute some integers s and t such that gcd(a, b) = sa +...
Questions
question
English, 11.04.2021 01:00
question
Mathematics, 11.04.2021 01:00
question
Mathematics, 11.04.2021 01:10
question
English, 11.04.2021 01:10
question
Mathematics, 11.04.2021 01:10
Questions on the website: 13722367