Главная » Просмотр файлов » ACSL Language Reference 1.9 с указанием, какие возможности ACSL не реализованы в Frama-C из проекта Astraver

ACSL Language Reference 1.9 с указанием, какие возможности ACSL не реализованы в Frama-C из проекта Astraver (1185160), страница 3

Файл №1185160 ACSL Language Reference 1.9 с указанием, какие возможности ACSL не реализованы в Frama-C из проекта Astraver (ACSL Language Reference 1.9 с указанием, какие возможности ACSL не реализованы в Frama-C из проекта Astraver) 3 страницаACSL Language Reference 1.9 с указанием, какие возможности ACSL не реализованы в Frama-C из проекта Astraver (1185160) страница 32020-08-21СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

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

The grammar for binders andtype expressions is given separately in Figure 2.3.With respect to C pure expressions, the additional constructs are as follows:162.2. LOGIC EXPRESSIONSAdditional connectives C operators && (UTF8: ∧), || (UTF8: ∨) and ! (UTF8: ¬) areused as logical connectives. There are additional connectives ==> (UTF8: =⇒) forimplication, <==> (UTF8: ⇐⇒) for equivalence and ^^ (UTF8: ⊕) for exclusive or.These logical connectives all have a bitwise counterpart, either C ones like &, |, ~ and^, or additional ones like bitwise implication --> and bitwise equivalence <-->.Quantification Universal quantification is denoted by \forall τ x1 ,.

. .,xn ; e and existential quantification by \exists τ x1 ,. . .,xn ; e.Local binding \let x = e1 ;e2 introduces the name x for expression e1 which can be used inexpression e2 .Conditional c ? e1 : e2 . There is a subtlety here: the condition may be either a booleanterm or a predicate.

In case of a predicate, the two branches must be also predicates,so that this construct acts as a connective with the following semantics: c ? e1 : e2 isequivalent to (c ==> e1 ) && (! c ==> e2 ).Syntactic naming id : e is a term or a predicate equivalent to e.

It is different from localnaming with \let : the name cannot be reused in other terms or predicates. It is onlyfor readibility purposes.Functional modifier The composite element modifier is an additional operator related toC structure field and array accessors. The expression { s \with .id = v } denotes thesame structure as s, except for the field id that is equal to v. The equivalent expressionfor an array is { t \with [ i ] = v } which returns the same array as t, except for theith element whose value is v. See section 2.10 for an example of use of these operators.rel-op::=== |!= |<= |>= |> |pred::=|||||||||||||||||\true | \falseterm (rel-op term)+id ( term (, term)∗ )( pred )pred && predpred || predpred ==> predpred <==> pred! predpred ^^ predterm ? pred : predpred ? pred : pred\let id = term ; pred\let id = pred ; pred\forall binders ; pred\exists binders ; predid : predstring : pred<comparisons (see remark)predicate applicationparenthesesconjunctiondisjunctionimplicationequivalencenegationexclusive orternary conditionlocal bindinguniversal quantificationexistential quantificationsyntactic namingsyntactic namingFigure 2.2: Grammar of predicates17CHAPTER 2.

SPECIFICATION LANGUAGE(, binder)∗binders::=binderbinder::=type-expr variable-ident(,variable-ident)∗type-expr::=logic-type-exprlogic-type-expr::=|built-in-logic-typeidbuilt-in-logic-type::=boolean |variable-ident::=||id | * variable-identvariable-ident []( variable-ident )| C-type-nameinteger |type identifierrealFigure 2.3: Grammar of binders and type expressionsLogic functions Applications in terms and in propositions are not applications of C functions, but of logic functions or predicates; see Section 2.6 for detail.Consecutive comparison operators Theconstructt1 relop1 t2 relop2 t3 · · · tkwithseveralconsecutivecomparisonoperatorsisashortcutfor(t1 relop1 t2 ) && (t2 relop2 t3 ) && · · ·.It is required that the relopi operatorsmust be in the same “direction”, i.e.

they must all belong either to {<, <=, ==} or to{>,>=,==}. Expressions such as x < y > z or x != y != z are not allowed.To enforce the same interpretation as in C expressions, one may need to add extra parentheses: a == b < c is equivalent to a == b && b < c, whereas a == (b < c) is equivalentto \let x = b < c; a == x. This situation raises some issues, as in the example below.There is a subtlety regarding comparison operators: they are predicates when used in predicate position, and boolean functions when used in term position.Example 2.1 Let us consider the following example:int f(int a, int b) { return a < b; }• the obvious postcondition \result == a < b is not the right one because it is actually ashortcut for \result == a && a < b.• adding parentheses results in a correct post-condition \result == (a < b).

