46295
|
1 |
%
|
|
2 |
\begin{isabellebody}%
|
|
3 |
\def\isabellecontext{Eq}%
|
|
4 |
%
|
|
5 |
\isadelimtheory
|
|
6 |
%
|
|
7 |
\endisadelimtheory
|
|
8 |
%
|
|
9 |
\isatagtheory
|
|
10 |
\isacommand{theory}\isamarkupfalse%
|
|
11 |
\ Eq\isanewline
|
|
12 |
\isakeyword{imports}\ Base\isanewline
|
|
13 |
\isakeyword{begin}%
|
|
14 |
\endisatagtheory
|
|
15 |
{\isafoldtheory}%
|
|
16 |
%
|
|
17 |
\isadelimtheory
|
|
18 |
%
|
|
19 |
\endisadelimtheory
|
|
20 |
%
|
|
21 |
\isamarkupchapter{Equational reasoning%
|
|
22 |
}
|
|
23 |
\isamarkuptrue%
|
|
24 |
%
|
|
25 |
\begin{isamarkuptext}%
|
|
26 |
Equality is one of the most fundamental concepts of
|
|
27 |
mathematics. The Isabelle/Pure logic (\chref{ch:logic}) provides a
|
|
28 |
builtin relation \isa{{\isaliteral{5C3C65717569763E}{\isasymequiv}}\ {\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}\ {\isaliteral{5C3C616C7068613E}{\isasymalpha}}\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ {\isaliteral{5C3C616C7068613E}{\isasymalpha}}\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ prop} that expresses equality
|
|
29 |
of arbitrary terms (or propositions) at the framework level, as
|
|
30 |
expressed by certain basic inference rules (\secref{sec:eq-rules}).
|
|
31 |
|
|
32 |
Equational reasoning means to replace equals by equals, using
|
|
33 |
reflexivity and transitivity to form chains of replacement steps,
|
|
34 |
and congruence rules to access sub-structures. Conversions
|
|
35 |
(\secref{sec:conv}) provide a convenient framework to compose basic
|
|
36 |
equational steps to build specific equational reasoning tools.
|
|
37 |
|
|
38 |
Higher-order matching is able to provide suitable instantiations for
|
|
39 |
giving equality rules, which leads to the versatile concept of
|
|
40 |
\isa{{\isaliteral{5C3C6C616D6264613E}{\isasymlambda}}}-term rewriting (\secref{sec:rewriting}). Internally
|
|
41 |
this is based on the general-purpose Simplifier engine of Isabelle,
|
|
42 |
which is more specific and more efficient than plain conversions.
|
|
43 |
|
|
44 |
Object-logics usually introduce specific notions of equality or
|
|
45 |
equivalence, and relate it with the Pure equality. This enables to
|
|
46 |
re-use the Pure tools for equational reasoning for particular
|
|
47 |
object-logic connectives as well.%
|
|
48 |
\end{isamarkuptext}%
|
|
49 |
\isamarkuptrue%
|
|
50 |
%
|
|
51 |
\isamarkupsection{Basic equality rules \label{sec:eq-rules}%
|
|
52 |
}
|
|
53 |
\isamarkuptrue%
|
|
54 |
%
|
|
55 |
\begin{isamarkuptext}%
|
|
56 |
FIXME%
|
|
57 |
\end{isamarkuptext}%
|
|
58 |
\isamarkuptrue%
|
|
59 |
%
|
|
60 |
\isamarkupsection{Conversions \label{sec:conv}%
|
|
61 |
}
|
|
62 |
\isamarkuptrue%
|
|
63 |
%
|
|
64 |
\begin{isamarkuptext}%
|
|
65 |
FIXME%
|
|
66 |
\end{isamarkuptext}%
|
|
67 |
\isamarkuptrue%
|
|
68 |
%
|
|
69 |
\isamarkupsection{Rewriting \label{sec:rewriting}%
|
|
70 |
}
|
|
71 |
\isamarkuptrue%
|
|
72 |
%
|
|
73 |
\begin{isamarkuptext}%
|
|
74 |
Rewriting normalizes a given term (theorem or goal) by
|
|
75 |
replacing instances of given equalities \isa{t\ {\isaliteral{5C3C65717569763E}{\isasymequiv}}\ u} in subterms.
|
|
76 |
Rewriting continues until no rewrites are applicable to any subterm.
|
|
77 |
This may be used to unfold simple definitions of the form \isa{f\ x\isaliteral{5C3C5E7375623E}{}\isactrlsub {\isadigit{1}}\ {\isaliteral{5C3C646F74733E}{\isasymdots}}\ x\isaliteral{5C3C5E7375623E}{}\isactrlsub n\ {\isaliteral{5C3C65717569763E}{\isasymequiv}}\ u}, but is slightly more general than that.%
|
|
78 |
\end{isamarkuptext}%
|
|
79 |
\isamarkuptrue%
|
|
80 |
%
|
|
81 |
\isadelimmlref
|
|
82 |
%
|
|
83 |
\endisadelimmlref
|
|
84 |
%
|
|
85 |
\isatagmlref
|
|
86 |
%
|
|
87 |
\begin{isamarkuptext}%
|
|
88 |
\begin{mldecls}
|
46486
|
89 |
\indexdef{}{ML}{rewrite\_rule}\verb|rewrite_rule: thm list -> thm -> thm| \\
|
|
90 |
\indexdef{}{ML}{rewrite\_goals\_rule}\verb|rewrite_goals_rule: thm list -> thm -> thm| \\
|
46295
|
91 |
\indexdef{}{ML}{rewrite\_goal\_tac}\verb|rewrite_goal_tac: thm list -> int -> tactic| \\
|
|
92 |
\indexdef{}{ML}{rewrite\_goals\_tac}\verb|rewrite_goals_tac: thm list -> tactic| \\
|
|
93 |
\indexdef{}{ML}{fold\_goals\_tac}\verb|fold_goals_tac: thm list -> tactic| \\
|
|
94 |
\end{mldecls}
|
|
95 |
|
|
96 |
\begin{description}
|
|
97 |
|
46486
|
98 |
\item \verb|rewrite_rule|~\isa{rules\ thm} rewrites the whole
|
|
99 |
theorem by the given rules.
|
|
100 |
|
|
101 |
\item \verb|rewrite_goals_rule|~\isa{rules\ thm} rewrites the
|
|
102 |
outer premises of the given theorem. Interpreting the same as a
|
|
103 |
goal state (\secref{sec:tactical-goals}) it means to rewrite all
|
|
104 |
subgoals (in the same manner as \verb|rewrite_goals_tac|).
|
|
105 |
|
46295
|
106 |
\item \verb|rewrite_goal_tac|~\isa{rules\ i} rewrites subgoal
|
|
107 |
\isa{i} by the given rewrite rules.
|
|
108 |
|
|
109 |
\item \verb|rewrite_goals_tac|~\isa{rules} rewrites all subgoals
|
|
110 |
by the given rewrite rules.
|
|
111 |
|
|
112 |
\item \verb|fold_goals_tac|~\isa{rules} essentially uses \verb|rewrite_goals_tac| with the symmetric form of each member of \isa{rules}, re-ordered to fold longer expression first. This supports
|
|
113 |
to idea to fold primitive definitions that appear in expended form
|
|
114 |
in the proof state.
|
|
115 |
|
|
116 |
\end{description}%
|
|
117 |
\end{isamarkuptext}%
|
|
118 |
\isamarkuptrue%
|
|
119 |
%
|
|
120 |
\endisatagmlref
|
|
121 |
{\isafoldmlref}%
|
|
122 |
%
|
|
123 |
\isadelimmlref
|
|
124 |
%
|
|
125 |
\endisadelimmlref
|
|
126 |
%
|
|
127 |
\isadelimtheory
|
|
128 |
%
|
|
129 |
\endisadelimtheory
|
|
130 |
%
|
|
131 |
\isatagtheory
|
|
132 |
\isacommand{end}\isamarkupfalse%
|
|
133 |
%
|
|
134 |
\endisatagtheory
|
|
135 |
{\isafoldtheory}%
|
|
136 |
%
|
|
137 |
\isadelimtheory
|
|
138 |
%
|
|
139 |
\endisadelimtheory
|
|
140 |
\isanewline
|
|
141 |
\end{isabellebody}%
|
|
142 |
%%% Local Variables:
|
|
143 |
%%% mode: latex
|
|
144 |
%%% TeX-master: "root"
|
|
145 |
%%% End:
|