Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[test] Add test case showing discrepancy between coqc and sercomp/compser #94

Merged
merged 1 commit into from Dec 11, 2018

Conversation

palmskog
Copy link
Collaborator

@palmskog palmskog commented Dec 11, 2018

Here is an example file where, strangely, coqc and sercomp/compser differ in whether a proof fails. With coqc, I get:

File "./assoc.v", line 81, characters 6-31:
Error: No such goal.

That is, the proof of the lemma get_del_same fails.

However, sercomp and compser produce a .sexp file and then a .vo file without complaints. But now something really strange happens. If I remove the last lemma (get_set_diff_default) suddenly get_del_same starts to fail with sercomp at the right place.

I have no idea what's going on here. Any tips on debugging more would be welcome.

@ejgallego ejgallego added this to the 0.6.0 milestone Dec 11, 2018
@ejgallego ejgallego merged commit fe4b581 into v8.9 Dec 11, 2018
@ejgallego ejgallego deleted the v8.9+sercomp_test branch December 11, 2018 10:16
@ejgallego
Copy link
Owner

Hard to say if this a bug in Coq or not: the error recovery heuristic quicks in the faulty lemma, and Stm.join doesn't seem to complain. You can see this effect by loading the file in CoqIDE and processing it in one go to the end.

The workaround for us would be to use a "slow" mode, where we check each sentence individually instead of all at once, but let's wait a bit more to see what is going on; I'll submit a Coq bug report almost for sure.

@ejgallego
Copy link
Owner

I am still debugging this, let me know if pushing a workaround now is needed @palmskog .

@palmskog
Copy link
Collaborator Author

palmskog commented Dec 11, 2018

Here is one interesting detail, to document my own understanding of this issue.

What does the .vo file actually contain? Let's try coqchk:

$ sercomp.exe --mode=sexp assoc.v > assoc.sexp
$ compser.exe --mode=vo assoc.sexp
$ coqchk assoc.vo

The interesting output lines are:

Checking library: assoc
  checking cst:assoc.assoc
  checking cst:assoc.assoc_default
  checking cst:assoc.assoc_set
  checking cst:assoc.assoc_del
  checking cst:assoc.get_set_diff
  checking cst:assoc.get_set_diff_default
Modules were successfully checked

So, get_del_same never gets added to the .vo file: it's as if the lemma never existed in the .v file. A pragmatic user might want Coq to do something like this: "create a .vo file with all that is correct". However, a paranoid user will want some kind of notification/warning when a lemma is not included, instead of having to grep through coqchk output.

As already hinted at, I think what we want here is the --exn_on_opaque equivalent for Coq checking with compser.

@ejgallego
Copy link
Owner

Indeed, we don't detect the failure so we save the contents of the library until the point of failure.

This is a known pitfall of the current system, as saving is not integrated with the document manager [and as you can see the document manager itself seems to get confused], so for example current coqtop / sercomp does the "not open proofs" hack before save.

@ejgallego
Copy link
Owner

Error recovery mode has strange semantics in Coq upstream, disabling the feature in the compilers, examples fail now properly while using a single-shot execution mode.

ejgallego added a commit that referenced this pull request Dec 12, 2018
The semantics are a bit dubious see coq/coq#9204 and #94.

This makes the example provided in #94 fail, we update the test suite.
ejgallego added a commit to ejgallego/opam-repository that referenced this pull request Jan 28, 2019
CHANGES:

