]> matita.cs.unibo.it Git - helm.git/commitdiff
Replace is now working also over Type.
authorClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Fri, 5 Sep 2003 14:31:16 +0000 (14:31 +0000)
committerClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Fri, 5 Sep 2003 14:31:16 +0000 (14:31 +0000)
helm/ocaml/tactics/equalityTactics.ml

index 1d7c2f69cf5f1f70b08508362e200f6c92fdb75d..1c2a7d37fb1a83fc9e15cfc9ec989088a9af57f5 100644 (file)
@@ -159,22 +159,30 @@ let replace_tac ~what ~with_what ~status:((proof, goal) as status) =
      let wty = CicTypeChecker.type_of_aux' metasenv context what in
       try
       if (wty = (CicTypeChecker.type_of_aux' metasenv context with_what))
-       then T.thens
-              ~start:(
-                P.cut_tac 
-                 (C.Appl [
-                   (C.MutInd ((U.uri_of_string "cic:/Coq/Init/Logic/eq.ind"), 0, [])) ; (* quale uguaglianza usare, eq o eqT ? *)
-                     wty ; 
-                     what ; 
-                     with_what]))
-              ~continuations:[
-                T.then_
-                   ~start:(rewrite_simpl_tac ~term:(C.Rel 1))
-                   ~continuation:(
-                     ProofEngineStructuralRules.clear
-                      ~hyp:(List.hd context)) ;
-                T.id_tac]
-              ~status
+       then
+        let equality =
+         match CicTypeChecker.type_of_aux' metasenv context wty with
+            C.Sort C.Set -> "cic:/Coq/Init/Logic/eq.ind"
+          | C.Sort C.Type
+          | C.Sort C.Prop -> "cic:/Coq/Init/Logic_Type/eqT.ind"
+          | _ -> assert false
+        in
+         T.thens
+          ~start:(
+            P.cut_tac 
+             (C.Appl [
+               (C.MutInd ((U.uri_of_string equality), 0, [])) ;
+                 wty ; 
+                 what ; 
+                 with_what]))
+          ~continuations:[
+            T.then_
+               ~start:(rewrite_simpl_tac ~term:(C.Rel 1))
+               ~continuation:(
+                 ProofEngineStructuralRules.clear
+                  ~hyp:(List.hd context)) ;
+            T.id_tac]
+          ~status
        else raise (ProofEngineTypes.Fail "Replace: terms not replaceable")
        with (Failure "hd") -> raise (ProofEngineTypes.Fail "Replace: empty context")
 ;;