From 252fbb53c9d41d5d3f94bd9656adde26cd603ae3 Mon Sep 17 00:00:00 2001 From: Claudio Sacerdoti Coen Date: Thu, 17 Nov 2005 16:13:57 +0000 Subject: [PATCH] New tactic rename (for now for internal usage only). --- .../tactics/proofEngineStructuralRules.ml | 29 +++++++++++++++++++ .../tactics/proofEngineStructuralRules.mli | 4 +++ 2 files changed, 33 insertions(+) diff --git a/helm/ocaml/tactics/proofEngineStructuralRules.ml b/helm/ocaml/tactics/proofEngineStructuralRules.ml index 2c641fd84..2e8aa4049 100644 --- a/helm/ocaml/tactics/proofEngineStructuralRules.ml +++ b/helm/ocaml/tactics/proofEngineStructuralRules.ml @@ -154,6 +154,35 @@ let clear ~hyp = in mk_tactic (clear ~hyp) +(* Warning: this tactic has no effect on the proof term. + It just changes the name of an hypothesis in the current sequent *) +let rename ~from ~to_ = + let rename ~from ~to_ (proof, goal) = + let module C = Cic in + let curi,metasenv,pbo,pty = proof in + let metano,context,ty = + CicUtil.lookup_meta goal metasenv + in + let metasenv' = + List.map + (function + (m,canonical_context,ty) when m = metano -> + let canonical_context' = + List.map + (function + Some (Cic.Name hyp,decl_or_def) when hyp = from -> + Some (Cic.Name to_,decl_or_def) + | item -> item + ) canonical_context + in + m,canonical_context',ty + | t -> t + ) metasenv + in + (curi,metasenv',pbo,pty), [goal] + in + mk_tactic (rename ~from ~to_) + let set_goal n = ProofEngineTypes.mk_tactic (fun (proof, goal) -> diff --git a/helm/ocaml/tactics/proofEngineStructuralRules.mli b/helm/ocaml/tactics/proofEngineStructuralRules.mli index 142b82b68..91ebfecfb 100644 --- a/helm/ocaml/tactics/proofEngineStructuralRules.mli +++ b/helm/ocaml/tactics/proofEngineStructuralRules.mli @@ -26,5 +26,9 @@ val clearbody: hyp:string -> ProofEngineTypes.tactic val clear: hyp:string -> ProofEngineTypes.tactic +(* Warning: this tactic has no effect on the proof term. + It just changes the name of an hypothesis in the current sequent *) +val rename: from:string -> to_:string -> ProofEngineTypes.tactic + (* change the current goal to those referred by the given meta number *) val set_goal: int -> ProofEngineTypes.tactic -- 2.39.2