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 $ *)
16 open DisambiguateTypes
19 module Ast = CicNotationPt
20 module NRef = NReference
22 let debug_print s = prerr_endline (Lazy.force s);;
23 let debug_print _ = ();;
25 let reference_of_oxuri = ref (fun _ -> assert false);;
26 let set_reference_of_oxuri f = reference_of_oxuri := f;;
28 let cic_name_of_name = function
29 | Ast.Ident (n, None) -> n
33 let rec mk_rels howmany from =
36 | _ -> (NCic.Rel (howmany + from)) :: (mk_rels (howmany-1) from)
40 metasenv subst context uri ~rdb ~use_coercions term expty _ ~localization_tbl=
42 debug_print (lazy (sprintf "TEST_INTERPRETATION: %s"
43 (NCicPp.ppterm ~metasenv ~subst ~context term)));
46 try NCicUntrusted.NCicHash.find localization_tbl t
48 prerr_endline ("NOT LOCALISED" ^ NCicPp.ppterm ~metasenv ~subst ~context t);
49 (*assert false*) HExtlib.dummy_floc
51 let metasenv, subst, term, _ =
54 (if use_coercions then rdb#coerc_db else NCicCoercion.empty_db))
55 metasenv subst context term expty ~localise
57 Disambiguate.Ok (term, metasenv, subst, ())
59 | NCicRefiner.Uncertain loc_msg ->
60 debug_print (lazy ("UNCERTAIN: [" ^ snd (Lazy.force loc_msg) ^ "] " ^
61 NCicPp.ppterm ~metasenv ~subst ~context term)) ;
62 Disambiguate.Uncertain loc_msg
63 | NCicRefiner.RefineFailure loc_msg ->
64 debug_print (lazy (sprintf "PRUNED:\nterm%s\nmessage:%s"
65 (NCicPp.ppterm ~metasenv ~subst ~context term) (snd(Lazy.force loc_msg))));
66 Disambiguate.Ko loc_msg
70 ~rdb metasenv subst _context _uri
71 ~use_coercions obj _ _ugraph ~localization_tbl
76 try NCicUntrusted.NCicHash.find localization_tbl t
78 (*assert false*)HExtlib.dummy_floc
82 NCicRefiner.typeof_obj
84 (if use_coercions then rdb#coerc_db
85 else NCicCoercion.empty_db))
88 Disambiguate.Ok (obj, [], [], ())
90 | NCicRefiner.Uncertain loc_msg ->
91 debug_print (lazy ("UNCERTAIN: [" ^ snd (Lazy.force loc_msg) ^ "] " ^
93 Disambiguate.Uncertain loc_msg
94 | NCicRefiner.RefineFailure loc_msg ->
95 debug_print (lazy (sprintf "PRUNED:\nobj: %s\nmessage: %s"
96 (NCicPp.ppobj obj) (snd(Lazy.force loc_msg))));
97 Disambiguate.Ko loc_msg
101 (* TODO move it to Cic *)
102 let find_in_context name context =
103 let rec aux acc = function
104 | [] -> raise Not_found
105 | hd :: _ when hd = name -> acc
106 | _ :: tl -> aux (acc + 1) tl
110 let interpretate_term_and_interpretate_term_option
111 ?(create_dummy_ids=false)
112 ~obj_context ~mk_choice ~env ~uri ~is_path ~localization_tbl
114 (* create_dummy_ids shouldbe used only for interpretating patterns *)
117 let rec aux ~localize loc context = function
118 | CicNotationPt.AttributedTerm (`Loc loc, term) ->
119 let res = aux ~localize loc context term in
121 NCicUntrusted.NCicHash.add localization_tbl res loc;
123 | CicNotationPt.AttributedTerm (_, term) -> aux ~localize loc context term
124 | CicNotationPt.Appl (CicNotationPt.Appl inner :: args) ->
125 aux ~localize loc context (CicNotationPt.Appl (inner @ args))
127 (CicNotationPt.AttributedTerm (att,(CicNotationPt.Appl inner))::args)->
128 aux ~localize loc context
129 (CicNotationPt.AttributedTerm (att,CicNotationPt.Appl (inner @ args)))
130 | CicNotationPt.Appl (CicNotationPt.Symbol (symb, i) :: args) ->
131 let cic_args = List.map (aux ~localize loc context) args in
132 Disambiguate.resolve ~mk_choice ~env (Symbol (symb, i)) (`Args cic_args)
133 | CicNotationPt.Appl terms ->
134 NCic.Appl (List.map (aux ~localize loc context) terms)
135 | CicNotationPt.Binder (binder_kind, (var, typ), body) ->
136 let cic_type = aux_option ~localize loc context `Type typ in
137 let cic_name = cic_name_of_name var in
138 let cic_body = aux ~localize loc (cic_name :: context) body in
139 (match binder_kind with
140 | `Lambda -> NCic.Lambda (cic_name, cic_type, cic_body)
142 | `Forall -> NCic.Prod (cic_name, cic_type, cic_body)
144 Disambiguate.resolve ~env ~mk_choice (Symbol ("exists", 0))
145 (`Args [ cic_type; NCic.Lambda (cic_name, cic_type, cic_body) ]))
146 | CicNotationPt.Case (term, indty_ident, outtype, branches) ->
147 let cic_term = aux ~localize loc context term in
148 let cic_outtype = aux_option ~localize loc context `Term outtype in
149 let do_branch ((_, _, args), term) =
150 let rec do_branch' context = function
151 | [] -> aux ~localize loc context term
152 | (name, typ) :: tl ->
153 let cic_name = cic_name_of_name name in
154 let cic_body = do_branch' (cic_name :: context) tl in
157 | None -> NCic.Implicit `Type
158 | Some typ -> aux ~localize loc context typ
160 NCic.Lambda (cic_name, typ, cic_body)
162 do_branch' context args
164 if create_dummy_ids then
168 Ast.Wildcard,term -> ("wildcard",None,[]), term
170 raise (DisambiguateTypes.Invalid_choice
171 (lazy (loc, "Syntax error: the left hand side of a "^
172 "branch pattern must be \"_\"")))
176 NCic.MutCase (ref, cic_outtype, cic_term,
177 (List.map do_branch branches))
178 *) ignore branches; assert false (* patterns not implemented yet *)
181 match indty_ident with
182 | Some (indty_ident, _) ->
183 (match Disambiguate.resolve ~env ~mk_choice
184 (Id indty_ident) (`Args []) with
185 | NCic.Const (NReference.Ref (_,NReference.Ind _) as r) -> r
187 raise (Disambiguate.Try_again
188 (lazy "The type of the term to be matched is still unknown"))
190 raise (DisambiguateTypes.Invalid_choice
191 (lazy (loc,"The type of the term to be matched "^
192 "is not (co)inductive: " ^ NCicPp.ppterm
193 ~metasenv:[] ~subst:[] ~context:[] t))))
195 let rec fst_constructor =
197 (Ast.Pattern (head, _, _), _) :: _ -> head
198 | (Ast.Wildcard, _) :: tl -> fst_constructor tl
199 | [] -> raise (Invalid_choice (lazy (loc,"The type "^
200 "of the term to be matched cannot be determined "^
201 "because it is an inductive type without constructors "^
202 "or because all patterns use wildcards")))
205 DisambiguateTypes.Environment.iter
208 (DisambiguateTypes.string_of_domain_item k ^ " => " ^
209 description_of_alias v)) env;
211 (match Disambiguate.resolve ~env ~mk_choice
212 (Id (fst_constructor branches)) (`Args []) with
213 | NCic.Const (NReference.Ref (_,NReference.Con _) as r) ->
214 let b,_,_,_,_ = NCicEnvironment.get_checked_indtys r in
215 NReference.mk_indty b r
217 raise (Disambiguate.Try_again
218 (lazy "The type of the term to be matched is still unknown"))
220 raise (DisambiguateTypes.Invalid_choice
222 "The type of the term to be matched is not (co)inductive: "
223 ^ NCicPp.ppterm ~metasenv:[] ~subst:[] ~context:[] t))))
225 let _,leftsno,itl,_,indtyp_no =
226 NCicEnvironment.get_checked_indtys indtype_ref in
229 List.nth itl indtyp_no
230 with _ -> assert false in
231 let rec count_prod t =
232 match NCicReduction.whd ~subst:[] [] t with
233 NCic.Prod (_, _, t) -> 1 + (count_prod t)
236 let rec sort branches cl =
239 let rec analyze unused unrecognized useless =
242 if unrecognized != [] then
243 raise (DisambiguateTypes.Invalid_choice
245 (loc,"Unrecognized constructors: " ^
246 String.concat " " unrecognized)))
247 else if useless > 0 then
248 raise (DisambiguateTypes.Invalid_choice
250 (loc,"The last " ^ string_of_int useless ^
251 "case" ^ if useless > 1 then "s are" else " is" ^
255 | (Ast.Wildcard,_)::tl when not unused ->
256 analyze true unrecognized useless tl
257 | (Ast.Pattern (head,_,_),_)::tl when not unused ->
258 analyze unused (head::unrecognized) useless tl
259 | _::tl -> analyze unused unrecognized (useless + 1) tl
261 analyze false [] 0 branches
262 | (_,name,ty)::cltl ->
263 let rec find_and_remove =
267 (DisambiguateTypes.Invalid_choice
268 (lazy (loc, "Missing case: " ^ name)))
269 | ((Ast.Wildcard, _) as branch :: _) as branches ->
271 | (Ast.Pattern (name',_,_),_) as branch :: tl
275 let found,rest = find_and_remove tl in
278 let branch,tl = find_and_remove branches in
280 Ast.Pattern (name,y,args),term ->
281 if List.length args = count_prod ty - leftsno then
282 ((name,y,args),term)::sort tl cltl
285 (DisambiguateTypes.Invalid_choice
286 (lazy (loc,"Wrong number of arguments for " ^ name)))
287 | Ast.Wildcard,term ->
293 (`Lambda, (CicNotationPt.Ident ("_", None), None),
296 (("wildcard",None,[]),
297 mk_lambdas (count_prod ty - leftsno)) :: sort tl cltl
299 let branches = sort branches cl in
300 NCic.Match (indtype_ref, cic_outtype, cic_term,
301 (List.map do_branch branches))
302 | CicNotationPt.Cast (t1, t2) ->
303 let cic_t1 = aux ~localize loc context t1 in
304 let cic_t2 = aux ~localize loc context t2 in
305 NCic.LetIn ("_",cic_t2,cic_t1, NCic.Rel 1)
306 | CicNotationPt.LetIn ((name, typ), def, body) ->
307 let cic_def = aux ~localize loc context def in
308 let cic_name = cic_name_of_name name in
311 | None -> NCic.Implicit `Type
312 | Some t -> aux ~localize loc context t
314 let cic_body = aux ~localize loc (cic_name :: context) body in
315 NCic.LetIn (cic_name, cic_typ, cic_def, cic_body)
316 | CicNotationPt.LetRec (_kind, _defs, _body) -> NCic.Implicit `Term
317 | CicNotationPt.Ident _
318 | CicNotationPt.Uri _
319 | CicNotationPt.NRef _ when is_path -> raise Disambiguate.PathNotWellFormed
320 | CicNotationPt.Ident (name, subst) ->
321 assert (subst = None);
323 NCic.Rel (find_in_context name context)
325 try NCic.Const (List.assoc name obj_context)
327 Disambiguate.resolve ~env ~mk_choice (Id name) (`Args []))
328 | CicNotationPt.Uri (uri, subst) ->
329 assert (subst = None);
331 NCic.Const (!reference_of_oxuri(UriManager.uri_of_string uri))
332 with NRef.IllFormedReference _ ->
333 CicNotationPt.fail loc "Ill formed reference")
334 | CicNotationPt.NRef nref -> NCic.Const nref
335 | CicNotationPt.NCic t ->
336 let context = (* to make metas_of_term happy *)
337 List.map (fun x -> x,NCic.Decl (NCic.Implicit `Type)) context in
338 assert(NCicUntrusted.metas_of_term [] context t = []); t
339 | CicNotationPt.Implicit `Vector -> NCic.Implicit `Vector
340 | CicNotationPt.Implicit `JustOne -> NCic.Implicit `Term
341 | CicNotationPt.Implicit (`Tagged s) -> NCic.Implicit (`Tagged s)
342 | CicNotationPt.UserInput -> NCic.Implicit `Hole
343 | CicNotationPt.Num (num, i) ->
344 Disambiguate.resolve ~env ~mk_choice (Num i) (`Num_arg num)
345 | CicNotationPt.Meta (index, subst) ->
348 (function None -> assert false| Some t -> aux ~localize loc context t)
351 NCic.Meta (index, (0, NCic.Ctx cic_subst))
352 | CicNotationPt.Sort `Prop -> NCic.Sort NCic.Prop
353 | CicNotationPt.Sort `Set -> NCic.Sort (NCic.Type
354 [`Type,NUri.uri_of_string "cic:/matita/pts/Type.univ"])
355 | CicNotationPt.Sort (`Type _u) -> NCic.Sort (NCic.Type
356 [`Type,NUri.uri_of_string "cic:/matita/pts/Type0.univ"])
357 | CicNotationPt.Sort (`NType s) -> NCic.Sort (NCic.Type
358 [`Type,NUri.uri_of_string ("cic:/matita/pts/Type" ^ s ^ ".univ")])
359 | CicNotationPt.Sort (`NCProp s) -> NCic.Sort (NCic.Type
360 [`CProp,NUri.uri_of_string ("cic:/matita/pts/Type" ^ s ^ ".univ")])
361 | CicNotationPt.Sort (`CProp _u) -> NCic.Sort (NCic.Type
362 [`CProp,NUri.uri_of_string "cic:/matita/pts/Type.univ"])
363 | CicNotationPt.Symbol (symbol, instance) ->
364 Disambiguate.resolve ~env ~mk_choice
365 (Symbol (symbol, instance)) (`Args [])
366 | CicNotationPt.Variable _
367 | CicNotationPt.Magic _
368 | CicNotationPt.Layout _
369 | CicNotationPt.Literal _ -> assert false (* god bless Bologna *)
370 and aux_option ~localize loc context annotation = function
371 | None -> NCic.Implicit annotation
372 | Some (CicNotationPt.AttributedTerm (`Loc loc, term)) ->
373 let res = aux_option ~localize loc context annotation (Some term) in
375 NCicUntrusted.NCicHash.add localization_tbl res loc;
377 | Some (CicNotationPt.AttributedTerm (_, term)) ->
378 aux_option ~localize loc context annotation (Some term)
379 | Some CicNotationPt.Implicit `JustOne -> NCic.Implicit annotation
380 | Some CicNotationPt.Implicit `Vector -> NCic.Implicit `Vector
381 | Some term -> aux ~localize loc context term
383 (fun ~context -> aux ~localize:true HExtlib.dummy_floc context),
384 (fun ~context -> aux_option ~localize:true HExtlib.dummy_floc context)
387 let interpretate_term ?(create_dummy_ids=false) ~context ~env ~uri ~is_path ast
388 ~obj_context ~localization_tbl ~mk_choice
390 let context = List.map fst context in
392 (interpretate_term_and_interpretate_term_option
393 ~obj_context ~mk_choice ~create_dummy_ids ~env ~uri ~is_path ~localization_tbl)
397 let interpretate_term_option
398 ?(create_dummy_ids=false) ~context ~env ~uri ~is_path
399 ~localization_tbl ~mk_choice ~obj_context
401 let context = List.map fst context in
403 (interpretate_term_and_interpretate_term_option
404 ~obj_context ~mk_choice ~create_dummy_ids ~env ~uri ~is_path ~localization_tbl)
408 let disambiguate_path path =
409 let localization_tbl = NCicUntrusted.NCicHash.create 23 in
411 (interpretate_term_and_interpretate_term_option
412 ~obj_context:[] ~mk_choice:(fun _ -> assert false)
413 ~create_dummy_ids:true ~env:DisambiguateTypes.Environment.empty
414 ~uri:None ~is_path:true ~localization_tbl) ~context:[] path
417 let new_flavour_of_flavour = function
418 | `Definition -> `Definition
419 | `MutualDefinition -> `Definition
422 | `Remark -> `Example
423 | `Theorem -> `Theorem
424 | `Variant -> `Corollary
428 let ncic_name_of_ident = function
429 | Ast.Ident (name, None) -> name
434 (* ?(create_dummy_ids=false) *)
435 ~context ~env ~uri ~is_path obj ~localization_tbl ~mk_choice
437 assert (context = []);
438 assert (is_path = false);
439 let interpretate_term ~obj_context =
440 interpretate_term ~mk_choice ~localization_tbl ~obj_context in
441 let interpretate_term_option ~obj_context =
442 interpretate_term_option ~mk_choice ~localization_tbl ~obj_context in
443 let uri = match uri with | None -> assert false | Some u -> u in
445 | CicNotationPt.Theorem (flavour, name, ty, bo, pragma) ->
448 ~obj_context:[] ~context:[] ~env ~uri:None ~is_path:false ty
450 let height = (* XXX calculate *) 0 in
452 (match bo,flavour with
454 let attrs = `Provided, new_flavour_of_flavour flavour, pragma in
455 NCic.Constant ([],name,None,ty',attrs)
456 | Some _,`Axiom -> assert false
458 let attrs = `Provided, new_flavour_of_flavour flavour, pragma in
459 NCic.Constant ([],name,Some (NCic.Implicit `Term),ty',attrs)
462 | CicNotationPt.LetRec (kind, defs, _) ->
463 let inductive = kind = `Inductive in
466 (fun (i,acc) (_,(name,_),_,k) ->
468 (ncic_name_of_ident name, NReference.reference_of_spec uri
469 (if inductive then NReference.Fix (i,k,0)
470 else NReference.CoFix i)) :: acc))
475 (fun (params, (name, typ), body, decr_idx) ->
476 let add_binders kind t =
479 CicNotationPt.Binder (kind, var, t)) params t
483 ~obj_context ~context ~env ~uri:None ~is_path:false
484 (add_binders `Lambda body)
487 interpretate_term_option
489 ~context ~env ~uri:None ~is_path:false `Type
490 (HExtlib.map_option (add_binders `Pi) typ)
492 ([],ncic_name_of_ident name, decr_idx, cic_type, cic_body))
495 let attrs = `Provided, new_flavour_of_flavour flavour, pragma in
496 NCic.Fixpoint (inductive,inductiveFuns,attrs)
500 ~obj_context:[] ~context:[] ~env ~uri:None ~is_path:false bo
502 let attrs = `Provided, new_flavour_of_flavour flavour, pragma in
503 NCic.Constant ([],name,Some bo,ty',attrs)))
504 | CicNotationPt.Inductive (params,tyl) ->
508 (fun (context,res) (name,t) ->
511 None -> CicNotationPt.Implicit `JustOne
513 let name = cic_name_of_name name in
515 interpretate_term ~obj_context:[] ~context ~env ~uri:None
518 (name,NCic.Decl t)::context,(name,t)::res
521 context,List.rev res in
523 List.fold_right (fun (name,ty) t -> NCic.Prod (name,ty,t)) params in
524 let leftno = List.length params in
525 let _,inductive,_,_ = try List.hd tyl with Failure _ -> assert false in
529 (fun (i,res) (name,_,_,_) ->
531 NReference.reference_of_spec uri (NReference.Ind (inductive,i,leftno))
533 i+1,(name,nref)::res)
537 (fun (name,_,ty,cl) ->
540 (interpretate_term ~obj_context:[] ~context ~env ~uri:None
541 ~is_path:false ty) in
547 (interpretate_term ~obj_context ~context ~env ~uri:None
548 ~is_path:false ty) in
549 let relevance = [] in
552 let relevance = [] in
553 relevance,name,ty',cl'
556 let height = (* XXX calculate *) 0 in
557 let attrs = `Provided, `Regular in
559 NCic.Inductive (inductive,leftno,tyl,attrs)
560 | CicNotationPt.Record (params,name,ty,fields) ->
564 (fun (context,res) (name,t) ->
567 None -> CicNotationPt.Implicit `JustOne
569 let name = cic_name_of_name name in
571 interpretate_term ~obj_context:[] ~context ~env ~uri:None
574 (name,NCic.Decl t)::context,(name,t)::res
577 context,List.rev res in
579 List.fold_right (fun (name,ty) t -> NCic.Prod (name,ty,t)) params in
580 let leftno = List.length params in
583 (interpretate_term ~obj_context:[] ~context ~env ~uri:None
584 ~is_path:false ty) in
586 NReference.reference_of_spec uri (NReference.Ind (true,0,leftno)) in
587 let obj_context = [name,nref] in
591 (fun (context,res) (name,ty,_coercion,_arity) ->
593 interpretate_term ~obj_context ~context ~env ~uri:None
595 let context' = (name,NCic.Decl ty)::context in
596 context',(name,ty)::res
597 ) (context,[]) fields) in
599 let mutind = NCic.Const nref in
600 if params = [] then mutind
603 (mutind::mk_rels (List.length params) (List.length fields)) in
605 List.fold_left (fun t (name,ty) -> NCic.Prod (name,ty,t)) concl fields' in
606 let con' = add_params con in
607 let relevance = [] in
608 let tyl = [relevance,name,ty',[relevance,"mk_" ^ name,con']] in
609 let field_names = List.map (fun (x,_,y,z) -> x,y,z) fields in
610 let height = (* XXX calculate *) 0 in
611 let attrs = `Provided, `Record field_names in
613 NCic.Inductive (true,leftno,tyl,attrs)
616 let disambiguate_term ~context ~metasenv ~subst ~expty
617 ~mk_implicit ~description_of_alias ~fix_instance ~mk_choice
618 ~aliases ~universe ~rdb ~lookup_in_library
619 (text,prefix_len,term)
621 let mk_localization_tbl x = NCicUntrusted.NCicHash.create x in
623 MultiPassDisambiguator.disambiguate_thing
624 ~freshen_thing:CicNotationUtil.freshen_term
625 ~context ~metasenv ~initial_ugraph:() ~aliases
626 ~mk_implicit ~description_of_alias ~fix_instance
627 ~string_context_of_context:(List.map (fun (x,_) -> Some x))
628 ~universe ~uri:None ~pp_thing:CicNotationPp.pp_term
629 ~passes:(MultiPassDisambiguator.passes ())
630 ~lookup_in_library ~domain_of_thing:Disambiguate.domain_of_term
631 ~interpretate_thing:(interpretate_term ~obj_context:[] ~mk_choice (?create_dummy_ids:None))
632 ~refine_thing:(refine_term ~rdb) (text,prefix_len,term)
633 ~mk_localization_tbl ~expty ~subst
635 List.map (function (a,b,c,d,_) -> a,b,c,d) res, b
639 ~mk_implicit ~description_of_alias ~fix_instance ~mk_choice
640 ~aliases ~universe ~rdb ~lookup_in_library ~uri
641 (text,prefix_len,obj)
643 let mk_localization_tbl x = NCicUntrusted.NCicHash.create x in
645 MultiPassDisambiguator.disambiguate_thing
646 ~freshen_thing:CicNotationUtil.freshen_obj
647 ~context:[] ~metasenv:[] ~subst:[] ~initial_ugraph:() ~aliases
648 ~mk_implicit ~description_of_alias ~fix_instance
649 ~string_context_of_context:(List.map (fun (x,_) -> Some x))
652 ~pp_thing:(CicNotationPp.pp_obj CicNotationPp.pp_term)
653 ~passes:(MultiPassDisambiguator.passes ())
654 ~lookup_in_library ~domain_of_thing:Disambiguate.domain_of_obj
655 ~interpretate_thing:(interpretate_obj ~mk_choice)
656 ~refine_thing:(refine_obj ~rdb)
657 (text,prefix_len,obj)
658 ~mk_localization_tbl ~expty:None
660 List.map (function (a,b,c,d,_) -> a,b,c,d) res, b
666 [false, NUri.uri_of_string ("cic:/matita/pts/Type.univ")]
668 [false, NUri.uri_of_string ("cic:/matita/pts/Type"^string_of_int n^".univ")]
672 [false, NUri.uri_of_string ("cic:/matita/pts/CProp.univ")]
674 [false, NUri.uri_of_string ("cic:/matita/pts/CProp"^string_of_int n^".univ")]
676 NCicEnvironment.add_constraint true (mk_type 0) (mk_type 1);
677 NCicEnvironment.add_constraint true (mk_cprop 0) (mk_cprop 1);
678 NCicEnvironment.add_constraint true (mk_cprop 0) (mk_type 1);
679 NCicEnvironment.add_constraint true (mk_type 0) (mk_cprop 1);
680 NCicEnvironment.add_constraint false (mk_cprop 0) (mk_type 0);
681 NCicEnvironment.add_constraint false (mk_type 0) (mk_cprop 0);
683 NCicEnvironment.add_constraint true (mk_type 1) (mk_type 2);
684 NCicEnvironment.add_constraint true (mk_cprop 1) (mk_cprop 2);
685 NCicEnvironment.add_constraint true (mk_cprop 1) (mk_type 2);
686 NCicEnvironment.add_constraint true (mk_type 1) (mk_cprop 2);
687 NCicEnvironment.add_constraint false (mk_cprop 1) (mk_type 1);
688 NCicEnvironment.add_constraint false (mk_type 1) (mk_cprop 1);
690 NCicEnvironment.add_constraint true (mk_type 2) (mk_type 3);
691 NCicEnvironment.add_constraint true (mk_cprop 2) (mk_cprop 3);
692 NCicEnvironment.add_constraint true (mk_cprop 2) (mk_type 3);
693 NCicEnvironment.add_constraint true (mk_type 2) (mk_cprop 3);
694 NCicEnvironment.add_constraint false (mk_cprop 2) (mk_type 2);
695 NCicEnvironment.add_constraint false (mk_type 2) (mk_cprop 2);
697 NCicEnvironment.add_constraint false (mk_cprop 3) (mk_type 3);
698 NCicEnvironment.add_constraint false (mk_type 3) (mk_cprop 3);