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 coqbot responses #217

Closed
JasonGross opened this issue Sep 11, 2024 · 51 comments
Closed

Test coqbot responses #217

JasonGross opened this issue Sep 11, 2024 · 51 comments

Comments

@JasonGross
Copy link
Owner

No description provided.

@JasonGross JasonGross closed this as not planned Won't fix, can't repro, duplicate, stale Sep 11, 2024
@JasonGross
Copy link
Owner Author

@coqbot minimize coq.dev

#!/usr/bin/env bash

true | coqtop
coqc --version
opam pin remove coq -y
opam pin add coq 'https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y
true | coqtop
coqc --version

cat <<EOF > bug.v
Require Coq.ZArith.ZArith.

Import Coq.micromega.Lia.
Import Coq.Arith.PeanoNat.
Import Coq.Lists.List.
Import ListNotations.

Module Import Nat.
  Definition div_up a b := Nat.div (a + (b-1)) b.
  Lemma div_up_range a b (H : b <> 0) : a <= div_up a b * b < a + b.
Admitted.

  Lemma div_up_add_mod a b n:
    (a mod n = 0)%nat ->
    Nat.div_up (a + b) n =
    (Nat.div_up a n + Nat.div_up b n)%nat.
Admitted.

  Lemma div_up_exact_mod a b:
    (b <> 0)%nat ->
    (a mod b = 0)%nat ->
    ((Nat.div_up a b) * b = a)%nat.
Admitted.

Section Chunk.
  Context [A : Type] (k : nat).
  Implicit Types (bs ck xs ys : list A).
Fixpoint chunk' bs ck {struct bs} : list (list A).
Admitted.
  Definition chunk bs := chunk' bs [].

  Context (Hk : k <> 0).

  Lemma nth_error_chunk bs i (Hi : i < div_up (length bs) k)
    : nth_error (chunk bs) i = Some (firstn k (skipn (i*k) bs)).
Admitted.

  Lemma length_chunk bs : length (chunk bs) = div_up (length bs) k.
