File: search.mli

package info (click to toggle)
coq 8.20.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 44,116 kB
  • sloc: ml: 234,160; sh: 4,301; python: 3,270; ansic: 2,644; makefile: 882; lisp: 172; javascript: 63; xml: 24; sed: 2
file content (89 lines) | stat: -rw-r--r-- 3,679 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
(************************************************************************)
(*         *   The Coq Proof Assistant / The Coq Development Team       *)
(*  v      *         Copyright INRIA, CNRS and contributors             *)
(* <O___,, * (see version control and CREDITS file for authors & dates) *)
(*   \VV/  **************************************************************)
(*    //   *    This file is distributed under the terms of the         *)
(*         *     GNU Lesser General Public License Version 2.1          *)
(*         *     (see LICENSE file for the text of the license)         *)
(************************************************************************)

open Names
open Constr
open Environ
open Pattern
open Vernacexpr

(** {6 Search facilities. } *)

type glob_search_item =
  | GlobSearchSubPattern of glob_search_where * bool * constr_pattern
  | GlobSearchString of string
  | GlobSearchKind of Decls.logical_kind
  | GlobSearchFilter of (GlobRef.t -> bool)

type glob_search_request =
  | GlobSearchLiteral of glob_search_item
  | GlobSearchDisjConj of (bool * glob_search_request) list list

type filter_function =
  GlobRef.t -> Decls.logical_kind option -> env -> Evd.evar_map -> constr -> bool
type display_function =
  GlobRef.t -> Decls.logical_kind option -> env -> Evd.evar_map -> constr -> unit

(** {6 Generic filter functions} *)

val blacklist_filter : filter_function
(** Check whether a reference is blacklisted. *)

val module_filter : DirPath.t list search_restriction -> filter_function
(** Check whether a reference pertains or not to a set of modules *)

val search_filter : glob_search_item -> filter_function

(** {6 Specialized search functions}

[search_xxx gl pattern modinout] searches the hypothesis of the [gl]th
goal and the global environment for things matching [pattern] and
satisfying module exclude/include clauses of [modinout]. *)

val search_rewrite : env -> Evd.evar_map -> constr_pattern -> DirPath.t list search_restriction
                  -> display_function -> unit
val search_pattern : env -> Evd.evar_map -> constr_pattern -> DirPath.t list search_restriction
                  -> display_function -> unit
val search         : env -> Evd.evar_map -> (bool * glob_search_request) list
                  -> DirPath.t list search_restriction -> display_function -> unit

type search_constraint =
  | Name_Pattern of Str.regexp
  (** Whether the name satisfies a regexp (uses Ocaml Str syntax) *)
  | Type_Pattern of Pattern.constr_pattern
  (** Whether the object type satisfies a pattern *)
  | SubType_Pattern of Pattern.constr_pattern
  (** Whether some subtype of object type satisfies a pattern *)
  | In_Module of Names.DirPath.t
  (** Whether the object pertains to a module *)
  | Include_Blacklist
  (** Bypass the Search blacklist *)

type 'a coq_object = {
  coq_object_prefix : string list;
  coq_object_qualid : string list;
  coq_object_object : 'a;
}

val interface_search : env -> Evd.evar_map -> (search_constraint * bool) list -> constr coq_object list

(** {6 Generic search function} *)

val generic_search : env -> Evd.evar_map -> display_function -> unit
(** This function iterates over all hypothesis of the goal numbered
    [glnum] (if present) and all known declarations. *)

(** {6 Search function modifiers} *)

val prioritize_search : (display_function -> unit) -> display_function -> unit
(** [prioritize_search iter] iterates over the values of [iter] (seen
    as a sequence of declarations), in a relevance order. This requires to
    perform the entire iteration of [iter] before starting streaming. So
    [prioritize_search] should not be used for low-latency streaming. *)