1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425
|
\chapter{ML Functions in the {\tt abs\_theory} Library}
\input{entries-intro}
\DOC{ABS\_TAC\_PROOF}
\TYPE{\small\verb%ABS_TAC_PROOF : ((goal # tactic) -> thm)%}\egroup
\SYNOPSIS
Attempts to prove an abstract goal using a given tactic.
\DESCRIBE
When applied to a goal-tactic pair {\small\verb%(A ?- t,tac)%}, {\small\verb%ABS_TAC_PROOF%}
attempts to prove the goal {\small\verb%A ?- t%}, using the tactic {\small\verb%tac%}. Before
the proof of {\small\verb%A ?- t%} is attempted, the theory obligations for each
abstract object used in the goal are added to the assumption list. If the
proof succeeds, it returns the theorem {\small\verb%A' |- t%} corresponding to the
goal, where the assumption list {\small\verb%A'%} may be a proper superset of {\small\verb%A%}
unless the tactic is valid; there is no inbuilt validity checking.
\FAILURE
Fails if appropriate theory obligations cannot be found.
Fails unless the goal has hypotheses and conclusions all of type {\small\verb%bool%},
and the tactic can solve the goal.
\SEEALSO
prove_abs_thm, TAC_PROOF.
\ENDDOC
\DOC{abs\_type\_info}
\TYPE {\small\verb%abs_type_info : (thm -> type)%}\egroup
\SYNOPSIS
Retrieves the type of an abstract representation.
\DESCRIBE
A call to {\small\verb%abs_type_info thm%} returns a type representing the abstract
type of the object declared in the theorem {\small\verb%thm%}.
\USES
{\small\verb%abs_type_info%} is used to get the type of an abstract representation
for use in making definitions and proving theorems about the abstract
representation.
\FAILURE
Fails if theorem is not of the form returned by
{\small\verb%new_abstract_representation%}.
\SEEALSO
new_abstract_representation
\ENDDOC
\DOC{close\_theory}
\TYPE {\small\verb%close_theory : (void -> void)%}\egroup
\SYNOPSIS
Finishes a session in draft mode, writing changes to the theory file.
Removes any theory obligations from the theory obligation list.
\DESCRIBE
Executing {\small\verb%close_theory()%} finishes a session in draft mode. It
switches the system to proof mode. Changes made to the current theory
segment are written to the theory file associated with it. For a theory
segment named {\small\verb%`thy`%}, the associated file will be {\small\verb%thy.th%} in the
directory from which HOL was called. If the theory file does not exist, it
will be created. Any theory obligations are flushed from the theory
obligation list. If HOL is quit before {\small\verb%close_theory%} is invoked, the
additions made to the segment may not persist to future HOL sessions.
While in proof mode, the only changes which may be made to the theory are
the addition of theorems. The theory segment may later be extended with
{\small\verb%extend_theory%}.
\FAILURE
A call to {\small\verb%close_theory%} will fail if the system is not in draft mode.
Since it involves writing to the file system, if the write fails for
any reason {\small\verb%close_theory%} will fail.
\SEEALSO
extend_theory, new_theory, print_theory.
\ENDDOC
\DOC{EXPAND\_THOBS\_TAC}
\TYPE {\small\verb%EXPAND_THOBS_TAC : (string -> tactic)%}\egroup
\SYNOPSIS
Expands a goal using the abstract definition and theory
obligations for the named theory.
\DESCRIBE When applied to a goal {\small\verb%A ?- thob_def(rep)%}, where
{\small\verb%thob_def%} is a theory obligation and {\small\verb%rep%} is a representation, the
tactic expands the definition of the theory obligation and reduces the
terms resulting from the abstract definitions. This tactic is usually the
first step in proving that a given representation meets the abstract theory
obligations.
\FAILURE
Fails if the named theory is not an ancestor.
\SEEALSO
new_theory_obligations, new_abstract_representation
\ENDDOC
\DOC{g}
\TYPE {\small\verb%g : (term -> void)%}\egroup
\SYNOPSIS
Initializes the subgoal package with a new goal which has no assumptions
except those created from the theory obligations.
\DESCRIBE
The call
{\par\samepage\setseps\small
\begin{verbatim}
g "tm"
\end{verbatim}
}
\noindent is equivalent to
{\par\samepage\setseps\small
\begin{verbatim}
set_abs_goal([],"tm")
\end{verbatim}
}
\noindent
and clearly more convenient if a goal has no assumptions.
For a description of the subgoal package, see {\small\verb%set_abs_goal%}.
\FAILURE
Never fails.
\SEEALSO
b, backup, backup_limit, e, expand, expandf, get_state, p, print_state, r,
rotate, save_top_thm, set_abs_goal, set_state, top_goal, top_thm.
\ENDDOC
\DOC{instantiate\_abstract\_definition}
\TYPE {\small\verb%instantiate_abstract_definition : string -> string -> thm -> (term # term) list -> thm%}\egroup
\SYNOPSIS
Instantiates a definition that is made in terms of a definition
from an abstract theory.
\DESCRIBE
A call of {\small\verb%instantiate_abstract_definition `thy` `th` def
tpl%} retrieves the abstract definition {\small\verb%th%} from the abstract theory
{\small\verb%thy%} rewrites {\small\verb%def%} with it and instantiates the result using
{\small\verb%tpl%}, where {\small\verb%tpl%} is a list of paired terms where the first term is
the variable to be instantiated and the second term is the instantiation.
The abstract theory {\small\verb%thy%} must be an ancestor of the current theory.
\FAILURE
The call will fail if the theory {\small\verb%thy%} is not an ancestor of the
current theory. It will fail if there does not exist a definition {\small\verb%th%}
in theory segment {\small\verb%thy%}.
\SEEALSO
instantiate_abstract_theorem
\ENDDOC
\DOC{instantiate\_abstract\_theorem}
\TYPE {\small\verb%instantiate_abstract_theorem : string -> string -> (term # term) list -> (thm) list) -> thm%}\egroup
\SYNOPSIS
Instantiates an abstract theorem.
\DESCRIBE
The call {\small\verb%instantiate_abstract_theorem `thy` `th` tpl val%}
instantiates the theorem {\small\verb%th%} from the abstract theory {\small\verb%thy%} using
the instantiation {\small\verb%tpl%} and validation {\small\verb%val%}, where {\small\verb%tpl%} is a
list of paired terms where the first term is the variable to be
instantiated and the second term is the instantiation and {\small\verb%val%} is a
proof that the instantiation meets the theory obligations for the source
abstract theorem. The instantiation works whether the theory obligations
were made implicit or explicit in the original goal. The resulting theorem
is {\small\verb%\em not%} automatically saved in the current theory segment, but must be
explicitly saved using {\small\verb%save_thm%}.
\FAILURE
Fails if the instantiation cannot be resolved with the source theorem or
the validation does not match the instantiation. Fails if the {\small\verb%thy%}
is not an ancestor or the {\small\verb%th%} is not found in {\small\verb%thy%}.
\SEEALSO
instantiate_abstract_definition, save_thm
\ENDDOC
\DOC{new\_abstract\_representation}
\TYPE {\small\verb%new_abstract_representation : string -> (string # type) list -> thm%}\egroup
\SYNOPSIS
Declares a new abstract representation.
\DESCRIBE
A call to {\small\verb%new_abstract_representation name decl%} creates a new abstract
structure with the name {\small\verb%name%} using the declaration list {\small\verb%decl%}, where
{\small\verb%decl%} is a list of string--type pairs giving the name and type of the
constituent abstract objects.
The structure name, {\small\verb%name%}, is used as the constructor when building
representations.
The returned theorem is used by the function {\small\verb%abs_type_info%}.
\FAILURE
Fails if any of the names have been used in the theory segment.
\ENDDOC
\DOC{new\_abs\_parent}
\TYPE {\small\verb%new_abs_parent : (string -> void)%}\egroup
\SYNOPSIS
Extends the current theory with a new abstract parent theory.
\DESCRIBE
Executing {\small\verb%new_abs_parent `thy`%} extends the current theory by making the
existing abstract theory named {\small\verb%thy%} a parent of the current theory
segment. The extended theory contains the theory segments of both
constituent theories and any theory obligations declared in the parent.
The theory {\small\verb%thy%} is loaded into the system. The message ` {\small\verb%Theory thy
loaded%}' is printed. The effect of the call may not be written to the
theory file of the segment until {\small\verb%close_theory%} is invoked. If HOL is
quit before this, the effect may not persist to future HOL sessions.
\FAILURE
Executing {\small\verb%new_abs_parent `thy`%} will fail if the system is not in
draft mode. It will fail if {\small\verb%thy%} is not a theory on the current search
path. It will fail if there is a type in theory {\small\verb%thy%} with the same name
as a type in the current theory. It will fail if there is a constant in
theory {\small\verb%thy%} with the same name as a constant in the current theory. It
will fail if an ancestor of theory {\small\verb%thy%} has been extended with either
new types or constants which clash with names in theory {\small\verb%thy%}. It will
also fail if any of the theory files of theory {\small\verb%thy%} have been damaged. On
failure, the system recovers cleanly, unloading any theory segments it had
loaded before the failure was detected.
\SEEALSO
new_parent, close_theory, extend_theory, new_theory, print_theory, search_path.
\ENDDOC
\DOC{new\_theory}
\TYPE {\small\verb%new_theory : (string -> void)%}\egroup
\SYNOPSIS
Creates a new theory by extending the current theory with a new theory segment.
\DESCRIBE
A theory consists of a hierarchy of named parts called theory
segments. The theory segment at the top of the hierarchy tree in each
theory is said to be current. All theory segments have a theory of the same
name associated with them consisting of the theory segment itself and all
its ancestors. Each axiom, definition, specification and theorem belongs
to a particular theory segment.
Calling {\small\verb%new_theory `thy`%} creates a new theory segment and associated
theory having name {\small\verb%thy%}. The theory segment which was current before the
call becomes a parent of the new theory segment. The new theory therefore
consists of the current theory extended with the new theory segment. The
new theory segment replaces its parent as the current theory segment. The
call switches the system into draft mode and flushes the theory obligation
list. This allows new axioms, constants, types, constant specifications,
infix constants, binders and parents to be added to the theory segment.
Inconsistencies will be introduced into the theory if inconsistent axioms
are asserted. New theorems can also be added as when in proof mode. The
theory file in which the data of the new theory segment is ultimately
stored will have name {\small\verb%thy.th%} in the directory from which HOL was called.
The theory segment might not be written to this file until the session is
finished with a call to {\small\verb%close_theory%}. If HOL is quit without closing the
session with {\small\verb%close_theory%}, parts of the theory segment created during the
session may be lost. If the system is in draft mode when a call to
{\small\verb%new_theory%} is made, the previous session is closed; all changes made in
it will be written to the associated theory file.
\FAILURE The call {\small\verb%new_theory `thy`%} will fail if there already exists
a file {\small\verb%thy.th%} in the current search path. It will also fail if the
name {\small\verb%thy.th%} is unsuitable for a filename. Since it could involve writing
to the file system, if a write fails for any reason {\small\verb%new_theory%} will
fail.
\USES Hierarchically extending the current theory. By splitting a theory
into theory segments using {\small\verb%new_theory%}, the work required if
definitions, etc., need to be changed is minimized. Only the associated
segment and its descendants need be redefined.
\SEEALSO
close_theory, current_theory, extend_theory, load_theory, new_axiom,
new_binder, new_constant, new_definition, new_infix, new_parent,
new_specification, new_type, print_theory, save_thm, search_path.
\ENDDOC
\DOC{new\_theory\_obligations}
\TYPE {\small\verb%new_theory_obligations : (string # term) -> void%}\egroup
\SYNOPSIS
Declares new theory obligations.
\DESCRIBE
A call to {\small\verb%new_theory_obligations stp%} adds the theory obligation in
{\small\verb%stp%} to theory obligation list in the current theory, where {\small\verb%stp%}
is a string--term pair where the first string is the name of the obligation
and the term is a predicate that must be met for an instantiation to be
valid.
\USES
Declaring theory obligations for an abstract object declared in an abstract
theory.
\FAILURE
Fails if a term in {\small\verb%stp%} is not a predicate.
\SEEALSO
new_abstract_representation, instantiate_abstract_theorem
\ENDDOC
\DOC{prove\_abs\_thm}
\TYPE {\small\verb%prove_abs_thm : ((string # term # tactic) -> thm)%}\egroup
\SYNOPSIS
Attempts to prove a boolean term with abstract components
using the supplied tactic, then save the theorem.
\DESCRIBE
The function {\small\verb%prove_abs_thm%}
is identical to {\small\verb%prove_thm%} except that
the theory obligations for any abstract objects in the goal
are added to the assumption list before the proof is performed.
\FAILURE Fails if the term is not of type {\small\verb%bool%} (and so cannot possibly
be the conclusion of a theorem), or if the tactic cannot solve the goal.
In the latter case {\small\verb%prove_abs_thm%} will list the unsolved goals to
help the user. In addition, {\small\verb%prove_abs_thm%} will fail if the theorem
cannot be saved, e.g. because there is already a theorem of that name in
the current theory segment, or if the resulting theorem has assumptions;
clearly this can only happen if the tactic was invalid, so this gives some
measure of validity checking.
\SEEALSO
prove_thm
\ENDDOC
\DOC{set\_abs\_goal}
\TYPE {\small\verb%set_abs_goal : (goal -> void)%}\egroup
\SYNOPSIS
Initializes the subgoal package with a new abstract goal.
\DESCRIBE
The function {\small\verb%set_abs_goal%} is identical to {\small\verb%set_goal%} except that
the theory obligations for any abstract objects in the goal
are added to the assumption list.
\FAILURE
Never fails.
\USES
Starting an interactive proof session with the subgoal package for an
abstract goal.
\SEEALSO
set_goal
\ENDDOC
\DOC{STRIP\_THOBS\_TAC}
\TYPE {\small\verb%STRIP_THOBS_TAC : tactic%}\egroup
\SYNOPSIS
Strips an explicitly declared theory obligation from a goal, expands it,
and puts the results in the hypotheses.
\DESCRIBE
Removes one explicitly declared theory obligation from a goal
substituting the definition of the theory obligation for the
name. The abstract object may or may not be universally quantified. The
theory obligations are placed on the assumption list using
{\small\verb%STRIP_ASSUME_TAC%}.
\FAILURE
Fails if theory obligation list is empty (e.g. can occur when no
abstract parent has been declared).
\SEEALSO
STRIP_THOBS_THEN, STRIP_TAC, STRIP_ASSUME_TAC
\ENDDOC
\DOC{STRIP\_THOBS\_THEN}
\TYPE {\small\verb%STRIP_THOBS_THEN : thm_tactic -> tactic%}\egroup
\SYNOPSIS
Strips an explicitly declared theory obligation from a goal,
expands it, and applies the theorem tactic to the result.
\DESCRIBE
Removes one explicitly declared theory obligation from a goal
substituting the definition of the theory obligation for the
name. The abstract object may or may not be universally quantified. The
result is used as an argument to the theorem-tactic.
\FAILURE
Fails if theory obligation list is empty (e.g. can occur when no
abstract parent has been declared).
\SEEALSO
STRIP_THOBS_TAC, STRIP_TAC
\ENDDOC
|