+Variable coreVarToWeakVar : CoreVar -> WeakVar. Extract Inlined Constant coreVarToWeakVar => "coreVarToWeakVar".
+
+(* detects our crude Core-encoding of modal type introduction/elimination forms *)
+Definition isBrak (ce:CoreExpr CoreVar) : ??WeakTypeVar :=
+match ce with
+ | (CoreEApp (CoreEApp (CoreEVar v) (CoreEType (TyVarTy ec))) (CoreEType tbody))
+ => if coreName_eq hetmet_brak_name (coreVarCoreName v) then
+ match coreVarToWeakVar v with
+ | WExprVar _ => None
+ | WTypeVar tv => Some tv
+ | WCoerVar _ => None
+ end else None
+ | _ => None
+end.
+Definition isEsc (ce:CoreExpr CoreVar) : ??WeakTypeVar :=
+match ce with
+ | (CoreEApp (CoreEApp (CoreEVar v) (CoreEType (TyVarTy ec))) (CoreEType tbody))
+ => if coreName_eq hetmet_esc_name (coreVarCoreName v) then
+ match coreVarToWeakVar v with
+ | WExprVar _ => None
+ | WTypeVar tv => Some tv
+ | WCoerVar _ => None
+ end else None
+ | _ => None
+end.
+
+Definition coreCoercionToWeakCoercion (cc:CoreCoercion) : WeakCoercion :=
+ let (t1,t2) := coreCoercionKind cc
+ in weakCoercion t1 t2 cc.
+