X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Focaml%2Ftactics%2FproofEngineStructuralRules.ml;h=8995fbbeb8443ebed4cac5fd963b4b304483c7a7;hb=4167cea65ca58897d1a3dbb81ff95de5074700cc;hp=2c641fd84f9ee3e48d625951bc970d35a61ed4e2;hpb=8b55faddb06e3c4b0a13839210bb49170939b33e;p=helm.git diff --git a/helm/ocaml/tactics/proofEngineStructuralRules.ml b/helm/ocaml/tactics/proofEngineStructuralRules.ml index 2c641fd84..8995fbbeb 100644 --- a/helm/ocaml/tactics/proofEngineStructuralRules.ml +++ b/helm/ocaml/tactics/proofEngineStructuralRules.ml @@ -118,8 +118,8 @@ let clear ~hyp = Some (Cic.Name hyp',_) when hyp' = hyp -> (true, None::context) | None -> (b, None::context) - | Some (_,Cic.Def (_,Some _)) -> assert false | Some (n,C.Decl t) + | Some (n,Cic.Def (t,Some _)) | Some (n,C.Def (t,None)) -> if b then let _,_ = @@ -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) ->