Главная » Все файлы » Просмотр файлов из архивов » PDF-файлы » 3. Verification of sequential and concurrent programs. Apt_ Olderog (3rd edition) (2010)

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), страница 12

PDF-файл 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), страница 12 Математические методы верификации схем и программ (63286): Книга - 10 семестр (2 семестр магистратуры)3. Verification of sequential and concurrent programs. Apt_ Olderog (3rd edition) (2010) (3. Verification of sequential and concurrent programs. Apt_2020-08-25СтудИзба

Описание файла

PDF-файл из архива "3. Verification of sequential and concurrent programs. Apt_ Olderog (3rd edition) (2010).pdf", который расположен в категории "". Всё это находится в предмете "математические методы верификации схем и программ" из 10 семестр (2 семестр магистратуры), которые можно найти в файловом архиве МГУ им. Ломоносова. Не смотря на прямую связь этого архива с МГУ им. Ломоносова, его также можно найти и в других разделах. .

Просмотр PDF-файла онлайн

Текст 12 страницы из PDF

See Exercise 2.6 for the precise relationship.We also introduce the meaning of an assertion, written as [[p]], and definedby[[p]] = {σ | σ is a proper state and σ |= p}.We say that an assertion p is true, or holds, if for all proper states σ we haveσ |= p, that is, if [[p]] = Σ. Given two assertions p and q, we say that p and qare equivalent if p ↔ q is true.For error states we define ⊥ 6|= p, ∆ 6|= p and fail 6|= p. Thus for allassertions⊥, ∆, fail 6∈ [[p]].The following simple lemma summarizes the relevant properties of the meaning of an assertion.Lemma 2.1.

(Meaning of Assertion)(i) [[¬p]] = Σ − [[p]],(ii) [[p ∨ q]] = [[p]] ∪ [[q]],(iii) [[p ∧ q]] = [[p]] ∩ [[q]],(iv) p → q is true iff [[p]] ⊆ [[q]],(v) p ↔ q is true iff [[p]] = [[q]].⊓⊔Proof. See Exercise 2.7.2.7 SubstitutionTo prove correctness properties about assignment statements, we need theconcept of substitution. A substitution of an expression t for a simple orsubscripted variable u is written as[u := t]2.7 Substitution43and denotes a function from expressions to expressions and from assertionsto assertions. First, we define the application of [u := t] to an expression s,which is written in postfix notation. The result is an expression denoted bys[u := t].A substitution [u := t] describes the replacement of u by t.

For example, wehave• max(x, y)[x := x + 1] ≡ max(x + 1, y).However, substitution is not so easy to define when subscripted variables areinvolved. For example, we obtain• max(a[1], y)[a[1] := 2] ≡ max(2, y),• max(a[x], y)[a[1] := 2] ≡ if x = 1 then max(2, y) else max(a[x], y) fi.In the second case it is checked whether the syntactically different subscriptedvariables a[x] and a[1] are aliases of the same location. Then the substitutionof 2 for a[1] results in a[x] being replaced by 2, otherwise the substitutionhas no effect.

To determine whether a[x] and a[1] are aliases the definitionof substitution makes a case distinction on the subscripts of a (using theconditional expression if x = 1 then . . . else . . . fi).In general, in a given state σ the substituted expression s[u := t] shoulddescribe the same value as the expression s evaluated in the updated stateσ[u := σ(t)], which arises after the assignment u := t has been executed in σ(see Chapter 3). This semantic equivalence is made precise in the SubstitutionLemma 2.4 below.The formal definition of the expression s[u := t] proceeds by induction onthe structure of s:• if s ≡ x for some simple variable x then½t if s ≡ us[u := t] ≡s otherwise,• if s ≡ c for some constant c of basic type thens[u := t] ≡ s,• if s ≡ op(s1 , . .

., sn ) for some constant op of higher type thens[u := t] ≡ op(s1 [u := t], . . ., sn [u := t]),• if s ≡ a[s1 , . . ., sn ] for some array a, and u is a simple variable or a subscripted variable b[t1 , . . ., tm ] where a 6≡ b, thens[u := t] ≡ a[s1 [u := t], . . ., sn [u := t]],442 Preliminaries• if s ≡ a[s1 , . . ., sn ] for some array a and u ≡ a[t1 , .

. ., tn ] thenVns[u := t] ≡ if i=1 si [u := t] = ti then telse a[s1 [u := t], . . ., sn [u := t]] fi,• if s ≡ if B then s1 else s2 fi thens[u := t] ≡ if B[u := t] then s1 [u := t] else s2 [u := t] fi.Note that the definition of substitution does not take into account the infixnotation of binary constants op; so to apply substitution the infix notationmust first be replaced by the corresponding prefix notation.The most complicated case in this inductive definition is the secondclause dealing with subscripted variables, where s ≡ a[s1 , . . ., sn ] and u ≡a[t1 , . . ., tn ].

In that clause the conditional expressionVnif i=1 si [u := t] = ti then . . . else . . . fichecks whether, for any given proper state σ, the expression s ≡ a[s1 , . . ., sn ]in the updated state σ[u := σ(t)] and the expression u ≡ a[t1 , . . ., tn ] inthe state σ are aliases.

For this check the substitution [u := t] needs toapplied inductively to all subscripts s1 , . . ., sn of a[s1 , . . ., sn ]. In case of analias s[u := t] yields t. Otherwise, the substitution is applied inductively tothe subscripts s1 , . . ., sn of a[s1 , . . ., sn ].The following lemma is an immediate consequence of the above definitionof s[u := t].Lemma 2.2. (Identical Substitution) For all expressions s and t, all simple variables x and all subscripted variables a[t1 , .

. ., tn ](i) s[x := t] ≡ s if s does not contain x,(ii) s[a[t1 , . . ., tn ] := t] ≡ s if s does not contain a.⊓⊔The following example illustrates the application of substitution.Example 2.7. Suppose that a and b are arrays of type integer → integerand x is an integer variable. Thena[b[x]][b[1] := 2]≡ {definition of s[u := t] since a 6≡ b}a[b[x][b[1] := 2]]≡ {definition of s[u := t]}a[if x[b[1] := 2] = 1 then 2 else b[x[b[1] := 2]] fi]≡{by the Identical Substitution Lemma 2.2 x[b[1] := 2] ≡ x}a[if x = 1 then 2 else b[x] fi]⊓⊔2.7 Substitution45The application of substitutions [u := t] is now extended to assertions p.The result is again an assertion denoted byp[u := t].The definition of p[u := t] is by induction on the structure on p:• if p ≡ s for some Boolean expression s thenp[u := t] ≡ s[u := t]by the previous definition for expressions,• if p ≡ ¬q thenp[u := t] ≡ ¬(q[u := t]),• if p ≡ q ∨ r thenp[u := t] ≡ q[u := t] ∨ r[u := t],and similarly for the remaining binary connectives: ∧ , → and ↔ ,• if p ≡ ∃x : q thenp[u := t] ≡ ∃y : q[x := y][u := t],where y does not appear in p, t or u and is of the same type as x,• if p ≡ ∀x : q thenp[u := t] ≡ ∀y : q[x := y][u := t],where y does not appear in p, t or u and is of the same type as x.In the clauses dealing with quantification, renaming the bound variable xinto a new variable y avoids possible clashes with free occurrences of x in t.For example, we obtain(∃x : z = 2 · x)[z := x + 1]≡ ∃y : z = 2 · x[x := y][z := x + 1]≡ ∃y : x + 1 = 2 · y.Thus for assertions substitution is defined only up to a renaming of boundvariables.Simultaneous SubstitutionTo prove correctness properties of parallel assignments, we need the conceptof simultaneous substitution.

Let x̄ = x1 , . . . , xn be a list of distinct simple462 Preliminariesvariables of type T1 , . . . , Tn and t̄ = t1 , . . . , tn a corresponding list of expressions of type T1 , . . . , Tn . Then a simultaneous substitution of t̄ for x̄ is writtenas[x̄ := t̄]and denotes a function from expressions to expressions and from assertions toassertions. The application of [x̄ := t̄] to an expression s is written in postfixnotation. The result is an expression denoted bys[x̄ := t̄]and defined inductively over the structure of s. The definition proceeds analogously to that of a substitution for a single simple variable except that inthe base case we now have to select the right elements from the lists x̄ and t̄:• if s ≡ x for some simple variable x then½ti if x ≡ xi for some i ∈ {1, . . . , n}s[x̄ := t̄] ≡s otherwise.As an example of an inductive clause of the definition we state:• if s ≡ op(s1 , .

. ., sn ) for some constant op of higher type thens[x̄ := t̄] ≡ op(s1 [x̄ := t̄], . . ., sn [x̄ := t̄]).Using these inductive clauses the substitution for each variable xi from thelist x̄ is pursued simultaneously. This is illustrated by the following example.Example 2.8. We take s ≡ max(x, y) and calculatemax(x, y)[x, y := y + 1, x + 2]≡{op ≡ max in the inductive clause above}max(x[x, y := y + 1, x + 2], y[x, y := y + 1, x + 2])≡{the base case shown above}max(y + 1, x + 2).Note that a sequential application of two single substitutions yields a differentresult:max(x, y)[x := y + 1][y := x + 2]≡ max(y + 1, y)[y := x + 2])≡ max((x + 2) + 1, x + 2).⊓⊔Note 2.1.

