- #1
vvvidenov
- 23
- 0
Homework Statement
show that {m^5 [tex]\leq[/tex]n^4} is a loop invariant for the loop
while 1 [tex]\leq[/tex] m do
m:= 3m
n: = 4n
Homework Equations
similar solved example:
while 1[tex]\leq[/tex] m do
m:=2m
n: =3n
a) n^2[tex]\geq[/tex] m^3 is given [so 8n^2[tex]\geq[/tex] 8m^3 by multiplying both sides by 8; and 9 n^2 > 8 n^2 because n^2>0]
Hence ("new-n")^2=(3n)^2=9n^2>8n^2[tex]\geq[/tex]8m^3=(2m)^3=("new-m").
So ("new-n")^2[tex]\geq[/tex] ("new-m")
b)2m^6 is given [so 81(2m^6)< 81(n^4) by multiplying by 81, and 64(2m^6) < 81(2m^6)]
Hence 2("new-m")^6=2(2m)^6=2^6*2*m^6<81(2m^6)<81(n^4)=(3n)^4=(new-n")
The Attempt at a Solution
m^5[tex]\leq[/tex]n^4
81(m^5) < 81(n^4), and 64(m^5)< 81(m^5)
("new-m")^5=(3m)^5 < 81 (n^4)= (4n)^4
("new-m") [tex]\leq[/tex] ("new-n")
please help if I did something wrong in this attempt to solve the problem. It is confusing for me even I have the solved one above.
Last edited by a moderator: