]> matita.cs.unibo.it Git - helm.git/blob - helm/ocaml/cic_omdoc/cic2acic.ml
Added universes handling. The PRE_UNIVERSES tag may help ;)
[helm.git] / helm / ocaml / cic_omdoc / cic2acic.ml
1 (* Copyright (C) 2000, HELM Team.
2  * 
3  * This file is part of HELM, an Hypertextual, Electronic
4  * Library of Mathematics, developed at the Computer Science
5  * Department, University of Bologna, Italy.
6  * 
7  * HELM is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  * 
12  * HELM is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with HELM; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
20  * MA  02111-1307, USA.
21  * 
22  * For details, see the HELM World-Wide-Web page,
23  * http://cs.unibo.it/helm/.
24  *)
25
26 let hashtbl_add_time = ref 0.0;;
27
28 let xxx_add h k v =
29  let t1 = Sys.time () in
30   Hashtbl.add h k v ;
31   let t2 = Sys.time () in
32    hashtbl_add_time := !hashtbl_add_time +. t2 -. t1
33 ;;
34
35 let number_new_type_of_aux' = ref 0;;
36 let type_of_aux'_add_time = ref 0.0;;
37
38 let xxx_type_of_aux' m c t =
39  let t1 = Sys.time () in
40  let res,_ = CicTypeChecker.type_of_aux' m c t CicUniv.empty_ugraph in
41  let t2 = Sys.time () in
42  type_of_aux'_add_time := !type_of_aux'_add_time +. t2 -. t1 ;
43  res
44 ;;
45
46 type anntypes =
47  {annsynthesized : Cic.annterm ; annexpected : Cic.annterm option}
48 ;;
49
50 let gen_id seed =
51  let res = "i" ^ string_of_int !seed in
52   incr seed ;
53   res
54 ;;
55
56 let fresh_id seed ids_to_terms ids_to_father_ids =
57  fun father t ->
58   let res = gen_id seed in
59    xxx_add ids_to_father_ids res father ;
60    xxx_add ids_to_terms res t ;
61    res
62 ;;
63
64 let source_id_of_id id = "#source#" ^ id;;
65
66 exception NotEnoughElements;;
67
68 (*CSC: cut&paste da cicPp.ml *)
69 (* get_nth l n   returns the nth element of the list l if it exists or *)
70 (* raises NotEnoughElements if l has less than n elements             *)
71 let rec get_nth l n =
72  match (n,l) with
73     (1, he::_) -> he
74   | (n, he::tail) when n > 1 -> get_nth tail (n-1)
75   | (_,_) -> raise NotEnoughElements
76 ;;
77
78 let acic_of_cic_context' seed ids_to_terms ids_to_father_ids ids_to_inner_sorts
79      ids_to_inner_types metasenv context idrefs t expectedty
80 =
81  let module D = DoubleTypeInference in
82  let module C = Cic in
83   let fresh_id' = fresh_id seed ids_to_terms ids_to_father_ids in
84 (*    let time1 = Sys.time () in *)
85    let terms_to_types =
86      let time0 = Sys.time () in
87 (*
88      let prova = CicTypeChecker.type_of_aux' metasenv context t in
89      let time1 = Sys.time () in
90      prerr_endline ("*** Fine type_inference:" ^ (string_of_float (time1 -. time0)));
91      let res = D.double_type_of metasenv context t expectedty in
92      let time2 = Sys.time () in
93    prerr_endline ("*** Fine double_type_inference:" ^ (string_of_float (time2 -. time1)));
94      res 
95 *)
96     D.double_type_of metasenv context t expectedty
97    in
98 (*
99    let time2 = Sys.time () in
100    prerr_endline
101     ("++++++++++++ Tempi della double_type_of: "^ string_of_float (time2 -. time1)) ;
102 *)
103     let rec aux computeinnertypes father context idrefs tt =
104      let fresh_id'' = fresh_id' father tt in
105      (*CSC: computeinnertypes era true, il che e' proprio sbagliato, no? *)
106      let aux' = aux computeinnertypes (Some fresh_id'') in
107       (* First of all we compute the inner type and the inner sort *)
108       (* of the term. They may be useful in what follows.          *)
109       (*CSC: This is a very inefficient way of computing inner types *)
110       (*CSC: and inner sorts: very deep terms have their types/sorts *)
111       (*CSC: computed again and again.                               *)
112       let string_of_sort t =
113        match CicReduction.whd context t with 
114           C.Sort C.Prop  -> "Prop"
115         | C.Sort C.Set   -> "Set"
116         | C.Sort (C.Type _) -> "Type" (* TASSI OK*)
117         | C.Sort C.CProp -> "CProp"
118         | C.Meta _       ->
119 prerr_endline "Cic2acic: string_of_sort applied to a meta" ;
120            "?"
121         | t              ->
122 prerr_endline ("Cic2acic: string_of_sort applied to: " ^ CicPp.ppterm t) ;
123             assert false
124       in
125        let ainnertypes,innertype,innersort,expected_available =
126 (*CSC: Here we need the algorithm for Coscoy's double type-inference  *)
127 (*CSC: (expected type + inferred type). Just for now we use the usual *)
128 (*CSC: type-inference, but the result is very poor. As a very weak    *)
129 (*CSC: patch, I apply whd to the computed type. Full beta             *)
130 (*CSC: reduction would be a much better option.                       *)
131 (*CSC: solo per testare i tempi *)
132 (*XXXXXXX *)
133         try
134 (* *)
135         let {D.synthesized = synthesized; D.expected = expected} =
136          if computeinnertypes then
137           D.CicHash.find terms_to_types tt
138          else
139           (* We are already in an inner-type and Coscoy's double *)
140           (* type inference algorithm has not been applied.      *)
141           {D.synthesized =
142 (***CSC: patch per provare i tempi
143             CicReduction.whd context (xxx_type_of_aux' metasenv context tt) ; *)
144 Cic.Sort (Cic.Type (CicUniv.fresh())); (* TASSI: non dovrebbe fare danni *)
145           D.expected = None}
146         in
147          incr number_new_type_of_aux' ;
148          let innersort = (*XXXXX *) xxx_type_of_aux' metasenv context synthesized (* Cic.Sort Cic.Prop *) in
149           let ainnertypes,expected_available =
150            if computeinnertypes then
151             let annexpected,expected_available =
152                match expected with
153                   None -> None,false
154                 | Some expectedty' ->
155                    Some
156                     (aux false (Some fresh_id'') context idrefs expectedty'),
157                     true
158             in
159              Some
160               {annsynthesized =
161                 aux false (Some fresh_id'') context idrefs synthesized ;
162                annexpected = annexpected
163               }, expected_available
164            else
165             None,false
166           in
167            ainnertypes,synthesized, string_of_sort innersort, expected_available
168 (*XXXXXXXX *)
169         with
170          Not_found ->  (* l'inner-type non e' nella tabella ==> sort <> Prop *)
171           (* CSC: Type or Set? I can not tell *)
172           None,Cic.Sort (Cic.Type (CicUniv.fresh())),"Type",false 
173           (* TASSI non dovrebbe fare danni *)
174 (* *)
175        in
176         let add_inner_type id =
177          match ainnertypes with
178             None -> ()
179           | Some ainnertypes -> xxx_add ids_to_inner_types id ainnertypes
180         in
181          match tt with
182             C.Rel n ->
183              let id =
184               match get_nth context n with
185                  (Some (C.Name s,_)) -> s
186                | _ -> "__" ^ string_of_int n
187              in
188               xxx_add ids_to_inner_sorts fresh_id'' innersort ;
189               if innersort = "Prop"  && expected_available then
190                add_inner_type fresh_id'' ;
191               C.ARel (fresh_id'', List.nth idrefs (n-1), n, id)
192           | C.Var (uri,exp_named_subst) ->
193              xxx_add ids_to_inner_sorts fresh_id'' innersort ;
194              if innersort = "Prop"  && expected_available then
195               add_inner_type fresh_id'' ;
196              let exp_named_subst' =
197               List.map
198                (function i,t -> i, (aux' context idrefs t)) exp_named_subst
199              in
200               C.AVar (fresh_id'', uri,exp_named_subst')
201           | C.Meta (n,l) ->
202              let (_,canonical_context,_) = CicUtil.lookup_meta n metasenv in
203              xxx_add ids_to_inner_sorts fresh_id'' innersort ;
204              if innersort = "Prop"  && expected_available then
205               add_inner_type fresh_id'' ;
206              C.AMeta (fresh_id'', n,
207               (List.map2
208                 (fun ct t ->
209                   match (ct, t) with
210                   | None, _ -> None
211                   | _, Some t -> Some (aux' context idrefs t)
212                   | Some _, None -> assert false (* due to typing rules *))
213                 canonical_context l))
214           | C.Sort s -> C.ASort (fresh_id'', s)
215           | C.Implicit annotation -> C.AImplicit (fresh_id'', annotation)
216           | C.Cast (v,t) ->
217              xxx_add ids_to_inner_sorts fresh_id'' innersort ;
218              if innersort = "Prop" then
219               add_inner_type fresh_id'' ;
220              C.ACast (fresh_id'', aux' context idrefs v, aux' context idrefs t)
221           | C.Prod (n,s,t) ->
222               xxx_add ids_to_inner_sorts fresh_id''
223                (string_of_sort innertype) ;
224                     let sourcetype = xxx_type_of_aux' metasenv context s in
225                      xxx_add ids_to_inner_sorts (source_id_of_id fresh_id'')
226                       (string_of_sort sourcetype) ;
227               let n' =
228                match n with
229                   C.Anonymous -> n
230                 | C.Name n' ->
231                    if DoubleTypeInference.does_not_occur 1 t then
232                     C.Anonymous
233                    else
234                     C.Name n'
235               in
236                C.AProd
237                 (fresh_id'', n', aux' context idrefs s,
238                  aux' ((Some (n, C.Decl s))::context) (fresh_id''::idrefs) t)
239           | C.Lambda (n,s,t) ->
240              xxx_add ids_to_inner_sorts fresh_id'' innersort ;
241                    let sourcetype = xxx_type_of_aux' metasenv context s in
242                     xxx_add ids_to_inner_sorts (source_id_of_id fresh_id'')
243                      (string_of_sort sourcetype) ;
244               if innersort = "Prop" then
245                begin
246                 let father_is_lambda =
247                  match father with
248                     None -> false
249                   | Some father' ->
250                      match Hashtbl.find ids_to_terms father' with
251                         C.Lambda _ -> true
252                       | _ -> false
253                 in
254                  if (not father_is_lambda) || expected_available then
255                   add_inner_type fresh_id''
256                end ;
257               C.ALambda
258                (fresh_id'',n, aux' context idrefs s,
259                 aux' ((Some (n, C.Decl s)::context)) (fresh_id''::idrefs) t)
260           | C.LetIn (n,s,t) ->
261              xxx_add ids_to_inner_sorts fresh_id'' innersort ;
262              if innersort = "Prop" then
263               add_inner_type fresh_id'' ;
264              C.ALetIn
265               (fresh_id'', n, aux' context idrefs s,
266                aux' ((Some (n, C.Def(s,None)))::context) (fresh_id''::idrefs) t)
267           | C.Appl l ->
268              xxx_add ids_to_inner_sorts fresh_id'' innersort ;
269              if innersort = "Prop" then
270               add_inner_type fresh_id'' ;
271              C.AAppl (fresh_id'', List.map (aux' context idrefs) l)
272           | C.Const (uri,exp_named_subst) ->
273              xxx_add ids_to_inner_sorts fresh_id'' innersort ;
274              if innersort = "Prop"  && expected_available then
275               add_inner_type fresh_id'' ;
276              let exp_named_subst' =
277               List.map
278                (function i,t -> i, (aux' context idrefs t)) exp_named_subst
279              in
280               C.AConst (fresh_id'', uri, exp_named_subst')
281           | C.MutInd (uri,tyno,exp_named_subst) ->
282              let exp_named_subst' =
283               List.map
284                (function i,t -> i, (aux' context idrefs t)) exp_named_subst
285              in
286               C.AMutInd (fresh_id'', uri, tyno, exp_named_subst')
287           | C.MutConstruct (uri,tyno,consno,exp_named_subst) ->
288              xxx_add ids_to_inner_sorts fresh_id'' innersort ;
289              if innersort = "Prop"  && expected_available then
290               add_inner_type fresh_id'' ;
291              let exp_named_subst' =
292               List.map
293                (function i,t -> i, (aux' context idrefs t)) exp_named_subst
294              in
295               C.AMutConstruct (fresh_id'', uri, tyno, consno, exp_named_subst')
296           | C.MutCase (uri, tyno, outty, term, patterns) ->
297              xxx_add ids_to_inner_sorts fresh_id'' innersort ;
298              if innersort = "Prop" then
299               add_inner_type fresh_id'' ;
300              C.AMutCase (fresh_id'', uri, tyno, aux' context idrefs outty,
301               aux' context idrefs term, List.map (aux' context idrefs) patterns)
302           | C.Fix (funno, funs) ->
303              let fresh_idrefs =
304               List.map (function _ -> gen_id seed) funs in
305              let new_idrefs = List.rev fresh_idrefs @ idrefs in
306              let tys =
307               List.map (fun (name,_,ty,_) -> Some (C.Name name, C.Decl ty)) funs
308              in
309               xxx_add ids_to_inner_sorts fresh_id'' innersort ;
310               if innersort = "Prop" then
311                add_inner_type fresh_id'' ;
312               C.AFix (fresh_id'', funno,
313                List.map2
314                 (fun id (name, indidx, ty, bo) ->
315                   (id, name, indidx, aux' context idrefs ty,
316                     aux' (tys@context) new_idrefs bo)
317                 ) fresh_idrefs funs
318              )
319           | C.CoFix (funno, funs) ->
320              let fresh_idrefs =
321               List.map (function _ -> gen_id seed) funs in
322              let new_idrefs = List.rev fresh_idrefs @ idrefs in
323              let tys =
324               List.map (fun (name,ty,_) -> Some (C.Name name, C.Decl ty)) funs
325              in
326               xxx_add ids_to_inner_sorts fresh_id'' innersort ;
327               if innersort = "Prop" then
328                add_inner_type fresh_id'' ;
329               C.ACoFix (fresh_id'', funno,
330                List.map2
331                 (fun id (name, ty, bo) ->
332                   (id, name, aux' context idrefs ty,
333                     aux' (tys@context) new_idrefs bo)
334                 ) fresh_idrefs funs
335               )
336         in
337 (*
338          let timea = Sys.time () in
339          let res = aux true None context idrefs t in
340          let timeb = Sys.time () in
341           prerr_endline
342            ("+++++++++++++ Tempi della aux dentro alla acic_of_cic: "^ string_of_float (timeb -. timea)) ;
343           res
344 *)
345         aux true None context idrefs t
346 ;;
347
348 let acic_of_cic_context metasenv context idrefs t =
349  let ids_to_terms = Hashtbl.create 503 in
350  let ids_to_father_ids = Hashtbl.create 503 in
351  let ids_to_inner_sorts = Hashtbl.create 503 in
352  let ids_to_inner_types = Hashtbl.create 503 in
353  let seed = ref 0 in
354    acic_of_cic_context' seed ids_to_terms ids_to_father_ids ids_to_inner_sorts
355     ids_to_inner_types metasenv context idrefs t,
356    ids_to_terms, ids_to_father_ids, ids_to_inner_sorts, ids_to_inner_types
357 ;;
358
359 let aconjecture_of_conjecture seed ids_to_terms ids_to_father_ids 
360   ids_to_inner_sorts ids_to_inner_types ids_to_hypotheses hypotheses_seed
361   metasenv (metano,context,goal) = 
362   let acic_of_cic_context =
363     acic_of_cic_context' seed ids_to_terms ids_to_father_ids ids_to_inner_sorts
364       ids_to_inner_types  metasenv in
365   let _, acontext,final_idrefs =
366     (List.fold_right
367       (fun binding (context, acontext,idrefs) ->
368          let hid = "h" ^ string_of_int !hypotheses_seed in
369            Hashtbl.add ids_to_hypotheses hid binding ;
370            incr hypotheses_seed ;
371            match binding with
372                Some (n,Cic.Def (t,None)) ->
373                  let acic = acic_of_cic_context context idrefs t None in
374                  (binding::context),
375                    ((hid,Some (n,Cic.ADef acic))::acontext),(hid::idrefs)
376              | Some (n,Cic.Decl t) ->
377                  let acic = acic_of_cic_context context idrefs t None in
378                  (binding::context),
379                    ((hid,Some (n,Cic.ADecl acic))::acontext),(hid::idrefs)
380              | None ->
381                  (* Invariant: "" is never looked up *)
382                   (None::context),((hid,None)::acontext),""::idrefs
383              | Some (_,Cic.Def (_,Some _)) -> assert false
384          ) context ([],[],[])
385        )
386   in 
387   let agoal = acic_of_cic_context context final_idrefs goal None in
388   (metano,acontext,agoal)
389 ;;
390
391 let asequent_of_sequent (metasenv:Cic.metasenv) (sequent:Cic.conjecture) = 
392     let ids_to_terms = Hashtbl.create 503 in
393     let ids_to_father_ids = Hashtbl.create 503 in
394     let ids_to_inner_sorts = Hashtbl.create 503 in
395     let ids_to_inner_types = Hashtbl.create 503 in
396     let ids_to_hypotheses = Hashtbl.create 23 in
397     let hypotheses_seed = ref 0 in
398     let seed = ref 1 in (* 'i0' is used for the whole sequent *)
399     let (metano,acontext,agoal) = 
400       aconjecture_of_conjecture seed ids_to_terms ids_to_father_ids 
401       ids_to_inner_sorts ids_to_inner_types ids_to_hypotheses hypotheses_seed
402       metasenv sequent in
403     ("i0",metano,acontext,agoal), 
404      ids_to_terms,ids_to_father_ids,ids_to_inner_sorts,ids_to_hypotheses
405 ;;
406
407 let acic_object_of_cic_object ?(eta_fix=true) obj =
408  let module C = Cic in
409  let module E = Eta_fixing in
410   let ids_to_terms = Hashtbl.create 503 in
411   let ids_to_father_ids = Hashtbl.create 503 in
412   let ids_to_inner_sorts = Hashtbl.create 503 in
413   let ids_to_inner_types = Hashtbl.create 503 in
414   let ids_to_conjectures = Hashtbl.create 11 in
415   let ids_to_hypotheses = Hashtbl.create 127 in
416   let hypotheses_seed = ref 0 in
417   let conjectures_seed = ref 0 in
418   let seed = ref 0 in
419   let acic_term_of_cic_term_context' =
420    acic_of_cic_context' seed ids_to_terms ids_to_father_ids ids_to_inner_sorts
421     ids_to_inner_types in
422   let acic_term_of_cic_term' = acic_term_of_cic_term_context' [] [] [] in
423   let aconjecture_of_conjecture' = aconjecture_of_conjecture seed 
424     ids_to_terms ids_to_father_ids ids_to_inner_sorts ids_to_inner_types 
425     ids_to_hypotheses hypotheses_seed in 
426    let eta_fix metasenv context t =
427     if eta_fix then E.eta_fix metasenv context t else t
428    in
429    let aobj =
430     match obj with
431       C.Constant (id,Some bo,ty,params) ->
432        let bo' = eta_fix [] [] bo in
433        let ty' = eta_fix [] [] ty in
434        let abo = acic_term_of_cic_term' bo' (Some ty') in
435        let aty = acic_term_of_cic_term' ty' None in
436         C.AConstant
437          ("mettereaposto",Some "mettereaposto2",id,Some abo,aty,params)
438     | C.Constant (id,None,ty,params) ->
439        let ty' = eta_fix [] [] ty in
440        let aty = acic_term_of_cic_term' ty' None in
441         C.AConstant
442          ("mettereaposto",None,id,None,aty,params)
443     | C.Variable (id,bo,ty,params) ->
444        let ty' = eta_fix [] [] ty in
445        let abo =
446         match bo with
447            None -> None
448          | Some bo ->
449             let bo' = eta_fix [] [] bo in
450              Some (acic_term_of_cic_term' bo' (Some ty'))
451        in
452        let aty = acic_term_of_cic_term' ty' None in
453         C.AVariable
454          ("mettereaposto",id,abo,aty, params)
455     | C.CurrentProof (id,conjectures,bo,ty,params) ->
456        let conjectures' =
457         List.map
458          (function (i,canonical_context,term) ->
459            let canonical_context' =
460             List.fold_right
461              (fun d canonical_context' ->
462                let d' =
463                 match d with
464                    None -> None
465                  | Some (n, C.Decl t)->
466                     Some (n, C.Decl (eta_fix conjectures canonical_context' t))
467                  | Some (n, C.Def (t,None)) ->
468                     Some (n,
469                      C.Def ((eta_fix conjectures canonical_context' t),None))
470                  | Some (_,C.Def (_,Some _)) -> assert false
471                in
472                 d::canonical_context'
473              ) [] canonical_context
474            in
475            let term' = eta_fix conjectures canonical_context' term in
476             (i,canonical_context',term')
477          ) conjectures
478        in
479        let aconjectures = 
480         List.map
481          (function (i,canonical_context,term) as conjecture ->
482            let cid = "c" ^ string_of_int !conjectures_seed in
483             xxx_add ids_to_conjectures cid conjecture ;
484             incr conjectures_seed ;
485            let (i,acanonical_context,aterm) 
486              = aconjecture_of_conjecture' conjectures conjecture in
487            (cid,i,acanonical_context,aterm))
488           conjectures' in 
489 (*           let idrefs',revacanonical_context =
490              let rec aux context idrefs =
491               function
492                  [] -> idrefs,[]
493                | hyp::tl ->
494                   let hid = "h" ^ string_of_int !hypotheses_seed in
495                   let new_idrefs = hid::idrefs in
496                    xxx_add ids_to_hypotheses hid hyp ;
497                    incr hypotheses_seed ;
498                    match hyp with
499                       (Some (n,C.Decl t)) ->
500                         let final_idrefs,atl =
501                          aux (hyp::context) new_idrefs tl in
502                         let at =
503                          acic_term_of_cic_term_context'
504                           conjectures context idrefs t None
505                         in
506                          final_idrefs,(hid,Some (n,C.ADecl at))::atl
507                     | (Some (n,C.Def (t,_))) ->
508                         let final_idrefs,atl =
509                          aux (hyp::context) new_idrefs tl in
510                         let at =
511                          acic_term_of_cic_term_context'
512                           conjectures context idrefs t None
513                         in
514                          final_idrefs,(hid,Some (n,C.ADef at))::atl
515                     | None ->
516                        let final_idrefs,atl =
517                         aux (hyp::context) new_idrefs tl
518                        in
519                         final_idrefs,(hid,None)::atl
520              in
521               aux [] [] (List.rev canonical_context) 
522             in
523              let aterm =
524               acic_term_of_cic_term_context' conjectures
525                canonical_context idrefs' term None 
526              in
527               (cid,i,(List.rev revacanonical_context),aterm) 
528          ) conjectures' in *)
529 (*        let time1 = Sys.time () in *)
530        let bo' = eta_fix conjectures' [] bo in
531        let ty' = eta_fix conjectures' [] ty in
532 (*
533        let time2 = Sys.time () in
534        prerr_endline
535         ("++++++++++ Tempi della eta_fix: "^ string_of_float (time2 -. time1)) ;
536        hashtbl_add_time := 0.0 ;
537        type_of_aux'_add_time := 0.0 ;
538        DoubleTypeInference.syntactic_equality_add_time := 0.0 ;
539 *)
540        let abo =
541         acic_term_of_cic_term_context' conjectures' [] [] bo' (Some ty') in
542        let aty = acic_term_of_cic_term_context' conjectures' [] [] ty' None in
543 (*
544        let time3 = Sys.time () in
545        prerr_endline
546         ("++++++++++++ Tempi della hashtbl_add_time: " ^ string_of_float !hashtbl_add_time) ;
547        prerr_endline
548         ("++++++++++++ Tempi della type_of_aux'_add_time(" ^ string_of_int !number_new_type_of_aux' ^ "): " ^ string_of_float !type_of_aux'_add_time) ;
549        prerr_endline
550         ("++++++++++++ Tempi della type_of_aux'_add_time nella double_type_inference(" ^ string_of_int !DoubleTypeInference.number_new_type_of_aux'_double_work ^ ";" ^ string_of_int !DoubleTypeInference.number_new_type_of_aux'_prop ^ "/" ^ string_of_int !DoubleTypeInference.number_new_type_of_aux' ^ "): " ^ string_of_float !DoubleTypeInference.type_of_aux'_add_time) ;
551        prerr_endline
552         ("++++++++++++ Tempi della syntactic_equality_add_time: " ^ string_of_float !DoubleTypeInference.syntactic_equality_add_time) ;
553        prerr_endline
554         ("++++++++++ Tempi della acic_of_cic: " ^ string_of_float (time3 -. time2)) ;
555        prerr_endline
556         ("++++++++++ Numero di iterazioni della acic_of_cic: " ^ string_of_int !seed) ;
557 *)
558         C.ACurrentProof
559          ("mettereaposto","mettereaposto2",id,aconjectures,abo,aty,params)
560     | C.InductiveDefinition (tys,params,paramsno) ->
561        let context =
562         List.map
563          (fun (name,_,arity,_) -> Some (C.Name name, C.Decl arity)) tys in
564        let idrefs = List.map (function _ -> gen_id seed) tys in
565        let atys =
566         List.map2
567          (fun id (name,inductive,ty,cons) ->
568            let acons =
569             List.map
570              (function (name,ty) ->
571                (name,
572                  acic_term_of_cic_term_context' [] context idrefs ty None)
573              ) cons
574            in
575             (id,name,inductive,acic_term_of_cic_term' ty None,acons)
576          ) (List.rev idrefs) tys
577        in
578         C.AInductiveDefinition ("mettereaposto",atys,params,paramsno)
579    in
580     aobj,ids_to_terms,ids_to_father_ids,ids_to_inner_sorts,ids_to_inner_types,
581      ids_to_conjectures,ids_to_hypotheses
582 ;;
583
584