aux proof
;;
-let build_goal_proof bag eq l initial ty se context menv =
+let build_goal_proof ?(contextualize=true) ?(forward=false) bag eq l initial ty se context menv =
let se = List.map (fun i -> Cic.Meta (i,[])) se in
let lets = get_duplicate_step_in_wfo bag l initial in
let letsno = List.length lets in
+ let l = if forward then List.rev l else l in
let lift_list l = List.map (fun (i,t) -> i,CicSubstitution.lift 1 t) l in
let lets,_,h =
List.fold_left
| (rule,pos,id,subst,pred)::tl ->
let p,l,r = proof_of_id bag id in
let p = build_proof_term bag eq h letsno p in
- let pos = if pos = Utils.Left then Utils.Right else Utils.Left in
+ let pos = if forward then pos else
+ if pos = Utils.Left then Utils.Right else Utils.Left in
let varname =
match rule with
| SuperpositionLeft -> Cic.Name ("SupL" ^ Utils.string_of_pos pos)
p))
lets (letsno-1,initial)
in
- canonical
- (contextualize_rewrites proof (CicSubstitution.lift letsno ty))
- context menv,
- se
+ let proof =
+ if contextualize
+ then contextualize_rewrites proof (CicSubstitution.lift letsno ty)
+ else proof in
+ canonical proof context menv, se
;;
let refl_proof eq_uri ty term =
let irl = [] in
let newmeta = Cic.Meta(maxmeta,irl) in
let newsubst = Subst.buildsubst i context newmeta ty subst in
- newsubst, (maxmeta,context,ty)::metasenv, maxmeta+1)
+ (* newsubst, (maxmeta,context,ty)::metasenv, maxmeta+1) *)
+ newsubst, (maxmeta,[],ty)::metasenv, maxmeta+1)
to_be_relocated (Subst.empty_subst, [], newmeta+1)
in
- let menv = Subst.apply_subst_metasenv subst menv @ newmetasenv in
+ (* let subst = Subst.flatten_subst subst in *)
+ let menv = Subst.apply_subst_metasenv subst (menv @ newmetasenv) in
subst, menv, newmeta
let fix_metas_goal newmeta goal =
let fix_metas bag newmeta eq =
let w, p, (ty, left, right, o), menv,_ = open_equality eq in
let to_be_relocated =
-(* List.map (fun i ,_,_ -> i) menv *)
+ List.map (fun i ,_,_ -> i) menv
+(*
HExtlib.list_uniq
(List.sort Pervasives.compare
(Utils.metas_of_term left @ Utils.metas_of_term right @
Utils.metas_of_term ty))
+*)
in
let subst, metasenv, newmeta = relocate newmeta menv to_be_relocated in
let ty = Subst.apply_subst subst ty in