- | C.Meta (i,l) as t->
- (try
- let t' = List.assoc i subst in
- aux metasenv subst n context t'
- with
- Not_found -> subst,metasenv,t)
+ | C.Meta (i,l) ->
+ (* andrea: in general, beta_expand can create badly typed
+ terms. This happens quite seldom in practice, UNLESS we
+ iterate on the local context. For this reason, we renounce
+ to iterate and just lift *)
+ let l =
+ List.map
+ (function
+ Some t -> Some (CicSubstitution.lift 1 t)
+ | None -> None) l in
+ subst, metasenv, C.Meta (i,l)
+ (*
+ let (subst, metasenv, context, local_context) =
+ List.fold_right
+ (fun t (subst, metasenv, context, local_context) ->
+ match t with
+ | None -> (subst, metasenv, context, None :: local_context)
+ | Some t ->
+ let (subst, metasenv, t) =
+ aux metasenv subst n context t
+ in
+ (subst, metasenv, context, Some t :: local_context))
+ l (subst, metasenv, context, [])
+ in
+ prerr_endline ("nuova meta :" ^ (CicPp.ppterm (C.Meta (i, local_context))));
+ (subst, metasenv, C.Meta (i, local_context)) *)