+(* clean_up_meta take a substitution, a metasenv a meta_inex and a local
+context l and clean up l with respect to the hidden hipothesis in the
+canonical context *)
+
+let clean_up_local_context subst metasenv n l =
+ let cc =
+ (try
+ let (cc,_) = lookup_subst n subst in cc
+ with Subst_not_found _ ->
+ try
+ let (_,cc,_) = lookup_meta n metasenv in cc
+ with Meta_not_found _ -> assert false) in
+ (try
+ List.map2
+ (fun t1 t2 ->
+ match t1,t2 with
+ None , _ -> None
+ | _ , t -> t) cc l
+ with
+ Invalid_argument _ -> assert false)
+