assignment 7

assignment 7 - CS-536 Fall 2008 Assignment #7Due date Nov...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS-536 Fall 2008 Assignment #7Due date Nov 10, by midnightMain, Internet and Bangalore sections.------------------------------------------------------------Q1.For the following programs, prove termination only. State your WFS (Well Founded Set), TF (termination function) and T-INV. (WFS can be the Natural numbers)a)P:{True}(10 pt.)i,s := 10,0;loopselecti!=0 => i,s := i-1,s+b[i]End loopselectR:{s=(=101][kkb)}Sol:Step 1:{True}i := 10; s := 0;=TrueStep 2:{ 0<i10 ^ s==ikkb1][) ^ i!=0 i (0<i10)Step 3:={ 0<i10 ^ s==ikkb1][) ^ i!=0 OLD-T:=i; i,s := i-1,s+b[i]{OLD-T<TF}={ 0<i10 ^ s==ikkb1][) ^ i!=0 {OLD-T>TF}ii-1 ss+b[i] OLD-Ti ={ 0<i10 ^ s==ikkb1][) ^ i!=0 {OLD-T>i}ii-1 ss+b[i] OLD-Ti ={ 0<i10 ^ s==ikkb1][) ^ i!=0 {OLD-T>i-1}ss+b[i] OLD-Ti ={ 0<i10 ^ s==ikkb1][) ^ i!=0 {i>i-1}Trueb)(10 pt.)P:{0<n}i:=1;loopselect2*i<=n => i:=2*iEnd loopselectR:{ 0<i<=n<2*i ^ 5p: i=p2}Sol:W={1,2,.i/2}Step 1: {0<n}i=1;TrueStep 2:{T-INV ^ B }=> N {i>=1 ^ 2*i<=n}=>N...
View Full Document

Page1 / 6

assignment 7 - CS-536 Fall 2008 Assignment #7Due date Nov...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online