- let in_subst_domain i =
- let eq_to_i = function (j,_) -> i=j in
- List.exists eq_to_i subst1 ||
- List.exists eq_to_i subst2
- in
- (* When unwinding the META that corresponds to the elimination *)
- (* predicate (which is emeta), we must also perform one-step *)
- (* beta-reduction. apply_subst doesn't need the context. Hence *)
- (* the underscore. *)
- let apply_subst _ t =
- let t' = CicMetaSubst.apply_subst subst1 t in
- CicMetaSubst.apply_subst_reducing
- (Some (emeta,List.length fargs)) subst2 t'
- in
- let old_uninstantiatedmetas,new_uninstantiatedmetas =
- classify_metas newmeta in_subst_domain apply_subst
- newmetasenv''
- in
- let arguments' = List.map (apply_subst context) arguments in
- let bo' = Cic.Appl (eliminator_ref::arguments') in
- let newmetasenv''' =
- new_uninstantiatedmetas@old_uninstantiatedmetas
- in
- let (newproof, newmetasenv'''') =
- (* When unwinding the META that corresponds to the *)
- (* elimination predicate (which is emeta), we must *)
- (* also perform one-step beta-reduction. *)
- (* The only difference w.r.t. apply_subst is that *)
- (* we also substitute metano with bo'. *)
- (*CSC: Nota: sostituire nuovamente subst1 e' superfluo, *)
- (*CSC: no? *)
- let apply_subst' t =
- let t' = CicMetaSubst.apply_subst subst1 t in
- CicMetaSubst.apply_subst_reducing
- (Some (emeta,List.length fargs))
- ((metano,bo')::subst2) t'
- in
- subst_meta_and_metasenv_in_proof
- proof metano apply_subst' newmetasenv'''
- in
- (newproof,
- List.map (function (i,_,_) -> i) new_uninstantiatedmetas)