Главная » Просмотр файлов » 3. Verification of sequential and concurrent programs. Apt_ Olderog (3rd edition) (2010)

3. Verification of sequential and concurrent programs. Apt_ Olderog (3rd edition) (2010) (811405), страница 34

Файл №811405 3. Verification of sequential and concurrent programs. Apt_ Olderog (3rd edition) (2010) (3. Verification of sequential and concurrent programs. Apt_ Olderog (3rd edition) (2010).pdf) 34 страница3. Verification of sequential and concurrent programs. Apt_ Olderog (3rd edition) (2010) (811405) страница 342020-08-25СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 34)

5.5 Proof outline establishing termination of the Quicksort procedure.The application of the consequence rule preceding the first recursive call ofQuicksort is justified by the following two implications:(n − m = z ∧ m < n ∧ v − m < n − m) → max(v − m, 0) < z,(n − m = z ∧ m < n ∧ n − w < n − m) → max(n − w, 0) < z.This completes the proof of Claim 3.⊓⊔Applying now the simplified version of the recursion IV rule we derive Q4.In summary, we have provedPT4 ⊢ Q4.1825 Recursive Programs with Parameters5.5 Exercises5.1. Call a recursive program proper when its sets of local and globalvariables are disjoint, and safe when for all procedures no formal parameter appears in an actual parameter and for all its block statementsbegin local x̄ := t̄; S end we have var(x̄) ∩ var(t̄) = ∅.Suppose that< S, σ > →∗ < R, τ >,where σ is a proper state. Prove the following two properties of recursiveprograms.(i) If S is proper, then so is R.(ii) If S is safe, then so is R.5.2.

Prove the Input/Output Lemma 5.1.5.3. Prove the Block Lemma 5.4.5.4. Prove the Change and Access Lemma 5.5.5.5. Prove the Soundness Theorem 5.4.5.6. This exercise considers the modularity rule 12 ′ introduced in Section 5.3.(i) Prove that this rule is a derived rule, in the sense that every proof ofpartial correctness that uses it can be converted into a proof that usesthe recursion III rule instead. Conclude that this proof rule is sound inthe sense of partial correctness.(ii) Suggest an analogous modularity proof rule for total correctness.5.7.

Prove the Soundness Theorem 5.5 for the proof system TRP.5.8. Consider the P artition procedure defined in Section 5.5. Prove the correctness formulas P1–P3 and PT4 for the procedure call P artition(m, n)using the properties P1–P4 and T of the while program P ART from Section 3.9 and the Transfer Lemma 5.2.5.9.

Allow the failure statements in the main statements and procedure bodies. Add to the proof systems PRP and TRP the corresponding failure rulesfrom Section 3.7 and prove the counterparts of the Soundness Corollary 5.1and Soundness Theorem 5.5.5.6 Bibliographic RemarksThe usual treatment of parameter mechanisms involves appropriate renamingof local variables to avoid variable clashes, see, e.g., Apt [1981]. The semantics5.6 Bibliographic Remarks183and proof theory of the call-by-value parameter mechanism adopted hereavoids any renaming and seems to be new. Recursion IV rule is a modificationof the corresponding rule from America and de Boer [1990].For other parameter mechanisms like call-by-name (as in ALGOL) or callby-reference (as in Pascal) a renaming of local variables in procedure bodiesis unavoidable to maintain the static scope of variables. In Olderog [1981] aproof system for programs with procedures having call-by-name parametersis presented, where local variables are renamed whenever the block of a procedure body is entered.

This mimicks the copy rule of ALGOL 60, see, e.g.,Grau, Hill, and Langmaack [1967].Clarke investigated programs with a powerful ALGOL-like proceduremechanism where recursive procedures can take procedures as parameters;in Clarke [1979] he showed that for such programs it is impossible to obtaina complete Hoare-style proof system even if —different from this book— onlylogical structures with finite data domains are considered. Clarke’s article initiated an intense research on the question of whether complete Hoare-styleproof systems could be obtained for programs with a restricted ALGOL-likeprocedure mechanism.

For program classes with complete proof systems see,for example, Olderog [1981,1983a,1984] and Damm and Josko [1983]. An interesting survey over these results on completeness of Hoare’s logic can befound in Clarke [1985].The algorithm Quicksort is due to Hoare[1961a,1962].

The first proof ofpartial correctness of Quicksort is given in Foley and Hoare [1971]. Thatproof establishes the permutation and the sorting property simultaneously,in contrast to our modular approach. For dealing with recursive procedures,Foley and Hoare [1971] use proof rules corresponding to our rules for blocks,instantiation, and recursion III rule for the case of one recursive procedure.They also use a so-called adaptation rule of Hoare [1971a] that allows oneto adapt a given correctness formula about a program to other pre- andpostconditions. In our approach we use several auxiliary rules which togetherhave the same effect as the adaptation rule. The expressive power of theadaptation rule has been analyzed in Olderog [1983b].

No proof rule for thetermination of recursive procedures is proposed in Foley and Hoare [1971],only an informal argument is given why Quicksort terminates. In Kaldewaij[1990] a correctness proof of a non-recursive version of Quicksort is given.6 Object-Oriented Programs6.16.26.36.46.56.66.76.86.96.106.11ISyntax . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Semantics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Assertions . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .Verification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Adding Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Transformation of Object-Oriented Programs . . . . . . . . . .Object Creation . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . .Case Study: Zero Search in Linked List . . . . . . . . . . . . . . .Case Study: Insertion into a Linked List . . . . . . . . . . . . . .Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Bibliographic Remarks . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . .187192197200206211217226232238240N THIS CHAPTER we study the verification of object-oriented programs. We focus on the following main characteristics of objects:• objects possess (and encapsulate) their own local variables,• objects interact via method calls,• objects can be dynamically created.In contrast to the formal parameters of procedures and the local variables ofblock statements which only exist temporarily, the local variables of an object exist permanently. To emphasize the difference between these temporaryvariables and the local variables of an object, the latter are called instancevariables.

The local state of an object is a mapping that assigns values toits instance variables. Each object represents its local state by a pointer to1851866 Object-Oriented Programsit. Encapsulation means that the instance variables of an object cannot bedirectly accessed by other objects; they can be accessed only via method callsof the object.A method call invokes a procedure which is executed by the called object.The execution of a method call thus involves a temporary transfer of controlfrom the local state of the caller object to that of the called object (alsoreferred to by callee).

Upon termination of the method call the control returnsto the local state of the caller. The method calls are the only way to transfercontrol from one object to another.We start in Section 6.1 by defining the syntax of the object-oriented programming language. We first restrict the language to simple method callswhich do not involve parameters. In Section 6.2 we introduce the corresponding operational semantics. This requires an appropriate extension ofthe concept of a state to properly deal with objects and instance variables.In Section 6.3 we introduce the syntax and semantics of the assertionlanguage. Expressions of the programming language only refer to the localstate of the executing object.

We call them local expressions. In order toexpress global properties we introduce in the assertion language a new kindof expression which allow us to navigate through the local object states. Wecall them global expressions.Next, in Section 6.4, we introduce a new assignment axiom for the instancevariables. The rules for partial and total correctness of recursive procedurecalls with parameters (as described in Chapter 5) are naturally extended tomethod calls.

Характеристики

Список файлов книги

Свежие статьи
Популярно сейчас
Зачем заказывать выполнение своего задания, если оно уже было выполнено много много раз? Его можно просто купить или даже скачать бесплатно на СтудИзбе. Найдите нужный учебный материал у нас!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6417
Авторов
на СтудИзбе
307
Средний доход
с одного платного файла
Обучение Подробнее