]> matita.cs.unibo.it Git - helm.git/blob - helm/matita/matitaEngine.ml
* More tactics are now available to matita.
[helm.git] / helm / matita / matitaEngine.ml
1
2 open Printf
3 open MatitaTypes
4
5 let debug = false ;;
6 let debug_print = if debug then prerr_endline else ignore ;;
7
8 (** create a ProofEngineTypes.mk_fresh_name_type function which uses given
9   * names as long as they are available, then it fallbacks to name generation
10   * using FreshNamesGenerator module *)
11 let namer_of names =
12   let len = List.length names in
13   let count = ref 0 in
14   fun metasenv context name ~typ ->
15     if !count < len then begin
16       let name = Cic.Name (List.nth names !count) in
17       incr count;
18       name
19     end else
20       FreshNamesGenerator.mk_fresh_name ~subst:[] metasenv context name ~typ
21
22 let tactic_of_ast = function
23   | TacticAst.Absurd (_, term) -> Tactics.absurd term
24   | TacticAst.Apply (_, term) -> Tactics.apply term
25   | TacticAst.Assumption _ -> Tactics.assumption
26   | TacticAst.Auto (_,depth) -> 
27       AutoTactic.auto_tac_new ?depth ~dbd:(MatitaDb.instance ()) ()
28   | TacticAst.Change (_, what, with_what, _) -> Tactics.change ~what ~with_what
29   | TacticAst.Contradiction _ -> Tactics.contradiction
30   | TacticAst.Compare (_, term) -> Tactics.compare term
31   | TacticAst.Constructor (_, n) -> Tactics.constructor n
32   | TacticAst.Cut (_, term) -> Tactics.cut term
33   | TacticAst.DecideEquality _ -> Tactics.decide_equality
34   | TacticAst.Discriminate (_,term) -> Tactics.discriminate term
35   | TacticAst.Elim (_, term, _) ->
36       Tactics.elim_intros term
37   | TacticAst.ElimType (_, term) -> Tactics.elim_type term
38   | TacticAst.Exact (_, term) -> Tactics.exact term
39   | TacticAst.Exists _ -> Tactics.exists
40   | TacticAst.Fourier _ -> Tactics.fourier
41   | TacticAst.FwdSimpl (_, term) -> 
42      Tactics.fwd_simpl ~what:term ~dbd:(MatitaDb.instance ())
43   | TacticAst.Generalize (_,term,pat) -> Tactics.generalize term pat
44   | TacticAst.Goal (_, n) -> Tactics.set_goal n
45   | TacticAst.Intros (_, None, names) ->
46       PrimitiveTactics.intros_tac ~mk_fresh_name_callback:(namer_of names) ()
47   | TacticAst.Intros (_, Some num, names) ->
48       PrimitiveTactics.intros_tac ~howmany:num
49         ~mk_fresh_name_callback:(namer_of names) ()
50   | TacticAst.LApply (_, to_what, what) ->
51      Tactics.lapply ?to_what what
52   | TacticAst.Left _ -> Tactics.left
53   | TacticAst.LetIn (loc,term,name) ->
54       Tactics.letin term ~mk_fresh_name_callback:(namer_of [name])
55   | TacticAst.Reduce (_, reduction_kind, pattern) ->
56       (match reduction_kind with
57       | `Normalize -> Tactics.normalize ~pattern
58       | `Reduce -> Tactics.reduce ~pattern  
59       | `Simpl -> Tactics.simpl ~pattern 
60       | `Whd -> Tactics.whd ~pattern)
61   | TacticAst.Reflexivity _ -> Tactics.reflexivity
62   | TacticAst.Replace (_, what, with_what) -> Tactics.replace ~what ~with_what
63   | TacticAst.Rewrite (_, dir, t, pattern) ->
64       if dir = `Left then
65         EqualityTactics.rewrite_tac ~where:pattern ~term:t ()
66       else
67         EqualityTactics.rewrite_back_tac ~where:pattern ~term:t ()
68   | TacticAst.Right _ -> Tactics.right
69   | TacticAst.Ring _ -> Tactics.ring
70   | TacticAst.Split _ -> Tactics.split
71   | TacticAst.Symmetry _ -> Tactics.symmetry
72   | TacticAst.Transitivity (_, term) -> Tactics.transitivity term
73
74 let eval_tactical status tac =
75   let apply_tactic tactic =
76     let (proof, goals) =
77       ProofEngineTypes.apply_tactic tactic (MatitaMisc.get_proof_status status)
78     in
79     let new_status =
80       match goals with
81       | [] -> 
82           let (_,metasenv,_,_) = proof in
83           (match metasenv with
84           | [] -> Proof proof
85           | (ng,_,_)::_ -> Incomplete_proof (proof,ng))
86       | ng::_ -> Incomplete_proof (proof, ng)
87     in
88     { status with proof_status = new_status }
89   in
90   let rec tactical_of_ast = function
91     | TacticAst.Tactic (loc, tactic) -> tactic_of_ast tactic
92     | TacticAst.Fail loc -> Tacticals.fail
93     | TacticAst.Do (loc, num, tactical) ->
94         Tacticals.do_tactic num (tactical_of_ast tactical)
95     | TacticAst.IdTac loc -> Tacticals.id_tac
96     | TacticAst.Repeat (loc, tactical) ->
97         Tacticals.repeat_tactic (tactical_of_ast tactical)
98     | TacticAst.Seq (loc, tacticals) ->  (* tac1; tac2; ... *)
99         Tacticals.seq (List.map tactical_of_ast tacticals)
100     | TacticAst.Then (loc, tactical, tacticals) ->  (* tac; [ tac1 | ... ] *)
101         Tacticals.thens (tactical_of_ast tactical)
102           (List.map tactical_of_ast tacticals)
103     | TacticAst.Tries (loc, tacticals) ->
104         Tacticals.try_tactics
105           (List.map (fun t -> "", tactical_of_ast t) tacticals)
106     | TacticAst.Try (loc, tactical) ->
107         Tacticals.try_tactic (tactical_of_ast tactical)
108   in
109   apply_tactic (tactical_of_ast tac)
110
111 let eval_coercion status coercion = 
112   let coer_uri,coer_ty =
113     match coercion with 
114     | Cic.Const (uri,_)
115     | Cic.Var (uri,_) ->
116         let o,_ = 
117           CicEnvironment.get_obj CicUniv.empty_ugraph uri 
118         in
119         (match o with
120         | Cic.Constant (_,_,ty,_,_)
121         | Cic.Variable (_,_,ty,_,_) ->
122             uri,ty
123         | _ -> assert false)
124     | Cic.MutConstruct (uri,t,c,_) ->
125         let o,_ = 
126           CicEnvironment.get_obj CicUniv.empty_ugraph uri 
127         in
128         (match o with
129         | Cic.InductiveDefinition (l,_,_,_) ->
130             let (_,_,_,cl) = List.nth l t in
131             let (_,cty) = List.nth cl c in
132               uri,cty
133         | _ -> assert false)
134     | _ -> assert false 
135   in
136   (* we have to get the source and the tgt type uri 
137    * in Coq syntax we have already their names, but 
138    * since we don't support Funclass and similar I think
139    * all the coercion should be of the form
140    * (A:?)(B:?)T1->T2
141    * So we should be able to extract them from the coercion type
142    *)
143   let extract_last_two_p ty =
144     let rec aux = function
145       | Cic.Prod( _, src, Cic.Prod (n,t1,t2)) -> aux (Cic.Prod(n,t1,t2))   
146       | Cic.Prod( _, src, tgt) -> src, tgt
147       | _ -> assert false
148     in  
149     aux ty
150   in
151   let ty_src,ty_tgt = extract_last_two_p coer_ty in
152   let context = [] in 
153   let src_uri = 
154     let ty_src = CicReduction.whd context ty_src in
155      CicUtil.uri_of_term ty_src
156   in
157   let tgt_uri = 
158     let ty_tgt = CicReduction.whd context ty_tgt in
159      CicUtil.uri_of_term ty_tgt
160   in
161   let new_coercions =
162     (* also adds them to the Db *)
163     CoercGraph.close_coercion_graph src_uri tgt_uri coer_uri in
164   let status =
165    List.fold_left (fun s (uri,o,ugraph) -> MatitaSync.add_obj uri o status)
166     status new_coercions in
167   {status with proof_status = No_proof}
168
169 let generate_elimination_principles uri status =
170  let elim sort status =
171    try
172     let uri,obj = CicElim.elim_of ~sort uri 0 in
173      MatitaSync.add_obj uri obj status
174    with CicElim.Can_t_eliminate -> status
175  in
176  List.fold_left (fun status sort -> elim sort status) status
177   [ Cic.Prop; Cic.Set; (Cic.Type (CicUniv.fresh ())) ]
178
179 let generate_projections uri fields status =
180  let projections = CicRecord.projections_of uri fields in
181   List.fold_left
182    (fun status (uri, name, bo) -> 
183      try 
184       let ty, ugraph = 
185         CicTypeChecker.type_of_aux' [] [] bo CicUniv.empty_ugraph in
186       let bo = Unshare.unshare bo in
187       let ty = Unshare.unshare ty in
188       let attrs = [`Class `Projection; `Generated] in
189       let obj = Cic.Constant (name,Some bo,ty,[],attrs) in
190        MatitaSync.add_obj uri obj status
191      with
192         CicTypeChecker.TypeCheckerFailure s ->
193          MatitaLog.message 
194           ("Unable to create projection " ^ name ^ " cause: " ^ s);
195          status
196       | CicEnvironment.Object_not_found uri ->
197          let depend = UriManager.name_of_uri uri in
198           MatitaLog.message 
199            ("Unable to create projection " ^ name ^ " because it requires " ^ depend);
200          status
201   ) status projections
202  
203 let eval_command status cmd =
204   match cmd with
205   | TacticAst.Set (loc, name, value) -> set_option status name value
206   | TacticAst.Qed loc ->
207       let uri, metasenv, bo, ty = 
208         match status.proof_status with
209         | Proof (Some uri, metasenv, body, ty) ->
210             uri, metasenv, body, ty
211         | Proof (None, metasenv, body, ty) -> 
212             command_error 
213               ("Someone allows to start a thm without giving the "^
214                "name/uri. This should be fixed!")
215         | _-> command_error "You can't qed an uncomplete theorem"
216       in
217       let suri = UriManager.string_of_uri uri in
218       if metasenv <> [] then 
219         command_error "Proof not completed! metasenv is not empty!";
220       let name = UriManager.name_of_uri uri in
221       let obj = Cic.Constant (name,Some bo,ty,[],[]) in
222       MatitaSync.add_obj uri obj status
223   | TacticAst.Coercion (loc, coercion) -> 
224       eval_coercion status coercion
225   | TacticAst.Alias (loc, spec) -> 
226      (match spec with
227       | TacticAst.Ident_alias (id,uri) -> 
228           {status with aliases = 
229             DisambiguateTypes.Environment.add 
230               (DisambiguateTypes.Id id) 
231               ("boh?",(fun _ _ _ -> CicUtil.term_of_uri (UriManager.uri_of_string uri)))
232               status.aliases }
233       | TacticAst.Symbol_alias (symb, instance, desc) ->
234           {status with aliases = 
235             DisambiguateTypes.Environment.add 
236               (DisambiguateTypes.Symbol (symb,instance))
237               (DisambiguateChoices.lookup_symbol_by_dsc symb desc) 
238               status.aliases }
239       | TacticAst.Number_alias (instance,desc) ->
240           {status with aliases = 
241             DisambiguateTypes.Environment.add 
242               (DisambiguateTypes.Num instance) 
243               (DisambiguateChoices.lookup_num_by_dsc desc) status.aliases })
244   | TacticAst.Obj (loc,obj) ->
245      let ext,name =
246       match obj with
247          Cic.Constant (name,_,_,_,_)
248        | Cic.CurrentProof (name,_,_,_,_,_) -> ".con",name
249        | Cic.InductiveDefinition (types,_,_,_) ->
250           ".ind",
251           (match types with (name,_,_,_)::_ -> name | _ -> assert false)
252        | _ -> assert false in
253      let uri = 
254        UriManager.uri_of_string (MatitaMisc.qualify status name ^ ext) 
255      in
256      let metasenv = MatitaMisc.get_proof_metasenv status in
257      match obj with
258         Cic.CurrentProof (_,metasenv',bo,ty,_,_) ->
259          assert (metasenv = metasenv');
260          let goalno =
261           match metasenv' with (goalno,_,_)::_ -> goalno | _ -> assert false in
262          let initial_proof = (Some uri, metasenv, bo, ty) in
263           { status with proof_status = Incomplete_proof (initial_proof,goalno)}
264       | _ ->
265         if metasenv <> [] then
266          command_error (
267            "metasenv not empty while giving a definition with body: " ^
268            CicMetaSubst.ppmetasenv metasenv []);
269         let status = MatitaSync.add_obj uri obj status in
270          match obj with
271             Cic.Constant _ -> status
272           | Cic.InductiveDefinition (_,_,_,attrs) ->
273              let status = generate_elimination_principles uri status in
274              let rec get_record_attrs =
275               function
276                  [] -> None
277                | (`Class (`Record fields))::_ -> Some fields
278                | _::tl -> get_record_attrs tl
279              in
280               (match get_record_attrs attrs with
281                   None -> status (* not a record *)
282                 | Some fields -> generate_projections uri fields status)
283           | Cic.CurrentProof _
284           | Cic.Variable _ -> assert false
285
286 let eval_executable status ex =
287   match ex with
288   | TacticAst.Tactical (_, tac) -> eval_tactical status tac
289   | TacticAst.Command (_, cmd) -> eval_command status cmd
290   | TacticAst.Macro (_, mac) -> 
291       command_error (sprintf "The macro %s can't be in a script" 
292         (TacticAstPp.pp_macro_cic mac))
293
294 let eval_comment status c = status
295             
296 let eval status st =
297   match st with
298   | TacticAst.Executable (_,ex) -> eval_executable status ex
299   | TacticAst.Comment (_,c) -> eval_comment status c
300
301 let disambiguate_term status term =
302   let (aliases, metasenv, cic, _) =
303     match
304       MatitaDisambiguator.disambiguate_term ~dbd:(MatitaDb.instance ())
305         ~aliases:(status.aliases) ~context:(MatitaMisc.get_proof_context status)
306         ~metasenv:(MatitaMisc.get_proof_metasenv status) term
307     with
308     | [x] -> x
309     | _ -> assert false
310   in
311   let proof_status =
312     match status.proof_status with
313     | No_proof -> Intermediate metasenv
314     | Incomplete_proof ((uri, _, proof, ty), goal) ->
315         Incomplete_proof ((uri, metasenv, proof, ty), goal)
316     | Intermediate _ -> Intermediate metasenv 
317     | Proof _ -> assert false
318   in
319   let status =
320     { status with
321         aliases = aliases;
322         proof_status = proof_status }
323   in
324   status, cic
325   
326 let disambiguate_obj status obj =
327   let uri =
328    match obj with
329       TacticAst.Inductive (_,(name,_,_,_)::_)
330     | TacticAst.Record (_,name,_,_) ->
331        Some (UriManager.uri_of_string (MatitaMisc.qualify status name ^ ".ind"))
332     | TacticAst.Inductive _ -> assert false
333     | _ -> None in
334   let (aliases, metasenv, cic, _) =
335     match
336       MatitaDisambiguator.disambiguate_obj ~dbd:(MatitaDb.instance ())
337         ~aliases:(status.aliases) ~uri obj
338     with
339     | [x] -> x
340     | _ -> assert false
341   in
342   let proof_status =
343     match status.proof_status with
344     | No_proof -> Intermediate metasenv
345     | Incomplete_proof _
346     | Intermediate _
347     | Proof _ -> assert false
348   in
349   let status =
350     { status with
351         aliases = aliases;
352         proof_status = proof_status }
353   in
354   status, cic
355   
356 let disambiguate_pattern aliases (hyp_paths ,goal_path) =
357   let interp path = Disambiguate.interpretate_path [] aliases path in
358   let goal_path = 
359     match goal_path with 
360     | None -> None
361     | Some path -> Some (interp path) in
362   let hyp_paths = List.map (fun (name, path) -> name, interp path) hyp_paths in
363   (hyp_paths ,goal_path)
364   
365 let disambiguate_tactic status = function
366   | TacticAst.Apply (loc, term) ->
367       let status, cic = disambiguate_term status term in
368       status, TacticAst.Apply (loc, cic)
369   | TacticAst.Absurd (loc, term) -> 
370       let status, cic = disambiguate_term status term in
371       status, TacticAst.Absurd (loc, cic)
372   | TacticAst.Assumption loc -> status, TacticAst.Assumption loc
373   | TacticAst.Auto (loc,num) -> status, TacticAst.Auto (loc,num)
374   | TacticAst.Change (loc, what, with_what, pattern) -> 
375       let status, cic1 = disambiguate_term status what in
376       let status, cic2 = disambiguate_term status with_what in
377       let pattern = disambiguate_pattern status.aliases pattern in
378       status, TacticAst.Change (loc, cic1, cic2, pattern)
379   | TacticAst.Contradiction loc -> status, TacticAst.Contradiction loc
380   | TacticAst.Cut (loc, term) -> 
381       let status, cic = disambiguate_term status term in
382       status, TacticAst.Cut (loc, cic)
383   | TacticAst.Discriminate (loc,term) ->
384       let status,term = disambiguate_term status term in
385       status, TacticAst.Discriminate(loc,term)
386   | TacticAst.Exact (loc, term) -> 
387       let status, cic = disambiguate_term status term in
388       status, TacticAst.Exact (loc, cic)
389   | TacticAst.Elim (loc, term, Some term') ->
390       let status, cic1 = disambiguate_term status term in
391       let status, cic2 = disambiguate_term status term' in
392       status, TacticAst.Elim (loc, cic1, Some cic2)
393   | TacticAst.Elim (loc, term, None) ->
394       let status, cic = disambiguate_term status term in
395       status, TacticAst.Elim (loc, cic, None)
396   | TacticAst.ElimType (loc, term) -> 
397       let status, cic = disambiguate_term status term in
398       status, TacticAst.ElimType (loc, cic)
399   | TacticAst.Exists loc -> status, TacticAst.Exists loc 
400   | TacticAst.FwdSimpl (loc, term) ->
401      let status, term = disambiguate_term status term in
402      status, TacticAst.FwdSimpl (loc, term)  
403   | TacticAst.Fourier loc -> status, TacticAst.Fourier loc
404   | TacticAst.Generalize (loc,term,pattern) ->
405       let status,term = disambiguate_term status term in
406       let pattern = disambiguate_pattern status.aliases pattern in
407       status, TacticAst.Generalize(loc,term,pattern)
408   | TacticAst.Goal (loc, g) -> status, TacticAst.Goal (loc, g)
409   | TacticAst.Intros (loc, num, names) ->
410       status, TacticAst.Intros (loc, num, names)
411   | TacticAst.LApply (loc, to_what, what) ->
412      let status, to_what =
413       match to_what with
414          None -> status,None
415        | Some to_what -> status, Some (disambiguate_term status to_what) in
416      let status, what = disambiguate_term status what in
417      status, TacticAst.LApply (loc, None, what)
418   | TacticAst.Left loc -> status, TacticAst.Left loc
419   | TacticAst.LetIn (loc, term, name) ->
420       let status, term = disambiguate_term status term in
421       status, TacticAst.LetIn (loc,term,name)
422   | TacticAst.Reduce (loc, reduction_kind, pattern) ->
423       let pattern = disambiguate_pattern status.aliases pattern in
424       status, TacticAst.Reduce(loc, reduction_kind, pattern)
425   | TacticAst.Reflexivity loc -> status, TacticAst.Reflexivity loc
426   | TacticAst.Replace (loc, what, with_what) -> 
427       let status, cic1 = disambiguate_term status what in
428       let status, cic2 = disambiguate_term status with_what in
429       status, TacticAst.Replace (loc, cic1, cic2)
430   | TacticAst.Rewrite (loc, dir, t, pattern) ->
431       let status, term = disambiguate_term status t in
432       let pattern = disambiguate_pattern status.aliases pattern in
433       status, TacticAst.Rewrite (loc, dir, term, pattern)
434   | TacticAst.Right loc -> status, TacticAst.Right loc
435   | TacticAst.Ring loc -> status, TacticAst.Ring loc
436   | TacticAst.Split loc -> status, TacticAst.Split loc
437   | TacticAst.Symmetry loc -> status, TacticAst.Symmetry loc
438   | TacticAst.Transitivity (loc, term) -> 
439       let status, cic = disambiguate_term status term in
440       status, TacticAst.Transitivity (loc, cic)
441
442 let rec disambiguate_tactical status = function 
443   | TacticAst.Tactic (loc, tactic) -> 
444       let status, tac = disambiguate_tactic status tactic in
445       status, TacticAst.Tactic (loc, tac)
446   | TacticAst.Do (loc, num, tactical) ->
447       let status, tac = disambiguate_tactical status tactical in
448       status, TacticAst.Do (loc, num, tac)
449   | TacticAst.Repeat (loc, tactical) -> 
450       let status, tac = disambiguate_tactical status tactical in
451       status, TacticAst.Repeat (loc, tac)
452   | TacticAst.Seq (loc, tacticals) ->  (* tac1; tac2; ... *)
453       let status, tacticals = disambiguate_tacticals status tacticals in
454       let tacticals = List.rev tacticals in
455       status, TacticAst.Seq (loc, tacticals)
456   | TacticAst.Then (loc, tactical, tacticals) ->  (* tac; [ tac1 | ... ] *)
457       let status, tactical = disambiguate_tactical status tactical in
458       let status, tacticals = disambiguate_tacticals status tacticals in
459       status, TacticAst.Then (loc, tactical, tacticals)
460   | TacticAst.Tries (loc, tacticals) ->
461       let status, tacticals = disambiguate_tacticals status tacticals in
462       status, TacticAst.Tries (loc, tacticals)
463   | TacticAst.Try (loc, tactical) ->
464       let status, tactical = disambiguate_tactical status tactical in
465       status, TacticAst.Try (loc, tactical)
466   | (TacticAst.IdTac _ | TacticAst.Fail _) as tac ->
467       status, tac
468
469 and disambiguate_tacticals status tacticals =
470   let status, tacticals =
471     List.fold_left
472       (fun (status, tacticals) tactical ->
473         let status, tac = disambiguate_tactical status tactical in
474         status, tac :: tacticals)
475       (status, [])
476       tacticals
477   in
478   let tacticals = List.rev tacticals in
479   status, tacticals
480   
481 let disambiguate_command status = function
482   | TacticAst.Coercion (loc, term) ->
483       let status, term = disambiguate_term status term in
484       status, TacticAst.Coercion (loc,term)
485   | (TacticAst.Set _ | TacticAst.Qed _) as cmd ->
486       status, cmd
487   | TacticAst.Alias _ as x -> status, x
488   | TacticAst.Obj (loc,obj) ->
489       let status,obj = disambiguate_obj status obj in
490        status, TacticAst.Obj (loc,obj)
491
492 let disambiguate_executable status ex =
493   match ex with
494   | TacticAst.Tactical (loc, tac) ->
495       let status, tac = disambiguate_tactical status tac in
496       status, (TacticAst.Tactical (loc, tac))
497   | TacticAst.Command (loc, cmd) ->
498       let status, cmd = disambiguate_command status cmd in
499       status, (TacticAst.Command (loc, cmd))
500   | TacticAst.Macro (_, mac) -> 
501       command_error (sprintf "The macro %s can't be in a script" 
502         (TacticAstPp.pp_macro_ast mac))
503
504 let disambiguate_comment status c = 
505   match c with
506   | TacticAst.Note (loc,n) -> status, TacticAst.Note (loc,n)
507   | TacticAst.Code (loc,ex) -> 
508         let status, ex = disambiguate_executable status ex in
509         status, TacticAst.Code (loc,ex)
510         
511 let disambiguate_statement status statement =
512   match statement with
513   | TacticAst.Comment (loc,c) -> 
514         let status, c = disambiguate_comment status c in
515         status, TacticAst.Comment (loc,c)
516   | TacticAst.Executable (loc,ex) -> 
517         let status, ex = disambiguate_executable status ex in
518         status, TacticAst.Executable (loc,ex)
519   
520 let eval_ast status ast =
521   let status,st = disambiguate_statement status ast in
522   (* this disambiguation step should be deferred to support tacticals *)
523   eval status st
524
525 let eval_from_stream status str cb =
526   let stl = CicTextualParser2.parse_statements str in
527   List.fold_left 
528     (fun status ast -> cb status ast;eval_ast status ast) status 
529   stl
530   
531 let eval_string status str =
532   eval_from_stream status (Stream.of_string str) (fun _ _ -> ())
533
534 let default_options () =
535   let options =
536     StringMap.add "baseuri"
537       (String
538         (Helm_registry.get "matita.baseuri" ^ Helm_registry.get "matita.owner"))
539       no_options
540   in
541   let options =
542     StringMap.add "basedir"
543       (String (Helm_registry.get "matita.basedir" ))
544       options
545   in
546   options
547
548 let initial_status =
549   lazy {
550     aliases = DisambiguateTypes.empty_environment;
551     proof_status = No_proof;
552     options = default_options ();
553     objects = [];
554   }
555
556