| 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 | (* diff options *) |
| 12 | |
| 13 | (** Name of Diffs option *) |
| 14 | val opt_name : string list |
| 15 | |
| 16 | (** Returns true if the diffs option is "on" or "removed" *) |
| 17 | val show_diffs : unit -> bool |
| 18 | |
| 19 | (** Returns true if the diffs option is "removed" *) |
| 20 | val show_removed : unit -> bool |
| 21 | |
| 22 | (** controls whether color output is enabled *) |
| 23 | val write_color_enabled : bool -> unit |
| 24 | |
| 25 | (** true indicates that color output is enabled *) |
| 26 | val color_enabled : unit -> bool |
| 27 | |
| 28 | type diffOpt = DiffOff | DiffOn | DiffRemoved |
| 29 | |
| 30 | val string_to_diffs : string -> diffOpt |
| 31 | |
| 32 | type goal |
| 33 | |
| 34 | val make_goal : Environ.env -> Evd.evar_map -> Evar.t -> goal |
| 35 | |
| 36 | (** Computes the diff between the goals of two Proofs and returns |
| 37 | the highlighted lists of hypotheses and conclusions. |
| 38 | |
| 39 | If the strings used to display the goal are not lexable (this is believed |
| 40 | unlikely), this routine will generate a Diff_Failure. This routine may also |
| 41 | raise Diff_Failure under some "impossible" conditions. |
| 42 | |
| 43 | If you want to make your call especially bulletproof, catch these |
| 44 | exceptions, print a user-visible message, then recall this routine with |
| 45 | the second argument ('og_s') set to None, which will skip the diff. |
| 46 | |
| 47 | The 'short' flag skips computing the diffs of the hypotheses, which allows the |
| 48 | Subgoals XML command to fetch just the conclusion of a goal. This is useful, |
| 49 | for example, when an IDE only needs to display the number of admitted goals or |
| 50 | preview the next unsolved goal. |
| 51 | *) |
| 52 | val diff_goal : ?short:bool -> ?og_s:goal -> flags:PrintingFlags.t -> goal -> Pp.t list * Pp.t |
| 53 | |
| 54 | (** Convert a string to a list of token strings using the lexer *) |
| 55 | val tokenize_string : string -> string list |
| 56 | |
| 57 | (** Computes diffs for a single conclusion *) |
| 58 | val diff_concl : ?og_s:goal -> flags:PrintingFlags.t -> goal -> Pp.t |
| 59 | |
| 60 | type goal_map |
| 61 | |
| 62 | (** Generates a map from [np] to [op] that maps changed goals to their prior |
| 63 | forms. The map doesn't include entries for unchanged goals; unchanged goals |
| 64 | will have the same goal id in both versions. |
| 65 | |
| 66 | [op] and [np] must be from the same proof document and [op] must be for a state |
| 67 | before [np]. *) |
| 68 | val make_goal_map : Proof.t -> Proof.t -> goal_map |
| 69 | |
| 70 | val map_goal : Evar.t -> goal_map -> goal option |
| 71 | |
| 72 | (* Exposed for unit test, don't use these otherwise *) |
| 73 | (* output channel for the test log file *) |
| 74 | val log_out_ch : out_channel ref |
| 75 | |
| 76 | |
| 77 | type hyp_info = { |
| 78 | idents: string list; |
| 79 | rhs_pp: Pp.t; |
| 80 | } |
| 81 | |
| 82 | val diff_hyps : string list list -> hyp_info CString.Map.t -> string list list -> hyp_info CString.Map.t -> Pp.t list |
| 83 | |
| 84 | val diff_proofs : diff_opt:diffOpt -> ?old:Proof.t -> flags:PrintingFlags.t -> Proof.t -> Pp.t |
| 85 | |
| 86 | val notify_proof_diff_failure : string -> unit |