-
Notifications
You must be signed in to change notification settings - Fork 694
Add a generic mechanism for rewriting with any equality satisfying J #21098
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
base: master
Are you sure you want to change the base?
Conversation
5d85858
to
04fdca3
Compare
@coqbot run full ci |
04fdca3
to
9e27b8c
Compare
a30387b
to
428b37f
Compare
@coqbot run full ci |
428b37f
to
e8c319f
Compare
Minimized File /home/runner/work/run-coq-bug-minimizer/run-coq-bug-minimizer/builds/coq/coq-failing/_build_ci/ext_lib/theories/Data/List.v in 14m 27s (from ci-ext_lib) (full log on GitHub Actions - verbose log) We are collecting data on the user experience of the Coq Bug Minimizer. 🌟 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" "ondemand" "-coqlib" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq//" "-Q" "/github/workspace/cwd" "Top" "-Q" "/github/workspace/builds/coq/coq-failing/_build_ci/ext_lib/theories" "ExtLib" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/Ltac2" "Ltac2" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/Stdlib" "Stdlib" "-top" "ExtLib.Data.List") -*- *)
(* File reduced by coq-bug-minimizer from original input, then from 263 lines to 26 lines, then from 39 lines to 263 lines, then from 268 lines to 34 lines, then from 48 lines to 34 lines *)
(* coqc version 9.2+alpha compiled with OCaml 4.14.2
coqtop version 9.2+alpha
Expected coqc runtime on this file: 0.092 sec *)
Module Export Nat.
Set Implicit Arguments.
Inductive R_nat_lt : nat -> nat -> Prop :=
| R_lt : forall n m, n < m -> R_nat_lt n m.
Theorem wf_R_lt : well_founded R_nat_lt.
Admitted.
Set Universe Polymorphism.
Inductive R_list_len@{u} {T : Type@{u}} : list T -> list T -> Prop :=
| R_l_len : forall n m, length n < length m -> R_list_len n m.
Theorem wf_R_list_len@{u} (T : Type@{u}) : well_founded (@R_list_len T).
Proof.
constructor.
intros.
refine (@Fix _ _ Nat.wf_R_lt (fun n : nat => forall ls : list T, n = length ls -> Acc R_list_len ls)
(fun x rec ls pfls => Acc_intro _ _)
_ _ refl_equal).
refine (
match ls as ls return x = length ls -> forall z : list T, R_list_len z ls -> Acc R_list_len z with
| nil => fun (pfls : x = 0) z pf => _
| cons l ls => fun pfls z pf =>
rec _ (match pf in R_list_len xs ys return x = length ys -> Nat.R_nat_lt (length xs) x with
| R_l_len n m pf' => fun pf_eq => match eq_sym pf_eq in _ = x return Nat.R_nat_lt (length n) x with
| refl_equal => Nat.R_lt pf'
end
end pfls) _ eq_refl
end pfls).
clear - pf; abstract (inversion pf; subst; simpl in *; inversion H).
Defined. 🛠️ 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 6.0MiB file on GitHub Actions Artifacts under
|
c448b1e
to
2152508
Compare
2152508
to
8c0a681
Compare
@coqbot run full ci |
@coqbot run full ci |
3b4944d
to
6f2a108
Compare
@coqbot run full ci |
What is "J"? Perhaps you could add some documentation and explain the benefit to users in basic terms. Offhand I can't tell whether this has broad benefits for users or if it's very specialized. |
J is the name of the induction principle for eq (also known as I or Id or the Identity type) in the academic literature. This pr makes rewriting more general (for example, I believe without it, eq must be an inductive type, whereas with this pr, it can be an axiom or module parameter) |
@jfehrle I will explain more when the PR will be ready, but one point is also to stop relying on |
Marking the PR as draft, given that it is not ready yet. |
@coqbot run full ci |
This PR has a mechanism to rewrite with any equality satisfying reflexivity and the J based typeclass inference.