+let rec look_ahead aux = function
+ | Cic.Appl ((Cic.Const(uri_ind,ens))::tl) as t
+ when LibraryObjects.is_eq_ind_URI uri_ind ||
+ LibraryObjects.is_eq_ind_r_URI uri_ind ->
+ let ty1,what,pred,p1,other,p2 = open_eq_ind tl in
+ let ty2,eq,lp,rp = open_pred pred in
+ let hole = Cic.Implicit (Some `Hole) in
+ let ty2 = CicSubstitution.subst hole ty2 in
+ aux ty1 (CicSubstitution.subst other lp) (CicSubstitution.subst other rp) hole ty2 t
+ | Cic.Lambda (n,s,t) -> Cic.Lambda (n,s,look_ahead aux t)
+ | t -> t
+;;
+