text‹
We formalize basic concepts of Computational Tree Logic (CTL) 🍋‹"McMillan-PhDThesis"› 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. ›
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‹ 🚫
The CTL path operators are more interesting; they are based on an arbitrary,
but fixed model ‹M›, which is simply a transition relation over states 🍋‹'a\. ›
axiomatizationM :: "('a \ 'a) set"
text‹
The operators ‹🚫E🚫X›, ‹🚫E🚫F›, ‹🚫E🚫G› are taken as primitives, while ‹🚫A🚫X›, ‹🚫A🚫F›, ‹🚫A🚫G› are defined as derived ones. The formula ‹🚫E🚫X p› holds in a
state ‹s›, iff there is a successor state ‹s'\ (with respect to the model ‹M›), such that ‹p› holds in‹s'\. The formula \\<^bold>E\<^bold>F p\ holds in a state ‹s›, iff there is a path in‹M›, starting from‹s›, such that there exists a
state ‹s'\ on the path, such that \p\ holds in \s'›. The formula ‹🚫E🚫G p›
holds in a state ‹s›, iff there is a path, starting from‹s›, such that for
all states‹s'\ on the path, \p\ holds in \s'›. It is easy to see that ‹🚫E🚫F
p›and‹🚫E🚫G p› may be expressed using least and greatest fixed points 🍋‹"McMillan-PhDThesis"›. ›
definition EX (‹🚫E🚫X _› [80] 90) where [simp]: "\<^bold>E\<^bold>X p = {s. \s'. (s, s') \ \ \ s' \ p}"
definition EF (‹🚫E🚫F _› [80] 90) where [simp]: "\<^bold>E\<^bold>F p = lfp (\s. p \ \<^bold>E\<^bold>X s)"
definition EG (‹🚫E🚫G _› [80] 90) where [simp]: "\<^bold>E\<^bold>G p = gfp (\s. p \ \<^bold>E\<^bold>X s)"
text‹ ‹🚫A🚫X›, ‹🚫A🚫F›and‹🚫A🚫G› are now defined dually in terms of ‹🚫E🚫X›, ‹🚫E🚫F›and‹🚫E🚫G›. ›
definition AX (‹🚫A🚫X _› [80] 90) where [simp]: "\<^bold>A\<^bold>X p = - \<^bold>E\<^bold>X - p" definition AF (‹🚫A🚫F _› [80] 90) where [simp]: "\<^bold>A\<^bold>F p = - \<^bold>E\<^bold>G - p" definition AG (‹🚫A🚫G _› [80] 90) where [simp]: "\<^bold>A\<^bold>G p = - \<^bold>E\<^bold>F - p"
subsection‹Basic fixed point properties›
text‹
First of all, we use the de-Morgan property of fixed points. ›
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‹x ∈ u›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‹ In order to give dual fixed point representations of 🍋‹🚫A🚫F p›and 🍋‹🚫A🚫G p›: ›
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‹ From the greatest fixed point definition of 🍋‹🚫A🚫G p›, we derive as
a consequence of the Knaster-Tarski theorem on the one hand that 🍋‹🚫A🚫G p›is a fixed point of the monotonic function 🍋‹λs. p ∩🚫A🚫X s›. ›
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‹
This fact may be split up into two inequalities (merely using transitivity
of ‹⊆›, which is an instance of the overloaded‹≤›in Isabelle/HOL). ›
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‹
On the other hand, we havefrom the Knaster-Tarski fixed point theorem that
any other post-fixed point of 🍋‹λs. p ∩🚫A🚫X s›is smaller than 🍋‹🚫A🚫G p›. A post-fixed point is a set of states‹q› such that 🍋‹q ⊆ p ∩🚫A🚫X q›. This leads tothe following co-induction principle for 🍋‹🚫A🚫G p›. ›
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‹The tree induction principle \label{sec:calc-ctl-tree-induct}›
text‹ With the most basic facts available, we are now able to establish a few more
interesting results, leading to the 🚫‹tree induction› principle for‹🚫A🚫G›
(see below). We will use some elementary monotonicity and distributivity
rules. ›
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‹
The formula 🍋‹AG p› implies 🍋‹AX p› (we use substitution of ‹⊆›with monotonicity). ›
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‹
Furthermore we show idempotency of the ‹🚫A🚫G› operator. The proofis a good
example of how accumulated facts may get used to feed a single rule step. ›
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‹ 🚫
We now give an alternative characterization of the ‹🚫A🚫G› operator, which
describes the ‹🚫A🚫G› operator in an ``operational'' way by tree induction: In a state holds 🍋‹AG p› iff in that state holds ‹p›, andin all
reachable states‹s› follows from the fact that ‹p› holds in‹s›, that ‹p› also holds in all successor states of ‹s›. We use the co-induction principle
@{thm [source] AG_I} to establish this in a purely algebraic manner. ›
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) moreovernote AG_mono alsohave"\<^bold>A\<^bold>X p \ (p \ \<^bold>A\<^bold>X p)" .. moreovernote AG_mono finallyshow ?thesis . qed qed qed
subsection‹An application of tree induction\label{sec:calc-ctl-commute}›
text‹
Further interesting properties of CTL expressions may be demonstrated with
the help of tree induction; here we show that ‹🚫A🚫X›and‹🚫A🚫G› commute. ›
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
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 und die Messung sind noch experimentell.