Browse Source

Corrections de fautes

Thibaut Marty 7 years ago
parent
commit
95bec3a388
2 changed files with 18 additions and 25 deletions
  1. 10 16
      dm.tex
  2. 8 9
      sections/correctness.tex

+ 10 - 16
dm.tex

@@ -54,9 +54,9 @@
 
 Some programs of a language can be incorrect, that is programs which their execution will make no sense.
 
-Ensuring that a program do exactly what we want it to do is a hard task.
+Ensuring that a program does exactly what we want it to do is a hard task.
 Since Rice and his famous theorem, we know that automatically checking that a program respects its specification is impossible (in general).
-It exists some techniques, not to ensure the validity of a program, but at least ensure that a program does not contains a certain type of non-sense.
+There exists some techniques, not to ensure the validity of a program, but at least ensure that a program does not contains a certain type of nonsense.
 Using a type system, and type checking, is one way to ensure that no operation in the program is performed when it has no sense.
 Data-flow analysis for reachability is one other way to ensure that all used objects are defined.
 
@@ -69,7 +69,7 @@ Then, we define a type system and a static analysis for this language.
 
 We will see that both of them have different flows. Each complement the other, and none of them are perfect.
 
-\section{Small-step Semantic}
+\section{Small-step Semantics}
 
 \subsection{Domains}
 
@@ -104,7 +104,7 @@ where
 \end{align*}
 
 For the undefined cases, for example when we try to add two records, we also note $\mathcal{A}|[e|] \sigma = \bot$.
-In the rest of this homwork, we suppose $\mathcal{B}|[ \bullet |]$ the denotational semantic for booleans expressions already defined.
+In the rest of this work, we suppose $\mathcal{B}|[ \bullet |]$ the denotational semantic for booleans expressions already defined.
 
 \subsection{Structural Operational Semantic for commands}
 
@@ -205,9 +205,9 @@ Field lookup
   \inference{\Gamma \vdash e : \{f : T\}}{\Gamma \vdash e.f : T}
 \]
 
-As is, the last rule can seems too restrictive.
+As is, the last rule can seem too restrictive.
 Indeed, an expression $e$ does not have to match \emph{exactly} the type $\{f : T\}$ to provide the field $f$.
-It can contains some other fields.
+It can contain some other fields.
 
 We want the type $\{f : T\}$ to express \enquote{any record with a field $f$ of type $T$}.
 To do this, we introduce the following sub-typing relation:
@@ -215,7 +215,6 @@ To do this, we introduce the following sub-typing relation:
 \[
   \inference{}{\{f_1 : T_1; \dots ; f_n : T_n; g_1 : S_1; \dots ; g_k : S_k\} <: \{f_1 : T_1; \dots ; f_n : T_n\}}
 \]
-% FIXME on avait noté la relation <: dans l'autre sens
 
 Note that in order to assure the reflexivity of our relation,
 a type $S$ is a sub-type of $T$ if all the fields of $T$ are included in $S$.
@@ -245,7 +244,7 @@ Condition
   \inference{\Gamma \vdash b & \Gamma \vdash S_1 & \Gamma \vdash S_2}{\Gamma \vdash \<if>\ b\ \<then>\ S_1\ \<else>\ S_2}
 \]
 
-As the booleans expressions can contain expressions which can contain variables, they are not necessarily well typed. Hence we need to define typing rules on booleans:
+As the boolean expressions can contain expressions which can contain variables, they are not necessarily well typed. Hence we need to define typing rules on booleans:
 \[
   \inference{}{\Gamma \vdash \<true>}
 \]
@@ -362,9 +361,9 @@ RF(5) &= RF(2) = \{x \mapsto \{f_1\}\}
 \subsection{Termination}
 
 We can design an algorithm to solve this equation system under the hypothesis that there is no label $l$ such as $(l, l) \in flow(P)$.
-At each step we can :
+At each step we can:
 \begin{itemize}
