-
-(*
-module R = CicReduction
-
- let rec elim_clear_tac ~term' ~nr_of_hyp_still_to_elim status =
- let (proof, goal) = status in
- warn (lazy ("nr_of_hyp_still_to_elim=" ^ (string_of_int nr_of_hyp_still_to_elim)));
- if nr_of_hyp_still_to_elim <> 0 then
- let _,metasenv,_,_ = proof in
- let _,context,_ = CicUtil.lookup_meta goal metasenv in
- let old_context_len = List.length context in
- let termty,_ =
- CicTypeChecker.type_of_aux' metasenv context term'
- CicUniv.empty_ugraph in
- warn (lazy ("elim_clear termty= " ^ CicPp.ppterm termty));
- match termty with
- C.MutInd (uri,typeno,exp_named_subst)
- | C.Appl((C.MutInd (uri,typeno,exp_named_subst))::_)
- when (List.mem (uri,typeno,exp_named_subst) urilist) ->
- warn (lazy ("elim " ^ CicPp.ppterm termty));
- ProofEngineTypes.apply_tactic
- (T.then_
- ~start:(P.elim_intros_simpl_tac term')
- ~continuation:(
- (* clear the hyp that has just been eliminated *)
- ProofEngineTypes.mk_tactic (fun status ->
- let (proof, goal) = status in
- let _,metasenv,_,_ = proof in
- let _,context,_ = CicUtil.lookup_meta goal metasenv in
- let new_context_len = List.length context in
- warn (lazy ("newcon=" ^ (string_of_int new_context_len) ^ " & oldcon=" ^ (string_of_int old_context_len) ^ " & old_nr_of_hyp=" ^ (string_of_int nr_of_hyp_still_to_elim)));
- let new_nr_of_hyp_still_to_elim = nr_of_hyp_still_to_elim + (new_context_len - old_context_len) - 1 in
- let hyp_name =
- match List.nth context new_nr_of_hyp_still_to_elim with
- None
- | Some (Cic.Anonymous,_) -> assert false
- | Some (Cic.Name name,_) -> name
- in
- ProofEngineTypes.apply_tactic
- (T.then_
- ~start:(
- if (term'==term) (* if it's the first application of elim, there's no need to clear the hyp *)
- then begin debug_print (lazy ("%%%%%%% no clear")); T.id_tac end
- else begin debug_print (lazy ("%%%%%%% clear " ^ (string_of_int (new_nr_of_hyp_still_to_elim)))); (S.clear ~hyp:hyp_name) end)
- ~continuation:(ProofEngineTypes.mk_tactic (elim_clear_tac ~term':(C.Rel new_nr_of_hyp_still_to_elim) ~nr_of_hyp_still_to_elim:new_nr_of_hyp_still_to_elim)))
- status
- )))
- status
- | _ ->
- let new_nr_of_hyp_still_to_elim = nr_of_hyp_still_to_elim - 1 in
- warn (lazy ("fail; hyp=" ^ (string_of_int new_nr_of_hyp_still_to_elim)));
- elim_clear_tac ~term':(C.Rel new_nr_of_hyp_still_to_elim) ~nr_of_hyp_still_to_elim:new_nr_of_hyp_still_to_elim status
- else (* no hyp to elim left in this goal *)
- ProofEngineTypes.apply_tactic T.id_tac status
-
- in
- elim_clear_tac ~term':term ~nr_of_hyp_still_to_elim:1 status
-*)