]> matita.cs.unibo.it Git - helm.git/commitdiff
- the result of a refinement is now cleared from dummy dependent types
authorClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Thu, 5 Feb 2004 14:11:01 +0000 (14:11 +0000)
committerClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Thu, 5 Feb 2004 14:11:01 +0000 (14:11 +0000)
  and letins
- freshNameGenerator: bug fixed

helm/ocaml/cic_unification/cicRefine.ml
helm/ocaml/cic_unification/freshNamesGenerator.ml

index 85c171b14973704f524451621f21847d1eb17c12..c9c8f4d8256184569ea8662a2416b3aeaefc74e3 100644 (file)
@@ -532,11 +532,42 @@ and type_of_aux' metasenv context t =
   let ty,subst',metasenv' =
    type_of_aux [] metasenv context t
   in
-   (FreshNamesGenerator.clean_dummy_dependent_types
-     (CicMetaSubst.apply_subst subst' t),
-    FreshNamesGenerator.clean_dummy_dependent_types
-     (CicMetaSubst.apply_subst subst' ty),
-    CicMetaSubst.apply_subst_metasenv subst' metasenv')
+   let substituted_t = CicMetaSubst.apply_subst subst' t in
+   let substituted_ty = CicMetaSubst.apply_subst subst' ty in
+   let substituted_metasenv =
+    CicMetaSubst.apply_subst_metasenv subst' metasenv'
+   in
+    let cleaned_t =
+     FreshNamesGenerator.clean_dummy_dependent_types substituted_t in
+    let cleaned_ty =
+     FreshNamesGenerator.clean_dummy_dependent_types substituted_ty in
+    let cleaned_metasenv =
+     List.map
+      (function (n,context,ty) ->
+        let ty' = FreshNamesGenerator.clean_dummy_dependent_types ty in
+        let context' =
+         List.map
+          (function
+              None -> None
+            | Some (n, Cic.Decl t) ->
+               Some (n,
+                Cic.Decl (FreshNamesGenerator.clean_dummy_dependent_types t))
+            | Some (n, Cic.Def (bo,ty)) ->
+               let bo' = FreshNamesGenerator.clean_dummy_dependent_types bo in
+               let ty' =
+                match ty with
+                   None -> None
+                 | Some ty ->
+                    Some (FreshNamesGenerator.clean_dummy_dependent_types ty)
+               in
+                Some (n, Cic.Def (bo',ty'))
+          ) context
+        in
+         (n,context',ty')
+      ) substituted_metasenv
+    in
+     (cleaned_t,cleaned_ty,cleaned_metasenv)
+
 ;;
 
 (* DEBUGGING ONLY *)
index 3664b4a72473008ec526a83049df98ae0922b340..80a26888f320b0e10a2a1723715fe1f52a0c75f2 100644 (file)
@@ -69,7 +69,7 @@ let clean_dummy_dependent_types t =
  let module C = Cic in
   let rec aux k =
    function
-      C.Rel m as t -> t,[m - k]
+      C.Rel m as t -> t,[k - m]
     | C.Var (uri,exp_named_subst) ->
        let exp_named_subst',rels = 
         List.fold_right