The first clause of the Lemma 2.2 on Identical Substitutions holdsalso, appropriately rephrased, for simultaneous substitutions: for all expressions s2.8 Substitution Lemma47• s[x̄ := t̄] ≡ s if s does not contain any variable xi from the list x̄.⊓⊔The application of simultaneous subsitution to an assertion p is denotedbyp[x̄ := t̄]and defined inductively over the structure of p, as in the case of a substitutionfor a single simple variable.2.8 Substitution LemmaIn this section we connect the notions of substitution and of update introduced in Sections 2.7 and 2.3. We begin by noting the following so-calledcoincidence lemma.Lemma 2.3. (Coincidence) For all expressions s, all assertions p and allproper states σ and τ(i) if σ[var(s)] = τ [var(s)] then σ(s) = τ (s),(ii) if σ[f ree(p)] = τ [f ree(p)] then σ |= p iff τ |= p.⊓⊔Proof.

See Exercise 2.8.Using the Coincidence Lemma we can prove the following lemma which isused in the next chapter when discussing the assignment statement.Lemma 2.4. (Substitution) For all expressions s and t, all assertions p,all simple or subscripted variables u of the same type as t and all proper statesσ,(i) σ(s[u := t]) = σ[u := σ(t)](s),(ii) σ |= p[u := t] iff σ[u := σ(t)] |= p.Clause (i) relates the value of the expression s[u := t] in a state σ to thevalue of the expression s in an updated state, and similarly with (ii).Proof.

(i) The proof proceeds by induction on the structure of s. Supposefirst that s is a simple variable. Then when s ≡ u, we haveσ(s[u := t])= {definition of substitution}σ(t)={definition of update}σ[s := σ(t)](s)={s ≡ u}σ[u := σ(t)](s),482 Preliminariesand when s 6≡ u the same conclusion follows by the Identical SubstitutionLemma 2.2 and the definition of an update.The case when s is a subscripted variable, say s ≡ a[s1 , .

. ., sn ], is slightlymore complicated. When u is a simple variable or u ≡ b[t1 , . . ., tm ] wherea 6≡ b, we haveσ(s[u := t])={definition of substitution}σ(a[s1 [u := t], . . ., sn [u := t]])={definition of semantics}σ(a)(σ(s1 [u := t]), . . ., σ(sn [u := t])){induction hypothesis}σ(a)(σ[u := σ(t)](s1 ), . . ., σ[u := σ(t)](sn ))= {by definition of update, σ[u := σ(t)](a) = σ(a)}=σ[u := σ(t)](a)(σ[u := σ(t)](s1 ), . . ., σ[u := σ(t)](sn ))= {definition of semantics, s ≡ a[s1 , . . ., sn ]}σ[u := σ(t)](s)and when u ≡ a[t1 , .

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