Debian Codegraph @

kernel/hConstr.mli

raw symbols SCIP
1 (************************************************************************)
2 (* * The Rocq Prover / The Rocq Development Team *)
3 (* v * Copyright INRIA, CNRS and contributors *)
4 (* <O___,, * (see version control and CREDITS file for authors & dates) *)
5 (* \VV/ **************************************************************)
6 (* // * This file is distributed under the terms of the *)
7 (* * GNU Lesser General Public License Version 2.1 *)
8 (* * (see LICENSE file for the text of the license) *)
9 (************************************************************************)
10
11 open Constr
12
13 type t
14 (** Hashconsed constr in an implicit environment,
15 keeping variables which have different types and bodies separate.
16
17 For instance the [x] subterms in [fun x : bool => x] and [fun x : nat => x] are different
18 (and have different hashes modulo accidental collision)
19 and the [x] subterms in [fun (y:nat) (x:bool) => x] and [fun (x:bool) (y:nat) => x] are different
20 (one is [Rel 1], the other is [Rel 2])
21 but the [x] subterms in [fun (y:nat) (x:bool) => x] and [fun (y:bool) (x:bool) => x] are shared.
22
23 This allows using it as a cache key while typechecking.
24
25 Hashconsing information of subterms is also kept. *)
26
27 val self : t -> constr
28
29 val kind : t -> (t,t,Sorts.t,UVars.Instance.t,Sorts.relevance) kind_of_term
30
31 val refcount : t -> int
32 (** How many times this term appeared as a subterm of the argument to [of_constr]. *)
33
34 val of_constr : Environ.env -> constr -> t
35
36 (* May not be used on Rel! (subterms can be rels) *)
37 val of_kind_nohashcons : (t,t,Sorts.t,UVars.Instance.t,Sorts.relevance) kind_of_term -> t
38 (** Build a [t] without hashconsing. Its refcount may be 1 even if
39 an identical term was already seen.
40
41 May not be used to build [Rel].
42
43 This is intended for the reconstruction of the inductive type when checking CaseInvert. *)
44
45 module Tbl : sig
46 (** Imperative tables indexed by [HConstr.t].
47 The interfaces exposed are the same as [Hashtbl]
48 but are not guaranteed to be implemented by [Hashtbl]. *)
49
50 type key = t
51
52 type 'a t
53
54 val find_opt : 'a t -> key -> 'a option
55
56 val add : 'a t -> key -> 'a -> unit
57
58 val create : unit -> 'a t
59 end
60
61 val hcons : t -> int * Constr.t