Extensibella Example: mtc:lambda

Language Specification

File: defs.sos

[Reduce File] [Raw File]
Module mtc:lambda

Builds on mtc:shared_declarations

e ::= ...
    | abs(string, ty, e)
    | app(e, e)
    | var(string)

v ::= ...
    | closure([(string, v)], string, e)

ty ::= ...
     | arrowTy(ty, ty)


typeOf (X, Ty1)::G E Ty2
----------------------------------------- [T-Abs]
typeOf G abs(X, Ty1, E) arrowTy(Ty1, Ty2)


typeOf G E1 arrowTy(Ty1, Ty2)
typeOf G E2 Ty1
----------------------------- [T-App]
typeOf G app(E1, E2) Ty2


lookup G X Ty
------------------ [T-Var]
typeOf G var(X) Ty



-------------------------------------- [E-Abs]
eval G abs(X, Ty1, E) closure(G, X, E)


eval G E1 closure(GC, X, Body)
eval G E2 V2
eval (X, V2)::GC Body V
------------------------------ [E-App]
eval G app(E1, E2) V


lookup G X V
--------------- [E-Var]
eval G var(X) V



typeOfCtx TG G
typeOf (X, Ty1)::TG E Ty2
-------------------------------------------- [VT-Closure]
valueType closure(G, X, E) arrowTy(Ty1, Ty2)



evalStep E1 E11
--------------------------------- [ES-App-Step1]
evalStep app(E1, E2) app(E11, E2)


value E1
evalStep E2 E21
--------------------------------- [ES-App-Step2]
evalStep app(E1, E2) app(E1, E21)


value E2
subst X E2 E1 E
---------------------------------- [ES-App-Subst]
evalStep app(abs(X, Ty, E1), E2) E



------------------- [V-Abs]
value abs(X, Ty, E)



------------------------------------- [S-Abs-Same]
subst X R abs(X, Ty, E) abs(X, Ty, E)


X != Y
subst X R E E1
-------------------------------------- [S-Abs-Diff]
subst X R abs(Y, Ty, E) abs(Y, Ty, E1)


subst X R E1 E11
subst X R E2 E21
----------------------------------- [S-App]
subst X R app(E1, E2) app(E11, E21)


------------------ [S-Var-Same]
subst X R var(X) R


X != Y
----------------------- [S-Var-Diff]
subst X R var(Y) var(Y)



-------------------------------------- [C-ArrowTy]
canon arrowTy(Ty1, Ty2) abs(X, Ty1, E)






---------------------------- [Proj-Abs]
|{e}- abs(X, Ty, E) ~~> nilE


-------------------------- [Proj-App]
|{e}- app(E1, E2) ~~> nilE


--------------------- [Proj-Var]
|{e}- var(X) ~~> nilE


------------------------------- [Proj-Closure]
|{v}- closure(G, X, E) ~~> nilV


---------------------------------- [Proj-ArrowTy]
|{ty}- arrowTy(Ty1, Ty2) ~~> nilTy

Reasoning

[Show All Proofs] [Hide All Proofs] [Raw File]

Click on a command or tactic to see a detailed view of its use.

Module mtc:lambda.

Theorem typeOfCtx_lookups : forall TG EG X Ty V,
  typeOfCtx TG EG -> lookup TG X Ty -> lookup EG X V ->
  valueType V Ty. [Show Proof]



Prove mtc:shared_declarations:type_preservation. [Show Proof]



Prove mtc:shared_declarations:value_evalStep_false. [Show Proof]



Prove mtc:shared_declarations:subst_unique. [Show Proof]



Prove mtc:shared_declarations:evalStep_unique. [Show Proof]



Prove mtc:shared_declarations:ty_lookup. [Show Proof]



Prove mtc:shared_declarations:subst_preservation. [Show Proof]



Prove mtc:shared_declarations:evalStep_type_preservation. [Show Proof]



Prove mtc:shared_declarations:canonical_form. [Show Proof]



Prove mtc:shared_declarations:subst_is. [Show Proof]



Prove mtc:shared_declarations:evalStep_is. [Show Proof]



Prove mtc:shared_declarations:subst_total. [Show Proof]



Prove mtc:shared_declarations:progress. [Show Proof]


Back to example home