Open JasonGross opened 1 year ago
I've fixed compatibility with Coq 8.9, let me look at quickcheck
The issue with QuickChick seems to be a bug in Coq's legacy (apply
) unification, I'm currently minimizing it.
The issue with QuickCheck is https://github.com/coq/coq/issues/17566. I'm not sure what we should do here, options I see are:
Opaque ret
apply
dpose proof
instead of apply
I don't think we should give up on the PR. @JasonGross is one of the (relatively) few people that actually understands universes, so getting that insight in here to benefit everyone seems a good thing.
Will the Coq but be fixed?
Will the Coq bug be fixed?
I'm not sure. I certainly don't understand the code well enough to write a patch. @SkySkimmer says:
Old unification only understands inductive cumulativity in the syntactic equality fast path IIRC https://github.com/coq/coq/pull/14758
Or alternatively if https://github.com/coq/coq/issues/17565 is granted then users can just Set New Unification In Tactics
or whatever the flag ends up being called. Or we can try to get rapply ... in ...
. Someday hopefully the old unification engine will be removed and replaced by the new one, but I'm not sure how far off that if.
Or we can alter QuickChick to make it compatible with here.
Fails QuickChick unit test on Coq dev: https://github.com/QuickChick/QuickChick/blob/235f6f2156b06239d10e971b7f229f18b73fb67c/test/plugin/plugin.v#L51
File "./plugin.v", line 51, characters 0-22: Error: Conversion test raised an anomaly: Anomaly "in Univ.repr: Universe plugin.51 undefined."
Fails QuickChick unit test on Coq dev: QuickChick/QuickChick@
235f6f2
/test/plugin/plugin.v#L51File "./plugin.v", line 51, characters 0-22: Error: Conversion test raised an anomaly: Anomaly "in Univ.repr: Universe plugin.51 undefined."
@JasonGross any idea regarding the new (Universe?) issue with QuickChick? The failing example blocks this PR from being merged, otherwise IIUC would break Coq CI.
Can we get coqbot to minimize it for us? Something like @coqbot minimize coq.dev
git clone git@github.com:JasonGross/coq-ext-lib.git --branch=cumul
cd coq-ext-lib
opam pin add -y .
opam install -y coq-quickchick
Fails QuickChick unit test on Coq dev: QuickChick/QuickChick@
235f6f2
/test/plugin/plugin.v#L51File "./plugin.v", line 51, characters 0-22: Error: Conversion test raised an anomaly: Anomaly "in Univ.repr: Universe plugin.51 undefined."
@JasonGross any idea regarding the new (Universe?) issue with QuickChick? The failing example blocks this PR from being merged, otherwise IIUC would break Coq CI.
I see
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> retrieved coq-quickchick.dev (git+https://github.com/QuickChick/QuickChick#master)
Error: The installation of coq-quickchick failed at "make -j 3 tests".
#=== ERROR while installing coq-quickchick.dev ================================#
# context 2.1.5 | linux/x86_64 | ocaml-option-flambda.1 ocaml-variants.4.13.1+options | https://coq.inria.fr/opam/extra-dev#2024-01-08 09:50
# path ~/.opam/4.13.1+flambda/.opam-switch/build/coq-quickchick.dev
# command /usr/bin/make -j 3 tests
# exit-code 2
# env-file ~/.opam/log/coq-quickchick-5176-be5acb.env
# output-file ~/.opam/log/coq-quickchick-5176-be5acb.out
### output ###
# +++ Passed 10000 tests (0 discards)
# [...]
# xargs: warning: options --max-args and --replace/-I/-i are mutually exclusive, ignoring previous --max-args value
# Mutant test:mutation.ml:2917:65: Testing...
# Mutant test:mutation.ml:2917:65: Killed!
# Mutant test:bar: Testing...
# Mutant test:bar: Killed!
# Mutant test:mutation.ml:2927:67: Testing...
# Mutant test:mutation.ml:2927:67: Killed!
# Mutant test:foo: Testing...
# Mutant test:foo: Killed!
# make[1]: Leaving directory '/home/coq/.opam/4.13.1+flambda/.opam-switch/build/coq-quickchick.dev/test'
# make: *** [Makefile:68: tests] Error 2
<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
+- The following actions failed
| - install coq-quickchick dev
+-
- No changes have been performed
on CI. What should I pass opam install
to see the anomaly?
I might have changed the test suite in coq/opam#2897. Locating this problem on my side.
@liyishuai here's the minimized example. Any ideas for tracking down what's going on? Is QuickChick internally relying on some ext-lib structure not being cumulative?
@JasonGross, Minimized File /home/runner/work/run-coq-bug-minimizer/run-coq-bug-minimizer/QuickChick/test/plugin/plugin.v (full log on GitHub Actions - verbose log)
build.log
)bug.log
)If you have any comments on your experience of the minimizer, please share them in a reply (possibly tagging @JasonGross
).
If you believe there's a bug in the bug minimizer, please report it on the bug minimizer issue tracker.
Originally posted by @coqbot-app[bot] in https://github.com/coq/coq/issues/18518#issuecomment-1905471597
Is QuickChick internally relying on some ext-lib structure not being cumulative?
I don't think so. @Lysxia any ideas?
Slightly more minimal example. Removing Cumulative
makes it pass
Require Coq.Strings.String.
Module Export Monad.
Set Universe Polymorphism.
Cumulative Class Monad@{d c} (m : Type@{d} -> Type@{c}) : Type :=
{ ret : forall {t : Type@{d}}, t -> m t
; bind : forall {t u : Type@{d}}, m t -> (t -> m u) -> m u
}.
Axiom liftM@{d c} : forall {m : Type@{d} -> Type@{c}} {M : Monad m} {T U : Type@{d}} (f : T -> U), m T -> m U.
End Monad.
Module Export QuickChick.
Module Export Show.
Import Coq.Strings.String.
Class Show (A : Type) : Type := { show : A -> string }.
#[global] Declare Instance showNat : Show nat.
#[global] Declare Instance showList {A : Type} `{_ : Show A} : Show (list A).
#[global] Declare Instance showOpt {A : Type} `{_ : Show A} : Show (option A).
End Show.
Module Export Generators.
Set Implicit Arguments.
Axiom G : Type -> Type.
#[global] Declare Instance MonadGen : Monad G.
Axiom sampleGen : forall (A : Type) (g : G A), list A.
End Generators.
End QuickChick.
Declare ML Module "coq-quickchick.plugin".
Definition a : G nat.
Admitted.
Sample (liftM Some a).
Reported upstream as https://github.com/QuickChick/QuickChick/issues/352
I'm guessing the issue is that the evd
from interp_constr
is being thrown away in let (c,_evd) = interp_constr env evd c in
https://github.com/QuickChick/QuickChick/blob/235f6f2156b06239d10e971b7f229f18b73fb67c/plugin/quickChick.mlg.cppo#L298-L302
This is required for Monad for use in metacoq, I believe, but I figured I would set the flag everywhere while I'm at it. Maybe CoqExtLib should have some file of
DefaultOptions
or something with#[export] Set ...
for all the options, that isImport
ed by the relevant files?