X-Git-Url: http://git.megacz.com/?p=coq-hetmet.git;a=blobdiff_plain;f=src%2FHaskWeakVars.v;h=61eafcadbce6354be3eb572a9d63678e56aad83c;hp=44e267d0ab21bc49d2cfb98e735ef686a486f24b;hb=32436fdf380f7f2efc7a70896268509e7b3e0d6f;hpb=72d3380355a80135c91e77736f1ebb6ca4f43923 diff --git a/src/HaskWeakVars.v b/src/HaskWeakVars.v index 44e267d..61eafca 100644 --- a/src/HaskWeakVars.v +++ b/src/HaskWeakVars.v @@ -8,7 +8,7 @@ Require Import General. Require Import Coq.Strings.String. Require Import Coq.Lists.List. Require Import HaskKinds. -Require Import HaskCoreLiterals. +Require Import HaskLiteralsAndTyCons. Require Import HaskCoreVars. Require Import HaskCoreTypes. Require Import HaskWeakTypes. @@ -46,54 +46,12 @@ Variable getTyConTyVars_ : CoreTyCon -> list CoreVar. Extract Inlined Const Definition tyConTyVars (tc:CoreTyCon) := General.filter (map (fun x => match coreVarToWeakVar x with WTypeVar v => Some v | _ => None end) (getTyConTyVars_ tc)). Opaque tyConTyVars. -Definition tyConKind (tc:TyCon) : list Kind := - map (fun (x:WeakTypeVar) => x:Kind) (tyConTyVars tc). +Definition tyConKind (tc:TyCon) : list Kind := map (fun (x:WeakTypeVar) => x:Kind) (tyConTyVars tc). Variable rawTyFunKind : CoreTyCon -> Kind. Extract Inlined Constant rawTyFunKind => "(coreKindToKind . TyCon.tyConKind)". Definition tyFunKind (tc:TyFun) : ((list Kind) * Kind) := splitKind (rawTyFunKind tc). -(* -(* EqDecidable instances for all of the above *) -Instance WeakCoerVarEqDecidable : EqDecidable WeakCoerVar. - apply Build_EqDecidable. - intros. - destruct v1 as [cv1 t1a t1b]. - destruct v2 as [cv2 t2a t2b]. - destruct (eqd_dec cv1 cv2); subst. - destruct (eqd_dec t1a t2a); subst. - destruct (eqd_dec t1b t2b); subst. - left; auto. - right; intro; apply n; inversion H; subst; auto. - right; intro; apply n; inversion H; subst; auto. - right; intro; apply n; inversion H; subst; auto. - Defined. - -Instance WeakExprVarEqDecidable : EqDecidable WeakExprVar. - apply Build_EqDecidable. - intros. - destruct v1 as [cv1 k1]. - destruct v2 as [cv2 k2]. - destruct (eqd_dec cv1 cv2); subst. - destruct (eqd_dec k1 k2); subst. - left; auto. - right; intro; apply n; inversion H; subst; auto. - right; intro; apply n; inversion H; subst; auto. - Defined. - -Instance WeakVarEqDecidable : EqDecidable WeakVar. - apply Build_EqDecidable. - induction v1; destruct v2; try (right; intro q; inversion q; fail) ; auto; - destruct (eqd_dec w w0); subst. - left; auto. - right; intro X; apply n; inversion X; auto. - left; auto. - right; intro X; apply n; inversion X; auto. - left; auto. - right; intro X; apply n; inversion X; auto. - Defined. -*) - Instance WeakVarToString : ToString WeakVar := - { toString := fun x => toString (weakVarToCoreVar x) }. \ No newline at end of file + { toString := fun x => toString (weakVarToCoreVar x) }.