]> matita.cs.unibo.it Git - helm.git/blob - matita/components/ng_tactics/nTacStatus.ml
Change Sort.merge (deprecated) with List.merge
[helm.git] / matita / components / ng_tactics / nTacStatus.ml
1 (*
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.                     
5     ||I||                                                                
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_______________________________________________________________ *)
11
12 (* $Id: nCic.ml 9058 2008-10-13 17:42:30Z tassi $ *)
13
14 let debug = ref false;;
15 let pp x = 
16  if !debug then prerr_endline (Lazy.force x) else ()
17 ;;
18
19 type automation_cache = NDiscriminationTree.DiscriminationTree.t
20 type unit_eq_cache = NCicParamod.state
21
22 exception Error of string lazy_t * exn option
23 let fail ?exn msg = raise (Error (msg,exn))
24
25 module NRef = NReference
26
27 let wrap fname f x =
28   try f x 
29   with 
30   | MultiPassDisambiguator.DisambiguationError _ 
31   | NCicRefiner.RefineFailure _ 
32   | NCicRefiner.Uncertain _ 
33   | NCicUnification.UnificationFailure _ 
34   | NCicUnification.Uncertain _ 
35   | NCicTypeChecker.TypeCheckerFailure _ 
36   | NCicMetaSubst.MetaSubstFailure _
37   | NCicMetaSubst.Uncertain _ as exn -> fail ~exn (lazy fname)
38 ;;
39
40 class type g_eq_status =
41  object
42    method eq_cache : unit_eq_cache 
43  end
44
45 class eq_status =
46  object(self)
47   val eq_cache = NCicParamod.empty_state
48   method eq_cache = eq_cache
49   method set_eq_cache v = {< eq_cache = v >}
50   method set_eq_status
51    : 'status. #g_eq_status as 'status -> 'self
52    = fun o -> self#set_eq_cache o#eq_cache
53  end
54
55 class type g_auto_status =
56  object
57    method auto_cache : automation_cache
58  end
59
60 class auto_status =
61  object(self)
62   val auto_cache = NDiscriminationTree.DiscriminationTree.empty
63   method auto_cache = auto_cache
64   method set_auto_cache v = {< auto_cache = v >}
65   method set_auto_status
66    : 'status. #g_auto_status as 'status -> 'self
67    = fun o -> self#set_auto_cache o#auto_cache
68  end
69
70 class type g_pstatus =
71  object
72   inherit GrafiteDisambiguate.g_status
73   inherit g_auto_status
74   inherit g_eq_status
75   method obj: NCic.obj
76  end
77
78 class virtual pstatus =
79  fun (o: NCic.obj) ->
80  object (self)
81    inherit GrafiteDisambiguate.status
82    inherit auto_status
83    inherit eq_status
84    val obj = o
85    method obj = obj
86    method set_obj o = {< obj = o >}
87    method set_pstatus : 'status. #g_pstatus as 'status -> 'self
88    = fun o ->
89     (((self#set_disambiguate_status o)#set_obj o#obj)#set_auto_status o)#set_eq_status o
90   end
91
92 type tactic_term = NotationPt.term Disambiguate.disambiguator_input
93 type tactic_pattern = GrafiteAst.npattern Disambiguate.disambiguator_input
94
95 type cic_term = NCic.context * NCic.term
96 let ctx_of (c,_) = c ;;
97 let mk_cic_term c t = c,t ;;
98
99 let ppterm (status:#pstatus) t =
100  let uri,height,metasenv,subst,obj = status#obj in
101  let context,t = t in
102   status#ppterm ~metasenv ~subst ~context t
103 ;;
104
105 let ppcontext (status: #pstatus) c =
106  let uri,height,metasenv,subst,obj = status#obj in
107   status#ppcontext ~metasenv ~subst c
108 ;;
109
110 let ppterm_and_context (status: #pstatus) t =
111  let uri,height,metasenv,subst,obj = status#obj in
112  let context,t = t in
113   status#ppcontext ~metasenv ~subst context ^ "\n ⊢ "^ 
114   status#ppterm ~metasenv ~subst ~context t
115 ;;
116
117 let relocate status destination (source,t as orig) =
118  pp(lazy("relocate:\n" ^ ppterm_and_context status orig));
119  pp(lazy("relocate in:\n" ^ ppcontext status destination));
120  let rc = 
121    if source == destination then status, orig else
122     let _, _, metasenv, subst, _ = status#obj in
123     let rec compute_ops ctx = function (* destination, source *)
124       | (n1, NCic.Decl t1 as e)::cl1 as ex, (n2, NCic.Decl t2)::cl2 ->
125           if n1 = n2 && 
126              NCicReduction.are_convertible status ctx ~subst ~metasenv t1 t2 then
127             compute_ops (e::ctx) (cl1,cl2)
128           else
129             [ `Delift ctx; `Lift (List.rev ex) ]
130       | (n1, NCic.Def (b1,t1) as e)::cl1 as ex, (n2, NCic.Def (b2,t2))::cl2 ->
131           if n1 = n2 && 
132              NCicReduction.are_convertible status ctx ~subst ~metasenv t1 t2 &&
133              NCicReduction.are_convertible status ctx ~subst ~metasenv b1 b2 then
134             compute_ops (e::ctx) (cl1,cl2)
135           else
136             [ `Delift ctx; `Lift (List.rev ex) ]
137       | (n1, NCic.Def (b1,t1) as e)::cl1 as ex, (n2, NCic.Decl t2)::cl2 ->
138           if n1 = n2 && 
139              NCicReduction.are_convertible status ctx ~subst ~metasenv t1 t2 then
140             compute_ops (e::ctx) (cl1,cl2)
141           else
142             [ `Delift ctx; `Lift (List.rev ex) ]
143       | (n1, NCic.Decl _)::cl1 as ex, (n2, NCic.Def _)::cl2 -> 
144             [ `Delift ctx; `Lift (List.rev ex) ]
145       | _::_ as ex, [] -> [ `Lift (List.rev ex) ]
146       | [], _::_ -> [ `Delift ctx ]
147       | [],[] -> []
148     in
149     let ops = compute_ops [] (List.rev destination, List.rev source) in
150     let rec mk_irl i j = if i > j then [] else NCic.Rel i :: mk_irl (i+1) j in
151     List.fold_left 
152      (fun (status, (source,t)) -> function 
153       | `Lift extra_ctx -> 
154            let len = List.length extra_ctx in
155            status, (extra_ctx@source, NCicSubstitution.lift status len t)
156       | `Delift ctx -> 
157             let len_ctx = List.length ctx in
158             let irl = mk_irl 1 (List.length ctx) in
159             let lc = List.length source - len_ctx, NCic.Ctx irl in
160             let u, d, metasenv, subst, o = status#obj in
161             pp(lazy("delifting as " ^ 
162               status#ppterm ~metasenv ~subst ~context:source 
163                (NCic.Meta (-1,lc))));
164             let (metasenv, subst), t =
165               NCicMetaSubst.delift status
166                  ~unify:(fun m s c t1 t2 -> 
167                    try Some (NCicUnification.unify status m s c t1 t2)
168                    with 
169                     | NCicUnification.UnificationFailure _ 
170                     | NCicUnification.Uncertain _ -> None) 
171                metasenv subst source (-1) lc t
172             in
173             let status = status#set_obj (u, d, metasenv, subst, o) in
174             status, (ctx,t))
175        (status,orig) ops
176  in
177  pp(lazy("relocated: " ^ ppterm (fst rc) (snd rc)));
178  rc
179 ;;
180 let relocate a b c = wrap "relocate" (relocate a b) c;;
181
182 let term_of_cic_term s t c = 
183   let s, (_,t) = relocate s c t in
184   s, t
185 ;;
186
187 let disambiguate status context t ty =
188  let status, expty = 
189    match ty with 
190    | `XTSome ty -> 
191        let status, (_,x) = relocate status context ty in status, `XTSome x 
192    | `XTNone -> status, `XTNone 
193    | `XTSort -> status, `XTSort
194    | `XTInd  -> status, `XTInd
195  in
196  let uri,height,metasenv,subst,obj = status#obj in
197  let metasenv, subst, status, t = 
198    GrafiteDisambiguate.disambiguate_nterm status expty context metasenv subst t 
199  in
200  let new_pstatus = uri,height,metasenv,subst,obj in
201   status#set_obj new_pstatus, (context, t) 
202 ;;
203 let disambiguate a b c d = wrap "disambiguate" (disambiguate a b c) d;;
204
205 let typeof status ctx t =
206   let status, (_,t) = relocate status ctx t in
207   let _,_,metasenv,subst,_ = status#obj in
208   let ty = NCicTypeChecker.typeof status ~subst ~metasenv ctx t in
209   status, (ctx, ty)
210 ;;
211 let typeof a b c = wrap "typeof" (typeof a b) c;;
212
213 let saturate status ?delta (ctx,t) =
214   let n,h,metasenv,subst,k = status#obj in
215   let t,metasenv,args = NCicMetaSubst.saturate status ?delta metasenv subst ctx t 0 in
216   let status = status#set_obj (n,h,metasenv,subst,k) in
217   status, (ctx,t), List.map (fun x -> ctx,x) args
218 ;;
219 let saturate a ?delta b = wrap "saturate" (saturate a ?delta) b;;
220   
221 let whd status ?delta ctx t =
222   let status, (_,t) = relocate status ctx t in
223   let _,_,_,subst,_ = status#obj in
224   let t = NCicReduction.whd status ~subst ?delta ctx t in
225   status, (ctx, t)
226 ;;
227   
228 let normalize status ?delta ctx t =
229   let status, (_,t) = relocate status ctx t in
230   let _,_,_,subst,_ = status#obj in
231   let t = NCicTacReduction.normalize status ~subst ?delta ctx t in
232   status, (ctx, t)
233 ;;
234   
235 let are_convertible status ctx a b =
236   let status, (_,a) = relocate status ctx a in
237   let status, (_,b) = relocate status ctx b in
238   let n,h,metasenv,subst,o = status#obj in
239   let res = NCicReduction.are_convertible status metasenv subst ctx a b in
240    status, res
241 ;;
242 let are_convertible a b c d = wrap "are_convertible" (are_convertible a b c) d;;
243
244 let unify status ctx a b =
245   let status, (_,a) = relocate status ctx a in
246   let status, (_,b) = relocate status ctx b in
247   let n,h,metasenv,subst,o = status#obj in
248   let metasenv, subst = NCicUnification.unify status metasenv subst ctx a b in
249    status#set_obj (n,h,metasenv,subst,o)
250 ;;
251 let unify a b c d = wrap "unify" (unify a b c) d;;
252
253 let fix_sorts status (ctx,t) =
254  let f () =
255   let name,height,metasenv,subst,obj = status#obj in
256   let metasenv, t = 
257     NCicUnification.fix_sorts status metasenv subst t in
258   let status = status#set_obj (name,height,metasenv,subst,obj) in
259    status, (ctx,t)
260  in
261   wrap "fix_sorts" f ()
262 ;;
263
264 let refine status ctx term expty =
265   let status, (_,term) = relocate status ctx term in
266   let status, expty = 
267     match expty with
268     | `XTSome e -> 
269         let status, (_, e) = relocate status ctx e in status, `XTSome e
270     | `XTNone -> status, `XTNone 
271     | `XTSort -> status, `XTSort
272     | `XTInd  -> status, `XTInd
273   in
274   let name,height,metasenv,subst,obj = status#obj in
275   let metasenv,subst,t,ty = 
276    NCicRefiner.typeof status metasenv subst ctx term expty
277   in
278    status#set_obj (name,height,metasenv,subst,obj), (ctx,t), (ctx,ty)
279 ;;
280 let refine a b c d = wrap "refine" (refine a b c) d;;
281
282 let get_goalty status g =
283  let _,_,metasenv,_,_ = status#obj in
284  try
285    let _, ctx, ty = NCicUtils.lookup_meta g metasenv in
286    ctx, ty
287  with NCicUtils.Meta_not_found _ as exn -> fail ~exn (lazy "get_goalty")
288 ;;
289
290 let get_subst status =
291   let _,_,_,subst,_ = status#obj in subst
292 ;;
293
294 let to_subst status i entry =
295  let name,height,metasenv,subst,obj = status#obj in
296  let metasenv = List.filter (fun j,_ -> j <> i) metasenv in
297  let subst = (i, entry) :: subst in
298   status#set_obj (name,height,metasenv,subst,obj)
299 ;;
300
301 let instantiate status ?refine:(dorefine=true) i t =
302  let _,_,metasenv,_,_ = status#obj in
303  let gname, context, gty = List.assoc i metasenv in
304   if dorefine then
305    let status, (_,t), (_,ty) = refine status context t (`XTSome (context,gty)) in
306     to_subst status i (gname,context,t,ty)
307   else
308    let status,(_,ty) = typeof status context t in
309     to_subst status i (gname,context,snd t,ty)
310 ;;
311
312 let instantiate_with_ast status i t =
313  let _,_,metasenv,_,_ = status#obj in
314  let gname, context, gty = List.assoc i metasenv in
315  let ggty = mk_cic_term context gty in
316  let status, (_,t) = disambiguate status context t (`XTSome ggty) in
317   to_subst status i (gname,context,t,gty)
318 ;;
319
320 let mk_meta status ?(attrs=[]) ctx bo_or_ty kind =
321   match bo_or_ty with
322   | `Decl ty ->
323       let status, (_,ty) = relocate status ctx ty in
324       let n,h,metasenv,subst,o = status#obj in
325       let metasenv, _, instance, _ = 
326         NCicMetaSubst.mk_meta ~attrs metasenv ctx ~with_type:ty kind
327       in
328       let status = status#set_obj (n,h,metasenv,subst,o) in
329       status, (ctx,instance)
330   | `Def bo ->
331       let status, (_,bo_ as bo) = relocate status ctx bo in
332       let status, (_,ty) = typeof status ctx bo in
333       let n,h,metasenv,subst,o = status#obj in
334       let metasenv, metano, instance, _ = 
335         NCicMetaSubst.mk_meta ~attrs metasenv ctx ~with_type:ty kind in
336       let attrs,_,_ = NCicUtils.lookup_meta metano metasenv in
337       let metasenv = List.filter (fun j,_ -> j <> metano) metasenv in
338       let subst = (metano, (attrs, ctx, bo_, ty)) :: subst in
339       let status = status#set_obj (n,h,metasenv,subst,o) in
340       status, (ctx,instance)
341 ;;
342
343 let mk_in_scope status t =
344   mk_meta status ~attrs:[`InScope] (ctx_of t) (`Def t) `IsTerm
345 ;;
346
347 let mk_out_scope n status t = 
348   mk_meta status ~attrs:[`OutScope n] (ctx_of t) (`Def t) `IsTerm
349 ;;
350
351 (* the following unification problem will be driven by 
352  *   select s ~found:mk_in_scope ~postprocess:(mk_out_scope argsno) t pattern
353  *
354  *   ? args = t
355  *
356  *   where argsn = length args and the pattern matches t
357  *
358  *  found is called on every selected term to map them
359  *  postprocess is called on the entire term after selection
360  *)
361 let select_term 
362   low_status ~found ~postprocess (context,term) (wanted,path) 
363 =
364   let is_found status ctx t wanted =
365     (* we could lift wanted step-by-step *)
366     pp(lazy("is_found: "^ppterm status (ctx,t)));
367     try true, unify status ctx (ctx, t) wanted
368     with 
369     | Error (_, Some (NCicUnification.UnificationFailure _))
370     | Error (_, Some (NCicUnification.Uncertain _)) -> false, status
371   in
372   let match_term status ctx (wanted : cic_term) t =
373     let rec aux ctx (status,already_found) t =
374       let b, status = is_found status ctx t wanted in
375       if b then
376          let status , (_,t) = found status (ctx, t) in 
377          (status,true),t
378       else
379         let _,_,_,subst,_ = status#obj in
380         match t with
381         | NCic.Meta (i,lc) when List.mem_assoc i subst ->
382             let _,_,t,_ = NCicUtils.lookup_subst i subst in
383             aux ctx (status,already_found) t
384         | NCic.Meta _ -> (status,already_found),t
385         | _ ->
386           NCicUntrusted.map_term_fold_a status (fun e c -> e::c) ctx aux
387            (status,already_found) t
388      in 
389        aux ctx (status,false) t
390   in 
391   let _,_,_,subst,_ = low_status#obj in
392   let rec select status ctx pat cic = 
393     match pat, cic with
394     | _, NCic.Meta (i,lc) when List.mem_assoc i subst ->
395         let cic = 
396           let _,_,t,_ = NCicUtils.lookup_subst i subst in
397           NCicSubstitution.subst_meta status lc t
398         in
399         select status ctx pat cic
400     | NCic.LetIn (_,t1,s1,b1), NCic.LetIn (n,t2,s2,b2) ->
401         let status, t = select status ctx t1 t2 in
402         let status, s = select status ctx s1 s2 in
403         let ctx = (n, NCic.Def (s2,t2)) :: ctx in
404         let status, b = select status ctx b1 b2 in
405         status, NCic.LetIn (n,t,s,b)
406     | NCic.Lambda (_,s1,t1), NCic.Lambda (n,s2,t2) ->
407         let status, s = select status ctx s1 s2 in
408         let ctx = (n, NCic.Decl s2) :: ctx in
409         let status, t = select status ctx t1 t2 in
410         status, NCic.Lambda (n,s,t)
411     | NCic.Prod (_,s1,t1), NCic.Prod (n,s2,t2) ->
412         let status, s = select status ctx s1 s2 in
413         let ctx = (n, NCic.Decl s2) :: ctx in
414         let status, t = select status ctx t1 t2 in
415         status, NCic.Prod (n,s,t)
416     | NCic.Appl l1, NCic.Appl l2 when List.length l1 = List.length l2 ->
417         let status, l = 
418            List.fold_left2
419              (fun (status,l) x y -> 
420               let status, x = select status ctx x y in
421               status, x::l)
422              (status,[]) l1 l2
423         in
424         status, NCic.Appl (List.rev l)
425     | NCic.Match (_,ot1,t1,pl1), NCic.Match (u,ot2,t2,pl2)
426       when List.length pl1 = List.length pl2 ->
427         let status, t = select status ctx t1 t2 in
428         let status, ot = select status ctx ot1 ot2 in
429         let status, pl = 
430            List.fold_left2
431              (fun (status,l) x y -> 
432               let status, x = select status ctx x y in
433               status, x::l)
434              (status,[]) pl1 pl2
435         in
436         status, NCic.Match (u,ot,t,List.rev pl)
437     | NCic.Implicit `Hole, t -> 
438         (match wanted with
439         | Some wanted -> 
440              let status', wanted = disambiguate status ctx wanted `XTNone in
441              pp(lazy("wanted: "^ppterm status' wanted));
442              let (status',found), t' = match_term status' ctx wanted t in
443               if found then status',t' else status,t
444         | None ->
445            let (status,_),t = match_term status ctx (ctx,t) t in
446             status,t)
447     | NCic.Implicit _, t -> status, t
448     | _,t -> 
449         fail (lazy ("malformed pattern: " ^ status#ppterm ~metasenv:[]
450           ~context:[] ~subst:[] pat ^ " against " ^ 
451           status#ppterm ~metasenv:[] ~subst:[] ~context:[] t))
452   in
453   pp(lazy ("select in: "^ppterm low_status (context,term)));
454   let status, term = select low_status context path term in
455   let term = (context, term) in
456   pp(lazy ("postprocess: "^ppterm low_status term));
457   postprocess status term
458 ;;
459
460 let analyse_indty status ty = 
461  let status, reduct = whd status (ctx_of ty) ty in
462  let ref, args =
463   match reduct with
464    | _,NCic.Const ref -> ref, []
465    | _,NCic.Appl (NCic.Const (NRef.Ref (_,(NRef.Ind _)) as ref) :: args) -> 
466          ref, args
467    | _,_ -> fail (lazy ("not an inductive type: " ^ ppterm status ty)) in
468  let _,lno,tl,_,i = NCicEnvironment.get_checked_indtys status ref in
469  let _,_,_,cl = List.nth tl i in
470  let consno = List.length cl in
471  let left, right = HExtlib.split_nth lno args in
472  status, (ref, consno, left, right, cl)
473 ;;
474
475 let apply_subst status ctx t =
476  let status, (_,t) = relocate status ctx t in
477  let _,_,_,subst,_ = status#obj in
478   status, (ctx, NCicUntrusted.apply_subst status subst ctx t)
479 ;;
480
481 let apply_subst_context status ~fix_projections ctx =
482  let _,_,_,subst,_ = status#obj in
483   NCicUntrusted.apply_subst_context status ~fix_projections subst ctx
484 ;;
485
486 let metas_of_term status (context,t) =
487  let _,_,_,subst,_ = status#obj in
488  NCicUntrusted.metas_of_term status subst context t
489 ;;
490
491 (* ============= move this elsewhere ====================*)
492
493 class type ['stack] g_status =
494  object
495   inherit g_pstatus
496   method stack: 'stack
497  end
498
499 class virtual ['stack] status =
500  fun (o: NCic.obj) (s: 'stack) ->
501  object (self)
502    inherit (pstatus o)
503    val stack = s
504    method stack = stack
505    method set_stack s = {< stack = s >}
506    method set_status : 'status. 'stack #g_status as 'status -> 'self
507    = fun o -> (self#set_pstatus o)#set_stack o#stack
508   end
509
510 class type virtual lowtac_status = [unit] status
511
512 type 'status lowtactic = #lowtac_status as 'status -> int -> 'status
513
514 class type virtual tac_status = [Continuationals.Stack.t] status
515
516 type 'status tactic = #tac_status as 'status -> 'status
517
518 let pp_tac_status (status: #tac_status) = 
519   prerr_endline (status#ppobj status#obj);
520   prerr_endline ("STACK:\n" ^ Continuationals.Stack.pp status#stack)
521 ;;
522
523 module NCicInverseRelIndexable : Discrimination_tree.Indexable
524 with type input = cic_term and type constant_name = NUri.uri = struct
525
526 open Discrimination_tree
527
528 type input = cic_term
529 type constant_name = NUri.uri
530
531 let ppelem = function
532   | Constant (uri,arity) -> 
533       "("^NUri.name_of_uri uri ^ "," ^ string_of_int arity^")"
534   | Bound (i,arity) -> 
535       "("^string_of_int i ^ "," ^ string_of_int arity^")"
536   | Variable -> "?"
537   | Proposition -> "Prop"
538   | Datatype -> "Type"
539   | Dead -> "Dead"
540 ;;
541
542 let string_of_path l = String.concat "." (List.map ppelem l) ;;
543
544 let path_string_of (ctx,t) =
545   let len_ctx = List.length ctx in
546   let rec aux arity = function
547     | NCic.Appl ((NCic.Meta _|NCic.Implicit _)::_) -> [Variable]
548     | NCic.Appl (NCic.Lambda _ :: _) -> [Variable] (* maybe we should b-reduce *)
549     | NCic.Appl [] -> assert false
550     | NCic.Appl (hd::tl) ->
551         aux (List.length tl) hd @ List.flatten (List.map (aux 0) tl) 
552     | NCic.Lambda _ | NCic.Prod _ -> [Variable]
553         (* I think we should CicSubstitution.subst Implicit t *)
554     | NCic.LetIn _ -> [Variable] (* z-reduce? *)
555     | NCic.Meta _ | NCic.Implicit _ -> assert (arity = 0); [Variable]
556     | NCic.Rel i -> [Bound (len_ctx - i, arity)]
557     | NCic.Sort (NCic.Prop) -> assert (arity=0); [Proposition]
558     | NCic.Sort _ -> assert (arity=0); [Datatype]
559     | NCic.Const (NReference.Ref (u,_)) -> [Constant (u, arity)]
560     | NCic.Match _ -> [Dead]
561   in 
562   let path = aux 0 t in
563 (*   prerr_endline (string_of_path path); *)
564   path
565 ;;
566
567 let compare e1 e2 =
568   match e1,e2 with
569   | Constant (u1,a1),Constant (u2,a2) -> 
570        let x = NUri.compare u1 u2 in
571        if x = 0 then Pervasives.compare a1 a2 else x
572   | e1,e2 -> Pervasives.compare e1 e2
573 ;;
574
575
576 end
577
578 module Ncic_termOT : Set.OrderedType with type t = cic_term =
579  struct
580    type t = cic_term
581    let compare = Pervasives.compare
582  end
583
584 module Ncic_termSet : Set.S with type elt = cic_term = Set.Make(Ncic_termOT)
585
586 module InvRelDiscriminationTree = 
587    Discrimination_tree.Make(NCicInverseRelIndexable)(Ncic_termSet)
588