From b808931a8bfa434543229fb8e39eca979686f302 Mon Sep 17 00:00:00 2001 From: Kathy Gray Date: Tue, 9 Dec 2014 15:24:58 +0000 Subject: Some of the type rules for expressions --- language/l2_rules.ott | 57 +++++++++++++++++++++++++-------------------------- language/l2_typ.ott | 1 + 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/language/l2_rules.ott b/language/l2_rules.ott index 5cdf762b..5c4229a7 100644 --- a/language/l2_rules.ott +++ b/language/l2_rules.ott @@ -719,33 +719,29 @@ E , t |- exp : t' gives exp' , I , E_t :: :: check_exp :: check_exp_ {{ com Typing expressions, collecting nexp constraints, effects, and new bindings }} by - |- exp : u gives ,E_t1 -E_d |- exp : u :> t,exp', S_N2 ------------------------------------------------------------- :: coerce - |- exp : t gives ,E_t1 - -E_t(id) gives t ------------------------------------------------------------- :: var - |- id : t gives Ie,E_t - -E_t(id) gives register t ------------------------------------------------------------- :: reg - |- id : t gives <{},{rreg}>,E_t - -E_t(id) gives reg t ------------------------------------------------------------ :: local - |- id : t gives Ie,E_t - -E_t(id) gives { ki//i/>},S_N,tag,u -t = u [] ------------------------------------------------------------ :: ty_app - |- id : t gives ,E_t - -% Need to take into account possible type variables here -E_t(id) gives t' -> t {} Ctor {} - |- exp : t' gives I,E_t +E_t(id) gives {tid0|->kinf0, .., tidn |-> kinfn}, {},Ctor, unit -> x pure +u == x [ t_arg0/tid0 .. t_argn/tidn] +E_d |- u ~< t,S_N +----------------------------------------------------------- :: unaryCtor +,t |- id : x gives id, ,{} + +E_t(id) gives {}, {},tag,u +E_d,t |- id : u gives t', exp, S_N, effect +------------------------------------------------------------ :: localVar +,t |- id : u gives id, ,{} + +E_t(id) gives {tid1|->kinf1, .., tidn |-> kinfn}, S_N,tag,u' +u == u'[t_arg1/tid1 .. t_argn/tidn] +E_d,t |- id : u gives t', exp, S_N', effect +------------------------------------------------------------ :: otherVar +,t |- id : u gives id,,{} + +E_t(id) gives {tid0|->kinf0, .., tidn |-> kinfn}, {},Ctor, t'' -> x pure +t' -> u pure == t'' -> x pure [ t_arg0/tid0 .. t_argn/tidn] +E_d |- u ~< t,S_N +,t' |- exp : u' gives exp, ,E_t' ------------------------------------------------------------ :: ctor - |- :E_app: id(exp) : t gives I,E_t +,t |- :E_app: id(exp) : t gives :E_app: id(exp'), ,{} % Need to take into account possible type variables on result of id E_t(id) gives t' -> t effect tag S_N @@ -758,10 +754,13 @@ E_t(id) gives t' -> t effect tag S_N ------------------------------------------------------------ :: infix_app |- :E_app_infix: exp1 id exp2 : t gives I u+ , E_t -E_r() gives id t_args, -> |- expi : ti gives Ii,E_t//i/> +E_r() gives x, +>,ti |- expi : ui gives exp'i,,E_t//i/> + |- ui ~< ti,S_N'i//i/> +S_N == u+ +S_N' == u+ ------------------------------------------------------------ :: record -> |- { semi_opt} : id t_args gives u+ , E_t +>,t |- { semi_opt} : x gives{ semi_opt}, u+ >, {} > |- exp : id t_args gives I,E_t E_r(id t_args) gives diff --git a/language/l2_typ.ott b/language/l2_typ.ott index 65857331..9d8a5a64 100644 --- a/language/l2_typ.ott +++ b/language/l2_typ.ott @@ -112,6 +112,7 @@ ne :: 'Ne_' ::= | ne :: :: nexp | effect :: :: effect | order :: :: order + | fresh :: M :: freshvar {{ lem T_arg (T_var "fresh") }} t_args :: '' ::= {{ lem list t_arg }} {{ com Arguments to type constructors }} -- cgit v1.2.3