State and prove the loop invariant

s <= 0

x <= 1

i <= 0

//

while i<n do

//

i <= i+1

//

s <= s+x

//

x<=x/2