]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/components/ng_tactics/nCicElim.ml
fixed coercion mechanism w.r.t. undo/require
[helm.git] / helm / software / components / ng_tactics / nCicElim.ml
index 4339b2860f42531eef867c1860a5536e0b44e586..d5cbca892e15f045d446e82903dbbdd84106cfdf 100644 (file)
@@ -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
@@ -98,7 +99,7 @@ let mk_elim uri leftno [it] (outsort,suffix) =
                       params @
                       [p_name] @
                       k_names @
-                      List.map (fun _ -> CicNotationPt.Implicit)
+                      List.map (fun _ -> CicNotationPt.Implicit `JustOne)
                        (List.tl args) @
                       [mk_appl (name::abs)])))
               | _ -> mk_id name,None
@@ -148,7 +149,8 @@ let mk_elim uri leftno [it] (outsort,suffix) =
      (function x::_ -> x | _ -> assert false) 80 
      (CicNotationPres.mpres_of_box boxml)));
 *)
-  CicNotationPt.Theorem (`Definition,srec_name,CicNotationPt.Implicit,Some res)
+  CicNotationPt.Theorem
+   (`Definition,srec_name,CicNotationPt.Implicit `JustOne,Some res)
 ;;
 
 let ast_of_sort s =
@@ -169,7 +171,7 @@ let ast_of_sort s =
 
 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 ()))
@@ -264,23 +266,26 @@ let mk_projection leftno tyname consname consty (projname,_,_) i =
       @ names in
      let outtype = pp rels outtype in
      let outtype= CicNotationPt.Binder (`Lambda, (arg, Some arg_ty), outtype) in
-      CicNotationPt.Binder
-       (`Lambda, (arg,Some arg_ty),
-         CicNotationPt.Case (arg,None,Some outtype,[branch]))
+      [arg, Some arg_ty], CicNotationPt.Case (arg,None,Some outtype,[branch])
    | _,NCic.Prod (name,_,t) ->
       let name = mk_id name in
-       CicNotationPt.Binder
-        (`Lambda, (name,None), aux (name::names) t (leftno - 1))
+      let params,body = aux (name::names) t (leftno - 1) in
+       (name,None)::params, body
    | _,_ -> assert false
  in
- let res = aux [] consty leftno in
+ let params,bo = aux [] consty leftno in
+ let pprojname = mk_id projname in
+ let res =
+  CicNotationPt.LetRec (`Inductive,
+   [params, (pprojname,None), bo, leftno], pprojname) in
 (* prerr_endline
    (BoxPp.render_to_string
      ~map_unicode_to_tex:false
      (function x::_ -> x | _ -> assert false)
      80 (CicNotationPres.render (fun _ -> None)
      (TermContentPres.pp_ast res)));*)
-  CicNotationPt.Theorem (`Definition,projname,CicNotationPt.Implicit,Some res)
+  CicNotationPt.Theorem
+   (`Definition,projname,CicNotationPt.Implicit `JustOne,Some res)
 ;;
 
 let mk_projections (_,_,_,_,obj) =