Documentation

LeanSce.SCE.Sepcomp

Separate compilation: the linker's step on compiled units (CoreLink, CoreLinkN) is well-typed and evaluates in lock-step with source-level link / linkall.

def linkSCE (e₁ e₂ : SCE.Exp) :
Equations
Instances For
    theorem separate_compilation {Γ Γ₁ A B : SCE.Typ} {l : String} {es₁ es₂ : SCE.Exp} {ec₁ ec₂ ec : Core.Exp} {ρs vs : SCE.Exp} {ρc : Core.Exp} (helab₁ : elabExp Γ es₁ Γ₁ ec₁) (helab₂ : elabExp Γ es₂ ((SCE.Typ.rcd l A).marr B) ec₂) (hlookup : SCE.SRLookup Γ₁ l A) (hlink : CoreLink l (elabTyp Γ₁) (elabTyp A) (elabTyp B) ec₁ ec₂ ec) (heval : S_Sem.BStep ρs (es₁.mlink es₂) vs) (henv : elabExp SCE.Typ.top ρs Γ ρc) (henv_val : SCE.Value ρs) :
    ∃ (vc : Core.Exp), EBig ρc ec vc ∧ elabExp SCE.Typ.top vs (Γ₁.and B) vc

    Separate compilation (binary link). Elaborate the provider and the functor separately, compose the compiled pieces with the linker's step, and the result evaluates in lock-step with source-level link.

    theorem separate_compilation_sandboxed {Γ Γ₁ A B : SCE.Typ} {l : String} {es₁ body : SCE.Exp} {ec₁ ec₂ ec : Core.Exp} {ρs vs : SCE.Exp} {ρc : Core.Exp} (helab₁ : elabExp Γ es₁ Γ₁ ec₁) (helab₂ : elabExp SCE.Typ.top (SCE.Exp.mfunctor SCE.Sandbox.sandboxed (SCE.Typ.rcd l A) body) ((SCE.Typ.rcd l A).marr B) ec₂) (hlookup : SCE.SRLookup Γ₁ l A) (hlink : CoreLink l (elabTyp Γ₁) (elabTyp A) (elabTyp B) ec₁ ec₂ ec) (heval : S_Sem.BStep ρs (es₁.mlink (SCE.Exp.mfunctor SCE.Sandbox.sandboxed (SCE.Typ.rcd l A) body)) vs) (henv : elabExp SCE.Typ.top ρs Γ ρc) (henv_val : SCE.Value ρs) :
    ∃ (vc : Core.Exp), EBig ρc ec vc ∧ elabExp SCE.Typ.top vs (Γ₁.and B) vc

    Separate compilation reuses a sandboxed client elaborated under the empty context with a compatible provider in any ambient context.

    theorem separate_compilation_closed {Γ₁ A B : SCE.Typ} {l : String} {es₁ es₂ : SCE.Exp} {ec₁ ec₂ : Core.Exp} {vs : SCE.Exp} (helab₁ : elabExp SCE.Typ.top es₁ Γ₁ ec₁) (helab₂ : elabExp SCE.Typ.top es₂ ((SCE.Typ.rcd l A).marr B) ec₂) (hlookup : SCE.SRLookup Γ₁ l A) (heval : S_Sem.BStep SCE.Exp.unit (es₁.mlink es₂) vs) :
    ∃ (vc : Core.Exp), EBig Core.Exp.unit (linkedCore (elabTyp Γ₁) (elabTyp (SCE.Typ.rcd l A)) (elabTyp B) ec₁ ec₂) vc ∧ elabExp SCE.Typ.top vs (Γ₁.and B) vc

    Separate compilation, closed — the toolchain's actual case: closed compiled units, empty initial environment.

    inductive CoreLinkN :

    The linker's n-ary step: the provider is wired to every import of the elaborated interface ⟦D⟧ by projection from its single binding.

    Instances For
      theorem core_linkn_typed {Γ₁ D : SCE.Typ} {Γc B : Core.Typ} {ec₁ ec₂ ec : Core.Exp} (hlink : CoreLinkN D (elabTyp Γ₁) B ec₁ ec₂ ec) (hok : SCE.LinkOk Γ₁ D) (h₁ : HasType Γc ec₁ (elabTyp Γ₁)) (h₂ : HasType Γc ec₂ ((elabTyp D).arr B)) :
      HasType Γc ec ((elabTyp Γ₁).and B)
      theorem separate_compilation_n {Γ Γ₁ D B : SCE.Typ} {es₁ es₂ : SCE.Exp} {ec₁ ec₂ ec : Core.Exp} {ρs vs : SCE.Exp} {ρc : Core.Exp} (helab₁ : elabExp Γ es₁ Γ₁ ec₁) (helab₂ : elabExp Γ es₂ (D.marr B) ec₂) (hok : SCE.LinkOk Γ₁ D) (hlink : CoreLinkN D (elabTyp Γ₁) (elabTyp B) ec₁ ec₂ ec) (heval : S_Sem.BStep ρs (es₁.mlinkn es₂) vs) (henv : elabExp SCE.Typ.top ρs Γ ρc) (henv_val : SCE.Value ρs) :
      ∃ (vc : Core.Exp), EBig ρc ec vc ∧ elabExp SCE.Typ.top vs (Γ₁.and B) vc

      Separate compilation (n-ary linkall). As above, with a whole import interface D wired by projection from the once-bound provider.

      theorem separate_compilation_n_sandboxed {Γ Γ₁ D B : SCE.Typ} {es₁ body : SCE.Exp} {ec₁ ec₂ ec : Core.Exp} {ρs vs : SCE.Exp} {ρc : Core.Exp} (helab₁ : elabExp Γ es₁ Γ₁ ec₁) (helab₂ : elabExp SCE.Typ.top (SCE.Exp.mfunctor SCE.Sandbox.sandboxed D body) (D.marr B) ec₂) (hok : SCE.LinkOk Γ₁ D) (hlink : CoreLinkN D (elabTyp Γ₁) (elabTyp B) ec₁ ec₂ ec) (heval : S_Sem.BStep ρs (es₁.mlinkn (SCE.Exp.mfunctor SCE.Sandbox.sandboxed D body)) vs) (henv : elabExp SCE.Typ.top ρs Γ ρc) (henv_val : SCE.Value ρs) :
      ∃ (vc : Core.Exp), EBig ρc ec vc ∧ elabExp SCE.Typ.top vs (Γ₁.and B) vc

      Multi-import separate compilation reuses a sandboxed client elaborated under the empty context with a compatible provider in any ambient context.

      theorem separate_compilation_n_closed {Γ₁ D B : SCE.Typ} {es₁ es₂ : SCE.Exp} {ec₁ ec₂ : Core.Exp} {vs : SCE.Exp} (helab₁ : elabExp SCE.Typ.top es₁ Γ₁ ec₁) (helab₂ : elabExp SCE.Typ.top es₂ (D.marr B) ec₂) (hok : SCE.LinkOk Γ₁ D) (heval : S_Sem.BStep SCE.Exp.unit (es₁.mlinkn es₂) vs) :
      ∃ (vc : Core.Exp), EBig Core.Exp.unit (linkedCore (elabTyp Γ₁) (elabTyp D) (elabTyp B) ec₁ ec₂) vc ∧ elabExp SCE.Typ.top vs (Γ₁.and B) vc

      Separate compilation, n-ary, closed.