From fedc831df9626a31cd0d26ee6b9e022b67f90c2a Mon Sep 17 00:00:00 2001
From: Hugo Herbelin
Date: Thu, 23 Feb 2017 14:34:44 +0100
Subject: Fixing a little bug in using the "where" clause for inductive types.
This was not working when the inductive type had implicit parameters.
This could still be improved. E.g. the following still does not work:
Reserved Notation "#".
Inductive I {A:Type} := C : # where "#" := I.
But it should be made working by taking care of adding the mandatory
implicit argument A at the time # is interpreted as [@I _]
(i.e., technically speaking, using expl_impls in interp_notation).
---
test-suite/success/Notations.v | 6 ++++++
toplevel/command.ml | 3 ++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/test-suite/success/Notations.v b/test-suite/success/Notations.v
index 511b60b4bb..8c83b196e4 100644
--- a/test-suite/success/Notations.v
+++ b/test-suite/success/Notations.v
@@ -116,3 +116,9 @@ Notation " |- {{ a }} b" := (a=b) (no associativity, at level 10).
Goal True.
{{ exact I. }}
Qed.
+
+(* Check "where" clause for inductive types with parameters *)
+
+Reserved Notation "x === y" (at level 50).
+Inductive EQ {A} (x:A) : A -> Prop := REFL : x === x
+ where "x === y" := (EQ x y).
diff --git a/toplevel/command.ml b/toplevel/command.ml
index b9e4dbd7b2..8926b410c6 100644
--- a/toplevel/command.ml
+++ b/toplevel/command.ml
@@ -571,12 +571,13 @@ let interp_mutual_inductive (paramsl,indl) notations poly prv finite =
lift_implicits (rel_context_nhyps ctx_params) impls) arities in
let arities = List.map pi1 arities and aritypoly = List.map pi2 arities in
let impls = compute_internalization_env env0 (Inductive params) indnames fullarities indimpls in
+ let implsforntn = compute_internalization_env env0 Variable indnames fullarities indimpls in
let mldatas = List.map2 (mk_mltype_data evdref env_params params) arities indnames in
let constructors =
Metasyntax.with_syntax_protection (fun () ->
(* Temporary declaration of notations and scopes *)
- List.iter (Metasyntax.set_notation_for_interpretation impls) notations;
+ List.iter (Metasyntax.set_notation_for_interpretation implsforntn) notations;
(* Interpret the constructor types *)
List.map3 (interp_cstrs env_ar_params evdref impls) mldatas arities indl)
() in
--
cgit v1.2.3
From 8451b4ae99b448894a6269c08be7f3ac0d74cac4 Mon Sep 17 00:00:00 2001
From: Hugo Herbelin
Date: Thu, 23 Feb 2017 14:58:17 +0100
Subject: Fixing a little bug in printing ex2 (type was printed "_" by
default).
---
theories/Init/Logic.v | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/theories/Init/Logic.v b/theories/Init/Logic.v
index 85123cc444..b32985b800 100644
--- a/theories/Init/Logic.v
+++ b/theories/Init/Logic.v
@@ -243,9 +243,9 @@ Notation "'exists' x .. y , p" := (ex (fun x => .. (ex (fun y => p)) ..))
Notation "'exists2' x , p & q" := (ex2 (fun x => p) (fun x => q))
(at level 200, x ident, p at level 200, right associativity) : type_scope.
-Notation "'exists2' x : t , p & q" := (ex2 (fun x:t => p) (fun x:t => q))
- (at level 200, x ident, t at level 200, p at level 200, right associativity,
- format "'[' 'exists2' '/ ' x : t , '/ ' '[' p & '/' q ']' ']'")
+Notation "'exists2' x : A , p & q" := (ex2 (A:=A) (fun x => p) (fun x => q))
+ (at level 200, x ident, A at level 200, p at level 200, right associativity,
+ format "'[' 'exists2' '/ ' x : A , '/ ' '[' p & '/' q ']' ']'")
: type_scope.
(** Derived rules for universal quantification *)
--
cgit v1.2.3
From ed25677029e2cc1e34eba76aade1a00980ca11de Mon Sep 17 00:00:00 2001
From: Hugo Herbelin
Date: Fri, 24 Feb 2017 09:39:50 +0100
Subject: Fixing anomaly on unsupported key in interactive ltac debug.
---
proofs/tactic_debug.ml | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/proofs/tactic_debug.ml b/proofs/tactic_debug.ml
index a4a447e88f..6aae6e98bb 100644
--- a/proofs/tactic_debug.ml
+++ b/proofs/tactic_debug.ml
@@ -98,6 +98,8 @@ let string_get s i =
try Proofview.NonLogical.return (String.get s i)
with e -> Proofview.NonLogical.raise e
+let run_invalid_arg () = Proofview.NonLogical.raise (Invalid_argument "run_com")
+
(* Gives the number of steps or next breakpoint of a run command *)
let run_com inst =
let open Proofview.NonLogical in
@@ -108,14 +110,14 @@ let run_com inst =
let s = String.sub inst i (String.length inst - i) in
if inst.[0] >= '0' && inst.[0] <= '9' then
int_of_string s >>= fun num ->
- (if num<0 then invalid_arg "run_com" else return ()) >>
+ (if num<0 then run_invalid_arg () else return ()) >>
(skip:=num) >> (skipped:=0)
else
breakpoint:=Some (possibly_unquote s)
else
- invalid_arg "run_com"
+ run_invalid_arg ()
else
- invalid_arg "run_com"
+ run_invalid_arg ()
(* Prints the run counter *)
let run ini =
--
cgit v1.2.3
From 209ff6ae4367b8c96b59bc318f4791dcb2251c14 Mon Sep 17 00:00:00 2001
From: Tej Chajed
Date: Thu, 23 Mar 2017 15:11:46 -0400
Subject: Correctly identify [Time Defined.] as a defined
Need to check inside control expressions. Also fixes handling of
[Redirect "file" Defined.] and [Timeout n Defined.].
Fixes Coq bug 5411 (https://coq.inria.fr/bugs/show_bug.cgi?id=5411):
coqc -quick hangs on [Time Defined.]
---
stm/stm.ml | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/stm/stm.ml b/stm/stm.ml
index f577994ffa..71ec8acc68 100644
--- a/stm/stm.ml
+++ b/stm/stm.ml
@@ -1912,10 +1912,14 @@ let collect_proof keep cur hd brkind id =
| [] -> no_name
| id :: _ -> Id.to_string id in
let loc = (snd cur).loc in
- let is_defined = function
- | _, { expr = VernacEndProof (Proved ((Transparent|Opaque (Some _)),_)) } ->
- true
+ let rec is_defined_expr = function
+ | VernacEndProof (Proved ((Transparent|Opaque (Some _)),_)) -> true
+ | VernacTime (_, e) -> is_defined_expr e
+ | VernacRedirect (_, (_, e)) -> is_defined_expr e
+ | VernacTimeout (_, e) -> is_defined_expr e
| _ -> false in
+ let is_defined = function
+ | _, { expr = e } -> is_defined_expr e in
let proof_using_ast = function
| Some (_, ({ expr = VernacProof(_,Some _) } as v)) -> Some v
| _ -> None in
--
cgit v1.2.3
From ca0d97dd3b3033e7f87dd5e5ea09ab6f14fd881b Mon Sep 17 00:00:00 2001
From: Maxime Dénès
Date: Tue, 4 Apr 2017 10:41:18 +0200
Subject: Fix bug #5435: [Eval native_compute in] raises anomaly.
Was introduced by 4f041384cb27f0d2. Unsoundness seems miraculously
avoided by a safeguard I put in nativecode.ml. But other kernel changes
in this commit should probably be reviewed carefully.
---
kernel/nativecode.ml | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/kernel/nativecode.ml b/kernel/nativecode.ml
index eaddace4b7..b17715a8ff 100644
--- a/kernel/nativecode.ml
+++ b/kernel/nativecode.ml
@@ -1849,9 +1849,10 @@ and apply_fv env sigma univ (fv_named,fv_rel) auxdefs ml =
and compile_rel env sigma univ auxdefs n =
let open Context.Rel in
- let n = length env.env_rel_context - n in
let open Declaration in
- match lookup n env.env_rel_context with
+ let decl = lookup n env.env_rel_context in
+ let n = length env.env_rel_context - n in
+ match decl with
| LocalDef (_,t,_) ->
let code = lambda_of_constr env sigma t in
let auxdefs,code = compile_with_fv env sigma univ auxdefs None code in
--
cgit v1.2.3
From 70bcfcf5b2ea485ebe253158c37b89dfac63820b Mon Sep 17 00:00:00 2001
From: Maxime Dénès
Date: Tue, 4 Apr 2017 10:44:15 +0200
Subject: Test file for #5435: [Eval native_compute in] raises anomaly.
---
test-suite/bugs/closed/5435.v | 2 ++
1 file changed, 2 insertions(+)
create mode 100644 test-suite/bugs/closed/5435.v
diff --git a/test-suite/bugs/closed/5435.v b/test-suite/bugs/closed/5435.v
new file mode 100644
index 0000000000..60ace5ce96
--- /dev/null
+++ b/test-suite/bugs/closed/5435.v
@@ -0,0 +1,2 @@
+Definition foo (x : nat) := Eval native_compute in x.
+
--
cgit v1.2.3
From c6f24b1cbfb485dbf14b3934208c113140de2eca Mon Sep 17 00:00:00 2001
From: Hugo Herbelin
Date: Wed, 5 Apr 2017 13:07:19 +0200
Subject: Fixing #5454 (an assert false with 'pat).
Note: Apparently not easy to make a test file as the error is raised
in "G_vernac.fresh_var" at parsing time (not captured by Fail).
---
interp/topconstr.ml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/interp/topconstr.ml b/interp/topconstr.ml
index a397ca82eb..bf0ce60d88 100644
--- a/interp/topconstr.ml
+++ b/interp/topconstr.ml
@@ -58,7 +58,9 @@ let rec cases_pattern_fold_names f a = function
| CPatDelimiters (_,_,pat) -> cases_pattern_fold_names f a pat
| CPatAtom (_,Some (Ident (_,id))) when not (is_constructor id) -> f id a
| CPatPrim _ | CPatAtom _ -> a
- | CPatCast _ -> assert false
+ | CPatCast (loc,_,_) ->
+ CErrors.user_err_loc (loc, "cases_pattern_fold_names",
+ Pp.strbrk "Casts are not supported here.")
let ids_of_pattern =
cases_pattern_fold_names Id.Set.add Id.Set.empty
--
cgit v1.2.3
From 48c44b55b76e75aa2af9f82753c6ffe7531790c8 Mon Sep 17 00:00:00 2001
From: Maxime Dénès
Date: Wed, 5 Apr 2017 18:18:56 +0200
Subject: Fix a few programming pearls related to Time, Fail and Redirect.
This fixes a few clear bugs, but the STM code handling Time, Fail and
Redirect before par: still needs to be rewritten. It does not implement
the same semantics as the vernac interpreter for Fail Fail [c] and
ignores Redirect.
This commit was already reviewed with Enrico and tested on Travis.
---
stm/stm.ml | 11 ++++++-----
toplevel/vernacentries.ml | 2 +-
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/stm/stm.ml b/stm/stm.ml
index 56243b76f9..3efad70fb2 100644
--- a/stm/stm.ml
+++ b/stm/stm.ml
@@ -1746,12 +1746,13 @@ end = struct (* {{{ *)
{ indentation; verbose; loc; expr = e; strlen }
=
let e, time, fail =
- let rec find time fail = function
- | VernacTime (_,e) | VernacRedirect (_,(_,e)) -> find true fail e
- | VernacFail e -> find time true e
- | _ -> e, time, fail in find false false e in
+ let rec find ~time ~fail = function
+ | VernacTime (_,e) -> find ~time:true ~fail e
+ | VernacRedirect (_,(_,e)) -> find ~time ~fail e
+ | VernacFail e -> find ~time ~fail:true e
+ | e -> e, time, fail in find ~time:false ~fail:false e in
Hooks.call Hooks.with_fail fail (fun () ->
- (if time then System.with_time false else (fun x -> x)) (fun () ->
+ (if time then System.with_time !Flags.time else (fun x -> x)) (fun () ->
ignore(TaskQueue.with_n_workers nworkers (fun queue ->
Proof_global.with_current_proof (fun _ p ->
let goals, _, _, _, _ = Proof.proof p in
diff --git a/toplevel/vernacentries.ml b/toplevel/vernacentries.ml
index 6736d83293..3df6d7a580 100644
--- a/toplevel/vernacentries.ml
+++ b/toplevel/vernacentries.ml
@@ -2218,7 +2218,7 @@ let interp ?(verbosely=true) ?proof (loc,c) =
current_timeout := Some n;
aux ?locality ?polymorphism isprogcmd v
| VernacRedirect (s, (_,v)) ->
- Feedback.with_output_to_file s (aux false) v
+ Feedback.with_output_to_file s (aux ?locality ?polymorphism isprogcmd) v
| VernacTime (_,v) ->
System.with_time !Flags.time
(aux ?locality ?polymorphism isprogcmd) v;
--
cgit v1.2.3
From 007ab31b4d1b9457d2758a614aed5a49dee53b62 Mon Sep 17 00:00:00 2001
From: Hugo Herbelin
Date: Sat, 8 Apr 2017 18:35:03 +0200
Subject: Fixing #5460 (limitation in computing deps in pattern-matching
compilation).
This was assuming dependencies occurring in configurations of
the form x:A, y:B x, z:C x y |- match x, y, z with ... end".
But still work to do for better management of dependencies in general...
---
pretyping/cases.ml | 17 ++++++++---------
test-suite/bugs/closed/5460.v | 11 +++++++++++
2 files changed, 19 insertions(+), 9 deletions(-)
create mode 100644 test-suite/bugs/closed/5460.v
diff --git a/pretyping/cases.ml b/pretyping/cases.ml
index ef3e53bf1f..17779d25b9 100644
--- a/pretyping/cases.ml
+++ b/pretyping/cases.ml
@@ -554,31 +554,30 @@ let dependencies_in_rhs nargs current tms eqns =
declarations [d(i+1);...;dn] the term [tmi] is dependent in.
[find_dependencies_signature (used1,...,usedn) ((tm1,d1),...,(tmn,dn))]
- returns [(deps1,...,depsn)] where [depsi] is a subset of n,..,i+1
+ returns [(deps1,...,depsn)] where [depsi] is a subset of tm(i+1),..,tmn
denoting in which of the d(i+1)...dn, the term tmi is dependent.
- Dependencies are expressed by index, e.g. in dependency list
- [n-2;1], [1] points to [dn] and [n-2] to [d3]
*)
let rec find_dependency_list tmblock = function
| [] -> []
- | (used,tdeps,d)::rest ->
+ | (used,tdeps,tm,d)::rest ->
let deps = find_dependency_list tmblock rest in
if used && List.exists (fun x -> dependent_decl x d) tmblock
then
- List.add_set Int.equal
- (List.length rest + 1) (List.union Int.equal deps tdeps)
+ match kind_of_term tm with
+ | Rel n -> List.add_set Int.equal n (List.union Int.equal deps tdeps)
+ | _ -> List.union Int.equal deps tdeps
else deps
let find_dependencies is_dep_or_cstr_in_rhs (tm,(_,tmtypleaves),d) nextlist =
let deps = find_dependency_list (tm::tmtypleaves) nextlist in
if is_dep_or_cstr_in_rhs || not (List.is_empty deps)
- then ((true ,deps,d)::nextlist)
- else ((false,[] ,d)::nextlist)
+ then ((true ,deps,tm,d)::nextlist)
+ else ((false,[] ,tm,d)::nextlist)
let find_dependencies_signature deps_in_rhs typs =
let l = List.fold_right2 find_dependencies deps_in_rhs typs [] in
- List.map (fun (_,deps,_) -> deps) l
+ List.map (fun (_,deps,_,_) -> deps) l
(* Assume we had terms t1..tq to match in a context xp:Tp,...,x1:T1 |-
and xn:Tn has just been regeneralized into x:Tn so that the terms
diff --git a/test-suite/bugs/closed/5460.v b/test-suite/bugs/closed/5460.v
new file mode 100644
index 0000000000..50221cdd83
--- /dev/null
+++ b/test-suite/bugs/closed/5460.v
@@ -0,0 +1,11 @@
+(* Bugs in computing dependencies in pattern-matching compilation *)
+
+Inductive A := a1 | a2.
+Inductive B := b.
+Inductive C : A -> Type := c : C a1 | d : C a2.
+Definition P (x : A) (y : C x) (z : B) : nat :=
+ match z, x, y with
+ | b, a1, c => 0
+ | b, a2, d => 0
+ | _, _, _ => 1
+ end.
--
cgit v1.2.3
From 865fa8fc7aacbca3ab167e65f56e280d334eb192 Mon Sep 17 00:00:00 2001
From: Paul Steckler
Date: Thu, 13 Apr 2017 16:38:26 -0400
Subject: add XML protocol doc for 8.5
---
dev/doc/xml-protocol.md | 738 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 738 insertions(+)
create mode 100644 dev/doc/xml-protocol.md
diff --git a/dev/doc/xml-protocol.md b/dev/doc/xml-protocol.md
new file mode 100644
index 0000000000..22aa120d5d
--- /dev/null
+++ b/dev/doc/xml-protocol.md
@@ -0,0 +1,738 @@
+#Coq XML Protocol for Coq 8.5#
+
+This document is based on documentation originally written by CJ Bell
+for his [vscoq](https://github.com/siegebell/vscoq/) project.
+
+Here, the aim is to provide a "hands on" description of the XML
+protocol that coqtop and IDEs use to communicate. The protocol first appeared
+with Coq 8.5, and is used by CoqIDE. It will also be used in upcoming
+versions of Proof General.
+
+A somewhat out-of-date description of the async state machine is
+[documented here](https://github.com/ejgallego/jscoq/blob/master/etc/notes/coq-notes.md).
+OCaml types for the protocol can be found in the [`ide/interface.mli` file](/ide/interface.mli).
+
+* [Commands](#commands)
+ - [About](#command-about)
+ - [Add](#command-add)
+ - [EditAt](#command-editAt)
+ - [Init](#command-init)
+ - [Goal](#command-goal)
+ - [Status](#command-status)
+ - [Query](#command-query)
+ - [Evars](#command-evars)
+ - [Hints](#command-hints)
+ - [Search](#command-search)
+ - [GetOptions](#command-getoptions)
+ - [SetOptions](#command-setoptions)
+ - [MkCases](#command-mkcases)
+ - [StopWorker](#command-stopworker)
+ - [PrintAst](#command-printast)
+ - [Annotate](#command-annotate)
+* [Feedback messages](#feedback)
+ - [Added Axiom](#feedback-addedaxiom)
+ - [Processing](#feedback-processing)
+ - [Processed](#feedback-processed)
+ - [Incomplete](#feedback-incomplete)
+ - [Complete](#feedback-complete)
+ - [GlobRef](#feedback-globref)
+ - [Error](#feedback-error)
+ - [InProgress](#feedback-inprogress)
+ - [WorkerStatus](#feedback-workerstatus)
+ - [File Dependencies](#feedback-filedependencies)
+ - [File Loaded](#feedback-fileloaded)
+ - [ErrorMessage](#feedback-errormessage)
+ - [Message](#feedback-message)
+ - [Custom](#feedback-custom)
+
+Sentences: each command sent to Coqtop is a "sentence"; they are typically terminated by ".\s" (followed by whitespace or EOF).
+Examples: "Lemma a: True.", "(* asdf *) Qed.", "auto; reflexivity."
+In practice, the command sentences sent to Coqtop are terminated at the "." and start with any previous whitespace.
+Each sentence is assigned a unique stateId after being sent to Coq (via Add).
+States:
+ * Processing: has been received by Coq and has no obvious syntax error (that would prevent future parsing)
+ * Processed:
+ * InProgress:
+ * Incomplete: the validity of the sentence cannot be checked due to a prior error
+ * Complete:
+ * Error: the sentence has an error
+
+State ID 0 is reserved as a 'dummy' state.
+
+--------------------------
+
+## Commands
+
+### **About(unit)**
+Returns information about the protocol and build dates for Coqtop.
+```
+
+
+
+```
+#### *Returns*
+```html
+
+ 8.5
+ 20140312
+ April 2014
+ April 15 2014 16:16:30
+
+
+```
+The string fields are the Coq version, the protocol version, the release date, and the compile time of Coqtop.
+The protocol version is a date in YYYYMMDD format, where "20140312" corresponds to Coq 8.5. An IDE that wishes
+to support multiple Coq versions can use the protocol version information to know how to handle output from Coqtop.
+
+### **Add(stateId: integer, command: string, verbose: boolean)**
+Adds a toplevel command (e.g. vernacular, definition, tactic) to the given state.
+`verbose` controls whether out-of-band messages will be generated for the added command (e.g. "foo is assumed" in response to adding "Axiom foo: nat.").
+```html
+
+
+
+ ${command}
+ ${editId}
+
+
+
+
+
+
+
+```
+
+#### *Returns*
+* The added command is given a fresh `stateId` and becomes the next "tip".
+```html
+
+
+
+
+
+ ${message}
+
+
+
+```
+* When closing a focused proof (in the middle of a bunch of interpreted commands),
+the `Qed` will be assigned a prior `stateId` and `nextStateId` will be the id of an already-interpreted
+state that should become the next tip.
+```html
+
+
+
+
+
+ ${message}
+
+
+
+```
+* Failure:
+ - Syntax error. Error offsets are byte offsets (not character offsets) with respect to the start of the sentence, starting at 0.
+ ```html
+
+
+ ${errorMessage}
+
+ ```
+ - Another kind of error, for example, Qed with a pending goal.
+ ```html
+ ${errorMessage}
+ ```
+
+-------------------------------
+
+### **EditAt(stateId: integer)**
+Moves current tip to `${stateId}`, such that commands may be added to the new state ID.
+```html
+
+```
+#### *Returns*
+* Simple backtrack; focused stateId becomes the parent state
+```html
+
+
+
+```
+
+* New focus; focusedQedStateId is the closing Qed of the new focus; senteneces between the two should be cleared
+```html
+
+
+
+
+
+
+
+
+
+
+
+```
+* Failure: If `stateId` is in an error-state and cannot be jumped to, `errorFreeStateId` is the parent state of ``stateId` that shopuld be edited instead.
+```html
+
+
+ ${errorMessage}
+
+```
+
+-------------------------------
+
+### **Init()**
+* No options.
+```html
+
+```
+* With options. Looking at
+ [ide_slave.ml](https://github.com/coq/coq/blob/c5d0aa889fa80404f6c291000938e443d6200e5b/ide/ide_slave.ml#L355),
+ it seems that `options` is just the name of a script file, whose path
+ is added via `Add LoadPath` to the initial state.
+```html
+
+
+
+```
+Providing the script file enables Coq to use .aux files created during
+compilation. Those file contain timing information that allow Coq to
+choose smartly between asynchronous and synchronous processing of
+proofs.
+
+#### *Returns*
+* The initial stateId (not associated with a sentence)
+```html
+
+
+
+```
+
+-------------------------------
+
+
+### **Goal()**
+```html
+
+```
+#### *Returns*
+* If there is a goal. `shelvedGoals` and `abandonedGoals` have the same structure as the first set of (current/foreground) goals. `backgroundGoals` contains a list of pairs of lists of goals (list ((list Goal)*(list Goal))); it represents a "focus stack" ([see code for reference](https://github.com/coq/coq/blob/trunk/engine/proofview.ml#L113)). Each time a proof is focused, it will add a new pair of lists-of-goals. The first pair is the most nested set of background goals, the last pair is the top level set of background goals. The first list in the pair is in reverse order. Each time you focus the goal (e.g. using `Focus` or a bullet), a new pair will be prefixed to the list.
+```html
+
+
+
+```
+
+For example, this script:
+```coq
+Goal P -> (1=1/\2=2) /\ (3=3 /\ (4=4 /\ 5=5) /\ 6=6) /\ 7=7.
+intros.
+split; split. (* current visible goals are [1=1, 2=2, 3=3/\(4=4/\5=5)/\6=6, 7=7] *)
+Focus 3. (* focus on 3=3/\(4=4/\5=5)/\6=6; bg-before: [1=1, 2=2], bg-after: [7=7] *)
+split; [ | split ]. (* current visible goals are [3=3, 4=4/\5=5, 6=6] *)
+Focus 2. (* focus on 4=4/\5=5; bg-before: [3=3], bg-after: [6=6] *)
+* (* focus again on 4=4/\5=5; bg-before: [], bg-after: [] *)
+split. (* current visible goals are [4=4,5=5] *)
+```
+should generate the following goals structure:
+```
+goals: [ P|-4=4, P|-5=5 ]
+background:
+[
+ ( [], [] ), (* bullet with one goal has no before or after background goals *)
+ ( [ P|-3=3 ], [ P|-6=6 ] ), (* Focus 2 *)
+ ( [ P|-2=2, P|-1=1 ], [ P|-7=7 ] ) (* Focus 3; notice that 1=1 and 2=2 are reversed *)
+]
+```
+Pseudocode for listing all of the goals in order: `rev (flat_map fst background) ++ goals ++ flat_map snd background`.
+
+* No goal:
+```html
+
+```
+
+-------------------------------
+
+
+### **Status(force: bool)**
+CoqIDE typically sets `force` to `false`.
+```html
+
+```
+#### *Returns*
+*
+```html
+
+ ${path}
+ ${proofName}
+ ${allProofs}
+ ${proofNumber}
+
+```
+
+-------------------------------
+
+
+### **Query(query: string, stateId: integer)**
+In practice, `stateId` is 0, but the effect is to perform the query on the currently-focused state.
+```html
+
+
+ ${query}
+
+
+
+```
+#### *Returns*
+*
+```html
+
+ ${message}
+
+```
+-------------------------------
+
+
+
+### **Evars()**
+```html
+
+```
+#### *Returns*
+*
+```html
+
+
+
+```
+
+-------------------------------
+
+
+### **Hints()**
+```html
+
+```
+#### *Returns*
+*
+```html
+
+
+
+```
+
+-------------------------------
+
+
+### **Search([(constraintTypeN: string, constraintValueN: string, positiveConstraintN: boolean)])**
+Searches for objects that satisfy a list of constraints. If `${positiveConstraint}` is `false`, then the constraint is inverted.
+```html
+
+
+
+
+ ${constraintValue1}
+
+
+
+ ...
+
+
+
+ bool_rect
+
+
+
+
+
+```
+#### *Returns*
+*
+```html
+
+
+
+
+ ${metaInfo}
+ ...
+
+
+ ${name}
+
+ ${definition}
+
+ ...
+
+
+```
+##### Types of constraints:
+* Name pattern: `${constraintType} = "name_pattern"`; `${constraintValue}` is a regular expression string.
+* Type pattern: `${constraintType} = "type_pattern"`; `${constraintValue}` is a pattern (???: an open gallina term) string.
+* SubType pattern: `${constraintType} = "subtype_pattern"`; `${constraintValue}` is a pattern (???: an open gallina term) string.
+* In module: `${constraintType} = "in_module"`; `${constraintValue}` is a list of strings specifying the module/directory structure.
+* Include blacklist: `${constraintType} = "include_blacklist"`; `${constraintValue}` *is ommitted*.
+
+-------------------------------
+
+
+### **GetOptions()**
+```html
+
+```
+#### *Returns*
+*
+```html
+
+
+
+ ${string1}...
+
+ ${sync}
+ ${deprecated}
+ ${name}
+ ${option_value}
+
+
+ ...
+
+
+```
+
+-------------------------------
+
+
+### **SetOptions(options)**
+Sends a list of option settings, where each setting roughly looks like:
+`([optionNamePart1, ..., optionNamePartN], value)`.
+```html
+
+
+
+
+ optionNamePart1
+ ...
+ optionNamePartN
+
+
+
+
+
+ ...
+
+
+
+ Printing
+ Width
+
+
+
+
+
+
+
+```
+CoqIDE sends the following settings (defaults in parentheses):
+```
+Printing Width : (60),
+Printing Coercions : (),
+Printing Matching : (...true...)
+Printing Notations : (...true...)
+Printing Existential Instances : (...false...)
+Printing Implicit : (...false...)
+Printing All : (...false...)
+Printing Universes : (...false...)
+```
+#### *Returns*
+*
+```html
+
+```
+
+-------------------------------
+
+
+### **MkCases(...)**
+```html
+...
+```
+#### *Returns*
+*
+```html
+
+
+ ${string1}...
+ ...
+
+
+```
+
+-------------------------------
+
+
+### **StopWorker(worker: string)**
+```html
+${worker}
+```
+#### *Returns*
+*
+```html
+
+```
+
+-------------------------------
+
+
+### **PrintAst(stateId: integer)**
+```html
+
+```
+#### *Returns*
+*
+```html
+
+
+
+
+
+
+
+ ...
+ ${token}
+ ...
+
+ ...
+
+
+ ...
+
+
+```
+
+-------------------------------
+
+
+
+### **Annotate(annotation: string)**
+```html
+${annotation}
+```
+#### *Returns*
+*
+
+take `Theorem plus_0_r : forall n : nat, n + 0 = n.` as an example.
+
+```html
+
+
+
+ Theorem
+ plus_0_r :
+
+ forall
+ n :
+ nat
+ ,
+
+
+
+
+ n
+
+ +
+
+
+ 0
+
+
+
+ =
+
+
+ n
+
+
+
+
+ .
+
+
+```
+
+-------------------------------
+
+## Feedback messages
+
+Feedback messages are issued out-of-band,
+ giving updates on the current state of sentences/stateIds,
+ worker-thread status, etc.
+
+In the descriptions of feedback syntax below, wherever a `state_id`
+tag may occur, there may instead be an `edit_id` tag.
+
+* Added Axiom: in response to `Axiom`, `admit`, `Admitted`, etc.
+```html
+
+
+
+
+```
+* Processing
+```html
+
+
+
+ ${workerName}
+
+
+```
+* Processed
+```html
+
+
+
+
+
+```
+* Incomplete
+```html
+
+
+
+
+```
+* Complete
+* GlobRef
+* Error. Issued, for example, when a processed tactic has failed or is unknown.
+The error offsets may both be 0 if there is no particular syntax involved.
+* InProgress
+```html
+
+
+
+ 1
+
+
+```
+* WorkerStatus
+Ex: `workername = "proofworker:0"`
+Ex: `status = "Idle"` or `status = "proof: myLemmaName"` or `status = "Dead"`
+```html
+
+
+
+
+ ${workerName}
+ ${status}
+
+
+
+```
+* File Dependencies. Typically in response to a `Require`. Dependencies are *.vo files.
+ - State `stateId` directly depends on `dependency`:
+ ```html
+
+
+
+
+ ${dependency}
+
+
+ ```
+ - State `stateId` depends on `dependency` via dependency `sourceDependency`
+ ```xml
+
+
+
+
+ ${dependency}
+
+
+ ```
+* File Loaded. For state `stateId`, module `module` is being loaded from `voFileName`
+```xml
+
+
+
+ ${module}
+ ${voFileName`}
+
+
+```
+
+* Error Message.
+```xml
+
+
+
+
+ ${errorMessage"
+
+
+```
+
+* Custom. A feedback message that Coq plugins can use to return structured results, including results from Ltac profiling. Optionally, `startPos` and `stopPos` define a range of offsets in the document that the message refers to; otherwise, they will be 0. `customTag` is intended as a unique string that identifies what kind of payload is contained in `customXML`.
+```xml
+
+
+
+
+ ${customTag}
+ ${customXML}
+
+
+```
+
--
cgit v1.2.3
From 6ef2dc11653e0572db6f7660470242ed23a0bdc2 Mon Sep 17 00:00:00 2001
From: Paul Steckler
Date: Thu, 13 Apr 2017 16:38:48 -0400
Subject: update XML protocol doc to 8.6
---
dev/doc/xml-protocol.md | 37 ++++++++++++++++++++++---------------
1 file changed, 22 insertions(+), 15 deletions(-)
diff --git a/dev/doc/xml-protocol.md b/dev/doc/xml-protocol.md
index 22aa120d5d..4e51176059 100644
--- a/dev/doc/xml-protocol.md
+++ b/dev/doc/xml-protocol.md
@@ -1,4 +1,4 @@
-#Coq XML Protocol for Coq 8.5#
+#Coq XML Protocol for Coq 8.6#
This document is based on documentation originally written by CJ Bell
for his [vscoq](https://github.com/siegebell/vscoq/) project.
@@ -12,6 +12,12 @@ A somewhat out-of-date description of the async state machine is
[documented here](https://github.com/ejgallego/jscoq/blob/master/etc/notes/coq-notes.md).
OCaml types for the protocol can be found in the [`ide/interface.mli` file](/ide/interface.mli).
+# CHANGES
+## Changes from 8.5:
+ * In several places, flat text wrapped in tags now appears as structured text inside tags
+ * The "errormsg" feedback has been replaced by a "message" feedback which contains
+ tag, with a message_level attribute of "error"
+
* [Commands](#commands)
- [About](#command-about)
- [Add](#command-add)
@@ -41,7 +47,6 @@ OCaml types for the protocol can be found in the [`ide/interface.mli` file](/ide
- [WorkerStatus](#feedback-workerstatus)
- [File Dependencies](#feedback-filedependencies)
- [File Loaded](#feedback-fileloaded)
- - [ErrorMessage](#feedback-errormessage)
- [Message](#feedback-message)
- [Custom](#feedback-custom)
@@ -73,15 +78,15 @@ Returns information about the protocol and build dates for Coqtop.
#### *Returns*
```html
- 8.5
- 20140312
- April 2014
- April 15 2014 16:16:30
+ 8.6
+ 20150913
+ December 2016
+ Dec 23 2016 16:16:30
```
The string fields are the Coq version, the protocol version, the release date, and the compile time of Coqtop.
-The protocol version is a date in YYYYMMDD format, where "20140312" corresponds to Coq 8.5. An IDE that wishes
+The protocol version is a date in YYYYMMDD format, where "20150913" corresponds to Coq 8.6. An IDE that wishes
to support multiple Coq versions can use the protocol version information to know how to handle output from Coqtop.
### **Add(stateId: integer, command: string, verbose: boolean)**
@@ -136,12 +141,12 @@ state that should become the next tip.
loc_s="${startOffsetOfError}"
loc_e="${endOffsetOfError}">
- ${errorMessage}
+ ${errorMessage}
```
- Another kind of error, for example, Qed with a pending goal.
```html
- ${errorMessage}
+ ${errorMessage}
```
-------------------------------
@@ -230,11 +235,11 @@ proofs.
3
- ${hyp1}
+ ${hyp1}
...
- ${hypN}
+ ${hypN}
- ${goal}
+ ${goal}
...
${goalN}
@@ -713,13 +718,15 @@ Ex: `status = "Idle"` or `status = "proof: myLemmaName"` or `status = "Dead"`
```
-* Error Message.
+* Message. `level` is one of `{info,warning,notice,error,debug}`. For example, in response to an add `"Axiom foo: nat."` with `verbose=true`, message `foo is assumed` will be emitted in response.
```xml
-
- ${errorMessage"
+
+
+ ${message}
+
```
--
cgit v1.2.3
From ba1ff58db4aac8315e42acb598770d1aa67385ce Mon Sep 17 00:00:00 2001
From: Maxime Dénès
Date: Fri, 14 Apr 2017 13:07:06 +0200
Subject: [travis] Use the lite target for fiat-crypto.
---
dev/ci/ci-fiat-crypto.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dev/ci/ci-fiat-crypto.sh b/dev/ci/ci-fiat-crypto.sh
index 93d39aab07..c6df45a1d4 100755
--- a/dev/ci/ci-fiat-crypto.sh
+++ b/dev/ci/ci-fiat-crypto.sh
@@ -7,4 +7,4 @@ fiat_crypto_CI_DIR=${CI_BUILD_DIR}/fiat-crypto
git_checkout ${fiat_crypto_CI_BRANCH} ${fiat_crypto_CI_GITURL} ${fiat_crypto_CI_DIR}
-( cd ${fiat_crypto_CI_DIR} && make -j ${NJOBS} )
+( cd ${fiat_crypto_CI_DIR} && make -j ${NJOBS} lite )
--
cgit v1.2.3
From e73b124a9d504e1759d4a4a0d3899882f58d459a Mon Sep 17 00:00:00 2001
From: Gaetan Gilbert
Date: Wed, 12 Apr 2017 16:12:58 +0200
Subject: Fix anomaly when doing [all:Check _.] during a proof.
---
stm/vernac_classifier.ml | 4 ++--
test-suite/success/all-check.v | 3 +++
2 files changed, 5 insertions(+), 2 deletions(-)
create mode 100644 test-suite/success/all-check.v
diff --git a/stm/vernac_classifier.ml b/stm/vernac_classifier.ml
index dc5be08a37..58a86a4aa5 100644
--- a/stm/vernac_classifier.ml
+++ b/stm/vernac_classifier.ml
@@ -219,8 +219,8 @@ let rec classify_vernac e =
(* What are these? *)
| VernacToplevelControl _
| VernacRestoreState _
- | VernacWriteState _ -> VtUnknown, VtNow
- | VernacError _ -> assert false
+ | VernacWriteState _
+ | VernacError _ -> VtUnknown, VtNow
(* Plugins should classify their commands *)
| VernacExtend (s,l) ->
try List.assoc s !classifiers l ()
diff --git a/test-suite/success/all-check.v b/test-suite/success/all-check.v
new file mode 100644
index 0000000000..391bc540e4
--- /dev/null
+++ b/test-suite/success/all-check.v
@@ -0,0 +1,3 @@
+Goal True.
+Fail all:Check _.
+Abort.
--
cgit v1.2.3
From 74f9548a083409d400f2723ee8c1e07705da4812 Mon Sep 17 00:00:00 2001
From: Maxime Dénès
Date: Fri, 14 Apr 2017 20:49:16 +0200
Subject: Fix EOL characters in xml protocol documentation.
---
dev/doc/xml-protocol.md | 1490 +++++++++++++++++++++++------------------------
1 file changed, 745 insertions(+), 745 deletions(-)
diff --git a/dev/doc/xml-protocol.md b/dev/doc/xml-protocol.md
index 4e51176059..2ff82c6888 100644
--- a/dev/doc/xml-protocol.md
+++ b/dev/doc/xml-protocol.md
@@ -1,745 +1,745 @@
-#Coq XML Protocol for Coq 8.6#
-
-This document is based on documentation originally written by CJ Bell
-for his [vscoq](https://github.com/siegebell/vscoq/) project.
-
-Here, the aim is to provide a "hands on" description of the XML
-protocol that coqtop and IDEs use to communicate. The protocol first appeared
-with Coq 8.5, and is used by CoqIDE. It will also be used in upcoming
-versions of Proof General.
-
-A somewhat out-of-date description of the async state machine is
-[documented here](https://github.com/ejgallego/jscoq/blob/master/etc/notes/coq-notes.md).
-OCaml types for the protocol can be found in the [`ide/interface.mli` file](/ide/interface.mli).
-
-# CHANGES
-## Changes from 8.5:
- * In several places, flat text wrapped in tags now appears as structured text inside tags
- * The "errormsg" feedback has been replaced by a "message" feedback which contains
- tag, with a message_level attribute of "error"
-
-* [Commands](#commands)
- - [About](#command-about)
- - [Add](#command-add)
- - [EditAt](#command-editAt)
- - [Init](#command-init)
- - [Goal](#command-goal)
- - [Status](#command-status)
- - [Query](#command-query)
- - [Evars](#command-evars)
- - [Hints](#command-hints)
- - [Search](#command-search)
- - [GetOptions](#command-getoptions)
- - [SetOptions](#command-setoptions)
- - [MkCases](#command-mkcases)
- - [StopWorker](#command-stopworker)
- - [PrintAst](#command-printast)
- - [Annotate](#command-annotate)
-* [Feedback messages](#feedback)
- - [Added Axiom](#feedback-addedaxiom)
- - [Processing](#feedback-processing)
- - [Processed](#feedback-processed)
- - [Incomplete](#feedback-incomplete)
- - [Complete](#feedback-complete)
- - [GlobRef](#feedback-globref)
- - [Error](#feedback-error)
- - [InProgress](#feedback-inprogress)
- - [WorkerStatus](#feedback-workerstatus)
- - [File Dependencies](#feedback-filedependencies)
- - [File Loaded](#feedback-fileloaded)
- - [Message](#feedback-message)
- - [Custom](#feedback-custom)
-
-Sentences: each command sent to Coqtop is a "sentence"; they are typically terminated by ".\s" (followed by whitespace or EOF).
-Examples: "Lemma a: True.", "(* asdf *) Qed.", "auto; reflexivity."
-In practice, the command sentences sent to Coqtop are terminated at the "." and start with any previous whitespace.
-Each sentence is assigned a unique stateId after being sent to Coq (via Add).
-States:
- * Processing: has been received by Coq and has no obvious syntax error (that would prevent future parsing)
- * Processed:
- * InProgress:
- * Incomplete: the validity of the sentence cannot be checked due to a prior error
- * Complete:
- * Error: the sentence has an error
-
-State ID 0 is reserved as a 'dummy' state.
-
---------------------------
-
-## Commands
-
-### **About(unit)**
-Returns information about the protocol and build dates for Coqtop.
-```
-
-
-
-```
-#### *Returns*
-```html
-
- 8.6
- 20150913
- December 2016
- Dec 23 2016 16:16:30
-
-
-```
-The string fields are the Coq version, the protocol version, the release date, and the compile time of Coqtop.
-The protocol version is a date in YYYYMMDD format, where "20150913" corresponds to Coq 8.6. An IDE that wishes
-to support multiple Coq versions can use the protocol version information to know how to handle output from Coqtop.
-
-### **Add(stateId: integer, command: string, verbose: boolean)**
-Adds a toplevel command (e.g. vernacular, definition, tactic) to the given state.
-`verbose` controls whether out-of-band messages will be generated for the added command (e.g. "foo is assumed" in response to adding "Axiom foo: nat.").
-```html
-
-
-
- ${command}
- ${editId}
-
-
-
-
-
-
-
-```
-
-#### *Returns*
-* The added command is given a fresh `stateId` and becomes the next "tip".
-```html
-
-
-
-
-
- ${message}
-
-
-
-```
-* When closing a focused proof (in the middle of a bunch of interpreted commands),
-the `Qed` will be assigned a prior `stateId` and `nextStateId` will be the id of an already-interpreted
-state that should become the next tip.
-```html
-
-
-
-
-
- ${message}
-
-
-
-```
-* Failure:
- - Syntax error. Error offsets are byte offsets (not character offsets) with respect to the start of the sentence, starting at 0.
- ```html
-
-
- ${errorMessage}
-
- ```
- - Another kind of error, for example, Qed with a pending goal.
- ```html
- ${errorMessage}
- ```
-
--------------------------------
-
-### **EditAt(stateId: integer)**
-Moves current tip to `${stateId}`, such that commands may be added to the new state ID.
-```html
-
-```
-#### *Returns*
-* Simple backtrack; focused stateId becomes the parent state
-```html
-
-
-
-```
-
-* New focus; focusedQedStateId is the closing Qed of the new focus; senteneces between the two should be cleared
-```html
-
-
-
-
-
-
-
-
-
-
-
-```
-* Failure: If `stateId` is in an error-state and cannot be jumped to, `errorFreeStateId` is the parent state of ``stateId` that shopuld be edited instead.
-```html
-
-
- ${errorMessage}
-
-```
-
--------------------------------
-
-### **Init()**
-* No options.
-```html
-
-```
-* With options. Looking at
- [ide_slave.ml](https://github.com/coq/coq/blob/c5d0aa889fa80404f6c291000938e443d6200e5b/ide/ide_slave.ml#L355),
- it seems that `options` is just the name of a script file, whose path
- is added via `Add LoadPath` to the initial state.
-```html
-
-
-
-```
-Providing the script file enables Coq to use .aux files created during
-compilation. Those file contain timing information that allow Coq to
-choose smartly between asynchronous and synchronous processing of
-proofs.
-
-#### *Returns*
-* The initial stateId (not associated with a sentence)
-```html
-
-
-
-```
-
--------------------------------
-
-
-### **Goal()**
-```html
-
-```
-#### *Returns*
-* If there is a goal. `shelvedGoals` and `abandonedGoals` have the same structure as the first set of (current/foreground) goals. `backgroundGoals` contains a list of pairs of lists of goals (list ((list Goal)*(list Goal))); it represents a "focus stack" ([see code for reference](https://github.com/coq/coq/blob/trunk/engine/proofview.ml#L113)). Each time a proof is focused, it will add a new pair of lists-of-goals. The first pair is the most nested set of background goals, the last pair is the top level set of background goals. The first list in the pair is in reverse order. Each time you focus the goal (e.g. using `Focus` or a bullet), a new pair will be prefixed to the list.
-```html
-
-
-
-```
-
-For example, this script:
-```coq
-Goal P -> (1=1/\2=2) /\ (3=3 /\ (4=4 /\ 5=5) /\ 6=6) /\ 7=7.
-intros.
-split; split. (* current visible goals are [1=1, 2=2, 3=3/\(4=4/\5=5)/\6=6, 7=7] *)
-Focus 3. (* focus on 3=3/\(4=4/\5=5)/\6=6; bg-before: [1=1, 2=2], bg-after: [7=7] *)
-split; [ | split ]. (* current visible goals are [3=3, 4=4/\5=5, 6=6] *)
-Focus 2. (* focus on 4=4/\5=5; bg-before: [3=3], bg-after: [6=6] *)
-* (* focus again on 4=4/\5=5; bg-before: [], bg-after: [] *)
-split. (* current visible goals are [4=4,5=5] *)
-```
-should generate the following goals structure:
-```
-goals: [ P|-4=4, P|-5=5 ]
-background:
-[
- ( [], [] ), (* bullet with one goal has no before or after background goals *)
- ( [ P|-3=3 ], [ P|-6=6 ] ), (* Focus 2 *)
- ( [ P|-2=2, P|-1=1 ], [ P|-7=7 ] ) (* Focus 3; notice that 1=1 and 2=2 are reversed *)
-]
-```
-Pseudocode for listing all of the goals in order: `rev (flat_map fst background) ++ goals ++ flat_map snd background`.
-
-* No goal:
-```html
-
-```
-
--------------------------------
-
-
-### **Status(force: bool)**
-CoqIDE typically sets `force` to `false`.
-```html
-
-```
-#### *Returns*
-*
-```html
-
- ${path}
- ${proofName}
- ${allProofs}
- ${proofNumber}
-
-```
-
--------------------------------
-
-
-### **Query(query: string, stateId: integer)**
-In practice, `stateId` is 0, but the effect is to perform the query on the currently-focused state.
-```html
-
-
- ${query}
-
-
-
-```
-#### *Returns*
-*
-```html
-
- ${message}
-
-```
--------------------------------
-
-
-
-### **Evars()**
-```html
-
-```
-#### *Returns*
-*
-```html
-
-
-
-```
-
--------------------------------
-
-
-### **Hints()**
-```html
-
-```
-#### *Returns*
-*
-```html
-
-
-
-```
-
--------------------------------
-
-
-### **Search([(constraintTypeN: string, constraintValueN: string, positiveConstraintN: boolean)])**
-Searches for objects that satisfy a list of constraints. If `${positiveConstraint}` is `false`, then the constraint is inverted.
-```html
-
-
-
-
- ${constraintValue1}
-
-
-
- ...
-
-
-
- bool_rect
-
-
-
-
-
-```
-#### *Returns*
-*
-```html
-
-
-
-
- ${metaInfo}
- ...
-
-
- ${name}
-
- ${definition}
-
- ...
-
-
-```
-##### Types of constraints:
-* Name pattern: `${constraintType} = "name_pattern"`; `${constraintValue}` is a regular expression string.
-* Type pattern: `${constraintType} = "type_pattern"`; `${constraintValue}` is a pattern (???: an open gallina term) string.
-* SubType pattern: `${constraintType} = "subtype_pattern"`; `${constraintValue}` is a pattern (???: an open gallina term) string.
-* In module: `${constraintType} = "in_module"`; `${constraintValue}` is a list of strings specifying the module/directory structure.
-* Include blacklist: `${constraintType} = "include_blacklist"`; `${constraintValue}` *is ommitted*.
-
--------------------------------
-
-
-### **GetOptions()**
-```html
-
-```
-#### *Returns*
-*
-```html
-
-
-
- ${string1}...
-
- ${sync}
- ${deprecated}
- ${name}
- ${option_value}
-
-
- ...
-
-
-```
-
--------------------------------
-
-
-### **SetOptions(options)**
-Sends a list of option settings, where each setting roughly looks like:
-`([optionNamePart1, ..., optionNamePartN], value)`.
-```html
-
-
-
-
- optionNamePart1
- ...
- optionNamePartN
-
-
-
-
-
- ...
-
-
-
- Printing
- Width
-
-
-
-
-
-
-
-```
-CoqIDE sends the following settings (defaults in parentheses):
-```
-Printing Width : (60),
-Printing Coercions : (),
-Printing Matching : (...true...)
-Printing Notations : (...true...)
-Printing Existential Instances : (...false...)
-Printing Implicit : (...false...)
-Printing All : (...false...)
-Printing Universes : (...false...)
-```
-#### *Returns*
-*
-```html
-
-```
-
--------------------------------
-
-
-### **MkCases(...)**
-```html
-...
-```
-#### *Returns*
-*
-```html
-
-
- ${string1}...
- ...
-
-
-```
-
--------------------------------
-
-
-### **StopWorker(worker: string)**
-```html
-${worker}
-```
-#### *Returns*
-*
-```html
-
-```
-
--------------------------------
-
-
-### **PrintAst(stateId: integer)**
-```html
-
-```
-#### *Returns*
-*
-```html
-
-
-
-
-
-
-
- ...
- ${token}
- ...
-
- ...
-
-
- ...
-
-
-```
-
--------------------------------
-
-
-
-### **Annotate(annotation: string)**
-```html
-${annotation}
-```
-#### *Returns*
-*
-
-take `Theorem plus_0_r : forall n : nat, n + 0 = n.` as an example.
-
-```html
-
-
-
- Theorem
- plus_0_r :
-
- forall
- n :
- nat
- ,
-
-
-
-
- n
-
- +
-
-
- 0
-
-
-
- =
-
-
- n
-
-
-
-
- .
-
-
-```
-
--------------------------------
-
-## Feedback messages
-
-Feedback messages are issued out-of-band,
- giving updates on the current state of sentences/stateIds,
- worker-thread status, etc.
-
-In the descriptions of feedback syntax below, wherever a `state_id`
-tag may occur, there may instead be an `edit_id` tag.
-
-* Added Axiom: in response to `Axiom`, `admit`, `Admitted`, etc.
-```html
-
-
-
-
-```
-* Processing
-```html
-
-
-
- ${workerName}
-
-
-```
-* Processed
-```html
-
-
-
-
-
-```
-* Incomplete
-```html
-
-
-
-
-```
-* Complete
-* GlobRef
-* Error. Issued, for example, when a processed tactic has failed or is unknown.
-The error offsets may both be 0 if there is no particular syntax involved.
-* InProgress
-```html
-
-
-
- 1
-
-
-```
-* WorkerStatus
-Ex: `workername = "proofworker:0"`
-Ex: `status = "Idle"` or `status = "proof: myLemmaName"` or `status = "Dead"`
-```html
-
-
-
-
- ${workerName}
- ${status}
-
-
-
-```
-* File Dependencies. Typically in response to a `Require`. Dependencies are *.vo files.
- - State `stateId` directly depends on `dependency`:
- ```html
-
-
-
-
- ${dependency}
-
-
- ```
- - State `stateId` depends on `dependency` via dependency `sourceDependency`
- ```xml
-
-
-
-
- ${dependency}
-
-
- ```
-* File Loaded. For state `stateId`, module `module` is being loaded from `voFileName`
-```xml
-
-
-
- ${module}
- ${voFileName`}
-
-
-```
-
-* Message. `level` is one of `{info,warning,notice,error,debug}`. For example, in response to an add `"Axiom foo: nat."` with `verbose=true`, message `foo is assumed` will be emitted in response.
-```xml
-
-
-
-
-
- ${message}
-
-
-
-```
-
-* Custom. A feedback message that Coq plugins can use to return structured results, including results from Ltac profiling. Optionally, `startPos` and `stopPos` define a range of offsets in the document that the message refers to; otherwise, they will be 0. `customTag` is intended as a unique string that identifies what kind of payload is contained in `customXML`.
-```xml
-
-
-
-
- ${customTag}
- ${customXML}
-
-
-```
-
+#Coq XML Protocol for Coq 8.6#
+
+This document is based on documentation originally written by CJ Bell
+for his [vscoq](https://github.com/siegebell/vscoq/) project.
+
+Here, the aim is to provide a "hands on" description of the XML
+protocol that coqtop and IDEs use to communicate. The protocol first appeared
+with Coq 8.5, and is used by CoqIDE. It will also be used in upcoming
+versions of Proof General.
+
+A somewhat out-of-date description of the async state machine is
+[documented here](https://github.com/ejgallego/jscoq/blob/master/etc/notes/coq-notes.md).
+OCaml types for the protocol can be found in the [`ide/interface.mli` file](/ide/interface.mli).
+
+# CHANGES
+## Changes from 8.5:
+ * In several places, flat text wrapped in tags now appears as structured text inside tags
+ * The "errormsg" feedback has been replaced by a "message" feedback which contains
+ tag, with a message_level attribute of "error"
+
+* [Commands](#commands)
+ - [About](#command-about)
+ - [Add](#command-add)
+ - [EditAt](#command-editAt)
+ - [Init](#command-init)
+ - [Goal](#command-goal)
+ - [Status](#command-status)
+ - [Query](#command-query)
+ - [Evars](#command-evars)
+ - [Hints](#command-hints)
+ - [Search](#command-search)
+ - [GetOptions](#command-getoptions)
+ - [SetOptions](#command-setoptions)
+ - [MkCases](#command-mkcases)
+ - [StopWorker](#command-stopworker)
+ - [PrintAst](#command-printast)
+ - [Annotate](#command-annotate)
+* [Feedback messages](#feedback)
+ - [Added Axiom](#feedback-addedaxiom)
+ - [Processing](#feedback-processing)
+ - [Processed](#feedback-processed)
+ - [Incomplete](#feedback-incomplete)
+ - [Complete](#feedback-complete)
+ - [GlobRef](#feedback-globref)
+ - [Error](#feedback-error)
+ - [InProgress](#feedback-inprogress)
+ - [WorkerStatus](#feedback-workerstatus)
+ - [File Dependencies](#feedback-filedependencies)
+ - [File Loaded](#feedback-fileloaded)
+ - [Message](#feedback-message)
+ - [Custom](#feedback-custom)
+
+Sentences: each command sent to Coqtop is a "sentence"; they are typically terminated by ".\s" (followed by whitespace or EOF).
+Examples: "Lemma a: True.", "(* asdf *) Qed.", "auto; reflexivity."
+In practice, the command sentences sent to Coqtop are terminated at the "." and start with any previous whitespace.
+Each sentence is assigned a unique stateId after being sent to Coq (via Add).
+States:
+ * Processing: has been received by Coq and has no obvious syntax error (that would prevent future parsing)
+ * Processed:
+ * InProgress:
+ * Incomplete: the validity of the sentence cannot be checked due to a prior error
+ * Complete:
+ * Error: the sentence has an error
+
+State ID 0 is reserved as a 'dummy' state.
+
+--------------------------
+
+## Commands
+
+### **About(unit)**
+Returns information about the protocol and build dates for Coqtop.
+```
+
+
+
+```
+#### *Returns*
+```html
+
+ 8.6
+ 20150913
+ December 2016
+ Dec 23 2016 16:16:30
+
+
+```
+The string fields are the Coq version, the protocol version, the release date, and the compile time of Coqtop.
+The protocol version is a date in YYYYMMDD format, where "20150913" corresponds to Coq 8.6. An IDE that wishes
+to support multiple Coq versions can use the protocol version information to know how to handle output from Coqtop.
+
+### **Add(stateId: integer, command: string, verbose: boolean)**
+Adds a toplevel command (e.g. vernacular, definition, tactic) to the given state.
+`verbose` controls whether out-of-band messages will be generated for the added command (e.g. "foo is assumed" in response to adding "Axiom foo: nat.").
+```html
+
+
+
+ ${command}
+ ${editId}
+
+
+
+
+
+
+
+```
+
+#### *Returns*
+* The added command is given a fresh `stateId` and becomes the next "tip".
+```html
+
+
+
+
+
+ ${message}
+
+
+
+```
+* When closing a focused proof (in the middle of a bunch of interpreted commands),
+the `Qed` will be assigned a prior `stateId` and `nextStateId` will be the id of an already-interpreted
+state that should become the next tip.
+```html
+
+
+
+
+
+ ${message}
+
+
+
+```
+* Failure:
+ - Syntax error. Error offsets are byte offsets (not character offsets) with respect to the start of the sentence, starting at 0.
+ ```html
+
+
+ ${errorMessage}
+
+ ```
+ - Another kind of error, for example, Qed with a pending goal.
+ ```html
+ ${errorMessage}
+ ```
+
+-------------------------------
+
+### **EditAt(stateId: integer)**
+Moves current tip to `${stateId}`, such that commands may be added to the new state ID.
+```html
+
+```
+#### *Returns*
+* Simple backtrack; focused stateId becomes the parent state
+```html
+
+
+
+```
+
+* New focus; focusedQedStateId is the closing Qed of the new focus; senteneces between the two should be cleared
+```html
+
+
+
+
+
+
+
+
+
+
+
+```
+* Failure: If `stateId` is in an error-state and cannot be jumped to, `errorFreeStateId` is the parent state of ``stateId` that shopuld be edited instead.
+```html
+
+
+ ${errorMessage}
+
+```
+
+-------------------------------
+
+### **Init()**
+* No options.
+```html
+
+```
+* With options. Looking at
+ [ide_slave.ml](https://github.com/coq/coq/blob/c5d0aa889fa80404f6c291000938e443d6200e5b/ide/ide_slave.ml#L355),
+ it seems that `options` is just the name of a script file, whose path
+ is added via `Add LoadPath` to the initial state.
+```html
+
+
+
+```
+Providing the script file enables Coq to use .aux files created during
+compilation. Those file contain timing information that allow Coq to
+choose smartly between asynchronous and synchronous processing of
+proofs.
+
+#### *Returns*
+* The initial stateId (not associated with a sentence)
+```html
+
+
+
+```
+
+-------------------------------
+
+
+### **Goal()**
+```html
+
+```
+#### *Returns*
+* If there is a goal. `shelvedGoals` and `abandonedGoals` have the same structure as the first set of (current/foreground) goals. `backgroundGoals` contains a list of pairs of lists of goals (list ((list Goal)*(list Goal))); it represents a "focus stack" ([see code for reference](https://github.com/coq/coq/blob/trunk/engine/proofview.ml#L113)). Each time a proof is focused, it will add a new pair of lists-of-goals. The first pair is the most nested set of background goals, the last pair is the top level set of background goals. The first list in the pair is in reverse order. Each time you focus the goal (e.g. using `Focus` or a bullet), a new pair will be prefixed to the list.
+```html
+
+
+
+```
+
+For example, this script:
+```coq
+Goal P -> (1=1/\2=2) /\ (3=3 /\ (4=4 /\ 5=5) /\ 6=6) /\ 7=7.
+intros.
+split; split. (* current visible goals are [1=1, 2=2, 3=3/\(4=4/\5=5)/\6=6, 7=7] *)
+Focus 3. (* focus on 3=3/\(4=4/\5=5)/\6=6; bg-before: [1=1, 2=2], bg-after: [7=7] *)
+split; [ | split ]. (* current visible goals are [3=3, 4=4/\5=5, 6=6] *)
+Focus 2. (* focus on 4=4/\5=5; bg-before: [3=3], bg-after: [6=6] *)
+* (* focus again on 4=4/\5=5; bg-before: [], bg-after: [] *)
+split. (* current visible goals are [4=4,5=5] *)
+```
+should generate the following goals structure:
+```
+goals: [ P|-4=4, P|-5=5 ]
+background:
+[
+ ( [], [] ), (* bullet with one goal has no before or after background goals *)
+ ( [ P|-3=3 ], [ P|-6=6 ] ), (* Focus 2 *)
+ ( [ P|-2=2, P|-1=1 ], [ P|-7=7 ] ) (* Focus 3; notice that 1=1 and 2=2 are reversed *)
+]
+```
+Pseudocode for listing all of the goals in order: `rev (flat_map fst background) ++ goals ++ flat_map snd background`.
+
+* No goal:
+```html
+
+```
+
+-------------------------------
+
+
+### **Status(force: bool)**
+CoqIDE typically sets `force` to `false`.
+```html
+
+```
+#### *Returns*
+*
+```html
+
+ ${path}
+ ${proofName}
+ ${allProofs}
+ ${proofNumber}
+
+```
+
+-------------------------------
+
+
+### **Query(query: string, stateId: integer)**
+In practice, `stateId` is 0, but the effect is to perform the query on the currently-focused state.
+```html
+
+
+ ${query}
+
+
+
+```
+#### *Returns*
+*
+```html
+
+ ${message}
+
+```
+-------------------------------
+
+
+
+### **Evars()**
+```html
+
+```
+#### *Returns*
+*
+```html
+
+
+
+```
+
+-------------------------------
+
+
+### **Hints()**
+```html
+
+```
+#### *Returns*
+*
+```html
+
+
+
+```
+
+-------------------------------
+
+
+### **Search([(constraintTypeN: string, constraintValueN: string, positiveConstraintN: boolean)])**
+Searches for objects that satisfy a list of constraints. If `${positiveConstraint}` is `false`, then the constraint is inverted.
+```html
+
+
+
+
+ ${constraintValue1}
+
+
+
+ ...
+
+
+
+ bool_rect
+
+
+
+
+
+```
+#### *Returns*
+*
+```html
+
+
+
+
+ ${metaInfo}
+ ...
+
+
+ ${name}
+
+ ${definition}
+
+ ...
+
+
+```
+##### Types of constraints:
+* Name pattern: `${constraintType} = "name_pattern"`; `${constraintValue}` is a regular expression string.
+* Type pattern: `${constraintType} = "type_pattern"`; `${constraintValue}` is a pattern (???: an open gallina term) string.
+* SubType pattern: `${constraintType} = "subtype_pattern"`; `${constraintValue}` is a pattern (???: an open gallina term) string.
+* In module: `${constraintType} = "in_module"`; `${constraintValue}` is a list of strings specifying the module/directory structure.
+* Include blacklist: `${constraintType} = "include_blacklist"`; `${constraintValue}` *is ommitted*.
+
+-------------------------------
+
+
+### **GetOptions()**
+```html
+
+```
+#### *Returns*
+*
+```html
+
+
+
+ ${string1}...
+
+ ${sync}
+ ${deprecated}
+ ${name}
+ ${option_value}
+
+
+ ...
+
+
+```
+
+-------------------------------
+
+
+### **SetOptions(options)**
+Sends a list of option settings, where each setting roughly looks like:
+`([optionNamePart1, ..., optionNamePartN], value)`.
+```html
+
+
+
+
+ optionNamePart1
+ ...
+ optionNamePartN
+
+
+
+
+
+ ...
+
+
+
+ Printing
+ Width
+
+
+
+
+
+
+
+```
+CoqIDE sends the following settings (defaults in parentheses):
+```
+Printing Width : (60),
+Printing Coercions : (),
+Printing Matching : (...true...)
+Printing Notations : (...true...)
+Printing Existential Instances : (...false...)
+Printing Implicit : (...false...)
+Printing All : (...false...)
+Printing Universes : (...false...)
+```
+#### *Returns*
+*
+```html
+
+```
+
+-------------------------------
+
+
+### **MkCases(...)**
+```html
+...
+```
+#### *Returns*
+*
+```html
+
+
+ ${string1}...
+ ...
+
+
+```
+
+-------------------------------
+
+
+### **StopWorker(worker: string)**
+```html
+${worker}
+```
+#### *Returns*
+*
+```html
+
+```
+
+-------------------------------
+
+
+### **PrintAst(stateId: integer)**
+```html
+
+```
+#### *Returns*
+*
+```html
+
+
+
+
+
+
+
+ ...
+ ${token}
+ ...
+
+ ...
+
+
+ ...
+
+
+```
+
+-------------------------------
+
+
+
+### **Annotate(annotation: string)**
+```html
+${annotation}
+```
+#### *Returns*
+*
+
+take `Theorem plus_0_r : forall n : nat, n + 0 = n.` as an example.
+
+```html
+
+
+
+ Theorem
+ plus_0_r :
+
+ forall
+ n :
+ nat
+ ,
+
+
+
+
+ n
+
+ +
+
+
+ 0
+
+
+
+ =
+
+
+ n
+
+
+
+
+ .
+
+
+```
+
+-------------------------------
+
+## Feedback messages
+
+Feedback messages are issued out-of-band,
+ giving updates on the current state of sentences/stateIds,
+ worker-thread status, etc.
+
+In the descriptions of feedback syntax below, wherever a `state_id`
+tag may occur, there may instead be an `edit_id` tag.
+
+* Added Axiom: in response to `Axiom`, `admit`, `Admitted`, etc.
+```html
+
+
+
+
+```
+* Processing
+```html
+
+
+
+ ${workerName}
+
+
+```
+* Processed
+```html
+
+
+
+
+
+```
+* Incomplete
+```html
+
+
+
+
+```
+* Complete
+* GlobRef
+* Error. Issued, for example, when a processed tactic has failed or is unknown.
+The error offsets may both be 0 if there is no particular syntax involved.
+* InProgress
+```html
+
+
+
+ 1
+
+
+```
+* WorkerStatus
+Ex: `workername = "proofworker:0"`
+Ex: `status = "Idle"` or `status = "proof: myLemmaName"` or `status = "Dead"`
+```html
+
+
+
+
+ ${workerName}
+ ${status}
+
+
+
+```
+* File Dependencies. Typically in response to a `Require`. Dependencies are *.vo files.
+ - State `stateId` directly depends on `dependency`:
+ ```html
+
+
+
+
+ ${dependency}
+
+
+ ```
+ - State `stateId` depends on `dependency` via dependency `sourceDependency`
+ ```xml
+
+
+
+
+ ${dependency}
+
+
+ ```
+* File Loaded. For state `stateId`, module `module` is being loaded from `voFileName`
+```xml
+
+
+
+ ${module}
+ ${voFileName`}
+
+
+```
+
+* Message. `level` is one of `{info,warning,notice,error,debug}`. For example, in response to an add `"Axiom foo: nat."` with `verbose=true`, message `foo is assumed` will be emitted in response.
+```xml
+
+
+
+
+
+ ${message}
+
+
+
+```
+
+* Custom. A feedback message that Coq plugins can use to return structured results, including results from Ltac profiling. Optionally, `startPos` and `stopPos` define a range of offsets in the document that the message refers to; otherwise, they will be 0. `customTag` is intended as a unique string that identifies what kind of payload is contained in `customXML`.
+```xml
+
+
+
+
+ ${customTag}
+ ${customXML}
+
+
+```
+
--
cgit v1.2.3
From 53a50875b28ad96ab1559ca3f97db5133ca5c78e Mon Sep 17 00:00:00 2001
From: Hugo Herbelin
Date: Fri, 14 Apr 2017 23:30:44 +0200
Subject: Fixing bug #5469 (notation format not recognizing curly braces).
---
test-suite/bugs/closed/5469.v | 3 +++
toplevel/metasyntax.ml | 28 ++++++++++++++++++++++++----
2 files changed, 27 insertions(+), 4 deletions(-)
create mode 100644 test-suite/bugs/closed/5469.v
diff --git a/test-suite/bugs/closed/5469.v b/test-suite/bugs/closed/5469.v
new file mode 100644
index 0000000000..fce671c754
--- /dev/null
+++ b/test-suite/bugs/closed/5469.v
@@ -0,0 +1,3 @@
+(* Some problems with the special treatment of curly braces *)
+
+Reserved Notation "'a' { x }" (at level 0, format "'a' { x }").
diff --git a/toplevel/metasyntax.ml b/toplevel/metasyntax.ml
index e90d638d03..e5f8191409 100644
--- a/toplevel/metasyntax.ml
+++ b/toplevel/metasyntax.ml
@@ -515,11 +515,35 @@ let read_recursive_format sl fmt =
let slfmt, fmt = get_head fmt in
slfmt, get_tail (slfmt, fmt)
+let warn_skip_spaces_curly =
+ CWarnings.create ~name:"skip-spaces-curly" ~category:"parsing"
+ (fun () ->strbrk "Skipping spaces inside curly brackets")
+
+let rec drop_spacing = function
+ | UnpCut _ as u :: fmt -> warn_skip_spaces_curly (); drop_spacing fmt
+ | UnpTerminal s' :: fmt when String.equal s' (String.make (String.length s') ' ') -> warn_skip_spaces_curly (); drop_spacing fmt
+ | fmt -> fmt
+
+let has_closing_curly_brace symbs fmt =
+ (* TODO: recognize and fail in case a box overlaps a pair of curly braces *)
+ let fmt = drop_spacing fmt in
+ match symbs, fmt with
+ | NonTerminal s :: symbs, (UnpTerminal s' as u) :: fmt when Id.equal s (Id.of_string s') ->
+ let fmt = drop_spacing fmt in
+ (match fmt with
+ | UnpTerminal "}" :: fmt -> Some (u :: fmt)
+ | _ -> None)
+ | _ -> None
+
let hunks_of_format (from,(vars,typs)) symfmt =
+ let a = ref None in
let rec aux = function
| symbs, (UnpTerminal s' as u) :: fmt
when String.equal s' (String.make (String.length s') ' ') ->
let symbs, l = aux (symbs,fmt) in symbs, u :: l
+ | symbs, (UnpTerminal "{") :: fmt when (a := has_closing_curly_brace symbs fmt; !a <> None) ->
+ let newfmt = Option.get !a in
+ aux (symbs,newfmt)
| Terminal s :: symbs, (UnpTerminal s') :: fmt
when String.equal s (String.drop_simple_quotes s') ->
let symbs, l = aux (symbs,fmt) in symbs, UnpTerminal s :: l
@@ -952,10 +976,6 @@ let check_curly_brackets_notation_exists () =
error "Notations involving patterns of the form \"{ _ }\" are treated \n\
specially and require that the notation \"{ _ }\" is already reserved."
-let warn_skip_spaces_curly =
- CWarnings.create ~name:"skip-spaces-curly" ~category:"parsing"
- (fun () ->strbrk "Skipping spaces inside curly brackets")
-
(* Remove patterns of the form "{ _ }", unless it is the "{ _ }" notation *)
let remove_curly_brackets l =
let rec skip_break acc = function
--
cgit v1.2.3
From 727ef1bd345f9ad9e08d9e4f136e2db7d034a93d Mon Sep 17 00:00:00 2001
From: Hugo Herbelin
Date: Fri, 14 Apr 2017 22:35:38 +0200
Subject: Fixing bug #5470 (anomaly on notations with misused "binder" type).
---
test-suite/bugs/closed/5470.v | 3 +++
toplevel/metasyntax.ml | 10 ++++++++++
2 files changed, 13 insertions(+)
create mode 100644 test-suite/bugs/closed/5470.v
diff --git a/test-suite/bugs/closed/5470.v b/test-suite/bugs/closed/5470.v
new file mode 100644
index 0000000000..5b3984b6df
--- /dev/null
+++ b/test-suite/bugs/closed/5470.v
@@ -0,0 +1,3 @@
+(* This used to raise an anomaly *)
+
+Fail Reserved Notation "x +++ y" (at level 70, x binder).
diff --git a/toplevel/metasyntax.ml b/toplevel/metasyntax.ml
index e5f8191409..349c05a38d 100644
--- a/toplevel/metasyntax.ml
+++ b/toplevel/metasyntax.ml
@@ -809,6 +809,15 @@ let check_useless_entry_types recvars mainvars etyps =
(pr_id x ++ str " is unbound in the notation.")
| _ -> ()
+let check_binder_type recvars etyps =
+ let l1,l2 = List.split recvars in
+ let l = l1@l2 in
+ List.iter (function
+ | (x,ETBinder b) when not (List.mem x l) ->
+ errorlabstrm "" (str (if b then "binder" else "closed binder") ++
+ strbrk " is only for use in recursive notations for binders.")
+ | _ -> ()) etyps
+
let not_a_syntax_modifier = function
| SetOnlyParsing -> true
| SetOnlyPrinting -> true
@@ -1009,6 +1018,7 @@ let compute_syntax_data df modifiers =
let toks = split_notation_string df in
let (recvars,mainvars,symbols) = analyze_notation_tokens toks in
let _ = check_useless_entry_types recvars mainvars etyps in
+ let _ = check_binder_type recvars etyps in
let ntn_for_interp = make_notation_key symbols in
let symbols' = remove_curly_brackets symbols in
let need_squash = not (List.equal Notation.symbol_eq symbols symbols') in
--
cgit v1.2.3