This repository contains some Coq developments for type systems related to linear logic. Some of the developments have been reported on in the following papers:
- Relational Parametricity for Polymorphic Linear Lambda Calculus
- Lightweight linear types in System F^o
- Lolliproc: to Concurrency from Classical Linear Logic via Curry-Howard and Control
- A Linear/Producer/Consumer model of Classical Linear Logic
This repository is quite old and the Coq code hasn't been compiled in quite a while. The bulk of the Coq development took place using Coq v. 8.2 and some of the developments rely on Penn's Metatheory Library. (See 'Dependencies' below.)
The formalism includes:
-
Proofs about the safety, logical relations, parametricity, contextual equivalence, and applications of PDILL (a term calculus of Polymorphic Dual Intuitionistic Linear Logic), and Linear System F^o (LinF) with additive products type [1],
-
Proofs about the safety, logical relations, parametricity, and applications of (CBV and CBN) System F.
-
Some experiments with other formulations of linear type systems.
The code run with Coq 8.2pl1 (July. 2009).
- DIRECTORY : linf Contents
-
Extra.v general metalib lemmas
-
LinF_Definitions.v syntax and typings
-
LinF_Infrastructure.v metalib lemmas for linf
-
LinF_Lemmas.v supporting lemmas
-
LinF_Soundness.v preservation and progress
-
LinF_ExtraLemmas.v additional lemmas
-
DESCRIPTION : Proofs of the safety of LinF with additive products type
- DIRECTORY : parametricity Contents
-
ExtraMetalib.v general metalib lemmas
-
LinF_PreLib.v supporting lemmas of metalib
-
LinF_Parametricity_Pre.v supporting lemmas of relations
-
LinF_Parametricity_Interface.v signature of logical relations
-
LinF_Parametricity_Macro.v macro lemmas
-
LinF_Parametricity.v parametricity
-
LinF_Parametricity_App.v applications
-
LinF_ContextualEq_Def. definitions of contexts
-
LinF_ContextualEq_Lemmas.v supporting lemmas of contexts
-
LinF_ContextualEq_Sound.v sound to contextual equivalence
-
LinF_ContextualEq_Prop.v properties of contextual equivalence
-
LinF_ContextualEq_Complete.v complete to contextual equivalence
-
DESCRIPTION : Proofs about the standard parametricity of LinF, which interprets types on closed relations.
- DIRECTORY : parametricity Contents
-
LinF_Renaming.v lemmas for variables renaming
-
LinF_OParametricity_Pre.v supporting lemmas of relations
-
LinF_OParametricity_Interface.v signature of logical relations
-
LinF_OParametricity_Macro.v macro lemmas
-
LinF_OParametricity.v parametricity
-
LinF_OParametricity_App.v applications
-
LinF_OContextualEq_Lemmas.v supporting lemmas of
-
LinF_OContextualEq_Sound.v sound to contextual equivalence
-
DESCRIPTION : Proofs about the novel parametricity of LinF, which interprets types on open relations.
- DIRECTORY : bang Contents
-
Extra.v general metalib lemmas
-
Bang_Definitions.v syntax and typings
-
Bang_Infrastructure.v metalib lemmas for linf
-
Bang_Lemmas.v supporting lemmas
-
Bang_Soundness.v preservation and progress
-
Bang_ExtraLemmas.v additional lemmas
-
ExtraMetalib.v general metalib lemmas
-
Bang_PreLib.v supporting lemmas of metalib
-
Bang_Parametricity_Pre.v supporting lemmas of relations
-
Bang_Parametricity_Interface.v signature of logical relations
-
Bang_Parametricity_Macro.v macro lemmas
-
Bang_Parametricity.v parametricity
-
Bang_Parametricity_App.v applications
-
Bang_ContextualEq_Def. definitions of contexts
-
Bang_ContextualEq_Lemmas.v supporting lemmas of contexts
-
Bang_ContextualEq_Sound.v sound to contextual equivalence
-
Bang_ContextualEq_Prop.v properties of contextual equivalence
-
Bang_ContextualEq_Complete.v complete to contextual equivalence
-
Bang_Renaming.v lemmas for variables renaming
-
Bang_OParametricity_Pre.v supporting lemmas of relations
-
Bang_OParametricity_Interface.v signature of logical relations
-
Bang_OParametricity_Macro.v macro lemmas
-
Bang_OParametricity.v parametricity
-
Bang_OParametricity_App.v applications
-
Bang_OParametricity_App2.v applications
-
Bang_OContextualEq_Lemmas.v supporting lemmas of contexts
-
Bang_OContextualEq_Sound.v sound to contextual equivalence
-
DESCRIPTION : Proofs of the safety, closed parametricity, and open parametricity for Bang.
- DIRECTORIES:
algorithmic
andsetalgo
DESCRIPTION : Experimental formulation of "standard" linear type system using algorithmic typing judgments that compute the "residual" resources.
You will probably need
- Coq 8.2pl1 (June. 2009) [2].
- A Coq library for programming language metatheory (20090714) [3].
This directory contains a corresponding metatheory library. So you can compile the code without additional installations.
[1] Karl Mazurak, Jianzhou Zhao, and Steve Zdancewic. Lightweight linear types in system F^o. 2009. Unpublished Draft. [2] http://coq.inria.fr/ [3] http://www.plclub.org/metalib
Compiling and using this software:
- Run 'make' in ll/coq/linf
- Run 'make' in ll/coq/parametricity
- Run 'make' in ll/coq/bang
- Run 'make' in ll/sf/cbv, ll/sf/cbn and ll/sf/ocbv
- The code in ll/coq/linf formalizes LinF with additive products type. It does not formalize Boolean types at section 3.3, and multiplicative products type at section 4.3. The corresponding parametricity proofs do not cover these two types either.
Our contextual equivalence observes outcomes of complete programs by values of
a base type,
[ \begin{array}{rll} [[ GG ; 0 |- v ~~ v' isin Bool : s ]] & \triangleq & ([[v]] = [[true]] \land [[v']] = [[true]]) \lor ([[v]] = [[false]] \land [[v']] = [[false]]) \ \end{array} ]
We assume the following encodings to represent
Definition Two := (typ_all kn_nonlin (typ_arrow kn_nonlin (typ_bvar 0) (typ_arrow kn_nonlin (typ_bvar 0) (typ_bvar 0)))). Definition tt := (exp_tabs kn_nonlin (exp_abs kn_nonlin (typ_bvar 0) (exp_abs kn_nonlin (typ_bvar 0) (exp_bvar 1)))). Definition ff := (exp_tabs kn_nonlin (exp_abs kn_nonlin (typ_bvar 0) (exp_abs kn_nonlin (typ_bvar 0) (exp_bvar 0)))).
Also, we assume that logical relations are consistent at type
LinF_ContextualEq_Sound.v:
Axiom F_related_values__consistent : forall v v',
F_related_values Two nil nil nil v v' ->
((v = tt /\ v' =tt) \/ (v = ff /\ v' =ff)).
LinF_OContextualEq_Sound.v:
Axiom F_Related_ovalues__consistent : forall v v',
F_Related_ovalues Two nil nil nil v v' nil nil->
((v = tt /\ v' =tt) \/ (v = ff /\ v' =ff)).
The Bang formalism in ll/coq/bang uses the follow encodings for
Definition Two := (typ_all (typ_arrow (typ_bang (typ_bvar 0)) (typ_arrow (typ_bang (typ_bvar 0)) (typ_bang (typ_bvar 0))))).
Definition tt := (exp_tabs
(exp_abs
(typ_bang (typ_bvar 0))
(exp_let
(exp_bvar 0)
(exp_abs
(typ_bang (typ_bvar 0))
(exp_let
(exp_bvar 0)
(exp_bang 2)
)
)
)
)
).
Definition ff := (exp_tabs
(exp_abs
(typ_bang (typ_bvar 0))
(exp_let
(exp_bvar 0)
(exp_abs
(typ_bang (typ_bvar 0))
(exp_let
(exp_bvar 0)
(exp_bang 0)
)
)
)
)
).
- When proving Compositionality', another subtlety is that the relation
${ ([[v]], [[v']]) | , \exists [[DD]], [[GG; DD |- v ~~ v' isin t : s]] }$ must satisfy weakening on$[[s]]$ .
\begin{lemma}[Compositionality']
\label{lem-osubst'}
By induction on the type structure of
The current version of metatheory [3] does not support name spaces separation. Therefore, we assume two axioms in LinF_OParametricity.v:
Axiom ddom_gdom_disjoint : forall X x E,
X `in` ddom_env E ->
x `in` gdom_env E ->
X <> x.
Axiom ddom_ldom_disjoint : forall X x E (lE:lenv),
X `in` ddom_env E ->
x `in` dom lE ->
X <> x.
They state exactly the idea that type variables and term variables are in different name spaces, and the proofs only use these axioms at the above case to show that relation can be weaken.
The Bang formalism in ll/coq/bang also makes the same assumptions.