Debian Codegraph @

kernel/qGraph.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 Sorts
12
13 (** {6 Graphs of quality elimination constraints. } *)
14
15 (* *********************************************** *)
16 (* "Raw" elimination table between constants.
17 Used to specify the elimination rules between constant sorts. *)
18
19 module ElimTable : sig
20 val eliminates_to : Quality.t -> Quality.t -> bool
21 end
22
23 (* ************************************************ *)
24
25 type t
26
27 type path_explanation
28
29 type explanation =
30 | Path of path_explanation
31 | Other of Pp.t
32
33 type quality_inconsistency =
34 ((QVar.t -> Pp.t) option) *
35 (ElimConstraint.kind * Quality.t * Quality.t * explanation option)
36
37 type elimination_error =
38 | IllegalConstraintFromSProp of Quality.t
39 | IllegalConstantConstraint of Quality.constant * Quality.constant
40 | CreatesForbiddenPath of Quality.t * Quality.t
41 | MultipleDominance of Quality.t * Quality.t * Quality.t
42 | QualityInconsistency of quality_inconsistency
43
44 exception EliminationError of elimination_error
45
46 exception AlreadyDeclared
47 val add_quality : Quality.t -> t -> t
48 (** Always call this function on a quality before trying to [enforce] or [check]
49 a constraint or calling [eliminates_to].
50 Forces [Type] to eliminate to this quality. *)
51
52 val merge : t -> t -> t
53
54 val merge_constraints : ElimConstraints.t -> t -> t
55
56 val update_dominance_if_valid : t -> ElimConstraint.t -> t option
57 (** Checks if the given constraint satisfies the dominance condition:
58 Let q1 ~> q2 be the given constraint, with q2 a sort variable.
59 Then q1 (or the dominant sort of q1) should be related to the dominant sort of q2,
60 i.e., dom*(q1) ~> dom(q2) or dom(q2) ~> dom*(q1).
61
62 Returns [None] if the dominance *is not valid*, i.e., if the dominant sorts
63 are not related. Otherwise, returns [Some g] where [g] is the updated graph. *)
64
65 val check_constraint : t -> ElimConstraint.t -> bool
66 val check_constraints : ElimConstraints.t -> t -> bool
67
68 val enforce_eliminates_to : Quality.t -> Quality.t -> t -> t
69 (** Set the first quality to eliminate to the second one in the graph.
70
71 If this constraint creates a cycle that violates the constraints,
72 [QualityInconsistency] is raised. *)
73
74 val initial_graph : t
75 (** Graph with the constant quality elimination constraints found in
76 [Quality.Constants.eliminates_to]. *)
77
78 val update_rigids : t -> t -> t
79 val check_rigid_paths : t -> unit
80 val add_rigid_path : Quality.t -> Quality.t -> t -> t
81
82 val is_declared : Quality.t -> t -> bool
83
84 val eliminates_to : t -> Quality.t -> Quality.t -> bool
85
86 val eliminates_to_prop : t -> Quality.t -> bool
87
88 val sort_eliminates_to : t -> Sorts.t -> Sorts.t -> bool
89
90 val domain : t -> Quality.Set.t
91 val qvar_domain : t -> QVar.Set.t
92
93 val is_empty : t -> bool
94
95 val pr_qualities : (Quality.t -> Pp.t) -> t -> Pp.t
96
97 val explain_quality_inconsistency : (QVar.t -> Pp.t) -> explanation option -> Pp.t
98
99 val explain_elimination_error : (QVar.t -> Pp.t) -> elimination_error -> Pp.t