]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/components/acic_content/termAcicContent.ml
Coercions are now hidden by default (in termAcicContent.ml)
[helm.git] / helm / software / components / acic_content / termAcicContent.ml
index fddd777f7e13959fac65a76ff202f40ae23f4738..a25730e4d1fa0aed8e2279694d2d60d3a7d7deb7 100644 (file)
@@ -66,6 +66,8 @@ let constructor_of_inductive_type uri i j =
     fst (List.nth (constructors_of_inductive_type uri i) (j-1))
   with Not_found -> assert false)
 
+let hide_coercions = ref true;;
+
 let ast_of_acic0 term_info acic k =
   let k = k term_info in
   let id_to_uris = term_info.uri in
@@ -117,7 +119,23 @@ let ast_of_acic0 term_info acic k =
     | Cic.ALetIn (id,n,s,t) ->
         idref id (Ast.LetIn ((CicNotationUtil.name_of_cic_name n, None),
           k s, k t))
-    | Cic.AAppl (aid,args) -> idref aid (Ast.Appl (List.map k args))
+    | Cic.AAppl (aid,(Cic.AConst _ as he::tl as args))
+    | Cic.AAppl (aid,(Cic.AMutInd _ as he::tl as args))
+    | Cic.AAppl (aid,(Cic.AMutConstruct _ as he::tl as args)) ->
+       if CoercGraph.is_a_coercion (Deannotate.deannotate_term he) &&
+          !hide_coercions
+       then
+        let rec last =
+         function
+            [] -> assert false
+          | [t] -> t
+          | _::tl -> last tl
+        in
+         idref aid (k (last tl))
+       else
+        idref aid (Ast.Appl (List.map k args))
+    | Cic.AAppl (aid,args) ->
+        idref aid (Ast.Appl (List.map k args))
     | Cic.AConst (id,uri,substs) ->
         register_uri id uri;
         idref id (Ast.Ident (UriManager.name_of_uri uri, aux_substs substs))