doc-src/TutorialI/CTL/document/PDL.tex
changeset 11458 09a6c44a48ea
parent 11231 30d96882f915
child 11866 fbd097aec213
equal deleted inserted replaced
11457:279da0358aa9 11458:09a6c44a48ea
     5 \isamarkupsubsection{Propositional Dynamic Logic --- PDL%
     5 \isamarkupsubsection{Propositional Dynamic Logic --- PDL%
     6 }
     6 }
     7 %
     7 %
     8 \begin{isamarkuptext}%
     8 \begin{isamarkuptext}%
     9 \index{PDL|(}
     9 \index{PDL|(}
    10 The formulae of PDL\footnote{The customary definition of PDL
    10 The formulae of PDL are built up from atomic propositions via
       
    11 negation and conjunction and the two temporal
       
    12 connectives \isa{AX} and \isa{EF}\@. Since formulae are essentially
       
    13 syntax trees, they are naturally modelled as a datatype:%
       
    14 \footnote{The customary definition of PDL
    11 \cite{HarelKT-DL} looks quite different from ours, but the two are easily
    15 \cite{HarelKT-DL} looks quite different from ours, but the two are easily
    12 shown to be equivalent.} are built up from atomic propositions via
    16 shown to be equivalent.}%
    13 negation and conjunction and the two temporal
       
    14 connectives \isa{AX} and \isa{EF}. Since formulae are essentially
       
    15 syntax trees, they are naturally modelled as a datatype:%
       
    16 \end{isamarkuptext}%
    17 \end{isamarkuptext}%
    17 \isacommand{datatype}\ formula\ {\isacharequal}\ Atom\ atom\isanewline
    18 \isacommand{datatype}\ formula\ {\isacharequal}\ Atom\ atom\isanewline
    18 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {\isacharbar}\ Neg\ formula\isanewline
    19 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {\isacharbar}\ Neg\ formula\isanewline
    19 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {\isacharbar}\ And\ formula\ formula\isanewline
    20 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {\isacharbar}\ And\ formula\ formula\isanewline
    20 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {\isacharbar}\ AX\ formula\isanewline
    21 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {\isacharbar}\ AX\ formula\isanewline
    21 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {\isacharbar}\ EF\ formula%
    22 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {\isacharbar}\ EF\ formula%
    22 \begin{isamarkuptext}%
    23 \begin{isamarkuptext}%
    23 \noindent
    24 \noindent
    24 This is almost the same as in the boolean expression case study in
    25 This resembles the boolean expression case study in
    25 \S\ref{sec:boolex}.
    26 \S\ref{sec:boolex}.
    26 
    27 A validity relation between
    27 The meaning of these formulae is given by saying which formula is true in
    28 states and formulae specifies the semantics:%
    28 which state:%
       
    29 \end{isamarkuptext}%
    29 \end{isamarkuptext}%
    30 \isacommand{consts}\ valid\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequote}state\ {\isasymRightarrow}\ formula\ {\isasymRightarrow}\ bool{\isachardoublequote}\ \ \ {\isacharparenleft}{\isachardoublequote}{\isacharparenleft}{\isacharunderscore}\ {\isasymTurnstile}\ {\isacharunderscore}{\isacharparenright}{\isachardoublequote}\ {\isacharbrackleft}{\isadigit{8}}{\isadigit{0}}{\isacharcomma}{\isadigit{8}}{\isadigit{0}}{\isacharbrackright}\ {\isadigit{8}}{\isadigit{0}}{\isacharparenright}%
    30 \isacommand{consts}\ valid\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequote}state\ {\isasymRightarrow}\ formula\ {\isasymRightarrow}\ bool{\isachardoublequote}\ \ \ {\isacharparenleft}{\isachardoublequote}{\isacharparenleft}{\isacharunderscore}\ {\isasymTurnstile}\ {\isacharunderscore}{\isacharparenright}{\isachardoublequote}\ {\isacharbrackleft}{\isadigit{8}}{\isadigit{0}}{\isacharcomma}{\isadigit{8}}{\isadigit{0}}{\isacharbrackright}\ {\isadigit{8}}{\isadigit{0}}{\isacharparenright}%
    31 \begin{isamarkuptext}%
    31 \begin{isamarkuptext}%
    32 \noindent
    32 \noindent
    33 The syntax annotation allows us to write \isa{s\ {\isasymTurnstile}\ f} instead of
    33 The syntax annotation allows us to write \isa{s\ {\isasymTurnstile}\ f} instead of
    34 \hbox{\isa{valid\ s\ f}}.
    34 \hbox{\isa{valid\ s\ f}}.
    35 
       
    36 \smallskip
       
    37 The definition of \isa{{\isasymTurnstile}} is by recursion over the syntax:%
    35 The definition of \isa{{\isasymTurnstile}} is by recursion over the syntax:%
    38 \end{isamarkuptext}%
    36 \end{isamarkuptext}%
    39 \isacommand{primrec}\isanewline
    37 \isacommand{primrec}\isanewline
    40 {\isachardoublequote}s\ {\isasymTurnstile}\ Atom\ a\ \ {\isacharequal}\ {\isacharparenleft}a\ {\isasymin}\ L\ s{\isacharparenright}{\isachardoublequote}\isanewline
    38 {\isachardoublequote}s\ {\isasymTurnstile}\ Atom\ a\ \ {\isacharequal}\ {\isacharparenleft}a\ {\isasymin}\ L\ s{\isacharparenright}{\isachardoublequote}\isanewline
    41 {\isachardoublequote}s\ {\isasymTurnstile}\ Neg\ f\ \ \ {\isacharequal}\ {\isacharparenleft}{\isasymnot}{\isacharparenleft}s\ {\isasymTurnstile}\ f{\isacharparenright}{\isacharparenright}{\isachardoublequote}\isanewline
    39 {\isachardoublequote}s\ {\isasymTurnstile}\ Neg\ f\ \ \ {\isacharequal}\ {\isacharparenleft}{\isasymnot}{\isacharparenleft}s\ {\isasymTurnstile}\ f{\isacharparenright}{\isacharparenright}{\isachardoublequote}\isanewline
    49 \isa{EF\ f} means that there \emph{E}xists some \emph{F}uture state in which \isa{f} is
    47 \isa{EF\ f} means that there \emph{E}xists some \emph{F}uture state in which \isa{f} is
    50 true. The future is expressed via \isa{\isactrlsup {\isacharasterisk}}, the reflexive transitive
    48 true. The future is expressed via \isa{\isactrlsup {\isacharasterisk}}, the reflexive transitive
    51 closure. Because of reflexivity, the future includes the present.
    49 closure. Because of reflexivity, the future includes the present.
    52 
    50 
    53 Now we come to the model checker itself. It maps a formula into the set of
    51 Now we come to the model checker itself. It maps a formula into the set of
    54 states where the formula is true and is defined by recursion over the syntax,
    52 states where the formula is true.  It too is defined by recursion over the syntax:%
    55 too:%
       
    56 \end{isamarkuptext}%
    53 \end{isamarkuptext}%
    57 \isacommand{consts}\ mc\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequote}formula\ {\isasymRightarrow}\ state\ set{\isachardoublequote}\isanewline
    54 \isacommand{consts}\ mc\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequote}formula\ {\isasymRightarrow}\ state\ set{\isachardoublequote}\isanewline
    58 \isacommand{primrec}\isanewline
    55 \isacommand{primrec}\isanewline
    59 {\isachardoublequote}mc{\isacharparenleft}Atom\ a{\isacharparenright}\ \ {\isacharequal}\ {\isacharbraceleft}s{\isachardot}\ a\ {\isasymin}\ L\ s{\isacharbraceright}{\isachardoublequote}\isanewline
    56 {\isachardoublequote}mc{\isacharparenleft}Atom\ a{\isacharparenright}\ \ {\isacharequal}\ {\isacharbraceleft}s{\isachardot}\ a\ {\isasymin}\ L\ s{\isacharbraceright}{\isachardoublequote}\isanewline
    60 {\isachardoublequote}mc{\isacharparenleft}Neg\ f{\isacharparenright}\ \ \ {\isacharequal}\ {\isacharminus}mc\ f{\isachardoublequote}\isanewline
    57 {\isachardoublequote}mc{\isacharparenleft}Neg\ f{\isacharparenright}\ \ \ {\isacharequal}\ {\isacharminus}mc\ f{\isachardoublequote}\isanewline
   107 \ \ \isacommand{apply}{\isacharparenleft}rule\ mono{\isacharunderscore}ef{\isacharparenright}\isanewline
   104 \ \ \isacommand{apply}{\isacharparenleft}rule\ mono{\isacharunderscore}ef{\isacharparenright}\isanewline
   108 \ \isacommand{apply}{\isacharparenleft}simp{\isacharparenright}%
   105 \ \isacommand{apply}{\isacharparenleft}simp{\isacharparenright}%
   109 \begin{isamarkuptxt}%
   106 \begin{isamarkuptxt}%
   110 \noindent
   107 \noindent
   111 Having disposed of the monotonicity subgoal,
   108 Having disposed of the monotonicity subgoal,
   112 simplification leaves us with the following main goal
   109 simplification leaves us with the following goal:
   113 \begin{isabelle}
   110 \begin{isabelle}
   114 \ {\isadigit{1}}{\isachardot}\ {\isasymAnd}x{\isachardot}\ x\ {\isasymin}\ A\ {\isasymor}\isanewline
   111 \ {\isadigit{1}}{\isachardot}\ {\isasymAnd}x{\isachardot}\ x\ {\isasymin}\ A\ {\isasymor}\isanewline
   115 \ \ \ \ \ \ \ \ \ x\ {\isasymin}\ M{\isasyminverse}\ {\isacharbackquote}{\isacharbackquote}\ {\isacharparenleft}lfp\ {\isacharparenleft}\dots{\isacharparenright}\ {\isasyminter}\ {\isacharbraceleft}x{\isachardot}\ {\isasymexists}t{\isachardot}\ {\isacharparenleft}x{\isacharcomma}\ t{\isacharparenright}\ {\isasymin}\ M\isactrlsup {\isacharasterisk}\ {\isasymand}\ t\ {\isasymin}\ A{\isacharbraceright}{\isacharparenright}\isanewline
   112 \ \ \ \ \ \ \ \ \ x\ {\isasymin}\ M{\isasyminverse}\ {\isacharbackquote}{\isacharbackquote}\ {\isacharparenleft}lfp\ {\isacharparenleft}\dots{\isacharparenright}\ {\isasyminter}\ {\isacharbraceleft}x{\isachardot}\ {\isasymexists}t{\isachardot}\ {\isacharparenleft}x{\isacharcomma}\ t{\isacharparenright}\ {\isasymin}\ M\isactrlsup {\isacharasterisk}\ {\isasymand}\ t\ {\isasymin}\ A{\isacharbraceright}{\isacharparenright}\isanewline
   116 \ \ \ \ \ \ \ \ {\isasymLongrightarrow}\ {\isasymexists}t{\isachardot}\ {\isacharparenleft}x{\isacharcomma}\ t{\isacharparenright}\ {\isasymin}\ M\isactrlsup {\isacharasterisk}\ {\isasymand}\ t\ {\isasymin}\ A
   113 \ \ \ \ \ \ \ \ {\isasymLongrightarrow}\ {\isasymexists}t{\isachardot}\ {\isacharparenleft}x{\isacharcomma}\ t{\isacharparenright}\ {\isasymin}\ M\isactrlsup {\isacharasterisk}\ {\isasymand}\ t\ {\isasymin}\ A
   117 \end{isabelle}
   114 \end{isabelle}
   118 which is proved by \isa{blast} with the help of transitivity of \isa{\isactrlsup {\isacharasterisk}}:%
   115 It is proved by \isa{blast}, using the transitivity of 
       
   116 \isa{M\isactrlsup {\isacharasterisk}}.%
   119 \end{isamarkuptxt}%
   117 \end{isamarkuptxt}%
   120 \ \isacommand{apply}{\isacharparenleft}blast\ intro{\isacharcolon}\ rtrancl{\isacharunderscore}trans{\isacharparenright}%
   118 \ \isacommand{apply}{\isacharparenleft}blast\ intro{\isacharcolon}\ rtrancl{\isacharunderscore}trans{\isacharparenright}%
   121 \begin{isamarkuptxt}%
   119 \begin{isamarkuptxt}%
   122 We now return to the second set inclusion subgoal, which is again proved
   120 We now return to the second set inclusion subgoal, which is again proved
   123 pointwise:%
   121 pointwise:%
   130 \begin{isabelle}%
   128 \begin{isabelle}%
   131 \ {\isadigit{1}}{\isachardot}\ {\isasymAnd}x\ t{\isachardot}\ {\isasymlbrakk}{\isacharparenleft}x{\isacharcomma}\ t{\isacharparenright}\ {\isasymin}\ M\isactrlsup {\isacharasterisk}{\isacharsemicolon}\ t\ {\isasymin}\ A{\isasymrbrakk}\ {\isasymLongrightarrow}\ x\ {\isasymin}\ lfp\ {\isacharparenleft}{\isasymlambda}T{\isachardot}\ A\ {\isasymunion}\ M{\isasyminverse}\ {\isacharbackquote}{\isacharbackquote}\ T{\isacharparenright}%
   129 \ {\isadigit{1}}{\isachardot}\ {\isasymAnd}x\ t{\isachardot}\ {\isasymlbrakk}{\isacharparenleft}x{\isacharcomma}\ t{\isacharparenright}\ {\isasymin}\ M\isactrlsup {\isacharasterisk}{\isacharsemicolon}\ t\ {\isasymin}\ A{\isasymrbrakk}\ {\isasymLongrightarrow}\ x\ {\isasymin}\ lfp\ {\isacharparenleft}{\isasymlambda}T{\isachardot}\ A\ {\isasymunion}\ M{\isasyminverse}\ {\isacharbackquote}{\isacharbackquote}\ T{\isacharparenright}%
   132 \end{isabelle}
   130 \end{isabelle}
   133 This goal is proved by induction on \isa{{\isacharparenleft}s{\isacharcomma}\ t{\isacharparenright}\ {\isasymin}\ M\isactrlsup {\isacharasterisk}}. But since the model
   131 This goal is proved by induction on \isa{{\isacharparenleft}s{\isacharcomma}\ t{\isacharparenright}\ {\isasymin}\ M\isactrlsup {\isacharasterisk}}. But since the model
   134 checker works backwards (from \isa{t} to \isa{s}), we cannot use the
   132 checker works backwards (from \isa{t} to \isa{s}), we cannot use the
   135 induction theorem \isa{rtrancl{\isacharunderscore}induct} because it works in the
   133 induction theorem \isa{rtrancl{\isacharunderscore}induct}: it works in the
   136 forward direction. Fortunately the converse induction theorem
   134 forward direction. Fortunately the converse induction theorem
   137 \isa{converse{\isacharunderscore}rtrancl{\isacharunderscore}induct} already exists:
   135 \isa{converse{\isacharunderscore}rtrancl{\isacharunderscore}induct} already exists:
   138 \begin{isabelle}%
   136 \begin{isabelle}%
   139 \ \ \ \ \ {\isasymlbrakk}{\isacharparenleft}a{\isacharcomma}\ b{\isacharparenright}\ {\isasymin}\ r\isactrlsup {\isacharasterisk}{\isacharsemicolon}\ P\ b{\isacharsemicolon}\isanewline
   137 \ \ \ \ \ {\isasymlbrakk}{\isacharparenleft}a{\isacharcomma}\ b{\isacharparenright}\ {\isasymin}\ r\isactrlsup {\isacharasterisk}{\isacharsemicolon}\ P\ b{\isacharsemicolon}\isanewline
   140 \isaindent{\ \ \ \ \ \ \ \ }{\isasymAnd}y\ z{\isachardot}\ {\isasymlbrakk}{\isacharparenleft}y{\isacharcomma}\ z{\isacharparenright}\ {\isasymin}\ r{\isacharsemicolon}\ {\isacharparenleft}z{\isacharcomma}\ b{\isacharparenright}\ {\isasymin}\ r\isactrlsup {\isacharasterisk}{\isacharsemicolon}\ P\ z{\isasymrbrakk}\ {\isasymLongrightarrow}\ P\ y{\isasymrbrakk}\isanewline
   138 \isaindent{\ \ \ \ \ \ \ \ }{\isasymAnd}y\ z{\isachardot}\ {\isasymlbrakk}{\isacharparenleft}y{\isacharcomma}\ z{\isacharparenright}\ {\isasymin}\ r{\isacharsemicolon}\ {\isacharparenleft}z{\isacharcomma}\ b{\isacharparenright}\ {\isasymin}\ r\isactrlsup {\isacharasterisk}{\isacharsemicolon}\ P\ z{\isasymrbrakk}\ {\isasymLongrightarrow}\ P\ y{\isasymrbrakk}\isanewline
   176 \isacommand{apply}{\isacharparenleft}induct{\isacharunderscore}tac\ f{\isacharparenright}\isanewline
   174 \isacommand{apply}{\isacharparenleft}induct{\isacharunderscore}tac\ f{\isacharparenright}\isanewline
   177 \isacommand{apply}{\isacharparenleft}auto\ simp\ add{\isacharcolon}EF{\isacharunderscore}lemma{\isacharparenright}\isanewline
   175 \isacommand{apply}{\isacharparenleft}auto\ simp\ add{\isacharcolon}EF{\isacharunderscore}lemma{\isacharparenright}\isanewline
   178 \isacommand{done}%
   176 \isacommand{done}%
   179 \begin{isamarkuptext}%
   177 \begin{isamarkuptext}%
   180 \begin{exercise}
   178 \begin{exercise}
   181 \isa{AX} has a dual operator \isa{EN}\footnote{We cannot use the customary \isa{EX}
   179 \isa{AX} has a dual operator \isa{EN} 
   182 as that is the \textsc{ascii}-equivalent of \isa{{\isasymexists}}}
   180 (``there exists a next state such that'')%
   183 (``there exists a next state such that'') with the intended semantics
   181 \footnote{We cannot use the customary \isa{EX}: it is reserved
       
   182 as the \textsc{ascii}-equivalent of \isa{{\isasymexists}}.}
       
   183 with the intended semantics
   184 \begin{isabelle}%
   184 \begin{isabelle}%
   185 \ \ \ \ \ s\ {\isasymTurnstile}\ EN\ f\ {\isacharequal}\ {\isacharparenleft}{\isasymexists}t{\isachardot}\ {\isacharparenleft}s{\isacharcomma}\ t{\isacharparenright}\ {\isasymin}\ M\ {\isasymand}\ t\ {\isasymTurnstile}\ f{\isacharparenright}%
   185 \ \ \ \ \ s\ {\isasymTurnstile}\ EN\ f\ {\isacharequal}\ {\isacharparenleft}{\isasymexists}t{\isachardot}\ {\isacharparenleft}s{\isacharcomma}\ t{\isacharparenright}\ {\isasymin}\ M\ {\isasymand}\ t\ {\isasymTurnstile}\ f{\isacharparenright}%
   186 \end{isabelle}
   186 \end{isabelle}
   187 Fortunately, \isa{EN\ f} can already be expressed as a PDL formula. How?
   187 Fortunately, \isa{EN\ f} can already be expressed as a PDL formula. How?
   188 
   188