]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/components/cic_proof_checking/freshNamesGenerator.ml
Several instances of the same bug fixed at once: when processing a Fix,
[helm.git] / helm / software / components / cic_proof_checking / freshNamesGenerator.ml
index 3cfda02dff123a649bf51005ed6a0c01647c275d..73b75ce18e7257e876a0d316d934fd95db15350d 100755 (executable)
@@ -193,9 +193,13 @@ let rec mk_fresh_names ~subst metasenv context t =
        let pl' = List.map (mk_fresh_names ~subst metasenv context) pl in
        Cic.MutCase (sp, i, outty', t', pl')
     | Cic.Fix (i, fl) -> 
-        let tys = List.map 
-           (fun (n,_,ty,_) -> 
-             Some (Cic.Name n,(Cic.Decl ty))) fl in
+        let tys,_ =
+          List.fold_left
+            (fun (types,len) (n,_,ty,_) ->
+               (Some (Cic.Name n,(Cic.Decl (CicSubstitution.lift len ty)))::types,
+                len+1)
+           ) ([],0) fl
+        in
        let fl' = List.map 
            (fun (n,i,ty,bo) -> 
              let ty' = mk_fresh_names ~subst metasenv context ty in
@@ -203,9 +207,13 @@ let rec mk_fresh_names ~subst metasenv context t =
              (n,i,ty',bo')) fl in
        Cic.Fix (i, fl') 
     | Cic.CoFix (i, fl) ->
-       let tys = List.map 
-           (fun (n,_,ty) -> 
-             Some (Cic.Name n,(Cic.Decl ty))) fl in
+        let tys,_ =
+          List.fold_left
+            (fun (types,len) (n,ty,_) ->
+               (Some (Cic.Name n,(Cic.Decl (CicSubstitution.lift len ty)))::types,
+                len+1)
+           ) ([],0) fl
+        in
        let fl' = List.map 
            (fun (n,ty,bo) -> 
              let ty' = mk_fresh_names ~subst metasenv context ty in