2 ||M|| This file is part of HELM, an Hypertextual, Electronic
3 ||A|| Library of Mathematics, developed at the Computer Science
4 ||T|| Department, University of Bologna, Italy.
6 ||T|| HELM is free software; you can redistribute it and/or
7 ||A|| modify it under the terms of the GNU General Public License
8 \ / version 2 or (at your option) any later version.
9 \ / This software is distributed as is, NO WARRANTY.
10 V_______________________________________________________________ *)
12 (* $Id: nCic.ml 9058 2008-10-13 17:42:30Z tassi $ *)
15 module DT = DisambiguateTypes
16 module Ast = NotationPt
17 module NRef = NReference
19 let debug = ref false;;
20 let debug_print s = if !debug then prerr_endline (Lazy.force s);;
22 let cic_name_of_name = function
23 | Ast.Ident (n, None) -> n
27 let rec mk_rels howmany from =
30 | _ -> (NCic.Rel (howmany + from)) :: (mk_rels (howmany-1) from)
33 let refine_term (status: #NCicCoercion.status) metasenv subst context uri ~use_coercions term expty _
37 debug_print (lazy (P.sprintf "TEST_INTERPRETATION: %s"
38 (status#ppterm ~metasenv ~subst ~context term)));
41 try NCicUntrusted.NCicHash.find localization_tbl t
43 prerr_endline ("NOT LOCALISED" ^ status#ppterm ~metasenv ~subst ~context t);
44 (*assert false*) HExtlib.dummy_floc
46 let metasenv, subst, term, _ =
49 (if use_coercions then status#coerc_db else NCicCoercion.empty_db))
50 metasenv subst context term expty ~localise
52 Disambiguate.Ok (term, metasenv, subst, ())
54 | NCicRefiner.Uncertain loc_msg ->
55 debug_print (lazy ("UNCERTAIN: [" ^ snd (Lazy.force loc_msg) ^ "] " ^
56 status#ppterm ~metasenv ~subst ~context term)) ;
57 Disambiguate.Uncertain loc_msg
58 | NCicRefiner.RefineFailure loc_msg ->
59 debug_print (lazy (P.sprintf "PRUNED:\nterm%s\nmessage:%s"
60 (status#ppterm ~metasenv ~subst ~context term) (snd(Lazy.force loc_msg))));
61 Disambiguate.Ko loc_msg
64 let refine_obj status metasenv subst _context _uri ~use_coercions obj _ _ugraph
67 (*prerr_endline ((P.sprintf "TEST_INTERPRETATION: %s" (status#ppobj obj)));*)
71 try NCicUntrusted.NCicHash.find localization_tbl t
73 (*assert false*)HExtlib.dummy_floc
77 NCicRefiner.typeof_obj
79 (if use_coercions then status#coerc_db
80 else NCicCoercion.empty_db))
83 Disambiguate.Ok (obj, [], [], ())
85 | NCicRefiner.Uncertain loc_msg ->
86 debug_print (lazy ("UNCERTAIN: [" ^ snd (Lazy.force loc_msg) ^ "] " ^
88 Disambiguate.Uncertain loc_msg
89 | NCicRefiner.RefineFailure loc_msg ->
90 debug_print (lazy (P.sprintf "PRUNED:\nobj: %s\nmessage: %s"
91 (status#ppobj obj) (snd(Lazy.force loc_msg))));
92 Disambiguate.Ko loc_msg
96 (* TODO move it to Cic *)
97 let find_in_context name context =
98 let rec aux acc = function
99 | [] -> raise Not_found
100 | hd :: _ when hd = name -> acc
101 | _ :: tl -> aux (acc + 1) tl
105 let interpretate_term_and_interpretate_term_option (status: #NCic.status)
106 ?(create_dummy_ids=false) ~obj_context ~mk_choice ~env ~uri ~is_path
109 (* create_dummy_ids shouldbe used only for interpretating patterns *)
112 let rec aux ~localize loc context = function
113 | NotationPt.AttributedTerm (`Loc loc, term) ->
114 let res = aux ~localize loc context term in
116 NCicUntrusted.NCicHash.add localization_tbl res loc;
118 | NotationPt.AttributedTerm (_, term) -> aux ~localize loc context term
120 (NotationPt.AttributedTerm (att, inner)::args)->
121 aux ~localize loc context
122 (NotationPt.AttributedTerm (att,NotationPt.Appl (inner :: args)))
123 | NotationPt.Appl (NotationPt.Appl inner :: args) ->
124 aux ~localize loc context (NotationPt.Appl (inner @ args))
125 | NotationPt.Appl (NotationPt.Symbol (symb, i) :: args) ->
126 let cic_args = List.map (aux ~localize loc context) args in
127 Disambiguate.resolve ~mk_choice ~env (DT.Symbol (symb, i)) (`Args cic_args)
128 | NotationPt.Appl terms ->
129 NCic.Appl (List.map (aux ~localize loc context) terms)
130 | NotationPt.Binder (binder_kind, (var, typ), body) ->
131 let cic_type = aux_option ~localize loc context `Type typ in
132 let cic_name = cic_name_of_name var in
133 let cic_body = aux ~localize loc (cic_name :: context) body in
134 (match binder_kind with
135 | `Lambda -> NCic.Lambda (cic_name, cic_type, cic_body)
137 | `Forall -> NCic.Prod (cic_name, cic_type, cic_body)
139 Disambiguate.resolve ~env ~mk_choice (DT.Symbol ("exists", 0))
140 (`Args [ cic_type; NCic.Lambda (cic_name, cic_type, cic_body) ]))
141 | NotationPt.Case (term, indty_ident, outtype, branches) ->
142 let cic_term = aux ~localize loc context term in
143 let cic_outtype = aux_option ~localize loc context `Term outtype in
144 let do_branch ((_, _, args), term) =
145 let rec do_branch' context = function
146 | [] -> aux ~localize loc context term
147 | (name, typ) :: tl ->
148 let cic_name = cic_name_of_name name in
149 let cic_body = do_branch' (cic_name :: context) tl in
152 | None -> NCic.Implicit `Type
153 | Some typ -> aux ~localize loc context typ
155 NCic.Lambda (cic_name, typ, cic_body)
157 do_branch' context args
159 if create_dummy_ids then
163 Ast.Wildcard,term -> ("wildcard",None,[]), term
165 raise (DisambiguateTypes.Invalid_choice
166 (lazy (loc, "Syntax error: the left hand side of a "^
167 "branch pattern must be \"_\"")))
170 NReference.reference_of_string "cic:/fake_indty.ind(0,0,0)"
172 NCic.Match (indtype_ref, cic_outtype, cic_term,
173 (List.map do_branch branches))
176 match indty_ident with
177 | Some (indty_ident, _) ->
178 (match Disambiguate.resolve ~env ~mk_choice
179 (DT.Id indty_ident) (`Args []) with
180 | NCic.Const (NReference.Ref (_,NReference.Ind _) as r) -> r
182 raise (Disambiguate.Try_again
183 (lazy "The type of the term to be matched is still unknown"))
185 raise (DisambiguateTypes.Invalid_choice
186 (lazy (loc,"The type of the term to be matched "^
187 "is not (co)inductive: " ^ status#ppterm
188 ~metasenv:[] ~subst:[] ~context:[] t))))
190 let rec fst_constructor =
192 (Ast.Pattern (head, _, _), _) :: _ -> head
193 | (Ast.Wildcard, _) :: tl -> fst_constructor tl
194 | [] -> raise (DT.Invalid_choice (lazy (loc,"The type "^
195 "of the term to be matched cannot be determined "^
196 "because it is an inductive type without constructors "^
197 "or because all patterns use wildcards")))
200 DisambiguateTypes.Environment.iter
203 (DisambiguateTypes.string_of_domain_item k ^ " => " ^
204 description_of_alias v)) env;
206 (match Disambiguate.resolve ~env ~mk_choice
207 (DT.Id (fst_constructor branches)) (`Args []) with
208 | NCic.Const (NReference.Ref (_,NReference.Con _) as r) ->
209 let b,_,_,_,_= NCicEnvironment.get_checked_indtys status r in
210 NReference.mk_indty b r
212 raise (Disambiguate.Try_again
213 (lazy "The type of the term to be matched is still unknown"))
215 raise (DisambiguateTypes.Invalid_choice
217 "The type of the term to be matched is not (co)inductive: "
218 ^ status#ppterm ~metasenv:[] ~subst:[] ~context:[] t))))
220 let _,leftsno,itl,_,indtyp_no =
221 NCicEnvironment.get_checked_indtys status indtype_ref in
224 List.nth itl indtyp_no
225 with _ -> assert false in
226 let rec count_prod t =
227 match NCicReduction.whd status ~subst:[] [] t with
228 NCic.Prod (_, _, t) -> 1 + (count_prod t)
231 let rec sort branches cl =
234 let rec analyze unused unrecognized useless =
237 if unrecognized != [] then
238 raise (DisambiguateTypes.Invalid_choice
240 (loc,"Unrecognized constructors: " ^
241 String.concat " " unrecognized)))
242 else if useless > 0 then
243 raise (DisambiguateTypes.Invalid_choice
245 (loc,"The last " ^ string_of_int useless ^
246 "case" ^ if useless > 1 then "s are" else " is" ^
250 | (Ast.Wildcard,_)::tl when not unused ->
251 analyze true unrecognized useless tl
252 | (Ast.Pattern (head,_,_),_)::tl when not unused ->
253 analyze unused (head::unrecognized) useless tl
254 | _::tl -> analyze unused unrecognized (useless + 1) tl
256 analyze false [] 0 branches
257 | (_,name,ty)::cltl ->
258 let rec find_and_remove =
262 (DisambiguateTypes.Invalid_choice
263 (lazy (loc, "Missing case: " ^ name)))
264 | ((Ast.Wildcard, _) as branch :: _) as branches ->
266 | (Ast.Pattern (name',_,_),_) as branch :: tl
270 let found,rest = find_and_remove tl in
273 let branch,tl = find_and_remove branches in
275 Ast.Pattern (name,y,args),term ->
276 if List.length args = count_prod ty - leftsno then
277 ((name,y,args),term)::sort tl cltl
280 (DisambiguateTypes.Invalid_choice
281 (lazy (loc,"Wrong number of arguments for " ^ name)))
282 | Ast.Wildcard,term ->
288 (`Lambda, (NotationPt.Ident ("_", None), None),
291 (("wildcard",None,[]),
292 mk_lambdas (count_prod ty - leftsno)) :: sort tl cltl
294 let branches = sort branches cl in
295 NCic.Match (indtype_ref, cic_outtype, cic_term,
296 (List.map do_branch branches))
297 | NotationPt.Cast (t1, t2) ->
298 let cic_t1 = aux ~localize loc context t1 in
299 let cic_t2 = aux ~localize loc context t2 in
300 NCic.LetIn ("_",cic_t2,cic_t1, NCic.Rel 1)
301 | NotationPt.LetIn ((name, typ), def, body) ->
302 let cic_def = aux ~localize loc context def in
303 let cic_name = cic_name_of_name name in
306 | None -> NCic.Implicit `Type
307 | Some t -> aux ~localize loc context t
309 let cic_body = aux ~localize loc (cic_name :: context) body in
310 NCic.LetIn (cic_name, cic_typ, cic_def, cic_body)
313 | NotationPt.NRef _ when is_path -> raise Disambiguate.PathNotWellFormed
314 | NotationPt.Ident (name, subst) ->
315 assert (subst = None);
317 NCic.Rel (find_in_context name context)
319 try NCic.Const (List.assoc name obj_context)
321 Disambiguate.resolve ~env ~mk_choice (DT.Id name) (`Args []))
322 | NotationPt.Uri (uri, subst) ->
323 assert (subst = None);
325 NCic.Const (NReference.reference_of_string uri)
326 with NRef.IllFormedReference _ ->
327 NotationPt.fail loc "Ill formed reference")
328 | NotationPt.NRef nref -> NCic.Const nref
329 | NotationPt.NCic t -> t
330 | NotationPt.Implicit `Vector -> NCic.Implicit `Vector
331 | NotationPt.Implicit `JustOne -> NCic.Implicit `Term
332 | NotationPt.Implicit (`Tagged s) -> NCic.Implicit (`Tagged s)
333 | NotationPt.UserInput -> NCic.Implicit `Hole
334 | NotationPt.Num (num, i) ->
335 Disambiguate.resolve ~env ~mk_choice (DT.Num i) (`Num_arg num)
336 | NotationPt.Meta (index, subst) ->
339 (function None -> assert false| Some t -> aux ~localize loc context t)
342 NCic.Meta (index, (0, NCic.Ctx cic_subst))
343 | NotationPt.Sort `Prop -> NCic.Sort NCic.Prop
344 | NotationPt.Sort `Set -> NCic.Sort (NCic.Type
345 [`Type,NUri.uri_of_string "cic:/matita/pts/Type.univ"])
346 | NotationPt.Sort (`NType s) -> NCic.Sort (NCic.Type
347 [`Type,NUri.uri_of_string ("cic:/matita/pts/Type" ^ s ^ ".univ")])
348 | NotationPt.Sort (`NCProp s) -> NCic.Sort (NCic.Type
349 [`CProp,NUri.uri_of_string ("cic:/matita/pts/Type" ^ s ^ ".univ")])
350 | NotationPt.Symbol (symbol, instance) ->
351 Disambiguate.resolve ~env ~mk_choice
352 (DT.Symbol (symbol, instance)) (`Args [])
353 | NotationPt.Variable _
355 | NotationPt.Layout _
356 | NotationPt.Literal _ -> assert false (* god bless Bologna *)
357 and aux_option ~localize loc context annotation = function
358 | None -> NCic.Implicit annotation
359 | Some (NotationPt.AttributedTerm (`Loc loc, term)) ->
360 let res = aux_option ~localize loc context annotation (Some term) in
362 NCicUntrusted.NCicHash.add localization_tbl res loc;
364 | Some (NotationPt.AttributedTerm (_, term)) ->
365 aux_option ~localize loc context annotation (Some term)
366 | Some NotationPt.Implicit `JustOne -> NCic.Implicit annotation
367 | Some NotationPt.Implicit `Vector -> NCic.Implicit `Vector
368 | Some term -> aux ~localize loc context term
370 (fun ~context -> aux ~localize:true HExtlib.dummy_floc context),
371 (fun ~context -> aux_option ~localize:true HExtlib.dummy_floc context)
374 let interpretate_term status ?(create_dummy_ids=false) ~context ~env ~uri
375 ~is_path ast ~obj_context ~localization_tbl ~mk_choice
377 let context = List.map fst context in
379 (interpretate_term_and_interpretate_term_option status
380 ~obj_context ~mk_choice ~create_dummy_ids ~env ~uri ~is_path
385 let interpretate_term_option status ?(create_dummy_ids=false) ~context ~env ~uri
386 ~is_path ~localization_tbl ~mk_choice ~obj_context
388 let context = List.map fst context in
390 (interpretate_term_and_interpretate_term_option status
391 ~obj_context ~mk_choice ~create_dummy_ids ~env ~uri ~is_path
396 let disambiguate_path status path =
397 let localization_tbl = NCicUntrusted.NCicHash.create 23 in
399 (interpretate_term_and_interpretate_term_option status
400 ~obj_context:[] ~mk_choice:(fun _ -> assert false)
401 ~create_dummy_ids:true ~env:DisambiguateTypes.Environment.empty
402 ~uri:None ~is_path:true ~localization_tbl) ~context:[] path
405 let ncic_name_of_ident = function
406 | Ast.Ident (name, None) -> name
410 let interpretate_obj status
411 (* ?(create_dummy_ids=false) *)
412 ~context ~env ~uri ~is_path obj ~localization_tbl ~mk_choice
414 assert (context = []);
415 assert (is_path = false);
416 let interpretate_term ~obj_context =
417 interpretate_term ~mk_choice ~localization_tbl ~obj_context in
418 let interpretate_term_option ~obj_context =
419 interpretate_term_option ~mk_choice ~localization_tbl ~obj_context in
420 let uri = match uri with | None -> assert false | Some u -> u in
422 | NotationPt.Theorem (name, ty, bo, attrs) ->
423 let _, flavour, _ = attrs in
425 interpretate_term status
426 ~obj_context:[] ~context:[] ~env ~uri:None ~is_path:false ty
428 let height = (* XXX calculate *) 0 in
430 (match bo,flavour with
432 NCic.Constant ([],name,None,ty',attrs)
433 | Some _,`Axiom -> assert false
435 NCic.Constant ([],name,Some (NCic.Implicit `Term),ty',attrs)
438 interpretate_term status
439 ~obj_context:[] ~context:[] ~env ~uri:None ~is_path:false bo
441 NCic.Constant ([],name,Some bo,ty',attrs))
442 | NotationPt.Inductive (params,tyl) ->
446 (fun (context,res) (name,t) ->
449 None -> NotationPt.Implicit `JustOne
451 let name = cic_name_of_name name in
453 interpretate_term status ~obj_context:[] ~context ~env ~uri:None
456 (name,NCic.Decl t)::context,(name,t)::res
459 context,List.rev res in
461 List.fold_right (fun (name,ty) t -> NCic.Prod (name,ty,t)) params in
462 let leftno = List.length params in
463 let _,inductive,_,_ = try List.hd tyl with Failure _ -> assert false in
467 (fun (i,res) (name,_,_,_) ->
469 NReference.reference_of_spec uri (NReference.Ind (inductive,i,leftno))
471 i+1,(name,nref)::res)
475 (fun (name,_,ty,cl) ->
478 (interpretate_term status ~obj_context:[] ~context ~env ~uri:None
479 ~is_path:false ty) in
485 (interpretate_term status ~obj_context ~context ~env ~uri:None
486 ~is_path:false ty) in
487 let relevance = [] in
490 let relevance = [] in
491 relevance,name,ty',cl'
494 let height = (* XXX calculate *) 0 in
495 let attrs = `Provided, `Regular in
497 NCic.Inductive (inductive,leftno,tyl,attrs)
498 | NotationPt.Record (params,name,ty,fields) ->
502 (fun (context,res) (name,t) ->
505 None -> NotationPt.Implicit `JustOne
507 let name = cic_name_of_name name in
509 interpretate_term status ~obj_context:[] ~context ~env ~uri:None
512 (name,NCic.Decl t)::context,(name,t)::res
515 context,List.rev res in
517 List.fold_right (fun (name,ty) t -> NCic.Prod (name,ty,t)) params in
518 let leftno = List.length params in
521 (interpretate_term status ~obj_context:[] ~context ~env ~uri:None
522 ~is_path:false ty) in
524 NReference.reference_of_spec uri (NReference.Ind (true,0,leftno)) in
525 let obj_context = [name,nref] in
529 (fun (context,res) (name,ty,_coercion,_arity) ->
531 interpretate_term status ~obj_context ~context ~env ~uri:None
533 let context' = (name,NCic.Decl ty)::context in
534 context',(name,ty)::res
535 ) (context,[]) fields) in
537 let mutind = NCic.Const nref in
538 if params = [] then mutind
541 (mutind::mk_rels (List.length params) (List.length fields)) in
543 List.fold_left (fun t (name,ty) -> NCic.Prod (name,ty,t)) concl fields' in
544 let con' = add_params con in
545 let relevance = [] in
546 let tyl = [relevance,name,ty',[relevance,"mk_" ^ name,con']] in
547 let field_names = List.map (fun (x,_,y,z) -> x,y,z) fields in
548 let height = (* XXX calculate *) 0 in
549 let attrs = `Provided, `Record field_names in
551 NCic.Inductive (true,leftno,tyl,attrs)
552 | NotationPt.LetRec (kind, defs, attrs) ->
553 let inductive = kind = `Inductive in
556 (fun (i,acc) (_,(name,_),_,k) ->
558 (ncic_name_of_ident name, NReference.reference_of_spec uri
559 (if inductive then NReference.Fix (i,k,0)
560 else NReference.CoFix i)) :: acc))
565 (fun (params, (name, typ), body, decr_idx) ->
566 let add_binders kind t =
569 NotationPt.Binder (kind, var, t)) params t
572 interpretate_term status
573 ~obj_context ~context ~env ~uri:None ~is_path:false
574 (add_binders `Lambda body)
577 interpretate_term_option status
579 ~context ~env ~uri:None ~is_path:false `Type
580 (HExtlib.map_option (add_binders `Pi) typ)
582 ([],ncic_name_of_ident name, decr_idx, cic_type, cic_body))
585 let height = (* XXX calculate *) 0 in
587 NCic.Fixpoint (inductive,inductiveFuns,attrs)
590 let disambiguate_term (status: #NCicCoercion.status) ~context ~metasenv ~subst
591 ~expty ~mk_implicit ~description_of_alias ~fix_instance ~mk_choice
592 ~aliases ~universe ~lookup_in_library (text,prefix_len,term)
594 let mk_localization_tbl x = NCicUntrusted.NCicHash.create x in
596 MultiPassDisambiguator.disambiguate_thing
597 ~freshen_thing:NotationUtil.freshen_term
598 ~context ~metasenv ~initial_ugraph:() ~aliases
599 ~mk_implicit ~description_of_alias ~fix_instance
600 ~string_context_of_context:(List.map (fun (x,_) -> Some x))
601 ~universe ~uri:None ~pp_thing:(NotationPp.pp_term status)
602 ~passes:(MultiPassDisambiguator.passes ())
603 ~lookup_in_library ~domain_of_thing:Disambiguate.domain_of_term
604 ~interpretate_thing:(interpretate_term status ~obj_context:[] ~mk_choice (?create_dummy_ids:None))
605 ~refine_thing:(refine_term status) (text,prefix_len,term)
606 ~mk_localization_tbl ~expty ~subst
608 List.map (function (a,b,c,d,_) -> a,b,c,d) res, b
611 let disambiguate_obj (status: #NCicCoercion.status)
612 ~mk_implicit ~description_of_alias ~fix_instance ~mk_choice
613 ~aliases ~universe ~lookup_in_library ~uri (text,prefix_len,obj)
615 let mk_localization_tbl x = NCicUntrusted.NCicHash.create x in
617 MultiPassDisambiguator.disambiguate_thing
618 ~freshen_thing:NotationUtil.freshen_obj
619 ~context:[] ~metasenv:[] ~subst:[] ~initial_ugraph:() ~aliases
620 ~mk_implicit ~description_of_alias ~fix_instance
621 ~string_context_of_context:(List.map (fun (x,_) -> Some x))
624 ~pp_thing:(NotationPp.pp_obj (NotationPp.pp_term status))
625 ~passes:(MultiPassDisambiguator.passes ())
626 ~lookup_in_library ~domain_of_thing:Disambiguate.domain_of_obj
627 ~interpretate_thing:(interpretate_obj status ~mk_choice)
628 ~refine_thing:(refine_obj status)
629 (text,prefix_len,obj)
630 ~mk_localization_tbl ~expty:`XTNone
632 List.map (function (a,b,c,d,_) -> a,b,c,d) res, b
638 [false, NUri.uri_of_string ("cic:/matita/pts/Type.univ")]
640 [false, NUri.uri_of_string ("cic:/matita/pts/Type"^string_of_int n^".univ")]
644 [false, NUri.uri_of_string ("cic:/matita/pts/CProp.univ")]
646 [false, NUri.uri_of_string ("cic:/matita/pts/CProp"^string_of_int n^".univ")]
648 NCicEnvironment.add_constraint true (mk_type 0) (mk_type 1);
649 NCicEnvironment.add_constraint true (mk_cprop 0) (mk_cprop 1);
650 NCicEnvironment.add_constraint true (mk_cprop 0) (mk_type 1);
651 NCicEnvironment.add_constraint true (mk_type 0) (mk_cprop 1);
652 NCicEnvironment.add_constraint false (mk_cprop 0) (mk_type 0);
653 NCicEnvironment.add_constraint false (mk_type 0) (mk_cprop 0);
655 NCicEnvironment.add_constraint true (mk_type 1) (mk_type 2);
656 NCicEnvironment.add_constraint true (mk_cprop 1) (mk_cprop 2);
657 NCicEnvironment.add_constraint true (mk_cprop 1) (mk_type 2);
658 NCicEnvironment.add_constraint true (mk_type 1) (mk_cprop 2);
659 NCicEnvironment.add_constraint false (mk_cprop 1) (mk_type 1);
660 NCicEnvironment.add_constraint false (mk_type 1) (mk_cprop 1);
662 NCicEnvironment.add_constraint true (mk_type 2) (mk_type 3);
663 NCicEnvironment.add_constraint true (mk_cprop 2) (mk_cprop 3);
664 NCicEnvironment.add_constraint true (mk_cprop 2) (mk_type 3);
665 NCicEnvironment.add_constraint true (mk_type 2) (mk_cprop 3);
666 NCicEnvironment.add_constraint false (mk_cprop 2) (mk_type 2);
667 NCicEnvironment.add_constraint false (mk_type 2) (mk_cprop 2);
669 NCicEnvironment.add_constraint false (mk_cprop 3) (mk_type 3);
670 NCicEnvironment.add_constraint false (mk_type 3) (mk_cprop 3);