+ trans : (State.t,(TagSet.t*Transition.t) list) Hashtbl.t;
+ query_string: string;
+ }
+
+
+let dump ppf a =
+ Format.fprintf ppf "Automaton (%i) :\n" a.id;
+ Format.fprintf ppf "States : "; StateSet.print ppf a.states;
+ Format.fprintf ppf "\nInitial states : "; StateSet.print ppf a.init;
+ Format.fprintf ppf "\nAlternating transitions :\n";
+ let l = Hashtbl.fold (fun k t acc ->
+ (List.map (fun (ts,tr) -> (ts,k),Transition.node tr) t) @ acc) a.trans [] in
+ let l = List.sort (fun ((tsx,x),_) ((tsy,y),_) ->
+ if y-x == 0 then TagSet.compare tsy tsx else y-x) l in
+ let maxh,maxt,l_print =
+ List.fold_left (
+ fun (maxh,maxt,l) ((ts,q),(_,_,b,f,_)) ->
+ let s =
+ if TagSet.is_finite ts
+ then "{" ^ (TagSet.fold (fun t a -> a ^ " '" ^ (Tag.to_string t)^"'") ts "") ^" }"
+ else let cts = TagSet.neg ts in
+ if TagSet.is_empty cts then "*" else
+ (TagSet.fold (fun t a -> a ^ " " ^ (Tag.to_string t)) cts "*\\{"
+ )^ "}"
+ in
+ let s = Printf.sprintf "(%s,%i)" s q in
+ let s_frm =
+ Formula.print Format.str_formatter f;
+ Format.flush_str_formatter()
+ in
+ (max (String.length s) maxh, max (String.length s_frm) maxt,
+ (s,(if b then "⇒" else "→"),s_frm)::l)) (0,0,[]) l
+ in
+ Format.fprintf ppf "%s\n%!" (String.make (maxt+maxh+3) '_');
+ List.iter (fun (s,m,f) -> let s = s ^ (String.make (maxh-(String.length s)) ' ') in
+ Format.fprintf ppf "%s %s %s\n" s m f) l_print;
+ Format.fprintf ppf "%s\n%!" (String.make (maxt+maxh+3) '_')
+
+
+module FormTable = Hashtbl.Make(struct
+ type t = Formula.t*StateSet.t*StateSet.t
+ let equal (f1,s1,t1) (f2,s2,t2) =
+ f1 == f2 && s1 == s2 && t1 == t2
+ let hash (f,s,t) =
+ HASHINT3(Uid.to_int (Formula.uid f),
+ Uid.to_int (StateSet.uid s),
+ Uid.to_int (StateSet.uid t))
+ end)
+module F = Formula
+
+let eval_form_bool =
+ let h_f = FormTable.create BIG_H_SIZE in
+ fun f s1 s2 ->
+ let rec loop f =
+ match F.expr f with
+ | F.True -> true,true,true
+ | F.False -> false,false,false
+ | F.Atom((`Left|`LLeft),b,q) ->
+ if b == (StateSet.mem q s1)
+ then (true,true,false)
+ else false,false,false
+ | F.Atom(_,b,q) ->
+ if b == (StateSet.mem q s2)
+ then (true,false,true)
+ else false,false,false
+ | f' ->
+ try FormTable.find h_f (f,s1,s2)
+ with Not_found -> let r =
+ match f' with
+ | F.Or(f1,f2) ->
+ let b1,rl1,rr1 = loop f1
+ in
+ if b1 && rl1 && rr1 then (true,true,true) else
+ let b2,rl2,rr2 = loop f2 in
+ let rl1,rr1 = if b1 then rl1,rr1 else false,false
+ and rl2,rr2 = if b2 then rl2,rr2 else false,false
+ in (b1 || b2, rl1||rl2,rr1||rr2)
+
+ | F.And(f1,f2) ->
+ let b1,rl1,rr1 = loop f1 in
+ if b1 && rl1 && rr1 then (true,true,true) else
+ if b1 then
+ let b2,rl2,rr2 = loop f2 in
+ if b2 then (true,rl1||rl2,rr1||rr2) else (false,false,false)
+ else (false,false,false)
+ | _ -> assert false
+ in FormTable.add h_f (f,s1,s2) r;r
+ in loop f
+
+
+module FTable = Hashtbl.Make(struct
+ type t = Tag.t*Formlist.t*StateSet.t*StateSet.t
+ let equal (tg1,f1,s1,t1) (tg2,f2,s2,t2) =
+ tg1 == tg2 && f1 == f2 && s1 == s2 && t1 == t2;;
+ let hash (tg,f,s,t) =
+ HASHINT4(tg, Uid.to_int (Formlist.uid f),
+ Uid.to_int (StateSet.uid s),
+ Uid.to_int (StateSet.uid t))
+ end)
+
+
+let h_f = FTable.create BIG_H_SIZE
+type merge_conf = NO | ONLY1 | ONLY2 | ONLY12 | MARK | MARK1 | MARK2 | MARK12
+(* 000 001 010 011 100 101 110 111 *)
+let eval_formlist tag s1 s2 fl =
+ let rec loop fl =
+ try
+ FTable.find h_f (tag,fl,s1,s2)
+ with
+ | Not_found ->
+ match Formlist.node fl with
+ | Formlist.Cons(f,fll) ->
+ let q,ts,mark,f,_ = Transition.node f in
+ let b,b1,b2 =
+ if TagSet.mem tag ts then eval_form_bool f s1 s2 else (false,false,false)
+ in
+ let (s,(b',b1',b2',amark)) as res = loop fll in
+ let r = if b then (StateSet.add q s, (b, b1'||b1,b2'||b2,mark||amark))
+ else res
+ in FTable.add h_f (tag,fl,s1,s2) r;r
+ | Formlist.Nil -> StateSet.empty,(false,false,false,false)
+ in
+ let r,conf = loop fl
+ in
+ r,(match conf with
+ | (false,_,_,_) -> NO
+ | (_,false,false,false) -> NO
+ | (_,true,false,false) -> ONLY1
+ | (_,false,true,false) -> ONLY2
+ | (_,true,true,false) -> ONLY12
+ | (_,false,false,true) -> MARK
+ | (_,true,false,true) -> MARK1
+ | (_,false,true,true) -> MARK2
+ | _ -> MARK12)
+
+let bool_of_merge conf =
+ match conf with
+ | NO -> false,false,false,false
+ | ONLY1 -> true,true,false,false
+ | ONLY2 -> true,false,true,false
+ | ONLY12 -> true,true,true,false
+ | MARK -> true,false,false,true
+ | MARK1 -> true,true,false,true
+ | MARK2 -> true,false,true,true
+ | MARK12 -> true,true,true,true
+
+
+let tags_of_state a q =
+ Hashtbl.fold
+ (fun p l acc ->
+ if p == q then List.fold_left
+ (fun acc (ts,t) ->
+ let _,_,_,_,aux = Transition.node t in
+ if aux then acc else
+ TagSet.cup ts acc) acc l
+
+ else acc) a.trans TagSet.empty
+
+
+
+ let tags a qs =
+ let ts = Ptset.Int.fold (fun q acc -> TagSet.cup acc (tags_of_state a q)) qs TagSet.empty
+ in
+ if TagSet.is_finite ts
+ then `Positive(TagSet.positive ts)
+ else `Negative(TagSet.negative ts)
+
+ let inter_text a b =
+ match b with
+ | `Positive s -> let r = Ptset.Int.inter a s in (r,Ptset.Int.mem Tag.pcdata r, true)
+ | `Negative s -> let r = Ptset.Int.diff a s in (r, Ptset.Int.mem Tag.pcdata r, false)
+
+
+ module type ResultSet =
+ sig
+ type t
+ type elt = [` Tree ] Tree.node
+ val empty : t
+ val cons : elt -> t -> t
+ val concat : t -> t -> t
+ val iter : ( elt -> unit) -> t -> unit
+ val fold : ( elt -> 'a -> 'a) -> t -> 'a -> 'a
+ val map : ( elt -> elt) -> t -> t
+ val length : t -> int
+ val merge : merge_conf -> elt -> t -> t -> t
+ val mk_quick_tag_loop : (elt -> elt -> 'a*t array) -> 'a -> int -> Tree.t -> Tag.t -> (elt -> elt -> 'a*t array)
+ val mk_quick_star_loop : (elt -> elt -> 'a*t array) -> 'a -> int -> Tree.t -> (elt -> elt -> 'a*t array)
+
+ end
+
+ module Integer : ResultSet =
+ struct
+ type t = int
+ type elt = [`Tree] Tree.node
+
+ let empty = 0
+ let cons _ x = x+1
+ let concat x y = x + y
+ let iter _ _ = failwith "iter not implemented"
+ let fold _ _ _ = failwith "fold not implemented"
+ let map _ _ = failwith "map not implemented"
+ let length x = x
+ let merge2 conf t res1 res2 =
+ let rb,rb1,rb2,mark = conf in
+ if rb then
+ let res1 = if rb1 then res1 else 0
+ and res2 = if rb2 then res2 else 0
+ in
+ if mark then 1+res1+res2
+ else res1+res2
+ else 0
+ let merge conf t res1 res2 =
+ match conf with
+ | NO -> 0
+ | ONLY1 -> res1
+ | ONLY2 -> res2
+ | ONLY12 -> res1+res2
+ | MARK -> 1
+ | MARK1 -> res1+1
+ | MARK2 -> res2+1
+ | MARK12 -> res1+res2+1
+ let merge conf _ res1 res2 =
+ let conf = Obj.magic conf in
+ (conf lsr 2) + ((conf land 0b10) lsr 1)*res2 + (conf land 0b1)*res1
+
+
+ let mk_quick_tag_loop _ sl ss tree tag = ();
+ fun t ctx ->
+ (sl, Array.make ss (Tree.subtree_tags tree tag t))
+ let mk_quick_star_loop _ sl ss tree = ();
+ fun t ctx ->
+ (sl, Array.make ss (Tree.subtree_elements tree t))
+
+ end
+
+ module IdSet : ResultSet=
+ struct
+ type elt = [`Tree] Tree.node
+ type node = Nil
+ | Cons of elt * node
+ | Concat of node*node
+
+ and t = { node : node;
+ length : int }
+
+ let empty = { node = Nil; length = 0 }
+
+ let cons e t = { node = Cons(e,t.node); length = t.length+1 }
+ let concat t1 t2 = { node = Concat(t1.node,t2.node); length = t1.length+t2.length }
+ let append e t = { node = Concat(t.node,Cons(e,Nil)); length = t.length+1 }
+
+ let fold f l acc =
+ let rec loop acc t = match t with
+ | Nil -> acc
+ | Cons (e,t) -> loop (f e acc) t
+ | Concat (t1,t2) -> loop (loop acc t1) t2
+ in
+ loop acc l.node
+
+ let length l = l.length
+
+
+ let iter f l =
+ let rec loop = function
+ | Nil -> ()
+ | Cons (e,t) -> f e; loop t
+ | Concat(t1,t2) -> loop t1;loop t2
+ in loop l.node
+
+ let map f l =
+ let rec loop = function
+ | Nil -> Nil
+ | Cons(e,t) -> Cons(f e, loop t)
+ | Concat(t1,t2) -> Concat(loop t1,loop t2)
+ in
+ { l with node = loop l.node }
+
+ let merge conf t res1 res2 =
+ match conf with
+ NO -> empty
+ | MARK -> cons t empty
+ | ONLY1 -> res1
+ | ONLY2 -> res2
+ | ONLY12 -> { node = (Concat(res1.node,res2.node));
+ length = res1.length + res2.length ;}
+ | MARK12 -> { node = Cons(t,(Concat(res1.node,res2.node)));
+ length = res1.length + res2.length + 1;}
+ | MARK1 -> { node = Cons(t,res1.node);
+ length = res1.length + 1;}
+ | MARK2 -> { node = Cons(t,res2.node);
+ length = res2.length + 1;}
+
+ let mk_quick_tag_loop f _ _ _ _ = f
+ let mk_quick_star_loop f _ _ _ = f
+ end
+ module GResult(Doc : sig val doc : Tree.t end) = struct
+ type bits
+ type elt = [` Tree] Tree.node
+ external create_empty : int -> bits = "caml_result_set_create" "noalloc"
+ external set : bits -> int -> unit = "caml_result_set_set" "noalloc"
+ external next : bits -> int -> int = "caml_result_set_next" "noalloc"
+ external count : bits -> int = "caml_result_set_count" "noalloc"
+ external clear : bits -> elt -> elt -> unit = "caml_result_set_clear" "noalloc"
+
+ external set_tag_bits : bits -> Tag.t -> Tree.t -> elt -> elt = "caml_set_tag_bits" "noalloc"
+ type t =
+ { segments : elt list;
+ bits : bits;
+ }
+
+ let ebits =
+ let size = (Tree.subtree_size Doc.doc Tree.root) in
+ create_empty (size*2+1)
+
+ let empty = { segments = [];
+ bits = ebits }
+
+ let cons e t =
+ let rec loop l = match l with
+ | [] -> { bits = (set t.bits (Obj.magic e);t.bits);
+ segments = [ e ] }
+ | p::r ->
+ if Tree.is_binary_ancestor Doc.doc e p then
+ loop r
+ else
+ { bits = (set t.bits (Obj.magic e);t.bits);
+ segments = e::l }
+ in
+ loop t.segments
+
+ let concat t1 t2 =
+ if t2.segments == [] then t1
+ else
+ if t1.segments == [] then t2
+ else
+ let h2 = List.hd t2.segments in
+ let rec loop l = match l with
+ | [] -> t2.segments
+ | p::r ->
+ if Tree.is_binary_ancestor Doc.doc p h2 then
+ l
+ else
+ p::(loop r)
+ in
+ { bits = t1.bits;
+ segments = loop t1.segments
+ }
+
+ let iter f t =
+ let rec loop i =
+ if i == -1 then ()
+ else (f ((Obj.magic i):elt);loop (next t.bits i))
+ in loop (next t.bits 0)
+
+ let fold f t acc =
+ let rec loop i acc =
+ if i == -1 then acc
+ else loop (next t.bits i) (f ((Obj.magic i):elt) acc)
+ in loop (next t.bits 0) acc
+
+ let map _ _ = failwith "noop"
+ (*let length t = let cpt = ref 0 in
+ iter (fun _ -> incr cpt) t; !cpt *)
+ let length t = count t.bits
+
+ let clear_bits t =
+ let rec loop l = match l with
+ [] -> ()
+ | idx::ll ->
+ clear t.bits idx (Tree.closing Doc.doc idx); loop ll
+ in
+ loop t.segments;empty
+
+ let merge (rb,rb1,rb2,mark) elt t1 t2 =
+ if rb then
+(* let _ = Printf.eprintf "Lenght before merging is %i %i\n"
+ (List.length t1.segments) (List.length t2.segments)
+ in *)
+ match t1.segments,t2.segments with
+ [],[] -> if mark then cons elt empty else empty
+ | [_],[] when rb1 -> if mark then cons elt t1 else t1
+ | [], [_] when rb2 -> if mark then cons elt t2 else t2
+ | [_],[_] when rb1 && rb2 -> if mark then cons elt empty else
+ concat t1 t2
+ | _ ->
+ let t1 = if rb1 then t1 else clear_bits t1
+ and t2 = if rb2 then t2 else clear_bits t2
+ in
+ (if mark then cons elt (concat t1 t2)
+ else concat t1 t2)
+ else
+ let _ = clear_bits t1 in
+ clear_bits t2
+
+ let merge conf t t1 t2 =
+ match t1.segments,t2.segments,conf with
+ | _,_,NO -> let _ = clear_bits t1 in clear_bits t2
+ | [],[],(MARK1|MARK2|MARK12|MARK) -> cons t empty
+ | [],[],_ -> empty
+ | [_],[],(ONLY1|ONLY12) -> t1
+ | [_],[],(MARK1|MARK12) -> cons t t1
+ | [],[_],(ONLY2|ONLY12) -> t2
+ | [],[_],(MARK2|MARK12) -> cons t t2
+ | [_],[_],ONLY12 -> concat t1 t2
+ | [_],[_],MARK12 -> cons t empty
+ | _,_,MARK -> let _ = clear_bits t2 in cons t (clear_bits t1)
+ | _,_,ONLY1 -> let _ = clear_bits t2 in t1
+ | _,_,ONLY2 -> let _ = clear_bits t1 in t2
+ | _,_,ONLY12 -> concat t1 t2
+ | _,_,MARK1 -> let _ = clear_bits t2 in cons t t1
+ | _,_,MARK2 -> let _ = clear_bits t1 in cons t t2
+ | _,_,MARK12 -> cons t (concat t1 t2)
+
+ let mk_quick_tag_loop _ sl ss tree tag = ();
+ fun t _ ->
+ let res = empty in
+ let first = set_tag_bits empty.bits tag tree t in
+ let res =
+ if first == Tree.nil then res else
+ cons first res
+ in
+ (sl, Array.make ss res)
+
+ let mk_quick_star_loop f _ _ _ = f
+ end
+ module Run (RS : ResultSet) =
+ struct
+
+ module SList = struct
+ include Hlist.Make (StateSet)
+ let print ppf l =
+ Format.fprintf ppf "[ ";
+ begin
+ match l.Node.node with
+ | Nil -> ()
+ | Cons(s,ll) ->
+ StateSet.print ppf s;
+ iter (fun s -> Format.fprintf ppf "; ";
+ StateSet.print ppf s) ll
+ end;
+ Format.fprintf ppf "]%!"
+
+
+ end
+
+
+IFDEF DEBUG
+THEN
+ module IntSet = Set.Make(struct type t = int let compare = (-) end)
+INCLUDE "html_trace.ml"
+
+END
+ module Trace =
+ struct
+ module HFname = Hashtbl.Make (struct
+ type t = Obj.t
+ let hash = Hashtbl.hash
+ let equal = (==)
+ end)
+
+ let h_fname = HFname.create 401
+
+ let register_funname f s =
+ HFname.add h_fname (Obj.repr f) s
+ let get_funname f = try HFname.find h_fname (Obj.repr f) with _ -> "[anon_fun]"
+
+
+
+ let mk_fun f s = register_funname f s;f
+ let mk_app_fun f arg s =
+ let g = f arg in
+ register_funname g ((get_funname f) ^ " " ^ s); g
+ let mk_app_fun2 f arg1 arg2 s =
+ let g = f arg1 arg2 in
+ register_funname g ((get_funname f) ^ " " ^ s); g
+
+ end
+
+ let string_of_ts tags = (Ptset.Int.fold (fun t a -> a ^ " " ^ (Tag.to_string t) ) tags "{")^ " }"
+
+
+ module Algebra =
+ struct
+ type jump = [ `NIL | `ANY |`ANYNOTEXT | `JUMP ]
+ type t = jump*Ptset.Int.t*Ptset.Int.t
+ let jts = function
+ | `JUMP -> "JUMP"
+ | `NIL -> "NIL"
+ | `ANY -> "ANY"
+ | `ANYNOTEXT -> "ANYNOTEXT"
+ let merge_jump (j1,c1,l1) (j2,c2,l2) =
+ match j1,j2 with
+ | _,`NIL -> (j1,c1,l1)
+ | `NIL,_ -> (j2,c2,l2)
+ | `ANY,_ -> (`ANY,Ptset.Int.empty,Ptset.Int.empty)
+ | _,`ANY -> (`ANY,Ptset.Int.empty,Ptset.Int.empty)
+ | `ANYNOTEXT,_ ->
+ if Ptset.Int.mem Tag.pcdata (Ptset.Int.union c2 l2) then
+ (`ANY,Ptset.Int.empty,Ptset.Int.empty)
+ else
+ (`ANYNOTEXT,Ptset.Int.empty,Ptset.Int.empty)
+ | _,`ANYNOTEXT ->
+ if Ptset.Int.mem Tag.pcdata (Ptset.Int.union c1 l1) then
+ (`ANY,Ptset.Int.empty,Ptset.Int.empty)
+ else
+ (`ANYNOTEXT,Ptset.Int.empty,Ptset.Int.empty)
+ | `JUMP,`JUMP -> (`JUMP, Ptset.Int.union c1 c2,Ptset.Int.union l1 l2)
+
+ let merge_jump_list = function
+ | [] -> `NIL,Ptset.Int.empty,Ptset.Int.empty
+ | p::r ->
+ List.fold_left (merge_jump) p r
+
+ let labels a s =
+ Hashtbl.fold
+ (
+ fun q l acc ->
+ if (q == s)
+ then
+
+ (List.fold_left
+ (fun acc (ts,f) ->
+ let _,_,_,_,bur = Transition.node f in
+ if bur then acc else TagSet.cup acc ts)
+ acc l)
+ else acc ) a.trans TagSet.empty
+ exception Found
+
+ let is_rec a s access =
+ List.exists
+ (fun (_,t) -> let _,_,_,f,_ = Transition.node t in
+ StateSet.mem s ((fun (_,_,x) -> x) (access (Formula.st f)))) (Hashtbl.find a.trans s)
+
+ let is_final_marking a s =
+ List.exists (fun (_,t) -> let _,_,m,f,_ = Transition.node t in m&& (Formula.is_true f))
+ (Hashtbl.find a.trans s)
+
+
+ let decide a c_label l_label dir_states dir =
+
+ let l = StateSet.fold
+ (fun s l ->
+ let s_rec = is_rec a s (if dir then fst else snd) in
+ let s_rec = if dir then s_rec else
+ (* right move *)
+ is_rec a s fst
+ in
+ let s_lab = labels a s in
+ let jmp,cc,ll =
+ if (not (TagSet.is_finite s_lab)) then
+ if TagSet.mem Tag.pcdata s_lab then (`ANY,Ptset.Int.empty,Ptset.Int.empty)
+ else (`ANYNOTEXT,Ptset.Int.empty,Ptset.Int.empty)
+ else
+ if s_rec
+ then (`JUMP,Ptset.Int.empty, TagSet.positive
+ (TagSet.cap (TagSet.inj_positive l_label) s_lab))
+ else (`JUMP,TagSet.positive
+ (TagSet.cap (TagSet.inj_positive c_label) s_lab),
+ Ptset.Int.empty )
+ in
+ (if jmp != `ANY
+ && jmp != `ANYNOTEXT
+ && Ptset.Int.is_empty cc
+ && Ptset.Int.is_empty ll
+ then (`NIL,Ptset.Int.empty,Ptset.Int.empty)
+ else (jmp,cc,ll))::l) dir_states []
+ in merge_jump_list l
+
+
+ end
+
+
+
+ let choose_jump (d,cl,ll) f_nil f_t1 f_s1 f_tn f_sn f_s1n f_notext f_maytext =
+ match d with
+ | `NIL -> (`NIL,f_nil)
+ | `ANYNOTEXT -> `ANY,f_notext
+ | `ANY -> `ANY,f_maytext
+ | `JUMP ->
+ if Ptset.Int.is_empty cl then
+ if Ptset.Int.is_singleton ll then
+ let tag = Ptset.Int.choose ll in
+ (`TAG(tag),Trace.mk_app_fun f_tn tag (Tag.to_string tag))
+ else
+ (`MANY(ll),Trace.mk_app_fun f_sn ll (string_of_ts ll))
+ else if Ptset.Int.is_empty ll then
+ if Ptset.Int.is_singleton cl then
+ let tag = Ptset.Int.choose cl in
+ (`TAG(tag),Trace.mk_app_fun f_t1 tag (Tag.to_string tag))
+ else
+ (`MANY(cl),Trace.mk_app_fun f_s1 cl (string_of_ts cl))
+ else
+ (`ANY,Trace.mk_app_fun2 f_s1n cl ll ((string_of_ts cl) ^ " " ^ (string_of_ts ll)))
+
+ | _ -> assert false
+
+ let choose_jump_down tree d =
+ choose_jump d
+ (Trace.mk_fun (fun _ -> Tree.nil) "Tree.mk_nil")
+ (Trace.mk_fun (Tree.tagged_child tree) "Tree.tagged_child")
+ (Trace.mk_fun (Tree.select_child tree) "Tree.select_child")
+ (Trace.mk_fun (Tree.tagged_descendant tree) "Tree.tagged_desc")
+ (Trace.mk_fun (Tree.select_descendant tree) "Tree.select_desc")
+ (Trace.mk_fun (fun _ _ -> Tree.first_child tree) "[FIRSTCHILD]Tree.select_child_desc")
+ (Trace.mk_fun (Tree.first_element tree) "Tree.first_element")
+ (Trace.mk_fun (Tree.first_child tree) "Tree.first_child")
+
+ let choose_jump_next tree d =
+ choose_jump d
+ (Trace.mk_fun (fun _ _ -> Tree.nil) "Tree.mk_nil2")
+ (Trace.mk_fun (Tree.tagged_following_sibling_below tree) "Tree.tagged_sibling_ctx")
+ (Trace.mk_fun (Tree.select_following_sibling_below tree) "Tree.select_sibling_ctx")
+ (Trace.mk_fun (Tree.tagged_following_below tree) "Tree.tagged_foll_ctx")
+ (Trace.mk_fun (Tree.select_following_below tree) "Tree.select_foll_ctx")
+ (Trace.mk_fun (fun _ _ -> Tree.next_sibling_below tree) "[NEXTSIBLING]Tree.select_sibling_foll_ctx")
+ (Trace.mk_fun (Tree.next_element_below tree) "Tree.next_element_ctx")
+ (Trace.mk_fun (Tree.next_sibling_below tree) "Tree.node_sibling_ctx")
+