]> matita.cs.unibo.it Git - helm.git/commitdiff
Added a new version of meta_convertibnility that returns the
authorAndrea Asperti <andrea.asperti@unibo.it>
Mon, 28 May 2007 13:18:32 +0000 (13:18 +0000)
committerAndrea Asperti <andrea.asperti@unibo.it>
Mon, 28 May 2007 13:18:32 +0000 (13:18 +0000)
variant substitution.

helm/software/components/tactics/paramodulation/equality.ml
helm/software/components/tactics/paramodulation/equality.mli

index 30138b378f9eac358305f3ffbcc4170e05de44c7..e35918c689b805b0e6b4037133e001e9583abe8f 100644 (file)
@@ -1026,7 +1026,6 @@ let meta_convertibility_eq eq1 eq2 =
         false
 ;;
 
-
 let meta_convertibility t1 t2 =
   if t1 = t2 then
     true
@@ -1038,6 +1037,32 @@ let meta_convertibility t1 t2 =
       false
 ;;
 
+let meta_convertibility_subst t1 t2 menv =
+  if t1 = t2 then
+    Some([])
+  else
+    try
+      let (l,_) = meta_convertibility_aux ([],[]) t1 t2 in
+      let subst =
+       List.map
+         (fun (x,y) ->
+            try 
+              let (_,c,t) = CicUtil.lookup_meta x menv in
+              let irl = 
+                CicMkImplicit.identity_relocation_list_for_metavariable c in
+              (x,(c,Cic.Meta(y,irl),t))
+            with CicUtil.Meta_not_found _ ->
+              try 
+                let (_,c,t) = CicUtil.lookup_meta y menv in
+                let irl =  
+                  CicMkImplicit.identity_relocation_list_for_metavariable c in
+                  (y,(c,Cic.Meta(x,irl),t))
+              with CicUtil.Meta_not_found _ -> assert false) l in   
+       Some subst
+    with NotMetaConvertible ->
+      None
+;;
+
 exception TermIsNotAnEquality;;
 
 let term_is_equality term =
index a8dec96f937ce74835bf6a1a5e027808b18ec117..6eb48a036e7f8f0e539f5fb746a2a54879c0af32 100644 (file)
@@ -116,6 +116,8 @@ val meta_convertibility: Cic.term -> Cic.term -> bool
 
 (** meta convertibility between two equations *)
 val meta_convertibility_eq: equality -> equality -> bool
+val meta_convertibility_subst: 
+  Cic.term -> Cic.term -> Cic.metasenv -> Cic.substitution option
 
 val is_weak_identity: equality -> bool
 val is_identity: Utils.environment -> equality -> bool