X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fcomponents%2Facic_content%2FtermAcicContent.ml;h=edb22c9442c5aaa53c9e43c7ea8b7a54b728c2e1;hb=2fb7dd29bac6ee7add3618c5d798fa60ab0c8eb4;hp=4c98e1ad93b4de3d959ca25dca3194321fd503e6;hpb=8e6a30412bbac3acc0a020e0fe90d492b0fc6776;p=helm.git diff --git a/helm/software/components/acic_content/termAcicContent.ml b/helm/software/components/acic_content/termAcicContent.ml index 4c98e1ad9..edb22c944 100644 --- a/helm/software/components/acic_content/termAcicContent.ml +++ b/helm/software/components/acic_content/termAcicContent.ml @@ -124,34 +124,25 @@ let ast_of_acic0 ~output_type term_info acic k = | 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)) as t -> - let last_n n l = - let rec aux = - function - [] -> assert false - | [_] as l -> l,1 - | he::tl -> - let (res,len) as res' = aux tl in - if len < n then - he::res,len + 1 - else - res' - in - match fst (aux l) with - [] -> assert false - | [t] -> t - | Ast.AttributedTerm (_,(Ast.Appl l))::tl -> - idref aid (Ast.Appl (l@tl)) - | l -> idref aid (Ast.Appl l) - in (match LibraryObjects.destroy_nat t with | Some n -> idref aid (Ast.Num (string_of_int n, -1)) | None -> let deannot_he = Deannotate.deannotate_term he in - if CoercDb.is_a_coercion' deannot_he && !Acic2content.hide_coercions - then - (match CoercDb.is_a_coercion_to_funclass deannot_he with - | None -> idref aid (last_n 1 (List.map k tl)) - | Some i -> idref aid (last_n (i+1) (List.map k tl))) + let coercion_info = CoercDb.is_a_coercion deannot_he in + if coercion_info <> None && !Acic2content.hide_coercions then + match coercion_info with + | None -> assert false + | Some (_,_,_,sats,cpos) -> + if cpos < List.length tl then + let _,rest = + try HExtlib.split_nth (cpos+sats+1) tl with Failure _ -> [],[] + in + if rest = [] then + idref aid (List.nth (List.map k tl) cpos) + else + idref aid (Ast.Appl (List.map k (List.nth tl cpos::rest))) + else + idref aid (Ast.Appl (List.map k tl)) else idref aid (Ast.Appl (List.map k args))) | Cic.AAppl (aid,args) ->