(***********************************************************************)
(*                                                                     *)
(*                                 GALAX                               *)
(*                              XQuery Engine                          *)
(*                                                                     *)
(*  Copyright 2001-2003, Lucent Technologies.                          *)
(*  Distributed only by permission.                                    *)
(*                                                                     *)
(***********************************************************************)

(* $Id: rewrite_judge.mli,v 1.2 2003/05/28 14:47:38 simeon Exp $ *)

(* Module Rewrite_judge
   Description:
     This module implements some auxiliary judgments used during
     optimization analysis.
*)

val used_count : Xquery_ast.vname -> Xquery_ast.cexpr -> int
    (* [used_count] determines the occurrence of variable $x in a
       given core expression *)

val can_fail : Xquery_ast.cexpr -> bool
    (* [can_fail] determines whether the given core expression can
       raise an error *)

(*
val is_ordered : Xquery_ast.cexpr -> bool
    (* [is_ordered] determines whether the given core expression is
       already sorted by document order or not *)
*)

val intersects : Static_context.static_context -> Xquery_ast.model -> Xquery_ast.datatype -> bool

(* Note:
     intersection should be moved in the typing directory and fixed.
   - Jerome *)

val does_node_care_about_order : Xquery_ast.cexpr -> bool
    (* [is_ordered] determines whether the semantics of the expression
       depends on document order or not. *)

