Skip to content
Snippets Groups Projects
Commit aba903a6 authored by Basile Desloges's avatar Basile Desloges
Browse files

[eacsl:doc] Update E-ACSL reference manual

- Function contracts: remove abrupt clauses from the list of exceptions
- Statement contracts: remove abrupt clauses from the list of exceptions
- Add grammar for abrupt termination
- Update list of contributors
parent e57aaa3f
No related branches found
No related tags found
No related merge requests found
...@@ -15,7 +15,7 @@ DEPS_MODERN=macros_modern.tex eacslversion.tex biblio.bib \ ...@@ -15,7 +15,7 @@ DEPS_MODERN=macros_modern.tex eacslversion.tex biblio.bib \
assertions_modern.bnf loops_modern.bnf st_contracts_modern.bnf \ assertions_modern.bnf loops_modern.bnf st_contracts_modern.bnf \
logic_modern.bnf data_invariants_modern.bnf model_modern.bnf \ logic_modern.bnf data_invariants_modern.bnf model_modern.bnf \
ghost_modern.bnf generalinvariants_modern.bnf iterator_modern.bnf \ ghost_modern.bnf generalinvariants_modern.bnf iterator_modern.bnf \
bsearch.c bsearch2.c link.c abrupt_modern.bnf bsearch.c bsearch2.c link.c
############## ##############
# Main rules # # Main rules #
......
\begin{syntax}
{ abrupt-clause } ::= { exits-clause }
\
{ exits-clause } ::= { "exits" pred ";" }
\
{ abrupt-clause-stmt } ::= { breaks-clause } | { continues-clause } | { returns-clause }
\
{ breaks-clause } ::= { "breaks" pred ";" }
\
{ continues-clause } ::= { "continues" pred ";" }
\
{ returns-clause } ::= { "returns" pred ";" }
\
{ term } ::= { "\exit_status" }
\end{syntax}
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
\item \changeinsection{typing}{no user-defined types} \item \changeinsection{typing}{no user-defined types}
\item \changeinsection{builtinconstructs}{no more implementation issue for \item \changeinsection{builtinconstructs}{no more implementation issue for
\lstinline|\\old|} \lstinline|\\old|}
\item \changeinsection{at}{more restrictive scoping rule for label references \item \changeinsection{at}{more restrictive scoping rule for label references
in \lstinline|\\at|} in \lstinline|\\at|}
\end{itemize} \end{itemize}
...@@ -84,7 +84,7 @@ in \lstinline|\\at|} ...@@ -84,7 +84,7 @@ in \lstinline|\\at|}
\item \changeinsection{expressions}{remove laziness of operator \item \changeinsection{expressions}{remove laziness of operator
\lstinline|<==>|} \lstinline|<==>|}
\item \changeinsection{expressions}{restrict guarded quantifications to integer} \item \changeinsection{expressions}{restrict guarded quantifications to integer}
\item \changeinsection{expressions}{add iterator quantifications} \item \changeinsection{expressions}{add iterator quantifications}
\item \changeinsection{expressions}{extend unguarded quantifications to char} \item \changeinsection{expressions}{extend unguarded quantifications to char}
\item \changeinsection{locations}{extend syntax of set comprehensions} \item \changeinsection{locations}{extend syntax of set comprehensions}
\item \changeinsection{loop_annot}{simplify explanations for loop invariants and \item \changeinsection{loop_annot}{simplify explanations for loop invariants and
...@@ -128,6 +128,11 @@ in \lstinline|\\at|} ...@@ -128,6 +128,11 @@ in \lstinline|\\at|}
\begin{itemize} \begin{itemize}
\item \changeinsection{reals}{support of rational numbers and operations} \item \changeinsection{reals}{support of rational numbers and operations}
\item \changeinsection{fn-behavior}{remove abrupt clauses from the list of
exceptions}
\item \changeinsection{statement_contract}{remove abrupt clauses from the list
of exceptions}
\item \changeinsection{abrupt}{add grammar for abrupt termination}
\end{itemize} \end{itemize}
\subsection*{Version Potassium-19} \subsection*{Version Potassium-19}
......
\begin{syntax} \begin{syntax}
[ function-contract ] ::= requires-clause*; [ function-contract ] ::= requires-clause*
{ decreases-clause? } simple-clause*; { decreases-clause? } simple-clause*
named-behavior* { completeness-clause* } named-behavior* { completeness-clause* }
\ \
requires-clause ::= "requires" pred ";" requires-clause ::= "requires" pred ";"
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
{ decreases-clause } ::= { "decreases" term ("for" id)? ";" } { decreases-clause } ::= { "decreases" term ("for" id)? ";" }
\ \
[ simple-clause ] ::= { assigns-clause } | ensures-clause [ simple-clause ] ::= { assigns-clause } | ensures-clause
| { allocation-clause} | { abrupt-clause }
\ \
{ assigns-clause } ::= { "assigns" locations ";" } { assigns-clause } ::= { "assigns" locations ";" }
\ \
......
...@@ -43,7 +43,7 @@ currently implemented into the \framac's \eacsl plug-in. ...@@ -43,7 +43,7 @@ currently implemented into the \framac's \eacsl plug-in.
\begin{center} \begin{center}
\begin{tabular}{|l|l|} \begin{tabular}{|l|l|}
\hline \hline
typing typing
& mathematical reals \\ & mathematical reals \\
\hline \hline
terms terms
...@@ -52,7 +52,7 @@ currently implemented into the \framac's \eacsl plug-in. ...@@ -52,7 +52,7 @@ currently implemented into the \framac's \eacsl plug-in.
& let binding \\ & let binding \\
& t-sets \\ & t-sets \\
\hline \hline
predicates predicates
& exclusive or operator \\ % \lstinline|^^| & exclusive or operator \\ % \lstinline|^^|
& let bindings \\ & let bindings \\
& quantifications over non-integer types \\ & quantifications over non-integer types \\
...@@ -60,7 +60,7 @@ currently implemented into the \framac's \eacsl plug-in. ...@@ -60,7 +60,7 @@ currently implemented into the \framac's \eacsl plug-in.
& \lstinline|\\specified| & \lstinline|\\specified|
\\ \\
\hline \hline
annotations annotations
& behavior-specific annotations \\ & behavior-specific annotations \\
& loop assigns \\ & loop assigns \\
& loop variants \\ & loop variants \\
...@@ -69,6 +69,7 @@ currently implemented into the \framac's \eacsl plug-in. ...@@ -69,6 +69,7 @@ currently implemented into the \framac's \eacsl plug-in.
\hline \hline
behavior clauses behavior clauses
& assigns \\ & assigns \\
& allocates \\
& decreases \\ & decreases \\
& abrupt termination \\ & abrupt termination \\
& complete and disjoint behaviors & complete and disjoint behaviors
......
...@@ -82,6 +82,7 @@ Patrick Baudin, ...@@ -82,6 +82,7 @@ Patrick Baudin,
Bernard Botella, Bernard Botella,
Lo\"ic Correnson, Lo\"ic Correnson,
Pascal Cuoq, Pascal Cuoq,
Basile Desloges,
Johannes Kanig, Johannes Kanig,
Fonenantsoa Maurica, Fonenantsoa Maurica,
David Mentr\'e, David Mentr\'e,
......
...@@ -196,7 +196,7 @@ one is valid: ...@@ -196,7 +196,7 @@ one is valid:
\item \lstinline|\exists integer x, 1 <= x <= 0 && -1 <= 1/x <= 1| \item \lstinline|\exists integer x, 1 <= x <= 0 && -1 <= 1/x <= 1|
\end{itemize} \end{itemize}
In particular, the second one is invalid since the quantification is in fact an In particular, the second one is invalid since the quantification is in fact an
enumeration over a finite number of elements, it amounts to enumeration over a finite number of elements, it amounts to
\lstinline|1/-1 > 0 && 1/0 > 0 && 1/1 > 0|. The first atomic proposition is \lstinline|1/-1 > 0 && 1/0 > 0 && 1/1 > 0|. The first atomic proposition is
invalid, so the rest of the conjunction (and in particular 1/0) is not invalid, so the rest of the conjunction (and in particular 1/0) is not
evaluated. The fourth one is invalid since it is an existential quantification evaluated. The fourth one is invalid since it is an existential quantification
...@@ -294,13 +294,12 @@ It is not possible to define logic types introduced by the specification writer ...@@ -294,13 +294,12 @@ It is not possible to define logic types introduced by the specification writer
\label{sec:fn-behavior} \label{sec:fn-behavior}
\index{function contract}\index{contract} \index{function contract}\index{contract}
\except{no \lstinline|terminates| and \lstinline|abrupt| clauses} \except{no \lstinline|terminates|}
Figure~\ref{fig:gram:contracts} shows grammar of function Figure~\ref{fig:gram:contracts} shows grammar of function
contracts. This is a simplified version of \acsl one without contracts. This is a simplified version of \acsl one without
\lstinline|terminates| and \lstinline|abrupt| \lstinline|terminates| clauses. Section~\ref{sec:termination} explains why
clauses. Section~\ref{sec:termination} (resp.~\ref{sec:abrupt}) explains why \eacsl has no \lstinline|terminates| clause.
\eacsl has no \lstinline|terminates| (resp. \lstinline|abrupt|) clause.
\begin{figure}[htbp] \begin{figure}[htbp]
\begin{cadre} \begin{cadre}
...@@ -370,7 +369,7 @@ members easily identifiable. ...@@ -370,7 +369,7 @@ members easily identifiable.
\begin{notimplementedenv} \begin{notimplementedenv}
\begin{example}\label{ex:tset} \begin{example}\label{ex:tset}
The set \lstinlineµ{ x | integer x; 0 <= x <= 9 || 20 <= x <= 29 }µ denotes the The set \lstinlineµ{ x | integer x; 0 <= x <= 9 || 20 <= x <= 29 }µ denotes the
set of all integers between 0 and 9 and between 20 and 29. set of all integers between 0 and 9 and between 20 and 29.
\end{example} \end{example}
\end{notimplementedenv} \end{notimplementedenv}
...@@ -422,7 +421,7 @@ Figure~\ref{fig:gram:assertions} summarizes grammar for assertions. ...@@ -422,7 +421,7 @@ Figure~\ref{fig:gram:assertions} summarizes grammar for assertions.
\except{loop invariants lose their inductive nature} \except{loop invariants lose their inductive nature}
Figure~\ref{fig:gram:loops} shows grammar for loop annotations. There is no Figure~\ref{fig:gram:loops} shows grammar for loop annotations. There is no
syntactic difference with \acsl. syntactic difference with \acsl.
\begin{figure}[htbp] \begin{figure}[htbp]
\begin{cadre} \begin{cadre}
\input{loops_modern.bnf} \input{loops_modern.bnf}
...@@ -453,7 +452,7 @@ In \eacsl, the same loop invariant $I$ is valid if and only if: ...@@ -453,7 +452,7 @@ In \eacsl, the same loop invariant $I$ is valid if and only if:
\begin{itemize} \begin{itemize}
\item $I$ holds before entering the loop; and \item $I$ holds before entering the loop; and
\item if execution of the loop body in that state ends normally at the end of \item if execution of the loop body in that state ends normally at the end of
the body or with a "continue" statement, $I$ is true in the resulting state. the body or with a "continue" statement, $I$ is true in the resulting state.
\end{itemize} \end{itemize}
Thus the only difference with \acsl is that \eacsl does not assume that the Thus the only difference with \acsl is that \eacsl does not assume that the
...@@ -543,11 +542,9 @@ definition of its upper bound. ...@@ -543,11 +542,9 @@ definition of its upper bound.
\label{sec:statement_contract} \label{sec:statement_contract}
\index{statement contract}\index{contract} \index{statement contract}\index{contract}
\except{no \lstinline|abrupt| clauses} \nodiff
Figure~\ref{fig:gram:contracts} shows grammar of statement contracts. Like Figure~\ref{fig:gram:stcontracts} shows grammar of statement contracts.
function contracts, this is a simplified version of \acsl with no
\lstinline|abrupt| clauses. All other constructs are unchanged.
\begin{figure}[htbp] \begin{figure}[htbp]
\begin{cadre} \begin{cadre}
...@@ -706,7 +703,7 @@ predicates which are related to memory location. ...@@ -706,7 +703,7 @@ predicates which are related to memory location.
\nodiff \nodiff
\difficultswhy{\lstinline|\\base\_addr|, \difficultswhy{\lstinline|\\base\_addr|,
\lstinline|\\block\_length|, \lstinline|\\valid|, \lstinline|\\block\_length|, \lstinline|\\valid|,
\lstinline|\\valid_read| and \lstinline|\\valid_read| and
\lstinline|\\offset|}{the implementation of a memory model} \lstinline|\\offset|}{the implementation of a memory model}
...@@ -723,9 +720,7 @@ predicates which are related to memory location. ...@@ -723,9 +720,7 @@ predicates which are related to memory location.
\subsection{Allocation and deallocation} \subsection{Allocation and deallocation}
\difficultswhy{All these constructs}{the implementation of a memory model} \difficultswhy{All these constructs}{the implementation of a memory model}
\label{sec:alloc-dealloc} \label{sec:alloc-dealloc}
\nodiff
\mywarning{this section is still almost experimental in \acsl. Thus it might still
evolve in the future.}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
...@@ -753,8 +748,21 @@ Figure~\ref{fig:gram:list} shows the notations for built-in lists. ...@@ -753,8 +748,21 @@ Figure~\ref{fig:gram:list} shows the notations for built-in lists.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Abrupt termination}\label{sec:abrupt} \section{\notimplemented{Abrupt termination}}
\absentexperimental \label{sec:abrupt}
\index{abrupt termination}
\nodiff
Figure~\ref{fig:gram:abrupt} shows grammar of abrupt termination.
\begin{figure}[htbp]
\begin{cadre}
\input{abrupt_modern.bnf}
\end{cadre}
\caption{Grammar of contracts about abrupt terminations}
\label{fig:gram:abrupt}
\end{figure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
......
...@@ -2,9 +2,11 @@ ...@@ -2,9 +2,11 @@
statement ::= "/*@" statement-contract "*/" statement statement ::= "/*@" statement-contract "*/" statement
\ \
[ statement-contract ] ::= {("for" id ("," id)* ":")?} requires-clause* ; [ statement-contract ] ::= {("for" id ("," id)* ":")?} requires-clause* ;
simple-clause* named-behavior-stmt* ; simple-clause-stmt* named-behavior-stmt* ;
completeness-clause* completeness-clause*
\ \
simple-clause-stmt ::= simple-clause | { abrupt-clause-stmt }
\
named-behavior-stmt ::= "behavior" id ":" behavior-body-stmt named-behavior-stmt ::= "behavior" id ":" behavior-body-stmt
\ \
behavior-body-stmt ::= assumes-clause* ; behavior-body-stmt ::= assumes-clause* ;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment