18537
|
1 |
%
|
|
2 |
\begin{isabellebody}%
|
|
3 |
\def\isabellecontext{tactic}%
|
|
4 |
%
|
|
5 |
\isadelimtheory
|
|
6 |
\isanewline
|
|
7 |
\isanewline
|
|
8 |
\isanewline
|
|
9 |
%
|
|
10 |
\endisadelimtheory
|
|
11 |
%
|
|
12 |
\isatagtheory
|
|
13 |
\isacommand{theory}\isamarkupfalse%
|
|
14 |
\ tactic\ \isakeyword{imports}\ base\ \isakeyword{begin}%
|
|
15 |
\endisatagtheory
|
|
16 |
{\isafoldtheory}%
|
|
17 |
%
|
|
18 |
\isadelimtheory
|
|
19 |
%
|
|
20 |
\endisadelimtheory
|
|
21 |
%
|
20452
|
22 |
\isamarkupchapter{Tactical reasoning%
|
18537
|
23 |
}
|
|
24 |
\isamarkuptrue%
|
|
25 |
%
|
|
26 |
\begin{isamarkuptext}%
|
20474
|
27 |
Tactical reasoning works by refining the initial claim in a
|
|
28 |
backwards fashion, until a solved form is reached. A \isa{goal}
|
|
29 |
consists of several subgoals that need to be solved in order to
|
|
30 |
achieve the main statement; zero subgoals means that the proof may
|
|
31 |
be finished. A \isa{tactic} is a refinement operation that maps
|
|
32 |
a goal to a lazy sequence of potential successors. A \isa{tactical} is a combinator for composing tactics.%
|
18537
|
33 |
\end{isamarkuptext}%
|
|
34 |
\isamarkuptrue%
|
|
35 |
%
|
|
36 |
\isamarkupsection{Goals \label{sec:tactical-goals}%
|
|
37 |
}
|
|
38 |
\isamarkuptrue%
|
|
39 |
%
|
|
40 |
\begin{isamarkuptext}%
|
20451
|
41 |
Isabelle/Pure represents a goal\glossary{Tactical goal}{A theorem of
|
|
42 |
\seeglossary{Horn Clause} form stating that a number of subgoals
|
|
43 |
imply the main conclusion, which is marked as a protected
|
|
44 |
proposition.} as a theorem stating that the subgoals imply the main
|
|
45 |
goal: \isa{A\isactrlsub {\isadigit{1}}\ {\isasymLongrightarrow}\ {\isasymdots}\ {\isasymLongrightarrow}\ A\isactrlsub n\ {\isasymLongrightarrow}\ C}. The outermost goal
|
|
46 |
structure is that of a Horn Clause\glossary{Horn Clause}{An iterated
|
|
47 |
implication \isa{A\isactrlsub {\isadigit{1}}\ {\isasymLongrightarrow}\ {\isasymdots}\ {\isasymLongrightarrow}\ A\isactrlsub n\ {\isasymLongrightarrow}\ C}, without any
|
|
48 |
outermost quantifiers. Strictly speaking, propositions \isa{A\isactrlsub i} need to be atomic in Horn Clauses, but Isabelle admits
|
|
49 |
arbitrary substructure here (nested \isa{{\isasymLongrightarrow}} and \isa{{\isasymAnd}}
|
|
50 |
connectives).}: i.e.\ an iterated implication without any
|
|
51 |
quantifiers\footnote{Recall that outermost \isa{{\isasymAnd}x{\isachardot}\ {\isasymphi}{\isacharbrackleft}x{\isacharbrackright}} is
|
|
52 |
always represented via schematic variables in the body: \isa{{\isasymphi}{\isacharbrackleft}{\isacharquery}x{\isacharbrackright}}. These variables may get instantiated during the course of
|
|
53 |
reasoning.}. For \isa{n\ {\isacharequal}\ {\isadigit{0}}} a goal is called ``solved''.
|
18537
|
54 |
|
20451
|
55 |
The structure of each subgoal \isa{A\isactrlsub i} is that of a
|
20474
|
56 |
general Hereditary Harrop Formula \isa{{\isasymAnd}x\isactrlsub {\isadigit{1}}\ {\isasymdots}\ {\isasymAnd}x\isactrlsub k{\isachardot}\ H\isactrlsub {\isadigit{1}}\ {\isasymLongrightarrow}\ {\isasymdots}\ {\isasymLongrightarrow}\ H\isactrlsub m\ {\isasymLongrightarrow}\ B} in normal form where.
|
|
57 |
Here \isa{x\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ x\isactrlsub k} are goal parameters, i.e.\
|
20451
|
58 |
arbitrary-but-fixed entities of certain types, and \isa{H\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ H\isactrlsub m} are goal hypotheses, i.e.\ facts that may
|
|
59 |
be assumed locally. Together, this forms the goal context of the
|
|
60 |
conclusion \isa{B} to be established. The goal hypotheses may be
|
20474
|
61 |
again arbitrary Hereditary Harrop Formulas, although the level of
|
|
62 |
nesting rarely exceeds 1--2 in practice.
|
18537
|
63 |
|
20451
|
64 |
The main conclusion \isa{C} is internally marked as a protected
|
|
65 |
proposition\glossary{Protected proposition}{An arbitrarily
|
|
66 |
structured proposition \isa{C} which is forced to appear as
|
|
67 |
atomic by wrapping it into a propositional identity operator;
|
|
68 |
notation \isa{{\isacharhash}C}. Protecting a proposition prevents basic
|
|
69 |
inferences from entering into that structure for the time being.},
|
20474
|
70 |
which is represented explicitly by the notation \isa{{\isacharhash}C}. This
|
|
71 |
ensures that the decomposition into subgoals and main conclusion is
|
|
72 |
well-defined for arbitrarily structured claims.
|
18537
|
73 |
|
20451
|
74 |
\medskip Basic goal management is performed via the following
|
|
75 |
Isabelle/Pure rules:
|
18537
|
76 |
|
|
77 |
\[
|
|
78 |
\infer[\isa{{\isacharparenleft}init{\isacharparenright}}]{\isa{C\ {\isasymLongrightarrow}\ {\isacharhash}C}}{} \qquad
|
20547
|
79 |
\infer[\isa{{\isacharparenleft}finish{\isacharparenright}}]{\isa{C}}{\isa{{\isacharhash}C}}
|
18537
|
80 |
\]
|
|
81 |
|
|
82 |
\medskip The following low-level variants admit general reasoning
|
|
83 |
with protected propositions:
|
|
84 |
|
|
85 |
\[
|
|
86 |
\infer[\isa{{\isacharparenleft}protect{\isacharparenright}}]{\isa{{\isacharhash}C}}{\isa{C}} \qquad
|
|
87 |
\infer[\isa{{\isacharparenleft}conclude{\isacharparenright}}]{\isa{A\isactrlsub {\isadigit{1}}\ {\isasymLongrightarrow}\ {\isasymdots}\ {\isasymLongrightarrow}\ A\isactrlsub n\ {\isasymLongrightarrow}\ C}}{\isa{A\isactrlsub {\isadigit{1}}\ {\isasymLongrightarrow}\ {\isasymdots}\ {\isasymLongrightarrow}\ A\isactrlsub n\ {\isasymLongrightarrow}\ {\isacharhash}C}}
|
|
88 |
\]%
|
|
89 |
\end{isamarkuptext}%
|
|
90 |
\isamarkuptrue%
|
|
91 |
%
|
|
92 |
\isadelimmlref
|
|
93 |
%
|
|
94 |
\endisadelimmlref
|
|
95 |
%
|
|
96 |
\isatagmlref
|
|
97 |
%
|
|
98 |
\begin{isamarkuptext}%
|
|
99 |
\begin{mldecls}
|
|
100 |
\indexml{Goal.init}\verb|Goal.init: cterm -> thm| \\
|
|
101 |
\indexml{Goal.finish}\verb|Goal.finish: thm -> thm| \\
|
|
102 |
\indexml{Goal.protect}\verb|Goal.protect: thm -> thm| \\
|
|
103 |
\indexml{Goal.conclude}\verb|Goal.conclude: thm -> thm| \\
|
|
104 |
\end{mldecls}
|
|
105 |
|
|
106 |
\begin{description}
|
|
107 |
|
20474
|
108 |
\item \verb|Goal.init|~\isa{C} initializes a tactical goal from
|
|
109 |
the well-formed proposition \isa{C}.
|
18537
|
110 |
|
20474
|
111 |
\item \verb|Goal.finish|~\isa{thm} checks whether theorem
|
|
112 |
\isa{thm} is a solved goal (no subgoals), and concludes the
|
|
113 |
result by removing the goal protection.
|
18537
|
114 |
|
20474
|
115 |
\item \verb|Goal.protect|~\isa{thm} protects the full statement
|
|
116 |
of theorem \isa{thm}.
|
|
117 |
|
|
118 |
\item \verb|Goal.conclude|~\isa{thm} removes the goal
|
|
119 |
protection, even if there are pending subgoals.
|
18537
|
120 |
|
|
121 |
\end{description}%
|
|
122 |
\end{isamarkuptext}%
|
|
123 |
\isamarkuptrue%
|
|
124 |
%
|
|
125 |
\endisatagmlref
|
|
126 |
{\isafoldmlref}%
|
|
127 |
%
|
|
128 |
\isadelimmlref
|
|
129 |
%
|
|
130 |
\endisadelimmlref
|
|
131 |
%
|
|
132 |
\isamarkupsection{Tactics%
|
|
133 |
}
|
|
134 |
\isamarkuptrue%
|
|
135 |
%
|
|
136 |
\begin{isamarkuptext}%
|
|
137 |
FIXME
|
|
138 |
|
|
139 |
\glossary{Tactic}{Any function that maps a \seeglossary{tactical goal}
|
|
140 |
to a lazy sequence of possible sucessors. This scheme subsumes
|
|
141 |
failure (empty result sequence), as well as lazy enumeration of proof
|
|
142 |
search results. Error conditions are usually mapped to an empty
|
|
143 |
result, which gives further tactics a chance to try in turn.
|
|
144 |
Commonly, tactics either take an argument to address a particular
|
|
145 |
subgoal, or operate on a certain range of subgoals in a uniform
|
|
146 |
fashion. In any case, the main conclusion is normally left untouched,
|
|
147 |
apart from instantiating \seeglossary{schematic variables}.}%
|
|
148 |
\end{isamarkuptext}%
|
|
149 |
\isamarkuptrue%
|
|
150 |
%
|
|
151 |
\isamarkupsection{Tacticals%
|
|
152 |
}
|
|
153 |
\isamarkuptrue%
|
|
154 |
%
|
|
155 |
\begin{isamarkuptext}%
|
|
156 |
FIXME
|
|
157 |
|
|
158 |
\glossary{Tactical}{A functional combinator for building up complex
|
|
159 |
tactics from simpler ones. Typical tactical perform sequential
|
|
160 |
composition, disjunction (choice), iteration, or goal addressing.
|
|
161 |
Various search strategies may be expressed via tacticals.}%
|
|
162 |
\end{isamarkuptext}%
|
|
163 |
\isamarkuptrue%
|
|
164 |
%
|
|
165 |
\isadelimtheory
|
|
166 |
%
|
|
167 |
\endisadelimtheory
|
|
168 |
%
|
|
169 |
\isatagtheory
|
|
170 |
\isacommand{end}\isamarkupfalse%
|
|
171 |
%
|
|
172 |
\endisatagtheory
|
|
173 |
{\isafoldtheory}%
|
|
174 |
%
|
|
175 |
\isadelimtheory
|
|
176 |
%
|
|
177 |
\endisadelimtheory
|
|
178 |
\isanewline
|
|
179 |
\isanewline
|
|
180 |
\end{isabellebody}%
|
|
181 |
%%% Local Variables:
|
|
182 |
%%% mode: latex
|
|
183 |
%%% TeX-master: "root"
|
|
184 |
%%% End:
|