5 chapter {* Other commands *}
7 section {* Inspecting the context *}
10 \begin{matharray}{rcl}
11 @{command_def "print_commands"}@{text "\<^sup>*"} & : & @{text "any \<rightarrow>"} \\
12 @{command_def "print_theory"}@{text "\<^sup>*"} & : & @{text "context \<rightarrow>"} \\
13 @{command_def "print_methods"}@{text "\<^sup>*"} & : & @{text "context \<rightarrow>"} \\
14 @{command_def "print_attributes"}@{text "\<^sup>*"} & : & @{text "context \<rightarrow>"} \\
15 @{command_def "print_theorems"}@{text "\<^sup>*"} & : & @{text "context \<rightarrow>"} \\
16 @{command_def "find_theorems"}@{text "\<^sup>*"} & : & @{text "context \<rightarrow>"} \\
17 @{command_def "find_consts"}@{text "\<^sup>*"} & : & @{text "context \<rightarrow>"} \\
18 @{command_def "thm_deps"}@{text "\<^sup>*"} & : & @{text "context \<rightarrow>"} \\
19 @{command_def "print_facts"}@{text "\<^sup>*"} & : & @{text "context \<rightarrow>"} \\
20 @{command_def "print_binds"}@{text "\<^sup>*"} & : & @{text "context \<rightarrow>"} \\
24 ('print\_theory' | 'print\_theorems') ('!'?)
27 'find\_theorems' (('(' (nat)? ('with\_dups')? ')')?) (thmcriterion *)
29 thmcriterion: ('-'?) ('name' ':' nameref | 'intro' | 'elim' | 'dest' |
30 'solves' | 'simp' ':' term | term)
32 'find\_consts' (constcriterion *)
34 constcriterion: ('-'?) ('name' ':' nameref | 'strict' ':' type | type)
40 These commands print certain parts of the theory and proof context.
41 Note that there are some further ones available, such as for the set
42 of rules declared for simplifications.
46 \item @{command "print_commands"} prints Isabelle's outer theory
47 syntax, including keywords and command.
49 \item @{command "print_theory"} prints the main logical content of
50 the theory context; the ``@{text "!"}'' option indicates extra
53 \item @{command "print_methods"} prints all proof methods
54 available in the current theory context.
56 \item @{command "print_attributes"} prints all attributes
57 available in the current theory context.
59 \item @{command "print_theorems"} prints theorems resulting from the
60 last command; the ``@{text "!"}'' option indicates extra verbosity.
62 \item @{command "find_theorems"}~@{text criteria} retrieves facts
63 from the theory or proof context matching all of given search
64 criteria. The criterion @{text "name: p"} selects all theorems
65 whose fully qualified name matches pattern @{text p}, which may
66 contain ``@{text "*"}'' wildcards. The criteria @{text intro},
67 @{text elim}, and @{text dest} select theorems that match the
68 current goal as introduction, elimination or destruction rules,
69 respectively. The criterion @{text "solves"} returns all rules
70 that would directly solve the current goal. The criterion
71 @{text "simp: t"} selects all rewrite rules whose left-hand side
72 matches the given term. The criterion term @{text t} selects all
73 theorems that contain the pattern @{text t} -- as usual, patterns
74 may contain occurrences of the dummy ``@{text _}'', schematic
75 variables, and type constraints.
77 Criteria can be preceded by ``@{text "-"}'' to select theorems that
78 do \emph{not} match. Note that giving the empty list of criteria
79 yields \emph{all} currently known facts. An optional limit for the
80 number of printed facts may be given; the default is 40. By
81 default, duplicates are removed from the search result. Use
82 @{text with_dups} to display duplicates.
84 \item @{command "find_consts"}~@{text criteria} prints all constants
85 whose type meets all of the given criteria. The criterion @{text
86 "strict: ty"} is met by any type that matches the type pattern
87 @{text ty}. Patterns may contain both the dummy type ``@{text _}''
88 and sort constraints. The criterion @{text ty} is similar, but it
89 also matches against subtypes. The criterion @{text "name: p"} and
90 the prefix ``@{text "-"}'' function as described for @{command
93 \item @{command "thm_deps"}~@{text "a\<^sub>1 \<dots> a\<^sub>n"}
94 visualizes dependencies of facts, using Isabelle's graph browser
95 tool (see also \cite{isabelle-sys}).
97 \item @{command "print_facts"} prints all local facts of the
98 current context, both named and unnamed ones.
100 \item @{command "print_binds"} prints all term abbreviations
101 present in the context.
107 section {* History commands \label{sec:history} *}
110 \begin{matharray}{rcl}
111 @{command_def "undo"}^{{ * }{ * }} & : & @{text "any \<rightarrow> any"} \\
112 @{command_def "linear_undo"}^{{ * }{ * }} & : & @{text "any \<rightarrow> any"} \\
113 @{command_def "kill"}^{{ * }{ * }} & : & @{text "any \<rightarrow> any"} \\
116 The Isabelle/Isar top-level maintains a two-stage history, for
117 theory and proof state transformation. Basically, any command can
118 be undone using @{command "undo"}, excluding mere diagnostic
119 elements. Note that a theorem statement with a \emph{finished}
120 proof is treated as a single unit by @{command "undo"}. In
121 contrast, the variant @{command "linear_undo"} admits to step back
122 into the middle of a proof. The @{command "kill"} command aborts
123 the current history node altogether, discontinuing a proof or even
124 the whole theory. This operation is \emph{not} undo-able.
127 History commands should never be used with user interfaces such as
128 Proof~General \cite{proofgeneral,Aspinall:TACAS:2000}, which takes
129 care of stepping forth and back itself. Interfering by manual
130 @{command "undo"}, @{command "linear_undo"}, or even @{command
131 "kill"} commands would quickly result in utter confusion.
136 section {* System commands *}
139 \begin{matharray}{rcl}
140 @{command_def "cd"}@{text "\<^sup>*"} & : & @{text "any \<rightarrow>"} \\
141 @{command_def "pwd"}@{text "\<^sup>*"} & : & @{text "any \<rightarrow>"} \\
142 @{command_def "use_thy"}@{text "\<^sup>*"} & : & @{text "any \<rightarrow>"} \\
146 ('cd' | 'use\_thy' | 'update\_thy') name
152 \item @{command "cd"}~@{text path} changes the current directory
153 of the Isabelle process.
155 \item @{command "pwd"} prints the current working directory.
157 \item @{command "use_thy"}~@{text A} preload theory @{text A}.
158 These system commands are scarcely used when working interactively,
159 since loading of theories is done automatically as required.