- Introduction and preliminaries
- Language server protocol support table
- Implementation-specific options
- Implementation-specific
dataerror field - Extensions to the LSP specification
- Extra diagnostics data
- Goal Display
- File checking progress
- Document Ast Request
- .vo file saving
- Performance Data Notification
- Trim cache notification
- Workspace Update Notification
- Viewport notification
- Did Change Configuration and Server Configuration parameters
- Server Version Notification
- Server Status Notification
- Sentence Execution Information
- Pétanque
- Changelog
- Common types
petanque/get_root_state:petanque/get_state_at_pospetanque/startpetanque/runpetanque/run_at_pospetanque/goalspetanque/premisespetanque/state/eqpetanque/state/hashpetanque/state/proof/equalpetanque/state/proof/hashpetanque/astpetanque/ast_at_pospetanque/proof_infopetanque/proof_info_at_pos
rocq-lsp is a Language Server Protocol implementation for the Rocq
Prover. It is compatible with standard LSP clients but includes
extensions for advanced Rocq-specific, machine-learning, and software
engineering workflows, named petanque.
This document is written for the 3.17 version of the LSP specification: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification
For documentation on the API of the VSCode/VSCodium rocq-lsp
extension see the VSCODE_API file instead.
See also the upstream LSP issue on generic support for Proof Assistants microsoft/language-server-protocol#1414
rocq-lsp is a bit different from other servers in that checking the
file is often very expensive, so the continuous LSP model can be too
heavy. The philosophy of rocq-lsp is to treat a Rocq document as a
build task, and then check the document under user-request.
Thus, for example when the user requests goals at a given point,
rocq-lsp will check if the goals are known, otherwise try to check
the required document parts to return answers to the user ASAP.
rocq-lsp has three main functioning modes (controlled by a regular
parameter):
-
continuous mode: in this mode,
rocq-lspwill try to complete checking of all open files when idle. This mode has shown to be very useful in many contexts, for example educational, as it provides very low latency. -
on-demand mode: in this mode,
rocq-lspwill do nothing when idle. This mode, for example, can simulate the traditional "step-based" Rocq interaction mode, configure your client to request goals at the desired position, androcq-lspwill execute the document up to that point. -
on-demand mode, with viewport hints: in this mode, inspired by Isabelle, the
rocq-lspclient will inform the server about the user's viewport. This mode provides a comfortable compromise between latency and CPU usage.
Note that on-demand mode often implies that some requests that require
the full document to be checked, like documentSymbols, will return
less complete information.
Also note that it has been hard for us to design an interaction mode that would fit well all client editors; for example VSCode doesn't implement progress on some requests that would be very useful for us.
However, the underlying checking engine (Flèche) is very flexible,
please feel free to contact with us if your client would want things
in a different way.
See the manual for the exact details. By default, rocq-lsp attempts
to auto-configure projects by locating _RocqProject (or
_CoqProject) files within the LSP workspace folders sent by the
client.
To implement a minimal but functional rocq-lsp client, you need to:
- Initialize a standard LSP client.
- Setup the right parameters for
initializationOptionsoninitialize. - Implement the
coq/goalsrequest handler.
Optionally, we recommend supporting:
- The
coq/serverStatusnotification. - The
coq/viewportnotification.
If a feature doesn't appear here it usually means it is not planned in the short term:
| Method | Support | Notes |
|---|---|---|
initialize |
Partial | We don't obey the advertised client capabilities |
client/registerCapability |
No | Not planned ATM |
$/setTrace |
Yes | |
$/logTrace |
Yes | |
window/logMessage |
Yes | |
| --------------------------------------- | --------- | -------------------------------------------------------------------------- |
textDocument/didOpen |
Yes | We can't reuse Memo tables yet |
textDocument/didChange |
Yes | We only support TextDocumentSyncKind.Full for now |
textDocument/didClose |
Partial | We'd likely want to save a .vo file on close if possible |
textDocument/didSave |
Partial | Undergoing behavior refinement |
| --------------------------------------- | --------- | -------------------------------------------------------------------------- |
notebookDocument/didOpen |
No | Planned |
| --------------------------------------- | --------- | -------------------------------------------------------------------------- |
textDocument/declaration |
No | Planned, blocked on upstream issues |
textDocument/definition |
Yes (*) | Uses .glob information which is often incomplete |
textDocument/references |
No | Planned, blocked on upstream issues |
textDocument/hover |
Yes | Shows stats, type info, and location of identifiers at point, extensible |
textDocument/codeLens |
No | |
textDocument/foldingRange |
No | |
textDocument/documentSymbol |
Yes | Sections and modules missing (#322) |
textDocument/semanticTokens |
No | Planned |
textDocument/inlineValue |
No | Planned |
textDocument/inlayHint |
No | Planned |
textDocument/completion |
Partial | Needs more work locally and upstream (#50) |
textDocument/publishDiagnostics |
Yes | |
textDocument/diagnostic |
No | Planned, issue #49 |
textDocument/codeAction |
No | Planned |
textDocument/selectionRange |
Partial | Selection for a point is its span; no parents |
| --------------------------------------- | --------- | -------------------------------------------------------------------------- |
workspace/diagnostic |
No | Planned |
workspace/workspaceFolders |
Yes | Each folder should have a _RocqProject file at the root. |
workspace/didChangeWorkspaceFolders |
Yes | |
workspace/didChangeConfiguration |
Yes (*) | We still do a client -> server push, instead of pull |
| --------------------------------------- | --------- | -------------------------------------------------------------------------- |
The rocq-lsp server only accepts file:/// URIs; moreover, the URIs
sent to the server must be able to be mapped back to a Rocq library
name, so a fully-checked file can be saved to a .vo for example.
Don't hesitate to open an issue if you need support for different kind
of URIs in your application / client. The client does support
vsls:/// URIs.
Additionally, rocq-lsp will use the languageId field in didOpen
parameters to determine the content type. Supported languageId are:
coq/rocq: File will be interpreted as a regular Rocq vernacular file,markdown: File will be interpreted as a markdown file. Code snippets betweenrocq(orcoq) markdown code blocks will be interpreted as Rocq code.latex: File will be interpreted as a LaTeX file. Code snippets between\begin{rocq}/\end{rocq}LaTeX environments (or\being{coq}/\end{coq}will be interpreted as Rocq code.
By default, the rocq-lsp VSCode client will activate for files ending
in some specific extensions, setting their languageId as follows:
.v:languageId = rocq.mv:languageId = markdown.v.texor.lv:languageId = latex
The rocq-lsp server accepts several options via the
initializationOptions field of the LSP initialize request. See
package.json and the documentation of the
workspace/didChangeConfiguration call below for the list of options.
Rocq will often generate "feedback" messages when trying to execute
commands, for example debug messages, or to return solutions to
commands such as Search or Print.
Rocq "feedback" is very context dependent, feedback related to
document sentences is recorded in the document, and can be obtained
with the coq/goals request below.
Feedback related to specific command requests is handled via:
- if the request succeeds, feedback should be reflected in the return type of the request
- if the request fails, we will set the optional
datafield in the request response to an object of typeRocqErrorData:
interface RocqErrorData = {
feedback : Message<string>[];
}
As of today, rocq-lsp implements several extensions to the LSP
spec. Note that none of them are stable yet.
- Extra diagnostics data
- Goal display
- File checking progress
- Document Ast
- .vo file saving
- Performance data notification
- Trim cache notification
- Workspace Update Notification
- Viewport notification
- Server configuration parameters
- Server version notification
- Server status notification
This is enabled if the server-side option send_diags_extra_data is
set to true. In this case, some diagnostics may come with extra data
in the optional data field.
This field is experimental, and it can change without warning. As of today we offer two kinds of extra information on errors:
- range of the full sentence that displayed the error,
- if the error was on a Require, information about the library that failed.
As of today, this extra data is passed via member parameters
// From `prefix` Require `refs`
type failedRequire = {
prefix ?: qualid
refs : qualid list
}
type DiagnosticsData = {
sentenceRange ?: Range;
failedRequire ?: FailedRequire
}In order to display proof goals and information at point, rocq-lsp
supports the proof/goals request, parameters are:
interface GoalRequest {
textDocument: VersionedTextDocumentIdentifier;
position: Position;
pp_format?: 'Box' | 'Pp' | 'Str';
compact?: boolean;
pretac?: string;
command?: string;
mode?: 'Prev' | 'After';
}The textDocument and position parameters are standard.
Note that rocq-lsp will execute the Rocq document up to the
position specified in the request parameters.
-
pp_formatcontrols the pretty printing format used in the results.Ppwill return goals using Rocq's pretty-printing type (to be documented, see our rendered undereditor/code/lib/format-pprint),Stringwill return the goals and message bodies in plain text. -
compactcontrols whether the hypotheses will be "compacted", that is to say, given for example hypothesesa,bof typenat, they will be displayed asa, b : nat, or separately, that is to saya : nat \n b : nat. -
mode(if absent, thegoal_after_tacticglobal configuration parameter will be used) controls whether thegoalsreturned correspond to the sentence atposition, or to the previous sentence in the document. If there is no Rocq sentence at the requestedposition, we will return the goals corresponding to the previous sentence.If the
messages_follow_goalglobal setting is set totrue,modewill be used to select whichmessagesanderrorfields are returned in the answer too. If the setting is set tofalse(default),messagesanderrorare returned for the specified exact documentposition. -
command, is a list of Rocq commands that will be run just after the selected sentence for goal display, but before goals are sent to the user. This is useful for ephemeral post-processing of goals. Usepetanque/runif you have more complex ephemeral execution needs outside goal display.
The answer to the proof/goals request is a GoalAnswer object,
where:
interface Hyp<Pp> {
names: Pp[];
def?: Pp;
ty: Pp;
}
interface Goal<Pp> {
hyps: Hyp<Pp>[];
ty: Pp;
}
interface GoalConfig<G, Pp> {
goals : Goal<G>[];
stack : [Goal<G>[], Goal<G>[]][];
bullet ?: Pp;
shelf : Goal<G>[];
given_up : Goal<G>[];
}
export interface Message<Pp> {
range?: Range;
level : number;
text : Pp
}
interface GoalAnswer<G, Pp> {
textDocument: VersionedTextDocumentIdentifier;
position: Position;
range?: Range;
goals?: GoalConfig<G, Pp>;
messages: Pp[] | Message<Pp>[];
error?: Pp;
program?: ProgramInfo;
}
const goalReq : RequestType<GoalRequest, GoalAnswer<PpString>, void>which can be then rendered by the client at wish.
The main objects of interest are:
-
Hyp: This represents a pair of hypothesis names and type, additionally with a body as obtained withsetorposetactics -
Goal: Contains a Rocq goal: a pair of hypothesis and the goal's type -
GoalConfig: This is the main object for goals information,goalscontains the current list of foreground goals,stackcontains a list of focused goals, where each element of the list represents a focus position (like a zipper); see below for an example.shelfandgiven_upcontain goals in theshelf(a kind of goal hiding from tactics) and admitted ones.If
modewas set toPrev, or thegoal_after_tacticoption is set tofalse, goals returned here will correspond to the previous sentence. -
GoalAnswer: In addition to the goals at point,GoalAnswerwill contain information to the selected sentence, in particular,messages,error, andrange.The selected sentence here depends on the
messages_follow_goalglobal setting:-
if
messages_follow_goal = false, the selected sentence is always the one atposition, if there is some. Note that Rocq will skip most blank space when parsing, so there are parts of a document that have no corresponding sentence attached. In these cases the fields will be undefined. -
if
messages_follow_goal = true, the selected sentence is the same than the one used forgoals.
-
An example for stack is the following Rocq script:
t. (* Produces 5 goals *)
- t1.
- t2.
- t3. (* Produces 3 goals *)
+ f1.
+ f2. (* <- current focus *)
+ f3.
- t4.
- t5.In this case, the stack will be [ ["f1"], ["f3"] ; [ "t2"; "t1" ], [ "t4" ; "t5" ]].
proof/goals was first used in the lambdapi-lsp server
implementation, and we adapted it to rocq-lsp.
As of today, the default output format type parameter Pp is
controlled by the server option pp_type : number, if the pp_format
field is not present. see package.json for different values. 0 is
guaranteed to be Pp = string, the other values are
Rocq-implementation-specific and generally not stable; tho we provide
utils for those interested in richer printing formats.
- v0.2.5:
petanque/get_state_at_poswill not error if there is no node at point- new method
petanque/run_at_pos - new option
compactin goal requests (both LSP and petanque) to display "non-compacted" contexts. - new methods
petanque/proof_infoandpetanque/proof_info_at_pos
- v0.2.4:
- behavior of
messages,error, andrangecan now be controlled by themessages_follow_goalglobal setting - new experimental output format
Box.GoalAnswernow carries an additional type parameter, to account for it.
- behavior of
- v0.2.3: new field in answer
range, which contains the range of the sentence atposition - v0.1.9: backwards compatible with 0.1.8
commandfield, alias ofpretac, as this is not limited to tactics- new optional
mode : "Prev" | "After"field to indicate desired goal position
- v0.1.8: new optional
pretacfield for post-processing, backwards compatible with 0.1.7 - v0.1.7: program information added, rest of fields compatible with 0.1.6
- v0.1.7: pp_format field added to request, backwards compatible
- v0.1.6: the
Ppparameter can now be either Rocq'sPp.ttype orstring(default) - v0.1.5: message type does now include range and level
- v0.1.4: goal type was made generic, the
stacksanddeffields are not null anymore, compatible v0.1.3 clients - v0.1.3: send full goal configuration with shelf, given_up, versioned identifier for document
- v0.1.2: include messages and optional error in the request response
- v0.1.1: include position and document in the request response
- v0.1.0: initial version, imported from lambdapi-lsp
The $/coq/fileProgress notification is sent from server to client to
describe the ranges of the document that have been processed.
It is modelled after $/lean/fileProgress, see
microsoft/language-server-protocol#1414 for more information.
enum CoqFileProgressKind {
Processing = 1,
FatalError = 2
}
interface CoqFileProgressProcessingInfo {
/** Range for which the processing info was reported. */
range: Range;
/** Kind of progress that was reported. */
kind?: CoqFileProgressKind;
}
interface CoqFileProgressParams {
/** The text document to which this progress notification applies. */
textDocument: VersionedTextDocumentIdentifier;
/**
* Array containing the parts of the file which are still being processed.
* The array should be empty if and only if the server is finished processing.
*/
processing: CoqFileProgressProcessingInfo[];
}- v0.1.1: exact copy from Lean protocol (spec under Apache License)
The coq/getDocument request returns a serialized version of Fleche's
document, plus some additional information for each sentence / node.
It is modelled after LSP's standard textDocument/documentSymbol, but
returns instead the full document contents as understood by Flèche.
Caveats: Flèche notion of document is evolving, in particular you should not assume that the document will remain a list, more structure could be happening..
interface FlecheDocumentParams {
textDocument: VersionedTextDocumentIdentifier;
ast ?: boolean;
goals ?: 'Pp' | 'Str';
}// Status of the document, Yes if fully checked, range contains the last seen lexical token
interface CompletionStatus {
status : ['Yes' | 'Stopped' | 'Failed']
range : Range
};
// Implementation-specific span information, `range` is assured, the
// other parameters will be present when requested in the call For
// goals, we use the printing mode specified at initalization time
interface SpanInfo {
range : Range;
ast ?: any;
goals ?: GoalsAnswer<Pp>;
};
interface FlecheDocument {
spans: RangedSpan[];
completed : CompletionStatus
};
const docReq : RequestType<FlecheDocumentParams, FlecheDocument, void>- v0.1.6: initial version
rocq-lsp provides a file-save request coq/saveVo, which will save the
current file to disk.
Note that rocq-lsp does not automatic trigger this on didSave, as
it would produce too much disk trashing, but we are happy to implement
usability tweaks so .vo files are produced when they should.
interface FlecheSaveParams {
textDocument: VersionedTextDocumentIdentifier;
}The request will return null, or fail if not successful.
- v0.2.4: non-backwards compatible change!
RangedSpantype is removed in favor ofSpanInfo.SpanInfonow contains a list of properties, for nowrange,ast,goals, which are returned depending on the request parameters, except forrangewhich is always present. New (optional) fieldsastandgoalsare added toFlecheDocumentParams. - v0.1.6: first version
The $/coq/filePerfData notification is sent from server to client
when the checking completes (if the server-side send_perf_data
option is enabled); it includes information about execution hotspots,
caching, and memory use by sentences:
interface PerfInfo {
// Original Execution Time (when not cached)
time: number;
// Difference in words allocated in the heap using `Gc.quick_stat`
memory: number;
// Whether the execution was cached
cache_hit: boolean;
// Caching overhead
time_hash: number;
}
interface SentencePerfParams<R> {
range: R;
info: PerfInfo;
}
interface DocumentPerfParams<R> {
textDocument: VersionedTextDocumentIdentifier;
summary: string;
timings: SentencePerfParams<R>[];
}
const coqPerfData : NotificationType<DocumentPerfParams<Range>>- v0.1.9:
- new server-side option to control whether the notification is sent
- Fields renamed:
loc -> range,mem -> memory - Fixed type for
range, it was alwaysRange timeandmemoryare now into a betterPerfInfodata, which correctly provides info for memoized sentences- We now send the real time, even if the command was cached
memorynow means difference in memory fromGC.quick_statfilePerfDatawill send the full document, ordered linearly, in 0.1.7 we only sent the top 10 hotspots- generalized typed over
Rparameter for range
- v0.1.8: Spec was accidentally broken, types were invalid
- v0.1.7: Initial version
The coq/trimCaches notification from client to server tells the
server to free memory. It has no parameters.
The coq/workspace_update notification from client to server notifies
the server that the Rocq external environment has changed, for
example, when .vo files have been updated.
This can used in combination with other calls like coq/saveVo to
work with multiple files.
The coq/viewRange notification from client to server tells the
server the visible range of the user.
interface ViewRangeParams {
textDocument: VersionedTextDocumentIdentifier;
range: Range;
}The server will listen to the workspace/didChangeConfiguration
parameters and try to update them without a full server restart.
The settings field corresponds to the data structure also passed in
the initializationOptions parameter for the LSP init method.
As of today, the server exposes the following parameters:
export interface UnicodeCompletionConfig {
enabled: "off" | "normal" | "extended";
commit_chars : string[];
}
export interface CompletionConfig {
unicode: UnicodeCompletionConfig
}
export interface CoqLspServerConfig {
client_version: string;
eager_diagnostics: boolean;
goal_after_tactic: boolean;
messages_follow_goal: boolean;
show_coq_info_messages: boolean;
show_notices_as_diagnostics: boolean;
admit_on_bad_qed: boolean;
debug: boolean;
unicode_completion: "off" | "normal" | "extended"; // Deprecated
max_errors: number;
pp_type: 0 | 1 | 2;
show_stats_on_hover: boolean;
show_loc_info_on_hover: boolean;
show_universes_on_hover: boolean;
show_state_hash_on_hover: boolean;
show_comments_on_hover: boolean;
check_only_on_request: boolean;
send_perf_data: boolean;
send_execinfo: boolean;
completion: CompletionConfig
}The settings are documented in the package.json file for the VSCode
client.
- v0.2.5: New option
show_comments_on_hover - v0.2.4:
- Deprecate
unicode_completionin favor of newcompletion: CompletionConfigconfiguration record. - New option,
messages_follow_goal. - New option,
send_execinfo.
- Deprecate
- v0.2.3: New options,
show_universes_on_hover,show_state_hash_on_hover,send_perf_data. - v0.1.9: First public documentation.
The server will send the $/coq/serverVersion notification to inform
the client about rocq-lsp version specific info.
The parameters are:
export interface CoqServerVersion {
coq: string;
ocaml: string;
coq_lsp: string;
}- v0.1.9: First public documentation.
The server will send the $/coq/serverStatus notification to inform
the client of checking status (start / end checking file)
The parameters are:
export interface CoqBusyStatus {
status: "Busy";
modname: string;
}
export interface CoqIdleStatus {
status: "Idle" | "Stopped";
}
export type CoqServerStatus = CoqBusyStatus | CoqIdleStatus;- v0.1.9: First public documentation.
The server will send the $/coq/executionInformation notification to
inform the client that rocq-lsp intends to execute a sentence.
The parameters are:
export type ExecutionInfoParams {
textDocument: VersionedTextDocumentIdentifier;
range: Range
};This way, clients can know when rocq-lsp start execution of a sentence,
and set a UI timer for example to inform the user that the sentence is
under execution. This notification will likely be replaced by an
improved coq/fileProgress.
Note: this notification needs to be enabled via the global
configuration parameter send_execinfo.
- v0.2.4: First public documentation.
The pétanque API enables lightweight interaction with Rocq without
requiring modifications to the document. This is very useful in
various contexts, especially for accessing Rocq's command command
execution and proof engine. pétanque uses the same JSON-RPC 2.0
protocol as LSP.
pétanque is at an experimental stage, and can be used as a standalone
tool via the pet-server binary. We strongly recommend to use pétanque
withing an LSP context.
Several resource-heavy server-side Rocq objects such as proof states are represented in the protocol via integer identifiers, as they cannot be serialized practically. These will be garbage collected automatically in future versions of the API.
Preliminary documentation for pétanque is provided below:
- v1 (
rocq-lsp0.2.3): Initial public release - v2 (
rocq-lsp0.2.4):- added: new methods for Ast access
petanque/astandpetanque/ast_at_pos(@ejgallego, @JulesViennotFranca, #980) - changed:
No_state_at_pointerror is nowNo_node_at_point(@JulesViennotFranca, #980)
- added: new methods for Ast access
- v3 (
rocq-lsp0.2.5):- changed:
petanque/get_state_at_poswill not error if there is no node at point - added: new method
petanque/run_at_pos - added: new methods
petanque/proof_infoandpetanque/proof_info_at_pos
- changed:
The basic operating mode of petanque is to first get a Rocq state
from a document, this can be done either by position
(petanque/get_state_at_pos), or via a lemma name
(petanque/start). Once you have a state at hand, you can use
petanque/run to execute a Rocq command, petanque/goals to obtain
goals from it, and a variety of other operations. You can also use the
different *_at_pos requests (for example petanque/run_at_pos) if
your request is a one-shot query.
Options for command execution, in particular, whether to memoize the execution and whether to hash it:
interface Run_opts {
{ memo ?: bool [@default true]
; hash ?: bool [@default true]
}
endResult of a Rocq command execution. Contains a result, a hash of the result (if enabled), whether the resulting command finished a proof, and Rocq feedback messages generated by the execution of the command.
interface Run_result<res> {
{ st : res
; hash ?: int
; proof_finished : bool
; feedback : (int * string) list
}Returns state at the beginning of a document. Forces execution of the full document.
interface Params =
{ uri : string
; opts ?: Run_opts
}interface Response = Run_result<number>Returns state at a given document point. Will force execution of the document to that point. Recall that LSP positions are zero-based, (line 1 in editors is line 0 here).
interface Params =
{ uri : string
; opts ?: Run_opts
; position : Position
}interface Response = Run_result<int>
}If the position has no corresponding Rocq code attached (for example, empty space between two commands), the state returned will be the one of the previous node.
Returns the state corresponding after the start of a lemma (that is to say, before any proofs). Forces the execution of the full document.
thm is the theorem name to prove, note that we don't handle aliases
well yet, pre_commands can be used to inject commands before the
lemma declaration.
interface Params =
{ uri : string
; opts ?: Run_opts
; pre_commands ?: string
; thm : string
}interface Response = Run_result<number>Runs Rocq commands (either tactics or a full commands). It admits
multiple commands, separated by the usual ..
interface Params =
{ opts ?: Run_opts
; st: number
; tac: string
}interface Response = Run_result<int>If the execution fails, the JSON-RPC request will fail. You can
recover messages generated during the failed execution using
rocq-lsp's specific error data
field
Runs Rocq commands (either tactics or a full commands) at a particular document point. It admits
multiple commands, separated by the usual .. It returns the generated Rocq messages.
interface Params =
{ opts?: Run_opts
; textDocument: VersionedTextDocumentIdentifier
; position: Position
; command: string
}interface Response = Run_result<unit>If the execution fails, the JSON-RPC request will fail. You can
recover messages generated during the failed execution using
rocq-lsp's specific error data
field
If the position has no corresponding Rocq code attached (for example, empty space between two commands), the state returned will be the one of the previous node.
interface Goal_opts = { compact : bool }
interface Params = { st: number; opts?: Goal_opts }interface Response = GoalConfig<string>Returns information about declared Rocq objects at a particular state:
interface Params = { st: number }interface Info =
{ kind : string /* type of object */
; range ?: Range /* a range, if known */
; offset : int * int /* a offset in the file */
; raw_text : Result<string, string> /* raw text of the premise */
}
interface Premise =
{ full_name : string
/* should be a Rocq DirPath, but let's go step by step */
; file : string /* file (in FS format) where the premise is found */
; info : Result<Info, string> /* Info about the object, if available */
}
interface Response = PremiseChecks equality of states, with petanque/state/hash it can be used
to implement a client-side hash table of visited proof states.
interface Inspect =
| Physical /** Flèche-based "almost physical" state eq */
| Goals /** Full goal equality, much faster than calling goals, but still linear on the side of the goal type and context */
interface Params =
{ kind ?: Inspect
; st1 : int
; st2 : int
}interface Response = boolHash for a Rocq state. Note we use a quick hash, so on collisions, petanque/state/eq must be used.
interface Params = { st: number }interface Response = numberVersion of petanque/state/equal but only for the proof state.
Version of petanque/state/hash but only for the proof state.
Parse a string. Ast is a JSON serialization of Rocq's Ast, as in
coq/getDocument, and often not stable between versions.
interface Params = { st: int; text : string }interface Response = Run_result<Option<Ast>>Return Rocq's Ast at point. Note that:
- if no node is at
position, then we error - if there is a node, but not Ast (due to a parsing error for
example), we return
None
interface Params = { uri: string; position : Position }interface Response = Option<Ast>petanque/proof_info request will return some information for a given state, in particular the proof name and statement list (for mutual proofs). Use the petanque/proof_info_pos to get some Flèche specific metadata such as range.
interface ProofInfo =
{ name : string
, statements : string[]
, range : Option<Range>
}
interface Params = { st : number }
interface Response = Option<ProofInfo>Version of petanque/proof_info that will try to infer some more data
using the document.
interface Params = { uri : string, position : Position }petanque/list_notations_in_statement will provide information about
which notations appear in statement.
interface Params = { st : number, statement : string }
interface Notation_info =
{ locations : Loc.t[]
; path : string
; secpath : string
; notation : string
; scope : Option<string>
}
interface Response = Run_result<Notation_info[]>