text\<open>
We formalize basic concepts of Computational Tree Logic (CTL) \<^cite>\<open>"McMillan-PhDThesis"\<close> within the simply-typed
set theory of HOL.
Byusing the common technique of ``shallow embedding'', a CTL formula is
identified with the corresponding set of stateswhere it holds.
Consequently, CTL operations such as negation, conjunction, disjunction
simply become complement, intersection, union of sets. We only require a
separate operation for implication, as point-wise inclusion is usually not
encountered in plain set-theory. \<close>
definition imp :: "'a ctl \ 'a ctl \ 'a ctl" (infixr \\\ 75) where"p \ q = - p \ q"
lemma [intro!]: "p \ p \ q \ q" unfolding imp_def by auto lemma [intro!]: "p \ (q \ p)" unfolding imp_def by rule
text\<open> \<^smallskip>
The CTL path operators are more interesting; they are based on an arbitrary,
but fixed model \<open>\<M>\<close>, which is simply a transition relation over states \<^typ>\<open>'a\<close>. \<close>
axiomatization\<M> :: "('a \<times> 'a) set"
text\<open>
The operators \<open>\<^bold>E\<^bold>X\<close>, \<open>\<^bold>E\<^bold>F\<close>, \<open>\<^bold>E\<^bold>G\<close> are taken as primitives, while \<open>\<^bold>A\<^bold>X\<close>, \<open>\<^bold>A\<^bold>F\<close>, \<open>\<^bold>A\<^bold>G\<close> are defined as derived ones. The formula \<open>\<^bold>E\<^bold>X p\<close> holds in a
state \<open>s\<close>, iff there is a successor state \<open>s'\<close> (with respect to the model \<open>\<M>\<close>), such that \<open>p\<close> holds in \<open>s'\<close>. The formula \<open>\<^bold>E\<^bold>F p\<close> holds in a state \<open>s\<close>, iff there is a path in \<open>\<M>\<close>, starting from \<open>s\<close>, such that there exists a
state \<open>s'\<close> on the path, such that \<open>p\<close> holds in \<open>s'\<close>. The formula \<open>\<^bold>E\<^bold>G p\<close>
holds in a state \<open>s\<close>, iff there is a path, starting from \<open>s\<close>, such that for
all states\<open>s'\<close> on the path, \<open>p\<close> holds in \<open>s'\<close>. It is easy to see that \<open>\<^bold>E\<^bold>F
p\<close> and \<open>\<^bold>E\<^bold>G p\<close> may be expressed using least and greatest fixed points \<^cite>\<open>"McMillan-PhDThesis"\<close>. \<close>
definition EX (\<open>\<^bold>E\<^bold>X _\<close> [80] 90) where [simp]: "\<^bold>E\<^bold>X p = {s. \s'. (s, s') \ \ \ s' \ p}"
definition EF (\<open>\<^bold>E\<^bold>F _\<close> [80] 90) where [simp]: "\<^bold>E\<^bold>F p = lfp (\s. p \ \<^bold>E\<^bold>X s)"
definition EG (\<open>\<^bold>E\<^bold>G _\<close> [80] 90) where [simp]: "\<^bold>E\<^bold>G p = gfp (\s. p \ \<^bold>E\<^bold>X s)"
text\<open> \<open>\<^bold>A\<^bold>X\<close>, \<open>\<^bold>A\<^bold>F\<close> and \<open>\<^bold>A\<^bold>G\<close> are now defined dually in terms of \<open>\<^bold>E\<^bold>X\<close>, \<open>\<^bold>E\<^bold>F\<close> and \<open>\<^bold>E\<^bold>G\<close>. \<close>
definition AX (\<open>\<^bold>A\<^bold>X _\<close> [80] 90) where [simp]: "\<^bold>A\<^bold>X p = - \<^bold>E\<^bold>X - p" definition AF (\<open>\<^bold>A\<^bold>F _\<close> [80] 90) where [simp]: "\<^bold>A\<^bold>F p = - \<^bold>E\<^bold>G - p" definition AG (\<open>\<^bold>A\<^bold>G _\<close> [80] 90) where [simp]: "\<^bold>A\<^bold>G p = - \<^bold>E\<^bold>F - p"
subsection \<open>Basic fixed point properties\<close>
text\<open>
First of all, we use the de-Morgan property of fixed points. \<close>
lemma lfp_gfp: "lfp f = - gfp (\s::'a set. - (f (- s)))" proof show"lfp f \ - gfp (\s. - f (- s))" proof show"x \ - gfp (\s. - f (- s))" if l: "x \ lfp f" for x proof assume"x \ gfp (\s. - f (- s))" thenobtain u where"x \ u" and "u \ - f (- u)" by (auto simp add: gfp_def) thenhave"f (- u) \ - u" by auto thenhave"lfp f \ - u" by (rule lfp_lowerbound) from l and this have"x \ u" by auto with\<open>x \<in> u\<close> show False by contradiction qed qed show"- gfp (\s. - f (- s)) \ lfp f" proof (rule lfp_greatest) fix u assume"f u \ u" thenhave"- u \ - f u" by auto thenhave"- u \ - f (- (- u))" by simp thenhave"- u \ gfp (\s. - f (- s))" by (rule gfp_upperbound) thenshow"- gfp (\s. - f (- s)) \ u" by auto qed qed
lemma lfp_gfp': "- lfp f = gfp (\s::'a set. - (f (- s)))" by (simp add: lfp_gfp)
lemma gfp_lfp': "- gfp f = lfp (\s::'a set. - (f (- s)))" by (simp add: lfp_gfp)
text\<open> In order to give dual fixed point representations of \<^term>\<open>\<^bold>A\<^bold>F p\<close> and \<^term>\<open>\<^bold>A\<^bold>G p\<close>: \<close>
lemma AF_lfp: "\<^bold>A\<^bold>F p = lfp (\s. p \ \<^bold>A\<^bold>X s)" by (simp add: lfp_gfp)
lemma AG_gfp: "\<^bold>A\<^bold>G p = gfp (\s. p \ \<^bold>A\<^bold>X s)" by (simp add: lfp_gfp)
lemma EF_fp: "\<^bold>E\<^bold>F p = p \ \<^bold>E\<^bold>X \<^bold>E\<^bold>F p" proof - have"mono (\s. p \ \<^bold>E\<^bold>X s)" by rule auto thenshow ?thesis by (simp only: EF_def) (rule lfp_unfold) qed
lemma AF_fp: "\<^bold>A\<^bold>F p = p \ \<^bold>A\<^bold>X \<^bold>A\<^bold>F p" proof - have"mono (\s. p \ \<^bold>A\<^bold>X s)" by rule auto thenshow ?thesis by (simp only: AF_lfp) (rule lfp_unfold) qed
lemma EG_fp: "\<^bold>E\<^bold>G p = p \ \<^bold>E\<^bold>X \<^bold>E\<^bold>G p" proof - have"mono (\s. p \ \<^bold>E\<^bold>X s)" by rule auto thenshow ?thesis by (simp only: EG_def) (rule gfp_unfold) qed
text\<open> From the greatest fixed point definition of \<^term>\<open>\<^bold>A\<^bold>G p\<close>, we derive as
a consequence of the Knaster-Tarski theorem on the one hand that \<^term>\<open>\<^bold>A\<^bold>G p\<close> is a fixed point of the monotonic function \<^term>\<open>\<lambda>s. p \<inter> \<^bold>A\<^bold>X s\<close>. \<close>
lemma AG_fp: "\<^bold>A\<^bold>G p = p \ \<^bold>A\<^bold>X \<^bold>A\<^bold>G p" proof - have"mono (\s. p \ \<^bold>A\<^bold>X s)" by rule auto thenshow ?thesis by (simp only: AG_gfp) (rule gfp_unfold) qed
text\<open>
This fact may be split up into two inequalities (merely using transitivity
of \<open>\<subseteq>\<close>, which is an instance of the overloaded \<open>\<le>\<close> in Isabelle/HOL). \<close>
lemma AG_fp_1: "\<^bold>A\<^bold>G p \ p" proof - note AG_fp alsohave"p \ \<^bold>A\<^bold>X \<^bold>A\<^bold>G p \ p" by auto finallyshow ?thesis . qed
lemma AG_fp_2: "\<^bold>A\<^bold>G p \ \<^bold>A\<^bold>X \<^bold>A\<^bold>G p" proof - note AG_fp alsohave"p \ \<^bold>A\<^bold>X \<^bold>A\<^bold>G p \ \<^bold>A\<^bold>X \<^bold>A\<^bold>G p" by auto finallyshow ?thesis . qed
text\<open>
On the other hand, we havefrom the Knaster-Tarski fixed point theorem that
any other post-fixed point of \<^term>\<open>\<lambda>s. p \<inter> \<^bold>A\<^bold>X s\<close> is smaller than \<^term>\<open>\<^bold>A\<^bold>G p\<close>. A post-fixed point is a set of states \<open>q\<close> such that \<^term>\<open>q \<subseteq> p \<inter> \<^bold>A\<^bold>X q\<close>. This leads to the following co-induction principle for \<^term>\<open>\<^bold>A\<^bold>G p\<close>. \<close>
lemma AG_I: "q \ p \ \<^bold>A\<^bold>X q \ q \ \<^bold>A\<^bold>G p" by (simp only: AG_gfp) (rule gfp_upperbound)
subsection \<open>The tree induction principle \label{sec:calc-ctl-tree-induct}\<close>
text\<open> With the most basic facts available, we are now able to establish a few more
interesting results, leading to the \<^emph>\<open>tree induction\<close> principle for \<open>\<^bold>A\<^bold>G\<close>
(see below). We will use some elementary monotonicity and distributivity
rules. \<close>
lemma AX_int: "\<^bold>A\<^bold>X (p \ q) = \<^bold>A\<^bold>X p \ \<^bold>A\<^bold>X q" by auto lemma AX_mono: "p \ q \ \<^bold>A\<^bold>X p \ \<^bold>A\<^bold>X q" by auto lemma AG_mono: "p \ q \ \<^bold>A\<^bold>G p \ \<^bold>A\<^bold>G q" by (simp only: AG_gfp, rule gfp_mono) auto
text\<open>
The formula \<^term>\<open>AG p\<close> implies \<^term>\<open>AX p\<close> (we use substitution of \<open>\<subseteq>\<close> with monotonicity). \<close>
lemma AG_AX: "\<^bold>A\<^bold>G p \ \<^bold>A\<^bold>X p" proof - have"\<^bold>A\<^bold>G p \ \<^bold>A\<^bold>X \<^bold>A\<^bold>G p" by (rule AG_fp_2) alsohave"\<^bold>A\<^bold>G p \ p" by (rule AG_fp_1) moreovernote AX_mono finallyshow ?thesis . qed
text\<open>
Furthermore we show idempotency of the \<open>\<^bold>A\<^bold>G\<close> operator. The proof is a good
example of how accumulated facts may get used to feed a single rule step. \<close>
lemma AG_AG: "\<^bold>A\<^bold>G \<^bold>A\<^bold>G p = \<^bold>A\<^bold>G p" proof show"\<^bold>A\<^bold>G \<^bold>A\<^bold>G p \ \<^bold>A\<^bold>G p" by (rule AG_fp_1) next show"\<^bold>A\<^bold>G p \ \<^bold>A\<^bold>G \<^bold>A\<^bold>G p" proof (rule AG_I) have"\<^bold>A\<^bold>G p \ \<^bold>A\<^bold>G p" .. moreoverhave"\<^bold>A\<^bold>G p \ \<^bold>A\<^bold>X \<^bold>A\<^bold>G p" by (rule AG_fp_2) ultimatelyshow"\<^bold>A\<^bold>G p \ \<^bold>A\<^bold>G p \ \<^bold>A\<^bold>X \<^bold>A\<^bold>G p" .. qed qed
text\<open> \<^smallskip>
We now give an alternative characterization of the \<open>\<^bold>A\<^bold>G\<close> operator, which
describes the \<open>\<^bold>A\<^bold>G\<close> operator in an ``operational'' way by tree induction: In a state holds \<^term>\<open>AG p\<close> iff in that state holds \<open>p\<close>, and in all
reachable states\<open>s\<close> follows from the fact that \<open>p\<close> holds in \<open>s\<close>, that \<open>p\<close> also holds in all successor states of \<open>s\<close>. We use the co-induction principle
@{thm [source] AG_I} to establish this in a purely algebraic manner. \<close>
theorem AG_induct: "p \ \<^bold>A\<^bold>G (p \ \<^bold>A\<^bold>X p) = \<^bold>A\<^bold>G p" proof show"p \ \<^bold>A\<^bold>G (p \ \<^bold>A\<^bold>X p) \ \<^bold>A\<^bold>G p" (is "?lhs \ _") proof (rule AG_I) show"?lhs \ p \ \<^bold>A\<^bold>X ?lhs" proof show"?lhs \ p" .. show"?lhs \ \<^bold>A\<^bold>X ?lhs" proof -
{ have"\<^bold>A\<^bold>G (p \ \<^bold>A\<^bold>X p) \ p \ \<^bold>A\<^bold>X p" by (rule AG_fp_1) alsohave"p \ p \ \<^bold>A\<^bold>X p \ \<^bold>A\<^bold>X p" .. finallyhave"?lhs \ \<^bold>A\<^bold>X p" by auto
} moreover
{ have"p \ \<^bold>A\<^bold>G (p \ \<^bold>A\<^bold>X p) \ \<^bold>A\<^bold>G (p \ \<^bold>A\<^bold>X p)" .. alsohave"\ \ \<^bold>A\<^bold>X \" by (rule AG_fp_2) finallyhave"?lhs \ \<^bold>A\<^bold>X \<^bold>A\<^bold>G (p \ \<^bold>A\<^bold>X p)" .
} ultimatelyhave"?lhs \ \<^bold>A\<^bold>X p \ \<^bold>A\<^bold>X \<^bold>A\<^bold>G (p \ \<^bold>A\<^bold>X p)" .. alsohave"\ = \<^bold>A\<^bold>X ?lhs" by (simp only: AX_int) finallyshow ?thesis . qed qed qed next show"\<^bold>A\<^bold>G p \ p \ \<^bold>A\<^bold>G (p \ \<^bold>A\<^bold>X p)" proof show"\<^bold>A\<^bold>G p \ p" by (rule AG_fp_1) show"\<^bold>A\<^bold>G p \ \<^bold>A\<^bold>G (p \ \<^bold>A\<^bold>X p)" proof - have"\<^bold>A\<^bold>G p = \<^bold>A\<^bold>G \<^bold>A\<^bold>G p" by (simp only: AG_AG) alsohave"\<^bold>A\<^bold>G p \ \<^bold>A\<^bold>X p" by (rule AG_AX) moreover note AG_mono alsohave"\<^bold>A\<^bold>X p \ (p \ \<^bold>A\<^bold>X p)" .. moreover note AG_mono finallyshow ?thesis . qed qed qed
subsection \<open>An application of tree induction \label{sec:calc-ctl-commute}\<close>
text\<open>
Further interesting properties of CTL expressions may be demonstrated with
the help of tree induction; here we show that \<open>\<^bold>A\<^bold>X\<close> and \<open>\<^bold>A\<^bold>G\<close> commute. \<close>
theorem AG_AX_commute: "\<^bold>A\<^bold>G \<^bold>A\<^bold>X p = \<^bold>A\<^bold>X \<^bold>A\<^bold>G p" proof - have"\<^bold>A\<^bold>G \<^bold>A\<^bold>X p = \<^bold>A\<^bold>X p \ \<^bold>A\<^bold>X \<^bold>A\<^bold>G \<^bold>A\<^bold>X p" by (rule AG_fp) alsohave"\ = \<^bold>A\<^bold>X (p \ \<^bold>A\<^bold>G \<^bold>A\<^bold>X p)" by (simp only: AX_int) alsohave"p \ \<^bold>A\<^bold>G \<^bold>A\<^bold>X p = \<^bold>A\<^bold>G p" (is "?lhs = _") proof have"\<^bold>A\<^bold>X p \ p \ \<^bold>A\<^bold>X p" .. alsohave"p \ \<^bold>A\<^bold>G (p \ \<^bold>A\<^bold>X p) = \<^bold>A\<^bold>G p" by (rule AG_induct) alsonote Int_mono AG_mono ultimatelyshow"?lhs \ \<^bold>A\<^bold>G p" by fast next have"\<^bold>A\<^bold>G p \ p" by (rule AG_fp_1) moreover
{ have"\<^bold>A\<^bold>G p = \<^bold>A\<^bold>G \<^bold>A\<^bold>G p" by (simp only: AG_AG) alsohave"\<^bold>A\<^bold>G p \ \<^bold>A\<^bold>X p" by (rule AG_AX) alsonote AG_mono ultimatelyhave"\<^bold>A\<^bold>G p \ \<^bold>A\<^bold>G \<^bold>A\<^bold>X p" .
} ultimatelyshow"\<^bold>A\<^bold>G p \ ?lhs" .. qed finallyshow ?thesis . qed
end
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.