]> matita.cs.unibo.it Git - helm.git/commitdiff
added function term_of_equality to re-build the Cic.term from an equality
authorAlberto Griggio <griggio@fbk.eu>
Mon, 5 Dec 2005 16:48:44 +0000 (16:48 +0000)
committerAlberto Griggio <griggio@fbk.eu>
Mon, 5 Dec 2005 16:48:44 +0000 (16:48 +0000)
helm/ocaml/paramodulation/inference.ml
helm/ocaml/paramodulation/inference.mli

index 105b708e92d47d21c4b812d58876f405fe9347bd..5633599d20636d44ae0a25625c0ed0f0fb33a8d1 100644 (file)
@@ -922,3 +922,29 @@ let is_identity ((metasenv, context, ugraph) as env) = function
           (fst (CicReduction.are_convertible 
                  ~metasenv:(metasenv @ menv) context left right ugraph)))
 ;;
+
+
+let term_of_equality equality =
+  let _, _, (ty, left, right, _), menv, args = equality in
+  let eq i = function Cic.Meta (j, _) -> i = j | _ -> false in
+  let argsno = List.length args in
+  let t =
+    CicSubstitution.lift argsno
+      (Cic.Appl [Cic.MutInd (LibraryObjects.eq_URI (), 0, []); ty; left; right])
+  in
+  snd (
+    List.fold_right
+      (fun a (n, t) ->
+         match a with
+         | Cic.Meta (i, _) ->
+             let name = Cic.Name ("X" ^ (string_of_int n)) in
+             let _, _, ty = CicUtil.lookup_meta i menv in
+             let t = 
+               ProofEngineReduction.replace
+                 ~equality:eq ~what:[i]
+                 ~with_what:[Cic.Rel (argsno - (n - 1))] ~where:t
+             in
+             (n-1, Cic.Prod (name, ty, t))
+         | _ -> assert false)
+      args (argsno, t))
+;;
index 55f3df414aa7949e0f8c7bc08cb368da216d7d4a..30927dc72d4e7a9c3eb3836d23bdc1a0358303f1 100644 (file)
@@ -109,6 +109,11 @@ exception TermIsNotAnEquality;;
 *)
 val equality_of_term: Cic.term -> Cic.term -> equality
 
+(**
+   Re-builds the term corresponding to this equality
+*)
+val term_of_equality: equality -> Cic.term
+
 val term_is_equality: Cic.term -> bool
 
 (** tests a sort of alpha-convertibility between the two terms, but on the