Admitted.

  Lemma length_chunk_app (l l' : list A) :
    (length l mod k)%nat = 0%nat ->
    length (chunk (l ++ l')) = length (chunk l ++ chunk l').
Admitted.

  Lemma chunk_app : forall (l l': list A),
      (length l mod k = 0)%nat ->
      chunk (l ++ l') = chunk l ++ chunk l'.
  Proof.
    intros * Hmod.
    eapply nth_ext with (d := []) (d' := []); [ | intros idx ].
    - apply length_chunk_app; assumption.
    - intros Hidx; eassert (Some _ = Some _) as HS; [ | injection HS; intros Hs; apply Hs ].
      rewrite <- !nth_error_nth' by assumption.
      rewrite <- !nth_error_nth' by (rewrite length_chunk_app in Hidx; eassumption).
      assert (idx < length (chunk l) \/ length (chunk l) <= idx)%nat as [Hlt | Hge] by lia;
        [ rewrite nth_error_app1 | rewrite nth_error_app2 ]; try eassumption.
      all: rewrite !nth_error_chunk.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hlt by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hidx by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hge by assumption.
      all: rewrite ?length_chunk, ?app_length, ?div_up_add_mod by assumption.
      all: try lia.
      all: pose proof Nat.div_up_range (length l) k ltac:(lia).
      + pose proof div_up_exact_mod (length l) k ltac:(lia) ltac:(lia).
        rewrite !firstn_skipn_comm, !firstn_app.
        replace (idx * k + k - length l)%nat with 0%nat by nia.
        simpl; rewrite app_nil_r; reflexivity.
      + rewrite Nat.mul_sub_distr_r.
        erewrite div_up_exact_mod by lia.
        rewrite skipn_app, skipn_all2; [ reflexivity | nia ].
  Qed.
EOF

coqc -q bug.v

Copy link

coqbot-app bot commented Sep 11, 2024

Hey @JasonGross, the coq bug minimizer is running your script, I'll come back to you with the results once it's done.

1 similar comment
Copy link

coqbot-app bot commented Sep 11, 2024

Hey @JasonGross, the coq bug minimizer is running your script, I'll come back to you with the results once it's done.

@JasonGross JasonGross pinned this issue Sep 11, 2024
Copy link

coqbot-app bot commented Sep 11, 2024

@JasonGross, Minimized File (full log on GitHub Actions)

🌟 Minimized Coq File (consider adding this file to the test-suite)
Require Coq.ZArith.ZArith.

Import Coq.micromega.Lia.
Import Coq.Arith.PeanoNat.
Import Coq.Lists.List.
Import ListNotations.

Module Import Nat.
  Definition div_up a b := Nat.div (a + (b-1)) b.
  Lemma div_up_range a b (H : b <> 0) : a <= div_up a b * b < a + b.
Admitted.

  Lemma div_up_add_mod a b n:
    (a mod n = 0)%nat ->
    Nat.div_up (a + b) n =
    (Nat.div_up a n + Nat.div_up b n)%nat.
Admitted.

  Lemma div_up_exact_mod a b:
    (b <> 0)%nat ->
    (a mod b = 0)%nat ->
    ((Nat.div_up a b) * b = a)%nat.
Admitted.

Section Chunk.
  Context [A : Type] (k : nat).
  Implicit Types (bs ck xs ys : list A).
Fixpoint chunk' bs ck {struct bs} : list (list A).
Admitted.
  Definition chunk bs := chunk' bs [].

  Context (Hk : k <> 0).

  Lemma nth_error_chunk bs i (Hi : i < div_up (length bs) k)
    : nth_error (chunk bs) i = Some (firstn k (skipn (i*k) bs)).
Admitted.

  Lemma length_chunk bs : length (chunk bs) = div_up (length bs) k.
Admitted.

  Lemma length_chunk_app (l l' : list A) :
    (length l mod k)%nat = 0%nat ->
    length (chunk (l ++ l')) = length (chunk l ++ chunk l').
Admitted.

  Lemma chunk_app : forall (l l': list A),
      (length l mod k = 0)%nat ->
      chunk (l ++ l') = chunk l ++ chunk l'.
  Proof.
    intros * Hmod.
    eapply nth_ext with (d := []) (d' := []); [ | intros idx ].
    - apply length_chunk_app; assumption.
    - intros Hidx; eassert (Some _ = Some _) as HS; [ | injection HS; intros Hs; apply Hs ].
      rewrite <- !nth_error_nth' by assumption.
      rewrite <- !nth_error_nth' by (rewrite length_chunk_app in Hidx; eassumption).
      assert (idx < length (chunk l) \/ length (chunk l) <= idx)%nat as [Hlt | Hge] by lia;
        [ rewrite nth_error_app1 | rewrite nth_error_app2 ]; try eassumption.
      all: rewrite !nth_error_chunk.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hlt by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hidx by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hge by assumption.
      all: rewrite ?length_chunk, ?app_length, ?div_up_add_mod by assumption.
      all: try lia.
      all: pose proof Nat.div_up_range (length l) k ltac:(lia).
      + pose proof div_up_exact_mod (length l) k ltac:(lia) ltac:(lia).
        rewrite !firstn_skipn_comm, !firstn_app.
        replace (idx * k + k - length l)%nat with 0%nat by nia.
        simpl; rewrite app_nil_r; reflexivity.
      + rewrite Nat.mul_sub_distr_r.
        erewrite div_up_exact_mod by lia.
        rewrite skipn_app, skipn_all2; [ reflexivity | nia ].
  Qed.
🛠️ Intermediate Coq File (useful for debugging if minimization did not go as far as you wanted)
🛠️ 📜 Intermediate Coq File log (useful for debugging if minimization did not go as far as you wanted)
📜 Build Log (contains the Coq error message) (truncated to last 8.0KiB; full 27KiB file on GitHub Actions Artifacts under build.log)
racters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
Error: The section Chunk and module Nat need to be closed.
📜 🔎 Minimization Log (truncated to last 8.0KiB; full 51KiB file on GitHub Actions Artifacts under bug.log)
ub/workspace/run-script.sh @ line 187) $�[0m dirname /home/coq/.opam/4.13.1+flambda/bin/coqc.orig
++ �[33;1m(/github/workspace/run-script.sh @ line 187) $�[0m cd /home/coq/.opam/4.13.1+flambda/bin
++ �[33;1m(/github/workspace/run-script.sh @ line 187) $�[0m readlink -f coq_makefile
+ �[33;1m(/github/workspace/run-script.sh @ line 187) $�[0m PASSING_COQ_MAKEFILE=/home/coq/.opam/4.13.1+flambda/bin/coq_makefile
+++ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m dirname /home/coq/.opam/4.13.1+flambda/bin/coqc.orig
++ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m cd /home/coq/.opam/4.13.1+flambda/bin
++ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m readlink -f coqdep
+ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m PASSING_COQDEP=/home/coq/.opam/4.13.1+flambda/bin/coqdep
+ �[33;1m(/github/workspace/run-script.sh @ line 190) $�[0m '[' /home/coq/.opam/4.13.1+flambda/bin/coqc.orig '!=' /home/coq/.opam/4.13.1+flambda/bin/coqc.orig ']'
+ �[33;1m(/github/workspace/run-script.sh @ line 195) $�[0m NONPASSING_PREFIX=
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m process_args '' ''
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m bash -c 'split_args_to_lines /home/coq/.opam/4.13.1+flambda/bin/coqc.orig -q bug.v '
++ �[33;1m(/github/workspace/run-script.sh @ line 63) $�[0m passing_prefix=
++ �[33;1m(/github/workspace/run-script.sh @ line 64) $�[0m prefixed_arg=--arg
++ �[33;1m(/github/workspace/run-script.sh @ line 65) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 69) $�[0m known_v_file=
++ �[33;1m(/github/workspace/run-script.sh @ line 70) $�[0m next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m tail -n +2
++ �[33;1m(/github/workspace/run-script.sh @ line 71) $�[0m next_next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 72) $�[0m skip_next=no
++ �[33;1m(/github/workspace/run-script.sh @ line 73) $�[0m prev_load=
++ �[33;1m(/github/workspace/run-script.sh @ line 74) $�[0m found_known_v_file=no
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' -q
process_args: processing (-q)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 101) $�[0m case "$i" in
++ �[33;1m(/github/workspace/run-script.sh @ line 133) $�[0m printf '%s=%s\n' --arg -q
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' bug.v
process_args: processing (bug.v)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m coqpath_to_args /github/workspace ''
++ �[33;1m(/github/workspace/run-script.sh @ line 142) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 143) $�[0m local IFS=:
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f ''
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f bug.v
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m '[' '' == /github/workspace/bug.v ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 99) $�[0m :
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
+ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m FAILING_ARGS=--arg=-q
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m process_args passing ''
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m bash -c 'split_args_to_lines /home/coq/.opam/4.13.1+flambda/bin/coqc.orig -q bug.v '
++ �[33;1m(/github/workspace/run-script.sh @ line 63) $�[0m passing_prefix=
++ �[33;1m(/github/workspace/run-script.sh @ line 64) $�[0m prefixed_arg=--arg
++ �[33;1m(/github/workspace/run-script.sh @ line 65) $�[0m '[' '!' -z passing ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 66) $�[0m passing_prefix=--passing
++ �[33;1m(/github/workspace/run-script.sh @ line 67) $�[0m prefixed_arg=--passing-arg
++ �[33;1m(/github/workspace/run-script.sh @ line 69) $�[0m known_v_file=
++ �[33;1m(/github/workspace/run-script.sh @ line 70) $�[0m next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 71) $�[0m next_next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 72) $�[0m skip_next=no
++ �[33;1m(/github/workspace/run-script.sh @ line 73) $�[0m prev_load=
++ �[33;1m(/github/workspace/run-script.sh @ line 74) $�[0m found_known_v_file=no
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m tail -n +2
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m sed 's,\(/github/workspace/builds/coq\)/coq-failing/,\1/coq-passing/,g'
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' -q
process_args: processing (-q)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 101) $�[0m case "$i" in
++ �[33;1m(/github/workspace/run-script.sh @ line 133) $�[0m printf '%s=%s\n' --passing-arg -q
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' bug.v
process_args: processing (bug.v)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m coqpath_to_args /github/workspace ''
++ �[33;1m(/github/workspace/run-script.sh @ line 142) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 143) $�[0m local IFS=:
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f ''
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f bug.v
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m '[' '' == /github/workspace/bug.v ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 99) $�[0m :
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
+ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m PASSING_ARGS=--passing-arg=-q
++ �[33;1m(/github/workspace/run-script.sh @ line 200) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 200) $�[0m readlink -f ''
+ �[33;1m(/github/workspace/run-script.sh @ line 200) $�[0m ABS_FILE=

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.

Copy link

coqbot-app bot commented Sep 11, 2024

@JasonGross, Minimized File (full log on GitHub Actions)

🌟 Minimized Coq File (consider adding this file to the test-suite)
Require Coq.ZArith.ZArith.

Import Coq.micromega.Lia.
Import Coq.Arith.PeanoNat.
Import Coq.Lists.List.
Import ListNotations.

Module Import Nat.
  Definition div_up a b := Nat.div (a + (b-1)) b.
  Lemma div_up_range a b (H : b <> 0) : a <= div_up a b * b < a + b.
Admitted.

  Lemma div_up_add_mod a b n:
    (a mod n = 0)%nat ->
    Nat.div_up (a + b) n =
    (Nat.div_up a n + Nat.div_up b n)%nat.
Admitted.

  Lemma div_up_exact_mod a b:
    (b <> 0)%nat ->
    (a mod b = 0)%nat ->
    ((Nat.div_up a b) * b = a)%nat.
Admitted.

Section Chunk.
  Context [A : Type] (k : nat).
  Implicit Types (bs ck xs ys : list A).
Fixpoint chunk' bs ck {struct bs} : list (list A).
Admitted.
  Definition chunk bs := chunk' bs [].

  Context (Hk : k <> 0).

  Lemma nth_error_chunk bs i (Hi : i < div_up (length bs) k)
    : nth_error (chunk bs) i = Some (firstn k (skipn (i*k) bs)).
Admitted.

  Lemma length_chunk bs : length (chunk bs) = div_up (length bs) k.
Admitted.

  Lemma length_chunk_app (l l' : list A) :
    (length l mod k)%nat = 0%nat ->
    length (chunk (l ++ l')) = length (chunk l ++ chunk l').
Admitted.

  Lemma chunk_app : forall (l l': list A),
      (length l mod k = 0)%nat ->
      chunk (l ++ l') = chunk l ++ chunk l'.
  Proof.
    intros * Hmod.
    eapply nth_ext with (d := []) (d' := []); [ | intros idx ].
    - apply length_chunk_app; assumption.
    - intros Hidx; eassert (Some _ = Some _) as HS; [ | injection HS; intros Hs; apply Hs ].
      rewrite <- !nth_error_nth' by assumption.
      rewrite <- !nth_error_nth' by (rewrite length_chunk_app in Hidx; eassumption).
      assert (idx < length (chunk l) \/ length (chunk l) <= idx)%nat as [Hlt | Hge] by lia;
        [ rewrite nth_error_app1 | rewrite nth_error_app2 ]; try eassumption.
      all: rewrite !nth_error_chunk.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hlt by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hidx by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hge by assumption.
      all: rewrite ?length_chunk, ?app_length, ?div_up_add_mod by assumption.
      all: try lia.
      all: pose proof Nat.div_up_range (length l) k ltac:(lia).
      + pose proof div_up_exact_mod (length l) k ltac:(lia) ltac:(lia).
        rewrite !firstn_skipn_comm, !firstn_app.
        replace (idx * k + k - length l)%nat with 0%nat by nia.
        simpl; rewrite app_nil_r; reflexivity.
      + rewrite Nat.mul_sub_distr_r.
        erewrite div_up_exact_mod by lia.
        rewrite skipn_app, skipn_all2; [ reflexivity | nia ].
  Qed.
🛠️ Intermediate Coq File (useful for debugging if minimization did not go as far as you wanted)
🛠️ 📜 Intermediate Coq File log (useful for debugging if minimization did not go as far as you wanted)
📜 Build Log (contains the Coq error message) (truncated to last 8.0KiB; full 27KiB file on GitHub Actions Artifacts under build.log)
racters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
Error: The section Chunk and module Nat need to be closed.
📜 🔎 Minimization Log (truncated to last 8.0KiB; full 51KiB file on GitHub Actions Artifacts under bug.log)
ub/workspace/run-script.sh @ line 187) $�[0m dirname /home/coq/.opam/4.13.1+flambda/bin/coqc.orig
++ �[33;1m(/github/workspace/run-script.sh @ line 187) $�[0m cd /home/coq/.opam/4.13.1+flambda/bin
++ �[33;1m(/github/workspace/run-script.sh @ line 187) $�[0m readlink -f coq_makefile
+ �[33;1m(/github/workspace/run-script.sh @ line 187) $�[0m PASSING_COQ_MAKEFILE=/home/coq/.opam/4.13.1+flambda/bin/coq_makefile
+++ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m dirname /home/coq/.opam/4.13.1+flambda/bin/coqc.orig
++ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m cd /home/coq/.opam/4.13.1+flambda/bin
++ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m readlink -f coqdep
+ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m PASSING_COQDEP=/home/coq/.opam/4.13.1+flambda/bin/coqdep
+ �[33;1m(/github/workspace/run-script.sh @ line 190) $�[0m '[' /home/coq/.opam/4.13.1+flambda/bin/coqc.orig '!=' /home/coq/.opam/4.13.1+flambda/bin/coqc.orig ']'
+ �[33;1m(/github/workspace/run-script.sh @ line 195) $�[0m NONPASSING_PREFIX=
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m process_args '' ''
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m bash -c 'split_args_to_lines /home/coq/.opam/4.13.1+flambda/bin/coqc.orig -q bug.v '
++ �[33;1m(/github/workspace/run-script.sh @ line 63) $�[0m passing_prefix=
++ �[33;1m(/github/workspace/run-script.sh @ line 64) $�[0m prefixed_arg=--arg
++ �[33;1m(/github/workspace/run-script.sh @ line 65) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m tail -n +2
++ �[33;1m(/github/workspace/run-script.sh @ line 69) $�[0m known_v_file=
++ �[33;1m(/github/workspace/run-script.sh @ line 70) $�[0m next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 71) $�[0m next_next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 72) $�[0m skip_next=no
++ �[33;1m(/github/workspace/run-script.sh @ line 73) $�[0m prev_load=
++ �[33;1m(/github/workspace/run-script.sh @ line 74) $�[0m found_known_v_file=no
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' -q
process_args: processing (-q)
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m coqpath_to_args /github/workspace ''
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 142) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 143) $�[0m local IFS=:
++ �[33;1m(/github/workspace/run-script.sh @ line 101) $�[0m case "$i" in
++ �[33;1m(/github/workspace/run-script.sh @ line 133) $�[0m printf '%s=%s\n' --arg -q
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' bug.v
process_args: processing (bug.v)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ bug.v == *\.\v ]]
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f ''
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f bug.v
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m '[' '' == /github/workspace/bug.v ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 99) $�[0m :
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
+ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m FAILING_ARGS=--arg=-q
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m bash -c 'split_args_to_lines /home/coq/.opam/4.13.1+flambda/bin/coqc.orig -q bug.v '
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m process_args passing ''
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m tail -n +2
++ �[33;1m(/github/workspace/run-script.sh @ line 63) $�[0m passing_prefix=
++ �[33;1m(/github/workspace/run-script.sh @ line 64) $�[0m prefixed_arg=--arg
++ �[33;1m(/github/workspace/run-script.sh @ line 65) $�[0m '[' '!' -z passing ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 66) $�[0m passing_prefix=--passing
++ �[33;1m(/github/workspace/run-script.sh @ line 67) $�[0m prefixed_arg=--passing-arg
++ �[33;1m(/github/workspace/run-script.sh @ line 69) $�[0m known_v_file=
++ �[33;1m(/github/workspace/run-script.sh @ line 70) $�[0m next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 71) $�[0m next_next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 72) $�[0m skip_next=no
++ �[33;1m(/github/workspace/run-script.sh @ line 73) $�[0m prev_load=
++ �[33;1m(/github/workspace/run-script.sh @ line 74) $�[0m found_known_v_file=no
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m sed 's,\(/github/workspace/builds/coq\)/coq-failing/,\1/coq-passing/,g'
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' -q
process_args: processing (-q)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 101) $�[0m case "$i" in
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m coqpath_to_args /github/workspace ''
++ �[33;1m(/github/workspace/run-script.sh @ line 133) $�[0m printf '%s=%s\n' --passing-arg -q
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' bug.v
process_args: processing (bug.v)
++ �[33;1m(/github/workspace/run-script.sh @ line 142) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 143) $�[0m local IFS=:
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f ''
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f bug.v
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m '[' '' == /github/workspace/bug.v ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 99) $�[0m :
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
+ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m PASSING_ARGS=--passing-arg=-q
++ �[33;1m(/github/workspace/run-script.sh @ line 200) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 200) $�[0m readlink -f ''
+ �[33;1m(/github/workspace/run-script.sh @ line 200) $�[0m ABS_FILE=

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.

@JasonGross
Copy link
Owner Author

@coqbot minimize coq.dev

#!/usr/bin/env bash

true | coqtop
coqc --version
opam pin remove coq -y
opam pin add coq 'https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y -k git
true | coqtop
coqc --version

cat <<EOF > bug.v
Require Coq.ZArith.ZArith.

Import Coq.micromega.Lia.
Import Coq.Arith.PeanoNat.
Import Coq.Lists.List.
Import ListNotations.

Module Import Nat.
  Definition div_up a b := Nat.div (a + (b-1)) b.
  Lemma div_up_range a b (H : b <> 0) : a <= div_up a b * b < a + b.
Admitted.

  Lemma div_up_add_mod a b n:
    (a mod n = 0)%nat ->
    Nat.div_up (a + b) n =
    (Nat.div_up a n + Nat.div_up b n)%nat.
Admitted.

  Lemma div_up_exact_mod a b:
    (b <> 0)%nat ->
    (a mod b = 0)%nat ->
    ((Nat.div_up a b) * b = a)%nat.
Admitted.

Section Chunk.
  Context [A : Type] (k : nat).
  Implicit Types (bs ck xs ys : list A).
Fixpoint chunk' bs ck {struct bs} : list (list A).
Admitted.
  Definition chunk bs := chunk' bs [].

  Context (Hk : k <> 0).

  Lemma nth_error_chunk bs i (Hi : i < div_up (length bs) k)
    : nth_error (chunk bs) i = Some (firstn k (skipn (i*k) bs)).
Admitted.

  Lemma length_chunk bs : length (chunk bs) = div_up (length bs) k.
Admitted.

  Lemma length_chunk_app (l l' : list A) :
    (length l mod k)%nat = 0%nat ->
    length (chunk (l ++ l')) = length (chunk l ++ chunk l').
Admitted.

  Lemma chunk_app : forall (l l': list A),
      (length l mod k = 0)%nat ->
      chunk (l ++ l') = chunk l ++ chunk l'.
  Proof.
    intros * Hmod.
    eapply nth_ext with (d := []) (d' := []); [ | intros idx ].
    - apply length_chunk_app; assumption.
    - intros Hidx; eassert (Some _ = Some _) as HS; [ | injection HS; intros Hs; apply Hs ].
      rewrite <- !nth_error_nth' by assumption.
      rewrite <- !nth_error_nth' by (rewrite length_chunk_app in Hidx; eassumption).
      assert (idx < length (chunk l) \/ length (chunk l) <= idx)%nat as [Hlt | Hge] by lia;
        [ rewrite nth_error_app1 | rewrite nth_error_app2 ]; try eassumption.
      all: rewrite !nth_error_chunk.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hlt by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hidx by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hge by assumption.
      all: rewrite ?length_chunk, ?app_length, ?div_up_add_mod by assumption.
      all: try lia.
      all: pose proof Nat.div_up_range (length l) k ltac:(lia).
      + pose proof div_up_exact_mod (length l) k ltac:(lia) ltac:(lia).
        rewrite !firstn_skipn_comm, !firstn_app.
        replace (idx * k + k - length l)%nat with 0%nat by nia.
        simpl; rewrite app_nil_r; reflexivity.
      + rewrite Nat.mul_sub_distr_r.
        erewrite div_up_exact_mod by lia.
        rewrite skipn_app, skipn_all2; [ reflexivity | nia ].
  Qed.
EOF

coqc -q bug.v

Copy link

coqbot-app bot commented Sep 11, 2024

Hey @JasonGross, the coq bug minimizer is running your script, I'll come back to you with the results once it's done.

@JasonGross
Copy link
Owner Author

@coqbot minimize coq.dev

#!/usr/bin/env bash

true | coqtop
coqc --version
opam pin remove coq -y
opam pin add coq 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y
true | coqtop
coqc --version

cat <<EOF > bug.v
Require Coq.ZArith.ZArith.

Import Coq.micromega.Lia.
Import Coq.Arith.PeanoNat.
Import Coq.Lists.List.
Import ListNotations.

Module Import Nat.
  Definition div_up a b := Nat.div (a + (b-1)) b.
  Lemma div_up_range a b (H : b <> 0) : a <= div_up a b * b < a + b.
Admitted.

  Lemma div_up_add_mod a b n:
    (a mod n = 0)%nat ->
    Nat.div_up (a + b) n =
    (Nat.div_up a n + Nat.div_up b n)%nat.
Admitted.

  Lemma div_up_exact_mod a b:
    (b <> 0)%nat ->
    (a mod b = 0)%nat ->
    ((Nat.div_up a b) * b = a)%nat.
Admitted.

Section Chunk.
  Context [A : Type] (k : nat).
  Implicit Types (bs ck xs ys : list A).
Fixpoint chunk' bs ck {struct bs} : list (list A).
Admitted.
  Definition chunk bs := chunk' bs [].

  Context (Hk : k <> 0).

  Lemma nth_error_chunk bs i (Hi : i < div_up (length bs) k)
    : nth_error (chunk bs) i = Some (firstn k (skipn (i*k) bs)).
Admitted.

  Lemma length_chunk bs : length (chunk bs) = div_up (length bs) k.
Admitted.

  Lemma length_chunk_app (l l' : list A) :
    (length l mod k)%nat = 0%nat ->
    length (chunk (l ++ l')) = length (chunk l ++ chunk l').
Admitted.

  Lemma chunk_app : forall (l l': list A),
      (length l mod k = 0)%nat ->
      chunk (l ++ l') = chunk l ++ chunk l'.
  Proof.
    intros * Hmod.
    eapply nth_ext with (d := []) (d' := []); [ | intros idx ].
    - apply length_chunk_app; assumption.
    - intros Hidx; eassert (Some _ = Some _) as HS; [ | injection HS; intros Hs; apply Hs ].
      rewrite <- !nth_error_nth' by assumption.
      rewrite <- !nth_error_nth' by (rewrite length_chunk_app in Hidx; eassumption).
      assert (idx < length (chunk l) \/ length (chunk l) <= idx)%nat as [Hlt | Hge] by lia;
        [ rewrite nth_error_app1 | rewrite nth_error_app2 ]; try eassumption.
      all: rewrite !nth_error_chunk.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hlt by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hidx by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hge by assumption.
      all: rewrite ?length_chunk, ?app_length, ?div_up_add_mod by assumption.
      all: try lia.
      all: pose proof Nat.div_up_range (length l) k ltac:(lia).
      + pose proof div_up_exact_mod (length l) k ltac:(lia) ltac:(lia).
        rewrite !firstn_skipn_comm, !firstn_app.
        replace (idx * k + k - length l)%nat with 0%nat by nia.
        simpl; rewrite app_nil_r; reflexivity.
      + rewrite Nat.mul_sub_distr_r.
        erewrite div_up_exact_mod by lia.
        rewrite skipn_app, skipn_all2; [ reflexivity | nia ].
  Qed.
EOF

coqc -q bug.v

Copy link

coqbot-app bot commented Sep 11, 2024

Hey @JasonGross, the coq bug minimizer is running your script, I'll come back to you with the results once it's done.

Copy link

coqbot-app bot commented Sep 11, 2024

@JasonGross, Minimized File (full log on GitHub Actions)

🌟 Minimized Coq File (consider adding this file to the test-suite)
Require Coq.ZArith.ZArith.

Import Coq.micromega.Lia.
Import Coq.Arith.PeanoNat.
Import Coq.Lists.List.
Import ListNotations.

Module Import Nat.
  Definition div_up a b := Nat.div (a + (b-1)) b.
  Lemma div_up_range a b (H : b <> 0) : a <= div_up a b * b < a + b.
Admitted.

  Lemma div_up_add_mod a b n:
    (a mod n = 0)%nat ->
    Nat.div_up (a + b) n =
    (Nat.div_up a n + Nat.div_up b n)%nat.
Admitted.

  Lemma div_up_exact_mod a b:
    (b <> 0)%nat ->
    (a mod b = 0)%nat ->
    ((Nat.div_up a b) * b = a)%nat.
Admitted.

Section Chunk.
  Context [A : Type] (k : nat).
  Implicit Types (bs ck xs ys : list A).
Fixpoint chunk' bs ck {struct bs} : list (list A).
Admitted.
  Definition chunk bs := chunk' bs [].

  Context (Hk : k <> 0).

  Lemma nth_error_chunk bs i (Hi : i < div_up (length bs) k)
    : nth_error (chunk bs) i = Some (firstn k (skipn (i*k) bs)).
Admitted.

  Lemma length_chunk bs : length (chunk bs) = div_up (length bs) k.
Admitted.

  Lemma length_chunk_app (l l' : list A) :
    (length l mod k)%nat = 0%nat ->
    length (chunk (l ++ l')) = length (chunk l ++ chunk l').
Admitted.

  Lemma chunk_app : forall (l l': list A),
      (length l mod k = 0)%nat ->
      chunk (l ++ l') = chunk l ++ chunk l'.
  Proof.
    intros * Hmod.
    eapply nth_ext with (d := []) (d' := []); [ | intros idx ].
    - apply length_chunk_app; assumption.
    - intros Hidx; eassert (Some _ = Some _) as HS; [ | injection HS; intros Hs; apply Hs ].
      rewrite <- !nth_error_nth' by assumption.
      rewrite <- !nth_error_nth' by (rewrite length_chunk_app in Hidx; eassumption).
      assert (idx < length (chunk l) \/ length (chunk l) <= idx)%nat as [Hlt | Hge] by lia;
        [ rewrite nth_error_app1 | rewrite nth_error_app2 ]; try eassumption.
      all: rewrite !nth_error_chunk.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hlt by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hidx by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hge by assumption.
      all: rewrite ?length_chunk, ?app_length, ?div_up_add_mod by assumption.
      all: try lia.
      all: pose proof Nat.div_up_range (length l) k ltac:(lia).
      + pose proof div_up_exact_mod (length l) k ltac:(lia) ltac:(lia).
        rewrite !firstn_skipn_comm, !firstn_app.
        replace (idx * k + k - length l)%nat with 0%nat by nia.
        simpl; rewrite app_nil_r; reflexivity.
      + rewrite Nat.mul_sub_distr_r.
        erewrite div_up_exact_mod by lia.
        rewrite skipn_app, skipn_all2; [ reflexivity | nia ].
  Qed.
🛠️ Intermediate Coq File (useful for debugging if minimization did not go as far as you wanted)
🛠️ 📜 Intermediate Coq File log (useful for debugging if minimization did not go as far as you wanted)
📜 Build Log (contains the Coq error message) (truncated to last 8.0KiB; full 27KiB file on GitHub Actions Artifacts under build.log)
racters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
Error: The section Chunk and module Nat need to be closed.
📜 🔎 Minimization Log (truncated to last 8.0KiB; full 51KiB file on GitHub Actions Artifacts under bug.log)
ub/workspace/run-script.sh @ line 187) $�[0m dirname /home/coq/.opam/4.13.1+flambda/bin/coqc.orig
++ �[33;1m(/github/workspace/run-script.sh @ line 187) $�[0m cd /home/coq/.opam/4.13.1+flambda/bin
++ �[33;1m(/github/workspace/run-script.sh @ line 187) $�[0m readlink -f coq_makefile
+ �[33;1m(/github/workspace/run-script.sh @ line 187) $�[0m PASSING_COQ_MAKEFILE=/home/coq/.opam/4.13.1+flambda/bin/coq_makefile
+++ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m dirname /home/coq/.opam/4.13.1+flambda/bin/coqc.orig
++ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m cd /home/coq/.opam/4.13.1+flambda/bin
++ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m readlink -f coqdep
+ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m PASSING_COQDEP=/home/coq/.opam/4.13.1+flambda/bin/coqdep
+ �[33;1m(/github/workspace/run-script.sh @ line 190) $�[0m '[' /home/coq/.opam/4.13.1+flambda/bin/coqc.orig '!=' /home/coq/.opam/4.13.1+flambda/bin/coqc.orig ']'
+ �[33;1m(/github/workspace/run-script.sh @ line 195) $�[0m NONPASSING_PREFIX=
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m process_args '' ''
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m bash -c 'split_args_to_lines /home/coq/.opam/4.13.1+flambda/bin/coqc.orig -q bug.v '
++ �[33;1m(/github/workspace/run-script.sh @ line 63) $�[0m passing_prefix=
++ �[33;1m(/github/workspace/run-script.sh @ line 64) $�[0m prefixed_arg=--arg
++ �[33;1m(/github/workspace/run-script.sh @ line 65) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 69) $�[0m known_v_file=
++ �[33;1m(/github/workspace/run-script.sh @ line 70) $�[0m next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 71) $�[0m next_next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 72) $�[0m skip_next=no
++ �[33;1m(/github/workspace/run-script.sh @ line 73) $�[0m prev_load=
++ �[33;1m(/github/workspace/run-script.sh @ line 74) $�[0m found_known_v_file=no
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m tail -n +2
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' -q
process_args: processing (-q)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 101) $�[0m case "$i" in
++ �[33;1m(/github/workspace/run-script.sh @ line 133) $�[0m printf '%s=%s\n' --arg -q
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' bug.v
process_args: processing (bug.v)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m coqpath_to_args /github/workspace ''
++ �[33;1m(/github/workspace/run-script.sh @ line 142) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 143) $�[0m local IFS=:
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f ''
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f bug.v
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m '[' '' == /github/workspace/bug.v ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 99) $�[0m :
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
+ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m FAILING_ARGS=--arg=-q
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m process_args passing ''
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m bash -c 'split_args_to_lines /home/coq/.opam/4.13.1+flambda/bin/coqc.orig -q bug.v '
++ �[33;1m(/github/workspace/run-script.sh @ line 63) $�[0m passing_prefix=
++ �[33;1m(/github/workspace/run-script.sh @ line 64) $�[0m prefixed_arg=--arg
++ �[33;1m(/github/workspace/run-script.sh @ line 65) $�[0m '[' '!' -z passing ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 66) $�[0m passing_prefix=--passing
++ �[33;1m(/github/workspace/run-script.sh @ line 67) $�[0m prefixed_arg=--passing-arg
++ �[33;1m(/github/workspace/run-script.sh @ line 69) $�[0m known_v_file=
++ �[33;1m(/github/workspace/run-script.sh @ line 70) $�[0m next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 71) $�[0m next_next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 72) $�[0m skip_next=no
++ �[33;1m(/github/workspace/run-script.sh @ line 73) $�[0m prev_load=
++ �[33;1m(/github/workspace/run-script.sh @ line 74) $�[0m found_known_v_file=no
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m tail -n +2
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m sed 's,\(/github/workspace/builds/coq\)/coq-failing/,\1/coq-passing/,g'
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' -q
process_args: processing (-q)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 101) $�[0m case "$i" in
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m coqpath_to_args /github/workspace ''
++ �[33;1m(/github/workspace/run-script.sh @ line 142) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 143) $�[0m local IFS=:
++ �[33;1m(/github/workspace/run-script.sh @ line 133) $�[0m printf '%s=%s\n' --passing-arg -q
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' bug.v
process_args: processing (bug.v)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ bug.v == *\.\v ]]
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f ''
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f bug.v
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m '[' '' == /github/workspace/bug.v ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 99) $�[0m :
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
+ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m PASSING_ARGS=--passing-arg=-q
++ �[33;1m(/github/workspace/run-script.sh @ line 200) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 200) $�[0m readlink -f ''
+ �[33;1m(/github/workspace/run-script.sh @ line 200) $�[0m ABS_FILE=

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.

Copy link

coqbot-app bot commented Sep 11, 2024

@JasonGross, Minimized File (full log on GitHub Actions)

🌟 Minimized Coq File (consider adding this file to the test-suite)
Require Coq.ZArith.ZArith.

Import Coq.micromega.Lia.
Import Coq.Arith.PeanoNat.
Import Coq.Lists.List.
Import ListNotations.

Module Import Nat.
  Definition div_up a b := Nat.div (a + (b-1)) b.
  Lemma div_up_range a b (H : b <> 0) : a <= div_up a b * b < a + b.
Admitted.

  Lemma div_up_add_mod a b n:
    (a mod n = 0)%nat ->
    Nat.div_up (a + b) n =
    (Nat.div_up a n + Nat.div_up b n)%nat.
Admitted.

  Lemma div_up_exact_mod a b:
    (b <> 0)%nat ->
    (a mod b = 0)%nat ->
    ((Nat.div_up a b) * b = a)%nat.
Admitted.

Section Chunk.
  Context [A : Type] (k : nat).
  Implicit Types (bs ck xs ys : list A).
Fixpoint chunk' bs ck {struct bs} : list (list A).
Admitted.
  Definition chunk bs := chunk' bs [].

  Context (Hk : k <> 0).

  Lemma nth_error_chunk bs i (Hi : i < div_up (length bs) k)
    : nth_error (chunk bs) i = Some (firstn k (skipn (i*k) bs)).
Admitted.

  Lemma length_chunk bs : length (chunk bs) = div_up (length bs) k.
Admitted.

  Lemma length_chunk_app (l l' : list A) :
    (length l mod k)%nat = 0%nat ->
    length (chunk (l ++ l')) = length (chunk l ++ chunk l').
Admitted.

  Lemma chunk_app : forall (l l': list A),
      (length l mod k = 0)%nat ->
      chunk (l ++ l') = chunk l ++ chunk l'.
  Proof.
    intros * Hmod.
    eapply nth_ext with (d := []) (d' := []); [ | intros idx ].
    - apply length_chunk_app; assumption.
    - intros Hidx; eassert (Some _ = Some _) as HS; [ | injection HS; intros Hs; apply Hs ].
      rewrite <- !nth_error_nth' by assumption.
      rewrite <- !nth_error_nth' by (rewrite length_chunk_app in Hidx; eassumption).
      assert (idx < length (chunk l) \/ length (chunk l) <= idx)%nat as [Hlt | Hge] by lia;
        [ rewrite nth_error_app1 | rewrite nth_error_app2 ]; try eassumption.
      all: rewrite !nth_error_chunk.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hlt by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hidx by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hge by assumption.
      all: rewrite ?length_chunk, ?app_length, ?div_up_add_mod by assumption.
      all: try lia.
      all: pose proof Nat.div_up_range (length l) k ltac:(lia).
      + pose proof div_up_exact_mod (length l) k ltac:(lia) ltac:(lia).
        rewrite !firstn_skipn_comm, !firstn_app.
        replace (idx * k + k - length l)%nat with 0%nat by nia.
        simpl; rewrite app_nil_r; reflexivity.
      + rewrite Nat.mul_sub_distr_r.
        erewrite div_up_exact_mod by lia.
        rewrite skipn_app, skipn_all2; [ reflexivity | nia ].
  Qed.
🛠️ Intermediate Coq File (useful for debugging if minimization did not go as far as you wanted)
🛠️ 📜 Intermediate Coq File log (useful for debugging if minimization did not go as far as you wanted)
📜 Build Log (contains the Coq error message) (truncated to last 8.0KiB; full 27KiB file on GitHub Actions Artifacts under build.log)
racters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
Error: The section Chunk and module Nat need to be closed.
📜 🔎 Minimization Log (truncated to last 8.0KiB; full 51KiB file on GitHub Actions Artifacts under bug.log)
ub/workspace/run-script.sh @ line 187) $�[0m dirname /home/coq/.opam/4.13.1+flambda/bin/coqc.orig
++ �[33;1m(/github/workspace/run-script.sh @ line 187) $�[0m cd /home/coq/.opam/4.13.1+flambda/bin
++ �[33;1m(/github/workspace/run-script.sh @ line 187) $�[0m readlink -f coq_makefile
+ �[33;1m(/github/workspace/run-script.sh @ line 187) $�[0m PASSING_COQ_MAKEFILE=/home/coq/.opam/4.13.1+flambda/bin/coq_makefile
+++ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m dirname /home/coq/.opam/4.13.1+flambda/bin/coqc.orig
++ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m cd /home/coq/.opam/4.13.1+flambda/bin
++ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m readlink -f coqdep
+ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m PASSING_COQDEP=/home/coq/.opam/4.13.1+flambda/bin/coqdep
+ �[33;1m(/github/workspace/run-script.sh @ line 190) $�[0m '[' /home/coq/.opam/4.13.1+flambda/bin/coqc.orig '!=' /home/coq/.opam/4.13.1+flambda/bin/coqc.orig ']'
+ �[33;1m(/github/workspace/run-script.sh @ line 195) $�[0m NONPASSING_PREFIX=
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m process_args '' ''
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m bash -c 'split_args_to_lines /home/coq/.opam/4.13.1+flambda/bin/coqc.orig -q bug.v '
++ �[33;1m(/github/workspace/run-script.sh @ line 63) $�[0m passing_prefix=
++ �[33;1m(/github/workspace/run-script.sh @ line 64) $�[0m prefixed_arg=--arg
++ �[33;1m(/github/workspace/run-script.sh @ line 65) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 69) $�[0m known_v_file=
++ �[33;1m(/github/workspace/run-script.sh @ line 70) $�[0m next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 71) $�[0m next_next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 72) $�[0m skip_next=no
++ �[33;1m(/github/workspace/run-script.sh @ line 73) $�[0m prev_load=
++ �[33;1m(/github/workspace/run-script.sh @ line 74) $�[0m found_known_v_file=no
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m tail -n +2
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' -q
process_args: processing (-q)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 101) $�[0m case "$i" in
++ �[33;1m(/github/workspace/run-script.sh @ line 133) $�[0m printf '%s=%s\n' --arg -q
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' bug.v
process_args: processing (bug.v)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m coqpath_to_args /github/workspace ''
++ �[33;1m(/github/workspace/run-script.sh @ line 142) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 143) $�[0m local IFS=:
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f ''
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f bug.v
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m '[' '' == /github/workspace/bug.v ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 99) $�[0m :
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
+ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m FAILING_ARGS=--arg=-q
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m process_args passing ''
++ �[33;1m(/github/workspace/run-script.sh @ line 63) $�[0m passing_prefix=
++ �[33;1m(/github/workspace/run-script.sh @ line 64) $�[0m prefixed_arg=--arg
++ �[33;1m(/github/workspace/run-script.sh @ line 65) $�[0m '[' '!' -z passing ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 66) $�[0m passing_prefix=--passing
++ �[33;1m(/github/workspace/run-script.sh @ line 67) $�[0m prefixed_arg=--passing-arg
++ �[33;1m(/github/workspace/run-script.sh @ line 69) $�[0m known_v_file=
++ �[33;1m(/github/workspace/run-script.sh @ line 70) $�[0m next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 71) $�[0m next_next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 72) $�[0m skip_next=no
++ �[33;1m(/github/workspace/run-script.sh @ line 73) $�[0m prev_load=
++ �[33;1m(/github/workspace/run-script.sh @ line 74) $�[0m found_known_v_file=no
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m bash -c 'split_args_to_lines /home/coq/.opam/4.13.1+flambda/bin/coqc.orig -q bug.v '
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m tail -n +2
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m sed 's,\(/github/workspace/builds/coq\)/coq-failing/,\1/coq-passing/,g'
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' -q
process_args: processing (-q)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 101) $�[0m case "$i" in
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m coqpath_to_args /github/workspace ''
++ �[33;1m(/github/workspace/run-script.sh @ line 142) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 143) $�[0m local IFS=:
++ �[33;1m(/github/workspace/run-script.sh @ line 133) $�[0m printf '%s=%s\n' --passing-arg -q
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' bug.v
process_args: processing (bug.v)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ bug.v == *\.\v ]]
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f ''
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f bug.v
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m '[' '' == /github/workspace/bug.v ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 99) $�[0m :
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
+ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m PASSING_ARGS=--passing-arg=-q
++ �[33;1m(/github/workspace/run-script.sh @ line 200) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 200) $�[0m readlink -f ''
+ �[33;1m(/github/workspace/run-script.sh @ line 200) $�[0m ABS_FILE=

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.

@JasonGross
Copy link
Owner Author

@coqbot minimize coq.dev

#!/usr/bin/env bash

true | coqtop
coqc --version
opam pin remove coq -y
opam pin add coq 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y -k git
true | coqtop
coqc --version

cat <<EOF > bug.v
Require Coq.ZArith.ZArith.

Import Coq.micromega.Lia.
Import Coq.Arith.PeanoNat.
Import Coq.Lists.List.
Import ListNotations.

Module Import Nat.
  Definition div_up a b := Nat.div (a + (b-1)) b.
  Lemma div_up_range a b (H : b <> 0) : a <= div_up a b * b < a + b.
Admitted.

  Lemma div_up_add_mod a b n:
    (a mod n = 0)%nat ->
    Nat.div_up (a + b) n =
    (Nat.div_up a n + Nat.div_up b n)%nat.
Admitted.

  Lemma div_up_exact_mod a b:
    (b <> 0)%nat ->
    (a mod b = 0)%nat ->
    ((Nat.div_up a b) * b = a)%nat.
Admitted.

Section Chunk.
  Context [A : Type] (k : nat).
  Implicit Types (bs ck xs ys : list A).
Fixpoint chunk' bs ck {struct bs} : list (list A).
Admitted.
  Definition chunk bs := chunk' bs [].

  Context (Hk : k <> 0).

  Lemma nth_error_chunk bs i (Hi : i < div_up (length bs) k)
    : nth_error (chunk bs) i = Some (firstn k (skipn (i*k) bs)).
Admitted.

  Lemma length_chunk bs : length (chunk bs) = div_up (length bs) k.
Admitted.

  Lemma length_chunk_app (l l' : list A) :
    (length l mod k)%nat = 0%nat ->
    length (chunk (l ++ l')) = length (chunk l ++ chunk l').
Admitted.

  Lemma chunk_app : forall (l l': list A),
      (length l mod k = 0)%nat ->
      chunk (l ++ l') = chunk l ++ chunk l'.
  Proof.
    intros * Hmod.
    eapply nth_ext with (d := []) (d' := []); [ | intros idx ].
    - apply length_chunk_app; assumption.
    - intros Hidx; eassert (Some _ = Some _) as HS; [ | injection HS; intros Hs; apply Hs ].
      rewrite <- !nth_error_nth' by assumption.
      rewrite <- !nth_error_nth' by (rewrite length_chunk_app in Hidx; eassumption).
      assert (idx < length (chunk l) \/ length (chunk l) <= idx)%nat as [Hlt | Hge] by lia;
        [ rewrite nth_error_app1 | rewrite nth_error_app2 ]; try eassumption.
      all: rewrite !nth_error_chunk.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hlt by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hidx by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hge by assumption.
      all: rewrite ?length_chunk, ?app_length, ?div_up_add_mod by assumption.
      all: try lia.
      all: pose proof Nat.div_up_range (length l) k ltac:(lia).
      + pose proof div_up_exact_mod (length l) k ltac:(lia) ltac:(lia).
        rewrite !firstn_skipn_comm, !firstn_app.
        replace (idx * k + k - length l)%nat with 0%nat by nia.
        simpl; rewrite app_nil_r; reflexivity.
      + rewrite Nat.mul_sub_distr_r.
        erewrite div_up_exact_mod by lia.
        rewrite skipn_app, skipn_all2; [ reflexivity | nia ].
  Qed.
EOF

coqc -q bug.v

Copy link

coqbot-app bot commented Sep 11, 2024

Hey @JasonGross, the coq bug minimizer is running your script, I'll come back to you with the results once it's done.

Copy link

coqbot-app bot commented Sep 11, 2024

@JasonGross, Minimized File (full log on GitHub Actions)

🌟 Minimized Coq File (consider adding this file to the test-suite)
Require Coq.ZArith.ZArith.

Import Coq.micromega.Lia.
Import Coq.Arith.PeanoNat.
Import Coq.Lists.List.
Import ListNotations.

Module Import Nat.
  Definition div_up a b := Nat.div (a + (b-1)) b.
  Lemma div_up_range a b (H : b <> 0) : a <= div_up a b * b < a + b.
Admitted.

  Lemma div_up_add_mod a b n:
    (a mod n = 0)%nat ->
    Nat.div_up (a + b) n =
    (Nat.div_up a n + Nat.div_up b n)%nat.
Admitted.

  Lemma div_up_exact_mod a b:
    (b <> 0)%nat ->
    (a mod b = 0)%nat ->
    ((Nat.div_up a b) * b = a)%nat.
Admitted.

Section Chunk.
  Context [A : Type] (k : nat).
  Implicit Types (bs ck xs ys : list A).
Fixpoint chunk' bs ck {struct bs} : list (list A).
Admitted.
  Definition chunk bs := chunk' bs [].

  Context (Hk : k <> 0).

  Lemma nth_error_chunk bs i (Hi : i < div_up (length bs) k)
    : nth_error (chunk bs) i = Some (firstn k (skipn (i*k) bs)).
Admitted.

  Lemma length_chunk bs : length (chunk bs) = div_up (length bs) k.
Admitted.

  Lemma length_chunk_app (l l' : list A) :
    (length l mod k)%nat = 0%nat ->
    length (chunk (l ++ l')) = length (chunk l ++ chunk l').
Admitted.

  Lemma chunk_app : forall (l l': list A),
      (length l mod k = 0)%nat ->
      chunk (l ++ l') = chunk l ++ chunk l'.
  Proof.
    intros * Hmod.
    eapply nth_ext with (d := []) (d' := []); [ | intros idx ].
    - apply length_chunk_app; assumption.
    - intros Hidx; eassert (Some _ = Some _) as HS; [ | injection HS; intros Hs; apply Hs ].
      rewrite <- !nth_error_nth' by assumption.
      rewrite <- !nth_error_nth' by (rewrite length_chunk_app in Hidx; eassumption).
      assert (idx < length (chunk l) \/ length (chunk l) <= idx)%nat as [Hlt | Hge] by lia;
        [ rewrite nth_error_app1 | rewrite nth_error_app2 ]; try eassumption.
      all: rewrite !nth_error_chunk.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hlt by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hidx by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hge by assumption.
      all: rewrite ?length_chunk, ?app_length, ?div_up_add_mod by assumption.
      all: try lia.
      all: pose proof Nat.div_up_range (length l) k ltac:(lia).
      + pose proof div_up_exact_mod (length l) k ltac:(lia) ltac:(lia).
        rewrite !firstn_skipn_comm, !firstn_app.
        replace (idx * k + k - length l)%nat with 0%nat by nia.
        simpl; rewrite app_nil_r; reflexivity.
      + rewrite Nat.mul_sub_distr_r.
        erewrite div_up_exact_mod by lia.
        rewrite skipn_app, skipn_all2; [ reflexivity | nia ].
  Qed.
🛠️ Intermediate Coq File (useful for debugging if minimization did not go as far as you wanted)
🛠️ 📜 Intermediate Coq File log (useful for debugging if minimization did not go as far as you wanted)
📜 Build Log (contains the Coq error message) (truncated to last 8.0KiB; full 27KiB file on GitHub Actions Artifacts under build.log)
racters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
Error: The section Chunk and module Nat need to be closed.
📜 🔎 Minimization Log (truncated to last 8.0KiB; full 51KiB file on GitHub Actions Artifacts under bug.log)
ub/workspace/run-script.sh @ line 187) $�[0m dirname /home/coq/.opam/4.13.1+flambda/bin/coqc.orig
++ �[33;1m(/github/workspace/run-script.sh @ line 187) $�[0m cd /home/coq/.opam/4.13.1+flambda/bin
++ �[33;1m(/github/workspace/run-script.sh @ line 187) $�[0m readlink -f coq_makefile
+ �[33;1m(/github/workspace/run-script.sh @ line 187) $�[0m PASSING_COQ_MAKEFILE=/home/coq/.opam/4.13.1+flambda/bin/coq_makefile
+++ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m dirname /home/coq/.opam/4.13.1+flambda/bin/coqc.orig
++ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m cd /home/coq/.opam/4.13.1+flambda/bin
++ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m readlink -f coqdep
+ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m PASSING_COQDEP=/home/coq/.opam/4.13.1+flambda/bin/coqdep
+ �[33;1m(/github/workspace/run-script.sh @ line 190) $�[0m '[' /home/coq/.opam/4.13.1+flambda/bin/coqc.orig '!=' /home/coq/.opam/4.13.1+flambda/bin/coqc.orig ']'
+ �[33;1m(/github/workspace/run-script.sh @ line 195) $�[0m NONPASSING_PREFIX=
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m process_args '' ''
++ �[33;1m(/github/workspace/run-script.sh @ line 63) $�[0m passing_prefix=
++ �[33;1m(/github/workspace/run-script.sh @ line 64) $�[0m prefixed_arg=--arg
++ �[33;1m(/github/workspace/run-script.sh @ line 65) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 69) $�[0m known_v_file=
++ �[33;1m(/github/workspace/run-script.sh @ line 70) $�[0m next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 71) $�[0m next_next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 72) $�[0m skip_next=no
++ �[33;1m(/github/workspace/run-script.sh @ line 73) $�[0m prev_load=
++ �[33;1m(/github/workspace/run-script.sh @ line 74) $�[0m found_known_v_file=no
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m bash -c 'split_args_to_lines /home/coq/.opam/4.13.1+flambda/bin/coqc.orig -q bug.v '
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m tail -n +2
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' -q
process_args: processing (-q)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 101) $�[0m case "$i" in
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m coqpath_to_args /github/workspace ''
++ �[33;1m(/github/workspace/run-script.sh @ line 133) $�[0m printf '%s=%s\n' --arg -q
++ �[33;1m(/github/workspace/run-script.sh @ line 142) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 143) $�[0m local IFS=:
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' bug.v
process_args: processing (bug.v)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ bug.v == *\.\v ]]
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f ''
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f bug.v
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m '[' '' == /github/workspace/bug.v ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 99) $�[0m :
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
+ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m FAILING_ARGS=--arg=-q
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m process_args passing ''
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m bash -c 'split_args_to_lines /home/coq/.opam/4.13.1+flambda/bin/coqc.orig -q bug.v '
++ �[33;1m(/github/workspace/run-script.sh @ line 63) $�[0m passing_prefix=
++ �[33;1m(/github/workspace/run-script.sh @ line 64) $�[0m prefixed_arg=--arg
++ �[33;1m(/github/workspace/run-script.sh @ line 65) $�[0m '[' '!' -z passing ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 66) $�[0m passing_prefix=--passing
++ �[33;1m(/github/workspace/run-script.sh @ line 67) $�[0m prefixed_arg=--passing-arg
++ �[33;1m(/github/workspace/run-script.sh @ line 69) $�[0m known_v_file=
++ �[33;1m(/github/workspace/run-script.sh @ line 70) $�[0m next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 71) $�[0m next_next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 72) $�[0m skip_next=no
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m tail -n +2
++ �[33;1m(/github/workspace/run-script.sh @ line 73) $�[0m prev_load=
++ �[33;1m(/github/workspace/run-script.sh @ line 74) $�[0m found_known_v_file=no
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m sed 's,\(/github/workspace/builds/coq\)/coq-failing/,\1/coq-passing/,g'
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' -q
process_args: processing (-q)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 101) $�[0m case "$i" in
++ �[33;1m(/github/workspace/run-script.sh @ line 133) $�[0m printf '%s=%s\n' --passing-arg -q
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' bug.v
process_args: processing (bug.v)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m coqpath_to_args /github/workspace ''
++ �[33;1m(/github/workspace/run-script.sh @ line 142) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 143) $�[0m local IFS=:
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f ''
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f bug.v
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m '[' '' == /github/workspace/bug.v ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 99) $�[0m :
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
+ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m PASSING_ARGS=--passing-arg=-q
++ �[33;1m(/github/workspace/run-script.sh @ line 200) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 200) $�[0m readlink -f ''
+ �[33;1m(/github/workspace/run-script.sh @ line 200) $�[0m ABS_FILE=

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.

@JasonGross
Copy link
Owner Author

@coqbot minimize coq.dev

#!/usr/bin/env bash

true | coqtop
coqc --version
opam pin remove coq -y --no-action
opam pin add coq 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' --no-action
opam pin add coq-core 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon:coq-core.opam' --no-action
opam pin add coq-stdlib 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon:coq-stdlib.opam' --no-action
opam install coq coq-core coq-stdlib --reinstall
true | coqtop
coqc --version

cat <<EOF > bug.v
Require Coq.ZArith.ZArith.

Import Coq.micromega.Lia.
Import Coq.Arith.PeanoNat.
Import Coq.Lists.List.
Import ListNotations.

Module Import Nat.
  Definition div_up a b := Nat.div (a + (b-1)) b.
  Lemma div_up_range a b (H : b <> 0) : a <= div_up a b * b < a + b.
Admitted.

  Lemma div_up_add_mod a b n:
    (a mod n = 0)%nat ->
    Nat.div_up (a + b) n =
    (Nat.div_up a n + Nat.div_up b n)%nat.
Admitted.

  Lemma div_up_exact_mod a b:
    (b <> 0)%nat ->
    (a mod b = 0)%nat ->
    ((Nat.div_up a b) * b = a)%nat.
Admitted.

Section Chunk.
  Context [A : Type] (k : nat).
  Implicit Types (bs ck xs ys : list A).
Fixpoint chunk' bs ck {struct bs} : list (list A).
Admitted.
  Definition chunk bs := chunk' bs [].

  Context (Hk : k <> 0).

  Lemma nth_error_chunk bs i (Hi : i < div_up (length bs) k)
    : nth_error (chunk bs) i = Some (firstn k (skipn (i*k) bs)).
Admitted.

  Lemma length_chunk bs : length (chunk bs) = div_up (length bs) k.
Admitted.

  Lemma length_chunk_app (l l' : list A) :
    (length l mod k)%nat = 0%nat ->
    length (chunk (l ++ l')) = length (chunk l ++ chunk l').
Admitted.

  Lemma chunk_app : forall (l l': list A),
      (length l mod k = 0)%nat ->
      chunk (l ++ l') = chunk l ++ chunk l'.
  Proof.
    intros * Hmod.
    eapply nth_ext with (d := []) (d' := []); [ | intros idx ].
    - apply length_chunk_app; assumption.
    - intros Hidx; eassert (Some _ = Some _) as HS; [ | injection HS; intros Hs; apply Hs ].
      rewrite <- !nth_error_nth' by assumption.
      rewrite <- !nth_error_nth' by (rewrite length_chunk_app in Hidx; eassumption).
      assert (idx < length (chunk l) \/ length (chunk l) <= idx)%nat as [Hlt | Hge] by lia;
        [ rewrite nth_error_app1 | rewrite nth_error_app2 ]; try eassumption.
      all: rewrite !nth_error_chunk.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hlt by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hidx by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hge by assumption.
      all: rewrite ?length_chunk, ?app_length, ?div_up_add_mod by assumption.
      all: try lia.
      all: pose proof Nat.div_up_range (length l) k ltac:(lia).
      + pose proof div_up_exact_mod (length l) k ltac:(lia) ltac:(lia).
        rewrite !firstn_skipn_comm, !firstn_app.
        replace (idx * k + k - length l)%nat with 0%nat by nia.
        simpl; rewrite app_nil_r; reflexivity.
      + rewrite Nat.mul_sub_distr_r.
        erewrite div_up_exact_mod by lia.
        rewrite skipn_app, skipn_all2; [ reflexivity | nia ].
  Qed.
EOF

coqc -q bug.v

Copy link

coqbot-app bot commented Sep 11, 2024

Hey @JasonGross, the coq bug minimizer is running your script, I'll come back to you with the results once it's done.

Copy link

coqbot-app bot commented Sep 11, 2024

@JasonGross, Minimized File (full log on GitHub Actions)

🌟 Minimized Coq File (consider adding this file to the test-suite)
Require Coq.ZArith.ZArith.

Import Coq.micromega.Lia.
Import Coq.Arith.PeanoNat.
Import Coq.Lists.List.
Import ListNotations.

Module Import Nat.
  Definition div_up a b := Nat.div (a + (b-1)) b.
  Lemma div_up_range a b (H : b <> 0) : a <= div_up a b * b < a + b.
Admitted.

  Lemma div_up_add_mod a b n:
    (a mod n = 0)%nat ->
    Nat.div_up (a + b) n =
    (Nat.div_up a n + Nat.div_up b n)%nat.
Admitted.

  Lemma div_up_exact_mod a b:
    (b <> 0)%nat ->
    (a mod b = 0)%nat ->
    ((Nat.div_up a b) * b = a)%nat.
Admitted.

Section Chunk.
  Context [A : Type] (k : nat).
  Implicit Types (bs ck xs ys : list A).
Fixpoint chunk' bs ck {struct bs} : list (list A).
Admitted.
  Definition chunk bs := chunk' bs [].

  Context (Hk : k <> 0).

  Lemma nth_error_chunk bs i (Hi : i < div_up (length bs) k)
    : nth_error (chunk bs) i = Some (firstn k (skipn (i*k) bs)).
Admitted.

  Lemma length_chunk bs : length (chunk bs) = div_up (length bs) k.
Admitted.

  Lemma length_chunk_app (l l' : list A) :
    (length l mod k)%nat = 0%nat ->
    length (chunk (l ++ l')) = length (chunk l ++ chunk l').
Admitted.

  Lemma chunk_app : forall (l l': list A),
      (length l mod k = 0)%nat ->
      chunk (l ++ l') = chunk l ++ chunk l'.
  Proof.
    intros * Hmod.
    eapply nth_ext with (d := []) (d' := []); [ | intros idx ].
    - apply length_chunk_app; assumption.
    - intros Hidx; eassert (Some _ = Some _) as HS; [ | injection HS; intros Hs; apply Hs ].
      rewrite <- !nth_error_nth' by assumption.
      rewrite <- !nth_error_nth' by (rewrite length_chunk_app in Hidx; eassumption).
      assert (idx < length (chunk l) \/ length (chunk l) <= idx)%nat as [Hlt | Hge] by lia;
        [ rewrite nth_error_app1 | rewrite nth_error_app2 ]; try eassumption.
      all: rewrite !nth_error_chunk.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hlt by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hidx by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hge by assumption.
      all: rewrite ?length_chunk, ?app_length, ?div_up_add_mod by assumption.
      all: try lia.
      all: pose proof Nat.div_up_range (length l) k ltac:(lia).
      + pose proof div_up_exact_mod (length l) k ltac:(lia) ltac:(lia).
        rewrite !firstn_skipn_comm, !firstn_app.
        replace (idx * k + k - length l)%nat with 0%nat by nia.
        simpl; rewrite app_nil_r; reflexivity.
      + rewrite Nat.mul_sub_distr_r.
        erewrite div_up_exact_mod by lia.
        rewrite skipn_app, skipn_all2; [ reflexivity | nia ].
  Qed.
🛠️ Intermediate Coq File (useful for debugging if minimization did not go as far as you wanted)
🛠️ 📜 Intermediate Coq File log (useful for debugging if minimization did not go as far as you wanted)
📜 Build Log (contains the Coq error message) (truncated to last 8.0KiB; full 28KiB file on GitHub Actions Artifacts under build.log)
racters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
Error: The section Chunk and module Nat need to be closed.
📜 🔎 Minimization Log (truncated to last 8.0KiB; full 52KiB file on GitHub Actions Artifacts under bug.log)
ub/workspace/run-script.sh @ line 187) $�[0m dirname /home/coq/.opam/4.13.1+flambda/bin/coqc.orig
++ �[33;1m(/github/workspace/run-script.sh @ line 187) $�[0m cd /home/coq/.opam/4.13.1+flambda/bin
++ �[33;1m(/github/workspace/run-script.sh @ line 187) $�[0m readlink -f coq_makefile
+ �[33;1m(/github/workspace/run-script.sh @ line 187) $�[0m PASSING_COQ_MAKEFILE=/home/coq/.opam/4.13.1+flambda/bin/coq_makefile
+++ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m dirname /home/coq/.opam/4.13.1+flambda/bin/coqc.orig
++ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m cd /home/coq/.opam/4.13.1+flambda/bin
++ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m readlink -f coqdep
+ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m PASSING_COQDEP=/home/coq/.opam/4.13.1+flambda/bin/coqdep
+ �[33;1m(/github/workspace/run-script.sh @ line 190) $�[0m '[' /home/coq/.opam/4.13.1+flambda/bin/coqc.orig '!=' /home/coq/.opam/4.13.1+flambda/bin/coqc.orig ']'
+ �[33;1m(/github/workspace/run-script.sh @ line 195) $�[0m NONPASSING_PREFIX=
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m process_args '' ''
++ �[33;1m(/github/workspace/run-script.sh @ line 63) $�[0m passing_prefix=
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m bash -c 'split_args_to_lines /home/coq/.opam/4.13.1+flambda/bin/coqc.orig -q bug.v '
++ �[33;1m(/github/workspace/run-script.sh @ line 64) $�[0m prefixed_arg=--arg
++ �[33;1m(/github/workspace/run-script.sh @ line 65) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 69) $�[0m known_v_file=
++ �[33;1m(/github/workspace/run-script.sh @ line 70) $�[0m next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 71) $�[0m next_next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 72) $�[0m skip_next=no
++ �[33;1m(/github/workspace/run-script.sh @ line 73) $�[0m prev_load=
++ �[33;1m(/github/workspace/run-script.sh @ line 74) $�[0m found_known_v_file=no
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m tail -n +2
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' -q
process_args: processing (-q)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m coqpath_to_args /github/workspace ''
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 101) $�[0m case "$i" in
++ �[33;1m(/github/workspace/run-script.sh @ line 133) $�[0m printf '%s=%s\n' --arg -q
++ �[33;1m(/github/workspace/run-script.sh @ line 142) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 143) $�[0m local IFS=:
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' bug.v
process_args: processing (bug.v)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ bug.v == *\.\v ]]
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f ''
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f bug.v
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m '[' '' == /github/workspace/bug.v ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 99) $�[0m :
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
+ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m FAILING_ARGS=--arg=-q
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m process_args passing ''
++ �[33;1m(/github/workspace/run-script.sh @ line 63) $�[0m passing_prefix=
++ �[33;1m(/github/workspace/run-script.sh @ line 64) $�[0m prefixed_arg=--arg
++ �[33;1m(/github/workspace/run-script.sh @ line 65) $�[0m '[' '!' -z passing ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m bash -c 'split_args_to_lines /home/coq/.opam/4.13.1+flambda/bin/coqc.orig -q bug.v '
++ �[33;1m(/github/workspace/run-script.sh @ line 66) $�[0m passing_prefix=--passing
++ �[33;1m(/github/workspace/run-script.sh @ line 67) $�[0m prefixed_arg=--passing-arg
++ �[33;1m(/github/workspace/run-script.sh @ line 69) $�[0m known_v_file=
++ �[33;1m(/github/workspace/run-script.sh @ line 70) $�[0m next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 71) $�[0m next_next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 72) $�[0m skip_next=no
++ �[33;1m(/github/workspace/run-script.sh @ line 73) $�[0m prev_load=
++ �[33;1m(/github/workspace/run-script.sh @ line 74) $�[0m found_known_v_file=no
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m sed 's,\(/github/workspace/builds/coq\)/coq-failing/,\1/coq-passing/,g'
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m tail -n +2
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' -q
process_args: processing (-q)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 101) $�[0m case "$i" in
++ �[33;1m(/github/workspace/run-script.sh @ line 133) $�[0m printf '%s=%s\n' --passing-arg -q
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' bug.v
process_args: processing (bug.v)
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m coqpath_to_args /github/workspace ''
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 142) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 143) $�[0m local IFS=:
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f ''
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f bug.v
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m '[' '' == /github/workspace/bug.v ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 99) $�[0m :
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
+ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m PASSING_ARGS=--passing-arg=-q
++ �[33;1m(/github/workspace/run-script.sh @ line 200) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 200) $�[0m readlink -f ''
+ �[33;1m(/github/workspace/run-script.sh @ line 200) $�[0m ABS_FILE=

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.

@JasonGross
Copy link
Owner Author

@coqbot minimize coq.dev

#!/usr/bin/env bash

true | coqtop
coqc --version
opam pin remove coq -y --no-action
opam pin add 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon'
true | coqtop
coqc --version

cat <<EOF > bug.v
Require Coq.ZArith.ZArith.

Import Coq.micromega.Lia.
Import Coq.Arith.PeanoNat.
Import Coq.Lists.List.
Import ListNotations.

Module Import Nat.
  Definition div_up a b := Nat.div (a + (b-1)) b.
  Lemma div_up_range a b (H : b <> 0) : a <= div_up a b * b < a + b.
Admitted.

  Lemma div_up_add_mod a b n:
    (a mod n = 0)%nat ->
    Nat.div_up (a + b) n =
    (Nat.div_up a n + Nat.div_up b n)%nat.
Admitted.

  Lemma div_up_exact_mod a b:
    (b <> 0)%nat ->
    (a mod b = 0)%nat ->
    ((Nat.div_up a b) * b = a)%nat.
Admitted.

Section Chunk.
  Context [A : Type] (k : nat).
  Implicit Types (bs ck xs ys : list A).
Fixpoint chunk' bs ck {struct bs} : list (list A).
Admitted.
  Definition chunk bs := chunk' bs [].

  Context (Hk : k <> 0).

  Lemma nth_error_chunk bs i (Hi : i < div_up (length bs) k)
    : nth_error (chunk bs) i = Some (firstn k (skipn (i*k) bs)).
Admitted.

  Lemma length_chunk bs : length (chunk bs) = div_up (length bs) k.
Admitted.

  Lemma length_chunk_app (l l' : list A) :
    (length l mod k)%nat = 0%nat ->
    length (chunk (l ++ l')) = length (chunk l ++ chunk l').
Admitted.

  Lemma chunk_app : forall (l l': list A),
      (length l mod k = 0)%nat ->
      chunk (l ++ l') = chunk l ++ chunk l'.
  Proof.
    intros * Hmod.
    eapply nth_ext with (d := []) (d' := []); [ | intros idx ].
    - apply length_chunk_app; assumption.
    - intros Hidx; eassert (Some _ = Some _) as HS; [ | injection HS; intros Hs; apply Hs ].
      rewrite <- !nth_error_nth' by assumption.
      rewrite <- !nth_error_nth' by (rewrite length_chunk_app in Hidx; eassumption).
      assert (idx < length (chunk l) \/ length (chunk l) <= idx)%nat as [Hlt | Hge] by lia;
        [ rewrite nth_error_app1 | rewrite nth_error_app2 ]; try eassumption.
      all: rewrite !nth_error_chunk.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hlt by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hidx by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hge by assumption.
      all: rewrite ?length_chunk, ?app_length, ?div_up_add_mod by assumption.
      all: try lia.
      all: pose proof Nat.div_up_range (length l) k ltac:(lia).
      + pose proof div_up_exact_mod (length l) k ltac:(lia) ltac:(lia).
        rewrite !firstn_skipn_comm, !firstn_app.
        replace (idx * k + k - length l)%nat with 0%nat by nia.
        simpl; rewrite app_nil_r; reflexivity.
      + rewrite Nat.mul_sub_distr_r.
        erewrite div_up_exact_mod by lia.
        rewrite skipn_app, skipn_all2; [ reflexivity | nia ].
  Qed.
EOF

coqc -q bug.v

Copy link

coqbot-app bot commented Sep 11, 2024

Hey @JasonGross, the coq bug minimizer is running your script, I'll come back to you with the results once it's done.

Copy link

coqbot-app bot commented Sep 11, 2024

@JasonGross, Minimized File (full log on GitHub Actions)

🌟 Minimized Coq File (consider adding this file to the test-suite)
Require Coq.ZArith.ZArith.

Import Coq.micromega.Lia.
Import Coq.Arith.PeanoNat.
Import Coq.Lists.List.
Import ListNotations.

Module Import Nat.
  Definition div_up a b := Nat.div (a + (b-1)) b.
  Lemma div_up_range a b (H : b <> 0) : a <= div_up a b * b < a + b.
Admitted.

  Lemma div_up_add_mod a b n:
    (a mod n = 0)%nat ->
    Nat.div_up (a + b) n =
    (Nat.div_up a n + Nat.div_up b n)%nat.
Admitted.

  Lemma div_up_exact_mod a b:
    (b <> 0)%nat ->
    (a mod b = 0)%nat ->
    ((Nat.div_up a b) * b = a)%nat.
Admitted.

Section Chunk.
  Context [A : Type] (k : nat).
  Implicit Types (bs ck xs ys : list A).
Fixpoint chunk' bs ck {struct bs} : list (list A).
Admitted.
  Definition chunk bs := chunk' bs [].

  Context (Hk : k <> 0).

  Lemma nth_error_chunk bs i (Hi : i < div_up (length bs) k)
    : nth_error (chunk bs) i = Some (firstn k (skipn (i*k) bs)).
Admitted.

  Lemma length_chunk bs : length (chunk bs) = div_up (length bs) k.
Admitted.

  Lemma length_chunk_app (l l' : list A) :
    (length l mod k)%nat = 0%nat ->
    length (chunk (l ++ l')) = length (chunk l ++ chunk l').
Admitted.

  Lemma chunk_app : forall (l l': list A),
      (length l mod k = 0)%nat ->
      chunk (l ++ l') = chunk l ++ chunk l'.
  Proof.
    intros * Hmod.
    eapply nth_ext with (d := []) (d' := []); [ | intros idx ].
    - apply length_chunk_app; assumption.
    - intros Hidx; eassert (Some _ = Some _) as HS; [ | injection HS; intros Hs; apply Hs ].
      rewrite <- !nth_error_nth' by assumption.
      rewrite <- !nth_error_nth' by (rewrite length_chunk_app in Hidx; eassumption).
      assert (idx < length (chunk l) \/ length (chunk l) <= idx)%nat as [Hlt | Hge] by lia;
        [ rewrite nth_error_app1 | rewrite nth_error_app2 ]; try eassumption.
      all: rewrite !nth_error_chunk.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hlt by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hidx by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hge by assumption.
      all: rewrite ?length_chunk, ?app_length, ?div_up_add_mod by assumption.
      all: try lia.
      all: pose proof Nat.div_up_range (length l) k ltac:(lia).
      + pose proof div_up_exact_mod (length l) k ltac:(lia) ltac:(lia).
        rewrite !firstn_skipn_comm, !firstn_app.
        replace (idx * k + k - length l)%nat with 0%nat by nia.
        simpl; rewrite app_nil_r; reflexivity.
      + rewrite Nat.mul_sub_distr_r.
        erewrite div_up_exact_mod by lia.
        rewrite skipn_app, skipn_all2; [ reflexivity | nia ].
  Qed.
🛠️ Intermediate Coq File (useful for debugging if minimization did not go as far as you wanted)
🛠️ 📜 Intermediate Coq File log (useful for debugging if minimization did not go as far as you wanted)
📜 Build Log (contains the Coq error message) (truncated to last 8.0KiB; full 25KiB file on GitHub Actions Artifacts under build.log)
racters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
Error: The section Chunk and module Nat need to be closed.
📜 🔎 Minimization Log (truncated to last 8.0KiB; full 50KiB file on GitHub Actions Artifacts under bug.log)
ub/workspace/run-script.sh @ line 187) $�[0m dirname /home/coq/.opam/4.13.1+flambda/bin/coqc.orig
++ �[33;1m(/github/workspace/run-script.sh @ line 187) $�[0m cd /home/coq/.opam/4.13.1+flambda/bin
++ �[33;1m(/github/workspace/run-script.sh @ line 187) $�[0m readlink -f coq_makefile
+ �[33;1m(/github/workspace/run-script.sh @ line 187) $�[0m PASSING_COQ_MAKEFILE=/home/coq/.opam/4.13.1+flambda/bin/coq_makefile
+++ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m dirname /home/coq/.opam/4.13.1+flambda/bin/coqc.orig
++ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m cd /home/coq/.opam/4.13.1+flambda/bin
++ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m readlink -f coqdep
+ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m PASSING_COQDEP=/home/coq/.opam/4.13.1+flambda/bin/coqdep
+ �[33;1m(/github/workspace/run-script.sh @ line 190) $�[0m '[' /home/coq/.opam/4.13.1+flambda/bin/coqc.orig '!=' /home/coq/.opam/4.13.1+flambda/bin/coqc.orig ']'
+ �[33;1m(/github/workspace/run-script.sh @ line 195) $�[0m NONPASSING_PREFIX=
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m process_args '' ''
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m bash -c 'split_args_to_lines /home/coq/.opam/4.13.1+flambda/bin/coqc.orig -q bug.v '
++ �[33;1m(/github/workspace/run-script.sh @ line 63) $�[0m passing_prefix=
++ �[33;1m(/github/workspace/run-script.sh @ line 64) $�[0m prefixed_arg=--arg
++ �[33;1m(/github/workspace/run-script.sh @ line 65) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 69) $�[0m known_v_file=
++ �[33;1m(/github/workspace/run-script.sh @ line 70) $�[0m next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 71) $�[0m next_next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 72) $�[0m skip_next=no
++ �[33;1m(/github/workspace/run-script.sh @ line 73) $�[0m prev_load=
++ �[33;1m(/github/workspace/run-script.sh @ line 74) $�[0m found_known_v_file=no
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m tail -n +2
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' -q
process_args: processing (-q)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 101) $�[0m case "$i" in
++ �[33;1m(/github/workspace/run-script.sh @ line 133) $�[0m printf '%s=%s\n' --arg -q
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' bug.v
process_args: processing (bug.v)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m coqpath_to_args /github/workspace ''
++ �[33;1m(/github/workspace/run-script.sh @ line 142) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 143) $�[0m local IFS=:
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f ''
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f bug.v
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m '[' '' == /github/workspace/bug.v ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 99) $�[0m :
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
+ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m FAILING_ARGS=--arg=-q
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m process_args passing ''
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m bash -c 'split_args_to_lines /home/coq/.opam/4.13.1+flambda/bin/coqc.orig -q bug.v '
++ �[33;1m(/github/workspace/run-script.sh @ line 63) $�[0m passing_prefix=
++ �[33;1m(/github/workspace/run-script.sh @ line 64) $�[0m prefixed_arg=--arg
++ �[33;1m(/github/workspace/run-script.sh @ line 65) $�[0m '[' '!' -z passing ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 66) $�[0m passing_prefix=--passing
++ �[33;1m(/github/workspace/run-script.sh @ line 67) $�[0m prefixed_arg=--passing-arg
++ �[33;1m(/github/workspace/run-script.sh @ line 69) $�[0m known_v_file=
++ �[33;1m(/github/workspace/run-script.sh @ line 70) $�[0m next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 71) $�[0m next_next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 72) $�[0m skip_next=no
++ �[33;1m(/github/workspace/run-script.sh @ line 73) $�[0m prev_load=
++ �[33;1m(/github/workspace/run-script.sh @ line 74) $�[0m found_known_v_file=no
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m tail -n +2
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m sed 's,\(/github/workspace/builds/coq\)/coq-failing/,\1/coq-passing/,g'
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' -q
process_args: processing (-q)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 101) $�[0m case "$i" in
++ �[33;1m(/github/workspace/run-script.sh @ line 133) $�[0m printf '%s=%s\n' --passing-arg -q
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m coqpath_to_args /github/workspace ''
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' bug.v
++ �[33;1m(/github/workspace/run-script.sh @ line 142) $�[0m cd /github/workspace
process_args: processing (bug.v)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 143) $�[0m local IFS=:
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f ''
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f bug.v
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m '[' '' == /github/workspace/bug.v ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 99) $�[0m :
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
+ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m PASSING_ARGS=--passing-arg=-q
++ �[33;1m(/github/workspace/run-script.sh @ line 200) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 200) $�[0m readlink -f ''
+ �[33;1m(/github/workspace/run-script.sh @ line 200) $�[0m ABS_FILE=

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.

@JasonGross
Copy link
Owner Author

@coqbot minimize coq.dev

#!/usr/bin/env bash

true | coqtop
coqc --version
opam pin remove coq -y --no-action
opam pin add 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y
true | coqtop
coqc --version

cat <<EOF > bug.v
Require Coq.ZArith.ZArith.

Import Coq.micromega.Lia.
Import Coq.Arith.PeanoNat.
Import Coq.Lists.List.
Import ListNotations.

Module Import Nat.
  Definition div_up a b := Nat.div (a + (b-1)) b.
  Lemma div_up_range a b (H : b <> 0) : a <= div_up a b * b < a + b.
Admitted.

  Lemma div_up_add_mod a b n:
    (a mod n = 0)%nat ->
    Nat.div_up (a + b) n =
    (Nat.div_up a n + Nat.div_up b n)%nat.
Admitted.

  Lemma div_up_exact_mod a b:
    (b <> 0)%nat ->
    (a mod b = 0)%nat ->
    ((Nat.div_up a b) * b = a)%nat.
Admitted.

Section Chunk.
  Context [A : Type] (k : nat).
  Implicit Types (bs ck xs ys : list A).
Fixpoint chunk' bs ck {struct bs} : list (list A).
Admitted.
  Definition chunk bs := chunk' bs [].

  Context (Hk : k <> 0).

  Lemma nth_error_chunk bs i (Hi : i < div_up (length bs) k)
    : nth_error (chunk bs) i = Some (firstn k (skipn (i*k) bs)).
Admitted.

  Lemma length_chunk bs : length (chunk bs) = div_up (length bs) k.
Admitted.

  Lemma length_chunk_app (l l' : list A) :
    (length l mod k)%nat = 0%nat ->
    length (chunk (l ++ l')) = length (chunk l ++ chunk l').
Admitted.

  Lemma chunk_app : forall (l l': list A),
      (length l mod k = 0)%nat ->
      chunk (l ++ l') = chunk l ++ chunk l'.
  Proof.
    intros * Hmod.
    eapply nth_ext with (d := []) (d' := []); [ | intros idx ].
    - apply length_chunk_app; assumption.
    - intros Hidx; eassert (Some _ = Some _) as HS; [ | injection HS; intros Hs; apply Hs ].
      rewrite <- !nth_error_nth' by assumption.
      rewrite <- !nth_error_nth' by (rewrite length_chunk_app in Hidx; eassumption).
      assert (idx < length (chunk l) \/ length (chunk l) <= idx)%nat as [Hlt | Hge] by lia;
        [ rewrite nth_error_app1 | rewrite nth_error_app2 ]; try eassumption.
      all: rewrite !nth_error_chunk.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hlt by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hidx by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hge by assumption.
      all: rewrite ?length_chunk, ?app_length, ?div_up_add_mod by assumption.
      all: try lia.
      all: pose proof Nat.div_up_range (length l) k ltac:(lia).
      + pose proof div_up_exact_mod (length l) k ltac:(lia) ltac:(lia).
        rewrite !firstn_skipn_comm, !firstn_app.
        replace (idx * k + k - length l)%nat with 0%nat by nia.
        simpl; rewrite app_nil_r; reflexivity.
      + rewrite Nat.mul_sub_distr_r.
        erewrite div_up_exact_mod by lia.
        rewrite skipn_app, skipn_all2; [ reflexivity | nia ].
  Qed.
EOF

coqc -q bug.v

Copy link

coqbot-app bot commented Sep 11, 2024

Hey @JasonGross, the coq bug minimizer is running your script, I'll come back to you with the results once it's done.

Copy link

coqbot-app bot commented Sep 11, 2024

@JasonGross, Minimized File (full log on GitHub Actions)

🌟 Minimized Coq File (consider adding this file to the test-suite)
Require Coq.ZArith.ZArith.

Import Coq.micromega.Lia.
Import Coq.Arith.PeanoNat.
Import Coq.Lists.List.
Import ListNotations.

Module Import Nat.
  Definition div_up a b := Nat.div (a + (b-1)) b.
  Lemma div_up_range a b (H : b <> 0) : a <= div_up a b * b < a + b.
Admitted.

  Lemma div_up_add_mod a b n:
    (a mod n = 0)%nat ->
    Nat.div_up (a + b) n =
    (Nat.div_up a n + Nat.div_up b n)%nat.
Admitted.

  Lemma div_up_exact_mod a b:
    (b <> 0)%nat ->
    (a mod b = 0)%nat ->
    ((Nat.div_up a b) * b = a)%nat.
Admitted.

Section Chunk.
  Context [A : Type] (k : nat).
  Implicit Types (bs ck xs ys : list A).
Fixpoint chunk' bs ck {struct bs} : list (list A).
Admitted.
  Definition chunk bs := chunk' bs [].

  Context (Hk : k <> 0).

  Lemma nth_error_chunk bs i (Hi : i < div_up (length bs) k)
    : nth_error (chunk bs) i = Some (firstn k (skipn (i*k) bs)).
Admitted.

  Lemma length_chunk bs : length (chunk bs) = div_up (length bs) k.
Admitted.

  Lemma length_chunk_app (l l' : list A) :
    (length l mod k)%nat = 0%nat ->
    length (chunk (l ++ l')) = length (chunk l ++ chunk l').
Admitted.

  Lemma chunk_app : forall (l l': list A),
      (length l mod k = 0)%nat ->
      chunk (l ++ l') = chunk l ++ chunk l'.
  Proof.
    intros * Hmod.
    eapply nth_ext with (d := []) (d' := []); [ | intros idx ].
    - apply length_chunk_app; assumption.
    - intros Hidx; eassert (Some _ = Some _) as HS; [ | injection HS; intros Hs; apply Hs ].
      rewrite <- !nth_error_nth' by assumption.
      rewrite <- !nth_error_nth' by (rewrite length_chunk_app in Hidx; eassumption).
      assert (idx < length (chunk l) \/ length (chunk l) <= idx)%nat as [Hlt | Hge] by lia;
        [ rewrite nth_error_app1 | rewrite nth_error_app2 ]; try eassumption.
      all: rewrite !nth_error_chunk.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hlt by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hidx by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hge by assumption.
      all: rewrite ?length_chunk, ?app_length, ?div_up_add_mod by assumption.
      all: try lia.
      all: pose proof Nat.div_up_range (length l) k ltac:(lia).
      + pose proof div_up_exact_mod (length l) k ltac:(lia) ltac:(lia).
        rewrite !firstn_skipn_comm, !firstn_app.
        replace (idx * k + k - length l)%nat with 0%nat by nia.
        simpl; rewrite app_nil_r; reflexivity.
      + rewrite Nat.mul_sub_distr_r.
        erewrite div_up_exact_mod by lia.
        rewrite skipn_app, skipn_all2; [ reflexivity | nia ].
  Qed.
🛠️ Intermediate Coq File (useful for debugging if minimization did not go as far as you wanted)
🛠️ 📜 Intermediate Coq File log (useful for debugging if minimization did not go as far as you wanted)
📜 Build Log (contains the Coq error message) (truncated to last 8.0KiB; full 29KiB file on GitHub Actions Artifacts under build.log)
racters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
Error: The section Chunk and module Nat need to be closed.
📜 🔎 Minimization Log (truncated to last 8.0KiB; full 53KiB file on GitHub Actions Artifacts under bug.log)
ub/workspace/run-script.sh @ line 187) $�[0m dirname /home/coq/.opam/4.13.1+flambda/bin/coqc.orig
++ �[33;1m(/github/workspace/run-script.sh @ line 187) $�[0m cd /home/coq/.opam/4.13.1+flambda/bin
++ �[33;1m(/github/workspace/run-script.sh @ line 187) $�[0m readlink -f coq_makefile
+ �[33;1m(/github/workspace/run-script.sh @ line 187) $�[0m PASSING_COQ_MAKEFILE=/home/coq/.opam/4.13.1+flambda/bin/coq_makefile
+++ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m dirname /home/coq/.opam/4.13.1+flambda/bin/coqc.orig
++ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m cd /home/coq/.opam/4.13.1+flambda/bin
++ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m readlink -f coqdep
+ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m PASSING_COQDEP=/home/coq/.opam/4.13.1+flambda/bin/coqdep
+ �[33;1m(/github/workspace/run-script.sh @ line 190) $�[0m '[' /home/coq/.opam/4.13.1+flambda/bin/coqc.orig '!=' /home/coq/.opam/4.13.1+flambda/bin/coqc.orig ']'
+ �[33;1m(/github/workspace/run-script.sh @ line 195) $�[0m NONPASSING_PREFIX=
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m process_args '' ''
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m bash -c 'split_args_to_lines /home/coq/.opam/4.13.1+flambda/bin/coqc.orig -q bug.v '
++ �[33;1m(/github/workspace/run-script.sh @ line 63) $�[0m passing_prefix=
++ �[33;1m(/github/workspace/run-script.sh @ line 64) $�[0m prefixed_arg=--arg
++ �[33;1m(/github/workspace/run-script.sh @ line 65) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 69) $�[0m known_v_file=
++ �[33;1m(/github/workspace/run-script.sh @ line 70) $�[0m next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 71) $�[0m next_next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 72) $�[0m skip_next=no
++ �[33;1m(/github/workspace/run-script.sh @ line 73) $�[0m prev_load=
++ �[33;1m(/github/workspace/run-script.sh @ line 74) $�[0m found_known_v_file=no
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m tail -n +2
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' -q
process_args: processing (-q)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 101) $�[0m case "$i" in
++ �[33;1m(/github/workspace/run-script.sh @ line 133) $�[0m printf '%s=%s\n' --arg -q
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' bug.v
process_args: processing (bug.v)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m coqpath_to_args /github/workspace ''
++ �[33;1m(/github/workspace/run-script.sh @ line 142) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 143) $�[0m local IFS=:
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f ''
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f bug.v
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m '[' '' == /github/workspace/bug.v ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 99) $�[0m :
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
+ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m FAILING_ARGS=--arg=-q
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m process_args passing ''
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m bash -c 'split_args_to_lines /home/coq/.opam/4.13.1+flambda/bin/coqc.orig -q bug.v '
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m tail -n +2
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m sed 's,\(/github/workspace/builds/coq\)/coq-failing/,\1/coq-passing/,g'
++ �[33;1m(/github/workspace/run-script.sh @ line 63) $�[0m passing_prefix=
++ �[33;1m(/github/workspace/run-script.sh @ line 64) $�[0m prefixed_arg=--arg
++ �[33;1m(/github/workspace/run-script.sh @ line 65) $�[0m '[' '!' -z passing ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 66) $�[0m passing_prefix=--passing
++ �[33;1m(/github/workspace/run-script.sh @ line 67) $�[0m prefixed_arg=--passing-arg
++ �[33;1m(/github/workspace/run-script.sh @ line 69) $�[0m known_v_file=
++ �[33;1m(/github/workspace/run-script.sh @ line 70) $�[0m next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 71) $�[0m next_next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 72) $�[0m skip_next=no
++ �[33;1m(/github/workspace/run-script.sh @ line 73) $�[0m prev_load=
++ �[33;1m(/github/workspace/run-script.sh @ line 74) $�[0m found_known_v_file=no
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' -q
process_args: processing (-q)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 101) $�[0m case "$i" in
++ �[33;1m(/github/workspace/run-script.sh @ line 133) $�[0m printf '%s=%s\n' --passing-arg -q
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' bug.v
process_args: processing (bug.v)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m coqpath_to_args /github/workspace ''
++ �[33;1m(/github/workspace/run-script.sh @ line 142) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 143) $�[0m local IFS=:
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f ''
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f bug.v
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m '[' '' == /github/workspace/bug.v ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 99) $�[0m :
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
+ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m PASSING_ARGS=--passing-arg=-q
++ �[33;1m(/github/workspace/run-script.sh @ line 200) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 200) $�[0m readlink -f ''
+ �[33;1m(/github/workspace/run-script.sh @ line 200) $�[0m ABS_FILE=

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.

@JasonGross
Copy link
Owner Author

@coqbot minimize coq.dev

#!/usr/bin/env bash

true | coqtop
coqc --version
opam pin remove coq -y --no-action
opam pin add 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y --confirm-level=unsafe-yes
true | coqtop
coqc --version

cat <<EOF > bug.v
Require Coq.ZArith.ZArith.

Import Coq.micromega.Lia.
Import Coq.Arith.PeanoNat.
Import Coq.Lists.List.
Import ListNotations.

Module Import Nat.
  Definition div_up a b := Nat.div (a + (b-1)) b.
  Lemma div_up_range a b (H : b <> 0) : a <= div_up a b * b < a + b.
Admitted.

  Lemma div_up_add_mod a b n:
    (a mod n = 0)%nat ->
    Nat.div_up (a + b) n =
    (Nat.div_up a n + Nat.div_up b n)%nat.
Admitted.

  Lemma div_up_exact_mod a b:
    (b <> 0)%nat ->
    (a mod b = 0)%nat ->
    ((Nat.div_up a b) * b = a)%nat.
Admitted.

Section Chunk.
  Context [A : Type] (k : nat).
  Implicit Types (bs ck xs ys : list A).
Fixpoint chunk' bs ck {struct bs} : list (list A).
Admitted.
  Definition chunk bs := chunk' bs [].

  Context (Hk : k <> 0).

  Lemma nth_error_chunk bs i (Hi : i < div_up (length bs) k)
    : nth_error (chunk bs) i = Some (firstn k (skipn (i*k) bs)).
Admitted.

  Lemma length_chunk bs : length (chunk bs) = div_up (length bs) k.
Admitted.

  Lemma length_chunk_app (l l' : list A) :
    (length l mod k)%nat = 0%nat ->
    length (chunk (l ++ l')) = length (chunk l ++ chunk l').
Admitted.

  Lemma chunk_app : forall (l l': list A),
      (length l mod k = 0)%nat ->
      chunk (l ++ l') = chunk l ++ chunk l'.
  Proof.
    intros * Hmod.
    eapply nth_ext with (d := []) (d' := []); [ | intros idx ].
    - apply length_chunk_app; assumption.
    - intros Hidx; eassert (Some _ = Some _) as HS; [ | injection HS; intros Hs; apply Hs ].
      rewrite <- !nth_error_nth' by assumption.
      rewrite <- !nth_error_nth' by (rewrite length_chunk_app in Hidx; eassumption).
      assert (idx < length (chunk l) \/ length (chunk l) <= idx)%nat as [Hlt | Hge] by lia;
        [ rewrite nth_error_app1 | rewrite nth_error_app2 ]; try eassumption.
      all: rewrite !nth_error_chunk.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hlt by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hidx by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hge by assumption.
      all: rewrite ?length_chunk, ?app_length, ?div_up_add_mod by assumption.
      all: try lia.
      all: pose proof Nat.div_up_range (length l) k ltac:(lia).
      + pose proof div_up_exact_mod (length l) k ltac:(lia) ltac:(lia).
        rewrite !firstn_skipn_comm, !firstn_app.
        replace (idx * k + k - length l)%nat with 0%nat by nia.
        simpl; rewrite app_nil_r; reflexivity.
      + rewrite Nat.mul_sub_distr_r.
        erewrite div_up_exact_mod by lia.
        rewrite skipn_app, skipn_all2; [ reflexivity | nia ].
  Qed.
EOF

coqc -q bug.v

Copy link

coqbot-app bot commented Sep 11, 2024

Hey @JasonGross, the coq bug minimizer is running your script, I'll come back to you with the results once it's done.

Copy link

coqbot-app bot commented Sep 11, 2024

@JasonGross, Minimized File /home/runner/work/run-coq-bug-minimizer/run-coq-bug-minimizer/bug.v (full log on GitHub Actions - verbose log)

🌟 Minimized Coq File (consider adding this file to the test-suite)
Require Coq.ZArith.ZArith.

Import Coq.micromega.Lia.
Import Coq.Arith.PeanoNat.
Import Coq.Lists.List.
Import ListNotations.

Module Import Nat.
  Definition div_up a b := Nat.div (a + (b-1)) b.
  Lemma div_up_range a b (H : b <> 0) : a <= div_up a b * b < a + b.
Admitted.

  Lemma div_up_add_mod a b n:
    (a mod n = 0)%nat ->
    Nat.div_up (a + b) n =
    (Nat.div_up a n + Nat.div_up b n)%nat.
Admitted.

  Lemma div_up_exact_mod a b:
    (b <> 0)%nat ->
    (a mod b = 0)%nat ->
    ((Nat.div_up a b) * b = a)%nat.
Admitted.

Section Chunk.
  Context [A : Type] (k : nat).
  Implicit Types (bs ck xs ys : list A).
Fixpoint chunk' bs ck {struct bs} : list (list A).
Admitted.
  Definition chunk bs := chunk' bs [].

  Context (Hk : k <> 0).

  Lemma nth_error_chunk bs i (Hi : i < div_up (length bs) k)
    : nth_error (chunk bs) i = Some (firstn k (skipn (i*k) bs)).
Admitted.

  Lemma length_chunk bs : length (chunk bs) = div_up (length bs) k.
Admitted.

  Lemma length_chunk_app (l l' : list A) :
    (length l mod k)%nat = 0%nat ->
    length (chunk (l ++ l')) = length (chunk l ++ chunk l').
Admitted.

  Lemma chunk_app : forall (l l': list A),
      (length l mod k = 0)%nat ->
      chunk (l ++ l') = chunk l ++ chunk l'.
  Proof.
    intros * Hmod.
    eapply nth_ext with (d := []) (d' := []); [ | intros idx ].
    - apply length_chunk_app; assumption.
    - intros Hidx; eassert (Some _ = Some _) as HS; [ | injection HS; intros Hs; apply Hs ].
      rewrite <- !nth_error_nth' by assumption.
      rewrite <- !nth_error_nth' by (rewrite length_chunk_app in Hidx; eassumption).
      assert (idx < length (chunk l) \/ length (chunk l) <= idx)%nat as [Hlt | Hge] by lia;
        [ rewrite nth_error_app1 | rewrite nth_error_app2 ]; try eassumption.
      all: rewrite !nth_error_chunk.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hlt by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hidx by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hge by assumption.
      all: rewrite ?length_chunk, ?app_length, ?div_up_add_mod by assumption.
      all: try lia.
      all: pose proof Nat.div_up_range (length l) k ltac:(lia).
      + pose proof div_up_exact_mod (length l) k ltac:(lia) ltac:(lia).
        rewrite !firstn_skipn_comm, !firstn_app.
        replace (idx * k + k - length l)%nat with 0%nat by nia.
        simpl; rewrite app_nil_r; reflexivity.
      + rewrite Nat.mul_sub_distr_r.
        erewrite div_up_exact_mod by lia.
        rewrite skipn_app, skipn_all2; [ reflexivity | nia ].
  Qed.
🛠️ Intermediate Coq File (useful for debugging if minimization did not go as far as you wanted)
🛠️ 📜 Intermediate Coq File log (useful for debugging if minimization did not go as far as you wanted)
📜 Build Log (contains the Coq error message) (truncated to last 8.0KiB; full 77KiB file on GitHub Actions Artifacts under build.log)
ngoxft-1.0-0:amd64 (1.50.12+ds-1) ...

@JasonGross
Copy link
Owner Author

@coqbot minimize coq.dev

#!/usr/bin/env bash

true | coqtop
coqc --version
opam pin remove coq -y --no-action
opam pin add coq coq-core coq-stdlib coqide-server 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y --confirm-level=unsafe-yes
true | coqtop
coqc --version

cat <<EOF > bug.v
Require Coq.ZArith.ZArith.

Import Coq.micromega.Lia.
Import Coq.Arith.PeanoNat.
Import Coq.Lists.List.
Import ListNotations.

Module Import Nat.
  Definition div_up a b := Nat.div (a + (b-1)) b.
  Lemma div_up_range a b (H : b <> 0) : a <= div_up a b * b < a + b.
Admitted.

  Lemma div_up_add_mod a b n:
    (a mod n = 0)%nat ->
    Nat.div_up (a + b) n =
    (Nat.div_up a n + Nat.div_up b n)%nat.
Admitted.

  Lemma div_up_exact_mod a b:
    (b <> 0)%nat ->
    (a mod b = 0)%nat ->
    ((Nat.div_up a b) * b = a)%nat.
Admitted.

Section Chunk.
  Context [A : Type] (k : nat).
  Implicit Types (bs ck xs ys : list A).
Fixpoint chunk' bs ck {struct bs} : list (list A).
Admitted.
  Definition chunk bs := chunk' bs [].

  Context (Hk : k <> 0).

  Lemma nth_error_chunk bs i (Hi : i < div_up (length bs) k)
    : nth_error (chunk bs) i = Some (firstn k (skipn (i*k) bs)).
Admitted.

  Lemma length_chunk bs : length (chunk bs) = div_up (length bs) k.
Admitted.

  Lemma length_chunk_app (l l' : list A) :
    (length l mod k)%nat = 0%nat ->
    length (chunk (l ++ l')) = length (chunk l ++ chunk l').
Admitted.

  Lemma chunk_app : forall (l l': list A),
      (length l mod k = 0)%nat ->
      chunk (l ++ l') = chunk l ++ chunk l'.
  Proof.
    intros * Hmod.
    eapply nth_ext with (d := []) (d' := []); [ | intros idx ].
    - apply length_chunk_app; assumption.
    - intros Hidx; eassert (Some _ = Some _) as HS; [ | injection HS; intros Hs; apply Hs ].
      rewrite <- !nth_error_nth' by assumption.
      rewrite <- !nth_error_nth' by (rewrite length_chunk_app in Hidx; eassumption).
      assert (idx < length (chunk l) \/ length (chunk l) <= idx)%nat as [Hlt | Hge] by lia;
        [ rewrite nth_error_app1 | rewrite nth_error_app2 ]; try eassumption.
      all: rewrite !nth_error_chunk.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hlt by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hidx by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hge by assumption.
      all: rewrite ?length_chunk, ?app_length, ?div_up_add_mod by assumption.
      all: try lia.
      all: pose proof Nat.div_up_range (length l) k ltac:(lia).
      + pose proof div_up_exact_mod (length l) k ltac:(lia) ltac:(lia).
        rewrite !firstn_skipn_comm, !firstn_app.
        replace (idx * k + k - length l)%nat with 0%nat by nia.
        simpl; rewrite app_nil_r; reflexivity.
      + rewrite Nat.mul_sub_distr_r.
        erewrite div_up_exact_mod by lia.
        rewrite skipn_app, skipn_all2; [ reflexivity | nia ].
  Qed.
EOF

coqc -q bug.v

Copy link

coqbot-app bot commented Sep 11, 2024

Hey @JasonGross, the coq bug minimizer is running your script, I'll come back to you with the results once it's done.

@JasonGross
Copy link
Owner Author

@coqbot minimize coq.dev

#!/usr/bin/env bash

true | coqtop
coqc --version
opam pin remove coq -y --no-action
opam pin add coq 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y --no-action
opam pin add coq 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y --no-action
opam pin add coq-core 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y --no-action
opam pin add coq-stdlib 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y --no-action
opam pin add coqide-server 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y --no-action
opam install coq coq-core coq-stdlib coqide-server --reinstall -y --confirm-level=unsafe-yes
true | coqtop
coqc --version

cat <<EOF > bug.v
Require Coq.ZArith.ZArith.

Import Coq.micromega.Lia.
Import Coq.Arith.PeanoNat.
Import Coq.Lists.List.
Import ListNotations.

Module Import Nat.
  Definition div_up a b := Nat.div (a + (b-1)) b.
  Lemma div_up_range a b (H : b <> 0) : a <= div_up a b * b < a + b.
Admitted.

  Lemma div_up_add_mod a b n:
    (a mod n = 0)%nat ->
    Nat.div_up (a + b) n =
    (Nat.div_up a n + Nat.div_up b n)%nat.
Admitted.

  Lemma div_up_exact_mod a b:
    (b <> 0)%nat ->
    (a mod b = 0)%nat ->
    ((Nat.div_up a b) * b = a)%nat.
Admitted.

Section Chunk.
  Context [A : Type] (k : nat).
  Implicit Types (bs ck xs ys : list A).
Fixpoint chunk' bs ck {struct bs} : list (list A).
Admitted.
  Definition chunk bs := chunk' bs [].

  Context (Hk : k <> 0).

  Lemma nth_error_chunk bs i (Hi : i < div_up (length bs) k)
    : nth_error (chunk bs) i = Some (firstn k (skipn (i*k) bs)).
Admitted.

  Lemma length_chunk bs : length (chunk bs) = div_up (length bs) k.
Admitted.

  Lemma length_chunk_app (l l' : list A) :
    (length l mod k)%nat = 0%nat ->
    length (chunk (l ++ l')) = length (chunk l ++ chunk l').
Admitted.

  Lemma chunk_app : forall (l l': list A),
      (length l mod k = 0)%nat ->
      chunk (l ++ l') = chunk l ++ chunk l'.
  Proof.
    intros * Hmod.
    eapply nth_ext with (d := []) (d' := []); [ | intros idx ].
    - apply length_chunk_app; assumption.
    - intros Hidx; eassert (Some _ = Some _) as HS; [ | injection HS; intros Hs; apply Hs ].
      rewrite <- !nth_error_nth' by assumption.
      rewrite <- !nth_error_nth' by (rewrite length_chunk_app in Hidx; eassumption).
      assert (idx < length (chunk l) \/ length (chunk l) <= idx)%nat as [Hlt | Hge] by lia;
        [ rewrite nth_error_app1 | rewrite nth_error_app2 ]; try eassumption.
      all: rewrite !nth_error_chunk.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hlt by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hidx by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hge by assumption.
      all: rewrite ?length_chunk, ?app_length, ?div_up_add_mod by assumption.
      all: try lia.
      all: pose proof Nat.div_up_range (length l) k ltac:(lia).
      + pose proof div_up_exact_mod (length l) k ltac:(lia) ltac:(lia).
        rewrite !firstn_skipn_comm, !firstn_app.
        replace (idx * k + k - length l)%nat with 0%nat by nia.
        simpl; rewrite app_nil_r; reflexivity.
      + rewrite Nat.mul_sub_distr_r.
        erewrite div_up_exact_mod by lia.
        rewrite skipn_app, skipn_all2; [ reflexivity | nia ].
  Qed.
EOF

coqc -q bug.v

Copy link

coqbot-app bot commented Sep 11, 2024

Hey @JasonGross, the coq bug minimizer is running your script, I'll come back to you with the results once it's done.

Copy link

coqbot-app bot commented Sep 11, 2024

@JasonGross, Minimized File (full log on GitHub Actions)

🌟 Minimized Coq File (consider adding this file to the test-suite)
Require Coq.ZArith.ZArith.

Import Coq.micromega.Lia.
Import Coq.Arith.PeanoNat.
Import Coq.Lists.List.
Import ListNotations.

Module Import Nat.
  Definition div_up a b := Nat.div (a + (b-1)) b.
  Lemma div_up_range a b (H : b <> 0) : a <= div_up a b * b < a + b.
Admitted.

  Lemma div_up_add_mod a b n:
    (a mod n = 0)%nat ->
    Nat.div_up (a + b) n =
    (Nat.div_up a n + Nat.div_up b n)%nat.
Admitted.

  Lemma div_up_exact_mod a b:
    (b <> 0)%nat ->
    (a mod b = 0)%nat ->
    ((Nat.div_up a b) * b = a)%nat.
Admitted.

Section Chunk.
  Context [A : Type] (k : nat).
  Implicit Types (bs ck xs ys : list A).
Fixpoint chunk' bs ck {struct bs} : list (list A).
Admitted.
  Definition chunk bs := chunk' bs [].

  Context (Hk : k <> 0).

  Lemma nth_error_chunk bs i (Hi : i < div_up (length bs) k)
    : nth_error (chunk bs) i = Some (firstn k (skipn (i*k) bs)).
Admitted.

  Lemma length_chunk bs : length (chunk bs) = div_up (length bs) k.
Admitted.

  Lemma length_chunk_app (l l' : list A) :
    (length l mod k)%nat = 0%nat ->
    length (chunk (l ++ l')) = length (chunk l ++ chunk l').
Admitted.

  Lemma chunk_app : forall (l l': list A),
      (length l mod k = 0)%nat ->
      chunk (l ++ l') = chunk l ++ chunk l'.
  Proof.
    intros * Hmod.
    eapply nth_ext with (d := []) (d' := []); [ | intros idx ].
    - apply length_chunk_app; assumption.
    - intros Hidx; eassert (Some _ = Some _) as HS; [ | injection HS; intros Hs; apply Hs ].
      rewrite <- !nth_error_nth' by assumption.
      rewrite <- !nth_error_nth' by (rewrite length_chunk_app in Hidx; eassumption).
      assert (idx < length (chunk l) \/ length (chunk l) <= idx)%nat as [Hlt | Hge] by lia;
        [ rewrite nth_error_app1 | rewrite nth_error_app2 ]; try eassumption.
      all: rewrite !nth_error_chunk.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hlt by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hidx by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hge by assumption.
      all: rewrite ?length_chunk, ?app_length, ?div_up_add_mod by assumption.
      all: try lia.
      all: pose proof Nat.div_up_range (length l) k ltac:(lia).
      + pose proof div_up_exact_mod (length l) k ltac:(lia) ltac:(lia).
        rewrite !firstn_skipn_comm, !firstn_app.
        replace (idx * k + k - length l)%nat with 0%nat by nia.
        simpl; rewrite app_nil_r; reflexivity.
      + rewrite Nat.mul_sub_distr_r.
        erewrite div_up_exact_mod by lia.
        rewrite skipn_app, skipn_all2; [ reflexivity | nia ].
  Qed.
🛠️ Intermediate Coq File (useful for debugging if minimization did not go as far as you wanted)
🛠️ 📜 Intermediate Coq File log (useful for debugging if minimization did not go as far as you wanted)
📜 Build Log (contains the Coq error message) (truncated to last 8.0KiB; full 25KiB file on GitHub Actions Artifacts under build.log)
racters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
Error: The section Chunk and module Nat need to be closed.
📜 🔎 Minimization Log (truncated to last 8.0KiB; full 50KiB file on GitHub Actions Artifacts under bug.log)
ub/workspace/run-script.sh @ line 187) $�[0m dirname /home/coq/.opam/4.13.1+flambda/bin/coqc.orig
++ �[33;1m(/github/workspace/run-script.sh @ line 187) $�[0m cd /home/coq/.opam/4.13.1+flambda/bin
++ �[33;1m(/github/workspace/run-script.sh @ line 187) $�[0m readlink -f coq_makefile
+ �[33;1m(/github/workspace/run-script.sh @ line 187) $�[0m PASSING_COQ_MAKEFILE=/home/coq/.opam/4.13.1+flambda/bin/coq_makefile
+++ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m dirname /home/coq/.opam/4.13.1+flambda/bin/coqc.orig
++ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m cd /home/coq/.opam/4.13.1+flambda/bin
++ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m readlink -f coqdep
+ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m PASSING_COQDEP=/home/coq/.opam/4.13.1+flambda/bin/coqdep
+ �[33;1m(/github/workspace/run-script.sh @ line 190) $�[0m '[' /home/coq/.opam/4.13.1+flambda/bin/coqc.orig '!=' /home/coq/.opam/4.13.1+flambda/bin/coqc.orig ']'
+ �[33;1m(/github/workspace/run-script.sh @ line 195) $�[0m NONPASSING_PREFIX=
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m process_args '' ''
++ �[33;1m(/github/workspace/run-script.sh @ line 63) $�[0m passing_prefix=
++ �[33;1m(/github/workspace/run-script.sh @ line 64) $�[0m prefixed_arg=--arg
++ �[33;1m(/github/workspace/run-script.sh @ line 65) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 69) $�[0m known_v_file=
++ �[33;1m(/github/workspace/run-script.sh @ line 70) $�[0m next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 71) $�[0m next_next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 72) $�[0m skip_next=no
++ �[33;1m(/github/workspace/run-script.sh @ line 73) $�[0m prev_load=
++ �[33;1m(/github/workspace/run-script.sh @ line 74) $�[0m found_known_v_file=no
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m bash -c 'split_args_to_lines /home/coq/.opam/4.13.1+flambda/bin/coqc.orig -q bug.v '
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m tail -n +2
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' -q
process_args: processing (-q)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 101) $�[0m case "$i" in
++ �[33;1m(/github/workspace/run-script.sh @ line 133) $�[0m printf '%s=%s\n' --arg -q
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' bug.v
process_args: processing (bug.v)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m coqpath_to_args /github/workspace ''
++ �[33;1m(/github/workspace/run-script.sh @ line 142) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 143) $�[0m local IFS=:
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f ''
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f bug.v
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m '[' '' == /github/workspace/bug.v ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 99) $�[0m :
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
+ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m FAILING_ARGS=--arg=-q
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m process_args passing ''
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m bash -c 'split_args_to_lines /home/coq/.opam/4.13.1+flambda/bin/coqc.orig -q bug.v '
++ �[33;1m(/github/workspace/run-script.sh @ line 63) $�[0m passing_prefix=
++ �[33;1m(/github/workspace/run-script.sh @ line 64) $�[0m prefixed_arg=--arg
++ �[33;1m(/github/workspace/run-script.sh @ line 65) $�[0m '[' '!' -z passing ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 66) $�[0m passing_prefix=--passing
++ �[33;1m(/github/workspace/run-script.sh @ line 67) $�[0m prefixed_arg=--passing-arg
++ �[33;1m(/github/workspace/run-script.sh @ line 69) $�[0m known_v_file=
++ �[33;1m(/github/workspace/run-script.sh @ line 70) $�[0m next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 71) $�[0m next_next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 72) $�[0m skip_next=no
++ �[33;1m(/github/workspace/run-script.sh @ line 73) $�[0m prev_load=
++ �[33;1m(/github/workspace/run-script.sh @ line 74) $�[0m found_known_v_file=no
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m tail -n +2
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m sed 's,\(/github/workspace/builds/coq\)/coq-failing/,\1/coq-passing/,g'
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' -q
process_args: processing (-q)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 101) $�[0m case "$i" in
++ �[33;1m(/github/workspace/run-script.sh @ line 133) $�[0m printf '%s=%s\n' --passing-arg -q
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' bug.v
process_args: processing (bug.v)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m coqpath_to_args /github/workspace ''
++ �[33;1m(/github/workspace/run-script.sh @ line 142) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 143) $�[0m local IFS=:
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f ''
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f bug.v
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m '[' '' == /github/workspace/bug.v ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 99) $�[0m :
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
+ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m PASSING_ARGS=--passing-arg=-q
++ �[33;1m(/github/workspace/run-script.sh @ line 200) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 200) $�[0m readlink -f ''
+ �[33;1m(/github/workspace/run-script.sh @ line 200) $�[0m ABS_FILE=

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.

Copy link

coqbot-app bot commented Sep 11, 2024

@JasonGross, Minimized File (full log on GitHub Actions)

🌟 Minimized Coq File (consider adding this file to the test-suite)
Require Coq.ZArith.ZArith.

Import Coq.micromega.Lia.
Import Coq.Arith.PeanoNat.
Import Coq.Lists.List.
Import ListNotations.

Module Import Nat.
  Definition div_up a b := Nat.div (a + (b-1)) b.
  Lemma div_up_range a b (H : b <> 0) : a <= div_up a b * b < a + b.
Admitted.

  Lemma div_up_add_mod a b n:
    (a mod n = 0)%nat ->
    Nat.div_up (a + b) n =
    (Nat.div_up a n + Nat.div_up b n)%nat.
Admitted.

  Lemma div_up_exact_mod a b:
    (b <> 0)%nat ->
    (a mod b = 0)%nat ->
    ((Nat.div_up a b) * b = a)%nat.
Admitted.

Section Chunk.
  Context [A : Type] (k : nat).
  Implicit Types (bs ck xs ys : list A).
Fixpoint chunk' bs ck {struct bs} : list (list A).
Admitted.
  Definition chunk bs := chunk' bs [].

  Context (Hk : k <> 0).

  Lemma nth_error_chunk bs i (Hi : i < div_up (length bs) k)
    : nth_error (chunk bs) i = Some (firstn k (skipn (i*k) bs)).
Admitted.

  Lemma length_chunk bs : length (chunk bs) = div_up (length bs) k.
Admitted.

  Lemma length_chunk_app (l l' : list A) :
    (length l mod k)%nat = 0%nat ->
    length (chunk (l ++ l')) = length (chunk l ++ chunk l').
Admitted.

  Lemma chunk_app : forall (l l': list A),
      (length l mod k = 0)%nat ->
      chunk (l ++ l') = chunk l ++ chunk l'.
  Proof.
    intros * Hmod.
    eapply nth_ext with (d := []) (d' := []); [ | intros idx ].
    - apply length_chunk_app; assumption.
    - intros Hidx; eassert (Some _ = Some _) as HS; [ | injection HS; intros Hs; apply Hs ].
      rewrite <- !nth_error_nth' by assumption.
      rewrite <- !nth_error_nth' by (rewrite length_chunk_app in Hidx; eassumption).
      assert (idx < length (chunk l) \/ length (chunk l) <= idx)%nat as [Hlt | Hge] by lia;
        [ rewrite nth_error_app1 | rewrite nth_error_app2 ]; try eassumption.
      all: rewrite !nth_error_chunk.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hlt by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hidx by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hge by assumption.
      all: rewrite ?length_chunk, ?app_length, ?div_up_add_mod by assumption.
      all: try lia.
      all: pose proof Nat.div_up_range (length l) k ltac:(lia).
      + pose proof div_up_exact_mod (length l) k ltac:(lia) ltac:(lia).
        rewrite !firstn_skipn_comm, !firstn_app.
        replace (idx * k + k - length l)%nat with 0%nat by nia.
        simpl; rewrite app_nil_r; reflexivity.
      + rewrite Nat.mul_sub_distr_r.
        erewrite div_up_exact_mod by lia.
        rewrite skipn_app, skipn_all2; [ reflexivity | nia ].
  Qed.
🛠️ Intermediate Coq File (useful for debugging if minimization did not go as far as you wanted)
🛠️ 📜 Intermediate Coq File log (useful for debugging if minimization did not go as far as you wanted)
📜 Build Log (contains the Coq error message) (truncated to last 8.0KiB; full 29KiB file on GitHub Actions Artifacts under build.log)
racters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
Error: The section Chunk and module Nat need to be closed.
📜 🔎 Minimization Log (truncated to last 8.0KiB; full 54KiB file on GitHub Actions Artifacts under bug.log)
ub/workspace/run-script.sh @ line 187) $�[0m dirname /home/coq/.opam/4.13.1+flambda/bin/coqc.orig
++ �[33;1m(/github/workspace/run-script.sh @ line 187) $�[0m cd /home/coq/.opam/4.13.1+flambda/bin
++ �[33;1m(/github/workspace/run-script.sh @ line 187) $�[0m readlink -f coq_makefile
+ �[33;1m(/github/workspace/run-script.sh @ line 187) $�[0m PASSING_COQ_MAKEFILE=/home/coq/.opam/4.13.1+flambda/bin/coq_makefile
+++ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m dirname /home/coq/.opam/4.13.1+flambda/bin/coqc.orig
++ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m cd /home/coq/.opam/4.13.1+flambda/bin
++ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m readlink -f coqdep
+ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m PASSING_COQDEP=/home/coq/.opam/4.13.1+flambda/bin/coqdep
+ �[33;1m(/github/workspace/run-script.sh @ line 190) $�[0m '[' /home/coq/.opam/4.13.1+flambda/bin/coqc.orig '!=' /home/coq/.opam/4.13.1+flambda/bin/coqc.orig ']'
+ �[33;1m(/github/workspace/run-script.sh @ line 195) $�[0m NONPASSING_PREFIX=
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m process_args '' ''
++ �[33;1m(/github/workspace/run-script.sh @ line 63) $�[0m passing_prefix=
++ �[33;1m(/github/workspace/run-script.sh @ line 64) $�[0m prefixed_arg=--arg
++ �[33;1m(/github/workspace/run-script.sh @ line 65) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 69) $�[0m known_v_file=
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m bash -c 'split_args_to_lines /home/coq/.opam/4.13.1+flambda/bin/coqc.orig -q bug.v '
++ �[33;1m(/github/workspace/run-script.sh @ line 70) $�[0m next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 71) $�[0m next_next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 72) $�[0m skip_next=no
++ �[33;1m(/github/workspace/run-script.sh @ line 73) $�[0m prev_load=
++ �[33;1m(/github/workspace/run-script.sh @ line 74) $�[0m found_known_v_file=no
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m tail -n +2
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' -q
process_args: processing (-q)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 101) $�[0m case "$i" in
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m coqpath_to_args /github/workspace ''
++ �[33;1m(/github/workspace/run-script.sh @ line 142) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 143) $�[0m local IFS=:
++ �[33;1m(/github/workspace/run-script.sh @ line 133) $�[0m printf '%s=%s\n' --arg -q
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' bug.v
process_args: processing (bug.v)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ bug.v == *\.\v ]]
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f ''
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f bug.v
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m '[' '' == /github/workspace/bug.v ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 99) $�[0m :
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
+ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m FAILING_ARGS=--arg=-q
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m process_args passing ''
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m bash -c 'split_args_to_lines /home/coq/.opam/4.13.1+flambda/bin/coqc.orig -q bug.v '
++ �[33;1m(/github/workspace/run-script.sh @ line 63) $�[0m passing_prefix=
++ �[33;1m(/github/workspace/run-script.sh @ line 64) $�[0m prefixed_arg=--arg
++ �[33;1m(/github/workspace/run-script.sh @ line 65) $�[0m '[' '!' -z passing ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 66) $�[0m passing_prefix=--passing
++ �[33;1m(/github/workspace/run-script.sh @ line 67) $�[0m prefixed_arg=--passing-arg
++ �[33;1m(/github/workspace/run-script.sh @ line 69) $�[0m known_v_file=
++ �[33;1m(/github/workspace/run-script.sh @ line 70) $�[0m next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 71) $�[0m next_next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 72) $�[0m skip_next=no
++ �[33;1m(/github/workspace/run-script.sh @ line 73) $�[0m prev_load=
++ �[33;1m(/github/workspace/run-script.sh @ line 74) $�[0m found_known_v_file=no
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m tail -n +2
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m sed 's,\(/github/workspace/builds/coq\)/coq-failing/,\1/coq-passing/,g'
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' -q
process_args: processing (-q)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 101) $�[0m case "$i" in
++ �[33;1m(/github/workspace/run-script.sh @ line 133) $�[0m printf '%s=%s\n' --passing-arg -q
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' bug.v
process_args: processing (bug.v)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m coqpath_to_args /github/workspace ''
++ �[33;1m(/github/workspace/run-script.sh @ line 142) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 143) $�[0m local IFS=:
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f ''
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f bug.v
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m '[' '' == /github/workspace/bug.v ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 99) $�[0m :
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
+ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m PASSING_ARGS=--passing-arg=-q
++ �[33;1m(/github/workspace/run-script.sh @ line 200) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 200) $�[0m readlink -f ''
+ �[33;1m(/github/workspace/run-script.sh @ line 200) $�[0m ABS_FILE=

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.

@JasonGross
Copy link
Owner Author

@coqbot minimize coq.dev

#!/usr/bin/env bash

true | coqtop
coqc --version
opam pin remove coq -y --no-action
opam pin add coq 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y --no-action
opam pin add coq 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y --no-action
opam pin add coq-core 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y --no-action
opam pin add coq-stdlib 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y --no-action
opam pin add coqide-server 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y --no-action
opam reinstall coq coq-core coq-stdlib coqide-server -y --confirm-level=unsafe-yes || exit 1
true | coqtop
coqc --version

cat <<EOF > bug.v
Require Coq.ZArith.ZArith.

Import Coq.micromega.Lia.
Import Coq.Arith.PeanoNat.
Import Coq.Lists.List.
Import ListNotations.

Module Import Nat.
  Definition div_up a b := Nat.div (a + (b-1)) b.
  Lemma div_up_range a b (H : b <> 0) : a <= div_up a b * b < a + b.
Admitted.

  Lemma div_up_add_mod a b n:
    (a mod n = 0)%nat ->
    Nat.div_up (a + b) n =
    (Nat.div_up a n + Nat.div_up b n)%nat.
Admitted.

  Lemma div_up_exact_mod a b:
    (b <> 0)%nat ->
    (a mod b = 0)%nat ->
    ((Nat.div_up a b) * b = a)%nat.
Admitted.

Section Chunk.
  Context [A : Type] (k : nat).
  Implicit Types (bs ck xs ys : list A).
Fixpoint chunk' bs ck {struct bs} : list (list A).
Admitted.
  Definition chunk bs := chunk' bs [].

  Context (Hk : k <> 0).

  Lemma nth_error_chunk bs i (Hi : i < div_up (length bs) k)
    : nth_error (chunk bs) i = Some (firstn k (skipn (i*k) bs)).
Admitted.

  Lemma length_chunk bs : length (chunk bs) = div_up (length bs) k.
Admitted.

  Lemma length_chunk_app (l l' : list A) :
    (length l mod k)%nat = 0%nat ->
    length (chunk (l ++ l')) = length (chunk l ++ chunk l').
Admitted.

  Lemma chunk_app : forall (l l': list A),
      (length l mod k = 0)%nat ->
      chunk (l ++ l') = chunk l ++ chunk l'.
  Proof.
    intros * Hmod.
    eapply nth_ext with (d := []) (d' := []); [ | intros idx ].
    - apply length_chunk_app; assumption.
    - intros Hidx; eassert (Some _ = Some _) as HS; [ | injection HS; intros Hs; apply Hs ].
      rewrite <- !nth_error_nth' by assumption.
      rewrite <- !nth_error_nth' by (rewrite length_chunk_app in Hidx; eassumption).
      assert (idx < length (chunk l) \/ length (chunk l) <= idx)%nat as [Hlt | Hge] by lia;
        [ rewrite nth_error_app1 | rewrite nth_error_app2 ]; try eassumption.
      all: rewrite !nth_error_chunk.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hlt by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hidx by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hge by assumption.
      all: rewrite ?length_chunk, ?app_length, ?div_up_add_mod by assumption.
      all: try lia.
      all: pose proof Nat.div_up_range (length l) k ltac:(lia).
      + pose proof div_up_exact_mod (length l) k ltac:(lia) ltac:(lia).
        rewrite !firstn_skipn_comm, !firstn_app.
        replace (idx * k + k - length l)%nat with 0%nat by nia.
        simpl; rewrite app_nil_r; reflexivity.
      + rewrite Nat.mul_sub_distr_r.
        erewrite div_up_exact_mod by lia.
        rewrite skipn_app, skipn_all2; [ reflexivity | nia ].
  Qed.
EOF

coqc -q bug.v

Copy link

coqbot-app bot commented Sep 11, 2024

Hey @JasonGross, the coq bug minimizer is running your script, I'll come back to you with the results once it's done.

Copy link

coqbot-app bot commented Sep 11, 2024

@JasonGross, Minimized File /home/runner/work/run-coq-bug-minimizer/run-coq-bug-minimizer/bug.v (full log on GitHub Actions - verbose log)

🌟 Minimized Coq File (consider adding this file to the test-suite)
Require Coq.ZArith.ZArith.

Import Coq.micromega.Lia.
Import Coq.Arith.PeanoNat.
Import Coq.Lists.List.
Import ListNotations.

Module Import Nat.
  Definition div_up a b := Nat.div (a + (b-1)) b.
  Lemma div_up_range a b (H : b <> 0) : a <= div_up a b * b < a + b.
Admitted.

  Lemma div_up_add_mod a b n:
    (a mod n = 0)%nat ->
    Nat.div_up (a + b) n =
    (Nat.div_up a n + Nat.div_up b n)%nat.
Admitted.

  Lemma div_up_exact_mod a b:
    (b <> 0)%nat ->
    (a mod b = 0)%nat ->
    ((Nat.div_up a b) * b = a)%nat.
Admitted.

Section Chunk.
  Context [A : Type] (k : nat).
  Implicit Types (bs ck xs ys : list A).
Fixpoint chunk' bs ck {struct bs} : list (list A).
Admitted.
  Definition chunk bs := chunk' bs [].

  Context (Hk : k <> 0).

  Lemma nth_error_chunk bs i (Hi : i < div_up (length bs) k)
    : nth_error (chunk bs) i = Some (firstn k (skipn (i*k) bs)).
Admitted.

  Lemma length_chunk bs : length (chunk bs) = div_up (length bs) k.
Admitted.

  Lemma length_chunk_app (l l' : list A) :
    (length l mod k)%nat = 0%nat ->
    length (chunk (l ++ l')) = length (chunk l ++ chunk l').
Admitted.

  Lemma chunk_app : forall (l l': list A),
      (length l mod k = 0)%nat ->
      chunk (l ++ l') = chunk l ++ chunk l'.
  Proof.
    intros * Hmod.
    eapply nth_ext with (d := []) (d' := []); [ | intros idx ].
    - apply length_chunk_app; assumption.
    - intros Hidx; eassert (Some _ = Some _) as HS; [ | injection HS; intros Hs; apply Hs ].
      rewrite <- !nth_error_nth' by assumption.
      rewrite <- !nth_error_nth' by (rewrite length_chunk_app in Hidx; eassumption).
      assert (idx < length (chunk l) \/ length (chunk l) <= idx)%nat as [Hlt | Hge] by lia;
        [ rewrite nth_error_app1 | rewrite nth_error_app2 ]; try eassumption.
      all: rewrite !nth_error_chunk.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hlt by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hidx by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hge by assumption.
      all: rewrite ?length_chunk, ?app_length, ?div_up_add_mod by assumption.
      all: try lia.
      all: pose proof Nat.div_up_range (length l) k ltac:(lia).
      + pose proof div_up_exact_mod (length l) k ltac:(lia) ltac:(lia).
        rewrite !firstn_skipn_comm, !firstn_app.
        replace (idx * k + k - length l)%nat with 0%nat by nia.
        simpl; rewrite app_nil_r; reflexivity.
      + rewrite Nat.mul_sub_distr_r.
        erewrite div_up_exact_mod by lia.
        rewrite skipn_app, skipn_all2; [ reflexivity | nia ].
  Qed.
🛠️ Intermediate Coq File (useful for debugging if minimization did not go as far as you wanted)
🛠️ 📜 Intermediate Coq File log (useful for debugging if minimization did not go as far as you wanted)
📜 Build Log (contains the Coq error message) (truncated to last 8.0KiB; full 13KiB file on GitHub Actions Artifacts under build.log)

MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace
MINIMIZER_DEBUG_EXTRA: exec: /home/coq/.opam/4.13.1+flambda/bin/coqtop.orig 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.tCbk5xJn6j
MINIMIZER_DEBUG: files: 
Welcome to Coq buildkitsandbox:/home/coq/.opam/4.13.1+flambda/.opam-switch/build/coq-core.dev/_build/default,master (44155b062e6c384cc3ca36293b99dcd13f9cb085)

Coq < 
++ �[33;1m(/github/workspace/run-script.sh @ line 4) $�[0m coqc --version
MINIMIZER_DEBUG_EXTRA: coqc: /home/coq/.opam/4.13.1+flambda/bin/coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace
MINIMIZER_DEBUG_EXTRA: exec: /home/coq/.opam/4.13.1+flambda/bin/coqc.orig --version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.Mi4KiwKZW0
MINIMIZER_DEBUG: files: 
The Coq Proof Assistant, version 8.21+alpha
compiled with OCaml 4.13.1
++ �[33;1m(/github/workspace/run-script.sh @ line 5) $�[0m opam pin remove coq -y --no-action
Ok, coq is no longer pinned to git+https://github.com/coq/coq#44155b062e6c384cc3ca36293b99dcd13f9cb085 (version dev)
::group::opam wrap files
wrapping /usr/local/bin/opam
attempting to wrap coqc
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqc
attempting to wrap coqtop
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqtop
::endgroup::
++ �[33;1m(/github/workspace/run-script.sh @ line 6) $�[0m opam pin add coq git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon -y --no-action
[coq.dev] synchronised (git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon)
[WARNING] Failed checks on coq package definition from source at git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon:
           warning 41: Some packages are mentioned in package scripts or features, but there is no dependency or depopt toward them: "coq-native"
coq is now pinned to git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon (version dev)
::group::opam wrap files
wrapping /usr/local/bin/opam
attempting to wrap coqc
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqc
attempting to wrap coqtop
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqtop
::endgroup::
++ �[33;1m(/github/workspace/run-script.sh @ line 7) $�[0m opam pin add coq git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon -y --no-action
[NOTE] Package coq is already pinned to git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon (version dev).
[coq.dev] synchronised (no changes)
[WARNING] Failed checks on coq package definition from source at git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon:
           warning 41: Some packages are mentioned in package scripts or features, but there is no dependency or depopt toward them: "coq-native"
coq is now pinned to git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon (version dev)
::group::opam wrap files
wrapping /usr/local/bin/opam
attempting to wrap coqc
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqc
attempting to wrap coqtop
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqtop
::endgroup::
++ �[33;1m(/github/workspace/run-script.sh @ line 8) $�[0m opam pin add coq-core git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon -y --no-action
[NOTE] Package coq-core is currently pinned to git+https://github.com/coq/coq#44155b062e6c384cc3ca36293b99dcd13f9cb085 (version dev).
[coq-core.dev] synchronised (git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon)
coq-core is now pinned to git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon (version dev)
::group::opam wrap files
wrapping /usr/local/bin/opam
attempting to wrap coqc
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqc
attempting to wrap coqtop
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqtop
::endgroup::
++ �[33;1m(/github/workspace/run-script.sh @ line 9) $�[0m opam pin add coq-stdlib git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon -y --no-action
[NOTE] Package coq-stdlib is currently pinned to git+https://github.com/coq/coq#44155b062e6c384cc3ca36293b99dcd13f9cb085 (version dev).
[coq-stdlib.dev] synchronised (git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon)
coq-stdlib is now pinned to git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon (version dev)
::group::opam wrap files
wrapping /usr/local/bin/opam
attempting to wrap coqc
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqc
attempting to wrap coqtop
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqtop
::endgroup::
++ �[33;1m(/github/workspace/run-script.sh @ line 10) $�[0m opam pin add coqide-server git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon -y --no-action
[NOTE] Package coqide-server is currently pinned to git+https://github.com/coq/coq#44155b062e6c384cc3ca36293b99dcd13f9cb085 (version dev).
[coqide-server.dev] synchronised (git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon)
coqide-server is now pinned to git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon (version dev)
::group::opam wrap files
wrapping /usr/local/bin/opam
attempting to wrap coqc
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqc
attempting to wrap coqtop
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqtop
::endgroup::
++ �[33;1m(/github/workspace/run-script.sh @ line 11) $�[0m opam reinstall coq coq-core coq-stdlib coqide-server -y --confirm-level=unsafe-yes

<><> Synchronising pinned packages ><><><><><><><><><><><><><><><><><><><><><><>
[coq-core.dev] synchronised (no changes)
[coq.dev] synchronised (no changes)
[coq-stdlib.dev] synchronised (no changes)
[coqide-server.dev] synchronised (no changes)

The following actions will be performed:
=== recompile 5 packages
  - recompile coq           dev (pinned)
  - recompile coq-bignums   dev          [uses coq]
  - recompile coq-core      dev (pinned)
  - recompile coq-stdlib    dev (pinned)
  - recompile coqide-server dev (pinned)

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> retrieved coq-bignums.dev  (no changes)
-> removed   coq-bignums.dev
-> removed   coq.dev
-> removed   coq-stdlib.dev
-> removed   coqide-server.dev
-> removed   coq-core.dev
-> installed coq-core.dev
-> installed coqide-server.dev
-> installed coq-stdlib.dev
-> installed coq.dev
-> installed coq-bignums.dev
Done.
::group::opam wrap files
wrapping /usr/local/bin/opam
attempting to wrap coqc
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqc
attempting to wrap coqtop
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqtop
::endgroup::
++ �[33;1m(/github/workspace/run-script.sh @ line 12) $�[0m true
++ �[33;1m(/github/workspace/run-script.sh @ line 12) $�[0m coqtop
Welcome to Coq badd4d0ebc79:/home/coq/.opam/4.13.1+flambda/.opam-switch/build/coq-core.dev/_build/default,master (b999f458037563317ddbb8ab6e3ecf9e1986077d)

Coq < 
++ �[33;1m(/github/workspace/run-script.sh @ line 13) $�[0m coqc --version
The Coq Proof Assistant, version 8.21+alpha
compiled with OCaml 4.13.1
++ �[33;1m(/github/workspace/run-script.sh @ line 15) $�[0m cat
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m coqc -q bug.v
File "./bug.v", line 1, characters 8-25:
Warning: Coq.ZArith.ZArith has been replaced by Stdlib.ZArith.ZArith.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
File "./bug.v", line 3, characters 7-24:
Warning: Coq.micromega.Lia has been replaced by Stdlib.micromega.Lia.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
File "./bug.v", line 4, characters 7-25:
Warning: Coq.Arith.PeanoNat has been replaced by Stdlib.Arith.PeanoNat.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
File "./bug.v", line 5, characters 7-21:
Warning: Coq.Lists.List has been replaced by Stdlib.Lists.List.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
File "./bug.v", line 53, characters 56-68:
Error: No information can be deduced from this equality and the injectivity
of constructors. This may be because the terms are convertible, or due to
pattern matching restrictions in the sort Prop. You can try to use option Set
Keep Proof Equalities.
📜 🔎 Minimization Log
Error: Could not find FAILING_COQC ('')
Files in '':

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.

@JasonGross
Copy link
Owner Author

@coqbot minimize coq.dev

#!/usr/bin/env bash

true | coqtop
coqc --version
opam pin remove coq -y --no-action
opam pin add coq 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y --no-action
opam pin add coq 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y --no-action
opam pin add coq-core 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y --no-action
opam pin add coq-stdlib 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y --no-action
opam pin add coqide-server 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y --no-action
opam reinstall coq coq-core coq-stdlib coqide-server -y --confirm-level=unsafe-yes || exit 1
true | coqtop
coqc --version

cat <<EOF > bug.v
Require Coq.ZArith.ZArith.

Import Coq.micromega.Lia.
Import Coq.Arith.PeanoNat.
Import Coq.Lists.List.
Import ListNotations.

Module Import Nat.
  Definition div_up a b := Nat.div (a + (b-1)) b.
  Lemma div_up_range a b (H : b <> 0) : a <= div_up a b * b < a + b.
Admitted.

  Lemma div_up_add_mod a b n:
    (a mod n = 0)%nat ->
    Nat.div_up (a + b) n =
    (Nat.div_up a n + Nat.div_up b n)%nat.
Admitted.

  Lemma div_up_exact_mod a b:
    (b <> 0)%nat ->
    (a mod b = 0)%nat ->
    ((Nat.div_up a b) * b = a)%nat.
Admitted.

Section Chunk.
  Context [A : Type] (k : nat).
  Implicit Types (bs ck xs ys : list A).
Fixpoint chunk' bs ck {struct bs} : list (list A).
Admitted.
  Definition chunk bs := chunk' bs [].

  Context (Hk : k <> 0).

  Lemma nth_error_chunk bs i (Hi : i < div_up (length bs) k)
    : nth_error (chunk bs) i = Some (firstn k (skipn (i*k) bs)).
Admitted.

  Lemma length_chunk bs : length (chunk bs) = div_up (length bs) k.
Admitted.

  Lemma length_chunk_app (l l' : list A) :
    (length l mod k)%nat = 0%nat ->
    length (chunk (l ++ l')) = length (chunk l ++ chunk l').
Admitted.

  Lemma chunk_app : forall (l l': list A),
      (length l mod k = 0)%nat ->
      chunk (l ++ l') = chunk l ++ chunk l'.
  Proof.
    intros * Hmod.
    eapply nth_ext with (d := []) (d' := []); [ | intros idx ].
    - apply length_chunk_app; assumption.
    - intros Hidx; eassert (Some _ = Some _) as HS; [ | injection HS; intros Hs; apply Hs ].
      rewrite <- !nth_error_nth' by assumption.
      rewrite <- !nth_error_nth' by (rewrite length_chunk_app in Hidx; eassumption).
      assert (idx < length (chunk l) \/ length (chunk l) <= idx)%nat as [Hlt | Hge] by lia;
        [ rewrite nth_error_app1 | rewrite nth_error_app2 ]; try eassumption.
      all: rewrite !nth_error_chunk.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hlt by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hidx by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hge by assumption.
      all: rewrite ?length_chunk, ?app_length, ?div_up_add_mod by assumption.
      all: try lia.
      all: pose proof Nat.div_up_range (length l) k ltac:(lia).
      + pose proof div_up_exact_mod (length l) k ltac:(lia) ltac:(lia).
        rewrite !firstn_skipn_comm, !firstn_app.
        replace (idx * k + k - length l)%nat with 0%nat by nia.
        simpl; rewrite app_nil_r; reflexivity.
      + rewrite Nat.mul_sub_distr_r.
        erewrite div_up_exact_mod by lia.
        rewrite skipn_app, skipn_all2; [ reflexivity | nia ].
  Qed.
EOF

coqc -q bug.v

Copy link

coqbot-app bot commented Sep 11, 2024

Hey @JasonGross, the coq bug minimizer is running your script, I'll come back to you with the results once it's done.

Copy link

coqbot-app bot commented Sep 11, 2024

@JasonGross, Error: Could not minimize file (full log on GitHub Actions, cc @JasonGross)

build log

minimizer 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.

@JasonGross
Copy link
Owner Author

@coqbot minimize coq.dev

#!/usr/bin/env bash

true | coqtop
coqc --version
opam pin remove coq -y --no-action
opam pin add coq 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y --no-action
opam pin add coq 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y --no-action
opam pin add coq-core 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y --no-action
opam pin add coq-stdlib 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y --no-action
opam pin add coqide-server 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y --no-action
opam reinstall coq coq-core coq-stdlib coqide-server -y --confirm-level=unsafe-yes || exit 1
true | coqtop
coqc --version

cat <<EOF > bug.v
Require Coq.ZArith.ZArith.

Import Coq.micromega.Lia.
Import Coq.Arith.PeanoNat.
Import Coq.Lists.List.
Import ListNotations.

Module Import Nat.
  Definition div_up a b := Nat.div (a + (b-1)) b.
  Lemma div_up_range a b (H : b <> 0) : a <= div_up a b * b < a + b.
Admitted.

  Lemma div_up_add_mod a b n:
    (a mod n = 0)%nat ->
    Nat.div_up (a + b) n =
    (Nat.div_up a n + Nat.div_up b n)%nat.
Admitted.

  Lemma div_up_exact_mod a b:
    (b <> 0)%nat ->
    (a mod b = 0)%nat ->
    ((Nat.div_up a b) * b = a)%nat.
Admitted.

Section Chunk.
  Context [A : Type] (k : nat).
  Implicit Types (bs ck xs ys : list A).
Fixpoint chunk' bs ck {struct bs} : list (list A).
Admitted.
  Definition chunk bs := chunk' bs [].

  Context (Hk : k <> 0).

  Lemma nth_error_chunk bs i (Hi : i < div_up (length bs) k)
    : nth_error (chunk bs) i = Some (firstn k (skipn (i*k) bs)).
Admitted.

  Lemma length_chunk bs : length (chunk bs) = div_up (length bs) k.
Admitted.

  Lemma length_chunk_app (l l' : list A) :
    (length l mod k)%nat = 0%nat ->
    length (chunk (l ++ l')) = length (chunk l ++ chunk l').
Admitted.

  Lemma chunk_app : forall (l l': list A),
      (length l mod k = 0)%nat ->
      chunk (l ++ l') = chunk l ++ chunk l'.
  Proof.
    intros * Hmod.
    eapply nth_ext with (d := []) (d' := []); [ | intros idx ].
    - apply length_chunk_app; assumption.
    - intros Hidx; eassert (Some _ = Some _) as HS; [ | injection HS; intros Hs; apply Hs ].
      rewrite <- !nth_error_nth' by assumption.
      rewrite <- !nth_error_nth' by (rewrite length_chunk_app in Hidx; eassumption).
      assert (idx < length (chunk l) \/ length (chunk l) <= idx)%nat as [Hlt | Hge] by lia;
        [ rewrite nth_error_app1 | rewrite nth_error_app2 ]; try eassumption.
      all: rewrite !nth_error_chunk.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hlt by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hidx by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hge by assumption.
      all: rewrite ?length_chunk, ?app_length, ?div_up_add_mod by assumption.
      all: try lia.
      all: pose proof Nat.div_up_range (length l) k ltac:(lia).
      + pose proof div_up_exact_mod (length l) k ltac:(lia) ltac:(lia).
        rewrite !firstn_skipn_comm, !firstn_app.
        replace (idx * k + k - length l)%nat with 0%nat by nia.
        simpl; rewrite app_nil_r; reflexivity.
      + rewrite Nat.mul_sub_distr_r.
        erewrite div_up_exact_mod by lia.
        rewrite skipn_app, skipn_all2; [ reflexivity | nia ].
  Qed.
EOF

coqc -q bug.v

Copy link

coqbot-app bot commented Sep 11, 2024

Hey @JasonGross, the coq bug minimizer is running your script, I'll come back to you with the results once it's done.

Copy link

coqbot-app bot commented Sep 11, 2024

@JasonGross, Minimized File /home/runner/work/run-coq-bug-minimizer/run-coq-bug-minimizer/bug.v (full log on GitHub Actions - verbose log)

🌟 Minimized Coq File (consider adding this file to the test-suite)
(* -*- mode: coq; coq-prog-args: ("-emacs" "-q" "-w" "-deprecated-native-compiler-option,-native-compiler-disabled" "-native-compiler" "ondemand" "-Q" "/github/workspace/cwd" "Top" "-Q" "/home/coq/.opam/4.13.1+flambda/lib/coq/user-contrib/Bignums" "Bignums" "-Q" "/home/coq/.opam/4.13.1+flambda/lib/coq/user-contrib/Ltac2" "Ltac2" "-top" "Top.bug_01") -*- *)
(* File reduced by coq-bug-minimizer from original input, then from 87 lines to 50 lines, then from 55 lines to 52 lines *)
(* coqc version 8.21+alpha compiled with OCaml 4.13.1
   coqtop version 58611a5f03d0:/home/coq/.opam/4.13.1+flambda/.opam-switch/build/coq-core.dev/_build/default,master (b999f458037563317ddbb8ab6e3ecf9e1986077d)
   Expected coqc runtime on this file: 0.220 sec *)

Require Stdlib.ZArith.ZArith.

Import Coq.Arith.PeanoNat.
Import Coq.Lists.List.
Import ListNotations.

Section Chunk.
  Context [A : Type] (k : nat).
  Implicit Types (bs ck xs ys : list A).
Fixpoint chunk' bs ck {struct bs} : list (list A).
Admitted.
  Definition chunk bs := chunk' bs [].

  Lemma length_chunk_app (l l' : list A) :
    (length l mod k)%nat = 0%nat ->
    length (chunk (l ++ l')) = length (chunk l ++ chunk l').
Admitted.

  Lemma chunk_app : forall (l l': list A),
      (length l mod k = 0)%nat ->
      chunk (l ++ l') = chunk l ++ chunk l'.
  Proof.
    intros * Hmod.
    eapply nth_ext with (d := []) (d' := []); [ | intros idx ].
    -
 apply length_chunk_app; assumption.
    -
 intros Hidx; eassert (Some _ = Some _) as HS; [ | injection HS; intros Hs; apply Hs ].
      rewrite <- !nth_error_nth' by assumption.
      rewrite <- !nth_error_nth' by (rewrite length_chunk_app in Hidx; eassumption).
      assert (idx < length (chunk l) \/ length (chunk l) <= idx)%nat as [Hlt | Hge] by lia;
        [ rewrite nth_error_app1 | rewrite nth_error_app2 ]; try eassumption.
      all: rewrite !nth_error_chunk.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hlt by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hidx by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hge by assumption.
      all: rewrite ?length_chunk, ?app_length, ?div_up_add_mod by assumption.
      all: try lia.
      all: pose proof Nat.div_up_range (length l) k ltac:(lia).
      +
 pose proof div_up_exact_mod (length l) k ltac:(lia) ltac:(lia).
        rewrite !firstn_skipn_comm, !firstn_app.
        replace (idx * k + k - length l)%nat with 0%nat by nia.
        simpl; rewrite app_nil_r; reflexivity.
      +
 rewrite Nat.mul_sub_distr_r.
        erewrite div_up_exact_mod by lia.
        rewrite skipn_app, skipn_all2; [ reflexivity | nia ].
  Qed.
🛠️ Intermediate Coq File (useful for debugging if minimization did not go as far as you wanted)
🛠️ 📜 Intermediate Coq File log (useful for debugging if minimization did not go as far as you wanted)
📜 Build Log (contains the Coq error message) (truncated to last 8.0KiB; full 14KiB file on GitHub Actions Artifacts under build.log)
o-action
Ok, coq is no longer pinned to git+https://github.com/coq/coq#44155b062e6c384cc3ca36293b99dcd13f9cb085 (version dev)
::group::opam wrap files
wrapping /usr/local/bin/opam
attempting to wrap coqc
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqc
attempting to wrap coqtop
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqtop
::endgroup::
++ �[33;1m(/github/workspace/run-script.sh @ line 6) $�[0m opam pin add coq git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon -y --no-action
[coq.dev] synchronised (git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon)
[WARNING] Failed checks on coq package definition from source at git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon:
           warning 41: Some packages are mentioned in package scripts or features, but there is no dependency or depopt toward them: "coq-native"
coq is now pinned to git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon (version dev)
::group::opam wrap files
wrapping /usr/local/bin/opam
attempting to wrap coqc
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqc
attempting to wrap coqtop
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqtop
::endgroup::
++ �[33;1m(/github/workspace/run-script.sh @ line 7) $�[0m opam pin add coq git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon -y --no-action
[NOTE] Package coq is already pinned to git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon (version dev).
[coq.dev] synchronised (no changes)
[WARNING] Failed checks on coq package definition from source at git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon:
           warning 41: Some packages are mentioned in package scripts or features, but there is no dependency or depopt toward them: "coq-native"
coq is now pinned to git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon (version dev)
::group::opam wrap files
wrapping /usr/local/bin/opam
attempting to wrap coqc
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqc
attempting to wrap coqtop
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqtop
::endgroup::
++ �[33;1m(/github/workspace/run-script.sh @ line 8) $�[0m opam pin add coq-core git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon -y --no-action
[NOTE] Package coq-core is currently pinned to git+https://github.com/coq/coq#44155b062e6c384cc3ca36293b99dcd13f9cb085 (version dev).
[coq-core.dev] synchronised (git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon)
coq-core is now pinned to git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon (version dev)
::group::opam wrap files
wrapping /usr/local/bin/opam
attempting to wrap coqc
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqc
attempting to wrap coqtop
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqtop
::endgroup::
++ �[33;1m(/github/workspace/run-script.sh @ line 9) $�[0m opam pin add coq-stdlib git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon -y --no-action
[NOTE] Package coq-stdlib is currently pinned to git+https://github.com/coq/coq#44155b062e6c384cc3ca36293b99dcd13f9cb085 (version dev).
[coq-stdlib.dev] synchronised (git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon)
coq-stdlib is now pinned to git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon (version dev)
::group::opam wrap files
wrapping /usr/local/bin/opam
attempting to wrap coqc
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqc
attempting to wrap coqtop
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqtop
::endgroup::
++ �[33;1m(/github/workspace/run-script.sh @ line 10) $�[0m opam pin add coqide-server git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon -y --no-action
[NOTE] Package coqide-server is currently pinned to git+https://github.com/coq/coq#44155b062e6c384cc3ca36293b99dcd13f9cb085 (version dev).
[coqide-server.dev] synchronised (git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon)
coqide-server is now pinned to git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon (version dev)
::group::opam wrap files
wrapping /usr/local/bin/opam
attempting to wrap coqc
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqc
attempting to wrap coqtop
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqtop
::endgroup::
++ �[33;1m(/github/workspace/run-script.sh @ line 11) $�[0m opam reinstall coq coq-core coq-stdlib coqide-server -y --confirm-level=unsafe-yes

<><> Synchronising pinned packages ><><><><><><><><><><><><><><><><><><><><><><>
[coq.dev] synchronised (no changes)
[coq-stdlib.dev] synchronised (no changes)
[coq-core.dev] synchronised (no changes)
[coqide-server.dev] synchronised (no changes)

The following actions will be performed:
=== recompile 5 packages
  - recompile coq           dev (pinned)
  - recompile coq-bignums   dev          [uses coq]
  - recompile coq-core      dev (pinned)
  - recompile coq-stdlib    dev (pinned)
  - recompile coqide-server dev (pinned)

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> retrieved coq-bignums.dev  (no changes)
-> removed   coq-bignums.dev
-> removed   coq.dev
-> removed   coq-stdlib.dev
-> removed   coqide-server.dev
-> removed   coq-core.dev
-> installed coq-core.dev
-> installed coqide-server.dev
-> installed coq-stdlib.dev
-> installed coq.dev
-> installed coq-bignums.dev
Done.
::group::opam wrap files
wrapping /usr/local/bin/opam
attempting to wrap coqc
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqc
attempting to wrap coqtop
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqtop
::endgroup::
++ �[33;1m(/github/workspace/run-script.sh @ line 12) $�[0m true
++ �[33;1m(/github/workspace/run-script.sh @ line 12) $�[0m coqtop
MINIMIZER_DEBUG_EXTRA: coqc: /home/coq/.opam/4.13.1+flambda/bin/coqtop
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace
MINIMIZER_DEBUG_EXTRA: exec: /home/coq/.opam/4.13.1+flambda/bin/coqtop.orig 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.uxoPqOdYa1
MINIMIZER_DEBUG: files: 
Welcome to Coq 58611a5f03d0:/home/coq/.opam/4.13.1+flambda/.opam-switch/build/coq-core.dev/_build/default,master (b999f458037563317ddbb8ab6e3ecf9e1986077d)

Coq < 
++ �[33;1m(/github/workspace/run-script.sh @ line 13) $�[0m coqc --version
MINIMIZER_DEBUG_EXTRA: coqc: /home/coq/.opam/4.13.1+flambda/bin/coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace
MINIMIZER_DEBUG_EXTRA: exec: /home/coq/.opam/4.13.1+flambda/bin/coqc.orig --version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.5xOwAYIomW
MINIMIZER_DEBUG: files: 
The Coq Proof Assistant, version 8.21+alpha
compiled with OCaml 4.13.1
++ �[33;1m(/github/workspace/run-script.sh @ line 15) $�[0m cat
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m coqc -q bug.v
MINIMIZER_DEBUG_EXTRA: coqc: /home/coq/.opam/4.13.1+flambda/bin/coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace
MINIMIZER_DEBUG_EXTRA: exec: /home/coq/.opam/4.13.1+flambda/bin/coqc.orig -q bug.v 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.dFxqq7m8SX
MINIMIZER_DEBUG: files:  bug.v
File "./bug.v", line 1, characters 8-25:
Warning: Coq.ZArith.ZArith has been replaced by Stdlib.ZArith.ZArith.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
File "./bug.v", line 3, characters 7-24:
Warning: Coq.micromega.Lia has been replaced by Stdlib.micromega.Lia.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
File "./bug.v", line 4, characters 7-25:
Warning: Coq.Arith.PeanoNat has been replaced by Stdlib.Arith.PeanoNat.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
File "./bug.v", line 5, characters 7-21:
Warning: Coq.Lists.List has been replaced by Stdlib.Lists.List.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
File "./bug.v", line 53, characters 56-68:
Error: No information can be deduced from this equality and the injectivity
of constructors. This may be because the terms are convertible, or due to
pattern matching restrictions in the sort Prop. You can try to use option Set
Keep Proof Equalities.
📜 🔎 Minimization Log (truncated to last 8.0KiB; full 38KiB file on GitHub Actions Artifacts under bug.log)
l successful.�[0m

I will now attempt to remove unused variables
�[92m
Variable removal successful.�[0m

I will now attempt to remove unused contexts
�[92m
Context removal successful.�[0m

I will now attempt to replace Qed Obligation with Admit Obligations
�[92m
Admitting Qed Obligations successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting Qed Obligations unsuccessful.
No successful changes.

I will now attempt to replace Qeds with Admitteds

Non-fatal error: Failed to admit Qeds and preserve the error.  
The new error was:
File "/tmp/tmpli5p9x1o/Top/bug_01.v", line 11, characters 7-25:
Warning: Coq.Arith.PeanoNat has been replaced by Stdlib.Arith.PeanoNat.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
File "/tmp/tmpli5p9x1o/Top/bug_01.v", line 12, characters 7-21:
Warning: Coq.Lists.List has been replaced by Stdlib.Lists.List.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
Error: The section Chunk needs to be closed.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting Qeds unsuccessful.
No successful changes.

I will now attempt to replace Qeds with admit. Defined.

Non-fatal error: Failed to admit Qeds and preserve the error.  
The new error was:
File "/tmp/tmp0do1q1cm/Top/bug_01.v", line 11, characters 7-25:
Warning: Coq.Arith.PeanoNat has been replaced by Stdlib.Arith.PeanoNat.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
File "/tmp/tmp0do1q1cm/Top/bug_01.v", line 12, characters 7-21:
Warning: Coq.Lists.List has been replaced by Stdlib.Lists.List.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
File "/tmp/tmp0do1q1cm/Top/bug_01.v", line 31, characters 0-8:
Error:  (in proof chunk_app): Attempt to save an incomplete proof
(the proof term is not complete because of given up (admitted) goals).
If this is really what you want to do, use Admitted in place of Qed.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting Qeds unsuccessful.
No successful changes.

I will now attempt to remove goals ending in [Abort.]
�[92m
Aborted removal successful.�[0m

I will now attempt to remove unused Ltacs
�[92m
Ltac removal successful.�[0m

I will now attempt to remove unused definitions
�[92m
Definition removal successful.�[0m

I will now attempt to remove unused non-instance, non-canonical structure definitions
�[92m
Non-instance definition removal successful.�[0m

I will now attempt to remove unused variables
�[92m
Variable removal successful.�[0m

I will now attempt to remove unused contexts
�[92m
Context removal successful.�[0m

I will now attempt to admit [abstract ...]s
�[92m
Admitting [abstract ...] successful.�[0m
�[92m
Admitting [abstract ...] successful.�[0m
Admitting [abstract ...] unsuccessful.
Admitting [abstract ...] unsuccessful.

I will now attempt to remove goals ending in [Abort.]
�[92m
Aborted removal successful.�[0m

I will now attempt to remove unused Ltacs
�[92m
Ltac removal successful.�[0m

I will now attempt to remove unused definitions
�[92m
Definition removal successful.�[0m

I will now attempt to remove unused non-instance, non-canonical structure definitions
�[92m
Non-instance definition removal successful.�[0m

I will now attempt to remove unused variables
�[92m
Variable removal successful.�[0m

I will now attempt to remove unused contexts
�[92m
Context removal successful.�[0m

I will now attempt to replace Obligation with Admit Obligations
�[92m
Admitting Obligations successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting Obligations unsuccessful.
No successful changes.

I will now attempt to admit lemmas with Admitted

Non-fatal error: Failed to admit lemmas and preserve the error.  
The new error was:
File "/tmp/tmpli5p9x1o/Top/bug_01.v", line 11, characters 7-25:
Warning: Coq.Arith.PeanoNat has been replaced by Stdlib.Arith.PeanoNat.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
File "/tmp/tmpli5p9x1o/Top/bug_01.v", line 12, characters 7-21:
Warning: Coq.Lists.List has been replaced by Stdlib.Lists.List.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
Error: The section Chunk needs to be closed.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting lemmas unsuccessful.
No successful changes.

I will now attempt to admit definitions with Admitted

Non-fatal error: Failed to admit definitions and preserve the error.  
The new error was:
File "/tmp/tmpli5p9x1o/Top/bug_01.v", line 11, characters 7-25:
Warning: Coq.Arith.PeanoNat has been replaced by Stdlib.Arith.PeanoNat.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
File "/tmp/tmpli5p9x1o/Top/bug_01.v", line 12, characters 7-21:
Warning: Coq.Lists.List has been replaced by Stdlib.Lists.List.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
Error: The section Chunk needs to be closed.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting definitions unsuccessful.
No successful changes.

I will now attempt to admit lemmas with admit. Defined

Non-fatal error: Failed to admit lemmas and preserve the error.  
The new error was:
File "/tmp/tmp0do1q1cm/Top/bug_01.v", line 11, characters 7-25:
Warning: Coq.Arith.PeanoNat has been replaced by Stdlib.Arith.PeanoNat.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
File "/tmp/tmp0do1q1cm/Top/bug_01.v", line 12, characters 7-21:
Warning: Coq.Lists.List has been replaced by Stdlib.Lists.List.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
File "/tmp/tmp0do1q1cm/Top/bug_01.v", line 31, characters 0-8:
Error:  (in proof chunk_app): Attempt to save an incomplete proof
(the proof term is not complete because of given up (admitted) goals).
If this is really what you want to do, use Admitted in place of Qed.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting lemmas unsuccessful.
No successful changes.

I will now attempt to admit definitions with admit. Defined

Non-fatal error: Failed to admit definitions and preserve the error.  
The new error was:
File "/tmp/tmp0do1q1cm/Top/bug_01.v", line 11, characters 7-25:
Warning: Coq.Arith.PeanoNat has been replaced by Stdlib.Arith.PeanoNat.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
File "/tmp/tmp0do1q1cm/Top/bug_01.v", line 12, characters 7-21:
Warning: Coq.Lists.List has been replaced by Stdlib.Lists.List.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
File "/tmp/tmp0do1q1cm/Top/bug_01.v", line 31, characters 0-8:
Error:  (in proof chunk_app): Attempt to save an incomplete proof
(the proof term is not complete because of given up (admitted) goals).
If this is really what you want to do, use Admitted in place of Qed.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting definitions unsuccessful.
No successful changes.

I will now attempt to export modules
Module exportation unsuccessful.

I will now attempt to split imports and exports
Import/Export splitting unsuccessful.

I will now attempt to split := definitions
One-line definition splitting unsuccessful.

I will now attempt to remove all lines, one at a time
Line removal unsuccessful.

I will now attempt to remove goals ending in [Abort.]
�[92m
Aborted removal successful.�[0m

I will now attempt to remove unused Ltacs
�[92m
Ltac removal successful.�[0m

I will now attempt to remove unused definitions
�[92m
Definition removal successful.�[0m

I will now attempt to remove unused non-instance, non-canonical structure definitions
�[92m
Non-instance definition removal successful.�[0m

I will now attempt to remove unused variables
�[92m
Variable removal successful.�[0m

I will now attempt to remove unused contexts
�[92m
Context removal successful.�[0m

I will now attempt to remove empty sections

No empty sections to remove.

Now, I will attempt to strip repeated newlines and trailing spaces from this file...
�[92m
Succeeded in stripping newlines and spaces.�[0m

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.

@JasonGross
Copy link
Owner Author

@coqbot minimize coq.dev

#!/usr/bin/env bash

true | coqtop
coqc --version
opam pin remove coq -y --no-action
opam pin add coq 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y --no-action
opam pin add coq 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y --no-action
opam pin add coq-core 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y --no-action
opam pin add coq-stdlib 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y --no-action
opam pin add coqide-server 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y --no-action
opam reinstall coq coq-core coq-stdlib coqide-server -y --confirm-level=unsafe-yes || exit 1
true | coqtop
coqc --version

cat <<EOF > bug.v
Require Coq.ZArith.ZArith.

Import Coq.micromega.Lia.
Import Coq.Arith.PeanoNat.
Import Coq.Lists.List.
Import ListNotations.

Module Import Nat.
  Definition div_up a b := Nat.div (a + (b-1)) b.
  Lemma div_up_range a b (H : b <> 0) : a <= div_up a b * b < a + b.
Admitted.

  Lemma div_up_add_mod a b n:
    (a mod n = 0)%nat ->
    Nat.div_up (a + b) n =
    (Nat.div_up a n + Nat.div_up b n)%nat.
Admitted.

  Lemma div_up_exact_mod a b:
    (b <> 0)%nat ->
    (a mod b = 0)%nat ->
    ((Nat.div_up a b) * b = a)%nat.
Admitted.

Section Chunk.
  Context [A : Type] (k : nat).
  Implicit Types (bs ck xs ys : list A).
Fixpoint chunk' bs ck {struct bs} : list (list A).
Admitted.
  Definition chunk bs := chunk' bs [].

  Context (Hk : k <> 0).

  Lemma nth_error_chunk bs i (Hi : i < div_up (length bs) k)
    : nth_error (chunk bs) i = Some (firstn k (skipn (i*k) bs)).
Admitted.

  Lemma length_chunk bs : length (chunk bs) = div_up (length bs) k.
Admitted.

  Lemma length_chunk_app (l l' : list A) :
    (length l mod k)%nat = 0%nat ->
    length (chunk (l ++ l')) = length (chunk l ++ chunk l').
Admitted.

  Lemma chunk_app : forall (l l': list A),
      (length l mod k = 0)%nat ->
      chunk (l ++ l') = chunk l ++ chunk l'.
  Proof.
    intros * Hmod.
    eapply nth_ext with (d := []) (d' := []); [ | intros idx ].
    - apply length_chunk_app; assumption.
    - intros Hidx; eassert (Some _ = Some _) as HS; [ | injection HS; intros Hs; apply Hs ].
      rewrite <- !nth_error_nth' by assumption.
      rewrite <- !nth_error_nth' by (rewrite length_chunk_app in Hidx; eassumption).
      assert (idx < length (chunk l) \/ length (chunk l) <= idx)%nat as [Hlt | Hge] by lia;
        [ rewrite nth_error_app1 | rewrite nth_error_app2 ]; try eassumption.
      all: rewrite !nth_error_chunk.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hlt by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hidx by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hge by assumption.
      all: rewrite ?length_chunk, ?app_length, ?div_up_add_mod by assumption.
      all: try lia.
      all: pose proof Nat.div_up_range (length l) k ltac:(lia).
      + pose proof div_up_exact_mod (length l) k ltac:(lia) ltac:(lia).
        rewrite !firstn_skipn_comm, !firstn_app.
        replace (idx * k + k - length l)%nat with 0%nat by nia.
        simpl; rewrite app_nil_r; reflexivity.
      + rewrite Nat.mul_sub_distr_r.
        erewrite div_up_exact_mod by lia.
        rewrite skipn_app, skipn_all2; [ reflexivity | nia ].
  Qed.
EOF

coqc -q bug.v

Copy link

coqbot-app bot commented Sep 11, 2024

Hey @JasonGross, the coq bug minimizer is running your script, I'll come back to you with the results once it's done.

Copy link

coqbot-app bot commented Sep 11, 2024

@JasonGross, Minimized File /home/runner/work/run-coq-bug-minimizer/run-coq-bug-minimizer/bug.v (full log on GitHub Actions - verbose log)

🌟 Minimized Coq File (consider adding this file to the test-suite)
(* -*- mode: coq; coq-prog-args: ("-emacs" "-q" "-w" "-deprecated-native-compiler-option,-native-compiler-disabled" "-native-compiler" "ondemand" "-Q" "/github/workspace/cwd" "Top" "-Q" "/home/coq/.opam/4.13.1+flambda/lib/coq/user-contrib/Bignums" "Bignums" "-Q" "/home/coq/.opam/4.13.1+flambda/lib/coq/user-contrib/Ltac2" "Ltac2" "-top" "Top.bug_01") -*- *)
(* File reduced by coq-bug-minimizer from original input, then from 87 lines to 50 lines, then from 55 lines to 52 lines *)
(* coqc version 8.21+alpha compiled with OCaml 4.13.1
   coqtop version 5e78f6d93a6e:/home/coq/.opam/4.13.1+flambda/.opam-switch/build/coq-core.dev/_build/default,master (b999f458037563317ddbb8ab6e3ecf9e1986077d)
   Expected coqc runtime on this file: 0.218 sec *)

Require Stdlib.ZArith.ZArith.

Import Coq.Arith.PeanoNat.
Import Coq.Lists.List.
Import ListNotations.

Section Chunk.
  Context [A : Type] (k : nat).
  Implicit Types (bs ck xs ys : list A).
Fixpoint chunk' bs ck {struct bs} : list (list A).
Admitted.
  Definition chunk bs := chunk' bs [].

  Lemma length_chunk_app (l l' : list A) :
    (length l mod k)%nat = 0%nat ->
    length (chunk (l ++ l')) = length (chunk l ++ chunk l').
Admitted.

  Lemma chunk_app : forall (l l': list A),
      (length l mod k = 0)%nat ->
      chunk (l ++ l') = chunk l ++ chunk l'.
  Proof.
    intros * Hmod.
    eapply nth_ext with (d := []) (d' := []); [ | intros idx ].
    -
 apply length_chunk_app; assumption.
    -
 intros Hidx; eassert (Some _ = Some _) as HS; [ | injection HS; intros Hs; apply Hs ].
      rewrite <- !nth_error_nth' by assumption.
      rewrite <- !nth_error_nth' by (rewrite length_chunk_app in Hidx; eassumption).
      assert (idx < length (chunk l) \/ length (chunk l) <= idx)%nat as [Hlt | Hge] by lia;
        [ rewrite nth_error_app1 | rewrite nth_error_app2 ]; try eassumption.
      all: rewrite !nth_error_chunk.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hlt by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hidx by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hge by assumption.
      all: rewrite ?length_chunk, ?app_length, ?div_up_add_mod by assumption.
      all: try lia.
      all: pose proof Nat.div_up_range (length l) k ltac:(lia).
      +
 pose proof div_up_exact_mod (length l) k ltac:(lia) ltac:(lia).
        rewrite !firstn_skipn_comm, !firstn_app.
        replace (idx * k + k - length l)%nat with 0%nat by nia.
        simpl; rewrite app_nil_r; reflexivity.
      +
 rewrite Nat.mul_sub_distr_r.
        erewrite div_up_exact_mod by lia.
        rewrite skipn_app, skipn_all2; [ reflexivity | nia ].
  Qed.
🛠️ Intermediate Coq File (useful for debugging if minimization did not go as far as you wanted)
🛠️ 📜 Intermediate Coq File log (useful for debugging if minimization did not go as far as you wanted)
📜 Build Log (contains the Coq error message) (truncated to last 8.0KiB; full 14KiB file on GitHub Actions Artifacts under build.log)
o-action
Ok, coq is no longer pinned to git+https://github.com/coq/coq#44155b062e6c384cc3ca36293b99dcd13f9cb085 (version dev)
::group::opam wrap files
wrapping /usr/local/bin/opam
attempting to wrap coqc
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqc
attempting to wrap coqtop
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqtop
::endgroup::
++ �[33;1m(/github/workspace/run-script.sh @ line 6) $�[0m opam pin add coq git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon -y --no-action
[coq.dev] synchronised (git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon)
[WARNING] Failed checks on coq package definition from source at git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon:
           warning 41: Some packages are mentioned in package scripts or features, but there is no dependency or depopt toward them: "coq-native"
coq is now pinned to git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon (version dev)
::group::opam wrap files
wrapping /usr/local/bin/opam
attempting to wrap coqc
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqc
attempting to wrap coqtop
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqtop
::endgroup::
++ �[33;1m(/github/workspace/run-script.sh @ line 7) $�[0m opam pin add coq git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon -y --no-action
[NOTE] Package coq is already pinned to git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon (version dev).
[coq.dev] synchronised (no changes)
[WARNING] Failed checks on coq package definition from source at git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon:
           warning 41: Some packages are mentioned in package scripts or features, but there is no dependency or depopt toward them: "coq-native"
coq is now pinned to git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon (version dev)
::group::opam wrap files
wrapping /usr/local/bin/opam
attempting to wrap coqc
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqc
attempting to wrap coqtop
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqtop
::endgroup::
++ �[33;1m(/github/workspace/run-script.sh @ line 8) $�[0m opam pin add coq-core git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon -y --no-action
[NOTE] Package coq-core is currently pinned to git+https://github.com/coq/coq#44155b062e6c384cc3ca36293b99dcd13f9cb085 (version dev).
[coq-core.dev] synchronised (git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon)
coq-core is now pinned to git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon (version dev)
::group::opam wrap files
wrapping /usr/local/bin/opam
attempting to wrap coqc
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqc
attempting to wrap coqtop
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqtop
::endgroup::
++ �[33;1m(/github/workspace/run-script.sh @ line 9) $�[0m opam pin add coq-stdlib git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon -y --no-action
[NOTE] Package coq-stdlib is currently pinned to git+https://github.com/coq/coq#44155b062e6c384cc3ca36293b99dcd13f9cb085 (version dev).
[coq-stdlib.dev] synchronised (git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon)
coq-stdlib is now pinned to git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon (version dev)
::group::opam wrap files
wrapping /usr/local/bin/opam
attempting to wrap coqc
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqc
attempting to wrap coqtop
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqtop
::endgroup::
++ �[33;1m(/github/workspace/run-script.sh @ line 10) $�[0m opam pin add coqide-server git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon -y --no-action
[NOTE] Package coqide-server is currently pinned to git+https://github.com/coq/coq#44155b062e6c384cc3ca36293b99dcd13f9cb085 (version dev).
[coqide-server.dev] synchronised (git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon)
coqide-server is now pinned to git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon (version dev)
::group::opam wrap files
wrapping /usr/local/bin/opam
attempting to wrap coqc
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqc
attempting to wrap coqtop
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqtop
::endgroup::
++ �[33;1m(/github/workspace/run-script.sh @ line 11) $�[0m opam reinstall coq coq-core coq-stdlib coqide-server -y --confirm-level=unsafe-yes

<><> Synchronising pinned packages ><><><><><><><><><><><><><><><><><><><><><><>
[coq-stdlib.dev] synchronised (no changes)
[coq.dev] synchronised (no changes)
[coq-core.dev] synchronised (no changes)
[coqide-server.dev] synchronised (no changes)

The following actions will be performed:
=== recompile 5 packages
  - recompile coq           dev (pinned)
  - recompile coq-bignums   dev          [uses coq]
  - recompile coq-core      dev (pinned)
  - recompile coq-stdlib    dev (pinned)
  - recompile coqide-server dev (pinned)

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> retrieved coq-bignums.dev  (no changes)
-> removed   coq-bignums.dev
-> removed   coq.dev
-> removed   coq-stdlib.dev
-> removed   coqide-server.dev
-> removed   coq-core.dev
-> installed coq-core.dev
-> installed coqide-server.dev
-> installed coq-stdlib.dev
-> installed coq.dev
-> installed coq-bignums.dev
Done.
::group::opam wrap files
wrapping /usr/local/bin/opam
attempting to wrap coqc
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqc
attempting to wrap coqtop
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqtop
::endgroup::
++ �[33;1m(/github/workspace/run-script.sh @ line 12) $�[0m true
++ �[33;1m(/github/workspace/run-script.sh @ line 12) $�[0m coqtop
MINIMIZER_DEBUG_EXTRA: coqc: /home/coq/.opam/4.13.1+flambda/bin/coqtop
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace
MINIMIZER_DEBUG_EXTRA: exec: /home/coq/.opam/4.13.1+flambda/bin/coqtop.orig 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.r4cmrpilLy
MINIMIZER_DEBUG: files: 
Welcome to Coq 5e78f6d93a6e:/home/coq/.opam/4.13.1+flambda/.opam-switch/build/coq-core.dev/_build/default,master (b999f458037563317ddbb8ab6e3ecf9e1986077d)

Coq < 
++ �[33;1m(/github/workspace/run-script.sh @ line 13) $�[0m coqc --version
MINIMIZER_DEBUG_EXTRA: coqc: /home/coq/.opam/4.13.1+flambda/bin/coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace
MINIMIZER_DEBUG_EXTRA: exec: /home/coq/.opam/4.13.1+flambda/bin/coqc.orig --version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.Q3iEbIr5ey
MINIMIZER_DEBUG: files: 
The Coq Proof Assistant, version 8.21+alpha
compiled with OCaml 4.13.1
++ �[33;1m(/github/workspace/run-script.sh @ line 15) $�[0m cat
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m coqc -q bug.v
MINIMIZER_DEBUG_EXTRA: coqc: /home/coq/.opam/4.13.1+flambda/bin/coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace
MINIMIZER_DEBUG_EXTRA: exec: /home/coq/.opam/4.13.1+flambda/bin/coqc.orig -q bug.v 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.R2KG1fU1h2
MINIMIZER_DEBUG: files:  bug.v
File "./bug.v", line 1, characters 8-25:
Warning: Coq.ZArith.ZArith has been replaced by Stdlib.ZArith.ZArith.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
File "./bug.v", line 3, characters 7-24:
Warning: Coq.micromega.Lia has been replaced by Stdlib.micromega.Lia.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
File "./bug.v", line 4, characters 7-25:
Warning: Coq.Arith.PeanoNat has been replaced by Stdlib.Arith.PeanoNat.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
File "./bug.v", line 5, characters 7-21:
Warning: Coq.Lists.List has been replaced by Stdlib.Lists.List.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
File "./bug.v", line 53, characters 56-68:
Error: No information can be deduced from this equality and the injectivity
of constructors. This may be because the terms are convertible, or due to
pattern matching restrictions in the sort Prop. You can try to use option Set
Keep Proof Equalities.
📜 🔎 Minimization Log (truncated to last 8.0KiB; full 38KiB file on GitHub Actions Artifacts under bug.log)
l successful.�[0m

I will now attempt to remove unused variables
�[92m
Variable removal successful.�[0m

I will now attempt to remove unused contexts
�[92m
Context removal successful.�[0m

I will now attempt to replace Qed Obligation with Admit Obligations
�[92m
Admitting Qed Obligations successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting Qed Obligations unsuccessful.
No successful changes.

I will now attempt to replace Qeds with Admitteds

Non-fatal error: Failed to admit Qeds and preserve the error.  
The new error was:
File "/tmp/tmphy4yo8ob/Top/bug_01.v", line 11, characters 7-25:
Warning: Coq.Arith.PeanoNat has been replaced by Stdlib.Arith.PeanoNat.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
File "/tmp/tmphy4yo8ob/Top/bug_01.v", line 12, characters 7-21:
Warning: Coq.Lists.List has been replaced by Stdlib.Lists.List.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
Error: The section Chunk needs to be closed.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting Qeds unsuccessful.
No successful changes.

I will now attempt to replace Qeds with admit. Defined.

Non-fatal error: Failed to admit Qeds and preserve the error.  
The new error was:
File "/tmp/tmp44100chr/Top/bug_01.v", line 11, characters 7-25:
Warning: Coq.Arith.PeanoNat has been replaced by Stdlib.Arith.PeanoNat.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
File "/tmp/tmp44100chr/Top/bug_01.v", line 12, characters 7-21:
Warning: Coq.Lists.List has been replaced by Stdlib.Lists.List.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
File "/tmp/tmp44100chr/Top/bug_01.v", line 31, characters 0-8:
Error:  (in proof chunk_app): Attempt to save an incomplete proof
(the proof term is not complete because of given up (admitted) goals).
If this is really what you want to do, use Admitted in place of Qed.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting Qeds unsuccessful.
No successful changes.

I will now attempt to remove goals ending in [Abort.]
�[92m
Aborted removal successful.�[0m

I will now attempt to remove unused Ltacs
�[92m
Ltac removal successful.�[0m

I will now attempt to remove unused definitions
�[92m
Definition removal successful.�[0m

I will now attempt to remove unused non-instance, non-canonical structure definitions
�[92m
Non-instance definition removal successful.�[0m

I will now attempt to remove unused variables
�[92m
Variable removal successful.�[0m

I will now attempt to remove unused contexts
�[92m
Context removal successful.�[0m

I will now attempt to admit [abstract ...]s
�[92m
Admitting [abstract ...] successful.�[0m
�[92m
Admitting [abstract ...] successful.�[0m
Admitting [abstract ...] unsuccessful.
Admitting [abstract ...] unsuccessful.

I will now attempt to remove goals ending in [Abort.]
�[92m
Aborted removal successful.�[0m

I will now attempt to remove unused Ltacs
�[92m
Ltac removal successful.�[0m

I will now attempt to remove unused definitions
�[92m
Definition removal successful.�[0m

I will now attempt to remove unused non-instance, non-canonical structure definitions
�[92m
Non-instance definition removal successful.�[0m

I will now attempt to remove unused variables
�[92m
Variable removal successful.�[0m

I will now attempt to remove unused contexts
�[92m
Context removal successful.�[0m

I will now attempt to replace Obligation with Admit Obligations
�[92m
Admitting Obligations successful.�[0m
Failed to do everything at once; trying one at a time.
Admitting Obligations unsuccessful.
No successful changes.

I will now attempt to admit lemmas with Admitted

Non-fatal error: Failed to admit lemmas and preserve the error.  
The new error was:
File "/tmp/tmphy4yo8ob/Top/bug_01.v", line 11, characters 7-25:
Warning: Coq.Arith.PeanoNat has been replaced by Stdlib.Arith.PeanoNat.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
File "/tmp/tmphy4yo8ob/Top/bug_01.v", line 12, characters 7-21:
Warning: Coq.Lists.List has been replaced by Stdlib.Lists.List.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
Error: The section Chunk needs to be closed.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting lemmas unsuccessful.
No successful changes.

I will now attempt to admit definitions with Admitted

Non-fatal error: Failed to admit definitions and preserve the error.  
The new error was:
File "/tmp/tmphy4yo8ob/Top/bug_01.v", line 11, characters 7-25:
Warning: Coq.Arith.PeanoNat has been replaced by Stdlib.Arith.PeanoNat.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
File "/tmp/tmphy4yo8ob/Top/bug_01.v", line 12, characters 7-21:
Warning: Coq.Lists.List has been replaced by Stdlib.Lists.List.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
Error: The section Chunk needs to be closed.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting definitions unsuccessful.
No successful changes.

I will now attempt to admit lemmas with admit. Defined

Non-fatal error: Failed to admit lemmas and preserve the error.  
The new error was:
File "/tmp/tmp44100chr/Top/bug_01.v", line 11, characters 7-25:
Warning: Coq.Arith.PeanoNat has been replaced by Stdlib.Arith.PeanoNat.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
File "/tmp/tmp44100chr/Top/bug_01.v", line 12, characters 7-21:
Warning: Coq.Lists.List has been replaced by Stdlib.Lists.List.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
File "/tmp/tmp44100chr/Top/bug_01.v", line 31, characters 0-8:
Error:  (in proof chunk_app): Attempt to save an incomplete proof
(the proof term is not complete because of given up (admitted) goals).
If this is really what you want to do, use Admitted in place of Qed.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting lemmas unsuccessful.
No successful changes.

I will now attempt to admit definitions with admit. Defined

Non-fatal error: Failed to admit definitions and preserve the error.  
The new error was:
File "/tmp/tmp44100chr/Top/bug_01.v", line 11, characters 7-25:
Warning: Coq.Arith.PeanoNat has been replaced by Stdlib.Arith.PeanoNat.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
File "/tmp/tmp44100chr/Top/bug_01.v", line 12, characters 7-21:
Warning: Coq.Lists.List has been replaced by Stdlib.Lists.List.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
File "/tmp/tmp44100chr/Top/bug_01.v", line 31, characters 0-8:
Error:  (in proof chunk_app): Attempt to save an incomplete proof
(the proof term is not complete because of given up (admitted) goals).
If this is really what you want to do, use Admitted in place of Qed.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting definitions unsuccessful.
No successful changes.

I will now attempt to export modules
Module exportation unsuccessful.

I will now attempt to split imports and exports
Import/Export splitting unsuccessful.

I will now attempt to split := definitions
One-line definition splitting unsuccessful.

I will now attempt to remove all lines, one at a time
Line removal unsuccessful.

I will now attempt to remove goals ending in [Abort.]
�[92m
Aborted removal successful.�[0m

I will now attempt to remove unused Ltacs
�[92m
Ltac removal successful.�[0m

I will now attempt to remove unused definitions
�[92m
Definition removal successful.�[0m

I will now attempt to remove unused non-instance, non-canonical structure definitions
�[92m
Non-instance definition removal successful.�[0m

I will now attempt to remove unused variables
�[92m
Variable removal successful.�[0m

I will now attempt to remove unused contexts
�[92m
Context removal successful.�[0m

I will now attempt to remove empty sections

No empty sections to remove.

Now, I will attempt to strip repeated newlines and trailing spaces from this file...
�[92m
Succeeded in stripping newlines and spaces.�[0m

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.

@JasonGross
Copy link
Owner Author

@coqbot minimize coq.dev

#!/usr/bin/env bash

true | coqtop
coqc --version
opam pin remove coq -y --no-action
opam pin add coq 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y --no-action
opam pin add coq 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y --no-action
opam pin add coq-core 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y --no-action
opam pin add coq-stdlib 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y --no-action
opam pin add coqide-server 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y --no-action
opam reinstall coq coq-core coq-stdlib coqide-server -y --confirm-level=unsafe-yes || exit 1
true | coqtop
coqc --version

cat <<EOF > bug.v
Require Coq.ZArith.ZArith.

Import Coq.micromega.Lia.
Import Coq.Arith.PeanoNat.
Import Coq.Lists.List.
Import ListNotations.

Module Import Nat.
  Definition div_up a b := Nat.div (a + (b-1)) b.
  Lemma div_up_range a b (H : b <> 0) : a <= div_up a b * b < a + b.
Admitted.

  Lemma div_up_add_mod a b n:
    (a mod n = 0)%nat ->
    Nat.div_up (a + b) n =
    (Nat.div_up a n + Nat.div_up b n)%nat.
Admitted.

  Lemma div_up_exact_mod a b:
    (b <> 0)%nat ->
    (a mod b = 0)%nat ->
    ((Nat.div_up a b) * b = a)%nat.
Admitted.

Section Chunk.
  Context [A : Type] (k : nat).
  Implicit Types (bs ck xs ys : list A).
Fixpoint chunk' bs ck {struct bs} : list (list A).
Admitted.
  Definition chunk bs := chunk' bs [].

  Context (Hk : k <> 0).

  Lemma nth_error_chunk bs i (Hi : i < div_up (length bs) k)
    : nth_error (chunk bs) i = Some (firstn k (skipn (i*k) bs)).
Admitted.

  Lemma length_chunk bs : length (chunk bs) = div_up (length bs) k.
Admitted.

  Lemma length_chunk_app (l l' : list A) :
    (length l mod k)%nat = 0%nat ->
    length (chunk (l ++ l')) = length (chunk l ++ chunk l').
Admitted.

  Lemma chunk_app : forall (l l': list A),
      (length l mod k = 0)%nat ->
      chunk (l ++ l') = chunk l ++ chunk l'.
  Proof.
    intros * Hmod.
    eapply nth_ext with (d := []) (d' := []); [ | intros idx ].
    - apply length_chunk_app; assumption.
    - intros Hidx; eassert (Some _ = Some _) as HS; [ | injection HS; intros Hs; apply Hs ].
      rewrite <- !nth_error_nth' by assumption.
      rewrite <- !nth_error_nth' by (rewrite length_chunk_app in Hidx; eassumption).
      assert (idx < length (chunk l) \/ length (chunk l) <= idx)%nat as [Hlt | Hge] by lia;
        [ rewrite nth_error_app1 | rewrite nth_error_app2 ]; try eassumption.
      all: rewrite !nth_error_chunk.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hlt by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hidx by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hge by assumption.
      all: rewrite ?length_chunk, ?app_length, ?div_up_add_mod by assumption.
      all: try lia.
      all: pose proof Nat.div_up_range (length l) k ltac:(lia).
      + pose proof div_up_exact_mod (length l) k ltac:(lia) ltac:(lia).
        rewrite !firstn_skipn_comm, !firstn_app.
        replace (idx * k + k - length l)%nat with 0%nat by nia.
        simpl; rewrite app_nil_r; reflexivity.
      + rewrite Nat.mul_sub_distr_r.
        erewrite div_up_exact_mod by lia.
        rewrite skipn_app, skipn_all2; [ reflexivity | nia ].
  Qed.
EOF

coqc -q bug.v

Copy link

coqbot-app bot commented Sep 12, 2024

Hey @JasonGross, the coq bug minimizer is running your script, I'll come back to you with the results once it's done.

Copy link

coqbot-app bot commented Sep 12, 2024

@JasonGross, Minimized File (full log on GitHub Actions)

🌟 Minimized Coq File (consider adding this file to the test-suite)
Require Coq.ZArith.ZArith.

Import Coq.micromega.Lia.
Import Coq.Arith.PeanoNat.
Import Coq.Lists.List.
Import ListNotations.

Module Import Nat.
  Definition div_up a b := Nat.div (a + (b-1)) b.
  Lemma div_up_range a b (H : b <> 0) : a <= div_up a b * b < a + b.
Admitted.

  Lemma div_up_add_mod a b n:
    (a mod n = 0)%nat ->
    Nat.div_up (a + b) n =
    (Nat.div_up a n + Nat.div_up b n)%nat.
Admitted.

  Lemma div_up_exact_mod a b:
    (b <> 0)%nat ->
    (a mod b = 0)%nat ->
    ((Nat.div_up a b) * b = a)%nat.
Admitted.

Section Chunk.
  Context [A : Type] (k : nat).
  Implicit Types (bs ck xs ys : list A).
Fixpoint chunk' bs ck {struct bs} : list (list A).
Admitted.
  Definition chunk bs := chunk' bs [].

  Context (Hk : k <> 0).

  Lemma nth_error_chunk bs i (Hi : i < div_up (length bs) k)
    : nth_error (chunk bs) i = Some (firstn k (skipn (i*k) bs)).
Admitted.

  Lemma length_chunk bs : length (chunk bs) = div_up (length bs) k.
Admitted.

  Lemma length_chunk_app (l l' : list A) :
    (length l mod k)%nat = 0%nat ->
    length (chunk (l ++ l')) = length (chunk l ++ chunk l').
Admitted.

  Lemma chunk_app : forall (l l': list A),
      (length l mod k = 0)%nat ->
      chunk (l ++ l') = chunk l ++ chunk l'.
  Proof.
    intros * Hmod.
    eapply nth_ext with (d := []) (d' := []); [ | intros idx ].
    - apply length_chunk_app; assumption.
    - intros Hidx; eassert (Some _ = Some _) as HS; [ | injection HS; intros Hs; apply Hs ].
      rewrite <- !nth_error_nth' by assumption.
      rewrite <- !nth_error_nth' by (rewrite length_chunk_app in Hidx; eassumption).
      assert (idx < length (chunk l) \/ length (chunk l) <= idx)%nat as [Hlt | Hge] by lia;
        [ rewrite nth_error_app1 | rewrite nth_error_app2 ]; try eassumption.
      all: rewrite !nth_error_chunk.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hlt by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hidx by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hge by assumption.
      all: rewrite ?length_chunk, ?app_length, ?div_up_add_mod by assumption.
      all: try lia.
      all: pose proof Nat.div_up_range (length l) k ltac:(lia).
      + pose proof div_up_exact_mod (length l) k ltac:(lia) ltac:(lia).
        rewrite !firstn_skipn_comm, !firstn_app.
        replace (idx * k + k - length l)%nat with 0%nat by nia.
        simpl; rewrite app_nil_r; reflexivity.
      + rewrite Nat.mul_sub_distr_r.
        erewrite div_up_exact_mod by lia.
        rewrite skipn_app, skipn_all2; [ reflexivity | nia ].
  Qed.
🛠️ Intermediate Coq File (useful for debugging if minimization did not go as far as you wanted)
🛠️ 📜 Intermediate Coq File log (useful for debugging if minimization did not go as far as you wanted)
📜 Build Log (contains the Coq error message) (truncated to last 8.0KiB; full 30KiB file on GitHub Actions Artifacts under build.log)
racters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./bug.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
Error: The section Chunk and module Nat need to be closed.
📜 🔎 Minimization Log (truncated to last 8.0KiB; full 55KiB file on GitHub Actions Artifacts under bug.log)
ub/workspace/run-script.sh @ line 187) $�[0m dirname /home/coq/.opam/4.13.1+flambda/bin/coqc.orig
++ �[33;1m(/github/workspace/run-script.sh @ line 187) $�[0m cd /home/coq/.opam/4.13.1+flambda/bin
++ �[33;1m(/github/workspace/run-script.sh @ line 187) $�[0m readlink -f coq_makefile
+ �[33;1m(/github/workspace/run-script.sh @ line 187) $�[0m PASSING_COQ_MAKEFILE=/home/coq/.opam/4.13.1+flambda/bin/coq_makefile
+++ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m dirname /home/coq/.opam/4.13.1+flambda/bin/coqc.orig
++ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m cd /home/coq/.opam/4.13.1+flambda/bin
++ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m readlink -f coqdep
+ �[33;1m(/github/workspace/run-script.sh @ line 188) $�[0m PASSING_COQDEP=/home/coq/.opam/4.13.1+flambda/bin/coqdep
+ �[33;1m(/github/workspace/run-script.sh @ line 190) $�[0m '[' /home/coq/.opam/4.13.1+flambda/bin/coqc.orig '!=' /home/coq/.opam/4.13.1+flambda/bin/coqc.orig ']'
+ �[33;1m(/github/workspace/run-script.sh @ line 195) $�[0m NONPASSING_PREFIX=
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m process_args '' ''
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m bash -c 'split_args_to_lines /home/coq/.opam/4.13.1+flambda/bin/coqc.orig -q bug.v '
++ �[33;1m(/github/workspace/run-script.sh @ line 63) $�[0m passing_prefix=
++ �[33;1m(/github/workspace/run-script.sh @ line 64) $�[0m prefixed_arg=--arg
++ �[33;1m(/github/workspace/run-script.sh @ line 65) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 69) $�[0m known_v_file=
++ �[33;1m(/github/workspace/run-script.sh @ line 70) $�[0m next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 71) $�[0m next_next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 72) $�[0m skip_next=no
++ �[33;1m(/github/workspace/run-script.sh @ line 73) $�[0m prev_load=
++ �[33;1m(/github/workspace/run-script.sh @ line 74) $�[0m found_known_v_file=no
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m tail -n +2
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' -q
process_args: processing (-q)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 101) $�[0m case "$i" in
++ �[33;1m(/github/workspace/run-script.sh @ line 133) $�[0m printf '%s=%s\n' --arg -q
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' bug.v
process_args: processing (bug.v)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m coqpath_to_args /github/workspace ''
++ �[33;1m(/github/workspace/run-script.sh @ line 142) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 143) $�[0m local IFS=:
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f ''
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f bug.v
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m '[' '' == /github/workspace/bug.v ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 99) $�[0m :
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
+ �[33;1m(/github/workspace/run-script.sh @ line 198) $�[0m FAILING_ARGS=--arg=-q
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m process_args passing ''
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m bash -c 'split_args_to_lines /home/coq/.opam/4.13.1+flambda/bin/coqc.orig -q bug.v '
++ �[33;1m(/github/workspace/run-script.sh @ line 63) $�[0m passing_prefix=
++ �[33;1m(/github/workspace/run-script.sh @ line 64) $�[0m prefixed_arg=--arg
++ �[33;1m(/github/workspace/run-script.sh @ line 65) $�[0m '[' '!' -z passing ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 66) $�[0m passing_prefix=--passing
++ �[33;1m(/github/workspace/run-script.sh @ line 67) $�[0m prefixed_arg=--passing-arg
++ �[33;1m(/github/workspace/run-script.sh @ line 69) $�[0m known_v_file=
++ �[33;1m(/github/workspace/run-script.sh @ line 70) $�[0m next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 71) $�[0m next_next_is_known=no
++ �[33;1m(/github/workspace/run-script.sh @ line 72) $�[0m skip_next=no
++ �[33;1m(/github/workspace/run-script.sh @ line 73) $�[0m prev_load=
++ �[33;1m(/github/workspace/run-script.sh @ line 74) $�[0m found_known_v_file=no
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m tail -n +2
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m sed 's,\(/github/workspace/builds/coq\)/coq-failing/,\1/coq-passing/,g'
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' -q
process_args: processing (-q)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ -q == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 101) $�[0m case "$i" in
++ �[33;1m(/github/workspace/run-script.sh @ line 133) $�[0m printf '%s=%s\n' --passing-arg -q
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
++ �[33;1m(/github/workspace/run-script.sh @ line 76) $�[0m printf 'process_args: processing (%q)\n' bug.v
process_args: processing (bug.v)
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m coqpath_to_args /github/workspace ''
++ �[33;1m(/github/workspace/run-script.sh @ line 142) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 143) $�[0m local IFS=:
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f ''
+++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m readlink -f bug.v
++ �[33;1m(/github/workspace/run-script.sh @ line 77) $�[0m '[' '' == /github/workspace/bug.v ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 80) $�[0m '[' '!' -z '' ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 94) $�[0m '[' no == yes ']'
++ �[33;1m(/github/workspace/run-script.sh @ line 98) $�[0m [[ bug.v == *\.\v ]]
++ �[33;1m(/github/workspace/run-script.sh @ line 99) $�[0m :
++ �[33;1m(/github/workspace/run-script.sh @ line 137) $�[0m cur_arg=
++ �[33;1m(/github/workspace/run-script.sh @ line 75) $�[0m read i
+ �[33;1m(/github/workspace/run-script.sh @ line 199) $�[0m PASSING_ARGS=--passing-arg=-q
++ �[33;1m(/github/workspace/run-script.sh @ line 200) $�[0m cd /github/workspace
++ �[33;1m(/github/workspace/run-script.sh @ line 200) $�[0m readlink -f ''
+ �[33;1m(/github/workspace/run-script.sh @ line 200) $�[0m ABS_FILE=

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.

@JasonGross
Copy link
Owner Author

@coqbot minimize coq.dev

#!/usr/bin/env bash

true | coqtop
coqc --version
opam pin remove coq -y --no-action
opam pin add coq 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y --no-action
opam pin add coq 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y --no-action
opam pin add coq-core 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y --no-action
opam pin add coq-stdlib 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y --no-action
opam pin add coqide-server 'git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon' -y --no-action
opam reinstall coq coq-core coq-stdlib coqide-server -y --confirm-level=unsafe-yes || exit 1
true | coqtop
coqc --version

cat <<EOF > test.v
Require Coq.ZArith.ZArith.

Import Coq.micromega.Lia.
Import Coq.Arith.PeanoNat.
Import Coq.Lists.List.
Import ListNotations.

Module Import Nat.
  Definition div_up a b := Nat.div (a + (b-1)) b.
  Lemma div_up_range a b (H : b <> 0) : a <= div_up a b * b < a + b.
Admitted.

  Lemma div_up_add_mod a b n:
    (a mod n = 0)%nat ->
    Nat.div_up (a + b) n =
    (Nat.div_up a n + Nat.div_up b n)%nat.
Admitted.

  Lemma div_up_exact_mod a b:
    (b <> 0)%nat ->
    (a mod b = 0)%nat ->
    ((Nat.div_up a b) * b = a)%nat.
Admitted.

Section Chunk.
  Context [A : Type] (k : nat).
  Implicit Types (bs ck xs ys : list A).
Fixpoint chunk' bs ck {struct bs} : list (list A).
Admitted.
  Definition chunk bs := chunk' bs [].

  Context (Hk : k <> 0).

  Lemma nth_error_chunk bs i (Hi : i < div_up (length bs) k)
    : nth_error (chunk bs) i = Some (firstn k (skipn (i*k) bs)).
Admitted.

  Lemma length_chunk bs : length (chunk bs) = div_up (length bs) k.
Admitted.

  Lemma length_chunk_app (l l' : list A) :
    (length l mod k)%nat = 0%nat ->
    length (chunk (l ++ l')) = length (chunk l ++ chunk l').
Admitted.

  Lemma chunk_app : forall (l l': list A),
      (length l mod k = 0)%nat ->
      chunk (l ++ l') = chunk l ++ chunk l'.
  Proof.
    intros * Hmod.
    eapply nth_ext with (d := []) (d' := []); [ | intros idx ].
    - apply length_chunk_app; assumption.
    - intros Hidx; eassert (Some _ = Some _) as HS; [ | injection HS; intros Hs; apply Hs ].
      rewrite <- !nth_error_nth' by assumption.
      rewrite <- !nth_error_nth' by (rewrite length_chunk_app in Hidx; eassumption).
      assert (idx < length (chunk l) \/ length (chunk l) <= idx)%nat as [Hlt | Hge] by lia;
        [ rewrite nth_error_app1 | rewrite nth_error_app2 ]; try eassumption.
      all: rewrite !nth_error_chunk.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hlt by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hidx by assumption.
      all: repeat rewrite ?length_chunk, ?app_length, ?div_up_add_mod in Hge by assumption.
      all: rewrite ?length_chunk, ?app_length, ?div_up_add_mod by assumption.
      all: try lia.
      all: pose proof Nat.div_up_range (length l) k ltac:(lia).
      + pose proof div_up_exact_mod (length l) k ltac:(lia) ltac:(lia).
        rewrite !firstn_skipn_comm, !firstn_app.
        replace (idx * k + k - length l)%nat with 0%nat by nia.
        simpl; rewrite app_nil_r; reflexivity.
      + rewrite Nat.mul_sub_distr_r.
        erewrite div_up_exact_mod by lia.
        rewrite skipn_app, skipn_all2; [ reflexivity | nia ].
  Qed.
EOF

coqc -q test.v

Copy link

coqbot-app bot commented Sep 12, 2024

Hey @JasonGross, the coq bug minimizer is running your script, I'll come back to you with the results once it's done.

Copy link

coqbot-app bot commented Sep 12, 2024

@JasonGross, Error: Could not minimize file (full log on GitHub Actions, cc @JasonGross)

build log (truncated to last 26KiB; full 30KiB file on GitHub Actions Artifacts under build.log)
coq/.opam/4.13.1+flambda/bin/coqtop.orig 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.dHJTYVHUM8
MINIMIZER_DEBUG: files: 
Welcome to Coq buildkitsandbox:/home/coq/.opam/4.13.1+flambda/.opam-switch/build/coq-core.dev/_build/default,master (f9d9e518a4dd59bdbbc20087147ba9a3def2261a)

Coq < 
++ �[33;1m(/github/workspace/run-script.sh @ line 4) $�[0m coqc --version
MINIMIZER_DEBUG_EXTRA: coqc: /home/coq/.opam/4.13.1+flambda/bin/coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace
MINIMIZER_DEBUG_EXTRA: exec: /home/coq/.opam/4.13.1+flambda/bin/coqc.orig --version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.AmsPjgdBKc
MINIMIZER_DEBUG: files: 
The Coq Proof Assistant, version 8.21+alpha
compiled with OCaml 4.13.1
++ �[33;1m(/github/workspace/run-script.sh @ line 5) $�[0m opam pin remove coq -y --no-action
Ok, coq is no longer pinned to git+https://github.com/coq/coq#f9d9e518a4dd59bdbbc20087147ba9a3def2261a (version dev)
::group::opam wrap files
wrapping /usr/local/bin/opam
attempting to wrap coqc
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqc
attempting to wrap coqtop
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqtop
::endgroup::
++ �[33;1m(/github/workspace/run-script.sh @ line 6) $�[0m opam pin add coq git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon -y --no-action
[ERROR] Could not synchronize /home/coq/.opam/4.13.1+flambda/.opam-switch/sources/coq from "git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon":
        Branch test-minimizer-general-tycon not found
[coq.dev] fetching sources failed: git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon
[ERROR] Error getting source from git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon:
          - git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon

++ �[33;1m(/github/workspace/run-script.sh @ line 7) $�[0m opam pin add coq git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon -y --no-action
[ERROR] Could not synchronize /home/coq/.opam/4.13.1+flambda/.opam-switch/sources/coq from "git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon":
        Branch test-minimizer-general-tycon not found
[coq.dev] fetching sources failed: git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon
[ERROR] Error getting source from git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon:
          - git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon

++ �[33;1m(/github/workspace/run-script.sh @ line 8) $�[0m opam pin add coq-core git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon -y --no-action
[NOTE] Package coq-core is currently pinned to git+https://github.com/coq/coq#f9d9e518a4dd59bdbbc20087147ba9a3def2261a (version dev).
[ERROR] Could not synchronize /home/coq/.opam/4.13.1+flambda/.opam-switch/sources/coq-core from "git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon":
        Branch test-minimizer-general-tycon not found
[coq-core.dev] fetching sources failed: git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon
[ERROR] Error getting source from git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon:
          - git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon

++ �[33;1m(/github/workspace/run-script.sh @ line 9) $�[0m opam pin add coq-stdlib git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon -y --no-action
[NOTE] Package coq-stdlib is currently pinned to git+https://github.com/coq/coq#f9d9e518a4dd59bdbbc20087147ba9a3def2261a (version dev).
[ERROR] Could not synchronize /home/coq/.opam/4.13.1+flambda/.opam-switch/sources/coq-stdlib from "git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon":
        Branch test-minimizer-general-tycon not found
[coq-stdlib.dev] fetching sources failed: git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon
[ERROR] Error getting source from git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon:
          - git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon

++ �[33;1m(/github/workspace/run-script.sh @ line 10) $�[0m opam pin add coqide-server git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon -y --no-action
[NOTE] Package coqide-server is currently pinned to git+https://github.com/coq/coq#f9d9e518a4dd59bdbbc20087147ba9a3def2261a (version dev).
[ERROR] Could not synchronize /home/coq/.opam/4.13.1+flambda/.opam-switch/sources/coqide-server from "git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon":
        Branch test-minimizer-general-tycon not found
[coqide-server.dev] fetching sources failed: git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon
[ERROR] Error getting source from git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon:
          - git+https://github.com/SkySkimmer/coq.git#test-minimizer-general-tycon

++ �[33;1m(/github/workspace/run-script.sh @ line 11) $�[0m opam reinstall coq coq-core coq-stdlib coqide-server -y --confirm-level=unsafe-yes

<><> Synchronising pinned packages ><><><><><><><><><><><><><><><><><><><><><><>
[coq-stdlib.dev] synchronised (git+https://github.com/coq/coq#f9d9e518a4dd59bdbbc20087147ba9a3def2261a)
[coq-core.dev] synchronised (git+https://github.com/coq/coq#f9d9e518a4dd59bdbbc20087147ba9a3def2261a)
[coqide-server.dev] synchronised (git+https://github.com/coq/coq#f9d9e518a4dd59bdbbc20087147ba9a3def2261a)

The following actions will be performed:
=== recompile 5 packages
  - recompile coq           dev
  - recompile coq-bignums   dev          [uses coq]
  - recompile coq-core      dev (pinned)
  - recompile coq-stdlib    dev (pinned)
  - recompile coqide-server dev (pinned)

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> retrieved coq-bignums.dev  (no changes)
-> retrieved coq.dev  (git+https://github.com/coq/coq.git#master)
-> removed   coq-bignums.dev
-> removed   coq.dev
-> removed   coq-stdlib.dev
-> removed   coqide-server.dev
-> removed   coq-core.dev
-> installed coq-core.dev
-> installed coqide-server.dev
-> installed coq-stdlib.dev
-> installed coq.dev
-> installed coq-bignums.dev
Done.
::group::opam wrap files
wrapping /usr/local/bin/opam
attempting to wrap coqc
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqc
attempting to wrap coqtop
wrapping /home/coq/.opam/4.13.1+flambda/bin/coqtop
::endgroup::
++ �[33;1m(/github/workspace/run-script.sh @ line 12) $�[0m true
++ �[33;1m(/github/workspace/run-script.sh @ line 12) $�[0m coqtop
MINIMIZER_DEBUG_EXTRA: coqc: /home/coq/.opam/4.13.1+flambda/bin/coqtop
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace
MINIMIZER_DEBUG_EXTRA: exec: /home/coq/.opam/4.13.1+flambda/bin/coqtop.orig 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.znQojQrenA
MINIMIZER_DEBUG: files: 
Welcome to Coq 141a4fbc810e:/home/coq/.opam/4.13.1+flambda/.opam-switch/build/coq-core.dev/_build/default,master (f9d9e518a4dd59bdbbc20087147ba9a3def2261a)

Coq < 
++ �[33;1m(/github/workspace/run-script.sh @ line 13) $�[0m coqc --version
MINIMIZER_DEBUG_EXTRA: coqc: /home/coq/.opam/4.13.1+flambda/bin/coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace
MINIMIZER_DEBUG_EXTRA: exec: /home/coq/.opam/4.13.1+flambda/bin/coqc.orig --version 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.MflO7XVJ3W
MINIMIZER_DEBUG: files: 
The Coq Proof Assistant, version 8.21+alpha
compiled with OCaml 4.13.1
++ �[33;1m(/github/workspace/run-script.sh @ line 15) $�[0m cat
++ �[33;1m(/github/workspace/run-script.sh @ line 90) $�[0m coqc -q test.v
MINIMIZER_DEBUG_EXTRA: coqc: /home/coq/.opam/4.13.1+flambda/bin/coqc
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace
MINIMIZER_DEBUG_EXTRA: exec: /home/coq/.opam/4.13.1+flambda/bin/coqc.orig -q test.v 
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.unmEHHXIyU
MINIMIZER_DEBUG: files:  test.v
File "./test.v", line 1, characters 8-25:
Warning: Coq.ZArith.ZArith has been replaced by Stdlib.ZArith.ZArith.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
File "./test.v", line 3, characters 7-24:
Warning: Coq.micromega.Lia has been replaced by Stdlib.micromega.Lia.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
File "./test.v", line 4, characters 7-25:
Warning: Coq.Arith.PeanoNat has been replaced by Stdlib.Arith.PeanoNat.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
File "./test.v", line 5, characters 7-21:
Warning: Coq.Lists.List has been replaced by Stdlib.Lists.List.
[deprecated-dirpath-Coq,deprecated-since-8.21,deprecated,default]
File "./test.v", line 59, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 59, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 59, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 59, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 59, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 59, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 59, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 59, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 59, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 59, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 59, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 59, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 59, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 60, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 61, characters 42-52:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
File "./test.v", line 62, characters 35-45:
Warning: Notation app_length is deprecated since 8.20.
Use length_app instead.
[deprecated-syntactic-definition-since-8.20,deprecated-since-8.20,deprecated-syntactic-definition,deprecated,default]
Error: The section Chunk and module Nat need to be closed.
minimizer 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.

@JasonGross
Copy link
Owner Author

Testing MetaRocq/metarocq#1072 (comment)
@coqbot minimize coq.8.17

opam install -y coq-wasm
cat > test_bug.v <<EOF
From Coq Require Import List.
From Coq.Strings Require Import Byte.
From CertiCoq.Plugin Require Import CertiCoq.
From Wasm Require Import binary_format_parser datatypes instantiation_func.

Definition test_bytes : list Byte.byte := x00 :: x61 :: x73 :: x6d :: x01 :: x00 :: x00 :: x00 :: nil.

Definition test_module : option module := run_parse_module test_bytes.

CertiCoq Compile test_module.
EOF
coqc -q test_bug.v

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant