1. Homepage
  2. Homework
  3. CS 536: Science of Programming - HW5 : Weakest Preconditions 1 & 2; Domain Predicates
This question has been solved

CS 536: Science of Programming - HW5 : Weakest Preconditions 1 & 2; Domain Predicates

Engage in a Conversation
USIITIllinois Institute of TechnologyCS 536CS536Science of ProgrammingWeakest PreconditionsDomain Predicates

Weakest Preconditions 1 & 2; Domain Predicates CourseNana.COM

CS 536: Science of Programming, Spring 2023 Due Mon Feb 27, 11:59 pm CourseNana.COM

Problems [60 points total]
Class 10: Weakest Preconditions part 1 [27 points] CourseNana.COM

1. [3points]LetIF ≡ ifB1 S1 B2 S2 fi andletw1wlp(S1,q)andw2wlp(S2,q). Question: Whyiswlp(IF,q)(B1→w1)(B2→w2) butnot(B1w1)(B2w2). CourseNana.COM

2. [4 points] Which of the following statements behave differently depending on whether S is deterministic or nondeterministic? Explain briefly. CourseNana.COM

wp(S,pq)→wp(S,p)wp(S,q) wp(S,p)wp(S,q)→wp(S,pq) wp(S,pq)→wp(S,p)wp(S,q) wp(S,p)wp(S,q)→wp(S,pq) CourseNana.COM

3. [20=5*4 points] Consider the statement σ{wlp(S,q)}S{q}. If σ satisfies the precondi- tion, then σ{wlp(S,q)}S{q} is satisfied when CourseNana.COM

·       M ( S , σ ) –  q (description using meaning functions) CourseNana.COM

·       For all τ  M ( S , σ ), τ =  or τ q (equivalent description using states/logic) (Note the description is correct whether S is deterministic or nondeterministic.) CourseNana.COM

For each of the statements below, assume σ satisfies the precondition and give the mean- ing function requirement and the equivalent logical description. If not specified, S could be deterministic or nondeterministic. If S is deterministic, it could be helpful to use the phrase M(S,σ)={τ}. CourseNana.COM

1.     σ⊭{wlp(S,q)}S{q} CourseNana.COM

2.     σtot {¬wlp(S,q)}S{¬q}, if S is deterministic CourseNana.COM

3.     σtot {wp(S,q)}S{q} CourseNana.COM

4.     σ⊭tot {wp(S,q)}S{q} CourseNana.COM

5.     σ{¬wp(S,q)}S{¬q}, if S is deterministic CourseNana.COM

CS Dept, Illinois Institute of Technology – 1 – © James Sasaki, 2023 CourseNana.COM

CS 536: Science of Programming Wed 2023-02-15, 19:50 HW 5: Classes 10 - 11 Class 11: Weakest Preconditions part 2 [9 points] CourseNana.COM

4. [9 points] Calculate wlp ( if x < 0 then x := – x fi, x2 ≥ x ). (Don't forget the implicit "else skip" clause.) You can omit intermediate calculations but they might be worth partial credit. After syntactically calculating the wlp, logically simplify the result. (Textual simplifications like
p
p ≡ p are always allowed.) CourseNana.COM

1.     [3 points] Calculate the wlp of the true branch CourseNana.COM

2.     [2 points] Calculate the wlp of the false branch CourseNana.COM

3.     [2 points] Calculate the overall wlp. CourseNana.COM

4.     [2 points] Give the result after logical/arithmetic simplification. CourseNana.COM

Class 11: Domain Predicates [24 points] CourseNana.COM

Calculate the wp 's below. Show your intermediate calculations. You can logically simplify your answer as you go and/or at the end or not at all (your preference). (Textual simplifications like p p ≡ p are always allowed.) CourseNana.COM

5.     [12=4*3 points] wp(S,q) where S≡ y:=y/x and q≡sqrt(y)<x. CourseNana.COM

1.     Calculate D ( S ). CourseNana.COM

2.     Calculate w≡wlp(S,q). CourseNana.COM

3.     Calculate D ( w ). CourseNana.COM

4.     Calculatewp(S,q) (it'sD(S)wD(w)). CourseNana.COM

6.     [12=4*3 points] wp(S,q) where S≡if y≥0 then x:=y/x else x:=–x/y fi and q≡r<x≤y. CourseNana.COM

1.     Calculate D ( S ). CourseNana.COM

2.     Calculate w≡wlp(S,q). CourseNana.COM

3.     Calculate D ( w ). CourseNana.COM

4.     Calculate wp(S,q). CourseNana.COM


  CourseNana.COM

Get in Touch with Our Experts

WeChat (微信) WeChat (微信)
Whatsapp WhatsApp
US代写,IIT代写,Illinois Institute of Technology代写,CS 536代写,CS536代写,Science of Programming代写,Weakest Preconditions代写,Domain Predicates代写,US代编,IIT代编,Illinois Institute of Technology代编,CS 536代编,CS536代编,Science of Programming代编,Weakest Preconditions代编,Domain Predicates代编,US代考,IIT代考,Illinois Institute of Technology代考,CS 536代考,CS536代考,Science of Programming代考,Weakest Preconditions代考,Domain Predicates代考,UShelp,IIThelp,Illinois Institute of Technologyhelp,CS 536help,CS536help,Science of Programminghelp,Weakest Preconditionshelp,Domain Predicateshelp,US作业代写,IIT作业代写,Illinois Institute of Technology作业代写,CS 536作业代写,CS536作业代写,Science of Programming作业代写,Weakest Preconditions作业代写,Domain Predicates作业代写,US编程代写,IIT编程代写,Illinois Institute of Technology编程代写,CS 536编程代写,CS536编程代写,Science of Programming编程代写,Weakest Preconditions编程代写,Domain Predicates编程代写,USprogramming help,IITprogramming help,Illinois Institute of Technologyprogramming help,CS 536programming help,CS536programming help,Science of Programmingprogramming help,Weakest Preconditionsprogramming help,Domain Predicatesprogramming help,USassignment help,IITassignment help,Illinois Institute of Technologyassignment help,CS 536assignment help,CS536assignment help,Science of Programmingassignment help,Weakest Preconditionsassignment help,Domain Predicatesassignment help,USsolution,IITsolution,Illinois Institute of Technologysolution,CS 536solution,CS536solution,Science of Programmingsolution,Weakest Preconditionssolution,Domain Predicatessolution,