Correctness of finite chains of independently compiled units. An import-free unit is compiled under the empty context and joined by non-dependent merge. An importing unit is a sandboxed functor, also compiled under the empty context, whose imports are supplied by the preceding chain. No unit is re-elaborated under the accumulated exports.
A nonempty chain of n units, with source composition S, accumulated
exports I, and assembled core term L, using ordinary single-import linking.
Only imports must be unambiguous; unrelated duplicate exports are permitted.
The exports of an import-free unit may themselves include functors.
- start {e : SCE.Exp} {E : SCE.Typ} {c : Core.Exp} (helab : elabExp SCE.Typ.top e E c) : UnitChain 1 e E c
- independent {n : Nat} {S e : SCE.Exp} {I E : SCE.Typ} {L c : Core.Exp} (hchain : UnitChain n S I L) (helab : elabExp SCE.Typ.top e E c) : UnitChain (n + 1) (S.nmrg e) (I.and E) (nmrgCore L c)
- importing {n : Nat} {S body : SCE.Exp} {I A E : SCE.Typ} {l : String} {L c : Core.Exp} (hchain : UnitChain n S I L) (helab : elabExp SCE.Typ.top (SCE.Exp.mfunctor SCE.Sandbox.sandboxed (SCE.Typ.rcd l A) body) ((SCE.Typ.rcd l A).marr E) c) (hlookup : SCE.SRLookup I l A) : UnitChain (n + 1) (S.mlink (SCE.Exp.mfunctor SCE.Sandbox.sandboxed (SCE.Typ.rcd l A) body)) (I.and E) (linkedCore (elabTyp I) (elabTyp (SCE.Typ.rcd l A)) (elabTyp E) L c)
Instances For
Assembling independently compiled units gives exactly the elaboration of their source composition.
The assembled chain is well typed at its accumulated export type.
Evaluation correctness for the whole chain, including import-free steps.
The corresponding chain construction with linkall: an importing unit
declares an interface D satisfied by the accumulated exports.
- start {e : SCE.Exp} {E : SCE.Typ} {c : Core.Exp} (helab : elabExp SCE.Typ.top e E c) : UnitChainN 1 e E c
- independent {n : Nat} {S e : SCE.Exp} {I E : SCE.Typ} {L c : Core.Exp} (hchain : UnitChainN n S I L) (helab : elabExp SCE.Typ.top e E c) : UnitChainN (n + 1) (S.nmrg e) (I.and E) (nmrgCore L c)
- importing {n : Nat} {S body : SCE.Exp} {I D E : SCE.Typ} {L c : Core.Exp} (hchain : UnitChainN n S I L) (helab : elabExp SCE.Typ.top (SCE.Exp.mfunctor SCE.Sandbox.sandboxed D body) (D.marr E) c) (hok : SCE.LinkOk I D) : UnitChainN (n + 1) (S.mlinkn (SCE.Exp.mfunctor SCE.Sandbox.sandboxed D body)) (I.and E) (linkedCore (elabTyp I) (elabTyp D) (elabTyp E) L c)
Instances For
The multi-import assembly is exactly the elaboration of its source chain.
The assembled multi-import chain has its accumulated export type.
Evaluation correctness for the whole multi-import chain.