2 research outputs found
Frex: dependently-typed algebraic simplification
We present an extensible, mathematically-structured algebraic simplification
library design. We structure the library using universal algebraic concepts: a
free algebra -- fral -- and a free extension -- frex -- of an algebra by a set
of variables. The library's dependently-typed API guarantees simplification
modules, even user-defined ones, are terminating, sound, and complete with
respect to a well-specified class of equations. Completeness offers intangible
benefits in practice -- our main contribution is the novel design. Cleanly
separating between the interface and implementation of simplification modules
provides two new modularity axes. First, simplification modules share thousands
of lines of infrastructure code dealing with term-representation,
pretty-printing, certification, and macros/reflection. Second, new
simplification modules can reuse existing ones. We demonstrate this design by
developing simplification modules for monoid varieties: ordinary, commutative,
and involutive. We implemented this design in the new Idris2 dependently-typed
programming language, and in Agda
Verified programming with explicit coercions
Type systems have proved to be a powerful means of specifying and proving
important program invariants. In dependently typed programming languages
types can depend on values and hence express arbitrarily complicated
propositions and their machine checkable proofs. The type-based approach
to program specification allows for the programmer to not only transcribe
their intentions, but arranges for their direct involvement in the proving
process, thus aiding the machine in its attempt to satisfy difficult obligations.
In this thesis we develop a series of patterns for programming in a correct-by-construction style making use of constraints and coercions to prove
properties within a dependently typed host. This allows for the development
of a verified, kernel which can be built upon using the host system features.
In particular this should allow for the development of “tactics” or semiautomated
solvers invoked when coercing types all within a single language.
The efficacy of this approach is given by the development of a system of
expressions indexed by their, exposing a case analysis feature serving to
generate value constraints. These constraints are directly reflected into
the host allowing for their involvement in the type-checking process. A
motivating use case of this design shows how a term’s semantic index
information admits an exact, formalized cost analysis amenable to reasoning
within the host. Finally we show how such a system is used to identify
unreachable dead-code, trivially admitting the design and verification of
an SSA style compiler with this optimization. We think such a design
of explicitly proving the local correctness of type-transformations in the
presence of accumulated constraints can form the basis of a flexible language
in concert with a variety of trusted solver