-\item Rewrite a $RF(l)$ as $\bigcap_{(l', l) \in flow(P)} RF_{out}(l')$, where $RF_{out}(l')$ can be simplified into a term that does not contains $RF(l)$ (because $(l, l) \not\in flow(P)$).
+\item Rewrite a $RF(l)$ as $\bigcap_{(l', l) \in flow(P)} RF_{out}(l')$, where $RF_{out}(l')$ can be simplified into a term that does not contain $RF(l)$ (because $(l, l) \not\in flow(P)$).
 \item Because a program contains a finite number of instructions, it exists a time when no $RF(l)$ is left. The system is solved.
 \end{itemize}
 
@@ -386,7 +385,7 @@ Indeed, the expression $3 + x$ is not well typed as the type of $x$ is $\{f:int\
 
 The program $x := \{\}; \<if>\ b\ \<then>\ x.f := 1\ \<else>\ \<skip>; y := x.f$ is well typed because the type $\{\}$ is a sub-type of the type $\{f:int\}$.
 However, its static analysis fails.
-The static analysis will take the worst case of the two branches of the \<if> statement, that is the \<else> branch when $x$ doesn't get the extra field $f$.
+The static analysis will take the worst case of the two branches of the \<if> statement, that is the \<else> branch when $x$ does not get the extra field $f$.
 Thus, the last statement, $y := x.f$, tries to reach the undefined (according to the analysis) field $f$.
 
 \subsection{Extension of the static analysis}
@@ -395,9 +394,4 @@ A better solution of the two previous approaches is the union of them.
 In other words, we could extend the static analysis by using the result of the type checking.
 In this way, the two previous examples will be rightly rejected by the new analysis.
 
-% An other improvement could be made the analysis of the expressions.
-% Expressions are defined inductively and can contain sub-epxressions.
-% But the current static analysis only process one level of expression.
-% For instance, if we have an expression % TODO
-
 \end{document}

+ 8 - 9
sections/correctness.tex

@@ -2,7 +2,7 @@
 
 \begin{definition}[Well typed value]
 \label{wt-value}
-A value $v \in Value$ is well typed regarding to a type $T$ (noted $v |- T$) when :
+A value $v \in Value$ is well typed regarding to a type $T$ (noted $v |- T$) when:
 \begin{align*}
 v |- int &<=> v \in \mathbb{N} \\
 v |- \{f_1 : T_1, \dots, f_n : T_n\} &<=> v \in Field \rightharpoonup Value\text{ and }\forall f_i, f_i \in dom(v) \land v(f_i) |- T_i
@@ -16,7 +16,7 @@ A state $\sigma \in State$, $\sigma \neq \bot$ is well typed with regards to a t
 \end{definition}
 
 \begin{lemma}[Well typed expressions cannot go wrong]
-$\forall e \in AExpr, \sigma \in State, \Gamma$ such as $\sigma |- \Gamma$ :
+$\forall e \in AExpr, \sigma \in State, \Gamma$ such as $\sigma |- \Gamma$:
 \[\Gamma |- e : T => \mathcal{A}|[e|] \sigma |- T\]
 In particular, $\mathcal{A}|[e|] \sigma \neq \bot$.
 \end{lemma}
@@ -24,7 +24,7 @@ In particular, $\mathcal{A}|[e|] \sigma \neq \bot$.
 \begin{proof}
 We demonstrate this property by induction on the structure of the expression $e$.
 First let assume that $\Gamma |- e : T$.
-We can eliminates all trivial cases in contradiction with this assumption (for example when $e = 1 + 1$ and $T = \{\}$).
+We can eliminate all trivial cases in contradiction with this assumption (for example when $e = 1 + 1$ and $T = \{\}$).
 Here are the other base cases:
 \begin{itemize}
 \item $e = n, T = int$.
@@ -66,7 +66,7 @@ By definition of $|-$,
 \]
 
 By our hypothesis of induction, we have $\mathcal{A}|[e_1|]\sigma |- T$.
-So by definition \ref{wt-state} we have :
+So by definition \ref{wt-state} we have:
 \begin{itemize}
 \item $\mathcal{A}|[e_1|]\sigma \in Field \rightharpoonup Value$
 \item $f \in dom(\mathcal{A}|[e_1|]\sigma)$
@@ -94,7 +94,7 @@ or
 
 Let consider the first case (the other case works the same).
 By our hypothesis of induction, we have $\mathcal{A}|[e_1|]\sigma |- \{f_1 : T_1; \dots; f_n : T_n\}$.
-So by definition \ref{wt-state} we have :
+So by definition \ref{wt-state} we have:
 \begin{itemize}
 \item $\mathcal{A}|[e_1|]\sigma \in Field \rightharpoonup Value$
 \item $f \in dom(\mathcal{A}|[e_1|]\sigma)$
@@ -112,7 +112,7 @@ and moreover:
 \item $\mathcal{A}|[e|]\sigma f |- T'$.
 \end{itemize}
 
-This match the definition of $\mathcal{A}|[e|] \sigma |- T = \{f : T'; f_1 : T_1; \dots; f_n : T_n\}$.
+This matches the definition of $\mathcal{A}|[e|] \sigma |- T = \{f : T'; f_1 : T_1; \dots; f_n : T_n\}$.
 
 \item $e = \{f_1 = e_1; \dots; f_n = e_n\}$.
 
@@ -125,7 +125,7 @@ This means that, $\forall f_i, 1 \leq i \leq n$:
 \item $\mathcal{A}|[e|]\sigma f_i = \mathcal{A}|[e_i|]\sigma |- T_i$ (by induction).
 \end{itemize}
 
-This match the definition for $\mathcal{A}|[e|] \sigma |- T$.
+This matches the definition for $\mathcal{A}|[e|] \sigma |- T$.
 
 \end{itemize}
 \end{proof}
@@ -149,10 +149,9 @@ By hypothesis, $\sigma |- \Gamma$, so $\sigma' |- \Gamma$.
 We have two cases:
 \begin{itemize}
 \item $s = \sigma'' \in State$
-Let consider 
 There is no transition from a terminal state, so this is trivially true.
 \item $s = (S, \sigma'')$
-By induciton we know that $\sigma'' |- \Gamma$.
+By induction we know that $\sigma'' |- \Gamma$.
 
 We can prove by induction on the structure of $S$ that
 $(S, \sigma'') \rightarrow \sigma' => \sigma' |- \Gamma$ and