1. Homepage
  2. Homework
  3. CS 536: Science of Programming - HW 4: Sequential Nondeterminism // Hoare Triples 1 & 2
This question has been solved

CS 536: Science of Programming - HW 4: Sequential Nondeterminism // Hoare Triples 1 & 2

Engage in a Conversation
USIITIllinois Institute of Technology States Satisfaction State Updates spSequential NondeterminismHoare Triples

Sequential Nondeterminism, Hoare Triples 1 & 2 CS 536: Science of Programming, Spring 2023 CourseNana.COM

Due Thu Feb 16, 11:59 pm [not Sep 16] 2023-02-13: p.1; 2023-02-15: p.2 CourseNana.COM

A. Problems [60 points total] Class 7: Sequential Nondeterminism CourseNana.COM

1. [12 = 2 * 6 points] Let D O be the nondeterministic loop [2023-02-13 do/od keywords] do x≠0 x:=x-1; y:=y+1 x≠0 x:=x-1; y:=y+2 od CourseNana.COM

  1. First, let's work on what what a typical loop iteration does over an arbitrary state σ={x=β,y=δ}. Assume β≥2 and calculate the two states we can be in after a single iter- ationoftheloop. I.e.,whataretheτ whereDO,σ3DO,τ?
  2. Extend part (a) to do κ iterations where 1 < κ ≤ β . What is the set of final states Σ′ we can reachiniterations? I.e.,whatisΣ′={τΣ|DO,σDO,τ}?

Classes 8 & 9: Hoare Triples, pt 1 & 2 CourseNana.COM

2. [16=4*4 points] CourseNana.COM

  1. Using backward assignment, what can we use for precondition p1 in the triple

{p1} b:=b+b{b*c≤d–b}? (Mild hint: Be careful with parenthesization) CourseNana.COM

  1. Using backward assignment, what can we use for p2 in {p2}x:=m{1≤x*y≤n*m} ?
  2. Using backward assignment, what can we use for p3 in { p3 } y := n { p2} ?
  3. Joining parts (b) and (c), what can we use for p4 in {p4}y:=n; x:=m{1≤x*y≤n*m} ?

3. [6=2*3 points] Letp0p,pp1,q0q,andqq1 allbevalid. From{p}S{q},thereare four triples of the form {pi}S{qj}that get by replacing p by p0 or p1 and q by q0 or q1. CourseNana.COM

  1. Ifσ{p}S{q},whichofthefourtriplesσ{pi }S{qj } is/arealsosatisfiedbyσunder? Briefly justify.
  2. Repeat part (a) but under total correctness.

4. [8=2*4 points] Say σ{p1}S{q1} and σ{p2}S{q2}. a. Doesσ{p1p2}S{q1q2}? Justifybriefly.
b. Doesσ
{p1p2}S{q1q2}? Justifybriefly. CourseNana.COM

tions of correctness triples. Assume σ ≠ and S is deterministic.
For (a) and (b), the four statements are σ
{p}S{q}, σ {p}S{¬q}, σ ⊭ {p}S{q}, σ ⊭ {p}S{¬q} CourseNana.COM

  1. [4points] Therearefourstatementsoftheformσ(or⊭){p}S {qor¬q}. Which(if any) of them are implied by σtot {p}S{q}?
  2. [4points] Thereare[2023-02-15]fourstatementsoftheformσ (or⊭){p}S {qor¬q}. Which (if any) of them are implied by σtot {T}S{q}?

For (a) and (c), the four statements are σ {p}S{q}, σ {p}S{¬q}, σ {¬p}S{q}, σ {¬p}S{¬q}
c. [2 points] There are four statements of the form σ{p or ¬p} S {q or ¬q}. When can all CourseNana.COM

four of them be satisfied at the same time, or is it impossible? CourseNana.COM

Definitions
"Σ0partlyp" meansthereisaτΣ0withτp. "Σ0partly⊭p" meansthereisaτΣ0withτ¬p. CourseNana.COM

6. [8 = 2 * 4 points] Now assume that σ ≠ and S is nondeterministic and answer the following questions. CourseNana.COM

  1. Therearefourstatementsoftheformσpartly(or⊭){p}S{qor¬q}. If⊥∉M(S,σ), then which (if any) of them are implied by σ⊭{p}S{q}?
  2. Continuing, which (if any) of the remaining statements can occur (but might not) when σ⊭{p}S{q}?

Get in Touch with Our Experts

WeChat WeChat
Whatsapp WhatsApp
US代写,IIT代写,Illinois Institute of Technology 代写, States Satisfaction代写, State Updates代写, sp代写,Sequential Nondeterminism代写,Hoare Triples代写,US代编,IIT代编,Illinois Institute of Technology 代编, States Satisfaction代编, State Updates代编, sp代编,Sequential Nondeterminism代编,Hoare Triples代编,US代考,IIT代考,Illinois Institute of Technology 代考, States Satisfaction代考, State Updates代考, sp代考,Sequential Nondeterminism代考,Hoare Triples代考,UShelp,IIThelp,Illinois Institute of Technology help, States Satisfactionhelp, State Updateshelp, sphelp,Sequential Nondeterminismhelp,Hoare Tripleshelp,US作业代写,IIT作业代写,Illinois Institute of Technology 作业代写, States Satisfaction作业代写, State Updates作业代写, sp作业代写,Sequential Nondeterminism作业代写,Hoare Triples作业代写,US编程代写,IIT编程代写,Illinois Institute of Technology 编程代写, States Satisfaction编程代写, State Updates编程代写, sp编程代写,Sequential Nondeterminism编程代写,Hoare Triples编程代写,USprogramming help,IITprogramming help,Illinois Institute of Technology programming help, States Satisfactionprogramming help, State Updatesprogramming help, spprogramming help,Sequential Nondeterminismprogramming help,Hoare Triplesprogramming help,USassignment help,IITassignment help,Illinois Institute of Technology assignment help, States Satisfactionassignment help, State Updatesassignment help, spassignment help,Sequential Nondeterminismassignment help,Hoare Triplesassignment help,USsolution,IITsolution,Illinois Institute of Technology solution, States Satisfactionsolution, State Updatessolution, spsolution,Sequential Nondeterminismsolution,Hoare Triplessolution,