]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/cic_proof_checking/cicSubstitution.ml
removed no longer used METAs
[helm.git] / helm / ocaml / cic_proof_checking / cicSubstitution.ml
index 2abce6a0edc635fbfffc3df5bd40c4bf990fc78d..a30a036cb42dc7726c1720906d706f903b0fcf30 100644 (file)
@@ -23,6 +23,8 @@
  * http://cs.unibo.it/helm/.
  *)
 
+(* $Id$ *)
+
 exception CannotSubstInMeta;;
 exception RelToHiddenHypothesis;;
 exception ReferenceToVariable;;
@@ -121,7 +123,7 @@ let subst arg =
         List.map (function (uri,t) -> (uri,substaux k t)) exp_named_subst
        in
         C.Var (uri,exp_named_subst')
-    | C.Meta (i, l) as t -> 
+    | C.Meta (i, l) -> 
        let l' =
         List.map
          (function
@@ -189,9 +191,9 @@ let subst arg =
 (*CSC: dovrebbe diventare da sinistra verso destra:                      *)
 (*CSC: t{a=a/A;b/a} ==> \H:a=a.H{b/a} ==> \H:b=b.H                       *)
 (*CSC: per la roba che proviene da Coq questo non serve!                 *)
-let subst_vars exp_named_subst =
+let subst_vars exp_named_subst =
 (*
-debug_print ("@@@POSSIBLE BUG: SUBSTITUTION IS NOT SIMULTANEOUS") ;
+debug_print (lazy ("@@@POSSIBLE BUG: SUBSTITUTION IS NOT SIMULTANEOUS")) ;
 *)
  let rec substaux k =
   let module C = Cic in
@@ -216,21 +218,21 @@ debug_print ("@@@POSSIBLE BUG: SUBSTITUTION IS NOT SIMULTANEOUS") ;
            )
           in
 (*
-debug_print "\n\n---- BEGIN " ;
-debug_print ("----params: " ^ String.concat " ; " (List.map UriManager.string_of_uri params)) ;
-debug_print ("----S(" ^ UriManager.string_of_uri uri ^ "): " ^ String.concat " ; " (List.map (function (uri,_) -> UriManager.string_of_uri uri) exp_named_subst)) ;
-debug_print ("----P: " ^ String.concat " ; " (List.map (function (uri,_) -> UriManager.string_of_uri uri) exp_named_subst')) ;
+debug_print (lazy "\n\n---- BEGIN ") ;
+debug_print (lazy ("----params: " ^ String.concat " ; " (List.map UriManager.string_of_uri params))) ;
+debug_print (lazy ("----S(" ^ UriManager.string_of_uri uri ^ "): " ^ String.concat " ; " (List.map (function (uri,_) -> UriManager.string_of_uri uri) exp_named_subst))) ;
+debug_print (lazy ("----P: " ^ String.concat " ; " (List.map (function (uri,_) -> UriManager.string_of_uri uri) exp_named_subst'))) ;
 *)
            let exp_named_subst'' =
             substaux_in_exp_named_subst uri k exp_named_subst' params
            in
 (*
-debug_print ("----D: " ^ String.concat " ; " (List.map (function (uri,_) -> UriManager.string_of_uri uri) exp_named_subst'')) ;
-debug_print "---- END\n\n " ;
+debug_print (lazy ("----D: " ^ String.concat " ; " (List.map (function (uri,_) -> UriManager.string_of_uri uri) exp_named_subst''))) ;
+debug_print (lazy "---- END\n\n ") ;
 *)
             C.Var (uri,exp_named_subst'')
        )
-    | C.Meta (i, l) as t -> 
+    | C.Meta (i, l) -> 
        let l' =
         List.map
          (function
@@ -331,18 +333,19 @@ debug_print "---- END\n\n " ;
     | _::tl -> filter_and_lift tl
 (*
     | (uri,_)::tl ->
-debug_print ("---- SKIPPO " ^ UriManager.string_of_uri uri) ;
+debug_print (lazy ("---- SKIPPO " ^ UriManager.string_of_uri uri)) ;
 if List.for_all (function (uri',_) -> not (UriManager.eq uri uri'))
-exp_named_subst' then debug_print "---- OK1" ;
-debug_print ("++++ uri " ^ UriManager.string_of_uri uri ^ " not in " ^ String.concat " ; " (List.map UriManager.string_of_uri params)) ;
-if List.mem uri params then debug_print "---- OK2" ;
+exp_named_subst' then debug_print (lazy "---- OK1") ;
+debug_print (lazy ("++++ uri " ^ UriManager.string_of_uri uri ^ " not in " ^ String.concat " ; " (List.map UriManager.string_of_uri params))) ;
+if List.mem uri params then debug_print (lazy "---- OK2") ;
         filter_and_lift tl
 *)
   in
    List.map (function (uri,t) -> (uri,substaux k t)) exp_named_subst' @
     (filter_and_lift exp_named_subst)
  in
-  substaux 1
+  if exp_named_subst = [] then t
+  else substaux 1 t
 ;;
 
 (* subst_meta [t_1 ; ... ; t_n] t                                *)