X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=components%2Facic_content%2FtermAcicContent.ml;h=516d5f5429ab56926e92e426ca654a45511b2ee5;hb=070e79b6e7ec986dd5fcdee24857956f6a4a9221;hp=a25730e4d1fa0aed8e2279694d2d60d3a7d7deb7;hpb=9e32b487a1343ead9069ea76e40515ceb19d26d6;p=helm.git diff --git a/components/acic_content/termAcicContent.ml b/components/acic_content/termAcicContent.ml index a25730e4d..516d5f542 100644 --- a/components/acic_content/termAcicContent.ml +++ b/components/acic_content/termAcicContent.ml @@ -66,7 +66,6 @@ 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 @@ -122,16 +121,31 @@ let ast_of_acic0 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)) -> - if CoercGraph.is_a_coercion (Deannotate.deannotate_term he) && - !hide_coercions + 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 + let deannot_he = Deannotate.deannotate_term he in + if CoercGraph.is_a_coercion deannot_he && !Acic2content.hide_coercions then - let rec last = - function - [] -> assert false - | [t] -> t - | _::tl -> last tl - in - idref aid (k (last tl)) + match CoercGraph.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)) else idref aid (Ast.Appl (List.map k args)) | Cic.AAppl (aid,args) ->