Note howeverthat there is an implicit conversion (see Sec. 2.2.3) from the int (the type of \result )to boolean (the type of (a<b))• an equivalent post-condition, which does not rely on implicit conversion, is( \result != 0) == (a<b). Both pairs of parentheses are mandatory.• \result == (integer)(a<b) is also acceptable because it compares two integers. The casttowards integer enforces a<b to be understood as a boolean term. Notice that a casttowards int would also be acceptable.• \result != 0 <==> a < b is acceptable because it is an equivalence between two predicates.182.2. LOGIC EXPRESSIONSclassselectionunarymultiplicativeadditiveshiftcomparisoncomparisonbitwise andbitwise xorbitwise orbitwise impliesbitwise equivconnective andconnective xorconnective orconnective impliesconnective equivternary connectivebindingnamingassociativityleftrightleftleftleftleftleftleftleftleftleftleftleftleftleftrightleftrightleftrightoperators[· · ·] -> .! ~ + - * & (cast) sizeof*/%+<< >>< <= > >=== !=&^|--><-->&&^^||==><==>· · ·?· · ·:· · ·\forall \exists \let:Figure 2.4: Operator precedence2.2.1Operators precedenceThe precedence of C operators is conservatively extended with additional operators, as shownin Figure 2.4.

In this table, operators are sorted from highest to lowest priority. Operatorsof same priority are presented on the same line.There is a remaining ambiguity between the connective · · ·?· · ·:· · · and the labelling operator :.Consider for instance the expression x?y:z:t. The precedence table does not indicate whetherthis should be understood as x?(y:z):t or x?y:(z:t).

Such a case must be considered as asyntax error, and should be fixed by explicitly adding parentheses.2.2.2SemanticsThe semantics of logic expressions in ACSL is based on mathematical first-order logic [25]. Inparticular, it is a 2-valued logic with only total functions. Consequently, expressions are never“undefined”. This is an important design choice and the specification writer should be aware ofthat. (For a discussion about the issues raised by such design choices, in similar specificationlanguages such as JML, see the comprehensive list compiled by Patrice Chalin [4, 5].)Having only total functions implies than one can write terms such as 1/0, or *p when p is null(or more generally when it points to a non-properly allocated memory cell).

In particular,the predicates1/0*p====1/0*pare valid, since they are instances of the axiom ∀x, x = xof first-order logic. The reader should not be alarmed, because there is no way to deduceanything useful from such terms. As usual, it is up to the specification designer to writeconsistent assertions. For example, when introducing the following lemma (see Section 2.6):19CHAPTER 2. SPECIFICATION LANGUAGE123/*@ lemma div_mul_identity:@\forall real x, real y; y != 0.0 ==> y*(x/y) == x;@*/a premise is added to require y to be non zero.2.2.3TypingThe language of logic expressions is typed (as in multi-sorted first-order logic). Types areeither C types or logic types defined as follows:• “mathematical” types: integer for unbounded, mathematical integers, real for realnumbers, boolean for booleans (with values written \true and \false );• logic types introduced by the specification writer (see Section 2.6).There are implicit coercions for numeric types:• C integral types char , short , int and long , signed or unsigned, are all subtypes of typeinteger ;• integer is itself a subtype of type real ;• C types float and double are subtypes of type real .Notes:• There is a distinction between booleans and predicates.

The expression x<y in termposition is a boolean, and the same expression is also allowed in predicate position.• Unlike in C, there is a distinction between booleans and integers. There is an implicit promotion from integers to booleans, thus one may write x && y instead ofx != 0 && y != 0. If the reverse conversion is needed, an explicit cast is required,e.g. ( int )(x>0)+1, where \false becomes 0 and \true becomes 1.• Quantification can be made over any type: logic types and C types.

Quantificationover pointers must be used carefully, since it depends on the memory state wheredereferencing is done (see Section 2.2.4 and Section 2.6.9).Formal typing rules for terms are given in appendix A.3.2.2.4Integer arithmetic and machine integersThe following integer arithmetic operations apply to mathematical integers: addition, subtraction, multiplication, unary minus. The value of a C variable of an integral type is promoted to a mathematical integer. As a consequence, there is no “arithmetic overflow” in logicexpressions.Division and modulo are also mathematical operations, which coincide with the correspondingC operations on C machine integers, thus following the ISO C99 conventions.

In particular,these are not the usual mathematical Euclidean division and remainder. Generally speaking,division rounds the result towards zero. The results are not specified if divisor is zero;otherwise if q and r are the quotient and the remainder of n divided by d then:202.2.

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

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

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