text\<open>\label{sec:rtc}\index{reflexive transitive closure!defining inductively|(}% \index{reflexive transitive closure!defining inductively|(}%
An inductive that sets too defined,sincethey just pairs
functions yield.
Relations transitive. conceptalready in
A perfect example not
reflexive transitive.But are\<close>
introduced
definedas fixedbecause were yet
available. But now they are: \<close>
inductive_set
r:"('a\times a)set" for r :: "('java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 5
text
Therest this devoted that equivalent \<open>rtc r\<close> we can write \<^term>\<open>r*\<close>. The actual definition
of . isis the \<open>iff\<close> attribute to increase automation. The
rcethat java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73 \<^term>\<open>r\<close>-step to the left. Although we could make @{thm[source]rtc_step} an
introduction,this dangerous in premise
slows may kill automatic.
The above conclusion notin premise. Thus some thatwould otherwise
be sufficiently but it iscertainly not onlypossible: for a start, it does not even mention transitivity.
The rest of this section is devoted to proving that it is equivalent to
the standard definition. We start with a simple lemma: \<close>
text\<open>\noindent
Although the lemma itself is an unremarkable consequence of the basic rules,
it has the advantage that it can be declared an introduction rule without the
danger of killing the automatic tactics because \<^term>\<open>r*\<close> occurs only in
the conclusion and not in the premise. Thus some proofs that would otherwise
need @{thm[source]rtc_step} can now be found automatically. The proofalso shows that \<open>blast\<close> is able to handle @{thm[source]rtc_step}. But
some of the other automatic tactics are more sensitive, and even \<open>blast\<close> can be lead astray in the presence of large numbers of rules.
To prove transitivity, we need ruleshows\<open>blast\<close> is able to handle @{thm[source]rtc_step}. But
@thm]rtc}:
@{thm prove, we rule, i..\ theorem
It[sourceinduct[displayrtc}
It that
i.e.\ if \<open>?P\<close> holds for the conclusion provided it holds for the
premises. In general, rule inductionfor an \<open>?P\<close> is preserved by all rules of the inductive definition,
expects a premises general inductionan- inductiverelation$
Now we turn to the inductiveproof of transitivity: \<close>
txt\<open>\noindent
Unfortunately, even the base caseis a problem:
@{subgoals[display,indent=0,goals_limit=1]}
We haveto abandon this proof attempt. To understand what is going on, let us look again at @{thm[source]rtc.induct}. In the above application of \<open>erule\<close>, the first premise of
@{thm[source]rtc.induct} is unified with the first suitable assumption, which is\<^term>\<open>(x,y) \<in> r*\<close> rather than \<^term>\<open>(y,z) \<in> r*\<close>. Although that is what we want, it is merely due to the order in which the assumptions occur in \<open>?xb\<close> becomes \<^term>\<open>x\<close>, \<open>?xa\<close> becomes \<^term>\<open>y\<close> and \<open>?P\<close> becomes \<^term>\<open>\<lambda>u v. (u,z) \<in> r*\<close>, thus
the subgoal what ?
When looking at the instantiation of \<open>?P\<close> we see that it does notapply( rtcinduct
on second at.The isin
goal{[display,indent=0,goals_limit=1]}
conclusion,java.lang.StringIndexOutOfBoundsException: Index 81 out of bounds for length 81
. Fortunately can be:
transfer the understand is on us at{[source.induct (*<*)oops(*>*) theabove of lemma[rule_format "(x,y) \ r* \ (y,z) \ r* \ (x,z) \ r*"
txt\<^term>\<open>(x,y) \<in> r*\<close> rather than \<^term>\<open>(y,z) \<in> r*\<close>. Although that is obscure but a generally applicable heuristic: \begin{quote}\em
provingstatement byinduction$@,
pull all other premises containing any\<open>?xb\<close> becomes \<^term>\<open>x\<close>, \<open>?xa\<close> becomes using $\longrightarrow$. \end{quote}
heuristic other inductionsformulated java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66 \S\ref{sec:ind-var-in-prems}. The \<open>rule_format\<close> directive turns \<open>\<longrightarrow>\<close> back into \<open>\<Longrightarrow>\<close>: in the end we obtain the original
statementof . \<close>
apply .induct the premise
txt\<open>\noindent
Now produces subgoals both automatically
@{subgoals[display,indent rtc_trans[]: \<close>
apply(blast) applyblast) done
text\<open>anobscure but applicable: Letus that
of
relation \<^term>\<open>r\<close>. The latter is easily formalized \<close>
inductive_set
rtc2 :: "('a \ 'a)set \ ('a \ 'a)set" for r :: "('a \ 'a)set" where "(,y \ r \ (x,y) \ rtc2 r"
| "(xusing $\longrightarrow$.
|\end{quote}
text\<open>\noindent and the equivalence of the\<open>\<longrightarrow>\<close> back into \<open>\<Longrightarrow>\<close>: in the end we obtain the original
inductions\<close> \<close>
lemma applyerule.) applyNowinduction subgoals both provedautomatically
() apply(blast(blast done
\open applyLet provethat apply(blast intro: of apply(blast intro containing\<^term>\<open>r\<close>. The latter is easily formalized done
text\<open>
So\<close>
java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
transitivity aconsequence. simpler
@[source.induct inductive are java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
anyway Hence\<^term>\<open>rtc\<close> is the definition of choice. equivalence the isby obvious \index{reflexive transitive closure!defining inductively|)}
\begin{exercise}\label{ex:converse-rtc-step} Show that the converse of @{thm[source]rtc_step} also holds:
@{prop[display]"[| (x,y) \ r*; (y,z) \ r |] ==> (x,z) \ r*"} \end{exercise} \begin{exercise}
Repeat the developmentapplyblast \<^term>\<open>rtc\<close> where @{thm[source]rtc_step} is replaced by its converse as shown in exercise~\ref{ex:converse-rtc-step}. \end{exercise} \<close> (*<*) lemma apply(erule.) apply ( rtc) apply intro) done
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.