Implementations of the Compiler for a Functional Language

This section illustrates the use of the HOAS approach in implementing
a compiler for the simply typed λ-calculus augmented with
recursion, conditionals and some built-in arithmetic operations. It
does this by showing the continuation-passing style, the closure
conversion, the code hoisting and code generation transformations
can be realized via λProlog programs.

trans provides the HOAS encoding of
the functional language of interest and the λProlog
definitions of predicates encoding the different transformations
in the compiler.

trans_tst provides the encodings
pf some functional programs that can be used to test the implementation
of the compiler.

Verification of the Compiler for the Functional Language

This section provides the proof scripts in Abella that verify the
implementation of the compiler in λProlog. The
initial subsections deal with library definitions and other related aspects
that are common to the correctness proofs for the different transformations.
The following subsections deal with the correctness proof of
individual transformations. The last subsection shows
the combination of the individual correctness proofs to form the full correctness proof.

Some Library Definitions and Theorems

util contains the some library definitions
and theorems used in the main proofs.

Properties of Typing

typing contains proofs for properties of
evaluations in the source and target languages.

Properties of Evaluation

eval contains proofs for properties of
evaluations in the source and target languages.

Properties of Substitutions

subst contains proofs for properties of
explicit treatments of substitutions in the source and target languages.
Most of the proofs are very concise because the actual substitutions are
delegated to the meta language.

Verification of the CPS Transformation

cps_typ_pres contains the type
preservation proof for the CPS transformation.

cps_sem_pres contains the
semantics preservation proof for the CPS transformation.

Verification of the Closure Conversion Transformation

cc_typ_pres contains the type
preservation proof for the closure conversion.

cc_sem_pres contains the semantics
preservation proof for the closure conversion.

Verification of the Code Hoisting Transformation

ch_typ_pres contains the type
preservation proof for the code hoisting.

ch_sem_pres contains the semantics
preservation proof for the code hoisting.

Verification of the Code Generation Transformation

cg_sem_pres contains the semantics
preservation proof for the code generation.

Correctness of the Full Compilation

full_sem_pres contains the semantics
preservation proof for the code generation.

The Complete Suite

The entire development can be downloaded as a tarball from
here. Run 'make'
command to compile the λProlog programs and the proof scripts.
Make sure that the executables including the Teyjus compiler (tjcc)
and linker (tjlink) and the Abella theorem prover (abella) are in
the search path.

Acknowledgements

This material is based upon work supported by the National Science
Foundation under Grant No CCF-0917140 and Grant No. CCF-1617771. The
work has also received support from the University of
Minnesota through a Doctoral Dissertation Fellowship and a Grant-in-Aid of
Research. Any opinions, findings and conclusions or recommendations
expressed in this material are those of the participants and do not
necessarily reflect the views of the National Science Foundation.

The views and opinions expressed in this page are strictly those of the page author(s). The contents of this page have not been reviewed or approved by the University of Minnesota.