1. Homepage
  2. Homework
  3. CS 440: Programming Languages Assignment: Axiomatic Semantics
This question has been solved

CS 440: Programming Languages Assignment: Axiomatic Semantics

Engage in a Conversation
IITCS440Programming LanguagesAxiomatic SemanticsRacket

CourseNana.COM

CS 440: Programming Languages CourseNana.COM

Assignment: Axiomatic Semantics CourseNana.COM

Logistics and Submission CourseNana.COM

Please submit your solutions as a PDF (typed or neatly handwritten!) on Blackboard by the due date. Hoare Logic CourseNana.COM

  1. [10 points] Consider the following IMP program, which we will refer to as C: x := y - z; CourseNana.COM

             if x < 5 then
                 x := y * z
    

    else
    x := y - z
    CourseNana.COM

    Derive the weakest precondition P such that the Hoare triple { P } C { x > 0 } is valid. You must show your work in steps, deriving the weakest assertion required before each step of the program. Use relational, logical, and arithmetic operators as needed. CourseNana.COM

  2. [10 points] Consider the following IMP program: CourseNana.COM

             i := 0;
             j := len(arr) - 1;
             while i <= j do
    
                 if arr[i] <= arr[0] then
                     i := i + 1
    
                 else
                     tmp := arr[i];
    
                     arr[i] := arr[j];
                     arr[j] := tmp;
                     j := j - 1
    

    Givenanon-emptyarrayofintegersarr(withindexes0throughlen(arr) - 1),theprogramattempts to partition arr such that all elements lesser than or equal to its first element appear before all elements greater than its first element. CourseNana.COM

    Come up with assertions P (the loop invariant) and Q (the loop postcondition), in terms of i, j, and arr, that can be used to demonstrate partial correctness of the program. Briefly explain how P can be used to imply Q. CourseNana.COM

Get in Touch with Our Experts

WeChat (微信) WeChat (微信)
Whatsapp WhatsApp
IIT代写,CS440代写,Programming Languages代写,Axiomatic Semantics代写,Racket代写,IIT代编,CS440代编,Programming Languages代编,Axiomatic Semantics代编,Racket代编,IIT代考,CS440代考,Programming Languages代考,Axiomatic Semantics代考,Racket代考,IIThelp,CS440help,Programming Languageshelp,Axiomatic Semanticshelp,Rackethelp,IIT作业代写,CS440作业代写,Programming Languages作业代写,Axiomatic Semantics作业代写,Racket作业代写,IIT编程代写,CS440编程代写,Programming Languages编程代写,Axiomatic Semantics编程代写,Racket编程代写,IITprogramming help,CS440programming help,Programming Languagesprogramming help,Axiomatic Semanticsprogramming help,Racketprogramming help,IITassignment help,CS440assignment help,Programming Languagesassignment help,Axiomatic Semanticsassignment help,Racketassignment help,IITsolution,CS440solution,Programming Languagessolution,Axiomatic Semanticssolution,Racketsolution,