1.library Management For PVS
1.library Management For PVS
Abstract—The Prototype Verification System (PVS) is a spec- help in documenting each library with the information of the
ification language integrated with support tools and a theorem theories it offers and their dependencies, so it can be shared
prover. One mechanism for extending and improving PVS is among PVS users with the help of the pvslm implementation.
through the development of libraries, i.e., collections of mech-
anized theories in the language of PVS. This paper presents The pvslm implementation is a command line tool offering
the pvslm tool: (i) a description language for annotating PVS support for adding, updating, deleting, and re-installing the
libraries, with a small footprint but expressive enough for contents of a library source, and also managing several library
describing complex dependencies among library theories; and (ii) sources at the same time.
an implementation for managing PVS libraries annotated with The pvslm description language is presented in this paper
this language, offering support for several library sources. The
usefulness of the tool is illustrated in this paper with a detailed with the help of BNF-like notation. The pvslm implementation
step-by-step guide on how to manage the current version of the is written in the Python programming language and it can
NASA PVS Library with both pvslm’s annotation language and manage any (annotated) PVS library that is publicly available
implementation. from a pvslm server through the internet: once available, such
Index Terms—PVS, PVSLM, PVS Library Manager, PVS a library source can be configured in pvslm, be automatically
theory, Git, Python
downloaded from the internet, and set up in the host system.
As a case study for the use of the pvslm tool, this paper
I. I NTRODUCTION
presents a step-by-step guide on how to manually configure the
The Prototype Verification System [1] (PVS) is a verifi- NASA PVS Library comprising the command line instructions
cation system comprising a specification language integrated and snapshots of the user interaction.
with support tools and a theorem prover; basically, PVS is The current distribution of pvslm is freely available for
a mechanization of classical typed higher-order logic with download [5] under the GNU General Public License GPLv3
specifications organized into parameterized theories in this and it automatically installs the latest version of the NASA
logic. The PVS system has been used in state-of-the-art formal PVS Library, which is currently annotated with the pvslm
methods projects as a productive environment for constructing description language.
and maintaining collections of theories, both in industry and Paper outline. Section II presents the pvslm description
in research. These novel developments often result in large language. Sections III and IV present, respectively, instructions
collections of PVS definitions, theorems, and proofs, grouped for obtaining and installing the pvslm implementation, and a
into libraries, with many dependencies among them. This is the list of commands available from pvslm. Section V includes a
case, for instance, of the NASA PVS Library [2] maintained by step-by-step guide on the configuration and installation with
the NASA Langley Formal Methods Team: a large collection pvslm of the NASA PVS Library. Some concluding remarks
of freely-available formal developments in PVS comprising are presented in Section VI.
more than 40 theories, 24000+ theorems, and 136000+ and
3623000+ lines of, respectively, specification and proofs, all II. T HE PVSLM D ESCRIPTION L ANGUAGE
of theses ranging from trigonometry to graphs and topology. This section presents a formal definition of the pvslm
In general, given the increasing size of mathematical de- description language in the form of BNF-like notation, adopted
velopments in the form of libraries and the growing need from the NASA PVS library. It also presents the main conven-
for and adoption of mechanized proof environments [3], [4] tions and assumptions used by the pvslm tool for managing
such as PVS, it is important to have tools for managing PVS libraries. It is important to point out that the description
such libraries. This paper presents pvslm [5], an utility for language was first proposed by the NASA Langley Formal
assisting in the management of PVS libraries, comprising: (i) Methods Team for documenting its NASA PVS library: the
a description language for annotating PVS libraries, with a main contribution of this paper, in this regard, is the formal
small footprint but expressive enough for describing complex formulation of such a description language.
dependencies among library theories; and (ii) an implementa- a) Terminology: The pvslm tool distinguishes three lev-
tion for managing PVS libraries annotated with this language, els of aggregation for PVS sources. A PVS theory is the
offering support for several library sources. In pvslm, the building block of a library managed by pvslm. A package
description language is designed to represent a PVS library is a collection of theories. A library is at the top level of
as a collection of packages, with a package consisting of a aggregation, comprising a collection of packages. In summary,
collection of PVS theories. In this sense, the annotations can a library is a collection of packages and a package is a
hmetadatai ::= hheaderi hbodyi
hheaderi ::= ‘/’ htheorylisti
htheorylisti ::= htheoryi | htheoryi ‘,’ htheorylisti
hbodyi ::= (hpackagedepi | htheorydepi)∗
hpackagedepi ::= hpackagei ‘/’ htheorylisti
htheorydepi ::= htheoryi ‘:’ hqualtheorylisti?
hqualtheorylisti ::= hqualtheoryi | hqualtheoryi ‘,’ hqualtheorylisti
hqualtheoryi ::= (hpackagei ‘@’)? htheoryi
collection of theories. The pvslm tool can manage several $ curl http://migueleci.github.io/pvslm/
libraries each with several packages. downloads/pvslm-conf.py \
b) Package configuration: A package is defined in a -o pvslm-install && chmod +x pvslm-install
&& \
folder at the root of the library source, with the folder name python ./pvslm-install
defining the name of the package. Each folder contains the
pvs and prf files for its theories, and a folder named This command uses the curl utility to download the pvslm
pvsbin: this is a special folder used by the pvslm implemen- installation sources from GitHub. Once these sources are
tation for accessing the package metadata from a file named downloaded and some file permissions adjusted, the instal-
top.dep. lation script is executed as a Python 2 program. During the
c) Package metadata: The metadata of a package is installation process, the user can select the value for global
defined in its top.dep file, located inside folder pvsbin. variable PVS_PATH, i.e., the location in which the tool is to
Table I presents the syntax of pvslm description language, in be installed, including where the configuration files for the
BNF-like notation, used to populate this metadata file. library sources and the local copy of the libraries are to be
The topmost symbol in the description language is placed. This procedure and the installation script have been
hmetadatai, while htheoryi and hpackagei are terminals tested both on Linux and Mac OS X boxes.
representing, respectively, theory and package names. The Upon its successful installation, pvslm automatically con-
metadata comprises two parts, namely, a header and a body. figures the NASALib library sources and makes a local copy
The header corresponds to a single line with an ‘/’ symbol of them by using git’s clone command, so they are available
followed by a comma-separated list of theory names; these for installation in PVS. Further information on the installation
names correspond to the names of the theories included in procedure is available from [5] including, e.g., a detailed list
the package (in any order). A body comprises any number of the tool commands and some examples of the configuration
of lines, each with either a package dependency or a theory files.
dependency. A package dependency describes a dependency
from another package and the list of theories from that package IV. AVAILABLE C OMMANDS
that are being depended upon. A theory dependency describes, This section presents the list of commands offered by the
for each one of the theories listed in the header of the package, pvslm tool. Section V presents examples on the use of some
the list of its theory dependencies. In the case such a theory of these commands.
depends on a theory from other package, the name of that The pvslm tool provides commands at two levels. First, it
dependency must be qualified by the name of its package. provides commands at the level of library sources for manag-
Figure 1 presents an overview of the configuration file ing library git repositories. Second, it provides commands at
for package trig in NASALib. According to its header the level of packages for managing the contents of a library.
description, package trig defines theories top, trig_doc, Table II lists all commands pvslm offers.
trig, trig_values, etc. It contains 5 package At the level of library sources, the tool provides 5 different
dependencies and 6 theory dependencies. For instance, commands, all identified with the special token src. They
package trig depends on theory for_iterate in package include commands for:
structures, and on theories finite_sets_minmax
• Adding a library source (i.e., command -a) with a name,
and finite_sets_inductions in package
finite_sets. On the other hand, theory trig_doc a short description, and a git URL.
• Deleting a library source (i.e., command -d) with the
has no dependencies, while theory trig depends on theories
trig_basic, sqrt, trig_values, and trig_ineq. given name.
• Cloning a library source (i.e., command -c) with the
In the case of theory sqrt, it is explicitly stated that such a
theory is in package reals. given name.
• Updating a library source (i.e., command -u) with the
III. O BTAINING THE PVSLM I MPLEMENTATION given name.
The pvslm tool can be installed automatically from the • Removing the clone of a library source (i.e., command
terminal in *nix systems by issuing the following command: -r) with the given name.
/top,trig_doc,trig,trig_basic,trig_values,trig_ineq,trig_full,trig_extra,atan2
structures/for_iterate
reals/real_fun_preds,factorial,binomial,abs_lems,sign,sqrt_exists,root
analysis_ax/continuous_functions_props,derivatives,sqrt_derivative
finite_sets/finite_sets_minmax,finite_sets_inductions
ints/factorial
top:trig_doc,trig,trig_full,trig_basic,trig_values,trig_ineq,trig_extra
trig_doc:
trig:trig_basic,reals@sqrt,trig_values,trig_ineq
trig_basic:reals@sqrt
trig_values:trig_ineq
trig_ineq:trig_basic
Fig. 1: Overview of metadata file for package trig in NASALib.
It is important to note that none of the commands at the library source by default. However, this command is included
library source level modify the user’s PVS installation. These in this section for the sake of a complete installation example.
commands exclusively modify the internals of the pvslm Also note that it is not possible to have two or more library
configuration. Also, note that a library source is realized sources with the same name.
exactly by one git repository. b) Cloning a library: After a library source is configured,
At the level of packages, the tool provides 4 different it is possible to issue a command for cloning the library source
commands, all identified with the special token pkg. They packages into a local git repository. The following command
include commands for: clones NASALib:
• Installing and updating a given package (i.e., command
$ pvslm.py src -c nasalib
-i) from a given library source, including all its depen-
dencies. This command internally uses git’s clone command to obtain
• Updating a given package (i.e., command -u) from a a local copy of the entire library source repository by using
given library source, including all its dependencies. the URL configured with the library source.
• Deleting a given package (i.e., command -d) from a c) Updating a library: When necessary, it is possible to
given library source (local copy), including all packages update the contents of a local copy of a library source. For the
that depend on it. effect of updating the local copy of NASALib from its publicly
• Listing the contents (i.e., command -l) from a given available source, an user can issue the following command:
library source.
The listing command has three variants. In the first one, all $ pvslm.py src -u nasalib
libraries available to the system are listed. In the second one, This command updates the local copy of the entire library via
all packages of a given library are listed. In the third one, git’s pull command by using the URL associated to the library
all dependencies of a given package and library are listed. source when it was created.
Internally, the pvslm uses a topological sorting algorithm, d) Listing the packages in a library: By having a local
based upon each package’s metadata, for computing the set copy of a library, it is possible to list all its packages. Also,
of dependencies among theories and packages. it is possible to list the dependencies of a given package. The
V. C ASE STUDY: M ANAGING NASAL IB WITH PVSLM following command lists the package dependencies of package
complex from NASALib:
This section presents a step-by-step guide on the configu-
ration and installation with pvslm of the NASA PVS Library $ pvslm.py pkg -l nasalib@complex
(NASALib) that is available from GitHub.
a) Library source configuration: The first step is to issue This command generates the following output:
a command for configuring the library sources as follows:
Package complex depends on:
$ pvslm.py src -a \\ algebra
nasalib \\
‘The NASA PVS Library is a collection of
analysis_ax
formal PVS developments \\ ints
maintained by the NASA Langley Formal lnexp
Methods Team.’ \\ reals
https://github.com/nasa/pvslib.git structures
Internally, this command generates the library source con- trig
figuration file in the destination folder chosen during the e) Installing a package: The following command installs
installation process of pvslm. package complex in PVS.
It is important to note that this step is unnecessary with the
current distribution of pvslm because it installs the NASALib $ pvslm.py pkg -i nasalib@complex
Level Command Parameters Description
src -a name desc URL Add a new library source with the given name,
description, and URL.
-d name Delete the given library source.
-c name Clone the given library source.
-u name Update the given library source.
-r name Remove the clone of the given library source.
pkg -i library@package Install and update the given package, and all its
dependencies.
-u library@package Update a package and all its dependencies.
-d library@package Delete a package and all ones depending on it.
-l List the installed libraries.
-l library List the available packages of the given library.
-l library@package List all the dependencies of the given package.