Debian Codegraph @

plugins/ssr/ssrast.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 (* This file is (C) Copyright 2006-2015 Microsoft Corporation and Inria. *)
12
13 open Names
14 open Ltac_plugin
15
16 (* Names of variables to be cleared (automatic check: not a section var) *)
17 type ssrhyp = SsrHyp of Id.t Loc.located
18 (* Variant of the above *)
19 type ssrhyp_or_id = Hyp of ssrhyp | Id of ssrhyp
20
21 (* Variant of the above *)
22 type ssrhyps = ssrhyp list
23
24 (* Direction to be used for rewriting as in -> or rewrite flag *)
25 type ssrdir = Ssrmatching_plugin.Ssrmatching.ssrdir = L2R | R2L
26
27 (* simpl: "/=", cut: "//", simplcut: "//=" nop: commodity placeholder *)
28 type ssrsimpl = Simpl of int | Cut of int | SimplCut of int * int | Nop
29
30 (* modality for rewrite and do: ! ? *)
31 type ssrmmod = May | Must | Once
32
33 (* modality with a bound for rewrite and do: !n ?n *)
34 type ssrmult = int * ssrmmod
35
36 (** Occurrence switch {1 2}, all is Some(false,[]) *)
37 type ssrocc = (bool * int list) option
38
39 (* index MAYBE REMOVE ONLY INTERNAL stuff between {} *)
40 type ssrindex = int Locus.or_var
41
42 (* clear switch {H G} *)
43 type ssrclear = ssrhyps
44
45 (* Discharge occ switch (combined occurrence / clear switch) *)
46 type ssrdocc = ssrclear option * ssrocc
47
48 (* OLD ssr terms *)
49 (* terms are pre constr, the kind is a parsing/printing flag to distinguish
50 * between x, @x and (x). It affects automatic clear and let-in preservation. *)
51 (* FIXME *)
52 (* Cpattern is a temporary flag that becomes InParens ASAP. *)
53 type ssrtermkind = Ssrmatching_plugin.Ssrmatching.ssrtermkind
54 type ssrterm = ssrtermkind * Genintern.glob_constr_and_expr
55
56 (* NEW ssr term *)
57
58 type ast_glob_env = {
59 ast_ltacvars : Id.Set.t;
60 ast_extra : Genintern.Store.t;
61 ast_intern_sign : Genintern.intern_variable_status;
62 }
63
64 (* These terms are raw but closed with the intenalization/interpretation
65 * context. It is up to the tactic receiving it to decide if such contexts
66 * are useful or not, and eventually manipulate the term before turning it
67 * into a constr *)
68 type ast_closure_term = {
69 body : Constrexpr.constr_expr;
70 glob_env : ast_glob_env option; (* for Tacintern.intern_constr *)
71 interp_env : Geninterp.interp_sign option; (* for Tacinterp.interp_open_constr_with_bindings *)
72 annotation : [ `None | `Parens | `DoubleParens | `At ];
73 }
74
75 type ssrview = ast_closure_term list
76
77 type id_block = Prefix of Id.t | SuffixId of Id.t | SuffixNum of int
78
79 (* Only [One] forces an introduction, possibly reducing the goal. *)
80 type anon_kind =
81 | One of string option (* name hint *)
82 | Drop
83 | All
84 | Temporary
85
86 type ssripat =
87 | IPatNoop
88 | IPatId of Id.t
89 | IPatAnon of anon_kind (* inaccessible name *)
90 | IPatDispatch of ssripatss_or_block (* (..|..) *)
91 | IPatCase of ssripatss_or_block (* [..|..] *)
92 | IPatInj of ssripatss
93 | IPatRewrite of (*occurrence option * rewrite_pattern **) ssrocc * ssrdir
94 | IPatView of ssrview (* /view *)
95 | IPatClear of ssrclear (* {H1 H2} *)
96 | IPatSimpl of ssrsimpl
97 | IPatAbstractVars of Id.t list
98 | IPatFastNondep
99
100 and ssripats = ssripat list
101 and ssripatss = ssripats list
102 and ssripatss_or_block =
103 | Block of id_block
104 | Regular of ssripats list
105 type ssrhpats = ((ssrclear option * ssripats) * ssripats) * ssripats
106 type ssrhpats_wtransp = bool * ssrhpats
107
108 (* tac => inpats *)
109 type ssrintrosarg = Tacexpr.raw_tactic_expr * ssripats
110
111
112 type ssrfwdid = Id.t
113
114 (** Binders (for fwd tactics) *)
115 type 'term ssrbind =
116 | Bvar of Name.t
117 | Bdecl of Name.t list * 'term
118 | Bdef of Name.t * 'term option * 'term
119 | Bstruct of Name.t
120 | Bcast of 'term
121 (* We use an intermediate structure to correctly render the binder list *)
122 (* abbreviations. We use a list of hints to extract the binders and *)
123 (* base term from a term, for the two first levels of representation of *)
124 (* of constr terms. *)
125 type ssrbindfmt =
126 | BFvar
127 | BFdecl of int (* #xs *)
128 | BFcast (* final cast *)
129 | BFdef (* has cast? *)
130 | BFrec of bool * bool (* has struct? * has cast? *)
131 type 'term ssrbindval = 'term ssrbind list * 'term
132
133 (** Forward chaining argument *)
134 (* There are three kinds of forward definitions: *)
135 (* - Hint: type only, cast to Type, may have proof hint. *)
136 (* - Have: type option + value, no space before type *)
137 (* - Pose: binders + value, space before binders. *)
138 type ssrfwdkind = FwdHint of string * bool | FwdHave | FwdPose
139 type ssrfwdfmt = ssrfwdkind * ssrbindfmt list
140
141 (* in *)
142 type ssrclseq = InGoal | InHyps
143 | InHypsGoal | InHypsSeqGoal | InSeqGoal | InHypsSeq | InAll | InAllHyps
144
145 type 'tac ssrhint = bool * 'tac option list
146
147 type 'tac fwdbinders =
148 bool * (ssrhpats * ((ssrfwdfmt * ast_closure_term) * 'tac ssrhint))
149
150 type 'tac ffwbinders =
151 (ssrhpats * ((ssrfwdfmt * ast_closure_term) * 'tac ssrhint))
152
153 type clause =
154 (ssrclear * ((ssrhyp_or_id * string) *
155 Ssrmatching_plugin.Ssrmatching.cpattern option) option)
156 type clauses = clause list * ssrclseq
157
158 type wgen =
159 (ssrclear *
160 ((ssrhyp_or_id * string) *
161 Ssrmatching_plugin.Ssrmatching.cpattern option)
162 option)
163
164 type 'a ssrdoarg = ((ssrindex * ssrmmod) * 'a ssrhint) * clauses
165 type 'a ssrseqarg = ssrindex * ('a ssrhint * 'a option)
166
167
168 open Ssrmatching_plugin
169 open Ssrmatching
170
171 type 'a ssrcasearg = ssripat option * ('a * ssripats)
172 type 'a ssrmovearg = ssrview * 'a ssrcasearg
173
174 type ssrdgens = { dgens : (ssrdocc * cpattern) list;
175 gens : (ssrdocc * cpattern) list;
176 clr : ssrclear }
177 type 'a ssragens = (ssrdocc * 'a) list list * ssrclear
178 type ssrapplyarg = ssrterm list * (ssrterm ssragens * ssripats)
179
180 (* OOP : these are general shortcuts *)
181 type gist = Tacintern.glob_sign
182 type ist = Tacinterp.interp_sign
183 type goal = Evar.t