Debian Codegraph @

tactics/rewrite.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 open Environ
13 open EConstr
14 open Evd
15 open Tactypes
16
17 (** TODO: document and clean me! *)
18
19 exception RewriteFailure of Environ.env * Evd.evar_map * Pretype_errors.pretype_error
20
21 type unary_strategy =
22 Subterms | Subterm | Innermost | Outermost
23 | Bottomup | Topdown | Progress | Try | Any | Repeat
24
25 type binary_strategy =
26 | Compose
27
28 type nary_strategy = Choice
29
30 type ('constr,'redexpr,'id) strategy_ast =
31 | StratId | StratFail | StratRefl
32 | StratUnary of unary_strategy * ('constr,'redexpr,'id) strategy_ast
33 | StratBinary of
34 binary_strategy * ('constr,'redexpr,'id) strategy_ast * ('constr,'redexpr,'id) strategy_ast
35 | StratNAry of nary_strategy * ('constr,'redexpr,'id) strategy_ast list
36 | StratConstr of 'constr * bool
37 | StratTerms of 'constr list
38 | StratHints of bool * string
39 | StratEval of 'redexpr
40 | StratFold of 'constr
41 | StratVar of 'id
42 | StratFix of 'id * ('constr,'redexpr,'id) strategy_ast
43
44 type rewrite_proof =
45 | RewPrf of constr * constr
46 | RewCast of Constr.cast_kind
47
48 type evars = evar_map * Evar.Set.t (* goal evars, constraint evars *)
49
50 type rewrite_result_info = {
51 rew_car : constr;
52 rew_from : constr;
53 rew_to : constr;
54 rew_prf : rewrite_proof;
55 rew_evars : evars;
56 }
57
58 type rewrite_result =
59 | Fail
60 | Identity
61 | Success of rewrite_result_info
62
63 type strategy
64
65 val strategy_of_ast : (Glob_term.glob_constr * constr delayed_open, Redexpr.red_expr delayed_open, Id.t) strategy_ast -> strategy
66
67 val map_strategy : ('a -> 'b) -> ('c -> 'd) -> ('e -> 'f) ->
68 ('a, 'c, 'e) strategy_ast -> ('b, 'd, 'f) strategy_ast
69
70 val pr_strategy : ('a -> Pp.t) -> ('b -> Pp.t) -> ('c -> Pp.t) ->
71 ('a, 'b, 'c) strategy_ast -> Pp.t
72
73 (** Entry point for user-level "rewrite_strat" *)
74 val cl_rewrite_clause_strat : strategy -> Id.t option -> unit Proofview.tactic
75
76 (** Entry point for user-level "setoid_rewrite" *)
77 val cl_rewrite_clause :
78 EConstr.t with_bindings delayed_open ->
79 bool -> Locus.occurrences -> Id.t option -> unit Proofview.tactic
80
81 val is_applied_rewrite_relation :
82 env -> evar_map -> rel_context -> constr -> types option
83
84 val get_reflexive_proof : env -> evar_map -> constr -> constr -> evar_map * constr
85
86 val get_symmetric_proof : env -> evar_map -> constr -> constr -> evar_map * constr
87
88 val get_transitive_proof : env -> evar_map -> constr -> constr -> evar_map * constr
89
90 val setoid_symmetry : unit Proofview.tactic
91
92 val setoid_symmetry_in : Id.t -> unit Proofview.tactic
93
94 val setoid_reflexivity : unit Proofview.tactic
95
96 val setoid_transitivity : constr option -> unit Proofview.tactic
97
98
99 val apply_strategy :
100 strategy ->
101 Environ.env ->
102 Names.Id.Set.t ->
103 constr ->
104 bool * constr ->
105 evars -> rewrite_result
106
107 module Strategies :
108 sig
109 val fail : strategy
110 val id : strategy
111 val refl : strategy
112 val progress : strategy -> strategy
113 val seq : strategy -> strategy -> strategy
114 val seqs : strategy list -> strategy
115 val choice : strategy -> strategy -> strategy
116 val choices : strategy list -> strategy
117 val try_ : strategy -> strategy
118
119 val fix_tac : (strategy -> strategy Proofview.tactic) -> strategy Proofview.tactic
120 val fix : (strategy -> strategy) -> strategy
121
122 val any : strategy -> strategy
123 val repeat : strategy -> strategy
124 val all_subterms : strategy -> strategy
125 val one_subterm : strategy -> strategy
126 val bottomup : strategy -> strategy
127 val topdown : strategy -> strategy
128 val innermost : strategy -> strategy
129 val outermost : strategy -> strategy
130
131 val one_lemma : delayed_open_constr -> bool -> Gentactic.glob_generic_tactic option -> Locus.occurrences -> strategy
132 val lemmas : (delayed_open_constr * bool * Gentactic.glob_generic_tactic option) list -> strategy
133
134 val old_hints : string -> strategy
135 val hints : string -> strategy
136 val reduce : Redexpr.red_expr -> strategy
137
138 val fold : Evd.econstr -> strategy
139 val fold_glob : Glob_term.glob_constr -> strategy
140 end
141
142 module Internal :
143 sig
144 val build_signature :
145 Environ.env -> Evd.evar_map -> constr ->
146 (types * types option) option list ->
147 (types * types option) option ->
148 Evd.evar_map * constr * (constr * t option) list
149 val build_morphism_signature : Environ.env -> Evd.evar_map -> Constrexpr.constr_expr -> Evd.evar_map * t
150 val default_morphism : Environ.env -> Evd.evar_map ->
151 (types * types option) option list *
152 (types * types option) option ->
153 constr -> Evd.evar_map * constr * t
154 end