X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fcomponents%2Fng_tactics%2FnCicElim.ml;h=b493edb6a22f295750a96141dd74f6a5d0a68385;hb=711a06aebcd4f8e1127a56d82dd1fc4de22d5ea2;hp=d5cbca892e15f045d446e82903dbbdd84106cfdf;hpb=e869500069d11aadd7bbe8afddcdd9044d0b56a7;p=helm.git diff --git a/helm/software/components/ng_tactics/nCicElim.ml b/helm/software/components/ng_tactics/nCicElim.ml index d5cbca892..b493edb6a 100644 --- a/helm/software/components/ng_tactics/nCicElim.ml +++ b/helm/software/components/ng_tactics/nCicElim.ml @@ -42,7 +42,7 @@ let mk_appl = | l -> CicNotationPt.Appl l ;; -let mk_elim uri leftno it (outsort,suffix) = +let mk_elim uri leftno it (outsort,suffix) pragma = let _,ind_name,ty,cl = it in let srec_name = ind_name ^ "_" ^ suffix in let rec_name = mk_id srec_name in @@ -150,29 +150,35 @@ let mk_elim uri leftno it (outsort,suffix) = (CicNotationPres.mpres_of_box boxml))); *) CicNotationPt.Theorem - (`Definition,srec_name,CicNotationPt.Implicit `JustOne,Some res) + (`Definition,srec_name, + CicNotationPt.Implicit `JustOne,Some res,pragma) ;; let ast_of_sort s = + let headrm prefix s = + try + let len_prefix = String.length prefix in + assert (String.sub s 0 len_prefix = prefix); + String.sub s len_prefix (String.length s - len_prefix) + with Invalid_argument _ -> assert false + in match s with - NCic.Prop -> `Prop,"ind" - | NCic.Type u -> - let u = NCicPp.ppterm ~metasenv:[] ~subst:[] ~context:[] (NCic.Sort s) in - (try - if String.sub u 0 4 = "Type" then - `NType (String.sub u 4 (String.length u - 4)), "rect_" ^ u - else if String.sub u 0 5 = "CProp" then - `NCProp (String.sub u 5 (String.length u - 5)), "rect_" ^ u - else - (prerr_endline u; - assert false) - with Failure _ -> assert false) + | NCic.Prop -> `Prop,"ind" + | NCic.Type [] -> `NType "", "rect_Type" + | NCic.Type ((`Type,u) :: _) -> + let name = NUri.name_of_uri u in + `NType (headrm "Type" name), "rect_" ^ name + | NCic.Type ((`CProp,u) :: _) -> + let name = NUri.name_of_uri u in + `NCProp (headrm "Type" name), + "rect_" ^ Str.replace_first (Str.regexp "Type") "CProp" name + | _ -> assert false ;; let mk_elims (uri,_,_,_,obj) = match obj with NCic.Inductive (true,leftno,[itl],_) -> - List.map (fun s -> mk_elim uri leftno itl (ast_of_sort s)) + List.map (fun s -> mk_elim uri leftno itl (ast_of_sort s) (`Elim s)) (NCic.Prop:: List.map (fun s -> NCic.Type s) (NCicEnvironment.get_universes ())) | _ -> [] @@ -285,7 +291,7 @@ let mk_projection leftno tyname consname consty (projname,_,_) i = 80 (CicNotationPres.render (fun _ -> None) (TermContentPres.pp_ast res)));*) CicNotationPt.Theorem - (`Definition,projname,CicNotationPt.Implicit `JustOne,Some res) + (`Definition,projname,CicNotationPt.Implicit `JustOne,Some res,`Projection) ;; let mk_projections (_,_,_,_,obj) =