1\documentclass[landscape,10pt]{article}
2\usepackage[landscape,a4paper,left=3mm,right=3mm,noheadfoot]{geometry}
3\usepackage{multicol}
4%\usepackage[T1]{fontenc}
5%\usepackage{helvet}
6\usepackage[colorlinks,pdftitle={HOL Quick Reference}]{hyperref}
7\usepackage{underscore}
8% http://www.tex.ac.uk/tex-archive/help/Catalogue/entries/underscore.html
9
10\newcommand{\hol}[2]{{\sffamily #1.\href{http://hol-theorem-prover.org/kananaskis-10-helpdocs/help/Docfiles/HTML/#1.#2.html}{#2}}}
11\newcommand{\holnoref}[2]{{\sffamily #1.#2}}
12% You can customise the above e.g. without hyperlinks and full path..
13%\newcommand{\hol}[2]{{\sffamily #2}}
14%\newcommand{\holnoref}[2]{{\sffamily #2}}
15\newcommand{\var}[1]{{\emph{#1}}}
16
17\pagestyle{empty}
18
19\begin{document}
20\begin{center}
21\Large HOL Quick Reference
22\end{center}
23\footnotesize
24\begin{multicols}{3}
25\subsection*{Creating Theories}
26\begin{tabular}{ll}
27\hol{Theory}{new_theory} \var{name} & creates a new theory\\
28\hol{Theory}{export_theory}() & writes theory to disk  \\
29\hol{TotalDefn}{Define} \var{term} & function definition \\
30\hol{bossLib}{Hol_datatype} \var{type-dec} & defines a concrete datatype \\
31\holnoref{EquivType}{define_equivalence_type} \var{rec} & type of equivalence classes \\
32\hol{Theory}{save_thm}(\var{name},\var{thm}) & stores theorem \\
33\hol{Tactical}{prove}(\var{term},\var{tactic}) & proves theorem using tactic \\
34\hol{Tactical}{store_thm}(\var{name},\var{term},\var{tactic}) & proves and stores theorem \\
35\end{tabular}
36\subsection*{Goal Stack Operations}
37\begin{tabular}{ll}
38\hol{proofManagerLib}{g} \var{term} & starts a new goal \\
39\hol{proofManagerLib}{e} \var{tactic} & applies a tactic to the top goal \\
40\hol{proofManagerLib}{b}() & undoes previous expansion \\
41\hol{proofManagerLib}{restart}() & undoes all expansions \\
42\holnoref{proofManagerLib}{drop}() & abandons the top goal \\
43\holnoref{proofManagerLib}{dropn} \var{int} & abandons a number of goals \\
44\hol{proofManagerLib}{p}() & prints the state of the top goal \\
45\holnoref{proofManagerLib}{status}() & prints the state of all goals \\
46\hol{proofManagerLib}{top_thm}() & returns the last theorem proved \\
47\hol{proofManagerLib}{r} \var{int} & rotates sub-goals \\
48\holnoref{proofManagerLib}{R} \var{int} & rotates proofs \\
49\end{tabular}
50\subsection*{Some Basic Tactics}
51\begin{tabular}{ll}
52\hol{bossLib}{Cases} & case analysis on outermost variable \\
53\hol{bossLib}{Cases_on} \var{term} & case analysis on given term \\
54\hol{bossLib}{Induct} & induct on outermost variable \\
55\hol{bossLib}{Induct_on} \var{term} & induct on given term \\
56\hol{Tactic}{STRIP_TAC} & splits on outermost connective \\
57\hol{Tactic}{EXISTS_TAC} \var{term} & gives witness for existential \\
58\hol{Tactic}{SELECT_ELIM_TAC} & eliminates Hilbert choice operator \\
59\hol{Tactic}{EQ_TAC} & reduces boolean equality to implication \\
60\hol{Tactic}{ASSUME_TAC} \var{thm} & adds an assumption \\
61\hol{Tactic}{DISJ1_TAC} & selects left disjunct \\
62\hol{Tactic}{DISJ2_TAC} & selects right disjunct \\
63\multicolumn{2}{l}{\hol{bossLib}{SPOSE_NOT_THEN} \var{thm-tactic}} \\
64& \quad starts proof by contradiction \\
65\end{tabular}
66\subsection*{Some Basic Tacticals}
67\begin{tabular}{ll}
68\hol{Tactical}{THEN} & applies tactics in sequence \\
69\hol{Tactical}{THENL} & applies list of tactics to sub-goals \\
70\hol{Tactical}{THEN1} & applies the second tactic to first sub-goal \\
71\hol{Tactical}{ORELSE} & applies second tactic only if the first fails \\
72\hol{Tactical}{REVERSE} & reverses the order of sub-goals \\
73\hol{Tactical}{ALL_TAC} & leaves the goal unchanged \\
74\hol{Tactical}{TRY} & do nothing if the tactic fails \\
75\hol{Tactical}{REPEAT} & repeat a tactic until it fails \\
76\hol{Tactic}{NTAC} & apply a tactic some number of times \\
77\hol{Tactical}{MAP_EVERY} & apply a tactic using theorems in a list \\
78\end{tabular}
79\subsection*{Using Assumptions}
80\begin{tabular}{ll}
81\hol{bossLib}{by}(\var{term},\var{tactic}) & add assum.\ using proof \\ % infix
82\hol{Tactical}{ASSUM_LIST} [\var{thms}] & adds list of theorems \\
83\hol{Tactical}{POP_ASSUM} \var{thm-tactic} & use first assumption \\
84\hol{Tactical}{POP_ASSUM_LIST} \var{thms-tactic} & use all assumptions \\
85\hol{Tactical}{PAT_ASSUM} \var{thm-tactic} & use matching assumption \\
86\hol{Tactical}{FIRST_X_ASSUM} \var{thm-tactic} & use first successful assum. \\
87\hol{Tactic}{STRIP_ASSUME_TAC} \var{thm} & split and add assumption \\
88\hol{Tactic}{WEAKEN_TAC} \var{term-pred} & remove assumptions \\
89\hol{Tactic}{RULE_ASSUM_TAC} & apply rule to assumptions \\
90\hol{Tactic}{IMP_RES_TAC} \var{thm} & resolve \var{thm} using assums. \\
91\hol{Tactic}{RES_TAC} & mutually resolve assums. \\
92\hol{Q}{ABBREV_TAC} & abbreviate goal's sub-term \\
93\end{tabular}
94\subsection*{Decision Procedures}
95\begin{tabular}{ll}
96\hol{tautLib}{TAUT_TAC} & tautology checker \\
97\hol{bossLib}{DECIDE_TAC} & above, plus linear arithmetic \\
98\hol{mesonLib}{MESON_TAC} [\var{thms}] & first-order prover \\
99\hol{BasicProvers}{PROVE_TAC} [\var{thms}] & uses Meson \\
100\holnoref{metisLib}{METIS_TAC} [\var{thms}] & new first-order prover \\
101\hol{bossLib}{EVAL_TAC} & evaluation tactic  \\
102\holnoref{numLib}{ARITH_TAC} & for Presburger arithmetic \\
103\holnoref{intLib}{ARITH_TAC} & uses Omega test \\
104\holnoref{intLib}{COOPER_TAC} & Cooper's algorithm \\
105\holnoref{realLib}{REAL_ARITH_TAC} & \\
106\\
107\end{tabular}
108\end{multicols}
109
110\begin{multicols}{2}
111\subsection*{Term Rewriting Tactics}
112\begin{tabular}{ll}
113\hol{Rewrite}{GEN_REWRITE_TAC} \var{conv-op rws} [\var{thms}] & used to construct bespoke rewriting tactics; \\
114 & applies \var{conv-op} to the rewriting conversion \\[4pt]
115\hol{Rewrite}{PURE_REWRITE_TAC} [\var{thms}] & rewrites goal only using the given theorems \\
116\hol{Rewrite}{PURE_ONCE_REWRITE_TAC} [\var{thms}] & as above but executes just a single rewrite  \\
117\hol{Rewrite}{REWRITE_TAC} [\var{thms}] & rewrites goal  using theorems and some basic rewrites \\
118\hol{Rewrite}{ONCE_REWRITE_TAC} [\var{thms}] & as above but executes just a single rewrite \\
119\hol{Rewrite}{PURE_ASM_REWRITE_TAC} [\var{thms}] & rewrites goal only using assumptions and theorems \\
120\hol{Rewrite}{PURE_ONCE_ASM_REWRITE_TAC} [\var{thms}] & as above but executes just a single rewrite \\
121\hol{Rewrite}{ASM_REWRITE_TAC} [\var{thms}] & rewrites using assums., theorems and basic rewrites \\
122\hol{Rewrite}{ONCE_ASM_REWRITE_TAC} [\var{thms}] & as above but executes just a single rewrite
123\end{tabular}
124
125\subsection*{Simplification Tactics}
126\begin{tabular}{ll}
127\hol{simpLib}{SIMP_TAC} \var{simpset} [\var{thms}] & simplifies goal using theorems and simplification set \\
128\hol{simpLib}{ASM_SIMP_TAC} \var{simpset} [\var{thms}] & as above but also uses the assumptions \\
129\hol{simpLib}{FULL_SIMP_TAC} \var{simpset} [\var{thms}] & simplifies the goal and all the assumptions \\[4pt]
130\hol{BasicProvers}{RW_TAC} \var{simpset} [\var{thms}] & more aggressive simplifier; uses type info.\ \& case splits \\
131\hol{BasicProvers}{SRW_TAC} [\var{ssfrags}][\var{thms}] & as above but
132uses a list of \emph{simpset} fragments  \\[4pt]
133\hol{simpLib}{rewrites} [\var{thms}] & constructs a rewrite fragment \\
134\hol{simpLib}{mk_simpset} [\var{ssfrag}] & constructs a \emph{simpset} from fragments \\
135\hol{simpLib}{++}(\var{simpset},\var{ssfrag}) & adds a fragment to a \emph{simpset} \\ % infix
136\holnoref{simpLib}{\&\&}(\var{simpset},[\var{thms}]) & adds rewrites to a \emph{simpset} \\ % infix
137\hol{simpLib}{AC} \var{thm} \var{thm} & constructs tagged theorem
138to enable AC simplification
139\end{tabular}
140\end{multicols}
141
142\begin{multicols}{2}
143\subsection*{Simplification Sets and Fragments}
144\begin{tabular}{ll}
145\hol{pureSimps}{pure_ss} & minimal \emph{simpset} for conditional rewriting \\
146\hol{boolSimps}{bool_ss} & propositional and first-order logic simplifications, plus beta-conversion \\
147\hol{bossLib}{std_ss} & as above + pairs, options, sums, numeral evaluation \& eta reduction \\
148\hol{bossLib}{arith_ss} & as above + arithmetic rewrites and decision procedure for linear arithmetic \\
149\hol{bossLib}{list_ss} & a version of the above for the theory of lists \\
150\holnoref{realLib}{real_ss} & adds some real number evaluation and rewrites to the arithmetic \emph{simpset} \\
151\hol{bossLib}{srw_ss}() & returns `stateful' \emph{simpset}; has type theorems from loaded theories
152\end{tabular}
153
154\medskip
155\noindent\begin{tabular}{ll}
156\hol{bossLib}{augment_srw_ss} [\var{ssfrag}] & adds fragments to the `stateful' \emph{simpset} \\
157\hol{BasicProvers}{export_rewrites} [\var{names}] & exports named theorems to the `stateful' \emph{simpset} \\
158\end{tabular}
159
160
161\noindent\begin{tabular}{ll}
162\holnoref{boolSimps}{CONJ_ss} & congruence rule for conjunction \\
163\holnoref{boolSimps}{ETA_ss} & eta conversion \\
164\holnoref{boolSimps}{LET_ss} & rewrites out `let' terms \\
165\hol{boolSimps}{DNF_ss} & converts term to disjunctive-normal-form\\
166\holnoref{pairSimps}{PAIR_ss} & rewrites for pairs \\
167\holnoref{optionSimps}{OPTION_ss} & rewrites for options \\
168\holnoref{stringSimps}{STRING_ss} & rewrites for strings \\
169\holnoref{numSimps}{ARITH_ss} & arithmetic rewrites and decision procedure \\
170\holnoref{numSimps}{ARITH_AC_ss} & AC fragment for addition and multiplication \\
171\holnoref{numSimps}{REDUCE_ss} & reduces ground-term expressions \\
172\holnoref{listSimps}{LIST_ss} & rewrites for lists \\
173\holnoref{pred_setSimps}{SET_SPEC_ss} & rewrites for set membership \\
174\holnoref{pred_setSimps}{PRED_SET_ss} & rewrites for sets \\
175\end{tabular}
176\end{multicols}
177
178\begin{multicols}{2}
179\subsection*{Specialize and Generalize Rules}
180\begin{tabular}{ll}
181\hol{Thm}{SPEC} \var{term} & specializes one variable in the conclusion of a theorem \\
182\hol{Drule}{SPECL} [\var{terms}] & specializes zero or more variables in the conclusion of a theorem \\
183\hol{Drule}{SPEC_ALL} & specializes the conclusion of a theorem with its own quantified variables \\
184\hol{Drule}{GSPEC} & as above but uses unique variables \\
185\hol{Drule}{ISPEC} \var{term} & specializes theorem, with type instantiation if necessary \\
186\hol{Drule}{ISPECL} [\var{terms}] & specializes theorem zero or more times, with type instantiation if necessary \\
187\hol{Thm}{INST} [\var{term} \verb+|->+ \var{term}] & instantiates free variables in a theorem \\
188\hol{Thm}{GEN} \var{term} & generalizes the conclusion of a theorem \\
189\hol{Drule}{GENL} [\var{terms}] & generalizes zero or more variables in the conclusion of a theorem \\
190\hol{Drule}{GEN_ALL} & generalizes the conclusion of a theorem over its own free variables \\
191\end{tabular}
192\subsection*{Some Inference Rules}
193\begin{tabular}{ll}
194\hol{Conv}{CONV_RULE} \var{conv} & makes an inference rule from a conversion \\
195\hol{Conv}{GSYM} \var{thm} & reverses the first equation(s) encountered in a top-down search \\
196\hol{Drule}{NOT_EQ_SYM} \var{thm} & swaps left-hand and right-hand sides of a negated equation \\
197\hol{Thm}{CONJUNCT1} \var{thm} & extracts left conjunct of theorem \\
198\hol{Thm}{CONJUNCT2} \var{thm} & extracts right conjunct of theorem \\
199\hol{Drule}{CONJUNCTS} \var{thm} & recursively splits conjunctions into a list of conjuncts \\
200\hol{Drule}{MATCH_MP} \var{thm} \var{thm} & Modus Ponens inference rule with automatic matching \\
201\hol{Thm}{EQ_MP} \var{thm} \var{thm} & equality version of the Modus Ponens rule \\
202\hol{Thm}{EQ_IMP_RULE} \var{thm} & derives forward and backward implication from equality of boolean terms \\
203\end{tabular}
204\subsection*{Some Conversions}
205\begin{tabular}{ll}
206\hol{bossLib}{DECIDE} & prove term using a tautology checker and linear arithmetic \\
207\hol{Rewrite}{REWRITE_CONV} [\var{thms}] & rewrites term using basic rewrites and given theorems \\
208\hol{simpLib}{SIMP_CONV} \var{simpset} [\var{thms}] & simplifies term using \emph{simpset} and theorems \\
209\hol{computeLib}{CBV_CONV} \var{compset} & call-by-value conversion \\[4pt]
210\hol{numLib}{num_CONV} & equates a non-zero numeral with the form $\mathrm{SUC}\ x$ for some $x$ \\
211\hol{numLib}{REDUCE_CONV} & evaluates arithmetic and boolean ground expressions \\
212\hol{numLib}{SUC_TO_NUMERAL_DEFN_CONV} & translates $\mathrm{SUC}\ x$ equations to use numeral constructors \\
213\holnoref{numLib}{EXISTS_LEAST_CONV} & when applied to a term $\exists n. P(n)$, this conversion returns: \\
214 & $\vdash (\exists n. P(n)) = \exists n. P(n) \wedge \forall n'. n' < n \Rightarrow \neg P(n')$ \\[4pt]
215\end{tabular}
216
217\noindent\begin{tabular}{ll}
218\hol{Conv}{SYM_CONV} & interchanges the left and right-hand sides of an equation \\
219\hol{Conv}{SKOLEM_CONV} & proves the existence of a Skolem function \\[4pt]
220\hol{Drule}{GEN_ALPHA_CONV} & renames the bound variable of an abstraction, quantified term, \emph{etc.} \\
221\hol{Thm}{BETA_CONV} & performs a single step of beta-conversion \\
222\hol{Thm}{ETA_CONV} & performs a top level eta-conversion \\[4pt]
223\hol{PairRules}{GEN_PALPHA_CONV} & paired variable version of the above \\
224\hol{PairRules}{PBETA_CONV} & paired variable version of the above \\
225\hol{PairRules}{PETA_CONV} & paired variable version of the above \\
226\end{tabular}
227\subsection*{Quantification Conversions}
228\begin{tabular}{ll}
229\holnoref{Conv}{SWAP_VARS_CONV} & swaps two universally quantified variables \\
230\hol{Conv}{SWAP_EXISTS_CONV} & swaps two existentially quantified variables \\
231\holnoref{Conv}{\{NOT$|$AND$|$OR\}_\{EXISTS$|$FORALL\}_CONV} & moves operation inwards through quantifier \\
232\holnoref{Conv}{\{EXISTS$|$FORALL\}_\{NOT$|$AND$|$OR$|$IMP\}_CONV} & moves quantifier inwards through operation \\
233\multicolumn{2}{l}{\holnoref{Conv}{\{LEFT$|$RIGHT\}_\{AND$|$OR$|$IMP\}_\{EXISTS$|$FORALL\}_CONV}} \\
234 & moves quantifier of left/right operand outward
235\end{tabular}
236\subsection*{Conversion Operations}
237\begin{tabular}{ll}
238\hol{Conv}{DEPTH_CONV} & applies conversion repeatedly to all sub-terms, in bottom-up order \\
239\hol{Conv}{REDEPTH_CONV} & applies conversion bottom-up to sub-terms, retraversing changed ones \\
240\hol{Conv}{ONCE_DEPTH_CONV} & applies conversion once to the first suitable sub-term in top-down order \\
241\hol{Conv}{TOP_DEPTH_CONV} & applies conversion top-down to all sub-terms, retraversing changed ones \\
242\hol{Conv}{LAND_CONV} & applies conversion to the left-hand argument of a binary operator \\
243\hol{Conv}{RAND_CONV} & applies conversion to the operand of an application \\
244\hol{Conv}{RATOR_CONV} & applies conversion to the operator of an application \\
245\hol{Conv}{BINOP_CONV} & applies conversion to both arguments of a binary operator \\
246\holnoref{Conv}{LHS_CONV} & applies conversion to the left-hand side of an equality \\
247\holnoref{Conv}{RHS_CONV} & applies conversion to the right-hand side of an equality \\
248\hol{Conv}{STRIP_QUANT_CONV} & applies conversion underneath a quantifier prefix \\
249\hol{Conv}{STRIP_BINDER_CONV} & applies conversion underneath a binder prefix \\
250\hol{Conv}{FORK_CONV}(\var{conv},\var{conv}) & applies a pair of conversions to the arguments of a binary operator \\
251\hol{Conv}{THENC}(\var{conv},\var{conv}) & applies two conversions in sequence \\
252\hol{Conv}{ORELSEC}(\var{conv},\var{conv}) & applies the first of two conversions that succeeds \\
253\end{tabular}
254\subsection*{Parsing}
255\begin{tabular}{ll}
256\holnoref{numLib}{prefer_num}() & give numerals and operators natural
257number types by default \\
258\hol{intLib}{prefer_int}() & give numerals and operators integer
259types by default\\
260\hol{Parse}{overload_on}(\var{name},\var{term}) & establishes constant as one of the overloading possibilities for a string \\
261\hol{Parse}{add_infix}(\var{name},\var{int},\var{assoc}) & adds string as infix with given precedence \& associativity to grammar \\
262\hol{Parse}{set_fixity} \var{name} \var{fixity} & allows the fixity of tokens to be updated \\
263\hol{Parse}{type_abbrev}(\var{name},\var{type}) & establishes a type abbreviation \\
264\hol{Parse}{add_rule} \var{record} & adds a parsing/printing rule to the global grammar \\
265\end{tabular}
266\subsection*{The Database}
267\begin{tabular}{ll}
268\hol{DB}{match} [\var{names}] \var{term} & attempt to find matching theorems in the specified theories \\
269\hol{DB}{find} \var{string} & search for theory element by name fragment \\
270\hol{DB}{axioms} \var{name} & all the axioms stored in the named theory \\
271\hol{DB}{theorems} \var{name} & all the theorems stored in the named theory \\
272\hol{DB}{definitions} \var{name} & all the definitions stored in the named theory \\
273\holnoref{DB}{export_theory_as_docfiles} \var{name} & produce \emph{.doc} files for the named theory \\
274\holnoref{DB}{html_theory} \var{name} & produce web-page for the named theory \\
275\end{tabular}
276\subsection*{Tracing}
277\begin{tabular}{ll}
278\hol{Feedback}{traces}() & returns a list of registered tracing variables \\
279\hol{Feedback}{set_trace} \var{name} \var{int} & set a tracing level for a registered trace \\
280\hol{Feedback}{reset_trace} \var{name} & resets a tracing variable to its default value \\
281\hol{Feedback}{reset_traces}() & resets all registered tracing variables to their default values \\[4pt]
282\quad \textsf{``Rewrite''} & tracing variable for term rewriting (0--1) \\
283\quad \textsf{``Subgoal number''} & number of printed sub-goals (10--10000) \\
284\quad \textsf{``meson''} & for the first-order prover (1--2) \\
285\quad \textsf{``numeral types''} & show types of numerals (0--1)\\
286\quad \textsf{``simplifier''} & for the simplifier (0--7) \\
287\quad \textsf{``types''} & printing of types (0--2) \\[4pt]
288\hol{Globals}{show_types} := \var{bool} & flag controlling printing of
289HOL types \\
290\hol{Globals}{show_assums} := \var{bool} & flag for controlling
291display of theorem assumptions\\
292\hol{Globals}{show_tags} := \var{bool} & flag for controlling display of tags in theorem pretty-printer \\[4pt]
293\hol{Lib}{start_time}() & set a timer running \\
294\hol{Lib}{end_time} \var{name} & check a running timer, and print out how long it has been running \\
295\hol{Lib}{time} \var{function} & measure how long a function application takes \\
296\hol{Count}{thm_count}() & returns the current value of the theorem counter \\
297\holnoref{Count}{reset_thm_count}() & resets the theorem counter \\
298\hol{Count}{apply} \var{function} & returns the theorem count for a function application \\
299\end{tabular}
300\end{multicols}
301\end{document}
302