| 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 Glob_term |
| 13 | |
| 14 | (* [get_pattern_id pat] returns a list of all the variable appearing in [pat] *) |
| 15 | val get_pattern_id : cases_pattern -> Id.t list |
| 16 | |
| 17 | (* [pattern_to_term pat] returns a glob_constr corresponding to [pat]. |
| 18 | [pat] must not contain occurrences of anonymous pattern |
| 19 | *) |
| 20 | val pattern_to_term : cases_pattern -> glob_constr |
| 21 | |
| 22 | (* |
| 23 | Some basic functions to rebuild glob_constr |
| 24 | In each of them the location is Util.Loc.ghost |
| 25 | *) |
| 26 | val mkGRef : GlobRef.t -> glob_constr |
| 27 | val mkGVar : Id.t -> glob_constr |
| 28 | val mkGApp : glob_constr * glob_constr list -> glob_constr |
| 29 | val mkGLambda : Name.t * glob_constr * glob_constr -> glob_constr |
| 30 | val mkGProd : Name.t * glob_constr * glob_constr -> glob_constr |
| 31 | |
| 32 | val mkGLetIn : |
| 33 | Name.t * glob_constr * glob_constr option * glob_constr -> glob_constr |
| 34 | |
| 35 | val mkGCases : |
| 36 | glob_constr option * tomatch_tuples * cases_clauses -> glob_constr |
| 37 | |
| 38 | val mkGHole : unit -> glob_constr |
| 39 | |
| 40 | (* we only build Evd.BinderType Anonymous holes *) |
| 41 | |
| 42 | (* |
| 43 | Some basic functions to decompose glob_constrs |
| 44 | These are analogous to the ones constrs |
| 45 | *) |
| 46 | val glob_decompose_app : glob_constr -> glob_constr * glob_constr list |
| 47 | |
| 48 | (* [glob_make_eq t1 t2] build the glob_constr corresponding to [t2 = t1] *) |
| 49 | val glob_make_eq : ?typ:glob_constr -> glob_constr -> glob_constr -> glob_constr |
| 50 | |
| 51 | (* [glob_make_neq t1 t2] build the glob_constr corresponding to [t1 <> t2] *) |
| 52 | val glob_make_neq : glob_constr -> glob_constr -> glob_constr |
| 53 | |
| 54 | (* alpha_conversion functions *) |
| 55 | |
| 56 | (* Replace the var mapped in the glob_constr/context *) |
| 57 | val change_vars : Id.t Id.Map.t -> glob_constr -> glob_constr |
| 58 | |
| 59 | (* [alpha_pat avoid pat] rename all the variables present in [pat] s.t. |
| 60 | the result does not share variables with [avoid]. This function create |
| 61 | a fresh variable for each occurrence of the anonymous pattern. |
| 62 | |
| 63 | Also returns a mapping from old variables to new ones and the concatenation of |
| 64 | [avoid] with the variables appearing in the result. |
| 65 | *) |
| 66 | val alpha_pat : |
| 67 | Id.Map.key list |
| 68 | -> Glob_term.cases_pattern |
| 69 | -> Glob_term.cases_pattern * Id.Map.key list * Id.t Id.Map.t |
| 70 | |
| 71 | (* [alpha_rt avoid rt] alpha convert [rt] s.t. the result respects barendregt |
| 72 | conventions and does not share bound variables with avoid |
| 73 | *) |
| 74 | val alpha_rt : Id.t list -> glob_constr -> glob_constr |
| 75 | |
| 76 | (* same as alpha_rt but for case branches *) |
| 77 | val alpha_br : Id.t list -> Glob_term.cases_clause -> Glob_term.cases_clause |
| 78 | |
| 79 | (* Reduction function *) |
| 80 | val replace_var_by_term : |
| 81 | Id.t |
| 82 | -> Glob_term.glob_constr |
| 83 | -> Glob_term.glob_constr |
| 84 | -> Glob_term.glob_constr |
| 85 | |
| 86 | (* |
| 87 | [is_free_in id rt] checks if [id] is a free variable in [rt] |
| 88 | *) |
| 89 | val is_free_in : Id.t -> glob_constr -> bool |
| 90 | val are_unifiable : Environ.env -> cases_pattern -> cases_pattern -> bool |
| 91 | val eq_cases_pattern : Environ.env -> cases_pattern -> cases_pattern -> bool |
| 92 | |
| 93 | (* |
| 94 | ids_of_pat : cases_pattern -> Id.Set.t |
| 95 | returns the set of variables appearing in a pattern |
| 96 | *) |
| 97 | val ids_of_pat : cases_pattern -> Id.Set.t |
| 98 | val expand_as : glob_constr -> glob_constr |
| 99 | |
| 100 | (* [resolve_and_replace_implicits ?expected_type env sigma rt] solves implicits of [rt] w.r.t. [env] and [sigma] and then replace them by their solution |
| 101 | *) |
| 102 | val resolve_and_replace_implicits : |
| 103 | EConstr.types |
| 104 | -> Environ.env |
| 105 | -> Evd.evar_map |
| 106 | -> glob_constr |
| 107 | -> glob_constr |