4 % \usepackage{amssymb,amsmath}
11 \definecolor{gray}{gray}{0.85}
12 %\newcommand{\logo}[3]{
13 %\parpic(0cm,0cm)(#2,#3)[l]{\includegraphics[width=#1]{whelp-bw}}
16 \newcommand{\AUTO}{\textsc{Auto}}
17 \newcommand{\COQ}{Coq}
18 \newcommand{\ELIM}{\textsc{Elim}}
19 \newcommand{\HELM}{Helm}
20 \newcommand{\HINT}{\textsc{Hint}}
21 \newcommand{\IN}{\ensuremath{\dN}}
22 \newcommand{\INSTANCE}{\textsc{Instance}}
23 \newcommand{\IR}{\ensuremath{\dR}}
24 \newcommand{\IZ}{\ensuremath{\dZ}}
25 \newcommand{\LIBXSLT}{LibXSLT}
26 \newcommand{\LOCATE}{\textsc{Locate}}
27 \newcommand{\MATCH}{\textsc{Match}}
28 \newcommand{\MATITA}{Matita}
29 \newcommand{\METAHEADING}{Symbol & Position \\ \hline\hline}
30 \newcommand{\MOWGLI}{MoWGLI}
31 \newcommand{\NAT}{\ensuremath{\mathit{nat}}}
32 \newcommand{\NATIND}{\mathit{nat\_ind}}
33 \newcommand{\NUPRL}{NuPRL}
34 \newcommand{\OCAML}{OCaml}
35 \newcommand{\PROP}{\mathit{Prop}}
36 \newcommand{\REF}[3]{\ensuremath{\mathit{Ref}_{#1}(#2,#3)}}
37 \newcommand{\TEXMACRO}[1]{\texttt{\char92 #1}}
38 \newcommand{\UWOBO}{UWOBO}
39 \newcommand{\WHELP}{Whelp}
40 \newcommand{\DOT}{\ensuremath{\mbox{\textbf{.}}}}
41 \newcommand{\SEMICOLON}{\ensuremath{\mbox{\textbf{;}}}}
42 \newcommand{\BRANCH}{\ensuremath{\mbox{\textbf{[}}}}
43 \newcommand{\SHIFT}{\ensuremath{\mbox{\textbf{\textbar}}}}
44 \newcommand{\POS}[1]{\ensuremath{#1\mbox{\textbf{:}}}}
45 \newcommand{\MERGE}{\ensuremath{\mbox{\textbf{]}}}}
46 \newcommand{\FOCUS}[1]{\ensuremath{\mathtt{focus}~#1}}
47 \newcommand{\UNFOCUS}{\ensuremath{\mathtt{unfocus}}}
48 \newcommand{\SKIP}{\MATHTT{skip}}
49 \newcommand{\TACTIC}[1]{\ensuremath{\mathtt{tactic}~#1}}
51 \definecolor{gray}{gray}{0.85} % 1 -> white; 0 -> black
52 \newcommand{\NT}[1]{\langle\mathit{#1}\rangle}
53 \newcommand{\URI}[1]{\texttt{#1}}
55 %{\end{SaveVerbatim}\setlength{\fboxrule}{.5mm}\setlength{\fboxsep}{2mm}%
56 \newenvironment{grafite}{\VerbatimEnvironment
57 \begin{SaveVerbatim}{boxtmp}}%
58 {\end{SaveVerbatim}\setlength{\fboxsep}{3mm}%
60 \fcolorbox{black}{gray}{\BUseVerbatim[boxwidth=0.9\linewidth]{boxtmp}}
64 \newenvironment{example}{\stepcounter{example}\vspace{0.5em}\noindent\emph{Example} \arabic{example}.}
66 \newcommand{\ASSIGNEDTO}[1]{\textbf{Assigned to:} #1}
67 \newcommand{\FILE}[1]{\texttt{#1}}
68 % \newcommand{\NOTE}[1]{\ifodd \arabic{page} \else \hspace{-2cm}\fi\ednote{#1}}
69 \newcommand{\NOTE}[1]{\ednote{#1}{foo}}
70 \newcommand{\TODO}[1]{\textbf{TODO: #1}}
73 \newcommand{\sequent}[2]{
74 \savebox{\tmpxyz}[0.9\linewidth]{
75 \begin{minipage}{0.9\linewidth}
79 \end{minipage}}\setlength{\fboxsep}{3mm}%
81 \fcolorbox{black}{gray}{\usebox{\tmpxyz}}
84 \bibliographystyle{plain}
90 \title{The \MATITA{} Proof Assistant}
92 \author{Andrea \surname{Asperti} \email{asperti@cs.unibo.it}}
93 \author{Claudio \surname{Sacerdoti Coen} \email{sacerdot@cs.unibo.it}}
94 \author{Enrico \surname{Tassi} \email{tassi@cs.unibo.it}}
95 \author{Stefano \surname{Zacchiroli} \email{zacchiro@cs.unibo.it}}
96 \institute{Department of Computer Science, University of Bologna\\
97 Mura Anteo Zamboni, 7 --- 40127 Bologna, ITALY}
99 \runningtitle{The Matita proof assistant}
100 \runningauthor{Asperti, Sacerdoti Coen, Tassi, Zacchiroli}
105 ``We are nearly bug-free'' -- \emph{CSC, Oct 2005}
112 \keywords{Proof Assistant, Mathematical Knowledge Management, XML, Authoring,
119 \includegraphics[width=0.9\textwidth]{libraries}
120 \caption{\MATITA{} libraries}
122 \label{fig:libraries}
125 \section{Overview of the Architecture}
126 Fig.~\ref{fig:libraries} shows the architecture of the \emph{libraries} (circle nodes)
127 and \emph{applications} (squared nodes) developed in the HELM project.
129 Applications and libraries depend over other libraries forming a
130 directed acyclic graph (DAG). Each library can be decomposed in
131 a a set of \emph{modules} also forming a DAG.
133 Modules and libraries provide coherent sets of functionalities
134 at different scales. Applications that require only a few functionalities
135 depend on a restricted set of libraries. \MATITA, our most complex
136 application, depends on every library.
138 Only the proof assistant \MATITA{} is an application meant to be used directly
139 by the user. All the other applications are Web services developed in the
140 HELM and MoWGLI projects and already described elsewhere. In particular:
142 \item The \emph{Getter} is a Web service to retrieve an (XML) document
143 from a physical location (URL) given its logical name (URI). The Getter is
144 responsible of updating a table that maps URIs to URLs. Thanks to the Getter
145 it is possible to work on a logically monolithic library that is physically
146 distributed on the network. More information on the Getter can be found
148 \item \emph{Whelp} is a search engine to index and locate mathematical
149 notions (axioms, theorems, definitions) in the logical library managed
150 by the Getter. Typical examples of a query to Whelp are queries that search
151 for a theorem that generalize or instantiate a given formula, or that
152 can be immediately applied to prove a given goal. The output of Whelp is
153 an XML document that lists the URIs of a complete set of candidates that
154 are likely to satisfy the given query. The set is complete in the sense
155 that no notion that actually satisfies the query is thrown away. However,
156 the query is only approssimated in the sense that false matches can be
157 returned. Whelp has been described in~\cite{whelp}.
158 \item \emph{Uwobo} is a Web service that, given the URI of a mathematical
159 notion in the distributed library, renders it according to the user provided
160 two dimensional mathematical notation. Uwobo may also embed the rendering
161 of mathematical notions into arbitrary documents before returning them.
162 The Getter is used by Uwobo to retrieve the document to be rendered.
163 Uwobo has been described in~\cite{uwobo}.
164 \item The \emph{Proof Checker} is a Web service that, given the URI of
165 notion in the distributed library, checks its correctness. Since the notion
166 is likely to depend in an acyclic way over other notions, the proof checker
167 is also responsible of building in a top-down way the DAG of all
168 dependencies, checking in turn every notion for correctness.
169 The proof checker has been described in~\cite{proofchecker}.
170 \item The \emph{Dependency Analyzer} is a Web service that can produce
171 a textual or graphical representation of the dependecies of an object.
172 The dependency analyzer has been described in~\cite{dependencyanalyzer}.
175 The dependency of a library or application over another library can
176 be satisfied by linking the library in the same executable.
177 For those libraries whose functionalities are also provided by the
178 aforementioned Web services, it is also possible to link stub code that
179 forwards the request to a remote Web service. For instance, the Getter
180 is just a wrapper to the \texttt{getter} library that allows the library
181 to be used as a Web service. \MATITA{} can directly link the code of the
182 \texttt{getter} library, or it can use a stub library with the same API
183 that forwards every request to the Getter.
185 To better understand the architecture of \MATITA{} and the role of each
186 library, we can focus on the rappresentation of the mathematical information.
187 \MATITA{} is based on (a variant of) the Calculus of (Co)Inductive
188 Constructions (CIC). In CIC terms are used to represent mathematical
189 expressions, types and proofs. \MATITA{} is able to handle terms at
190 four different levels of refinement. On each level it is possible to provide a
191 different set of functionalities. The four different levels are:
192 fully specified terms; partially specified terms; terms
193 at the content level; terms at the presentation level.
195 \subsection{Fully specified terms}
196 \emph{Fully specified terms} are CIC terms where no information is
197 missing or left implicit. A fully specified term should be well-typed.
198 The mathematical notions (axioms, definitions, theorems) that are stored
199 in our mathematical library are fully specified and well-typed terms.
200 Fully specified terms are extremely verbose (to make type-checking
201 decidable). Their syntax is fixed and does not resemble the usual
202 extendible mathematical notation. They are not meant for direct user
205 The \texttt{cic} library defines the data type that represents CIC terms
206 and provides a parser for terms stored in an XML format.
208 The most important library that deals with fully specified terms is
209 \texttt{cic\_proof\_checking}. It implements the procedure that verifies
210 if a fully specified term is well-typed. It also implements the
211 \emph{conversion} judgement that verifies if two given terms are
212 computationally equivalent (i.e. they share the same normal form).
214 Terms may reference other mathematical notions in the library.
215 One commitment of our project is that the library should be physically
216 distributed. The \texttt{getter} library manages the distribution,
217 providing a mapping from logical names (URIs) to the physical location
218 of a notion (an URL). The \texttt{urimanager} library provides the URI
219 data type and several utility functions over URIs. The
220 \texttt{cic\_proof\_checking} library calls the \texttt{getter} library
221 every time it needs to retrieve the definition of a mathematical notion
222 referenced by a term that is being type-checked.
224 The Proof Checker is the Web service that provides an HTTP interface
225 to the \texttt{cic\_proof\_checking} library.
227 We use metadata and a sort of crawler to index the mathematical notions
228 in the distributed library. We are interested in retrieving a notion
229 by matching, instantiation or generalization of a user or system provided
230 mathematical expression. Thus we need to collect metadata over the fully
231 specified terms and to store the metadata in some kind of (relational)
232 database for later usage. The \texttt{hmysql} library provides a simplified
233 interface to a (possibly remote) MySql database system used to store the
234 metadata. The \texttt{metadata} library defines the data type of the metadata
235 we are collecting and the functions that extracts the metadata from the
236 mathematical notions (the main functionality of the crawler).
237 The \texttt{whelp} library implements a search engine that performs
238 approximated queries by matching/instantiation/generalization. The queries
239 operate only on the metadata and do not involve any actual matching
240 (that will be described later on and that is implemented in the
241 \texttt{cic\_unification} library). Not performing any actual matching
242 the query only returns a complete and hopefully small set of matching
243 candidates. The process that has issued the query is responsible of
244 actually retrieving from the distributed library the candidates to prune
245 out false matches if interested in doing so.
247 The Whelp search engine is the Web service that provides an interface to
248 the \texttt{whelp} library.
250 \subsection{Partially specified terms}
251 \emph{Partially specified terms} are CIC terms where subterms can be omitted.
252 Omitted subterms can bear no information at all or they may be associated to
253 a sequent. The formers are called \emph{implicit terms} and they occur only
254 linearly. The latters may occur multiple times and are called
255 \emph{metavariables}. An \emph{explicit substitution} is applied to each
256 occurrence of a metavariable. A metavariable stand for a term whose type is
257 given by the conclusion of the sequent. The term must be closed in the
258 context that is given by the ordered list of hypotheses of the sequent.
259 The explicit substitution instantiates every hypothesis with an actual
260 value for the term bound by the hypothesis.
262 Partially specified terms are not required to be well-typed. However a
263 partially specified term should be \emph{refinable}. A \emph{refiner} is
264 a type-inference procedure that can instantiate implicit terms and
265 metavariables and that can introduce \emph{implicit coercions} to make a
266 partially specified term be well-typed. The refiner of \MATITA{} is implemented
267 in the \texttt{cic\_unification} library. As the type checker is based on
268 the conversion check, the refiner is based on \emph{unification} that is
269 a procedure that makes two partially specified term convertible by instantiating
270 as few as possible metavariables that occur in them.
272 Since terms are use in CIC to represent proofs, so far correct incomplete
273 proofs are represented by refinable partially specified terms. The metavariables
274 that occur in the proof correspond to the conjectures still to be proved.
275 The sequent associated to the metavariable is the conjecture the user needs to
278 \emph{Tactics} are the procedures that the user can apply to progress in the
279 proof. A tactic proves a conjecture possibly creating new (and hopefully
280 simpler) conjectures. The implementation of tactics is given in the
281 \texttt{tactics} library. It is heavily based on the refinement and unification
282 procedures of the \texttt{cic\_unification} library.
284 As fully specified terms, partially specified terms are not well suited
285 for user consumption since their syntax is not extendible and it is not
286 possible to adopt the usual mathematical notation. However they are already
287 an improvement over fully specified terms since they allow to omit redundant
288 information that can be inferred by the refiner.
290 \subsection{Terms at the content level}
292 \subsection{Terms at the presentation level}
296 At the bottom of the DAG we have a few libraries (\texttt{extlib},
297 \texttt{xml} and the \texttt{registry}) that provide a core of
298 useful functions used everywhere else. In particular, the \texttt{xml} library
299 to easily represent, parse and pretty-print XML files is a central component
300 since in HELM every piece of information is stored in \ldots. [FINIRE]
301 The other basic libraries provide often needed operations over generic
302 data structures (\texttt{extlib}) and central storage for configuration options
303 (the \texttt{registry}).
312 We would like to thank all the students that during the past
313 five years collaborated in the \HELM{} project and contributed to
314 the development of Matita, and in particular
315 A.Griggio, F.Guidi, P. Di Lena, L.Padovani, I.Schena, M.Selmi,
320 \bibliography{matita}