X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fcomponents%2Fng_tactics%2FnCicElim.ml;h=4117c4ffa48423e9cff889e3822dc04f47b98e08;hb=d43b4cfa41256e90fceb0129b7eadb38207190c3;hp=79a22b07720fa9d5a3e7b2503324653a249becd7;hpb=3c17c53d6628c1863a33ab071266a0f5614bbce1;p=helm.git diff --git a/helm/software/components/ng_tactics/nCicElim.ml b/helm/software/components/ng_tactics/nCicElim.ml index 79a22b077..4117c4ffa 100644 --- a/helm/software/components/ng_tactics/nCicElim.ml +++ b/helm/software/components/ng_tactics/nCicElim.ml @@ -38,10 +38,11 @@ let mk_appl = function [] -> assert false | [x] -> x + | CicNotationPt.Appl l1 :: l2 -> CicNotationPt.Appl (l1 @ l2) | l -> CicNotationPt.Appl l ;; -let mk_elim uri leftno [it] (outsort,suffix) = +let mk_elim uri leftno it (outsort,suffix) = let _,ind_name,ty,cl = it in let srec_name = ind_name ^ "_" ^ suffix in let rec_name = mk_id srec_name in @@ -153,24 +154,29 @@ let mk_elim uri leftno [it] (outsort,suffix) = ;; 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,_) -> + NCic.Inductive (true,leftno,[itl],_) -> List.map (fun s -> mk_elim uri leftno itl (ast_of_sort s)) (NCic.Prop:: List.map (fun s -> NCic.Type s) (NCicEnvironment.get_universes ()))