* [general] support Coq 8.9,
 * [general] SerAPI now uses Dune as a build system,
 * [opam]   install `sertop.el`,
 * [serlib] support to serialize kernel environments,
 * [serapi] new query `Env` that tries to print the current kernel environment,
 * [serlib] correct field names for `CAst`,
 * [serlib] more robust support for opaque / non-serializable types (ejgallego/coq-serapi#61, ejgallego/coq-serapi#68).
            Thanks to @palmskog,
 * [serlib] new option `--exn_on_opaque` to raise an exception on
            non-serializable types; closes ejgallego/coq-serapi#68, thanks to @palmskog,
 * [serlib] serialization test-suite from
            https://github.com/proofengineering/serapi-tests, thanks to
            @palmskog,
 * [sercomp] add `--mode` option to better control output,
 * [sercomp] add `compser` for deserialization (inverse of `sercomp`)
             (@palmskog),
 * [serapi]  Allow custom document creation using the `NewDoc` call.
             Use the `--no_init` option to avoid automatic creation
             on init. (@ejgallego)
 * [sercomp] Allow compilers to output `.vo` (@ejgallego , suggested by
             @palmskog)
 * [sercomp] Serialize top-level vernaculars with their syntactic
             attributes (such as location) (@ejallego)
 * [serapi]  Add `Assumptions` query, at the suggestion of @Armael
             (@ejgallego)
 * [sercomp] Disable error resilience mode in compilers; semantics are
             a bit dubious see coq/coq#9204 also ejgallego/coq-serapi#94.
             (@ejgallego, report by @palmskog)
 * [sercomp] Add `check` mode to compilers to check all proofs without
             outputting `.vo`. (@palmskog)
 * [sercomp] Add "hacky" `--quick` option to skip checking of opaque
             proofs. (@ejgallego, request by @palmskog)
 * [sercomp] Add `--async_workers` option to set maximum number
             of parallel async workers. (@palmskog)
 * [sertop] Stop linking Coq plugins statically and load `serlib`
            plugins when Coq plugins are loaded instead (@ejgallego,
            review by @palmskog)

_Version 0.5.7_:

 * [serlib] Fixed serializers for more tactics data, add support for
   `ground` plugin (ejgallego/coq-serapi#68). Thanks again to @palmskog for the report.

_Version 0.5.6_:

 * [serlib] Fixed serializers for some tactics data (ejgallego/coq-serapi#66) Thanks to
   @palmskog for the report.

_Version 0.5.5_:

 * [serlib] Be more lenient when parsing back `Id.t` as to accommodate
   hacks in the Coq AST (ejgallego/coq-serapi#64) Thanks to @palmskog for the report.

_Version 0.5.4_:

 * [serlib] Fix critical bug in handling of abstract type (ejgallego/coq-serapi#60)

_Version 0.5.3_:

 * [sertop] Support for `-I` option (`--ml-include-path`).

_Version 0.5.2_:

 * [serlib] Compatibility with OCaml 4.07.0 [problems with `Stdlib` packing]

_Version 0.5.1_:

 * [serlib] (basic) support for serialization of the ssreflect grammar,
 * [serapi] `(Query () (Ast n))` is now `(Query ((sid n)) Ast)`,
 * [serapi] remove broken deprecated `SetOpt` and `LibAdd` commands,
 * [doc] Improved man page.
 * [js] Miscellaneous improvements on the js build.

_Version 0.5.0_:

 * [general] support Coq 8.8, use improved document API,
 * [sertop] By default `sertop` will create a new document with `doc_id` 0,
 * [sertop] new debug options, see `sertop --help`.

_Version 0.4_:

 * [general] support Coq 8.7 , make use of improved upstream API,
 * [sertop] support `-R` and `-Q` options, note the slightly different
   syntax wrt Coq upstream: `-R dir,path` in place of `-R dir path`,
 * [serlib] support serialization of generic arguments [ejgallego/coq-serapi#41],
 * [serapi] `(ReadFile file)`: hack to load a completed file.

_Version 0.2_:

 * Better Query/Object system.

_Version 0.1_:

 * Serialization-independent protocol core,
 * [js] Javascript worker,
 * [lib] Better Prelude support,
 * [serlib] Full Serialization of generic arguments,
 * [proto] Add is not a synchronous call anymore,
 * [proto] Refactor into a flat command hierarchy,
 * [proto] More useful queries,
 * [proto] Guarantee initial state is 1,
 * [proto] Support for ltac profiling,
 * [proto] Printing: add depth limiting,
 * [proto] Better handling of options in the sexp backend.

_Version 0.03_:

 * **[done]** Implicit arguments.
 * **[done]** Coq Workers support.
 * **[done]** Advanced Sentence splitting `(Parse (Sentence string))`, which can handle the whole document.

_Version 0.02_:

 * **[done]** Serialization of the `Proof.proof` object.
 * **[done]** Improve API: add options.
 * **[done]** Improve and review printing workflow.
 * **[done]** `(Query ((Prefix "add") (Limit 10) (PpStr)) $ObjectType)`
 * **[done]** Basic Sentence splitting `(Parse num string))`, retuns the first num end of the sentences _without_ executing them.
              This has pitfalls as parsing is very stateful.
 * **[done]** Basic completion-oriented Search support `(Query () Names)`
 * **[done]** Better command line parsing (`Cmdliner`, `Core` ?)
 * **[partial]** Print Grammar tactic. `(Query ... (Tactics))`.
   Still we need to decide on:
   `Coq.Init.Notations.instantiate` vs `instantiate`, the issue of
   `Nametab.shortest_qualid_of_global` is a very sensible one for IDEs
ejgallego added a commit to ejgallego/opam-repository that referenced this pull request Jan 28, 2019
CHANGES:

* [general] support Coq 8.9,
 * [general] SerAPI now uses Dune as a build system,
 * [opam]   install `sertop.el`,
 * [serlib] support to serialize kernel environments,
 * [serapi] new query `Env` that tries to print the current kernel environment,
 * [serlib] correct field names for `CAst`,
 * [serlib] more robust support for opaque / non-serializable types (ejgallego/coq-serapi#61, ejgallego/coq-serapi#68).
            Thanks to @palmskog,
 * [serlib] new option `--exn_on_opaque` to raise an exception on
            non-serializable types; closes ejgallego/coq-serapi#68, thanks to @palmskog,
 * [serlib] serialization test-suite from
            https://github.com/proofengineering/serapi-tests, thanks to
            @palmskog,
 * [sercomp] add `--mode` option to better control output,
 * [sercomp] add `compser` for deserialization (inverse of `sercomp`)
             (@palmskog),
 * [serapi]  Allow custom document creation using the `NewDoc` call.
             Use the `--no_init` option to avoid automatic creation
             on init. (@ejgallego)
 * [sercomp] Allow compilers to output `.vo` (@ejgallego , suggested by
             @palmskog)
 * [sercomp] Serialize top-level vernaculars with their syntactic
             attributes (such as location) (@ejallego)
 * [serapi]  Add `Assumptions` query, at the suggestion of @Armael
             (@ejgallego)
 * [sercomp] Disable error resilience mode in compilers; semantics are
             a bit dubious see coq/coq#9204 also ejgallego/coq-serapi#94.
             (@ejgallego, report by @palmskog)
 * [sercomp] Add `check` mode to compilers to check all proofs without
             outputting `.vo`. (@palmskog)
 * [sercomp] Add "hacky" `--quick` option to skip checking of opaque
             proofs. (@ejgallego, request by @palmskog)
 * [sercomp] Add `--async_workers` option to set maximum number
             of parallel async workers. (@palmskog)
 * [sertop] Stop linking Coq plugins statically and load `serlib`
            plugins when Coq plugins are loaded instead (@ejgallego,
            review by @palmskog)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants