This project aims to formalize in the Rocq Prover part of the Stainless project. It describes a call-by-value lambda-calculus and defines a rich type system (based on computations) that describes behaviors of lambda-calculus terms. Supported types include: System F polymorphism, recursive types, infinite intersections, refinement and dependent types, equality types.
The proofs require Rocq and Rocq-Equations, which can be installed using opam:
opam repo add rocq-released https://rocq-prover.org/opam/released
opam pin add -yn rocq-prover 9.0.0
opam install rocq-equations.1.3.1+9.0 -y
See “Installing the Rocq Prover and its packages” for more details.
Alternatively, you can also use the provided Dockerfile to build a Docker image with all dependencies installed:
docker build -t systemfr .
docker run -v "$(pwd)":/theories systemfr
After installing Rocq, you can compile the proofs using:
./configure
make -j8 # should take around 10 minutes
All trees (for terms and for types) are defined in Trees.v. The operational semantics is given in SmallStep.v. The semantic definition of types is given in ReducibilityDefinition.v. We then prove soundness of inference rules for these types in the Erased*.v files (for erased terms) and in the Annotated*.v files (for annotated terms).
The file dependencies.pdf has an overview of the dependencies between all files.
We prove the following properties and the soundness of the typing rules. We rely on the following assumptions:
- The terms and types appearing in goals/context satisfy some well-formedness conditions
- The types are appearing in goals/context are non-empty
- Inferred types are always syntactically singletons
- During delta-beta reduction, the term being evaluated has type
T_top(or equivalently, another arbitrary type) - In
untangle(Untangle.v), we know which terms have the Tau property, and we rely on the abstract model ofupdateandtlookupspecified using axioms in TauProperty.v
widengives a larger typewiden_open_subtypein InferApp.vdelta_beta_reductiongives observationally equivalent terms:delta_beta_obs_equivin DeltaBetaReduction.vuntanglereturns an equivalent typeuntangle_open_equivalent_typesin Untangle.v
- NBase:
open_nbase1andopen_nbase2in NormalizationBase.v - NExists1:
open_nexists_1in NormalizationExists.v - NExists2:
open_nexists_2in NormalizationExists.v - NPi:
open_npiin NormalizationPi.v - NCons:
open_nconsin NormalizationList.v - NSing:
open_nsingin NormalizationSing.v - NMatch1:
open_nmatch_1in NormalizationMatch.v - NMatch2:
open_nmatch_2in NormalizationMatch.v - NMatch3:
open_nmatch_3in NormalizationMatch.v
- TVar:
open_tvarin InferMisc.v - TAbs:
open_tabsin InferMisc.v - TApp:
open_tappin InferApp.v - TLet
open_tletin InferApp.v - TNil:
open_tnilin ErasedList.v - TCons:
open_tconsin ErasedList.v - TDots:
open_append_keyin TauProperty.v - TFix:
open_tfixin InferFix.v - TMatch:
open_tmatchin InferMatch.v - TCheck:
open_subtype_reduciblein ReducibilitySubtype.v
- SubTop:
open_subtypein SubtypeMisc.v - SubRefl:
open_subreflin SubtypeMisc.v - SubSing:
open_subsingin SubtypeMisc.v - SubCons1:
open_subcons1in SubtypeList.v - SubCons2:
open_subcons2in SubtypeList.v - SubPi:
open_subpiin SubtypePi.v - SubExistsLeft:
open_sub_exists_leftin SubtypeExists - SubExistsRight:
open_sub_exists_rightin SubtypeExists - SubMatch:
open_submatchin SubtypeMatch.v - SubNorm:
open_subnormin SubtypeNorm.v
