Debian Codegraph @

pretyping/locus.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 Names
12
13 (** Locus : positions in hypotheses and goals. *)
14
15 (** ['a or_var] represents either a value of type ['a] or a variable. *)
16 type 'a or_var =
17 | ArgArg of 'a
18 | ArgVar of lident
19
20 (** {6 Occurrences} *)
21
22 (** Occurences in a hypothesis or conclusion. *)
23 type 'a occurrences_gen =
24 | AllOccurrences
25 | AtLeastOneOccurrence
26 | AllOccurrencesBut of 'a list (** The list should be non-empty. *)
27 | NoOccurrences
28 | OnlyOccurrences of 'a list (** The list should be non-empty. *)
29
30 type occurrences_expr = (int or_var) occurrences_gen
31 type 'a with_occurrences_expr = occurrences_expr * 'a
32
33 type occurrences = int occurrences_gen
34 type 'a with_occurrences = occurrences * 'a
35
36
37 (** {6 Locations} *)
38
39 (** In a hypothesis, occurrences can refer to the body (if any), to the type, or to both. *)
40 type hyp_location_flag = InHyp | InHypTypeOnly | InHypValueOnly
41
42 (** {6 Abstract clauses expressions} *)
43
44 type 'a hyp_location_expr = 'a with_occurrences_expr * hyp_location_flag
45
46 (** A [clause_expr] (and its instance [clause]) denotes occurrences and
47 hypotheses in a goal in an abstract way; in particular, it can refer
48 to the set of all hypotheses independently of the effective contents
49 of the current goal.
50
51 Concerning the field [onhyps]:
52 - [None] means *on every hypothesis*.
53 - [Some hyps] means on hypotheses belonging to [hyps]. *)
54 type 'id clause_expr =
55 { onhyps : 'id hyp_location_expr list option;
56 concl_occs : occurrences_expr }
57
58 type clause = Id.t clause_expr
59
60 (** {6 Concrete view of occurrence clauses} *)
61
62 (** [clause_atom] refers either to:
63 - Some occurrences in a hypothesis.
64 - Some occurrences in the conclusion .*)
65 type clause_atom =
66 | OnHyp of Id.t * occurrences_expr * hyp_location_flag
67 | OnConcl of occurrences_expr
68
69 (** A [concrete_clause] is a collection of occurrences in hypotheses
70 and in the conclusion. *)
71 type concrete_clause = clause_atom list
72
73
74 (** {6 A weaker form of clause with no mention of occurrences} *)
75
76 (** A [hyp_location] is a hypothesis together with a location in this
77 hypothesis (body, type, or both). *)
78 type hyp_location = Id.t * hyp_location_flag
79
80 (** A [goal_location] is either:
81 - A hypothesis (together with a location in this hypothesis).
82 - The conclusion (represented by [None]). *)
83 type goal_location = hyp_location option
84
85
86 (** {6 Simple clauses, without occurrences nor location} *)
87
88 (** A [simple_clause] is a set of hypotheses, possibly extended with
89 the conclusion (conclusion is represented by None). *)
90 type simple_clause = Id.t option list
91
92 (** {6 Occurences modulo conversion} *)
93
94 (** A notion of occurrences allowing to express "all occurrences
95 convertible to the first which matches". *)
96 type 'a or_like_first = AtOccs of 'a | LikeFirst