8749
|
1 |
\begin{isabelle}%
|
|
2 |
%
|
|
3 |
\begin{isamarkuptext}%
|
|
4 |
So far all examples of rewrite rules were equations. The simplifier also
|
|
5 |
accepts \emph{conditional} equations, for example%
|
|
6 |
\end{isamarkuptext}%
|
9541
|
7 |
\isacommand{lemma}\ hd\_Cons\_tl[simp]:\ {"}xs\ {\isasymnoteq}\ []\ \ {\isasymLongrightarrow}\ \ hd\ xs\ \#\ tl\ xs\ =\ xs{"}\isanewline
|
|
8 |
\isacommand{by}(case\_tac\ xs,\ simp,\ simp)%
|
8749
|
9 |
\begin{isamarkuptext}%
|
|
10 |
\noindent
|
|
11 |
Note the use of ``\ttindexboldpos{,}{$Isar}'' to string together a
|
9541
|
12 |
sequence of methods. Assuming that the simplification rule
|
|
13 |
\isa{(rev\ xs\ =\ [])\ =\ (xs\ =\ [])}
|
8749
|
14 |
is present as well,%
|
|
15 |
\end{isamarkuptext}%
|
9541
|
16 |
\isacommand{lemma}\ {"}xs\ {\isasymnoteq}\ []\ {\isasymLongrightarrow}\ hd(rev\ xs)\ \#\ tl(rev\ xs)\ =\ rev\ xs{"}%
|
8749
|
17 |
\begin{isamarkuptext}%
|
|
18 |
\noindent
|
8771
|
19 |
is proved by plain simplification:
|
8749
|
20 |
the conditional equation \isa{hd_Cons_tl} above
|
|
21 |
can simplify \isa{hd(rev~xs)~\#~tl(rev~xs)} to \isa{rev xs}
|
|
22 |
because the corresponding precondition \isa{rev xs \isasymnoteq\ []}
|
|
23 |
simplifies to \isa{xs \isasymnoteq\ []}, which is exactly the local
|
|
24 |
assumption of the subgoal.%
|
|
25 |
\end{isamarkuptext}%
|
|
26 |
\end{isabelle}%
|
9145
|
27 |
%%% Local Variables:
|
|
28 |
%%% mode: latex
|
|
29 |
%%% TeX-master: "root"
|
|
30 |
%%% End:
|