• Keine Ergebnisse gefunden

University of Kaiserslautern Department of Computer Science AG Grundlagen der Informatik

N/A
N/A
Protected

Academic year: 2021

Aktie "University of Kaiserslautern Department of Computer Science AG Grundlagen der Informatik"

Copied!
1
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Prof. Dr. K. Madlener Dipl.-Inf. P. Michel Dipl.-Inf. C. Feller

University of Kaiserslautern

Department of Computer Science AG Grundlagen der Informatik

Exercise Sheet 7: Specification and Verification with Higher-Order Logic (Summer Term 2011)

Date: 22.06.2011

Exercise 1 Case Study: Quicksort

In the lecture you have seen an elegant way to specify and prove quicksort. You can download the “QSort.thy”

(and “Universe.thy”) containing this version.

The file “EQSort.thy” contains another – more efficient – version of quicksort, which calculates the split with the pivot element in one pass through the list. The file also contains all specifications and proofs for its correctness.

a) Go through theefficientversion of the specification, model and proof and compare them to the elegant one. Describe why the proofs are more complicated inefficientversion.

b) Create a new theory “RQSort.thy” – which stands forrefinedquicksort – in which you prove the cor- rectness of theefficientquicksort by proving an equivalence to theelegantversion. Use the specification of “QSort.thy” to formulate the two correctness theorems.

Hint: Instead of importing Main in“RQSort.thy”you should import both“QSort.thy”and“EQSort.thy”.

You then have to qualify each symbol you use from these theories to make clear which you are talking about.

Exercise 2 Case Study: Mergesort

In this exercise we take a look at another sorting algorithm, namelymergesort. We are thereby changing the model, but keep the properties we already specified and validated for quicksort.

Download the “MSort.thy” theory from our website, which contains all the necessary definitions and pro- perties (together with “Universe.thy”).

Complete all the missing proofs and find the necessary helper lemmas, which capture the basic ideas of the algorithm.

Referenzen

ÄHNLICHE DOKUMENTE

The Ministers noted a number of significant achievements with realignment initiatives since the last SCC meeting in June 2011, including: progress in the environmental

Download the file Sheet4_exprsimp.hs from the website. This Haskell program parses expressions given by the user and simplifies them. You do not have to understand the other parts

b) We now want to proof a more general property of this program which is not fixed to vn being 3. As the first step towards this goal, prove that the execution of the loop body adds

Exercise Sheet 6: Specification and Verification with Higher-Order Logic (Summer Term 2012)..

b) Download the theory “RQSort.thy” – which stands for refined quicksort – in which you prove the correctness of the efficient quicksort. prove that the efficient version of

c) Optimize your proof by using the custom wphoare method, like done in the splitcorrect lemmas... d) The splitcorrect lemma does not prove that split does not change the content of

In a software project, the classes Person, AgePerson und AgeManager were implemented; their source is given in Figure 1... a) For testing purposes, the following code

The SLLN yields an idea called the Monte Carlo Method of direct sim- ulation.. (Interestingly, it is often much easier to find and simulate such an X than to compute