001_Baddam_Krishna_Assignment_4

001_Baddam_Krishna_Assignment_4 - CS536 1A. a) Law of...

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

View Full Document Right Arrow Icon
CS536 Homework #4 CWID:A20193023 1A. a) Law of excluded miracle: wp(S,false)=false wp(s1;s2,false)=wp(s1,wp(s2,false)) Using semicolon definition wp(s1;s2,Q)=wp(s1,wp(s2,Q)) =wp(s1,false) Using Law of excluded miracle =false Semicolon satisfies Law of excluded miracle b) Law of monotonicity: If Q=>R, then wp(S,Q)=>wp(S,R) If Q=>R, then wp(s1;s2,Q)=>wp(s1;s2,R) wp(s1,wp(s2,Q)) Let wp(s2,Q)=Q’ Solve from bottom now Q’=>R’ i.e., wp(s1,Q’)=>wp(s1,R’) using law of monotonicity Substituting values for Q’ and R’ wp(s1,wp(s2,Q))=>wp(s1,wp(s2,R)) wp(s1,wp(s2,R)) Let wp(s2,R)=R’ wp(s1;s2,R) Semicolon satisfies Law of monotonicity c) Law of distributivity of conjunction: wp(S,Q)^wp(S,R)=wp(S,Q^R) wp(s1;s2,Q)^wp(s1;s2,R) wp(s1,wp(s2,Q))^wp(s1,wp(s2,R)) wp(s1,wp(s2,Q)^wp(s2,R)) using law of distributivity of conjunction wp(s1,wp(s2,Q^R))
Background image of page 1

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

View Full DocumentRight Arrow Icon
wp(s1;s2,Q^R) Semicolon satisfies Law of distributivity of conjunction d) Law of distributivity of disjunction: wp(S,Q)vwp(S,R)=>wp(S,QvR) wp(s1;s2,Q)vwp(s1;s2,R) wp(s1,wp(s2,Q))vwp(s1,wp(s2,R)) wp(s1,wp(s2,Q)vwp(s2,R)) Using Law of distributivity of disjunction wp(s1,wp(s2,QvR)) wp(s1;s2,QvR) Semicolon satisfies Law of distributivity of disjunction. 2A. a). Law of Excluded miracle: To Prove: wp(select,false) = false wp(select,false) = {Ei 1<=i<=n : Bi} ^ {Ai 1<=i<=n Bi=> wp(Si,false)} = {Ei 1<=i<=n : Bi} ^ {Ai 1<=i<=n Bi=>false} (since Si is a legitimate construct and it satisfies law I) If some Bi is true then {Ei 1<=i<=n : Bi} is true ^ {Ai 1<=i<=n Bi=>false} is false Because true => false is fasle Hence True and false = flase =RHS If all B’s are False and False ^ {Ai 1<=i<=n Bi=>false} is false = RHS b). Distributivity of conjunction To prove: Wp(select,Q) ^ wp(select,R) = wp(select, Q^R) {Ei 1<=i<=n : Bi} ^ {Ai 1<=i<=n Bi=> wp(Si,Q)} ^
Background image of page 2
{Ei 1<=i<=n : Bi} ^ {Ai 1<=i<=n Bi=> wp(Si,R)} = {Ei 1<=i<=n : Bi} ^ {Ai 1<=i<=n Bi=> wp(Si,Q) ^ Bi=> wp(Si,R)} Since Si is a legitimate construct and it satifies law I ={Ei 1<=i<=n : Bi} ^ {Ai 1<=i<=n Bi=> wp(Si,Q ^ R)} (from law of Distributivity of conjunction =RHS c). Law of Monotonicity If Q=> R then wp(Select,Q) => wp(Select,R) wp(Select,Q) = {Ei 1<=i<=n : Bi} ^ {Ai 1<=i<=n Bi=> wp(Si,Q)}
Background image of page 3

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

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

Page1 / 8

001_Baddam_Krishna_Assignment_4 - CS536 1A. a) Law of...

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

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